#[allow(unused_imports)]
use progenitor_client::{encode_path, RequestBuilderExt};
pub use progenitor_client::{ByteStream, Error, ResponseValue};
#[allow(unused_imports)]
use reqwest::header::{HeaderMap, HeaderValue};
/// Types used as operation parameters and responses.
pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
///Task
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "name",
/// "output_rules",
/// "script",
/// "state"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// },
/// "name": {
/// "type": "string"
/// },
/// "output_rules": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "script": {
/// "type": "string"
/// },
/// "state": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct Task {
pub id: String,
pub name: String,
pub output_rules: Vec,
pub script: String,
pub state: String,
}
impl From<&Task> for Task {
fn from(value: &Task) -> Self {
value.clone()
}
}
impl Task {
pub fn builder() -> builder::Task {
Default::default()
}
}
///TaskEvent
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "payload",
/// "seq",
/// "stream",
/// "time"
/// ],
/// "properties": {
/// "payload": {
/// "type": "string"
/// },
/// "seq": {
/// "type": "integer",
/// "format": "uint",
/// "minimum": 0.0
/// },
/// "stream": {
/// "type": "string"
/// },
/// "time": {
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct TaskEvent {
pub payload: String,
pub seq: u32,
pub stream: String,
pub time: chrono::DateTime,
}
impl From<&TaskEvent> for TaskEvent {
fn from(value: &TaskEvent) -> Self {
value.clone()
}
}
impl TaskEvent {
pub fn builder() -> builder::TaskEvent {
Default::default()
}
}
///TaskOutput
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "path",
/// "size"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// },
/// "path": {
/// "type": "string"
/// },
/// "size": {
/// "type": "integer",
/// "format": "uint64",
/// "minimum": 0.0
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct TaskOutput {
pub id: String,
pub path: String,
pub size: u64,
}
impl From<&TaskOutput> for TaskOutput {
fn from(value: &TaskOutput) -> Self {
value.clone()
}
}
impl TaskOutput {
pub fn builder() -> builder::TaskOutput {
Default::default()
}
}
///TaskSubmit
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "name",
/// "script"
/// ],
/// "properties": {
/// "name": {
/// "type": "string"
/// },
/// "output_rules": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "script": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct TaskSubmit {
pub name: String,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub output_rules: Vec,
pub script: String,
}
impl From<&TaskSubmit> for TaskSubmit {
fn from(value: &TaskSubmit) -> Self {
value.clone()
}
}
impl TaskSubmit {
pub fn builder() -> builder::TaskSubmit {
Default::default()
}
}
///TaskSubmitResult
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct TaskSubmitResult {
pub id: String,
}
impl From<&TaskSubmitResult> for TaskSubmitResult {
fn from(value: &TaskSubmitResult) -> Self {
value.clone()
}
}
impl TaskSubmitResult {
pub fn builder() -> builder::TaskSubmitResult {
Default::default()
}
}
///UploadedChunk
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct UploadedChunk {
pub id: String,
}
impl From<&UploadedChunk> for UploadedChunk {
fn from(value: &UploadedChunk) -> Self {
value.clone()
}
}
impl UploadedChunk {
pub fn builder() -> builder::UploadedChunk {
Default::default()
}
}
///UserCreate
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "name": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct UserCreate {
pub name: String,
}
impl From<&UserCreate> for UserCreate {
fn from(value: &UserCreate) -> Self {
value.clone()
}
}
impl UserCreate {
pub fn builder() -> builder::UserCreate {
Default::default()
}
}
///UserCreateResult
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "name",
/// "token"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// },
/// "name": {
/// "type": "string"
/// },
/// "token": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct UserCreateResult {
pub id: String,
pub name: String,
pub token: String,
}
impl From<&UserCreateResult> for UserCreateResult {
fn from(value: &UserCreateResult) -> Self {
value.clone()
}
}
impl UserCreateResult {
pub fn builder() -> builder::UserCreateResult {
Default::default()
}
}
///WhoamiResult
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "name"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// },
/// "name": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WhoamiResult {
pub id: String,
pub name: String,
}
impl From<&WhoamiResult> for WhoamiResult {
fn from(value: &WhoamiResult) -> Self {
value.clone()
}
}
impl WhoamiResult {
pub fn builder() -> builder::WhoamiResult {
Default::default()
}
}
///Worker
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "deleted",
/// "id",
/// "recycle",
/// "tasks"
/// ],
/// "properties": {
/// "deleted": {
/// "type": "boolean"
/// },
/// "id": {
/// "type": "string"
/// },
/// "instance_id": {
/// "type": "string"
/// },
/// "lastping": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "recycle": {
/// "type": "boolean"
/// },
/// "tasks": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/WorkerTask"
/// }
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct Worker {
pub deleted: bool,
pub id: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub instance_id: Option,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub lastping: Option>,
pub recycle: bool,
pub tasks: Vec,
}
impl From<&Worker> for Worker {
fn from(value: &Worker) -> Self {
value.clone()
}
}
impl Worker {
pub fn builder() -> builder::Worker {
Default::default()
}
}
///WorkerAddOutput
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "chunks",
/// "path",
/// "size"
/// ],
/// "properties": {
/// "chunks": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "path": {
/// "type": "string"
/// },
/// "size": {
/// "type": "integer",
/// "format": "int64"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerAddOutput {
pub chunks: Vec,
pub path: String,
pub size: i64,
}
impl From<&WorkerAddOutput> for WorkerAddOutput {
fn from(value: &WorkerAddOutput) -> Self {
value.clone()
}
}
impl WorkerAddOutput {
pub fn builder() -> builder::WorkerAddOutput {
Default::default()
}
}
///WorkerAppendTask
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "payload",
/// "stream",
/// "time"
/// ],
/// "properties": {
/// "payload": {
/// "type": "string"
/// },
/// "stream": {
/// "type": "string"
/// },
/// "time": {
/// "type": "string",
/// "format": "date-time"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerAppendTask {
pub payload: String,
pub stream: String,
pub time: chrono::DateTime,
}
impl From<&WorkerAppendTask> for WorkerAppendTask {
fn from(value: &WorkerAppendTask) -> Self {
value.clone()
}
}
impl WorkerAppendTask {
pub fn builder() -> builder::WorkerAppendTask {
Default::default()
}
}
///WorkerBootstrap
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "bootstrap",
/// "token"
/// ],
/// "properties": {
/// "bootstrap": {
/// "type": "string"
/// },
/// "token": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerBootstrap {
pub bootstrap: String,
pub token: String,
}
impl From<&WorkerBootstrap> for WorkerBootstrap {
fn from(value: &WorkerBootstrap) -> Self {
value.clone()
}
}
impl WorkerBootstrap {
pub fn builder() -> builder::WorkerBootstrap {
Default::default()
}
}
///WorkerBootstrapResult
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerBootstrapResult {
pub id: String,
}
impl From<&WorkerBootstrapResult> for WorkerBootstrapResult {
fn from(value: &WorkerBootstrapResult) -> Self {
value.clone()
}
}
impl WorkerBootstrapResult {
pub fn builder() -> builder::WorkerBootstrapResult {
Default::default()
}
}
///WorkerCompleteTask
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "failed"
/// ],
/// "properties": {
/// "failed": {
/// "type": "boolean"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerCompleteTask {
pub failed: bool,
}
impl From<&WorkerCompleteTask> for WorkerCompleteTask {
fn from(value: &WorkerCompleteTask) -> Self {
value.clone()
}
}
impl WorkerCompleteTask {
pub fn builder() -> builder::WorkerCompleteTask {
Default::default()
}
}
///WorkerPingResult
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "poweroff"
/// ],
/// "properties": {
/// "poweroff": {
/// "type": "boolean"
/// },
/// "task": {
/// "$ref": "#/components/schemas/WorkerPingTask"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerPingResult {
pub poweroff: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub task: Option,
}
impl From<&WorkerPingResult> for WorkerPingResult {
fn from(value: &WorkerPingResult) -> Self {
value.clone()
}
}
impl WorkerPingResult {
pub fn builder() -> builder::WorkerPingResult {
Default::default()
}
}
///WorkerPingTask
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "output_rules",
/// "script"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// },
/// "output_rules": {
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "script": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerPingTask {
pub id: String,
pub output_rules: Vec,
pub script: String,
}
impl From<&WorkerPingTask> for WorkerPingTask {
fn from(value: &WorkerPingTask) -> Self {
value.clone()
}
}
impl WorkerPingTask {
pub fn builder() -> builder::WorkerPingTask {
Default::default()
}
}
///WorkerTask
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "id",
/// "name",
/// "owner"
/// ],
/// "properties": {
/// "id": {
/// "type": "string"
/// },
/// "name": {
/// "type": "string"
/// },
/// "owner": {
/// "type": "string"
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkerTask {
pub id: String,
pub name: String,
pub owner: String,
}
impl From<&WorkerTask> for WorkerTask {
fn from(value: &WorkerTask) -> Self {
value.clone()
}
}
impl WorkerTask {
pub fn builder() -> builder::WorkerTask {
Default::default()
}
}
///WorkersResult
///
/// JSON schema
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "workers"
/// ],
/// "properties": {
/// "workers": {
/// "type": "array",
/// "items": {
/// "$ref": "#/components/schemas/Worker"
/// }
/// }
/// }
///}
/// ```
///
#[derive(Clone, Debug, Deserialize, Serialize, schemars :: JsonSchema)]
pub struct WorkersResult {
pub workers: Vec,
}
impl From<&WorkersResult> for WorkersResult {
fn from(value: &WorkersResult) -> Self {
value.clone()
}
}
impl WorkersResult {
pub fn builder() -> builder::WorkersResult {
Default::default()
}
}
pub mod builder {
#[derive(Clone, Debug)]
pub struct Task {
id: Result,
name: Result,
output_rules: Result, String>,
script: Result,
state: Result,
}
impl Default for Task {
fn default() -> Self {
Self {
id: Err("no value supplied for id".to_string()),
name: Err("no value supplied for name".to_string()),
output_rules: Err("no value supplied for output_rules".to_string()),
script: Err("no value supplied for script".to_string()),
state: Err("no value supplied for state".to_string()),
}
}
}
impl Task {
pub fn id(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {}", e));
self
}
pub fn name(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {}", e));
self
}
pub fn output_rules(mut self, value: T) -> Self
where
T: std::convert::TryInto>,
T::Error: std::fmt::Display,
{
self.output_rules = value.try_into().map_err(|e| {
format!("error converting supplied value for output_rules: {}", e)
});
self
}
pub fn script(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.script = value
.try_into()
.map_err(|e| format!("error converting supplied value for script: {}", e));
self
}
pub fn state(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.state = value
.try_into()
.map_err(|e| format!("error converting supplied value for state: {}", e));
self
}
}
impl std::convert::TryFrom for super::Task {
type Error = String;
fn try_from(value: Task) -> Result {
Ok(Self {
id: value.id?,
name: value.name?,
output_rules: value.output_rules?,
script: value.script?,
state: value.state?,
})
}
}
impl From for Task {
fn from(value: super::Task) -> Self {
Self {
id: Ok(value.id),
name: Ok(value.name),
output_rules: Ok(value.output_rules),
script: Ok(value.script),
state: Ok(value.state),
}
}
}
#[derive(Clone, Debug)]
pub struct TaskEvent {
payload: Result,
seq: Result,
stream: Result,
time: Result, String>,
}
impl Default for TaskEvent {
fn default() -> Self {
Self {
payload: Err("no value supplied for payload".to_string()),
seq: Err("no value supplied for seq".to_string()),
stream: Err("no value supplied for stream".to_string()),
time: Err("no value supplied for time".to_string()),
}
}
}
impl TaskEvent {
pub fn payload(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.payload = value
.try_into()
.map_err(|e| format!("error converting supplied value for payload: {}", e));
self
}
pub fn seq(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.seq = value
.try_into()
.map_err(|e| format!("error converting supplied value for seq: {}", e));
self
}
pub fn stream(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.stream = value
.try_into()
.map_err(|e| format!("error converting supplied value for stream: {}", e));
self
}
pub fn time(mut self, value: T) -> Self
where
T: std::convert::TryInto>,
T::Error: std::fmt::Display,
{
self.time = value
.try_into()
.map_err(|e| format!("error converting supplied value for time: {}", e));
self
}
}
impl std::convert::TryFrom for super::TaskEvent {
type Error = String;
fn try_from(value: TaskEvent) -> Result {
Ok(Self {
payload: value.payload?,
seq: value.seq?,
stream: value.stream?,
time: value.time?,
})
}
}
impl From for TaskEvent {
fn from(value: super::TaskEvent) -> Self {
Self {
payload: Ok(value.payload),
seq: Ok(value.seq),
stream: Ok(value.stream),
time: Ok(value.time),
}
}
}
#[derive(Clone, Debug)]
pub struct TaskOutput {
id: Result,
path: Result,
size: Result,
}
impl Default for TaskOutput {
fn default() -> Self {
Self {
id: Err("no value supplied for id".to_string()),
path: Err("no value supplied for path".to_string()),
size: Err("no value supplied for size".to_string()),
}
}
}
impl TaskOutput {
pub fn id(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {}", e));
self
}
pub fn path(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.path = value
.try_into()
.map_err(|e| format!("error converting supplied value for path: {}", e));
self
}
pub fn size(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.size = value
.try_into()
.map_err(|e| format!("error converting supplied value for size: {}", e));
self
}
}
impl std::convert::TryFrom for super::TaskOutput {
type Error = String;
fn try_from(value: TaskOutput) -> Result {
Ok(Self {
id: value.id?,
path: value.path?,
size: value.size?,
})
}
}
impl From for TaskOutput {
fn from(value: super::TaskOutput) -> Self {
Self {
id: Ok(value.id),
path: Ok(value.path),
size: Ok(value.size),
}
}
}
#[derive(Clone, Debug)]
pub struct TaskSubmit {
name: Result,
output_rules: Result, String>,
script: Result,
}
impl Default for TaskSubmit {
fn default() -> Self {
Self {
name: Err("no value supplied for name".to_string()),
output_rules: Ok(Default::default()),
script: Err("no value supplied for script".to_string()),
}
}
}
impl TaskSubmit {
pub fn name(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {}", e));
self
}
pub fn output_rules(mut self, value: T) -> Self
where
T: std::convert::TryInto>,
T::Error: std::fmt::Display,
{
self.output_rules = value.try_into().map_err(|e| {
format!("error converting supplied value for output_rules: {}", e)
});
self
}
pub fn script(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.script = value
.try_into()
.map_err(|e| format!("error converting supplied value for script: {}", e));
self
}
}
impl std::convert::TryFrom for super::TaskSubmit {
type Error = String;
fn try_from(value: TaskSubmit) -> Result {
Ok(Self {
name: value.name?,
output_rules: value.output_rules?,
script: value.script?,
})
}
}
impl From for TaskSubmit {
fn from(value: super::TaskSubmit) -> Self {
Self {
name: Ok(value.name),
output_rules: Ok(value.output_rules),
script: Ok(value.script),
}
}
}
#[derive(Clone, Debug)]
pub struct TaskSubmitResult {
id: Result,
}
impl Default for TaskSubmitResult {
fn default() -> Self {
Self {
id: Err("no value supplied for id".to_string()),
}
}
}
impl TaskSubmitResult {
pub fn id(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {}", e));
self
}
}
impl std::convert::TryFrom for super::TaskSubmitResult {
type Error = String;
fn try_from(value: TaskSubmitResult) -> Result {
Ok(Self { id: value.id? })
}
}
impl From for TaskSubmitResult {
fn from(value: super::TaskSubmitResult) -> Self {
Self { id: Ok(value.id) }
}
}
#[derive(Clone, Debug)]
pub struct UploadedChunk {
id: Result,
}
impl Default for UploadedChunk {
fn default() -> Self {
Self {
id: Err("no value supplied for id".to_string()),
}
}
}
impl UploadedChunk {
pub fn id(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {}", e));
self
}
}
impl std::convert::TryFrom for super::UploadedChunk {
type Error = String;
fn try_from(value: UploadedChunk) -> Result {
Ok(Self { id: value.id? })
}
}
impl From for UploadedChunk {
fn from(value: super::UploadedChunk) -> Self {
Self { id: Ok(value.id) }
}
}
#[derive(Clone, Debug)]
pub struct UserCreate {
name: Result,
}
impl Default for UserCreate {
fn default() -> Self {
Self {
name: Err("no value supplied for name".to_string()),
}
}
}
impl UserCreate {
pub fn name(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {}", e));
self
}
}
impl std::convert::TryFrom for super::UserCreate {
type Error = String;
fn try_from(value: UserCreate) -> Result {
Ok(Self { name: value.name? })
}
}
impl From for UserCreate {
fn from(value: super::UserCreate) -> Self {
Self {
name: Ok(value.name),
}
}
}
#[derive(Clone, Debug)]
pub struct UserCreateResult {
id: Result,
name: Result,
token: Result,
}
impl Default for UserCreateResult {
fn default() -> Self {
Self {
id: Err("no value supplied for id".to_string()),
name: Err("no value supplied for name".to_string()),
token: Err("no value supplied for token".to_string()),
}
}
}
impl UserCreateResult {
pub fn id(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {}", e));
self
}
pub fn name(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {}", e));
self
}
pub fn token(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.token = value
.try_into()
.map_err(|e| format!("error converting supplied value for token: {}", e));
self
}
}
impl std::convert::TryFrom for super::UserCreateResult {
type Error = String;
fn try_from(value: UserCreateResult) -> Result {
Ok(Self {
id: value.id?,
name: value.name?,
token: value.token?,
})
}
}
impl From for UserCreateResult {
fn from(value: super::UserCreateResult) -> Self {
Self {
id: Ok(value.id),
name: Ok(value.name),
token: Ok(value.token),
}
}
}
#[derive(Clone, Debug)]
pub struct WhoamiResult {
id: Result,
name: Result,
}
impl Default for WhoamiResult {
fn default() -> Self {
Self {
id: Err("no value supplied for id".to_string()),
name: Err("no value supplied for name".to_string()),
}
}
}
impl WhoamiResult {
pub fn id(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {}", e));
self
}
pub fn name(mut self, value: T) -> Self
where
T: std::convert::TryInto,
T::Error: std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {}", e));
self
}
}
impl std::convert::TryFrom for super::WhoamiResult {
type Error = String;
fn try_from(value: WhoamiResult) -> Result {
Ok(Self {
id: value.id?,
name: value.name?,
})
}
}
impl From for WhoamiResult {
fn from(value: super::WhoamiResult) -> Self {
Self {
id: Ok(value.id),
name: Ok(value.name),
}
}
}
#[derive(Clone, Debug)]
pub struct Worker {
deleted: Result,
id: Result,
instance_id: Result