Something went wrong. Try again.
Something went wrong. Try again.
6.0 kB · 149 lines
Rust
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149// @generated by jacquard-lexicon. DO NOT EDIT.//// Lexicon: tools.ozone.queue.createQueue//// This file was automatically generated from Lexicon schemas.// Any manual changes will be overwritten on the next regeneration.
#[allow(unused_imports)]use alloc::collections::BTreeMap;
#[allow(unused_imports)]use core::marker::PhantomData;use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};use jacquard_common::deps::smol_str::SmolStr;use jacquard_common::types::string::Nsid;use jacquard_common::types::value::Data;use jacquard_derive::{IntoStatic, open_union};use serde::{Serialize, Deserialize};use crate::tools_ozone::queue::QueueView;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct CreateQueue<S: BosStr = DefaultStr> { ///Match any of these tags on the account that is being reported against. #[serde(skip_serializing_if = "Option::is_none")] pub account_tags: Option<Vec<S>>, ///Collection name for record subjects. Omit to accept every collection. #[serde(skip_serializing_if = "Option::is_none")] pub collection: Option<Nsid<S>>, ///Optional description of the queue #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<S>, ///Display name for the queue (must be unique) pub name: S, ///Labels to recommend for this queue and use as fallback appeal routing mappings #[serde(skip_serializing_if = "Option::is_none")] pub recommended_labels: Option<Vec<S>>, ///Policy keys to recommend when actioning reports in this queue #[serde(skip_serializing_if = "Option::is_none")] pub recommended_policies: Option<Vec<S>>, ///Report reason types (fully qualified NSIDs) #[serde(skip_serializing_if = "Option::is_none")] pub report_types: Option<Vec<S>>, ///Match any listed tag on the account submitting the report. #[serde(skip_serializing_if = "Option::is_none")] pub reporter_tags: Option<Vec<S>>, ///Admins can always list this queue and browse its reports. Other roles require an active queue assignment. Individual report and moderation event access is unchanged. #[serde(skip_serializing_if = "Option::is_none")] pub strict_access: Option<bool>, ///Subject types this queue accepts #[serde(skip_serializing_if = "Option::is_none")] pub subject_types: Option<Vec<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 CreateQueueOutput<S: BosStr = DefaultStr> { pub queue: QueueView<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, thiserror::Error, miette::Diagnostic)]
#[serde(tag = "error", content = "message")]pub enum CreateQueueError { /// One or more recommended policy keys do not exist in the configured policy list #[serde(rename = "InvalidRecommendedPolicies")] InvalidRecommendedPolicies(Option<SmolStr>), /// The queue configuration conflicts with an existing queue #[serde(rename = "ConflictingQueue")] ConflictingQueue(Option<SmolStr>), /// Catch-all for unknown error codes. #[serde(untagged)] Other { error: SmolStr, message: Option<SmolStr> },}
impl core::fmt::Display for CreateQueueError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::InvalidRecommendedPolicies(msg) => { write!(f, "InvalidRecommendedPolicies")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::ConflictingQueue(msg) => { write!(f, "ConflictingQueue")?; 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(()) } } }}
/** Response marker for the `tools.ozone.queue.createQueue` procedure.
Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `CreateQueueOutput<S>` for this endpoint.*/pub struct CreateQueueResponse;impl jacquard_common::xrpc::XrpcResp for CreateQueueResponse { const NSID: &'static str = "tools.ozone.queue.createQueue"; const ENCODING: &'static str = "application/json"; type Output<S: BosStr> = CreateQueueOutput<S>; type Err = CreateQueueError;}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for CreateQueue<S> { const NSID: &'static str = "tools.ozone.queue.createQueue"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = CreateQueueResponse;}
/** Endpoint marker for the `tools.ozone.queue.createQueue` procedure.
Path: `/xrpc/tools.ozone.queue.createQueue`. The request payload type is `CreateQueue<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/pub struct CreateQueueRequest;impl jacquard_common::xrpc::XrpcEndpoint for CreateQueueRequest { const PATH: &'static str = "/xrpc/tools.ozone.queue.createQueue"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<S: BosStr> = CreateQueue<S>; type Response = CreateQueueResponse;}