#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{Did, AtUri};
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::io_atcr::hold::notify_manifest;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct BlobInfo<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub digest: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ChildManifestInfo<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub digest: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub media_type: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub platform: Option<notify_manifest::PlatformInfo<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LayerInfo<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub digest: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub media_type: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct NotifyManifest<'a> {
#[serde(borrow)]
pub manifest: notify_manifest::ManifestInfo<'a>,
#[serde(borrow)]
pub manifest_digest: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub operation: Option<NotifyManifestOperation<'a>>,
#[serde(borrow)]
pub repository: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tag: Option<CowStr<'a>>,
#[serde(borrow)]
pub user_did: Did<'a>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum NotifyManifestOperation<'a> {
Push,
Pull,
Other(CowStr<'a>),
}
impl<'a> NotifyManifestOperation<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Push => "push",
Self::Pull => "pull",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for NotifyManifestOperation<'a> {
fn from(s: &'a str) -> Self {
match s {
"push" => Self::Push,
"pull" => Self::Pull,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for NotifyManifestOperation<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"push" => Self::Push,
"pull" => Self::Pull,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for NotifyManifestOperation<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for NotifyManifestOperation<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for NotifyManifestOperation<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for NotifyManifestOperation<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for NotifyManifestOperation<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for NotifyManifestOperation<'_> {
type Output = NotifyManifestOperation<'static>;
fn into_static(self) -> Self::Output {
match self {
NotifyManifestOperation::Push => NotifyManifestOperation::Push,
NotifyManifestOperation::Pull => NotifyManifestOperation::Pull,
NotifyManifestOperation::Other(v) => {
NotifyManifestOperation::Other(v.into_static())
}
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct NotifyManifestOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub layers_created: Option<i64>,
#[serde(borrow)]
pub operation: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub post_created: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub post_uri: Option<AtUri<'a>>,
pub stats_updated: bool,
pub success: bool,
}
#[open_union]
#[derive(
Serialize,
Deserialize,
Debug,
Clone,
PartialEq,
Eq,
thiserror::Error,
miette::Diagnostic,
IntoStatic
)]
#[serde(tag = "error", content = "message")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum NotifyManifestError<'a> {
#[serde(rename = "InvalidOperation")]
InvalidOperation(Option<CowStr<'a>>),
#[serde(rename = "UserMismatch")]
UserMismatch(Option<CowStr<'a>>),
#[serde(rename = "QuotaExceeded")]
QuotaExceeded(Option<CowStr<'a>>),
}
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::Unknown(err) => write!(f, "Unknown error: {:?}", err),
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ManifestInfo<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub config: Option<notify_manifest::BlobInfo<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub layers: Option<Vec<notify_manifest::LayerInfo<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub manifests: Option<Vec<notify_manifest::ChildManifestInfo<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub media_type: Option<CowStr<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct PlatformInfo<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub architecture: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub os: Option<CowStr<'a>>,
}
impl<'a> LexiconSchema for BlobInfo<'a> {
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<'a> LexiconSchema for ChildManifestInfo<'a> {
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<'a> LexiconSchema for LayerInfo<'a> {
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<'de> = NotifyManifestOutput<'de>;
type Err<'de> = NotifyManifestError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for NotifyManifest<'a> {
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<'de> = NotifyManifest<'de>;
type Response = NotifyManifestResponse;
}
impl<'a> LexiconSchema for ManifestInfo<'a> {
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<'a> LexiconSchema for PlatformInfo<'a> {
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> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
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::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Manifest;
type Repository;
type UserDid;
type ManifestDigest;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Manifest = Unset;
type Repository = Unset;
type UserDid = Unset;
type ManifestDigest = Unset;
}
pub struct SetManifest<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetManifest<S> {}
impl<S: State> State for SetManifest<S> {
type Manifest = Set<members::manifest>;
type Repository = S::Repository;
type UserDid = S::UserDid;
type ManifestDigest = S::ManifestDigest;
}
pub struct SetRepository<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRepository<S> {}
impl<S: State> State for SetRepository<S> {
type Manifest = S::Manifest;
type Repository = Set<members::repository>;
type UserDid = S::UserDid;
type ManifestDigest = S::ManifestDigest;
}
pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUserDid<S> {}
impl<S: State> State for SetUserDid<S> {
type Manifest = S::Manifest;
type Repository = S::Repository;
type UserDid = Set<members::user_did>;
type ManifestDigest = S::ManifestDigest;
}
pub struct SetManifestDigest<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetManifestDigest<S> {}
impl<S: State> State for SetManifestDigest<S> {
type Manifest = S::Manifest;
type Repository = S::Repository;
type UserDid = S::UserDid;
type ManifestDigest = Set<members::manifest_digest>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct manifest(());
pub struct repository(());
pub struct user_did(());
pub struct manifest_digest(());
}
}
pub struct NotifyManifestBuilder<'a, S: notify_manifest_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<notify_manifest::ManifestInfo<'a>>,
Option<CowStr<'a>>,
Option<NotifyManifestOperation<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<Did<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> NotifyManifest<'a> {
pub fn new() -> NotifyManifestBuilder<'a, notify_manifest_state::Empty> {
NotifyManifestBuilder::new()
}
}
impl<'a> NotifyManifestBuilder<'a, notify_manifest_state::Empty> {
pub fn new() -> Self {
NotifyManifestBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotifyManifestBuilder<'a, S>
where
S: notify_manifest_state::State,
S::Manifest: notify_manifest_state::IsUnset,
{
pub fn manifest(
mut self,
value: impl Into<notify_manifest::ManifestInfo<'a>>,
) -> NotifyManifestBuilder<'a, notify_manifest_state::SetManifest<S>> {
self._fields.0 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotifyManifestBuilder<'a, S>
where
S: notify_manifest_state::State,
S::ManifestDigest: notify_manifest_state::IsUnset,
{
pub fn manifest_digest(
mut self,
value: impl Into<CowStr<'a>>,
) -> NotifyManifestBuilder<'a, notify_manifest_state::SetManifestDigest<S>> {
self._fields.1 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: notify_manifest_state::State> NotifyManifestBuilder<'a, S> {
pub fn operation(
mut self,
value: impl Into<Option<NotifyManifestOperation<'a>>>,
) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_operation(
mut self,
value: Option<NotifyManifestOperation<'a>>,
) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> NotifyManifestBuilder<'a, S>
where
S: notify_manifest_state::State,
S::Repository: notify_manifest_state::IsUnset,
{
pub fn repository(
mut self,
value: impl Into<CowStr<'a>>,
) -> NotifyManifestBuilder<'a, notify_manifest_state::SetRepository<S>> {
self._fields.3 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: notify_manifest_state::State> NotifyManifestBuilder<'a, S> {
pub fn tag(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_tag(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S> NotifyManifestBuilder<'a, S>
where
S: notify_manifest_state::State,
S::UserDid: notify_manifest_state::IsUnset,
{
pub fn user_did(
mut self,
value: impl Into<Did<'a>>,
) -> NotifyManifestBuilder<'a, notify_manifest_state::SetUserDid<S>> {
self._fields.5 = Option::Some(value.into());
NotifyManifestBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotifyManifestBuilder<'a, S>
where
S: notify_manifest_state::State,
S::Manifest: notify_manifest_state::IsSet,
S::Repository: notify_manifest_state::IsSet,
S::UserDid: notify_manifest_state::IsSet,
S::ManifestDigest: notify_manifest_state::IsSet,
{
pub fn build(self) -> NotifyManifest<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> NotifyManifest<'a> {
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),
}
}
}