Skip to main content

jacquard_api/network_slices/slice/
start_sync.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: network.slices.slice.startSync
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
14use jacquard_common::deps::smol_str::SmolStr;
15use jacquard_common::types::string::{Did, Nsid};
16use jacquard_common::types::value::Data;
17use jacquard_derive::IntoStatic;
18use serde::{Serialize, Deserialize};
19
20#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
21#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
22pub struct StartSync<S: BosStr = DefaultStr> {
23    ///List of collection NSIDs to sync (primary collections matching slice domain)
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub collections: Option<Vec<Nsid<S>>>,
26    ///List of external collection NSIDs to sync (collections outside slice domain)
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub external_collections: Option<Vec<Nsid<S>>>,
29    ///Maximum number of records to sync per repository
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub limit_per_repo: Option<i64>,
32    ///List of specific repository DIDs to sync from
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub repos: Option<Vec<Did<S>>>,
35    ///Skip lexicon validation during sync  Defaults to `false`.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    #[serde(default = "_default_start_sync_skip_validation")]
38    pub skip_validation: Option<bool>,
39    ///AT-URI of the slice to sync data into
40    pub slice: S,
41    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
42    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
43}
44
45
46#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
47#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
48pub struct StartSyncOutput<S: BosStr = DefaultStr> {
49    ///UUID of the enqueued sync job
50    pub job_id: S,
51    ///Success message confirming job enqueue
52    pub message: S,
53    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
54    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
55}
56
57/** Response marker for the `network.slices.slice.startSync` procedure.
58
59Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `StartSyncOutput<S>` for this endpoint.*/
60pub struct StartSyncResponse;
61impl jacquard_common::xrpc::XrpcResp for StartSyncResponse {
62    const NSID: &'static str = "network.slices.slice.startSync";
63    const ENCODING: &'static str = "application/json";
64    type Output<S: BosStr> = StartSyncOutput<S>;
65    type Err = jacquard_common::xrpc::GenericError;
66}
67
68impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for StartSync<S> {
69    const NSID: &'static str = "network.slices.slice.startSync";
70    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
71        "application/json",
72    );
73    type Response = StartSyncResponse;
74}
75
76/** Endpoint marker for the `network.slices.slice.startSync` procedure.
77
78Path: `/xrpc/network.slices.slice.startSync`. The request payload type is `StartSync<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
79pub struct StartSyncRequest;
80impl jacquard_common::xrpc::XrpcEndpoint for StartSyncRequest {
81    const PATH: &'static str = "/xrpc/network.slices.slice.startSync";
82    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
83        "application/json",
84    );
85    type Request<S: BosStr> = StartSync<S>;
86    type Response = StartSyncResponse;
87}
88
89fn _default_start_sync_skip_validation() -> Option<bool> {
90    Some(false)
91}