pub mod add_secret;
pub mod archive;
pub mod artifact;
pub mod blob;
pub mod branch;
pub mod branches;
pub mod collaborator;
pub mod compare;
pub mod create;
pub mod delete;
pub mod delete_branch;
pub mod diff;
pub mod fork_status;
pub mod fork_sync;
pub mod get_default_branch;
pub mod hidden_ref;
pub mod issue;
pub mod languages;
pub mod list_secrets;
pub mod log;
pub mod merge;
pub mod merge_check;
pub mod pull;
pub mod remove_secret;
pub mod set_default_branch;
pub mod tag;
pub mod tags;
pub mod tree;
#[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::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Repo<'a> {
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub description: Option<CowStr<'a>>,
#[serde(borrow)]
pub knot: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub labels: Option<Vec<AtUri<'a>>>,
#[serde(borrow)]
pub name: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub source: Option<UriValue<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub spindle: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub topics: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub website: Option<UriValue<'a>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RepoGetRecordOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub cid: Option<Cid<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(borrow)]
pub value: Repo<'a>,
}
impl<'a> Repo<'a> {
pub fn uri(
uri: impl Into<CowStr<'a>>,
) -> Result<RecordUri<'a, RepoRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RepoRecord;
impl XrpcResp for RepoRecord {
const NSID: &'static str = "sh.tangled.repo";
const ENCODING: &'static str = "application/json";
type Output<'de> = RepoGetRecordOutput<'de>;
type Err<'de> = RecordError<'de>;
}
impl From<RepoGetRecordOutput<'_>> for Repo<'_> {
fn from(output: RepoGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl Collection for Repo<'_> {
const NSID: &'static str = "sh.tangled.repo";
type Record = RepoRecord;
}
impl Collection for RepoRecord {
const NSID: &'static str = "sh.tangled.repo";
type Record = RepoRecord;
}
impl<'a> LexiconSchema for Repo<'a> {
fn nsid() -> &'static str {
"sh.tangled.repo"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_tangled_repo()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.description {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 140usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("description"),
max: 140usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.description {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count < 1usize {
return Err(ConstraintError::MinGraphemes {
path: ValidationPath::from_field("description"),
min: 1usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.topics {
#[allow(unused_comparisons)]
if value.len() > 50usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("topics"),
max: 50usize,
actual: value.len(),
});
}
}
Ok(())
}
}
pub mod repo_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 CreatedAt;
type Knot;
type Name;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Knot = Unset;
type Name = Unset;
}
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 CreatedAt = Set<members::created_at>;
type Knot = S::Knot;
type Name = S::Name;
}
pub struct SetKnot<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetKnot<S> {}
impl<S: State> State for SetKnot<S> {
type CreatedAt = S::CreatedAt;
type Knot = Set<members::knot>;
type Name = S::Name;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type CreatedAt = S::CreatedAt;
type Knot = S::Knot;
type Name = Set<members::name>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct knot(());
pub struct name(());
}
}
pub struct RepoBuilder<'a, S: repo_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Datetime>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<Vec<AtUri<'a>>>,
Option<CowStr<'a>>,
Option<UriValue<'a>>,
Option<CowStr<'a>>,
Option<Vec<CowStr<'a>>>,
Option<UriValue<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Repo<'a> {
pub fn new() -> RepoBuilder<'a, repo_state::Empty> {
RepoBuilder::new()
}
}
impl<'a> RepoBuilder<'a, repo_state::Empty> {
pub fn new() -> Self {
RepoBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::CreatedAt: repo_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> RepoBuilder<'a, repo_state::SetCreatedAt<S>> {
self._fields.0 = Option::Some(value.into());
RepoBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn description(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::Knot: repo_state::IsUnset,
{
pub fn knot(
mut self,
value: impl Into<CowStr<'a>>,
) -> RepoBuilder<'a, repo_state::SetKnot<S>> {
self._fields.2 = Option::Some(value.into());
RepoBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn labels(mut self, value: impl Into<Option<Vec<AtUri<'a>>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_labels(mut self, value: Option<Vec<AtUri<'a>>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::Name: repo_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> RepoBuilder<'a, repo_state::SetName<S>> {
self._fields.4 = Option::Some(value.into());
RepoBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn source(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_source(mut self, value: Option<UriValue<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn spindle(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_spindle(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn topics(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_topics(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn website(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_website(mut self, value: Option<UriValue<'a>>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::CreatedAt: repo_state::IsSet,
S::Knot: repo_state::IsSet,
S::Name: repo_state::IsSet,
{
pub fn build(self) -> Repo<'a> {
Repo {
created_at: self._fields.0.unwrap(),
description: self._fields.1,
knot: self._fields.2.unwrap(),
labels: self._fields.3,
name: self._fields.4.unwrap(),
source: self._fields.5,
spindle: self._fields.6,
topics: self._fields.7,
website: self._fields.8,
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>,
>,
) -> Repo<'a> {
Repo {
created_at: self._fields.0.unwrap(),
description: self._fields.1,
knot: self._fields.2.unwrap(),
labels: self._fields.3,
name: self._fields.4.unwrap(),
source: self._fields.5,
spindle: self._fields.6,
topics: self._fields.7,
website: self._fields.8,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_tangled_repo() -> 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("sh.tangled.repo"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("name"), SmolStr::new_static("knot"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString {
min_graphemes: Some(1usize),
max_graphemes: Some(140usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("knot"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("knot where the repo was created"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labels"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"List of labels that this repo subscribes to",
),
),
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("name of the repo")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("source"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("source of the repo")),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("spindle"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"CI runner to send jobs to and receive results from",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("topics"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Topics related to the repo"),
),
items: LexArrayItem::String(LexString {
min_length: Some(1usize),
max_length: Some(50usize),
..Default::default()
}),
max_length: Some(50usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("website"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Any URI related to the repo"),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}
}