reduct_base/msg/
query_link_api.rs

1// Copyright 2025 ReductSoftware UG
2// This Source Code Form is subject to the terms of the Mozilla Public
3//    License, v. 2.0. If a copy of the MPL was not distributed with this
4//    file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
6use crate::msg::entry_api::QueryEntry;
7use chrono::serde::ts_seconds::deserialize as as_ts;
8use chrono::serde::ts_seconds::serialize as to_ts;
9use chrono::{DateTime, Utc};
10use serde::{Deserialize, Serialize};
11
12#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
13/// Request to create a query link for sharing
14pub struct QueryLinkCreateRequest {
15    /// Bucket name
16    pub bucket: String,
17    /// Entry name
18    pub entry: String,
19    /// Record index
20    pub index: 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}