#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{Datetime, Nsid};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::network_slices::slice::get_job_status;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct JobStatus<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub completed_at: Option<Datetime>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<S>,
pub job_id: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub result: Option<get_job_status::SyncJobResult<S>>,
pub retry_count: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub started_at: Option<Datetime>,
pub status: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetJobStatus<S: BosStr = DefaultStr> {
pub job_id: S,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetJobStatusOutput<S: BosStr = DefaultStr> {
#[serde(flatten)]
pub value: Data<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct SyncJobResult<S: BosStr = DefaultStr> {
pub collections_synced: Vec<Nsid<S>>,
pub message: S,
pub repos_processed: i64,
pub success: bool,
pub total_records: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for JobStatus<S> {
fn nsid() -> &'static str {
"network.slices.slice.getJobStatus"
}
fn def_name() -> &'static str {
"jobStatus"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_network_slices_slice_getJobStatus()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub struct GetJobStatusResponse;
impl jacquard_common::xrpc::XrpcResp for GetJobStatusResponse {
const NSID: &'static str = "network.slices.slice.getJobStatus";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetJobStatusOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetJobStatus<S> {
const NSID: &'static str = "network.slices.slice.getJobStatus";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetJobStatusResponse;
}
pub struct GetJobStatusRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetJobStatusRequest {
const PATH: &'static str = "/xrpc/network.slices.slice.getJobStatus";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetJobStatus<S>;
type Response = GetJobStatusResponse;
}
impl<S: BosStr> LexiconSchema for SyncJobResult<S> {
fn nsid() -> &'static str {
"network.slices.slice.getJobStatus"
}
fn def_name() -> &'static str {
"syncJobResult"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_network_slices_slice_getJobStatus()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod job_status_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Status;
type RetryCount;
type CreatedAt;
type JobId;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Status = Unset;
type RetryCount = Unset;
type CreatedAt = Unset;
type JobId = Unset;
}
pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatus<St> {}
impl<St: State> State for SetStatus<St> {
type Status = Set<members::status>;
type RetryCount = St::RetryCount;
type CreatedAt = St::CreatedAt;
type JobId = St::JobId;
}
pub struct SetRetryCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRetryCount<St> {}
impl<St: State> State for SetRetryCount<St> {
type Status = St::Status;
type RetryCount = Set<members::retry_count>;
type CreatedAt = St::CreatedAt;
type JobId = St::JobId;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type Status = St::Status;
type RetryCount = St::RetryCount;
type CreatedAt = Set<members::created_at>;
type JobId = St::JobId;
}
pub struct SetJobId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetJobId<St> {}
impl<St: State> State for SetJobId<St> {
type Status = St::Status;
type RetryCount = St::RetryCount;
type CreatedAt = St::CreatedAt;
type JobId = Set<members::job_id>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct status(());
pub struct retry_count(());
pub struct created_at(());
pub struct job_id(());
}
}
pub struct JobStatusBuilder<S: BosStr, St: job_status_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Datetime>,
Option<Datetime>,
Option<S>,
Option<S>,
Option<get_job_status::SyncJobResult<S>>,
Option<i64>,
Option<Datetime>,
Option<S>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> JobStatus<S> {
pub fn new() -> JobStatusBuilder<S, job_status_state::Empty> {
JobStatusBuilder::new()
}
}
impl<S: BosStr> JobStatusBuilder<S, job_status_state::Empty> {
pub fn new() -> Self {
JobStatusBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: job_status_state::State> JobStatusBuilder<S, St> {
pub fn completed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_completed_at(mut self, value: Option<Datetime>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> JobStatusBuilder<S, St>
where
St: job_status_state::State,
St::CreatedAt: job_status_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> JobStatusBuilder<S, job_status_state::SetCreatedAt<St>> {
self._fields.1 = Option::Some(value.into());
JobStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: job_status_state::State> JobStatusBuilder<S, St> {
pub fn error(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_error(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> JobStatusBuilder<S, St>
where
St: job_status_state::State,
St::JobId: job_status_state::IsUnset,
{
pub fn job_id(
mut self,
value: impl Into<S>,
) -> JobStatusBuilder<S, job_status_state::SetJobId<St>> {
self._fields.3 = Option::Some(value.into());
JobStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: job_status_state::State> JobStatusBuilder<S, St> {
pub fn result(mut self, value: impl Into<Option<get_job_status::SyncJobResult<S>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_result(mut self, value: Option<get_job_status::SyncJobResult<S>>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St> JobStatusBuilder<S, St>
where
St: job_status_state::State,
St::RetryCount: job_status_state::IsUnset,
{
pub fn retry_count(
mut self,
value: impl Into<i64>,
) -> JobStatusBuilder<S, job_status_state::SetRetryCount<St>> {
self._fields.5 = Option::Some(value.into());
JobStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: job_status_state::State> JobStatusBuilder<S, St> {
pub fn started_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_started_at(mut self, value: Option<Datetime>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> JobStatusBuilder<S, St>
where
St: job_status_state::State,
St::Status: job_status_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<S>,
) -> JobStatusBuilder<S, job_status_state::SetStatus<St>> {
self._fields.7 = Option::Some(value.into());
JobStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> JobStatusBuilder<S, St>
where
St: job_status_state::State,
St::Status: job_status_state::IsSet,
St::RetryCount: job_status_state::IsSet,
St::CreatedAt: job_status_state::IsSet,
St::JobId: job_status_state::IsSet,
{
pub fn build(self) -> JobStatus<S> {
JobStatus {
completed_at: self._fields.0,
created_at: self._fields.1.unwrap(),
error: self._fields.2,
job_id: self._fields.3.unwrap(),
result: self._fields.4,
retry_count: self._fields.5.unwrap(),
started_at: self._fields.6,
status: self._fields.7.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> JobStatus<S> {
JobStatus {
completed_at: self._fields.0,
created_at: self._fields.1.unwrap(),
error: self._fields.2,
job_id: self._fields.3.unwrap(),
result: self._fields.4,
retry_count: self._fields.5.unwrap(),
started_at: self._fields.6,
status: self._fields.7.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_network_slices_slice_getJobStatus() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("network.slices.slice.getJobStatus"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("jobStatus"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("jobId"),
SmolStr::new_static("status"),
SmolStr::new_static("createdAt"),
SmolStr::new_static("retryCount"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("completedAt"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("When the job completed")),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("When the job was created")),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("error"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Error message if job failed",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("jobId"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("UUID of the job")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("result"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#syncJobResult"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("retryCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("startedAt"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"When the job started executing",
)),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Current status of the job")),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![SmolStr::new_static("jobId")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("jobId"),
LexXrpcParametersProperty::String(LexString {
description: Some(CowStr::new_static("UUID of the sync job")),
..Default::default()
}),
);
map
},
..Default::default()
})),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("syncJobResult"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("success"),
SmolStr::new_static("totalRecords"),
SmolStr::new_static("collectionsSynced"),
SmolStr::new_static("reposProcessed"),
SmolStr::new_static("message"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("collectionsSynced"),
LexObjectProperty::Array(LexArray {
description: Some(CowStr::new_static(
"List of collection NSIDs that were synced",
)),
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::Nsid),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("message"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Human-readable message about the job completion",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reposProcessed"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("success"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("totalRecords"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod get_job_status_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type JobId;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type JobId = Unset;
}
pub struct SetJobId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetJobId<St> {}
impl<St: State> State for SetJobId<St> {
type JobId = Set<members::job_id>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct job_id(());
}
}
pub struct GetJobStatusBuilder<S: BosStr, St: get_job_status_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetJobStatus<S> {
pub fn new() -> GetJobStatusBuilder<S, get_job_status_state::Empty> {
GetJobStatusBuilder::new()
}
}
impl<S: BosStr> GetJobStatusBuilder<S, get_job_status_state::Empty> {
pub fn new() -> Self {
GetJobStatusBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetJobStatusBuilder<S, St>
where
St: get_job_status_state::State,
St::JobId: get_job_status_state::IsUnset,
{
pub fn job_id(
mut self,
value: impl Into<S>,
) -> GetJobStatusBuilder<S, get_job_status_state::SetJobId<St>> {
self._fields.0 = Option::Some(value.into());
GetJobStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetJobStatusBuilder<S, St>
where
St: get_job_status_state::State,
St::JobId: get_job_status_state::IsSet,
{
pub fn build(self) -> GetJobStatus<S> {
GetJobStatus {
job_id: self._fields.0.unwrap(),
}
}
}
pub mod sync_job_result_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Message;
type Success;
type TotalRecords;
type CollectionsSynced;
type ReposProcessed;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Message = Unset;
type Success = Unset;
type TotalRecords = Unset;
type CollectionsSynced = Unset;
type ReposProcessed = Unset;
}
pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMessage<St> {}
impl<St: State> State for SetMessage<St> {
type Message = Set<members::message>;
type Success = St::Success;
type TotalRecords = St::TotalRecords;
type CollectionsSynced = St::CollectionsSynced;
type ReposProcessed = St::ReposProcessed;
}
pub struct SetSuccess<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSuccess<St> {}
impl<St: State> State for SetSuccess<St> {
type Message = St::Message;
type Success = Set<members::success>;
type TotalRecords = St::TotalRecords;
type CollectionsSynced = St::CollectionsSynced;
type ReposProcessed = St::ReposProcessed;
}
pub struct SetTotalRecords<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTotalRecords<St> {}
impl<St: State> State for SetTotalRecords<St> {
type Message = St::Message;
type Success = St::Success;
type TotalRecords = Set<members::total_records>;
type CollectionsSynced = St::CollectionsSynced;
type ReposProcessed = St::ReposProcessed;
}
pub struct SetCollectionsSynced<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCollectionsSynced<St> {}
impl<St: State> State for SetCollectionsSynced<St> {
type Message = St::Message;
type Success = St::Success;
type TotalRecords = St::TotalRecords;
type CollectionsSynced = Set<members::collections_synced>;
type ReposProcessed = St::ReposProcessed;
}
pub struct SetReposProcessed<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReposProcessed<St> {}
impl<St: State> State for SetReposProcessed<St> {
type Message = St::Message;
type Success = St::Success;
type TotalRecords = St::TotalRecords;
type CollectionsSynced = St::CollectionsSynced;
type ReposProcessed = Set<members::repos_processed>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct message(());
pub struct success(());
pub struct total_records(());
pub struct collections_synced(());
pub struct repos_processed(());
}
}
pub struct SyncJobResultBuilder<S: BosStr, St: sync_job_result_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<Nsid<S>>>,
Option<S>,
Option<i64>,
Option<bool>,
Option<i64>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SyncJobResult<S> {
pub fn new() -> SyncJobResultBuilder<S, sync_job_result_state::Empty> {
SyncJobResultBuilder::new()
}
}
impl<S: BosStr> SyncJobResultBuilder<S, sync_job_result_state::Empty> {
pub fn new() -> Self {
SyncJobResultBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncJobResultBuilder<S, St>
where
St: sync_job_result_state::State,
St::CollectionsSynced: sync_job_result_state::IsUnset,
{
pub fn collections_synced(
mut self,
value: impl Into<Vec<Nsid<S>>>,
) -> SyncJobResultBuilder<S, sync_job_result_state::SetCollectionsSynced<St>> {
self._fields.0 = Option::Some(value.into());
SyncJobResultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncJobResultBuilder<S, St>
where
St: sync_job_result_state::State,
St::Message: sync_job_result_state::IsUnset,
{
pub fn message(
mut self,
value: impl Into<S>,
) -> SyncJobResultBuilder<S, sync_job_result_state::SetMessage<St>> {
self._fields.1 = Option::Some(value.into());
SyncJobResultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncJobResultBuilder<S, St>
where
St: sync_job_result_state::State,
St::ReposProcessed: sync_job_result_state::IsUnset,
{
pub fn repos_processed(
mut self,
value: impl Into<i64>,
) -> SyncJobResultBuilder<S, sync_job_result_state::SetReposProcessed<St>> {
self._fields.2 = Option::Some(value.into());
SyncJobResultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncJobResultBuilder<S, St>
where
St: sync_job_result_state::State,
St::Success: sync_job_result_state::IsUnset,
{
pub fn success(
mut self,
value: impl Into<bool>,
) -> SyncJobResultBuilder<S, sync_job_result_state::SetSuccess<St>> {
self._fields.3 = Option::Some(value.into());
SyncJobResultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncJobResultBuilder<S, St>
where
St: sync_job_result_state::State,
St::TotalRecords: sync_job_result_state::IsUnset,
{
pub fn total_records(
mut self,
value: impl Into<i64>,
) -> SyncJobResultBuilder<S, sync_job_result_state::SetTotalRecords<St>> {
self._fields.4 = Option::Some(value.into());
SyncJobResultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncJobResultBuilder<S, St>
where
St: sync_job_result_state::State,
St::Message: sync_job_result_state::IsSet,
St::Success: sync_job_result_state::IsSet,
St::TotalRecords: sync_job_result_state::IsSet,
St::CollectionsSynced: sync_job_result_state::IsSet,
St::ReposProcessed: sync_job_result_state::IsSet,
{
pub fn build(self) -> SyncJobResult<S> {
SyncJobResult {
collections_synced: self._fields.0.unwrap(),
message: self._fields.1.unwrap(),
repos_processed: self._fields.2.unwrap(),
success: self._fields.3.unwrap(),
total_records: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> SyncJobResult<S> {
SyncJobResult {
collections_synced: self._fields.0.unwrap(),
message: self._fields.1.unwrap(),
repos_processed: self._fields.2.unwrap(),
success: self._fields.3.unwrap(),
total_records: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}