Skip to main content

reduct_base/msg/
query_link_api.rs

1// Copyright 2021-2026 ReductSoftware UG
2// Licensed under the Apache License, Version 2.0
3
4use crate::msg::entry_api::QueryEntry;
5use chrono::serde::ts_seconds::deserialize as as_ts;
6use chrono::serde::ts_seconds::serialize as to_ts;
7use chrono::{DateTime, Utc};
8use serde::{Deserialize, Serialize};
9
10#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
11/// Request to create a query link for sharing
12pub struct QueryLinkCreateRequest {
13    /// Bucket name
14    pub bucket: String,
15    /// Entry name (since v1.18 used for backward compatibility)
16    pub entry: String,
17    /// Exact record entry name for stable preview resolution (optional)
18    pub record_entry: Option<String>,
19    /// Exact record timestamp for stable preview resolution (optional)
20    pub record_timestamp: Option<u64>,
21    /// Query to share
22    pub query: QueryEntry,
23    /// Expiration time
24    #[serde(deserialize_with = "as_ts", serialize_with = "to_ts")]
25    pub expire_at: DateTime<Utc>,
26    ///  Optimal base URL for the link (optional)
27    pub base_url: Option<String>,
28}
29
30#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
31/// Response with created query link
32pub struct QueryLinkCreateResponse {
33    /// Link to access the query
34    pub link: String,
35}