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