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