#[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::{AtUri, Did};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::io_atcr::hold::notify_manifest;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct BlobInfo<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub digest: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
#[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, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ChildManifestInfo<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub digest: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub platform: Option<notify_manifest::PlatformInfo<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
#[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, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct LayerInfo<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub digest: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
#[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 NotifyManifest<S: BosStr = DefaultStr> {
pub manifest: notify_manifest::ManifestInfo<S>,
pub manifest_digest: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub operation: Option<NotifyManifestOperation<S>>,
pub repository: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub tag: Option<S>,
pub user_did: Did<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum NotifyManifestOperation<S: BosStr = DefaultStr> {
Push,
Pull,
Other(S),
}
impl<S: BosStr> NotifyManifestOperation<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Push => "push",
Self::Pull => "pull",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"push" => Self::Push,
"pull" => Self::Pull,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for NotifyManifestOperation<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for NotifyManifestOperation<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for NotifyManifestOperation<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for NotifyManifestOperation<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for NotifyManifestOperation<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for NotifyManifestOperation<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = NotifyManifestOperation<S::Output>;
fn into_static(self) -> Self::Output {
match self {
NotifyManifestOperation::Push => NotifyManifestOperation::Push,
NotifyManifestOperation::Pull => NotifyManifestOperation::Pull,
NotifyManifestOperation::Other(v) => NotifyManifestOperation::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct NotifyManifestOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub layers_created: Option<i64>,
pub operation: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub post_created: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub post_uri: Option<AtUri<S>>,
pub stats_updated: bool,
pub success: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic,
)]
#[serde(tag = "error", content = "message")]
pub enum NotifyManifestError {
#[serde(rename = "InvalidOperation")]
InvalidOperation(Option<SmolStr>),
#[serde(rename = "UserMismatch")]
UserMismatch(Option<SmolStr>),
#[serde(rename = "QuotaExceeded")]
QuotaExceeded(Option<SmolStr>),
#[serde(untagged)]
Other {
error: SmolStr,
message: Option<SmolStr>,
},
}
impl core::fmt::Display for NotifyManifestError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InvalidOperation(msg) => {
write!(f, "InvalidOperation")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::UserMismatch(msg) => {
write!(f, "UserMismatch")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::QuotaExceeded(msg) => {
write!(f, "QuotaExceeded")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::Other { error, message } => {
write!(f, "{}", error)?;
if let Some(msg) = message {
write!(f, ": {}", msg)?;
}
Ok(())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ManifestInfo<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub config: Option<notify_manifest::BlobInfo<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub layers: Option<Vec<notify_manifest::LayerInfo<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub manifests: Option<Vec<notify_manifest::ChildManifestInfo<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub media_type: Option<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, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct PlatformInfo<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub architecture: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub os: Option<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for BlobInfo<S> {
fn nsid() -> &'static str {
"io.atcr.hold.notifyManifest"
}
fn def_name() -> &'static str {
"blobInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_atcr_hold_notifyManifest()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.digest {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("digest"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ChildManifestInfo<S> {
fn nsid() -> &'static str {
"io.atcr.hold.notifyManifest"
}
fn def_name() -> &'static str {
"childManifestInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_atcr_hold_notifyManifest()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.digest {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("digest"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.media_type {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("media_type"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for LayerInfo<S> {
fn nsid() -> &'static str {
"io.atcr.hold.notifyManifest"
}
fn def_name() -> &'static str {
"layerInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_atcr_hold_notifyManifest()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.digest {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("digest"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.media_type {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("media_type"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
pub struct NotifyManifestResponse;
impl jacquard_common::xrpc::XrpcResp for NotifyManifestResponse {
const NSID: &'static str = "io.atcr.hold.notifyManifest";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = NotifyManifestOutput<S>;
type Err = NotifyManifestError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for NotifyManifest<S> {
const NSID: &'static str = "io.atcr.hold.notifyManifest";
const METHOD: jacquard_common::xrpc::XrpcMethod =
jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
type Response = NotifyManifestResponse;
}
pub struct NotifyManifestRequest;
impl jacquard_common::xrpc::XrpcEndpoint for NotifyManifestRequest {
const PATH: &'static str = "/xrpc/io.atcr.hold.notifyManifest";
const METHOD: jacquard_common::xrpc::XrpcMethod =
jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
type Request<S: BosStr> = NotifyManifest<S>;
type Response = NotifyManifestResponse;
}
impl<S: BosStr> LexiconSchema for ManifestInfo<S> {
fn nsid() -> &'static str {
"io.atcr.hold.notifyManifest"
}
fn def_name() -> &'static str {
"manifestInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_atcr_hold_notifyManifest()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.media_type {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("media_type"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PlatformInfo<S> {
fn nsid() -> &'static str {
"io.atcr.hold.notifyManifest"
}
fn def_name() -> &'static str {
"platformInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_atcr_hold_notifyManifest()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.architecture {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("architecture"),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.os {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("os"),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
fn lexicon_doc_io_atcr_hold_notifyManifest() -> 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("io.atcr.hold.notifyManifest"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("blobInfo"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("digest"),
LexObjectProperty::String(LexString {
max_length: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("size"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("childManifestInfo"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("digest"),
LexObjectProperty::String(LexString {
max_length: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mediaType"),
LexObjectProperty::String(LexString {
max_length: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("platform"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#platformInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("size"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("layerInfo"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("digest"),
LexObjectProperty::String(LexString {
max_length: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mediaType"),
LexObjectProperty::String(LexString {
max_length: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("size"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcProcedure(LexXrpcProcedure {
input: Some(LexXrpcBody {
encoding: CowStr::new_static("application/json"),
schema: Some(
LexXrpcBodySchema::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("repository"),
SmolStr::new_static("userDid"),
SmolStr::new_static("manifestDigest"),
SmolStr::new_static("manifest")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("manifest"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#manifestInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("manifestDigest"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Manifest digest for building layer record AT-URIs",
),
),
max_length: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("operation"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Operation type (defaults to 'push' for backward compatibility)",
),
),
max_length: Some(16usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repository"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Image repository name"),
),
max_length: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tag"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Image tag (optional, required for Bluesky posts)",
),
),
max_length: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("userDid"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("DID of the image owner"),
),
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("manifestInfo"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("OCI manifest information")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("config"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#blobInfo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("layers"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#layerInfo"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("manifests"),
LexObjectProperty::Array(LexArray {
description: Some(CowStr::new_static(
"Child manifests for multi-arch images",
)),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#childManifestInfo"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mediaType"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("OCI media type")),
max_length: Some(256usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("platformInfo"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("architecture"),
LexObjectProperty::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("os"),
LexObjectProperty::String(LexString {
max_length: Some(64usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod notify_manifest_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 ManifestDigest;
type Manifest;
type UserDid;
type Repository;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type ManifestDigest = Unset;
type Manifest = Unset;
type UserDid = Unset;
type Repository = Unset;
}
pub struct SetManifestDigest<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetManifestDigest<St> {}
impl<St: State> State for SetManifestDigest<St> {
type ManifestDigest = Set<members::manifest_digest>;
type Manifest = St::Manifest;
type UserDid = St::UserDid;
type Repository = St::Repository;
}
pub struct SetManifest<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetManifest<St> {}
impl<St: State> State for SetManifest<St> {
type ManifestDigest = St::ManifestDigest;
type Manifest = Set<members::manifest>;
type UserDid = St::UserDid;
type Repository = St::Repository;
}
pub struct SetUserDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUserDid<St> {}
impl<St: State> State for SetUserDid<St> {
type ManifestDigest = St::ManifestDigest;
type Manifest = St::Manifest;
type UserDid = Set<members::user_did>;
type Repository = St::Repository;
}
pub struct SetRepository<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRepository<St> {}
impl<St: State> State for SetRepository<St> {
type ManifestDigest = St::ManifestDigest;
type Manifest = St::Manifest;
type UserDid = St::UserDid;
type Repository = Set<members::repository>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct manifest_digest(());
pub struct manifest(());
pub struct user_did(());
pub struct repository(());
}
}
pub struct NotifyManifestBuilder<S: BosStr, St: notify_manifest_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<notify_manifest::ManifestInfo<S>>,
Option<S>,
Option<NotifyManifestOperation<S>>,
Option<S>,
Option<S>,
Option<Did<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> NotifyManifest<S> {
pub fn new() -> NotifyManifestBuilder<S, notify_manifest_state::Empty> {
NotifyManifestBuilder::new()
}
}
impl<S: BosStr> NotifyManifestBuilder<S, notify_manifest_state::Empty> {
pub fn new() -> Self {
NotifyManifestBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotifyManifestBuilder<S, St>
where
St: notify_manifest_state::State,
St::Manifest: notify_manifest_state::IsUnset,
{
pub fn manifest(
mut self,
value: impl Into<notify_manifest::ManifestInfo<S>>,
) -> NotifyManifestBuilder<S, notify_manifest_state::SetManifest<St>> {
self._fields.0 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotifyManifestBuilder<S, St>
where
St: notify_manifest_state::State,
St::ManifestDigest: notify_manifest_state::IsUnset,
{
pub fn manifest_digest(
mut self,
value: impl Into<S>,
) -> NotifyManifestBuilder<S, notify_manifest_state::SetManifestDigest<St>> {
self._fields.1 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notify_manifest_state::State> NotifyManifestBuilder<S, St> {
pub fn operation(mut self, value: impl Into<Option<NotifyManifestOperation<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_operation(mut self, value: Option<NotifyManifestOperation<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> NotifyManifestBuilder<S, St>
where
St: notify_manifest_state::State,
St::Repository: notify_manifest_state::IsUnset,
{
pub fn repository(
mut self,
value: impl Into<S>,
) -> NotifyManifestBuilder<S, notify_manifest_state::SetRepository<St>> {
self._fields.3 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notify_manifest_state::State> NotifyManifestBuilder<S, St> {
pub fn tag(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_tag(mut self, value: Option<S>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St> NotifyManifestBuilder<S, St>
where
St: notify_manifest_state::State,
St::UserDid: notify_manifest_state::IsUnset,
{
pub fn user_did(
mut self,
value: impl Into<Did<S>>,
) -> NotifyManifestBuilder<S, notify_manifest_state::SetUserDid<St>> {
self._fields.5 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotifyManifestBuilder<S, St>
where
St: notify_manifest_state::State,
St::ManifestDigest: notify_manifest_state::IsSet,
St::Manifest: notify_manifest_state::IsSet,
St::UserDid: notify_manifest_state::IsSet,
St::Repository: notify_manifest_state::IsSet,
{
pub fn build(self) -> NotifyManifest<S> {
NotifyManifest {
manifest: self._fields.0.unwrap(),
manifest_digest: self._fields.1.unwrap(),
operation: self._fields.2,
repository: self._fields.3.unwrap(),
tag: self._fields.4,
user_did: self._fields.5.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> NotifyManifest<S> {
NotifyManifest {
manifest: self._fields.0.unwrap(),
manifest_digest: self._fields.1.unwrap(),
operation: self._fields.2,
repository: self._fields.3.unwrap(),
tag: self._fields.4,
user_did: self._fields.5.unwrap(),
extra_data: Some(extra_data),
}
}
}