1#![allow(clippy::all)]
3
4pub mod create_embeddings {
5 use ::one::{Error, IntoOperation, Method, Operation};
6#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
8#[serde(deny_unknown_fields)]
9pub struct Input {
10 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12 pub dimensions: ::std::option::Option<i64>,
13 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15 pub encoding_format: ::std::option::Option<InputEncodingFormat>,
16 pub input: InputInput,
18 pub model: InputModel,
20}
21impl Input {
22 pub fn builder() -> builder::Input {
23 Default::default()
24 }
25}
26#[derive(
28 ::serde::Deserialize,
29 ::serde::Serialize,
30 Clone,
31 Copy,
32 Debug,
33 Eq,
34 Hash,
35 Ord,
36 PartialEq,
37 PartialOrd
38)]
39pub enum InputEncodingFormat {
40 #[serde(rename = "base64_int8")]
41 Base64Int8,
42 #[serde(rename = "base64_binary")]
43 Base64Binary,
44}
45impl ::std::fmt::Display for InputEncodingFormat {
46 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
47 match *self {
48 Self::Base64Int8 => f.write_str("base64_int8"),
49 Self::Base64Binary => f.write_str("base64_binary"),
50 }
51 }
52}
53impl ::std::str::FromStr for InputEncodingFormat {
54 type Err = self::error::ConversionError;
55 fn from_str(
56 value: &str,
57 ) -> ::std::result::Result<Self, self::error::ConversionError> {
58 match value {
59 "base64_int8" => Ok(Self::Base64Int8),
60 "base64_binary" => Ok(Self::Base64Binary),
61 _ => Err("invalid value".into()),
62 }
63 }
64}
65impl ::std::convert::TryFrom<&str> for InputEncodingFormat {
66 type Error = self::error::ConversionError;
67 fn try_from(
68 value: &str,
69 ) -> ::std::result::Result<Self, self::error::ConversionError> {
70 value.parse()
71 }
72}
73impl ::std::convert::TryFrom<::std::string::String> for InputEncodingFormat {
74 type Error = self::error::ConversionError;
75 fn try_from(
76 value: ::std::string::String,
77 ) -> ::std::result::Result<Self, self::error::ConversionError> {
78 value.parse()
79 }
80}
81#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
83#[serde(untagged)]
84pub enum InputInput {
85 String(::std::string::String),
86 Array(::std::vec::Vec<::std::string::String>),
87}
88impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for InputInput {
89 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
90 Self::Array(value)
91 }
92}
93#[derive(
95 ::serde::Deserialize,
96 ::serde::Serialize,
97 Clone,
98 Copy,
99 Debug,
100 Eq,
101 Hash,
102 Ord,
103 PartialEq,
104 PartialOrd
105)]
106pub enum InputModel {
107 #[serde(rename = "pplx-embed-v1-0.6b")]
108 PplxEmbedV106b,
109 #[serde(rename = "pplx-embed-v1-4b")]
110 PplxEmbedV14b,
111}
112impl ::std::fmt::Display for InputModel {
113 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
114 match *self {
115 Self::PplxEmbedV106b => f.write_str("pplx-embed-v1-0.6b"),
116 Self::PplxEmbedV14b => f.write_str("pplx-embed-v1-4b"),
117 }
118 }
119}
120impl ::std::str::FromStr for InputModel {
121 type Err = self::error::ConversionError;
122 fn from_str(
123 value: &str,
124 ) -> ::std::result::Result<Self, self::error::ConversionError> {
125 match value {
126 "pplx-embed-v1-0.6b" => Ok(Self::PplxEmbedV106b),
127 "pplx-embed-v1-4b" => Ok(Self::PplxEmbedV14b),
128 _ => Err("invalid value".into()),
129 }
130 }
131}
132impl ::std::convert::TryFrom<&str> for InputModel {
133 type Error = self::error::ConversionError;
134 fn try_from(
135 value: &str,
136 ) -> ::std::result::Result<Self, self::error::ConversionError> {
137 value.parse()
138 }
139}
140impl ::std::convert::TryFrom<::std::string::String> for InputModel {
141 type Error = self::error::ConversionError;
142 fn try_from(
143 value: ::std::string::String,
144 ) -> ::std::result::Result<Self, self::error::ConversionError> {
145 value.parse()
146 }
147}
148pub mod builder {
150 #[derive(Clone, Debug)]
151 pub struct Input {
152 dimensions: ::std::result::Result<
153 ::std::option::Option<i64>,
154 ::std::string::String,
155 >,
156 encoding_format: ::std::result::Result<
157 ::std::option::Option<super::InputEncodingFormat>,
158 ::std::string::String,
159 >,
160 input: ::std::result::Result<super::InputInput, ::std::string::String>,
161 model: ::std::result::Result<super::InputModel, ::std::string::String>,
162 }
163 impl ::std::default::Default for Input {
164 fn default() -> Self {
165 Self {
166 dimensions: Ok(Default::default()),
167 encoding_format: Ok(Default::default()),
168 input: Err("no value supplied for input".to_string()),
169 model: Err("no value supplied for model".to_string()),
170 }
171 }
172 }
173 impl Input {
174 pub fn dimensions<T>(mut self, value: T) -> Self
175 where
176 T: ::std::convert::TryInto<::std::option::Option<i64>>,
177 T::Error: ::std::fmt::Display,
178 {
179 self.dimensions = value
180 .try_into()
181 .map_err(|e| {
182 format!("error converting supplied value for dimensions: {e}")
183 });
184 self
185 }
186 pub fn encoding_format<T>(mut self, value: T) -> Self
187 where
188 T: ::std::convert::TryInto<
189 ::std::option::Option<super::InputEncodingFormat>,
190 >,
191 T::Error: ::std::fmt::Display,
192 {
193 self.encoding_format = value
194 .try_into()
195 .map_err(|e| {
196 format!("error converting supplied value for encoding_format: {e}")
197 });
198 self
199 }
200 pub fn input<T>(mut self, value: T) -> Self
201 where
202 T: ::std::convert::TryInto<super::InputInput>,
203 T::Error: ::std::fmt::Display,
204 {
205 self.input = value
206 .try_into()
207 .map_err(|e| format!("error converting supplied value for input: {e}"));
208 self
209 }
210 pub fn model<T>(mut self, value: T) -> Self
211 where
212 T: ::std::convert::TryInto<super::InputModel>,
213 T::Error: ::std::fmt::Display,
214 {
215 self.model = value
216 .try_into()
217 .map_err(|e| format!("error converting supplied value for model: {e}"));
218 self
219 }
220 }
221 impl ::std::convert::TryFrom<Input> for super::Input {
222 type Error = super::error::ConversionError;
223 fn try_from(
224 value: Input,
225 ) -> ::std::result::Result<Self, super::error::ConversionError> {
226 Ok(Self {
227 dimensions: value.dimensions?,
228 encoding_format: value.encoding_format?,
229 input: value.input?,
230 model: value.model?,
231 })
232 }
233 }
234 impl ::std::convert::From<super::Input> for Input {
235 fn from(value: super::Input) -> Self {
236 Self {
237 dimensions: Ok(value.dimensions),
238 encoding_format: Ok(value.encoding_format),
239 input: Ok(value.input),
240 model: Ok(value.model),
241 }
242 }
243 }
244}
245pub mod error {
247 pub struct ConversionError(::std::borrow::Cow<'static, str>);
249 impl ::std::error::Error for ConversionError {}
250 impl ::std::fmt::Display for ConversionError {
251 fn fmt(
252 &self,
253 f: &mut ::std::fmt::Formatter<'_>,
254 ) -> Result<(), ::std::fmt::Error> {
255 ::std::fmt::Display::fmt(&self.0, f)
256 }
257 }
258 impl ::std::fmt::Debug for ConversionError {
259 fn fmt(
260 &self,
261 f: &mut ::std::fmt::Formatter<'_>,
262 ) -> Result<(), ::std::fmt::Error> {
263 ::std::fmt::Debug::fmt(&self.0, f)
264 }
265 }
266 impl From<&'static str> for ConversionError {
267 fn from(value: &'static str) -> Self {
268 Self(value.into())
269 }
270 }
271 impl From<String> for ConversionError {
272 fn from(value: String) -> Self {
273 Self(value.into())
274 }
275 }
276}
277
278pub mod output {
279#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
281pub struct Cost {
282 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
284 pub currency: ::std::option::Option<CostCurrency>,
285 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
287 pub input_cost: ::std::option::Option<f64>,
288 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
290 pub total_cost: ::std::option::Option<f64>,
291}
292impl Cost {
293 pub fn builder() -> builder::Cost {
294 Default::default()
295 }
296}
297#[derive(
299 ::serde::Deserialize,
300 ::serde::Serialize,
301 Clone,
302 Copy,
303 Debug,
304 Eq,
305 Hash,
306 Ord,
307 PartialEq,
308 PartialOrd
309)]
310pub enum CostCurrency {
311 #[serde(rename = "USD")]
312 Usd,
313}
314impl ::std::fmt::Display for CostCurrency {
315 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
316 match *self {
317 Self::Usd => f.write_str("USD"),
318 }
319 }
320}
321impl ::std::str::FromStr for CostCurrency {
322 type Err = self::error::ConversionError;
323 fn from_str(
324 value: &str,
325 ) -> ::std::result::Result<Self, self::error::ConversionError> {
326 match value {
327 "USD" => Ok(Self::Usd),
328 _ => Err("invalid value".into()),
329 }
330 }
331}
332impl ::std::convert::TryFrom<&str> for CostCurrency {
333 type Error = self::error::ConversionError;
334 fn try_from(
335 value: &str,
336 ) -> ::std::result::Result<Self, self::error::ConversionError> {
337 value.parse()
338 }
339}
340impl ::std::convert::TryFrom<::std::string::String> for CostCurrency {
341 type Error = self::error::ConversionError;
342 fn try_from(
343 value: ::std::string::String,
344 ) -> ::std::result::Result<Self, self::error::ConversionError> {
345 value.parse()
346 }
347}
348#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
350pub struct EmbeddingItem {
351 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
353 pub embedding: ::std::option::Option<::std::string::String>,
354 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
356 pub index: ::std::option::Option<i64>,
357 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
359 pub object: ::std::option::Option<::std::string::String>,
360}
361impl EmbeddingItem {
362 pub fn builder() -> builder::EmbeddingItem {
363 Default::default()
364 }
365}
366#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
368pub struct Output {
369 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
371 pub data: ::std::vec::Vec<EmbeddingItem>,
372 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
374 pub detail: ::std::vec::Vec<ValidationErrorDetail>,
375 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
377 pub model: ::std::option::Option<::std::string::String>,
378 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
380 pub object: ::std::option::Option<::std::string::String>,
381 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
382 pub usage: ::std::option::Option<Usage>,
383}
384impl Output {
385 pub fn builder() -> builder::Output {
386 Default::default()
387 }
388}
389#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
391pub struct Usage {
392 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
393 pub cost: ::std::option::Option<Cost>,
394 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
396 pub prompt_tokens: ::std::option::Option<i64>,
397 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
399 pub total_tokens: ::std::option::Option<i64>,
400}
401impl Usage {
402 pub fn builder() -> builder::Usage {
403 Default::default()
404 }
405}
406#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
408pub struct ValidationErrorDetail {
409 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
411 pub loc: ::std::vec::Vec<::std::string::String>,
412 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
414 pub msg: ::std::option::Option<::std::string::String>,
415 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
417 pub type_: ::std::option::Option<::std::string::String>,
418}
419impl ValidationErrorDetail {
420 pub fn builder() -> builder::ValidationErrorDetail {
421 Default::default()
422 }
423}
424pub mod builder {
426 #[derive(Clone, Debug)]
427 pub struct Cost {
428 currency: ::std::result::Result<
429 ::std::option::Option<super::CostCurrency>,
430 ::std::string::String,
431 >,
432 input_cost: ::std::result::Result<
433 ::std::option::Option<f64>,
434 ::std::string::String,
435 >,
436 total_cost: ::std::result::Result<
437 ::std::option::Option<f64>,
438 ::std::string::String,
439 >,
440 }
441 impl ::std::default::Default for Cost {
442 fn default() -> Self {
443 Self {
444 currency: Ok(Default::default()),
445 input_cost: Ok(Default::default()),
446 total_cost: Ok(Default::default()),
447 }
448 }
449 }
450 impl Cost {
451 pub fn currency<T>(mut self, value: T) -> Self
452 where
453 T: ::std::convert::TryInto<::std::option::Option<super::CostCurrency>>,
454 T::Error: ::std::fmt::Display,
455 {
456 self.currency = value
457 .try_into()
458 .map_err(|e| {
459 format!("error converting supplied value for currency: {e}")
460 });
461 self
462 }
463 pub fn input_cost<T>(mut self, value: T) -> Self
464 where
465 T: ::std::convert::TryInto<::std::option::Option<f64>>,
466 T::Error: ::std::fmt::Display,
467 {
468 self.input_cost = value
469 .try_into()
470 .map_err(|e| {
471 format!("error converting supplied value for input_cost: {e}")
472 });
473 self
474 }
475 pub fn total_cost<T>(mut self, value: T) -> Self
476 where
477 T: ::std::convert::TryInto<::std::option::Option<f64>>,
478 T::Error: ::std::fmt::Display,
479 {
480 self.total_cost = value
481 .try_into()
482 .map_err(|e| {
483 format!("error converting supplied value for total_cost: {e}")
484 });
485 self
486 }
487 }
488 impl ::std::convert::TryFrom<Cost> for super::Cost {
489 type Error = super::error::ConversionError;
490 fn try_from(
491 value: Cost,
492 ) -> ::std::result::Result<Self, super::error::ConversionError> {
493 Ok(Self {
494 currency: value.currency?,
495 input_cost: value.input_cost?,
496 total_cost: value.total_cost?,
497 })
498 }
499 }
500 impl ::std::convert::From<super::Cost> for Cost {
501 fn from(value: super::Cost) -> Self {
502 Self {
503 currency: Ok(value.currency),
504 input_cost: Ok(value.input_cost),
505 total_cost: Ok(value.total_cost),
506 }
507 }
508 }
509 #[derive(Clone, Debug)]
510 pub struct EmbeddingItem {
511 embedding: ::std::result::Result<
512 ::std::option::Option<::std::string::String>,
513 ::std::string::String,
514 >,
515 index: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
516 object: ::std::result::Result<
517 ::std::option::Option<::std::string::String>,
518 ::std::string::String,
519 >,
520 }
521 impl ::std::default::Default for EmbeddingItem {
522 fn default() -> Self {
523 Self {
524 embedding: Ok(Default::default()),
525 index: Ok(Default::default()),
526 object: Ok(Default::default()),
527 }
528 }
529 }
530 impl EmbeddingItem {
531 pub fn embedding<T>(mut self, value: T) -> Self
532 where
533 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
534 T::Error: ::std::fmt::Display,
535 {
536 self.embedding = value
537 .try_into()
538 .map_err(|e| {
539 format!("error converting supplied value for embedding: {e}")
540 });
541 self
542 }
543 pub fn index<T>(mut self, value: T) -> Self
544 where
545 T: ::std::convert::TryInto<::std::option::Option<i64>>,
546 T::Error: ::std::fmt::Display,
547 {
548 self.index = value
549 .try_into()
550 .map_err(|e| format!("error converting supplied value for index: {e}"));
551 self
552 }
553 pub fn object<T>(mut self, value: T) -> Self
554 where
555 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
556 T::Error: ::std::fmt::Display,
557 {
558 self.object = value
559 .try_into()
560 .map_err(|e| format!("error converting supplied value for object: {e}"));
561 self
562 }
563 }
564 impl ::std::convert::TryFrom<EmbeddingItem> for super::EmbeddingItem {
565 type Error = super::error::ConversionError;
566 fn try_from(
567 value: EmbeddingItem,
568 ) -> ::std::result::Result<Self, super::error::ConversionError> {
569 Ok(Self {
570 embedding: value.embedding?,
571 index: value.index?,
572 object: value.object?,
573 })
574 }
575 }
576 impl ::std::convert::From<super::EmbeddingItem> for EmbeddingItem {
577 fn from(value: super::EmbeddingItem) -> Self {
578 Self {
579 embedding: Ok(value.embedding),
580 index: Ok(value.index),
581 object: Ok(value.object),
582 }
583 }
584 }
585 #[derive(Clone, Debug)]
586 pub struct Output {
587 data: ::std::result::Result<
588 ::std::vec::Vec<super::EmbeddingItem>,
589 ::std::string::String,
590 >,
591 detail: ::std::result::Result<
592 ::std::vec::Vec<super::ValidationErrorDetail>,
593 ::std::string::String,
594 >,
595 model: ::std::result::Result<
596 ::std::option::Option<::std::string::String>,
597 ::std::string::String,
598 >,
599 object: ::std::result::Result<
600 ::std::option::Option<::std::string::String>,
601 ::std::string::String,
602 >,
603 usage: ::std::result::Result<
604 ::std::option::Option<super::Usage>,
605 ::std::string::String,
606 >,
607 }
608 impl ::std::default::Default for Output {
609 fn default() -> Self {
610 Self {
611 data: Ok(Default::default()),
612 detail: Ok(Default::default()),
613 model: Ok(Default::default()),
614 object: Ok(Default::default()),
615 usage: Ok(Default::default()),
616 }
617 }
618 }
619 impl Output {
620 pub fn data<T>(mut self, value: T) -> Self
621 where
622 T: ::std::convert::TryInto<::std::vec::Vec<super::EmbeddingItem>>,
623 T::Error: ::std::fmt::Display,
624 {
625 self.data = value
626 .try_into()
627 .map_err(|e| format!("error converting supplied value for data: {e}"));
628 self
629 }
630 pub fn detail<T>(mut self, value: T) -> Self
631 where
632 T: ::std::convert::TryInto<::std::vec::Vec<super::ValidationErrorDetail>>,
633 T::Error: ::std::fmt::Display,
634 {
635 self.detail = value
636 .try_into()
637 .map_err(|e| format!("error converting supplied value for detail: {e}"));
638 self
639 }
640 pub fn model<T>(mut self, value: T) -> Self
641 where
642 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
643 T::Error: ::std::fmt::Display,
644 {
645 self.model = value
646 .try_into()
647 .map_err(|e| format!("error converting supplied value for model: {e}"));
648 self
649 }
650 pub fn object<T>(mut self, value: T) -> Self
651 where
652 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
653 T::Error: ::std::fmt::Display,
654 {
655 self.object = value
656 .try_into()
657 .map_err(|e| format!("error converting supplied value for object: {e}"));
658 self
659 }
660 pub fn usage<T>(mut self, value: T) -> Self
661 where
662 T: ::std::convert::TryInto<::std::option::Option<super::Usage>>,
663 T::Error: ::std::fmt::Display,
664 {
665 self.usage = value
666 .try_into()
667 .map_err(|e| format!("error converting supplied value for usage: {e}"));
668 self
669 }
670 }
671 impl ::std::convert::TryFrom<Output> for super::Output {
672 type Error = super::error::ConversionError;
673 fn try_from(
674 value: Output,
675 ) -> ::std::result::Result<Self, super::error::ConversionError> {
676 Ok(Self {
677 data: value.data?,
678 detail: value.detail?,
679 model: value.model?,
680 object: value.object?,
681 usage: value.usage?,
682 })
683 }
684 }
685 impl ::std::convert::From<super::Output> for Output {
686 fn from(value: super::Output) -> Self {
687 Self {
688 data: Ok(value.data),
689 detail: Ok(value.detail),
690 model: Ok(value.model),
691 object: Ok(value.object),
692 usage: Ok(value.usage),
693 }
694 }
695 }
696 #[derive(Clone, Debug)]
697 pub struct Usage {
698 cost: ::std::result::Result<
699 ::std::option::Option<super::Cost>,
700 ::std::string::String,
701 >,
702 prompt_tokens: ::std::result::Result<
703 ::std::option::Option<i64>,
704 ::std::string::String,
705 >,
706 total_tokens: ::std::result::Result<
707 ::std::option::Option<i64>,
708 ::std::string::String,
709 >,
710 }
711 impl ::std::default::Default for Usage {
712 fn default() -> Self {
713 Self {
714 cost: Ok(Default::default()),
715 prompt_tokens: Ok(Default::default()),
716 total_tokens: Ok(Default::default()),
717 }
718 }
719 }
720 impl Usage {
721 pub fn cost<T>(mut self, value: T) -> Self
722 where
723 T: ::std::convert::TryInto<::std::option::Option<super::Cost>>,
724 T::Error: ::std::fmt::Display,
725 {
726 self.cost = value
727 .try_into()
728 .map_err(|e| format!("error converting supplied value for cost: {e}"));
729 self
730 }
731 pub fn prompt_tokens<T>(mut self, value: T) -> Self
732 where
733 T: ::std::convert::TryInto<::std::option::Option<i64>>,
734 T::Error: ::std::fmt::Display,
735 {
736 self.prompt_tokens = value
737 .try_into()
738 .map_err(|e| {
739 format!("error converting supplied value for prompt_tokens: {e}")
740 });
741 self
742 }
743 pub fn total_tokens<T>(mut self, value: T) -> Self
744 where
745 T: ::std::convert::TryInto<::std::option::Option<i64>>,
746 T::Error: ::std::fmt::Display,
747 {
748 self.total_tokens = value
749 .try_into()
750 .map_err(|e| {
751 format!("error converting supplied value for total_tokens: {e}")
752 });
753 self
754 }
755 }
756 impl ::std::convert::TryFrom<Usage> for super::Usage {
757 type Error = super::error::ConversionError;
758 fn try_from(
759 value: Usage,
760 ) -> ::std::result::Result<Self, super::error::ConversionError> {
761 Ok(Self {
762 cost: value.cost?,
763 prompt_tokens: value.prompt_tokens?,
764 total_tokens: value.total_tokens?,
765 })
766 }
767 }
768 impl ::std::convert::From<super::Usage> for Usage {
769 fn from(value: super::Usage) -> Self {
770 Self {
771 cost: Ok(value.cost),
772 prompt_tokens: Ok(value.prompt_tokens),
773 total_tokens: Ok(value.total_tokens),
774 }
775 }
776 }
777 #[derive(Clone, Debug)]
778 pub struct ValidationErrorDetail {
779 loc: ::std::result::Result<
780 ::std::vec::Vec<::std::string::String>,
781 ::std::string::String,
782 >,
783 msg: ::std::result::Result<
784 ::std::option::Option<::std::string::String>,
785 ::std::string::String,
786 >,
787 type_: ::std::result::Result<
788 ::std::option::Option<::std::string::String>,
789 ::std::string::String,
790 >,
791 }
792 impl ::std::default::Default for ValidationErrorDetail {
793 fn default() -> Self {
794 Self {
795 loc: Ok(Default::default()),
796 msg: Ok(Default::default()),
797 type_: Ok(Default::default()),
798 }
799 }
800 }
801 impl ValidationErrorDetail {
802 pub fn loc<T>(mut self, value: T) -> Self
803 where
804 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
805 T::Error: ::std::fmt::Display,
806 {
807 self.loc = value
808 .try_into()
809 .map_err(|e| format!("error converting supplied value for loc: {e}"));
810 self
811 }
812 pub fn msg<T>(mut self, value: T) -> Self
813 where
814 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
815 T::Error: ::std::fmt::Display,
816 {
817 self.msg = value
818 .try_into()
819 .map_err(|e| format!("error converting supplied value for msg: {e}"));
820 self
821 }
822 pub fn type_<T>(mut self, value: T) -> Self
823 where
824 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
825 T::Error: ::std::fmt::Display,
826 {
827 self.type_ = value
828 .try_into()
829 .map_err(|e| format!("error converting supplied value for type_: {e}"));
830 self
831 }
832 }
833 impl ::std::convert::TryFrom<ValidationErrorDetail>
834 for super::ValidationErrorDetail {
835 type Error = super::error::ConversionError;
836 fn try_from(
837 value: ValidationErrorDetail,
838 ) -> ::std::result::Result<Self, super::error::ConversionError> {
839 Ok(Self {
840 loc: value.loc?,
841 msg: value.msg?,
842 type_: value.type_?,
843 })
844 }
845 }
846 impl ::std::convert::From<super::ValidationErrorDetail> for ValidationErrorDetail {
847 fn from(value: super::ValidationErrorDetail) -> Self {
848 Self {
849 loc: Ok(value.loc),
850 msg: Ok(value.msg),
851 type_: Ok(value.type_),
852 }
853 }
854 }
855}
856pub mod error {
858 pub struct ConversionError(::std::borrow::Cow<'static, str>);
860 impl ::std::error::Error for ConversionError {}
861 impl ::std::fmt::Display for ConversionError {
862 fn fmt(
863 &self,
864 f: &mut ::std::fmt::Formatter<'_>,
865 ) -> Result<(), ::std::fmt::Error> {
866 ::std::fmt::Display::fmt(&self.0, f)
867 }
868 }
869 impl ::std::fmt::Debug for ConversionError {
870 fn fmt(
871 &self,
872 f: &mut ::std::fmt::Formatter<'_>,
873 ) -> Result<(), ::std::fmt::Error> {
874 ::std::fmt::Debug::fmt(&self.0, f)
875 }
876 }
877 impl From<&'static str> for ConversionError {
878 fn from(value: &'static str) -> Self {
879 Self(value.into())
880 }
881 }
882 impl From<String> for ConversionError {
883 fn from(value: String) -> Self {
884 Self(value.into())
885 }
886 }
887}
888
889}
890
891 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "dimensions", part: ::one::Part::Body, key: Some("dimensions") }, ::one::Route { field: "encoding_format", part: ::one::Part::Body, key: Some("encoding_format") }, ::one::Route { field: "input", part: ::one::Part::Body, key: Some("input") }, ::one::Route { field: "model", part: ::one::Part::Body, key: Some("model") }], required_parts: &[::one::Part::Body] };
893
894 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
910 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZdszRmI::5QKcMrnZSe6MnnVIKtksZQ", Method::POST, "/v1/embeddings").with_routed(&input, &ROUTING)?
911 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
912 }
913
914 impl IntoOperation for Input {
915 type Output = output::Output;
916
917 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
918 build(self)
919 }
920 }
921 impl IntoOperation for builder::Input {
922 type Output = output::Output;
923
924 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
925 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
926 }
927 }
928}
929pub fn create_embeddings() -> create_embeddings::builder::Input {
931 create_embeddings::builder::Input::default()
932}
933pub mod get_async_chat_completion_response {
934 use ::one::{Error, IntoOperation, Method, Operation};
935#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
937#[serde(deny_unknown_fields)]
938pub struct Input {
939 #[serde(rename = "apiRequest")]
941 pub api_request: InputApiRequest,
942}
943impl Input {
944 pub fn builder() -> builder::Input {
945 Default::default()
946 }
947}
948#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
950#[serde(transparent)]
951pub struct InputApiRequest(::std::string::String);
952impl ::std::ops::Deref for InputApiRequest {
953 type Target = ::std::string::String;
954 fn deref(&self) -> &::std::string::String {
955 &self.0
956 }
957}
958impl ::std::convert::From<InputApiRequest> for ::std::string::String {
959 fn from(value: InputApiRequest) -> Self {
960 value.0
961 }
962}
963impl ::std::str::FromStr for InputApiRequest {
964 type Err = self::error::ConversionError;
965 fn from_str(
966 value: &str,
967 ) -> ::std::result::Result<Self, self::error::ConversionError> {
968 ::std::convert::TryFrom::try_from(value)
969 }
970}
971impl ::std::convert::TryFrom<&str> for InputApiRequest {
972 type Error = self::error::ConversionError;
973 fn try_from(
974 value: &str,
975 ) -> ::std::result::Result<Self, self::error::ConversionError> {
976 if value.chars().count() < 1usize {
977 return Err("shorter than 1 characters".into());
978 }
979 Ok(Self(value.to_string()))
980 }
981}
982impl ::std::convert::TryFrom<::std::string::String> for InputApiRequest {
983 type Error = self::error::ConversionError;
984 fn try_from(
985 value: ::std::string::String,
986 ) -> ::std::result::Result<Self, self::error::ConversionError> {
987 ::std::convert::TryFrom::try_from(value.as_str())
988 }
989}
990impl<'de> ::serde::Deserialize<'de> for InputApiRequest {
991 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
992 where
993 D: ::serde::Deserializer<'de>,
994 {
995 ::std::convert::TryFrom::try_from(
996 ::std::string::String::deserialize(deserializer)?,
997 )
998 .map_err(|e: self::error::ConversionError| {
999 <D::Error as ::serde::de::Error>::custom(e.to_string())
1000 })
1001 }
1002}
1003pub mod builder {
1005 #[derive(Clone, Debug)]
1006 pub struct Input {
1007 api_request: ::std::result::Result<
1008 super::InputApiRequest,
1009 ::std::string::String,
1010 >,
1011 }
1012 impl ::std::default::Default for Input {
1013 fn default() -> Self {
1014 Self {
1015 api_request: Err("no value supplied for api_request".to_string()),
1016 }
1017 }
1018 }
1019 impl Input {
1020 pub fn api_request<T>(mut self, value: T) -> Self
1021 where
1022 T: ::std::convert::TryInto<super::InputApiRequest>,
1023 T::Error: ::std::fmt::Display,
1024 {
1025 self.api_request = value
1026 .try_into()
1027 .map_err(|e| {
1028 format!("error converting supplied value for api_request: {e}")
1029 });
1030 self
1031 }
1032 }
1033 impl ::std::convert::TryFrom<Input> for super::Input {
1034 type Error = super::error::ConversionError;
1035 fn try_from(
1036 value: Input,
1037 ) -> ::std::result::Result<Self, super::error::ConversionError> {
1038 Ok(Self {
1039 api_request: value.api_request?,
1040 })
1041 }
1042 }
1043 impl ::std::convert::From<super::Input> for Input {
1044 fn from(value: super::Input) -> Self {
1045 Self {
1046 api_request: Ok(value.api_request),
1047 }
1048 }
1049 }
1050}
1051pub mod error {
1053 pub struct ConversionError(::std::borrow::Cow<'static, str>);
1055 impl ::std::error::Error for ConversionError {}
1056 impl ::std::fmt::Display for ConversionError {
1057 fn fmt(
1058 &self,
1059 f: &mut ::std::fmt::Formatter<'_>,
1060 ) -> Result<(), ::std::fmt::Error> {
1061 ::std::fmt::Display::fmt(&self.0, f)
1062 }
1063 }
1064 impl ::std::fmt::Debug for ConversionError {
1065 fn fmt(
1066 &self,
1067 f: &mut ::std::fmt::Formatter<'_>,
1068 ) -> Result<(), ::std::fmt::Error> {
1069 ::std::fmt::Debug::fmt(&self.0, f)
1070 }
1071 }
1072 impl From<&'static str> for ConversionError {
1073 fn from(value: &'static str) -> Self {
1074 Self(value.into())
1075 }
1076 }
1077 impl From<String> for ConversionError {
1078 fn from(value: String) -> Self {
1079 Self(value.into())
1080 }
1081 }
1082}
1083
1084pub mod output {
1085#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1087pub struct ChatCompletionResponsePayload {
1088 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1090 pub choices: ::std::vec::Vec<ChatCompletionResponsePayloadChoicesItem>,
1091 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1093 pub citations: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
1094 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1096 pub created: ::std::option::Option<i64>,
1097 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1099 pub id: ::std::option::Option<::std::string::String>,
1100 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1102 pub images: ::std::option::Option<
1103 ::std::vec::Vec<ChatCompletionResponsePayloadImagesItem>,
1104 >,
1105 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1107 pub model: ::std::option::Option<::std::string::String>,
1108 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1110 pub object: ::std::option::Option<::std::string::String>,
1111 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1113 pub related_questions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
1114 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1116 pub search_results: ::std::option::Option<
1117 ::std::vec::Vec<ChatCompletionResponsePayloadSearchResultsItem>,
1118 >,
1119 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1121 pub usage: ::std::option::Option<
1122 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1123 >,
1124}
1125impl ChatCompletionResponsePayload {
1126 pub fn builder() -> builder::ChatCompletionResponsePayload {
1127 Default::default()
1128 }
1129}
1130#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1132pub struct ChatCompletionResponsePayloadChoicesItem {
1133 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
1135 pub delta: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1136 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1138 pub finish_reason: ::std::option::Option<
1139 ChatCompletionResponsePayloadChoicesItemFinishReason,
1140 >,
1141 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1143 pub index: ::std::option::Option<i64>,
1144 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
1146 pub message: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1147}
1148impl ChatCompletionResponsePayloadChoicesItem {
1149 pub fn builder() -> builder::ChatCompletionResponsePayloadChoicesItem {
1150 Default::default()
1151 }
1152}
1153#[derive(
1155 ::serde::Deserialize,
1156 ::serde::Serialize,
1157 Clone,
1158 Copy,
1159 Debug,
1160 Eq,
1161 Hash,
1162 Ord,
1163 PartialEq,
1164 PartialOrd
1165)]
1166pub enum ChatCompletionResponsePayloadChoicesItemFinishReason {
1167 #[serde(rename = "stop")]
1168 Stop,
1169 #[serde(rename = "length")]
1170 Length,
1171}
1172impl ::std::fmt::Display for ChatCompletionResponsePayloadChoicesItemFinishReason {
1173 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1174 match *self {
1175 Self::Stop => f.write_str("stop"),
1176 Self::Length => f.write_str("length"),
1177 }
1178 }
1179}
1180impl ::std::str::FromStr for ChatCompletionResponsePayloadChoicesItemFinishReason {
1181 type Err = self::error::ConversionError;
1182 fn from_str(
1183 value: &str,
1184 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1185 match value {
1186 "stop" => Ok(Self::Stop),
1187 "length" => Ok(Self::Length),
1188 _ => Err("invalid value".into()),
1189 }
1190 }
1191}
1192impl ::std::convert::TryFrom<&str>
1193for ChatCompletionResponsePayloadChoicesItemFinishReason {
1194 type Error = self::error::ConversionError;
1195 fn try_from(
1196 value: &str,
1197 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1198 value.parse()
1199 }
1200}
1201impl ::std::convert::TryFrom<::std::string::String>
1202for ChatCompletionResponsePayloadChoicesItemFinishReason {
1203 type Error = self::error::ConversionError;
1204 fn try_from(
1205 value: ::std::string::String,
1206 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1207 value.parse()
1208 }
1209}
1210#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1212pub struct ChatCompletionResponsePayloadImagesItem {
1213 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1215 pub height: ::std::option::Option<i64>,
1216 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1218 pub image_url: ::std::option::Option<::std::string::String>,
1219 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1221 pub origin_url: ::std::option::Option<::std::string::String>,
1222 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1224 pub title: ::std::option::Option<::std::string::String>,
1225 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1227 pub width: ::std::option::Option<i64>,
1228}
1229impl ChatCompletionResponsePayloadImagesItem {
1230 pub fn builder() -> builder::ChatCompletionResponsePayloadImagesItem {
1231 Default::default()
1232 }
1233}
1234#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1236pub struct ChatCompletionResponsePayloadSearchResultsItem {
1237 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1239 pub date: ::std::option::Option<::std::string::String>,
1240 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1242 pub last_updated: ::std::option::Option<::std::string::String>,
1243 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1245 pub snippet: ::std::option::Option<::std::string::String>,
1246 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1248 pub source: ::std::option::Option<
1249 ChatCompletionResponsePayloadSearchResultsItemSource,
1250 >,
1251 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1253 pub title: ::std::option::Option<::std::string::String>,
1254 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1256 pub url: ::std::option::Option<::std::string::String>,
1257}
1258impl ChatCompletionResponsePayloadSearchResultsItem {
1259 pub fn builder() -> builder::ChatCompletionResponsePayloadSearchResultsItem {
1260 Default::default()
1261 }
1262}
1263#[derive(
1265 ::serde::Deserialize,
1266 ::serde::Serialize,
1267 Clone,
1268 Copy,
1269 Debug,
1270 Eq,
1271 Hash,
1272 Ord,
1273 PartialEq,
1274 PartialOrd
1275)]
1276pub enum ChatCompletionResponsePayloadSearchResultsItemSource {
1277 #[serde(rename = "web")]
1278 Web,
1279 #[serde(rename = "attachment")]
1280 Attachment,
1281}
1282impl ::std::fmt::Display for ChatCompletionResponsePayloadSearchResultsItemSource {
1283 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1284 match *self {
1285 Self::Web => f.write_str("web"),
1286 Self::Attachment => f.write_str("attachment"),
1287 }
1288 }
1289}
1290impl ::std::str::FromStr for ChatCompletionResponsePayloadSearchResultsItemSource {
1291 type Err = self::error::ConversionError;
1292 fn from_str(
1293 value: &str,
1294 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1295 match value {
1296 "web" => Ok(Self::Web),
1297 "attachment" => Ok(Self::Attachment),
1298 _ => Err("invalid value".into()),
1299 }
1300 }
1301}
1302impl ::std::convert::TryFrom<&str>
1303for ChatCompletionResponsePayloadSearchResultsItemSource {
1304 type Error = self::error::ConversionError;
1305 fn try_from(
1306 value: &str,
1307 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1308 value.parse()
1309 }
1310}
1311impl ::std::convert::TryFrom<::std::string::String>
1312for ChatCompletionResponsePayloadSearchResultsItemSource {
1313 type Error = self::error::ConversionError;
1314 fn try_from(
1315 value: ::std::string::String,
1316 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1317 value.parse()
1318 }
1319}
1320#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1322pub struct Output {
1323 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1325 pub completed_at: ::std::option::Option<i64>,
1326 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1328 pub created_at: ::std::option::Option<i64>,
1329 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1331 pub detail: ::std::vec::Vec<OutputDetailItem>,
1332 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1334 pub error_message: ::std::option::Option<::std::string::String>,
1335 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1337 pub failed_at: ::std::option::Option<i64>,
1338 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1340 pub id: ::std::option::Option<::std::string::String>,
1341 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1343 pub model: ::std::option::Option<::std::string::String>,
1344 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1346 pub response: ::std::option::Option<ChatCompletionResponsePayload>,
1347 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1349 pub started_at: ::std::option::Option<i64>,
1350 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1352 pub status: ::std::option::Option<OutputStatus>,
1353}
1354impl Output {
1355 pub fn builder() -> builder::Output {
1356 Default::default()
1357 }
1358}
1359#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
1361pub struct OutputDetailItem {
1362 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1364 pub loc: ::std::vec::Vec<::std::string::String>,
1365 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
1367 pub msg: ::std::option::Option<::std::string::String>,
1368 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
1370 pub type_: ::std::option::Option<::std::string::String>,
1371}
1372impl OutputDetailItem {
1373 pub fn builder() -> builder::OutputDetailItem {
1374 Default::default()
1375 }
1376}
1377#[derive(
1379 ::serde::Deserialize,
1380 ::serde::Serialize,
1381 Clone,
1382 Copy,
1383 Debug,
1384 Eq,
1385 Hash,
1386 Ord,
1387 PartialEq,
1388 PartialOrd
1389)]
1390pub enum OutputStatus {
1391 #[serde(rename = "CREATED")]
1392 Created,
1393 #[serde(rename = "IN_PROGRESS")]
1394 InProgress,
1395 #[serde(rename = "COMPLETED")]
1396 Completed,
1397 #[serde(rename = "FAILED")]
1398 Failed,
1399}
1400impl ::std::fmt::Display for OutputStatus {
1401 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1402 match *self {
1403 Self::Created => f.write_str("CREATED"),
1404 Self::InProgress => f.write_str("IN_PROGRESS"),
1405 Self::Completed => f.write_str("COMPLETED"),
1406 Self::Failed => f.write_str("FAILED"),
1407 }
1408 }
1409}
1410impl ::std::str::FromStr for OutputStatus {
1411 type Err = self::error::ConversionError;
1412 fn from_str(
1413 value: &str,
1414 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1415 match value {
1416 "CREATED" => Ok(Self::Created),
1417 "IN_PROGRESS" => Ok(Self::InProgress),
1418 "COMPLETED" => Ok(Self::Completed),
1419 "FAILED" => Ok(Self::Failed),
1420 _ => Err("invalid value".into()),
1421 }
1422 }
1423}
1424impl ::std::convert::TryFrom<&str> for OutputStatus {
1425 type Error = self::error::ConversionError;
1426 fn try_from(
1427 value: &str,
1428 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1429 value.parse()
1430 }
1431}
1432impl ::std::convert::TryFrom<::std::string::String> for OutputStatus {
1433 type Error = self::error::ConversionError;
1434 fn try_from(
1435 value: ::std::string::String,
1436 ) -> ::std::result::Result<Self, self::error::ConversionError> {
1437 value.parse()
1438 }
1439}
1440pub mod builder {
1442 #[derive(Clone, Debug)]
1443 pub struct ChatCompletionResponsePayload {
1444 choices: ::std::result::Result<
1445 ::std::vec::Vec<super::ChatCompletionResponsePayloadChoicesItem>,
1446 ::std::string::String,
1447 >,
1448 citations: ::std::result::Result<
1449 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
1450 ::std::string::String,
1451 >,
1452 created: ::std::result::Result<
1453 ::std::option::Option<i64>,
1454 ::std::string::String,
1455 >,
1456 id: ::std::result::Result<
1457 ::std::option::Option<::std::string::String>,
1458 ::std::string::String,
1459 >,
1460 images: ::std::result::Result<
1461 ::std::option::Option<
1462 ::std::vec::Vec<super::ChatCompletionResponsePayloadImagesItem>,
1463 >,
1464 ::std::string::String,
1465 >,
1466 model: ::std::result::Result<
1467 ::std::option::Option<::std::string::String>,
1468 ::std::string::String,
1469 >,
1470 object: ::std::result::Result<
1471 ::std::option::Option<::std::string::String>,
1472 ::std::string::String,
1473 >,
1474 related_questions: ::std::result::Result<
1475 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
1476 ::std::string::String,
1477 >,
1478 search_results: ::std::result::Result<
1479 ::std::option::Option<
1480 ::std::vec::Vec<super::ChatCompletionResponsePayloadSearchResultsItem>,
1481 >,
1482 ::std::string::String,
1483 >,
1484 usage: ::std::result::Result<
1485 ::std::option::Option<
1486 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1487 >,
1488 ::std::string::String,
1489 >,
1490 }
1491 impl ::std::default::Default for ChatCompletionResponsePayload {
1492 fn default() -> Self {
1493 Self {
1494 choices: Ok(Default::default()),
1495 citations: Ok(Default::default()),
1496 created: Ok(Default::default()),
1497 id: Ok(Default::default()),
1498 images: Ok(Default::default()),
1499 model: Ok(Default::default()),
1500 object: Ok(Default::default()),
1501 related_questions: Ok(Default::default()),
1502 search_results: Ok(Default::default()),
1503 usage: Ok(Default::default()),
1504 }
1505 }
1506 }
1507 impl ChatCompletionResponsePayload {
1508 pub fn choices<T>(mut self, value: T) -> Self
1509 where
1510 T: ::std::convert::TryInto<
1511 ::std::vec::Vec<super::ChatCompletionResponsePayloadChoicesItem>,
1512 >,
1513 T::Error: ::std::fmt::Display,
1514 {
1515 self.choices = value
1516 .try_into()
1517 .map_err(|e| {
1518 format!("error converting supplied value for choices: {e}")
1519 });
1520 self
1521 }
1522 pub fn citations<T>(mut self, value: T) -> Self
1523 where
1524 T: ::std::convert::TryInto<
1525 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
1526 >,
1527 T::Error: ::std::fmt::Display,
1528 {
1529 self.citations = value
1530 .try_into()
1531 .map_err(|e| {
1532 format!("error converting supplied value for citations: {e}")
1533 });
1534 self
1535 }
1536 pub fn created<T>(mut self, value: T) -> Self
1537 where
1538 T: ::std::convert::TryInto<::std::option::Option<i64>>,
1539 T::Error: ::std::fmt::Display,
1540 {
1541 self.created = value
1542 .try_into()
1543 .map_err(|e| {
1544 format!("error converting supplied value for created: {e}")
1545 });
1546 self
1547 }
1548 pub fn id<T>(mut self, value: T) -> Self
1549 where
1550 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1551 T::Error: ::std::fmt::Display,
1552 {
1553 self.id = value
1554 .try_into()
1555 .map_err(|e| format!("error converting supplied value for id: {e}"));
1556 self
1557 }
1558 pub fn images<T>(mut self, value: T) -> Self
1559 where
1560 T: ::std::convert::TryInto<
1561 ::std::option::Option<
1562 ::std::vec::Vec<super::ChatCompletionResponsePayloadImagesItem>,
1563 >,
1564 >,
1565 T::Error: ::std::fmt::Display,
1566 {
1567 self.images = value
1568 .try_into()
1569 .map_err(|e| format!("error converting supplied value for images: {e}"));
1570 self
1571 }
1572 pub fn model<T>(mut self, value: T) -> Self
1573 where
1574 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1575 T::Error: ::std::fmt::Display,
1576 {
1577 self.model = value
1578 .try_into()
1579 .map_err(|e| format!("error converting supplied value for model: {e}"));
1580 self
1581 }
1582 pub fn object<T>(mut self, value: T) -> Self
1583 where
1584 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1585 T::Error: ::std::fmt::Display,
1586 {
1587 self.object = value
1588 .try_into()
1589 .map_err(|e| format!("error converting supplied value for object: {e}"));
1590 self
1591 }
1592 pub fn related_questions<T>(mut self, value: T) -> Self
1593 where
1594 T: ::std::convert::TryInto<
1595 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
1596 >,
1597 T::Error: ::std::fmt::Display,
1598 {
1599 self.related_questions = value
1600 .try_into()
1601 .map_err(|e| {
1602 format!("error converting supplied value for related_questions: {e}")
1603 });
1604 self
1605 }
1606 pub fn search_results<T>(mut self, value: T) -> Self
1607 where
1608 T: ::std::convert::TryInto<
1609 ::std::option::Option<
1610 ::std::vec::Vec<
1611 super::ChatCompletionResponsePayloadSearchResultsItem,
1612 >,
1613 >,
1614 >,
1615 T::Error: ::std::fmt::Display,
1616 {
1617 self.search_results = value
1618 .try_into()
1619 .map_err(|e| {
1620 format!("error converting supplied value for search_results: {e}")
1621 });
1622 self
1623 }
1624 pub fn usage<T>(mut self, value: T) -> Self
1625 where
1626 T: ::std::convert::TryInto<
1627 ::std::option::Option<
1628 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1629 >,
1630 >,
1631 T::Error: ::std::fmt::Display,
1632 {
1633 self.usage = value
1634 .try_into()
1635 .map_err(|e| format!("error converting supplied value for usage: {e}"));
1636 self
1637 }
1638 }
1639 impl ::std::convert::TryFrom<ChatCompletionResponsePayload>
1640 for super::ChatCompletionResponsePayload {
1641 type Error = super::error::ConversionError;
1642 fn try_from(
1643 value: ChatCompletionResponsePayload,
1644 ) -> ::std::result::Result<Self, super::error::ConversionError> {
1645 Ok(Self {
1646 choices: value.choices?,
1647 citations: value.citations?,
1648 created: value.created?,
1649 id: value.id?,
1650 images: value.images?,
1651 model: value.model?,
1652 object: value.object?,
1653 related_questions: value.related_questions?,
1654 search_results: value.search_results?,
1655 usage: value.usage?,
1656 })
1657 }
1658 }
1659 impl ::std::convert::From<super::ChatCompletionResponsePayload>
1660 for ChatCompletionResponsePayload {
1661 fn from(value: super::ChatCompletionResponsePayload) -> Self {
1662 Self {
1663 choices: Ok(value.choices),
1664 citations: Ok(value.citations),
1665 created: Ok(value.created),
1666 id: Ok(value.id),
1667 images: Ok(value.images),
1668 model: Ok(value.model),
1669 object: Ok(value.object),
1670 related_questions: Ok(value.related_questions),
1671 search_results: Ok(value.search_results),
1672 usage: Ok(value.usage),
1673 }
1674 }
1675 }
1676 #[derive(Clone, Debug)]
1677 pub struct ChatCompletionResponsePayloadChoicesItem {
1678 delta: ::std::result::Result<
1679 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1680 ::std::string::String,
1681 >,
1682 finish_reason: ::std::result::Result<
1683 ::std::option::Option<
1684 super::ChatCompletionResponsePayloadChoicesItemFinishReason,
1685 >,
1686 ::std::string::String,
1687 >,
1688 index: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
1689 message: ::std::result::Result<
1690 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1691 ::std::string::String,
1692 >,
1693 }
1694 impl ::std::default::Default for ChatCompletionResponsePayloadChoicesItem {
1695 fn default() -> Self {
1696 Self {
1697 delta: Ok(Default::default()),
1698 finish_reason: Ok(Default::default()),
1699 index: Ok(Default::default()),
1700 message: Ok(Default::default()),
1701 }
1702 }
1703 }
1704 impl ChatCompletionResponsePayloadChoicesItem {
1705 pub fn delta<T>(mut self, value: T) -> Self
1706 where
1707 T: ::std::convert::TryInto<
1708 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1709 >,
1710 T::Error: ::std::fmt::Display,
1711 {
1712 self.delta = value
1713 .try_into()
1714 .map_err(|e| format!("error converting supplied value for delta: {e}"));
1715 self
1716 }
1717 pub fn finish_reason<T>(mut self, value: T) -> Self
1718 where
1719 T: ::std::convert::TryInto<
1720 ::std::option::Option<
1721 super::ChatCompletionResponsePayloadChoicesItemFinishReason,
1722 >,
1723 >,
1724 T::Error: ::std::fmt::Display,
1725 {
1726 self.finish_reason = value
1727 .try_into()
1728 .map_err(|e| {
1729 format!("error converting supplied value for finish_reason: {e}")
1730 });
1731 self
1732 }
1733 pub fn index<T>(mut self, value: T) -> Self
1734 where
1735 T: ::std::convert::TryInto<::std::option::Option<i64>>,
1736 T::Error: ::std::fmt::Display,
1737 {
1738 self.index = value
1739 .try_into()
1740 .map_err(|e| format!("error converting supplied value for index: {e}"));
1741 self
1742 }
1743 pub fn message<T>(mut self, value: T) -> Self
1744 where
1745 T: ::std::convert::TryInto<
1746 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
1747 >,
1748 T::Error: ::std::fmt::Display,
1749 {
1750 self.message = value
1751 .try_into()
1752 .map_err(|e| {
1753 format!("error converting supplied value for message: {e}")
1754 });
1755 self
1756 }
1757 }
1758 impl ::std::convert::TryFrom<ChatCompletionResponsePayloadChoicesItem>
1759 for super::ChatCompletionResponsePayloadChoicesItem {
1760 type Error = super::error::ConversionError;
1761 fn try_from(
1762 value: ChatCompletionResponsePayloadChoicesItem,
1763 ) -> ::std::result::Result<Self, super::error::ConversionError> {
1764 Ok(Self {
1765 delta: value.delta?,
1766 finish_reason: value.finish_reason?,
1767 index: value.index?,
1768 message: value.message?,
1769 })
1770 }
1771 }
1772 impl ::std::convert::From<super::ChatCompletionResponsePayloadChoicesItem>
1773 for ChatCompletionResponsePayloadChoicesItem {
1774 fn from(value: super::ChatCompletionResponsePayloadChoicesItem) -> Self {
1775 Self {
1776 delta: Ok(value.delta),
1777 finish_reason: Ok(value.finish_reason),
1778 index: Ok(value.index),
1779 message: Ok(value.message),
1780 }
1781 }
1782 }
1783 #[derive(Clone, Debug)]
1784 pub struct ChatCompletionResponsePayloadImagesItem {
1785 height: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
1786 image_url: ::std::result::Result<
1787 ::std::option::Option<::std::string::String>,
1788 ::std::string::String,
1789 >,
1790 origin_url: ::std::result::Result<
1791 ::std::option::Option<::std::string::String>,
1792 ::std::string::String,
1793 >,
1794 title: ::std::result::Result<
1795 ::std::option::Option<::std::string::String>,
1796 ::std::string::String,
1797 >,
1798 width: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
1799 }
1800 impl ::std::default::Default for ChatCompletionResponsePayloadImagesItem {
1801 fn default() -> Self {
1802 Self {
1803 height: Ok(Default::default()),
1804 image_url: Ok(Default::default()),
1805 origin_url: Ok(Default::default()),
1806 title: Ok(Default::default()),
1807 width: Ok(Default::default()),
1808 }
1809 }
1810 }
1811 impl ChatCompletionResponsePayloadImagesItem {
1812 pub fn height<T>(mut self, value: T) -> Self
1813 where
1814 T: ::std::convert::TryInto<::std::option::Option<i64>>,
1815 T::Error: ::std::fmt::Display,
1816 {
1817 self.height = value
1818 .try_into()
1819 .map_err(|e| format!("error converting supplied value for height: {e}"));
1820 self
1821 }
1822 pub fn image_url<T>(mut self, value: T) -> Self
1823 where
1824 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1825 T::Error: ::std::fmt::Display,
1826 {
1827 self.image_url = value
1828 .try_into()
1829 .map_err(|e| {
1830 format!("error converting supplied value for image_url: {e}")
1831 });
1832 self
1833 }
1834 pub fn origin_url<T>(mut self, value: T) -> Self
1835 where
1836 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1837 T::Error: ::std::fmt::Display,
1838 {
1839 self.origin_url = value
1840 .try_into()
1841 .map_err(|e| {
1842 format!("error converting supplied value for origin_url: {e}")
1843 });
1844 self
1845 }
1846 pub fn title<T>(mut self, value: T) -> Self
1847 where
1848 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1849 T::Error: ::std::fmt::Display,
1850 {
1851 self.title = value
1852 .try_into()
1853 .map_err(|e| format!("error converting supplied value for title: {e}"));
1854 self
1855 }
1856 pub fn width<T>(mut self, value: T) -> Self
1857 where
1858 T: ::std::convert::TryInto<::std::option::Option<i64>>,
1859 T::Error: ::std::fmt::Display,
1860 {
1861 self.width = value
1862 .try_into()
1863 .map_err(|e| format!("error converting supplied value for width: {e}"));
1864 self
1865 }
1866 }
1867 impl ::std::convert::TryFrom<ChatCompletionResponsePayloadImagesItem>
1868 for super::ChatCompletionResponsePayloadImagesItem {
1869 type Error = super::error::ConversionError;
1870 fn try_from(
1871 value: ChatCompletionResponsePayloadImagesItem,
1872 ) -> ::std::result::Result<Self, super::error::ConversionError> {
1873 Ok(Self {
1874 height: value.height?,
1875 image_url: value.image_url?,
1876 origin_url: value.origin_url?,
1877 title: value.title?,
1878 width: value.width?,
1879 })
1880 }
1881 }
1882 impl ::std::convert::From<super::ChatCompletionResponsePayloadImagesItem>
1883 for ChatCompletionResponsePayloadImagesItem {
1884 fn from(value: super::ChatCompletionResponsePayloadImagesItem) -> Self {
1885 Self {
1886 height: Ok(value.height),
1887 image_url: Ok(value.image_url),
1888 origin_url: Ok(value.origin_url),
1889 title: Ok(value.title),
1890 width: Ok(value.width),
1891 }
1892 }
1893 }
1894 #[derive(Clone, Debug)]
1895 pub struct ChatCompletionResponsePayloadSearchResultsItem {
1896 date: ::std::result::Result<
1897 ::std::option::Option<::std::string::String>,
1898 ::std::string::String,
1899 >,
1900 last_updated: ::std::result::Result<
1901 ::std::option::Option<::std::string::String>,
1902 ::std::string::String,
1903 >,
1904 snippet: ::std::result::Result<
1905 ::std::option::Option<::std::string::String>,
1906 ::std::string::String,
1907 >,
1908 source: ::std::result::Result<
1909 ::std::option::Option<
1910 super::ChatCompletionResponsePayloadSearchResultsItemSource,
1911 >,
1912 ::std::string::String,
1913 >,
1914 title: ::std::result::Result<
1915 ::std::option::Option<::std::string::String>,
1916 ::std::string::String,
1917 >,
1918 url: ::std::result::Result<
1919 ::std::option::Option<::std::string::String>,
1920 ::std::string::String,
1921 >,
1922 }
1923 impl ::std::default::Default for ChatCompletionResponsePayloadSearchResultsItem {
1924 fn default() -> Self {
1925 Self {
1926 date: Ok(Default::default()),
1927 last_updated: Ok(Default::default()),
1928 snippet: Ok(Default::default()),
1929 source: Ok(Default::default()),
1930 title: Ok(Default::default()),
1931 url: Ok(Default::default()),
1932 }
1933 }
1934 }
1935 impl ChatCompletionResponsePayloadSearchResultsItem {
1936 pub fn date<T>(mut self, value: T) -> Self
1937 where
1938 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1939 T::Error: ::std::fmt::Display,
1940 {
1941 self.date = value
1942 .try_into()
1943 .map_err(|e| format!("error converting supplied value for date: {e}"));
1944 self
1945 }
1946 pub fn last_updated<T>(mut self, value: T) -> Self
1947 where
1948 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1949 T::Error: ::std::fmt::Display,
1950 {
1951 self.last_updated = value
1952 .try_into()
1953 .map_err(|e| {
1954 format!("error converting supplied value for last_updated: {e}")
1955 });
1956 self
1957 }
1958 pub fn snippet<T>(mut self, value: T) -> Self
1959 where
1960 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1961 T::Error: ::std::fmt::Display,
1962 {
1963 self.snippet = value
1964 .try_into()
1965 .map_err(|e| {
1966 format!("error converting supplied value for snippet: {e}")
1967 });
1968 self
1969 }
1970 pub fn source<T>(mut self, value: T) -> Self
1971 where
1972 T: ::std::convert::TryInto<
1973 ::std::option::Option<
1974 super::ChatCompletionResponsePayloadSearchResultsItemSource,
1975 >,
1976 >,
1977 T::Error: ::std::fmt::Display,
1978 {
1979 self.source = value
1980 .try_into()
1981 .map_err(|e| format!("error converting supplied value for source: {e}"));
1982 self
1983 }
1984 pub fn title<T>(mut self, value: T) -> Self
1985 where
1986 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1987 T::Error: ::std::fmt::Display,
1988 {
1989 self.title = value
1990 .try_into()
1991 .map_err(|e| format!("error converting supplied value for title: {e}"));
1992 self
1993 }
1994 pub fn url<T>(mut self, value: T) -> Self
1995 where
1996 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
1997 T::Error: ::std::fmt::Display,
1998 {
1999 self.url = value
2000 .try_into()
2001 .map_err(|e| format!("error converting supplied value for url: {e}"));
2002 self
2003 }
2004 }
2005 impl ::std::convert::TryFrom<ChatCompletionResponsePayloadSearchResultsItem>
2006 for super::ChatCompletionResponsePayloadSearchResultsItem {
2007 type Error = super::error::ConversionError;
2008 fn try_from(
2009 value: ChatCompletionResponsePayloadSearchResultsItem,
2010 ) -> ::std::result::Result<Self, super::error::ConversionError> {
2011 Ok(Self {
2012 date: value.date?,
2013 last_updated: value.last_updated?,
2014 snippet: value.snippet?,
2015 source: value.source?,
2016 title: value.title?,
2017 url: value.url?,
2018 })
2019 }
2020 }
2021 impl ::std::convert::From<super::ChatCompletionResponsePayloadSearchResultsItem>
2022 for ChatCompletionResponsePayloadSearchResultsItem {
2023 fn from(value: super::ChatCompletionResponsePayloadSearchResultsItem) -> Self {
2024 Self {
2025 date: Ok(value.date),
2026 last_updated: Ok(value.last_updated),
2027 snippet: Ok(value.snippet),
2028 source: Ok(value.source),
2029 title: Ok(value.title),
2030 url: Ok(value.url),
2031 }
2032 }
2033 }
2034 #[derive(Clone, Debug)]
2035 pub struct Output {
2036 completed_at: ::std::result::Result<
2037 ::std::option::Option<i64>,
2038 ::std::string::String,
2039 >,
2040 created_at: ::std::result::Result<
2041 ::std::option::Option<i64>,
2042 ::std::string::String,
2043 >,
2044 detail: ::std::result::Result<
2045 ::std::vec::Vec<super::OutputDetailItem>,
2046 ::std::string::String,
2047 >,
2048 error_message: ::std::result::Result<
2049 ::std::option::Option<::std::string::String>,
2050 ::std::string::String,
2051 >,
2052 failed_at: ::std::result::Result<
2053 ::std::option::Option<i64>,
2054 ::std::string::String,
2055 >,
2056 id: ::std::result::Result<
2057 ::std::option::Option<::std::string::String>,
2058 ::std::string::String,
2059 >,
2060 model: ::std::result::Result<
2061 ::std::option::Option<::std::string::String>,
2062 ::std::string::String,
2063 >,
2064 response: ::std::result::Result<
2065 ::std::option::Option<super::ChatCompletionResponsePayload>,
2066 ::std::string::String,
2067 >,
2068 started_at: ::std::result::Result<
2069 ::std::option::Option<i64>,
2070 ::std::string::String,
2071 >,
2072 status: ::std::result::Result<
2073 ::std::option::Option<super::OutputStatus>,
2074 ::std::string::String,
2075 >,
2076 }
2077 impl ::std::default::Default for Output {
2078 fn default() -> Self {
2079 Self {
2080 completed_at: Ok(Default::default()),
2081 created_at: Ok(Default::default()),
2082 detail: Ok(Default::default()),
2083 error_message: Ok(Default::default()),
2084 failed_at: Ok(Default::default()),
2085 id: Ok(Default::default()),
2086 model: Ok(Default::default()),
2087 response: Ok(Default::default()),
2088 started_at: Ok(Default::default()),
2089 status: Ok(Default::default()),
2090 }
2091 }
2092 }
2093 impl Output {
2094 pub fn completed_at<T>(mut self, value: T) -> Self
2095 where
2096 T: ::std::convert::TryInto<::std::option::Option<i64>>,
2097 T::Error: ::std::fmt::Display,
2098 {
2099 self.completed_at = value
2100 .try_into()
2101 .map_err(|e| {
2102 format!("error converting supplied value for completed_at: {e}")
2103 });
2104 self
2105 }
2106 pub fn created_at<T>(mut self, value: T) -> Self
2107 where
2108 T: ::std::convert::TryInto<::std::option::Option<i64>>,
2109 T::Error: ::std::fmt::Display,
2110 {
2111 self.created_at = value
2112 .try_into()
2113 .map_err(|e| {
2114 format!("error converting supplied value for created_at: {e}")
2115 });
2116 self
2117 }
2118 pub fn detail<T>(mut self, value: T) -> Self
2119 where
2120 T: ::std::convert::TryInto<::std::vec::Vec<super::OutputDetailItem>>,
2121 T::Error: ::std::fmt::Display,
2122 {
2123 self.detail = value
2124 .try_into()
2125 .map_err(|e| format!("error converting supplied value for detail: {e}"));
2126 self
2127 }
2128 pub fn error_message<T>(mut self, value: T) -> Self
2129 where
2130 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2131 T::Error: ::std::fmt::Display,
2132 {
2133 self.error_message = value
2134 .try_into()
2135 .map_err(|e| {
2136 format!("error converting supplied value for error_message: {e}")
2137 });
2138 self
2139 }
2140 pub fn failed_at<T>(mut self, value: T) -> Self
2141 where
2142 T: ::std::convert::TryInto<::std::option::Option<i64>>,
2143 T::Error: ::std::fmt::Display,
2144 {
2145 self.failed_at = value
2146 .try_into()
2147 .map_err(|e| {
2148 format!("error converting supplied value for failed_at: {e}")
2149 });
2150 self
2151 }
2152 pub fn id<T>(mut self, value: T) -> Self
2153 where
2154 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2155 T::Error: ::std::fmt::Display,
2156 {
2157 self.id = value
2158 .try_into()
2159 .map_err(|e| format!("error converting supplied value for id: {e}"));
2160 self
2161 }
2162 pub fn model<T>(mut self, value: T) -> Self
2163 where
2164 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2165 T::Error: ::std::fmt::Display,
2166 {
2167 self.model = value
2168 .try_into()
2169 .map_err(|e| format!("error converting supplied value for model: {e}"));
2170 self
2171 }
2172 pub fn response<T>(mut self, value: T) -> Self
2173 where
2174 T: ::std::convert::TryInto<
2175 ::std::option::Option<super::ChatCompletionResponsePayload>,
2176 >,
2177 T::Error: ::std::fmt::Display,
2178 {
2179 self.response = value
2180 .try_into()
2181 .map_err(|e| {
2182 format!("error converting supplied value for response: {e}")
2183 });
2184 self
2185 }
2186 pub fn started_at<T>(mut self, value: T) -> Self
2187 where
2188 T: ::std::convert::TryInto<::std::option::Option<i64>>,
2189 T::Error: ::std::fmt::Display,
2190 {
2191 self.started_at = value
2192 .try_into()
2193 .map_err(|e| {
2194 format!("error converting supplied value for started_at: {e}")
2195 });
2196 self
2197 }
2198 pub fn status<T>(mut self, value: T) -> Self
2199 where
2200 T: ::std::convert::TryInto<::std::option::Option<super::OutputStatus>>,
2201 T::Error: ::std::fmt::Display,
2202 {
2203 self.status = value
2204 .try_into()
2205 .map_err(|e| format!("error converting supplied value for status: {e}"));
2206 self
2207 }
2208 }
2209 impl ::std::convert::TryFrom<Output> for super::Output {
2210 type Error = super::error::ConversionError;
2211 fn try_from(
2212 value: Output,
2213 ) -> ::std::result::Result<Self, super::error::ConversionError> {
2214 Ok(Self {
2215 completed_at: value.completed_at?,
2216 created_at: value.created_at?,
2217 detail: value.detail?,
2218 error_message: value.error_message?,
2219 failed_at: value.failed_at?,
2220 id: value.id?,
2221 model: value.model?,
2222 response: value.response?,
2223 started_at: value.started_at?,
2224 status: value.status?,
2225 })
2226 }
2227 }
2228 impl ::std::convert::From<super::Output> for Output {
2229 fn from(value: super::Output) -> Self {
2230 Self {
2231 completed_at: Ok(value.completed_at),
2232 created_at: Ok(value.created_at),
2233 detail: Ok(value.detail),
2234 error_message: Ok(value.error_message),
2235 failed_at: Ok(value.failed_at),
2236 id: Ok(value.id),
2237 model: Ok(value.model),
2238 response: Ok(value.response),
2239 started_at: Ok(value.started_at),
2240 status: Ok(value.status),
2241 }
2242 }
2243 }
2244 #[derive(Clone, Debug)]
2245 pub struct OutputDetailItem {
2246 loc: ::std::result::Result<
2247 ::std::vec::Vec<::std::string::String>,
2248 ::std::string::String,
2249 >,
2250 msg: ::std::result::Result<
2251 ::std::option::Option<::std::string::String>,
2252 ::std::string::String,
2253 >,
2254 type_: ::std::result::Result<
2255 ::std::option::Option<::std::string::String>,
2256 ::std::string::String,
2257 >,
2258 }
2259 impl ::std::default::Default for OutputDetailItem {
2260 fn default() -> Self {
2261 Self {
2262 loc: Ok(Default::default()),
2263 msg: Ok(Default::default()),
2264 type_: Ok(Default::default()),
2265 }
2266 }
2267 }
2268 impl OutputDetailItem {
2269 pub fn loc<T>(mut self, value: T) -> Self
2270 where
2271 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
2272 T::Error: ::std::fmt::Display,
2273 {
2274 self.loc = value
2275 .try_into()
2276 .map_err(|e| format!("error converting supplied value for loc: {e}"));
2277 self
2278 }
2279 pub fn msg<T>(mut self, value: T) -> Self
2280 where
2281 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2282 T::Error: ::std::fmt::Display,
2283 {
2284 self.msg = value
2285 .try_into()
2286 .map_err(|e| format!("error converting supplied value for msg: {e}"));
2287 self
2288 }
2289 pub fn type_<T>(mut self, value: T) -> Self
2290 where
2291 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2292 T::Error: ::std::fmt::Display,
2293 {
2294 self.type_ = value
2295 .try_into()
2296 .map_err(|e| format!("error converting supplied value for type_: {e}"));
2297 self
2298 }
2299 }
2300 impl ::std::convert::TryFrom<OutputDetailItem> for super::OutputDetailItem {
2301 type Error = super::error::ConversionError;
2302 fn try_from(
2303 value: OutputDetailItem,
2304 ) -> ::std::result::Result<Self, super::error::ConversionError> {
2305 Ok(Self {
2306 loc: value.loc?,
2307 msg: value.msg?,
2308 type_: value.type_?,
2309 })
2310 }
2311 }
2312 impl ::std::convert::From<super::OutputDetailItem> for OutputDetailItem {
2313 fn from(value: super::OutputDetailItem) -> Self {
2314 Self {
2315 loc: Ok(value.loc),
2316 msg: Ok(value.msg),
2317 type_: Ok(value.type_),
2318 }
2319 }
2320 }
2321}
2322pub mod error {
2324 pub struct ConversionError(::std::borrow::Cow<'static, str>);
2326 impl ::std::error::Error for ConversionError {}
2327 impl ::std::fmt::Display for ConversionError {
2328 fn fmt(
2329 &self,
2330 f: &mut ::std::fmt::Formatter<'_>,
2331 ) -> Result<(), ::std::fmt::Error> {
2332 ::std::fmt::Display::fmt(&self.0, f)
2333 }
2334 }
2335 impl ::std::fmt::Debug for ConversionError {
2336 fn fmt(
2337 &self,
2338 f: &mut ::std::fmt::Formatter<'_>,
2339 ) -> Result<(), ::std::fmt::Error> {
2340 ::std::fmt::Debug::fmt(&self.0, f)
2341 }
2342 }
2343 impl From<&'static str> for ConversionError {
2344 fn from(value: &'static str) -> Self {
2345 Self(value.into())
2346 }
2347 }
2348 impl From<String> for ConversionError {
2349 fn from(value: String) -> Self {
2350 Self(value.into())
2351 }
2352 }
2353}
2354
2355}
2356
2357 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "apiRequest", part: ::one::Part::Path, key: Some("apiRequest") }], required_parts: &[::one::Part::Path] };
2359
2360 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
2369 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZpCyaCE::92w3q2h1RBy0zJ6NmDUWRg", Method::GET, "/v1/async/sonar/{{apiRequest}}").with_routed(&input, &ROUTING)?
2370 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
2371 }
2372
2373 impl IntoOperation for Input {
2374 type Output = output::Output;
2375
2376 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
2377 build(self)
2378 }
2379 }
2380 impl IntoOperation for builder::Input {
2381 type Output = output::Output;
2382
2383 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
2384 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
2385 }
2386 }
2387}
2388pub fn get_async_chat_completion_response() -> get_async_chat_completion_response::builder::Input {
2390 get_async_chat_completion_response::builder::Input::default()
2391}
2392pub mod search_web {
2393 use ::one::{Error, IntoOperation, Method, Operation};
2394#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2396#[serde(deny_unknown_fields)]
2397pub struct Input {
2398 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2400 pub country: ::std::option::Option<InputCountry>,
2401 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2403 pub last_updated_after_filter: ::std::option::Option<::std::string::String>,
2404 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2406 pub last_updated_before_filter: ::std::option::Option<::std::string::String>,
2407 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2409 pub max_results: ::std::option::Option<::std::num::NonZeroU64>,
2410 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2412 pub max_tokens: ::std::option::Option<::std::num::NonZeroU64>,
2413 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2415 pub max_tokens_per_page: ::std::option::Option<::std::num::NonZeroU64>,
2416 pub query: InputQuery,
2418 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2420 pub search_after_date_filter: ::std::option::Option<::std::string::String>,
2421 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2423 pub search_before_date_filter: ::std::option::Option<::std::string::String>,
2424 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2426 pub search_domain_filter: ::std::vec::Vec<::std::string::String>,
2427 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2429 pub search_language_filter: ::std::vec::Vec<::std::string::String>,
2430 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2432 pub search_recency_filter: ::std::option::Option<InputSearchRecencyFilter>,
2433}
2434impl Input {
2435 pub fn builder() -> builder::Input {
2436 Default::default()
2437 }
2438}
2439#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2441#[serde(transparent)]
2442pub struct InputCountry(::std::string::String);
2443impl ::std::ops::Deref for InputCountry {
2444 type Target = ::std::string::String;
2445 fn deref(&self) -> &::std::string::String {
2446 &self.0
2447 }
2448}
2449impl ::std::convert::From<InputCountry> for ::std::string::String {
2450 fn from(value: InputCountry) -> Self {
2451 value.0
2452 }
2453}
2454impl ::std::str::FromStr for InputCountry {
2455 type Err = self::error::ConversionError;
2456 fn from_str(
2457 value: &str,
2458 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2459 ::std::convert::TryFrom::try_from(value)
2460 }
2461}
2462impl ::std::convert::TryFrom<&str> for InputCountry {
2463 type Error = self::error::ConversionError;
2464 fn try_from(
2465 value: &str,
2466 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2467 if value.chars().count() > 2usize {
2468 return Err("longer than 2 characters".into());
2469 }
2470 if value.chars().count() < 2usize {
2471 return Err("shorter than 2 characters".into());
2472 }
2473 Ok(Self(value.to_string()))
2474 }
2475}
2476impl ::std::convert::TryFrom<::std::string::String> for InputCountry {
2477 type Error = self::error::ConversionError;
2478 fn try_from(
2479 value: ::std::string::String,
2480 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2481 ::std::convert::TryFrom::try_from(value.as_str())
2482 }
2483}
2484impl<'de> ::serde::Deserialize<'de> for InputCountry {
2485 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
2486 where
2487 D: ::serde::Deserializer<'de>,
2488 {
2489 ::std::convert::TryFrom::try_from(
2490 ::std::string::String::deserialize(deserializer)?,
2491 )
2492 .map_err(|e: self::error::ConversionError| {
2493 <D::Error as ::serde::de::Error>::custom(e.to_string())
2494 })
2495 }
2496}
2497#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2499#[serde(untagged)]
2500pub enum InputQuery {
2501 String(::std::string::String),
2502 Array(::std::vec::Vec<::std::string::String>),
2503}
2504impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for InputQuery {
2505 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
2506 Self::Array(value)
2507 }
2508}
2509#[derive(
2511 ::serde::Deserialize,
2512 ::serde::Serialize,
2513 Clone,
2514 Copy,
2515 Debug,
2516 Eq,
2517 Hash,
2518 Ord,
2519 PartialEq,
2520 PartialOrd
2521)]
2522pub enum InputSearchRecencyFilter {
2523 #[serde(rename = "hour")]
2524 Hour,
2525 #[serde(rename = "day")]
2526 Day,
2527 #[serde(rename = "week")]
2528 Week,
2529 #[serde(rename = "month")]
2530 Month,
2531 #[serde(rename = "year")]
2532 Year,
2533}
2534impl ::std::fmt::Display for InputSearchRecencyFilter {
2535 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2536 match *self {
2537 Self::Hour => f.write_str("hour"),
2538 Self::Day => f.write_str("day"),
2539 Self::Week => f.write_str("week"),
2540 Self::Month => f.write_str("month"),
2541 Self::Year => f.write_str("year"),
2542 }
2543 }
2544}
2545impl ::std::str::FromStr for InputSearchRecencyFilter {
2546 type Err = self::error::ConversionError;
2547 fn from_str(
2548 value: &str,
2549 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2550 match value {
2551 "hour" => Ok(Self::Hour),
2552 "day" => Ok(Self::Day),
2553 "week" => Ok(Self::Week),
2554 "month" => Ok(Self::Month),
2555 "year" => Ok(Self::Year),
2556 _ => Err("invalid value".into()),
2557 }
2558 }
2559}
2560impl ::std::convert::TryFrom<&str> for InputSearchRecencyFilter {
2561 type Error = self::error::ConversionError;
2562 fn try_from(
2563 value: &str,
2564 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2565 value.parse()
2566 }
2567}
2568impl ::std::convert::TryFrom<::std::string::String> for InputSearchRecencyFilter {
2569 type Error = self::error::ConversionError;
2570 fn try_from(
2571 value: ::std::string::String,
2572 ) -> ::std::result::Result<Self, self::error::ConversionError> {
2573 value.parse()
2574 }
2575}
2576pub mod builder {
2578 #[derive(Clone, Debug)]
2579 pub struct Input {
2580 country: ::std::result::Result<
2581 ::std::option::Option<super::InputCountry>,
2582 ::std::string::String,
2583 >,
2584 last_updated_after_filter: ::std::result::Result<
2585 ::std::option::Option<::std::string::String>,
2586 ::std::string::String,
2587 >,
2588 last_updated_before_filter: ::std::result::Result<
2589 ::std::option::Option<::std::string::String>,
2590 ::std::string::String,
2591 >,
2592 max_results: ::std::result::Result<
2593 ::std::option::Option<::std::num::NonZeroU64>,
2594 ::std::string::String,
2595 >,
2596 max_tokens: ::std::result::Result<
2597 ::std::option::Option<::std::num::NonZeroU64>,
2598 ::std::string::String,
2599 >,
2600 max_tokens_per_page: ::std::result::Result<
2601 ::std::option::Option<::std::num::NonZeroU64>,
2602 ::std::string::String,
2603 >,
2604 query: ::std::result::Result<super::InputQuery, ::std::string::String>,
2605 search_after_date_filter: ::std::result::Result<
2606 ::std::option::Option<::std::string::String>,
2607 ::std::string::String,
2608 >,
2609 search_before_date_filter: ::std::result::Result<
2610 ::std::option::Option<::std::string::String>,
2611 ::std::string::String,
2612 >,
2613 search_domain_filter: ::std::result::Result<
2614 ::std::vec::Vec<::std::string::String>,
2615 ::std::string::String,
2616 >,
2617 search_language_filter: ::std::result::Result<
2618 ::std::vec::Vec<::std::string::String>,
2619 ::std::string::String,
2620 >,
2621 search_recency_filter: ::std::result::Result<
2622 ::std::option::Option<super::InputSearchRecencyFilter>,
2623 ::std::string::String,
2624 >,
2625 }
2626 impl ::std::default::Default for Input {
2627 fn default() -> Self {
2628 Self {
2629 country: Ok(Default::default()),
2630 last_updated_after_filter: Ok(Default::default()),
2631 last_updated_before_filter: Ok(Default::default()),
2632 max_results: Ok(Default::default()),
2633 max_tokens: Ok(Default::default()),
2634 max_tokens_per_page: Ok(Default::default()),
2635 query: Err("no value supplied for query".to_string()),
2636 search_after_date_filter: Ok(Default::default()),
2637 search_before_date_filter: Ok(Default::default()),
2638 search_domain_filter: Ok(Default::default()),
2639 search_language_filter: Ok(Default::default()),
2640 search_recency_filter: Ok(Default::default()),
2641 }
2642 }
2643 }
2644 impl Input {
2645 pub fn country<T>(mut self, value: T) -> Self
2646 where
2647 T: ::std::convert::TryInto<::std::option::Option<super::InputCountry>>,
2648 T::Error: ::std::fmt::Display,
2649 {
2650 self.country = value
2651 .try_into()
2652 .map_err(|e| {
2653 format!("error converting supplied value for country: {e}")
2654 });
2655 self
2656 }
2657 pub fn last_updated_after_filter<T>(mut self, value: T) -> Self
2658 where
2659 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2660 T::Error: ::std::fmt::Display,
2661 {
2662 self.last_updated_after_filter = value
2663 .try_into()
2664 .map_err(|e| {
2665 format!(
2666 "error converting supplied value for last_updated_after_filter: {e}"
2667 )
2668 });
2669 self
2670 }
2671 pub fn last_updated_before_filter<T>(mut self, value: T) -> Self
2672 where
2673 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2674 T::Error: ::std::fmt::Display,
2675 {
2676 self.last_updated_before_filter = value
2677 .try_into()
2678 .map_err(|e| {
2679 format!(
2680 "error converting supplied value for last_updated_before_filter: {e}"
2681 )
2682 });
2683 self
2684 }
2685 pub fn max_results<T>(mut self, value: T) -> Self
2686 where
2687 T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
2688 T::Error: ::std::fmt::Display,
2689 {
2690 self.max_results = value
2691 .try_into()
2692 .map_err(|e| {
2693 format!("error converting supplied value for max_results: {e}")
2694 });
2695 self
2696 }
2697 pub fn max_tokens<T>(mut self, value: T) -> Self
2698 where
2699 T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
2700 T::Error: ::std::fmt::Display,
2701 {
2702 self.max_tokens = value
2703 .try_into()
2704 .map_err(|e| {
2705 format!("error converting supplied value for max_tokens: {e}")
2706 });
2707 self
2708 }
2709 pub fn max_tokens_per_page<T>(mut self, value: T) -> Self
2710 where
2711 T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
2712 T::Error: ::std::fmt::Display,
2713 {
2714 self.max_tokens_per_page = value
2715 .try_into()
2716 .map_err(|e| {
2717 format!(
2718 "error converting supplied value for max_tokens_per_page: {e}"
2719 )
2720 });
2721 self
2722 }
2723 pub fn query<T>(mut self, value: T) -> Self
2724 where
2725 T: ::std::convert::TryInto<super::InputQuery>,
2726 T::Error: ::std::fmt::Display,
2727 {
2728 self.query = value
2729 .try_into()
2730 .map_err(|e| format!("error converting supplied value for query: {e}"));
2731 self
2732 }
2733 pub fn search_after_date_filter<T>(mut self, value: T) -> Self
2734 where
2735 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2736 T::Error: ::std::fmt::Display,
2737 {
2738 self.search_after_date_filter = value
2739 .try_into()
2740 .map_err(|e| {
2741 format!(
2742 "error converting supplied value for search_after_date_filter: {e}"
2743 )
2744 });
2745 self
2746 }
2747 pub fn search_before_date_filter<T>(mut self, value: T) -> Self
2748 where
2749 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2750 T::Error: ::std::fmt::Display,
2751 {
2752 self.search_before_date_filter = value
2753 .try_into()
2754 .map_err(|e| {
2755 format!(
2756 "error converting supplied value for search_before_date_filter: {e}"
2757 )
2758 });
2759 self
2760 }
2761 pub fn search_domain_filter<T>(mut self, value: T) -> Self
2762 where
2763 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
2764 T::Error: ::std::fmt::Display,
2765 {
2766 self.search_domain_filter = value
2767 .try_into()
2768 .map_err(|e| {
2769 format!(
2770 "error converting supplied value for search_domain_filter: {e}"
2771 )
2772 });
2773 self
2774 }
2775 pub fn search_language_filter<T>(mut self, value: T) -> Self
2776 where
2777 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
2778 T::Error: ::std::fmt::Display,
2779 {
2780 self.search_language_filter = value
2781 .try_into()
2782 .map_err(|e| {
2783 format!(
2784 "error converting supplied value for search_language_filter: {e}"
2785 )
2786 });
2787 self
2788 }
2789 pub fn search_recency_filter<T>(mut self, value: T) -> Self
2790 where
2791 T: ::std::convert::TryInto<
2792 ::std::option::Option<super::InputSearchRecencyFilter>,
2793 >,
2794 T::Error: ::std::fmt::Display,
2795 {
2796 self.search_recency_filter = value
2797 .try_into()
2798 .map_err(|e| {
2799 format!(
2800 "error converting supplied value for search_recency_filter: {e}"
2801 )
2802 });
2803 self
2804 }
2805 }
2806 impl ::std::convert::TryFrom<Input> for super::Input {
2807 type Error = super::error::ConversionError;
2808 fn try_from(
2809 value: Input,
2810 ) -> ::std::result::Result<Self, super::error::ConversionError> {
2811 Ok(Self {
2812 country: value.country?,
2813 last_updated_after_filter: value.last_updated_after_filter?,
2814 last_updated_before_filter: value.last_updated_before_filter?,
2815 max_results: value.max_results?,
2816 max_tokens: value.max_tokens?,
2817 max_tokens_per_page: value.max_tokens_per_page?,
2818 query: value.query?,
2819 search_after_date_filter: value.search_after_date_filter?,
2820 search_before_date_filter: value.search_before_date_filter?,
2821 search_domain_filter: value.search_domain_filter?,
2822 search_language_filter: value.search_language_filter?,
2823 search_recency_filter: value.search_recency_filter?,
2824 })
2825 }
2826 }
2827 impl ::std::convert::From<super::Input> for Input {
2828 fn from(value: super::Input) -> Self {
2829 Self {
2830 country: Ok(value.country),
2831 last_updated_after_filter: Ok(value.last_updated_after_filter),
2832 last_updated_before_filter: Ok(value.last_updated_before_filter),
2833 max_results: Ok(value.max_results),
2834 max_tokens: Ok(value.max_tokens),
2835 max_tokens_per_page: Ok(value.max_tokens_per_page),
2836 query: Ok(value.query),
2837 search_after_date_filter: Ok(value.search_after_date_filter),
2838 search_before_date_filter: Ok(value.search_before_date_filter),
2839 search_domain_filter: Ok(value.search_domain_filter),
2840 search_language_filter: Ok(value.search_language_filter),
2841 search_recency_filter: Ok(value.search_recency_filter),
2842 }
2843 }
2844 }
2845}
2846pub mod error {
2848 pub struct ConversionError(::std::borrow::Cow<'static, str>);
2850 impl ::std::error::Error for ConversionError {}
2851 impl ::std::fmt::Display for ConversionError {
2852 fn fmt(
2853 &self,
2854 f: &mut ::std::fmt::Formatter<'_>,
2855 ) -> Result<(), ::std::fmt::Error> {
2856 ::std::fmt::Display::fmt(&self.0, f)
2857 }
2858 }
2859 impl ::std::fmt::Debug for ConversionError {
2860 fn fmt(
2861 &self,
2862 f: &mut ::std::fmt::Formatter<'_>,
2863 ) -> Result<(), ::std::fmt::Error> {
2864 ::std::fmt::Debug::fmt(&self.0, f)
2865 }
2866 }
2867 impl From<&'static str> for ConversionError {
2868 fn from(value: &'static str) -> Self {
2869 Self(value.into())
2870 }
2871 }
2872 impl From<String> for ConversionError {
2873 fn from(value: String) -> Self {
2874 Self(value.into())
2875 }
2876 }
2877}
2878
2879pub mod output {
2880#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
2882pub struct Output {
2883 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2885 pub detail: ::std::vec::Vec<OutputDetailItem>,
2886 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2888 pub id: ::std::option::Option<::std::string::String>,
2889 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2891 pub results: ::std::vec::Vec<OutputResultsItem>,
2892 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2894 pub server_time: ::std::option::Option<::std::string::String>,
2895}
2896impl Output {
2897 pub fn builder() -> builder::Output {
2898 Default::default()
2899 }
2900}
2901#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
2903pub struct OutputDetailItem {
2904 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
2906 pub loc: ::std::vec::Vec<::std::string::String>,
2907 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2909 pub msg: ::std::option::Option<::std::string::String>,
2910 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
2912 pub type_: ::std::option::Option<::std::string::String>,
2913}
2914impl OutputDetailItem {
2915 pub fn builder() -> builder::OutputDetailItem {
2916 Default::default()
2917 }
2918}
2919#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
2921pub struct OutputResultsItem {
2922 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2924 pub date: ::std::option::Option<::std::string::String>,
2925 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2927 pub last_updated: ::std::option::Option<::std::string::String>,
2928 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2930 pub snippet: ::std::option::Option<::std::string::String>,
2931 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2933 pub title: ::std::option::Option<::std::string::String>,
2934 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
2936 pub url: ::std::option::Option<::std::string::String>,
2937}
2938impl OutputResultsItem {
2939 pub fn builder() -> builder::OutputResultsItem {
2940 Default::default()
2941 }
2942}
2943pub mod builder {
2945 #[derive(Clone, Debug)]
2946 pub struct Output {
2947 detail: ::std::result::Result<
2948 ::std::vec::Vec<super::OutputDetailItem>,
2949 ::std::string::String,
2950 >,
2951 id: ::std::result::Result<
2952 ::std::option::Option<::std::string::String>,
2953 ::std::string::String,
2954 >,
2955 results: ::std::result::Result<
2956 ::std::vec::Vec<super::OutputResultsItem>,
2957 ::std::string::String,
2958 >,
2959 server_time: ::std::result::Result<
2960 ::std::option::Option<::std::string::String>,
2961 ::std::string::String,
2962 >,
2963 }
2964 impl ::std::default::Default for Output {
2965 fn default() -> Self {
2966 Self {
2967 detail: Ok(Default::default()),
2968 id: Ok(Default::default()),
2969 results: Ok(Default::default()),
2970 server_time: Ok(Default::default()),
2971 }
2972 }
2973 }
2974 impl Output {
2975 pub fn detail<T>(mut self, value: T) -> Self
2976 where
2977 T: ::std::convert::TryInto<::std::vec::Vec<super::OutputDetailItem>>,
2978 T::Error: ::std::fmt::Display,
2979 {
2980 self.detail = value
2981 .try_into()
2982 .map_err(|e| format!("error converting supplied value for detail: {e}"));
2983 self
2984 }
2985 pub fn id<T>(mut self, value: T) -> Self
2986 where
2987 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
2988 T::Error: ::std::fmt::Display,
2989 {
2990 self.id = value
2991 .try_into()
2992 .map_err(|e| format!("error converting supplied value for id: {e}"));
2993 self
2994 }
2995 pub fn results<T>(mut self, value: T) -> Self
2996 where
2997 T: ::std::convert::TryInto<::std::vec::Vec<super::OutputResultsItem>>,
2998 T::Error: ::std::fmt::Display,
2999 {
3000 self.results = value
3001 .try_into()
3002 .map_err(|e| {
3003 format!("error converting supplied value for results: {e}")
3004 });
3005 self
3006 }
3007 pub fn server_time<T>(mut self, value: T) -> Self
3008 where
3009 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3010 T::Error: ::std::fmt::Display,
3011 {
3012 self.server_time = value
3013 .try_into()
3014 .map_err(|e| {
3015 format!("error converting supplied value for server_time: {e}")
3016 });
3017 self
3018 }
3019 }
3020 impl ::std::convert::TryFrom<Output> for super::Output {
3021 type Error = super::error::ConversionError;
3022 fn try_from(
3023 value: Output,
3024 ) -> ::std::result::Result<Self, super::error::ConversionError> {
3025 Ok(Self {
3026 detail: value.detail?,
3027 id: value.id?,
3028 results: value.results?,
3029 server_time: value.server_time?,
3030 })
3031 }
3032 }
3033 impl ::std::convert::From<super::Output> for Output {
3034 fn from(value: super::Output) -> Self {
3035 Self {
3036 detail: Ok(value.detail),
3037 id: Ok(value.id),
3038 results: Ok(value.results),
3039 server_time: Ok(value.server_time),
3040 }
3041 }
3042 }
3043 #[derive(Clone, Debug)]
3044 pub struct OutputDetailItem {
3045 loc: ::std::result::Result<
3046 ::std::vec::Vec<::std::string::String>,
3047 ::std::string::String,
3048 >,
3049 msg: ::std::result::Result<
3050 ::std::option::Option<::std::string::String>,
3051 ::std::string::String,
3052 >,
3053 type_: ::std::result::Result<
3054 ::std::option::Option<::std::string::String>,
3055 ::std::string::String,
3056 >,
3057 }
3058 impl ::std::default::Default for OutputDetailItem {
3059 fn default() -> Self {
3060 Self {
3061 loc: Ok(Default::default()),
3062 msg: Ok(Default::default()),
3063 type_: Ok(Default::default()),
3064 }
3065 }
3066 }
3067 impl OutputDetailItem {
3068 pub fn loc<T>(mut self, value: T) -> Self
3069 where
3070 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
3071 T::Error: ::std::fmt::Display,
3072 {
3073 self.loc = value
3074 .try_into()
3075 .map_err(|e| format!("error converting supplied value for loc: {e}"));
3076 self
3077 }
3078 pub fn msg<T>(mut self, value: T) -> Self
3079 where
3080 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3081 T::Error: ::std::fmt::Display,
3082 {
3083 self.msg = value
3084 .try_into()
3085 .map_err(|e| format!("error converting supplied value for msg: {e}"));
3086 self
3087 }
3088 pub fn type_<T>(mut self, value: T) -> Self
3089 where
3090 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3091 T::Error: ::std::fmt::Display,
3092 {
3093 self.type_ = value
3094 .try_into()
3095 .map_err(|e| format!("error converting supplied value for type_: {e}"));
3096 self
3097 }
3098 }
3099 impl ::std::convert::TryFrom<OutputDetailItem> for super::OutputDetailItem {
3100 type Error = super::error::ConversionError;
3101 fn try_from(
3102 value: OutputDetailItem,
3103 ) -> ::std::result::Result<Self, super::error::ConversionError> {
3104 Ok(Self {
3105 loc: value.loc?,
3106 msg: value.msg?,
3107 type_: value.type_?,
3108 })
3109 }
3110 }
3111 impl ::std::convert::From<super::OutputDetailItem> for OutputDetailItem {
3112 fn from(value: super::OutputDetailItem) -> Self {
3113 Self {
3114 loc: Ok(value.loc),
3115 msg: Ok(value.msg),
3116 type_: Ok(value.type_),
3117 }
3118 }
3119 }
3120 #[derive(Clone, Debug)]
3121 pub struct OutputResultsItem {
3122 date: ::std::result::Result<
3123 ::std::option::Option<::std::string::String>,
3124 ::std::string::String,
3125 >,
3126 last_updated: ::std::result::Result<
3127 ::std::option::Option<::std::string::String>,
3128 ::std::string::String,
3129 >,
3130 snippet: ::std::result::Result<
3131 ::std::option::Option<::std::string::String>,
3132 ::std::string::String,
3133 >,
3134 title: ::std::result::Result<
3135 ::std::option::Option<::std::string::String>,
3136 ::std::string::String,
3137 >,
3138 url: ::std::result::Result<
3139 ::std::option::Option<::std::string::String>,
3140 ::std::string::String,
3141 >,
3142 }
3143 impl ::std::default::Default for OutputResultsItem {
3144 fn default() -> Self {
3145 Self {
3146 date: Ok(Default::default()),
3147 last_updated: Ok(Default::default()),
3148 snippet: Ok(Default::default()),
3149 title: Ok(Default::default()),
3150 url: Ok(Default::default()),
3151 }
3152 }
3153 }
3154 impl OutputResultsItem {
3155 pub fn date<T>(mut self, value: T) -> Self
3156 where
3157 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3158 T::Error: ::std::fmt::Display,
3159 {
3160 self.date = value
3161 .try_into()
3162 .map_err(|e| format!("error converting supplied value for date: {e}"));
3163 self
3164 }
3165 pub fn last_updated<T>(mut self, value: T) -> Self
3166 where
3167 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3168 T::Error: ::std::fmt::Display,
3169 {
3170 self.last_updated = value
3171 .try_into()
3172 .map_err(|e| {
3173 format!("error converting supplied value for last_updated: {e}")
3174 });
3175 self
3176 }
3177 pub fn snippet<T>(mut self, value: T) -> Self
3178 where
3179 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3180 T::Error: ::std::fmt::Display,
3181 {
3182 self.snippet = value
3183 .try_into()
3184 .map_err(|e| {
3185 format!("error converting supplied value for snippet: {e}")
3186 });
3187 self
3188 }
3189 pub fn title<T>(mut self, value: T) -> Self
3190 where
3191 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3192 T::Error: ::std::fmt::Display,
3193 {
3194 self.title = value
3195 .try_into()
3196 .map_err(|e| format!("error converting supplied value for title: {e}"));
3197 self
3198 }
3199 pub fn url<T>(mut self, value: T) -> Self
3200 where
3201 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3202 T::Error: ::std::fmt::Display,
3203 {
3204 self.url = value
3205 .try_into()
3206 .map_err(|e| format!("error converting supplied value for url: {e}"));
3207 self
3208 }
3209 }
3210 impl ::std::convert::TryFrom<OutputResultsItem> for super::OutputResultsItem {
3211 type Error = super::error::ConversionError;
3212 fn try_from(
3213 value: OutputResultsItem,
3214 ) -> ::std::result::Result<Self, super::error::ConversionError> {
3215 Ok(Self {
3216 date: value.date?,
3217 last_updated: value.last_updated?,
3218 snippet: value.snippet?,
3219 title: value.title?,
3220 url: value.url?,
3221 })
3222 }
3223 }
3224 impl ::std::convert::From<super::OutputResultsItem> for OutputResultsItem {
3225 fn from(value: super::OutputResultsItem) -> Self {
3226 Self {
3227 date: Ok(value.date),
3228 last_updated: Ok(value.last_updated),
3229 snippet: Ok(value.snippet),
3230 title: Ok(value.title),
3231 url: Ok(value.url),
3232 }
3233 }
3234 }
3235}
3236pub mod error {
3238 pub struct ConversionError(::std::borrow::Cow<'static, str>);
3240 impl ::std::error::Error for ConversionError {}
3241 impl ::std::fmt::Display for ConversionError {
3242 fn fmt(
3243 &self,
3244 f: &mut ::std::fmt::Formatter<'_>,
3245 ) -> Result<(), ::std::fmt::Error> {
3246 ::std::fmt::Display::fmt(&self.0, f)
3247 }
3248 }
3249 impl ::std::fmt::Debug for ConversionError {
3250 fn fmt(
3251 &self,
3252 f: &mut ::std::fmt::Formatter<'_>,
3253 ) -> Result<(), ::std::fmt::Error> {
3254 ::std::fmt::Debug::fmt(&self.0, f)
3255 }
3256 }
3257 impl From<&'static str> for ConversionError {
3258 fn from(value: &'static str) -> Self {
3259 Self(value.into())
3260 }
3261 }
3262 impl From<String> for ConversionError {
3263 fn from(value: String) -> Self {
3264 Self(value.into())
3265 }
3266 }
3267}
3268
3269}
3270
3271 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "country", part: ::one::Part::Body, key: Some("country") }, ::one::Route { field: "last_updated_after_filter", part: ::one::Part::Body, key: Some("last_updated_after_filter") }, ::one::Route { field: "last_updated_before_filter", part: ::one::Part::Body, key: Some("last_updated_before_filter") }, ::one::Route { field: "max_results", part: ::one::Part::Body, key: Some("max_results") }, ::one::Route { field: "max_tokens", part: ::one::Part::Body, key: Some("max_tokens") }, ::one::Route { field: "max_tokens_per_page", part: ::one::Part::Body, key: Some("max_tokens_per_page") }, ::one::Route { field: "query", part: ::one::Part::Body, key: Some("query") }, ::one::Route { field: "search_after_date_filter", part: ::one::Part::Body, key: Some("search_after_date_filter") }, ::one::Route { field: "search_before_date_filter", part: ::one::Part::Body, key: Some("search_before_date_filter") }, ::one::Route { field: "search_domain_filter", part: ::one::Part::Body, key: Some("search_domain_filter") }, ::one::Route { field: "search_language_filter", part: ::one::Part::Body, key: Some("search_language_filter") }, ::one::Route { field: "search_recency_filter", part: ::one::Part::Body, key: Some("search_recency_filter") }], required_parts: &[::one::Part::Body] };
3273
3274 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
3302 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZpg0YYw::53LshJC5TNOM_Bv6M_ptHw", Method::POST, "/search").with_routed(&input, &ROUTING)?
3303 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
3304 }
3305
3306 impl IntoOperation for Input {
3307 type Output = output::Output;
3308
3309 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
3310 build(self)
3311 }
3312 }
3313 impl IntoOperation for builder::Input {
3314 type Output = output::Output;
3315
3316 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
3317 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
3318 }
3319 }
3320}
3321pub fn search_web() -> search_web::builder::Input {
3323 search_web::builder::Input::default()
3324}
3325pub mod list_async_chat_completions_authenticated_user {
3326 use ::one::{Error, IntoOperation, Method, Operation};
3327#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
3329#[serde(deny_unknown_fields)]
3330pub struct Input {}
3331impl Input {
3332 pub fn builder() -> builder::Input {
3333 Default::default()
3334 }
3335}
3336pub mod builder {
3338 #[derive(Clone, Debug)]
3339 pub struct Input {}
3340 impl ::std::default::Default for Input {
3341 fn default() -> Self {
3342 Self {}
3343 }
3344 }
3345 impl Input {}
3346 impl ::std::convert::TryFrom<Input> for super::Input {
3347 type Error = super::error::ConversionError;
3348 fn try_from(
3349 _value: Input,
3350 ) -> ::std::result::Result<Self, super::error::ConversionError> {
3351 Ok(Self {})
3352 }
3353 }
3354 impl ::std::convert::From<super::Input> for Input {
3355 fn from(_value: super::Input) -> Self {
3356 Self {}
3357 }
3358 }
3359}
3360pub mod error {
3362 pub struct ConversionError(::std::borrow::Cow<'static, str>);
3364 impl ::std::error::Error for ConversionError {}
3365 impl ::std::fmt::Display for ConversionError {
3366 fn fmt(
3367 &self,
3368 f: &mut ::std::fmt::Formatter<'_>,
3369 ) -> Result<(), ::std::fmt::Error> {
3370 ::std::fmt::Display::fmt(&self.0, f)
3371 }
3372 }
3373 impl ::std::fmt::Debug for ConversionError {
3374 fn fmt(
3375 &self,
3376 f: &mut ::std::fmt::Formatter<'_>,
3377 ) -> Result<(), ::std::fmt::Error> {
3378 ::std::fmt::Debug::fmt(&self.0, f)
3379 }
3380 }
3381 impl From<&'static str> for ConversionError {
3382 fn from(value: &'static str) -> Self {
3383 Self(value.into())
3384 }
3385 }
3386 impl From<String> for ConversionError {
3387 fn from(value: String) -> Self {
3388 Self(value.into())
3389 }
3390 }
3391}
3392
3393pub mod output {
3394#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
3396pub struct AsyncChatCompletionRequest {
3397 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3399 pub completed_at: ::std::option::Option<i64>,
3400 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3402 pub created_at: ::std::option::Option<i64>,
3403 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3405 pub failed_at: ::std::option::Option<i64>,
3406 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3408 pub id: ::std::option::Option<::std::string::String>,
3409 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3411 pub model: ::std::option::Option<::std::string::String>,
3412 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3414 pub started_at: ::std::option::Option<i64>,
3415 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3417 pub status: ::std::option::Option<::std::string::String>,
3418}
3419impl AsyncChatCompletionRequest {
3420 pub fn builder() -> builder::AsyncChatCompletionRequest {
3421 Default::default()
3422 }
3423}
3424#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
3426pub struct Output {
3427 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3429 pub detail: ::std::vec::Vec<ValidationErrorDetail>,
3430 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3432 pub next_token: ::std::option::Option<::std::string::String>,
3433 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3435 pub requests: ::std::vec::Vec<AsyncChatCompletionRequest>,
3436}
3437impl Output {
3438 pub fn builder() -> builder::Output {
3439 Default::default()
3440 }
3441}
3442#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
3444pub struct ValidationErrorDetail {
3445 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3447 pub loc: ::std::vec::Vec<::std::string::String>,
3448 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3450 pub msg: ::std::option::Option<::std::string::String>,
3451 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
3453 pub type_: ::std::option::Option<::std::string::String>,
3454}
3455impl ValidationErrorDetail {
3456 pub fn builder() -> builder::ValidationErrorDetail {
3457 Default::default()
3458 }
3459}
3460pub mod builder {
3462 #[derive(Clone, Debug)]
3463 pub struct AsyncChatCompletionRequest {
3464 completed_at: ::std::result::Result<
3465 ::std::option::Option<i64>,
3466 ::std::string::String,
3467 >,
3468 created_at: ::std::result::Result<
3469 ::std::option::Option<i64>,
3470 ::std::string::String,
3471 >,
3472 failed_at: ::std::result::Result<
3473 ::std::option::Option<i64>,
3474 ::std::string::String,
3475 >,
3476 id: ::std::result::Result<
3477 ::std::option::Option<::std::string::String>,
3478 ::std::string::String,
3479 >,
3480 model: ::std::result::Result<
3481 ::std::option::Option<::std::string::String>,
3482 ::std::string::String,
3483 >,
3484 started_at: ::std::result::Result<
3485 ::std::option::Option<i64>,
3486 ::std::string::String,
3487 >,
3488 status: ::std::result::Result<
3489 ::std::option::Option<::std::string::String>,
3490 ::std::string::String,
3491 >,
3492 }
3493 impl ::std::default::Default for AsyncChatCompletionRequest {
3494 fn default() -> Self {
3495 Self {
3496 completed_at: Ok(Default::default()),
3497 created_at: Ok(Default::default()),
3498 failed_at: Ok(Default::default()),
3499 id: Ok(Default::default()),
3500 model: Ok(Default::default()),
3501 started_at: Ok(Default::default()),
3502 status: Ok(Default::default()),
3503 }
3504 }
3505 }
3506 impl AsyncChatCompletionRequest {
3507 pub fn completed_at<T>(mut self, value: T) -> Self
3508 where
3509 T: ::std::convert::TryInto<::std::option::Option<i64>>,
3510 T::Error: ::std::fmt::Display,
3511 {
3512 self.completed_at = value
3513 .try_into()
3514 .map_err(|e| {
3515 format!("error converting supplied value for completed_at: {e}")
3516 });
3517 self
3518 }
3519 pub fn created_at<T>(mut self, value: T) -> Self
3520 where
3521 T: ::std::convert::TryInto<::std::option::Option<i64>>,
3522 T::Error: ::std::fmt::Display,
3523 {
3524 self.created_at = value
3525 .try_into()
3526 .map_err(|e| {
3527 format!("error converting supplied value for created_at: {e}")
3528 });
3529 self
3530 }
3531 pub fn failed_at<T>(mut self, value: T) -> Self
3532 where
3533 T: ::std::convert::TryInto<::std::option::Option<i64>>,
3534 T::Error: ::std::fmt::Display,
3535 {
3536 self.failed_at = value
3537 .try_into()
3538 .map_err(|e| {
3539 format!("error converting supplied value for failed_at: {e}")
3540 });
3541 self
3542 }
3543 pub fn id<T>(mut self, value: T) -> Self
3544 where
3545 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3546 T::Error: ::std::fmt::Display,
3547 {
3548 self.id = value
3549 .try_into()
3550 .map_err(|e| format!("error converting supplied value for id: {e}"));
3551 self
3552 }
3553 pub fn model<T>(mut self, value: T) -> Self
3554 where
3555 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3556 T::Error: ::std::fmt::Display,
3557 {
3558 self.model = value
3559 .try_into()
3560 .map_err(|e| format!("error converting supplied value for model: {e}"));
3561 self
3562 }
3563 pub fn started_at<T>(mut self, value: T) -> Self
3564 where
3565 T: ::std::convert::TryInto<::std::option::Option<i64>>,
3566 T::Error: ::std::fmt::Display,
3567 {
3568 self.started_at = value
3569 .try_into()
3570 .map_err(|e| {
3571 format!("error converting supplied value for started_at: {e}")
3572 });
3573 self
3574 }
3575 pub fn status<T>(mut self, value: T) -> Self
3576 where
3577 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3578 T::Error: ::std::fmt::Display,
3579 {
3580 self.status = value
3581 .try_into()
3582 .map_err(|e| format!("error converting supplied value for status: {e}"));
3583 self
3584 }
3585 }
3586 impl ::std::convert::TryFrom<AsyncChatCompletionRequest>
3587 for super::AsyncChatCompletionRequest {
3588 type Error = super::error::ConversionError;
3589 fn try_from(
3590 value: AsyncChatCompletionRequest,
3591 ) -> ::std::result::Result<Self, super::error::ConversionError> {
3592 Ok(Self {
3593 completed_at: value.completed_at?,
3594 created_at: value.created_at?,
3595 failed_at: value.failed_at?,
3596 id: value.id?,
3597 model: value.model?,
3598 started_at: value.started_at?,
3599 status: value.status?,
3600 })
3601 }
3602 }
3603 impl ::std::convert::From<super::AsyncChatCompletionRequest>
3604 for AsyncChatCompletionRequest {
3605 fn from(value: super::AsyncChatCompletionRequest) -> Self {
3606 Self {
3607 completed_at: Ok(value.completed_at),
3608 created_at: Ok(value.created_at),
3609 failed_at: Ok(value.failed_at),
3610 id: Ok(value.id),
3611 model: Ok(value.model),
3612 started_at: Ok(value.started_at),
3613 status: Ok(value.status),
3614 }
3615 }
3616 }
3617 #[derive(Clone, Debug)]
3618 pub struct Output {
3619 detail: ::std::result::Result<
3620 ::std::vec::Vec<super::ValidationErrorDetail>,
3621 ::std::string::String,
3622 >,
3623 next_token: ::std::result::Result<
3624 ::std::option::Option<::std::string::String>,
3625 ::std::string::String,
3626 >,
3627 requests: ::std::result::Result<
3628 ::std::vec::Vec<super::AsyncChatCompletionRequest>,
3629 ::std::string::String,
3630 >,
3631 }
3632 impl ::std::default::Default for Output {
3633 fn default() -> Self {
3634 Self {
3635 detail: Ok(Default::default()),
3636 next_token: Ok(Default::default()),
3637 requests: Ok(Default::default()),
3638 }
3639 }
3640 }
3641 impl Output {
3642 pub fn detail<T>(mut self, value: T) -> Self
3643 where
3644 T: ::std::convert::TryInto<::std::vec::Vec<super::ValidationErrorDetail>>,
3645 T::Error: ::std::fmt::Display,
3646 {
3647 self.detail = value
3648 .try_into()
3649 .map_err(|e| format!("error converting supplied value for detail: {e}"));
3650 self
3651 }
3652 pub fn next_token<T>(mut self, value: T) -> Self
3653 where
3654 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3655 T::Error: ::std::fmt::Display,
3656 {
3657 self.next_token = value
3658 .try_into()
3659 .map_err(|e| {
3660 format!("error converting supplied value for next_token: {e}")
3661 });
3662 self
3663 }
3664 pub fn requests<T>(mut self, value: T) -> Self
3665 where
3666 T: ::std::convert::TryInto<
3667 ::std::vec::Vec<super::AsyncChatCompletionRequest>,
3668 >,
3669 T::Error: ::std::fmt::Display,
3670 {
3671 self.requests = value
3672 .try_into()
3673 .map_err(|e| {
3674 format!("error converting supplied value for requests: {e}")
3675 });
3676 self
3677 }
3678 }
3679 impl ::std::convert::TryFrom<Output> for super::Output {
3680 type Error = super::error::ConversionError;
3681 fn try_from(
3682 value: Output,
3683 ) -> ::std::result::Result<Self, super::error::ConversionError> {
3684 Ok(Self {
3685 detail: value.detail?,
3686 next_token: value.next_token?,
3687 requests: value.requests?,
3688 })
3689 }
3690 }
3691 impl ::std::convert::From<super::Output> for Output {
3692 fn from(value: super::Output) -> Self {
3693 Self {
3694 detail: Ok(value.detail),
3695 next_token: Ok(value.next_token),
3696 requests: Ok(value.requests),
3697 }
3698 }
3699 }
3700 #[derive(Clone, Debug)]
3701 pub struct ValidationErrorDetail {
3702 loc: ::std::result::Result<
3703 ::std::vec::Vec<::std::string::String>,
3704 ::std::string::String,
3705 >,
3706 msg: ::std::result::Result<
3707 ::std::option::Option<::std::string::String>,
3708 ::std::string::String,
3709 >,
3710 type_: ::std::result::Result<
3711 ::std::option::Option<::std::string::String>,
3712 ::std::string::String,
3713 >,
3714 }
3715 impl ::std::default::Default for ValidationErrorDetail {
3716 fn default() -> Self {
3717 Self {
3718 loc: Ok(Default::default()),
3719 msg: Ok(Default::default()),
3720 type_: Ok(Default::default()),
3721 }
3722 }
3723 }
3724 impl ValidationErrorDetail {
3725 pub fn loc<T>(mut self, value: T) -> Self
3726 where
3727 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
3728 T::Error: ::std::fmt::Display,
3729 {
3730 self.loc = value
3731 .try_into()
3732 .map_err(|e| format!("error converting supplied value for loc: {e}"));
3733 self
3734 }
3735 pub fn msg<T>(mut self, value: T) -> Self
3736 where
3737 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3738 T::Error: ::std::fmt::Display,
3739 {
3740 self.msg = value
3741 .try_into()
3742 .map_err(|e| format!("error converting supplied value for msg: {e}"));
3743 self
3744 }
3745 pub fn type_<T>(mut self, value: T) -> Self
3746 where
3747 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3748 T::Error: ::std::fmt::Display,
3749 {
3750 self.type_ = value
3751 .try_into()
3752 .map_err(|e| format!("error converting supplied value for type_: {e}"));
3753 self
3754 }
3755 }
3756 impl ::std::convert::TryFrom<ValidationErrorDetail>
3757 for super::ValidationErrorDetail {
3758 type Error = super::error::ConversionError;
3759 fn try_from(
3760 value: ValidationErrorDetail,
3761 ) -> ::std::result::Result<Self, super::error::ConversionError> {
3762 Ok(Self {
3763 loc: value.loc?,
3764 msg: value.msg?,
3765 type_: value.type_?,
3766 })
3767 }
3768 }
3769 impl ::std::convert::From<super::ValidationErrorDetail> for ValidationErrorDetail {
3770 fn from(value: super::ValidationErrorDetail) -> Self {
3771 Self {
3772 loc: Ok(value.loc),
3773 msg: Ok(value.msg),
3774 type_: Ok(value.type_),
3775 }
3776 }
3777 }
3778}
3779pub mod error {
3781 pub struct ConversionError(::std::borrow::Cow<'static, str>);
3783 impl ::std::error::Error for ConversionError {}
3784 impl ::std::fmt::Display for ConversionError {
3785 fn fmt(
3786 &self,
3787 f: &mut ::std::fmt::Formatter<'_>,
3788 ) -> Result<(), ::std::fmt::Error> {
3789 ::std::fmt::Display::fmt(&self.0, f)
3790 }
3791 }
3792 impl ::std::fmt::Debug for ConversionError {
3793 fn fmt(
3794 &self,
3795 f: &mut ::std::fmt::Formatter<'_>,
3796 ) -> Result<(), ::std::fmt::Error> {
3797 ::std::fmt::Debug::fmt(&self.0, f)
3798 }
3799 }
3800 impl From<&'static str> for ConversionError {
3801 fn from(value: &'static str) -> Self {
3802 Self(value.into())
3803 }
3804 }
3805 impl From<String> for ConversionError {
3806 fn from(value: String) -> Self {
3807 Self(value.into())
3808 }
3809 }
3810}
3811
3812}
3813
3814 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[], required_parts: &[] };
3816
3817 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
3824 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZphdHPE::77KKEaKnSkmhEM2ynmq16A", Method::GET, "/v1/async/sonar").with_routed(&input, &ROUTING)?
3825 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
3826 }
3827
3828 impl IntoOperation for Input {
3829 type Output = output::Output;
3830
3831 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
3832 build(self)
3833 }
3834 }
3835 impl IntoOperation for builder::Input {
3836 type Output = output::Output;
3837
3838 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
3839 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
3840 }
3841 }
3842}
3843pub fn list_async_chat_completions_authenticated_user() -> list_async_chat_completions_authenticated_user::builder::Input {
3845 list_async_chat_completions_authenticated_user::builder::Input::default()
3846}
3847pub mod create_contextualized_embeddings {
3848 use ::one::{Error, IntoOperation, Method, Operation};
3849#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3851#[serde(deny_unknown_fields)]
3852pub struct Input {
3853 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3855 pub dimensions: ::std::option::Option<i64>,
3856 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
3858 pub encoding_format: ::std::option::Option<InputEncodingFormat>,
3859 pub input: ::std::vec::Vec<::std::vec::Vec<InputInputItemItem>>,
3861 pub model: InputModel,
3863}
3864impl Input {
3865 pub fn builder() -> builder::Input {
3866 Default::default()
3867 }
3868}
3869#[derive(
3871 ::serde::Deserialize,
3872 ::serde::Serialize,
3873 Clone,
3874 Copy,
3875 Debug,
3876 Eq,
3877 Hash,
3878 Ord,
3879 PartialEq,
3880 PartialOrd
3881)]
3882pub enum InputEncodingFormat {
3883 #[serde(rename = "base64_int8")]
3884 Base64Int8,
3885 #[serde(rename = "base64_binary")]
3886 Base64Binary,
3887}
3888impl ::std::fmt::Display for InputEncodingFormat {
3889 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3890 match *self {
3891 Self::Base64Int8 => f.write_str("base64_int8"),
3892 Self::Base64Binary => f.write_str("base64_binary"),
3893 }
3894 }
3895}
3896impl ::std::str::FromStr for InputEncodingFormat {
3897 type Err = self::error::ConversionError;
3898 fn from_str(
3899 value: &str,
3900 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3901 match value {
3902 "base64_int8" => Ok(Self::Base64Int8),
3903 "base64_binary" => Ok(Self::Base64Binary),
3904 _ => Err("invalid value".into()),
3905 }
3906 }
3907}
3908impl ::std::convert::TryFrom<&str> for InputEncodingFormat {
3909 type Error = self::error::ConversionError;
3910 fn try_from(
3911 value: &str,
3912 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3913 value.parse()
3914 }
3915}
3916impl ::std::convert::TryFrom<::std::string::String> for InputEncodingFormat {
3917 type Error = self::error::ConversionError;
3918 fn try_from(
3919 value: ::std::string::String,
3920 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3921 value.parse()
3922 }
3923}
3924#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3926#[serde(transparent)]
3927pub struct InputInputItemItem(::std::string::String);
3928impl ::std::ops::Deref for InputInputItemItem {
3929 type Target = ::std::string::String;
3930 fn deref(&self) -> &::std::string::String {
3931 &self.0
3932 }
3933}
3934impl ::std::convert::From<InputInputItemItem> for ::std::string::String {
3935 fn from(value: InputInputItemItem) -> Self {
3936 value.0
3937 }
3938}
3939impl ::std::str::FromStr for InputInputItemItem {
3940 type Err = self::error::ConversionError;
3941 fn from_str(
3942 value: &str,
3943 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3944 ::std::convert::TryFrom::try_from(value)
3945 }
3946}
3947impl ::std::convert::TryFrom<&str> for InputInputItemItem {
3948 type Error = self::error::ConversionError;
3949 fn try_from(
3950 value: &str,
3951 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3952 if value.chars().count() < 1usize {
3953 return Err("shorter than 1 characters".into());
3954 }
3955 Ok(Self(value.to_string()))
3956 }
3957}
3958impl ::std::convert::TryFrom<::std::string::String> for InputInputItemItem {
3959 type Error = self::error::ConversionError;
3960 fn try_from(
3961 value: ::std::string::String,
3962 ) -> ::std::result::Result<Self, self::error::ConversionError> {
3963 ::std::convert::TryFrom::try_from(value.as_str())
3964 }
3965}
3966impl<'de> ::serde::Deserialize<'de> for InputInputItemItem {
3967 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
3968 where
3969 D: ::serde::Deserializer<'de>,
3970 {
3971 ::std::convert::TryFrom::try_from(
3972 ::std::string::String::deserialize(deserializer)?,
3973 )
3974 .map_err(|e: self::error::ConversionError| {
3975 <D::Error as ::serde::de::Error>::custom(e.to_string())
3976 })
3977 }
3978}
3979#[derive(
3981 ::serde::Deserialize,
3982 ::serde::Serialize,
3983 Clone,
3984 Copy,
3985 Debug,
3986 Eq,
3987 Hash,
3988 Ord,
3989 PartialEq,
3990 PartialOrd
3991)]
3992pub enum InputModel {
3993 #[serde(rename = "pplx-embed-context-v1-0.6b")]
3994 PplxEmbedContextV106b,
3995 #[serde(rename = "pplx-embed-context-v1-4b")]
3996 PplxEmbedContextV14b,
3997}
3998impl ::std::fmt::Display for InputModel {
3999 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4000 match *self {
4001 Self::PplxEmbedContextV106b => f.write_str("pplx-embed-context-v1-0.6b"),
4002 Self::PplxEmbedContextV14b => f.write_str("pplx-embed-context-v1-4b"),
4003 }
4004 }
4005}
4006impl ::std::str::FromStr for InputModel {
4007 type Err = self::error::ConversionError;
4008 fn from_str(
4009 value: &str,
4010 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4011 match value {
4012 "pplx-embed-context-v1-0.6b" => Ok(Self::PplxEmbedContextV106b),
4013 "pplx-embed-context-v1-4b" => Ok(Self::PplxEmbedContextV14b),
4014 _ => Err("invalid value".into()),
4015 }
4016 }
4017}
4018impl ::std::convert::TryFrom<&str> for InputModel {
4019 type Error = self::error::ConversionError;
4020 fn try_from(
4021 value: &str,
4022 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4023 value.parse()
4024 }
4025}
4026impl ::std::convert::TryFrom<::std::string::String> for InputModel {
4027 type Error = self::error::ConversionError;
4028 fn try_from(
4029 value: ::std::string::String,
4030 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4031 value.parse()
4032 }
4033}
4034pub mod builder {
4036 #[derive(Clone, Debug)]
4037 pub struct Input {
4038 dimensions: ::std::result::Result<
4039 ::std::option::Option<i64>,
4040 ::std::string::String,
4041 >,
4042 encoding_format: ::std::result::Result<
4043 ::std::option::Option<super::InputEncodingFormat>,
4044 ::std::string::String,
4045 >,
4046 input: ::std::result::Result<
4047 ::std::vec::Vec<::std::vec::Vec<super::InputInputItemItem>>,
4048 ::std::string::String,
4049 >,
4050 model: ::std::result::Result<super::InputModel, ::std::string::String>,
4051 }
4052 impl ::std::default::Default for Input {
4053 fn default() -> Self {
4054 Self {
4055 dimensions: Ok(Default::default()),
4056 encoding_format: Ok(Default::default()),
4057 input: Err("no value supplied for input".to_string()),
4058 model: Err("no value supplied for model".to_string()),
4059 }
4060 }
4061 }
4062 impl Input {
4063 pub fn dimensions<T>(mut self, value: T) -> Self
4064 where
4065 T: ::std::convert::TryInto<::std::option::Option<i64>>,
4066 T::Error: ::std::fmt::Display,
4067 {
4068 self.dimensions = value
4069 .try_into()
4070 .map_err(|e| {
4071 format!("error converting supplied value for dimensions: {e}")
4072 });
4073 self
4074 }
4075 pub fn encoding_format<T>(mut self, value: T) -> Self
4076 where
4077 T: ::std::convert::TryInto<
4078 ::std::option::Option<super::InputEncodingFormat>,
4079 >,
4080 T::Error: ::std::fmt::Display,
4081 {
4082 self.encoding_format = value
4083 .try_into()
4084 .map_err(|e| {
4085 format!("error converting supplied value for encoding_format: {e}")
4086 });
4087 self
4088 }
4089 pub fn input<T>(mut self, value: T) -> Self
4090 where
4091 T: ::std::convert::TryInto<
4092 ::std::vec::Vec<::std::vec::Vec<super::InputInputItemItem>>,
4093 >,
4094 T::Error: ::std::fmt::Display,
4095 {
4096 self.input = value
4097 .try_into()
4098 .map_err(|e| format!("error converting supplied value for input: {e}"));
4099 self
4100 }
4101 pub fn model<T>(mut self, value: T) -> Self
4102 where
4103 T: ::std::convert::TryInto<super::InputModel>,
4104 T::Error: ::std::fmt::Display,
4105 {
4106 self.model = value
4107 .try_into()
4108 .map_err(|e| format!("error converting supplied value for model: {e}"));
4109 self
4110 }
4111 }
4112 impl ::std::convert::TryFrom<Input> for super::Input {
4113 type Error = super::error::ConversionError;
4114 fn try_from(
4115 value: Input,
4116 ) -> ::std::result::Result<Self, super::error::ConversionError> {
4117 Ok(Self {
4118 dimensions: value.dimensions?,
4119 encoding_format: value.encoding_format?,
4120 input: value.input?,
4121 model: value.model?,
4122 })
4123 }
4124 }
4125 impl ::std::convert::From<super::Input> for Input {
4126 fn from(value: super::Input) -> Self {
4127 Self {
4128 dimensions: Ok(value.dimensions),
4129 encoding_format: Ok(value.encoding_format),
4130 input: Ok(value.input),
4131 model: Ok(value.model),
4132 }
4133 }
4134 }
4135}
4136pub mod error {
4138 pub struct ConversionError(::std::borrow::Cow<'static, str>);
4140 impl ::std::error::Error for ConversionError {}
4141 impl ::std::fmt::Display for ConversionError {
4142 fn fmt(
4143 &self,
4144 f: &mut ::std::fmt::Formatter<'_>,
4145 ) -> Result<(), ::std::fmt::Error> {
4146 ::std::fmt::Display::fmt(&self.0, f)
4147 }
4148 }
4149 impl ::std::fmt::Debug for ConversionError {
4150 fn fmt(
4151 &self,
4152 f: &mut ::std::fmt::Formatter<'_>,
4153 ) -> Result<(), ::std::fmt::Error> {
4154 ::std::fmt::Debug::fmt(&self.0, f)
4155 }
4156 }
4157 impl From<&'static str> for ConversionError {
4158 fn from(value: &'static str) -> Self {
4159 Self(value.into())
4160 }
4161 }
4162 impl From<String> for ConversionError {
4163 fn from(value: String) -> Self {
4164 Self(value.into())
4165 }
4166 }
4167}
4168
4169pub mod output {
4170#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
4172pub struct ContextualizedEmbeddingResult {
4173 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
4175 pub data: ::std::vec::Vec<EmbeddingItem>,
4176 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4178 pub index: ::std::option::Option<i64>,
4179 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4181 pub object: ::std::option::Option<::std::string::String>,
4182}
4183impl ContextualizedEmbeddingResult {
4184 pub fn builder() -> builder::ContextualizedEmbeddingResult {
4185 Default::default()
4186 }
4187}
4188#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
4190pub struct Cost {
4191 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4193 pub currency: ::std::option::Option<CostCurrency>,
4194 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4196 pub input_cost: ::std::option::Option<f64>,
4197 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4199 pub total_cost: ::std::option::Option<f64>,
4200}
4201impl Cost {
4202 pub fn builder() -> builder::Cost {
4203 Default::default()
4204 }
4205}
4206#[derive(
4208 ::serde::Deserialize,
4209 ::serde::Serialize,
4210 Clone,
4211 Copy,
4212 Debug,
4213 Eq,
4214 Hash,
4215 Ord,
4216 PartialEq,
4217 PartialOrd
4218)]
4219pub enum CostCurrency {
4220 #[serde(rename = "USD")]
4221 Usd,
4222}
4223impl ::std::fmt::Display for CostCurrency {
4224 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4225 match *self {
4226 Self::Usd => f.write_str("USD"),
4227 }
4228 }
4229}
4230impl ::std::str::FromStr for CostCurrency {
4231 type Err = self::error::ConversionError;
4232 fn from_str(
4233 value: &str,
4234 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4235 match value {
4236 "USD" => Ok(Self::Usd),
4237 _ => Err("invalid value".into()),
4238 }
4239 }
4240}
4241impl ::std::convert::TryFrom<&str> for CostCurrency {
4242 type Error = self::error::ConversionError;
4243 fn try_from(
4244 value: &str,
4245 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4246 value.parse()
4247 }
4248}
4249impl ::std::convert::TryFrom<::std::string::String> for CostCurrency {
4250 type Error = self::error::ConversionError;
4251 fn try_from(
4252 value: ::std::string::String,
4253 ) -> ::std::result::Result<Self, self::error::ConversionError> {
4254 value.parse()
4255 }
4256}
4257#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
4259pub struct EmbeddingItem {
4260 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4262 pub embedding: ::std::option::Option<::std::string::String>,
4263 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4265 pub index: ::std::option::Option<i64>,
4266 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4268 pub object: ::std::option::Option<::std::string::String>,
4269}
4270impl EmbeddingItem {
4271 pub fn builder() -> builder::EmbeddingItem {
4272 Default::default()
4273 }
4274}
4275#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
4277pub struct Output {
4278 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
4280 pub data: ::std::vec::Vec<ContextualizedEmbeddingResult>,
4281 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
4283 pub detail: ::std::vec::Vec<ValidationErrorDetail>,
4284 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4286 pub model: ::std::option::Option<::std::string::String>,
4287 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4289 pub object: ::std::option::Option<::std::string::String>,
4290 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4291 pub usage: ::std::option::Option<Usage>,
4292}
4293impl Output {
4294 pub fn builder() -> builder::Output {
4295 Default::default()
4296 }
4297}
4298#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
4300pub struct Usage {
4301 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4302 pub cost: ::std::option::Option<Cost>,
4303 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4305 pub prompt_tokens: ::std::option::Option<i64>,
4306 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4308 pub total_tokens: ::std::option::Option<i64>,
4309}
4310impl Usage {
4311 pub fn builder() -> builder::Usage {
4312 Default::default()
4313 }
4314}
4315#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
4317pub struct ValidationErrorDetail {
4318 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
4320 pub loc: ::std::vec::Vec<ValidationErrorDetailLocItem>,
4321 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4323 pub msg: ::std::option::Option<::std::string::String>,
4324 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
4326 pub type_: ::std::option::Option<::std::string::String>,
4327}
4328impl ValidationErrorDetail {
4329 pub fn builder() -> builder::ValidationErrorDetail {
4330 Default::default()
4331 }
4332}
4333#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4335#[serde(untagged)]
4336pub enum ValidationErrorDetailLocItem {
4337 String(::std::string::String),
4338 Integer(i64),
4339}
4340impl ::std::fmt::Display for ValidationErrorDetailLocItem {
4341 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
4342 match self {
4343 Self::String(x) => x.fmt(f),
4344 Self::Integer(x) => x.fmt(f),
4345 }
4346 }
4347}
4348impl ::std::convert::From<i64> for ValidationErrorDetailLocItem {
4349 fn from(value: i64) -> Self {
4350 Self::Integer(value)
4351 }
4352}
4353pub mod builder {
4355 #[derive(Clone, Debug)]
4356 pub struct ContextualizedEmbeddingResult {
4357 data: ::std::result::Result<
4358 ::std::vec::Vec<super::EmbeddingItem>,
4359 ::std::string::String,
4360 >,
4361 index: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
4362 object: ::std::result::Result<
4363 ::std::option::Option<::std::string::String>,
4364 ::std::string::String,
4365 >,
4366 }
4367 impl ::std::default::Default for ContextualizedEmbeddingResult {
4368 fn default() -> Self {
4369 Self {
4370 data: Ok(Default::default()),
4371 index: Ok(Default::default()),
4372 object: Ok(Default::default()),
4373 }
4374 }
4375 }
4376 impl ContextualizedEmbeddingResult {
4377 pub fn data<T>(mut self, value: T) -> Self
4378 where
4379 T: ::std::convert::TryInto<::std::vec::Vec<super::EmbeddingItem>>,
4380 T::Error: ::std::fmt::Display,
4381 {
4382 self.data = value
4383 .try_into()
4384 .map_err(|e| format!("error converting supplied value for data: {e}"));
4385 self
4386 }
4387 pub fn index<T>(mut self, value: T) -> Self
4388 where
4389 T: ::std::convert::TryInto<::std::option::Option<i64>>,
4390 T::Error: ::std::fmt::Display,
4391 {
4392 self.index = value
4393 .try_into()
4394 .map_err(|e| format!("error converting supplied value for index: {e}"));
4395 self
4396 }
4397 pub fn object<T>(mut self, value: T) -> Self
4398 where
4399 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4400 T::Error: ::std::fmt::Display,
4401 {
4402 self.object = value
4403 .try_into()
4404 .map_err(|e| format!("error converting supplied value for object: {e}"));
4405 self
4406 }
4407 }
4408 impl ::std::convert::TryFrom<ContextualizedEmbeddingResult>
4409 for super::ContextualizedEmbeddingResult {
4410 type Error = super::error::ConversionError;
4411 fn try_from(
4412 value: ContextualizedEmbeddingResult,
4413 ) -> ::std::result::Result<Self, super::error::ConversionError> {
4414 Ok(Self {
4415 data: value.data?,
4416 index: value.index?,
4417 object: value.object?,
4418 })
4419 }
4420 }
4421 impl ::std::convert::From<super::ContextualizedEmbeddingResult>
4422 for ContextualizedEmbeddingResult {
4423 fn from(value: super::ContextualizedEmbeddingResult) -> Self {
4424 Self {
4425 data: Ok(value.data),
4426 index: Ok(value.index),
4427 object: Ok(value.object),
4428 }
4429 }
4430 }
4431 #[derive(Clone, Debug)]
4432 pub struct Cost {
4433 currency: ::std::result::Result<
4434 ::std::option::Option<super::CostCurrency>,
4435 ::std::string::String,
4436 >,
4437 input_cost: ::std::result::Result<
4438 ::std::option::Option<f64>,
4439 ::std::string::String,
4440 >,
4441 total_cost: ::std::result::Result<
4442 ::std::option::Option<f64>,
4443 ::std::string::String,
4444 >,
4445 }
4446 impl ::std::default::Default for Cost {
4447 fn default() -> Self {
4448 Self {
4449 currency: Ok(Default::default()),
4450 input_cost: Ok(Default::default()),
4451 total_cost: Ok(Default::default()),
4452 }
4453 }
4454 }
4455 impl Cost {
4456 pub fn currency<T>(mut self, value: T) -> Self
4457 where
4458 T: ::std::convert::TryInto<::std::option::Option<super::CostCurrency>>,
4459 T::Error: ::std::fmt::Display,
4460 {
4461 self.currency = value
4462 .try_into()
4463 .map_err(|e| {
4464 format!("error converting supplied value for currency: {e}")
4465 });
4466 self
4467 }
4468 pub fn input_cost<T>(mut self, value: T) -> Self
4469 where
4470 T: ::std::convert::TryInto<::std::option::Option<f64>>,
4471 T::Error: ::std::fmt::Display,
4472 {
4473 self.input_cost = value
4474 .try_into()
4475 .map_err(|e| {
4476 format!("error converting supplied value for input_cost: {e}")
4477 });
4478 self
4479 }
4480 pub fn total_cost<T>(mut self, value: T) -> Self
4481 where
4482 T: ::std::convert::TryInto<::std::option::Option<f64>>,
4483 T::Error: ::std::fmt::Display,
4484 {
4485 self.total_cost = value
4486 .try_into()
4487 .map_err(|e| {
4488 format!("error converting supplied value for total_cost: {e}")
4489 });
4490 self
4491 }
4492 }
4493 impl ::std::convert::TryFrom<Cost> for super::Cost {
4494 type Error = super::error::ConversionError;
4495 fn try_from(
4496 value: Cost,
4497 ) -> ::std::result::Result<Self, super::error::ConversionError> {
4498 Ok(Self {
4499 currency: value.currency?,
4500 input_cost: value.input_cost?,
4501 total_cost: value.total_cost?,
4502 })
4503 }
4504 }
4505 impl ::std::convert::From<super::Cost> for Cost {
4506 fn from(value: super::Cost) -> Self {
4507 Self {
4508 currency: Ok(value.currency),
4509 input_cost: Ok(value.input_cost),
4510 total_cost: Ok(value.total_cost),
4511 }
4512 }
4513 }
4514 #[derive(Clone, Debug)]
4515 pub struct EmbeddingItem {
4516 embedding: ::std::result::Result<
4517 ::std::option::Option<::std::string::String>,
4518 ::std::string::String,
4519 >,
4520 index: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
4521 object: ::std::result::Result<
4522 ::std::option::Option<::std::string::String>,
4523 ::std::string::String,
4524 >,
4525 }
4526 impl ::std::default::Default for EmbeddingItem {
4527 fn default() -> Self {
4528 Self {
4529 embedding: Ok(Default::default()),
4530 index: Ok(Default::default()),
4531 object: Ok(Default::default()),
4532 }
4533 }
4534 }
4535 impl EmbeddingItem {
4536 pub fn embedding<T>(mut self, value: T) -> Self
4537 where
4538 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4539 T::Error: ::std::fmt::Display,
4540 {
4541 self.embedding = value
4542 .try_into()
4543 .map_err(|e| {
4544 format!("error converting supplied value for embedding: {e}")
4545 });
4546 self
4547 }
4548 pub fn index<T>(mut self, value: T) -> Self
4549 where
4550 T: ::std::convert::TryInto<::std::option::Option<i64>>,
4551 T::Error: ::std::fmt::Display,
4552 {
4553 self.index = value
4554 .try_into()
4555 .map_err(|e| format!("error converting supplied value for index: {e}"));
4556 self
4557 }
4558 pub fn object<T>(mut self, value: T) -> Self
4559 where
4560 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4561 T::Error: ::std::fmt::Display,
4562 {
4563 self.object = value
4564 .try_into()
4565 .map_err(|e| format!("error converting supplied value for object: {e}"));
4566 self
4567 }
4568 }
4569 impl ::std::convert::TryFrom<EmbeddingItem> for super::EmbeddingItem {
4570 type Error = super::error::ConversionError;
4571 fn try_from(
4572 value: EmbeddingItem,
4573 ) -> ::std::result::Result<Self, super::error::ConversionError> {
4574 Ok(Self {
4575 embedding: value.embedding?,
4576 index: value.index?,
4577 object: value.object?,
4578 })
4579 }
4580 }
4581 impl ::std::convert::From<super::EmbeddingItem> for EmbeddingItem {
4582 fn from(value: super::EmbeddingItem) -> Self {
4583 Self {
4584 embedding: Ok(value.embedding),
4585 index: Ok(value.index),
4586 object: Ok(value.object),
4587 }
4588 }
4589 }
4590 #[derive(Clone, Debug)]
4591 pub struct Output {
4592 data: ::std::result::Result<
4593 ::std::vec::Vec<super::ContextualizedEmbeddingResult>,
4594 ::std::string::String,
4595 >,
4596 detail: ::std::result::Result<
4597 ::std::vec::Vec<super::ValidationErrorDetail>,
4598 ::std::string::String,
4599 >,
4600 model: ::std::result::Result<
4601 ::std::option::Option<::std::string::String>,
4602 ::std::string::String,
4603 >,
4604 object: ::std::result::Result<
4605 ::std::option::Option<::std::string::String>,
4606 ::std::string::String,
4607 >,
4608 usage: ::std::result::Result<
4609 ::std::option::Option<super::Usage>,
4610 ::std::string::String,
4611 >,
4612 }
4613 impl ::std::default::Default for Output {
4614 fn default() -> Self {
4615 Self {
4616 data: Ok(Default::default()),
4617 detail: Ok(Default::default()),
4618 model: Ok(Default::default()),
4619 object: Ok(Default::default()),
4620 usage: Ok(Default::default()),
4621 }
4622 }
4623 }
4624 impl Output {
4625 pub fn data<T>(mut self, value: T) -> Self
4626 where
4627 T: ::std::convert::TryInto<
4628 ::std::vec::Vec<super::ContextualizedEmbeddingResult>,
4629 >,
4630 T::Error: ::std::fmt::Display,
4631 {
4632 self.data = value
4633 .try_into()
4634 .map_err(|e| format!("error converting supplied value for data: {e}"));
4635 self
4636 }
4637 pub fn detail<T>(mut self, value: T) -> Self
4638 where
4639 T: ::std::convert::TryInto<::std::vec::Vec<super::ValidationErrorDetail>>,
4640 T::Error: ::std::fmt::Display,
4641 {
4642 self.detail = value
4643 .try_into()
4644 .map_err(|e| format!("error converting supplied value for detail: {e}"));
4645 self
4646 }
4647 pub fn model<T>(mut self, value: T) -> Self
4648 where
4649 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4650 T::Error: ::std::fmt::Display,
4651 {
4652 self.model = value
4653 .try_into()
4654 .map_err(|e| format!("error converting supplied value for model: {e}"));
4655 self
4656 }
4657 pub fn object<T>(mut self, value: T) -> Self
4658 where
4659 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4660 T::Error: ::std::fmt::Display,
4661 {
4662 self.object = value
4663 .try_into()
4664 .map_err(|e| format!("error converting supplied value for object: {e}"));
4665 self
4666 }
4667 pub fn usage<T>(mut self, value: T) -> Self
4668 where
4669 T: ::std::convert::TryInto<::std::option::Option<super::Usage>>,
4670 T::Error: ::std::fmt::Display,
4671 {
4672 self.usage = value
4673 .try_into()
4674 .map_err(|e| format!("error converting supplied value for usage: {e}"));
4675 self
4676 }
4677 }
4678 impl ::std::convert::TryFrom<Output> for super::Output {
4679 type Error = super::error::ConversionError;
4680 fn try_from(
4681 value: Output,
4682 ) -> ::std::result::Result<Self, super::error::ConversionError> {
4683 Ok(Self {
4684 data: value.data?,
4685 detail: value.detail?,
4686 model: value.model?,
4687 object: value.object?,
4688 usage: value.usage?,
4689 })
4690 }
4691 }
4692 impl ::std::convert::From<super::Output> for Output {
4693 fn from(value: super::Output) -> Self {
4694 Self {
4695 data: Ok(value.data),
4696 detail: Ok(value.detail),
4697 model: Ok(value.model),
4698 object: Ok(value.object),
4699 usage: Ok(value.usage),
4700 }
4701 }
4702 }
4703 #[derive(Clone, Debug)]
4704 pub struct Usage {
4705 cost: ::std::result::Result<
4706 ::std::option::Option<super::Cost>,
4707 ::std::string::String,
4708 >,
4709 prompt_tokens: ::std::result::Result<
4710 ::std::option::Option<i64>,
4711 ::std::string::String,
4712 >,
4713 total_tokens: ::std::result::Result<
4714 ::std::option::Option<i64>,
4715 ::std::string::String,
4716 >,
4717 }
4718 impl ::std::default::Default for Usage {
4719 fn default() -> Self {
4720 Self {
4721 cost: Ok(Default::default()),
4722 prompt_tokens: Ok(Default::default()),
4723 total_tokens: Ok(Default::default()),
4724 }
4725 }
4726 }
4727 impl Usage {
4728 pub fn cost<T>(mut self, value: T) -> Self
4729 where
4730 T: ::std::convert::TryInto<::std::option::Option<super::Cost>>,
4731 T::Error: ::std::fmt::Display,
4732 {
4733 self.cost = value
4734 .try_into()
4735 .map_err(|e| format!("error converting supplied value for cost: {e}"));
4736 self
4737 }
4738 pub fn prompt_tokens<T>(mut self, value: T) -> Self
4739 where
4740 T: ::std::convert::TryInto<::std::option::Option<i64>>,
4741 T::Error: ::std::fmt::Display,
4742 {
4743 self.prompt_tokens = value
4744 .try_into()
4745 .map_err(|e| {
4746 format!("error converting supplied value for prompt_tokens: {e}")
4747 });
4748 self
4749 }
4750 pub fn total_tokens<T>(mut self, value: T) -> Self
4751 where
4752 T: ::std::convert::TryInto<::std::option::Option<i64>>,
4753 T::Error: ::std::fmt::Display,
4754 {
4755 self.total_tokens = value
4756 .try_into()
4757 .map_err(|e| {
4758 format!("error converting supplied value for total_tokens: {e}")
4759 });
4760 self
4761 }
4762 }
4763 impl ::std::convert::TryFrom<Usage> for super::Usage {
4764 type Error = super::error::ConversionError;
4765 fn try_from(
4766 value: Usage,
4767 ) -> ::std::result::Result<Self, super::error::ConversionError> {
4768 Ok(Self {
4769 cost: value.cost?,
4770 prompt_tokens: value.prompt_tokens?,
4771 total_tokens: value.total_tokens?,
4772 })
4773 }
4774 }
4775 impl ::std::convert::From<super::Usage> for Usage {
4776 fn from(value: super::Usage) -> Self {
4777 Self {
4778 cost: Ok(value.cost),
4779 prompt_tokens: Ok(value.prompt_tokens),
4780 total_tokens: Ok(value.total_tokens),
4781 }
4782 }
4783 }
4784 #[derive(Clone, Debug)]
4785 pub struct ValidationErrorDetail {
4786 loc: ::std::result::Result<
4787 ::std::vec::Vec<super::ValidationErrorDetailLocItem>,
4788 ::std::string::String,
4789 >,
4790 msg: ::std::result::Result<
4791 ::std::option::Option<::std::string::String>,
4792 ::std::string::String,
4793 >,
4794 type_: ::std::result::Result<
4795 ::std::option::Option<::std::string::String>,
4796 ::std::string::String,
4797 >,
4798 }
4799 impl ::std::default::Default for ValidationErrorDetail {
4800 fn default() -> Self {
4801 Self {
4802 loc: Ok(Default::default()),
4803 msg: Ok(Default::default()),
4804 type_: Ok(Default::default()),
4805 }
4806 }
4807 }
4808 impl ValidationErrorDetail {
4809 pub fn loc<T>(mut self, value: T) -> Self
4810 where
4811 T: ::std::convert::TryInto<
4812 ::std::vec::Vec<super::ValidationErrorDetailLocItem>,
4813 >,
4814 T::Error: ::std::fmt::Display,
4815 {
4816 self.loc = value
4817 .try_into()
4818 .map_err(|e| format!("error converting supplied value for loc: {e}"));
4819 self
4820 }
4821 pub fn msg<T>(mut self, value: T) -> Self
4822 where
4823 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4824 T::Error: ::std::fmt::Display,
4825 {
4826 self.msg = value
4827 .try_into()
4828 .map_err(|e| format!("error converting supplied value for msg: {e}"));
4829 self
4830 }
4831 pub fn type_<T>(mut self, value: T) -> Self
4832 where
4833 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4834 T::Error: ::std::fmt::Display,
4835 {
4836 self.type_ = value
4837 .try_into()
4838 .map_err(|e| format!("error converting supplied value for type_: {e}"));
4839 self
4840 }
4841 }
4842 impl ::std::convert::TryFrom<ValidationErrorDetail>
4843 for super::ValidationErrorDetail {
4844 type Error = super::error::ConversionError;
4845 fn try_from(
4846 value: ValidationErrorDetail,
4847 ) -> ::std::result::Result<Self, super::error::ConversionError> {
4848 Ok(Self {
4849 loc: value.loc?,
4850 msg: value.msg?,
4851 type_: value.type_?,
4852 })
4853 }
4854 }
4855 impl ::std::convert::From<super::ValidationErrorDetail> for ValidationErrorDetail {
4856 fn from(value: super::ValidationErrorDetail) -> Self {
4857 Self {
4858 loc: Ok(value.loc),
4859 msg: Ok(value.msg),
4860 type_: Ok(value.type_),
4861 }
4862 }
4863 }
4864}
4865pub mod error {
4867 pub struct ConversionError(::std::borrow::Cow<'static, str>);
4869 impl ::std::error::Error for ConversionError {}
4870 impl ::std::fmt::Display for ConversionError {
4871 fn fmt(
4872 &self,
4873 f: &mut ::std::fmt::Formatter<'_>,
4874 ) -> Result<(), ::std::fmt::Error> {
4875 ::std::fmt::Display::fmt(&self.0, f)
4876 }
4877 }
4878 impl ::std::fmt::Debug for ConversionError {
4879 fn fmt(
4880 &self,
4881 f: &mut ::std::fmt::Formatter<'_>,
4882 ) -> Result<(), ::std::fmt::Error> {
4883 ::std::fmt::Debug::fmt(&self.0, f)
4884 }
4885 }
4886 impl From<&'static str> for ConversionError {
4887 fn from(value: &'static str) -> Self {
4888 Self(value.into())
4889 }
4890 }
4891 impl From<String> for ConversionError {
4892 fn from(value: String) -> Self {
4893 Self(value.into())
4894 }
4895 }
4896}
4897
4898}
4899
4900 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "dimensions", part: ::one::Part::Body, key: Some("dimensions") }, ::one::Route { field: "encoding_format", part: ::one::Part::Body, key: Some("encoding_format") }, ::one::Route { field: "input", part: ::one::Part::Body, key: Some("input") }, ::one::Route { field: "model", part: ::one::Part::Body, key: Some("model") }], required_parts: &[::one::Part::Body] };
4902
4903 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
4923 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZg7PP6o::SZxilv2RT0GHpYxYECfmgQ", Method::POST, "/v1/contextualizedembeddings").with_routed(&input, &ROUTING)?
4924 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
4925 }
4926
4927 impl IntoOperation for Input {
4928 type Output = output::Output;
4929
4930 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
4931 build(self)
4932 }
4933 }
4934 impl IntoOperation for builder::Input {
4935 type Output = output::Output;
4936
4937 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
4938 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
4939 }
4940 }
4941}
4942pub fn create_contextualized_embeddings() -> create_contextualized_embeddings::builder::Input {
4944 create_contextualized_embeddings::builder::Input::default()
4945}
4946pub mod create_agent_response {
4947 use ::one::{Error, IntoOperation, Method, Operation};
4948#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
4950#[serde(untagged, deny_unknown_fields)]
4951pub enum Body {
4952 Variant0 {
4953 input: BodyVariant0Input,
4955 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4957 instructions: ::std::option::Option<::std::string::String>,
4958 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4960 language_preference: ::std::option::Option<::std::string::String>,
4961 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4963 max_output_tokens: ::std::option::Option<::std::num::NonZeroU64>,
4964 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4966 max_steps: ::std::option::Option<::std::num::NonZeroU64>,
4967 model: ::std::string::String,
4969 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4970 reasoning: ::std::option::Option<ReasoningConfiguration>,
4971 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4972 response_format: ::std::option::Option<ResponseFormatConfiguration>,
4973 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4975 stream: ::std::option::Option<bool>,
4976 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
4978 tools: ::std::vec::Vec<
4979 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
4980 >,
4981 },
4982 Variant1 {
4983 input: BodyVariant1Input,
4985 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4987 instructions: ::std::option::Option<::std::string::String>,
4988 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4990 language_preference: ::std::option::Option<::std::string::String>,
4991 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4993 max_output_tokens: ::std::option::Option<::std::num::NonZeroU64>,
4994 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
4996 max_steps: ::std::option::Option<::std::num::NonZeroU64>,
4997 models: ::std::vec::Vec<::std::string::String>,
4999 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5000 reasoning: ::std::option::Option<ReasoningConfiguration>,
5001 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5002 response_format: ::std::option::Option<ResponseFormatConfiguration>,
5003 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5005 stream: ::std::option::Option<bool>,
5006 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5008 tools: ::std::vec::Vec<
5009 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5010 >,
5011 },
5012 Variant2 {
5013 input: BodyVariant2Input,
5015 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5017 instructions: ::std::option::Option<::std::string::String>,
5018 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5020 language_preference: ::std::option::Option<::std::string::String>,
5021 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5023 max_output_tokens: ::std::option::Option<::std::num::NonZeroU64>,
5024 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5026 max_steps: ::std::option::Option<::std::num::NonZeroU64>,
5027 preset: ::std::string::String,
5029 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5030 reasoning: ::std::option::Option<ReasoningConfiguration>,
5031 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5032 response_format: ::std::option::Option<ResponseFormatConfiguration>,
5033 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5035 stream: ::std::option::Option<bool>,
5036 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5038 tools: ::std::vec::Vec<
5039 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5040 >,
5041 },
5042}
5043#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5045#[serde(untagged)]
5046pub enum BodyVariant0Input {
5047 String(::std::string::String),
5048 Array(
5049 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5050 ),
5051}
5052impl ::std::convert::From<
5053 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5054> for BodyVariant0Input {
5055 fn from(
5056 value: ::std::vec::Vec<
5057 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5058 >,
5059 ) -> Self {
5060 Self::Array(value)
5061 }
5062}
5063#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5065#[serde(untagged)]
5066pub enum BodyVariant1Input {
5067 String(::std::string::String),
5068 Array(
5069 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5070 ),
5071}
5072impl ::std::convert::From<
5073 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5074> for BodyVariant1Input {
5075 fn from(
5076 value: ::std::vec::Vec<
5077 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5078 >,
5079 ) -> Self {
5080 Self::Array(value)
5081 }
5082}
5083#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5085#[serde(untagged)]
5086pub enum BodyVariant2Input {
5087 String(::std::string::String),
5088 Array(
5089 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5090 ),
5091}
5092impl ::std::convert::From<
5093 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
5094> for BodyVariant2Input {
5095 fn from(
5096 value: ::std::vec::Vec<
5097 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5098 >,
5099 ) -> Self {
5100 Self::Array(value)
5101 }
5102}
5103#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5105pub struct Headers {
5106 #[serde(rename = "Accept")]
5108 pub accept: ::std::string::String,
5109}
5110impl Headers {
5111 pub fn builder() -> builder::Headers {
5112 Default::default()
5113 }
5114}
5115#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5117#[serde(deny_unknown_fields)]
5118pub struct Input {
5119 pub body: Body,
5120 pub headers: Headers,
5121}
5122impl Input {
5123 pub fn builder() -> builder::Input {
5124 Default::default()
5125 }
5126}
5127#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5129#[serde(deny_unknown_fields)]
5130pub struct ReasoningConfiguration {
5131 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5133 pub effort: ::std::option::Option<ReasoningConfigurationEffort>,
5134}
5135impl ReasoningConfiguration {
5136 pub fn builder() -> builder::ReasoningConfiguration {
5137 Default::default()
5138 }
5139}
5140#[derive(
5142 ::serde::Deserialize,
5143 ::serde::Serialize,
5144 Clone,
5145 Copy,
5146 Debug,
5147 Eq,
5148 Hash,
5149 Ord,
5150 PartialEq,
5151 PartialOrd
5152)]
5153pub enum ReasoningConfigurationEffort {
5154 #[serde(rename = "low")]
5155 Low,
5156 #[serde(rename = "medium")]
5157 Medium,
5158 #[serde(rename = "high")]
5159 High,
5160}
5161impl ::std::fmt::Display for ReasoningConfigurationEffort {
5162 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5163 match *self {
5164 Self::Low => f.write_str("low"),
5165 Self::Medium => f.write_str("medium"),
5166 Self::High => f.write_str("high"),
5167 }
5168 }
5169}
5170impl ::std::str::FromStr for ReasoningConfigurationEffort {
5171 type Err = self::error::ConversionError;
5172 fn from_str(
5173 value: &str,
5174 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5175 match value {
5176 "low" => Ok(Self::Low),
5177 "medium" => Ok(Self::Medium),
5178 "high" => Ok(Self::High),
5179 _ => Err("invalid value".into()),
5180 }
5181 }
5182}
5183impl ::std::convert::TryFrom<&str> for ReasoningConfigurationEffort {
5184 type Error = self::error::ConversionError;
5185 fn try_from(
5186 value: &str,
5187 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5188 value.parse()
5189 }
5190}
5191impl ::std::convert::TryFrom<::std::string::String> for ReasoningConfigurationEffort {
5192 type Error = self::error::ConversionError;
5193 fn try_from(
5194 value: ::std::string::String,
5195 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5196 value.parse()
5197 }
5198}
5199#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5201#[serde(deny_unknown_fields)]
5202pub struct ResponseFormatConfiguration {
5203 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
5205 pub json_schema: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5206 #[serde(rename = "type")]
5208 pub type_: ResponseFormatConfigurationType,
5209}
5210impl ResponseFormatConfiguration {
5211 pub fn builder() -> builder::ResponseFormatConfiguration {
5212 Default::default()
5213 }
5214}
5215#[derive(
5217 ::serde::Deserialize,
5218 ::serde::Serialize,
5219 Clone,
5220 Copy,
5221 Debug,
5222 Eq,
5223 Hash,
5224 Ord,
5225 PartialEq,
5226 PartialOrd
5227)]
5228pub enum ResponseFormatConfigurationType {
5229 #[serde(rename = "json_schema")]
5230 JsonSchema,
5231}
5232impl ::std::fmt::Display for ResponseFormatConfigurationType {
5233 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5234 match *self {
5235 Self::JsonSchema => f.write_str("json_schema"),
5236 }
5237 }
5238}
5239impl ::std::str::FromStr for ResponseFormatConfigurationType {
5240 type Err = self::error::ConversionError;
5241 fn from_str(
5242 value: &str,
5243 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5244 match value {
5245 "json_schema" => Ok(Self::JsonSchema),
5246 _ => Err("invalid value".into()),
5247 }
5248 }
5249}
5250impl ::std::convert::TryFrom<&str> for ResponseFormatConfigurationType {
5251 type Error = self::error::ConversionError;
5252 fn try_from(
5253 value: &str,
5254 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5255 value.parse()
5256 }
5257}
5258impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatConfigurationType {
5259 type Error = self::error::ConversionError;
5260 fn try_from(
5261 value: ::std::string::String,
5262 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5263 value.parse()
5264 }
5265}
5266pub mod builder {
5268 #[derive(Clone, Debug)]
5269 pub struct Headers {
5270 accept: ::std::result::Result<::std::string::String, ::std::string::String>,
5271 }
5272 impl ::std::default::Default for Headers {
5273 fn default() -> Self {
5274 Self {
5275 accept: Err("no value supplied for accept".to_string()),
5276 }
5277 }
5278 }
5279 impl Headers {
5280 pub fn accept<T>(mut self, value: T) -> Self
5281 where
5282 T: ::std::convert::TryInto<::std::string::String>,
5283 T::Error: ::std::fmt::Display,
5284 {
5285 self.accept = value
5286 .try_into()
5287 .map_err(|e| format!("error converting supplied value for accept: {e}"));
5288 self
5289 }
5290 }
5291 impl ::std::convert::TryFrom<Headers> for super::Headers {
5292 type Error = super::error::ConversionError;
5293 fn try_from(
5294 value: Headers,
5295 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5296 Ok(Self { accept: value.accept? })
5297 }
5298 }
5299 impl ::std::convert::From<super::Headers> for Headers {
5300 fn from(value: super::Headers) -> Self {
5301 Self { accept: Ok(value.accept) }
5302 }
5303 }
5304 #[derive(Clone, Debug)]
5305 pub struct Input {
5306 body: ::std::result::Result<super::Body, ::std::string::String>,
5307 headers: ::std::result::Result<super::Headers, ::std::string::String>,
5308 }
5309 impl ::std::default::Default for Input {
5310 fn default() -> Self {
5311 Self {
5312 body: Err("no value supplied for body".to_string()),
5313 headers: Err("no value supplied for headers".to_string()),
5314 }
5315 }
5316 }
5317 impl Input {
5318 pub fn body<T>(mut self, value: T) -> Self
5319 where
5320 T: ::std::convert::TryInto<super::Body>,
5321 T::Error: ::std::fmt::Display,
5322 {
5323 self.body = value
5324 .try_into()
5325 .map_err(|e| format!("error converting supplied value for body: {e}"));
5326 self
5327 }
5328 pub fn headers<T>(mut self, value: T) -> Self
5329 where
5330 T: ::std::convert::TryInto<super::Headers>,
5331 T::Error: ::std::fmt::Display,
5332 {
5333 self.headers = value
5334 .try_into()
5335 .map_err(|e| {
5336 format!("error converting supplied value for headers: {e}")
5337 });
5338 self
5339 }
5340 }
5341 impl ::std::convert::TryFrom<Input> for super::Input {
5342 type Error = super::error::ConversionError;
5343 fn try_from(
5344 value: Input,
5345 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5346 Ok(Self {
5347 body: value.body?,
5348 headers: value.headers?,
5349 })
5350 }
5351 }
5352 impl ::std::convert::From<super::Input> for Input {
5353 fn from(value: super::Input) -> Self {
5354 Self {
5355 body: Ok(value.body),
5356 headers: Ok(value.headers),
5357 }
5358 }
5359 }
5360 #[derive(Clone, Debug)]
5361 pub struct ReasoningConfiguration {
5362 effort: ::std::result::Result<
5363 ::std::option::Option<super::ReasoningConfigurationEffort>,
5364 ::std::string::String,
5365 >,
5366 }
5367 impl ::std::default::Default for ReasoningConfiguration {
5368 fn default() -> Self {
5369 Self {
5370 effort: Ok(Default::default()),
5371 }
5372 }
5373 }
5374 impl ReasoningConfiguration {
5375 pub fn effort<T>(mut self, value: T) -> Self
5376 where
5377 T: ::std::convert::TryInto<
5378 ::std::option::Option<super::ReasoningConfigurationEffort>,
5379 >,
5380 T::Error: ::std::fmt::Display,
5381 {
5382 self.effort = value
5383 .try_into()
5384 .map_err(|e| format!("error converting supplied value for effort: {e}"));
5385 self
5386 }
5387 }
5388 impl ::std::convert::TryFrom<ReasoningConfiguration>
5389 for super::ReasoningConfiguration {
5390 type Error = super::error::ConversionError;
5391 fn try_from(
5392 value: ReasoningConfiguration,
5393 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5394 Ok(Self { effort: value.effort? })
5395 }
5396 }
5397 impl ::std::convert::From<super::ReasoningConfiguration> for ReasoningConfiguration {
5398 fn from(value: super::ReasoningConfiguration) -> Self {
5399 Self { effort: Ok(value.effort) }
5400 }
5401 }
5402 #[derive(Clone, Debug)]
5403 pub struct ResponseFormatConfiguration {
5404 json_schema: ::std::result::Result<
5405 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5406 ::std::string::String,
5407 >,
5408 type_: ::std::result::Result<
5409 super::ResponseFormatConfigurationType,
5410 ::std::string::String,
5411 >,
5412 }
5413 impl ::std::default::Default for ResponseFormatConfiguration {
5414 fn default() -> Self {
5415 Self {
5416 json_schema: Ok(Default::default()),
5417 type_: Err("no value supplied for type_".to_string()),
5418 }
5419 }
5420 }
5421 impl ResponseFormatConfiguration {
5422 pub fn json_schema<T>(mut self, value: T) -> Self
5423 where
5424 T: ::std::convert::TryInto<
5425 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5426 >,
5427 T::Error: ::std::fmt::Display,
5428 {
5429 self.json_schema = value
5430 .try_into()
5431 .map_err(|e| {
5432 format!("error converting supplied value for json_schema: {e}")
5433 });
5434 self
5435 }
5436 pub fn type_<T>(mut self, value: T) -> Self
5437 where
5438 T: ::std::convert::TryInto<super::ResponseFormatConfigurationType>,
5439 T::Error: ::std::fmt::Display,
5440 {
5441 self.type_ = value
5442 .try_into()
5443 .map_err(|e| format!("error converting supplied value for type_: {e}"));
5444 self
5445 }
5446 }
5447 impl ::std::convert::TryFrom<ResponseFormatConfiguration>
5448 for super::ResponseFormatConfiguration {
5449 type Error = super::error::ConversionError;
5450 fn try_from(
5451 value: ResponseFormatConfiguration,
5452 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5453 Ok(Self {
5454 json_schema: value.json_schema?,
5455 type_: value.type_?,
5456 })
5457 }
5458 }
5459 impl ::std::convert::From<super::ResponseFormatConfiguration>
5460 for ResponseFormatConfiguration {
5461 fn from(value: super::ResponseFormatConfiguration) -> Self {
5462 Self {
5463 json_schema: Ok(value.json_schema),
5464 type_: Ok(value.type_),
5465 }
5466 }
5467 }
5468}
5469pub mod error {
5471 pub struct ConversionError(::std::borrow::Cow<'static, str>);
5473 impl ::std::error::Error for ConversionError {}
5474 impl ::std::fmt::Display for ConversionError {
5475 fn fmt(
5476 &self,
5477 f: &mut ::std::fmt::Formatter<'_>,
5478 ) -> Result<(), ::std::fmt::Error> {
5479 ::std::fmt::Display::fmt(&self.0, f)
5480 }
5481 }
5482 impl ::std::fmt::Debug for ConversionError {
5483 fn fmt(
5484 &self,
5485 f: &mut ::std::fmt::Formatter<'_>,
5486 ) -> Result<(), ::std::fmt::Error> {
5487 ::std::fmt::Debug::fmt(&self.0, f)
5488 }
5489 }
5490 impl From<&'static str> for ConversionError {
5491 fn from(value: &'static str) -> Self {
5492 Self(value.into())
5493 }
5494 }
5495 impl From<String> for ConversionError {
5496 fn from(value: String) -> Self {
5497 Self(value.into())
5498 }
5499 }
5500}
5501
5502pub mod output {
5503#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5505pub struct JsonResponseError {
5506 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5508 pub code: ::std::option::Option<::std::string::String>,
5509 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5511 pub message: ::std::option::Option<::std::string::String>,
5512 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
5514 pub type_: ::std::option::Option<::std::string::String>,
5515}
5516impl JsonResponseError {
5517 pub fn builder() -> builder::JsonResponseError {
5518 Default::default()
5519 }
5520}
5521#[derive(
5523 ::serde::Deserialize,
5524 ::serde::Serialize,
5525 Clone,
5526 Copy,
5527 Debug,
5528 Eq,
5529 Hash,
5530 Ord,
5531 PartialEq,
5532 PartialOrd
5533)]
5534pub enum JsonResponseObject {
5535 #[serde(rename = "response")]
5536 Response,
5537}
5538impl ::std::fmt::Display for JsonResponseObject {
5539 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5540 match *self {
5541 Self::Response => f.write_str("response"),
5542 }
5543 }
5544}
5545impl ::std::str::FromStr for JsonResponseObject {
5546 type Err = self::error::ConversionError;
5547 fn from_str(
5548 value: &str,
5549 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5550 match value {
5551 "response" => Ok(Self::Response),
5552 _ => Err("invalid value".into()),
5553 }
5554 }
5555}
5556impl ::std::convert::TryFrom<&str> for JsonResponseObject {
5557 type Error = self::error::ConversionError;
5558 fn try_from(
5559 value: &str,
5560 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5561 value.parse()
5562 }
5563}
5564impl ::std::convert::TryFrom<::std::string::String> for JsonResponseObject {
5565 type Error = self::error::ConversionError;
5566 fn try_from(
5567 value: ::std::string::String,
5568 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5569 value.parse()
5570 }
5571}
5572#[derive(
5574 ::serde::Deserialize,
5575 ::serde::Serialize,
5576 Clone,
5577 Copy,
5578 Debug,
5579 Eq,
5580 Hash,
5581 Ord,
5582 PartialEq,
5583 PartialOrd
5584)]
5585pub enum JsonResponseStatus {
5586 #[serde(rename = "completed")]
5587 Completed,
5588 #[serde(rename = "failed")]
5589 Failed,
5590 #[serde(rename = "in_progress")]
5591 InProgress,
5592 #[serde(rename = "requires_action")]
5593 RequiresAction,
5594}
5595impl ::std::fmt::Display for JsonResponseStatus {
5596 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5597 match *self {
5598 Self::Completed => f.write_str("completed"),
5599 Self::Failed => f.write_str("failed"),
5600 Self::InProgress => f.write_str("in_progress"),
5601 Self::RequiresAction => f.write_str("requires_action"),
5602 }
5603 }
5604}
5605impl ::std::str::FromStr for JsonResponseStatus {
5606 type Err = self::error::ConversionError;
5607 fn from_str(
5608 value: &str,
5609 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5610 match value {
5611 "completed" => Ok(Self::Completed),
5612 "failed" => Ok(Self::Failed),
5613 "in_progress" => Ok(Self::InProgress),
5614 "requires_action" => Ok(Self::RequiresAction),
5615 _ => Err("invalid value".into()),
5616 }
5617 }
5618}
5619impl ::std::convert::TryFrom<&str> for JsonResponseStatus {
5620 type Error = self::error::ConversionError;
5621 fn try_from(
5622 value: &str,
5623 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5624 value.parse()
5625 }
5626}
5627impl ::std::convert::TryFrom<::std::string::String> for JsonResponseStatus {
5628 type Error = self::error::ConversionError;
5629 fn try_from(
5630 value: ::std::string::String,
5631 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5632 value.parse()
5633 }
5634}
5635#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5637pub struct JsonResponseUsage {
5638 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
5640 pub cost: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5641 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5643 pub input_tokens: ::std::option::Option<i64>,
5644 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5645 pub input_tokens_details: ::std::option::Option<JsonResponseUsageInputTokensDetails>,
5646 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5648 pub output_tokens: ::std::option::Option<i64>,
5649 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
5651 pub tool_calls_details: ::serde_json::Map<
5652 ::std::string::String,
5653 ::serde_json::Value,
5654 >,
5655 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5657 pub total_tokens: ::std::option::Option<i64>,
5658}
5659impl JsonResponseUsage {
5660 pub fn builder() -> builder::JsonResponseUsage {
5661 Default::default()
5662 }
5663}
5664#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5666pub struct JsonResponseUsageInputTokensDetails {
5667 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5669 pub cache_creation_input_tokens: ::std::option::Option<i64>,
5670 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5672 pub cache_read_input_tokens: ::std::option::Option<i64>,
5673}
5674impl JsonResponseUsageInputTokensDetails {
5675 pub fn builder() -> builder::JsonResponseUsageInputTokensDetails {
5676 Default::default()
5677 }
5678}
5679#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5681pub struct Output {
5682 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5684 pub body: ::std::option::Option<OutputBody>,
5685 #[serde(
5687 rename = "contentType",
5688 skip_serializing_if = "::std::option::Option::is_none"
5689 )]
5690 pub content_type: ::std::option::Option<OutputContentType>,
5691}
5692impl Output {
5693 pub fn builder() -> builder::Output {
5694 Default::default()
5695 }
5696}
5697#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5699#[serde(untagged)]
5700pub enum OutputBody {
5701 JsonResponse {
5702 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5704 created_at: ::std::option::Option<i64>,
5705 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5706 error: ::std::option::Option<JsonResponseError>,
5707 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5709 id: ::std::option::Option<::std::string::String>,
5710 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5712 model: ::std::option::Option<::std::string::String>,
5713 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5715 object: ::std::option::Option<JsonResponseObject>,
5716 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5718 output: ::std::vec::Vec<
5719 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5720 >,
5721 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5723 status: ::std::option::Option<JsonResponseStatus>,
5724 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5725 usage: ::std::option::Option<JsonResponseUsage>,
5726 },
5727 SseEventStream(::std::vec::Vec<SseEventStreamItem>),
5728}
5729impl ::std::convert::From<::std::vec::Vec<SseEventStreamItem>> for OutputBody {
5730 fn from(value: ::std::vec::Vec<SseEventStreamItem>) -> Self {
5731 Self::SseEventStream(value)
5732 }
5733}
5734#[derive(
5736 ::serde::Deserialize,
5737 ::serde::Serialize,
5738 Clone,
5739 Copy,
5740 Debug,
5741 Eq,
5742 Hash,
5743 Ord,
5744 PartialEq,
5745 PartialOrd
5746)]
5747pub enum OutputContentType {
5748 #[serde(rename = "application/json")]
5749 ApplicationJson,
5750 #[serde(rename = "text/event-stream")]
5751 TextEventStream,
5752}
5753impl ::std::fmt::Display for OutputContentType {
5754 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
5755 match *self {
5756 Self::ApplicationJson => f.write_str("application/json"),
5757 Self::TextEventStream => f.write_str("text/event-stream"),
5758 }
5759 }
5760}
5761impl ::std::str::FromStr for OutputContentType {
5762 type Err = self::error::ConversionError;
5763 fn from_str(
5764 value: &str,
5765 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5766 match value {
5767 "application/json" => Ok(Self::ApplicationJson),
5768 "text/event-stream" => Ok(Self::TextEventStream),
5769 _ => Err("invalid value".into()),
5770 }
5771 }
5772}
5773impl ::std::convert::TryFrom<&str> for OutputContentType {
5774 type Error = self::error::ConversionError;
5775 fn try_from(
5776 value: &str,
5777 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5778 value.parse()
5779 }
5780}
5781impl ::std::convert::TryFrom<::std::string::String> for OutputContentType {
5782 type Error = self::error::ConversionError;
5783 fn try_from(
5784 value: ::std::string::String,
5785 ) -> ::std::result::Result<Self, self::error::ConversionError> {
5786 value.parse()
5787 }
5788}
5789#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5791pub struct SseEventStreamItem {
5792 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5794 pub contents: ::std::vec::Vec<
5795 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5796 >,
5797 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5799 pub delta: ::std::option::Option<SseEventStreamItemDelta>,
5800 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5801 pub error: ::std::option::Option<SseEventStreamItemError>,
5802 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
5804 pub item: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5805 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5807 pub output_index: ::std::option::Option<i64>,
5808 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5810 pub queries: ::std::vec::Vec<::std::string::String>,
5811 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
5813 pub response: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5814 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5816 pub results: ::std::vec::Vec<
5817 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5818 >,
5819 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5821 pub sequence_number: ::std::option::Option<i64>,
5822 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
5824 pub type_: ::std::option::Option<::std::string::String>,
5825 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
5827 pub urls: ::std::vec::Vec<::std::string::String>,
5828}
5829impl SseEventStreamItem {
5830 pub fn builder() -> builder::SseEventStreamItem {
5831 Default::default()
5832 }
5833}
5834#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
5836#[serde(untagged)]
5837pub enum SseEventStreamItemDelta {
5838 String(::std::string::String),
5839 Object(::serde_json::Map<::std::string::String, ::serde_json::Value>),
5840}
5841impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
5842for SseEventStreamItemDelta {
5843 fn from(
5844 value: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5845 ) -> Self {
5846 Self::Object(value)
5847 }
5848}
5849#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
5851pub struct SseEventStreamItemError {
5852 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5853 pub code: ::std::option::Option<::std::string::String>,
5854 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
5855 pub message: ::std::option::Option<::std::string::String>,
5856 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
5857 pub type_: ::std::option::Option<::std::string::String>,
5858}
5859impl SseEventStreamItemError {
5860 pub fn builder() -> builder::SseEventStreamItemError {
5861 Default::default()
5862 }
5863}
5864pub mod builder {
5866 #[derive(Clone, Debug)]
5867 pub struct JsonResponseError {
5868 code: ::std::result::Result<
5869 ::std::option::Option<::std::string::String>,
5870 ::std::string::String,
5871 >,
5872 message: ::std::result::Result<
5873 ::std::option::Option<::std::string::String>,
5874 ::std::string::String,
5875 >,
5876 type_: ::std::result::Result<
5877 ::std::option::Option<::std::string::String>,
5878 ::std::string::String,
5879 >,
5880 }
5881 impl ::std::default::Default for JsonResponseError {
5882 fn default() -> Self {
5883 Self {
5884 code: Ok(Default::default()),
5885 message: Ok(Default::default()),
5886 type_: Ok(Default::default()),
5887 }
5888 }
5889 }
5890 impl JsonResponseError {
5891 pub fn code<T>(mut self, value: T) -> Self
5892 where
5893 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5894 T::Error: ::std::fmt::Display,
5895 {
5896 self.code = value
5897 .try_into()
5898 .map_err(|e| format!("error converting supplied value for code: {e}"));
5899 self
5900 }
5901 pub fn message<T>(mut self, value: T) -> Self
5902 where
5903 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5904 T::Error: ::std::fmt::Display,
5905 {
5906 self.message = value
5907 .try_into()
5908 .map_err(|e| {
5909 format!("error converting supplied value for message: {e}")
5910 });
5911 self
5912 }
5913 pub fn type_<T>(mut self, value: T) -> Self
5914 where
5915 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5916 T::Error: ::std::fmt::Display,
5917 {
5918 self.type_ = value
5919 .try_into()
5920 .map_err(|e| format!("error converting supplied value for type_: {e}"));
5921 self
5922 }
5923 }
5924 impl ::std::convert::TryFrom<JsonResponseError> for super::JsonResponseError {
5925 type Error = super::error::ConversionError;
5926 fn try_from(
5927 value: JsonResponseError,
5928 ) -> ::std::result::Result<Self, super::error::ConversionError> {
5929 Ok(Self {
5930 code: value.code?,
5931 message: value.message?,
5932 type_: value.type_?,
5933 })
5934 }
5935 }
5936 impl ::std::convert::From<super::JsonResponseError> for JsonResponseError {
5937 fn from(value: super::JsonResponseError) -> Self {
5938 Self {
5939 code: Ok(value.code),
5940 message: Ok(value.message),
5941 type_: Ok(value.type_),
5942 }
5943 }
5944 }
5945 #[derive(Clone, Debug)]
5946 pub struct JsonResponseUsage {
5947 cost: ::std::result::Result<
5948 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5949 ::std::string::String,
5950 >,
5951 input_tokens: ::std::result::Result<
5952 ::std::option::Option<i64>,
5953 ::std::string::String,
5954 >,
5955 input_tokens_details: ::std::result::Result<
5956 ::std::option::Option<super::JsonResponseUsageInputTokensDetails>,
5957 ::std::string::String,
5958 >,
5959 output_tokens: ::std::result::Result<
5960 ::std::option::Option<i64>,
5961 ::std::string::String,
5962 >,
5963 tool_calls_details: ::std::result::Result<
5964 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5965 ::std::string::String,
5966 >,
5967 total_tokens: ::std::result::Result<
5968 ::std::option::Option<i64>,
5969 ::std::string::String,
5970 >,
5971 }
5972 impl ::std::default::Default for JsonResponseUsage {
5973 fn default() -> Self {
5974 Self {
5975 cost: Ok(Default::default()),
5976 input_tokens: Ok(Default::default()),
5977 input_tokens_details: Ok(Default::default()),
5978 output_tokens: Ok(Default::default()),
5979 tool_calls_details: Ok(Default::default()),
5980 total_tokens: Ok(Default::default()),
5981 }
5982 }
5983 }
5984 impl JsonResponseUsage {
5985 pub fn cost<T>(mut self, value: T) -> Self
5986 where
5987 T: ::std::convert::TryInto<
5988 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
5989 >,
5990 T::Error: ::std::fmt::Display,
5991 {
5992 self.cost = value
5993 .try_into()
5994 .map_err(|e| format!("error converting supplied value for cost: {e}"));
5995 self
5996 }
5997 pub fn input_tokens<T>(mut self, value: T) -> Self
5998 where
5999 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6000 T::Error: ::std::fmt::Display,
6001 {
6002 self.input_tokens = value
6003 .try_into()
6004 .map_err(|e| {
6005 format!("error converting supplied value for input_tokens: {e}")
6006 });
6007 self
6008 }
6009 pub fn input_tokens_details<T>(mut self, value: T) -> Self
6010 where
6011 T: ::std::convert::TryInto<
6012 ::std::option::Option<super::JsonResponseUsageInputTokensDetails>,
6013 >,
6014 T::Error: ::std::fmt::Display,
6015 {
6016 self.input_tokens_details = value
6017 .try_into()
6018 .map_err(|e| {
6019 format!(
6020 "error converting supplied value for input_tokens_details: {e}"
6021 )
6022 });
6023 self
6024 }
6025 pub fn output_tokens<T>(mut self, value: T) -> Self
6026 where
6027 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6028 T::Error: ::std::fmt::Display,
6029 {
6030 self.output_tokens = value
6031 .try_into()
6032 .map_err(|e| {
6033 format!("error converting supplied value for output_tokens: {e}")
6034 });
6035 self
6036 }
6037 pub fn tool_calls_details<T>(mut self, value: T) -> Self
6038 where
6039 T: ::std::convert::TryInto<
6040 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6041 >,
6042 T::Error: ::std::fmt::Display,
6043 {
6044 self.tool_calls_details = value
6045 .try_into()
6046 .map_err(|e| {
6047 format!(
6048 "error converting supplied value for tool_calls_details: {e}"
6049 )
6050 });
6051 self
6052 }
6053 pub fn total_tokens<T>(mut self, value: T) -> Self
6054 where
6055 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6056 T::Error: ::std::fmt::Display,
6057 {
6058 self.total_tokens = value
6059 .try_into()
6060 .map_err(|e| {
6061 format!("error converting supplied value for total_tokens: {e}")
6062 });
6063 self
6064 }
6065 }
6066 impl ::std::convert::TryFrom<JsonResponseUsage> for super::JsonResponseUsage {
6067 type Error = super::error::ConversionError;
6068 fn try_from(
6069 value: JsonResponseUsage,
6070 ) -> ::std::result::Result<Self, super::error::ConversionError> {
6071 Ok(Self {
6072 cost: value.cost?,
6073 input_tokens: value.input_tokens?,
6074 input_tokens_details: value.input_tokens_details?,
6075 output_tokens: value.output_tokens?,
6076 tool_calls_details: value.tool_calls_details?,
6077 total_tokens: value.total_tokens?,
6078 })
6079 }
6080 }
6081 impl ::std::convert::From<super::JsonResponseUsage> for JsonResponseUsage {
6082 fn from(value: super::JsonResponseUsage) -> Self {
6083 Self {
6084 cost: Ok(value.cost),
6085 input_tokens: Ok(value.input_tokens),
6086 input_tokens_details: Ok(value.input_tokens_details),
6087 output_tokens: Ok(value.output_tokens),
6088 tool_calls_details: Ok(value.tool_calls_details),
6089 total_tokens: Ok(value.total_tokens),
6090 }
6091 }
6092 }
6093 #[derive(Clone, Debug)]
6094 pub struct JsonResponseUsageInputTokensDetails {
6095 cache_creation_input_tokens: ::std::result::Result<
6096 ::std::option::Option<i64>,
6097 ::std::string::String,
6098 >,
6099 cache_read_input_tokens: ::std::result::Result<
6100 ::std::option::Option<i64>,
6101 ::std::string::String,
6102 >,
6103 }
6104 impl ::std::default::Default for JsonResponseUsageInputTokensDetails {
6105 fn default() -> Self {
6106 Self {
6107 cache_creation_input_tokens: Ok(Default::default()),
6108 cache_read_input_tokens: Ok(Default::default()),
6109 }
6110 }
6111 }
6112 impl JsonResponseUsageInputTokensDetails {
6113 pub fn cache_creation_input_tokens<T>(mut self, value: T) -> Self
6114 where
6115 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6116 T::Error: ::std::fmt::Display,
6117 {
6118 self.cache_creation_input_tokens = value
6119 .try_into()
6120 .map_err(|e| {
6121 format!(
6122 "error converting supplied value for cache_creation_input_tokens: {e}"
6123 )
6124 });
6125 self
6126 }
6127 pub fn cache_read_input_tokens<T>(mut self, value: T) -> Self
6128 where
6129 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6130 T::Error: ::std::fmt::Display,
6131 {
6132 self.cache_read_input_tokens = value
6133 .try_into()
6134 .map_err(|e| {
6135 format!(
6136 "error converting supplied value for cache_read_input_tokens: {e}"
6137 )
6138 });
6139 self
6140 }
6141 }
6142 impl ::std::convert::TryFrom<JsonResponseUsageInputTokensDetails>
6143 for super::JsonResponseUsageInputTokensDetails {
6144 type Error = super::error::ConversionError;
6145 fn try_from(
6146 value: JsonResponseUsageInputTokensDetails,
6147 ) -> ::std::result::Result<Self, super::error::ConversionError> {
6148 Ok(Self {
6149 cache_creation_input_tokens: value.cache_creation_input_tokens?,
6150 cache_read_input_tokens: value.cache_read_input_tokens?,
6151 })
6152 }
6153 }
6154 impl ::std::convert::From<super::JsonResponseUsageInputTokensDetails>
6155 for JsonResponseUsageInputTokensDetails {
6156 fn from(value: super::JsonResponseUsageInputTokensDetails) -> Self {
6157 Self {
6158 cache_creation_input_tokens: Ok(value.cache_creation_input_tokens),
6159 cache_read_input_tokens: Ok(value.cache_read_input_tokens),
6160 }
6161 }
6162 }
6163 #[derive(Clone, Debug)]
6164 pub struct Output {
6165 body: ::std::result::Result<
6166 ::std::option::Option<super::OutputBody>,
6167 ::std::string::String,
6168 >,
6169 content_type: ::std::result::Result<
6170 ::std::option::Option<super::OutputContentType>,
6171 ::std::string::String,
6172 >,
6173 }
6174 impl ::std::default::Default for Output {
6175 fn default() -> Self {
6176 Self {
6177 body: Ok(Default::default()),
6178 content_type: Ok(Default::default()),
6179 }
6180 }
6181 }
6182 impl Output {
6183 pub fn body<T>(mut self, value: T) -> Self
6184 where
6185 T: ::std::convert::TryInto<::std::option::Option<super::OutputBody>>,
6186 T::Error: ::std::fmt::Display,
6187 {
6188 self.body = value
6189 .try_into()
6190 .map_err(|e| format!("error converting supplied value for body: {e}"));
6191 self
6192 }
6193 pub fn content_type<T>(mut self, value: T) -> Self
6194 where
6195 T: ::std::convert::TryInto<::std::option::Option<super::OutputContentType>>,
6196 T::Error: ::std::fmt::Display,
6197 {
6198 self.content_type = value
6199 .try_into()
6200 .map_err(|e| {
6201 format!("error converting supplied value for content_type: {e}")
6202 });
6203 self
6204 }
6205 }
6206 impl ::std::convert::TryFrom<Output> for super::Output {
6207 type Error = super::error::ConversionError;
6208 fn try_from(
6209 value: Output,
6210 ) -> ::std::result::Result<Self, super::error::ConversionError> {
6211 Ok(Self {
6212 body: value.body?,
6213 content_type: value.content_type?,
6214 })
6215 }
6216 }
6217 impl ::std::convert::From<super::Output> for Output {
6218 fn from(value: super::Output) -> Self {
6219 Self {
6220 body: Ok(value.body),
6221 content_type: Ok(value.content_type),
6222 }
6223 }
6224 }
6225 #[derive(Clone, Debug)]
6226 pub struct SseEventStreamItem {
6227 contents: ::std::result::Result<
6228 ::std::vec::Vec<
6229 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6230 >,
6231 ::std::string::String,
6232 >,
6233 delta: ::std::result::Result<
6234 ::std::option::Option<super::SseEventStreamItemDelta>,
6235 ::std::string::String,
6236 >,
6237 error: ::std::result::Result<
6238 ::std::option::Option<super::SseEventStreamItemError>,
6239 ::std::string::String,
6240 >,
6241 item: ::std::result::Result<
6242 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6243 ::std::string::String,
6244 >,
6245 output_index: ::std::result::Result<
6246 ::std::option::Option<i64>,
6247 ::std::string::String,
6248 >,
6249 queries: ::std::result::Result<
6250 ::std::vec::Vec<::std::string::String>,
6251 ::std::string::String,
6252 >,
6253 response: ::std::result::Result<
6254 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6255 ::std::string::String,
6256 >,
6257 results: ::std::result::Result<
6258 ::std::vec::Vec<
6259 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6260 >,
6261 ::std::string::String,
6262 >,
6263 sequence_number: ::std::result::Result<
6264 ::std::option::Option<i64>,
6265 ::std::string::String,
6266 >,
6267 type_: ::std::result::Result<
6268 ::std::option::Option<::std::string::String>,
6269 ::std::string::String,
6270 >,
6271 urls: ::std::result::Result<
6272 ::std::vec::Vec<::std::string::String>,
6273 ::std::string::String,
6274 >,
6275 }
6276 impl ::std::default::Default for SseEventStreamItem {
6277 fn default() -> Self {
6278 Self {
6279 contents: Ok(Default::default()),
6280 delta: Ok(Default::default()),
6281 error: Ok(Default::default()),
6282 item: Ok(Default::default()),
6283 output_index: Ok(Default::default()),
6284 queries: Ok(Default::default()),
6285 response: Ok(Default::default()),
6286 results: Ok(Default::default()),
6287 sequence_number: Ok(Default::default()),
6288 type_: Ok(Default::default()),
6289 urls: Ok(Default::default()),
6290 }
6291 }
6292 }
6293 impl SseEventStreamItem {
6294 pub fn contents<T>(mut self, value: T) -> Self
6295 where
6296 T: ::std::convert::TryInto<
6297 ::std::vec::Vec<
6298 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6299 >,
6300 >,
6301 T::Error: ::std::fmt::Display,
6302 {
6303 self.contents = value
6304 .try_into()
6305 .map_err(|e| {
6306 format!("error converting supplied value for contents: {e}")
6307 });
6308 self
6309 }
6310 pub fn delta<T>(mut self, value: T) -> Self
6311 where
6312 T: ::std::convert::TryInto<
6313 ::std::option::Option<super::SseEventStreamItemDelta>,
6314 >,
6315 T::Error: ::std::fmt::Display,
6316 {
6317 self.delta = value
6318 .try_into()
6319 .map_err(|e| format!("error converting supplied value for delta: {e}"));
6320 self
6321 }
6322 pub fn error<T>(mut self, value: T) -> Self
6323 where
6324 T: ::std::convert::TryInto<
6325 ::std::option::Option<super::SseEventStreamItemError>,
6326 >,
6327 T::Error: ::std::fmt::Display,
6328 {
6329 self.error = value
6330 .try_into()
6331 .map_err(|e| format!("error converting supplied value for error: {e}"));
6332 self
6333 }
6334 pub fn item<T>(mut self, value: T) -> Self
6335 where
6336 T: ::std::convert::TryInto<
6337 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6338 >,
6339 T::Error: ::std::fmt::Display,
6340 {
6341 self.item = value
6342 .try_into()
6343 .map_err(|e| format!("error converting supplied value for item: {e}"));
6344 self
6345 }
6346 pub fn output_index<T>(mut self, value: T) -> Self
6347 where
6348 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6349 T::Error: ::std::fmt::Display,
6350 {
6351 self.output_index = value
6352 .try_into()
6353 .map_err(|e| {
6354 format!("error converting supplied value for output_index: {e}")
6355 });
6356 self
6357 }
6358 pub fn queries<T>(mut self, value: T) -> Self
6359 where
6360 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
6361 T::Error: ::std::fmt::Display,
6362 {
6363 self.queries = value
6364 .try_into()
6365 .map_err(|e| {
6366 format!("error converting supplied value for queries: {e}")
6367 });
6368 self
6369 }
6370 pub fn response<T>(mut self, value: T) -> Self
6371 where
6372 T: ::std::convert::TryInto<
6373 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6374 >,
6375 T::Error: ::std::fmt::Display,
6376 {
6377 self.response = value
6378 .try_into()
6379 .map_err(|e| {
6380 format!("error converting supplied value for response: {e}")
6381 });
6382 self
6383 }
6384 pub fn results<T>(mut self, value: T) -> Self
6385 where
6386 T: ::std::convert::TryInto<
6387 ::std::vec::Vec<
6388 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
6389 >,
6390 >,
6391 T::Error: ::std::fmt::Display,
6392 {
6393 self.results = value
6394 .try_into()
6395 .map_err(|e| {
6396 format!("error converting supplied value for results: {e}")
6397 });
6398 self
6399 }
6400 pub fn sequence_number<T>(mut self, value: T) -> Self
6401 where
6402 T: ::std::convert::TryInto<::std::option::Option<i64>>,
6403 T::Error: ::std::fmt::Display,
6404 {
6405 self.sequence_number = value
6406 .try_into()
6407 .map_err(|e| {
6408 format!("error converting supplied value for sequence_number: {e}")
6409 });
6410 self
6411 }
6412 pub fn type_<T>(mut self, value: T) -> Self
6413 where
6414 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6415 T::Error: ::std::fmt::Display,
6416 {
6417 self.type_ = value
6418 .try_into()
6419 .map_err(|e| format!("error converting supplied value for type_: {e}"));
6420 self
6421 }
6422 pub fn urls<T>(mut self, value: T) -> Self
6423 where
6424 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
6425 T::Error: ::std::fmt::Display,
6426 {
6427 self.urls = value
6428 .try_into()
6429 .map_err(|e| format!("error converting supplied value for urls: {e}"));
6430 self
6431 }
6432 }
6433 impl ::std::convert::TryFrom<SseEventStreamItem> for super::SseEventStreamItem {
6434 type Error = super::error::ConversionError;
6435 fn try_from(
6436 value: SseEventStreamItem,
6437 ) -> ::std::result::Result<Self, super::error::ConversionError> {
6438 Ok(Self {
6439 contents: value.contents?,
6440 delta: value.delta?,
6441 error: value.error?,
6442 item: value.item?,
6443 output_index: value.output_index?,
6444 queries: value.queries?,
6445 response: value.response?,
6446 results: value.results?,
6447 sequence_number: value.sequence_number?,
6448 type_: value.type_?,
6449 urls: value.urls?,
6450 })
6451 }
6452 }
6453 impl ::std::convert::From<super::SseEventStreamItem> for SseEventStreamItem {
6454 fn from(value: super::SseEventStreamItem) -> Self {
6455 Self {
6456 contents: Ok(value.contents),
6457 delta: Ok(value.delta),
6458 error: Ok(value.error),
6459 item: Ok(value.item),
6460 output_index: Ok(value.output_index),
6461 queries: Ok(value.queries),
6462 response: Ok(value.response),
6463 results: Ok(value.results),
6464 sequence_number: Ok(value.sequence_number),
6465 type_: Ok(value.type_),
6466 urls: Ok(value.urls),
6467 }
6468 }
6469 }
6470 #[derive(Clone, Debug)]
6471 pub struct SseEventStreamItemError {
6472 code: ::std::result::Result<
6473 ::std::option::Option<::std::string::String>,
6474 ::std::string::String,
6475 >,
6476 message: ::std::result::Result<
6477 ::std::option::Option<::std::string::String>,
6478 ::std::string::String,
6479 >,
6480 type_: ::std::result::Result<
6481 ::std::option::Option<::std::string::String>,
6482 ::std::string::String,
6483 >,
6484 }
6485 impl ::std::default::Default for SseEventStreamItemError {
6486 fn default() -> Self {
6487 Self {
6488 code: Ok(Default::default()),
6489 message: Ok(Default::default()),
6490 type_: Ok(Default::default()),
6491 }
6492 }
6493 }
6494 impl SseEventStreamItemError {
6495 pub fn code<T>(mut self, value: T) -> Self
6496 where
6497 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6498 T::Error: ::std::fmt::Display,
6499 {
6500 self.code = value
6501 .try_into()
6502 .map_err(|e| format!("error converting supplied value for code: {e}"));
6503 self
6504 }
6505 pub fn message<T>(mut self, value: T) -> Self
6506 where
6507 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6508 T::Error: ::std::fmt::Display,
6509 {
6510 self.message = value
6511 .try_into()
6512 .map_err(|e| {
6513 format!("error converting supplied value for message: {e}")
6514 });
6515 self
6516 }
6517 pub fn type_<T>(mut self, value: T) -> Self
6518 where
6519 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6520 T::Error: ::std::fmt::Display,
6521 {
6522 self.type_ = value
6523 .try_into()
6524 .map_err(|e| format!("error converting supplied value for type_: {e}"));
6525 self
6526 }
6527 }
6528 impl ::std::convert::TryFrom<SseEventStreamItemError>
6529 for super::SseEventStreamItemError {
6530 type Error = super::error::ConversionError;
6531 fn try_from(
6532 value: SseEventStreamItemError,
6533 ) -> ::std::result::Result<Self, super::error::ConversionError> {
6534 Ok(Self {
6535 code: value.code?,
6536 message: value.message?,
6537 type_: value.type_?,
6538 })
6539 }
6540 }
6541 impl ::std::convert::From<super::SseEventStreamItemError>
6542 for SseEventStreamItemError {
6543 fn from(value: super::SseEventStreamItemError) -> Self {
6544 Self {
6545 code: Ok(value.code),
6546 message: Ok(value.message),
6547 type_: Ok(value.type_),
6548 }
6549 }
6550 }
6551}
6552pub mod error {
6554 pub struct ConversionError(::std::borrow::Cow<'static, str>);
6556 impl ::std::error::Error for ConversionError {}
6557 impl ::std::fmt::Display for ConversionError {
6558 fn fmt(
6559 &self,
6560 f: &mut ::std::fmt::Formatter<'_>,
6561 ) -> Result<(), ::std::fmt::Error> {
6562 ::std::fmt::Display::fmt(&self.0, f)
6563 }
6564 }
6565 impl ::std::fmt::Debug for ConversionError {
6566 fn fmt(
6567 &self,
6568 f: &mut ::std::fmt::Formatter<'_>,
6569 ) -> Result<(), ::std::fmt::Error> {
6570 ::std::fmt::Debug::fmt(&self.0, f)
6571 }
6572 }
6573 impl From<&'static str> for ConversionError {
6574 fn from(value: &'static str) -> Self {
6575 Self(value.into())
6576 }
6577 }
6578 impl From<String> for ConversionError {
6579 fn from(value: String) -> Self {
6580 Self(value.into())
6581 }
6582 }
6583}
6584
6585}
6586
6587 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "body", part: ::one::Part::Body, key: None }, ::one::Route { field: "headers", part: ::one::Part::Headers, key: None }], required_parts: &[] };
6589
6590 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
6645 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZd-ZY-8::3LNxtXrfQAqRFKo2zDUT5A", Method::POST, "/v1/agent").with_routed(&input, &ROUTING)?
6646 .merge_headers(::serde_json::from_str("{\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
6647 }
6648
6649 impl IntoOperation for Input {
6650 type Output = output::Output;
6651
6652 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
6653 build(self)
6654 }
6655 }
6656 impl IntoOperation for builder::Input {
6657 type Output = output::Output;
6658
6659 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
6660 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
6661 }
6662 }
6663 impl ::std::convert::TryFrom<builder::Headers> for ::std::option::Option<Headers> {
6664 type Error = <Headers as ::std::convert::TryFrom<builder::Headers>>::Error;
6665
6666 fn try_from(value: builder::Headers) -> ::std::result::Result<Self, Self::Error> {
6667 Headers::try_from(value).map(Some)
6668 }
6669 }
6670 impl ::std::convert::TryFrom<builder::ReasoningConfiguration> for ::std::option::Option<ReasoningConfiguration> {
6671 type Error = <ReasoningConfiguration as ::std::convert::TryFrom<builder::ReasoningConfiguration>>::Error;
6672
6673 fn try_from(value: builder::ReasoningConfiguration) -> ::std::result::Result<Self, Self::Error> {
6674 ReasoningConfiguration::try_from(value).map(Some)
6675 }
6676 }
6677 impl ::std::convert::TryFrom<builder::ResponseFormatConfiguration> for ::std::option::Option<ResponseFormatConfiguration> {
6678 type Error = <ResponseFormatConfiguration as ::std::convert::TryFrom<builder::ResponseFormatConfiguration>>::Error;
6679
6680 fn try_from(value: builder::ResponseFormatConfiguration) -> ::std::result::Result<Self, Self::Error> {
6681 ResponseFormatConfiguration::try_from(value).map(Some)
6682 }
6683 }
6684}
6685pub fn create_agent_response() -> create_agent_response::builder::Input {
6687 create_agent_response::builder::Input::default()
6688}
6689pub mod create_chat_completion {
6690 use ::one::{Error, IntoOperation, Method, Operation};
6691#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
6693#[serde(deny_unknown_fields)]
6694pub struct Input {
6695 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6697 pub disable_search: ::std::option::Option<bool>,
6698 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6700 pub enable_search_classifier: ::std::option::Option<bool>,
6701 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6703 pub image_domain_filter: ::std::option::Option<
6704 ::std::vec::Vec<::std::string::String>,
6705 >,
6706 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6708 pub image_format_filter: ::std::option::Option<
6709 ::std::vec::Vec<::std::string::String>,
6710 >,
6711 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6713 pub language_preference: ::std::option::Option<::std::string::String>,
6714 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6716 pub last_updated_after_filter: ::std::option::Option<::std::string::String>,
6717 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6719 pub last_updated_before_filter: ::std::option::Option<::std::string::String>,
6720 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6722 pub max_tokens: ::std::option::Option<i64>,
6723 pub messages: ::std::vec::Vec<Message>,
6725 pub model: InputModel,
6727 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6729 pub reasoning_effort: ::std::option::Option<InputReasoningEffort>,
6730 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6732 pub response_format: ::std::option::Option<ResponseFormat>,
6733 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6735 pub return_images: ::std::option::Option<bool>,
6736 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6738 pub return_related_questions: ::std::option::Option<bool>,
6739 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6741 pub search_after_date_filter: ::std::option::Option<::std::string::String>,
6742 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6744 pub search_before_date_filter: ::std::option::Option<::std::string::String>,
6745 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6747 pub search_domain_filter: ::std::option::Option<
6748 ::std::vec::Vec<::std::string::String>,
6749 >,
6750 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6752 pub search_language_filter: ::std::option::Option<
6753 ::std::vec::Vec<::std::string::String>,
6754 >,
6755 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6757 pub search_mode: ::std::option::Option<InputSearchMode>,
6758 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6760 pub search_recency_filter: ::std::option::Option<InputSearchRecencyFilter>,
6761 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6763 pub stop: ::std::option::Option<InputStop>,
6764 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6766 pub stream: ::std::option::Option<bool>,
6767 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6769 pub stream_mode: ::std::option::Option<InputStreamMode>,
6770 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6772 pub temperature: ::std::option::Option<f64>,
6773 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6775 pub top_p: ::std::option::Option<f64>,
6776 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
6777 pub web_search_options: ::std::option::Option<WebSearchOptions>,
6778}
6779impl Input {
6780 pub fn builder() -> builder::Input {
6781 Default::default()
6782 }
6783}
6784#[derive(
6786 ::serde::Deserialize,
6787 ::serde::Serialize,
6788 Clone,
6789 Copy,
6790 Debug,
6791 Eq,
6792 Hash,
6793 Ord,
6794 PartialEq,
6795 PartialOrd
6796)]
6797pub enum InputModel {
6798 #[serde(rename = "sonar")]
6799 Sonar,
6800 #[serde(rename = "sonar-pro")]
6801 SonarPro,
6802 #[serde(rename = "sonar-deep-research")]
6803 SonarDeepResearch,
6804 #[serde(rename = "sonar-reasoning-pro")]
6805 SonarReasoningPro,
6806}
6807impl ::std::fmt::Display for InputModel {
6808 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6809 match *self {
6810 Self::Sonar => f.write_str("sonar"),
6811 Self::SonarPro => f.write_str("sonar-pro"),
6812 Self::SonarDeepResearch => f.write_str("sonar-deep-research"),
6813 Self::SonarReasoningPro => f.write_str("sonar-reasoning-pro"),
6814 }
6815 }
6816}
6817impl ::std::str::FromStr for InputModel {
6818 type Err = self::error::ConversionError;
6819 fn from_str(
6820 value: &str,
6821 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6822 match value {
6823 "sonar" => Ok(Self::Sonar),
6824 "sonar-pro" => Ok(Self::SonarPro),
6825 "sonar-deep-research" => Ok(Self::SonarDeepResearch),
6826 "sonar-reasoning-pro" => Ok(Self::SonarReasoningPro),
6827 _ => Err("invalid value".into()),
6828 }
6829 }
6830}
6831impl ::std::convert::TryFrom<&str> for InputModel {
6832 type Error = self::error::ConversionError;
6833 fn try_from(
6834 value: &str,
6835 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6836 value.parse()
6837 }
6838}
6839impl ::std::convert::TryFrom<::std::string::String> for InputModel {
6840 type Error = self::error::ConversionError;
6841 fn try_from(
6842 value: ::std::string::String,
6843 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6844 value.parse()
6845 }
6846}
6847#[derive(
6849 ::serde::Deserialize,
6850 ::serde::Serialize,
6851 Clone,
6852 Copy,
6853 Debug,
6854 Eq,
6855 Hash,
6856 Ord,
6857 PartialEq,
6858 PartialOrd
6859)]
6860pub enum InputReasoningEffort {
6861 #[serde(rename = "minimal")]
6862 Minimal,
6863 #[serde(rename = "low")]
6864 Low,
6865 #[serde(rename = "medium")]
6866 Medium,
6867 #[serde(rename = "high")]
6868 High,
6869}
6870impl ::std::fmt::Display for InputReasoningEffort {
6871 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6872 match *self {
6873 Self::Minimal => f.write_str("minimal"),
6874 Self::Low => f.write_str("low"),
6875 Self::Medium => f.write_str("medium"),
6876 Self::High => f.write_str("high"),
6877 }
6878 }
6879}
6880impl ::std::str::FromStr for InputReasoningEffort {
6881 type Err = self::error::ConversionError;
6882 fn from_str(
6883 value: &str,
6884 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6885 match value {
6886 "minimal" => Ok(Self::Minimal),
6887 "low" => Ok(Self::Low),
6888 "medium" => Ok(Self::Medium),
6889 "high" => Ok(Self::High),
6890 _ => Err("invalid value".into()),
6891 }
6892 }
6893}
6894impl ::std::convert::TryFrom<&str> for InputReasoningEffort {
6895 type Error = self::error::ConversionError;
6896 fn try_from(
6897 value: &str,
6898 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6899 value.parse()
6900 }
6901}
6902impl ::std::convert::TryFrom<::std::string::String> for InputReasoningEffort {
6903 type Error = self::error::ConversionError;
6904 fn try_from(
6905 value: ::std::string::String,
6906 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6907 value.parse()
6908 }
6909}
6910#[derive(
6912 ::serde::Deserialize,
6913 ::serde::Serialize,
6914 Clone,
6915 Copy,
6916 Debug,
6917 Eq,
6918 Hash,
6919 Ord,
6920 PartialEq,
6921 PartialOrd
6922)]
6923pub enum InputSearchMode {
6924 #[serde(rename = "web")]
6925 Web,
6926 #[serde(rename = "academic")]
6927 Academic,
6928 #[serde(rename = "sec")]
6929 Sec,
6930}
6931impl ::std::fmt::Display for InputSearchMode {
6932 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6933 match *self {
6934 Self::Web => f.write_str("web"),
6935 Self::Academic => f.write_str("academic"),
6936 Self::Sec => f.write_str("sec"),
6937 }
6938 }
6939}
6940impl ::std::str::FromStr for InputSearchMode {
6941 type Err = self::error::ConversionError;
6942 fn from_str(
6943 value: &str,
6944 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6945 match value {
6946 "web" => Ok(Self::Web),
6947 "academic" => Ok(Self::Academic),
6948 "sec" => Ok(Self::Sec),
6949 _ => Err("invalid value".into()),
6950 }
6951 }
6952}
6953impl ::std::convert::TryFrom<&str> for InputSearchMode {
6954 type Error = self::error::ConversionError;
6955 fn try_from(
6956 value: &str,
6957 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6958 value.parse()
6959 }
6960}
6961impl ::std::convert::TryFrom<::std::string::String> for InputSearchMode {
6962 type Error = self::error::ConversionError;
6963 fn try_from(
6964 value: ::std::string::String,
6965 ) -> ::std::result::Result<Self, self::error::ConversionError> {
6966 value.parse()
6967 }
6968}
6969#[derive(
6971 ::serde::Deserialize,
6972 ::serde::Serialize,
6973 Clone,
6974 Copy,
6975 Debug,
6976 Eq,
6977 Hash,
6978 Ord,
6979 PartialEq,
6980 PartialOrd
6981)]
6982pub enum InputSearchRecencyFilter {
6983 #[serde(rename = "hour")]
6984 Hour,
6985 #[serde(rename = "day")]
6986 Day,
6987 #[serde(rename = "week")]
6988 Week,
6989 #[serde(rename = "month")]
6990 Month,
6991 #[serde(rename = "year")]
6992 Year,
6993}
6994impl ::std::fmt::Display for InputSearchRecencyFilter {
6995 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
6996 match *self {
6997 Self::Hour => f.write_str("hour"),
6998 Self::Day => f.write_str("day"),
6999 Self::Week => f.write_str("week"),
7000 Self::Month => f.write_str("month"),
7001 Self::Year => f.write_str("year"),
7002 }
7003 }
7004}
7005impl ::std::str::FromStr for InputSearchRecencyFilter {
7006 type Err = self::error::ConversionError;
7007 fn from_str(
7008 value: &str,
7009 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7010 match value {
7011 "hour" => Ok(Self::Hour),
7012 "day" => Ok(Self::Day),
7013 "week" => Ok(Self::Week),
7014 "month" => Ok(Self::Month),
7015 "year" => Ok(Self::Year),
7016 _ => Err("invalid value".into()),
7017 }
7018 }
7019}
7020impl ::std::convert::TryFrom<&str> for InputSearchRecencyFilter {
7021 type Error = self::error::ConversionError;
7022 fn try_from(
7023 value: &str,
7024 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7025 value.parse()
7026 }
7027}
7028impl ::std::convert::TryFrom<::std::string::String> for InputSearchRecencyFilter {
7029 type Error = self::error::ConversionError;
7030 fn try_from(
7031 value: ::std::string::String,
7032 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7033 value.parse()
7034 }
7035}
7036#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7038#[serde(untagged)]
7039pub enum InputStop {
7040 String(::std::string::String),
7041 Array(::std::vec::Vec<::std::string::String>),
7042 Null,
7043}
7044impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for InputStop {
7045 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
7046 Self::Array(value)
7047 }
7048}
7049#[derive(
7051 ::serde::Deserialize,
7052 ::serde::Serialize,
7053 Clone,
7054 Copy,
7055 Debug,
7056 Eq,
7057 Hash,
7058 Ord,
7059 PartialEq,
7060 PartialOrd
7061)]
7062pub enum InputStreamMode {
7063 #[serde(rename = "full")]
7064 Full,
7065 #[serde(rename = "concise")]
7066 Concise,
7067}
7068impl ::std::fmt::Display for InputStreamMode {
7069 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7070 match *self {
7071 Self::Full => f.write_str("full"),
7072 Self::Concise => f.write_str("concise"),
7073 }
7074 }
7075}
7076impl ::std::str::FromStr for InputStreamMode {
7077 type Err = self::error::ConversionError;
7078 fn from_str(
7079 value: &str,
7080 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7081 match value {
7082 "full" => Ok(Self::Full),
7083 "concise" => Ok(Self::Concise),
7084 _ => Err("invalid value".into()),
7085 }
7086 }
7087}
7088impl ::std::convert::TryFrom<&str> for InputStreamMode {
7089 type Error = self::error::ConversionError;
7090 fn try_from(
7091 value: &str,
7092 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7093 value.parse()
7094 }
7095}
7096impl ::std::convert::TryFrom<::std::string::String> for InputStreamMode {
7097 type Error = self::error::ConversionError;
7098 fn try_from(
7099 value: ::std::string::String,
7100 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7101 value.parse()
7102 }
7103}
7104#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
7106#[serde(deny_unknown_fields)]
7107pub struct Message {
7108 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
7110 pub content: ::std::option::Option<MessageContent>,
7111 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
7113 pub role: ::std::option::Option<::std::string::String>,
7114}
7115impl Message {
7116 pub fn builder() -> builder::Message {
7117 Default::default()
7118 }
7119}
7120#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7122#[serde(untagged)]
7123pub enum MessageContent {
7124 String(::std::string::String),
7125 Array(
7126 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
7127 ),
7128 Null,
7129}
7130impl ::std::convert::From<
7131 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
7132> for MessageContent {
7133 fn from(
7134 value: ::std::vec::Vec<
7135 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
7136 >,
7137 ) -> Self {
7138 Self::Array(value)
7139 }
7140}
7141#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
7143#[serde(deny_unknown_fields)]
7144pub struct ResponseFormat {
7145 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
7147 pub json_schema: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
7148 #[serde(rename = "type")]
7150 pub type_: ResponseFormatType,
7151}
7152impl ResponseFormat {
7153 pub fn builder() -> builder::ResponseFormat {
7154 Default::default()
7155 }
7156}
7157#[derive(
7159 ::serde::Deserialize,
7160 ::serde::Serialize,
7161 Clone,
7162 Copy,
7163 Debug,
7164 Eq,
7165 Hash,
7166 Ord,
7167 PartialEq,
7168 PartialOrd
7169)]
7170pub enum ResponseFormatType {
7171 #[serde(rename = "text")]
7172 Text,
7173 #[serde(rename = "json_schema")]
7174 JsonSchema,
7175}
7176impl ::std::fmt::Display for ResponseFormatType {
7177 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7178 match *self {
7179 Self::Text => f.write_str("text"),
7180 Self::JsonSchema => f.write_str("json_schema"),
7181 }
7182 }
7183}
7184impl ::std::str::FromStr for ResponseFormatType {
7185 type Err = self::error::ConversionError;
7186 fn from_str(
7187 value: &str,
7188 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7189 match value {
7190 "text" => Ok(Self::Text),
7191 "json_schema" => Ok(Self::JsonSchema),
7192 _ => Err("invalid value".into()),
7193 }
7194 }
7195}
7196impl ::std::convert::TryFrom<&str> for ResponseFormatType {
7197 type Error = self::error::ConversionError;
7198 fn try_from(
7199 value: &str,
7200 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7201 value.parse()
7202 }
7203}
7204impl ::std::convert::TryFrom<::std::string::String> for ResponseFormatType {
7205 type Error = self::error::ConversionError;
7206 fn try_from(
7207 value: ::std::string::String,
7208 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7209 value.parse()
7210 }
7211}
7212#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
7214#[serde(deny_unknown_fields)]
7215pub struct WebSearchOptions {
7216 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
7218 pub image_results_enhanced_relevance: ::std::option::Option<bool>,
7219 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
7221 pub search_context_size: ::std::option::Option<WebSearchOptionsSearchContextSize>,
7222 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
7224 pub search_type: ::std::option::Option<WebSearchOptionsSearchType>,
7225 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
7227 pub user_location: ::std::option::Option<
7228 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
7229 >,
7230}
7231impl WebSearchOptions {
7232 pub fn builder() -> builder::WebSearchOptions {
7233 Default::default()
7234 }
7235}
7236#[derive(
7238 ::serde::Deserialize,
7239 ::serde::Serialize,
7240 Clone,
7241 Copy,
7242 Debug,
7243 Eq,
7244 Hash,
7245 Ord,
7246 PartialEq,
7247 PartialOrd
7248)]
7249pub enum WebSearchOptionsSearchContextSize {
7250 #[serde(rename = "low")]
7251 Low,
7252 #[serde(rename = "medium")]
7253 Medium,
7254 #[serde(rename = "high")]
7255 High,
7256}
7257impl ::std::fmt::Display for WebSearchOptionsSearchContextSize {
7258 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7259 match *self {
7260 Self::Low => f.write_str("low"),
7261 Self::Medium => f.write_str("medium"),
7262 Self::High => f.write_str("high"),
7263 }
7264 }
7265}
7266impl ::std::str::FromStr for WebSearchOptionsSearchContextSize {
7267 type Err = self::error::ConversionError;
7268 fn from_str(
7269 value: &str,
7270 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7271 match value {
7272 "low" => Ok(Self::Low),
7273 "medium" => Ok(Self::Medium),
7274 "high" => Ok(Self::High),
7275 _ => Err("invalid value".into()),
7276 }
7277 }
7278}
7279impl ::std::convert::TryFrom<&str> for WebSearchOptionsSearchContextSize {
7280 type Error = self::error::ConversionError;
7281 fn try_from(
7282 value: &str,
7283 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7284 value.parse()
7285 }
7286}
7287impl ::std::convert::TryFrom<::std::string::String>
7288for WebSearchOptionsSearchContextSize {
7289 type Error = self::error::ConversionError;
7290 fn try_from(
7291 value: ::std::string::String,
7292 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7293 value.parse()
7294 }
7295}
7296#[derive(
7298 ::serde::Deserialize,
7299 ::serde::Serialize,
7300 Clone,
7301 Copy,
7302 Debug,
7303 Eq,
7304 Hash,
7305 Ord,
7306 PartialEq,
7307 PartialOrd
7308)]
7309pub enum WebSearchOptionsSearchType {
7310 #[serde(rename = "fast")]
7311 Fast,
7312 #[serde(rename = "pro")]
7313 Pro,
7314 #[serde(rename = "auto")]
7315 Auto,
7316}
7317impl ::std::fmt::Display for WebSearchOptionsSearchType {
7318 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7319 match *self {
7320 Self::Fast => f.write_str("fast"),
7321 Self::Pro => f.write_str("pro"),
7322 Self::Auto => f.write_str("auto"),
7323 }
7324 }
7325}
7326impl ::std::str::FromStr for WebSearchOptionsSearchType {
7327 type Err = self::error::ConversionError;
7328 fn from_str(
7329 value: &str,
7330 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7331 match value {
7332 "fast" => Ok(Self::Fast),
7333 "pro" => Ok(Self::Pro),
7334 "auto" => Ok(Self::Auto),
7335 _ => Err("invalid value".into()),
7336 }
7337 }
7338}
7339impl ::std::convert::TryFrom<&str> for WebSearchOptionsSearchType {
7340 type Error = self::error::ConversionError;
7341 fn try_from(
7342 value: &str,
7343 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7344 value.parse()
7345 }
7346}
7347impl ::std::convert::TryFrom<::std::string::String> for WebSearchOptionsSearchType {
7348 type Error = self::error::ConversionError;
7349 fn try_from(
7350 value: ::std::string::String,
7351 ) -> ::std::result::Result<Self, self::error::ConversionError> {
7352 value.parse()
7353 }
7354}
7355pub mod builder {
7357 #[derive(Clone, Debug)]
7358 pub struct Input {
7359 disable_search: ::std::result::Result<
7360 ::std::option::Option<bool>,
7361 ::std::string::String,
7362 >,
7363 enable_search_classifier: ::std::result::Result<
7364 ::std::option::Option<bool>,
7365 ::std::string::String,
7366 >,
7367 image_domain_filter: ::std::result::Result<
7368 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7369 ::std::string::String,
7370 >,
7371 image_format_filter: ::std::result::Result<
7372 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7373 ::std::string::String,
7374 >,
7375 language_preference: ::std::result::Result<
7376 ::std::option::Option<::std::string::String>,
7377 ::std::string::String,
7378 >,
7379 last_updated_after_filter: ::std::result::Result<
7380 ::std::option::Option<::std::string::String>,
7381 ::std::string::String,
7382 >,
7383 last_updated_before_filter: ::std::result::Result<
7384 ::std::option::Option<::std::string::String>,
7385 ::std::string::String,
7386 >,
7387 max_tokens: ::std::result::Result<
7388 ::std::option::Option<i64>,
7389 ::std::string::String,
7390 >,
7391 messages: ::std::result::Result<
7392 ::std::vec::Vec<super::Message>,
7393 ::std::string::String,
7394 >,
7395 model: ::std::result::Result<super::InputModel, ::std::string::String>,
7396 reasoning_effort: ::std::result::Result<
7397 ::std::option::Option<super::InputReasoningEffort>,
7398 ::std::string::String,
7399 >,
7400 response_format: ::std::result::Result<
7401 ::std::option::Option<super::ResponseFormat>,
7402 ::std::string::String,
7403 >,
7404 return_images: ::std::result::Result<
7405 ::std::option::Option<bool>,
7406 ::std::string::String,
7407 >,
7408 return_related_questions: ::std::result::Result<
7409 ::std::option::Option<bool>,
7410 ::std::string::String,
7411 >,
7412 search_after_date_filter: ::std::result::Result<
7413 ::std::option::Option<::std::string::String>,
7414 ::std::string::String,
7415 >,
7416 search_before_date_filter: ::std::result::Result<
7417 ::std::option::Option<::std::string::String>,
7418 ::std::string::String,
7419 >,
7420 search_domain_filter: ::std::result::Result<
7421 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7422 ::std::string::String,
7423 >,
7424 search_language_filter: ::std::result::Result<
7425 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7426 ::std::string::String,
7427 >,
7428 search_mode: ::std::result::Result<
7429 ::std::option::Option<super::InputSearchMode>,
7430 ::std::string::String,
7431 >,
7432 search_recency_filter: ::std::result::Result<
7433 ::std::option::Option<super::InputSearchRecencyFilter>,
7434 ::std::string::String,
7435 >,
7436 stop: ::std::result::Result<
7437 ::std::option::Option<super::InputStop>,
7438 ::std::string::String,
7439 >,
7440 stream: ::std::result::Result<
7441 ::std::option::Option<bool>,
7442 ::std::string::String,
7443 >,
7444 stream_mode: ::std::result::Result<
7445 ::std::option::Option<super::InputStreamMode>,
7446 ::std::string::String,
7447 >,
7448 temperature: ::std::result::Result<
7449 ::std::option::Option<f64>,
7450 ::std::string::String,
7451 >,
7452 top_p: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
7453 web_search_options: ::std::result::Result<
7454 ::std::option::Option<super::WebSearchOptions>,
7455 ::std::string::String,
7456 >,
7457 }
7458 impl ::std::default::Default for Input {
7459 fn default() -> Self {
7460 Self {
7461 disable_search: Ok(Default::default()),
7462 enable_search_classifier: Ok(Default::default()),
7463 image_domain_filter: Ok(Default::default()),
7464 image_format_filter: Ok(Default::default()),
7465 language_preference: Ok(Default::default()),
7466 last_updated_after_filter: Ok(Default::default()),
7467 last_updated_before_filter: Ok(Default::default()),
7468 max_tokens: Ok(Default::default()),
7469 messages: Err("no value supplied for messages".to_string()),
7470 model: Err("no value supplied for model".to_string()),
7471 reasoning_effort: Ok(Default::default()),
7472 response_format: Ok(Default::default()),
7473 return_images: Ok(Default::default()),
7474 return_related_questions: Ok(Default::default()),
7475 search_after_date_filter: Ok(Default::default()),
7476 search_before_date_filter: Ok(Default::default()),
7477 search_domain_filter: Ok(Default::default()),
7478 search_language_filter: Ok(Default::default()),
7479 search_mode: Ok(Default::default()),
7480 search_recency_filter: Ok(Default::default()),
7481 stop: Ok(Default::default()),
7482 stream: Ok(Default::default()),
7483 stream_mode: Ok(Default::default()),
7484 temperature: Ok(Default::default()),
7485 top_p: Ok(Default::default()),
7486 web_search_options: Ok(Default::default()),
7487 }
7488 }
7489 }
7490 impl Input {
7491 pub fn disable_search<T>(mut self, value: T) -> Self
7492 where
7493 T: ::std::convert::TryInto<::std::option::Option<bool>>,
7494 T::Error: ::std::fmt::Display,
7495 {
7496 self.disable_search = value
7497 .try_into()
7498 .map_err(|e| {
7499 format!("error converting supplied value for disable_search: {e}")
7500 });
7501 self
7502 }
7503 pub fn enable_search_classifier<T>(mut self, value: T) -> Self
7504 where
7505 T: ::std::convert::TryInto<::std::option::Option<bool>>,
7506 T::Error: ::std::fmt::Display,
7507 {
7508 self.enable_search_classifier = value
7509 .try_into()
7510 .map_err(|e| {
7511 format!(
7512 "error converting supplied value for enable_search_classifier: {e}"
7513 )
7514 });
7515 self
7516 }
7517 pub fn image_domain_filter<T>(mut self, value: T) -> Self
7518 where
7519 T: ::std::convert::TryInto<
7520 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7521 >,
7522 T::Error: ::std::fmt::Display,
7523 {
7524 self.image_domain_filter = value
7525 .try_into()
7526 .map_err(|e| {
7527 format!(
7528 "error converting supplied value for image_domain_filter: {e}"
7529 )
7530 });
7531 self
7532 }
7533 pub fn image_format_filter<T>(mut self, value: T) -> Self
7534 where
7535 T: ::std::convert::TryInto<
7536 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7537 >,
7538 T::Error: ::std::fmt::Display,
7539 {
7540 self.image_format_filter = value
7541 .try_into()
7542 .map_err(|e| {
7543 format!(
7544 "error converting supplied value for image_format_filter: {e}"
7545 )
7546 });
7547 self
7548 }
7549 pub fn language_preference<T>(mut self, value: T) -> Self
7550 where
7551 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7552 T::Error: ::std::fmt::Display,
7553 {
7554 self.language_preference = value
7555 .try_into()
7556 .map_err(|e| {
7557 format!(
7558 "error converting supplied value for language_preference: {e}"
7559 )
7560 });
7561 self
7562 }
7563 pub fn last_updated_after_filter<T>(mut self, value: T) -> Self
7564 where
7565 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7566 T::Error: ::std::fmt::Display,
7567 {
7568 self.last_updated_after_filter = value
7569 .try_into()
7570 .map_err(|e| {
7571 format!(
7572 "error converting supplied value for last_updated_after_filter: {e}"
7573 )
7574 });
7575 self
7576 }
7577 pub fn last_updated_before_filter<T>(mut self, value: T) -> Self
7578 where
7579 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7580 T::Error: ::std::fmt::Display,
7581 {
7582 self.last_updated_before_filter = value
7583 .try_into()
7584 .map_err(|e| {
7585 format!(
7586 "error converting supplied value for last_updated_before_filter: {e}"
7587 )
7588 });
7589 self
7590 }
7591 pub fn max_tokens<T>(mut self, value: T) -> Self
7592 where
7593 T: ::std::convert::TryInto<::std::option::Option<i64>>,
7594 T::Error: ::std::fmt::Display,
7595 {
7596 self.max_tokens = value
7597 .try_into()
7598 .map_err(|e| {
7599 format!("error converting supplied value for max_tokens: {e}")
7600 });
7601 self
7602 }
7603 pub fn messages<T>(mut self, value: T) -> Self
7604 where
7605 T: ::std::convert::TryInto<::std::vec::Vec<super::Message>>,
7606 T::Error: ::std::fmt::Display,
7607 {
7608 self.messages = value
7609 .try_into()
7610 .map_err(|e| {
7611 format!("error converting supplied value for messages: {e}")
7612 });
7613 self
7614 }
7615 pub fn model<T>(mut self, value: T) -> Self
7616 where
7617 T: ::std::convert::TryInto<super::InputModel>,
7618 T::Error: ::std::fmt::Display,
7619 {
7620 self.model = value
7621 .try_into()
7622 .map_err(|e| format!("error converting supplied value for model: {e}"));
7623 self
7624 }
7625 pub fn reasoning_effort<T>(mut self, value: T) -> Self
7626 where
7627 T: ::std::convert::TryInto<
7628 ::std::option::Option<super::InputReasoningEffort>,
7629 >,
7630 T::Error: ::std::fmt::Display,
7631 {
7632 self.reasoning_effort = value
7633 .try_into()
7634 .map_err(|e| {
7635 format!("error converting supplied value for reasoning_effort: {e}")
7636 });
7637 self
7638 }
7639 pub fn response_format<T>(mut self, value: T) -> Self
7640 where
7641 T: ::std::convert::TryInto<::std::option::Option<super::ResponseFormat>>,
7642 T::Error: ::std::fmt::Display,
7643 {
7644 self.response_format = value
7645 .try_into()
7646 .map_err(|e| {
7647 format!("error converting supplied value for response_format: {e}")
7648 });
7649 self
7650 }
7651 pub fn return_images<T>(mut self, value: T) -> Self
7652 where
7653 T: ::std::convert::TryInto<::std::option::Option<bool>>,
7654 T::Error: ::std::fmt::Display,
7655 {
7656 self.return_images = value
7657 .try_into()
7658 .map_err(|e| {
7659 format!("error converting supplied value for return_images: {e}")
7660 });
7661 self
7662 }
7663 pub fn return_related_questions<T>(mut self, value: T) -> Self
7664 where
7665 T: ::std::convert::TryInto<::std::option::Option<bool>>,
7666 T::Error: ::std::fmt::Display,
7667 {
7668 self.return_related_questions = value
7669 .try_into()
7670 .map_err(|e| {
7671 format!(
7672 "error converting supplied value for return_related_questions: {e}"
7673 )
7674 });
7675 self
7676 }
7677 pub fn search_after_date_filter<T>(mut self, value: T) -> Self
7678 where
7679 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7680 T::Error: ::std::fmt::Display,
7681 {
7682 self.search_after_date_filter = value
7683 .try_into()
7684 .map_err(|e| {
7685 format!(
7686 "error converting supplied value for search_after_date_filter: {e}"
7687 )
7688 });
7689 self
7690 }
7691 pub fn search_before_date_filter<T>(mut self, value: T) -> Self
7692 where
7693 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7694 T::Error: ::std::fmt::Display,
7695 {
7696 self.search_before_date_filter = value
7697 .try_into()
7698 .map_err(|e| {
7699 format!(
7700 "error converting supplied value for search_before_date_filter: {e}"
7701 )
7702 });
7703 self
7704 }
7705 pub fn search_domain_filter<T>(mut self, value: T) -> Self
7706 where
7707 T: ::std::convert::TryInto<
7708 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7709 >,
7710 T::Error: ::std::fmt::Display,
7711 {
7712 self.search_domain_filter = value
7713 .try_into()
7714 .map_err(|e| {
7715 format!(
7716 "error converting supplied value for search_domain_filter: {e}"
7717 )
7718 });
7719 self
7720 }
7721 pub fn search_language_filter<T>(mut self, value: T) -> Self
7722 where
7723 T: ::std::convert::TryInto<
7724 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
7725 >,
7726 T::Error: ::std::fmt::Display,
7727 {
7728 self.search_language_filter = value
7729 .try_into()
7730 .map_err(|e| {
7731 format!(
7732 "error converting supplied value for search_language_filter: {e}"
7733 )
7734 });
7735 self
7736 }
7737 pub fn search_mode<T>(mut self, value: T) -> Self
7738 where
7739 T: ::std::convert::TryInto<::std::option::Option<super::InputSearchMode>>,
7740 T::Error: ::std::fmt::Display,
7741 {
7742 self.search_mode = value
7743 .try_into()
7744 .map_err(|e| {
7745 format!("error converting supplied value for search_mode: {e}")
7746 });
7747 self
7748 }
7749 pub fn search_recency_filter<T>(mut self, value: T) -> Self
7750 where
7751 T: ::std::convert::TryInto<
7752 ::std::option::Option<super::InputSearchRecencyFilter>,
7753 >,
7754 T::Error: ::std::fmt::Display,
7755 {
7756 self.search_recency_filter = value
7757 .try_into()
7758 .map_err(|e| {
7759 format!(
7760 "error converting supplied value for search_recency_filter: {e}"
7761 )
7762 });
7763 self
7764 }
7765 pub fn stop<T>(mut self, value: T) -> Self
7766 where
7767 T: ::std::convert::TryInto<::std::option::Option<super::InputStop>>,
7768 T::Error: ::std::fmt::Display,
7769 {
7770 self.stop = value
7771 .try_into()
7772 .map_err(|e| format!("error converting supplied value for stop: {e}"));
7773 self
7774 }
7775 pub fn stream<T>(mut self, value: T) -> Self
7776 where
7777 T: ::std::convert::TryInto<::std::option::Option<bool>>,
7778 T::Error: ::std::fmt::Display,
7779 {
7780 self.stream = value
7781 .try_into()
7782 .map_err(|e| format!("error converting supplied value for stream: {e}"));
7783 self
7784 }
7785 pub fn stream_mode<T>(mut self, value: T) -> Self
7786 where
7787 T: ::std::convert::TryInto<::std::option::Option<super::InputStreamMode>>,
7788 T::Error: ::std::fmt::Display,
7789 {
7790 self.stream_mode = value
7791 .try_into()
7792 .map_err(|e| {
7793 format!("error converting supplied value for stream_mode: {e}")
7794 });
7795 self
7796 }
7797 pub fn temperature<T>(mut self, value: T) -> Self
7798 where
7799 T: ::std::convert::TryInto<::std::option::Option<f64>>,
7800 T::Error: ::std::fmt::Display,
7801 {
7802 self.temperature = value
7803 .try_into()
7804 .map_err(|e| {
7805 format!("error converting supplied value for temperature: {e}")
7806 });
7807 self
7808 }
7809 pub fn top_p<T>(mut self, value: T) -> Self
7810 where
7811 T: ::std::convert::TryInto<::std::option::Option<f64>>,
7812 T::Error: ::std::fmt::Display,
7813 {
7814 self.top_p = value
7815 .try_into()
7816 .map_err(|e| format!("error converting supplied value for top_p: {e}"));
7817 self
7818 }
7819 pub fn web_search_options<T>(mut self, value: T) -> Self
7820 where
7821 T: ::std::convert::TryInto<::std::option::Option<super::WebSearchOptions>>,
7822 T::Error: ::std::fmt::Display,
7823 {
7824 self.web_search_options = value
7825 .try_into()
7826 .map_err(|e| {
7827 format!(
7828 "error converting supplied value for web_search_options: {e}"
7829 )
7830 });
7831 self
7832 }
7833 }
7834 impl ::std::convert::TryFrom<Input> for super::Input {
7835 type Error = super::error::ConversionError;
7836 fn try_from(
7837 value: Input,
7838 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7839 Ok(Self {
7840 disable_search: value.disable_search?,
7841 enable_search_classifier: value.enable_search_classifier?,
7842 image_domain_filter: value.image_domain_filter?,
7843 image_format_filter: value.image_format_filter?,
7844 language_preference: value.language_preference?,
7845 last_updated_after_filter: value.last_updated_after_filter?,
7846 last_updated_before_filter: value.last_updated_before_filter?,
7847 max_tokens: value.max_tokens?,
7848 messages: value.messages?,
7849 model: value.model?,
7850 reasoning_effort: value.reasoning_effort?,
7851 response_format: value.response_format?,
7852 return_images: value.return_images?,
7853 return_related_questions: value.return_related_questions?,
7854 search_after_date_filter: value.search_after_date_filter?,
7855 search_before_date_filter: value.search_before_date_filter?,
7856 search_domain_filter: value.search_domain_filter?,
7857 search_language_filter: value.search_language_filter?,
7858 search_mode: value.search_mode?,
7859 search_recency_filter: value.search_recency_filter?,
7860 stop: value.stop?,
7861 stream: value.stream?,
7862 stream_mode: value.stream_mode?,
7863 temperature: value.temperature?,
7864 top_p: value.top_p?,
7865 web_search_options: value.web_search_options?,
7866 })
7867 }
7868 }
7869 impl ::std::convert::From<super::Input> for Input {
7870 fn from(value: super::Input) -> Self {
7871 Self {
7872 disable_search: Ok(value.disable_search),
7873 enable_search_classifier: Ok(value.enable_search_classifier),
7874 image_domain_filter: Ok(value.image_domain_filter),
7875 image_format_filter: Ok(value.image_format_filter),
7876 language_preference: Ok(value.language_preference),
7877 last_updated_after_filter: Ok(value.last_updated_after_filter),
7878 last_updated_before_filter: Ok(value.last_updated_before_filter),
7879 max_tokens: Ok(value.max_tokens),
7880 messages: Ok(value.messages),
7881 model: Ok(value.model),
7882 reasoning_effort: Ok(value.reasoning_effort),
7883 response_format: Ok(value.response_format),
7884 return_images: Ok(value.return_images),
7885 return_related_questions: Ok(value.return_related_questions),
7886 search_after_date_filter: Ok(value.search_after_date_filter),
7887 search_before_date_filter: Ok(value.search_before_date_filter),
7888 search_domain_filter: Ok(value.search_domain_filter),
7889 search_language_filter: Ok(value.search_language_filter),
7890 search_mode: Ok(value.search_mode),
7891 search_recency_filter: Ok(value.search_recency_filter),
7892 stop: Ok(value.stop),
7893 stream: Ok(value.stream),
7894 stream_mode: Ok(value.stream_mode),
7895 temperature: Ok(value.temperature),
7896 top_p: Ok(value.top_p),
7897 web_search_options: Ok(value.web_search_options),
7898 }
7899 }
7900 }
7901 #[derive(Clone, Debug)]
7902 pub struct Message {
7903 content: ::std::result::Result<
7904 ::std::option::Option<super::MessageContent>,
7905 ::std::string::String,
7906 >,
7907 role: ::std::result::Result<
7908 ::std::option::Option<::std::string::String>,
7909 ::std::string::String,
7910 >,
7911 }
7912 impl ::std::default::Default for Message {
7913 fn default() -> Self {
7914 Self {
7915 content: Ok(Default::default()),
7916 role: Ok(Default::default()),
7917 }
7918 }
7919 }
7920 impl Message {
7921 pub fn content<T>(mut self, value: T) -> Self
7922 where
7923 T: ::std::convert::TryInto<::std::option::Option<super::MessageContent>>,
7924 T::Error: ::std::fmt::Display,
7925 {
7926 self.content = value
7927 .try_into()
7928 .map_err(|e| {
7929 format!("error converting supplied value for content: {e}")
7930 });
7931 self
7932 }
7933 pub fn role<T>(mut self, value: T) -> Self
7934 where
7935 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
7936 T::Error: ::std::fmt::Display,
7937 {
7938 self.role = value
7939 .try_into()
7940 .map_err(|e| format!("error converting supplied value for role: {e}"));
7941 self
7942 }
7943 }
7944 impl ::std::convert::TryFrom<Message> for super::Message {
7945 type Error = super::error::ConversionError;
7946 fn try_from(
7947 value: Message,
7948 ) -> ::std::result::Result<Self, super::error::ConversionError> {
7949 Ok(Self {
7950 content: value.content?,
7951 role: value.role?,
7952 })
7953 }
7954 }
7955 impl ::std::convert::From<super::Message> for Message {
7956 fn from(value: super::Message) -> Self {
7957 Self {
7958 content: Ok(value.content),
7959 role: Ok(value.role),
7960 }
7961 }
7962 }
7963 #[derive(Clone, Debug)]
7964 pub struct ResponseFormat {
7965 json_schema: ::std::result::Result<
7966 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
7967 ::std::string::String,
7968 >,
7969 type_: ::std::result::Result<super::ResponseFormatType, ::std::string::String>,
7970 }
7971 impl ::std::default::Default for ResponseFormat {
7972 fn default() -> Self {
7973 Self {
7974 json_schema: Ok(Default::default()),
7975 type_: Err("no value supplied for type_".to_string()),
7976 }
7977 }
7978 }
7979 impl ResponseFormat {
7980 pub fn json_schema<T>(mut self, value: T) -> Self
7981 where
7982 T: ::std::convert::TryInto<
7983 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
7984 >,
7985 T::Error: ::std::fmt::Display,
7986 {
7987 self.json_schema = value
7988 .try_into()
7989 .map_err(|e| {
7990 format!("error converting supplied value for json_schema: {e}")
7991 });
7992 self
7993 }
7994 pub fn type_<T>(mut self, value: T) -> Self
7995 where
7996 T: ::std::convert::TryInto<super::ResponseFormatType>,
7997 T::Error: ::std::fmt::Display,
7998 {
7999 self.type_ = value
8000 .try_into()
8001 .map_err(|e| format!("error converting supplied value for type_: {e}"));
8002 self
8003 }
8004 }
8005 impl ::std::convert::TryFrom<ResponseFormat> for super::ResponseFormat {
8006 type Error = super::error::ConversionError;
8007 fn try_from(
8008 value: ResponseFormat,
8009 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8010 Ok(Self {
8011 json_schema: value.json_schema?,
8012 type_: value.type_?,
8013 })
8014 }
8015 }
8016 impl ::std::convert::From<super::ResponseFormat> for ResponseFormat {
8017 fn from(value: super::ResponseFormat) -> Self {
8018 Self {
8019 json_schema: Ok(value.json_schema),
8020 type_: Ok(value.type_),
8021 }
8022 }
8023 }
8024 #[derive(Clone, Debug)]
8025 pub struct WebSearchOptions {
8026 image_results_enhanced_relevance: ::std::result::Result<
8027 ::std::option::Option<bool>,
8028 ::std::string::String,
8029 >,
8030 search_context_size: ::std::result::Result<
8031 ::std::option::Option<super::WebSearchOptionsSearchContextSize>,
8032 ::std::string::String,
8033 >,
8034 search_type: ::std::result::Result<
8035 ::std::option::Option<super::WebSearchOptionsSearchType>,
8036 ::std::string::String,
8037 >,
8038 user_location: ::std::result::Result<
8039 ::std::option::Option<
8040 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8041 >,
8042 ::std::string::String,
8043 >,
8044 }
8045 impl ::std::default::Default for WebSearchOptions {
8046 fn default() -> Self {
8047 Self {
8048 image_results_enhanced_relevance: Ok(Default::default()),
8049 search_context_size: Ok(Default::default()),
8050 search_type: Ok(Default::default()),
8051 user_location: Ok(Default::default()),
8052 }
8053 }
8054 }
8055 impl WebSearchOptions {
8056 pub fn image_results_enhanced_relevance<T>(mut self, value: T) -> Self
8057 where
8058 T: ::std::convert::TryInto<::std::option::Option<bool>>,
8059 T::Error: ::std::fmt::Display,
8060 {
8061 self.image_results_enhanced_relevance = value
8062 .try_into()
8063 .map_err(|e| {
8064 format!(
8065 "error converting supplied value for image_results_enhanced_relevance: {e}"
8066 )
8067 });
8068 self
8069 }
8070 pub fn search_context_size<T>(mut self, value: T) -> Self
8071 where
8072 T: ::std::convert::TryInto<
8073 ::std::option::Option<super::WebSearchOptionsSearchContextSize>,
8074 >,
8075 T::Error: ::std::fmt::Display,
8076 {
8077 self.search_context_size = value
8078 .try_into()
8079 .map_err(|e| {
8080 format!(
8081 "error converting supplied value for search_context_size: {e}"
8082 )
8083 });
8084 self
8085 }
8086 pub fn search_type<T>(mut self, value: T) -> Self
8087 where
8088 T: ::std::convert::TryInto<
8089 ::std::option::Option<super::WebSearchOptionsSearchType>,
8090 >,
8091 T::Error: ::std::fmt::Display,
8092 {
8093 self.search_type = value
8094 .try_into()
8095 .map_err(|e| {
8096 format!("error converting supplied value for search_type: {e}")
8097 });
8098 self
8099 }
8100 pub fn user_location<T>(mut self, value: T) -> Self
8101 where
8102 T: ::std::convert::TryInto<
8103 ::std::option::Option<
8104 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8105 >,
8106 >,
8107 T::Error: ::std::fmt::Display,
8108 {
8109 self.user_location = value
8110 .try_into()
8111 .map_err(|e| {
8112 format!("error converting supplied value for user_location: {e}")
8113 });
8114 self
8115 }
8116 }
8117 impl ::std::convert::TryFrom<WebSearchOptions> for super::WebSearchOptions {
8118 type Error = super::error::ConversionError;
8119 fn try_from(
8120 value: WebSearchOptions,
8121 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8122 Ok(Self {
8123 image_results_enhanced_relevance: value
8124 .image_results_enhanced_relevance?,
8125 search_context_size: value.search_context_size?,
8126 search_type: value.search_type?,
8127 user_location: value.user_location?,
8128 })
8129 }
8130 }
8131 impl ::std::convert::From<super::WebSearchOptions> for WebSearchOptions {
8132 fn from(value: super::WebSearchOptions) -> Self {
8133 Self {
8134 image_results_enhanced_relevance: Ok(
8135 value.image_results_enhanced_relevance,
8136 ),
8137 search_context_size: Ok(value.search_context_size),
8138 search_type: Ok(value.search_type),
8139 user_location: Ok(value.user_location),
8140 }
8141 }
8142 }
8143}
8144pub mod error {
8146 pub struct ConversionError(::std::borrow::Cow<'static, str>);
8148 impl ::std::error::Error for ConversionError {}
8149 impl ::std::fmt::Display for ConversionError {
8150 fn fmt(
8151 &self,
8152 f: &mut ::std::fmt::Formatter<'_>,
8153 ) -> Result<(), ::std::fmt::Error> {
8154 ::std::fmt::Display::fmt(&self.0, f)
8155 }
8156 }
8157 impl ::std::fmt::Debug for ConversionError {
8158 fn fmt(
8159 &self,
8160 f: &mut ::std::fmt::Formatter<'_>,
8161 ) -> Result<(), ::std::fmt::Error> {
8162 ::std::fmt::Debug::fmt(&self.0, f)
8163 }
8164 }
8165 impl From<&'static str> for ConversionError {
8166 fn from(value: &'static str) -> Self {
8167 Self(value.into())
8168 }
8169 }
8170 impl From<String> for ConversionError {
8171 fn from(value: String) -> Self {
8172 Self(value.into())
8173 }
8174 }
8175}
8176
8177pub mod output {
8178#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8180pub struct Output {
8181 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
8183 pub choices: ::std::vec::Vec<OutputChoicesItem>,
8184 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8186 pub citations: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8187 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8189 pub created: ::std::option::Option<i64>,
8190 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
8192 pub detail: ::std::vec::Vec<OutputDetailItem>,
8193 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8195 pub id: ::std::option::Option<::std::string::String>,
8196 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8198 pub images: ::std::option::Option<::std::vec::Vec<OutputImagesItem>>,
8199 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8201 pub model: ::std::option::Option<::std::string::String>,
8202 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8204 pub object: ::std::option::Option<::std::string::String>,
8205 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8207 pub related_questions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8208 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8210 pub search_results: ::std::option::Option<::std::vec::Vec<OutputSearchResultsItem>>,
8211 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8213 pub usage: ::std::option::Option<OutputUsage>,
8214}
8215impl Output {
8216 pub fn builder() -> builder::Output {
8217 Default::default()
8218 }
8219}
8220#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8222pub struct OutputChoicesItem {
8223 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
8225 pub delta: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8226 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8228 pub finish_reason: ::std::option::Option<OutputChoicesItemFinishReason>,
8229 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8231 pub index: ::std::option::Option<i64>,
8232 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
8234 pub message: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8235}
8236impl OutputChoicesItem {
8237 pub fn builder() -> builder::OutputChoicesItem {
8238 Default::default()
8239 }
8240}
8241#[derive(
8243 ::serde::Deserialize,
8244 ::serde::Serialize,
8245 Clone,
8246 Copy,
8247 Debug,
8248 Eq,
8249 Hash,
8250 Ord,
8251 PartialEq,
8252 PartialOrd
8253)]
8254pub enum OutputChoicesItemFinishReason {
8255 #[serde(rename = "stop")]
8256 Stop,
8257 #[serde(rename = "length")]
8258 Length,
8259}
8260impl ::std::fmt::Display for OutputChoicesItemFinishReason {
8261 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8262 match *self {
8263 Self::Stop => f.write_str("stop"),
8264 Self::Length => f.write_str("length"),
8265 }
8266 }
8267}
8268impl ::std::str::FromStr for OutputChoicesItemFinishReason {
8269 type Err = self::error::ConversionError;
8270 fn from_str(
8271 value: &str,
8272 ) -> ::std::result::Result<Self, self::error::ConversionError> {
8273 match value {
8274 "stop" => Ok(Self::Stop),
8275 "length" => Ok(Self::Length),
8276 _ => Err("invalid value".into()),
8277 }
8278 }
8279}
8280impl ::std::convert::TryFrom<&str> for OutputChoicesItemFinishReason {
8281 type Error = self::error::ConversionError;
8282 fn try_from(
8283 value: &str,
8284 ) -> ::std::result::Result<Self, self::error::ConversionError> {
8285 value.parse()
8286 }
8287}
8288impl ::std::convert::TryFrom<::std::string::String> for OutputChoicesItemFinishReason {
8289 type Error = self::error::ConversionError;
8290 fn try_from(
8291 value: ::std::string::String,
8292 ) -> ::std::result::Result<Self, self::error::ConversionError> {
8293 value.parse()
8294 }
8295}
8296#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8298pub struct OutputDetailItem {
8299 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
8301 pub loc: ::std::vec::Vec<::std::string::String>,
8302 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8304 pub msg: ::std::option::Option<::std::string::String>,
8305 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
8307 pub type_: ::std::option::Option<::std::string::String>,
8308}
8309impl OutputDetailItem {
8310 pub fn builder() -> builder::OutputDetailItem {
8311 Default::default()
8312 }
8313}
8314#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8316pub struct OutputImagesItem {
8317 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8319 pub height: ::std::option::Option<i64>,
8320 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8322 pub image_url: ::std::option::Option<::std::string::String>,
8323 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8325 pub origin_url: ::std::option::Option<::std::string::String>,
8326 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8328 pub title: ::std::option::Option<::std::string::String>,
8329 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8331 pub width: ::std::option::Option<i64>,
8332}
8333impl OutputImagesItem {
8334 pub fn builder() -> builder::OutputImagesItem {
8335 Default::default()
8336 }
8337}
8338#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8340pub struct OutputSearchResultsItem {
8341 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8343 pub date: ::std::option::Option<::std::string::String>,
8344 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8346 pub last_updated: ::std::option::Option<::std::string::String>,
8347 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8349 pub snippet: ::std::option::Option<::std::string::String>,
8350 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8352 pub source: ::std::option::Option<OutputSearchResultsItemSource>,
8353 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8355 pub title: ::std::option::Option<::std::string::String>,
8356 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8358 pub url: ::std::option::Option<::std::string::String>,
8359}
8360impl OutputSearchResultsItem {
8361 pub fn builder() -> builder::OutputSearchResultsItem {
8362 Default::default()
8363 }
8364}
8365#[derive(
8367 ::serde::Deserialize,
8368 ::serde::Serialize,
8369 Clone,
8370 Copy,
8371 Debug,
8372 Eq,
8373 Hash,
8374 Ord,
8375 PartialEq,
8376 PartialOrd
8377)]
8378pub enum OutputSearchResultsItemSource {
8379 #[serde(rename = "web")]
8380 Web,
8381 #[serde(rename = "attachment")]
8382 Attachment,
8383}
8384impl ::std::fmt::Display for OutputSearchResultsItemSource {
8385 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
8386 match *self {
8387 Self::Web => f.write_str("web"),
8388 Self::Attachment => f.write_str("attachment"),
8389 }
8390 }
8391}
8392impl ::std::str::FromStr for OutputSearchResultsItemSource {
8393 type Err = self::error::ConversionError;
8394 fn from_str(
8395 value: &str,
8396 ) -> ::std::result::Result<Self, self::error::ConversionError> {
8397 match value {
8398 "web" => Ok(Self::Web),
8399 "attachment" => Ok(Self::Attachment),
8400 _ => Err("invalid value".into()),
8401 }
8402 }
8403}
8404impl ::std::convert::TryFrom<&str> for OutputSearchResultsItemSource {
8405 type Error = self::error::ConversionError;
8406 fn try_from(
8407 value: &str,
8408 ) -> ::std::result::Result<Self, self::error::ConversionError> {
8409 value.parse()
8410 }
8411}
8412impl ::std::convert::TryFrom<::std::string::String> for OutputSearchResultsItemSource {
8413 type Error = self::error::ConversionError;
8414 fn try_from(
8415 value: ::std::string::String,
8416 ) -> ::std::result::Result<Self, self::error::ConversionError> {
8417 value.parse()
8418 }
8419}
8420#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
8422pub struct OutputUsage {
8423 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8425 pub citation_tokens: ::std::option::Option<i64>,
8426 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8428 pub completion_tokens: ::std::option::Option<i64>,
8429 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
8431 pub cost: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8432 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8434 pub num_search_queries: ::std::option::Option<i64>,
8435 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8437 pub prompt_tokens: ::std::option::Option<i64>,
8438 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8440 pub reasoning_tokens: ::std::option::Option<i64>,
8441 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8443 pub search_context_size: ::std::option::Option<::std::string::String>,
8444 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
8446 pub total_tokens: ::std::option::Option<i64>,
8447}
8448impl OutputUsage {
8449 pub fn builder() -> builder::OutputUsage {
8450 Default::default()
8451 }
8452}
8453pub mod builder {
8455 #[derive(Clone, Debug)]
8456 pub struct Output {
8457 choices: ::std::result::Result<
8458 ::std::vec::Vec<super::OutputChoicesItem>,
8459 ::std::string::String,
8460 >,
8461 citations: ::std::result::Result<
8462 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8463 ::std::string::String,
8464 >,
8465 created: ::std::result::Result<
8466 ::std::option::Option<i64>,
8467 ::std::string::String,
8468 >,
8469 detail: ::std::result::Result<
8470 ::std::vec::Vec<super::OutputDetailItem>,
8471 ::std::string::String,
8472 >,
8473 id: ::std::result::Result<
8474 ::std::option::Option<::std::string::String>,
8475 ::std::string::String,
8476 >,
8477 images: ::std::result::Result<
8478 ::std::option::Option<::std::vec::Vec<super::OutputImagesItem>>,
8479 ::std::string::String,
8480 >,
8481 model: ::std::result::Result<
8482 ::std::option::Option<::std::string::String>,
8483 ::std::string::String,
8484 >,
8485 object: ::std::result::Result<
8486 ::std::option::Option<::std::string::String>,
8487 ::std::string::String,
8488 >,
8489 related_questions: ::std::result::Result<
8490 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8491 ::std::string::String,
8492 >,
8493 search_results: ::std::result::Result<
8494 ::std::option::Option<::std::vec::Vec<super::OutputSearchResultsItem>>,
8495 ::std::string::String,
8496 >,
8497 usage: ::std::result::Result<
8498 ::std::option::Option<super::OutputUsage>,
8499 ::std::string::String,
8500 >,
8501 }
8502 impl ::std::default::Default for Output {
8503 fn default() -> Self {
8504 Self {
8505 choices: Ok(Default::default()),
8506 citations: Ok(Default::default()),
8507 created: Ok(Default::default()),
8508 detail: Ok(Default::default()),
8509 id: Ok(Default::default()),
8510 images: Ok(Default::default()),
8511 model: Ok(Default::default()),
8512 object: Ok(Default::default()),
8513 related_questions: Ok(Default::default()),
8514 search_results: Ok(Default::default()),
8515 usage: Ok(Default::default()),
8516 }
8517 }
8518 }
8519 impl Output {
8520 pub fn choices<T>(mut self, value: T) -> Self
8521 where
8522 T: ::std::convert::TryInto<::std::vec::Vec<super::OutputChoicesItem>>,
8523 T::Error: ::std::fmt::Display,
8524 {
8525 self.choices = value
8526 .try_into()
8527 .map_err(|e| {
8528 format!("error converting supplied value for choices: {e}")
8529 });
8530 self
8531 }
8532 pub fn citations<T>(mut self, value: T) -> Self
8533 where
8534 T: ::std::convert::TryInto<
8535 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8536 >,
8537 T::Error: ::std::fmt::Display,
8538 {
8539 self.citations = value
8540 .try_into()
8541 .map_err(|e| {
8542 format!("error converting supplied value for citations: {e}")
8543 });
8544 self
8545 }
8546 pub fn created<T>(mut self, value: T) -> Self
8547 where
8548 T: ::std::convert::TryInto<::std::option::Option<i64>>,
8549 T::Error: ::std::fmt::Display,
8550 {
8551 self.created = value
8552 .try_into()
8553 .map_err(|e| {
8554 format!("error converting supplied value for created: {e}")
8555 });
8556 self
8557 }
8558 pub fn detail<T>(mut self, value: T) -> Self
8559 where
8560 T: ::std::convert::TryInto<::std::vec::Vec<super::OutputDetailItem>>,
8561 T::Error: ::std::fmt::Display,
8562 {
8563 self.detail = value
8564 .try_into()
8565 .map_err(|e| format!("error converting supplied value for detail: {e}"));
8566 self
8567 }
8568 pub fn id<T>(mut self, value: T) -> Self
8569 where
8570 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8571 T::Error: ::std::fmt::Display,
8572 {
8573 self.id = value
8574 .try_into()
8575 .map_err(|e| format!("error converting supplied value for id: {e}"));
8576 self
8577 }
8578 pub fn images<T>(mut self, value: T) -> Self
8579 where
8580 T: ::std::convert::TryInto<
8581 ::std::option::Option<::std::vec::Vec<super::OutputImagesItem>>,
8582 >,
8583 T::Error: ::std::fmt::Display,
8584 {
8585 self.images = value
8586 .try_into()
8587 .map_err(|e| format!("error converting supplied value for images: {e}"));
8588 self
8589 }
8590 pub fn model<T>(mut self, value: T) -> Self
8591 where
8592 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8593 T::Error: ::std::fmt::Display,
8594 {
8595 self.model = value
8596 .try_into()
8597 .map_err(|e| format!("error converting supplied value for model: {e}"));
8598 self
8599 }
8600 pub fn object<T>(mut self, value: T) -> Self
8601 where
8602 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8603 T::Error: ::std::fmt::Display,
8604 {
8605 self.object = value
8606 .try_into()
8607 .map_err(|e| format!("error converting supplied value for object: {e}"));
8608 self
8609 }
8610 pub fn related_questions<T>(mut self, value: T) -> Self
8611 where
8612 T: ::std::convert::TryInto<
8613 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8614 >,
8615 T::Error: ::std::fmt::Display,
8616 {
8617 self.related_questions = value
8618 .try_into()
8619 .map_err(|e| {
8620 format!("error converting supplied value for related_questions: {e}")
8621 });
8622 self
8623 }
8624 pub fn search_results<T>(mut self, value: T) -> Self
8625 where
8626 T: ::std::convert::TryInto<
8627 ::std::option::Option<::std::vec::Vec<super::OutputSearchResultsItem>>,
8628 >,
8629 T::Error: ::std::fmt::Display,
8630 {
8631 self.search_results = value
8632 .try_into()
8633 .map_err(|e| {
8634 format!("error converting supplied value for search_results: {e}")
8635 });
8636 self
8637 }
8638 pub fn usage<T>(mut self, value: T) -> Self
8639 where
8640 T: ::std::convert::TryInto<::std::option::Option<super::OutputUsage>>,
8641 T::Error: ::std::fmt::Display,
8642 {
8643 self.usage = value
8644 .try_into()
8645 .map_err(|e| format!("error converting supplied value for usage: {e}"));
8646 self
8647 }
8648 }
8649 impl ::std::convert::TryFrom<Output> for super::Output {
8650 type Error = super::error::ConversionError;
8651 fn try_from(
8652 value: Output,
8653 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8654 Ok(Self {
8655 choices: value.choices?,
8656 citations: value.citations?,
8657 created: value.created?,
8658 detail: value.detail?,
8659 id: value.id?,
8660 images: value.images?,
8661 model: value.model?,
8662 object: value.object?,
8663 related_questions: value.related_questions?,
8664 search_results: value.search_results?,
8665 usage: value.usage?,
8666 })
8667 }
8668 }
8669 impl ::std::convert::From<super::Output> for Output {
8670 fn from(value: super::Output) -> Self {
8671 Self {
8672 choices: Ok(value.choices),
8673 citations: Ok(value.citations),
8674 created: Ok(value.created),
8675 detail: Ok(value.detail),
8676 id: Ok(value.id),
8677 images: Ok(value.images),
8678 model: Ok(value.model),
8679 object: Ok(value.object),
8680 related_questions: Ok(value.related_questions),
8681 search_results: Ok(value.search_results),
8682 usage: Ok(value.usage),
8683 }
8684 }
8685 }
8686 #[derive(Clone, Debug)]
8687 pub struct OutputChoicesItem {
8688 delta: ::std::result::Result<
8689 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8690 ::std::string::String,
8691 >,
8692 finish_reason: ::std::result::Result<
8693 ::std::option::Option<super::OutputChoicesItemFinishReason>,
8694 ::std::string::String,
8695 >,
8696 index: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
8697 message: ::std::result::Result<
8698 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8699 ::std::string::String,
8700 >,
8701 }
8702 impl ::std::default::Default for OutputChoicesItem {
8703 fn default() -> Self {
8704 Self {
8705 delta: Ok(Default::default()),
8706 finish_reason: Ok(Default::default()),
8707 index: Ok(Default::default()),
8708 message: Ok(Default::default()),
8709 }
8710 }
8711 }
8712 impl OutputChoicesItem {
8713 pub fn delta<T>(mut self, value: T) -> Self
8714 where
8715 T: ::std::convert::TryInto<
8716 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8717 >,
8718 T::Error: ::std::fmt::Display,
8719 {
8720 self.delta = value
8721 .try_into()
8722 .map_err(|e| format!("error converting supplied value for delta: {e}"));
8723 self
8724 }
8725 pub fn finish_reason<T>(mut self, value: T) -> Self
8726 where
8727 T: ::std::convert::TryInto<
8728 ::std::option::Option<super::OutputChoicesItemFinishReason>,
8729 >,
8730 T::Error: ::std::fmt::Display,
8731 {
8732 self.finish_reason = value
8733 .try_into()
8734 .map_err(|e| {
8735 format!("error converting supplied value for finish_reason: {e}")
8736 });
8737 self
8738 }
8739 pub fn index<T>(mut self, value: T) -> Self
8740 where
8741 T: ::std::convert::TryInto<::std::option::Option<i64>>,
8742 T::Error: ::std::fmt::Display,
8743 {
8744 self.index = value
8745 .try_into()
8746 .map_err(|e| format!("error converting supplied value for index: {e}"));
8747 self
8748 }
8749 pub fn message<T>(mut self, value: T) -> Self
8750 where
8751 T: ::std::convert::TryInto<
8752 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
8753 >,
8754 T::Error: ::std::fmt::Display,
8755 {
8756 self.message = value
8757 .try_into()
8758 .map_err(|e| {
8759 format!("error converting supplied value for message: {e}")
8760 });
8761 self
8762 }
8763 }
8764 impl ::std::convert::TryFrom<OutputChoicesItem> for super::OutputChoicesItem {
8765 type Error = super::error::ConversionError;
8766 fn try_from(
8767 value: OutputChoicesItem,
8768 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8769 Ok(Self {
8770 delta: value.delta?,
8771 finish_reason: value.finish_reason?,
8772 index: value.index?,
8773 message: value.message?,
8774 })
8775 }
8776 }
8777 impl ::std::convert::From<super::OutputChoicesItem> for OutputChoicesItem {
8778 fn from(value: super::OutputChoicesItem) -> Self {
8779 Self {
8780 delta: Ok(value.delta),
8781 finish_reason: Ok(value.finish_reason),
8782 index: Ok(value.index),
8783 message: Ok(value.message),
8784 }
8785 }
8786 }
8787 #[derive(Clone, Debug)]
8788 pub struct OutputDetailItem {
8789 loc: ::std::result::Result<
8790 ::std::vec::Vec<::std::string::String>,
8791 ::std::string::String,
8792 >,
8793 msg: ::std::result::Result<
8794 ::std::option::Option<::std::string::String>,
8795 ::std::string::String,
8796 >,
8797 type_: ::std::result::Result<
8798 ::std::option::Option<::std::string::String>,
8799 ::std::string::String,
8800 >,
8801 }
8802 impl ::std::default::Default for OutputDetailItem {
8803 fn default() -> Self {
8804 Self {
8805 loc: Ok(Default::default()),
8806 msg: Ok(Default::default()),
8807 type_: Ok(Default::default()),
8808 }
8809 }
8810 }
8811 impl OutputDetailItem {
8812 pub fn loc<T>(mut self, value: T) -> Self
8813 where
8814 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
8815 T::Error: ::std::fmt::Display,
8816 {
8817 self.loc = value
8818 .try_into()
8819 .map_err(|e| format!("error converting supplied value for loc: {e}"));
8820 self
8821 }
8822 pub fn msg<T>(mut self, value: T) -> Self
8823 where
8824 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8825 T::Error: ::std::fmt::Display,
8826 {
8827 self.msg = value
8828 .try_into()
8829 .map_err(|e| format!("error converting supplied value for msg: {e}"));
8830 self
8831 }
8832 pub fn type_<T>(mut self, value: T) -> Self
8833 where
8834 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8835 T::Error: ::std::fmt::Display,
8836 {
8837 self.type_ = value
8838 .try_into()
8839 .map_err(|e| format!("error converting supplied value for type_: {e}"));
8840 self
8841 }
8842 }
8843 impl ::std::convert::TryFrom<OutputDetailItem> for super::OutputDetailItem {
8844 type Error = super::error::ConversionError;
8845 fn try_from(
8846 value: OutputDetailItem,
8847 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8848 Ok(Self {
8849 loc: value.loc?,
8850 msg: value.msg?,
8851 type_: value.type_?,
8852 })
8853 }
8854 }
8855 impl ::std::convert::From<super::OutputDetailItem> for OutputDetailItem {
8856 fn from(value: super::OutputDetailItem) -> Self {
8857 Self {
8858 loc: Ok(value.loc),
8859 msg: Ok(value.msg),
8860 type_: Ok(value.type_),
8861 }
8862 }
8863 }
8864 #[derive(Clone, Debug)]
8865 pub struct OutputImagesItem {
8866 height: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
8867 image_url: ::std::result::Result<
8868 ::std::option::Option<::std::string::String>,
8869 ::std::string::String,
8870 >,
8871 origin_url: ::std::result::Result<
8872 ::std::option::Option<::std::string::String>,
8873 ::std::string::String,
8874 >,
8875 title: ::std::result::Result<
8876 ::std::option::Option<::std::string::String>,
8877 ::std::string::String,
8878 >,
8879 width: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
8880 }
8881 impl ::std::default::Default for OutputImagesItem {
8882 fn default() -> Self {
8883 Self {
8884 height: Ok(Default::default()),
8885 image_url: Ok(Default::default()),
8886 origin_url: Ok(Default::default()),
8887 title: Ok(Default::default()),
8888 width: Ok(Default::default()),
8889 }
8890 }
8891 }
8892 impl OutputImagesItem {
8893 pub fn height<T>(mut self, value: T) -> Self
8894 where
8895 T: ::std::convert::TryInto<::std::option::Option<i64>>,
8896 T::Error: ::std::fmt::Display,
8897 {
8898 self.height = value
8899 .try_into()
8900 .map_err(|e| format!("error converting supplied value for height: {e}"));
8901 self
8902 }
8903 pub fn image_url<T>(mut self, value: T) -> Self
8904 where
8905 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8906 T::Error: ::std::fmt::Display,
8907 {
8908 self.image_url = value
8909 .try_into()
8910 .map_err(|e| {
8911 format!("error converting supplied value for image_url: {e}")
8912 });
8913 self
8914 }
8915 pub fn origin_url<T>(mut self, value: T) -> Self
8916 where
8917 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8918 T::Error: ::std::fmt::Display,
8919 {
8920 self.origin_url = value
8921 .try_into()
8922 .map_err(|e| {
8923 format!("error converting supplied value for origin_url: {e}")
8924 });
8925 self
8926 }
8927 pub fn title<T>(mut self, value: T) -> Self
8928 where
8929 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
8930 T::Error: ::std::fmt::Display,
8931 {
8932 self.title = value
8933 .try_into()
8934 .map_err(|e| format!("error converting supplied value for title: {e}"));
8935 self
8936 }
8937 pub fn width<T>(mut self, value: T) -> Self
8938 where
8939 T: ::std::convert::TryInto<::std::option::Option<i64>>,
8940 T::Error: ::std::fmt::Display,
8941 {
8942 self.width = value
8943 .try_into()
8944 .map_err(|e| format!("error converting supplied value for width: {e}"));
8945 self
8946 }
8947 }
8948 impl ::std::convert::TryFrom<OutputImagesItem> for super::OutputImagesItem {
8949 type Error = super::error::ConversionError;
8950 fn try_from(
8951 value: OutputImagesItem,
8952 ) -> ::std::result::Result<Self, super::error::ConversionError> {
8953 Ok(Self {
8954 height: value.height?,
8955 image_url: value.image_url?,
8956 origin_url: value.origin_url?,
8957 title: value.title?,
8958 width: value.width?,
8959 })
8960 }
8961 }
8962 impl ::std::convert::From<super::OutputImagesItem> for OutputImagesItem {
8963 fn from(value: super::OutputImagesItem) -> Self {
8964 Self {
8965 height: Ok(value.height),
8966 image_url: Ok(value.image_url),
8967 origin_url: Ok(value.origin_url),
8968 title: Ok(value.title),
8969 width: Ok(value.width),
8970 }
8971 }
8972 }
8973 #[derive(Clone, Debug)]
8974 pub struct OutputSearchResultsItem {
8975 date: ::std::result::Result<
8976 ::std::option::Option<::std::string::String>,
8977 ::std::string::String,
8978 >,
8979 last_updated: ::std::result::Result<
8980 ::std::option::Option<::std::string::String>,
8981 ::std::string::String,
8982 >,
8983 snippet: ::std::result::Result<
8984 ::std::option::Option<::std::string::String>,
8985 ::std::string::String,
8986 >,
8987 source: ::std::result::Result<
8988 ::std::option::Option<super::OutputSearchResultsItemSource>,
8989 ::std::string::String,
8990 >,
8991 title: ::std::result::Result<
8992 ::std::option::Option<::std::string::String>,
8993 ::std::string::String,
8994 >,
8995 url: ::std::result::Result<
8996 ::std::option::Option<::std::string::String>,
8997 ::std::string::String,
8998 >,
8999 }
9000 impl ::std::default::Default for OutputSearchResultsItem {
9001 fn default() -> Self {
9002 Self {
9003 date: Ok(Default::default()),
9004 last_updated: Ok(Default::default()),
9005 snippet: Ok(Default::default()),
9006 source: Ok(Default::default()),
9007 title: Ok(Default::default()),
9008 url: Ok(Default::default()),
9009 }
9010 }
9011 }
9012 impl OutputSearchResultsItem {
9013 pub fn date<T>(mut self, value: T) -> Self
9014 where
9015 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
9016 T::Error: ::std::fmt::Display,
9017 {
9018 self.date = value
9019 .try_into()
9020 .map_err(|e| format!("error converting supplied value for date: {e}"));
9021 self
9022 }
9023 pub fn last_updated<T>(mut self, value: T) -> Self
9024 where
9025 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
9026 T::Error: ::std::fmt::Display,
9027 {
9028 self.last_updated = value
9029 .try_into()
9030 .map_err(|e| {
9031 format!("error converting supplied value for last_updated: {e}")
9032 });
9033 self
9034 }
9035 pub fn snippet<T>(mut self, value: T) -> Self
9036 where
9037 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
9038 T::Error: ::std::fmt::Display,
9039 {
9040 self.snippet = value
9041 .try_into()
9042 .map_err(|e| {
9043 format!("error converting supplied value for snippet: {e}")
9044 });
9045 self
9046 }
9047 pub fn source<T>(mut self, value: T) -> Self
9048 where
9049 T: ::std::convert::TryInto<
9050 ::std::option::Option<super::OutputSearchResultsItemSource>,
9051 >,
9052 T::Error: ::std::fmt::Display,
9053 {
9054 self.source = value
9055 .try_into()
9056 .map_err(|e| format!("error converting supplied value for source: {e}"));
9057 self
9058 }
9059 pub fn title<T>(mut self, value: T) -> Self
9060 where
9061 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
9062 T::Error: ::std::fmt::Display,
9063 {
9064 self.title = value
9065 .try_into()
9066 .map_err(|e| format!("error converting supplied value for title: {e}"));
9067 self
9068 }
9069 pub fn url<T>(mut self, value: T) -> Self
9070 where
9071 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
9072 T::Error: ::std::fmt::Display,
9073 {
9074 self.url = value
9075 .try_into()
9076 .map_err(|e| format!("error converting supplied value for url: {e}"));
9077 self
9078 }
9079 }
9080 impl ::std::convert::TryFrom<OutputSearchResultsItem>
9081 for super::OutputSearchResultsItem {
9082 type Error = super::error::ConversionError;
9083 fn try_from(
9084 value: OutputSearchResultsItem,
9085 ) -> ::std::result::Result<Self, super::error::ConversionError> {
9086 Ok(Self {
9087 date: value.date?,
9088 last_updated: value.last_updated?,
9089 snippet: value.snippet?,
9090 source: value.source?,
9091 title: value.title?,
9092 url: value.url?,
9093 })
9094 }
9095 }
9096 impl ::std::convert::From<super::OutputSearchResultsItem>
9097 for OutputSearchResultsItem {
9098 fn from(value: super::OutputSearchResultsItem) -> Self {
9099 Self {
9100 date: Ok(value.date),
9101 last_updated: Ok(value.last_updated),
9102 snippet: Ok(value.snippet),
9103 source: Ok(value.source),
9104 title: Ok(value.title),
9105 url: Ok(value.url),
9106 }
9107 }
9108 }
9109 #[derive(Clone, Debug)]
9110 pub struct OutputUsage {
9111 citation_tokens: ::std::result::Result<
9112 ::std::option::Option<i64>,
9113 ::std::string::String,
9114 >,
9115 completion_tokens: ::std::result::Result<
9116 ::std::option::Option<i64>,
9117 ::std::string::String,
9118 >,
9119 cost: ::std::result::Result<
9120 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
9121 ::std::string::String,
9122 >,
9123 num_search_queries: ::std::result::Result<
9124 ::std::option::Option<i64>,
9125 ::std::string::String,
9126 >,
9127 prompt_tokens: ::std::result::Result<
9128 ::std::option::Option<i64>,
9129 ::std::string::String,
9130 >,
9131 reasoning_tokens: ::std::result::Result<
9132 ::std::option::Option<i64>,
9133 ::std::string::String,
9134 >,
9135 search_context_size: ::std::result::Result<
9136 ::std::option::Option<::std::string::String>,
9137 ::std::string::String,
9138 >,
9139 total_tokens: ::std::result::Result<
9140 ::std::option::Option<i64>,
9141 ::std::string::String,
9142 >,
9143 }
9144 impl ::std::default::Default for OutputUsage {
9145 fn default() -> Self {
9146 Self {
9147 citation_tokens: Ok(Default::default()),
9148 completion_tokens: Ok(Default::default()),
9149 cost: Ok(Default::default()),
9150 num_search_queries: Ok(Default::default()),
9151 prompt_tokens: Ok(Default::default()),
9152 reasoning_tokens: Ok(Default::default()),
9153 search_context_size: Ok(Default::default()),
9154 total_tokens: Ok(Default::default()),
9155 }
9156 }
9157 }
9158 impl OutputUsage {
9159 pub fn citation_tokens<T>(mut self, value: T) -> Self
9160 where
9161 T: ::std::convert::TryInto<::std::option::Option<i64>>,
9162 T::Error: ::std::fmt::Display,
9163 {
9164 self.citation_tokens = value
9165 .try_into()
9166 .map_err(|e| {
9167 format!("error converting supplied value for citation_tokens: {e}")
9168 });
9169 self
9170 }
9171 pub fn completion_tokens<T>(mut self, value: T) -> Self
9172 where
9173 T: ::std::convert::TryInto<::std::option::Option<i64>>,
9174 T::Error: ::std::fmt::Display,
9175 {
9176 self.completion_tokens = value
9177 .try_into()
9178 .map_err(|e| {
9179 format!("error converting supplied value for completion_tokens: {e}")
9180 });
9181 self
9182 }
9183 pub fn cost<T>(mut self, value: T) -> Self
9184 where
9185 T: ::std::convert::TryInto<
9186 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
9187 >,
9188 T::Error: ::std::fmt::Display,
9189 {
9190 self.cost = value
9191 .try_into()
9192 .map_err(|e| format!("error converting supplied value for cost: {e}"));
9193 self
9194 }
9195 pub fn num_search_queries<T>(mut self, value: T) -> Self
9196 where
9197 T: ::std::convert::TryInto<::std::option::Option<i64>>,
9198 T::Error: ::std::fmt::Display,
9199 {
9200 self.num_search_queries = value
9201 .try_into()
9202 .map_err(|e| {
9203 format!(
9204 "error converting supplied value for num_search_queries: {e}"
9205 )
9206 });
9207 self
9208 }
9209 pub fn prompt_tokens<T>(mut self, value: T) -> Self
9210 where
9211 T: ::std::convert::TryInto<::std::option::Option<i64>>,
9212 T::Error: ::std::fmt::Display,
9213 {
9214 self.prompt_tokens = value
9215 .try_into()
9216 .map_err(|e| {
9217 format!("error converting supplied value for prompt_tokens: {e}")
9218 });
9219 self
9220 }
9221 pub fn reasoning_tokens<T>(mut self, value: T) -> Self
9222 where
9223 T: ::std::convert::TryInto<::std::option::Option<i64>>,
9224 T::Error: ::std::fmt::Display,
9225 {
9226 self.reasoning_tokens = value
9227 .try_into()
9228 .map_err(|e| {
9229 format!("error converting supplied value for reasoning_tokens: {e}")
9230 });
9231 self
9232 }
9233 pub fn search_context_size<T>(mut self, value: T) -> Self
9234 where
9235 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
9236 T::Error: ::std::fmt::Display,
9237 {
9238 self.search_context_size = value
9239 .try_into()
9240 .map_err(|e| {
9241 format!(
9242 "error converting supplied value for search_context_size: {e}"
9243 )
9244 });
9245 self
9246 }
9247 pub fn total_tokens<T>(mut self, value: T) -> Self
9248 where
9249 T: ::std::convert::TryInto<::std::option::Option<i64>>,
9250 T::Error: ::std::fmt::Display,
9251 {
9252 self.total_tokens = value
9253 .try_into()
9254 .map_err(|e| {
9255 format!("error converting supplied value for total_tokens: {e}")
9256 });
9257 self
9258 }
9259 }
9260 impl ::std::convert::TryFrom<OutputUsage> for super::OutputUsage {
9261 type Error = super::error::ConversionError;
9262 fn try_from(
9263 value: OutputUsage,
9264 ) -> ::std::result::Result<Self, super::error::ConversionError> {
9265 Ok(Self {
9266 citation_tokens: value.citation_tokens?,
9267 completion_tokens: value.completion_tokens?,
9268 cost: value.cost?,
9269 num_search_queries: value.num_search_queries?,
9270 prompt_tokens: value.prompt_tokens?,
9271 reasoning_tokens: value.reasoning_tokens?,
9272 search_context_size: value.search_context_size?,
9273 total_tokens: value.total_tokens?,
9274 })
9275 }
9276 }
9277 impl ::std::convert::From<super::OutputUsage> for OutputUsage {
9278 fn from(value: super::OutputUsage) -> Self {
9279 Self {
9280 citation_tokens: Ok(value.citation_tokens),
9281 completion_tokens: Ok(value.completion_tokens),
9282 cost: Ok(value.cost),
9283 num_search_queries: Ok(value.num_search_queries),
9284 prompt_tokens: Ok(value.prompt_tokens),
9285 reasoning_tokens: Ok(value.reasoning_tokens),
9286 search_context_size: Ok(value.search_context_size),
9287 total_tokens: Ok(value.total_tokens),
9288 }
9289 }
9290 }
9291}
9292pub mod error {
9294 pub struct ConversionError(::std::borrow::Cow<'static, str>);
9296 impl ::std::error::Error for ConversionError {}
9297 impl ::std::fmt::Display for ConversionError {
9298 fn fmt(
9299 &self,
9300 f: &mut ::std::fmt::Formatter<'_>,
9301 ) -> Result<(), ::std::fmt::Error> {
9302 ::std::fmt::Display::fmt(&self.0, f)
9303 }
9304 }
9305 impl ::std::fmt::Debug for ConversionError {
9306 fn fmt(
9307 &self,
9308 f: &mut ::std::fmt::Formatter<'_>,
9309 ) -> Result<(), ::std::fmt::Error> {
9310 ::std::fmt::Debug::fmt(&self.0, f)
9311 }
9312 }
9313 impl From<&'static str> for ConversionError {
9314 fn from(value: &'static str) -> Self {
9315 Self(value.into())
9316 }
9317 }
9318 impl From<String> for ConversionError {
9319 fn from(value: String) -> Self {
9320 Self(value.into())
9321 }
9322 }
9323}
9324
9325}
9326
9327 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "disable_search", part: ::one::Part::Body, key: Some("disable_search") }, ::one::Route { field: "enable_search_classifier", part: ::one::Part::Body, key: Some("enable_search_classifier") }, ::one::Route { field: "image_domain_filter", part: ::one::Part::Body, key: Some("image_domain_filter") }, ::one::Route { field: "image_format_filter", part: ::one::Part::Body, key: Some("image_format_filter") }, ::one::Route { field: "language_preference", part: ::one::Part::Body, key: Some("language_preference") }, ::one::Route { field: "last_updated_after_filter", part: ::one::Part::Body, key: Some("last_updated_after_filter") }, ::one::Route { field: "last_updated_before_filter", part: ::one::Part::Body, key: Some("last_updated_before_filter") }, ::one::Route { field: "max_tokens", part: ::one::Part::Body, key: Some("max_tokens") }, ::one::Route { field: "messages", part: ::one::Part::Body, key: Some("messages") }, ::one::Route { field: "model", part: ::one::Part::Body, key: Some("model") }, ::one::Route { field: "reasoning_effort", part: ::one::Part::Body, key: Some("reasoning_effort") }, ::one::Route { field: "response_format", part: ::one::Part::Body, key: Some("response_format") }, ::one::Route { field: "return_images", part: ::one::Part::Body, key: Some("return_images") }, ::one::Route { field: "return_related_questions", part: ::one::Part::Body, key: Some("return_related_questions") }, ::one::Route { field: "search_after_date_filter", part: ::one::Part::Body, key: Some("search_after_date_filter") }, ::one::Route { field: "search_before_date_filter", part: ::one::Part::Body, key: Some("search_before_date_filter") }, ::one::Route { field: "search_domain_filter", part: ::one::Part::Body, key: Some("search_domain_filter") }, ::one::Route { field: "search_language_filter", part: ::one::Part::Body, key: Some("search_language_filter") }, ::one::Route { field: "search_mode", part: ::one::Part::Body, key: Some("search_mode") }, ::one::Route { field: "search_recency_filter", part: ::one::Part::Body, key: Some("search_recency_filter") }, ::one::Route { field: "stop", part: ::one::Part::Body, key: Some("stop") }, ::one::Route { field: "stream", part: ::one::Part::Body, key: Some("stream") }, ::one::Route { field: "stream_mode", part: ::one::Part::Body, key: Some("stream_mode") }, ::one::Route { field: "temperature", part: ::one::Part::Body, key: Some("temperature") }, ::one::Route { field: "top_p", part: ::one::Part::Body, key: Some("top_p") }, ::one::Route { field: "web_search_options", part: ::one::Part::Body, key: Some("web_search_options") }], required_parts: &[::one::Part::Body] };
9329
9330 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
9402 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZeTvPJc::zmkwnSM8S6egtsvqG96MKQ", Method::POST, "/v1/sonar").with_routed(&input, &ROUTING)?
9403 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
9404 }
9405
9406 impl IntoOperation for Input {
9407 type Output = output::Output;
9408
9409 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
9410 build(self)
9411 }
9412 }
9413 impl IntoOperation for builder::Input {
9414 type Output = output::Output;
9415
9416 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
9417 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
9418 }
9419 }
9420 impl ::std::convert::TryFrom<builder::Message> for ::std::option::Option<Message> {
9421 type Error = <Message as ::std::convert::TryFrom<builder::Message>>::Error;
9422
9423 fn try_from(value: builder::Message) -> ::std::result::Result<Self, Self::Error> {
9424 Message::try_from(value).map(Some)
9425 }
9426 }
9427 impl ::std::convert::TryFrom<builder::ResponseFormat> for ::std::option::Option<ResponseFormat> {
9428 type Error = <ResponseFormat as ::std::convert::TryFrom<builder::ResponseFormat>>::Error;
9429
9430 fn try_from(value: builder::ResponseFormat) -> ::std::result::Result<Self, Self::Error> {
9431 ResponseFormat::try_from(value).map(Some)
9432 }
9433 }
9434 impl ::std::convert::TryFrom<builder::WebSearchOptions> for ::std::option::Option<WebSearchOptions> {
9435 type Error = <WebSearchOptions as ::std::convert::TryFrom<builder::WebSearchOptions>>::Error;
9436
9437 fn try_from(value: builder::WebSearchOptions) -> ::std::result::Result<Self, Self::Error> {
9438 WebSearchOptions::try_from(value).map(Some)
9439 }
9440 }
9441}
9442pub fn create_chat_completion() -> create_chat_completion::builder::Input {
9444 create_chat_completion::builder::Input::default()
9445}
9446pub mod create_async_chat_completion_sonar {
9447 use ::one::{Error, IntoOperation, Method, Operation};
9448#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9450#[serde(deny_unknown_fields)]
9451pub struct Input {
9452 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9454 pub idempotency_key: ::std::option::Option<::std::string::String>,
9455 pub request: RequestPayload,
9456}
9457impl Input {
9458 pub fn builder() -> builder::Input {
9459 Default::default()
9460 }
9461}
9462#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9464#[serde(deny_unknown_fields)]
9465pub struct Message {
9466 pub content: MessageContent,
9468 pub role: ::std::string::String,
9470}
9471impl Message {
9472 pub fn builder() -> builder::Message {
9473 Default::default()
9474 }
9475}
9476#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9478#[serde(untagged)]
9479pub enum MessageContent {
9480 String(::std::string::String),
9481 Array(
9482 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
9483 ),
9484 Null,
9485}
9486impl ::std::convert::From<
9487 ::std::vec::Vec<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
9488> for MessageContent {
9489 fn from(
9490 value: ::std::vec::Vec<
9491 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
9492 >,
9493 ) -> Self {
9494 Self::Array(value)
9495 }
9496}
9497#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9499#[serde(deny_unknown_fields)]
9500pub struct RequestPayload {
9501 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9503 pub disable_search: ::std::option::Option<bool>,
9504 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9506 pub enable_search_classifier: ::std::option::Option<bool>,
9507 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9509 pub image_domain_filter: ::std::option::Option<
9510 ::std::vec::Vec<::std::string::String>,
9511 >,
9512 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9514 pub image_format_filter: ::std::option::Option<
9515 ::std::vec::Vec<::std::string::String>,
9516 >,
9517 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9519 pub language_preference: ::std::option::Option<::std::string::String>,
9520 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9522 pub last_updated_after_filter: ::std::option::Option<::std::string::String>,
9523 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9525 pub last_updated_before_filter: ::std::option::Option<::std::string::String>,
9526 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9528 pub max_tokens: ::std::option::Option<i64>,
9529 pub messages: ::std::vec::Vec<Message>,
9531 pub model: RequestPayloadModel,
9533 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9535 pub reasoning_effort: ::std::option::Option<RequestPayloadReasoningEffort>,
9536 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9538 pub response_format: ::std::option::Option<
9539 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
9540 >,
9541 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9543 pub return_images: ::std::option::Option<bool>,
9544 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9546 pub return_related_questions: ::std::option::Option<bool>,
9547 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9549 pub search_after_date_filter: ::std::option::Option<::std::string::String>,
9550 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9552 pub search_before_date_filter: ::std::option::Option<::std::string::String>,
9553 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9555 pub search_domain_filter: ::std::option::Option<
9556 ::std::vec::Vec<::std::string::String>,
9557 >,
9558 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9560 pub search_language_filter: ::std::option::Option<
9561 ::std::vec::Vec<::std::string::String>,
9562 >,
9563 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9565 pub search_mode: ::std::option::Option<RequestPayloadSearchMode>,
9566 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9568 pub search_recency_filter: ::std::option::Option<RequestPayloadSearchRecencyFilter>,
9569 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9571 pub stop: ::std::option::Option<RequestPayloadStop>,
9572 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9574 pub stream: ::std::option::Option<bool>,
9575 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9577 pub stream_mode: ::std::option::Option<RequestPayloadStreamMode>,
9578 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9580 pub temperature: ::std::option::Option<f64>,
9581 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9583 pub top_p: ::std::option::Option<f64>,
9584 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
9585 pub web_search_options: ::std::option::Option<RequestPayloadWebSearchOptions>,
9586}
9587impl RequestPayload {
9588 pub fn builder() -> builder::RequestPayload {
9589 Default::default()
9590 }
9591}
9592#[derive(
9594 ::serde::Deserialize,
9595 ::serde::Serialize,
9596 Clone,
9597 Copy,
9598 Debug,
9599 Eq,
9600 Hash,
9601 Ord,
9602 PartialEq,
9603 PartialOrd
9604)]
9605pub enum RequestPayloadModel {
9606 #[serde(rename = "sonar-deep-research")]
9607 SonarDeepResearch,
9608}
9609impl ::std::fmt::Display for RequestPayloadModel {
9610 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9611 match *self {
9612 Self::SonarDeepResearch => f.write_str("sonar-deep-research"),
9613 }
9614 }
9615}
9616impl ::std::str::FromStr for RequestPayloadModel {
9617 type Err = self::error::ConversionError;
9618 fn from_str(
9619 value: &str,
9620 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9621 match value {
9622 "sonar-deep-research" => Ok(Self::SonarDeepResearch),
9623 _ => Err("invalid value".into()),
9624 }
9625 }
9626}
9627impl ::std::convert::TryFrom<&str> for RequestPayloadModel {
9628 type Error = self::error::ConversionError;
9629 fn try_from(
9630 value: &str,
9631 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9632 value.parse()
9633 }
9634}
9635impl ::std::convert::TryFrom<::std::string::String> for RequestPayloadModel {
9636 type Error = self::error::ConversionError;
9637 fn try_from(
9638 value: ::std::string::String,
9639 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9640 value.parse()
9641 }
9642}
9643#[derive(
9645 ::serde::Deserialize,
9646 ::serde::Serialize,
9647 Clone,
9648 Copy,
9649 Debug,
9650 Eq,
9651 Hash,
9652 Ord,
9653 PartialEq,
9654 PartialOrd
9655)]
9656pub enum RequestPayloadReasoningEffort {
9657 #[serde(rename = "minimal")]
9658 Minimal,
9659 #[serde(rename = "low")]
9660 Low,
9661 #[serde(rename = "medium")]
9662 Medium,
9663 #[serde(rename = "high")]
9664 High,
9665}
9666impl ::std::fmt::Display for RequestPayloadReasoningEffort {
9667 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9668 match *self {
9669 Self::Minimal => f.write_str("minimal"),
9670 Self::Low => f.write_str("low"),
9671 Self::Medium => f.write_str("medium"),
9672 Self::High => f.write_str("high"),
9673 }
9674 }
9675}
9676impl ::std::str::FromStr for RequestPayloadReasoningEffort {
9677 type Err = self::error::ConversionError;
9678 fn from_str(
9679 value: &str,
9680 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9681 match value {
9682 "minimal" => Ok(Self::Minimal),
9683 "low" => Ok(Self::Low),
9684 "medium" => Ok(Self::Medium),
9685 "high" => Ok(Self::High),
9686 _ => Err("invalid value".into()),
9687 }
9688 }
9689}
9690impl ::std::convert::TryFrom<&str> for RequestPayloadReasoningEffort {
9691 type Error = self::error::ConversionError;
9692 fn try_from(
9693 value: &str,
9694 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9695 value.parse()
9696 }
9697}
9698impl ::std::convert::TryFrom<::std::string::String> for RequestPayloadReasoningEffort {
9699 type Error = self::error::ConversionError;
9700 fn try_from(
9701 value: ::std::string::String,
9702 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9703 value.parse()
9704 }
9705}
9706#[derive(
9708 ::serde::Deserialize,
9709 ::serde::Serialize,
9710 Clone,
9711 Copy,
9712 Debug,
9713 Eq,
9714 Hash,
9715 Ord,
9716 PartialEq,
9717 PartialOrd
9718)]
9719pub enum RequestPayloadSearchMode {
9720 #[serde(rename = "web")]
9721 Web,
9722 #[serde(rename = "academic")]
9723 Academic,
9724 #[serde(rename = "sec")]
9725 Sec,
9726}
9727impl ::std::fmt::Display for RequestPayloadSearchMode {
9728 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9729 match *self {
9730 Self::Web => f.write_str("web"),
9731 Self::Academic => f.write_str("academic"),
9732 Self::Sec => f.write_str("sec"),
9733 }
9734 }
9735}
9736impl ::std::str::FromStr for RequestPayloadSearchMode {
9737 type Err = self::error::ConversionError;
9738 fn from_str(
9739 value: &str,
9740 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9741 match value {
9742 "web" => Ok(Self::Web),
9743 "academic" => Ok(Self::Academic),
9744 "sec" => Ok(Self::Sec),
9745 _ => Err("invalid value".into()),
9746 }
9747 }
9748}
9749impl ::std::convert::TryFrom<&str> for RequestPayloadSearchMode {
9750 type Error = self::error::ConversionError;
9751 fn try_from(
9752 value: &str,
9753 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9754 value.parse()
9755 }
9756}
9757impl ::std::convert::TryFrom<::std::string::String> for RequestPayloadSearchMode {
9758 type Error = self::error::ConversionError;
9759 fn try_from(
9760 value: ::std::string::String,
9761 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9762 value.parse()
9763 }
9764}
9765#[derive(
9767 ::serde::Deserialize,
9768 ::serde::Serialize,
9769 Clone,
9770 Copy,
9771 Debug,
9772 Eq,
9773 Hash,
9774 Ord,
9775 PartialEq,
9776 PartialOrd
9777)]
9778pub enum RequestPayloadSearchRecencyFilter {
9779 #[serde(rename = "hour")]
9780 Hour,
9781 #[serde(rename = "day")]
9782 Day,
9783 #[serde(rename = "week")]
9784 Week,
9785 #[serde(rename = "month")]
9786 Month,
9787 #[serde(rename = "year")]
9788 Year,
9789}
9790impl ::std::fmt::Display for RequestPayloadSearchRecencyFilter {
9791 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9792 match *self {
9793 Self::Hour => f.write_str("hour"),
9794 Self::Day => f.write_str("day"),
9795 Self::Week => f.write_str("week"),
9796 Self::Month => f.write_str("month"),
9797 Self::Year => f.write_str("year"),
9798 }
9799 }
9800}
9801impl ::std::str::FromStr for RequestPayloadSearchRecencyFilter {
9802 type Err = self::error::ConversionError;
9803 fn from_str(
9804 value: &str,
9805 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9806 match value {
9807 "hour" => Ok(Self::Hour),
9808 "day" => Ok(Self::Day),
9809 "week" => Ok(Self::Week),
9810 "month" => Ok(Self::Month),
9811 "year" => Ok(Self::Year),
9812 _ => Err("invalid value".into()),
9813 }
9814 }
9815}
9816impl ::std::convert::TryFrom<&str> for RequestPayloadSearchRecencyFilter {
9817 type Error = self::error::ConversionError;
9818 fn try_from(
9819 value: &str,
9820 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9821 value.parse()
9822 }
9823}
9824impl ::std::convert::TryFrom<::std::string::String>
9825for RequestPayloadSearchRecencyFilter {
9826 type Error = self::error::ConversionError;
9827 fn try_from(
9828 value: ::std::string::String,
9829 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9830 value.parse()
9831 }
9832}
9833#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
9835#[serde(untagged)]
9836pub enum RequestPayloadStop {
9837 String(::std::string::String),
9838 Array(::std::vec::Vec<::std::string::String>),
9839 Null,
9840}
9841impl ::std::convert::From<::std::vec::Vec<::std::string::String>>
9842for RequestPayloadStop {
9843 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
9844 Self::Array(value)
9845 }
9846}
9847#[derive(
9849 ::serde::Deserialize,
9850 ::serde::Serialize,
9851 Clone,
9852 Copy,
9853 Debug,
9854 Eq,
9855 Hash,
9856 Ord,
9857 PartialEq,
9858 PartialOrd
9859)]
9860pub enum RequestPayloadStreamMode {
9861 #[serde(rename = "full")]
9862 Full,
9863 #[serde(rename = "concise")]
9864 Concise,
9865}
9866impl ::std::fmt::Display for RequestPayloadStreamMode {
9867 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
9868 match *self {
9869 Self::Full => f.write_str("full"),
9870 Self::Concise => f.write_str("concise"),
9871 }
9872 }
9873}
9874impl ::std::str::FromStr for RequestPayloadStreamMode {
9875 type Err = self::error::ConversionError;
9876 fn from_str(
9877 value: &str,
9878 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9879 match value {
9880 "full" => Ok(Self::Full),
9881 "concise" => Ok(Self::Concise),
9882 _ => Err("invalid value".into()),
9883 }
9884 }
9885}
9886impl ::std::convert::TryFrom<&str> for RequestPayloadStreamMode {
9887 type Error = self::error::ConversionError;
9888 fn try_from(
9889 value: &str,
9890 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9891 value.parse()
9892 }
9893}
9894impl ::std::convert::TryFrom<::std::string::String> for RequestPayloadStreamMode {
9895 type Error = self::error::ConversionError;
9896 fn try_from(
9897 value: ::std::string::String,
9898 ) -> ::std::result::Result<Self, self::error::ConversionError> {
9899 value.parse()
9900 }
9901}
9902#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
9904#[serde(deny_unknown_fields)]
9905pub struct RequestPayloadWebSearchOptions {}
9906impl RequestPayloadWebSearchOptions {
9907 pub fn builder() -> builder::RequestPayloadWebSearchOptions {
9908 Default::default()
9909 }
9910}
9911pub mod builder {
9913 #[derive(Clone, Debug)]
9914 pub struct Input {
9915 idempotency_key: ::std::result::Result<
9916 ::std::option::Option<::std::string::String>,
9917 ::std::string::String,
9918 >,
9919 request: ::std::result::Result<super::RequestPayload, ::std::string::String>,
9920 }
9921 impl ::std::default::Default for Input {
9922 fn default() -> Self {
9923 Self {
9924 idempotency_key: Ok(Default::default()),
9925 request: Err("no value supplied for request".to_string()),
9926 }
9927 }
9928 }
9929 impl Input {
9930 pub fn idempotency_key<T>(mut self, value: T) -> Self
9931 where
9932 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
9933 T::Error: ::std::fmt::Display,
9934 {
9935 self.idempotency_key = value
9936 .try_into()
9937 .map_err(|e| {
9938 format!("error converting supplied value for idempotency_key: {e}")
9939 });
9940 self
9941 }
9942 pub fn request<T>(mut self, value: T) -> Self
9943 where
9944 T: ::std::convert::TryInto<super::RequestPayload>,
9945 T::Error: ::std::fmt::Display,
9946 {
9947 self.request = value
9948 .try_into()
9949 .map_err(|e| {
9950 format!("error converting supplied value for request: {e}")
9951 });
9952 self
9953 }
9954 }
9955 impl ::std::convert::TryFrom<Input> for super::Input {
9956 type Error = super::error::ConversionError;
9957 fn try_from(
9958 value: Input,
9959 ) -> ::std::result::Result<Self, super::error::ConversionError> {
9960 Ok(Self {
9961 idempotency_key: value.idempotency_key?,
9962 request: value.request?,
9963 })
9964 }
9965 }
9966 impl ::std::convert::From<super::Input> for Input {
9967 fn from(value: super::Input) -> Self {
9968 Self {
9969 idempotency_key: Ok(value.idempotency_key),
9970 request: Ok(value.request),
9971 }
9972 }
9973 }
9974 #[derive(Clone, Debug)]
9975 pub struct Message {
9976 content: ::std::result::Result<super::MessageContent, ::std::string::String>,
9977 role: ::std::result::Result<::std::string::String, ::std::string::String>,
9978 }
9979 impl ::std::default::Default for Message {
9980 fn default() -> Self {
9981 Self {
9982 content: Err("no value supplied for content".to_string()),
9983 role: Err("no value supplied for role".to_string()),
9984 }
9985 }
9986 }
9987 impl Message {
9988 pub fn content<T>(mut self, value: T) -> Self
9989 where
9990 T: ::std::convert::TryInto<super::MessageContent>,
9991 T::Error: ::std::fmt::Display,
9992 {
9993 self.content = value
9994 .try_into()
9995 .map_err(|e| {
9996 format!("error converting supplied value for content: {e}")
9997 });
9998 self
9999 }
10000 pub fn role<T>(mut self, value: T) -> Self
10001 where
10002 T: ::std::convert::TryInto<::std::string::String>,
10003 T::Error: ::std::fmt::Display,
10004 {
10005 self.role = value
10006 .try_into()
10007 .map_err(|e| format!("error converting supplied value for role: {e}"));
10008 self
10009 }
10010 }
10011 impl ::std::convert::TryFrom<Message> for super::Message {
10012 type Error = super::error::ConversionError;
10013 fn try_from(
10014 value: Message,
10015 ) -> ::std::result::Result<Self, super::error::ConversionError> {
10016 Ok(Self {
10017 content: value.content?,
10018 role: value.role?,
10019 })
10020 }
10021 }
10022 impl ::std::convert::From<super::Message> for Message {
10023 fn from(value: super::Message) -> Self {
10024 Self {
10025 content: Ok(value.content),
10026 role: Ok(value.role),
10027 }
10028 }
10029 }
10030 #[derive(Clone, Debug)]
10031 pub struct RequestPayload {
10032 disable_search: ::std::result::Result<
10033 ::std::option::Option<bool>,
10034 ::std::string::String,
10035 >,
10036 enable_search_classifier: ::std::result::Result<
10037 ::std::option::Option<bool>,
10038 ::std::string::String,
10039 >,
10040 image_domain_filter: ::std::result::Result<
10041 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10042 ::std::string::String,
10043 >,
10044 image_format_filter: ::std::result::Result<
10045 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10046 ::std::string::String,
10047 >,
10048 language_preference: ::std::result::Result<
10049 ::std::option::Option<::std::string::String>,
10050 ::std::string::String,
10051 >,
10052 last_updated_after_filter: ::std::result::Result<
10053 ::std::option::Option<::std::string::String>,
10054 ::std::string::String,
10055 >,
10056 last_updated_before_filter: ::std::result::Result<
10057 ::std::option::Option<::std::string::String>,
10058 ::std::string::String,
10059 >,
10060 max_tokens: ::std::result::Result<
10061 ::std::option::Option<i64>,
10062 ::std::string::String,
10063 >,
10064 messages: ::std::result::Result<
10065 ::std::vec::Vec<super::Message>,
10066 ::std::string::String,
10067 >,
10068 model: ::std::result::Result<super::RequestPayloadModel, ::std::string::String>,
10069 reasoning_effort: ::std::result::Result<
10070 ::std::option::Option<super::RequestPayloadReasoningEffort>,
10071 ::std::string::String,
10072 >,
10073 response_format: ::std::result::Result<
10074 ::std::option::Option<
10075 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
10076 >,
10077 ::std::string::String,
10078 >,
10079 return_images: ::std::result::Result<
10080 ::std::option::Option<bool>,
10081 ::std::string::String,
10082 >,
10083 return_related_questions: ::std::result::Result<
10084 ::std::option::Option<bool>,
10085 ::std::string::String,
10086 >,
10087 search_after_date_filter: ::std::result::Result<
10088 ::std::option::Option<::std::string::String>,
10089 ::std::string::String,
10090 >,
10091 search_before_date_filter: ::std::result::Result<
10092 ::std::option::Option<::std::string::String>,
10093 ::std::string::String,
10094 >,
10095 search_domain_filter: ::std::result::Result<
10096 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10097 ::std::string::String,
10098 >,
10099 search_language_filter: ::std::result::Result<
10100 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10101 ::std::string::String,
10102 >,
10103 search_mode: ::std::result::Result<
10104 ::std::option::Option<super::RequestPayloadSearchMode>,
10105 ::std::string::String,
10106 >,
10107 search_recency_filter: ::std::result::Result<
10108 ::std::option::Option<super::RequestPayloadSearchRecencyFilter>,
10109 ::std::string::String,
10110 >,
10111 stop: ::std::result::Result<
10112 ::std::option::Option<super::RequestPayloadStop>,
10113 ::std::string::String,
10114 >,
10115 stream: ::std::result::Result<
10116 ::std::option::Option<bool>,
10117 ::std::string::String,
10118 >,
10119 stream_mode: ::std::result::Result<
10120 ::std::option::Option<super::RequestPayloadStreamMode>,
10121 ::std::string::String,
10122 >,
10123 temperature: ::std::result::Result<
10124 ::std::option::Option<f64>,
10125 ::std::string::String,
10126 >,
10127 top_p: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
10128 web_search_options: ::std::result::Result<
10129 ::std::option::Option<super::RequestPayloadWebSearchOptions>,
10130 ::std::string::String,
10131 >,
10132 }
10133 impl ::std::default::Default for RequestPayload {
10134 fn default() -> Self {
10135 Self {
10136 disable_search: Ok(Default::default()),
10137 enable_search_classifier: Ok(Default::default()),
10138 image_domain_filter: Ok(Default::default()),
10139 image_format_filter: Ok(Default::default()),
10140 language_preference: Ok(Default::default()),
10141 last_updated_after_filter: Ok(Default::default()),
10142 last_updated_before_filter: Ok(Default::default()),
10143 max_tokens: Ok(Default::default()),
10144 messages: Err("no value supplied for messages".to_string()),
10145 model: Err("no value supplied for model".to_string()),
10146 reasoning_effort: Ok(Default::default()),
10147 response_format: Ok(Default::default()),
10148 return_images: Ok(Default::default()),
10149 return_related_questions: Ok(Default::default()),
10150 search_after_date_filter: Ok(Default::default()),
10151 search_before_date_filter: Ok(Default::default()),
10152 search_domain_filter: Ok(Default::default()),
10153 search_language_filter: Ok(Default::default()),
10154 search_mode: Ok(Default::default()),
10155 search_recency_filter: Ok(Default::default()),
10156 stop: Ok(Default::default()),
10157 stream: Ok(Default::default()),
10158 stream_mode: Ok(Default::default()),
10159 temperature: Ok(Default::default()),
10160 top_p: Ok(Default::default()),
10161 web_search_options: Ok(Default::default()),
10162 }
10163 }
10164 }
10165 impl RequestPayload {
10166 pub fn disable_search<T>(mut self, value: T) -> Self
10167 where
10168 T: ::std::convert::TryInto<::std::option::Option<bool>>,
10169 T::Error: ::std::fmt::Display,
10170 {
10171 self.disable_search = value
10172 .try_into()
10173 .map_err(|e| {
10174 format!("error converting supplied value for disable_search: {e}")
10175 });
10176 self
10177 }
10178 pub fn enable_search_classifier<T>(mut self, value: T) -> Self
10179 where
10180 T: ::std::convert::TryInto<::std::option::Option<bool>>,
10181 T::Error: ::std::fmt::Display,
10182 {
10183 self.enable_search_classifier = value
10184 .try_into()
10185 .map_err(|e| {
10186 format!(
10187 "error converting supplied value for enable_search_classifier: {e}"
10188 )
10189 });
10190 self
10191 }
10192 pub fn image_domain_filter<T>(mut self, value: T) -> Self
10193 where
10194 T: ::std::convert::TryInto<
10195 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10196 >,
10197 T::Error: ::std::fmt::Display,
10198 {
10199 self.image_domain_filter = value
10200 .try_into()
10201 .map_err(|e| {
10202 format!(
10203 "error converting supplied value for image_domain_filter: {e}"
10204 )
10205 });
10206 self
10207 }
10208 pub fn image_format_filter<T>(mut self, value: T) -> Self
10209 where
10210 T: ::std::convert::TryInto<
10211 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10212 >,
10213 T::Error: ::std::fmt::Display,
10214 {
10215 self.image_format_filter = value
10216 .try_into()
10217 .map_err(|e| {
10218 format!(
10219 "error converting supplied value for image_format_filter: {e}"
10220 )
10221 });
10222 self
10223 }
10224 pub fn language_preference<T>(mut self, value: T) -> Self
10225 where
10226 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
10227 T::Error: ::std::fmt::Display,
10228 {
10229 self.language_preference = value
10230 .try_into()
10231 .map_err(|e| {
10232 format!(
10233 "error converting supplied value for language_preference: {e}"
10234 )
10235 });
10236 self
10237 }
10238 pub fn last_updated_after_filter<T>(mut self, value: T) -> Self
10239 where
10240 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
10241 T::Error: ::std::fmt::Display,
10242 {
10243 self.last_updated_after_filter = value
10244 .try_into()
10245 .map_err(|e| {
10246 format!(
10247 "error converting supplied value for last_updated_after_filter: {e}"
10248 )
10249 });
10250 self
10251 }
10252 pub fn last_updated_before_filter<T>(mut self, value: T) -> Self
10253 where
10254 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
10255 T::Error: ::std::fmt::Display,
10256 {
10257 self.last_updated_before_filter = value
10258 .try_into()
10259 .map_err(|e| {
10260 format!(
10261 "error converting supplied value for last_updated_before_filter: {e}"
10262 )
10263 });
10264 self
10265 }
10266 pub fn max_tokens<T>(mut self, value: T) -> Self
10267 where
10268 T: ::std::convert::TryInto<::std::option::Option<i64>>,
10269 T::Error: ::std::fmt::Display,
10270 {
10271 self.max_tokens = value
10272 .try_into()
10273 .map_err(|e| {
10274 format!("error converting supplied value for max_tokens: {e}")
10275 });
10276 self
10277 }
10278 pub fn messages<T>(mut self, value: T) -> Self
10279 where
10280 T: ::std::convert::TryInto<::std::vec::Vec<super::Message>>,
10281 T::Error: ::std::fmt::Display,
10282 {
10283 self.messages = value
10284 .try_into()
10285 .map_err(|e| {
10286 format!("error converting supplied value for messages: {e}")
10287 });
10288 self
10289 }
10290 pub fn model<T>(mut self, value: T) -> Self
10291 where
10292 T: ::std::convert::TryInto<super::RequestPayloadModel>,
10293 T::Error: ::std::fmt::Display,
10294 {
10295 self.model = value
10296 .try_into()
10297 .map_err(|e| format!("error converting supplied value for model: {e}"));
10298 self
10299 }
10300 pub fn reasoning_effort<T>(mut self, value: T) -> Self
10301 where
10302 T: ::std::convert::TryInto<
10303 ::std::option::Option<super::RequestPayloadReasoningEffort>,
10304 >,
10305 T::Error: ::std::fmt::Display,
10306 {
10307 self.reasoning_effort = value
10308 .try_into()
10309 .map_err(|e| {
10310 format!("error converting supplied value for reasoning_effort: {e}")
10311 });
10312 self
10313 }
10314 pub fn response_format<T>(mut self, value: T) -> Self
10315 where
10316 T: ::std::convert::TryInto<
10317 ::std::option::Option<
10318 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
10319 >,
10320 >,
10321 T::Error: ::std::fmt::Display,
10322 {
10323 self.response_format = value
10324 .try_into()
10325 .map_err(|e| {
10326 format!("error converting supplied value for response_format: {e}")
10327 });
10328 self
10329 }
10330 pub fn return_images<T>(mut self, value: T) -> Self
10331 where
10332 T: ::std::convert::TryInto<::std::option::Option<bool>>,
10333 T::Error: ::std::fmt::Display,
10334 {
10335 self.return_images = value
10336 .try_into()
10337 .map_err(|e| {
10338 format!("error converting supplied value for return_images: {e}")
10339 });
10340 self
10341 }
10342 pub fn return_related_questions<T>(mut self, value: T) -> Self
10343 where
10344 T: ::std::convert::TryInto<::std::option::Option<bool>>,
10345 T::Error: ::std::fmt::Display,
10346 {
10347 self.return_related_questions = value
10348 .try_into()
10349 .map_err(|e| {
10350 format!(
10351 "error converting supplied value for return_related_questions: {e}"
10352 )
10353 });
10354 self
10355 }
10356 pub fn search_after_date_filter<T>(mut self, value: T) -> Self
10357 where
10358 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
10359 T::Error: ::std::fmt::Display,
10360 {
10361 self.search_after_date_filter = value
10362 .try_into()
10363 .map_err(|e| {
10364 format!(
10365 "error converting supplied value for search_after_date_filter: {e}"
10366 )
10367 });
10368 self
10369 }
10370 pub fn search_before_date_filter<T>(mut self, value: T) -> Self
10371 where
10372 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
10373 T::Error: ::std::fmt::Display,
10374 {
10375 self.search_before_date_filter = value
10376 .try_into()
10377 .map_err(|e| {
10378 format!(
10379 "error converting supplied value for search_before_date_filter: {e}"
10380 )
10381 });
10382 self
10383 }
10384 pub fn search_domain_filter<T>(mut self, value: T) -> Self
10385 where
10386 T: ::std::convert::TryInto<
10387 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10388 >,
10389 T::Error: ::std::fmt::Display,
10390 {
10391 self.search_domain_filter = value
10392 .try_into()
10393 .map_err(|e| {
10394 format!(
10395 "error converting supplied value for search_domain_filter: {e}"
10396 )
10397 });
10398 self
10399 }
10400 pub fn search_language_filter<T>(mut self, value: T) -> Self
10401 where
10402 T: ::std::convert::TryInto<
10403 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10404 >,
10405 T::Error: ::std::fmt::Display,
10406 {
10407 self.search_language_filter = value
10408 .try_into()
10409 .map_err(|e| {
10410 format!(
10411 "error converting supplied value for search_language_filter: {e}"
10412 )
10413 });
10414 self
10415 }
10416 pub fn search_mode<T>(mut self, value: T) -> Self
10417 where
10418 T: ::std::convert::TryInto<
10419 ::std::option::Option<super::RequestPayloadSearchMode>,
10420 >,
10421 T::Error: ::std::fmt::Display,
10422 {
10423 self.search_mode = value
10424 .try_into()
10425 .map_err(|e| {
10426 format!("error converting supplied value for search_mode: {e}")
10427 });
10428 self
10429 }
10430 pub fn search_recency_filter<T>(mut self, value: T) -> Self
10431 where
10432 T: ::std::convert::TryInto<
10433 ::std::option::Option<super::RequestPayloadSearchRecencyFilter>,
10434 >,
10435 T::Error: ::std::fmt::Display,
10436 {
10437 self.search_recency_filter = value
10438 .try_into()
10439 .map_err(|e| {
10440 format!(
10441 "error converting supplied value for search_recency_filter: {e}"
10442 )
10443 });
10444 self
10445 }
10446 pub fn stop<T>(mut self, value: T) -> Self
10447 where
10448 T: ::std::convert::TryInto<::std::option::Option<super::RequestPayloadStop>>,
10449 T::Error: ::std::fmt::Display,
10450 {
10451 self.stop = value
10452 .try_into()
10453 .map_err(|e| format!("error converting supplied value for stop: {e}"));
10454 self
10455 }
10456 pub fn stream<T>(mut self, value: T) -> Self
10457 where
10458 T: ::std::convert::TryInto<::std::option::Option<bool>>,
10459 T::Error: ::std::fmt::Display,
10460 {
10461 self.stream = value
10462 .try_into()
10463 .map_err(|e| format!("error converting supplied value for stream: {e}"));
10464 self
10465 }
10466 pub fn stream_mode<T>(mut self, value: T) -> Self
10467 where
10468 T: ::std::convert::TryInto<
10469 ::std::option::Option<super::RequestPayloadStreamMode>,
10470 >,
10471 T::Error: ::std::fmt::Display,
10472 {
10473 self.stream_mode = value
10474 .try_into()
10475 .map_err(|e| {
10476 format!("error converting supplied value for stream_mode: {e}")
10477 });
10478 self
10479 }
10480 pub fn temperature<T>(mut self, value: T) -> Self
10481 where
10482 T: ::std::convert::TryInto<::std::option::Option<f64>>,
10483 T::Error: ::std::fmt::Display,
10484 {
10485 self.temperature = value
10486 .try_into()
10487 .map_err(|e| {
10488 format!("error converting supplied value for temperature: {e}")
10489 });
10490 self
10491 }
10492 pub fn top_p<T>(mut self, value: T) -> Self
10493 where
10494 T: ::std::convert::TryInto<::std::option::Option<f64>>,
10495 T::Error: ::std::fmt::Display,
10496 {
10497 self.top_p = value
10498 .try_into()
10499 .map_err(|e| format!("error converting supplied value for top_p: {e}"));
10500 self
10501 }
10502 pub fn web_search_options<T>(mut self, value: T) -> Self
10503 where
10504 T: ::std::convert::TryInto<
10505 ::std::option::Option<super::RequestPayloadWebSearchOptions>,
10506 >,
10507 T::Error: ::std::fmt::Display,
10508 {
10509 self.web_search_options = value
10510 .try_into()
10511 .map_err(|e| {
10512 format!(
10513 "error converting supplied value for web_search_options: {e}"
10514 )
10515 });
10516 self
10517 }
10518 }
10519 impl ::std::convert::TryFrom<RequestPayload> for super::RequestPayload {
10520 type Error = super::error::ConversionError;
10521 fn try_from(
10522 value: RequestPayload,
10523 ) -> ::std::result::Result<Self, super::error::ConversionError> {
10524 Ok(Self {
10525 disable_search: value.disable_search?,
10526 enable_search_classifier: value.enable_search_classifier?,
10527 image_domain_filter: value.image_domain_filter?,
10528 image_format_filter: value.image_format_filter?,
10529 language_preference: value.language_preference?,
10530 last_updated_after_filter: value.last_updated_after_filter?,
10531 last_updated_before_filter: value.last_updated_before_filter?,
10532 max_tokens: value.max_tokens?,
10533 messages: value.messages?,
10534 model: value.model?,
10535 reasoning_effort: value.reasoning_effort?,
10536 response_format: value.response_format?,
10537 return_images: value.return_images?,
10538 return_related_questions: value.return_related_questions?,
10539 search_after_date_filter: value.search_after_date_filter?,
10540 search_before_date_filter: value.search_before_date_filter?,
10541 search_domain_filter: value.search_domain_filter?,
10542 search_language_filter: value.search_language_filter?,
10543 search_mode: value.search_mode?,
10544 search_recency_filter: value.search_recency_filter?,
10545 stop: value.stop?,
10546 stream: value.stream?,
10547 stream_mode: value.stream_mode?,
10548 temperature: value.temperature?,
10549 top_p: value.top_p?,
10550 web_search_options: value.web_search_options?,
10551 })
10552 }
10553 }
10554 impl ::std::convert::From<super::RequestPayload> for RequestPayload {
10555 fn from(value: super::RequestPayload) -> Self {
10556 Self {
10557 disable_search: Ok(value.disable_search),
10558 enable_search_classifier: Ok(value.enable_search_classifier),
10559 image_domain_filter: Ok(value.image_domain_filter),
10560 image_format_filter: Ok(value.image_format_filter),
10561 language_preference: Ok(value.language_preference),
10562 last_updated_after_filter: Ok(value.last_updated_after_filter),
10563 last_updated_before_filter: Ok(value.last_updated_before_filter),
10564 max_tokens: Ok(value.max_tokens),
10565 messages: Ok(value.messages),
10566 model: Ok(value.model),
10567 reasoning_effort: Ok(value.reasoning_effort),
10568 response_format: Ok(value.response_format),
10569 return_images: Ok(value.return_images),
10570 return_related_questions: Ok(value.return_related_questions),
10571 search_after_date_filter: Ok(value.search_after_date_filter),
10572 search_before_date_filter: Ok(value.search_before_date_filter),
10573 search_domain_filter: Ok(value.search_domain_filter),
10574 search_language_filter: Ok(value.search_language_filter),
10575 search_mode: Ok(value.search_mode),
10576 search_recency_filter: Ok(value.search_recency_filter),
10577 stop: Ok(value.stop),
10578 stream: Ok(value.stream),
10579 stream_mode: Ok(value.stream_mode),
10580 temperature: Ok(value.temperature),
10581 top_p: Ok(value.top_p),
10582 web_search_options: Ok(value.web_search_options),
10583 }
10584 }
10585 }
10586 #[derive(Clone, Debug)]
10587 pub struct RequestPayloadWebSearchOptions {}
10588 impl ::std::default::Default for RequestPayloadWebSearchOptions {
10589 fn default() -> Self {
10590 Self {}
10591 }
10592 }
10593 impl RequestPayloadWebSearchOptions {}
10594 impl ::std::convert::TryFrom<RequestPayloadWebSearchOptions>
10595 for super::RequestPayloadWebSearchOptions {
10596 type Error = super::error::ConversionError;
10597 fn try_from(
10598 _value: RequestPayloadWebSearchOptions,
10599 ) -> ::std::result::Result<Self, super::error::ConversionError> {
10600 Ok(Self {})
10601 }
10602 }
10603 impl ::std::convert::From<super::RequestPayloadWebSearchOptions>
10604 for RequestPayloadWebSearchOptions {
10605 fn from(_value: super::RequestPayloadWebSearchOptions) -> Self {
10606 Self {}
10607 }
10608 }
10609}
10610pub mod error {
10612 pub struct ConversionError(::std::borrow::Cow<'static, str>);
10614 impl ::std::error::Error for ConversionError {}
10615 impl ::std::fmt::Display for ConversionError {
10616 fn fmt(
10617 &self,
10618 f: &mut ::std::fmt::Formatter<'_>,
10619 ) -> Result<(), ::std::fmt::Error> {
10620 ::std::fmt::Display::fmt(&self.0, f)
10621 }
10622 }
10623 impl ::std::fmt::Debug for ConversionError {
10624 fn fmt(
10625 &self,
10626 f: &mut ::std::fmt::Formatter<'_>,
10627 ) -> Result<(), ::std::fmt::Error> {
10628 ::std::fmt::Debug::fmt(&self.0, f)
10629 }
10630 }
10631 impl From<&'static str> for ConversionError {
10632 fn from(value: &'static str) -> Self {
10633 Self(value.into())
10634 }
10635 }
10636 impl From<String> for ConversionError {
10637 fn from(value: String) -> Self {
10638 Self(value.into())
10639 }
10640 }
10641}
10642
10643pub mod output {
10644#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
10646pub struct CompletionResponse {
10647 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
10649 pub choices: ::std::vec::Vec<CompletionResponseChoicesItem>,
10650 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10652 pub citations: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10653 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10655 pub created: ::std::option::Option<i64>,
10656 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10658 pub id: ::std::option::Option<::std::string::String>,
10659 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10661 pub images: ::std::option::Option<::std::vec::Vec<CompletionResponseImagesItem>>,
10662 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10664 pub model: ::std::option::Option<::std::string::String>,
10665 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10667 pub object: ::std::option::Option<::std::string::String>,
10668 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10670 pub related_questions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
10671 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10673 pub search_results: ::std::option::Option<
10674 ::std::vec::Vec<CompletionResponseSearchResultsItem>,
10675 >,
10676 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10678 pub usage: ::std::option::Option<
10679 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
10680 >,
10681}
10682impl CompletionResponse {
10683 pub fn builder() -> builder::CompletionResponse {
10684 Default::default()
10685 }
10686}
10687#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
10689pub struct CompletionResponseChoicesItem {
10690 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
10692 pub delta: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
10693 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10695 pub finish_reason: ::std::option::Option<CompletionResponseChoicesItemFinishReason>,
10696 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10698 pub index: ::std::option::Option<i64>,
10699 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
10701 pub message: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
10702}
10703impl CompletionResponseChoicesItem {
10704 pub fn builder() -> builder::CompletionResponseChoicesItem {
10705 Default::default()
10706 }
10707}
10708#[derive(
10710 ::serde::Deserialize,
10711 ::serde::Serialize,
10712 Clone,
10713 Copy,
10714 Debug,
10715 Eq,
10716 Hash,
10717 Ord,
10718 PartialEq,
10719 PartialOrd
10720)]
10721pub enum CompletionResponseChoicesItemFinishReason {
10722 #[serde(rename = "stop")]
10723 Stop,
10724 #[serde(rename = "length")]
10725 Length,
10726}
10727impl ::std::fmt::Display for CompletionResponseChoicesItemFinishReason {
10728 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10729 match *self {
10730 Self::Stop => f.write_str("stop"),
10731 Self::Length => f.write_str("length"),
10732 }
10733 }
10734}
10735impl ::std::str::FromStr for CompletionResponseChoicesItemFinishReason {
10736 type Err = self::error::ConversionError;
10737 fn from_str(
10738 value: &str,
10739 ) -> ::std::result::Result<Self, self::error::ConversionError> {
10740 match value {
10741 "stop" => Ok(Self::Stop),
10742 "length" => Ok(Self::Length),
10743 _ => Err("invalid value".into()),
10744 }
10745 }
10746}
10747impl ::std::convert::TryFrom<&str> for CompletionResponseChoicesItemFinishReason {
10748 type Error = self::error::ConversionError;
10749 fn try_from(
10750 value: &str,
10751 ) -> ::std::result::Result<Self, self::error::ConversionError> {
10752 value.parse()
10753 }
10754}
10755impl ::std::convert::TryFrom<::std::string::String>
10756for CompletionResponseChoicesItemFinishReason {
10757 type Error = self::error::ConversionError;
10758 fn try_from(
10759 value: ::std::string::String,
10760 ) -> ::std::result::Result<Self, self::error::ConversionError> {
10761 value.parse()
10762 }
10763}
10764#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
10766pub struct CompletionResponseImagesItem {
10767 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10769 pub height: ::std::option::Option<i64>,
10770 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10772 pub image_url: ::std::option::Option<::std::string::String>,
10773 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10775 pub origin_url: ::std::option::Option<::std::string::String>,
10776 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10778 pub title: ::std::option::Option<::std::string::String>,
10779 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10781 pub width: ::std::option::Option<i64>,
10782}
10783impl CompletionResponseImagesItem {
10784 pub fn builder() -> builder::CompletionResponseImagesItem {
10785 Default::default()
10786 }
10787}
10788#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
10790pub struct CompletionResponseSearchResultsItem {
10791 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10793 pub date: ::std::option::Option<::std::string::String>,
10794 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10796 pub last_updated: ::std::option::Option<::std::string::String>,
10797 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10799 pub snippet: ::std::option::Option<::std::string::String>,
10800 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10802 pub source: ::std::option::Option<CompletionResponseSearchResultsItemSource>,
10803 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10805 pub title: ::std::option::Option<::std::string::String>,
10806 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10808 pub url: ::std::option::Option<::std::string::String>,
10809}
10810impl CompletionResponseSearchResultsItem {
10811 pub fn builder() -> builder::CompletionResponseSearchResultsItem {
10812 Default::default()
10813 }
10814}
10815#[derive(
10817 ::serde::Deserialize,
10818 ::serde::Serialize,
10819 Clone,
10820 Copy,
10821 Debug,
10822 Eq,
10823 Hash,
10824 Ord,
10825 PartialEq,
10826 PartialOrd
10827)]
10828pub enum CompletionResponseSearchResultsItemSource {
10829 #[serde(rename = "web")]
10830 Web,
10831 #[serde(rename = "attachment")]
10832 Attachment,
10833}
10834impl ::std::fmt::Display for CompletionResponseSearchResultsItemSource {
10835 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10836 match *self {
10837 Self::Web => f.write_str("web"),
10838 Self::Attachment => f.write_str("attachment"),
10839 }
10840 }
10841}
10842impl ::std::str::FromStr for CompletionResponseSearchResultsItemSource {
10843 type Err = self::error::ConversionError;
10844 fn from_str(
10845 value: &str,
10846 ) -> ::std::result::Result<Self, self::error::ConversionError> {
10847 match value {
10848 "web" => Ok(Self::Web),
10849 "attachment" => Ok(Self::Attachment),
10850 _ => Err("invalid value".into()),
10851 }
10852 }
10853}
10854impl ::std::convert::TryFrom<&str> for CompletionResponseSearchResultsItemSource {
10855 type Error = self::error::ConversionError;
10856 fn try_from(
10857 value: &str,
10858 ) -> ::std::result::Result<Self, self::error::ConversionError> {
10859 value.parse()
10860 }
10861}
10862impl ::std::convert::TryFrom<::std::string::String>
10863for CompletionResponseSearchResultsItemSource {
10864 type Error = self::error::ConversionError;
10865 fn try_from(
10866 value: ::std::string::String,
10867 ) -> ::std::result::Result<Self, self::error::ConversionError> {
10868 value.parse()
10869 }
10870}
10871#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
10873pub struct Output {
10874 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10876 pub completed_at: ::std::option::Option<i64>,
10877 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10879 pub created_at: ::std::option::Option<i64>,
10880 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
10882 pub detail: ::std::vec::Vec<OutputDetailItem>,
10883 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10884 pub error: ::std::option::Option<OutputError>,
10885 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10887 pub error_message: ::std::option::Option<::std::string::String>,
10888 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10890 pub failed_at: ::std::option::Option<i64>,
10891 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10893 pub id: ::std::option::Option<::std::string::String>,
10894 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10896 pub model: ::std::option::Option<::std::string::String>,
10897 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10899 pub response: ::std::option::Option<CompletionResponse>,
10900 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10902 pub started_at: ::std::option::Option<i64>,
10903 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10905 pub status: ::std::option::Option<OutputStatus>,
10906}
10907impl Output {
10908 pub fn builder() -> builder::Output {
10909 Default::default()
10910 }
10911}
10912#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
10914pub struct OutputDetailItem {
10915 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
10917 pub loc: ::std::vec::Vec<::std::string::String>,
10918 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10920 pub msg: ::std::option::Option<::std::string::String>,
10921 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
10923 pub type_: ::std::option::Option<::std::string::String>,
10924}
10925impl OutputDetailItem {
10926 pub fn builder() -> builder::OutputDetailItem {
10927 Default::default()
10928 }
10929}
10930#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
10932pub struct OutputError {
10933 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10935 pub code: ::std::option::Option<i64>,
10936 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
10938 pub message: ::std::option::Option<::std::string::String>,
10939 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
10941 pub type_: ::std::option::Option<::std::string::String>,
10942}
10943impl OutputError {
10944 pub fn builder() -> builder::OutputError {
10945 Default::default()
10946 }
10947}
10948#[derive(
10950 ::serde::Deserialize,
10951 ::serde::Serialize,
10952 Clone,
10953 Copy,
10954 Debug,
10955 Eq,
10956 Hash,
10957 Ord,
10958 PartialEq,
10959 PartialOrd
10960)]
10961pub enum OutputStatus {
10962 #[serde(rename = "CREATED")]
10963 Created,
10964 #[serde(rename = "IN_PROGRESS")]
10965 InProgress,
10966 #[serde(rename = "COMPLETED")]
10967 Completed,
10968 #[serde(rename = "FAILED")]
10969 Failed,
10970}
10971impl ::std::fmt::Display for OutputStatus {
10972 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
10973 match *self {
10974 Self::Created => f.write_str("CREATED"),
10975 Self::InProgress => f.write_str("IN_PROGRESS"),
10976 Self::Completed => f.write_str("COMPLETED"),
10977 Self::Failed => f.write_str("FAILED"),
10978 }
10979 }
10980}
10981impl ::std::str::FromStr for OutputStatus {
10982 type Err = self::error::ConversionError;
10983 fn from_str(
10984 value: &str,
10985 ) -> ::std::result::Result<Self, self::error::ConversionError> {
10986 match value {
10987 "CREATED" => Ok(Self::Created),
10988 "IN_PROGRESS" => Ok(Self::InProgress),
10989 "COMPLETED" => Ok(Self::Completed),
10990 "FAILED" => Ok(Self::Failed),
10991 _ => Err("invalid value".into()),
10992 }
10993 }
10994}
10995impl ::std::convert::TryFrom<&str> for OutputStatus {
10996 type Error = self::error::ConversionError;
10997 fn try_from(
10998 value: &str,
10999 ) -> ::std::result::Result<Self, self::error::ConversionError> {
11000 value.parse()
11001 }
11002}
11003impl ::std::convert::TryFrom<::std::string::String> for OutputStatus {
11004 type Error = self::error::ConversionError;
11005 fn try_from(
11006 value: ::std::string::String,
11007 ) -> ::std::result::Result<Self, self::error::ConversionError> {
11008 value.parse()
11009 }
11010}
11011pub mod builder {
11013 #[derive(Clone, Debug)]
11014 pub struct CompletionResponse {
11015 choices: ::std::result::Result<
11016 ::std::vec::Vec<super::CompletionResponseChoicesItem>,
11017 ::std::string::String,
11018 >,
11019 citations: ::std::result::Result<
11020 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11021 ::std::string::String,
11022 >,
11023 created: ::std::result::Result<
11024 ::std::option::Option<i64>,
11025 ::std::string::String,
11026 >,
11027 id: ::std::result::Result<
11028 ::std::option::Option<::std::string::String>,
11029 ::std::string::String,
11030 >,
11031 images: ::std::result::Result<
11032 ::std::option::Option<::std::vec::Vec<super::CompletionResponseImagesItem>>,
11033 ::std::string::String,
11034 >,
11035 model: ::std::result::Result<
11036 ::std::option::Option<::std::string::String>,
11037 ::std::string::String,
11038 >,
11039 object: ::std::result::Result<
11040 ::std::option::Option<::std::string::String>,
11041 ::std::string::String,
11042 >,
11043 related_questions: ::std::result::Result<
11044 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11045 ::std::string::String,
11046 >,
11047 search_results: ::std::result::Result<
11048 ::std::option::Option<
11049 ::std::vec::Vec<super::CompletionResponseSearchResultsItem>,
11050 >,
11051 ::std::string::String,
11052 >,
11053 usage: ::std::result::Result<
11054 ::std::option::Option<
11055 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
11056 >,
11057 ::std::string::String,
11058 >,
11059 }
11060 impl ::std::default::Default for CompletionResponse {
11061 fn default() -> Self {
11062 Self {
11063 choices: Ok(Default::default()),
11064 citations: Ok(Default::default()),
11065 created: Ok(Default::default()),
11066 id: Ok(Default::default()),
11067 images: Ok(Default::default()),
11068 model: Ok(Default::default()),
11069 object: Ok(Default::default()),
11070 related_questions: Ok(Default::default()),
11071 search_results: Ok(Default::default()),
11072 usage: Ok(Default::default()),
11073 }
11074 }
11075 }
11076 impl CompletionResponse {
11077 pub fn choices<T>(mut self, value: T) -> Self
11078 where
11079 T: ::std::convert::TryInto<
11080 ::std::vec::Vec<super::CompletionResponseChoicesItem>,
11081 >,
11082 T::Error: ::std::fmt::Display,
11083 {
11084 self.choices = value
11085 .try_into()
11086 .map_err(|e| {
11087 format!("error converting supplied value for choices: {e}")
11088 });
11089 self
11090 }
11091 pub fn citations<T>(mut self, value: T) -> Self
11092 where
11093 T: ::std::convert::TryInto<
11094 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11095 >,
11096 T::Error: ::std::fmt::Display,
11097 {
11098 self.citations = value
11099 .try_into()
11100 .map_err(|e| {
11101 format!("error converting supplied value for citations: {e}")
11102 });
11103 self
11104 }
11105 pub fn created<T>(mut self, value: T) -> Self
11106 where
11107 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11108 T::Error: ::std::fmt::Display,
11109 {
11110 self.created = value
11111 .try_into()
11112 .map_err(|e| {
11113 format!("error converting supplied value for created: {e}")
11114 });
11115 self
11116 }
11117 pub fn id<T>(mut self, value: T) -> Self
11118 where
11119 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11120 T::Error: ::std::fmt::Display,
11121 {
11122 self.id = value
11123 .try_into()
11124 .map_err(|e| format!("error converting supplied value for id: {e}"));
11125 self
11126 }
11127 pub fn images<T>(mut self, value: T) -> Self
11128 where
11129 T: ::std::convert::TryInto<
11130 ::std::option::Option<
11131 ::std::vec::Vec<super::CompletionResponseImagesItem>,
11132 >,
11133 >,
11134 T::Error: ::std::fmt::Display,
11135 {
11136 self.images = value
11137 .try_into()
11138 .map_err(|e| format!("error converting supplied value for images: {e}"));
11139 self
11140 }
11141 pub fn model<T>(mut self, value: T) -> Self
11142 where
11143 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11144 T::Error: ::std::fmt::Display,
11145 {
11146 self.model = value
11147 .try_into()
11148 .map_err(|e| format!("error converting supplied value for model: {e}"));
11149 self
11150 }
11151 pub fn object<T>(mut self, value: T) -> Self
11152 where
11153 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11154 T::Error: ::std::fmt::Display,
11155 {
11156 self.object = value
11157 .try_into()
11158 .map_err(|e| format!("error converting supplied value for object: {e}"));
11159 self
11160 }
11161 pub fn related_questions<T>(mut self, value: T) -> Self
11162 where
11163 T: ::std::convert::TryInto<
11164 ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11165 >,
11166 T::Error: ::std::fmt::Display,
11167 {
11168 self.related_questions = value
11169 .try_into()
11170 .map_err(|e| {
11171 format!("error converting supplied value for related_questions: {e}")
11172 });
11173 self
11174 }
11175 pub fn search_results<T>(mut self, value: T) -> Self
11176 where
11177 T: ::std::convert::TryInto<
11178 ::std::option::Option<
11179 ::std::vec::Vec<super::CompletionResponseSearchResultsItem>,
11180 >,
11181 >,
11182 T::Error: ::std::fmt::Display,
11183 {
11184 self.search_results = value
11185 .try_into()
11186 .map_err(|e| {
11187 format!("error converting supplied value for search_results: {e}")
11188 });
11189 self
11190 }
11191 pub fn usage<T>(mut self, value: T) -> Self
11192 where
11193 T: ::std::convert::TryInto<
11194 ::std::option::Option<
11195 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
11196 >,
11197 >,
11198 T::Error: ::std::fmt::Display,
11199 {
11200 self.usage = value
11201 .try_into()
11202 .map_err(|e| format!("error converting supplied value for usage: {e}"));
11203 self
11204 }
11205 }
11206 impl ::std::convert::TryFrom<CompletionResponse> for super::CompletionResponse {
11207 type Error = super::error::ConversionError;
11208 fn try_from(
11209 value: CompletionResponse,
11210 ) -> ::std::result::Result<Self, super::error::ConversionError> {
11211 Ok(Self {
11212 choices: value.choices?,
11213 citations: value.citations?,
11214 created: value.created?,
11215 id: value.id?,
11216 images: value.images?,
11217 model: value.model?,
11218 object: value.object?,
11219 related_questions: value.related_questions?,
11220 search_results: value.search_results?,
11221 usage: value.usage?,
11222 })
11223 }
11224 }
11225 impl ::std::convert::From<super::CompletionResponse> for CompletionResponse {
11226 fn from(value: super::CompletionResponse) -> Self {
11227 Self {
11228 choices: Ok(value.choices),
11229 citations: Ok(value.citations),
11230 created: Ok(value.created),
11231 id: Ok(value.id),
11232 images: Ok(value.images),
11233 model: Ok(value.model),
11234 object: Ok(value.object),
11235 related_questions: Ok(value.related_questions),
11236 search_results: Ok(value.search_results),
11237 usage: Ok(value.usage),
11238 }
11239 }
11240 }
11241 #[derive(Clone, Debug)]
11242 pub struct CompletionResponseChoicesItem {
11243 delta: ::std::result::Result<
11244 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
11245 ::std::string::String,
11246 >,
11247 finish_reason: ::std::result::Result<
11248 ::std::option::Option<super::CompletionResponseChoicesItemFinishReason>,
11249 ::std::string::String,
11250 >,
11251 index: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
11252 message: ::std::result::Result<
11253 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
11254 ::std::string::String,
11255 >,
11256 }
11257 impl ::std::default::Default for CompletionResponseChoicesItem {
11258 fn default() -> Self {
11259 Self {
11260 delta: Ok(Default::default()),
11261 finish_reason: Ok(Default::default()),
11262 index: Ok(Default::default()),
11263 message: Ok(Default::default()),
11264 }
11265 }
11266 }
11267 impl CompletionResponseChoicesItem {
11268 pub fn delta<T>(mut self, value: T) -> Self
11269 where
11270 T: ::std::convert::TryInto<
11271 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
11272 >,
11273 T::Error: ::std::fmt::Display,
11274 {
11275 self.delta = value
11276 .try_into()
11277 .map_err(|e| format!("error converting supplied value for delta: {e}"));
11278 self
11279 }
11280 pub fn finish_reason<T>(mut self, value: T) -> Self
11281 where
11282 T: ::std::convert::TryInto<
11283 ::std::option::Option<super::CompletionResponseChoicesItemFinishReason>,
11284 >,
11285 T::Error: ::std::fmt::Display,
11286 {
11287 self.finish_reason = value
11288 .try_into()
11289 .map_err(|e| {
11290 format!("error converting supplied value for finish_reason: {e}")
11291 });
11292 self
11293 }
11294 pub fn index<T>(mut self, value: T) -> Self
11295 where
11296 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11297 T::Error: ::std::fmt::Display,
11298 {
11299 self.index = value
11300 .try_into()
11301 .map_err(|e| format!("error converting supplied value for index: {e}"));
11302 self
11303 }
11304 pub fn message<T>(mut self, value: T) -> Self
11305 where
11306 T: ::std::convert::TryInto<
11307 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
11308 >,
11309 T::Error: ::std::fmt::Display,
11310 {
11311 self.message = value
11312 .try_into()
11313 .map_err(|e| {
11314 format!("error converting supplied value for message: {e}")
11315 });
11316 self
11317 }
11318 }
11319 impl ::std::convert::TryFrom<CompletionResponseChoicesItem>
11320 for super::CompletionResponseChoicesItem {
11321 type Error = super::error::ConversionError;
11322 fn try_from(
11323 value: CompletionResponseChoicesItem,
11324 ) -> ::std::result::Result<Self, super::error::ConversionError> {
11325 Ok(Self {
11326 delta: value.delta?,
11327 finish_reason: value.finish_reason?,
11328 index: value.index?,
11329 message: value.message?,
11330 })
11331 }
11332 }
11333 impl ::std::convert::From<super::CompletionResponseChoicesItem>
11334 for CompletionResponseChoicesItem {
11335 fn from(value: super::CompletionResponseChoicesItem) -> Self {
11336 Self {
11337 delta: Ok(value.delta),
11338 finish_reason: Ok(value.finish_reason),
11339 index: Ok(value.index),
11340 message: Ok(value.message),
11341 }
11342 }
11343 }
11344 #[derive(Clone, Debug)]
11345 pub struct CompletionResponseImagesItem {
11346 height: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
11347 image_url: ::std::result::Result<
11348 ::std::option::Option<::std::string::String>,
11349 ::std::string::String,
11350 >,
11351 origin_url: ::std::result::Result<
11352 ::std::option::Option<::std::string::String>,
11353 ::std::string::String,
11354 >,
11355 title: ::std::result::Result<
11356 ::std::option::Option<::std::string::String>,
11357 ::std::string::String,
11358 >,
11359 width: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
11360 }
11361 impl ::std::default::Default for CompletionResponseImagesItem {
11362 fn default() -> Self {
11363 Self {
11364 height: Ok(Default::default()),
11365 image_url: Ok(Default::default()),
11366 origin_url: Ok(Default::default()),
11367 title: Ok(Default::default()),
11368 width: Ok(Default::default()),
11369 }
11370 }
11371 }
11372 impl CompletionResponseImagesItem {
11373 pub fn height<T>(mut self, value: T) -> Self
11374 where
11375 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11376 T::Error: ::std::fmt::Display,
11377 {
11378 self.height = value
11379 .try_into()
11380 .map_err(|e| format!("error converting supplied value for height: {e}"));
11381 self
11382 }
11383 pub fn image_url<T>(mut self, value: T) -> Self
11384 where
11385 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11386 T::Error: ::std::fmt::Display,
11387 {
11388 self.image_url = value
11389 .try_into()
11390 .map_err(|e| {
11391 format!("error converting supplied value for image_url: {e}")
11392 });
11393 self
11394 }
11395 pub fn origin_url<T>(mut self, value: T) -> Self
11396 where
11397 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11398 T::Error: ::std::fmt::Display,
11399 {
11400 self.origin_url = value
11401 .try_into()
11402 .map_err(|e| {
11403 format!("error converting supplied value for origin_url: {e}")
11404 });
11405 self
11406 }
11407 pub fn title<T>(mut self, value: T) -> Self
11408 where
11409 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11410 T::Error: ::std::fmt::Display,
11411 {
11412 self.title = value
11413 .try_into()
11414 .map_err(|e| format!("error converting supplied value for title: {e}"));
11415 self
11416 }
11417 pub fn width<T>(mut self, value: T) -> Self
11418 where
11419 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11420 T::Error: ::std::fmt::Display,
11421 {
11422 self.width = value
11423 .try_into()
11424 .map_err(|e| format!("error converting supplied value for width: {e}"));
11425 self
11426 }
11427 }
11428 impl ::std::convert::TryFrom<CompletionResponseImagesItem>
11429 for super::CompletionResponseImagesItem {
11430 type Error = super::error::ConversionError;
11431 fn try_from(
11432 value: CompletionResponseImagesItem,
11433 ) -> ::std::result::Result<Self, super::error::ConversionError> {
11434 Ok(Self {
11435 height: value.height?,
11436 image_url: value.image_url?,
11437 origin_url: value.origin_url?,
11438 title: value.title?,
11439 width: value.width?,
11440 })
11441 }
11442 }
11443 impl ::std::convert::From<super::CompletionResponseImagesItem>
11444 for CompletionResponseImagesItem {
11445 fn from(value: super::CompletionResponseImagesItem) -> Self {
11446 Self {
11447 height: Ok(value.height),
11448 image_url: Ok(value.image_url),
11449 origin_url: Ok(value.origin_url),
11450 title: Ok(value.title),
11451 width: Ok(value.width),
11452 }
11453 }
11454 }
11455 #[derive(Clone, Debug)]
11456 pub struct CompletionResponseSearchResultsItem {
11457 date: ::std::result::Result<
11458 ::std::option::Option<::std::string::String>,
11459 ::std::string::String,
11460 >,
11461 last_updated: ::std::result::Result<
11462 ::std::option::Option<::std::string::String>,
11463 ::std::string::String,
11464 >,
11465 snippet: ::std::result::Result<
11466 ::std::option::Option<::std::string::String>,
11467 ::std::string::String,
11468 >,
11469 source: ::std::result::Result<
11470 ::std::option::Option<super::CompletionResponseSearchResultsItemSource>,
11471 ::std::string::String,
11472 >,
11473 title: ::std::result::Result<
11474 ::std::option::Option<::std::string::String>,
11475 ::std::string::String,
11476 >,
11477 url: ::std::result::Result<
11478 ::std::option::Option<::std::string::String>,
11479 ::std::string::String,
11480 >,
11481 }
11482 impl ::std::default::Default for CompletionResponseSearchResultsItem {
11483 fn default() -> Self {
11484 Self {
11485 date: Ok(Default::default()),
11486 last_updated: Ok(Default::default()),
11487 snippet: Ok(Default::default()),
11488 source: Ok(Default::default()),
11489 title: Ok(Default::default()),
11490 url: Ok(Default::default()),
11491 }
11492 }
11493 }
11494 impl CompletionResponseSearchResultsItem {
11495 pub fn date<T>(mut self, value: T) -> Self
11496 where
11497 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11498 T::Error: ::std::fmt::Display,
11499 {
11500 self.date = value
11501 .try_into()
11502 .map_err(|e| format!("error converting supplied value for date: {e}"));
11503 self
11504 }
11505 pub fn last_updated<T>(mut self, value: T) -> Self
11506 where
11507 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11508 T::Error: ::std::fmt::Display,
11509 {
11510 self.last_updated = value
11511 .try_into()
11512 .map_err(|e| {
11513 format!("error converting supplied value for last_updated: {e}")
11514 });
11515 self
11516 }
11517 pub fn snippet<T>(mut self, value: T) -> Self
11518 where
11519 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11520 T::Error: ::std::fmt::Display,
11521 {
11522 self.snippet = value
11523 .try_into()
11524 .map_err(|e| {
11525 format!("error converting supplied value for snippet: {e}")
11526 });
11527 self
11528 }
11529 pub fn source<T>(mut self, value: T) -> Self
11530 where
11531 T: ::std::convert::TryInto<
11532 ::std::option::Option<super::CompletionResponseSearchResultsItemSource>,
11533 >,
11534 T::Error: ::std::fmt::Display,
11535 {
11536 self.source = value
11537 .try_into()
11538 .map_err(|e| format!("error converting supplied value for source: {e}"));
11539 self
11540 }
11541 pub fn title<T>(mut self, value: T) -> Self
11542 where
11543 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11544 T::Error: ::std::fmt::Display,
11545 {
11546 self.title = value
11547 .try_into()
11548 .map_err(|e| format!("error converting supplied value for title: {e}"));
11549 self
11550 }
11551 pub fn url<T>(mut self, value: T) -> Self
11552 where
11553 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11554 T::Error: ::std::fmt::Display,
11555 {
11556 self.url = value
11557 .try_into()
11558 .map_err(|e| format!("error converting supplied value for url: {e}"));
11559 self
11560 }
11561 }
11562 impl ::std::convert::TryFrom<CompletionResponseSearchResultsItem>
11563 for super::CompletionResponseSearchResultsItem {
11564 type Error = super::error::ConversionError;
11565 fn try_from(
11566 value: CompletionResponseSearchResultsItem,
11567 ) -> ::std::result::Result<Self, super::error::ConversionError> {
11568 Ok(Self {
11569 date: value.date?,
11570 last_updated: value.last_updated?,
11571 snippet: value.snippet?,
11572 source: value.source?,
11573 title: value.title?,
11574 url: value.url?,
11575 })
11576 }
11577 }
11578 impl ::std::convert::From<super::CompletionResponseSearchResultsItem>
11579 for CompletionResponseSearchResultsItem {
11580 fn from(value: super::CompletionResponseSearchResultsItem) -> Self {
11581 Self {
11582 date: Ok(value.date),
11583 last_updated: Ok(value.last_updated),
11584 snippet: Ok(value.snippet),
11585 source: Ok(value.source),
11586 title: Ok(value.title),
11587 url: Ok(value.url),
11588 }
11589 }
11590 }
11591 #[derive(Clone, Debug)]
11592 pub struct Output {
11593 completed_at: ::std::result::Result<
11594 ::std::option::Option<i64>,
11595 ::std::string::String,
11596 >,
11597 created_at: ::std::result::Result<
11598 ::std::option::Option<i64>,
11599 ::std::string::String,
11600 >,
11601 detail: ::std::result::Result<
11602 ::std::vec::Vec<super::OutputDetailItem>,
11603 ::std::string::String,
11604 >,
11605 error: ::std::result::Result<
11606 ::std::option::Option<super::OutputError>,
11607 ::std::string::String,
11608 >,
11609 error_message: ::std::result::Result<
11610 ::std::option::Option<::std::string::String>,
11611 ::std::string::String,
11612 >,
11613 failed_at: ::std::result::Result<
11614 ::std::option::Option<i64>,
11615 ::std::string::String,
11616 >,
11617 id: ::std::result::Result<
11618 ::std::option::Option<::std::string::String>,
11619 ::std::string::String,
11620 >,
11621 model: ::std::result::Result<
11622 ::std::option::Option<::std::string::String>,
11623 ::std::string::String,
11624 >,
11625 response: ::std::result::Result<
11626 ::std::option::Option<super::CompletionResponse>,
11627 ::std::string::String,
11628 >,
11629 started_at: ::std::result::Result<
11630 ::std::option::Option<i64>,
11631 ::std::string::String,
11632 >,
11633 status: ::std::result::Result<
11634 ::std::option::Option<super::OutputStatus>,
11635 ::std::string::String,
11636 >,
11637 }
11638 impl ::std::default::Default for Output {
11639 fn default() -> Self {
11640 Self {
11641 completed_at: Ok(Default::default()),
11642 created_at: Ok(Default::default()),
11643 detail: Ok(Default::default()),
11644 error: Ok(Default::default()),
11645 error_message: Ok(Default::default()),
11646 failed_at: Ok(Default::default()),
11647 id: Ok(Default::default()),
11648 model: Ok(Default::default()),
11649 response: Ok(Default::default()),
11650 started_at: Ok(Default::default()),
11651 status: Ok(Default::default()),
11652 }
11653 }
11654 }
11655 impl Output {
11656 pub fn completed_at<T>(mut self, value: T) -> Self
11657 where
11658 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11659 T::Error: ::std::fmt::Display,
11660 {
11661 self.completed_at = value
11662 .try_into()
11663 .map_err(|e| {
11664 format!("error converting supplied value for completed_at: {e}")
11665 });
11666 self
11667 }
11668 pub fn created_at<T>(mut self, value: T) -> Self
11669 where
11670 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11671 T::Error: ::std::fmt::Display,
11672 {
11673 self.created_at = value
11674 .try_into()
11675 .map_err(|e| {
11676 format!("error converting supplied value for created_at: {e}")
11677 });
11678 self
11679 }
11680 pub fn detail<T>(mut self, value: T) -> Self
11681 where
11682 T: ::std::convert::TryInto<::std::vec::Vec<super::OutputDetailItem>>,
11683 T::Error: ::std::fmt::Display,
11684 {
11685 self.detail = value
11686 .try_into()
11687 .map_err(|e| format!("error converting supplied value for detail: {e}"));
11688 self
11689 }
11690 pub fn error<T>(mut self, value: T) -> Self
11691 where
11692 T: ::std::convert::TryInto<::std::option::Option<super::OutputError>>,
11693 T::Error: ::std::fmt::Display,
11694 {
11695 self.error = value
11696 .try_into()
11697 .map_err(|e| format!("error converting supplied value for error: {e}"));
11698 self
11699 }
11700 pub fn error_message<T>(mut self, value: T) -> Self
11701 where
11702 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11703 T::Error: ::std::fmt::Display,
11704 {
11705 self.error_message = value
11706 .try_into()
11707 .map_err(|e| {
11708 format!("error converting supplied value for error_message: {e}")
11709 });
11710 self
11711 }
11712 pub fn failed_at<T>(mut self, value: T) -> Self
11713 where
11714 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11715 T::Error: ::std::fmt::Display,
11716 {
11717 self.failed_at = value
11718 .try_into()
11719 .map_err(|e| {
11720 format!("error converting supplied value for failed_at: {e}")
11721 });
11722 self
11723 }
11724 pub fn id<T>(mut self, value: T) -> Self
11725 where
11726 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11727 T::Error: ::std::fmt::Display,
11728 {
11729 self.id = value
11730 .try_into()
11731 .map_err(|e| format!("error converting supplied value for id: {e}"));
11732 self
11733 }
11734 pub fn model<T>(mut self, value: T) -> Self
11735 where
11736 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11737 T::Error: ::std::fmt::Display,
11738 {
11739 self.model = value
11740 .try_into()
11741 .map_err(|e| format!("error converting supplied value for model: {e}"));
11742 self
11743 }
11744 pub fn response<T>(mut self, value: T) -> Self
11745 where
11746 T: ::std::convert::TryInto<::std::option::Option<super::CompletionResponse>>,
11747 T::Error: ::std::fmt::Display,
11748 {
11749 self.response = value
11750 .try_into()
11751 .map_err(|e| {
11752 format!("error converting supplied value for response: {e}")
11753 });
11754 self
11755 }
11756 pub fn started_at<T>(mut self, value: T) -> Self
11757 where
11758 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11759 T::Error: ::std::fmt::Display,
11760 {
11761 self.started_at = value
11762 .try_into()
11763 .map_err(|e| {
11764 format!("error converting supplied value for started_at: {e}")
11765 });
11766 self
11767 }
11768 pub fn status<T>(mut self, value: T) -> Self
11769 where
11770 T: ::std::convert::TryInto<::std::option::Option<super::OutputStatus>>,
11771 T::Error: ::std::fmt::Display,
11772 {
11773 self.status = value
11774 .try_into()
11775 .map_err(|e| format!("error converting supplied value for status: {e}"));
11776 self
11777 }
11778 }
11779 impl ::std::convert::TryFrom<Output> for super::Output {
11780 type Error = super::error::ConversionError;
11781 fn try_from(
11782 value: Output,
11783 ) -> ::std::result::Result<Self, super::error::ConversionError> {
11784 Ok(Self {
11785 completed_at: value.completed_at?,
11786 created_at: value.created_at?,
11787 detail: value.detail?,
11788 error: value.error?,
11789 error_message: value.error_message?,
11790 failed_at: value.failed_at?,
11791 id: value.id?,
11792 model: value.model?,
11793 response: value.response?,
11794 started_at: value.started_at?,
11795 status: value.status?,
11796 })
11797 }
11798 }
11799 impl ::std::convert::From<super::Output> for Output {
11800 fn from(value: super::Output) -> Self {
11801 Self {
11802 completed_at: Ok(value.completed_at),
11803 created_at: Ok(value.created_at),
11804 detail: Ok(value.detail),
11805 error: Ok(value.error),
11806 error_message: Ok(value.error_message),
11807 failed_at: Ok(value.failed_at),
11808 id: Ok(value.id),
11809 model: Ok(value.model),
11810 response: Ok(value.response),
11811 started_at: Ok(value.started_at),
11812 status: Ok(value.status),
11813 }
11814 }
11815 }
11816 #[derive(Clone, Debug)]
11817 pub struct OutputDetailItem {
11818 loc: ::std::result::Result<
11819 ::std::vec::Vec<::std::string::String>,
11820 ::std::string::String,
11821 >,
11822 msg: ::std::result::Result<
11823 ::std::option::Option<::std::string::String>,
11824 ::std::string::String,
11825 >,
11826 type_: ::std::result::Result<
11827 ::std::option::Option<::std::string::String>,
11828 ::std::string::String,
11829 >,
11830 }
11831 impl ::std::default::Default for OutputDetailItem {
11832 fn default() -> Self {
11833 Self {
11834 loc: Ok(Default::default()),
11835 msg: Ok(Default::default()),
11836 type_: Ok(Default::default()),
11837 }
11838 }
11839 }
11840 impl OutputDetailItem {
11841 pub fn loc<T>(mut self, value: T) -> Self
11842 where
11843 T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
11844 T::Error: ::std::fmt::Display,
11845 {
11846 self.loc = value
11847 .try_into()
11848 .map_err(|e| format!("error converting supplied value for loc: {e}"));
11849 self
11850 }
11851 pub fn msg<T>(mut self, value: T) -> Self
11852 where
11853 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11854 T::Error: ::std::fmt::Display,
11855 {
11856 self.msg = value
11857 .try_into()
11858 .map_err(|e| format!("error converting supplied value for msg: {e}"));
11859 self
11860 }
11861 pub fn type_<T>(mut self, value: T) -> Self
11862 where
11863 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11864 T::Error: ::std::fmt::Display,
11865 {
11866 self.type_ = value
11867 .try_into()
11868 .map_err(|e| format!("error converting supplied value for type_: {e}"));
11869 self
11870 }
11871 }
11872 impl ::std::convert::TryFrom<OutputDetailItem> for super::OutputDetailItem {
11873 type Error = super::error::ConversionError;
11874 fn try_from(
11875 value: OutputDetailItem,
11876 ) -> ::std::result::Result<Self, super::error::ConversionError> {
11877 Ok(Self {
11878 loc: value.loc?,
11879 msg: value.msg?,
11880 type_: value.type_?,
11881 })
11882 }
11883 }
11884 impl ::std::convert::From<super::OutputDetailItem> for OutputDetailItem {
11885 fn from(value: super::OutputDetailItem) -> Self {
11886 Self {
11887 loc: Ok(value.loc),
11888 msg: Ok(value.msg),
11889 type_: Ok(value.type_),
11890 }
11891 }
11892 }
11893 #[derive(Clone, Debug)]
11894 pub struct OutputError {
11895 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
11896 message: ::std::result::Result<
11897 ::std::option::Option<::std::string::String>,
11898 ::std::string::String,
11899 >,
11900 type_: ::std::result::Result<
11901 ::std::option::Option<::std::string::String>,
11902 ::std::string::String,
11903 >,
11904 }
11905 impl ::std::default::Default for OutputError {
11906 fn default() -> Self {
11907 Self {
11908 code: Ok(Default::default()),
11909 message: Ok(Default::default()),
11910 type_: Ok(Default::default()),
11911 }
11912 }
11913 }
11914 impl OutputError {
11915 pub fn code<T>(mut self, value: T) -> Self
11916 where
11917 T: ::std::convert::TryInto<::std::option::Option<i64>>,
11918 T::Error: ::std::fmt::Display,
11919 {
11920 self.code = value
11921 .try_into()
11922 .map_err(|e| format!("error converting supplied value for code: {e}"));
11923 self
11924 }
11925 pub fn message<T>(mut self, value: T) -> Self
11926 where
11927 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11928 T::Error: ::std::fmt::Display,
11929 {
11930 self.message = value
11931 .try_into()
11932 .map_err(|e| {
11933 format!("error converting supplied value for message: {e}")
11934 });
11935 self
11936 }
11937 pub fn type_<T>(mut self, value: T) -> Self
11938 where
11939 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
11940 T::Error: ::std::fmt::Display,
11941 {
11942 self.type_ = value
11943 .try_into()
11944 .map_err(|e| format!("error converting supplied value for type_: {e}"));
11945 self
11946 }
11947 }
11948 impl ::std::convert::TryFrom<OutputError> for super::OutputError {
11949 type Error = super::error::ConversionError;
11950 fn try_from(
11951 value: OutputError,
11952 ) -> ::std::result::Result<Self, super::error::ConversionError> {
11953 Ok(Self {
11954 code: value.code?,
11955 message: value.message?,
11956 type_: value.type_?,
11957 })
11958 }
11959 }
11960 impl ::std::convert::From<super::OutputError> for OutputError {
11961 fn from(value: super::OutputError) -> Self {
11962 Self {
11963 code: Ok(value.code),
11964 message: Ok(value.message),
11965 type_: Ok(value.type_),
11966 }
11967 }
11968 }
11969}
11970pub mod error {
11972 pub struct ConversionError(::std::borrow::Cow<'static, str>);
11974 impl ::std::error::Error for ConversionError {}
11975 impl ::std::fmt::Display for ConversionError {
11976 fn fmt(
11977 &self,
11978 f: &mut ::std::fmt::Formatter<'_>,
11979 ) -> Result<(), ::std::fmt::Error> {
11980 ::std::fmt::Display::fmt(&self.0, f)
11981 }
11982 }
11983 impl ::std::fmt::Debug for ConversionError {
11984 fn fmt(
11985 &self,
11986 f: &mut ::std::fmt::Formatter<'_>,
11987 ) -> Result<(), ::std::fmt::Error> {
11988 ::std::fmt::Debug::fmt(&self.0, f)
11989 }
11990 }
11991 impl From<&'static str> for ConversionError {
11992 fn from(value: &'static str) -> Self {
11993 Self(value.into())
11994 }
11995 }
11996 impl From<String> for ConversionError {
11997 fn from(value: String) -> Self {
11998 Self(value.into())
11999 }
12000 }
12001}
12002
12003}
12004
12005 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "idempotency_key", part: ::one::Part::Body, key: Some("idempotency_key") }, ::one::Route { field: "request", part: ::one::Part::Body, key: Some("request") }], required_parts: &[::one::Part::Body] };
12007
12008 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
12083 ::std::result::Result::Ok(Operation::action("conn_mod_def::GJ6CZhlw03k::e46CEqjNTEqKVz-hX2SWUQ", Method::POST, "/async/sonar").with_routed(&input, &ROUTING)?
12084 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
12085 }
12086
12087 impl IntoOperation for Input {
12088 type Output = output::Output;
12089
12090 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
12091 build(self)
12092 }
12093 }
12094 impl IntoOperation for builder::Input {
12095 type Output = output::Output;
12096
12097 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
12098 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
12099 }
12100 }
12101 impl ::std::convert::TryFrom<builder::Message> for ::std::option::Option<Message> {
12102 type Error = <Message as ::std::convert::TryFrom<builder::Message>>::Error;
12103
12104 fn try_from(value: builder::Message) -> ::std::result::Result<Self, Self::Error> {
12105 Message::try_from(value).map(Some)
12106 }
12107 }
12108 impl ::std::convert::TryFrom<builder::RequestPayload> for ::std::option::Option<RequestPayload> {
12109 type Error = <RequestPayload as ::std::convert::TryFrom<builder::RequestPayload>>::Error;
12110
12111 fn try_from(value: builder::RequestPayload) -> ::std::result::Result<Self, Self::Error> {
12112 RequestPayload::try_from(value).map(Some)
12113 }
12114 }
12115 impl ::std::convert::TryFrom<builder::RequestPayloadWebSearchOptions> for ::std::option::Option<RequestPayloadWebSearchOptions> {
12116 type Error = <RequestPayloadWebSearchOptions as ::std::convert::TryFrom<builder::RequestPayloadWebSearchOptions>>::Error;
12117
12118 fn try_from(value: builder::RequestPayloadWebSearchOptions) -> ::std::result::Result<Self, Self::Error> {
12119 RequestPayloadWebSearchOptions::try_from(value).map(Some)
12120 }
12121 }
12122}
12123pub fn create_async_chat_completion_sonar() -> create_async_chat_completion_sonar::builder::Input {
12125 create_async_chat_completion_sonar::builder::Input::default()
12126}
12127pub mod download_file_content {
12128 use ::one::{Error, IntoOperation, Method, Operation};
12129#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
12131#[serde(deny_unknown_fields)]
12132pub struct Input {
12133 #[serde(rename = "fileId")]
12135 pub file_id: InputFileId,
12136}
12137impl Input {
12138 pub fn builder() -> builder::Input {
12139 Default::default()
12140 }
12141}
12142#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12144#[serde(transparent)]
12145pub struct InputFileId(::std::string::String);
12146impl ::std::ops::Deref for InputFileId {
12147 type Target = ::std::string::String;
12148 fn deref(&self) -> &::std::string::String {
12149 &self.0
12150 }
12151}
12152impl ::std::convert::From<InputFileId> for ::std::string::String {
12153 fn from(value: InputFileId) -> Self {
12154 value.0
12155 }
12156}
12157impl ::std::str::FromStr for InputFileId {
12158 type Err = self::error::ConversionError;
12159 fn from_str(
12160 value: &str,
12161 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12162 ::std::convert::TryFrom::try_from(value)
12163 }
12164}
12165impl ::std::convert::TryFrom<&str> for InputFileId {
12166 type Error = self::error::ConversionError;
12167 fn try_from(
12168 value: &str,
12169 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12170 if value.chars().count() < 1usize {
12171 return Err("shorter than 1 characters".into());
12172 }
12173 static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(||
12174 { ::regress::Regex::with_flags("^file_.+", "u").unwrap() });
12175 if PATTERN.find(value).is_none() {
12176 return Err("doesn't match pattern \"^file_.+\"".into());
12177 }
12178 Ok(Self(value.to_string()))
12179 }
12180}
12181impl ::std::convert::TryFrom<::std::string::String> for InputFileId {
12182 type Error = self::error::ConversionError;
12183 fn try_from(
12184 value: ::std::string::String,
12185 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12186 ::std::convert::TryFrom::try_from(value.as_str())
12187 }
12188}
12189impl<'de> ::serde::Deserialize<'de> for InputFileId {
12190 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
12191 where
12192 D: ::serde::Deserializer<'de>,
12193 {
12194 ::std::convert::TryFrom::try_from(
12195 ::std::string::String::deserialize(deserializer)?,
12196 )
12197 .map_err(|e: self::error::ConversionError| {
12198 <D::Error as ::serde::de::Error>::custom(e.to_string())
12199 })
12200 }
12201}
12202pub mod builder {
12204 #[derive(Clone, Debug)]
12205 pub struct Input {
12206 file_id: ::std::result::Result<super::InputFileId, ::std::string::String>,
12207 }
12208 impl ::std::default::Default for Input {
12209 fn default() -> Self {
12210 Self {
12211 file_id: Err("no value supplied for file_id".to_string()),
12212 }
12213 }
12214 }
12215 impl Input {
12216 pub fn file_id<T>(mut self, value: T) -> Self
12217 where
12218 T: ::std::convert::TryInto<super::InputFileId>,
12219 T::Error: ::std::fmt::Display,
12220 {
12221 self.file_id = value
12222 .try_into()
12223 .map_err(|e| {
12224 format!("error converting supplied value for file_id: {e}")
12225 });
12226 self
12227 }
12228 }
12229 impl ::std::convert::TryFrom<Input> for super::Input {
12230 type Error = super::error::ConversionError;
12231 fn try_from(
12232 value: Input,
12233 ) -> ::std::result::Result<Self, super::error::ConversionError> {
12234 Ok(Self { file_id: value.file_id? })
12235 }
12236 }
12237 impl ::std::convert::From<super::Input> for Input {
12238 fn from(value: super::Input) -> Self {
12239 Self { file_id: Ok(value.file_id) }
12240 }
12241 }
12242}
12243pub mod error {
12245 pub struct ConversionError(::std::borrow::Cow<'static, str>);
12247 impl ::std::error::Error for ConversionError {}
12248 impl ::std::fmt::Display for ConversionError {
12249 fn fmt(
12250 &self,
12251 f: &mut ::std::fmt::Formatter<'_>,
12252 ) -> Result<(), ::std::fmt::Error> {
12253 ::std::fmt::Display::fmt(&self.0, f)
12254 }
12255 }
12256 impl ::std::fmt::Debug for ConversionError {
12257 fn fmt(
12258 &self,
12259 f: &mut ::std::fmt::Formatter<'_>,
12260 ) -> Result<(), ::std::fmt::Error> {
12261 ::std::fmt::Debug::fmt(&self.0, f)
12262 }
12263 }
12264 impl From<&'static str> for ConversionError {
12265 fn from(value: &'static str) -> Self {
12266 Self(value.into())
12267 }
12268 }
12269 impl From<String> for ConversionError {
12270 fn from(value: String) -> Self {
12271 Self(value.into())
12272 }
12273 }
12274}
12275
12276pub mod output {
12277#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
12279pub struct ErrorResponseError {
12280 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12282 pub code: ::std::option::Option<i64>,
12283 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12285 pub message: ::std::option::Option<::std::string::String>,
12286 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12288 pub param: ::std::option::Option<::std::string::String>,
12289 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
12291 pub type_: ::std::option::Option<::std::string::String>,
12292}
12293impl ErrorResponseError {
12294 pub fn builder() -> builder::ErrorResponseError {
12295 Default::default()
12296 }
12297}
12298#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
12300#[serde(untagged)]
12301pub enum Output {
12302 Variant0(::std::string::String),
12303 Variant1 {
12304 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12305 error: ::std::option::Option<ErrorResponseError>,
12306 },
12307}
12308pub mod builder {
12310 #[derive(Clone, Debug)]
12311 pub struct ErrorResponseError {
12312 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
12313 message: ::std::result::Result<
12314 ::std::option::Option<::std::string::String>,
12315 ::std::string::String,
12316 >,
12317 param: ::std::result::Result<
12318 ::std::option::Option<::std::string::String>,
12319 ::std::string::String,
12320 >,
12321 type_: ::std::result::Result<
12322 ::std::option::Option<::std::string::String>,
12323 ::std::string::String,
12324 >,
12325 }
12326 impl ::std::default::Default for ErrorResponseError {
12327 fn default() -> Self {
12328 Self {
12329 code: Ok(Default::default()),
12330 message: Ok(Default::default()),
12331 param: Ok(Default::default()),
12332 type_: Ok(Default::default()),
12333 }
12334 }
12335 }
12336 impl ErrorResponseError {
12337 pub fn code<T>(mut self, value: T) -> Self
12338 where
12339 T: ::std::convert::TryInto<::std::option::Option<i64>>,
12340 T::Error: ::std::fmt::Display,
12341 {
12342 self.code = value
12343 .try_into()
12344 .map_err(|e| format!("error converting supplied value for code: {e}"));
12345 self
12346 }
12347 pub fn message<T>(mut self, value: T) -> Self
12348 where
12349 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
12350 T::Error: ::std::fmt::Display,
12351 {
12352 self.message = value
12353 .try_into()
12354 .map_err(|e| {
12355 format!("error converting supplied value for message: {e}")
12356 });
12357 self
12358 }
12359 pub fn param<T>(mut self, value: T) -> Self
12360 where
12361 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
12362 T::Error: ::std::fmt::Display,
12363 {
12364 self.param = value
12365 .try_into()
12366 .map_err(|e| format!("error converting supplied value for param: {e}"));
12367 self
12368 }
12369 pub fn type_<T>(mut self, value: T) -> Self
12370 where
12371 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
12372 T::Error: ::std::fmt::Display,
12373 {
12374 self.type_ = value
12375 .try_into()
12376 .map_err(|e| format!("error converting supplied value for type_: {e}"));
12377 self
12378 }
12379 }
12380 impl ::std::convert::TryFrom<ErrorResponseError> for super::ErrorResponseError {
12381 type Error = super::error::ConversionError;
12382 fn try_from(
12383 value: ErrorResponseError,
12384 ) -> ::std::result::Result<Self, super::error::ConversionError> {
12385 Ok(Self {
12386 code: value.code?,
12387 message: value.message?,
12388 param: value.param?,
12389 type_: value.type_?,
12390 })
12391 }
12392 }
12393 impl ::std::convert::From<super::ErrorResponseError> for ErrorResponseError {
12394 fn from(value: super::ErrorResponseError) -> Self {
12395 Self {
12396 code: Ok(value.code),
12397 message: Ok(value.message),
12398 param: Ok(value.param),
12399 type_: Ok(value.type_),
12400 }
12401 }
12402 }
12403}
12404pub mod error {
12406 pub struct ConversionError(::std::borrow::Cow<'static, str>);
12408 impl ::std::error::Error for ConversionError {}
12409 impl ::std::fmt::Display for ConversionError {
12410 fn fmt(
12411 &self,
12412 f: &mut ::std::fmt::Formatter<'_>,
12413 ) -> Result<(), ::std::fmt::Error> {
12414 ::std::fmt::Display::fmt(&self.0, f)
12415 }
12416 }
12417 impl ::std::fmt::Debug for ConversionError {
12418 fn fmt(
12419 &self,
12420 f: &mut ::std::fmt::Formatter<'_>,
12421 ) -> Result<(), ::std::fmt::Error> {
12422 ::std::fmt::Debug::fmt(&self.0, f)
12423 }
12424 }
12425 impl From<&'static str> for ConversionError {
12426 fn from(value: &'static str) -> Self {
12427 Self(value.into())
12428 }
12429 }
12430 impl From<String> for ConversionError {
12431 fn from(value: String) -> Self {
12432 Self(value.into())
12433 }
12434 }
12435}
12436
12437}
12438
12439 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "fileId", part: ::one::Part::Path, key: Some("fileId") }], required_parts: &[::one::Part::Path] };
12441
12442 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
12451 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4Cvj6LtA::4dW3DoZhRoiAdi4PgsFkow", Method::GET, "/v1/files/{{fileId}}/content").with_routed(&input, &ROUTING)?
12452 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/octet-stream\"}").map_err(Error::Decode)?).returns::<output::Output>())
12453 }
12454
12455 impl IntoOperation for Input {
12456 type Output = output::Output;
12457
12458 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
12459 build(self)
12460 }
12461 }
12462 impl IntoOperation for builder::Input {
12463 type Output = output::Output;
12464
12465 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
12466 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
12467 }
12468 }
12469}
12470pub fn download_file_content() -> download_file_content::builder::Input {
12472 download_file_content::builder::Input::default()
12473}
12474pub mod delete_file {
12475 use ::one::{Error, IntoOperation, Method, Operation};
12476#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
12478#[serde(deny_unknown_fields)]
12479pub struct Input {
12480 #[serde(rename = "fileId")]
12482 pub file_id: InputFileId,
12483}
12484impl Input {
12485 pub fn builder() -> builder::Input {
12486 Default::default()
12487 }
12488}
12489#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12491#[serde(transparent)]
12492pub struct InputFileId(::std::string::String);
12493impl ::std::ops::Deref for InputFileId {
12494 type Target = ::std::string::String;
12495 fn deref(&self) -> &::std::string::String {
12496 &self.0
12497 }
12498}
12499impl ::std::convert::From<InputFileId> for ::std::string::String {
12500 fn from(value: InputFileId) -> Self {
12501 value.0
12502 }
12503}
12504impl ::std::str::FromStr for InputFileId {
12505 type Err = self::error::ConversionError;
12506 fn from_str(
12507 value: &str,
12508 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12509 ::std::convert::TryFrom::try_from(value)
12510 }
12511}
12512impl ::std::convert::TryFrom<&str> for InputFileId {
12513 type Error = self::error::ConversionError;
12514 fn try_from(
12515 value: &str,
12516 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12517 if value.chars().count() < 1usize {
12518 return Err("shorter than 1 characters".into());
12519 }
12520 Ok(Self(value.to_string()))
12521 }
12522}
12523impl ::std::convert::TryFrom<::std::string::String> for InputFileId {
12524 type Error = self::error::ConversionError;
12525 fn try_from(
12526 value: ::std::string::String,
12527 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12528 ::std::convert::TryFrom::try_from(value.as_str())
12529 }
12530}
12531impl<'de> ::serde::Deserialize<'de> for InputFileId {
12532 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
12533 where
12534 D: ::serde::Deserializer<'de>,
12535 {
12536 ::std::convert::TryFrom::try_from(
12537 ::std::string::String::deserialize(deserializer)?,
12538 )
12539 .map_err(|e: self::error::ConversionError| {
12540 <D::Error as ::serde::de::Error>::custom(e.to_string())
12541 })
12542 }
12543}
12544pub mod builder {
12546 #[derive(Clone, Debug)]
12547 pub struct Input {
12548 file_id: ::std::result::Result<super::InputFileId, ::std::string::String>,
12549 }
12550 impl ::std::default::Default for Input {
12551 fn default() -> Self {
12552 Self {
12553 file_id: Err("no value supplied for file_id".to_string()),
12554 }
12555 }
12556 }
12557 impl Input {
12558 pub fn file_id<T>(mut self, value: T) -> Self
12559 where
12560 T: ::std::convert::TryInto<super::InputFileId>,
12561 T::Error: ::std::fmt::Display,
12562 {
12563 self.file_id = value
12564 .try_into()
12565 .map_err(|e| {
12566 format!("error converting supplied value for file_id: {e}")
12567 });
12568 self
12569 }
12570 }
12571 impl ::std::convert::TryFrom<Input> for super::Input {
12572 type Error = super::error::ConversionError;
12573 fn try_from(
12574 value: Input,
12575 ) -> ::std::result::Result<Self, super::error::ConversionError> {
12576 Ok(Self { file_id: value.file_id? })
12577 }
12578 }
12579 impl ::std::convert::From<super::Input> for Input {
12580 fn from(value: super::Input) -> Self {
12581 Self { file_id: Ok(value.file_id) }
12582 }
12583 }
12584}
12585pub mod error {
12587 pub struct ConversionError(::std::borrow::Cow<'static, str>);
12589 impl ::std::error::Error for ConversionError {}
12590 impl ::std::fmt::Display for ConversionError {
12591 fn fmt(
12592 &self,
12593 f: &mut ::std::fmt::Formatter<'_>,
12594 ) -> Result<(), ::std::fmt::Error> {
12595 ::std::fmt::Display::fmt(&self.0, f)
12596 }
12597 }
12598 impl ::std::fmt::Debug for ConversionError {
12599 fn fmt(
12600 &self,
12601 f: &mut ::std::fmt::Formatter<'_>,
12602 ) -> Result<(), ::std::fmt::Error> {
12603 ::std::fmt::Debug::fmt(&self.0, f)
12604 }
12605 }
12606 impl From<&'static str> for ConversionError {
12607 fn from(value: &'static str) -> Self {
12608 Self(value.into())
12609 }
12610 }
12611 impl From<String> for ConversionError {
12612 fn from(value: String) -> Self {
12613 Self(value.into())
12614 }
12615 }
12616}
12617
12618pub mod output {
12619#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
12621pub struct Error {
12622 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12624 pub code: ::std::option::Option<i64>,
12625 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12627 pub message: ::std::option::Option<::std::string::String>,
12628 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12630 pub param: ::std::option::Option<::std::string::String>,
12631 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
12633 pub type_: ::std::option::Option<::std::string::String>,
12634}
12635impl Error {
12636 pub fn builder() -> builder::Error {
12637 Default::default()
12638 }
12639}
12640#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
12642pub struct Output {
12643 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12645 pub deleted: ::std::option::Option<bool>,
12646 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12647 pub error: ::std::option::Option<Error>,
12648 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12650 pub id: ::std::option::Option<::std::string::String>,
12651 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
12653 pub object: ::std::option::Option<OutputObject>,
12654}
12655impl Output {
12656 pub fn builder() -> builder::Output {
12657 Default::default()
12658 }
12659}
12660#[derive(
12662 ::serde::Deserialize,
12663 ::serde::Serialize,
12664 Clone,
12665 Copy,
12666 Debug,
12667 Eq,
12668 Hash,
12669 Ord,
12670 PartialEq,
12671 PartialOrd
12672)]
12673pub enum OutputObject {
12674 #[serde(rename = "file")]
12675 File,
12676}
12677impl ::std::fmt::Display for OutputObject {
12678 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
12679 match *self {
12680 Self::File => f.write_str("file"),
12681 }
12682 }
12683}
12684impl ::std::str::FromStr for OutputObject {
12685 type Err = self::error::ConversionError;
12686 fn from_str(
12687 value: &str,
12688 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12689 match value {
12690 "file" => Ok(Self::File),
12691 _ => Err("invalid value".into()),
12692 }
12693 }
12694}
12695impl ::std::convert::TryFrom<&str> for OutputObject {
12696 type Error = self::error::ConversionError;
12697 fn try_from(
12698 value: &str,
12699 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12700 value.parse()
12701 }
12702}
12703impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
12704 type Error = self::error::ConversionError;
12705 fn try_from(
12706 value: ::std::string::String,
12707 ) -> ::std::result::Result<Self, self::error::ConversionError> {
12708 value.parse()
12709 }
12710}
12711pub mod builder {
12713 #[derive(Clone, Debug)]
12714 pub struct Error {
12715 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
12716 message: ::std::result::Result<
12717 ::std::option::Option<::std::string::String>,
12718 ::std::string::String,
12719 >,
12720 param: ::std::result::Result<
12721 ::std::option::Option<::std::string::String>,
12722 ::std::string::String,
12723 >,
12724 type_: ::std::result::Result<
12725 ::std::option::Option<::std::string::String>,
12726 ::std::string::String,
12727 >,
12728 }
12729 impl ::std::default::Default for Error {
12730 fn default() -> Self {
12731 Self {
12732 code: Ok(Default::default()),
12733 message: Ok(Default::default()),
12734 param: Ok(Default::default()),
12735 type_: Ok(Default::default()),
12736 }
12737 }
12738 }
12739 impl Error {
12740 pub fn code<T>(mut self, value: T) -> Self
12741 where
12742 T: ::std::convert::TryInto<::std::option::Option<i64>>,
12743 T::Error: ::std::fmt::Display,
12744 {
12745 self.code = value
12746 .try_into()
12747 .map_err(|e| format!("error converting supplied value for code: {e}"));
12748 self
12749 }
12750 pub fn message<T>(mut self, value: T) -> Self
12751 where
12752 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
12753 T::Error: ::std::fmt::Display,
12754 {
12755 self.message = value
12756 .try_into()
12757 .map_err(|e| {
12758 format!("error converting supplied value for message: {e}")
12759 });
12760 self
12761 }
12762 pub fn param<T>(mut self, value: T) -> Self
12763 where
12764 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
12765 T::Error: ::std::fmt::Display,
12766 {
12767 self.param = value
12768 .try_into()
12769 .map_err(|e| format!("error converting supplied value for param: {e}"));
12770 self
12771 }
12772 pub fn type_<T>(mut self, value: T) -> Self
12773 where
12774 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
12775 T::Error: ::std::fmt::Display,
12776 {
12777 self.type_ = value
12778 .try_into()
12779 .map_err(|e| format!("error converting supplied value for type_: {e}"));
12780 self
12781 }
12782 }
12783 impl ::std::convert::TryFrom<Error> for super::Error {
12784 type Error = super::error::ConversionError;
12785 fn try_from(
12786 value: Error,
12787 ) -> ::std::result::Result<Self, super::error::ConversionError> {
12788 Ok(Self {
12789 code: value.code?,
12790 message: value.message?,
12791 param: value.param?,
12792 type_: value.type_?,
12793 })
12794 }
12795 }
12796 impl ::std::convert::From<super::Error> for Error {
12797 fn from(value: super::Error) -> Self {
12798 Self {
12799 code: Ok(value.code),
12800 message: Ok(value.message),
12801 param: Ok(value.param),
12802 type_: Ok(value.type_),
12803 }
12804 }
12805 }
12806 #[derive(Clone, Debug)]
12807 pub struct Output {
12808 deleted: ::std::result::Result<
12809 ::std::option::Option<bool>,
12810 ::std::string::String,
12811 >,
12812 error: ::std::result::Result<
12813 ::std::option::Option<super::Error>,
12814 ::std::string::String,
12815 >,
12816 id: ::std::result::Result<
12817 ::std::option::Option<::std::string::String>,
12818 ::std::string::String,
12819 >,
12820 object: ::std::result::Result<
12821 ::std::option::Option<super::OutputObject>,
12822 ::std::string::String,
12823 >,
12824 }
12825 impl ::std::default::Default for Output {
12826 fn default() -> Self {
12827 Self {
12828 deleted: Ok(Default::default()),
12829 error: Ok(Default::default()),
12830 id: Ok(Default::default()),
12831 object: Ok(Default::default()),
12832 }
12833 }
12834 }
12835 impl Output {
12836 pub fn deleted<T>(mut self, value: T) -> Self
12837 where
12838 T: ::std::convert::TryInto<::std::option::Option<bool>>,
12839 T::Error: ::std::fmt::Display,
12840 {
12841 self.deleted = value
12842 .try_into()
12843 .map_err(|e| {
12844 format!("error converting supplied value for deleted: {e}")
12845 });
12846 self
12847 }
12848 pub fn error<T>(mut self, value: T) -> Self
12849 where
12850 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
12851 T::Error: ::std::fmt::Display,
12852 {
12853 self.error = value
12854 .try_into()
12855 .map_err(|e| format!("error converting supplied value for error: {e}"));
12856 self
12857 }
12858 pub fn id<T>(mut self, value: T) -> Self
12859 where
12860 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
12861 T::Error: ::std::fmt::Display,
12862 {
12863 self.id = value
12864 .try_into()
12865 .map_err(|e| format!("error converting supplied value for id: {e}"));
12866 self
12867 }
12868 pub fn object<T>(mut self, value: T) -> Self
12869 where
12870 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
12871 T::Error: ::std::fmt::Display,
12872 {
12873 self.object = value
12874 .try_into()
12875 .map_err(|e| format!("error converting supplied value for object: {e}"));
12876 self
12877 }
12878 }
12879 impl ::std::convert::TryFrom<Output> for super::Output {
12880 type Error = super::error::ConversionError;
12881 fn try_from(
12882 value: Output,
12883 ) -> ::std::result::Result<Self, super::error::ConversionError> {
12884 Ok(Self {
12885 deleted: value.deleted?,
12886 error: value.error?,
12887 id: value.id?,
12888 object: value.object?,
12889 })
12890 }
12891 }
12892 impl ::std::convert::From<super::Output> for Output {
12893 fn from(value: super::Output) -> Self {
12894 Self {
12895 deleted: Ok(value.deleted),
12896 error: Ok(value.error),
12897 id: Ok(value.id),
12898 object: Ok(value.object),
12899 }
12900 }
12901 }
12902}
12903pub mod error {
12905 pub struct ConversionError(::std::borrow::Cow<'static, str>);
12907 impl ::std::error::Error for ConversionError {}
12908 impl ::std::fmt::Display for ConversionError {
12909 fn fmt(
12910 &self,
12911 f: &mut ::std::fmt::Formatter<'_>,
12912 ) -> Result<(), ::std::fmt::Error> {
12913 ::std::fmt::Display::fmt(&self.0, f)
12914 }
12915 }
12916 impl ::std::fmt::Debug for ConversionError {
12917 fn fmt(
12918 &self,
12919 f: &mut ::std::fmt::Formatter<'_>,
12920 ) -> Result<(), ::std::fmt::Error> {
12921 ::std::fmt::Debug::fmt(&self.0, f)
12922 }
12923 }
12924 impl From<&'static str> for ConversionError {
12925 fn from(value: &'static str) -> Self {
12926 Self(value.into())
12927 }
12928 }
12929 impl From<String> for ConversionError {
12930 fn from(value: String) -> Self {
12931 Self(value.into())
12932 }
12933 }
12934}
12935
12936}
12937
12938 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "fileId", part: ::one::Part::Path, key: Some("fileId") }], required_parts: &[::one::Part::Path] };
12940
12941 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
12950 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4CvkDEEA::mgo1j6gNQ3KCkFZENFv7MA", Method::DELETE, "/v1/files/{{fileId}}").with_routed(&input, &ROUTING)?
12951 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
12952 }
12953
12954 impl IntoOperation for Input {
12955 type Output = output::Output;
12956
12957 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
12958 build(self)
12959 }
12960 }
12961 impl IntoOperation for builder::Input {
12962 type Output = output::Output;
12963
12964 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
12965 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
12966 }
12967 }
12968}
12969pub fn delete_file() -> delete_file::builder::Input {
12971 delete_file::builder::Input::default()
12972}
12973pub mod cancel_batch {
12974 use ::one::{Error, IntoOperation, Method, Operation};
12975#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
12977#[serde(deny_unknown_fields)]
12978pub struct Input {
12979 #[serde(rename = "batchId")]
12981 pub batch_id: InputBatchId,
12982}
12983impl Input {
12984 pub fn builder() -> builder::Input {
12985 Default::default()
12986 }
12987}
12988#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12990#[serde(transparent)]
12991pub struct InputBatchId(::std::string::String);
12992impl ::std::ops::Deref for InputBatchId {
12993 type Target = ::std::string::String;
12994 fn deref(&self) -> &::std::string::String {
12995 &self.0
12996 }
12997}
12998impl ::std::convert::From<InputBatchId> for ::std::string::String {
12999 fn from(value: InputBatchId) -> Self {
13000 value.0
13001 }
13002}
13003impl ::std::str::FromStr for InputBatchId {
13004 type Err = self::error::ConversionError;
13005 fn from_str(
13006 value: &str,
13007 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13008 ::std::convert::TryFrom::try_from(value)
13009 }
13010}
13011impl ::std::convert::TryFrom<&str> for InputBatchId {
13012 type Error = self::error::ConversionError;
13013 fn try_from(
13014 value: &str,
13015 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13016 if value.chars().count() < 1usize {
13017 return Err("shorter than 1 characters".into());
13018 }
13019 static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(||
13020 { ::regress::Regex::with_flags("^batch_.+", "u").unwrap() });
13021 if PATTERN.find(value).is_none() {
13022 return Err("doesn't match pattern \"^batch_.+\"".into());
13023 }
13024 Ok(Self(value.to_string()))
13025 }
13026}
13027impl ::std::convert::TryFrom<::std::string::String> for InputBatchId {
13028 type Error = self::error::ConversionError;
13029 fn try_from(
13030 value: ::std::string::String,
13031 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13032 ::std::convert::TryFrom::try_from(value.as_str())
13033 }
13034}
13035impl<'de> ::serde::Deserialize<'de> for InputBatchId {
13036 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
13037 where
13038 D: ::serde::Deserializer<'de>,
13039 {
13040 ::std::convert::TryFrom::try_from(
13041 ::std::string::String::deserialize(deserializer)?,
13042 )
13043 .map_err(|e: self::error::ConversionError| {
13044 <D::Error as ::serde::de::Error>::custom(e.to_string())
13045 })
13046 }
13047}
13048pub mod builder {
13050 #[derive(Clone, Debug)]
13051 pub struct Input {
13052 batch_id: ::std::result::Result<super::InputBatchId, ::std::string::String>,
13053 }
13054 impl ::std::default::Default for Input {
13055 fn default() -> Self {
13056 Self {
13057 batch_id: Err("no value supplied for batch_id".to_string()),
13058 }
13059 }
13060 }
13061 impl Input {
13062 pub fn batch_id<T>(mut self, value: T) -> Self
13063 where
13064 T: ::std::convert::TryInto<super::InputBatchId>,
13065 T::Error: ::std::fmt::Display,
13066 {
13067 self.batch_id = value
13068 .try_into()
13069 .map_err(|e| {
13070 format!("error converting supplied value for batch_id: {e}")
13071 });
13072 self
13073 }
13074 }
13075 impl ::std::convert::TryFrom<Input> for super::Input {
13076 type Error = super::error::ConversionError;
13077 fn try_from(
13078 value: Input,
13079 ) -> ::std::result::Result<Self, super::error::ConversionError> {
13080 Ok(Self { batch_id: value.batch_id? })
13081 }
13082 }
13083 impl ::std::convert::From<super::Input> for Input {
13084 fn from(value: super::Input) -> Self {
13085 Self {
13086 batch_id: Ok(value.batch_id),
13087 }
13088 }
13089 }
13090}
13091pub mod error {
13093 pub struct ConversionError(::std::borrow::Cow<'static, str>);
13095 impl ::std::error::Error for ConversionError {}
13096 impl ::std::fmt::Display for ConversionError {
13097 fn fmt(
13098 &self,
13099 f: &mut ::std::fmt::Formatter<'_>,
13100 ) -> Result<(), ::std::fmt::Error> {
13101 ::std::fmt::Display::fmt(&self.0, f)
13102 }
13103 }
13104 impl ::std::fmt::Debug for ConversionError {
13105 fn fmt(
13106 &self,
13107 f: &mut ::std::fmt::Formatter<'_>,
13108 ) -> Result<(), ::std::fmt::Error> {
13109 ::std::fmt::Debug::fmt(&self.0, f)
13110 }
13111 }
13112 impl From<&'static str> for ConversionError {
13113 fn from(value: &'static str) -> Self {
13114 Self(value.into())
13115 }
13116 }
13117 impl From<String> for ConversionError {
13118 fn from(value: String) -> Self {
13119 Self(value.into())
13120 }
13121 }
13122}
13123
13124pub mod output {
13125#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13127pub struct BatchErrors {
13128 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
13130 pub data: ::std::vec::Vec<BatchInputError>,
13131 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13133 pub object: ::std::option::Option<BatchErrorsObject>,
13134}
13135impl BatchErrors {
13136 pub fn builder() -> builder::BatchErrors {
13137 Default::default()
13138 }
13139}
13140#[derive(
13142 ::serde::Deserialize,
13143 ::serde::Serialize,
13144 Clone,
13145 Copy,
13146 Debug,
13147 Eq,
13148 Hash,
13149 Ord,
13150 PartialEq,
13151 PartialOrd
13152)]
13153pub enum BatchErrorsObject {
13154 #[serde(rename = "list")]
13155 List,
13156}
13157impl ::std::fmt::Display for BatchErrorsObject {
13158 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
13159 match *self {
13160 Self::List => f.write_str("list"),
13161 }
13162 }
13163}
13164impl ::std::str::FromStr for BatchErrorsObject {
13165 type Err = self::error::ConversionError;
13166 fn from_str(
13167 value: &str,
13168 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13169 match value {
13170 "list" => Ok(Self::List),
13171 _ => Err("invalid value".into()),
13172 }
13173 }
13174}
13175impl ::std::convert::TryFrom<&str> for BatchErrorsObject {
13176 type Error = self::error::ConversionError;
13177 fn try_from(
13178 value: &str,
13179 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13180 value.parse()
13181 }
13182}
13183impl ::std::convert::TryFrom<::std::string::String> for BatchErrorsObject {
13184 type Error = self::error::ConversionError;
13185 fn try_from(
13186 value: ::std::string::String,
13187 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13188 value.parse()
13189 }
13190}
13191#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13193pub struct BatchInputError {
13194 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13196 pub code: ::std::option::Option<::std::string::String>,
13197 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13199 pub line: ::std::option::Option<i64>,
13200 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13202 pub message: ::std::option::Option<::std::string::String>,
13203}
13204impl BatchInputError {
13205 pub fn builder() -> builder::BatchInputError {
13206 Default::default()
13207 }
13208}
13209#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13211pub struct Error {
13212 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13214 pub code: ::std::option::Option<i64>,
13215 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13217 pub message: ::std::option::Option<::std::string::String>,
13218 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13220 pub param: ::std::option::Option<::std::string::String>,
13221 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
13223 pub type_: ::std::option::Option<::std::string::String>,
13224}
13225impl Error {
13226 pub fn builder() -> builder::Error {
13227 Default::default()
13228 }
13229}
13230#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13232pub struct InputTokenDetails {
13233 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13235 pub cached_tokens: ::std::option::Option<i64>,
13236}
13237impl InputTokenDetails {
13238 pub fn builder() -> builder::InputTokenDetails {
13239 Default::default()
13240 }
13241}
13242#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13244pub struct Output {
13245 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13247 pub cancelled_at: ::std::option::Option<i64>,
13248 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13250 pub cancelling_at: ::std::option::Option<i64>,
13251 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13253 pub completed_at: ::std::option::Option<i64>,
13254 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13256 pub completion_window: ::std::option::Option<::std::string::String>,
13257 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13259 pub created_at: ::std::option::Option<i64>,
13260 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13262 pub endpoint: ::std::option::Option<::std::string::String>,
13263 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13264 pub error: ::std::option::Option<Error>,
13265 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13267 pub error_file_id: ::std::option::Option<::std::string::String>,
13268 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13269 pub errors: ::std::option::Option<BatchErrors>,
13270 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13272 pub expired_at: ::std::option::Option<i64>,
13273 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13275 pub expires_at: ::std::option::Option<i64>,
13276 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13278 pub failed_at: ::std::option::Option<i64>,
13279 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13281 pub finalizing_at: ::std::option::Option<i64>,
13282 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13284 pub id: ::std::option::Option<::std::string::String>,
13285 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13287 pub in_progress_at: ::std::option::Option<i64>,
13288 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13290 pub input_file_id: ::std::option::Option<::std::string::String>,
13291 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
13293 pub metadata: ::std::collections::HashMap<
13294 ::std::string::String,
13295 ::std::string::String,
13296 >,
13297 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13299 pub object: ::std::option::Option<OutputObject>,
13300 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13302 pub output_file_id: ::std::option::Option<::std::string::String>,
13303 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13304 pub request_counts: ::std::option::Option<RequestCounts>,
13305 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13307 pub status: ::std::option::Option<OutputStatus>,
13308 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13309 pub usage: ::std::option::Option<Usage>,
13310}
13311impl Output {
13312 pub fn builder() -> builder::Output {
13313 Default::default()
13314 }
13315}
13316#[derive(
13318 ::serde::Deserialize,
13319 ::serde::Serialize,
13320 Clone,
13321 Copy,
13322 Debug,
13323 Eq,
13324 Hash,
13325 Ord,
13326 PartialEq,
13327 PartialOrd
13328)]
13329pub enum OutputObject {
13330 #[serde(rename = "batch")]
13331 Batch,
13332}
13333impl ::std::fmt::Display for OutputObject {
13334 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
13335 match *self {
13336 Self::Batch => f.write_str("batch"),
13337 }
13338 }
13339}
13340impl ::std::str::FromStr for OutputObject {
13341 type Err = self::error::ConversionError;
13342 fn from_str(
13343 value: &str,
13344 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13345 match value {
13346 "batch" => Ok(Self::Batch),
13347 _ => Err("invalid value".into()),
13348 }
13349 }
13350}
13351impl ::std::convert::TryFrom<&str> for OutputObject {
13352 type Error = self::error::ConversionError;
13353 fn try_from(
13354 value: &str,
13355 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13356 value.parse()
13357 }
13358}
13359impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
13360 type Error = self::error::ConversionError;
13361 fn try_from(
13362 value: ::std::string::String,
13363 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13364 value.parse()
13365 }
13366}
13367#[derive(
13369 ::serde::Deserialize,
13370 ::serde::Serialize,
13371 Clone,
13372 Copy,
13373 Debug,
13374 Eq,
13375 Hash,
13376 Ord,
13377 PartialEq,
13378 PartialOrd
13379)]
13380pub enum OutputStatus {
13381 #[serde(rename = "validating")]
13382 Validating,
13383 #[serde(rename = "in_progress")]
13384 InProgress,
13385 #[serde(rename = "finalizing")]
13386 Finalizing,
13387 #[serde(rename = "completed")]
13388 Completed,
13389 #[serde(rename = "expired")]
13390 Expired,
13391 #[serde(rename = "cancelling")]
13392 Cancelling,
13393 #[serde(rename = "cancelled")]
13394 Cancelled,
13395 #[serde(rename = "failed")]
13396 Failed,
13397}
13398impl ::std::fmt::Display for OutputStatus {
13399 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
13400 match *self {
13401 Self::Validating => f.write_str("validating"),
13402 Self::InProgress => f.write_str("in_progress"),
13403 Self::Finalizing => f.write_str("finalizing"),
13404 Self::Completed => f.write_str("completed"),
13405 Self::Expired => f.write_str("expired"),
13406 Self::Cancelling => f.write_str("cancelling"),
13407 Self::Cancelled => f.write_str("cancelled"),
13408 Self::Failed => f.write_str("failed"),
13409 }
13410 }
13411}
13412impl ::std::str::FromStr for OutputStatus {
13413 type Err = self::error::ConversionError;
13414 fn from_str(
13415 value: &str,
13416 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13417 match value {
13418 "validating" => Ok(Self::Validating),
13419 "in_progress" => Ok(Self::InProgress),
13420 "finalizing" => Ok(Self::Finalizing),
13421 "completed" => Ok(Self::Completed),
13422 "expired" => Ok(Self::Expired),
13423 "cancelling" => Ok(Self::Cancelling),
13424 "cancelled" => Ok(Self::Cancelled),
13425 "failed" => Ok(Self::Failed),
13426 _ => Err("invalid value".into()),
13427 }
13428 }
13429}
13430impl ::std::convert::TryFrom<&str> for OutputStatus {
13431 type Error = self::error::ConversionError;
13432 fn try_from(
13433 value: &str,
13434 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13435 value.parse()
13436 }
13437}
13438impl ::std::convert::TryFrom<::std::string::String> for OutputStatus {
13439 type Error = self::error::ConversionError;
13440 fn try_from(
13441 value: ::std::string::String,
13442 ) -> ::std::result::Result<Self, self::error::ConversionError> {
13443 value.parse()
13444 }
13445}
13446#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13448pub struct OutputTokenDetails {
13449 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13451 pub reasoning_tokens: ::std::option::Option<i64>,
13452}
13453impl OutputTokenDetails {
13454 pub fn builder() -> builder::OutputTokenDetails {
13455 Default::default()
13456 }
13457}
13458#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13460pub struct RequestCounts {
13461 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13463 pub completed: ::std::option::Option<i64>,
13464 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13466 pub failed: ::std::option::Option<i64>,
13467 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13469 pub total: ::std::option::Option<i64>,
13470}
13471impl RequestCounts {
13472 pub fn builder() -> builder::RequestCounts {
13473 Default::default()
13474 }
13475}
13476#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
13478pub struct Usage {
13479 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13481 pub input_tokens: ::std::option::Option<i64>,
13482 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13483 pub input_tokens_details: ::std::option::Option<InputTokenDetails>,
13484 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13486 pub output_tokens: ::std::option::Option<i64>,
13487 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13488 pub output_tokens_details: ::std::option::Option<OutputTokenDetails>,
13489 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
13491 pub total_tokens: ::std::option::Option<i64>,
13492}
13493impl Usage {
13494 pub fn builder() -> builder::Usage {
13495 Default::default()
13496 }
13497}
13498pub mod builder {
13500 #[derive(Clone, Debug)]
13501 pub struct BatchErrors {
13502 data: ::std::result::Result<
13503 ::std::vec::Vec<super::BatchInputError>,
13504 ::std::string::String,
13505 >,
13506 object: ::std::result::Result<
13507 ::std::option::Option<super::BatchErrorsObject>,
13508 ::std::string::String,
13509 >,
13510 }
13511 impl ::std::default::Default for BatchErrors {
13512 fn default() -> Self {
13513 Self {
13514 data: Ok(Default::default()),
13515 object: Ok(Default::default()),
13516 }
13517 }
13518 }
13519 impl BatchErrors {
13520 pub fn data<T>(mut self, value: T) -> Self
13521 where
13522 T: ::std::convert::TryInto<::std::vec::Vec<super::BatchInputError>>,
13523 T::Error: ::std::fmt::Display,
13524 {
13525 self.data = value
13526 .try_into()
13527 .map_err(|e| format!("error converting supplied value for data: {e}"));
13528 self
13529 }
13530 pub fn object<T>(mut self, value: T) -> Self
13531 where
13532 T: ::std::convert::TryInto<::std::option::Option<super::BatchErrorsObject>>,
13533 T::Error: ::std::fmt::Display,
13534 {
13535 self.object = value
13536 .try_into()
13537 .map_err(|e| format!("error converting supplied value for object: {e}"));
13538 self
13539 }
13540 }
13541 impl ::std::convert::TryFrom<BatchErrors> for super::BatchErrors {
13542 type Error = super::error::ConversionError;
13543 fn try_from(
13544 value: BatchErrors,
13545 ) -> ::std::result::Result<Self, super::error::ConversionError> {
13546 Ok(Self {
13547 data: value.data?,
13548 object: value.object?,
13549 })
13550 }
13551 }
13552 impl ::std::convert::From<super::BatchErrors> for BatchErrors {
13553 fn from(value: super::BatchErrors) -> Self {
13554 Self {
13555 data: Ok(value.data),
13556 object: Ok(value.object),
13557 }
13558 }
13559 }
13560 #[derive(Clone, Debug)]
13561 pub struct BatchInputError {
13562 code: ::std::result::Result<
13563 ::std::option::Option<::std::string::String>,
13564 ::std::string::String,
13565 >,
13566 line: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
13567 message: ::std::result::Result<
13568 ::std::option::Option<::std::string::String>,
13569 ::std::string::String,
13570 >,
13571 }
13572 impl ::std::default::Default for BatchInputError {
13573 fn default() -> Self {
13574 Self {
13575 code: Ok(Default::default()),
13576 line: Ok(Default::default()),
13577 message: Ok(Default::default()),
13578 }
13579 }
13580 }
13581 impl BatchInputError {
13582 pub fn code<T>(mut self, value: T) -> Self
13583 where
13584 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13585 T::Error: ::std::fmt::Display,
13586 {
13587 self.code = value
13588 .try_into()
13589 .map_err(|e| format!("error converting supplied value for code: {e}"));
13590 self
13591 }
13592 pub fn line<T>(mut self, value: T) -> Self
13593 where
13594 T: ::std::convert::TryInto<::std::option::Option<i64>>,
13595 T::Error: ::std::fmt::Display,
13596 {
13597 self.line = value
13598 .try_into()
13599 .map_err(|e| format!("error converting supplied value for line: {e}"));
13600 self
13601 }
13602 pub fn message<T>(mut self, value: T) -> Self
13603 where
13604 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13605 T::Error: ::std::fmt::Display,
13606 {
13607 self.message = value
13608 .try_into()
13609 .map_err(|e| {
13610 format!("error converting supplied value for message: {e}")
13611 });
13612 self
13613 }
13614 }
13615 impl ::std::convert::TryFrom<BatchInputError> for super::BatchInputError {
13616 type Error = super::error::ConversionError;
13617 fn try_from(
13618 value: BatchInputError,
13619 ) -> ::std::result::Result<Self, super::error::ConversionError> {
13620 Ok(Self {
13621 code: value.code?,
13622 line: value.line?,
13623 message: value.message?,
13624 })
13625 }
13626 }
13627 impl ::std::convert::From<super::BatchInputError> for BatchInputError {
13628 fn from(value: super::BatchInputError) -> Self {
13629 Self {
13630 code: Ok(value.code),
13631 line: Ok(value.line),
13632 message: Ok(value.message),
13633 }
13634 }
13635 }
13636 #[derive(Clone, Debug)]
13637 pub struct Error {
13638 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
13639 message: ::std::result::Result<
13640 ::std::option::Option<::std::string::String>,
13641 ::std::string::String,
13642 >,
13643 param: ::std::result::Result<
13644 ::std::option::Option<::std::string::String>,
13645 ::std::string::String,
13646 >,
13647 type_: ::std::result::Result<
13648 ::std::option::Option<::std::string::String>,
13649 ::std::string::String,
13650 >,
13651 }
13652 impl ::std::default::Default for Error {
13653 fn default() -> Self {
13654 Self {
13655 code: Ok(Default::default()),
13656 message: Ok(Default::default()),
13657 param: Ok(Default::default()),
13658 type_: Ok(Default::default()),
13659 }
13660 }
13661 }
13662 impl Error {
13663 pub fn code<T>(mut self, value: T) -> Self
13664 where
13665 T: ::std::convert::TryInto<::std::option::Option<i64>>,
13666 T::Error: ::std::fmt::Display,
13667 {
13668 self.code = value
13669 .try_into()
13670 .map_err(|e| format!("error converting supplied value for code: {e}"));
13671 self
13672 }
13673 pub fn message<T>(mut self, value: T) -> Self
13674 where
13675 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13676 T::Error: ::std::fmt::Display,
13677 {
13678 self.message = value
13679 .try_into()
13680 .map_err(|e| {
13681 format!("error converting supplied value for message: {e}")
13682 });
13683 self
13684 }
13685 pub fn param<T>(mut self, value: T) -> Self
13686 where
13687 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13688 T::Error: ::std::fmt::Display,
13689 {
13690 self.param = value
13691 .try_into()
13692 .map_err(|e| format!("error converting supplied value for param: {e}"));
13693 self
13694 }
13695 pub fn type_<T>(mut self, value: T) -> Self
13696 where
13697 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13698 T::Error: ::std::fmt::Display,
13699 {
13700 self.type_ = value
13701 .try_into()
13702 .map_err(|e| format!("error converting supplied value for type_: {e}"));
13703 self
13704 }
13705 }
13706 impl ::std::convert::TryFrom<Error> for super::Error {
13707 type Error = super::error::ConversionError;
13708 fn try_from(
13709 value: Error,
13710 ) -> ::std::result::Result<Self, super::error::ConversionError> {
13711 Ok(Self {
13712 code: value.code?,
13713 message: value.message?,
13714 param: value.param?,
13715 type_: value.type_?,
13716 })
13717 }
13718 }
13719 impl ::std::convert::From<super::Error> for Error {
13720 fn from(value: super::Error) -> Self {
13721 Self {
13722 code: Ok(value.code),
13723 message: Ok(value.message),
13724 param: Ok(value.param),
13725 type_: Ok(value.type_),
13726 }
13727 }
13728 }
13729 #[derive(Clone, Debug)]
13730 pub struct InputTokenDetails {
13731 cached_tokens: ::std::result::Result<
13732 ::std::option::Option<i64>,
13733 ::std::string::String,
13734 >,
13735 }
13736 impl ::std::default::Default for InputTokenDetails {
13737 fn default() -> Self {
13738 Self {
13739 cached_tokens: Ok(Default::default()),
13740 }
13741 }
13742 }
13743 impl InputTokenDetails {
13744 pub fn cached_tokens<T>(mut self, value: T) -> Self
13745 where
13746 T: ::std::convert::TryInto<::std::option::Option<i64>>,
13747 T::Error: ::std::fmt::Display,
13748 {
13749 self.cached_tokens = value
13750 .try_into()
13751 .map_err(|e| {
13752 format!("error converting supplied value for cached_tokens: {e}")
13753 });
13754 self
13755 }
13756 }
13757 impl ::std::convert::TryFrom<InputTokenDetails> for super::InputTokenDetails {
13758 type Error = super::error::ConversionError;
13759 fn try_from(
13760 value: InputTokenDetails,
13761 ) -> ::std::result::Result<Self, super::error::ConversionError> {
13762 Ok(Self {
13763 cached_tokens: value.cached_tokens?,
13764 })
13765 }
13766 }
13767 impl ::std::convert::From<super::InputTokenDetails> for InputTokenDetails {
13768 fn from(value: super::InputTokenDetails) -> Self {
13769 Self {
13770 cached_tokens: Ok(value.cached_tokens),
13771 }
13772 }
13773 }
13774 #[derive(Clone, Debug)]
13775 pub struct Output {
13776 cancelled_at: ::std::result::Result<
13777 ::std::option::Option<i64>,
13778 ::std::string::String,
13779 >,
13780 cancelling_at: ::std::result::Result<
13781 ::std::option::Option<i64>,
13782 ::std::string::String,
13783 >,
13784 completed_at: ::std::result::Result<
13785 ::std::option::Option<i64>,
13786 ::std::string::String,
13787 >,
13788 completion_window: ::std::result::Result<
13789 ::std::option::Option<::std::string::String>,
13790 ::std::string::String,
13791 >,
13792 created_at: ::std::result::Result<
13793 ::std::option::Option<i64>,
13794 ::std::string::String,
13795 >,
13796 endpoint: ::std::result::Result<
13797 ::std::option::Option<::std::string::String>,
13798 ::std::string::String,
13799 >,
13800 error: ::std::result::Result<
13801 ::std::option::Option<super::Error>,
13802 ::std::string::String,
13803 >,
13804 error_file_id: ::std::result::Result<
13805 ::std::option::Option<::std::string::String>,
13806 ::std::string::String,
13807 >,
13808 errors: ::std::result::Result<
13809 ::std::option::Option<super::BatchErrors>,
13810 ::std::string::String,
13811 >,
13812 expired_at: ::std::result::Result<
13813 ::std::option::Option<i64>,
13814 ::std::string::String,
13815 >,
13816 expires_at: ::std::result::Result<
13817 ::std::option::Option<i64>,
13818 ::std::string::String,
13819 >,
13820 failed_at: ::std::result::Result<
13821 ::std::option::Option<i64>,
13822 ::std::string::String,
13823 >,
13824 finalizing_at: ::std::result::Result<
13825 ::std::option::Option<i64>,
13826 ::std::string::String,
13827 >,
13828 id: ::std::result::Result<
13829 ::std::option::Option<::std::string::String>,
13830 ::std::string::String,
13831 >,
13832 in_progress_at: ::std::result::Result<
13833 ::std::option::Option<i64>,
13834 ::std::string::String,
13835 >,
13836 input_file_id: ::std::result::Result<
13837 ::std::option::Option<::std::string::String>,
13838 ::std::string::String,
13839 >,
13840 metadata: ::std::result::Result<
13841 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
13842 ::std::string::String,
13843 >,
13844 object: ::std::result::Result<
13845 ::std::option::Option<super::OutputObject>,
13846 ::std::string::String,
13847 >,
13848 output_file_id: ::std::result::Result<
13849 ::std::option::Option<::std::string::String>,
13850 ::std::string::String,
13851 >,
13852 request_counts: ::std::result::Result<
13853 ::std::option::Option<super::RequestCounts>,
13854 ::std::string::String,
13855 >,
13856 status: ::std::result::Result<
13857 ::std::option::Option<super::OutputStatus>,
13858 ::std::string::String,
13859 >,
13860 usage: ::std::result::Result<
13861 ::std::option::Option<super::Usage>,
13862 ::std::string::String,
13863 >,
13864 }
13865 impl ::std::default::Default for Output {
13866 fn default() -> Self {
13867 Self {
13868 cancelled_at: Ok(Default::default()),
13869 cancelling_at: Ok(Default::default()),
13870 completed_at: Ok(Default::default()),
13871 completion_window: Ok(Default::default()),
13872 created_at: Ok(Default::default()),
13873 endpoint: Ok(Default::default()),
13874 error: Ok(Default::default()),
13875 error_file_id: Ok(Default::default()),
13876 errors: Ok(Default::default()),
13877 expired_at: Ok(Default::default()),
13878 expires_at: Ok(Default::default()),
13879 failed_at: Ok(Default::default()),
13880 finalizing_at: Ok(Default::default()),
13881 id: Ok(Default::default()),
13882 in_progress_at: Ok(Default::default()),
13883 input_file_id: Ok(Default::default()),
13884 metadata: Ok(Default::default()),
13885 object: Ok(Default::default()),
13886 output_file_id: Ok(Default::default()),
13887 request_counts: Ok(Default::default()),
13888 status: Ok(Default::default()),
13889 usage: Ok(Default::default()),
13890 }
13891 }
13892 }
13893 impl Output {
13894 pub fn cancelled_at<T>(mut self, value: T) -> Self
13895 where
13896 T: ::std::convert::TryInto<::std::option::Option<i64>>,
13897 T::Error: ::std::fmt::Display,
13898 {
13899 self.cancelled_at = value
13900 .try_into()
13901 .map_err(|e| {
13902 format!("error converting supplied value for cancelled_at: {e}")
13903 });
13904 self
13905 }
13906 pub fn cancelling_at<T>(mut self, value: T) -> Self
13907 where
13908 T: ::std::convert::TryInto<::std::option::Option<i64>>,
13909 T::Error: ::std::fmt::Display,
13910 {
13911 self.cancelling_at = value
13912 .try_into()
13913 .map_err(|e| {
13914 format!("error converting supplied value for cancelling_at: {e}")
13915 });
13916 self
13917 }
13918 pub fn completed_at<T>(mut self, value: T) -> Self
13919 where
13920 T: ::std::convert::TryInto<::std::option::Option<i64>>,
13921 T::Error: ::std::fmt::Display,
13922 {
13923 self.completed_at = value
13924 .try_into()
13925 .map_err(|e| {
13926 format!("error converting supplied value for completed_at: {e}")
13927 });
13928 self
13929 }
13930 pub fn completion_window<T>(mut self, value: T) -> Self
13931 where
13932 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13933 T::Error: ::std::fmt::Display,
13934 {
13935 self.completion_window = value
13936 .try_into()
13937 .map_err(|e| {
13938 format!("error converting supplied value for completion_window: {e}")
13939 });
13940 self
13941 }
13942 pub fn created_at<T>(mut self, value: T) -> Self
13943 where
13944 T: ::std::convert::TryInto<::std::option::Option<i64>>,
13945 T::Error: ::std::fmt::Display,
13946 {
13947 self.created_at = value
13948 .try_into()
13949 .map_err(|e| {
13950 format!("error converting supplied value for created_at: {e}")
13951 });
13952 self
13953 }
13954 pub fn endpoint<T>(mut self, value: T) -> Self
13955 where
13956 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13957 T::Error: ::std::fmt::Display,
13958 {
13959 self.endpoint = value
13960 .try_into()
13961 .map_err(|e| {
13962 format!("error converting supplied value for endpoint: {e}")
13963 });
13964 self
13965 }
13966 pub fn error<T>(mut self, value: T) -> Self
13967 where
13968 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
13969 T::Error: ::std::fmt::Display,
13970 {
13971 self.error = value
13972 .try_into()
13973 .map_err(|e| format!("error converting supplied value for error: {e}"));
13974 self
13975 }
13976 pub fn error_file_id<T>(mut self, value: T) -> Self
13977 where
13978 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
13979 T::Error: ::std::fmt::Display,
13980 {
13981 self.error_file_id = value
13982 .try_into()
13983 .map_err(|e| {
13984 format!("error converting supplied value for error_file_id: {e}")
13985 });
13986 self
13987 }
13988 pub fn errors<T>(mut self, value: T) -> Self
13989 where
13990 T: ::std::convert::TryInto<::std::option::Option<super::BatchErrors>>,
13991 T::Error: ::std::fmt::Display,
13992 {
13993 self.errors = value
13994 .try_into()
13995 .map_err(|e| format!("error converting supplied value for errors: {e}"));
13996 self
13997 }
13998 pub fn expired_at<T>(mut self, value: T) -> Self
13999 where
14000 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14001 T::Error: ::std::fmt::Display,
14002 {
14003 self.expired_at = value
14004 .try_into()
14005 .map_err(|e| {
14006 format!("error converting supplied value for expired_at: {e}")
14007 });
14008 self
14009 }
14010 pub fn expires_at<T>(mut self, value: T) -> Self
14011 where
14012 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14013 T::Error: ::std::fmt::Display,
14014 {
14015 self.expires_at = value
14016 .try_into()
14017 .map_err(|e| {
14018 format!("error converting supplied value for expires_at: {e}")
14019 });
14020 self
14021 }
14022 pub fn failed_at<T>(mut self, value: T) -> Self
14023 where
14024 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14025 T::Error: ::std::fmt::Display,
14026 {
14027 self.failed_at = value
14028 .try_into()
14029 .map_err(|e| {
14030 format!("error converting supplied value for failed_at: {e}")
14031 });
14032 self
14033 }
14034 pub fn finalizing_at<T>(mut self, value: T) -> Self
14035 where
14036 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14037 T::Error: ::std::fmt::Display,
14038 {
14039 self.finalizing_at = value
14040 .try_into()
14041 .map_err(|e| {
14042 format!("error converting supplied value for finalizing_at: {e}")
14043 });
14044 self
14045 }
14046 pub fn id<T>(mut self, value: T) -> Self
14047 where
14048 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
14049 T::Error: ::std::fmt::Display,
14050 {
14051 self.id = value
14052 .try_into()
14053 .map_err(|e| format!("error converting supplied value for id: {e}"));
14054 self
14055 }
14056 pub fn in_progress_at<T>(mut self, value: T) -> Self
14057 where
14058 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14059 T::Error: ::std::fmt::Display,
14060 {
14061 self.in_progress_at = value
14062 .try_into()
14063 .map_err(|e| {
14064 format!("error converting supplied value for in_progress_at: {e}")
14065 });
14066 self
14067 }
14068 pub fn input_file_id<T>(mut self, value: T) -> Self
14069 where
14070 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
14071 T::Error: ::std::fmt::Display,
14072 {
14073 self.input_file_id = value
14074 .try_into()
14075 .map_err(|e| {
14076 format!("error converting supplied value for input_file_id: {e}")
14077 });
14078 self
14079 }
14080 pub fn metadata<T>(mut self, value: T) -> Self
14081 where
14082 T: ::std::convert::TryInto<
14083 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
14084 >,
14085 T::Error: ::std::fmt::Display,
14086 {
14087 self.metadata = value
14088 .try_into()
14089 .map_err(|e| {
14090 format!("error converting supplied value for metadata: {e}")
14091 });
14092 self
14093 }
14094 pub fn object<T>(mut self, value: T) -> Self
14095 where
14096 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
14097 T::Error: ::std::fmt::Display,
14098 {
14099 self.object = value
14100 .try_into()
14101 .map_err(|e| format!("error converting supplied value for object: {e}"));
14102 self
14103 }
14104 pub fn output_file_id<T>(mut self, value: T) -> Self
14105 where
14106 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
14107 T::Error: ::std::fmt::Display,
14108 {
14109 self.output_file_id = value
14110 .try_into()
14111 .map_err(|e| {
14112 format!("error converting supplied value for output_file_id: {e}")
14113 });
14114 self
14115 }
14116 pub fn request_counts<T>(mut self, value: T) -> Self
14117 where
14118 T: ::std::convert::TryInto<::std::option::Option<super::RequestCounts>>,
14119 T::Error: ::std::fmt::Display,
14120 {
14121 self.request_counts = value
14122 .try_into()
14123 .map_err(|e| {
14124 format!("error converting supplied value for request_counts: {e}")
14125 });
14126 self
14127 }
14128 pub fn status<T>(mut self, value: T) -> Self
14129 where
14130 T: ::std::convert::TryInto<::std::option::Option<super::OutputStatus>>,
14131 T::Error: ::std::fmt::Display,
14132 {
14133 self.status = value
14134 .try_into()
14135 .map_err(|e| format!("error converting supplied value for status: {e}"));
14136 self
14137 }
14138 pub fn usage<T>(mut self, value: T) -> Self
14139 where
14140 T: ::std::convert::TryInto<::std::option::Option<super::Usage>>,
14141 T::Error: ::std::fmt::Display,
14142 {
14143 self.usage = value
14144 .try_into()
14145 .map_err(|e| format!("error converting supplied value for usage: {e}"));
14146 self
14147 }
14148 }
14149 impl ::std::convert::TryFrom<Output> for super::Output {
14150 type Error = super::error::ConversionError;
14151 fn try_from(
14152 value: Output,
14153 ) -> ::std::result::Result<Self, super::error::ConversionError> {
14154 Ok(Self {
14155 cancelled_at: value.cancelled_at?,
14156 cancelling_at: value.cancelling_at?,
14157 completed_at: value.completed_at?,
14158 completion_window: value.completion_window?,
14159 created_at: value.created_at?,
14160 endpoint: value.endpoint?,
14161 error: value.error?,
14162 error_file_id: value.error_file_id?,
14163 errors: value.errors?,
14164 expired_at: value.expired_at?,
14165 expires_at: value.expires_at?,
14166 failed_at: value.failed_at?,
14167 finalizing_at: value.finalizing_at?,
14168 id: value.id?,
14169 in_progress_at: value.in_progress_at?,
14170 input_file_id: value.input_file_id?,
14171 metadata: value.metadata?,
14172 object: value.object?,
14173 output_file_id: value.output_file_id?,
14174 request_counts: value.request_counts?,
14175 status: value.status?,
14176 usage: value.usage?,
14177 })
14178 }
14179 }
14180 impl ::std::convert::From<super::Output> for Output {
14181 fn from(value: super::Output) -> Self {
14182 Self {
14183 cancelled_at: Ok(value.cancelled_at),
14184 cancelling_at: Ok(value.cancelling_at),
14185 completed_at: Ok(value.completed_at),
14186 completion_window: Ok(value.completion_window),
14187 created_at: Ok(value.created_at),
14188 endpoint: Ok(value.endpoint),
14189 error: Ok(value.error),
14190 error_file_id: Ok(value.error_file_id),
14191 errors: Ok(value.errors),
14192 expired_at: Ok(value.expired_at),
14193 expires_at: Ok(value.expires_at),
14194 failed_at: Ok(value.failed_at),
14195 finalizing_at: Ok(value.finalizing_at),
14196 id: Ok(value.id),
14197 in_progress_at: Ok(value.in_progress_at),
14198 input_file_id: Ok(value.input_file_id),
14199 metadata: Ok(value.metadata),
14200 object: Ok(value.object),
14201 output_file_id: Ok(value.output_file_id),
14202 request_counts: Ok(value.request_counts),
14203 status: Ok(value.status),
14204 usage: Ok(value.usage),
14205 }
14206 }
14207 }
14208 #[derive(Clone, Debug)]
14209 pub struct OutputTokenDetails {
14210 reasoning_tokens: ::std::result::Result<
14211 ::std::option::Option<i64>,
14212 ::std::string::String,
14213 >,
14214 }
14215 impl ::std::default::Default for OutputTokenDetails {
14216 fn default() -> Self {
14217 Self {
14218 reasoning_tokens: Ok(Default::default()),
14219 }
14220 }
14221 }
14222 impl OutputTokenDetails {
14223 pub fn reasoning_tokens<T>(mut self, value: T) -> Self
14224 where
14225 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14226 T::Error: ::std::fmt::Display,
14227 {
14228 self.reasoning_tokens = value
14229 .try_into()
14230 .map_err(|e| {
14231 format!("error converting supplied value for reasoning_tokens: {e}")
14232 });
14233 self
14234 }
14235 }
14236 impl ::std::convert::TryFrom<OutputTokenDetails> for super::OutputTokenDetails {
14237 type Error = super::error::ConversionError;
14238 fn try_from(
14239 value: OutputTokenDetails,
14240 ) -> ::std::result::Result<Self, super::error::ConversionError> {
14241 Ok(Self {
14242 reasoning_tokens: value.reasoning_tokens?,
14243 })
14244 }
14245 }
14246 impl ::std::convert::From<super::OutputTokenDetails> for OutputTokenDetails {
14247 fn from(value: super::OutputTokenDetails) -> Self {
14248 Self {
14249 reasoning_tokens: Ok(value.reasoning_tokens),
14250 }
14251 }
14252 }
14253 #[derive(Clone, Debug)]
14254 pub struct RequestCounts {
14255 completed: ::std::result::Result<
14256 ::std::option::Option<i64>,
14257 ::std::string::String,
14258 >,
14259 failed: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
14260 total: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
14261 }
14262 impl ::std::default::Default for RequestCounts {
14263 fn default() -> Self {
14264 Self {
14265 completed: Ok(Default::default()),
14266 failed: Ok(Default::default()),
14267 total: Ok(Default::default()),
14268 }
14269 }
14270 }
14271 impl RequestCounts {
14272 pub fn completed<T>(mut self, value: T) -> Self
14273 where
14274 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14275 T::Error: ::std::fmt::Display,
14276 {
14277 self.completed = value
14278 .try_into()
14279 .map_err(|e| {
14280 format!("error converting supplied value for completed: {e}")
14281 });
14282 self
14283 }
14284 pub fn failed<T>(mut self, value: T) -> Self
14285 where
14286 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14287 T::Error: ::std::fmt::Display,
14288 {
14289 self.failed = value
14290 .try_into()
14291 .map_err(|e| format!("error converting supplied value for failed: {e}"));
14292 self
14293 }
14294 pub fn total<T>(mut self, value: T) -> Self
14295 where
14296 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14297 T::Error: ::std::fmt::Display,
14298 {
14299 self.total = value
14300 .try_into()
14301 .map_err(|e| format!("error converting supplied value for total: {e}"));
14302 self
14303 }
14304 }
14305 impl ::std::convert::TryFrom<RequestCounts> for super::RequestCounts {
14306 type Error = super::error::ConversionError;
14307 fn try_from(
14308 value: RequestCounts,
14309 ) -> ::std::result::Result<Self, super::error::ConversionError> {
14310 Ok(Self {
14311 completed: value.completed?,
14312 failed: value.failed?,
14313 total: value.total?,
14314 })
14315 }
14316 }
14317 impl ::std::convert::From<super::RequestCounts> for RequestCounts {
14318 fn from(value: super::RequestCounts) -> Self {
14319 Self {
14320 completed: Ok(value.completed),
14321 failed: Ok(value.failed),
14322 total: Ok(value.total),
14323 }
14324 }
14325 }
14326 #[derive(Clone, Debug)]
14327 pub struct Usage {
14328 input_tokens: ::std::result::Result<
14329 ::std::option::Option<i64>,
14330 ::std::string::String,
14331 >,
14332 input_tokens_details: ::std::result::Result<
14333 ::std::option::Option<super::InputTokenDetails>,
14334 ::std::string::String,
14335 >,
14336 output_tokens: ::std::result::Result<
14337 ::std::option::Option<i64>,
14338 ::std::string::String,
14339 >,
14340 output_tokens_details: ::std::result::Result<
14341 ::std::option::Option<super::OutputTokenDetails>,
14342 ::std::string::String,
14343 >,
14344 total_tokens: ::std::result::Result<
14345 ::std::option::Option<i64>,
14346 ::std::string::String,
14347 >,
14348 }
14349 impl ::std::default::Default for Usage {
14350 fn default() -> Self {
14351 Self {
14352 input_tokens: Ok(Default::default()),
14353 input_tokens_details: Ok(Default::default()),
14354 output_tokens: Ok(Default::default()),
14355 output_tokens_details: Ok(Default::default()),
14356 total_tokens: Ok(Default::default()),
14357 }
14358 }
14359 }
14360 impl Usage {
14361 pub fn input_tokens<T>(mut self, value: T) -> Self
14362 where
14363 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14364 T::Error: ::std::fmt::Display,
14365 {
14366 self.input_tokens = value
14367 .try_into()
14368 .map_err(|e| {
14369 format!("error converting supplied value for input_tokens: {e}")
14370 });
14371 self
14372 }
14373 pub fn input_tokens_details<T>(mut self, value: T) -> Self
14374 where
14375 T: ::std::convert::TryInto<::std::option::Option<super::InputTokenDetails>>,
14376 T::Error: ::std::fmt::Display,
14377 {
14378 self.input_tokens_details = value
14379 .try_into()
14380 .map_err(|e| {
14381 format!(
14382 "error converting supplied value for input_tokens_details: {e}"
14383 )
14384 });
14385 self
14386 }
14387 pub fn output_tokens<T>(mut self, value: T) -> Self
14388 where
14389 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14390 T::Error: ::std::fmt::Display,
14391 {
14392 self.output_tokens = value
14393 .try_into()
14394 .map_err(|e| {
14395 format!("error converting supplied value for output_tokens: {e}")
14396 });
14397 self
14398 }
14399 pub fn output_tokens_details<T>(mut self, value: T) -> Self
14400 where
14401 T: ::std::convert::TryInto<::std::option::Option<super::OutputTokenDetails>>,
14402 T::Error: ::std::fmt::Display,
14403 {
14404 self.output_tokens_details = value
14405 .try_into()
14406 .map_err(|e| {
14407 format!(
14408 "error converting supplied value for output_tokens_details: {e}"
14409 )
14410 });
14411 self
14412 }
14413 pub fn total_tokens<T>(mut self, value: T) -> Self
14414 where
14415 T: ::std::convert::TryInto<::std::option::Option<i64>>,
14416 T::Error: ::std::fmt::Display,
14417 {
14418 self.total_tokens = value
14419 .try_into()
14420 .map_err(|e| {
14421 format!("error converting supplied value for total_tokens: {e}")
14422 });
14423 self
14424 }
14425 }
14426 impl ::std::convert::TryFrom<Usage> for super::Usage {
14427 type Error = super::error::ConversionError;
14428 fn try_from(
14429 value: Usage,
14430 ) -> ::std::result::Result<Self, super::error::ConversionError> {
14431 Ok(Self {
14432 input_tokens: value.input_tokens?,
14433 input_tokens_details: value.input_tokens_details?,
14434 output_tokens: value.output_tokens?,
14435 output_tokens_details: value.output_tokens_details?,
14436 total_tokens: value.total_tokens?,
14437 })
14438 }
14439 }
14440 impl ::std::convert::From<super::Usage> for Usage {
14441 fn from(value: super::Usage) -> Self {
14442 Self {
14443 input_tokens: Ok(value.input_tokens),
14444 input_tokens_details: Ok(value.input_tokens_details),
14445 output_tokens: Ok(value.output_tokens),
14446 output_tokens_details: Ok(value.output_tokens_details),
14447 total_tokens: Ok(value.total_tokens),
14448 }
14449 }
14450 }
14451}
14452pub mod error {
14454 pub struct ConversionError(::std::borrow::Cow<'static, str>);
14456 impl ::std::error::Error for ConversionError {}
14457 impl ::std::fmt::Display for ConversionError {
14458 fn fmt(
14459 &self,
14460 f: &mut ::std::fmt::Formatter<'_>,
14461 ) -> Result<(), ::std::fmt::Error> {
14462 ::std::fmt::Display::fmt(&self.0, f)
14463 }
14464 }
14465 impl ::std::fmt::Debug for ConversionError {
14466 fn fmt(
14467 &self,
14468 f: &mut ::std::fmt::Formatter<'_>,
14469 ) -> Result<(), ::std::fmt::Error> {
14470 ::std::fmt::Debug::fmt(&self.0, f)
14471 }
14472 }
14473 impl From<&'static str> for ConversionError {
14474 fn from(value: &'static str) -> Self {
14475 Self(value.into())
14476 }
14477 }
14478 impl From<String> for ConversionError {
14479 fn from(value: String) -> Self {
14480 Self(value.into())
14481 }
14482 }
14483}
14484
14485}
14486
14487 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "batchId", part: ::one::Part::Path, key: Some("batchId") }], required_parts: &[::one::Part::Path] };
14489
14490 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
14499 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4Cvo0xfg::i2gO9cmgT7GY1AwJPA0g8A", Method::POST, "/v1/batches/{{batchId}}/cancel").with_routed(&input, &ROUTING)?
14500 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
14501 }
14502
14503 impl IntoOperation for Input {
14504 type Output = output::Output;
14505
14506 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
14507 build(self)
14508 }
14509 }
14510 impl IntoOperation for builder::Input {
14511 type Output = output::Output;
14512
14513 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
14514 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
14515 }
14516 }
14517}
14518pub fn cancel_batch() -> cancel_batch::builder::Input {
14520 cancel_batch::builder::Input::default()
14521}
14522pub mod create_batch {
14523 use ::one::{Error, IntoOperation, Method, Operation};
14524#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
14526pub struct Headers {
14527 #[serde(
14529 rename = "Idempotency-Key",
14530 skip_serializing_if = "::std::option::Option::is_none"
14531 )]
14532 pub idempotency_key: ::std::option::Option<::std::string::String>,
14533}
14534impl Headers {
14535 pub fn builder() -> builder::Headers {
14536 Default::default()
14537 }
14538}
14539#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
14541#[serde(deny_unknown_fields)]
14542pub struct Input {
14543 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14545 pub completion_window: ::std::option::Option<InputCompletionWindow>,
14546 pub headers: Headers,
14547 pub input_file_id: ::std::string::String,
14549 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
14551 pub metadata: ::std::collections::HashMap<
14552 ::std::string::String,
14553 ::std::string::String,
14554 >,
14555}
14556impl Input {
14557 pub fn builder() -> builder::Input {
14558 Default::default()
14559 }
14560}
14561#[derive(
14563 ::serde::Deserialize,
14564 ::serde::Serialize,
14565 Clone,
14566 Copy,
14567 Debug,
14568 Eq,
14569 Hash,
14570 Ord,
14571 PartialEq,
14572 PartialOrd
14573)]
14574pub enum InputCompletionWindow {
14575 #[serde(rename = "24h")]
14576 X24h,
14577}
14578impl ::std::fmt::Display for InputCompletionWindow {
14579 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
14580 match *self {
14581 Self::X24h => f.write_str("24h"),
14582 }
14583 }
14584}
14585impl ::std::str::FromStr for InputCompletionWindow {
14586 type Err = self::error::ConversionError;
14587 fn from_str(
14588 value: &str,
14589 ) -> ::std::result::Result<Self, self::error::ConversionError> {
14590 match value {
14591 "24h" => Ok(Self::X24h),
14592 _ => Err("invalid value".into()),
14593 }
14594 }
14595}
14596impl ::std::convert::TryFrom<&str> for InputCompletionWindow {
14597 type Error = self::error::ConversionError;
14598 fn try_from(
14599 value: &str,
14600 ) -> ::std::result::Result<Self, self::error::ConversionError> {
14601 value.parse()
14602 }
14603}
14604impl ::std::convert::TryFrom<::std::string::String> for InputCompletionWindow {
14605 type Error = self::error::ConversionError;
14606 fn try_from(
14607 value: ::std::string::String,
14608 ) -> ::std::result::Result<Self, self::error::ConversionError> {
14609 value.parse()
14610 }
14611}
14612pub mod builder {
14614 #[derive(Clone, Debug)]
14615 pub struct Headers {
14616 idempotency_key: ::std::result::Result<
14617 ::std::option::Option<::std::string::String>,
14618 ::std::string::String,
14619 >,
14620 }
14621 impl ::std::default::Default for Headers {
14622 fn default() -> Self {
14623 Self {
14624 idempotency_key: Ok(Default::default()),
14625 }
14626 }
14627 }
14628 impl Headers {
14629 pub fn idempotency_key<T>(mut self, value: T) -> Self
14630 where
14631 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
14632 T::Error: ::std::fmt::Display,
14633 {
14634 self.idempotency_key = value
14635 .try_into()
14636 .map_err(|e| {
14637 format!("error converting supplied value for idempotency_key: {e}")
14638 });
14639 self
14640 }
14641 }
14642 impl ::std::convert::TryFrom<Headers> for super::Headers {
14643 type Error = super::error::ConversionError;
14644 fn try_from(
14645 value: Headers,
14646 ) -> ::std::result::Result<Self, super::error::ConversionError> {
14647 Ok(Self {
14648 idempotency_key: value.idempotency_key?,
14649 })
14650 }
14651 }
14652 impl ::std::convert::From<super::Headers> for Headers {
14653 fn from(value: super::Headers) -> Self {
14654 Self {
14655 idempotency_key: Ok(value.idempotency_key),
14656 }
14657 }
14658 }
14659 #[derive(Clone, Debug)]
14660 pub struct Input {
14661 completion_window: ::std::result::Result<
14662 ::std::option::Option<super::InputCompletionWindow>,
14663 ::std::string::String,
14664 >,
14665 headers: ::std::result::Result<super::Headers, ::std::string::String>,
14666 input_file_id: ::std::result::Result<
14667 ::std::string::String,
14668 ::std::string::String,
14669 >,
14670 metadata: ::std::result::Result<
14671 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
14672 ::std::string::String,
14673 >,
14674 }
14675 impl ::std::default::Default for Input {
14676 fn default() -> Self {
14677 Self {
14678 completion_window: Ok(Default::default()),
14679 headers: Err("no value supplied for headers".to_string()),
14680 input_file_id: Err("no value supplied for input_file_id".to_string()),
14681 metadata: Ok(Default::default()),
14682 }
14683 }
14684 }
14685 impl Input {
14686 pub fn completion_window<T>(mut self, value: T) -> Self
14687 where
14688 T: ::std::convert::TryInto<
14689 ::std::option::Option<super::InputCompletionWindow>,
14690 >,
14691 T::Error: ::std::fmt::Display,
14692 {
14693 self.completion_window = value
14694 .try_into()
14695 .map_err(|e| {
14696 format!("error converting supplied value for completion_window: {e}")
14697 });
14698 self
14699 }
14700 pub fn headers<T>(mut self, value: T) -> Self
14701 where
14702 T: ::std::convert::TryInto<super::Headers>,
14703 T::Error: ::std::fmt::Display,
14704 {
14705 self.headers = value
14706 .try_into()
14707 .map_err(|e| {
14708 format!("error converting supplied value for headers: {e}")
14709 });
14710 self
14711 }
14712 pub fn input_file_id<T>(mut self, value: T) -> Self
14713 where
14714 T: ::std::convert::TryInto<::std::string::String>,
14715 T::Error: ::std::fmt::Display,
14716 {
14717 self.input_file_id = value
14718 .try_into()
14719 .map_err(|e| {
14720 format!("error converting supplied value for input_file_id: {e}")
14721 });
14722 self
14723 }
14724 pub fn metadata<T>(mut self, value: T) -> Self
14725 where
14726 T: ::std::convert::TryInto<
14727 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
14728 >,
14729 T::Error: ::std::fmt::Display,
14730 {
14731 self.metadata = value
14732 .try_into()
14733 .map_err(|e| {
14734 format!("error converting supplied value for metadata: {e}")
14735 });
14736 self
14737 }
14738 }
14739 impl ::std::convert::TryFrom<Input> for super::Input {
14740 type Error = super::error::ConversionError;
14741 fn try_from(
14742 value: Input,
14743 ) -> ::std::result::Result<Self, super::error::ConversionError> {
14744 Ok(Self {
14745 completion_window: value.completion_window?,
14746 headers: value.headers?,
14747 input_file_id: value.input_file_id?,
14748 metadata: value.metadata?,
14749 })
14750 }
14751 }
14752 impl ::std::convert::From<super::Input> for Input {
14753 fn from(value: super::Input) -> Self {
14754 Self {
14755 completion_window: Ok(value.completion_window),
14756 headers: Ok(value.headers),
14757 input_file_id: Ok(value.input_file_id),
14758 metadata: Ok(value.metadata),
14759 }
14760 }
14761 }
14762}
14763pub mod error {
14765 pub struct ConversionError(::std::borrow::Cow<'static, str>);
14767 impl ::std::error::Error for ConversionError {}
14768 impl ::std::fmt::Display for ConversionError {
14769 fn fmt(
14770 &self,
14771 f: &mut ::std::fmt::Formatter<'_>,
14772 ) -> Result<(), ::std::fmt::Error> {
14773 ::std::fmt::Display::fmt(&self.0, f)
14774 }
14775 }
14776 impl ::std::fmt::Debug for ConversionError {
14777 fn fmt(
14778 &self,
14779 f: &mut ::std::fmt::Formatter<'_>,
14780 ) -> Result<(), ::std::fmt::Error> {
14781 ::std::fmt::Debug::fmt(&self.0, f)
14782 }
14783 }
14784 impl From<&'static str> for ConversionError {
14785 fn from(value: &'static str) -> Self {
14786 Self(value.into())
14787 }
14788 }
14789 impl From<String> for ConversionError {
14790 fn from(value: String) -> Self {
14791 Self(value.into())
14792 }
14793 }
14794}
14795
14796pub mod output {
14797#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
14799pub struct BatchErrors {
14800 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
14802 pub data: ::std::vec::Vec<BatchErrorsDataItem>,
14803 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14805 pub object: ::std::option::Option<BatchErrorsObject>,
14806}
14807impl BatchErrors {
14808 pub fn builder() -> builder::BatchErrors {
14809 Default::default()
14810 }
14811}
14812#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
14814pub struct BatchErrorsDataItem {
14815 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14817 pub code: ::std::option::Option<::std::string::String>,
14818 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14820 pub line: ::std::option::Option<i64>,
14821 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14823 pub message: ::std::option::Option<::std::string::String>,
14824}
14825impl BatchErrorsDataItem {
14826 pub fn builder() -> builder::BatchErrorsDataItem {
14827 Default::default()
14828 }
14829}
14830#[derive(
14832 ::serde::Deserialize,
14833 ::serde::Serialize,
14834 Clone,
14835 Copy,
14836 Debug,
14837 Eq,
14838 Hash,
14839 Ord,
14840 PartialEq,
14841 PartialOrd
14842)]
14843pub enum BatchErrorsObject {
14844 #[serde(rename = "list")]
14845 List,
14846}
14847impl ::std::fmt::Display for BatchErrorsObject {
14848 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
14849 match *self {
14850 Self::List => f.write_str("list"),
14851 }
14852 }
14853}
14854impl ::std::str::FromStr for BatchErrorsObject {
14855 type Err = self::error::ConversionError;
14856 fn from_str(
14857 value: &str,
14858 ) -> ::std::result::Result<Self, self::error::ConversionError> {
14859 match value {
14860 "list" => Ok(Self::List),
14861 _ => Err("invalid value".into()),
14862 }
14863 }
14864}
14865impl ::std::convert::TryFrom<&str> for BatchErrorsObject {
14866 type Error = self::error::ConversionError;
14867 fn try_from(
14868 value: &str,
14869 ) -> ::std::result::Result<Self, self::error::ConversionError> {
14870 value.parse()
14871 }
14872}
14873impl ::std::convert::TryFrom<::std::string::String> for BatchErrorsObject {
14874 type Error = self::error::ConversionError;
14875 fn try_from(
14876 value: ::std::string::String,
14877 ) -> ::std::result::Result<Self, self::error::ConversionError> {
14878 value.parse()
14879 }
14880}
14881#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
14883pub struct Error {
14884 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14886 pub code: ::std::option::Option<i64>,
14887 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14889 pub message: ::std::option::Option<::std::string::String>,
14890 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14892 pub param: ::std::option::Option<::std::string::String>,
14893 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
14895 pub type_: ::std::option::Option<::std::string::String>,
14896}
14897impl Error {
14898 pub fn builder() -> builder::Error {
14899 Default::default()
14900 }
14901}
14902#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
14904pub struct Output {
14905 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14907 pub cancelled_at: ::std::option::Option<i64>,
14908 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14910 pub cancelling_at: ::std::option::Option<i64>,
14911 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14913 pub completed_at: ::std::option::Option<i64>,
14914 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14916 pub completion_window: ::std::option::Option<::std::string::String>,
14917 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14919 pub created_at: ::std::option::Option<i64>,
14920 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14922 pub endpoint: ::std::option::Option<OutputEndpoint>,
14923 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14924 pub error: ::std::option::Option<Error>,
14925 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14927 pub error_file_id: ::std::option::Option<::std::string::String>,
14928 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14929 pub errors: ::std::option::Option<BatchErrors>,
14930 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14932 pub expired_at: ::std::option::Option<i64>,
14933 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14935 pub expires_at: ::std::option::Option<i64>,
14936 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14938 pub failed_at: ::std::option::Option<i64>,
14939 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14941 pub finalizing_at: ::std::option::Option<i64>,
14942 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14944 pub id: ::std::option::Option<::std::string::String>,
14945 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14947 pub in_progress_at: ::std::option::Option<i64>,
14948 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14950 pub input_file_id: ::std::option::Option<::std::string::String>,
14951 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
14953 pub metadata: ::std::collections::HashMap<
14954 ::std::string::String,
14955 ::std::string::String,
14956 >,
14957 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14959 pub object: ::std::option::Option<OutputObject>,
14960 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14962 pub output_file_id: ::std::option::Option<::std::string::String>,
14963 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14964 pub request_counts: ::std::option::Option<RequestCounts>,
14965 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14967 pub status: ::std::option::Option<OutputStatus>,
14968 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
14969 pub usage: ::std::option::Option<Usage>,
14970}
14971impl Output {
14972 pub fn builder() -> builder::Output {
14973 Default::default()
14974 }
14975}
14976#[derive(
14978 ::serde::Deserialize,
14979 ::serde::Serialize,
14980 Clone,
14981 Copy,
14982 Debug,
14983 Eq,
14984 Hash,
14985 Ord,
14986 PartialEq,
14987 PartialOrd
14988)]
14989pub enum OutputEndpoint {
14990 #[serde(rename = "/v1/responses")]
14991 V1Responses,
14992}
14993impl ::std::fmt::Display for OutputEndpoint {
14994 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
14995 match *self {
14996 Self::V1Responses => f.write_str("/v1/responses"),
14997 }
14998 }
14999}
15000impl ::std::str::FromStr for OutputEndpoint {
15001 type Err = self::error::ConversionError;
15002 fn from_str(
15003 value: &str,
15004 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15005 match value {
15006 "/v1/responses" => Ok(Self::V1Responses),
15007 _ => Err("invalid value".into()),
15008 }
15009 }
15010}
15011impl ::std::convert::TryFrom<&str> for OutputEndpoint {
15012 type Error = self::error::ConversionError;
15013 fn try_from(
15014 value: &str,
15015 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15016 value.parse()
15017 }
15018}
15019impl ::std::convert::TryFrom<::std::string::String> for OutputEndpoint {
15020 type Error = self::error::ConversionError;
15021 fn try_from(
15022 value: ::std::string::String,
15023 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15024 value.parse()
15025 }
15026}
15027#[derive(
15029 ::serde::Deserialize,
15030 ::serde::Serialize,
15031 Clone,
15032 Copy,
15033 Debug,
15034 Eq,
15035 Hash,
15036 Ord,
15037 PartialEq,
15038 PartialOrd
15039)]
15040pub enum OutputObject {
15041 #[serde(rename = "batch")]
15042 Batch,
15043}
15044impl ::std::fmt::Display for OutputObject {
15045 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
15046 match *self {
15047 Self::Batch => f.write_str("batch"),
15048 }
15049 }
15050}
15051impl ::std::str::FromStr for OutputObject {
15052 type Err = self::error::ConversionError;
15053 fn from_str(
15054 value: &str,
15055 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15056 match value {
15057 "batch" => Ok(Self::Batch),
15058 _ => Err("invalid value".into()),
15059 }
15060 }
15061}
15062impl ::std::convert::TryFrom<&str> for OutputObject {
15063 type Error = self::error::ConversionError;
15064 fn try_from(
15065 value: &str,
15066 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15067 value.parse()
15068 }
15069}
15070impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
15071 type Error = self::error::ConversionError;
15072 fn try_from(
15073 value: ::std::string::String,
15074 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15075 value.parse()
15076 }
15077}
15078#[derive(
15080 ::serde::Deserialize,
15081 ::serde::Serialize,
15082 Clone,
15083 Copy,
15084 Debug,
15085 Eq,
15086 Hash,
15087 Ord,
15088 PartialEq,
15089 PartialOrd
15090)]
15091pub enum OutputStatus {
15092 #[serde(rename = "validating")]
15093 Validating,
15094 #[serde(rename = "in_progress")]
15095 InProgress,
15096 #[serde(rename = "finalizing")]
15097 Finalizing,
15098 #[serde(rename = "completed")]
15099 Completed,
15100 #[serde(rename = "expired")]
15101 Expired,
15102 #[serde(rename = "cancelling")]
15103 Cancelling,
15104 #[serde(rename = "cancelled")]
15105 Cancelled,
15106 #[serde(rename = "failed")]
15107 Failed,
15108}
15109impl ::std::fmt::Display for OutputStatus {
15110 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
15111 match *self {
15112 Self::Validating => f.write_str("validating"),
15113 Self::InProgress => f.write_str("in_progress"),
15114 Self::Finalizing => f.write_str("finalizing"),
15115 Self::Completed => f.write_str("completed"),
15116 Self::Expired => f.write_str("expired"),
15117 Self::Cancelling => f.write_str("cancelling"),
15118 Self::Cancelled => f.write_str("cancelled"),
15119 Self::Failed => f.write_str("failed"),
15120 }
15121 }
15122}
15123impl ::std::str::FromStr for OutputStatus {
15124 type Err = self::error::ConversionError;
15125 fn from_str(
15126 value: &str,
15127 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15128 match value {
15129 "validating" => Ok(Self::Validating),
15130 "in_progress" => Ok(Self::InProgress),
15131 "finalizing" => Ok(Self::Finalizing),
15132 "completed" => Ok(Self::Completed),
15133 "expired" => Ok(Self::Expired),
15134 "cancelling" => Ok(Self::Cancelling),
15135 "cancelled" => Ok(Self::Cancelled),
15136 "failed" => Ok(Self::Failed),
15137 _ => Err("invalid value".into()),
15138 }
15139 }
15140}
15141impl ::std::convert::TryFrom<&str> for OutputStatus {
15142 type Error = self::error::ConversionError;
15143 fn try_from(
15144 value: &str,
15145 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15146 value.parse()
15147 }
15148}
15149impl ::std::convert::TryFrom<::std::string::String> for OutputStatus {
15150 type Error = self::error::ConversionError;
15151 fn try_from(
15152 value: ::std::string::String,
15153 ) -> ::std::result::Result<Self, self::error::ConversionError> {
15154 value.parse()
15155 }
15156}
15157#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
15159pub struct RequestCounts {
15160 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15162 pub completed: ::std::option::Option<i64>,
15163 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15165 pub failed: ::std::option::Option<i64>,
15166 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15168 pub total: ::std::option::Option<i64>,
15169}
15170impl RequestCounts {
15171 pub fn builder() -> builder::RequestCounts {
15172 Default::default()
15173 }
15174}
15175#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
15177pub struct Usage {
15178 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15180 pub input_tokens: ::std::option::Option<i64>,
15181 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15182 pub input_tokens_details: ::std::option::Option<UsageInputTokensDetails>,
15183 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15185 pub output_tokens: ::std::option::Option<i64>,
15186 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15187 pub output_tokens_details: ::std::option::Option<UsageOutputTokensDetails>,
15188 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15190 pub total_tokens: ::std::option::Option<i64>,
15191}
15192impl Usage {
15193 pub fn builder() -> builder::Usage {
15194 Default::default()
15195 }
15196}
15197#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
15199pub struct UsageInputTokensDetails {
15200 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15202 pub cached_tokens: ::std::option::Option<i64>,
15203}
15204impl UsageInputTokensDetails {
15205 pub fn builder() -> builder::UsageInputTokensDetails {
15206 Default::default()
15207 }
15208}
15209#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
15211pub struct UsageOutputTokensDetails {
15212 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
15214 pub reasoning_tokens: ::std::option::Option<i64>,
15215}
15216impl UsageOutputTokensDetails {
15217 pub fn builder() -> builder::UsageOutputTokensDetails {
15218 Default::default()
15219 }
15220}
15221pub mod builder {
15223 #[derive(Clone, Debug)]
15224 pub struct BatchErrors {
15225 data: ::std::result::Result<
15226 ::std::vec::Vec<super::BatchErrorsDataItem>,
15227 ::std::string::String,
15228 >,
15229 object: ::std::result::Result<
15230 ::std::option::Option<super::BatchErrorsObject>,
15231 ::std::string::String,
15232 >,
15233 }
15234 impl ::std::default::Default for BatchErrors {
15235 fn default() -> Self {
15236 Self {
15237 data: Ok(Default::default()),
15238 object: Ok(Default::default()),
15239 }
15240 }
15241 }
15242 impl BatchErrors {
15243 pub fn data<T>(mut self, value: T) -> Self
15244 where
15245 T: ::std::convert::TryInto<::std::vec::Vec<super::BatchErrorsDataItem>>,
15246 T::Error: ::std::fmt::Display,
15247 {
15248 self.data = value
15249 .try_into()
15250 .map_err(|e| format!("error converting supplied value for data: {e}"));
15251 self
15252 }
15253 pub fn object<T>(mut self, value: T) -> Self
15254 where
15255 T: ::std::convert::TryInto<::std::option::Option<super::BatchErrorsObject>>,
15256 T::Error: ::std::fmt::Display,
15257 {
15258 self.object = value
15259 .try_into()
15260 .map_err(|e| format!("error converting supplied value for object: {e}"));
15261 self
15262 }
15263 }
15264 impl ::std::convert::TryFrom<BatchErrors> for super::BatchErrors {
15265 type Error = super::error::ConversionError;
15266 fn try_from(
15267 value: BatchErrors,
15268 ) -> ::std::result::Result<Self, super::error::ConversionError> {
15269 Ok(Self {
15270 data: value.data?,
15271 object: value.object?,
15272 })
15273 }
15274 }
15275 impl ::std::convert::From<super::BatchErrors> for BatchErrors {
15276 fn from(value: super::BatchErrors) -> Self {
15277 Self {
15278 data: Ok(value.data),
15279 object: Ok(value.object),
15280 }
15281 }
15282 }
15283 #[derive(Clone, Debug)]
15284 pub struct BatchErrorsDataItem {
15285 code: ::std::result::Result<
15286 ::std::option::Option<::std::string::String>,
15287 ::std::string::String,
15288 >,
15289 line: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
15290 message: ::std::result::Result<
15291 ::std::option::Option<::std::string::String>,
15292 ::std::string::String,
15293 >,
15294 }
15295 impl ::std::default::Default for BatchErrorsDataItem {
15296 fn default() -> Self {
15297 Self {
15298 code: Ok(Default::default()),
15299 line: Ok(Default::default()),
15300 message: Ok(Default::default()),
15301 }
15302 }
15303 }
15304 impl BatchErrorsDataItem {
15305 pub fn code<T>(mut self, value: T) -> Self
15306 where
15307 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15308 T::Error: ::std::fmt::Display,
15309 {
15310 self.code = value
15311 .try_into()
15312 .map_err(|e| format!("error converting supplied value for code: {e}"));
15313 self
15314 }
15315 pub fn line<T>(mut self, value: T) -> Self
15316 where
15317 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15318 T::Error: ::std::fmt::Display,
15319 {
15320 self.line = value
15321 .try_into()
15322 .map_err(|e| format!("error converting supplied value for line: {e}"));
15323 self
15324 }
15325 pub fn message<T>(mut self, value: T) -> Self
15326 where
15327 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15328 T::Error: ::std::fmt::Display,
15329 {
15330 self.message = value
15331 .try_into()
15332 .map_err(|e| {
15333 format!("error converting supplied value for message: {e}")
15334 });
15335 self
15336 }
15337 }
15338 impl ::std::convert::TryFrom<BatchErrorsDataItem> for super::BatchErrorsDataItem {
15339 type Error = super::error::ConversionError;
15340 fn try_from(
15341 value: BatchErrorsDataItem,
15342 ) -> ::std::result::Result<Self, super::error::ConversionError> {
15343 Ok(Self {
15344 code: value.code?,
15345 line: value.line?,
15346 message: value.message?,
15347 })
15348 }
15349 }
15350 impl ::std::convert::From<super::BatchErrorsDataItem> for BatchErrorsDataItem {
15351 fn from(value: super::BatchErrorsDataItem) -> Self {
15352 Self {
15353 code: Ok(value.code),
15354 line: Ok(value.line),
15355 message: Ok(value.message),
15356 }
15357 }
15358 }
15359 #[derive(Clone, Debug)]
15360 pub struct Error {
15361 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
15362 message: ::std::result::Result<
15363 ::std::option::Option<::std::string::String>,
15364 ::std::string::String,
15365 >,
15366 param: ::std::result::Result<
15367 ::std::option::Option<::std::string::String>,
15368 ::std::string::String,
15369 >,
15370 type_: ::std::result::Result<
15371 ::std::option::Option<::std::string::String>,
15372 ::std::string::String,
15373 >,
15374 }
15375 impl ::std::default::Default for Error {
15376 fn default() -> Self {
15377 Self {
15378 code: Ok(Default::default()),
15379 message: Ok(Default::default()),
15380 param: Ok(Default::default()),
15381 type_: Ok(Default::default()),
15382 }
15383 }
15384 }
15385 impl Error {
15386 pub fn code<T>(mut self, value: T) -> Self
15387 where
15388 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15389 T::Error: ::std::fmt::Display,
15390 {
15391 self.code = value
15392 .try_into()
15393 .map_err(|e| format!("error converting supplied value for code: {e}"));
15394 self
15395 }
15396 pub fn message<T>(mut self, value: T) -> Self
15397 where
15398 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15399 T::Error: ::std::fmt::Display,
15400 {
15401 self.message = value
15402 .try_into()
15403 .map_err(|e| {
15404 format!("error converting supplied value for message: {e}")
15405 });
15406 self
15407 }
15408 pub fn param<T>(mut self, value: T) -> Self
15409 where
15410 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15411 T::Error: ::std::fmt::Display,
15412 {
15413 self.param = value
15414 .try_into()
15415 .map_err(|e| format!("error converting supplied value for param: {e}"));
15416 self
15417 }
15418 pub fn type_<T>(mut self, value: T) -> Self
15419 where
15420 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15421 T::Error: ::std::fmt::Display,
15422 {
15423 self.type_ = value
15424 .try_into()
15425 .map_err(|e| format!("error converting supplied value for type_: {e}"));
15426 self
15427 }
15428 }
15429 impl ::std::convert::TryFrom<Error> for super::Error {
15430 type Error = super::error::ConversionError;
15431 fn try_from(
15432 value: Error,
15433 ) -> ::std::result::Result<Self, super::error::ConversionError> {
15434 Ok(Self {
15435 code: value.code?,
15436 message: value.message?,
15437 param: value.param?,
15438 type_: value.type_?,
15439 })
15440 }
15441 }
15442 impl ::std::convert::From<super::Error> for Error {
15443 fn from(value: super::Error) -> Self {
15444 Self {
15445 code: Ok(value.code),
15446 message: Ok(value.message),
15447 param: Ok(value.param),
15448 type_: Ok(value.type_),
15449 }
15450 }
15451 }
15452 #[derive(Clone, Debug)]
15453 pub struct Output {
15454 cancelled_at: ::std::result::Result<
15455 ::std::option::Option<i64>,
15456 ::std::string::String,
15457 >,
15458 cancelling_at: ::std::result::Result<
15459 ::std::option::Option<i64>,
15460 ::std::string::String,
15461 >,
15462 completed_at: ::std::result::Result<
15463 ::std::option::Option<i64>,
15464 ::std::string::String,
15465 >,
15466 completion_window: ::std::result::Result<
15467 ::std::option::Option<::std::string::String>,
15468 ::std::string::String,
15469 >,
15470 created_at: ::std::result::Result<
15471 ::std::option::Option<i64>,
15472 ::std::string::String,
15473 >,
15474 endpoint: ::std::result::Result<
15475 ::std::option::Option<super::OutputEndpoint>,
15476 ::std::string::String,
15477 >,
15478 error: ::std::result::Result<
15479 ::std::option::Option<super::Error>,
15480 ::std::string::String,
15481 >,
15482 error_file_id: ::std::result::Result<
15483 ::std::option::Option<::std::string::String>,
15484 ::std::string::String,
15485 >,
15486 errors: ::std::result::Result<
15487 ::std::option::Option<super::BatchErrors>,
15488 ::std::string::String,
15489 >,
15490 expired_at: ::std::result::Result<
15491 ::std::option::Option<i64>,
15492 ::std::string::String,
15493 >,
15494 expires_at: ::std::result::Result<
15495 ::std::option::Option<i64>,
15496 ::std::string::String,
15497 >,
15498 failed_at: ::std::result::Result<
15499 ::std::option::Option<i64>,
15500 ::std::string::String,
15501 >,
15502 finalizing_at: ::std::result::Result<
15503 ::std::option::Option<i64>,
15504 ::std::string::String,
15505 >,
15506 id: ::std::result::Result<
15507 ::std::option::Option<::std::string::String>,
15508 ::std::string::String,
15509 >,
15510 in_progress_at: ::std::result::Result<
15511 ::std::option::Option<i64>,
15512 ::std::string::String,
15513 >,
15514 input_file_id: ::std::result::Result<
15515 ::std::option::Option<::std::string::String>,
15516 ::std::string::String,
15517 >,
15518 metadata: ::std::result::Result<
15519 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
15520 ::std::string::String,
15521 >,
15522 object: ::std::result::Result<
15523 ::std::option::Option<super::OutputObject>,
15524 ::std::string::String,
15525 >,
15526 output_file_id: ::std::result::Result<
15527 ::std::option::Option<::std::string::String>,
15528 ::std::string::String,
15529 >,
15530 request_counts: ::std::result::Result<
15531 ::std::option::Option<super::RequestCounts>,
15532 ::std::string::String,
15533 >,
15534 status: ::std::result::Result<
15535 ::std::option::Option<super::OutputStatus>,
15536 ::std::string::String,
15537 >,
15538 usage: ::std::result::Result<
15539 ::std::option::Option<super::Usage>,
15540 ::std::string::String,
15541 >,
15542 }
15543 impl ::std::default::Default for Output {
15544 fn default() -> Self {
15545 Self {
15546 cancelled_at: Ok(Default::default()),
15547 cancelling_at: Ok(Default::default()),
15548 completed_at: Ok(Default::default()),
15549 completion_window: Ok(Default::default()),
15550 created_at: Ok(Default::default()),
15551 endpoint: Ok(Default::default()),
15552 error: Ok(Default::default()),
15553 error_file_id: Ok(Default::default()),
15554 errors: Ok(Default::default()),
15555 expired_at: Ok(Default::default()),
15556 expires_at: Ok(Default::default()),
15557 failed_at: Ok(Default::default()),
15558 finalizing_at: Ok(Default::default()),
15559 id: Ok(Default::default()),
15560 in_progress_at: Ok(Default::default()),
15561 input_file_id: Ok(Default::default()),
15562 metadata: Ok(Default::default()),
15563 object: Ok(Default::default()),
15564 output_file_id: Ok(Default::default()),
15565 request_counts: Ok(Default::default()),
15566 status: Ok(Default::default()),
15567 usage: Ok(Default::default()),
15568 }
15569 }
15570 }
15571 impl Output {
15572 pub fn cancelled_at<T>(mut self, value: T) -> Self
15573 where
15574 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15575 T::Error: ::std::fmt::Display,
15576 {
15577 self.cancelled_at = value
15578 .try_into()
15579 .map_err(|e| {
15580 format!("error converting supplied value for cancelled_at: {e}")
15581 });
15582 self
15583 }
15584 pub fn cancelling_at<T>(mut self, value: T) -> Self
15585 where
15586 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15587 T::Error: ::std::fmt::Display,
15588 {
15589 self.cancelling_at = value
15590 .try_into()
15591 .map_err(|e| {
15592 format!("error converting supplied value for cancelling_at: {e}")
15593 });
15594 self
15595 }
15596 pub fn completed_at<T>(mut self, value: T) -> Self
15597 where
15598 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15599 T::Error: ::std::fmt::Display,
15600 {
15601 self.completed_at = value
15602 .try_into()
15603 .map_err(|e| {
15604 format!("error converting supplied value for completed_at: {e}")
15605 });
15606 self
15607 }
15608 pub fn completion_window<T>(mut self, value: T) -> Self
15609 where
15610 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15611 T::Error: ::std::fmt::Display,
15612 {
15613 self.completion_window = value
15614 .try_into()
15615 .map_err(|e| {
15616 format!("error converting supplied value for completion_window: {e}")
15617 });
15618 self
15619 }
15620 pub fn created_at<T>(mut self, value: T) -> Self
15621 where
15622 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15623 T::Error: ::std::fmt::Display,
15624 {
15625 self.created_at = value
15626 .try_into()
15627 .map_err(|e| {
15628 format!("error converting supplied value for created_at: {e}")
15629 });
15630 self
15631 }
15632 pub fn endpoint<T>(mut self, value: T) -> Self
15633 where
15634 T: ::std::convert::TryInto<::std::option::Option<super::OutputEndpoint>>,
15635 T::Error: ::std::fmt::Display,
15636 {
15637 self.endpoint = value
15638 .try_into()
15639 .map_err(|e| {
15640 format!("error converting supplied value for endpoint: {e}")
15641 });
15642 self
15643 }
15644 pub fn error<T>(mut self, value: T) -> Self
15645 where
15646 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
15647 T::Error: ::std::fmt::Display,
15648 {
15649 self.error = value
15650 .try_into()
15651 .map_err(|e| format!("error converting supplied value for error: {e}"));
15652 self
15653 }
15654 pub fn error_file_id<T>(mut self, value: T) -> Self
15655 where
15656 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15657 T::Error: ::std::fmt::Display,
15658 {
15659 self.error_file_id = value
15660 .try_into()
15661 .map_err(|e| {
15662 format!("error converting supplied value for error_file_id: {e}")
15663 });
15664 self
15665 }
15666 pub fn errors<T>(mut self, value: T) -> Self
15667 where
15668 T: ::std::convert::TryInto<::std::option::Option<super::BatchErrors>>,
15669 T::Error: ::std::fmt::Display,
15670 {
15671 self.errors = value
15672 .try_into()
15673 .map_err(|e| format!("error converting supplied value for errors: {e}"));
15674 self
15675 }
15676 pub fn expired_at<T>(mut self, value: T) -> Self
15677 where
15678 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15679 T::Error: ::std::fmt::Display,
15680 {
15681 self.expired_at = value
15682 .try_into()
15683 .map_err(|e| {
15684 format!("error converting supplied value for expired_at: {e}")
15685 });
15686 self
15687 }
15688 pub fn expires_at<T>(mut self, value: T) -> Self
15689 where
15690 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15691 T::Error: ::std::fmt::Display,
15692 {
15693 self.expires_at = value
15694 .try_into()
15695 .map_err(|e| {
15696 format!("error converting supplied value for expires_at: {e}")
15697 });
15698 self
15699 }
15700 pub fn failed_at<T>(mut self, value: T) -> Self
15701 where
15702 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15703 T::Error: ::std::fmt::Display,
15704 {
15705 self.failed_at = value
15706 .try_into()
15707 .map_err(|e| {
15708 format!("error converting supplied value for failed_at: {e}")
15709 });
15710 self
15711 }
15712 pub fn finalizing_at<T>(mut self, value: T) -> Self
15713 where
15714 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15715 T::Error: ::std::fmt::Display,
15716 {
15717 self.finalizing_at = value
15718 .try_into()
15719 .map_err(|e| {
15720 format!("error converting supplied value for finalizing_at: {e}")
15721 });
15722 self
15723 }
15724 pub fn id<T>(mut self, value: T) -> Self
15725 where
15726 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15727 T::Error: ::std::fmt::Display,
15728 {
15729 self.id = value
15730 .try_into()
15731 .map_err(|e| format!("error converting supplied value for id: {e}"));
15732 self
15733 }
15734 pub fn in_progress_at<T>(mut self, value: T) -> Self
15735 where
15736 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15737 T::Error: ::std::fmt::Display,
15738 {
15739 self.in_progress_at = value
15740 .try_into()
15741 .map_err(|e| {
15742 format!("error converting supplied value for in_progress_at: {e}")
15743 });
15744 self
15745 }
15746 pub fn input_file_id<T>(mut self, value: T) -> Self
15747 where
15748 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15749 T::Error: ::std::fmt::Display,
15750 {
15751 self.input_file_id = value
15752 .try_into()
15753 .map_err(|e| {
15754 format!("error converting supplied value for input_file_id: {e}")
15755 });
15756 self
15757 }
15758 pub fn metadata<T>(mut self, value: T) -> Self
15759 where
15760 T: ::std::convert::TryInto<
15761 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
15762 >,
15763 T::Error: ::std::fmt::Display,
15764 {
15765 self.metadata = value
15766 .try_into()
15767 .map_err(|e| {
15768 format!("error converting supplied value for metadata: {e}")
15769 });
15770 self
15771 }
15772 pub fn object<T>(mut self, value: T) -> Self
15773 where
15774 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
15775 T::Error: ::std::fmt::Display,
15776 {
15777 self.object = value
15778 .try_into()
15779 .map_err(|e| format!("error converting supplied value for object: {e}"));
15780 self
15781 }
15782 pub fn output_file_id<T>(mut self, value: T) -> Self
15783 where
15784 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
15785 T::Error: ::std::fmt::Display,
15786 {
15787 self.output_file_id = value
15788 .try_into()
15789 .map_err(|e| {
15790 format!("error converting supplied value for output_file_id: {e}")
15791 });
15792 self
15793 }
15794 pub fn request_counts<T>(mut self, value: T) -> Self
15795 where
15796 T: ::std::convert::TryInto<::std::option::Option<super::RequestCounts>>,
15797 T::Error: ::std::fmt::Display,
15798 {
15799 self.request_counts = value
15800 .try_into()
15801 .map_err(|e| {
15802 format!("error converting supplied value for request_counts: {e}")
15803 });
15804 self
15805 }
15806 pub fn status<T>(mut self, value: T) -> Self
15807 where
15808 T: ::std::convert::TryInto<::std::option::Option<super::OutputStatus>>,
15809 T::Error: ::std::fmt::Display,
15810 {
15811 self.status = value
15812 .try_into()
15813 .map_err(|e| format!("error converting supplied value for status: {e}"));
15814 self
15815 }
15816 pub fn usage<T>(mut self, value: T) -> Self
15817 where
15818 T: ::std::convert::TryInto<::std::option::Option<super::Usage>>,
15819 T::Error: ::std::fmt::Display,
15820 {
15821 self.usage = value
15822 .try_into()
15823 .map_err(|e| format!("error converting supplied value for usage: {e}"));
15824 self
15825 }
15826 }
15827 impl ::std::convert::TryFrom<Output> for super::Output {
15828 type Error = super::error::ConversionError;
15829 fn try_from(
15830 value: Output,
15831 ) -> ::std::result::Result<Self, super::error::ConversionError> {
15832 Ok(Self {
15833 cancelled_at: value.cancelled_at?,
15834 cancelling_at: value.cancelling_at?,
15835 completed_at: value.completed_at?,
15836 completion_window: value.completion_window?,
15837 created_at: value.created_at?,
15838 endpoint: value.endpoint?,
15839 error: value.error?,
15840 error_file_id: value.error_file_id?,
15841 errors: value.errors?,
15842 expired_at: value.expired_at?,
15843 expires_at: value.expires_at?,
15844 failed_at: value.failed_at?,
15845 finalizing_at: value.finalizing_at?,
15846 id: value.id?,
15847 in_progress_at: value.in_progress_at?,
15848 input_file_id: value.input_file_id?,
15849 metadata: value.metadata?,
15850 object: value.object?,
15851 output_file_id: value.output_file_id?,
15852 request_counts: value.request_counts?,
15853 status: value.status?,
15854 usage: value.usage?,
15855 })
15856 }
15857 }
15858 impl ::std::convert::From<super::Output> for Output {
15859 fn from(value: super::Output) -> Self {
15860 Self {
15861 cancelled_at: Ok(value.cancelled_at),
15862 cancelling_at: Ok(value.cancelling_at),
15863 completed_at: Ok(value.completed_at),
15864 completion_window: Ok(value.completion_window),
15865 created_at: Ok(value.created_at),
15866 endpoint: Ok(value.endpoint),
15867 error: Ok(value.error),
15868 error_file_id: Ok(value.error_file_id),
15869 errors: Ok(value.errors),
15870 expired_at: Ok(value.expired_at),
15871 expires_at: Ok(value.expires_at),
15872 failed_at: Ok(value.failed_at),
15873 finalizing_at: Ok(value.finalizing_at),
15874 id: Ok(value.id),
15875 in_progress_at: Ok(value.in_progress_at),
15876 input_file_id: Ok(value.input_file_id),
15877 metadata: Ok(value.metadata),
15878 object: Ok(value.object),
15879 output_file_id: Ok(value.output_file_id),
15880 request_counts: Ok(value.request_counts),
15881 status: Ok(value.status),
15882 usage: Ok(value.usage),
15883 }
15884 }
15885 }
15886 #[derive(Clone, Debug)]
15887 pub struct RequestCounts {
15888 completed: ::std::result::Result<
15889 ::std::option::Option<i64>,
15890 ::std::string::String,
15891 >,
15892 failed: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
15893 total: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
15894 }
15895 impl ::std::default::Default for RequestCounts {
15896 fn default() -> Self {
15897 Self {
15898 completed: Ok(Default::default()),
15899 failed: Ok(Default::default()),
15900 total: Ok(Default::default()),
15901 }
15902 }
15903 }
15904 impl RequestCounts {
15905 pub fn completed<T>(mut self, value: T) -> Self
15906 where
15907 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15908 T::Error: ::std::fmt::Display,
15909 {
15910 self.completed = value
15911 .try_into()
15912 .map_err(|e| {
15913 format!("error converting supplied value for completed: {e}")
15914 });
15915 self
15916 }
15917 pub fn failed<T>(mut self, value: T) -> Self
15918 where
15919 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15920 T::Error: ::std::fmt::Display,
15921 {
15922 self.failed = value
15923 .try_into()
15924 .map_err(|e| format!("error converting supplied value for failed: {e}"));
15925 self
15926 }
15927 pub fn total<T>(mut self, value: T) -> Self
15928 where
15929 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15930 T::Error: ::std::fmt::Display,
15931 {
15932 self.total = value
15933 .try_into()
15934 .map_err(|e| format!("error converting supplied value for total: {e}"));
15935 self
15936 }
15937 }
15938 impl ::std::convert::TryFrom<RequestCounts> for super::RequestCounts {
15939 type Error = super::error::ConversionError;
15940 fn try_from(
15941 value: RequestCounts,
15942 ) -> ::std::result::Result<Self, super::error::ConversionError> {
15943 Ok(Self {
15944 completed: value.completed?,
15945 failed: value.failed?,
15946 total: value.total?,
15947 })
15948 }
15949 }
15950 impl ::std::convert::From<super::RequestCounts> for RequestCounts {
15951 fn from(value: super::RequestCounts) -> Self {
15952 Self {
15953 completed: Ok(value.completed),
15954 failed: Ok(value.failed),
15955 total: Ok(value.total),
15956 }
15957 }
15958 }
15959 #[derive(Clone, Debug)]
15960 pub struct Usage {
15961 input_tokens: ::std::result::Result<
15962 ::std::option::Option<i64>,
15963 ::std::string::String,
15964 >,
15965 input_tokens_details: ::std::result::Result<
15966 ::std::option::Option<super::UsageInputTokensDetails>,
15967 ::std::string::String,
15968 >,
15969 output_tokens: ::std::result::Result<
15970 ::std::option::Option<i64>,
15971 ::std::string::String,
15972 >,
15973 output_tokens_details: ::std::result::Result<
15974 ::std::option::Option<super::UsageOutputTokensDetails>,
15975 ::std::string::String,
15976 >,
15977 total_tokens: ::std::result::Result<
15978 ::std::option::Option<i64>,
15979 ::std::string::String,
15980 >,
15981 }
15982 impl ::std::default::Default for Usage {
15983 fn default() -> Self {
15984 Self {
15985 input_tokens: Ok(Default::default()),
15986 input_tokens_details: Ok(Default::default()),
15987 output_tokens: Ok(Default::default()),
15988 output_tokens_details: Ok(Default::default()),
15989 total_tokens: Ok(Default::default()),
15990 }
15991 }
15992 }
15993 impl Usage {
15994 pub fn input_tokens<T>(mut self, value: T) -> Self
15995 where
15996 T: ::std::convert::TryInto<::std::option::Option<i64>>,
15997 T::Error: ::std::fmt::Display,
15998 {
15999 self.input_tokens = value
16000 .try_into()
16001 .map_err(|e| {
16002 format!("error converting supplied value for input_tokens: {e}")
16003 });
16004 self
16005 }
16006 pub fn input_tokens_details<T>(mut self, value: T) -> Self
16007 where
16008 T: ::std::convert::TryInto<
16009 ::std::option::Option<super::UsageInputTokensDetails>,
16010 >,
16011 T::Error: ::std::fmt::Display,
16012 {
16013 self.input_tokens_details = value
16014 .try_into()
16015 .map_err(|e| {
16016 format!(
16017 "error converting supplied value for input_tokens_details: {e}"
16018 )
16019 });
16020 self
16021 }
16022 pub fn output_tokens<T>(mut self, value: T) -> Self
16023 where
16024 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16025 T::Error: ::std::fmt::Display,
16026 {
16027 self.output_tokens = value
16028 .try_into()
16029 .map_err(|e| {
16030 format!("error converting supplied value for output_tokens: {e}")
16031 });
16032 self
16033 }
16034 pub fn output_tokens_details<T>(mut self, value: T) -> Self
16035 where
16036 T: ::std::convert::TryInto<
16037 ::std::option::Option<super::UsageOutputTokensDetails>,
16038 >,
16039 T::Error: ::std::fmt::Display,
16040 {
16041 self.output_tokens_details = value
16042 .try_into()
16043 .map_err(|e| {
16044 format!(
16045 "error converting supplied value for output_tokens_details: {e}"
16046 )
16047 });
16048 self
16049 }
16050 pub fn total_tokens<T>(mut self, value: T) -> Self
16051 where
16052 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16053 T::Error: ::std::fmt::Display,
16054 {
16055 self.total_tokens = value
16056 .try_into()
16057 .map_err(|e| {
16058 format!("error converting supplied value for total_tokens: {e}")
16059 });
16060 self
16061 }
16062 }
16063 impl ::std::convert::TryFrom<Usage> for super::Usage {
16064 type Error = super::error::ConversionError;
16065 fn try_from(
16066 value: Usage,
16067 ) -> ::std::result::Result<Self, super::error::ConversionError> {
16068 Ok(Self {
16069 input_tokens: value.input_tokens?,
16070 input_tokens_details: value.input_tokens_details?,
16071 output_tokens: value.output_tokens?,
16072 output_tokens_details: value.output_tokens_details?,
16073 total_tokens: value.total_tokens?,
16074 })
16075 }
16076 }
16077 impl ::std::convert::From<super::Usage> for Usage {
16078 fn from(value: super::Usage) -> Self {
16079 Self {
16080 input_tokens: Ok(value.input_tokens),
16081 input_tokens_details: Ok(value.input_tokens_details),
16082 output_tokens: Ok(value.output_tokens),
16083 output_tokens_details: Ok(value.output_tokens_details),
16084 total_tokens: Ok(value.total_tokens),
16085 }
16086 }
16087 }
16088 #[derive(Clone, Debug)]
16089 pub struct UsageInputTokensDetails {
16090 cached_tokens: ::std::result::Result<
16091 ::std::option::Option<i64>,
16092 ::std::string::String,
16093 >,
16094 }
16095 impl ::std::default::Default for UsageInputTokensDetails {
16096 fn default() -> Self {
16097 Self {
16098 cached_tokens: Ok(Default::default()),
16099 }
16100 }
16101 }
16102 impl UsageInputTokensDetails {
16103 pub fn cached_tokens<T>(mut self, value: T) -> Self
16104 where
16105 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16106 T::Error: ::std::fmt::Display,
16107 {
16108 self.cached_tokens = value
16109 .try_into()
16110 .map_err(|e| {
16111 format!("error converting supplied value for cached_tokens: {e}")
16112 });
16113 self
16114 }
16115 }
16116 impl ::std::convert::TryFrom<UsageInputTokensDetails>
16117 for super::UsageInputTokensDetails {
16118 type Error = super::error::ConversionError;
16119 fn try_from(
16120 value: UsageInputTokensDetails,
16121 ) -> ::std::result::Result<Self, super::error::ConversionError> {
16122 Ok(Self {
16123 cached_tokens: value.cached_tokens?,
16124 })
16125 }
16126 }
16127 impl ::std::convert::From<super::UsageInputTokensDetails>
16128 for UsageInputTokensDetails {
16129 fn from(value: super::UsageInputTokensDetails) -> Self {
16130 Self {
16131 cached_tokens: Ok(value.cached_tokens),
16132 }
16133 }
16134 }
16135 #[derive(Clone, Debug)]
16136 pub struct UsageOutputTokensDetails {
16137 reasoning_tokens: ::std::result::Result<
16138 ::std::option::Option<i64>,
16139 ::std::string::String,
16140 >,
16141 }
16142 impl ::std::default::Default for UsageOutputTokensDetails {
16143 fn default() -> Self {
16144 Self {
16145 reasoning_tokens: Ok(Default::default()),
16146 }
16147 }
16148 }
16149 impl UsageOutputTokensDetails {
16150 pub fn reasoning_tokens<T>(mut self, value: T) -> Self
16151 where
16152 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16153 T::Error: ::std::fmt::Display,
16154 {
16155 self.reasoning_tokens = value
16156 .try_into()
16157 .map_err(|e| {
16158 format!("error converting supplied value for reasoning_tokens: {e}")
16159 });
16160 self
16161 }
16162 }
16163 impl ::std::convert::TryFrom<UsageOutputTokensDetails>
16164 for super::UsageOutputTokensDetails {
16165 type Error = super::error::ConversionError;
16166 fn try_from(
16167 value: UsageOutputTokensDetails,
16168 ) -> ::std::result::Result<Self, super::error::ConversionError> {
16169 Ok(Self {
16170 reasoning_tokens: value.reasoning_tokens?,
16171 })
16172 }
16173 }
16174 impl ::std::convert::From<super::UsageOutputTokensDetails>
16175 for UsageOutputTokensDetails {
16176 fn from(value: super::UsageOutputTokensDetails) -> Self {
16177 Self {
16178 reasoning_tokens: Ok(value.reasoning_tokens),
16179 }
16180 }
16181 }
16182}
16183pub mod error {
16185 pub struct ConversionError(::std::borrow::Cow<'static, str>);
16187 impl ::std::error::Error for ConversionError {}
16188 impl ::std::fmt::Display for ConversionError {
16189 fn fmt(
16190 &self,
16191 f: &mut ::std::fmt::Formatter<'_>,
16192 ) -> Result<(), ::std::fmt::Error> {
16193 ::std::fmt::Display::fmt(&self.0, f)
16194 }
16195 }
16196 impl ::std::fmt::Debug for ConversionError {
16197 fn fmt(
16198 &self,
16199 f: &mut ::std::fmt::Formatter<'_>,
16200 ) -> Result<(), ::std::fmt::Error> {
16201 ::std::fmt::Debug::fmt(&self.0, f)
16202 }
16203 }
16204 impl From<&'static str> for ConversionError {
16205 fn from(value: &'static str) -> Self {
16206 Self(value.into())
16207 }
16208 }
16209 impl From<String> for ConversionError {
16210 fn from(value: String) -> Self {
16211 Self(value.into())
16212 }
16213 }
16214}
16215
16216}
16217
16218 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "completion_window", part: ::one::Part::Body, key: Some("completion_window") }, ::one::Route { field: "input_file_id", part: ::one::Part::Body, key: Some("input_file_id") }, ::one::Route { field: "metadata", part: ::one::Part::Body, key: Some("metadata") }, ::one::Route { field: "headers", part: ::one::Part::Headers, key: None }], required_parts: &[::one::Part::Body] };
16220
16221 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
16240 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4Cvwn-tg::U4xxnqWXRx6MfT8y3dns8g", Method::POST, "/v1/batches").with_routed(&input, &ROUTING)?
16241 .merge_body(::serde_json::from_str("{\"endpoint\":\"/v1/responses\"}").map_err(Error::Decode)?)?
16242 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
16243 }
16244
16245 impl IntoOperation for Input {
16246 type Output = output::Output;
16247
16248 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
16249 build(self)
16250 }
16251 }
16252 impl IntoOperation for builder::Input {
16253 type Output = output::Output;
16254
16255 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
16256 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
16257 }
16258 }
16259 impl ::std::convert::TryFrom<builder::Headers> for ::std::option::Option<Headers> {
16260 type Error = <Headers as ::std::convert::TryFrom<builder::Headers>>::Error;
16261
16262 fn try_from(value: builder::Headers) -> ::std::result::Result<Self, Self::Error> {
16263 Headers::try_from(value).map(Some)
16264 }
16265 }
16266}
16267pub fn create_batch() -> create_batch::builder::Input {
16269 create_batch::builder::Input::default()
16270}
16271pub mod list_batches {
16272 use ::one::{Error, IntoOperation, Method, Operation};
16273#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
16275#[serde(deny_unknown_fields)]
16276pub struct Input {
16277 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16279 pub after_id: ::std::option::Option<::std::string::String>,
16280 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16282 pub limit: ::std::option::Option<i64>,
16283}
16284impl Input {
16285 pub fn builder() -> builder::Input {
16286 Default::default()
16287 }
16288}
16289pub mod builder {
16291 #[derive(Clone, Debug)]
16292 pub struct Input {
16293 after_id: ::std::result::Result<
16294 ::std::option::Option<::std::string::String>,
16295 ::std::string::String,
16296 >,
16297 limit: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
16298 }
16299 impl ::std::default::Default for Input {
16300 fn default() -> Self {
16301 Self {
16302 after_id: Ok(Default::default()),
16303 limit: Ok(Default::default()),
16304 }
16305 }
16306 }
16307 impl Input {
16308 pub fn after_id<T>(mut self, value: T) -> Self
16309 where
16310 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
16311 T::Error: ::std::fmt::Display,
16312 {
16313 self.after_id = value
16314 .try_into()
16315 .map_err(|e| {
16316 format!("error converting supplied value for after_id: {e}")
16317 });
16318 self
16319 }
16320 pub fn limit<T>(mut self, value: T) -> Self
16321 where
16322 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16323 T::Error: ::std::fmt::Display,
16324 {
16325 self.limit = value
16326 .try_into()
16327 .map_err(|e| format!("error converting supplied value for limit: {e}"));
16328 self
16329 }
16330 }
16331 impl ::std::convert::TryFrom<Input> for super::Input {
16332 type Error = super::error::ConversionError;
16333 fn try_from(
16334 value: Input,
16335 ) -> ::std::result::Result<Self, super::error::ConversionError> {
16336 Ok(Self {
16337 after_id: value.after_id?,
16338 limit: value.limit?,
16339 })
16340 }
16341 }
16342 impl ::std::convert::From<super::Input> for Input {
16343 fn from(value: super::Input) -> Self {
16344 Self {
16345 after_id: Ok(value.after_id),
16346 limit: Ok(value.limit),
16347 }
16348 }
16349 }
16350}
16351pub mod error {
16353 pub struct ConversionError(::std::borrow::Cow<'static, str>);
16355 impl ::std::error::Error for ConversionError {}
16356 impl ::std::fmt::Display for ConversionError {
16357 fn fmt(
16358 &self,
16359 f: &mut ::std::fmt::Formatter<'_>,
16360 ) -> Result<(), ::std::fmt::Error> {
16361 ::std::fmt::Display::fmt(&self.0, f)
16362 }
16363 }
16364 impl ::std::fmt::Debug for ConversionError {
16365 fn fmt(
16366 &self,
16367 f: &mut ::std::fmt::Formatter<'_>,
16368 ) -> Result<(), ::std::fmt::Error> {
16369 ::std::fmt::Debug::fmt(&self.0, f)
16370 }
16371 }
16372 impl From<&'static str> for ConversionError {
16373 fn from(value: &'static str) -> Self {
16374 Self(value.into())
16375 }
16376 }
16377 impl From<String> for ConversionError {
16378 fn from(value: String) -> Self {
16379 Self(value.into())
16380 }
16381 }
16382}
16383
16384pub mod output {
16385#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
16387pub struct Batch {
16388 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16390 pub cancelled_at: ::std::option::Option<i64>,
16391 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16393 pub cancelling_at: ::std::option::Option<i64>,
16394 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16396 pub completed_at: ::std::option::Option<i64>,
16397 pub completion_window: ::std::string::String,
16399 pub created_at: i64,
16401 pub endpoint: ::std::string::String,
16403 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16405 pub error_file_id: ::std::option::Option<::std::string::String>,
16406 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16407 pub errors: ::std::option::Option<BatchErrorCollection>,
16408 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16410 pub expired_at: ::std::option::Option<i64>,
16411 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16413 pub expires_at: ::std::option::Option<i64>,
16414 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16416 pub failed_at: ::std::option::Option<i64>,
16417 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16419 pub finalizing_at: ::std::option::Option<i64>,
16420 pub id: ::std::string::String,
16422 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16424 pub in_progress_at: ::std::option::Option<i64>,
16425 pub input_file_id: ::std::string::String,
16427 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
16429 pub metadata: ::std::collections::HashMap<
16430 ::std::string::String,
16431 ::std::string::String,
16432 >,
16433 pub object: BatchObject,
16435 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16437 pub output_file_id: ::std::option::Option<::std::string::String>,
16438 pub request_counts: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
16440 pub status: BatchStatus,
16442 pub usage: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
16444}
16445impl Batch {
16446 pub fn builder() -> builder::Batch {
16447 Default::default()
16448 }
16449}
16450#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
16452pub struct BatchError {
16453 pub code: ::std::string::String,
16455 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16457 pub line: ::std::option::Option<i64>,
16458 pub message: ::std::string::String,
16460}
16461impl BatchError {
16462 pub fn builder() -> builder::BatchError {
16463 Default::default()
16464 }
16465}
16466#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
16468pub struct BatchErrorCollection {
16469 pub data: ::std::vec::Vec<BatchError>,
16471 pub object: BatchErrorCollectionObject,
16473}
16474impl BatchErrorCollection {
16475 pub fn builder() -> builder::BatchErrorCollection {
16476 Default::default()
16477 }
16478}
16479#[derive(
16481 ::serde::Deserialize,
16482 ::serde::Serialize,
16483 Clone,
16484 Copy,
16485 Debug,
16486 Eq,
16487 Hash,
16488 Ord,
16489 PartialEq,
16490 PartialOrd
16491)]
16492pub enum BatchErrorCollectionObject {
16493 #[serde(rename = "list")]
16494 List,
16495}
16496impl ::std::fmt::Display for BatchErrorCollectionObject {
16497 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
16498 match *self {
16499 Self::List => f.write_str("list"),
16500 }
16501 }
16502}
16503impl ::std::str::FromStr for BatchErrorCollectionObject {
16504 type Err = self::error::ConversionError;
16505 fn from_str(
16506 value: &str,
16507 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16508 match value {
16509 "list" => Ok(Self::List),
16510 _ => Err("invalid value".into()),
16511 }
16512 }
16513}
16514impl ::std::convert::TryFrom<&str> for BatchErrorCollectionObject {
16515 type Error = self::error::ConversionError;
16516 fn try_from(
16517 value: &str,
16518 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16519 value.parse()
16520 }
16521}
16522impl ::std::convert::TryFrom<::std::string::String> for BatchErrorCollectionObject {
16523 type Error = self::error::ConversionError;
16524 fn try_from(
16525 value: ::std::string::String,
16526 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16527 value.parse()
16528 }
16529}
16530#[derive(
16532 ::serde::Deserialize,
16533 ::serde::Serialize,
16534 Clone,
16535 Copy,
16536 Debug,
16537 Eq,
16538 Hash,
16539 Ord,
16540 PartialEq,
16541 PartialOrd
16542)]
16543pub enum BatchObject {
16544 #[serde(rename = "batch")]
16545 Batch,
16546}
16547impl ::std::fmt::Display for BatchObject {
16548 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
16549 match *self {
16550 Self::Batch => f.write_str("batch"),
16551 }
16552 }
16553}
16554impl ::std::str::FromStr for BatchObject {
16555 type Err = self::error::ConversionError;
16556 fn from_str(
16557 value: &str,
16558 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16559 match value {
16560 "batch" => Ok(Self::Batch),
16561 _ => Err("invalid value".into()),
16562 }
16563 }
16564}
16565impl ::std::convert::TryFrom<&str> for BatchObject {
16566 type Error = self::error::ConversionError;
16567 fn try_from(
16568 value: &str,
16569 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16570 value.parse()
16571 }
16572}
16573impl ::std::convert::TryFrom<::std::string::String> for BatchObject {
16574 type Error = self::error::ConversionError;
16575 fn try_from(
16576 value: ::std::string::String,
16577 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16578 value.parse()
16579 }
16580}
16581#[derive(
16583 ::serde::Deserialize,
16584 ::serde::Serialize,
16585 Clone,
16586 Copy,
16587 Debug,
16588 Eq,
16589 Hash,
16590 Ord,
16591 PartialEq,
16592 PartialOrd
16593)]
16594pub enum BatchStatus {
16595 #[serde(rename = "validating")]
16596 Validating,
16597 #[serde(rename = "in_progress")]
16598 InProgress,
16599 #[serde(rename = "finalizing")]
16600 Finalizing,
16601 #[serde(rename = "completed")]
16602 Completed,
16603 #[serde(rename = "expired")]
16604 Expired,
16605 #[serde(rename = "cancelling")]
16606 Cancelling,
16607 #[serde(rename = "cancelled")]
16608 Cancelled,
16609 #[serde(rename = "failed")]
16610 Failed,
16611}
16612impl ::std::fmt::Display for BatchStatus {
16613 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
16614 match *self {
16615 Self::Validating => f.write_str("validating"),
16616 Self::InProgress => f.write_str("in_progress"),
16617 Self::Finalizing => f.write_str("finalizing"),
16618 Self::Completed => f.write_str("completed"),
16619 Self::Expired => f.write_str("expired"),
16620 Self::Cancelling => f.write_str("cancelling"),
16621 Self::Cancelled => f.write_str("cancelled"),
16622 Self::Failed => f.write_str("failed"),
16623 }
16624 }
16625}
16626impl ::std::str::FromStr for BatchStatus {
16627 type Err = self::error::ConversionError;
16628 fn from_str(
16629 value: &str,
16630 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16631 match value {
16632 "validating" => Ok(Self::Validating),
16633 "in_progress" => Ok(Self::InProgress),
16634 "finalizing" => Ok(Self::Finalizing),
16635 "completed" => Ok(Self::Completed),
16636 "expired" => Ok(Self::Expired),
16637 "cancelling" => Ok(Self::Cancelling),
16638 "cancelled" => Ok(Self::Cancelled),
16639 "failed" => Ok(Self::Failed),
16640 _ => Err("invalid value".into()),
16641 }
16642 }
16643}
16644impl ::std::convert::TryFrom<&str> for BatchStatus {
16645 type Error = self::error::ConversionError;
16646 fn try_from(
16647 value: &str,
16648 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16649 value.parse()
16650 }
16651}
16652impl ::std::convert::TryFrom<::std::string::String> for BatchStatus {
16653 type Error = self::error::ConversionError;
16654 fn try_from(
16655 value: ::std::string::String,
16656 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16657 value.parse()
16658 }
16659}
16660#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
16662pub struct Error {
16663 pub code: i64,
16665 pub message: ::std::string::String,
16667 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16669 pub param: ::std::option::Option<::std::string::String>,
16670 #[serde(rename = "type")]
16672 pub type_: ::std::string::String,
16673}
16674impl Error {
16675 pub fn builder() -> builder::Error {
16676 Default::default()
16677 }
16678}
16679#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
16681pub struct Output {
16682 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
16684 pub data: ::std::vec::Vec<Batch>,
16685 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16686 pub error: ::std::option::Option<Error>,
16687 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16689 pub first_id: ::std::option::Option<::std::string::String>,
16690 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16692 pub has_more: ::std::option::Option<bool>,
16693 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16695 pub last_id: ::std::option::Option<::std::string::String>,
16696 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
16698 pub object: ::std::option::Option<OutputObject>,
16699}
16700impl Output {
16701 pub fn builder() -> builder::Output {
16702 Default::default()
16703 }
16704}
16705#[derive(
16707 ::serde::Deserialize,
16708 ::serde::Serialize,
16709 Clone,
16710 Copy,
16711 Debug,
16712 Eq,
16713 Hash,
16714 Ord,
16715 PartialEq,
16716 PartialOrd
16717)]
16718pub enum OutputObject {
16719 #[serde(rename = "list")]
16720 List,
16721}
16722impl ::std::fmt::Display for OutputObject {
16723 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
16724 match *self {
16725 Self::List => f.write_str("list"),
16726 }
16727 }
16728}
16729impl ::std::str::FromStr for OutputObject {
16730 type Err = self::error::ConversionError;
16731 fn from_str(
16732 value: &str,
16733 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16734 match value {
16735 "list" => Ok(Self::List),
16736 _ => Err("invalid value".into()),
16737 }
16738 }
16739}
16740impl ::std::convert::TryFrom<&str> for OutputObject {
16741 type Error = self::error::ConversionError;
16742 fn try_from(
16743 value: &str,
16744 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16745 value.parse()
16746 }
16747}
16748impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
16749 type Error = self::error::ConversionError;
16750 fn try_from(
16751 value: ::std::string::String,
16752 ) -> ::std::result::Result<Self, self::error::ConversionError> {
16753 value.parse()
16754 }
16755}
16756pub mod builder {
16758 #[derive(Clone, Debug)]
16759 pub struct Batch {
16760 cancelled_at: ::std::result::Result<
16761 ::std::option::Option<i64>,
16762 ::std::string::String,
16763 >,
16764 cancelling_at: ::std::result::Result<
16765 ::std::option::Option<i64>,
16766 ::std::string::String,
16767 >,
16768 completed_at: ::std::result::Result<
16769 ::std::option::Option<i64>,
16770 ::std::string::String,
16771 >,
16772 completion_window: ::std::result::Result<
16773 ::std::string::String,
16774 ::std::string::String,
16775 >,
16776 created_at: ::std::result::Result<i64, ::std::string::String>,
16777 endpoint: ::std::result::Result<::std::string::String, ::std::string::String>,
16778 error_file_id: ::std::result::Result<
16779 ::std::option::Option<::std::string::String>,
16780 ::std::string::String,
16781 >,
16782 errors: ::std::result::Result<
16783 ::std::option::Option<super::BatchErrorCollection>,
16784 ::std::string::String,
16785 >,
16786 expired_at: ::std::result::Result<
16787 ::std::option::Option<i64>,
16788 ::std::string::String,
16789 >,
16790 expires_at: ::std::result::Result<
16791 ::std::option::Option<i64>,
16792 ::std::string::String,
16793 >,
16794 failed_at: ::std::result::Result<
16795 ::std::option::Option<i64>,
16796 ::std::string::String,
16797 >,
16798 finalizing_at: ::std::result::Result<
16799 ::std::option::Option<i64>,
16800 ::std::string::String,
16801 >,
16802 id: ::std::result::Result<::std::string::String, ::std::string::String>,
16803 in_progress_at: ::std::result::Result<
16804 ::std::option::Option<i64>,
16805 ::std::string::String,
16806 >,
16807 input_file_id: ::std::result::Result<
16808 ::std::string::String,
16809 ::std::string::String,
16810 >,
16811 metadata: ::std::result::Result<
16812 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
16813 ::std::string::String,
16814 >,
16815 object: ::std::result::Result<super::BatchObject, ::std::string::String>,
16816 output_file_id: ::std::result::Result<
16817 ::std::option::Option<::std::string::String>,
16818 ::std::string::String,
16819 >,
16820 request_counts: ::std::result::Result<
16821 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
16822 ::std::string::String,
16823 >,
16824 status: ::std::result::Result<super::BatchStatus, ::std::string::String>,
16825 usage: ::std::result::Result<
16826 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
16827 ::std::string::String,
16828 >,
16829 }
16830 impl ::std::default::Default for Batch {
16831 fn default() -> Self {
16832 Self {
16833 cancelled_at: Ok(Default::default()),
16834 cancelling_at: Ok(Default::default()),
16835 completed_at: Ok(Default::default()),
16836 completion_window: Err(
16837 "no value supplied for completion_window".to_string(),
16838 ),
16839 created_at: Err("no value supplied for created_at".to_string()),
16840 endpoint: Err("no value supplied for endpoint".to_string()),
16841 error_file_id: Ok(Default::default()),
16842 errors: Ok(Default::default()),
16843 expired_at: Ok(Default::default()),
16844 expires_at: Ok(Default::default()),
16845 failed_at: Ok(Default::default()),
16846 finalizing_at: Ok(Default::default()),
16847 id: Err("no value supplied for id".to_string()),
16848 in_progress_at: Ok(Default::default()),
16849 input_file_id: Err("no value supplied for input_file_id".to_string()),
16850 metadata: Ok(Default::default()),
16851 object: Err("no value supplied for object".to_string()),
16852 output_file_id: Ok(Default::default()),
16853 request_counts: Err("no value supplied for request_counts".to_string()),
16854 status: Err("no value supplied for status".to_string()),
16855 usage: Err("no value supplied for usage".to_string()),
16856 }
16857 }
16858 }
16859 impl Batch {
16860 pub fn cancelled_at<T>(mut self, value: T) -> Self
16861 where
16862 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16863 T::Error: ::std::fmt::Display,
16864 {
16865 self.cancelled_at = value
16866 .try_into()
16867 .map_err(|e| {
16868 format!("error converting supplied value for cancelled_at: {e}")
16869 });
16870 self
16871 }
16872 pub fn cancelling_at<T>(mut self, value: T) -> Self
16873 where
16874 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16875 T::Error: ::std::fmt::Display,
16876 {
16877 self.cancelling_at = value
16878 .try_into()
16879 .map_err(|e| {
16880 format!("error converting supplied value for cancelling_at: {e}")
16881 });
16882 self
16883 }
16884 pub fn completed_at<T>(mut self, value: T) -> Self
16885 where
16886 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16887 T::Error: ::std::fmt::Display,
16888 {
16889 self.completed_at = value
16890 .try_into()
16891 .map_err(|e| {
16892 format!("error converting supplied value for completed_at: {e}")
16893 });
16894 self
16895 }
16896 pub fn completion_window<T>(mut self, value: T) -> Self
16897 where
16898 T: ::std::convert::TryInto<::std::string::String>,
16899 T::Error: ::std::fmt::Display,
16900 {
16901 self.completion_window = value
16902 .try_into()
16903 .map_err(|e| {
16904 format!("error converting supplied value for completion_window: {e}")
16905 });
16906 self
16907 }
16908 pub fn created_at<T>(mut self, value: T) -> Self
16909 where
16910 T: ::std::convert::TryInto<i64>,
16911 T::Error: ::std::fmt::Display,
16912 {
16913 self.created_at = value
16914 .try_into()
16915 .map_err(|e| {
16916 format!("error converting supplied value for created_at: {e}")
16917 });
16918 self
16919 }
16920 pub fn endpoint<T>(mut self, value: T) -> Self
16921 where
16922 T: ::std::convert::TryInto<::std::string::String>,
16923 T::Error: ::std::fmt::Display,
16924 {
16925 self.endpoint = value
16926 .try_into()
16927 .map_err(|e| {
16928 format!("error converting supplied value for endpoint: {e}")
16929 });
16930 self
16931 }
16932 pub fn error_file_id<T>(mut self, value: T) -> Self
16933 where
16934 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
16935 T::Error: ::std::fmt::Display,
16936 {
16937 self.error_file_id = value
16938 .try_into()
16939 .map_err(|e| {
16940 format!("error converting supplied value for error_file_id: {e}")
16941 });
16942 self
16943 }
16944 pub fn errors<T>(mut self, value: T) -> Self
16945 where
16946 T: ::std::convert::TryInto<
16947 ::std::option::Option<super::BatchErrorCollection>,
16948 >,
16949 T::Error: ::std::fmt::Display,
16950 {
16951 self.errors = value
16952 .try_into()
16953 .map_err(|e| format!("error converting supplied value for errors: {e}"));
16954 self
16955 }
16956 pub fn expired_at<T>(mut self, value: T) -> Self
16957 where
16958 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16959 T::Error: ::std::fmt::Display,
16960 {
16961 self.expired_at = value
16962 .try_into()
16963 .map_err(|e| {
16964 format!("error converting supplied value for expired_at: {e}")
16965 });
16966 self
16967 }
16968 pub fn expires_at<T>(mut self, value: T) -> Self
16969 where
16970 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16971 T::Error: ::std::fmt::Display,
16972 {
16973 self.expires_at = value
16974 .try_into()
16975 .map_err(|e| {
16976 format!("error converting supplied value for expires_at: {e}")
16977 });
16978 self
16979 }
16980 pub fn failed_at<T>(mut self, value: T) -> Self
16981 where
16982 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16983 T::Error: ::std::fmt::Display,
16984 {
16985 self.failed_at = value
16986 .try_into()
16987 .map_err(|e| {
16988 format!("error converting supplied value for failed_at: {e}")
16989 });
16990 self
16991 }
16992 pub fn finalizing_at<T>(mut self, value: T) -> Self
16993 where
16994 T: ::std::convert::TryInto<::std::option::Option<i64>>,
16995 T::Error: ::std::fmt::Display,
16996 {
16997 self.finalizing_at = value
16998 .try_into()
16999 .map_err(|e| {
17000 format!("error converting supplied value for finalizing_at: {e}")
17001 });
17002 self
17003 }
17004 pub fn id<T>(mut self, value: T) -> Self
17005 where
17006 T: ::std::convert::TryInto<::std::string::String>,
17007 T::Error: ::std::fmt::Display,
17008 {
17009 self.id = value
17010 .try_into()
17011 .map_err(|e| format!("error converting supplied value for id: {e}"));
17012 self
17013 }
17014 pub fn in_progress_at<T>(mut self, value: T) -> Self
17015 where
17016 T: ::std::convert::TryInto<::std::option::Option<i64>>,
17017 T::Error: ::std::fmt::Display,
17018 {
17019 self.in_progress_at = value
17020 .try_into()
17021 .map_err(|e| {
17022 format!("error converting supplied value for in_progress_at: {e}")
17023 });
17024 self
17025 }
17026 pub fn input_file_id<T>(mut self, value: T) -> Self
17027 where
17028 T: ::std::convert::TryInto<::std::string::String>,
17029 T::Error: ::std::fmt::Display,
17030 {
17031 self.input_file_id = value
17032 .try_into()
17033 .map_err(|e| {
17034 format!("error converting supplied value for input_file_id: {e}")
17035 });
17036 self
17037 }
17038 pub fn metadata<T>(mut self, value: T) -> Self
17039 where
17040 T: ::std::convert::TryInto<
17041 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
17042 >,
17043 T::Error: ::std::fmt::Display,
17044 {
17045 self.metadata = value
17046 .try_into()
17047 .map_err(|e| {
17048 format!("error converting supplied value for metadata: {e}")
17049 });
17050 self
17051 }
17052 pub fn object<T>(mut self, value: T) -> Self
17053 where
17054 T: ::std::convert::TryInto<super::BatchObject>,
17055 T::Error: ::std::fmt::Display,
17056 {
17057 self.object = value
17058 .try_into()
17059 .map_err(|e| format!("error converting supplied value for object: {e}"));
17060 self
17061 }
17062 pub fn output_file_id<T>(mut self, value: T) -> Self
17063 where
17064 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
17065 T::Error: ::std::fmt::Display,
17066 {
17067 self.output_file_id = value
17068 .try_into()
17069 .map_err(|e| {
17070 format!("error converting supplied value for output_file_id: {e}")
17071 });
17072 self
17073 }
17074 pub fn request_counts<T>(mut self, value: T) -> Self
17075 where
17076 T: ::std::convert::TryInto<
17077 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
17078 >,
17079 T::Error: ::std::fmt::Display,
17080 {
17081 self.request_counts = value
17082 .try_into()
17083 .map_err(|e| {
17084 format!("error converting supplied value for request_counts: {e}")
17085 });
17086 self
17087 }
17088 pub fn status<T>(mut self, value: T) -> Self
17089 where
17090 T: ::std::convert::TryInto<super::BatchStatus>,
17091 T::Error: ::std::fmt::Display,
17092 {
17093 self.status = value
17094 .try_into()
17095 .map_err(|e| format!("error converting supplied value for status: {e}"));
17096 self
17097 }
17098 pub fn usage<T>(mut self, value: T) -> Self
17099 where
17100 T: ::std::convert::TryInto<
17101 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
17102 >,
17103 T::Error: ::std::fmt::Display,
17104 {
17105 self.usage = value
17106 .try_into()
17107 .map_err(|e| format!("error converting supplied value for usage: {e}"));
17108 self
17109 }
17110 }
17111 impl ::std::convert::TryFrom<Batch> for super::Batch {
17112 type Error = super::error::ConversionError;
17113 fn try_from(
17114 value: Batch,
17115 ) -> ::std::result::Result<Self, super::error::ConversionError> {
17116 Ok(Self {
17117 cancelled_at: value.cancelled_at?,
17118 cancelling_at: value.cancelling_at?,
17119 completed_at: value.completed_at?,
17120 completion_window: value.completion_window?,
17121 created_at: value.created_at?,
17122 endpoint: value.endpoint?,
17123 error_file_id: value.error_file_id?,
17124 errors: value.errors?,
17125 expired_at: value.expired_at?,
17126 expires_at: value.expires_at?,
17127 failed_at: value.failed_at?,
17128 finalizing_at: value.finalizing_at?,
17129 id: value.id?,
17130 in_progress_at: value.in_progress_at?,
17131 input_file_id: value.input_file_id?,
17132 metadata: value.metadata?,
17133 object: value.object?,
17134 output_file_id: value.output_file_id?,
17135 request_counts: value.request_counts?,
17136 status: value.status?,
17137 usage: value.usage?,
17138 })
17139 }
17140 }
17141 impl ::std::convert::From<super::Batch> for Batch {
17142 fn from(value: super::Batch) -> Self {
17143 Self {
17144 cancelled_at: Ok(value.cancelled_at),
17145 cancelling_at: Ok(value.cancelling_at),
17146 completed_at: Ok(value.completed_at),
17147 completion_window: Ok(value.completion_window),
17148 created_at: Ok(value.created_at),
17149 endpoint: Ok(value.endpoint),
17150 error_file_id: Ok(value.error_file_id),
17151 errors: Ok(value.errors),
17152 expired_at: Ok(value.expired_at),
17153 expires_at: Ok(value.expires_at),
17154 failed_at: Ok(value.failed_at),
17155 finalizing_at: Ok(value.finalizing_at),
17156 id: Ok(value.id),
17157 in_progress_at: Ok(value.in_progress_at),
17158 input_file_id: Ok(value.input_file_id),
17159 metadata: Ok(value.metadata),
17160 object: Ok(value.object),
17161 output_file_id: Ok(value.output_file_id),
17162 request_counts: Ok(value.request_counts),
17163 status: Ok(value.status),
17164 usage: Ok(value.usage),
17165 }
17166 }
17167 }
17168 #[derive(Clone, Debug)]
17169 pub struct BatchError {
17170 code: ::std::result::Result<::std::string::String, ::std::string::String>,
17171 line: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
17172 message: ::std::result::Result<::std::string::String, ::std::string::String>,
17173 }
17174 impl ::std::default::Default for BatchError {
17175 fn default() -> Self {
17176 Self {
17177 code: Err("no value supplied for code".to_string()),
17178 line: Ok(Default::default()),
17179 message: Err("no value supplied for message".to_string()),
17180 }
17181 }
17182 }
17183 impl BatchError {
17184 pub fn code<T>(mut self, value: T) -> Self
17185 where
17186 T: ::std::convert::TryInto<::std::string::String>,
17187 T::Error: ::std::fmt::Display,
17188 {
17189 self.code = value
17190 .try_into()
17191 .map_err(|e| format!("error converting supplied value for code: {e}"));
17192 self
17193 }
17194 pub fn line<T>(mut self, value: T) -> Self
17195 where
17196 T: ::std::convert::TryInto<::std::option::Option<i64>>,
17197 T::Error: ::std::fmt::Display,
17198 {
17199 self.line = value
17200 .try_into()
17201 .map_err(|e| format!("error converting supplied value for line: {e}"));
17202 self
17203 }
17204 pub fn message<T>(mut self, value: T) -> Self
17205 where
17206 T: ::std::convert::TryInto<::std::string::String>,
17207 T::Error: ::std::fmt::Display,
17208 {
17209 self.message = value
17210 .try_into()
17211 .map_err(|e| {
17212 format!("error converting supplied value for message: {e}")
17213 });
17214 self
17215 }
17216 }
17217 impl ::std::convert::TryFrom<BatchError> for super::BatchError {
17218 type Error = super::error::ConversionError;
17219 fn try_from(
17220 value: BatchError,
17221 ) -> ::std::result::Result<Self, super::error::ConversionError> {
17222 Ok(Self {
17223 code: value.code?,
17224 line: value.line?,
17225 message: value.message?,
17226 })
17227 }
17228 }
17229 impl ::std::convert::From<super::BatchError> for BatchError {
17230 fn from(value: super::BatchError) -> Self {
17231 Self {
17232 code: Ok(value.code),
17233 line: Ok(value.line),
17234 message: Ok(value.message),
17235 }
17236 }
17237 }
17238 #[derive(Clone, Debug)]
17239 pub struct BatchErrorCollection {
17240 data: ::std::result::Result<
17241 ::std::vec::Vec<super::BatchError>,
17242 ::std::string::String,
17243 >,
17244 object: ::std::result::Result<
17245 super::BatchErrorCollectionObject,
17246 ::std::string::String,
17247 >,
17248 }
17249 impl ::std::default::Default for BatchErrorCollection {
17250 fn default() -> Self {
17251 Self {
17252 data: Err("no value supplied for data".to_string()),
17253 object: Err("no value supplied for object".to_string()),
17254 }
17255 }
17256 }
17257 impl BatchErrorCollection {
17258 pub fn data<T>(mut self, value: T) -> Self
17259 where
17260 T: ::std::convert::TryInto<::std::vec::Vec<super::BatchError>>,
17261 T::Error: ::std::fmt::Display,
17262 {
17263 self.data = value
17264 .try_into()
17265 .map_err(|e| format!("error converting supplied value for data: {e}"));
17266 self
17267 }
17268 pub fn object<T>(mut self, value: T) -> Self
17269 where
17270 T: ::std::convert::TryInto<super::BatchErrorCollectionObject>,
17271 T::Error: ::std::fmt::Display,
17272 {
17273 self.object = value
17274 .try_into()
17275 .map_err(|e| format!("error converting supplied value for object: {e}"));
17276 self
17277 }
17278 }
17279 impl ::std::convert::TryFrom<BatchErrorCollection> for super::BatchErrorCollection {
17280 type Error = super::error::ConversionError;
17281 fn try_from(
17282 value: BatchErrorCollection,
17283 ) -> ::std::result::Result<Self, super::error::ConversionError> {
17284 Ok(Self {
17285 data: value.data?,
17286 object: value.object?,
17287 })
17288 }
17289 }
17290 impl ::std::convert::From<super::BatchErrorCollection> for BatchErrorCollection {
17291 fn from(value: super::BatchErrorCollection) -> Self {
17292 Self {
17293 data: Ok(value.data),
17294 object: Ok(value.object),
17295 }
17296 }
17297 }
17298 #[derive(Clone, Debug)]
17299 pub struct Error {
17300 code: ::std::result::Result<i64, ::std::string::String>,
17301 message: ::std::result::Result<::std::string::String, ::std::string::String>,
17302 param: ::std::result::Result<
17303 ::std::option::Option<::std::string::String>,
17304 ::std::string::String,
17305 >,
17306 type_: ::std::result::Result<::std::string::String, ::std::string::String>,
17307 }
17308 impl ::std::default::Default for Error {
17309 fn default() -> Self {
17310 Self {
17311 code: Err("no value supplied for code".to_string()),
17312 message: Err("no value supplied for message".to_string()),
17313 param: Ok(Default::default()),
17314 type_: Err("no value supplied for type_".to_string()),
17315 }
17316 }
17317 }
17318 impl Error {
17319 pub fn code<T>(mut self, value: T) -> Self
17320 where
17321 T: ::std::convert::TryInto<i64>,
17322 T::Error: ::std::fmt::Display,
17323 {
17324 self.code = value
17325 .try_into()
17326 .map_err(|e| format!("error converting supplied value for code: {e}"));
17327 self
17328 }
17329 pub fn message<T>(mut self, value: T) -> Self
17330 where
17331 T: ::std::convert::TryInto<::std::string::String>,
17332 T::Error: ::std::fmt::Display,
17333 {
17334 self.message = value
17335 .try_into()
17336 .map_err(|e| {
17337 format!("error converting supplied value for message: {e}")
17338 });
17339 self
17340 }
17341 pub fn param<T>(mut self, value: T) -> Self
17342 where
17343 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
17344 T::Error: ::std::fmt::Display,
17345 {
17346 self.param = value
17347 .try_into()
17348 .map_err(|e| format!("error converting supplied value for param: {e}"));
17349 self
17350 }
17351 pub fn type_<T>(mut self, value: T) -> Self
17352 where
17353 T: ::std::convert::TryInto<::std::string::String>,
17354 T::Error: ::std::fmt::Display,
17355 {
17356 self.type_ = value
17357 .try_into()
17358 .map_err(|e| format!("error converting supplied value for type_: {e}"));
17359 self
17360 }
17361 }
17362 impl ::std::convert::TryFrom<Error> for super::Error {
17363 type Error = super::error::ConversionError;
17364 fn try_from(
17365 value: Error,
17366 ) -> ::std::result::Result<Self, super::error::ConversionError> {
17367 Ok(Self {
17368 code: value.code?,
17369 message: value.message?,
17370 param: value.param?,
17371 type_: value.type_?,
17372 })
17373 }
17374 }
17375 impl ::std::convert::From<super::Error> for Error {
17376 fn from(value: super::Error) -> Self {
17377 Self {
17378 code: Ok(value.code),
17379 message: Ok(value.message),
17380 param: Ok(value.param),
17381 type_: Ok(value.type_),
17382 }
17383 }
17384 }
17385 #[derive(Clone, Debug)]
17386 pub struct Output {
17387 data: ::std::result::Result<
17388 ::std::vec::Vec<super::Batch>,
17389 ::std::string::String,
17390 >,
17391 error: ::std::result::Result<
17392 ::std::option::Option<super::Error>,
17393 ::std::string::String,
17394 >,
17395 first_id: ::std::result::Result<
17396 ::std::option::Option<::std::string::String>,
17397 ::std::string::String,
17398 >,
17399 has_more: ::std::result::Result<
17400 ::std::option::Option<bool>,
17401 ::std::string::String,
17402 >,
17403 last_id: ::std::result::Result<
17404 ::std::option::Option<::std::string::String>,
17405 ::std::string::String,
17406 >,
17407 object: ::std::result::Result<
17408 ::std::option::Option<super::OutputObject>,
17409 ::std::string::String,
17410 >,
17411 }
17412 impl ::std::default::Default for Output {
17413 fn default() -> Self {
17414 Self {
17415 data: Ok(Default::default()),
17416 error: Ok(Default::default()),
17417 first_id: Ok(Default::default()),
17418 has_more: Ok(Default::default()),
17419 last_id: Ok(Default::default()),
17420 object: Ok(Default::default()),
17421 }
17422 }
17423 }
17424 impl Output {
17425 pub fn data<T>(mut self, value: T) -> Self
17426 where
17427 T: ::std::convert::TryInto<::std::vec::Vec<super::Batch>>,
17428 T::Error: ::std::fmt::Display,
17429 {
17430 self.data = value
17431 .try_into()
17432 .map_err(|e| format!("error converting supplied value for data: {e}"));
17433 self
17434 }
17435 pub fn error<T>(mut self, value: T) -> Self
17436 where
17437 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
17438 T::Error: ::std::fmt::Display,
17439 {
17440 self.error = value
17441 .try_into()
17442 .map_err(|e| format!("error converting supplied value for error: {e}"));
17443 self
17444 }
17445 pub fn first_id<T>(mut self, value: T) -> Self
17446 where
17447 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
17448 T::Error: ::std::fmt::Display,
17449 {
17450 self.first_id = value
17451 .try_into()
17452 .map_err(|e| {
17453 format!("error converting supplied value for first_id: {e}")
17454 });
17455 self
17456 }
17457 pub fn has_more<T>(mut self, value: T) -> Self
17458 where
17459 T: ::std::convert::TryInto<::std::option::Option<bool>>,
17460 T::Error: ::std::fmt::Display,
17461 {
17462 self.has_more = value
17463 .try_into()
17464 .map_err(|e| {
17465 format!("error converting supplied value for has_more: {e}")
17466 });
17467 self
17468 }
17469 pub fn last_id<T>(mut self, value: T) -> Self
17470 where
17471 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
17472 T::Error: ::std::fmt::Display,
17473 {
17474 self.last_id = value
17475 .try_into()
17476 .map_err(|e| {
17477 format!("error converting supplied value for last_id: {e}")
17478 });
17479 self
17480 }
17481 pub fn object<T>(mut self, value: T) -> Self
17482 where
17483 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
17484 T::Error: ::std::fmt::Display,
17485 {
17486 self.object = value
17487 .try_into()
17488 .map_err(|e| format!("error converting supplied value for object: {e}"));
17489 self
17490 }
17491 }
17492 impl ::std::convert::TryFrom<Output> for super::Output {
17493 type Error = super::error::ConversionError;
17494 fn try_from(
17495 value: Output,
17496 ) -> ::std::result::Result<Self, super::error::ConversionError> {
17497 Ok(Self {
17498 data: value.data?,
17499 error: value.error?,
17500 first_id: value.first_id?,
17501 has_more: value.has_more?,
17502 last_id: value.last_id?,
17503 object: value.object?,
17504 })
17505 }
17506 }
17507 impl ::std::convert::From<super::Output> for Output {
17508 fn from(value: super::Output) -> Self {
17509 Self {
17510 data: Ok(value.data),
17511 error: Ok(value.error),
17512 first_id: Ok(value.first_id),
17513 has_more: Ok(value.has_more),
17514 last_id: Ok(value.last_id),
17515 object: Ok(value.object),
17516 }
17517 }
17518 }
17519}
17520pub mod error {
17522 pub struct ConversionError(::std::borrow::Cow<'static, str>);
17524 impl ::std::error::Error for ConversionError {}
17525 impl ::std::fmt::Display for ConversionError {
17526 fn fmt(
17527 &self,
17528 f: &mut ::std::fmt::Formatter<'_>,
17529 ) -> Result<(), ::std::fmt::Error> {
17530 ::std::fmt::Display::fmt(&self.0, f)
17531 }
17532 }
17533 impl ::std::fmt::Debug for ConversionError {
17534 fn fmt(
17535 &self,
17536 f: &mut ::std::fmt::Formatter<'_>,
17537 ) -> Result<(), ::std::fmt::Error> {
17538 ::std::fmt::Debug::fmt(&self.0, f)
17539 }
17540 }
17541 impl From<&'static str> for ConversionError {
17542 fn from(value: &'static str) -> Self {
17543 Self(value.into())
17544 }
17545 }
17546 impl From<String> for ConversionError {
17547 fn from(value: String) -> Self {
17548 Self(value.into())
17549 }
17550 }
17551}
17552
17553}
17554
17555 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "after_id", part: ::one::Part::Query, key: Some("after_id") }, ::one::Route { field: "limit", part: ::one::Part::Query, key: Some("limit") }], required_parts: &[] };
17557
17558 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
17568 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4Cv6q_Dg::K7rPnHKGRIm35BQqDikVXg", Method::GET, "/v1/batches").with_routed(&input, &ROUTING)?
17569 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
17570 }
17571
17572 impl IntoOperation for Input {
17573 type Output = output::Output;
17574
17575 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
17576 build(self)
17577 }
17578 }
17579 impl IntoOperation for builder::Input {
17580 type Output = output::Output;
17581
17582 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
17583 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
17584 }
17585 }
17586}
17587pub fn list_batches() -> list_batches::builder::Input {
17589 list_batches::builder::Input::default()
17590}
17591pub mod retrieve_batch {
17592 use ::one::{Error, IntoOperation, Method, Operation};
17593#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
17595#[serde(deny_unknown_fields)]
17596pub struct Input {
17597 #[serde(rename = "batchId")]
17599 pub batch_id: InputBatchId,
17600}
17601impl Input {
17602 pub fn builder() -> builder::Input {
17603 Default::default()
17604 }
17605}
17606#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17608#[serde(transparent)]
17609pub struct InputBatchId(::std::string::String);
17610impl ::std::ops::Deref for InputBatchId {
17611 type Target = ::std::string::String;
17612 fn deref(&self) -> &::std::string::String {
17613 &self.0
17614 }
17615}
17616impl ::std::convert::From<InputBatchId> for ::std::string::String {
17617 fn from(value: InputBatchId) -> Self {
17618 value.0
17619 }
17620}
17621impl ::std::str::FromStr for InputBatchId {
17622 type Err = self::error::ConversionError;
17623 fn from_str(
17624 value: &str,
17625 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17626 ::std::convert::TryFrom::try_from(value)
17627 }
17628}
17629impl ::std::convert::TryFrom<&str> for InputBatchId {
17630 type Error = self::error::ConversionError;
17631 fn try_from(
17632 value: &str,
17633 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17634 if value.chars().count() < 1usize {
17635 return Err("shorter than 1 characters".into());
17636 }
17637 Ok(Self(value.to_string()))
17638 }
17639}
17640impl ::std::convert::TryFrom<::std::string::String> for InputBatchId {
17641 type Error = self::error::ConversionError;
17642 fn try_from(
17643 value: ::std::string::String,
17644 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17645 ::std::convert::TryFrom::try_from(value.as_str())
17646 }
17647}
17648impl<'de> ::serde::Deserialize<'de> for InputBatchId {
17649 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
17650 where
17651 D: ::serde::Deserializer<'de>,
17652 {
17653 ::std::convert::TryFrom::try_from(
17654 ::std::string::String::deserialize(deserializer)?,
17655 )
17656 .map_err(|e: self::error::ConversionError| {
17657 <D::Error as ::serde::de::Error>::custom(e.to_string())
17658 })
17659 }
17660}
17661pub mod builder {
17663 #[derive(Clone, Debug)]
17664 pub struct Input {
17665 batch_id: ::std::result::Result<super::InputBatchId, ::std::string::String>,
17666 }
17667 impl ::std::default::Default for Input {
17668 fn default() -> Self {
17669 Self {
17670 batch_id: Err("no value supplied for batch_id".to_string()),
17671 }
17672 }
17673 }
17674 impl Input {
17675 pub fn batch_id<T>(mut self, value: T) -> Self
17676 where
17677 T: ::std::convert::TryInto<super::InputBatchId>,
17678 T::Error: ::std::fmt::Display,
17679 {
17680 self.batch_id = value
17681 .try_into()
17682 .map_err(|e| {
17683 format!("error converting supplied value for batch_id: {e}")
17684 });
17685 self
17686 }
17687 }
17688 impl ::std::convert::TryFrom<Input> for super::Input {
17689 type Error = super::error::ConversionError;
17690 fn try_from(
17691 value: Input,
17692 ) -> ::std::result::Result<Self, super::error::ConversionError> {
17693 Ok(Self { batch_id: value.batch_id? })
17694 }
17695 }
17696 impl ::std::convert::From<super::Input> for Input {
17697 fn from(value: super::Input) -> Self {
17698 Self {
17699 batch_id: Ok(value.batch_id),
17700 }
17701 }
17702 }
17703}
17704pub mod error {
17706 pub struct ConversionError(::std::borrow::Cow<'static, str>);
17708 impl ::std::error::Error for ConversionError {}
17709 impl ::std::fmt::Display for ConversionError {
17710 fn fmt(
17711 &self,
17712 f: &mut ::std::fmt::Formatter<'_>,
17713 ) -> Result<(), ::std::fmt::Error> {
17714 ::std::fmt::Display::fmt(&self.0, f)
17715 }
17716 }
17717 impl ::std::fmt::Debug for ConversionError {
17718 fn fmt(
17719 &self,
17720 f: &mut ::std::fmt::Formatter<'_>,
17721 ) -> Result<(), ::std::fmt::Error> {
17722 ::std::fmt::Debug::fmt(&self.0, f)
17723 }
17724 }
17725 impl From<&'static str> for ConversionError {
17726 fn from(value: &'static str) -> Self {
17727 Self(value.into())
17728 }
17729 }
17730 impl From<String> for ConversionError {
17731 fn from(value: String) -> Self {
17732 Self(value.into())
17733 }
17734 }
17735}
17736
17737pub mod output {
17738#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
17740pub struct BatchErrors {
17741 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
17743 pub data: ::std::vec::Vec<BatchErrorsDataItem>,
17744 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17746 pub object: ::std::option::Option<BatchErrorsObject>,
17747}
17748impl BatchErrors {
17749 pub fn builder() -> builder::BatchErrors {
17750 Default::default()
17751 }
17752}
17753#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
17755pub struct BatchErrorsDataItem {
17756 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17758 pub code: ::std::option::Option<::std::string::String>,
17759 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17761 pub line: ::std::option::Option<i64>,
17762 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17764 pub message: ::std::option::Option<::std::string::String>,
17765}
17766impl BatchErrorsDataItem {
17767 pub fn builder() -> builder::BatchErrorsDataItem {
17768 Default::default()
17769 }
17770}
17771#[derive(
17773 ::serde::Deserialize,
17774 ::serde::Serialize,
17775 Clone,
17776 Copy,
17777 Debug,
17778 Eq,
17779 Hash,
17780 Ord,
17781 PartialEq,
17782 PartialOrd
17783)]
17784pub enum BatchErrorsObject {
17785 #[serde(rename = "list")]
17786 List,
17787}
17788impl ::std::fmt::Display for BatchErrorsObject {
17789 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
17790 match *self {
17791 Self::List => f.write_str("list"),
17792 }
17793 }
17794}
17795impl ::std::str::FromStr for BatchErrorsObject {
17796 type Err = self::error::ConversionError;
17797 fn from_str(
17798 value: &str,
17799 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17800 match value {
17801 "list" => Ok(Self::List),
17802 _ => Err("invalid value".into()),
17803 }
17804 }
17805}
17806impl ::std::convert::TryFrom<&str> for BatchErrorsObject {
17807 type Error = self::error::ConversionError;
17808 fn try_from(
17809 value: &str,
17810 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17811 value.parse()
17812 }
17813}
17814impl ::std::convert::TryFrom<::std::string::String> for BatchErrorsObject {
17815 type Error = self::error::ConversionError;
17816 fn try_from(
17817 value: ::std::string::String,
17818 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17819 value.parse()
17820 }
17821}
17822#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
17824pub struct Error {
17825 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17827 pub code: ::std::option::Option<i64>,
17828 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17830 pub message: ::std::option::Option<::std::string::String>,
17831 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17833 pub param: ::std::option::Option<::std::string::String>,
17834 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
17836 pub type_: ::std::option::Option<::std::string::String>,
17837}
17838impl Error {
17839 pub fn builder() -> builder::Error {
17840 Default::default()
17841 }
17842}
17843#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
17845pub struct Output {
17846 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17848 pub cancelled_at: ::std::option::Option<i64>,
17849 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17851 pub cancelling_at: ::std::option::Option<i64>,
17852 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17854 pub completed_at: ::std::option::Option<i64>,
17855 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17857 pub completion_window: ::std::option::Option<::std::string::String>,
17858 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17860 pub created_at: ::std::option::Option<i64>,
17861 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17863 pub endpoint: ::std::option::Option<::std::string::String>,
17864 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17865 pub error: ::std::option::Option<Error>,
17866 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17868 pub error_file_id: ::std::option::Option<::std::string::String>,
17869 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17870 pub errors: ::std::option::Option<BatchErrors>,
17871 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17873 pub expired_at: ::std::option::Option<i64>,
17874 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17876 pub expires_at: ::std::option::Option<i64>,
17877 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17879 pub failed_at: ::std::option::Option<i64>,
17880 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17882 pub finalizing_at: ::std::option::Option<i64>,
17883 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17885 pub id: ::std::option::Option<::std::string::String>,
17886 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17888 pub in_progress_at: ::std::option::Option<i64>,
17889 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17891 pub input_file_id: ::std::option::Option<::std::string::String>,
17892 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
17894 pub metadata: ::std::collections::HashMap<
17895 ::std::string::String,
17896 ::std::string::String,
17897 >,
17898 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17900 pub object: ::std::option::Option<OutputObject>,
17901 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17903 pub output_file_id: ::std::option::Option<::std::string::String>,
17904 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17905 pub request_counts: ::std::option::Option<RequestCounts>,
17906 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17908 pub status: ::std::option::Option<OutputStatus>,
17909 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
17910 pub usage: ::std::option::Option<Usage>,
17911}
17912impl Output {
17913 pub fn builder() -> builder::Output {
17914 Default::default()
17915 }
17916}
17917#[derive(
17919 ::serde::Deserialize,
17920 ::serde::Serialize,
17921 Clone,
17922 Copy,
17923 Debug,
17924 Eq,
17925 Hash,
17926 Ord,
17927 PartialEq,
17928 PartialOrd
17929)]
17930pub enum OutputObject {
17931 #[serde(rename = "batch")]
17932 Batch,
17933}
17934impl ::std::fmt::Display for OutputObject {
17935 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
17936 match *self {
17937 Self::Batch => f.write_str("batch"),
17938 }
17939 }
17940}
17941impl ::std::str::FromStr for OutputObject {
17942 type Err = self::error::ConversionError;
17943 fn from_str(
17944 value: &str,
17945 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17946 match value {
17947 "batch" => Ok(Self::Batch),
17948 _ => Err("invalid value".into()),
17949 }
17950 }
17951}
17952impl ::std::convert::TryFrom<&str> for OutputObject {
17953 type Error = self::error::ConversionError;
17954 fn try_from(
17955 value: &str,
17956 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17957 value.parse()
17958 }
17959}
17960impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
17961 type Error = self::error::ConversionError;
17962 fn try_from(
17963 value: ::std::string::String,
17964 ) -> ::std::result::Result<Self, self::error::ConversionError> {
17965 value.parse()
17966 }
17967}
17968#[derive(
17970 ::serde::Deserialize,
17971 ::serde::Serialize,
17972 Clone,
17973 Copy,
17974 Debug,
17975 Eq,
17976 Hash,
17977 Ord,
17978 PartialEq,
17979 PartialOrd
17980)]
17981pub enum OutputStatus {
17982 #[serde(rename = "validating")]
17983 Validating,
17984 #[serde(rename = "in_progress")]
17985 InProgress,
17986 #[serde(rename = "finalizing")]
17987 Finalizing,
17988 #[serde(rename = "completed")]
17989 Completed,
17990 #[serde(rename = "expired")]
17991 Expired,
17992 #[serde(rename = "cancelling")]
17993 Cancelling,
17994 #[serde(rename = "cancelled")]
17995 Cancelled,
17996 #[serde(rename = "failed")]
17997 Failed,
17998}
17999impl ::std::fmt::Display for OutputStatus {
18000 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
18001 match *self {
18002 Self::Validating => f.write_str("validating"),
18003 Self::InProgress => f.write_str("in_progress"),
18004 Self::Finalizing => f.write_str("finalizing"),
18005 Self::Completed => f.write_str("completed"),
18006 Self::Expired => f.write_str("expired"),
18007 Self::Cancelling => f.write_str("cancelling"),
18008 Self::Cancelled => f.write_str("cancelled"),
18009 Self::Failed => f.write_str("failed"),
18010 }
18011 }
18012}
18013impl ::std::str::FromStr for OutputStatus {
18014 type Err = self::error::ConversionError;
18015 fn from_str(
18016 value: &str,
18017 ) -> ::std::result::Result<Self, self::error::ConversionError> {
18018 match value {
18019 "validating" => Ok(Self::Validating),
18020 "in_progress" => Ok(Self::InProgress),
18021 "finalizing" => Ok(Self::Finalizing),
18022 "completed" => Ok(Self::Completed),
18023 "expired" => Ok(Self::Expired),
18024 "cancelling" => Ok(Self::Cancelling),
18025 "cancelled" => Ok(Self::Cancelled),
18026 "failed" => Ok(Self::Failed),
18027 _ => Err("invalid value".into()),
18028 }
18029 }
18030}
18031impl ::std::convert::TryFrom<&str> for OutputStatus {
18032 type Error = self::error::ConversionError;
18033 fn try_from(
18034 value: &str,
18035 ) -> ::std::result::Result<Self, self::error::ConversionError> {
18036 value.parse()
18037 }
18038}
18039impl ::std::convert::TryFrom<::std::string::String> for OutputStatus {
18040 type Error = self::error::ConversionError;
18041 fn try_from(
18042 value: ::std::string::String,
18043 ) -> ::std::result::Result<Self, self::error::ConversionError> {
18044 value.parse()
18045 }
18046}
18047#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
18049pub struct RequestCounts {
18050 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18052 pub completed: ::std::option::Option<i64>,
18053 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18055 pub failed: ::std::option::Option<i64>,
18056 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18058 pub total: ::std::option::Option<i64>,
18059}
18060impl RequestCounts {
18061 pub fn builder() -> builder::RequestCounts {
18062 Default::default()
18063 }
18064}
18065#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
18067pub struct Usage {
18068 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18070 pub input_tokens: ::std::option::Option<i64>,
18071 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18072 pub input_tokens_details: ::std::option::Option<UsageInputTokensDetails>,
18073 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18075 pub output_tokens: ::std::option::Option<i64>,
18076 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18077 pub output_tokens_details: ::std::option::Option<UsageOutputTokensDetails>,
18078 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18080 pub total_tokens: ::std::option::Option<i64>,
18081}
18082impl Usage {
18083 pub fn builder() -> builder::Usage {
18084 Default::default()
18085 }
18086}
18087#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
18089pub struct UsageInputTokensDetails {
18090 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18092 pub cached_tokens: ::std::option::Option<i64>,
18093}
18094impl UsageInputTokensDetails {
18095 pub fn builder() -> builder::UsageInputTokensDetails {
18096 Default::default()
18097 }
18098}
18099#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
18101pub struct UsageOutputTokensDetails {
18102 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
18104 pub reasoning_tokens: ::std::option::Option<i64>,
18105}
18106impl UsageOutputTokensDetails {
18107 pub fn builder() -> builder::UsageOutputTokensDetails {
18108 Default::default()
18109 }
18110}
18111pub mod builder {
18113 #[derive(Clone, Debug)]
18114 pub struct BatchErrors {
18115 data: ::std::result::Result<
18116 ::std::vec::Vec<super::BatchErrorsDataItem>,
18117 ::std::string::String,
18118 >,
18119 object: ::std::result::Result<
18120 ::std::option::Option<super::BatchErrorsObject>,
18121 ::std::string::String,
18122 >,
18123 }
18124 impl ::std::default::Default for BatchErrors {
18125 fn default() -> Self {
18126 Self {
18127 data: Ok(Default::default()),
18128 object: Ok(Default::default()),
18129 }
18130 }
18131 }
18132 impl BatchErrors {
18133 pub fn data<T>(mut self, value: T) -> Self
18134 where
18135 T: ::std::convert::TryInto<::std::vec::Vec<super::BatchErrorsDataItem>>,
18136 T::Error: ::std::fmt::Display,
18137 {
18138 self.data = value
18139 .try_into()
18140 .map_err(|e| format!("error converting supplied value for data: {e}"));
18141 self
18142 }
18143 pub fn object<T>(mut self, value: T) -> Self
18144 where
18145 T: ::std::convert::TryInto<::std::option::Option<super::BatchErrorsObject>>,
18146 T::Error: ::std::fmt::Display,
18147 {
18148 self.object = value
18149 .try_into()
18150 .map_err(|e| format!("error converting supplied value for object: {e}"));
18151 self
18152 }
18153 }
18154 impl ::std::convert::TryFrom<BatchErrors> for super::BatchErrors {
18155 type Error = super::error::ConversionError;
18156 fn try_from(
18157 value: BatchErrors,
18158 ) -> ::std::result::Result<Self, super::error::ConversionError> {
18159 Ok(Self {
18160 data: value.data?,
18161 object: value.object?,
18162 })
18163 }
18164 }
18165 impl ::std::convert::From<super::BatchErrors> for BatchErrors {
18166 fn from(value: super::BatchErrors) -> Self {
18167 Self {
18168 data: Ok(value.data),
18169 object: Ok(value.object),
18170 }
18171 }
18172 }
18173 #[derive(Clone, Debug)]
18174 pub struct BatchErrorsDataItem {
18175 code: ::std::result::Result<
18176 ::std::option::Option<::std::string::String>,
18177 ::std::string::String,
18178 >,
18179 line: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
18180 message: ::std::result::Result<
18181 ::std::option::Option<::std::string::String>,
18182 ::std::string::String,
18183 >,
18184 }
18185 impl ::std::default::Default for BatchErrorsDataItem {
18186 fn default() -> Self {
18187 Self {
18188 code: Ok(Default::default()),
18189 line: Ok(Default::default()),
18190 message: Ok(Default::default()),
18191 }
18192 }
18193 }
18194 impl BatchErrorsDataItem {
18195 pub fn code<T>(mut self, value: T) -> Self
18196 where
18197 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18198 T::Error: ::std::fmt::Display,
18199 {
18200 self.code = value
18201 .try_into()
18202 .map_err(|e| format!("error converting supplied value for code: {e}"));
18203 self
18204 }
18205 pub fn line<T>(mut self, value: T) -> Self
18206 where
18207 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18208 T::Error: ::std::fmt::Display,
18209 {
18210 self.line = value
18211 .try_into()
18212 .map_err(|e| format!("error converting supplied value for line: {e}"));
18213 self
18214 }
18215 pub fn message<T>(mut self, value: T) -> Self
18216 where
18217 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18218 T::Error: ::std::fmt::Display,
18219 {
18220 self.message = value
18221 .try_into()
18222 .map_err(|e| {
18223 format!("error converting supplied value for message: {e}")
18224 });
18225 self
18226 }
18227 }
18228 impl ::std::convert::TryFrom<BatchErrorsDataItem> for super::BatchErrorsDataItem {
18229 type Error = super::error::ConversionError;
18230 fn try_from(
18231 value: BatchErrorsDataItem,
18232 ) -> ::std::result::Result<Self, super::error::ConversionError> {
18233 Ok(Self {
18234 code: value.code?,
18235 line: value.line?,
18236 message: value.message?,
18237 })
18238 }
18239 }
18240 impl ::std::convert::From<super::BatchErrorsDataItem> for BatchErrorsDataItem {
18241 fn from(value: super::BatchErrorsDataItem) -> Self {
18242 Self {
18243 code: Ok(value.code),
18244 line: Ok(value.line),
18245 message: Ok(value.message),
18246 }
18247 }
18248 }
18249 #[derive(Clone, Debug)]
18250 pub struct Error {
18251 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
18252 message: ::std::result::Result<
18253 ::std::option::Option<::std::string::String>,
18254 ::std::string::String,
18255 >,
18256 param: ::std::result::Result<
18257 ::std::option::Option<::std::string::String>,
18258 ::std::string::String,
18259 >,
18260 type_: ::std::result::Result<
18261 ::std::option::Option<::std::string::String>,
18262 ::std::string::String,
18263 >,
18264 }
18265 impl ::std::default::Default for Error {
18266 fn default() -> Self {
18267 Self {
18268 code: Ok(Default::default()),
18269 message: Ok(Default::default()),
18270 param: Ok(Default::default()),
18271 type_: Ok(Default::default()),
18272 }
18273 }
18274 }
18275 impl Error {
18276 pub fn code<T>(mut self, value: T) -> Self
18277 where
18278 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18279 T::Error: ::std::fmt::Display,
18280 {
18281 self.code = value
18282 .try_into()
18283 .map_err(|e| format!("error converting supplied value for code: {e}"));
18284 self
18285 }
18286 pub fn message<T>(mut self, value: T) -> Self
18287 where
18288 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18289 T::Error: ::std::fmt::Display,
18290 {
18291 self.message = value
18292 .try_into()
18293 .map_err(|e| {
18294 format!("error converting supplied value for message: {e}")
18295 });
18296 self
18297 }
18298 pub fn param<T>(mut self, value: T) -> Self
18299 where
18300 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18301 T::Error: ::std::fmt::Display,
18302 {
18303 self.param = value
18304 .try_into()
18305 .map_err(|e| format!("error converting supplied value for param: {e}"));
18306 self
18307 }
18308 pub fn type_<T>(mut self, value: T) -> Self
18309 where
18310 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18311 T::Error: ::std::fmt::Display,
18312 {
18313 self.type_ = value
18314 .try_into()
18315 .map_err(|e| format!("error converting supplied value for type_: {e}"));
18316 self
18317 }
18318 }
18319 impl ::std::convert::TryFrom<Error> for super::Error {
18320 type Error = super::error::ConversionError;
18321 fn try_from(
18322 value: Error,
18323 ) -> ::std::result::Result<Self, super::error::ConversionError> {
18324 Ok(Self {
18325 code: value.code?,
18326 message: value.message?,
18327 param: value.param?,
18328 type_: value.type_?,
18329 })
18330 }
18331 }
18332 impl ::std::convert::From<super::Error> for Error {
18333 fn from(value: super::Error) -> Self {
18334 Self {
18335 code: Ok(value.code),
18336 message: Ok(value.message),
18337 param: Ok(value.param),
18338 type_: Ok(value.type_),
18339 }
18340 }
18341 }
18342 #[derive(Clone, Debug)]
18343 pub struct Output {
18344 cancelled_at: ::std::result::Result<
18345 ::std::option::Option<i64>,
18346 ::std::string::String,
18347 >,
18348 cancelling_at: ::std::result::Result<
18349 ::std::option::Option<i64>,
18350 ::std::string::String,
18351 >,
18352 completed_at: ::std::result::Result<
18353 ::std::option::Option<i64>,
18354 ::std::string::String,
18355 >,
18356 completion_window: ::std::result::Result<
18357 ::std::option::Option<::std::string::String>,
18358 ::std::string::String,
18359 >,
18360 created_at: ::std::result::Result<
18361 ::std::option::Option<i64>,
18362 ::std::string::String,
18363 >,
18364 endpoint: ::std::result::Result<
18365 ::std::option::Option<::std::string::String>,
18366 ::std::string::String,
18367 >,
18368 error: ::std::result::Result<
18369 ::std::option::Option<super::Error>,
18370 ::std::string::String,
18371 >,
18372 error_file_id: ::std::result::Result<
18373 ::std::option::Option<::std::string::String>,
18374 ::std::string::String,
18375 >,
18376 errors: ::std::result::Result<
18377 ::std::option::Option<super::BatchErrors>,
18378 ::std::string::String,
18379 >,
18380 expired_at: ::std::result::Result<
18381 ::std::option::Option<i64>,
18382 ::std::string::String,
18383 >,
18384 expires_at: ::std::result::Result<
18385 ::std::option::Option<i64>,
18386 ::std::string::String,
18387 >,
18388 failed_at: ::std::result::Result<
18389 ::std::option::Option<i64>,
18390 ::std::string::String,
18391 >,
18392 finalizing_at: ::std::result::Result<
18393 ::std::option::Option<i64>,
18394 ::std::string::String,
18395 >,
18396 id: ::std::result::Result<
18397 ::std::option::Option<::std::string::String>,
18398 ::std::string::String,
18399 >,
18400 in_progress_at: ::std::result::Result<
18401 ::std::option::Option<i64>,
18402 ::std::string::String,
18403 >,
18404 input_file_id: ::std::result::Result<
18405 ::std::option::Option<::std::string::String>,
18406 ::std::string::String,
18407 >,
18408 metadata: ::std::result::Result<
18409 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
18410 ::std::string::String,
18411 >,
18412 object: ::std::result::Result<
18413 ::std::option::Option<super::OutputObject>,
18414 ::std::string::String,
18415 >,
18416 output_file_id: ::std::result::Result<
18417 ::std::option::Option<::std::string::String>,
18418 ::std::string::String,
18419 >,
18420 request_counts: ::std::result::Result<
18421 ::std::option::Option<super::RequestCounts>,
18422 ::std::string::String,
18423 >,
18424 status: ::std::result::Result<
18425 ::std::option::Option<super::OutputStatus>,
18426 ::std::string::String,
18427 >,
18428 usage: ::std::result::Result<
18429 ::std::option::Option<super::Usage>,
18430 ::std::string::String,
18431 >,
18432 }
18433 impl ::std::default::Default for Output {
18434 fn default() -> Self {
18435 Self {
18436 cancelled_at: Ok(Default::default()),
18437 cancelling_at: Ok(Default::default()),
18438 completed_at: Ok(Default::default()),
18439 completion_window: Ok(Default::default()),
18440 created_at: Ok(Default::default()),
18441 endpoint: Ok(Default::default()),
18442 error: Ok(Default::default()),
18443 error_file_id: Ok(Default::default()),
18444 errors: Ok(Default::default()),
18445 expired_at: Ok(Default::default()),
18446 expires_at: Ok(Default::default()),
18447 failed_at: Ok(Default::default()),
18448 finalizing_at: Ok(Default::default()),
18449 id: Ok(Default::default()),
18450 in_progress_at: Ok(Default::default()),
18451 input_file_id: Ok(Default::default()),
18452 metadata: Ok(Default::default()),
18453 object: Ok(Default::default()),
18454 output_file_id: Ok(Default::default()),
18455 request_counts: Ok(Default::default()),
18456 status: Ok(Default::default()),
18457 usage: Ok(Default::default()),
18458 }
18459 }
18460 }
18461 impl Output {
18462 pub fn cancelled_at<T>(mut self, value: T) -> Self
18463 where
18464 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18465 T::Error: ::std::fmt::Display,
18466 {
18467 self.cancelled_at = value
18468 .try_into()
18469 .map_err(|e| {
18470 format!("error converting supplied value for cancelled_at: {e}")
18471 });
18472 self
18473 }
18474 pub fn cancelling_at<T>(mut self, value: T) -> Self
18475 where
18476 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18477 T::Error: ::std::fmt::Display,
18478 {
18479 self.cancelling_at = value
18480 .try_into()
18481 .map_err(|e| {
18482 format!("error converting supplied value for cancelling_at: {e}")
18483 });
18484 self
18485 }
18486 pub fn completed_at<T>(mut self, value: T) -> Self
18487 where
18488 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18489 T::Error: ::std::fmt::Display,
18490 {
18491 self.completed_at = value
18492 .try_into()
18493 .map_err(|e| {
18494 format!("error converting supplied value for completed_at: {e}")
18495 });
18496 self
18497 }
18498 pub fn completion_window<T>(mut self, value: T) -> Self
18499 where
18500 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18501 T::Error: ::std::fmt::Display,
18502 {
18503 self.completion_window = value
18504 .try_into()
18505 .map_err(|e| {
18506 format!("error converting supplied value for completion_window: {e}")
18507 });
18508 self
18509 }
18510 pub fn created_at<T>(mut self, value: T) -> Self
18511 where
18512 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18513 T::Error: ::std::fmt::Display,
18514 {
18515 self.created_at = value
18516 .try_into()
18517 .map_err(|e| {
18518 format!("error converting supplied value for created_at: {e}")
18519 });
18520 self
18521 }
18522 pub fn endpoint<T>(mut self, value: T) -> Self
18523 where
18524 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18525 T::Error: ::std::fmt::Display,
18526 {
18527 self.endpoint = value
18528 .try_into()
18529 .map_err(|e| {
18530 format!("error converting supplied value for endpoint: {e}")
18531 });
18532 self
18533 }
18534 pub fn error<T>(mut self, value: T) -> Self
18535 where
18536 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
18537 T::Error: ::std::fmt::Display,
18538 {
18539 self.error = value
18540 .try_into()
18541 .map_err(|e| format!("error converting supplied value for error: {e}"));
18542 self
18543 }
18544 pub fn error_file_id<T>(mut self, value: T) -> Self
18545 where
18546 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18547 T::Error: ::std::fmt::Display,
18548 {
18549 self.error_file_id = value
18550 .try_into()
18551 .map_err(|e| {
18552 format!("error converting supplied value for error_file_id: {e}")
18553 });
18554 self
18555 }
18556 pub fn errors<T>(mut self, value: T) -> Self
18557 where
18558 T: ::std::convert::TryInto<::std::option::Option<super::BatchErrors>>,
18559 T::Error: ::std::fmt::Display,
18560 {
18561 self.errors = value
18562 .try_into()
18563 .map_err(|e| format!("error converting supplied value for errors: {e}"));
18564 self
18565 }
18566 pub fn expired_at<T>(mut self, value: T) -> Self
18567 where
18568 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18569 T::Error: ::std::fmt::Display,
18570 {
18571 self.expired_at = value
18572 .try_into()
18573 .map_err(|e| {
18574 format!("error converting supplied value for expired_at: {e}")
18575 });
18576 self
18577 }
18578 pub fn expires_at<T>(mut self, value: T) -> Self
18579 where
18580 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18581 T::Error: ::std::fmt::Display,
18582 {
18583 self.expires_at = value
18584 .try_into()
18585 .map_err(|e| {
18586 format!("error converting supplied value for expires_at: {e}")
18587 });
18588 self
18589 }
18590 pub fn failed_at<T>(mut self, value: T) -> Self
18591 where
18592 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18593 T::Error: ::std::fmt::Display,
18594 {
18595 self.failed_at = value
18596 .try_into()
18597 .map_err(|e| {
18598 format!("error converting supplied value for failed_at: {e}")
18599 });
18600 self
18601 }
18602 pub fn finalizing_at<T>(mut self, value: T) -> Self
18603 where
18604 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18605 T::Error: ::std::fmt::Display,
18606 {
18607 self.finalizing_at = value
18608 .try_into()
18609 .map_err(|e| {
18610 format!("error converting supplied value for finalizing_at: {e}")
18611 });
18612 self
18613 }
18614 pub fn id<T>(mut self, value: T) -> Self
18615 where
18616 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18617 T::Error: ::std::fmt::Display,
18618 {
18619 self.id = value
18620 .try_into()
18621 .map_err(|e| format!("error converting supplied value for id: {e}"));
18622 self
18623 }
18624 pub fn in_progress_at<T>(mut self, value: T) -> Self
18625 where
18626 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18627 T::Error: ::std::fmt::Display,
18628 {
18629 self.in_progress_at = value
18630 .try_into()
18631 .map_err(|e| {
18632 format!("error converting supplied value for in_progress_at: {e}")
18633 });
18634 self
18635 }
18636 pub fn input_file_id<T>(mut self, value: T) -> Self
18637 where
18638 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18639 T::Error: ::std::fmt::Display,
18640 {
18641 self.input_file_id = value
18642 .try_into()
18643 .map_err(|e| {
18644 format!("error converting supplied value for input_file_id: {e}")
18645 });
18646 self
18647 }
18648 pub fn metadata<T>(mut self, value: T) -> Self
18649 where
18650 T: ::std::convert::TryInto<
18651 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
18652 >,
18653 T::Error: ::std::fmt::Display,
18654 {
18655 self.metadata = value
18656 .try_into()
18657 .map_err(|e| {
18658 format!("error converting supplied value for metadata: {e}")
18659 });
18660 self
18661 }
18662 pub fn object<T>(mut self, value: T) -> Self
18663 where
18664 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
18665 T::Error: ::std::fmt::Display,
18666 {
18667 self.object = value
18668 .try_into()
18669 .map_err(|e| format!("error converting supplied value for object: {e}"));
18670 self
18671 }
18672 pub fn output_file_id<T>(mut self, value: T) -> Self
18673 where
18674 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
18675 T::Error: ::std::fmt::Display,
18676 {
18677 self.output_file_id = value
18678 .try_into()
18679 .map_err(|e| {
18680 format!("error converting supplied value for output_file_id: {e}")
18681 });
18682 self
18683 }
18684 pub fn request_counts<T>(mut self, value: T) -> Self
18685 where
18686 T: ::std::convert::TryInto<::std::option::Option<super::RequestCounts>>,
18687 T::Error: ::std::fmt::Display,
18688 {
18689 self.request_counts = value
18690 .try_into()
18691 .map_err(|e| {
18692 format!("error converting supplied value for request_counts: {e}")
18693 });
18694 self
18695 }
18696 pub fn status<T>(mut self, value: T) -> Self
18697 where
18698 T: ::std::convert::TryInto<::std::option::Option<super::OutputStatus>>,
18699 T::Error: ::std::fmt::Display,
18700 {
18701 self.status = value
18702 .try_into()
18703 .map_err(|e| format!("error converting supplied value for status: {e}"));
18704 self
18705 }
18706 pub fn usage<T>(mut self, value: T) -> Self
18707 where
18708 T: ::std::convert::TryInto<::std::option::Option<super::Usage>>,
18709 T::Error: ::std::fmt::Display,
18710 {
18711 self.usage = value
18712 .try_into()
18713 .map_err(|e| format!("error converting supplied value for usage: {e}"));
18714 self
18715 }
18716 }
18717 impl ::std::convert::TryFrom<Output> for super::Output {
18718 type Error = super::error::ConversionError;
18719 fn try_from(
18720 value: Output,
18721 ) -> ::std::result::Result<Self, super::error::ConversionError> {
18722 Ok(Self {
18723 cancelled_at: value.cancelled_at?,
18724 cancelling_at: value.cancelling_at?,
18725 completed_at: value.completed_at?,
18726 completion_window: value.completion_window?,
18727 created_at: value.created_at?,
18728 endpoint: value.endpoint?,
18729 error: value.error?,
18730 error_file_id: value.error_file_id?,
18731 errors: value.errors?,
18732 expired_at: value.expired_at?,
18733 expires_at: value.expires_at?,
18734 failed_at: value.failed_at?,
18735 finalizing_at: value.finalizing_at?,
18736 id: value.id?,
18737 in_progress_at: value.in_progress_at?,
18738 input_file_id: value.input_file_id?,
18739 metadata: value.metadata?,
18740 object: value.object?,
18741 output_file_id: value.output_file_id?,
18742 request_counts: value.request_counts?,
18743 status: value.status?,
18744 usage: value.usage?,
18745 })
18746 }
18747 }
18748 impl ::std::convert::From<super::Output> for Output {
18749 fn from(value: super::Output) -> Self {
18750 Self {
18751 cancelled_at: Ok(value.cancelled_at),
18752 cancelling_at: Ok(value.cancelling_at),
18753 completed_at: Ok(value.completed_at),
18754 completion_window: Ok(value.completion_window),
18755 created_at: Ok(value.created_at),
18756 endpoint: Ok(value.endpoint),
18757 error: Ok(value.error),
18758 error_file_id: Ok(value.error_file_id),
18759 errors: Ok(value.errors),
18760 expired_at: Ok(value.expired_at),
18761 expires_at: Ok(value.expires_at),
18762 failed_at: Ok(value.failed_at),
18763 finalizing_at: Ok(value.finalizing_at),
18764 id: Ok(value.id),
18765 in_progress_at: Ok(value.in_progress_at),
18766 input_file_id: Ok(value.input_file_id),
18767 metadata: Ok(value.metadata),
18768 object: Ok(value.object),
18769 output_file_id: Ok(value.output_file_id),
18770 request_counts: Ok(value.request_counts),
18771 status: Ok(value.status),
18772 usage: Ok(value.usage),
18773 }
18774 }
18775 }
18776 #[derive(Clone, Debug)]
18777 pub struct RequestCounts {
18778 completed: ::std::result::Result<
18779 ::std::option::Option<i64>,
18780 ::std::string::String,
18781 >,
18782 failed: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
18783 total: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
18784 }
18785 impl ::std::default::Default for RequestCounts {
18786 fn default() -> Self {
18787 Self {
18788 completed: Ok(Default::default()),
18789 failed: Ok(Default::default()),
18790 total: Ok(Default::default()),
18791 }
18792 }
18793 }
18794 impl RequestCounts {
18795 pub fn completed<T>(mut self, value: T) -> Self
18796 where
18797 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18798 T::Error: ::std::fmt::Display,
18799 {
18800 self.completed = value
18801 .try_into()
18802 .map_err(|e| {
18803 format!("error converting supplied value for completed: {e}")
18804 });
18805 self
18806 }
18807 pub fn failed<T>(mut self, value: T) -> Self
18808 where
18809 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18810 T::Error: ::std::fmt::Display,
18811 {
18812 self.failed = value
18813 .try_into()
18814 .map_err(|e| format!("error converting supplied value for failed: {e}"));
18815 self
18816 }
18817 pub fn total<T>(mut self, value: T) -> Self
18818 where
18819 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18820 T::Error: ::std::fmt::Display,
18821 {
18822 self.total = value
18823 .try_into()
18824 .map_err(|e| format!("error converting supplied value for total: {e}"));
18825 self
18826 }
18827 }
18828 impl ::std::convert::TryFrom<RequestCounts> for super::RequestCounts {
18829 type Error = super::error::ConversionError;
18830 fn try_from(
18831 value: RequestCounts,
18832 ) -> ::std::result::Result<Self, super::error::ConversionError> {
18833 Ok(Self {
18834 completed: value.completed?,
18835 failed: value.failed?,
18836 total: value.total?,
18837 })
18838 }
18839 }
18840 impl ::std::convert::From<super::RequestCounts> for RequestCounts {
18841 fn from(value: super::RequestCounts) -> Self {
18842 Self {
18843 completed: Ok(value.completed),
18844 failed: Ok(value.failed),
18845 total: Ok(value.total),
18846 }
18847 }
18848 }
18849 #[derive(Clone, Debug)]
18850 pub struct Usage {
18851 input_tokens: ::std::result::Result<
18852 ::std::option::Option<i64>,
18853 ::std::string::String,
18854 >,
18855 input_tokens_details: ::std::result::Result<
18856 ::std::option::Option<super::UsageInputTokensDetails>,
18857 ::std::string::String,
18858 >,
18859 output_tokens: ::std::result::Result<
18860 ::std::option::Option<i64>,
18861 ::std::string::String,
18862 >,
18863 output_tokens_details: ::std::result::Result<
18864 ::std::option::Option<super::UsageOutputTokensDetails>,
18865 ::std::string::String,
18866 >,
18867 total_tokens: ::std::result::Result<
18868 ::std::option::Option<i64>,
18869 ::std::string::String,
18870 >,
18871 }
18872 impl ::std::default::Default for Usage {
18873 fn default() -> Self {
18874 Self {
18875 input_tokens: Ok(Default::default()),
18876 input_tokens_details: Ok(Default::default()),
18877 output_tokens: Ok(Default::default()),
18878 output_tokens_details: Ok(Default::default()),
18879 total_tokens: Ok(Default::default()),
18880 }
18881 }
18882 }
18883 impl Usage {
18884 pub fn input_tokens<T>(mut self, value: T) -> Self
18885 where
18886 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18887 T::Error: ::std::fmt::Display,
18888 {
18889 self.input_tokens = value
18890 .try_into()
18891 .map_err(|e| {
18892 format!("error converting supplied value for input_tokens: {e}")
18893 });
18894 self
18895 }
18896 pub fn input_tokens_details<T>(mut self, value: T) -> Self
18897 where
18898 T: ::std::convert::TryInto<
18899 ::std::option::Option<super::UsageInputTokensDetails>,
18900 >,
18901 T::Error: ::std::fmt::Display,
18902 {
18903 self.input_tokens_details = value
18904 .try_into()
18905 .map_err(|e| {
18906 format!(
18907 "error converting supplied value for input_tokens_details: {e}"
18908 )
18909 });
18910 self
18911 }
18912 pub fn output_tokens<T>(mut self, value: T) -> Self
18913 where
18914 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18915 T::Error: ::std::fmt::Display,
18916 {
18917 self.output_tokens = value
18918 .try_into()
18919 .map_err(|e| {
18920 format!("error converting supplied value for output_tokens: {e}")
18921 });
18922 self
18923 }
18924 pub fn output_tokens_details<T>(mut self, value: T) -> Self
18925 where
18926 T: ::std::convert::TryInto<
18927 ::std::option::Option<super::UsageOutputTokensDetails>,
18928 >,
18929 T::Error: ::std::fmt::Display,
18930 {
18931 self.output_tokens_details = value
18932 .try_into()
18933 .map_err(|e| {
18934 format!(
18935 "error converting supplied value for output_tokens_details: {e}"
18936 )
18937 });
18938 self
18939 }
18940 pub fn total_tokens<T>(mut self, value: T) -> Self
18941 where
18942 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18943 T::Error: ::std::fmt::Display,
18944 {
18945 self.total_tokens = value
18946 .try_into()
18947 .map_err(|e| {
18948 format!("error converting supplied value for total_tokens: {e}")
18949 });
18950 self
18951 }
18952 }
18953 impl ::std::convert::TryFrom<Usage> for super::Usage {
18954 type Error = super::error::ConversionError;
18955 fn try_from(
18956 value: Usage,
18957 ) -> ::std::result::Result<Self, super::error::ConversionError> {
18958 Ok(Self {
18959 input_tokens: value.input_tokens?,
18960 input_tokens_details: value.input_tokens_details?,
18961 output_tokens: value.output_tokens?,
18962 output_tokens_details: value.output_tokens_details?,
18963 total_tokens: value.total_tokens?,
18964 })
18965 }
18966 }
18967 impl ::std::convert::From<super::Usage> for Usage {
18968 fn from(value: super::Usage) -> Self {
18969 Self {
18970 input_tokens: Ok(value.input_tokens),
18971 input_tokens_details: Ok(value.input_tokens_details),
18972 output_tokens: Ok(value.output_tokens),
18973 output_tokens_details: Ok(value.output_tokens_details),
18974 total_tokens: Ok(value.total_tokens),
18975 }
18976 }
18977 }
18978 #[derive(Clone, Debug)]
18979 pub struct UsageInputTokensDetails {
18980 cached_tokens: ::std::result::Result<
18981 ::std::option::Option<i64>,
18982 ::std::string::String,
18983 >,
18984 }
18985 impl ::std::default::Default for UsageInputTokensDetails {
18986 fn default() -> Self {
18987 Self {
18988 cached_tokens: Ok(Default::default()),
18989 }
18990 }
18991 }
18992 impl UsageInputTokensDetails {
18993 pub fn cached_tokens<T>(mut self, value: T) -> Self
18994 where
18995 T: ::std::convert::TryInto<::std::option::Option<i64>>,
18996 T::Error: ::std::fmt::Display,
18997 {
18998 self.cached_tokens = value
18999 .try_into()
19000 .map_err(|e| {
19001 format!("error converting supplied value for cached_tokens: {e}")
19002 });
19003 self
19004 }
19005 }
19006 impl ::std::convert::TryFrom<UsageInputTokensDetails>
19007 for super::UsageInputTokensDetails {
19008 type Error = super::error::ConversionError;
19009 fn try_from(
19010 value: UsageInputTokensDetails,
19011 ) -> ::std::result::Result<Self, super::error::ConversionError> {
19012 Ok(Self {
19013 cached_tokens: value.cached_tokens?,
19014 })
19015 }
19016 }
19017 impl ::std::convert::From<super::UsageInputTokensDetails>
19018 for UsageInputTokensDetails {
19019 fn from(value: super::UsageInputTokensDetails) -> Self {
19020 Self {
19021 cached_tokens: Ok(value.cached_tokens),
19022 }
19023 }
19024 }
19025 #[derive(Clone, Debug)]
19026 pub struct UsageOutputTokensDetails {
19027 reasoning_tokens: ::std::result::Result<
19028 ::std::option::Option<i64>,
19029 ::std::string::String,
19030 >,
19031 }
19032 impl ::std::default::Default for UsageOutputTokensDetails {
19033 fn default() -> Self {
19034 Self {
19035 reasoning_tokens: Ok(Default::default()),
19036 }
19037 }
19038 }
19039 impl UsageOutputTokensDetails {
19040 pub fn reasoning_tokens<T>(mut self, value: T) -> Self
19041 where
19042 T: ::std::convert::TryInto<::std::option::Option<i64>>,
19043 T::Error: ::std::fmt::Display,
19044 {
19045 self.reasoning_tokens = value
19046 .try_into()
19047 .map_err(|e| {
19048 format!("error converting supplied value for reasoning_tokens: {e}")
19049 });
19050 self
19051 }
19052 }
19053 impl ::std::convert::TryFrom<UsageOutputTokensDetails>
19054 for super::UsageOutputTokensDetails {
19055 type Error = super::error::ConversionError;
19056 fn try_from(
19057 value: UsageOutputTokensDetails,
19058 ) -> ::std::result::Result<Self, super::error::ConversionError> {
19059 Ok(Self {
19060 reasoning_tokens: value.reasoning_tokens?,
19061 })
19062 }
19063 }
19064 impl ::std::convert::From<super::UsageOutputTokensDetails>
19065 for UsageOutputTokensDetails {
19066 fn from(value: super::UsageOutputTokensDetails) -> Self {
19067 Self {
19068 reasoning_tokens: Ok(value.reasoning_tokens),
19069 }
19070 }
19071 }
19072}
19073pub mod error {
19075 pub struct ConversionError(::std::borrow::Cow<'static, str>);
19077 impl ::std::error::Error for ConversionError {}
19078 impl ::std::fmt::Display for ConversionError {
19079 fn fmt(
19080 &self,
19081 f: &mut ::std::fmt::Formatter<'_>,
19082 ) -> Result<(), ::std::fmt::Error> {
19083 ::std::fmt::Display::fmt(&self.0, f)
19084 }
19085 }
19086 impl ::std::fmt::Debug for ConversionError {
19087 fn fmt(
19088 &self,
19089 f: &mut ::std::fmt::Formatter<'_>,
19090 ) -> Result<(), ::std::fmt::Error> {
19091 ::std::fmt::Debug::fmt(&self.0, f)
19092 }
19093 }
19094 impl From<&'static str> for ConversionError {
19095 fn from(value: &'static str) -> Self {
19096 Self(value.into())
19097 }
19098 }
19099 impl From<String> for ConversionError {
19100 fn from(value: String) -> Self {
19101 Self(value.into())
19102 }
19103 }
19104}
19105
19106}
19107
19108 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "batchId", part: ::one::Part::Path, key: Some("batchId") }], required_parts: &[::one::Part::Path] };
19110
19111 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
19120 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C2r7VUA::KPYnRbCSRaOY2MXu0W1CAg", Method::GET, "/v1/batches/{{batchId}}").with_routed(&input, &ROUTING)?
19121 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
19122 }
19123
19124 impl IntoOperation for Input {
19125 type Output = output::Output;
19126
19127 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
19128 build(self)
19129 }
19130 }
19131 impl IntoOperation for builder::Input {
19132 type Output = output::Output;
19133
19134 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
19135 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
19136 }
19137 }
19138}
19139pub fn retrieve_batch() -> retrieve_batch::builder::Input {
19141 retrieve_batch::builder::Input::default()
19142}
19143pub mod retrieve_file {
19144 use ::one::{Error, IntoOperation, Method, Operation};
19145#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
19147#[serde(deny_unknown_fields)]
19148pub struct Input {
19149 #[serde(rename = "fileId")]
19151 pub file_id: InputFileId,
19152}
19153impl Input {
19154 pub fn builder() -> builder::Input {
19155 Default::default()
19156 }
19157}
19158#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19160#[serde(transparent)]
19161pub struct InputFileId(::std::string::String);
19162impl ::std::ops::Deref for InputFileId {
19163 type Target = ::std::string::String;
19164 fn deref(&self) -> &::std::string::String {
19165 &self.0
19166 }
19167}
19168impl ::std::convert::From<InputFileId> for ::std::string::String {
19169 fn from(value: InputFileId) -> Self {
19170 value.0
19171 }
19172}
19173impl ::std::str::FromStr for InputFileId {
19174 type Err = self::error::ConversionError;
19175 fn from_str(
19176 value: &str,
19177 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19178 ::std::convert::TryFrom::try_from(value)
19179 }
19180}
19181impl ::std::convert::TryFrom<&str> for InputFileId {
19182 type Error = self::error::ConversionError;
19183 fn try_from(
19184 value: &str,
19185 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19186 if value.chars().count() < 1usize {
19187 return Err("shorter than 1 characters".into());
19188 }
19189 Ok(Self(value.to_string()))
19190 }
19191}
19192impl ::std::convert::TryFrom<::std::string::String> for InputFileId {
19193 type Error = self::error::ConversionError;
19194 fn try_from(
19195 value: ::std::string::String,
19196 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19197 ::std::convert::TryFrom::try_from(value.as_str())
19198 }
19199}
19200impl<'de> ::serde::Deserialize<'de> for InputFileId {
19201 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
19202 where
19203 D: ::serde::Deserializer<'de>,
19204 {
19205 ::std::convert::TryFrom::try_from(
19206 ::std::string::String::deserialize(deserializer)?,
19207 )
19208 .map_err(|e: self::error::ConversionError| {
19209 <D::Error as ::serde::de::Error>::custom(e.to_string())
19210 })
19211 }
19212}
19213pub mod builder {
19215 #[derive(Clone, Debug)]
19216 pub struct Input {
19217 file_id: ::std::result::Result<super::InputFileId, ::std::string::String>,
19218 }
19219 impl ::std::default::Default for Input {
19220 fn default() -> Self {
19221 Self {
19222 file_id: Err("no value supplied for file_id".to_string()),
19223 }
19224 }
19225 }
19226 impl Input {
19227 pub fn file_id<T>(mut self, value: T) -> Self
19228 where
19229 T: ::std::convert::TryInto<super::InputFileId>,
19230 T::Error: ::std::fmt::Display,
19231 {
19232 self.file_id = value
19233 .try_into()
19234 .map_err(|e| {
19235 format!("error converting supplied value for file_id: {e}")
19236 });
19237 self
19238 }
19239 }
19240 impl ::std::convert::TryFrom<Input> for super::Input {
19241 type Error = super::error::ConversionError;
19242 fn try_from(
19243 value: Input,
19244 ) -> ::std::result::Result<Self, super::error::ConversionError> {
19245 Ok(Self { file_id: value.file_id? })
19246 }
19247 }
19248 impl ::std::convert::From<super::Input> for Input {
19249 fn from(value: super::Input) -> Self {
19250 Self { file_id: Ok(value.file_id) }
19251 }
19252 }
19253}
19254pub mod error {
19256 pub struct ConversionError(::std::borrow::Cow<'static, str>);
19258 impl ::std::error::Error for ConversionError {}
19259 impl ::std::fmt::Display for ConversionError {
19260 fn fmt(
19261 &self,
19262 f: &mut ::std::fmt::Formatter<'_>,
19263 ) -> Result<(), ::std::fmt::Error> {
19264 ::std::fmt::Display::fmt(&self.0, f)
19265 }
19266 }
19267 impl ::std::fmt::Debug for ConversionError {
19268 fn fmt(
19269 &self,
19270 f: &mut ::std::fmt::Formatter<'_>,
19271 ) -> Result<(), ::std::fmt::Error> {
19272 ::std::fmt::Debug::fmt(&self.0, f)
19273 }
19274 }
19275 impl From<&'static str> for ConversionError {
19276 fn from(value: &'static str) -> Self {
19277 Self(value.into())
19278 }
19279 }
19280 impl From<String> for ConversionError {
19281 fn from(value: String) -> Self {
19282 Self(value.into())
19283 }
19284 }
19285}
19286
19287pub mod output {
19288#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
19290pub struct Error {
19291 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19293 pub code: ::std::option::Option<i64>,
19294 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19296 pub message: ::std::option::Option<::std::string::String>,
19297 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19299 pub param: ::std::option::Option<::std::string::String>,
19300 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
19302 pub type_: ::std::option::Option<::std::string::String>,
19303}
19304impl Error {
19305 pub fn builder() -> builder::Error {
19306 Default::default()
19307 }
19308}
19309#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
19311pub struct Output {
19312 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19314 pub bytes: ::std::option::Option<i64>,
19315 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19317 pub created_at: ::std::option::Option<i64>,
19318 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19319 pub error: ::std::option::Option<Error>,
19320 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19322 pub expires_at: ::std::option::Option<i64>,
19323 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19325 pub filename: ::std::option::Option<::std::string::String>,
19326 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19328 pub id: ::std::option::Option<::std::string::String>,
19329 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19331 pub object: ::std::option::Option<OutputObject>,
19332 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19334 pub purpose: ::std::option::Option<OutputPurpose>,
19335}
19336impl Output {
19337 pub fn builder() -> builder::Output {
19338 Default::default()
19339 }
19340}
19341#[derive(
19343 ::serde::Deserialize,
19344 ::serde::Serialize,
19345 Clone,
19346 Copy,
19347 Debug,
19348 Eq,
19349 Hash,
19350 Ord,
19351 PartialEq,
19352 PartialOrd
19353)]
19354pub enum OutputObject {
19355 #[serde(rename = "file")]
19356 File,
19357}
19358impl ::std::fmt::Display for OutputObject {
19359 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
19360 match *self {
19361 Self::File => f.write_str("file"),
19362 }
19363 }
19364}
19365impl ::std::str::FromStr for OutputObject {
19366 type Err = self::error::ConversionError;
19367 fn from_str(
19368 value: &str,
19369 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19370 match value {
19371 "file" => Ok(Self::File),
19372 _ => Err("invalid value".into()),
19373 }
19374 }
19375}
19376impl ::std::convert::TryFrom<&str> for OutputObject {
19377 type Error = self::error::ConversionError;
19378 fn try_from(
19379 value: &str,
19380 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19381 value.parse()
19382 }
19383}
19384impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
19385 type Error = self::error::ConversionError;
19386 fn try_from(
19387 value: ::std::string::String,
19388 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19389 value.parse()
19390 }
19391}
19392#[derive(
19394 ::serde::Deserialize,
19395 ::serde::Serialize,
19396 Clone,
19397 Copy,
19398 Debug,
19399 Eq,
19400 Hash,
19401 Ord,
19402 PartialEq,
19403 PartialOrd
19404)]
19405pub enum OutputPurpose {
19406 #[serde(rename = "batch")]
19407 Batch,
19408 #[serde(rename = "batch_output")]
19409 BatchOutput,
19410}
19411impl ::std::fmt::Display for OutputPurpose {
19412 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
19413 match *self {
19414 Self::Batch => f.write_str("batch"),
19415 Self::BatchOutput => f.write_str("batch_output"),
19416 }
19417 }
19418}
19419impl ::std::str::FromStr for OutputPurpose {
19420 type Err = self::error::ConversionError;
19421 fn from_str(
19422 value: &str,
19423 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19424 match value {
19425 "batch" => Ok(Self::Batch),
19426 "batch_output" => Ok(Self::BatchOutput),
19427 _ => Err("invalid value".into()),
19428 }
19429 }
19430}
19431impl ::std::convert::TryFrom<&str> for OutputPurpose {
19432 type Error = self::error::ConversionError;
19433 fn try_from(
19434 value: &str,
19435 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19436 value.parse()
19437 }
19438}
19439impl ::std::convert::TryFrom<::std::string::String> for OutputPurpose {
19440 type Error = self::error::ConversionError;
19441 fn try_from(
19442 value: ::std::string::String,
19443 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19444 value.parse()
19445 }
19446}
19447pub mod builder {
19449 #[derive(Clone, Debug)]
19450 pub struct Error {
19451 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
19452 message: ::std::result::Result<
19453 ::std::option::Option<::std::string::String>,
19454 ::std::string::String,
19455 >,
19456 param: ::std::result::Result<
19457 ::std::option::Option<::std::string::String>,
19458 ::std::string::String,
19459 >,
19460 type_: ::std::result::Result<
19461 ::std::option::Option<::std::string::String>,
19462 ::std::string::String,
19463 >,
19464 }
19465 impl ::std::default::Default for Error {
19466 fn default() -> Self {
19467 Self {
19468 code: Ok(Default::default()),
19469 message: Ok(Default::default()),
19470 param: Ok(Default::default()),
19471 type_: Ok(Default::default()),
19472 }
19473 }
19474 }
19475 impl Error {
19476 pub fn code<T>(mut self, value: T) -> Self
19477 where
19478 T: ::std::convert::TryInto<::std::option::Option<i64>>,
19479 T::Error: ::std::fmt::Display,
19480 {
19481 self.code = value
19482 .try_into()
19483 .map_err(|e| format!("error converting supplied value for code: {e}"));
19484 self
19485 }
19486 pub fn message<T>(mut self, value: T) -> Self
19487 where
19488 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
19489 T::Error: ::std::fmt::Display,
19490 {
19491 self.message = value
19492 .try_into()
19493 .map_err(|e| {
19494 format!("error converting supplied value for message: {e}")
19495 });
19496 self
19497 }
19498 pub fn param<T>(mut self, value: T) -> Self
19499 where
19500 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
19501 T::Error: ::std::fmt::Display,
19502 {
19503 self.param = value
19504 .try_into()
19505 .map_err(|e| format!("error converting supplied value for param: {e}"));
19506 self
19507 }
19508 pub fn type_<T>(mut self, value: T) -> Self
19509 where
19510 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
19511 T::Error: ::std::fmt::Display,
19512 {
19513 self.type_ = value
19514 .try_into()
19515 .map_err(|e| format!("error converting supplied value for type_: {e}"));
19516 self
19517 }
19518 }
19519 impl ::std::convert::TryFrom<Error> for super::Error {
19520 type Error = super::error::ConversionError;
19521 fn try_from(
19522 value: Error,
19523 ) -> ::std::result::Result<Self, super::error::ConversionError> {
19524 Ok(Self {
19525 code: value.code?,
19526 message: value.message?,
19527 param: value.param?,
19528 type_: value.type_?,
19529 })
19530 }
19531 }
19532 impl ::std::convert::From<super::Error> for Error {
19533 fn from(value: super::Error) -> Self {
19534 Self {
19535 code: Ok(value.code),
19536 message: Ok(value.message),
19537 param: Ok(value.param),
19538 type_: Ok(value.type_),
19539 }
19540 }
19541 }
19542 #[derive(Clone, Debug)]
19543 pub struct Output {
19544 bytes: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
19545 created_at: ::std::result::Result<
19546 ::std::option::Option<i64>,
19547 ::std::string::String,
19548 >,
19549 error: ::std::result::Result<
19550 ::std::option::Option<super::Error>,
19551 ::std::string::String,
19552 >,
19553 expires_at: ::std::result::Result<
19554 ::std::option::Option<i64>,
19555 ::std::string::String,
19556 >,
19557 filename: ::std::result::Result<
19558 ::std::option::Option<::std::string::String>,
19559 ::std::string::String,
19560 >,
19561 id: ::std::result::Result<
19562 ::std::option::Option<::std::string::String>,
19563 ::std::string::String,
19564 >,
19565 object: ::std::result::Result<
19566 ::std::option::Option<super::OutputObject>,
19567 ::std::string::String,
19568 >,
19569 purpose: ::std::result::Result<
19570 ::std::option::Option<super::OutputPurpose>,
19571 ::std::string::String,
19572 >,
19573 }
19574 impl ::std::default::Default for Output {
19575 fn default() -> Self {
19576 Self {
19577 bytes: Ok(Default::default()),
19578 created_at: Ok(Default::default()),
19579 error: Ok(Default::default()),
19580 expires_at: Ok(Default::default()),
19581 filename: Ok(Default::default()),
19582 id: Ok(Default::default()),
19583 object: Ok(Default::default()),
19584 purpose: Ok(Default::default()),
19585 }
19586 }
19587 }
19588 impl Output {
19589 pub fn bytes<T>(mut self, value: T) -> Self
19590 where
19591 T: ::std::convert::TryInto<::std::option::Option<i64>>,
19592 T::Error: ::std::fmt::Display,
19593 {
19594 self.bytes = value
19595 .try_into()
19596 .map_err(|e| format!("error converting supplied value for bytes: {e}"));
19597 self
19598 }
19599 pub fn created_at<T>(mut self, value: T) -> Self
19600 where
19601 T: ::std::convert::TryInto<::std::option::Option<i64>>,
19602 T::Error: ::std::fmt::Display,
19603 {
19604 self.created_at = value
19605 .try_into()
19606 .map_err(|e| {
19607 format!("error converting supplied value for created_at: {e}")
19608 });
19609 self
19610 }
19611 pub fn error<T>(mut self, value: T) -> Self
19612 where
19613 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
19614 T::Error: ::std::fmt::Display,
19615 {
19616 self.error = value
19617 .try_into()
19618 .map_err(|e| format!("error converting supplied value for error: {e}"));
19619 self
19620 }
19621 pub fn expires_at<T>(mut self, value: T) -> Self
19622 where
19623 T: ::std::convert::TryInto<::std::option::Option<i64>>,
19624 T::Error: ::std::fmt::Display,
19625 {
19626 self.expires_at = value
19627 .try_into()
19628 .map_err(|e| {
19629 format!("error converting supplied value for expires_at: {e}")
19630 });
19631 self
19632 }
19633 pub fn filename<T>(mut self, value: T) -> Self
19634 where
19635 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
19636 T::Error: ::std::fmt::Display,
19637 {
19638 self.filename = value
19639 .try_into()
19640 .map_err(|e| {
19641 format!("error converting supplied value for filename: {e}")
19642 });
19643 self
19644 }
19645 pub fn id<T>(mut self, value: T) -> Self
19646 where
19647 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
19648 T::Error: ::std::fmt::Display,
19649 {
19650 self.id = value
19651 .try_into()
19652 .map_err(|e| format!("error converting supplied value for id: {e}"));
19653 self
19654 }
19655 pub fn object<T>(mut self, value: T) -> Self
19656 where
19657 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
19658 T::Error: ::std::fmt::Display,
19659 {
19660 self.object = value
19661 .try_into()
19662 .map_err(|e| format!("error converting supplied value for object: {e}"));
19663 self
19664 }
19665 pub fn purpose<T>(mut self, value: T) -> Self
19666 where
19667 T: ::std::convert::TryInto<::std::option::Option<super::OutputPurpose>>,
19668 T::Error: ::std::fmt::Display,
19669 {
19670 self.purpose = value
19671 .try_into()
19672 .map_err(|e| {
19673 format!("error converting supplied value for purpose: {e}")
19674 });
19675 self
19676 }
19677 }
19678 impl ::std::convert::TryFrom<Output> for super::Output {
19679 type Error = super::error::ConversionError;
19680 fn try_from(
19681 value: Output,
19682 ) -> ::std::result::Result<Self, super::error::ConversionError> {
19683 Ok(Self {
19684 bytes: value.bytes?,
19685 created_at: value.created_at?,
19686 error: value.error?,
19687 expires_at: value.expires_at?,
19688 filename: value.filename?,
19689 id: value.id?,
19690 object: value.object?,
19691 purpose: value.purpose?,
19692 })
19693 }
19694 }
19695 impl ::std::convert::From<super::Output> for Output {
19696 fn from(value: super::Output) -> Self {
19697 Self {
19698 bytes: Ok(value.bytes),
19699 created_at: Ok(value.created_at),
19700 error: Ok(value.error),
19701 expires_at: Ok(value.expires_at),
19702 filename: Ok(value.filename),
19703 id: Ok(value.id),
19704 object: Ok(value.object),
19705 purpose: Ok(value.purpose),
19706 }
19707 }
19708 }
19709}
19710pub mod error {
19712 pub struct ConversionError(::std::borrow::Cow<'static, str>);
19714 impl ::std::error::Error for ConversionError {}
19715 impl ::std::fmt::Display for ConversionError {
19716 fn fmt(
19717 &self,
19718 f: &mut ::std::fmt::Formatter<'_>,
19719 ) -> Result<(), ::std::fmt::Error> {
19720 ::std::fmt::Display::fmt(&self.0, f)
19721 }
19722 }
19723 impl ::std::fmt::Debug for ConversionError {
19724 fn fmt(
19725 &self,
19726 f: &mut ::std::fmt::Formatter<'_>,
19727 ) -> Result<(), ::std::fmt::Error> {
19728 ::std::fmt::Debug::fmt(&self.0, f)
19729 }
19730 }
19731 impl From<&'static str> for ConversionError {
19732 fn from(value: &'static str) -> Self {
19733 Self(value.into())
19734 }
19735 }
19736 impl From<String> for ConversionError {
19737 fn from(value: String) -> Self {
19738 Self(value.into())
19739 }
19740 }
19741}
19742
19743}
19744
19745 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "fileId", part: ::one::Part::Path, key: Some("fileId") }], required_parts: &[::one::Part::Path] };
19747
19748 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
19757 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C298Pcg::SWXBuEhRS--8ACQW8_RMCw", Method::GET, "/v1/files/{{fileId}}").with_routed(&input, &ROUTING)?
19758 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
19759 }
19760
19761 impl IntoOperation for Input {
19762 type Output = output::Output;
19763
19764 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
19765 build(self)
19766 }
19767 }
19768 impl IntoOperation for builder::Input {
19769 type Output = output::Output;
19770
19771 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
19772 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
19773 }
19774 }
19775}
19776pub fn retrieve_file() -> retrieve_file::builder::Input {
19778 retrieve_file::builder::Input::default()
19779}
19780pub mod answer_questions {
19781 use ::one::{Error, IntoOperation, Method, Operation};
19782#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
19784#[serde(deny_unknown_fields)]
19785pub struct Input {
19786 pub model: InputModel,
19788 pub questions: ::std::collections::HashMap<
19790 ::std::string::String,
19791 InputQuestionsValue,
19792 >,
19793 pub state: InputState,
19795}
19796impl Input {
19797 pub fn builder() -> builder::Input {
19798 Default::default()
19799 }
19800}
19801#[derive(
19803 ::serde::Deserialize,
19804 ::serde::Serialize,
19805 Clone,
19806 Copy,
19807 Debug,
19808 Eq,
19809 Hash,
19810 Ord,
19811 PartialEq,
19812 PartialOrd
19813)]
19814pub enum InputModel {
19815 #[serde(rename = "pplx-decider-v1.2")]
19816 PplxDeciderV12,
19817 #[serde(rename = "pplx-decider-flash-v1.2")]
19818 PplxDeciderFlashV12,
19819 #[serde(rename = "pplx-decider-latest")]
19820 PplxDeciderLatest,
19821 #[serde(rename = "perplexity/pplx-decider-latest")]
19822 PerplexityPplxDeciderLatest,
19823 #[serde(rename = "pplx-decider-flash-latest")]
19824 PplxDeciderFlashLatest,
19825 #[serde(rename = "perplexity/pplx-decider-flash-latest")]
19826 PerplexityPplxDeciderFlashLatest,
19827 #[serde(rename = "pplx-decider-v1.1-27b")]
19828 PplxDeciderV1127b,
19829 #[serde(rename = "pplx-decider-v1-27b")]
19830 PplxDeciderV127b,
19831}
19832impl ::std::fmt::Display for InputModel {
19833 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
19834 match *self {
19835 Self::PplxDeciderV12 => f.write_str("pplx-decider-v1.2"),
19836 Self::PplxDeciderFlashV12 => f.write_str("pplx-decider-flash-v1.2"),
19837 Self::PplxDeciderLatest => f.write_str("pplx-decider-latest"),
19838 Self::PerplexityPplxDeciderLatest => {
19839 f.write_str("perplexity/pplx-decider-latest")
19840 }
19841 Self::PplxDeciderFlashLatest => f.write_str("pplx-decider-flash-latest"),
19842 Self::PerplexityPplxDeciderFlashLatest => {
19843 f.write_str("perplexity/pplx-decider-flash-latest")
19844 }
19845 Self::PplxDeciderV1127b => f.write_str("pplx-decider-v1.1-27b"),
19846 Self::PplxDeciderV127b => f.write_str("pplx-decider-v1-27b"),
19847 }
19848 }
19849}
19850impl ::std::str::FromStr for InputModel {
19851 type Err = self::error::ConversionError;
19852 fn from_str(
19853 value: &str,
19854 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19855 match value {
19856 "pplx-decider-v1.2" => Ok(Self::PplxDeciderV12),
19857 "pplx-decider-flash-v1.2" => Ok(Self::PplxDeciderFlashV12),
19858 "pplx-decider-latest" => Ok(Self::PplxDeciderLatest),
19859 "perplexity/pplx-decider-latest" => Ok(Self::PerplexityPplxDeciderLatest),
19860 "pplx-decider-flash-latest" => Ok(Self::PplxDeciderFlashLatest),
19861 "perplexity/pplx-decider-flash-latest" => {
19862 Ok(Self::PerplexityPplxDeciderFlashLatest)
19863 }
19864 "pplx-decider-v1.1-27b" => Ok(Self::PplxDeciderV1127b),
19865 "pplx-decider-v1-27b" => Ok(Self::PplxDeciderV127b),
19866 _ => Err("invalid value".into()),
19867 }
19868 }
19869}
19870impl ::std::convert::TryFrom<&str> for InputModel {
19871 type Error = self::error::ConversionError;
19872 fn try_from(
19873 value: &str,
19874 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19875 value.parse()
19876 }
19877}
19878impl ::std::convert::TryFrom<::std::string::String> for InputModel {
19879 type Error = self::error::ConversionError;
19880 fn try_from(
19881 value: ::std::string::String,
19882 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19883 value.parse()
19884 }
19885}
19886#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
19888#[serde(deny_unknown_fields)]
19889pub struct InputQuestionsValue {
19890 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19892 pub criteria: ::std::option::Option<InputQuestionsValueCriteria>,
19893 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
19895 pub instructions: ::std::option::Option<::std::string::String>,
19896 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
19898 pub type_: ::std::option::Option<InputQuestionsValueType>,
19899}
19900impl InputQuestionsValue {
19901 pub fn builder() -> builder::InputQuestionsValue {
19902 Default::default()
19903 }
19904}
19905#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
19907#[serde(untagged)]
19908pub enum InputQuestionsValueCriteria {
19909 Object(::std::collections::HashMap<::std::string::String, ::std::string::String>),
19910 Array(::std::vec::Vec<::std::string::String>),
19911}
19912impl ::std::convert::From<
19913 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
19914> for InputQuestionsValueCriteria {
19915 fn from(
19916 value: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
19917 ) -> Self {
19918 Self::Object(value)
19919 }
19920}
19921impl ::std::convert::From<::std::vec::Vec<::std::string::String>>
19922for InputQuestionsValueCriteria {
19923 fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
19924 Self::Array(value)
19925 }
19926}
19927#[derive(
19929 ::serde::Deserialize,
19930 ::serde::Serialize,
19931 Clone,
19932 Copy,
19933 Debug,
19934 Eq,
19935 Hash,
19936 Ord,
19937 PartialEq,
19938 PartialOrd
19939)]
19940pub enum InputQuestionsValueType {
19941 #[serde(rename = "noul")]
19942 Noul,
19943 #[serde(rename = "choice")]
19944 Choice,
19945 #[serde(rename = "score")]
19946 Score,
19947}
19948impl ::std::fmt::Display for InputQuestionsValueType {
19949 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
19950 match *self {
19951 Self::Noul => f.write_str("noul"),
19952 Self::Choice => f.write_str("choice"),
19953 Self::Score => f.write_str("score"),
19954 }
19955 }
19956}
19957impl ::std::str::FromStr for InputQuestionsValueType {
19958 type Err = self::error::ConversionError;
19959 fn from_str(
19960 value: &str,
19961 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19962 match value {
19963 "noul" => Ok(Self::Noul),
19964 "choice" => Ok(Self::Choice),
19965 "score" => Ok(Self::Score),
19966 _ => Err("invalid value".into()),
19967 }
19968 }
19969}
19970impl ::std::convert::TryFrom<&str> for InputQuestionsValueType {
19971 type Error = self::error::ConversionError;
19972 fn try_from(
19973 value: &str,
19974 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19975 value.parse()
19976 }
19977}
19978impl ::std::convert::TryFrom<::std::string::String> for InputQuestionsValueType {
19979 type Error = self::error::ConversionError;
19980 fn try_from(
19981 value: ::std::string::String,
19982 ) -> ::std::result::Result<Self, self::error::ConversionError> {
19983 value.parse()
19984 }
19985}
19986#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
19988#[serde(untagged)]
19989pub enum InputState {
19990 String(::std::string::String),
19991 Object(::serde_json::Map<::std::string::String, ::serde_json::Value>),
19992 Array(::std::vec::Vec<::serde_json::Value>),
19993}
19994impl ::std::convert::From<::serde_json::Map<::std::string::String, ::serde_json::Value>>
19995for InputState {
19996 fn from(
19997 value: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
19998 ) -> Self {
19999 Self::Object(value)
20000 }
20001}
20002impl ::std::convert::From<::std::vec::Vec<::serde_json::Value>> for InputState {
20003 fn from(value: ::std::vec::Vec<::serde_json::Value>) -> Self {
20004 Self::Array(value)
20005 }
20006}
20007pub mod builder {
20009 #[derive(Clone, Debug)]
20010 pub struct Input {
20011 model: ::std::result::Result<super::InputModel, ::std::string::String>,
20012 questions: ::std::result::Result<
20013 ::std::collections::HashMap<
20014 ::std::string::String,
20015 super::InputQuestionsValue,
20016 >,
20017 ::std::string::String,
20018 >,
20019 state: ::std::result::Result<super::InputState, ::std::string::String>,
20020 }
20021 impl ::std::default::Default for Input {
20022 fn default() -> Self {
20023 Self {
20024 model: Err("no value supplied for model".to_string()),
20025 questions: Err("no value supplied for questions".to_string()),
20026 state: Err("no value supplied for state".to_string()),
20027 }
20028 }
20029 }
20030 impl Input {
20031 pub fn model<T>(mut self, value: T) -> Self
20032 where
20033 T: ::std::convert::TryInto<super::InputModel>,
20034 T::Error: ::std::fmt::Display,
20035 {
20036 self.model = value
20037 .try_into()
20038 .map_err(|e| format!("error converting supplied value for model: {e}"));
20039 self
20040 }
20041 pub fn questions<T>(mut self, value: T) -> Self
20042 where
20043 T: ::std::convert::TryInto<
20044 ::std::collections::HashMap<
20045 ::std::string::String,
20046 super::InputQuestionsValue,
20047 >,
20048 >,
20049 T::Error: ::std::fmt::Display,
20050 {
20051 self.questions = value
20052 .try_into()
20053 .map_err(|e| {
20054 format!("error converting supplied value for questions: {e}")
20055 });
20056 self
20057 }
20058 pub fn state<T>(mut self, value: T) -> Self
20059 where
20060 T: ::std::convert::TryInto<super::InputState>,
20061 T::Error: ::std::fmt::Display,
20062 {
20063 self.state = value
20064 .try_into()
20065 .map_err(|e| format!("error converting supplied value for state: {e}"));
20066 self
20067 }
20068 }
20069 impl ::std::convert::TryFrom<Input> for super::Input {
20070 type Error = super::error::ConversionError;
20071 fn try_from(
20072 value: Input,
20073 ) -> ::std::result::Result<Self, super::error::ConversionError> {
20074 Ok(Self {
20075 model: value.model?,
20076 questions: value.questions?,
20077 state: value.state?,
20078 })
20079 }
20080 }
20081 impl ::std::convert::From<super::Input> for Input {
20082 fn from(value: super::Input) -> Self {
20083 Self {
20084 model: Ok(value.model),
20085 questions: Ok(value.questions),
20086 state: Ok(value.state),
20087 }
20088 }
20089 }
20090 #[derive(Clone, Debug)]
20091 pub struct InputQuestionsValue {
20092 criteria: ::std::result::Result<
20093 ::std::option::Option<super::InputQuestionsValueCriteria>,
20094 ::std::string::String,
20095 >,
20096 instructions: ::std::result::Result<
20097 ::std::option::Option<::std::string::String>,
20098 ::std::string::String,
20099 >,
20100 type_: ::std::result::Result<
20101 ::std::option::Option<super::InputQuestionsValueType>,
20102 ::std::string::String,
20103 >,
20104 }
20105 impl ::std::default::Default for InputQuestionsValue {
20106 fn default() -> Self {
20107 Self {
20108 criteria: Ok(Default::default()),
20109 instructions: Ok(Default::default()),
20110 type_: Ok(Default::default()),
20111 }
20112 }
20113 }
20114 impl InputQuestionsValue {
20115 pub fn criteria<T>(mut self, value: T) -> Self
20116 where
20117 T: ::std::convert::TryInto<
20118 ::std::option::Option<super::InputQuestionsValueCriteria>,
20119 >,
20120 T::Error: ::std::fmt::Display,
20121 {
20122 self.criteria = value
20123 .try_into()
20124 .map_err(|e| {
20125 format!("error converting supplied value for criteria: {e}")
20126 });
20127 self
20128 }
20129 pub fn instructions<T>(mut self, value: T) -> Self
20130 where
20131 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
20132 T::Error: ::std::fmt::Display,
20133 {
20134 self.instructions = value
20135 .try_into()
20136 .map_err(|e| {
20137 format!("error converting supplied value for instructions: {e}")
20138 });
20139 self
20140 }
20141 pub fn type_<T>(mut self, value: T) -> Self
20142 where
20143 T: ::std::convert::TryInto<
20144 ::std::option::Option<super::InputQuestionsValueType>,
20145 >,
20146 T::Error: ::std::fmt::Display,
20147 {
20148 self.type_ = value
20149 .try_into()
20150 .map_err(|e| format!("error converting supplied value for type_: {e}"));
20151 self
20152 }
20153 }
20154 impl ::std::convert::TryFrom<InputQuestionsValue> for super::InputQuestionsValue {
20155 type Error = super::error::ConversionError;
20156 fn try_from(
20157 value: InputQuestionsValue,
20158 ) -> ::std::result::Result<Self, super::error::ConversionError> {
20159 Ok(Self {
20160 criteria: value.criteria?,
20161 instructions: value.instructions?,
20162 type_: value.type_?,
20163 })
20164 }
20165 }
20166 impl ::std::convert::From<super::InputQuestionsValue> for InputQuestionsValue {
20167 fn from(value: super::InputQuestionsValue) -> Self {
20168 Self {
20169 criteria: Ok(value.criteria),
20170 instructions: Ok(value.instructions),
20171 type_: Ok(value.type_),
20172 }
20173 }
20174 }
20175}
20176pub mod error {
20178 pub struct ConversionError(::std::borrow::Cow<'static, str>);
20180 impl ::std::error::Error for ConversionError {}
20181 impl ::std::fmt::Display for ConversionError {
20182 fn fmt(
20183 &self,
20184 f: &mut ::std::fmt::Formatter<'_>,
20185 ) -> Result<(), ::std::fmt::Error> {
20186 ::std::fmt::Display::fmt(&self.0, f)
20187 }
20188 }
20189 impl ::std::fmt::Debug for ConversionError {
20190 fn fmt(
20191 &self,
20192 f: &mut ::std::fmt::Formatter<'_>,
20193 ) -> Result<(), ::std::fmt::Error> {
20194 ::std::fmt::Debug::fmt(&self.0, f)
20195 }
20196 }
20197 impl From<&'static str> for ConversionError {
20198 fn from(value: &'static str) -> Self {
20199 Self(value.into())
20200 }
20201 }
20202 impl From<String> for ConversionError {
20203 fn from(value: String) -> Self {
20204 Self(value.into())
20205 }
20206 }
20207}
20208
20209pub mod output {
20210#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
20212pub struct Output {
20213 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
20215 pub answers: ::std::collections::HashMap<::std::string::String, OutputAnswersValue>,
20216 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20217 pub error: ::std::option::Option<OutputError>,
20218 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20220 pub model: ::std::option::Option<::std::string::String>,
20221 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20222 pub usage: ::std::option::Option<OutputUsage>,
20223}
20224impl Output {
20225 pub fn builder() -> builder::Output {
20226 Default::default()
20227 }
20228}
20229#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
20231pub struct OutputAnswersValue {
20232 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20234 pub choice: ::std::option::Option<::std::string::String>,
20235 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20237 pub confidence: ::std::option::Option<f64>,
20238 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
20240 pub legend: ::std::collections::HashMap<
20241 ::std::string::String,
20242 ::std::string::String,
20243 >,
20244 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20246 pub noul: ::std::option::Option<f64>,
20247 #[serde(default, skip_serializing_if = "::std::collections::HashMap::is_empty")]
20249 pub probabilities: ::std::collections::HashMap<::std::string::String, f64>,
20250 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20252 pub score: ::std::option::Option<f64>,
20253 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
20255 pub type_: ::std::option::Option<OutputAnswersValueType>,
20256}
20257impl OutputAnswersValue {
20258 pub fn builder() -> builder::OutputAnswersValue {
20259 Default::default()
20260 }
20261}
20262#[derive(
20264 ::serde::Deserialize,
20265 ::serde::Serialize,
20266 Clone,
20267 Copy,
20268 Debug,
20269 Eq,
20270 Hash,
20271 Ord,
20272 PartialEq,
20273 PartialOrd
20274)]
20275pub enum OutputAnswersValueType {
20276 #[serde(rename = "noul")]
20277 Noul,
20278 #[serde(rename = "choice")]
20279 Choice,
20280 #[serde(rename = "score")]
20281 Score,
20282}
20283impl ::std::fmt::Display for OutputAnswersValueType {
20284 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
20285 match *self {
20286 Self::Noul => f.write_str("noul"),
20287 Self::Choice => f.write_str("choice"),
20288 Self::Score => f.write_str("score"),
20289 }
20290 }
20291}
20292impl ::std::str::FromStr for OutputAnswersValueType {
20293 type Err = self::error::ConversionError;
20294 fn from_str(
20295 value: &str,
20296 ) -> ::std::result::Result<Self, self::error::ConversionError> {
20297 match value {
20298 "noul" => Ok(Self::Noul),
20299 "choice" => Ok(Self::Choice),
20300 "score" => Ok(Self::Score),
20301 _ => Err("invalid value".into()),
20302 }
20303 }
20304}
20305impl ::std::convert::TryFrom<&str> for OutputAnswersValueType {
20306 type Error = self::error::ConversionError;
20307 fn try_from(
20308 value: &str,
20309 ) -> ::std::result::Result<Self, self::error::ConversionError> {
20310 value.parse()
20311 }
20312}
20313impl ::std::convert::TryFrom<::std::string::String> for OutputAnswersValueType {
20314 type Error = self::error::ConversionError;
20315 fn try_from(
20316 value: ::std::string::String,
20317 ) -> ::std::result::Result<Self, self::error::ConversionError> {
20318 value.parse()
20319 }
20320}
20321#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
20323pub struct OutputError {
20324 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20326 pub code: ::std::option::Option<::std::string::String>,
20327 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20329 pub message: ::std::option::Option<::std::string::String>,
20330 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20332 pub param: ::std::option::Option<::std::string::String>,
20333 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
20335 pub type_: ::std::option::Option<::std::string::String>,
20336}
20337impl OutputError {
20338 pub fn builder() -> builder::OutputError {
20339 Default::default()
20340 }
20341}
20342#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
20344pub struct OutputUsage {
20345 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20347 pub input_tokens: ::std::option::Option<i64>,
20348 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
20350 pub output_tokens: ::std::option::Option<i64>,
20351}
20352impl OutputUsage {
20353 pub fn builder() -> builder::OutputUsage {
20354 Default::default()
20355 }
20356}
20357pub mod builder {
20359 #[derive(Clone, Debug)]
20360 pub struct Output {
20361 answers: ::std::result::Result<
20362 ::std::collections::HashMap<
20363 ::std::string::String,
20364 super::OutputAnswersValue,
20365 >,
20366 ::std::string::String,
20367 >,
20368 error: ::std::result::Result<
20369 ::std::option::Option<super::OutputError>,
20370 ::std::string::String,
20371 >,
20372 model: ::std::result::Result<
20373 ::std::option::Option<::std::string::String>,
20374 ::std::string::String,
20375 >,
20376 usage: ::std::result::Result<
20377 ::std::option::Option<super::OutputUsage>,
20378 ::std::string::String,
20379 >,
20380 }
20381 impl ::std::default::Default for Output {
20382 fn default() -> Self {
20383 Self {
20384 answers: Ok(Default::default()),
20385 error: Ok(Default::default()),
20386 model: Ok(Default::default()),
20387 usage: Ok(Default::default()),
20388 }
20389 }
20390 }
20391 impl Output {
20392 pub fn answers<T>(mut self, value: T) -> Self
20393 where
20394 T: ::std::convert::TryInto<
20395 ::std::collections::HashMap<
20396 ::std::string::String,
20397 super::OutputAnswersValue,
20398 >,
20399 >,
20400 T::Error: ::std::fmt::Display,
20401 {
20402 self.answers = value
20403 .try_into()
20404 .map_err(|e| {
20405 format!("error converting supplied value for answers: {e}")
20406 });
20407 self
20408 }
20409 pub fn error<T>(mut self, value: T) -> Self
20410 where
20411 T: ::std::convert::TryInto<::std::option::Option<super::OutputError>>,
20412 T::Error: ::std::fmt::Display,
20413 {
20414 self.error = value
20415 .try_into()
20416 .map_err(|e| format!("error converting supplied value for error: {e}"));
20417 self
20418 }
20419 pub fn model<T>(mut self, value: T) -> Self
20420 where
20421 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
20422 T::Error: ::std::fmt::Display,
20423 {
20424 self.model = value
20425 .try_into()
20426 .map_err(|e| format!("error converting supplied value for model: {e}"));
20427 self
20428 }
20429 pub fn usage<T>(mut self, value: T) -> Self
20430 where
20431 T: ::std::convert::TryInto<::std::option::Option<super::OutputUsage>>,
20432 T::Error: ::std::fmt::Display,
20433 {
20434 self.usage = value
20435 .try_into()
20436 .map_err(|e| format!("error converting supplied value for usage: {e}"));
20437 self
20438 }
20439 }
20440 impl ::std::convert::TryFrom<Output> for super::Output {
20441 type Error = super::error::ConversionError;
20442 fn try_from(
20443 value: Output,
20444 ) -> ::std::result::Result<Self, super::error::ConversionError> {
20445 Ok(Self {
20446 answers: value.answers?,
20447 error: value.error?,
20448 model: value.model?,
20449 usage: value.usage?,
20450 })
20451 }
20452 }
20453 impl ::std::convert::From<super::Output> for Output {
20454 fn from(value: super::Output) -> Self {
20455 Self {
20456 answers: Ok(value.answers),
20457 error: Ok(value.error),
20458 model: Ok(value.model),
20459 usage: Ok(value.usage),
20460 }
20461 }
20462 }
20463 #[derive(Clone, Debug)]
20464 pub struct OutputAnswersValue {
20465 choice: ::std::result::Result<
20466 ::std::option::Option<::std::string::String>,
20467 ::std::string::String,
20468 >,
20469 confidence: ::std::result::Result<
20470 ::std::option::Option<f64>,
20471 ::std::string::String,
20472 >,
20473 legend: ::std::result::Result<
20474 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
20475 ::std::string::String,
20476 >,
20477 noul: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
20478 probabilities: ::std::result::Result<
20479 ::std::collections::HashMap<::std::string::String, f64>,
20480 ::std::string::String,
20481 >,
20482 score: ::std::result::Result<::std::option::Option<f64>, ::std::string::String>,
20483 type_: ::std::result::Result<
20484 ::std::option::Option<super::OutputAnswersValueType>,
20485 ::std::string::String,
20486 >,
20487 }
20488 impl ::std::default::Default for OutputAnswersValue {
20489 fn default() -> Self {
20490 Self {
20491 choice: Ok(Default::default()),
20492 confidence: Ok(Default::default()),
20493 legend: Ok(Default::default()),
20494 noul: Ok(Default::default()),
20495 probabilities: Ok(Default::default()),
20496 score: Ok(Default::default()),
20497 type_: Ok(Default::default()),
20498 }
20499 }
20500 }
20501 impl OutputAnswersValue {
20502 pub fn choice<T>(mut self, value: T) -> Self
20503 where
20504 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
20505 T::Error: ::std::fmt::Display,
20506 {
20507 self.choice = value
20508 .try_into()
20509 .map_err(|e| format!("error converting supplied value for choice: {e}"));
20510 self
20511 }
20512 pub fn confidence<T>(mut self, value: T) -> Self
20513 where
20514 T: ::std::convert::TryInto<::std::option::Option<f64>>,
20515 T::Error: ::std::fmt::Display,
20516 {
20517 self.confidence = value
20518 .try_into()
20519 .map_err(|e| {
20520 format!("error converting supplied value for confidence: {e}")
20521 });
20522 self
20523 }
20524 pub fn legend<T>(mut self, value: T) -> Self
20525 where
20526 T: ::std::convert::TryInto<
20527 ::std::collections::HashMap<::std::string::String, ::std::string::String>,
20528 >,
20529 T::Error: ::std::fmt::Display,
20530 {
20531 self.legend = value
20532 .try_into()
20533 .map_err(|e| format!("error converting supplied value for legend: {e}"));
20534 self
20535 }
20536 pub fn noul<T>(mut self, value: T) -> Self
20537 where
20538 T: ::std::convert::TryInto<::std::option::Option<f64>>,
20539 T::Error: ::std::fmt::Display,
20540 {
20541 self.noul = value
20542 .try_into()
20543 .map_err(|e| format!("error converting supplied value for noul: {e}"));
20544 self
20545 }
20546 pub fn probabilities<T>(mut self, value: T) -> Self
20547 where
20548 T: ::std::convert::TryInto<
20549 ::std::collections::HashMap<::std::string::String, f64>,
20550 >,
20551 T::Error: ::std::fmt::Display,
20552 {
20553 self.probabilities = value
20554 .try_into()
20555 .map_err(|e| {
20556 format!("error converting supplied value for probabilities: {e}")
20557 });
20558 self
20559 }
20560 pub fn score<T>(mut self, value: T) -> Self
20561 where
20562 T: ::std::convert::TryInto<::std::option::Option<f64>>,
20563 T::Error: ::std::fmt::Display,
20564 {
20565 self.score = value
20566 .try_into()
20567 .map_err(|e| format!("error converting supplied value for score: {e}"));
20568 self
20569 }
20570 pub fn type_<T>(mut self, value: T) -> Self
20571 where
20572 T: ::std::convert::TryInto<
20573 ::std::option::Option<super::OutputAnswersValueType>,
20574 >,
20575 T::Error: ::std::fmt::Display,
20576 {
20577 self.type_ = value
20578 .try_into()
20579 .map_err(|e| format!("error converting supplied value for type_: {e}"));
20580 self
20581 }
20582 }
20583 impl ::std::convert::TryFrom<OutputAnswersValue> for super::OutputAnswersValue {
20584 type Error = super::error::ConversionError;
20585 fn try_from(
20586 value: OutputAnswersValue,
20587 ) -> ::std::result::Result<Self, super::error::ConversionError> {
20588 Ok(Self {
20589 choice: value.choice?,
20590 confidence: value.confidence?,
20591 legend: value.legend?,
20592 noul: value.noul?,
20593 probabilities: value.probabilities?,
20594 score: value.score?,
20595 type_: value.type_?,
20596 })
20597 }
20598 }
20599 impl ::std::convert::From<super::OutputAnswersValue> for OutputAnswersValue {
20600 fn from(value: super::OutputAnswersValue) -> Self {
20601 Self {
20602 choice: Ok(value.choice),
20603 confidence: Ok(value.confidence),
20604 legend: Ok(value.legend),
20605 noul: Ok(value.noul),
20606 probabilities: Ok(value.probabilities),
20607 score: Ok(value.score),
20608 type_: Ok(value.type_),
20609 }
20610 }
20611 }
20612 #[derive(Clone, Debug)]
20613 pub struct OutputError {
20614 code: ::std::result::Result<
20615 ::std::option::Option<::std::string::String>,
20616 ::std::string::String,
20617 >,
20618 message: ::std::result::Result<
20619 ::std::option::Option<::std::string::String>,
20620 ::std::string::String,
20621 >,
20622 param: ::std::result::Result<
20623 ::std::option::Option<::std::string::String>,
20624 ::std::string::String,
20625 >,
20626 type_: ::std::result::Result<
20627 ::std::option::Option<::std::string::String>,
20628 ::std::string::String,
20629 >,
20630 }
20631 impl ::std::default::Default for OutputError {
20632 fn default() -> Self {
20633 Self {
20634 code: Ok(Default::default()),
20635 message: Ok(Default::default()),
20636 param: Ok(Default::default()),
20637 type_: Ok(Default::default()),
20638 }
20639 }
20640 }
20641 impl OutputError {
20642 pub fn code<T>(mut self, value: T) -> Self
20643 where
20644 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
20645 T::Error: ::std::fmt::Display,
20646 {
20647 self.code = value
20648 .try_into()
20649 .map_err(|e| format!("error converting supplied value for code: {e}"));
20650 self
20651 }
20652 pub fn message<T>(mut self, value: T) -> Self
20653 where
20654 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
20655 T::Error: ::std::fmt::Display,
20656 {
20657 self.message = value
20658 .try_into()
20659 .map_err(|e| {
20660 format!("error converting supplied value for message: {e}")
20661 });
20662 self
20663 }
20664 pub fn param<T>(mut self, value: T) -> Self
20665 where
20666 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
20667 T::Error: ::std::fmt::Display,
20668 {
20669 self.param = value
20670 .try_into()
20671 .map_err(|e| format!("error converting supplied value for param: {e}"));
20672 self
20673 }
20674 pub fn type_<T>(mut self, value: T) -> Self
20675 where
20676 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
20677 T::Error: ::std::fmt::Display,
20678 {
20679 self.type_ = value
20680 .try_into()
20681 .map_err(|e| format!("error converting supplied value for type_: {e}"));
20682 self
20683 }
20684 }
20685 impl ::std::convert::TryFrom<OutputError> for super::OutputError {
20686 type Error = super::error::ConversionError;
20687 fn try_from(
20688 value: OutputError,
20689 ) -> ::std::result::Result<Self, super::error::ConversionError> {
20690 Ok(Self {
20691 code: value.code?,
20692 message: value.message?,
20693 param: value.param?,
20694 type_: value.type_?,
20695 })
20696 }
20697 }
20698 impl ::std::convert::From<super::OutputError> for OutputError {
20699 fn from(value: super::OutputError) -> Self {
20700 Self {
20701 code: Ok(value.code),
20702 message: Ok(value.message),
20703 param: Ok(value.param),
20704 type_: Ok(value.type_),
20705 }
20706 }
20707 }
20708 #[derive(Clone, Debug)]
20709 pub struct OutputUsage {
20710 input_tokens: ::std::result::Result<
20711 ::std::option::Option<i64>,
20712 ::std::string::String,
20713 >,
20714 output_tokens: ::std::result::Result<
20715 ::std::option::Option<i64>,
20716 ::std::string::String,
20717 >,
20718 }
20719 impl ::std::default::Default for OutputUsage {
20720 fn default() -> Self {
20721 Self {
20722 input_tokens: Ok(Default::default()),
20723 output_tokens: Ok(Default::default()),
20724 }
20725 }
20726 }
20727 impl OutputUsage {
20728 pub fn input_tokens<T>(mut self, value: T) -> Self
20729 where
20730 T: ::std::convert::TryInto<::std::option::Option<i64>>,
20731 T::Error: ::std::fmt::Display,
20732 {
20733 self.input_tokens = value
20734 .try_into()
20735 .map_err(|e| {
20736 format!("error converting supplied value for input_tokens: {e}")
20737 });
20738 self
20739 }
20740 pub fn output_tokens<T>(mut self, value: T) -> Self
20741 where
20742 T: ::std::convert::TryInto<::std::option::Option<i64>>,
20743 T::Error: ::std::fmt::Display,
20744 {
20745 self.output_tokens = value
20746 .try_into()
20747 .map_err(|e| {
20748 format!("error converting supplied value for output_tokens: {e}")
20749 });
20750 self
20751 }
20752 }
20753 impl ::std::convert::TryFrom<OutputUsage> for super::OutputUsage {
20754 type Error = super::error::ConversionError;
20755 fn try_from(
20756 value: OutputUsage,
20757 ) -> ::std::result::Result<Self, super::error::ConversionError> {
20758 Ok(Self {
20759 input_tokens: value.input_tokens?,
20760 output_tokens: value.output_tokens?,
20761 })
20762 }
20763 }
20764 impl ::std::convert::From<super::OutputUsage> for OutputUsage {
20765 fn from(value: super::OutputUsage) -> Self {
20766 Self {
20767 input_tokens: Ok(value.input_tokens),
20768 output_tokens: Ok(value.output_tokens),
20769 }
20770 }
20771 }
20772}
20773pub mod error {
20775 pub struct ConversionError(::std::borrow::Cow<'static, str>);
20777 impl ::std::error::Error for ConversionError {}
20778 impl ::std::fmt::Display for ConversionError {
20779 fn fmt(
20780 &self,
20781 f: &mut ::std::fmt::Formatter<'_>,
20782 ) -> Result<(), ::std::fmt::Error> {
20783 ::std::fmt::Display::fmt(&self.0, f)
20784 }
20785 }
20786 impl ::std::fmt::Debug for ConversionError {
20787 fn fmt(
20788 &self,
20789 f: &mut ::std::fmt::Formatter<'_>,
20790 ) -> Result<(), ::std::fmt::Error> {
20791 ::std::fmt::Debug::fmt(&self.0, f)
20792 }
20793 }
20794 impl From<&'static str> for ConversionError {
20795 fn from(value: &'static str) -> Self {
20796 Self(value.into())
20797 }
20798 }
20799 impl From<String> for ConversionError {
20800 fn from(value: String) -> Self {
20801 Self(value.into())
20802 }
20803 }
20804}
20805
20806}
20807
20808 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "model", part: ::one::Part::Body, key: Some("model") }, ::one::Route { field: "questions", part: ::one::Part::Body, key: Some("questions") }, ::one::Route { field: "state", part: ::one::Part::Body, key: Some("state") }], required_parts: &[::one::Part::Body] };
20810
20811 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
20848 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C3RnlGg::ftX2lIFDQVSYsgMYEpB4hw", Method::POST, "/v1/decisions").with_routed(&input, &ROUTING)?
20849 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
20850 }
20851
20852 impl IntoOperation for Input {
20853 type Output = output::Output;
20854
20855 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
20856 build(self)
20857 }
20858 }
20859 impl IntoOperation for builder::Input {
20860 type Output = output::Output;
20861
20862 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
20863 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
20864 }
20865 }
20866 impl ::std::convert::TryFrom<builder::InputQuestionsValue> for ::std::option::Option<InputQuestionsValue> {
20867 type Error = <InputQuestionsValue as ::std::convert::TryFrom<builder::InputQuestionsValue>>::Error;
20868
20869 fn try_from(value: builder::InputQuestionsValue) -> ::std::result::Result<Self, Self::Error> {
20870 InputQuestionsValue::try_from(value).map(Some)
20871 }
20872 }
20873}
20874pub fn answer_questions() -> answer_questions::builder::Input {
20876 answer_questions::builder::Input::default()
20877}
20878pub mod upload_batch_input_file {
20879 use ::one::{Error, IntoOperation, Method, Operation};
20880#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
20882#[serde(deny_unknown_fields)]
20883pub struct Input {
20884 pub file: ::std::string::String,
20886 pub purpose: InputPurpose,
20888}
20889impl Input {
20890 pub fn builder() -> builder::Input {
20891 Default::default()
20892 }
20893}
20894#[derive(
20896 ::serde::Deserialize,
20897 ::serde::Serialize,
20898 Clone,
20899 Copy,
20900 Debug,
20901 Eq,
20902 Hash,
20903 Ord,
20904 PartialEq,
20905 PartialOrd
20906)]
20907pub enum InputPurpose {
20908 #[serde(rename = "batch")]
20909 Batch,
20910}
20911impl ::std::fmt::Display for InputPurpose {
20912 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
20913 match *self {
20914 Self::Batch => f.write_str("batch"),
20915 }
20916 }
20917}
20918impl ::std::str::FromStr for InputPurpose {
20919 type Err = self::error::ConversionError;
20920 fn from_str(
20921 value: &str,
20922 ) -> ::std::result::Result<Self, self::error::ConversionError> {
20923 match value {
20924 "batch" => Ok(Self::Batch),
20925 _ => Err("invalid value".into()),
20926 }
20927 }
20928}
20929impl ::std::convert::TryFrom<&str> for InputPurpose {
20930 type Error = self::error::ConversionError;
20931 fn try_from(
20932 value: &str,
20933 ) -> ::std::result::Result<Self, self::error::ConversionError> {
20934 value.parse()
20935 }
20936}
20937impl ::std::convert::TryFrom<::std::string::String> for InputPurpose {
20938 type Error = self::error::ConversionError;
20939 fn try_from(
20940 value: ::std::string::String,
20941 ) -> ::std::result::Result<Self, self::error::ConversionError> {
20942 value.parse()
20943 }
20944}
20945pub mod builder {
20947 #[derive(Clone, Debug)]
20948 pub struct Input {
20949 file: ::std::result::Result<::std::string::String, ::std::string::String>,
20950 purpose: ::std::result::Result<super::InputPurpose, ::std::string::String>,
20951 }
20952 impl ::std::default::Default for Input {
20953 fn default() -> Self {
20954 Self {
20955 file: Err("no value supplied for file".to_string()),
20956 purpose: Err("no value supplied for purpose".to_string()),
20957 }
20958 }
20959 }
20960 impl Input {
20961 pub fn file<T>(mut self, value: T) -> Self
20962 where
20963 T: ::std::convert::TryInto<::std::string::String>,
20964 T::Error: ::std::fmt::Display,
20965 {
20966 self.file = value
20967 .try_into()
20968 .map_err(|e| format!("error converting supplied value for file: {e}"));
20969 self
20970 }
20971 pub fn purpose<T>(mut self, value: T) -> Self
20972 where
20973 T: ::std::convert::TryInto<super::InputPurpose>,
20974 T::Error: ::std::fmt::Display,
20975 {
20976 self.purpose = value
20977 .try_into()
20978 .map_err(|e| {
20979 format!("error converting supplied value for purpose: {e}")
20980 });
20981 self
20982 }
20983 }
20984 impl ::std::convert::TryFrom<Input> for super::Input {
20985 type Error = super::error::ConversionError;
20986 fn try_from(
20987 value: Input,
20988 ) -> ::std::result::Result<Self, super::error::ConversionError> {
20989 Ok(Self {
20990 file: value.file?,
20991 purpose: value.purpose?,
20992 })
20993 }
20994 }
20995 impl ::std::convert::From<super::Input> for Input {
20996 fn from(value: super::Input) -> Self {
20997 Self {
20998 file: Ok(value.file),
20999 purpose: Ok(value.purpose),
21000 }
21001 }
21002 }
21003}
21004pub mod error {
21006 pub struct ConversionError(::std::borrow::Cow<'static, str>);
21008 impl ::std::error::Error for ConversionError {}
21009 impl ::std::fmt::Display for ConversionError {
21010 fn fmt(
21011 &self,
21012 f: &mut ::std::fmt::Formatter<'_>,
21013 ) -> Result<(), ::std::fmt::Error> {
21014 ::std::fmt::Display::fmt(&self.0, f)
21015 }
21016 }
21017 impl ::std::fmt::Debug for ConversionError {
21018 fn fmt(
21019 &self,
21020 f: &mut ::std::fmt::Formatter<'_>,
21021 ) -> Result<(), ::std::fmt::Error> {
21022 ::std::fmt::Debug::fmt(&self.0, f)
21023 }
21024 }
21025 impl From<&'static str> for ConversionError {
21026 fn from(value: &'static str) -> Self {
21027 Self(value.into())
21028 }
21029 }
21030 impl From<String> for ConversionError {
21031 fn from(value: String) -> Self {
21032 Self(value.into())
21033 }
21034 }
21035}
21036
21037pub mod output {
21038#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
21040pub struct Output {
21041 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21043 pub bytes: ::std::option::Option<i64>,
21044 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21046 pub created_at: ::std::option::Option<i64>,
21047 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21048 pub error: ::std::option::Option<OutputError>,
21049 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21051 pub expires_at: ::std::option::Option<i64>,
21052 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21054 pub filename: ::std::option::Option<::std::string::String>,
21055 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21057 pub id: ::std::option::Option<::std::string::String>,
21058 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21060 pub object: ::std::option::Option<OutputObject>,
21061 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21063 pub purpose: ::std::option::Option<OutputPurpose>,
21064}
21065impl Output {
21066 pub fn builder() -> builder::Output {
21067 Default::default()
21068 }
21069}
21070#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
21072pub struct OutputError {
21073 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21075 pub code: ::std::option::Option<OutputErrorCode>,
21076 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21078 pub message: ::std::option::Option<::std::string::String>,
21079 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21081 pub param: ::std::option::Option<::std::string::String>,
21082 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
21084 pub type_: ::std::option::Option<OutputErrorType>,
21085}
21086impl OutputError {
21087 pub fn builder() -> builder::OutputError {
21088 Default::default()
21089 }
21090}
21091#[derive(::serde::Serialize, Clone, Debug)]
21093#[serde(transparent)]
21094pub struct OutputErrorCode(i64);
21095impl ::std::ops::Deref for OutputErrorCode {
21096 type Target = i64;
21097 fn deref(&self) -> &i64 {
21098 &self.0
21099 }
21100}
21101impl ::std::convert::From<OutputErrorCode> for i64 {
21102 fn from(value: OutputErrorCode) -> Self {
21103 value.0
21104 }
21105}
21106impl ::std::str::FromStr for OutputErrorCode {
21107 type Err = self::error::ConversionError;
21108 fn from_str(
21109 value: &str,
21110 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21111 value
21112 .parse::<i64>()
21113 .map_err(|e| ::std::string::ToString::to_string(&e).into())
21114 .and_then(Self::try_from)
21115 }
21116}
21117impl ::std::convert::TryFrom<i64> for OutputErrorCode {
21118 type Error = self::error::ConversionError;
21119 fn try_from(
21120 value: i64,
21121 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21122 if ![400_i64, 403_i64, 413_i64, 429_i64].contains(&value) {
21123 Err("invalid value".into())
21124 } else {
21125 Ok(Self(value))
21126 }
21127 }
21128}
21129impl<'de> ::serde::Deserialize<'de> for OutputErrorCode {
21130 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
21131 where
21132 D: ::serde::Deserializer<'de>,
21133 {
21134 Self::try_from(<i64>::deserialize(deserializer)?)
21135 .map_err(|e| { <D::Error as ::serde::de::Error>::custom(e.to_string()) })
21136 }
21137}
21138#[derive(
21140 ::serde::Deserialize,
21141 ::serde::Serialize,
21142 Clone,
21143 Copy,
21144 Debug,
21145 Eq,
21146 Hash,
21147 Ord,
21148 PartialEq,
21149 PartialOrd
21150)]
21151pub enum OutputErrorType {
21152 #[serde(rename = "invalid_request_error")]
21153 InvalidRequestError,
21154 #[serde(rename = "forbidden_error")]
21155 ForbiddenError,
21156 #[serde(rename = "request_too_large")]
21157 RequestTooLarge,
21158 #[serde(rename = "rate_limit_error")]
21159 RateLimitError,
21160}
21161impl ::std::fmt::Display for OutputErrorType {
21162 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
21163 match *self {
21164 Self::InvalidRequestError => f.write_str("invalid_request_error"),
21165 Self::ForbiddenError => f.write_str("forbidden_error"),
21166 Self::RequestTooLarge => f.write_str("request_too_large"),
21167 Self::RateLimitError => f.write_str("rate_limit_error"),
21168 }
21169 }
21170}
21171impl ::std::str::FromStr for OutputErrorType {
21172 type Err = self::error::ConversionError;
21173 fn from_str(
21174 value: &str,
21175 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21176 match value {
21177 "invalid_request_error" => Ok(Self::InvalidRequestError),
21178 "forbidden_error" => Ok(Self::ForbiddenError),
21179 "request_too_large" => Ok(Self::RequestTooLarge),
21180 "rate_limit_error" => Ok(Self::RateLimitError),
21181 _ => Err("invalid value".into()),
21182 }
21183 }
21184}
21185impl ::std::convert::TryFrom<&str> for OutputErrorType {
21186 type Error = self::error::ConversionError;
21187 fn try_from(
21188 value: &str,
21189 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21190 value.parse()
21191 }
21192}
21193impl ::std::convert::TryFrom<::std::string::String> for OutputErrorType {
21194 type Error = self::error::ConversionError;
21195 fn try_from(
21196 value: ::std::string::String,
21197 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21198 value.parse()
21199 }
21200}
21201#[derive(
21203 ::serde::Deserialize,
21204 ::serde::Serialize,
21205 Clone,
21206 Copy,
21207 Debug,
21208 Eq,
21209 Hash,
21210 Ord,
21211 PartialEq,
21212 PartialOrd
21213)]
21214pub enum OutputObject {
21215 #[serde(rename = "file")]
21216 File,
21217}
21218impl ::std::fmt::Display for OutputObject {
21219 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
21220 match *self {
21221 Self::File => f.write_str("file"),
21222 }
21223 }
21224}
21225impl ::std::str::FromStr for OutputObject {
21226 type Err = self::error::ConversionError;
21227 fn from_str(
21228 value: &str,
21229 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21230 match value {
21231 "file" => Ok(Self::File),
21232 _ => Err("invalid value".into()),
21233 }
21234 }
21235}
21236impl ::std::convert::TryFrom<&str> for OutputObject {
21237 type Error = self::error::ConversionError;
21238 fn try_from(
21239 value: &str,
21240 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21241 value.parse()
21242 }
21243}
21244impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
21245 type Error = self::error::ConversionError;
21246 fn try_from(
21247 value: ::std::string::String,
21248 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21249 value.parse()
21250 }
21251}
21252#[derive(
21254 ::serde::Deserialize,
21255 ::serde::Serialize,
21256 Clone,
21257 Copy,
21258 Debug,
21259 Eq,
21260 Hash,
21261 Ord,
21262 PartialEq,
21263 PartialOrd
21264)]
21265pub enum OutputPurpose {
21266 #[serde(rename = "batch")]
21267 Batch,
21268 #[serde(rename = "batch_output")]
21269 BatchOutput,
21270}
21271impl ::std::fmt::Display for OutputPurpose {
21272 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
21273 match *self {
21274 Self::Batch => f.write_str("batch"),
21275 Self::BatchOutput => f.write_str("batch_output"),
21276 }
21277 }
21278}
21279impl ::std::str::FromStr for OutputPurpose {
21280 type Err = self::error::ConversionError;
21281 fn from_str(
21282 value: &str,
21283 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21284 match value {
21285 "batch" => Ok(Self::Batch),
21286 "batch_output" => Ok(Self::BatchOutput),
21287 _ => Err("invalid value".into()),
21288 }
21289 }
21290}
21291impl ::std::convert::TryFrom<&str> for OutputPurpose {
21292 type Error = self::error::ConversionError;
21293 fn try_from(
21294 value: &str,
21295 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21296 value.parse()
21297 }
21298}
21299impl ::std::convert::TryFrom<::std::string::String> for OutputPurpose {
21300 type Error = self::error::ConversionError;
21301 fn try_from(
21302 value: ::std::string::String,
21303 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21304 value.parse()
21305 }
21306}
21307pub mod builder {
21309 #[derive(Clone, Debug)]
21310 pub struct Output {
21311 bytes: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
21312 created_at: ::std::result::Result<
21313 ::std::option::Option<i64>,
21314 ::std::string::String,
21315 >,
21316 error: ::std::result::Result<
21317 ::std::option::Option<super::OutputError>,
21318 ::std::string::String,
21319 >,
21320 expires_at: ::std::result::Result<
21321 ::std::option::Option<i64>,
21322 ::std::string::String,
21323 >,
21324 filename: ::std::result::Result<
21325 ::std::option::Option<::std::string::String>,
21326 ::std::string::String,
21327 >,
21328 id: ::std::result::Result<
21329 ::std::option::Option<::std::string::String>,
21330 ::std::string::String,
21331 >,
21332 object: ::std::result::Result<
21333 ::std::option::Option<super::OutputObject>,
21334 ::std::string::String,
21335 >,
21336 purpose: ::std::result::Result<
21337 ::std::option::Option<super::OutputPurpose>,
21338 ::std::string::String,
21339 >,
21340 }
21341 impl ::std::default::Default for Output {
21342 fn default() -> Self {
21343 Self {
21344 bytes: Ok(Default::default()),
21345 created_at: Ok(Default::default()),
21346 error: Ok(Default::default()),
21347 expires_at: Ok(Default::default()),
21348 filename: Ok(Default::default()),
21349 id: Ok(Default::default()),
21350 object: Ok(Default::default()),
21351 purpose: Ok(Default::default()),
21352 }
21353 }
21354 }
21355 impl Output {
21356 pub fn bytes<T>(mut self, value: T) -> Self
21357 where
21358 T: ::std::convert::TryInto<::std::option::Option<i64>>,
21359 T::Error: ::std::fmt::Display,
21360 {
21361 self.bytes = value
21362 .try_into()
21363 .map_err(|e| format!("error converting supplied value for bytes: {e}"));
21364 self
21365 }
21366 pub fn created_at<T>(mut self, value: T) -> Self
21367 where
21368 T: ::std::convert::TryInto<::std::option::Option<i64>>,
21369 T::Error: ::std::fmt::Display,
21370 {
21371 self.created_at = value
21372 .try_into()
21373 .map_err(|e| {
21374 format!("error converting supplied value for created_at: {e}")
21375 });
21376 self
21377 }
21378 pub fn error<T>(mut self, value: T) -> Self
21379 where
21380 T: ::std::convert::TryInto<::std::option::Option<super::OutputError>>,
21381 T::Error: ::std::fmt::Display,
21382 {
21383 self.error = value
21384 .try_into()
21385 .map_err(|e| format!("error converting supplied value for error: {e}"));
21386 self
21387 }
21388 pub fn expires_at<T>(mut self, value: T) -> Self
21389 where
21390 T: ::std::convert::TryInto<::std::option::Option<i64>>,
21391 T::Error: ::std::fmt::Display,
21392 {
21393 self.expires_at = value
21394 .try_into()
21395 .map_err(|e| {
21396 format!("error converting supplied value for expires_at: {e}")
21397 });
21398 self
21399 }
21400 pub fn filename<T>(mut self, value: T) -> Self
21401 where
21402 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
21403 T::Error: ::std::fmt::Display,
21404 {
21405 self.filename = value
21406 .try_into()
21407 .map_err(|e| {
21408 format!("error converting supplied value for filename: {e}")
21409 });
21410 self
21411 }
21412 pub fn id<T>(mut self, value: T) -> Self
21413 where
21414 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
21415 T::Error: ::std::fmt::Display,
21416 {
21417 self.id = value
21418 .try_into()
21419 .map_err(|e| format!("error converting supplied value for id: {e}"));
21420 self
21421 }
21422 pub fn object<T>(mut self, value: T) -> Self
21423 where
21424 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
21425 T::Error: ::std::fmt::Display,
21426 {
21427 self.object = value
21428 .try_into()
21429 .map_err(|e| format!("error converting supplied value for object: {e}"));
21430 self
21431 }
21432 pub fn purpose<T>(mut self, value: T) -> Self
21433 where
21434 T: ::std::convert::TryInto<::std::option::Option<super::OutputPurpose>>,
21435 T::Error: ::std::fmt::Display,
21436 {
21437 self.purpose = value
21438 .try_into()
21439 .map_err(|e| {
21440 format!("error converting supplied value for purpose: {e}")
21441 });
21442 self
21443 }
21444 }
21445 impl ::std::convert::TryFrom<Output> for super::Output {
21446 type Error = super::error::ConversionError;
21447 fn try_from(
21448 value: Output,
21449 ) -> ::std::result::Result<Self, super::error::ConversionError> {
21450 Ok(Self {
21451 bytes: value.bytes?,
21452 created_at: value.created_at?,
21453 error: value.error?,
21454 expires_at: value.expires_at?,
21455 filename: value.filename?,
21456 id: value.id?,
21457 object: value.object?,
21458 purpose: value.purpose?,
21459 })
21460 }
21461 }
21462 impl ::std::convert::From<super::Output> for Output {
21463 fn from(value: super::Output) -> Self {
21464 Self {
21465 bytes: Ok(value.bytes),
21466 created_at: Ok(value.created_at),
21467 error: Ok(value.error),
21468 expires_at: Ok(value.expires_at),
21469 filename: Ok(value.filename),
21470 id: Ok(value.id),
21471 object: Ok(value.object),
21472 purpose: Ok(value.purpose),
21473 }
21474 }
21475 }
21476 #[derive(Clone, Debug)]
21477 pub struct OutputError {
21478 code: ::std::result::Result<
21479 ::std::option::Option<super::OutputErrorCode>,
21480 ::std::string::String,
21481 >,
21482 message: ::std::result::Result<
21483 ::std::option::Option<::std::string::String>,
21484 ::std::string::String,
21485 >,
21486 param: ::std::result::Result<
21487 ::std::option::Option<::std::string::String>,
21488 ::std::string::String,
21489 >,
21490 type_: ::std::result::Result<
21491 ::std::option::Option<super::OutputErrorType>,
21492 ::std::string::String,
21493 >,
21494 }
21495 impl ::std::default::Default for OutputError {
21496 fn default() -> Self {
21497 Self {
21498 code: Ok(Default::default()),
21499 message: Ok(Default::default()),
21500 param: Ok(Default::default()),
21501 type_: Ok(Default::default()),
21502 }
21503 }
21504 }
21505 impl OutputError {
21506 pub fn code<T>(mut self, value: T) -> Self
21507 where
21508 T: ::std::convert::TryInto<::std::option::Option<super::OutputErrorCode>>,
21509 T::Error: ::std::fmt::Display,
21510 {
21511 self.code = value
21512 .try_into()
21513 .map_err(|e| format!("error converting supplied value for code: {e}"));
21514 self
21515 }
21516 pub fn message<T>(mut self, value: T) -> Self
21517 where
21518 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
21519 T::Error: ::std::fmt::Display,
21520 {
21521 self.message = value
21522 .try_into()
21523 .map_err(|e| {
21524 format!("error converting supplied value for message: {e}")
21525 });
21526 self
21527 }
21528 pub fn param<T>(mut self, value: T) -> Self
21529 where
21530 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
21531 T::Error: ::std::fmt::Display,
21532 {
21533 self.param = value
21534 .try_into()
21535 .map_err(|e| format!("error converting supplied value for param: {e}"));
21536 self
21537 }
21538 pub fn type_<T>(mut self, value: T) -> Self
21539 where
21540 T: ::std::convert::TryInto<::std::option::Option<super::OutputErrorType>>,
21541 T::Error: ::std::fmt::Display,
21542 {
21543 self.type_ = value
21544 .try_into()
21545 .map_err(|e| format!("error converting supplied value for type_: {e}"));
21546 self
21547 }
21548 }
21549 impl ::std::convert::TryFrom<OutputError> for super::OutputError {
21550 type Error = super::error::ConversionError;
21551 fn try_from(
21552 value: OutputError,
21553 ) -> ::std::result::Result<Self, super::error::ConversionError> {
21554 Ok(Self {
21555 code: value.code?,
21556 message: value.message?,
21557 param: value.param?,
21558 type_: value.type_?,
21559 })
21560 }
21561 }
21562 impl ::std::convert::From<super::OutputError> for OutputError {
21563 fn from(value: super::OutputError) -> Self {
21564 Self {
21565 code: Ok(value.code),
21566 message: Ok(value.message),
21567 param: Ok(value.param),
21568 type_: Ok(value.type_),
21569 }
21570 }
21571 }
21572}
21573pub mod error {
21575 pub struct ConversionError(::std::borrow::Cow<'static, str>);
21577 impl ::std::error::Error for ConversionError {}
21578 impl ::std::fmt::Display for ConversionError {
21579 fn fmt(
21580 &self,
21581 f: &mut ::std::fmt::Formatter<'_>,
21582 ) -> Result<(), ::std::fmt::Error> {
21583 ::std::fmt::Display::fmt(&self.0, f)
21584 }
21585 }
21586 impl ::std::fmt::Debug for ConversionError {
21587 fn fmt(
21588 &self,
21589 f: &mut ::std::fmt::Formatter<'_>,
21590 ) -> Result<(), ::std::fmt::Error> {
21591 ::std::fmt::Debug::fmt(&self.0, f)
21592 }
21593 }
21594 impl From<&'static str> for ConversionError {
21595 fn from(value: &'static str) -> Self {
21596 Self(value.into())
21597 }
21598 }
21599 impl From<String> for ConversionError {
21600 fn from(value: String) -> Self {
21601 Self(value.into())
21602 }
21603 }
21604}
21605
21606}
21607
21608 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "file", part: ::one::Part::Body, key: Some("file") }, ::one::Route { field: "purpose", part: ::one::Part::Body, key: Some("purpose") }], required_parts: &[::one::Part::Body] };
21610
21611 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
21621 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C3-c16g::ip7Zrl7dS0GxYogF8tkVnw", Method::POST, "/v1/files").with_routed(&input, &ROUTING)?
21622 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"multipart/form-data\"}").map_err(Error::Decode)?).returns::<output::Output>())
21623 }
21624
21625 impl IntoOperation for Input {
21626 type Output = output::Output;
21627
21628 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
21629 build(self)
21630 }
21631 }
21632 impl IntoOperation for builder::Input {
21633 type Output = output::Output;
21634
21635 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
21636 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
21637 }
21638 }
21639}
21640pub fn upload_batch_input_file() -> upload_batch_input_file::builder::Input {
21642 upload_batch_input_file::builder::Input::default()
21643}
21644pub mod list_organization_files {
21645 use ::one::{Error, IntoOperation, Method, Operation};
21646#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
21648#[serde(deny_unknown_fields)]
21649pub struct Input {
21650 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21652 pub after_id: ::std::option::Option<::std::string::String>,
21653 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21655 pub limit: ::std::option::Option<i64>,
21656 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21658 pub order: ::std::option::Option<InputOrder>,
21659 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21661 pub purpose: ::std::option::Option<InputPurpose>,
21662}
21663impl Input {
21664 pub fn builder() -> builder::Input {
21665 Default::default()
21666 }
21667}
21668#[derive(
21670 ::serde::Deserialize,
21671 ::serde::Serialize,
21672 Clone,
21673 Copy,
21674 Debug,
21675 Eq,
21676 Hash,
21677 Ord,
21678 PartialEq,
21679 PartialOrd
21680)]
21681pub enum InputOrder {
21682 #[serde(rename = "asc")]
21683 Asc,
21684 #[serde(rename = "desc")]
21685 Desc,
21686}
21687impl ::std::fmt::Display for InputOrder {
21688 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
21689 match *self {
21690 Self::Asc => f.write_str("asc"),
21691 Self::Desc => f.write_str("desc"),
21692 }
21693 }
21694}
21695impl ::std::str::FromStr for InputOrder {
21696 type Err = self::error::ConversionError;
21697 fn from_str(
21698 value: &str,
21699 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21700 match value {
21701 "asc" => Ok(Self::Asc),
21702 "desc" => Ok(Self::Desc),
21703 _ => Err("invalid value".into()),
21704 }
21705 }
21706}
21707impl ::std::convert::TryFrom<&str> for InputOrder {
21708 type Error = self::error::ConversionError;
21709 fn try_from(
21710 value: &str,
21711 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21712 value.parse()
21713 }
21714}
21715impl ::std::convert::TryFrom<::std::string::String> for InputOrder {
21716 type Error = self::error::ConversionError;
21717 fn try_from(
21718 value: ::std::string::String,
21719 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21720 value.parse()
21721 }
21722}
21723#[derive(
21725 ::serde::Deserialize,
21726 ::serde::Serialize,
21727 Clone,
21728 Copy,
21729 Debug,
21730 Eq,
21731 Hash,
21732 Ord,
21733 PartialEq,
21734 PartialOrd
21735)]
21736pub enum InputPurpose {
21737 #[serde(rename = "batch")]
21738 Batch,
21739 #[serde(rename = "batch_output")]
21740 BatchOutput,
21741}
21742impl ::std::fmt::Display for InputPurpose {
21743 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
21744 match *self {
21745 Self::Batch => f.write_str("batch"),
21746 Self::BatchOutput => f.write_str("batch_output"),
21747 }
21748 }
21749}
21750impl ::std::str::FromStr for InputPurpose {
21751 type Err = self::error::ConversionError;
21752 fn from_str(
21753 value: &str,
21754 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21755 match value {
21756 "batch" => Ok(Self::Batch),
21757 "batch_output" => Ok(Self::BatchOutput),
21758 _ => Err("invalid value".into()),
21759 }
21760 }
21761}
21762impl ::std::convert::TryFrom<&str> for InputPurpose {
21763 type Error = self::error::ConversionError;
21764 fn try_from(
21765 value: &str,
21766 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21767 value.parse()
21768 }
21769}
21770impl ::std::convert::TryFrom<::std::string::String> for InputPurpose {
21771 type Error = self::error::ConversionError;
21772 fn try_from(
21773 value: ::std::string::String,
21774 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21775 value.parse()
21776 }
21777}
21778pub mod builder {
21780 #[derive(Clone, Debug)]
21781 pub struct Input {
21782 after_id: ::std::result::Result<
21783 ::std::option::Option<::std::string::String>,
21784 ::std::string::String,
21785 >,
21786 limit: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
21787 order: ::std::result::Result<
21788 ::std::option::Option<super::InputOrder>,
21789 ::std::string::String,
21790 >,
21791 purpose: ::std::result::Result<
21792 ::std::option::Option<super::InputPurpose>,
21793 ::std::string::String,
21794 >,
21795 }
21796 impl ::std::default::Default for Input {
21797 fn default() -> Self {
21798 Self {
21799 after_id: Ok(Default::default()),
21800 limit: Ok(Default::default()),
21801 order: Ok(Default::default()),
21802 purpose: Ok(Default::default()),
21803 }
21804 }
21805 }
21806 impl Input {
21807 pub fn after_id<T>(mut self, value: T) -> Self
21808 where
21809 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
21810 T::Error: ::std::fmt::Display,
21811 {
21812 self.after_id = value
21813 .try_into()
21814 .map_err(|e| {
21815 format!("error converting supplied value for after_id: {e}")
21816 });
21817 self
21818 }
21819 pub fn limit<T>(mut self, value: T) -> Self
21820 where
21821 T: ::std::convert::TryInto<::std::option::Option<i64>>,
21822 T::Error: ::std::fmt::Display,
21823 {
21824 self.limit = value
21825 .try_into()
21826 .map_err(|e| format!("error converting supplied value for limit: {e}"));
21827 self
21828 }
21829 pub fn order<T>(mut self, value: T) -> Self
21830 where
21831 T: ::std::convert::TryInto<::std::option::Option<super::InputOrder>>,
21832 T::Error: ::std::fmt::Display,
21833 {
21834 self.order = value
21835 .try_into()
21836 .map_err(|e| format!("error converting supplied value for order: {e}"));
21837 self
21838 }
21839 pub fn purpose<T>(mut self, value: T) -> Self
21840 where
21841 T: ::std::convert::TryInto<::std::option::Option<super::InputPurpose>>,
21842 T::Error: ::std::fmt::Display,
21843 {
21844 self.purpose = value
21845 .try_into()
21846 .map_err(|e| {
21847 format!("error converting supplied value for purpose: {e}")
21848 });
21849 self
21850 }
21851 }
21852 impl ::std::convert::TryFrom<Input> for super::Input {
21853 type Error = super::error::ConversionError;
21854 fn try_from(
21855 value: Input,
21856 ) -> ::std::result::Result<Self, super::error::ConversionError> {
21857 Ok(Self {
21858 after_id: value.after_id?,
21859 limit: value.limit?,
21860 order: value.order?,
21861 purpose: value.purpose?,
21862 })
21863 }
21864 }
21865 impl ::std::convert::From<super::Input> for Input {
21866 fn from(value: super::Input) -> Self {
21867 Self {
21868 after_id: Ok(value.after_id),
21869 limit: Ok(value.limit),
21870 order: Ok(value.order),
21871 purpose: Ok(value.purpose),
21872 }
21873 }
21874 }
21875}
21876pub mod error {
21878 pub struct ConversionError(::std::borrow::Cow<'static, str>);
21880 impl ::std::error::Error for ConversionError {}
21881 impl ::std::fmt::Display for ConversionError {
21882 fn fmt(
21883 &self,
21884 f: &mut ::std::fmt::Formatter<'_>,
21885 ) -> Result<(), ::std::fmt::Error> {
21886 ::std::fmt::Display::fmt(&self.0, f)
21887 }
21888 }
21889 impl ::std::fmt::Debug for ConversionError {
21890 fn fmt(
21891 &self,
21892 f: &mut ::std::fmt::Formatter<'_>,
21893 ) -> Result<(), ::std::fmt::Error> {
21894 ::std::fmt::Debug::fmt(&self.0, f)
21895 }
21896 }
21897 impl From<&'static str> for ConversionError {
21898 fn from(value: &'static str) -> Self {
21899 Self(value.into())
21900 }
21901 }
21902 impl From<String> for ConversionError {
21903 fn from(value: String) -> Self {
21904 Self(value.into())
21905 }
21906 }
21907}
21908
21909pub mod output {
21910#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
21912pub struct ErrorObject {
21913 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21915 pub code: ::std::option::Option<i64>,
21916 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21918 pub message: ::std::option::Option<::std::string::String>,
21919 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21921 pub param: ::std::option::Option<::std::string::String>,
21922 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
21924 pub type_: ::std::option::Option<::std::string::String>,
21925}
21926impl ErrorObject {
21927 pub fn builder() -> builder::ErrorObject {
21928 Default::default()
21929 }
21930}
21931#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
21933pub struct FileObject {
21934 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21936 pub bytes: ::std::option::Option<i64>,
21937 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21939 pub created_at: ::std::option::Option<i64>,
21940 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21942 pub expires_at: ::std::option::Option<i64>,
21943 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21945 pub filename: ::std::option::Option<::std::string::String>,
21946 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21948 pub id: ::std::option::Option<::std::string::String>,
21949 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21951 pub object: ::std::option::Option<FileObjectObject>,
21952 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
21954 pub purpose: ::std::option::Option<FileObjectPurpose>,
21955}
21956impl FileObject {
21957 pub fn builder() -> builder::FileObject {
21958 Default::default()
21959 }
21960}
21961#[derive(
21963 ::serde::Deserialize,
21964 ::serde::Serialize,
21965 Clone,
21966 Copy,
21967 Debug,
21968 Eq,
21969 Hash,
21970 Ord,
21971 PartialEq,
21972 PartialOrd
21973)]
21974pub enum FileObjectObject {
21975 #[serde(rename = "file")]
21976 File,
21977}
21978impl ::std::fmt::Display for FileObjectObject {
21979 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
21980 match *self {
21981 Self::File => f.write_str("file"),
21982 }
21983 }
21984}
21985impl ::std::str::FromStr for FileObjectObject {
21986 type Err = self::error::ConversionError;
21987 fn from_str(
21988 value: &str,
21989 ) -> ::std::result::Result<Self, self::error::ConversionError> {
21990 match value {
21991 "file" => Ok(Self::File),
21992 _ => Err("invalid value".into()),
21993 }
21994 }
21995}
21996impl ::std::convert::TryFrom<&str> for FileObjectObject {
21997 type Error = self::error::ConversionError;
21998 fn try_from(
21999 value: &str,
22000 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22001 value.parse()
22002 }
22003}
22004impl ::std::convert::TryFrom<::std::string::String> for FileObjectObject {
22005 type Error = self::error::ConversionError;
22006 fn try_from(
22007 value: ::std::string::String,
22008 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22009 value.parse()
22010 }
22011}
22012#[derive(
22014 ::serde::Deserialize,
22015 ::serde::Serialize,
22016 Clone,
22017 Copy,
22018 Debug,
22019 Eq,
22020 Hash,
22021 Ord,
22022 PartialEq,
22023 PartialOrd
22024)]
22025pub enum FileObjectPurpose {
22026 #[serde(rename = "batch")]
22027 Batch,
22028 #[serde(rename = "batch_output")]
22029 BatchOutput,
22030}
22031impl ::std::fmt::Display for FileObjectPurpose {
22032 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
22033 match *self {
22034 Self::Batch => f.write_str("batch"),
22035 Self::BatchOutput => f.write_str("batch_output"),
22036 }
22037 }
22038}
22039impl ::std::str::FromStr for FileObjectPurpose {
22040 type Err = self::error::ConversionError;
22041 fn from_str(
22042 value: &str,
22043 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22044 match value {
22045 "batch" => Ok(Self::Batch),
22046 "batch_output" => Ok(Self::BatchOutput),
22047 _ => Err("invalid value".into()),
22048 }
22049 }
22050}
22051impl ::std::convert::TryFrom<&str> for FileObjectPurpose {
22052 type Error = self::error::ConversionError;
22053 fn try_from(
22054 value: &str,
22055 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22056 value.parse()
22057 }
22058}
22059impl ::std::convert::TryFrom<::std::string::String> for FileObjectPurpose {
22060 type Error = self::error::ConversionError;
22061 fn try_from(
22062 value: ::std::string::String,
22063 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22064 value.parse()
22065 }
22066}
22067#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
22069pub struct Output {
22070 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
22072 pub data: ::std::vec::Vec<FileObject>,
22073 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22074 pub error: ::std::option::Option<ErrorObject>,
22075 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22077 pub first_id: ::std::option::Option<::std::string::String>,
22078 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22080 pub has_more: ::std::option::Option<bool>,
22081 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22083 pub last_id: ::std::option::Option<::std::string::String>,
22084 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22086 pub object: ::std::option::Option<OutputObject>,
22087}
22088impl Output {
22089 pub fn builder() -> builder::Output {
22090 Default::default()
22091 }
22092}
22093#[derive(
22095 ::serde::Deserialize,
22096 ::serde::Serialize,
22097 Clone,
22098 Copy,
22099 Debug,
22100 Eq,
22101 Hash,
22102 Ord,
22103 PartialEq,
22104 PartialOrd
22105)]
22106pub enum OutputObject {
22107 #[serde(rename = "list")]
22108 List,
22109}
22110impl ::std::fmt::Display for OutputObject {
22111 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
22112 match *self {
22113 Self::List => f.write_str("list"),
22114 }
22115 }
22116}
22117impl ::std::str::FromStr for OutputObject {
22118 type Err = self::error::ConversionError;
22119 fn from_str(
22120 value: &str,
22121 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22122 match value {
22123 "list" => Ok(Self::List),
22124 _ => Err("invalid value".into()),
22125 }
22126 }
22127}
22128impl ::std::convert::TryFrom<&str> for OutputObject {
22129 type Error = self::error::ConversionError;
22130 fn try_from(
22131 value: &str,
22132 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22133 value.parse()
22134 }
22135}
22136impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
22137 type Error = self::error::ConversionError;
22138 fn try_from(
22139 value: ::std::string::String,
22140 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22141 value.parse()
22142 }
22143}
22144pub mod builder {
22146 #[derive(Clone, Debug)]
22147 pub struct ErrorObject {
22148 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
22149 message: ::std::result::Result<
22150 ::std::option::Option<::std::string::String>,
22151 ::std::string::String,
22152 >,
22153 param: ::std::result::Result<
22154 ::std::option::Option<::std::string::String>,
22155 ::std::string::String,
22156 >,
22157 type_: ::std::result::Result<
22158 ::std::option::Option<::std::string::String>,
22159 ::std::string::String,
22160 >,
22161 }
22162 impl ::std::default::Default for ErrorObject {
22163 fn default() -> Self {
22164 Self {
22165 code: Ok(Default::default()),
22166 message: Ok(Default::default()),
22167 param: Ok(Default::default()),
22168 type_: Ok(Default::default()),
22169 }
22170 }
22171 }
22172 impl ErrorObject {
22173 pub fn code<T>(mut self, value: T) -> Self
22174 where
22175 T: ::std::convert::TryInto<::std::option::Option<i64>>,
22176 T::Error: ::std::fmt::Display,
22177 {
22178 self.code = value
22179 .try_into()
22180 .map_err(|e| format!("error converting supplied value for code: {e}"));
22181 self
22182 }
22183 pub fn message<T>(mut self, value: T) -> Self
22184 where
22185 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22186 T::Error: ::std::fmt::Display,
22187 {
22188 self.message = value
22189 .try_into()
22190 .map_err(|e| {
22191 format!("error converting supplied value for message: {e}")
22192 });
22193 self
22194 }
22195 pub fn param<T>(mut self, value: T) -> Self
22196 where
22197 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22198 T::Error: ::std::fmt::Display,
22199 {
22200 self.param = value
22201 .try_into()
22202 .map_err(|e| format!("error converting supplied value for param: {e}"));
22203 self
22204 }
22205 pub fn type_<T>(mut self, value: T) -> Self
22206 where
22207 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22208 T::Error: ::std::fmt::Display,
22209 {
22210 self.type_ = value
22211 .try_into()
22212 .map_err(|e| format!("error converting supplied value for type_: {e}"));
22213 self
22214 }
22215 }
22216 impl ::std::convert::TryFrom<ErrorObject> for super::ErrorObject {
22217 type Error = super::error::ConversionError;
22218 fn try_from(
22219 value: ErrorObject,
22220 ) -> ::std::result::Result<Self, super::error::ConversionError> {
22221 Ok(Self {
22222 code: value.code?,
22223 message: value.message?,
22224 param: value.param?,
22225 type_: value.type_?,
22226 })
22227 }
22228 }
22229 impl ::std::convert::From<super::ErrorObject> for ErrorObject {
22230 fn from(value: super::ErrorObject) -> Self {
22231 Self {
22232 code: Ok(value.code),
22233 message: Ok(value.message),
22234 param: Ok(value.param),
22235 type_: Ok(value.type_),
22236 }
22237 }
22238 }
22239 #[derive(Clone, Debug)]
22240 pub struct FileObject {
22241 bytes: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
22242 created_at: ::std::result::Result<
22243 ::std::option::Option<i64>,
22244 ::std::string::String,
22245 >,
22246 expires_at: ::std::result::Result<
22247 ::std::option::Option<i64>,
22248 ::std::string::String,
22249 >,
22250 filename: ::std::result::Result<
22251 ::std::option::Option<::std::string::String>,
22252 ::std::string::String,
22253 >,
22254 id: ::std::result::Result<
22255 ::std::option::Option<::std::string::String>,
22256 ::std::string::String,
22257 >,
22258 object: ::std::result::Result<
22259 ::std::option::Option<super::FileObjectObject>,
22260 ::std::string::String,
22261 >,
22262 purpose: ::std::result::Result<
22263 ::std::option::Option<super::FileObjectPurpose>,
22264 ::std::string::String,
22265 >,
22266 }
22267 impl ::std::default::Default for FileObject {
22268 fn default() -> Self {
22269 Self {
22270 bytes: Ok(Default::default()),
22271 created_at: Ok(Default::default()),
22272 expires_at: Ok(Default::default()),
22273 filename: Ok(Default::default()),
22274 id: Ok(Default::default()),
22275 object: Ok(Default::default()),
22276 purpose: Ok(Default::default()),
22277 }
22278 }
22279 }
22280 impl FileObject {
22281 pub fn bytes<T>(mut self, value: T) -> Self
22282 where
22283 T: ::std::convert::TryInto<::std::option::Option<i64>>,
22284 T::Error: ::std::fmt::Display,
22285 {
22286 self.bytes = value
22287 .try_into()
22288 .map_err(|e| format!("error converting supplied value for bytes: {e}"));
22289 self
22290 }
22291 pub fn created_at<T>(mut self, value: T) -> Self
22292 where
22293 T: ::std::convert::TryInto<::std::option::Option<i64>>,
22294 T::Error: ::std::fmt::Display,
22295 {
22296 self.created_at = value
22297 .try_into()
22298 .map_err(|e| {
22299 format!("error converting supplied value for created_at: {e}")
22300 });
22301 self
22302 }
22303 pub fn expires_at<T>(mut self, value: T) -> Self
22304 where
22305 T: ::std::convert::TryInto<::std::option::Option<i64>>,
22306 T::Error: ::std::fmt::Display,
22307 {
22308 self.expires_at = value
22309 .try_into()
22310 .map_err(|e| {
22311 format!("error converting supplied value for expires_at: {e}")
22312 });
22313 self
22314 }
22315 pub fn filename<T>(mut self, value: T) -> Self
22316 where
22317 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22318 T::Error: ::std::fmt::Display,
22319 {
22320 self.filename = value
22321 .try_into()
22322 .map_err(|e| {
22323 format!("error converting supplied value for filename: {e}")
22324 });
22325 self
22326 }
22327 pub fn id<T>(mut self, value: T) -> Self
22328 where
22329 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22330 T::Error: ::std::fmt::Display,
22331 {
22332 self.id = value
22333 .try_into()
22334 .map_err(|e| format!("error converting supplied value for id: {e}"));
22335 self
22336 }
22337 pub fn object<T>(mut self, value: T) -> Self
22338 where
22339 T: ::std::convert::TryInto<::std::option::Option<super::FileObjectObject>>,
22340 T::Error: ::std::fmt::Display,
22341 {
22342 self.object = value
22343 .try_into()
22344 .map_err(|e| format!("error converting supplied value for object: {e}"));
22345 self
22346 }
22347 pub fn purpose<T>(mut self, value: T) -> Self
22348 where
22349 T: ::std::convert::TryInto<::std::option::Option<super::FileObjectPurpose>>,
22350 T::Error: ::std::fmt::Display,
22351 {
22352 self.purpose = value
22353 .try_into()
22354 .map_err(|e| {
22355 format!("error converting supplied value for purpose: {e}")
22356 });
22357 self
22358 }
22359 }
22360 impl ::std::convert::TryFrom<FileObject> for super::FileObject {
22361 type Error = super::error::ConversionError;
22362 fn try_from(
22363 value: FileObject,
22364 ) -> ::std::result::Result<Self, super::error::ConversionError> {
22365 Ok(Self {
22366 bytes: value.bytes?,
22367 created_at: value.created_at?,
22368 expires_at: value.expires_at?,
22369 filename: value.filename?,
22370 id: value.id?,
22371 object: value.object?,
22372 purpose: value.purpose?,
22373 })
22374 }
22375 }
22376 impl ::std::convert::From<super::FileObject> for FileObject {
22377 fn from(value: super::FileObject) -> Self {
22378 Self {
22379 bytes: Ok(value.bytes),
22380 created_at: Ok(value.created_at),
22381 expires_at: Ok(value.expires_at),
22382 filename: Ok(value.filename),
22383 id: Ok(value.id),
22384 object: Ok(value.object),
22385 purpose: Ok(value.purpose),
22386 }
22387 }
22388 }
22389 #[derive(Clone, Debug)]
22390 pub struct Output {
22391 data: ::std::result::Result<
22392 ::std::vec::Vec<super::FileObject>,
22393 ::std::string::String,
22394 >,
22395 error: ::std::result::Result<
22396 ::std::option::Option<super::ErrorObject>,
22397 ::std::string::String,
22398 >,
22399 first_id: ::std::result::Result<
22400 ::std::option::Option<::std::string::String>,
22401 ::std::string::String,
22402 >,
22403 has_more: ::std::result::Result<
22404 ::std::option::Option<bool>,
22405 ::std::string::String,
22406 >,
22407 last_id: ::std::result::Result<
22408 ::std::option::Option<::std::string::String>,
22409 ::std::string::String,
22410 >,
22411 object: ::std::result::Result<
22412 ::std::option::Option<super::OutputObject>,
22413 ::std::string::String,
22414 >,
22415 }
22416 impl ::std::default::Default for Output {
22417 fn default() -> Self {
22418 Self {
22419 data: Ok(Default::default()),
22420 error: Ok(Default::default()),
22421 first_id: Ok(Default::default()),
22422 has_more: Ok(Default::default()),
22423 last_id: Ok(Default::default()),
22424 object: Ok(Default::default()),
22425 }
22426 }
22427 }
22428 impl Output {
22429 pub fn data<T>(mut self, value: T) -> Self
22430 where
22431 T: ::std::convert::TryInto<::std::vec::Vec<super::FileObject>>,
22432 T::Error: ::std::fmt::Display,
22433 {
22434 self.data = value
22435 .try_into()
22436 .map_err(|e| format!("error converting supplied value for data: {e}"));
22437 self
22438 }
22439 pub fn error<T>(mut self, value: T) -> Self
22440 where
22441 T: ::std::convert::TryInto<::std::option::Option<super::ErrorObject>>,
22442 T::Error: ::std::fmt::Display,
22443 {
22444 self.error = value
22445 .try_into()
22446 .map_err(|e| format!("error converting supplied value for error: {e}"));
22447 self
22448 }
22449 pub fn first_id<T>(mut self, value: T) -> Self
22450 where
22451 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22452 T::Error: ::std::fmt::Display,
22453 {
22454 self.first_id = value
22455 .try_into()
22456 .map_err(|e| {
22457 format!("error converting supplied value for first_id: {e}")
22458 });
22459 self
22460 }
22461 pub fn has_more<T>(mut self, value: T) -> Self
22462 where
22463 T: ::std::convert::TryInto<::std::option::Option<bool>>,
22464 T::Error: ::std::fmt::Display,
22465 {
22466 self.has_more = value
22467 .try_into()
22468 .map_err(|e| {
22469 format!("error converting supplied value for has_more: {e}")
22470 });
22471 self
22472 }
22473 pub fn last_id<T>(mut self, value: T) -> Self
22474 where
22475 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22476 T::Error: ::std::fmt::Display,
22477 {
22478 self.last_id = value
22479 .try_into()
22480 .map_err(|e| {
22481 format!("error converting supplied value for last_id: {e}")
22482 });
22483 self
22484 }
22485 pub fn object<T>(mut self, value: T) -> Self
22486 where
22487 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
22488 T::Error: ::std::fmt::Display,
22489 {
22490 self.object = value
22491 .try_into()
22492 .map_err(|e| format!("error converting supplied value for object: {e}"));
22493 self
22494 }
22495 }
22496 impl ::std::convert::TryFrom<Output> for super::Output {
22497 type Error = super::error::ConversionError;
22498 fn try_from(
22499 value: Output,
22500 ) -> ::std::result::Result<Self, super::error::ConversionError> {
22501 Ok(Self {
22502 data: value.data?,
22503 error: value.error?,
22504 first_id: value.first_id?,
22505 has_more: value.has_more?,
22506 last_id: value.last_id?,
22507 object: value.object?,
22508 })
22509 }
22510 }
22511 impl ::std::convert::From<super::Output> for Output {
22512 fn from(value: super::Output) -> Self {
22513 Self {
22514 data: Ok(value.data),
22515 error: Ok(value.error),
22516 first_id: Ok(value.first_id),
22517 has_more: Ok(value.has_more),
22518 last_id: Ok(value.last_id),
22519 object: Ok(value.object),
22520 }
22521 }
22522 }
22523}
22524pub mod error {
22526 pub struct ConversionError(::std::borrow::Cow<'static, str>);
22528 impl ::std::error::Error for ConversionError {}
22529 impl ::std::fmt::Display for ConversionError {
22530 fn fmt(
22531 &self,
22532 f: &mut ::std::fmt::Formatter<'_>,
22533 ) -> Result<(), ::std::fmt::Error> {
22534 ::std::fmt::Display::fmt(&self.0, f)
22535 }
22536 }
22537 impl ::std::fmt::Debug for ConversionError {
22538 fn fmt(
22539 &self,
22540 f: &mut ::std::fmt::Formatter<'_>,
22541 ) -> Result<(), ::std::fmt::Error> {
22542 ::std::fmt::Debug::fmt(&self.0, f)
22543 }
22544 }
22545 impl From<&'static str> for ConversionError {
22546 fn from(value: &'static str) -> Self {
22547 Self(value.into())
22548 }
22549 }
22550 impl From<String> for ConversionError {
22551 fn from(value: String) -> Self {
22552 Self(value.into())
22553 }
22554 }
22555}
22556
22557}
22558
22559 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "after_id", part: ::one::Part::Query, key: Some("after_id") }, ::one::Route { field: "limit", part: ::one::Part::Query, key: Some("limit") }, ::one::Route { field: "order", part: ::one::Part::Query, key: Some("order") }, ::one::Route { field: "purpose", part: ::one::Part::Query, key: Some("purpose") }], required_parts: &[] };
22561
22562 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
22574 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C4ADJxA::GjuOjehzSNy9beABVaA0zQ", Method::GET, "/v1/files").with_routed(&input, &ROUTING)?
22575 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
22576 }
22577
22578 impl IntoOperation for Input {
22579 type Output = output::Output;
22580
22581 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
22582 build(self)
22583 }
22584 }
22585 impl IntoOperation for builder::Input {
22586 type Output = output::Output;
22587
22588 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
22589 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
22590 }
22591 }
22592}
22593pub fn list_organization_files() -> list_organization_files::builder::Input {
22595 list_organization_files::builder::Input::default()
22596}
22597pub mod list_available_agent_api_models {
22598 use ::one::{Error, IntoOperation, Method, Operation};
22599#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
22601#[serde(deny_unknown_fields)]
22602pub struct Input {}
22603impl Input {
22604 pub fn builder() -> builder::Input {
22605 Default::default()
22606 }
22607}
22608pub mod builder {
22610 #[derive(Clone, Debug)]
22611 pub struct Input {}
22612 impl ::std::default::Default for Input {
22613 fn default() -> Self {
22614 Self {}
22615 }
22616 }
22617 impl Input {}
22618 impl ::std::convert::TryFrom<Input> for super::Input {
22619 type Error = super::error::ConversionError;
22620 fn try_from(
22621 _value: Input,
22622 ) -> ::std::result::Result<Self, super::error::ConversionError> {
22623 Ok(Self {})
22624 }
22625 }
22626 impl ::std::convert::From<super::Input> for Input {
22627 fn from(_value: super::Input) -> Self {
22628 Self {}
22629 }
22630 }
22631}
22632pub mod error {
22634 pub struct ConversionError(::std::borrow::Cow<'static, str>);
22636 impl ::std::error::Error for ConversionError {}
22637 impl ::std::fmt::Display for ConversionError {
22638 fn fmt(
22639 &self,
22640 f: &mut ::std::fmt::Formatter<'_>,
22641 ) -> Result<(), ::std::fmt::Error> {
22642 ::std::fmt::Display::fmt(&self.0, f)
22643 }
22644 }
22645 impl ::std::fmt::Debug for ConversionError {
22646 fn fmt(
22647 &self,
22648 f: &mut ::std::fmt::Formatter<'_>,
22649 ) -> Result<(), ::std::fmt::Error> {
22650 ::std::fmt::Debug::fmt(&self.0, f)
22651 }
22652 }
22653 impl From<&'static str> for ConversionError {
22654 fn from(value: &'static str) -> Self {
22655 Self(value.into())
22656 }
22657 }
22658 impl From<String> for ConversionError {
22659 fn from(value: String) -> Self {
22660 Self(value.into())
22661 }
22662 }
22663}
22664
22665pub mod output {
22666#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
22668pub struct ModelObject {
22669 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22671 pub created: ::std::option::Option<i64>,
22672 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22674 pub id: ::std::option::Option<::std::string::String>,
22675 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22677 pub object: ::std::option::Option<ModelObjectObject>,
22678 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22680 pub owned_by: ::std::option::Option<::std::string::String>,
22681}
22682impl ModelObject {
22683 pub fn builder() -> builder::ModelObject {
22684 Default::default()
22685 }
22686}
22687#[derive(
22689 ::serde::Deserialize,
22690 ::serde::Serialize,
22691 Clone,
22692 Copy,
22693 Debug,
22694 Eq,
22695 Hash,
22696 Ord,
22697 PartialEq,
22698 PartialOrd
22699)]
22700pub enum ModelObjectObject {
22701 #[serde(rename = "model")]
22702 Model,
22703}
22704impl ::std::fmt::Display for ModelObjectObject {
22705 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
22706 match *self {
22707 Self::Model => f.write_str("model"),
22708 }
22709 }
22710}
22711impl ::std::str::FromStr for ModelObjectObject {
22712 type Err = self::error::ConversionError;
22713 fn from_str(
22714 value: &str,
22715 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22716 match value {
22717 "model" => Ok(Self::Model),
22718 _ => Err("invalid value".into()),
22719 }
22720 }
22721}
22722impl ::std::convert::TryFrom<&str> for ModelObjectObject {
22723 type Error = self::error::ConversionError;
22724 fn try_from(
22725 value: &str,
22726 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22727 value.parse()
22728 }
22729}
22730impl ::std::convert::TryFrom<::std::string::String> for ModelObjectObject {
22731 type Error = self::error::ConversionError;
22732 fn try_from(
22733 value: ::std::string::String,
22734 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22735 value.parse()
22736 }
22737}
22738#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
22740pub struct Output {
22741 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
22743 pub data: ::std::vec::Vec<ModelObject>,
22744 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
22746 pub object: ::std::option::Option<OutputObject>,
22747}
22748impl Output {
22749 pub fn builder() -> builder::Output {
22750 Default::default()
22751 }
22752}
22753#[derive(
22755 ::serde::Deserialize,
22756 ::serde::Serialize,
22757 Clone,
22758 Copy,
22759 Debug,
22760 Eq,
22761 Hash,
22762 Ord,
22763 PartialEq,
22764 PartialOrd
22765)]
22766pub enum OutputObject {
22767 #[serde(rename = "list")]
22768 List,
22769}
22770impl ::std::fmt::Display for OutputObject {
22771 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
22772 match *self {
22773 Self::List => f.write_str("list"),
22774 }
22775 }
22776}
22777impl ::std::str::FromStr for OutputObject {
22778 type Err = self::error::ConversionError;
22779 fn from_str(
22780 value: &str,
22781 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22782 match value {
22783 "list" => Ok(Self::List),
22784 _ => Err("invalid value".into()),
22785 }
22786 }
22787}
22788impl ::std::convert::TryFrom<&str> for OutputObject {
22789 type Error = self::error::ConversionError;
22790 fn try_from(
22791 value: &str,
22792 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22793 value.parse()
22794 }
22795}
22796impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
22797 type Error = self::error::ConversionError;
22798 fn try_from(
22799 value: ::std::string::String,
22800 ) -> ::std::result::Result<Self, self::error::ConversionError> {
22801 value.parse()
22802 }
22803}
22804pub mod builder {
22806 #[derive(Clone, Debug)]
22807 pub struct ModelObject {
22808 created: ::std::result::Result<
22809 ::std::option::Option<i64>,
22810 ::std::string::String,
22811 >,
22812 id: ::std::result::Result<
22813 ::std::option::Option<::std::string::String>,
22814 ::std::string::String,
22815 >,
22816 object: ::std::result::Result<
22817 ::std::option::Option<super::ModelObjectObject>,
22818 ::std::string::String,
22819 >,
22820 owned_by: ::std::result::Result<
22821 ::std::option::Option<::std::string::String>,
22822 ::std::string::String,
22823 >,
22824 }
22825 impl ::std::default::Default for ModelObject {
22826 fn default() -> Self {
22827 Self {
22828 created: Ok(Default::default()),
22829 id: Ok(Default::default()),
22830 object: Ok(Default::default()),
22831 owned_by: Ok(Default::default()),
22832 }
22833 }
22834 }
22835 impl ModelObject {
22836 pub fn created<T>(mut self, value: T) -> Self
22837 where
22838 T: ::std::convert::TryInto<::std::option::Option<i64>>,
22839 T::Error: ::std::fmt::Display,
22840 {
22841 self.created = value
22842 .try_into()
22843 .map_err(|e| {
22844 format!("error converting supplied value for created: {e}")
22845 });
22846 self
22847 }
22848 pub fn id<T>(mut self, value: T) -> Self
22849 where
22850 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22851 T::Error: ::std::fmt::Display,
22852 {
22853 self.id = value
22854 .try_into()
22855 .map_err(|e| format!("error converting supplied value for id: {e}"));
22856 self
22857 }
22858 pub fn object<T>(mut self, value: T) -> Self
22859 where
22860 T: ::std::convert::TryInto<::std::option::Option<super::ModelObjectObject>>,
22861 T::Error: ::std::fmt::Display,
22862 {
22863 self.object = value
22864 .try_into()
22865 .map_err(|e| format!("error converting supplied value for object: {e}"));
22866 self
22867 }
22868 pub fn owned_by<T>(mut self, value: T) -> Self
22869 where
22870 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
22871 T::Error: ::std::fmt::Display,
22872 {
22873 self.owned_by = value
22874 .try_into()
22875 .map_err(|e| {
22876 format!("error converting supplied value for owned_by: {e}")
22877 });
22878 self
22879 }
22880 }
22881 impl ::std::convert::TryFrom<ModelObject> for super::ModelObject {
22882 type Error = super::error::ConversionError;
22883 fn try_from(
22884 value: ModelObject,
22885 ) -> ::std::result::Result<Self, super::error::ConversionError> {
22886 Ok(Self {
22887 created: value.created?,
22888 id: value.id?,
22889 object: value.object?,
22890 owned_by: value.owned_by?,
22891 })
22892 }
22893 }
22894 impl ::std::convert::From<super::ModelObject> for ModelObject {
22895 fn from(value: super::ModelObject) -> Self {
22896 Self {
22897 created: Ok(value.created),
22898 id: Ok(value.id),
22899 object: Ok(value.object),
22900 owned_by: Ok(value.owned_by),
22901 }
22902 }
22903 }
22904 #[derive(Clone, Debug)]
22905 pub struct Output {
22906 data: ::std::result::Result<
22907 ::std::vec::Vec<super::ModelObject>,
22908 ::std::string::String,
22909 >,
22910 object: ::std::result::Result<
22911 ::std::option::Option<super::OutputObject>,
22912 ::std::string::String,
22913 >,
22914 }
22915 impl ::std::default::Default for Output {
22916 fn default() -> Self {
22917 Self {
22918 data: Ok(Default::default()),
22919 object: Ok(Default::default()),
22920 }
22921 }
22922 }
22923 impl Output {
22924 pub fn data<T>(mut self, value: T) -> Self
22925 where
22926 T: ::std::convert::TryInto<::std::vec::Vec<super::ModelObject>>,
22927 T::Error: ::std::fmt::Display,
22928 {
22929 self.data = value
22930 .try_into()
22931 .map_err(|e| format!("error converting supplied value for data: {e}"));
22932 self
22933 }
22934 pub fn object<T>(mut self, value: T) -> Self
22935 where
22936 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
22937 T::Error: ::std::fmt::Display,
22938 {
22939 self.object = value
22940 .try_into()
22941 .map_err(|e| format!("error converting supplied value for object: {e}"));
22942 self
22943 }
22944 }
22945 impl ::std::convert::TryFrom<Output> for super::Output {
22946 type Error = super::error::ConversionError;
22947 fn try_from(
22948 value: Output,
22949 ) -> ::std::result::Result<Self, super::error::ConversionError> {
22950 Ok(Self {
22951 data: value.data?,
22952 object: value.object?,
22953 })
22954 }
22955 }
22956 impl ::std::convert::From<super::Output> for Output {
22957 fn from(value: super::Output) -> Self {
22958 Self {
22959 data: Ok(value.data),
22960 object: Ok(value.object),
22961 }
22962 }
22963 }
22964}
22965pub mod error {
22967 pub struct ConversionError(::std::borrow::Cow<'static, str>);
22969 impl ::std::error::Error for ConversionError {}
22970 impl ::std::fmt::Display for ConversionError {
22971 fn fmt(
22972 &self,
22973 f: &mut ::std::fmt::Formatter<'_>,
22974 ) -> Result<(), ::std::fmt::Error> {
22975 ::std::fmt::Display::fmt(&self.0, f)
22976 }
22977 }
22978 impl ::std::fmt::Debug for ConversionError {
22979 fn fmt(
22980 &self,
22981 f: &mut ::std::fmt::Formatter<'_>,
22982 ) -> Result<(), ::std::fmt::Error> {
22983 ::std::fmt::Debug::fmt(&self.0, f)
22984 }
22985 }
22986 impl From<&'static str> for ConversionError {
22987 fn from(value: &'static str) -> Self {
22988 Self(value.into())
22989 }
22990 }
22991 impl From<String> for ConversionError {
22992 fn from(value: String) -> Self {
22993 Self(value.into())
22994 }
22995 }
22996}
22997
22998}
22999
23000 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[], required_parts: &[] };
23002
23003 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
23010 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C_mphGA::NM3qTBtiRKKKrFiCZw5WlA", Method::GET, "/v1/models").with_routed(&input, &ROUTING)?
23011 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
23012 }
23013
23014 impl IntoOperation for Input {
23015 type Output = output::Output;
23016
23017 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
23018 build(self)
23019 }
23020 }
23021 impl IntoOperation for builder::Input {
23022 type Output = output::Output;
23023
23024 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
23025 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
23026 }
23027 }
23028}
23029pub fn list_available_agent_api_models() -> list_available_agent_api_models::builder::Input {
23031 list_available_agent_api_models::builder::Input::default()
23032}
23033pub mod cancel_agent_response {
23034 use ::one::{Error, IntoOperation, Method, Operation};
23035#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
23037#[serde(deny_unknown_fields)]
23038pub struct Input {
23039 pub id: InputId,
23041}
23042impl Input {
23043 pub fn builder() -> builder::Input {
23044 Default::default()
23045 }
23046}
23047#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23049#[serde(transparent)]
23050pub struct InputId(::std::string::String);
23051impl ::std::ops::Deref for InputId {
23052 type Target = ::std::string::String;
23053 fn deref(&self) -> &::std::string::String {
23054 &self.0
23055 }
23056}
23057impl ::std::convert::From<InputId> for ::std::string::String {
23058 fn from(value: InputId) -> Self {
23059 value.0
23060 }
23061}
23062impl ::std::str::FromStr for InputId {
23063 type Err = self::error::ConversionError;
23064 fn from_str(
23065 value: &str,
23066 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23067 ::std::convert::TryFrom::try_from(value)
23068 }
23069}
23070impl ::std::convert::TryFrom<&str> for InputId {
23071 type Error = self::error::ConversionError;
23072 fn try_from(
23073 value: &str,
23074 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23075 if value.chars().count() < 1usize {
23076 return Err("shorter than 1 characters".into());
23077 }
23078 static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(||
23079 { ::regress::Regex::with_flags("^resp_.+$", "u").unwrap() });
23080 if PATTERN.find(value).is_none() {
23081 return Err("doesn't match pattern \"^resp_.+$\"".into());
23082 }
23083 Ok(Self(value.to_string()))
23084 }
23085}
23086impl ::std::convert::TryFrom<::std::string::String> for InputId {
23087 type Error = self::error::ConversionError;
23088 fn try_from(
23089 value: ::std::string::String,
23090 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23091 ::std::convert::TryFrom::try_from(value.as_str())
23092 }
23093}
23094impl<'de> ::serde::Deserialize<'de> for InputId {
23095 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
23096 where
23097 D: ::serde::Deserializer<'de>,
23098 {
23099 ::std::convert::TryFrom::try_from(
23100 ::std::string::String::deserialize(deserializer)?,
23101 )
23102 .map_err(|e: self::error::ConversionError| {
23103 <D::Error as ::serde::de::Error>::custom(e.to_string())
23104 })
23105 }
23106}
23107pub mod builder {
23109 #[derive(Clone, Debug)]
23110 pub struct Input {
23111 id: ::std::result::Result<super::InputId, ::std::string::String>,
23112 }
23113 impl ::std::default::Default for Input {
23114 fn default() -> Self {
23115 Self {
23116 id: Err("no value supplied for id".to_string()),
23117 }
23118 }
23119 }
23120 impl Input {
23121 pub fn id<T>(mut self, value: T) -> Self
23122 where
23123 T: ::std::convert::TryInto<super::InputId>,
23124 T::Error: ::std::fmt::Display,
23125 {
23126 self.id = value
23127 .try_into()
23128 .map_err(|e| format!("error converting supplied value for id: {e}"));
23129 self
23130 }
23131 }
23132 impl ::std::convert::TryFrom<Input> for super::Input {
23133 type Error = super::error::ConversionError;
23134 fn try_from(
23135 value: Input,
23136 ) -> ::std::result::Result<Self, super::error::ConversionError> {
23137 Ok(Self { id: value.id? })
23138 }
23139 }
23140 impl ::std::convert::From<super::Input> for Input {
23141 fn from(value: super::Input) -> Self {
23142 Self { id: Ok(value.id) }
23143 }
23144 }
23145}
23146pub mod error {
23148 pub struct ConversionError(::std::borrow::Cow<'static, str>);
23150 impl ::std::error::Error for ConversionError {}
23151 impl ::std::fmt::Display for ConversionError {
23152 fn fmt(
23153 &self,
23154 f: &mut ::std::fmt::Formatter<'_>,
23155 ) -> Result<(), ::std::fmt::Error> {
23156 ::std::fmt::Display::fmt(&self.0, f)
23157 }
23158 }
23159 impl ::std::fmt::Debug for ConversionError {
23160 fn fmt(
23161 &self,
23162 f: &mut ::std::fmt::Formatter<'_>,
23163 ) -> Result<(), ::std::fmt::Error> {
23164 ::std::fmt::Debug::fmt(&self.0, f)
23165 }
23166 }
23167 impl From<&'static str> for ConversionError {
23168 fn from(value: &'static str) -> Self {
23169 Self(value.into())
23170 }
23171 }
23172 impl From<String> for ConversionError {
23173 fn from(value: String) -> Self {
23174 Self(value.into())
23175 }
23176 }
23177}
23178
23179pub mod output {
23180#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
23182pub struct Error {
23183 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23185 pub code: ::std::option::Option<ErrorCode>,
23186 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23188 pub message: ::std::option::Option<::std::string::String>,
23189 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
23191 pub type_: ::std::option::Option<ErrorType>,
23192}
23193impl Error {
23194 pub fn builder() -> builder::Error {
23195 Default::default()
23196 }
23197}
23198#[derive(
23200 ::serde::Deserialize,
23201 ::serde::Serialize,
23202 Clone,
23203 Copy,
23204 Debug,
23205 Eq,
23206 Hash,
23207 Ord,
23208 PartialEq,
23209 PartialOrd
23210)]
23211pub enum ErrorCode {
23212 #[serde(rename = "invalid_request")]
23213 InvalidRequest,
23214 #[serde(rename = "not_found")]
23215 NotFound,
23216}
23217impl ::std::fmt::Display for ErrorCode {
23218 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
23219 match *self {
23220 Self::InvalidRequest => f.write_str("invalid_request"),
23221 Self::NotFound => f.write_str("not_found"),
23222 }
23223 }
23224}
23225impl ::std::str::FromStr for ErrorCode {
23226 type Err = self::error::ConversionError;
23227 fn from_str(
23228 value: &str,
23229 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23230 match value {
23231 "invalid_request" => Ok(Self::InvalidRequest),
23232 "not_found" => Ok(Self::NotFound),
23233 _ => Err("invalid value".into()),
23234 }
23235 }
23236}
23237impl ::std::convert::TryFrom<&str> for ErrorCode {
23238 type Error = self::error::ConversionError;
23239 fn try_from(
23240 value: &str,
23241 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23242 value.parse()
23243 }
23244}
23245impl ::std::convert::TryFrom<::std::string::String> for ErrorCode {
23246 type Error = self::error::ConversionError;
23247 fn try_from(
23248 value: ::std::string::String,
23249 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23250 value.parse()
23251 }
23252}
23253#[derive(
23255 ::serde::Deserialize,
23256 ::serde::Serialize,
23257 Clone,
23258 Copy,
23259 Debug,
23260 Eq,
23261 Hash,
23262 Ord,
23263 PartialEq,
23264 PartialOrd
23265)]
23266pub enum ErrorType {
23267 #[serde(rename = "invalid_request_error")]
23268 InvalidRequestError,
23269 #[serde(rename = "not_found_error")]
23270 NotFoundError,
23271}
23272impl ::std::fmt::Display for ErrorType {
23273 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
23274 match *self {
23275 Self::InvalidRequestError => f.write_str("invalid_request_error"),
23276 Self::NotFoundError => f.write_str("not_found_error"),
23277 }
23278 }
23279}
23280impl ::std::str::FromStr for ErrorType {
23281 type Err = self::error::ConversionError;
23282 fn from_str(
23283 value: &str,
23284 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23285 match value {
23286 "invalid_request_error" => Ok(Self::InvalidRequestError),
23287 "not_found_error" => Ok(Self::NotFoundError),
23288 _ => Err("invalid value".into()),
23289 }
23290 }
23291}
23292impl ::std::convert::TryFrom<&str> for ErrorType {
23293 type Error = self::error::ConversionError;
23294 fn try_from(
23295 value: &str,
23296 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23297 value.parse()
23298 }
23299}
23300impl ::std::convert::TryFrom<::std::string::String> for ErrorType {
23301 type Error = self::error::ConversionError;
23302 fn try_from(
23303 value: ::std::string::String,
23304 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23305 value.parse()
23306 }
23307}
23308#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
23310pub struct Output {
23311 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23312 pub error: ::std::option::Option<Error>,
23313 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23315 pub response_id: ::std::option::Option<OutputResponseId>,
23316 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23318 pub status: ::std::option::Option<OutputStatus>,
23319}
23320impl Output {
23321 pub fn builder() -> builder::Output {
23322 Default::default()
23323 }
23324}
23325#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23327#[serde(transparent)]
23328pub struct OutputResponseId(::std::string::String);
23329impl ::std::ops::Deref for OutputResponseId {
23330 type Target = ::std::string::String;
23331 fn deref(&self) -> &::std::string::String {
23332 &self.0
23333 }
23334}
23335impl ::std::convert::From<OutputResponseId> for ::std::string::String {
23336 fn from(value: OutputResponseId) -> Self {
23337 value.0
23338 }
23339}
23340impl ::std::str::FromStr for OutputResponseId {
23341 type Err = self::error::ConversionError;
23342 fn from_str(
23343 value: &str,
23344 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23345 ::std::convert::TryFrom::try_from(value)
23346 }
23347}
23348impl ::std::convert::TryFrom<&str> for OutputResponseId {
23349 type Error = self::error::ConversionError;
23350 fn try_from(
23351 value: &str,
23352 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23353 static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(||
23354 { ::regress::Regex::with_flags("^resp_.+$", "u").unwrap() });
23355 if PATTERN.find(value).is_none() {
23356 return Err("doesn't match pattern \"^resp_.+$\"".into());
23357 }
23358 Ok(Self(value.to_string()))
23359 }
23360}
23361impl ::std::convert::TryFrom<::std::string::String> for OutputResponseId {
23362 type Error = self::error::ConversionError;
23363 fn try_from(
23364 value: ::std::string::String,
23365 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23366 ::std::convert::TryFrom::try_from(value.as_str())
23367 }
23368}
23369impl<'de> ::serde::Deserialize<'de> for OutputResponseId {
23370 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
23371 where
23372 D: ::serde::Deserializer<'de>,
23373 {
23374 ::std::convert::TryFrom::try_from(
23375 ::std::string::String::deserialize(deserializer)?,
23376 )
23377 .map_err(|e: self::error::ConversionError| {
23378 <D::Error as ::serde::de::Error>::custom(e.to_string())
23379 })
23380 }
23381}
23382#[derive(
23384 ::serde::Deserialize,
23385 ::serde::Serialize,
23386 Clone,
23387 Copy,
23388 Debug,
23389 Eq,
23390 Hash,
23391 Ord,
23392 PartialEq,
23393 PartialOrd
23394)]
23395pub enum OutputStatus {
23396 #[serde(rename = "cancelling")]
23397 Cancelling,
23398}
23399impl ::std::fmt::Display for OutputStatus {
23400 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
23401 match *self {
23402 Self::Cancelling => f.write_str("cancelling"),
23403 }
23404 }
23405}
23406impl ::std::str::FromStr for OutputStatus {
23407 type Err = self::error::ConversionError;
23408 fn from_str(
23409 value: &str,
23410 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23411 match value {
23412 "cancelling" => Ok(Self::Cancelling),
23413 _ => Err("invalid value".into()),
23414 }
23415 }
23416}
23417impl ::std::convert::TryFrom<&str> for OutputStatus {
23418 type Error = self::error::ConversionError;
23419 fn try_from(
23420 value: &str,
23421 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23422 value.parse()
23423 }
23424}
23425impl ::std::convert::TryFrom<::std::string::String> for OutputStatus {
23426 type Error = self::error::ConversionError;
23427 fn try_from(
23428 value: ::std::string::String,
23429 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23430 value.parse()
23431 }
23432}
23433pub mod builder {
23435 #[derive(Clone, Debug)]
23436 pub struct Error {
23437 code: ::std::result::Result<
23438 ::std::option::Option<super::ErrorCode>,
23439 ::std::string::String,
23440 >,
23441 message: ::std::result::Result<
23442 ::std::option::Option<::std::string::String>,
23443 ::std::string::String,
23444 >,
23445 type_: ::std::result::Result<
23446 ::std::option::Option<super::ErrorType>,
23447 ::std::string::String,
23448 >,
23449 }
23450 impl ::std::default::Default for Error {
23451 fn default() -> Self {
23452 Self {
23453 code: Ok(Default::default()),
23454 message: Ok(Default::default()),
23455 type_: Ok(Default::default()),
23456 }
23457 }
23458 }
23459 impl Error {
23460 pub fn code<T>(mut self, value: T) -> Self
23461 where
23462 T: ::std::convert::TryInto<::std::option::Option<super::ErrorCode>>,
23463 T::Error: ::std::fmt::Display,
23464 {
23465 self.code = value
23466 .try_into()
23467 .map_err(|e| format!("error converting supplied value for code: {e}"));
23468 self
23469 }
23470 pub fn message<T>(mut self, value: T) -> Self
23471 where
23472 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
23473 T::Error: ::std::fmt::Display,
23474 {
23475 self.message = value
23476 .try_into()
23477 .map_err(|e| {
23478 format!("error converting supplied value for message: {e}")
23479 });
23480 self
23481 }
23482 pub fn type_<T>(mut self, value: T) -> Self
23483 where
23484 T: ::std::convert::TryInto<::std::option::Option<super::ErrorType>>,
23485 T::Error: ::std::fmt::Display,
23486 {
23487 self.type_ = value
23488 .try_into()
23489 .map_err(|e| format!("error converting supplied value for type_: {e}"));
23490 self
23491 }
23492 }
23493 impl ::std::convert::TryFrom<Error> for super::Error {
23494 type Error = super::error::ConversionError;
23495 fn try_from(
23496 value: Error,
23497 ) -> ::std::result::Result<Self, super::error::ConversionError> {
23498 Ok(Self {
23499 code: value.code?,
23500 message: value.message?,
23501 type_: value.type_?,
23502 })
23503 }
23504 }
23505 impl ::std::convert::From<super::Error> for Error {
23506 fn from(value: super::Error) -> Self {
23507 Self {
23508 code: Ok(value.code),
23509 message: Ok(value.message),
23510 type_: Ok(value.type_),
23511 }
23512 }
23513 }
23514 #[derive(Clone, Debug)]
23515 pub struct Output {
23516 error: ::std::result::Result<
23517 ::std::option::Option<super::Error>,
23518 ::std::string::String,
23519 >,
23520 response_id: ::std::result::Result<
23521 ::std::option::Option<super::OutputResponseId>,
23522 ::std::string::String,
23523 >,
23524 status: ::std::result::Result<
23525 ::std::option::Option<super::OutputStatus>,
23526 ::std::string::String,
23527 >,
23528 }
23529 impl ::std::default::Default for Output {
23530 fn default() -> Self {
23531 Self {
23532 error: Ok(Default::default()),
23533 response_id: Ok(Default::default()),
23534 status: Ok(Default::default()),
23535 }
23536 }
23537 }
23538 impl Output {
23539 pub fn error<T>(mut self, value: T) -> Self
23540 where
23541 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
23542 T::Error: ::std::fmt::Display,
23543 {
23544 self.error = value
23545 .try_into()
23546 .map_err(|e| format!("error converting supplied value for error: {e}"));
23547 self
23548 }
23549 pub fn response_id<T>(mut self, value: T) -> Self
23550 where
23551 T: ::std::convert::TryInto<::std::option::Option<super::OutputResponseId>>,
23552 T::Error: ::std::fmt::Display,
23553 {
23554 self.response_id = value
23555 .try_into()
23556 .map_err(|e| {
23557 format!("error converting supplied value for response_id: {e}")
23558 });
23559 self
23560 }
23561 pub fn status<T>(mut self, value: T) -> Self
23562 where
23563 T: ::std::convert::TryInto<::std::option::Option<super::OutputStatus>>,
23564 T::Error: ::std::fmt::Display,
23565 {
23566 self.status = value
23567 .try_into()
23568 .map_err(|e| format!("error converting supplied value for status: {e}"));
23569 self
23570 }
23571 }
23572 impl ::std::convert::TryFrom<Output> for super::Output {
23573 type Error = super::error::ConversionError;
23574 fn try_from(
23575 value: Output,
23576 ) -> ::std::result::Result<Self, super::error::ConversionError> {
23577 Ok(Self {
23578 error: value.error?,
23579 response_id: value.response_id?,
23580 status: value.status?,
23581 })
23582 }
23583 }
23584 impl ::std::convert::From<super::Output> for Output {
23585 fn from(value: super::Output) -> Self {
23586 Self {
23587 error: Ok(value.error),
23588 response_id: Ok(value.response_id),
23589 status: Ok(value.status),
23590 }
23591 }
23592 }
23593}
23594pub mod error {
23596 pub struct ConversionError(::std::borrow::Cow<'static, str>);
23598 impl ::std::error::Error for ConversionError {}
23599 impl ::std::fmt::Display for ConversionError {
23600 fn fmt(
23601 &self,
23602 f: &mut ::std::fmt::Formatter<'_>,
23603 ) -> Result<(), ::std::fmt::Error> {
23604 ::std::fmt::Display::fmt(&self.0, f)
23605 }
23606 }
23607 impl ::std::fmt::Debug for ConversionError {
23608 fn fmt(
23609 &self,
23610 f: &mut ::std::fmt::Formatter<'_>,
23611 ) -> Result<(), ::std::fmt::Error> {
23612 ::std::fmt::Debug::fmt(&self.0, f)
23613 }
23614 }
23615 impl From<&'static str> for ConversionError {
23616 fn from(value: &'static str) -> Self {
23617 Self(value.into())
23618 }
23619 }
23620 impl From<String> for ConversionError {
23621 fn from(value: String) -> Self {
23622 Self(value.into())
23623 }
23624 }
23625}
23626
23627}
23628
23629 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "id", part: ::one::Part::Path, key: Some("id") }], required_parts: &[::one::Part::Path] };
23631
23632 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
23641 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C_ow__g::-HDfrxXrRLKWMZR_WKA_nA", Method::POST, "/v1/agent/{{id}}/cancel").with_routed(&input, &ROUTING)?
23642 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
23643 }
23644
23645 impl IntoOperation for Input {
23646 type Output = output::Output;
23647
23648 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
23649 build(self)
23650 }
23651 }
23652 impl IntoOperation for builder::Input {
23653 type Output = output::Output;
23654
23655 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
23656 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
23657 }
23658 }
23659}
23660pub fn cancel_agent_response() -> cancel_agent_response::builder::Input {
23662 cancel_agent_response::builder::Input::default()
23663}
23664pub mod download_agent_response_file {
23665 use ::one::{Error, IntoOperation, Method, Operation};
23666#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
23668#[serde(deny_unknown_fields)]
23669pub struct Input {
23670 #[serde(rename = "fileId")]
23672 pub file_id: InputFileId,
23673 pub id: InputId,
23675}
23676impl Input {
23677 pub fn builder() -> builder::Input {
23678 Default::default()
23679 }
23680}
23681#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23683#[serde(transparent)]
23684pub struct InputFileId(::std::string::String);
23685impl ::std::ops::Deref for InputFileId {
23686 type Target = ::std::string::String;
23687 fn deref(&self) -> &::std::string::String {
23688 &self.0
23689 }
23690}
23691impl ::std::convert::From<InputFileId> for ::std::string::String {
23692 fn from(value: InputFileId) -> Self {
23693 value.0
23694 }
23695}
23696impl ::std::str::FromStr for InputFileId {
23697 type Err = self::error::ConversionError;
23698 fn from_str(
23699 value: &str,
23700 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23701 ::std::convert::TryFrom::try_from(value)
23702 }
23703}
23704impl ::std::convert::TryFrom<&str> for InputFileId {
23705 type Error = self::error::ConversionError;
23706 fn try_from(
23707 value: &str,
23708 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23709 if value.chars().count() < 1usize {
23710 return Err("shorter than 1 characters".into());
23711 }
23712 Ok(Self(value.to_string()))
23713 }
23714}
23715impl ::std::convert::TryFrom<::std::string::String> for InputFileId {
23716 type Error = self::error::ConversionError;
23717 fn try_from(
23718 value: ::std::string::String,
23719 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23720 ::std::convert::TryFrom::try_from(value.as_str())
23721 }
23722}
23723impl<'de> ::serde::Deserialize<'de> for InputFileId {
23724 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
23725 where
23726 D: ::serde::Deserializer<'de>,
23727 {
23728 ::std::convert::TryFrom::try_from(
23729 ::std::string::String::deserialize(deserializer)?,
23730 )
23731 .map_err(|e: self::error::ConversionError| {
23732 <D::Error as ::serde::de::Error>::custom(e.to_string())
23733 })
23734 }
23735}
23736#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23738#[serde(transparent)]
23739pub struct InputId(::std::string::String);
23740impl ::std::ops::Deref for InputId {
23741 type Target = ::std::string::String;
23742 fn deref(&self) -> &::std::string::String {
23743 &self.0
23744 }
23745}
23746impl ::std::convert::From<InputId> for ::std::string::String {
23747 fn from(value: InputId) -> Self {
23748 value.0
23749 }
23750}
23751impl ::std::str::FromStr for InputId {
23752 type Err = self::error::ConversionError;
23753 fn from_str(
23754 value: &str,
23755 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23756 ::std::convert::TryFrom::try_from(value)
23757 }
23758}
23759impl ::std::convert::TryFrom<&str> for InputId {
23760 type Error = self::error::ConversionError;
23761 fn try_from(
23762 value: &str,
23763 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23764 if value.chars().count() < 1usize {
23765 return Err("shorter than 1 characters".into());
23766 }
23767 static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(||
23768 { ::regress::Regex::with_flags("^resp_.+", "u").unwrap() });
23769 if PATTERN.find(value).is_none() {
23770 return Err("doesn't match pattern \"^resp_.+\"".into());
23771 }
23772 Ok(Self(value.to_string()))
23773 }
23774}
23775impl ::std::convert::TryFrom<::std::string::String> for InputId {
23776 type Error = self::error::ConversionError;
23777 fn try_from(
23778 value: ::std::string::String,
23779 ) -> ::std::result::Result<Self, self::error::ConversionError> {
23780 ::std::convert::TryFrom::try_from(value.as_str())
23781 }
23782}
23783impl<'de> ::serde::Deserialize<'de> for InputId {
23784 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
23785 where
23786 D: ::serde::Deserializer<'de>,
23787 {
23788 ::std::convert::TryFrom::try_from(
23789 ::std::string::String::deserialize(deserializer)?,
23790 )
23791 .map_err(|e: self::error::ConversionError| {
23792 <D::Error as ::serde::de::Error>::custom(e.to_string())
23793 })
23794 }
23795}
23796pub mod builder {
23798 #[derive(Clone, Debug)]
23799 pub struct Input {
23800 file_id: ::std::result::Result<super::InputFileId, ::std::string::String>,
23801 id: ::std::result::Result<super::InputId, ::std::string::String>,
23802 }
23803 impl ::std::default::Default for Input {
23804 fn default() -> Self {
23805 Self {
23806 file_id: Err("no value supplied for file_id".to_string()),
23807 id: Err("no value supplied for id".to_string()),
23808 }
23809 }
23810 }
23811 impl Input {
23812 pub fn file_id<T>(mut self, value: T) -> Self
23813 where
23814 T: ::std::convert::TryInto<super::InputFileId>,
23815 T::Error: ::std::fmt::Display,
23816 {
23817 self.file_id = value
23818 .try_into()
23819 .map_err(|e| {
23820 format!("error converting supplied value for file_id: {e}")
23821 });
23822 self
23823 }
23824 pub fn id<T>(mut self, value: T) -> Self
23825 where
23826 T: ::std::convert::TryInto<super::InputId>,
23827 T::Error: ::std::fmt::Display,
23828 {
23829 self.id = value
23830 .try_into()
23831 .map_err(|e| format!("error converting supplied value for id: {e}"));
23832 self
23833 }
23834 }
23835 impl ::std::convert::TryFrom<Input> for super::Input {
23836 type Error = super::error::ConversionError;
23837 fn try_from(
23838 value: Input,
23839 ) -> ::std::result::Result<Self, super::error::ConversionError> {
23840 Ok(Self {
23841 file_id: value.file_id?,
23842 id: value.id?,
23843 })
23844 }
23845 }
23846 impl ::std::convert::From<super::Input> for Input {
23847 fn from(value: super::Input) -> Self {
23848 Self {
23849 file_id: Ok(value.file_id),
23850 id: Ok(value.id),
23851 }
23852 }
23853 }
23854}
23855pub mod error {
23857 pub struct ConversionError(::std::borrow::Cow<'static, str>);
23859 impl ::std::error::Error for ConversionError {}
23860 impl ::std::fmt::Display for ConversionError {
23861 fn fmt(
23862 &self,
23863 f: &mut ::std::fmt::Formatter<'_>,
23864 ) -> Result<(), ::std::fmt::Error> {
23865 ::std::fmt::Display::fmt(&self.0, f)
23866 }
23867 }
23868 impl ::std::fmt::Debug for ConversionError {
23869 fn fmt(
23870 &self,
23871 f: &mut ::std::fmt::Formatter<'_>,
23872 ) -> Result<(), ::std::fmt::Error> {
23873 ::std::fmt::Debug::fmt(&self.0, f)
23874 }
23875 }
23876 impl From<&'static str> for ConversionError {
23877 fn from(value: &'static str) -> Self {
23878 Self(value.into())
23879 }
23880 }
23881 impl From<String> for ConversionError {
23882 fn from(value: String) -> Self {
23883 Self(value.into())
23884 }
23885 }
23886}
23887
23888pub mod output {
23889#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
23891pub struct Error {
23892 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23894 pub code: ::std::option::Option<::std::string::String>,
23895 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23897 pub message: ::std::option::Option<::std::string::String>,
23898 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
23900 pub type_: ::std::option::Option<::std::string::String>,
23901}
23902impl Error {
23903 pub fn builder() -> builder::Error {
23904 Default::default()
23905 }
23906}
23907#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
23909pub struct Output {
23910 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23912 pub body: ::std::option::Option<OutputBody>,
23913 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23914 pub headers: ::std::option::Option<ResponseHeaders>,
23915 #[serde(
23917 rename = "statusCode",
23918 skip_serializing_if = "::std::option::Option::is_none"
23919 )]
23920 pub status_code: ::std::option::Option<i64>,
23921}
23922impl Output {
23923 pub fn builder() -> builder::Output {
23924 Default::default()
23925 }
23926}
23927#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
23929#[serde(untagged)]
23930pub enum OutputBody {
23931 BinaryFileContent(::std::string::String),
23932 ErrorResponseBody {
23933 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
23934 error: ::std::option::Option<Error>,
23935 },
23936}
23937#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
23939pub struct ResponseHeaders {
23940 #[serde(
23942 rename = "Content-Disposition",
23943 skip_serializing_if = "::std::option::Option::is_none"
23944 )]
23945 pub content_disposition: ::std::option::Option<::std::string::String>,
23946 #[serde(
23948 rename = "Content-Type",
23949 skip_serializing_if = "::std::option::Option::is_none"
23950 )]
23951 pub content_type: ::std::option::Option<::std::string::String>,
23952}
23953impl ResponseHeaders {
23954 pub fn builder() -> builder::ResponseHeaders {
23955 Default::default()
23956 }
23957}
23958pub mod builder {
23960 #[derive(Clone, Debug)]
23961 pub struct Error {
23962 code: ::std::result::Result<
23963 ::std::option::Option<::std::string::String>,
23964 ::std::string::String,
23965 >,
23966 message: ::std::result::Result<
23967 ::std::option::Option<::std::string::String>,
23968 ::std::string::String,
23969 >,
23970 type_: ::std::result::Result<
23971 ::std::option::Option<::std::string::String>,
23972 ::std::string::String,
23973 >,
23974 }
23975 impl ::std::default::Default for Error {
23976 fn default() -> Self {
23977 Self {
23978 code: Ok(Default::default()),
23979 message: Ok(Default::default()),
23980 type_: Ok(Default::default()),
23981 }
23982 }
23983 }
23984 impl Error {
23985 pub fn code<T>(mut self, value: T) -> Self
23986 where
23987 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
23988 T::Error: ::std::fmt::Display,
23989 {
23990 self.code = value
23991 .try_into()
23992 .map_err(|e| format!("error converting supplied value for code: {e}"));
23993 self
23994 }
23995 pub fn message<T>(mut self, value: T) -> Self
23996 where
23997 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
23998 T::Error: ::std::fmt::Display,
23999 {
24000 self.message = value
24001 .try_into()
24002 .map_err(|e| {
24003 format!("error converting supplied value for message: {e}")
24004 });
24005 self
24006 }
24007 pub fn type_<T>(mut self, value: T) -> Self
24008 where
24009 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24010 T::Error: ::std::fmt::Display,
24011 {
24012 self.type_ = value
24013 .try_into()
24014 .map_err(|e| format!("error converting supplied value for type_: {e}"));
24015 self
24016 }
24017 }
24018 impl ::std::convert::TryFrom<Error> for super::Error {
24019 type Error = super::error::ConversionError;
24020 fn try_from(
24021 value: Error,
24022 ) -> ::std::result::Result<Self, super::error::ConversionError> {
24023 Ok(Self {
24024 code: value.code?,
24025 message: value.message?,
24026 type_: value.type_?,
24027 })
24028 }
24029 }
24030 impl ::std::convert::From<super::Error> for Error {
24031 fn from(value: super::Error) -> Self {
24032 Self {
24033 code: Ok(value.code),
24034 message: Ok(value.message),
24035 type_: Ok(value.type_),
24036 }
24037 }
24038 }
24039 #[derive(Clone, Debug)]
24040 pub struct Output {
24041 body: ::std::result::Result<
24042 ::std::option::Option<super::OutputBody>,
24043 ::std::string::String,
24044 >,
24045 headers: ::std::result::Result<
24046 ::std::option::Option<super::ResponseHeaders>,
24047 ::std::string::String,
24048 >,
24049 status_code: ::std::result::Result<
24050 ::std::option::Option<i64>,
24051 ::std::string::String,
24052 >,
24053 }
24054 impl ::std::default::Default for Output {
24055 fn default() -> Self {
24056 Self {
24057 body: Ok(Default::default()),
24058 headers: Ok(Default::default()),
24059 status_code: Ok(Default::default()),
24060 }
24061 }
24062 }
24063 impl Output {
24064 pub fn body<T>(mut self, value: T) -> Self
24065 where
24066 T: ::std::convert::TryInto<::std::option::Option<super::OutputBody>>,
24067 T::Error: ::std::fmt::Display,
24068 {
24069 self.body = value
24070 .try_into()
24071 .map_err(|e| format!("error converting supplied value for body: {e}"));
24072 self
24073 }
24074 pub fn headers<T>(mut self, value: T) -> Self
24075 where
24076 T: ::std::convert::TryInto<::std::option::Option<super::ResponseHeaders>>,
24077 T::Error: ::std::fmt::Display,
24078 {
24079 self.headers = value
24080 .try_into()
24081 .map_err(|e| {
24082 format!("error converting supplied value for headers: {e}")
24083 });
24084 self
24085 }
24086 pub fn status_code<T>(mut self, value: T) -> Self
24087 where
24088 T: ::std::convert::TryInto<::std::option::Option<i64>>,
24089 T::Error: ::std::fmt::Display,
24090 {
24091 self.status_code = value
24092 .try_into()
24093 .map_err(|e| {
24094 format!("error converting supplied value for status_code: {e}")
24095 });
24096 self
24097 }
24098 }
24099 impl ::std::convert::TryFrom<Output> for super::Output {
24100 type Error = super::error::ConversionError;
24101 fn try_from(
24102 value: Output,
24103 ) -> ::std::result::Result<Self, super::error::ConversionError> {
24104 Ok(Self {
24105 body: value.body?,
24106 headers: value.headers?,
24107 status_code: value.status_code?,
24108 })
24109 }
24110 }
24111 impl ::std::convert::From<super::Output> for Output {
24112 fn from(value: super::Output) -> Self {
24113 Self {
24114 body: Ok(value.body),
24115 headers: Ok(value.headers),
24116 status_code: Ok(value.status_code),
24117 }
24118 }
24119 }
24120 #[derive(Clone, Debug)]
24121 pub struct ResponseHeaders {
24122 content_disposition: ::std::result::Result<
24123 ::std::option::Option<::std::string::String>,
24124 ::std::string::String,
24125 >,
24126 content_type: ::std::result::Result<
24127 ::std::option::Option<::std::string::String>,
24128 ::std::string::String,
24129 >,
24130 }
24131 impl ::std::default::Default for ResponseHeaders {
24132 fn default() -> Self {
24133 Self {
24134 content_disposition: Ok(Default::default()),
24135 content_type: Ok(Default::default()),
24136 }
24137 }
24138 }
24139 impl ResponseHeaders {
24140 pub fn content_disposition<T>(mut self, value: T) -> Self
24141 where
24142 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24143 T::Error: ::std::fmt::Display,
24144 {
24145 self.content_disposition = value
24146 .try_into()
24147 .map_err(|e| {
24148 format!(
24149 "error converting supplied value for content_disposition: {e}"
24150 )
24151 });
24152 self
24153 }
24154 pub fn content_type<T>(mut self, value: T) -> Self
24155 where
24156 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24157 T::Error: ::std::fmt::Display,
24158 {
24159 self.content_type = value
24160 .try_into()
24161 .map_err(|e| {
24162 format!("error converting supplied value for content_type: {e}")
24163 });
24164 self
24165 }
24166 }
24167 impl ::std::convert::TryFrom<ResponseHeaders> for super::ResponseHeaders {
24168 type Error = super::error::ConversionError;
24169 fn try_from(
24170 value: ResponseHeaders,
24171 ) -> ::std::result::Result<Self, super::error::ConversionError> {
24172 Ok(Self {
24173 content_disposition: value.content_disposition?,
24174 content_type: value.content_type?,
24175 })
24176 }
24177 }
24178 impl ::std::convert::From<super::ResponseHeaders> for ResponseHeaders {
24179 fn from(value: super::ResponseHeaders) -> Self {
24180 Self {
24181 content_disposition: Ok(value.content_disposition),
24182 content_type: Ok(value.content_type),
24183 }
24184 }
24185 }
24186}
24187pub mod error {
24189 pub struct ConversionError(::std::borrow::Cow<'static, str>);
24191 impl ::std::error::Error for ConversionError {}
24192 impl ::std::fmt::Display for ConversionError {
24193 fn fmt(
24194 &self,
24195 f: &mut ::std::fmt::Formatter<'_>,
24196 ) -> Result<(), ::std::fmt::Error> {
24197 ::std::fmt::Display::fmt(&self.0, f)
24198 }
24199 }
24200 impl ::std::fmt::Debug for ConversionError {
24201 fn fmt(
24202 &self,
24203 f: &mut ::std::fmt::Formatter<'_>,
24204 ) -> Result<(), ::std::fmt::Error> {
24205 ::std::fmt::Debug::fmt(&self.0, f)
24206 }
24207 }
24208 impl From<&'static str> for ConversionError {
24209 fn from(value: &'static str) -> Self {
24210 Self(value.into())
24211 }
24212 }
24213 impl From<String> for ConversionError {
24214 fn from(value: String) -> Self {
24215 Self(value.into())
24216 }
24217 }
24218}
24219
24220}
24221
24222 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "fileId", part: ::one::Part::Path, key: Some("fileId") }, ::one::Route { field: "id", part: ::one::Part::Path, key: Some("id") }], required_parts: &[::one::Part::Path] };
24224
24225 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
24235 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4C_1ULUA::GpV9-iA0SJmqaAjef6JzmQ", Method::GET, "/v1/agent/{{id}}/files/{{fileId}}/content").with_routed(&input, &ROUTING)?
24236 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/octet-stream\"}").map_err(Error::Decode)?).returns::<output::Output>())
24237 }
24238
24239 impl IntoOperation for Input {
24240 type Output = output::Output;
24241
24242 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
24243 build(self)
24244 }
24245 }
24246 impl IntoOperation for builder::Input {
24247 type Output = output::Output;
24248
24249 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
24250 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
24251 }
24252 }
24253}
24254pub fn download_agent_response_file() -> download_agent_response_file::builder::Input {
24256 download_agent_response_file::builder::Input::default()
24257}
24258pub mod list_files_produced_agent_response {
24259 use ::one::{Error, IntoOperation, Method, Operation};
24260#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
24262#[serde(deny_unknown_fields)]
24263pub struct Input {
24264 pub id: InputId,
24266}
24267impl Input {
24268 pub fn builder() -> builder::Input {
24269 Default::default()
24270 }
24271}
24272#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24274#[serde(transparent)]
24275pub struct InputId(::std::string::String);
24276impl ::std::ops::Deref for InputId {
24277 type Target = ::std::string::String;
24278 fn deref(&self) -> &::std::string::String {
24279 &self.0
24280 }
24281}
24282impl ::std::convert::From<InputId> for ::std::string::String {
24283 fn from(value: InputId) -> Self {
24284 value.0
24285 }
24286}
24287impl ::std::str::FromStr for InputId {
24288 type Err = self::error::ConversionError;
24289 fn from_str(
24290 value: &str,
24291 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24292 ::std::convert::TryFrom::try_from(value)
24293 }
24294}
24295impl ::std::convert::TryFrom<&str> for InputId {
24296 type Error = self::error::ConversionError;
24297 fn try_from(
24298 value: &str,
24299 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24300 if value.chars().count() < 1usize {
24301 return Err("shorter than 1 characters".into());
24302 }
24303 static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(||
24304 { ::regress::Regex::with_flags("^resp_.+", "u").unwrap() });
24305 if PATTERN.find(value).is_none() {
24306 return Err("doesn't match pattern \"^resp_.+\"".into());
24307 }
24308 Ok(Self(value.to_string()))
24309 }
24310}
24311impl ::std::convert::TryFrom<::std::string::String> for InputId {
24312 type Error = self::error::ConversionError;
24313 fn try_from(
24314 value: ::std::string::String,
24315 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24316 ::std::convert::TryFrom::try_from(value.as_str())
24317 }
24318}
24319impl<'de> ::serde::Deserialize<'de> for InputId {
24320 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
24321 where
24322 D: ::serde::Deserializer<'de>,
24323 {
24324 ::std::convert::TryFrom::try_from(
24325 ::std::string::String::deserialize(deserializer)?,
24326 )
24327 .map_err(|e: self::error::ConversionError| {
24328 <D::Error as ::serde::de::Error>::custom(e.to_string())
24329 })
24330 }
24331}
24332pub mod builder {
24334 #[derive(Clone, Debug)]
24335 pub struct Input {
24336 id: ::std::result::Result<super::InputId, ::std::string::String>,
24337 }
24338 impl ::std::default::Default for Input {
24339 fn default() -> Self {
24340 Self {
24341 id: Err("no value supplied for id".to_string()),
24342 }
24343 }
24344 }
24345 impl Input {
24346 pub fn id<T>(mut self, value: T) -> Self
24347 where
24348 T: ::std::convert::TryInto<super::InputId>,
24349 T::Error: ::std::fmt::Display,
24350 {
24351 self.id = value
24352 .try_into()
24353 .map_err(|e| format!("error converting supplied value for id: {e}"));
24354 self
24355 }
24356 }
24357 impl ::std::convert::TryFrom<Input> for super::Input {
24358 type Error = super::error::ConversionError;
24359 fn try_from(
24360 value: Input,
24361 ) -> ::std::result::Result<Self, super::error::ConversionError> {
24362 Ok(Self { id: value.id? })
24363 }
24364 }
24365 impl ::std::convert::From<super::Input> for Input {
24366 fn from(value: super::Input) -> Self {
24367 Self { id: Ok(value.id) }
24368 }
24369 }
24370}
24371pub mod error {
24373 pub struct ConversionError(::std::borrow::Cow<'static, str>);
24375 impl ::std::error::Error for ConversionError {}
24376 impl ::std::fmt::Display for ConversionError {
24377 fn fmt(
24378 &self,
24379 f: &mut ::std::fmt::Formatter<'_>,
24380 ) -> Result<(), ::std::fmt::Error> {
24381 ::std::fmt::Display::fmt(&self.0, f)
24382 }
24383 }
24384 impl ::std::fmt::Debug for ConversionError {
24385 fn fmt(
24386 &self,
24387 f: &mut ::std::fmt::Formatter<'_>,
24388 ) -> Result<(), ::std::fmt::Error> {
24389 ::std::fmt::Debug::fmt(&self.0, f)
24390 }
24391 }
24392 impl From<&'static str> for ConversionError {
24393 fn from(value: &'static str) -> Self {
24394 Self(value.into())
24395 }
24396 }
24397 impl From<String> for ConversionError {
24398 fn from(value: String) -> Self {
24399 Self(value.into())
24400 }
24401 }
24402}
24403
24404pub mod output {
24405#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
24407pub struct Error {
24408 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24410 pub code: ::std::option::Option<::std::string::String>,
24411 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24413 pub message: ::std::option::Option<::std::string::String>,
24414 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
24416 pub type_: ::std::option::Option<::std::string::String>,
24417}
24418impl Error {
24419 pub fn builder() -> builder::Error {
24420 Default::default()
24421 }
24422}
24423#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
24425pub struct FileMetadata {
24426 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24428 pub bytes: ::std::option::Option<i64>,
24429 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24431 pub created_at: ::std::option::Option<i64>,
24432 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24434 pub filename: ::std::option::Option<::std::string::String>,
24435 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24437 pub id: ::std::option::Option<::std::string::String>,
24438 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24440 pub object: ::std::option::Option<FileMetadataObject>,
24441}
24442impl FileMetadata {
24443 pub fn builder() -> builder::FileMetadata {
24444 Default::default()
24445 }
24446}
24447#[derive(
24449 ::serde::Deserialize,
24450 ::serde::Serialize,
24451 Clone,
24452 Copy,
24453 Debug,
24454 Eq,
24455 Hash,
24456 Ord,
24457 PartialEq,
24458 PartialOrd
24459)]
24460pub enum FileMetadataObject {
24461 #[serde(rename = "file")]
24462 File,
24463}
24464impl ::std::fmt::Display for FileMetadataObject {
24465 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
24466 match *self {
24467 Self::File => f.write_str("file"),
24468 }
24469 }
24470}
24471impl ::std::str::FromStr for FileMetadataObject {
24472 type Err = self::error::ConversionError;
24473 fn from_str(
24474 value: &str,
24475 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24476 match value {
24477 "file" => Ok(Self::File),
24478 _ => Err("invalid value".into()),
24479 }
24480 }
24481}
24482impl ::std::convert::TryFrom<&str> for FileMetadataObject {
24483 type Error = self::error::ConversionError;
24484 fn try_from(
24485 value: &str,
24486 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24487 value.parse()
24488 }
24489}
24490impl ::std::convert::TryFrom<::std::string::String> for FileMetadataObject {
24491 type Error = self::error::ConversionError;
24492 fn try_from(
24493 value: ::std::string::String,
24494 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24495 value.parse()
24496 }
24497}
24498#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
24500pub struct Output {
24501 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
24503 pub data: ::std::vec::Vec<FileMetadata>,
24504 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24505 pub error: ::std::option::Option<Error>,
24506 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
24508 pub object: ::std::option::Option<OutputObject>,
24509}
24510impl Output {
24511 pub fn builder() -> builder::Output {
24512 Default::default()
24513 }
24514}
24515#[derive(
24517 ::serde::Deserialize,
24518 ::serde::Serialize,
24519 Clone,
24520 Copy,
24521 Debug,
24522 Eq,
24523 Hash,
24524 Ord,
24525 PartialEq,
24526 PartialOrd
24527)]
24528pub enum OutputObject {
24529 #[serde(rename = "list")]
24530 List,
24531}
24532impl ::std::fmt::Display for OutputObject {
24533 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
24534 match *self {
24535 Self::List => f.write_str("list"),
24536 }
24537 }
24538}
24539impl ::std::str::FromStr for OutputObject {
24540 type Err = self::error::ConversionError;
24541 fn from_str(
24542 value: &str,
24543 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24544 match value {
24545 "list" => Ok(Self::List),
24546 _ => Err("invalid value".into()),
24547 }
24548 }
24549}
24550impl ::std::convert::TryFrom<&str> for OutputObject {
24551 type Error = self::error::ConversionError;
24552 fn try_from(
24553 value: &str,
24554 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24555 value.parse()
24556 }
24557}
24558impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
24559 type Error = self::error::ConversionError;
24560 fn try_from(
24561 value: ::std::string::String,
24562 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24563 value.parse()
24564 }
24565}
24566pub mod builder {
24568 #[derive(Clone, Debug)]
24569 pub struct Error {
24570 code: ::std::result::Result<
24571 ::std::option::Option<::std::string::String>,
24572 ::std::string::String,
24573 >,
24574 message: ::std::result::Result<
24575 ::std::option::Option<::std::string::String>,
24576 ::std::string::String,
24577 >,
24578 type_: ::std::result::Result<
24579 ::std::option::Option<::std::string::String>,
24580 ::std::string::String,
24581 >,
24582 }
24583 impl ::std::default::Default for Error {
24584 fn default() -> Self {
24585 Self {
24586 code: Ok(Default::default()),
24587 message: Ok(Default::default()),
24588 type_: Ok(Default::default()),
24589 }
24590 }
24591 }
24592 impl Error {
24593 pub fn code<T>(mut self, value: T) -> Self
24594 where
24595 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24596 T::Error: ::std::fmt::Display,
24597 {
24598 self.code = value
24599 .try_into()
24600 .map_err(|e| format!("error converting supplied value for code: {e}"));
24601 self
24602 }
24603 pub fn message<T>(mut self, value: T) -> Self
24604 where
24605 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24606 T::Error: ::std::fmt::Display,
24607 {
24608 self.message = value
24609 .try_into()
24610 .map_err(|e| {
24611 format!("error converting supplied value for message: {e}")
24612 });
24613 self
24614 }
24615 pub fn type_<T>(mut self, value: T) -> Self
24616 where
24617 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24618 T::Error: ::std::fmt::Display,
24619 {
24620 self.type_ = value
24621 .try_into()
24622 .map_err(|e| format!("error converting supplied value for type_: {e}"));
24623 self
24624 }
24625 }
24626 impl ::std::convert::TryFrom<Error> for super::Error {
24627 type Error = super::error::ConversionError;
24628 fn try_from(
24629 value: Error,
24630 ) -> ::std::result::Result<Self, super::error::ConversionError> {
24631 Ok(Self {
24632 code: value.code?,
24633 message: value.message?,
24634 type_: value.type_?,
24635 })
24636 }
24637 }
24638 impl ::std::convert::From<super::Error> for Error {
24639 fn from(value: super::Error) -> Self {
24640 Self {
24641 code: Ok(value.code),
24642 message: Ok(value.message),
24643 type_: Ok(value.type_),
24644 }
24645 }
24646 }
24647 #[derive(Clone, Debug)]
24648 pub struct FileMetadata {
24649 bytes: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
24650 created_at: ::std::result::Result<
24651 ::std::option::Option<i64>,
24652 ::std::string::String,
24653 >,
24654 filename: ::std::result::Result<
24655 ::std::option::Option<::std::string::String>,
24656 ::std::string::String,
24657 >,
24658 id: ::std::result::Result<
24659 ::std::option::Option<::std::string::String>,
24660 ::std::string::String,
24661 >,
24662 object: ::std::result::Result<
24663 ::std::option::Option<super::FileMetadataObject>,
24664 ::std::string::String,
24665 >,
24666 }
24667 impl ::std::default::Default for FileMetadata {
24668 fn default() -> Self {
24669 Self {
24670 bytes: Ok(Default::default()),
24671 created_at: Ok(Default::default()),
24672 filename: Ok(Default::default()),
24673 id: Ok(Default::default()),
24674 object: Ok(Default::default()),
24675 }
24676 }
24677 }
24678 impl FileMetadata {
24679 pub fn bytes<T>(mut self, value: T) -> Self
24680 where
24681 T: ::std::convert::TryInto<::std::option::Option<i64>>,
24682 T::Error: ::std::fmt::Display,
24683 {
24684 self.bytes = value
24685 .try_into()
24686 .map_err(|e| format!("error converting supplied value for bytes: {e}"));
24687 self
24688 }
24689 pub fn created_at<T>(mut self, value: T) -> Self
24690 where
24691 T: ::std::convert::TryInto<::std::option::Option<i64>>,
24692 T::Error: ::std::fmt::Display,
24693 {
24694 self.created_at = value
24695 .try_into()
24696 .map_err(|e| {
24697 format!("error converting supplied value for created_at: {e}")
24698 });
24699 self
24700 }
24701 pub fn filename<T>(mut self, value: T) -> Self
24702 where
24703 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24704 T::Error: ::std::fmt::Display,
24705 {
24706 self.filename = value
24707 .try_into()
24708 .map_err(|e| {
24709 format!("error converting supplied value for filename: {e}")
24710 });
24711 self
24712 }
24713 pub fn id<T>(mut self, value: T) -> Self
24714 where
24715 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
24716 T::Error: ::std::fmt::Display,
24717 {
24718 self.id = value
24719 .try_into()
24720 .map_err(|e| format!("error converting supplied value for id: {e}"));
24721 self
24722 }
24723 pub fn object<T>(mut self, value: T) -> Self
24724 where
24725 T: ::std::convert::TryInto<::std::option::Option<super::FileMetadataObject>>,
24726 T::Error: ::std::fmt::Display,
24727 {
24728 self.object = value
24729 .try_into()
24730 .map_err(|e| format!("error converting supplied value for object: {e}"));
24731 self
24732 }
24733 }
24734 impl ::std::convert::TryFrom<FileMetadata> for super::FileMetadata {
24735 type Error = super::error::ConversionError;
24736 fn try_from(
24737 value: FileMetadata,
24738 ) -> ::std::result::Result<Self, super::error::ConversionError> {
24739 Ok(Self {
24740 bytes: value.bytes?,
24741 created_at: value.created_at?,
24742 filename: value.filename?,
24743 id: value.id?,
24744 object: value.object?,
24745 })
24746 }
24747 }
24748 impl ::std::convert::From<super::FileMetadata> for FileMetadata {
24749 fn from(value: super::FileMetadata) -> Self {
24750 Self {
24751 bytes: Ok(value.bytes),
24752 created_at: Ok(value.created_at),
24753 filename: Ok(value.filename),
24754 id: Ok(value.id),
24755 object: Ok(value.object),
24756 }
24757 }
24758 }
24759 #[derive(Clone, Debug)]
24760 pub struct Output {
24761 data: ::std::result::Result<
24762 ::std::vec::Vec<super::FileMetadata>,
24763 ::std::string::String,
24764 >,
24765 error: ::std::result::Result<
24766 ::std::option::Option<super::Error>,
24767 ::std::string::String,
24768 >,
24769 object: ::std::result::Result<
24770 ::std::option::Option<super::OutputObject>,
24771 ::std::string::String,
24772 >,
24773 }
24774 impl ::std::default::Default for Output {
24775 fn default() -> Self {
24776 Self {
24777 data: Ok(Default::default()),
24778 error: Ok(Default::default()),
24779 object: Ok(Default::default()),
24780 }
24781 }
24782 }
24783 impl Output {
24784 pub fn data<T>(mut self, value: T) -> Self
24785 where
24786 T: ::std::convert::TryInto<::std::vec::Vec<super::FileMetadata>>,
24787 T::Error: ::std::fmt::Display,
24788 {
24789 self.data = value
24790 .try_into()
24791 .map_err(|e| format!("error converting supplied value for data: {e}"));
24792 self
24793 }
24794 pub fn error<T>(mut self, value: T) -> Self
24795 where
24796 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
24797 T::Error: ::std::fmt::Display,
24798 {
24799 self.error = value
24800 .try_into()
24801 .map_err(|e| format!("error converting supplied value for error: {e}"));
24802 self
24803 }
24804 pub fn object<T>(mut self, value: T) -> Self
24805 where
24806 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
24807 T::Error: ::std::fmt::Display,
24808 {
24809 self.object = value
24810 .try_into()
24811 .map_err(|e| format!("error converting supplied value for object: {e}"));
24812 self
24813 }
24814 }
24815 impl ::std::convert::TryFrom<Output> for super::Output {
24816 type Error = super::error::ConversionError;
24817 fn try_from(
24818 value: Output,
24819 ) -> ::std::result::Result<Self, super::error::ConversionError> {
24820 Ok(Self {
24821 data: value.data?,
24822 error: value.error?,
24823 object: value.object?,
24824 })
24825 }
24826 }
24827 impl ::std::convert::From<super::Output> for Output {
24828 fn from(value: super::Output) -> Self {
24829 Self {
24830 data: Ok(value.data),
24831 error: Ok(value.error),
24832 object: Ok(value.object),
24833 }
24834 }
24835 }
24836}
24837pub mod error {
24839 pub struct ConversionError(::std::borrow::Cow<'static, str>);
24841 impl ::std::error::Error for ConversionError {}
24842 impl ::std::fmt::Display for ConversionError {
24843 fn fmt(
24844 &self,
24845 f: &mut ::std::fmt::Formatter<'_>,
24846 ) -> Result<(), ::std::fmt::Error> {
24847 ::std::fmt::Display::fmt(&self.0, f)
24848 }
24849 }
24850 impl ::std::fmt::Debug for ConversionError {
24851 fn fmt(
24852 &self,
24853 f: &mut ::std::fmt::Formatter<'_>,
24854 ) -> Result<(), ::std::fmt::Error> {
24855 ::std::fmt::Debug::fmt(&self.0, f)
24856 }
24857 }
24858 impl From<&'static str> for ConversionError {
24859 fn from(value: &'static str) -> Self {
24860 Self(value.into())
24861 }
24862 }
24863 impl From<String> for ConversionError {
24864 fn from(value: String) -> Self {
24865 Self(value.into())
24866 }
24867 }
24868}
24869
24870}
24871
24872 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "id", part: ::one::Part::Path, key: Some("id") }], required_parts: &[::one::Part::Path] };
24874
24875 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
24884 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DAEIZ1g::LnDZak9-QIiiuJCLWddVwg", Method::GET, "/v1/agent/{{id}}/files").with_routed(&input, &ROUTING)?
24885 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
24886 }
24887
24888 impl IntoOperation for Input {
24889 type Output = output::Output;
24890
24891 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
24892 build(self)
24893 }
24894 }
24895 impl IntoOperation for builder::Input {
24896 type Output = output::Output;
24897
24898 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
24899 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
24900 }
24901 }
24902}
24903pub fn list_files_produced_agent_response() -> list_files_produced_agent_response::builder::Input {
24905 list_files_produced_agent_response::builder::Input::default()
24906}
24907pub mod retrieve_agent_response {
24908 use ::one::{Error, IntoOperation, Method, Operation};
24909#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
24911#[serde(deny_unknown_fields)]
24912pub struct Input {
24913 pub id: InputId,
24915}
24916impl Input {
24917 pub fn builder() -> builder::Input {
24918 Default::default()
24919 }
24920}
24921#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24923#[serde(transparent)]
24924pub struct InputId(::std::string::String);
24925impl ::std::ops::Deref for InputId {
24926 type Target = ::std::string::String;
24927 fn deref(&self) -> &::std::string::String {
24928 &self.0
24929 }
24930}
24931impl ::std::convert::From<InputId> for ::std::string::String {
24932 fn from(value: InputId) -> Self {
24933 value.0
24934 }
24935}
24936impl ::std::str::FromStr for InputId {
24937 type Err = self::error::ConversionError;
24938 fn from_str(
24939 value: &str,
24940 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24941 ::std::convert::TryFrom::try_from(value)
24942 }
24943}
24944impl ::std::convert::TryFrom<&str> for InputId {
24945 type Error = self::error::ConversionError;
24946 fn try_from(
24947 value: &str,
24948 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24949 if value.chars().count() < 1usize {
24950 return Err("shorter than 1 characters".into());
24951 }
24952 static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(||
24953 { ::regress::Regex::with_flags("^resp_.+$", "u").unwrap() });
24954 if PATTERN.find(value).is_none() {
24955 return Err("doesn't match pattern \"^resp_.+$\"".into());
24956 }
24957 Ok(Self(value.to_string()))
24958 }
24959}
24960impl ::std::convert::TryFrom<::std::string::String> for InputId {
24961 type Error = self::error::ConversionError;
24962 fn try_from(
24963 value: ::std::string::String,
24964 ) -> ::std::result::Result<Self, self::error::ConversionError> {
24965 ::std::convert::TryFrom::try_from(value.as_str())
24966 }
24967}
24968impl<'de> ::serde::Deserialize<'de> for InputId {
24969 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
24970 where
24971 D: ::serde::Deserializer<'de>,
24972 {
24973 ::std::convert::TryFrom::try_from(
24974 ::std::string::String::deserialize(deserializer)?,
24975 )
24976 .map_err(|e: self::error::ConversionError| {
24977 <D::Error as ::serde::de::Error>::custom(e.to_string())
24978 })
24979 }
24980}
24981pub mod builder {
24983 #[derive(Clone, Debug)]
24984 pub struct Input {
24985 id: ::std::result::Result<super::InputId, ::std::string::String>,
24986 }
24987 impl ::std::default::Default for Input {
24988 fn default() -> Self {
24989 Self {
24990 id: Err("no value supplied for id".to_string()),
24991 }
24992 }
24993 }
24994 impl Input {
24995 pub fn id<T>(mut self, value: T) -> Self
24996 where
24997 T: ::std::convert::TryInto<super::InputId>,
24998 T::Error: ::std::fmt::Display,
24999 {
25000 self.id = value
25001 .try_into()
25002 .map_err(|e| format!("error converting supplied value for id: {e}"));
25003 self
25004 }
25005 }
25006 impl ::std::convert::TryFrom<Input> for super::Input {
25007 type Error = super::error::ConversionError;
25008 fn try_from(
25009 value: Input,
25010 ) -> ::std::result::Result<Self, super::error::ConversionError> {
25011 Ok(Self { id: value.id? })
25012 }
25013 }
25014 impl ::std::convert::From<super::Input> for Input {
25015 fn from(value: super::Input) -> Self {
25016 Self { id: Ok(value.id) }
25017 }
25018 }
25019}
25020pub mod error {
25022 pub struct ConversionError(::std::borrow::Cow<'static, str>);
25024 impl ::std::error::Error for ConversionError {}
25025 impl ::std::fmt::Display for ConversionError {
25026 fn fmt(
25027 &self,
25028 f: &mut ::std::fmt::Formatter<'_>,
25029 ) -> Result<(), ::std::fmt::Error> {
25030 ::std::fmt::Display::fmt(&self.0, f)
25031 }
25032 }
25033 impl ::std::fmt::Debug for ConversionError {
25034 fn fmt(
25035 &self,
25036 f: &mut ::std::fmt::Formatter<'_>,
25037 ) -> Result<(), ::std::fmt::Error> {
25038 ::std::fmt::Debug::fmt(&self.0, f)
25039 }
25040 }
25041 impl From<&'static str> for ConversionError {
25042 fn from(value: &'static str) -> Self {
25043 Self(value.into())
25044 }
25045 }
25046 impl From<String> for ConversionError {
25047 fn from(value: String) -> Self {
25048 Self(value.into())
25049 }
25050 }
25051}
25052
25053pub mod output {
25054#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
25056pub struct Error {
25057 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25059 pub code: ::std::option::Option<::std::string::String>,
25060 pub message: ::std::string::String,
25062 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
25064 pub type_: ::std::option::Option<::std::string::String>,
25065}
25066impl Error {
25067 pub fn builder() -> builder::Error {
25068 Default::default()
25069 }
25070}
25071#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
25073pub struct Output {
25074 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25076 pub created_at: ::std::option::Option<i64>,
25077 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25079 pub effort: ::std::option::Option<::std::string::String>,
25080 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25081 pub error: ::std::option::Option<Error>,
25082 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25084 pub id: ::std::option::Option<::std::string::String>,
25085 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25087 pub model: ::std::option::Option<::std::string::String>,
25088 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25090 pub object: ::std::option::Option<OutputObject>,
25091 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
25093 pub output: ::std::vec::Vec<OutputItem>,
25094 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25096 pub status: ::std::option::Option<OutputStatus>,
25097 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25098 pub usage: ::std::option::Option<Usage>,
25099}
25100impl Output {
25101 pub fn builder() -> builder::Output {
25102 Default::default()
25103 }
25104}
25105#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
25107pub struct OutputItem {
25108 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
25110 pub type_: ::std::option::Option<::std::string::String>,
25111}
25112impl OutputItem {
25113 pub fn builder() -> builder::OutputItem {
25114 Default::default()
25115 }
25116}
25117#[derive(
25119 ::serde::Deserialize,
25120 ::serde::Serialize,
25121 Clone,
25122 Copy,
25123 Debug,
25124 Eq,
25125 Hash,
25126 Ord,
25127 PartialEq,
25128 PartialOrd
25129)]
25130pub enum OutputObject {
25131 #[serde(rename = "response")]
25132 Response,
25133}
25134impl ::std::fmt::Display for OutputObject {
25135 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
25136 match *self {
25137 Self::Response => f.write_str("response"),
25138 }
25139 }
25140}
25141impl ::std::str::FromStr for OutputObject {
25142 type Err = self::error::ConversionError;
25143 fn from_str(
25144 value: &str,
25145 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25146 match value {
25147 "response" => Ok(Self::Response),
25148 _ => Err("invalid value".into()),
25149 }
25150 }
25151}
25152impl ::std::convert::TryFrom<&str> for OutputObject {
25153 type Error = self::error::ConversionError;
25154 fn try_from(
25155 value: &str,
25156 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25157 value.parse()
25158 }
25159}
25160impl ::std::convert::TryFrom<::std::string::String> for OutputObject {
25161 type Error = self::error::ConversionError;
25162 fn try_from(
25163 value: ::std::string::String,
25164 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25165 value.parse()
25166 }
25167}
25168#[derive(
25170 ::serde::Deserialize,
25171 ::serde::Serialize,
25172 Clone,
25173 Copy,
25174 Debug,
25175 Eq,
25176 Hash,
25177 Ord,
25178 PartialEq,
25179 PartialOrd
25180)]
25181pub enum OutputStatus {
25182 #[serde(rename = "completed")]
25183 Completed,
25184 #[serde(rename = "failed")]
25185 Failed,
25186 #[serde(rename = "incomplete")]
25187 Incomplete,
25188 #[serde(rename = "in_progress")]
25189 InProgress,
25190 #[serde(rename = "queued")]
25191 Queued,
25192 #[serde(rename = "cancelled")]
25193 Cancelled,
25194}
25195impl ::std::fmt::Display for OutputStatus {
25196 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
25197 match *self {
25198 Self::Completed => f.write_str("completed"),
25199 Self::Failed => f.write_str("failed"),
25200 Self::Incomplete => f.write_str("incomplete"),
25201 Self::InProgress => f.write_str("in_progress"),
25202 Self::Queued => f.write_str("queued"),
25203 Self::Cancelled => f.write_str("cancelled"),
25204 }
25205 }
25206}
25207impl ::std::str::FromStr for OutputStatus {
25208 type Err = self::error::ConversionError;
25209 fn from_str(
25210 value: &str,
25211 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25212 match value {
25213 "completed" => Ok(Self::Completed),
25214 "failed" => Ok(Self::Failed),
25215 "incomplete" => Ok(Self::Incomplete),
25216 "in_progress" => Ok(Self::InProgress),
25217 "queued" => Ok(Self::Queued),
25218 "cancelled" => Ok(Self::Cancelled),
25219 _ => Err("invalid value".into()),
25220 }
25221 }
25222}
25223impl ::std::convert::TryFrom<&str> for OutputStatus {
25224 type Error = self::error::ConversionError;
25225 fn try_from(
25226 value: &str,
25227 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25228 value.parse()
25229 }
25230}
25231impl ::std::convert::TryFrom<::std::string::String> for OutputStatus {
25232 type Error = self::error::ConversionError;
25233 fn try_from(
25234 value: ::std::string::String,
25235 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25236 value.parse()
25237 }
25238}
25239#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
25241pub struct Usage {
25242 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
25244 pub cost: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
25245 pub input_tokens: i64,
25247 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25248 pub input_tokens_details: ::std::option::Option<UsageInputTokensDetails>,
25249 pub output_tokens: i64,
25251 #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
25253 pub tool_calls_details: ::serde_json::Map<
25254 ::std::string::String,
25255 ::serde_json::Value,
25256 >,
25257 pub total_tokens: i64,
25259}
25260impl Usage {
25261 pub fn builder() -> builder::Usage {
25262 Default::default()
25263 }
25264}
25265#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
25267pub struct UsageInputTokensDetails {
25268 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25270 pub cache_creation_input_tokens: ::std::option::Option<i64>,
25271 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25273 pub cache_read_input_tokens: ::std::option::Option<i64>,
25274}
25275impl UsageInputTokensDetails {
25276 pub fn builder() -> builder::UsageInputTokensDetails {
25277 Default::default()
25278 }
25279}
25280pub mod builder {
25282 #[derive(Clone, Debug)]
25283 pub struct Error {
25284 code: ::std::result::Result<
25285 ::std::option::Option<::std::string::String>,
25286 ::std::string::String,
25287 >,
25288 message: ::std::result::Result<::std::string::String, ::std::string::String>,
25289 type_: ::std::result::Result<
25290 ::std::option::Option<::std::string::String>,
25291 ::std::string::String,
25292 >,
25293 }
25294 impl ::std::default::Default for Error {
25295 fn default() -> Self {
25296 Self {
25297 code: Ok(Default::default()),
25298 message: Err("no value supplied for message".to_string()),
25299 type_: Ok(Default::default()),
25300 }
25301 }
25302 }
25303 impl Error {
25304 pub fn code<T>(mut self, value: T) -> Self
25305 where
25306 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
25307 T::Error: ::std::fmt::Display,
25308 {
25309 self.code = value
25310 .try_into()
25311 .map_err(|e| format!("error converting supplied value for code: {e}"));
25312 self
25313 }
25314 pub fn message<T>(mut self, value: T) -> Self
25315 where
25316 T: ::std::convert::TryInto<::std::string::String>,
25317 T::Error: ::std::fmt::Display,
25318 {
25319 self.message = value
25320 .try_into()
25321 .map_err(|e| {
25322 format!("error converting supplied value for message: {e}")
25323 });
25324 self
25325 }
25326 pub fn type_<T>(mut self, value: T) -> Self
25327 where
25328 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
25329 T::Error: ::std::fmt::Display,
25330 {
25331 self.type_ = value
25332 .try_into()
25333 .map_err(|e| format!("error converting supplied value for type_: {e}"));
25334 self
25335 }
25336 }
25337 impl ::std::convert::TryFrom<Error> for super::Error {
25338 type Error = super::error::ConversionError;
25339 fn try_from(
25340 value: Error,
25341 ) -> ::std::result::Result<Self, super::error::ConversionError> {
25342 Ok(Self {
25343 code: value.code?,
25344 message: value.message?,
25345 type_: value.type_?,
25346 })
25347 }
25348 }
25349 impl ::std::convert::From<super::Error> for Error {
25350 fn from(value: super::Error) -> Self {
25351 Self {
25352 code: Ok(value.code),
25353 message: Ok(value.message),
25354 type_: Ok(value.type_),
25355 }
25356 }
25357 }
25358 #[derive(Clone, Debug)]
25359 pub struct Output {
25360 created_at: ::std::result::Result<
25361 ::std::option::Option<i64>,
25362 ::std::string::String,
25363 >,
25364 effort: ::std::result::Result<
25365 ::std::option::Option<::std::string::String>,
25366 ::std::string::String,
25367 >,
25368 error: ::std::result::Result<
25369 ::std::option::Option<super::Error>,
25370 ::std::string::String,
25371 >,
25372 id: ::std::result::Result<
25373 ::std::option::Option<::std::string::String>,
25374 ::std::string::String,
25375 >,
25376 model: ::std::result::Result<
25377 ::std::option::Option<::std::string::String>,
25378 ::std::string::String,
25379 >,
25380 object: ::std::result::Result<
25381 ::std::option::Option<super::OutputObject>,
25382 ::std::string::String,
25383 >,
25384 output: ::std::result::Result<
25385 ::std::vec::Vec<super::OutputItem>,
25386 ::std::string::String,
25387 >,
25388 status: ::std::result::Result<
25389 ::std::option::Option<super::OutputStatus>,
25390 ::std::string::String,
25391 >,
25392 usage: ::std::result::Result<
25393 ::std::option::Option<super::Usage>,
25394 ::std::string::String,
25395 >,
25396 }
25397 impl ::std::default::Default for Output {
25398 fn default() -> Self {
25399 Self {
25400 created_at: Ok(Default::default()),
25401 effort: Ok(Default::default()),
25402 error: Ok(Default::default()),
25403 id: Ok(Default::default()),
25404 model: Ok(Default::default()),
25405 object: Ok(Default::default()),
25406 output: Ok(Default::default()),
25407 status: Ok(Default::default()),
25408 usage: Ok(Default::default()),
25409 }
25410 }
25411 }
25412 impl Output {
25413 pub fn created_at<T>(mut self, value: T) -> Self
25414 where
25415 T: ::std::convert::TryInto<::std::option::Option<i64>>,
25416 T::Error: ::std::fmt::Display,
25417 {
25418 self.created_at = value
25419 .try_into()
25420 .map_err(|e| {
25421 format!("error converting supplied value for created_at: {e}")
25422 });
25423 self
25424 }
25425 pub fn effort<T>(mut self, value: T) -> Self
25426 where
25427 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
25428 T::Error: ::std::fmt::Display,
25429 {
25430 self.effort = value
25431 .try_into()
25432 .map_err(|e| format!("error converting supplied value for effort: {e}"));
25433 self
25434 }
25435 pub fn error<T>(mut self, value: T) -> Self
25436 where
25437 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
25438 T::Error: ::std::fmt::Display,
25439 {
25440 self.error = value
25441 .try_into()
25442 .map_err(|e| format!("error converting supplied value for error: {e}"));
25443 self
25444 }
25445 pub fn id<T>(mut self, value: T) -> Self
25446 where
25447 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
25448 T::Error: ::std::fmt::Display,
25449 {
25450 self.id = value
25451 .try_into()
25452 .map_err(|e| format!("error converting supplied value for id: {e}"));
25453 self
25454 }
25455 pub fn model<T>(mut self, value: T) -> Self
25456 where
25457 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
25458 T::Error: ::std::fmt::Display,
25459 {
25460 self.model = value
25461 .try_into()
25462 .map_err(|e| format!("error converting supplied value for model: {e}"));
25463 self
25464 }
25465 pub fn object<T>(mut self, value: T) -> Self
25466 where
25467 T: ::std::convert::TryInto<::std::option::Option<super::OutputObject>>,
25468 T::Error: ::std::fmt::Display,
25469 {
25470 self.object = value
25471 .try_into()
25472 .map_err(|e| format!("error converting supplied value for object: {e}"));
25473 self
25474 }
25475 pub fn output<T>(mut self, value: T) -> Self
25476 where
25477 T: ::std::convert::TryInto<::std::vec::Vec<super::OutputItem>>,
25478 T::Error: ::std::fmt::Display,
25479 {
25480 self.output = value
25481 .try_into()
25482 .map_err(|e| format!("error converting supplied value for output: {e}"));
25483 self
25484 }
25485 pub fn status<T>(mut self, value: T) -> Self
25486 where
25487 T: ::std::convert::TryInto<::std::option::Option<super::OutputStatus>>,
25488 T::Error: ::std::fmt::Display,
25489 {
25490 self.status = value
25491 .try_into()
25492 .map_err(|e| format!("error converting supplied value for status: {e}"));
25493 self
25494 }
25495 pub fn usage<T>(mut self, value: T) -> Self
25496 where
25497 T: ::std::convert::TryInto<::std::option::Option<super::Usage>>,
25498 T::Error: ::std::fmt::Display,
25499 {
25500 self.usage = value
25501 .try_into()
25502 .map_err(|e| format!("error converting supplied value for usage: {e}"));
25503 self
25504 }
25505 }
25506 impl ::std::convert::TryFrom<Output> for super::Output {
25507 type Error = super::error::ConversionError;
25508 fn try_from(
25509 value: Output,
25510 ) -> ::std::result::Result<Self, super::error::ConversionError> {
25511 Ok(Self {
25512 created_at: value.created_at?,
25513 effort: value.effort?,
25514 error: value.error?,
25515 id: value.id?,
25516 model: value.model?,
25517 object: value.object?,
25518 output: value.output?,
25519 status: value.status?,
25520 usage: value.usage?,
25521 })
25522 }
25523 }
25524 impl ::std::convert::From<super::Output> for Output {
25525 fn from(value: super::Output) -> Self {
25526 Self {
25527 created_at: Ok(value.created_at),
25528 effort: Ok(value.effort),
25529 error: Ok(value.error),
25530 id: Ok(value.id),
25531 model: Ok(value.model),
25532 object: Ok(value.object),
25533 output: Ok(value.output),
25534 status: Ok(value.status),
25535 usage: Ok(value.usage),
25536 }
25537 }
25538 }
25539 #[derive(Clone, Debug)]
25540 pub struct OutputItem {
25541 type_: ::std::result::Result<
25542 ::std::option::Option<::std::string::String>,
25543 ::std::string::String,
25544 >,
25545 }
25546 impl ::std::default::Default for OutputItem {
25547 fn default() -> Self {
25548 Self {
25549 type_: Ok(Default::default()),
25550 }
25551 }
25552 }
25553 impl OutputItem {
25554 pub fn type_<T>(mut self, value: T) -> Self
25555 where
25556 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
25557 T::Error: ::std::fmt::Display,
25558 {
25559 self.type_ = value
25560 .try_into()
25561 .map_err(|e| format!("error converting supplied value for type_: {e}"));
25562 self
25563 }
25564 }
25565 impl ::std::convert::TryFrom<OutputItem> for super::OutputItem {
25566 type Error = super::error::ConversionError;
25567 fn try_from(
25568 value: OutputItem,
25569 ) -> ::std::result::Result<Self, super::error::ConversionError> {
25570 Ok(Self { type_: value.type_? })
25571 }
25572 }
25573 impl ::std::convert::From<super::OutputItem> for OutputItem {
25574 fn from(value: super::OutputItem) -> Self {
25575 Self { type_: Ok(value.type_) }
25576 }
25577 }
25578 #[derive(Clone, Debug)]
25579 pub struct Usage {
25580 cost: ::std::result::Result<
25581 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
25582 ::std::string::String,
25583 >,
25584 input_tokens: ::std::result::Result<i64, ::std::string::String>,
25585 input_tokens_details: ::std::result::Result<
25586 ::std::option::Option<super::UsageInputTokensDetails>,
25587 ::std::string::String,
25588 >,
25589 output_tokens: ::std::result::Result<i64, ::std::string::String>,
25590 tool_calls_details: ::std::result::Result<
25591 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
25592 ::std::string::String,
25593 >,
25594 total_tokens: ::std::result::Result<i64, ::std::string::String>,
25595 }
25596 impl ::std::default::Default for Usage {
25597 fn default() -> Self {
25598 Self {
25599 cost: Ok(Default::default()),
25600 input_tokens: Err("no value supplied for input_tokens".to_string()),
25601 input_tokens_details: Ok(Default::default()),
25602 output_tokens: Err("no value supplied for output_tokens".to_string()),
25603 tool_calls_details: Ok(Default::default()),
25604 total_tokens: Err("no value supplied for total_tokens".to_string()),
25605 }
25606 }
25607 }
25608 impl Usage {
25609 pub fn cost<T>(mut self, value: T) -> Self
25610 where
25611 T: ::std::convert::TryInto<
25612 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
25613 >,
25614 T::Error: ::std::fmt::Display,
25615 {
25616 self.cost = value
25617 .try_into()
25618 .map_err(|e| format!("error converting supplied value for cost: {e}"));
25619 self
25620 }
25621 pub fn input_tokens<T>(mut self, value: T) -> Self
25622 where
25623 T: ::std::convert::TryInto<i64>,
25624 T::Error: ::std::fmt::Display,
25625 {
25626 self.input_tokens = value
25627 .try_into()
25628 .map_err(|e| {
25629 format!("error converting supplied value for input_tokens: {e}")
25630 });
25631 self
25632 }
25633 pub fn input_tokens_details<T>(mut self, value: T) -> Self
25634 where
25635 T: ::std::convert::TryInto<
25636 ::std::option::Option<super::UsageInputTokensDetails>,
25637 >,
25638 T::Error: ::std::fmt::Display,
25639 {
25640 self.input_tokens_details = value
25641 .try_into()
25642 .map_err(|e| {
25643 format!(
25644 "error converting supplied value for input_tokens_details: {e}"
25645 )
25646 });
25647 self
25648 }
25649 pub fn output_tokens<T>(mut self, value: T) -> Self
25650 where
25651 T: ::std::convert::TryInto<i64>,
25652 T::Error: ::std::fmt::Display,
25653 {
25654 self.output_tokens = value
25655 .try_into()
25656 .map_err(|e| {
25657 format!("error converting supplied value for output_tokens: {e}")
25658 });
25659 self
25660 }
25661 pub fn tool_calls_details<T>(mut self, value: T) -> Self
25662 where
25663 T: ::std::convert::TryInto<
25664 ::serde_json::Map<::std::string::String, ::serde_json::Value>,
25665 >,
25666 T::Error: ::std::fmt::Display,
25667 {
25668 self.tool_calls_details = value
25669 .try_into()
25670 .map_err(|e| {
25671 format!(
25672 "error converting supplied value for tool_calls_details: {e}"
25673 )
25674 });
25675 self
25676 }
25677 pub fn total_tokens<T>(mut self, value: T) -> Self
25678 where
25679 T: ::std::convert::TryInto<i64>,
25680 T::Error: ::std::fmt::Display,
25681 {
25682 self.total_tokens = value
25683 .try_into()
25684 .map_err(|e| {
25685 format!("error converting supplied value for total_tokens: {e}")
25686 });
25687 self
25688 }
25689 }
25690 impl ::std::convert::TryFrom<Usage> for super::Usage {
25691 type Error = super::error::ConversionError;
25692 fn try_from(
25693 value: Usage,
25694 ) -> ::std::result::Result<Self, super::error::ConversionError> {
25695 Ok(Self {
25696 cost: value.cost?,
25697 input_tokens: value.input_tokens?,
25698 input_tokens_details: value.input_tokens_details?,
25699 output_tokens: value.output_tokens?,
25700 tool_calls_details: value.tool_calls_details?,
25701 total_tokens: value.total_tokens?,
25702 })
25703 }
25704 }
25705 impl ::std::convert::From<super::Usage> for Usage {
25706 fn from(value: super::Usage) -> Self {
25707 Self {
25708 cost: Ok(value.cost),
25709 input_tokens: Ok(value.input_tokens),
25710 input_tokens_details: Ok(value.input_tokens_details),
25711 output_tokens: Ok(value.output_tokens),
25712 tool_calls_details: Ok(value.tool_calls_details),
25713 total_tokens: Ok(value.total_tokens),
25714 }
25715 }
25716 }
25717 #[derive(Clone, Debug)]
25718 pub struct UsageInputTokensDetails {
25719 cache_creation_input_tokens: ::std::result::Result<
25720 ::std::option::Option<i64>,
25721 ::std::string::String,
25722 >,
25723 cache_read_input_tokens: ::std::result::Result<
25724 ::std::option::Option<i64>,
25725 ::std::string::String,
25726 >,
25727 }
25728 impl ::std::default::Default for UsageInputTokensDetails {
25729 fn default() -> Self {
25730 Self {
25731 cache_creation_input_tokens: Ok(Default::default()),
25732 cache_read_input_tokens: Ok(Default::default()),
25733 }
25734 }
25735 }
25736 impl UsageInputTokensDetails {
25737 pub fn cache_creation_input_tokens<T>(mut self, value: T) -> Self
25738 where
25739 T: ::std::convert::TryInto<::std::option::Option<i64>>,
25740 T::Error: ::std::fmt::Display,
25741 {
25742 self.cache_creation_input_tokens = value
25743 .try_into()
25744 .map_err(|e| {
25745 format!(
25746 "error converting supplied value for cache_creation_input_tokens: {e}"
25747 )
25748 });
25749 self
25750 }
25751 pub fn cache_read_input_tokens<T>(mut self, value: T) -> Self
25752 where
25753 T: ::std::convert::TryInto<::std::option::Option<i64>>,
25754 T::Error: ::std::fmt::Display,
25755 {
25756 self.cache_read_input_tokens = value
25757 .try_into()
25758 .map_err(|e| {
25759 format!(
25760 "error converting supplied value for cache_read_input_tokens: {e}"
25761 )
25762 });
25763 self
25764 }
25765 }
25766 impl ::std::convert::TryFrom<UsageInputTokensDetails>
25767 for super::UsageInputTokensDetails {
25768 type Error = super::error::ConversionError;
25769 fn try_from(
25770 value: UsageInputTokensDetails,
25771 ) -> ::std::result::Result<Self, super::error::ConversionError> {
25772 Ok(Self {
25773 cache_creation_input_tokens: value.cache_creation_input_tokens?,
25774 cache_read_input_tokens: value.cache_read_input_tokens?,
25775 })
25776 }
25777 }
25778 impl ::std::convert::From<super::UsageInputTokensDetails>
25779 for UsageInputTokensDetails {
25780 fn from(value: super::UsageInputTokensDetails) -> Self {
25781 Self {
25782 cache_creation_input_tokens: Ok(value.cache_creation_input_tokens),
25783 cache_read_input_tokens: Ok(value.cache_read_input_tokens),
25784 }
25785 }
25786 }
25787}
25788pub mod error {
25790 pub struct ConversionError(::std::borrow::Cow<'static, str>);
25792 impl ::std::error::Error for ConversionError {}
25793 impl ::std::fmt::Display for ConversionError {
25794 fn fmt(
25795 &self,
25796 f: &mut ::std::fmt::Formatter<'_>,
25797 ) -> Result<(), ::std::fmt::Error> {
25798 ::std::fmt::Display::fmt(&self.0, f)
25799 }
25800 }
25801 impl ::std::fmt::Debug for ConversionError {
25802 fn fmt(
25803 &self,
25804 f: &mut ::std::fmt::Formatter<'_>,
25805 ) -> Result<(), ::std::fmt::Error> {
25806 ::std::fmt::Debug::fmt(&self.0, f)
25807 }
25808 }
25809 impl From<&'static str> for ConversionError {
25810 fn from(value: &'static str) -> Self {
25811 Self(value.into())
25812 }
25813 }
25814 impl From<String> for ConversionError {
25815 fn from(value: String) -> Self {
25816 Self(value.into())
25817 }
25818 }
25819}
25820
25821}
25822
25823 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "id", part: ::one::Part::Path, key: Some("id") }], required_parts: &[::one::Part::Path] };
25825
25826 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
25835 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DAutPfA::zBfHj2pfT4mAb_sPwyGRIw", Method::GET, "/v1/agent/{{id}}").with_routed(&input, &ROUTING)?
25836 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
25837 }
25838
25839 impl IntoOperation for Input {
25840 type Output = output::Output;
25841
25842 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
25843 build(self)
25844 }
25845 }
25846 impl IntoOperation for builder::Input {
25847 type Output = output::Output;
25848
25849 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
25850 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
25851 }
25852 }
25853}
25854pub fn retrieve_agent_response() -> retrieve_agent_response::builder::Input {
25856 retrieve_agent_response::builder::Input::default()
25857}
25858pub mod get_skill {
25859 use ::one::{Error, IntoOperation, Method, Operation};
25860#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
25862#[serde(deny_unknown_fields)]
25863pub struct Input {
25864 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
25866 pub revision: ::std::option::Option<::std::string::String>,
25867 #[serde(rename = "skillId")]
25869 pub skill_id: InputSkillId,
25870}
25871impl Input {
25872 pub fn builder() -> builder::Input {
25873 Default::default()
25874 }
25875}
25876#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25878#[serde(transparent)]
25879pub struct InputSkillId(::std::string::String);
25880impl ::std::ops::Deref for InputSkillId {
25881 type Target = ::std::string::String;
25882 fn deref(&self) -> &::std::string::String {
25883 &self.0
25884 }
25885}
25886impl ::std::convert::From<InputSkillId> for ::std::string::String {
25887 fn from(value: InputSkillId) -> Self {
25888 value.0
25889 }
25890}
25891impl ::std::str::FromStr for InputSkillId {
25892 type Err = self::error::ConversionError;
25893 fn from_str(
25894 value: &str,
25895 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25896 ::std::convert::TryFrom::try_from(value)
25897 }
25898}
25899impl ::std::convert::TryFrom<&str> for InputSkillId {
25900 type Error = self::error::ConversionError;
25901 fn try_from(
25902 value: &str,
25903 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25904 if value.chars().count() < 1usize {
25905 return Err("shorter than 1 characters".into());
25906 }
25907 Ok(Self(value.to_string()))
25908 }
25909}
25910impl ::std::convert::TryFrom<::std::string::String> for InputSkillId {
25911 type Error = self::error::ConversionError;
25912 fn try_from(
25913 value: ::std::string::String,
25914 ) -> ::std::result::Result<Self, self::error::ConversionError> {
25915 ::std::convert::TryFrom::try_from(value.as_str())
25916 }
25917}
25918impl<'de> ::serde::Deserialize<'de> for InputSkillId {
25919 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
25920 where
25921 D: ::serde::Deserializer<'de>,
25922 {
25923 ::std::convert::TryFrom::try_from(
25924 ::std::string::String::deserialize(deserializer)?,
25925 )
25926 .map_err(|e: self::error::ConversionError| {
25927 <D::Error as ::serde::de::Error>::custom(e.to_string())
25928 })
25929 }
25930}
25931pub mod builder {
25933 #[derive(Clone, Debug)]
25934 pub struct Input {
25935 revision: ::std::result::Result<
25936 ::std::option::Option<::std::string::String>,
25937 ::std::string::String,
25938 >,
25939 skill_id: ::std::result::Result<super::InputSkillId, ::std::string::String>,
25940 }
25941 impl ::std::default::Default for Input {
25942 fn default() -> Self {
25943 Self {
25944 revision: Ok(Default::default()),
25945 skill_id: Err("no value supplied for skill_id".to_string()),
25946 }
25947 }
25948 }
25949 impl Input {
25950 pub fn revision<T>(mut self, value: T) -> Self
25951 where
25952 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
25953 T::Error: ::std::fmt::Display,
25954 {
25955 self.revision = value
25956 .try_into()
25957 .map_err(|e| {
25958 format!("error converting supplied value for revision: {e}")
25959 });
25960 self
25961 }
25962 pub fn skill_id<T>(mut self, value: T) -> Self
25963 where
25964 T: ::std::convert::TryInto<super::InputSkillId>,
25965 T::Error: ::std::fmt::Display,
25966 {
25967 self.skill_id = value
25968 .try_into()
25969 .map_err(|e| {
25970 format!("error converting supplied value for skill_id: {e}")
25971 });
25972 self
25973 }
25974 }
25975 impl ::std::convert::TryFrom<Input> for super::Input {
25976 type Error = super::error::ConversionError;
25977 fn try_from(
25978 value: Input,
25979 ) -> ::std::result::Result<Self, super::error::ConversionError> {
25980 Ok(Self {
25981 revision: value.revision?,
25982 skill_id: value.skill_id?,
25983 })
25984 }
25985 }
25986 impl ::std::convert::From<super::Input> for Input {
25987 fn from(value: super::Input) -> Self {
25988 Self {
25989 revision: Ok(value.revision),
25990 skill_id: Ok(value.skill_id),
25991 }
25992 }
25993 }
25994}
25995pub mod error {
25997 pub struct ConversionError(::std::borrow::Cow<'static, str>);
25999 impl ::std::error::Error for ConversionError {}
26000 impl ::std::fmt::Display for ConversionError {
26001 fn fmt(
26002 &self,
26003 f: &mut ::std::fmt::Formatter<'_>,
26004 ) -> Result<(), ::std::fmt::Error> {
26005 ::std::fmt::Display::fmt(&self.0, f)
26006 }
26007 }
26008 impl ::std::fmt::Debug for ConversionError {
26009 fn fmt(
26010 &self,
26011 f: &mut ::std::fmt::Formatter<'_>,
26012 ) -> Result<(), ::std::fmt::Error> {
26013 ::std::fmt::Debug::fmt(&self.0, f)
26014 }
26015 }
26016 impl From<&'static str> for ConversionError {
26017 fn from(value: &'static str) -> Self {
26018 Self(value.into())
26019 }
26020 }
26021 impl From<String> for ConversionError {
26022 fn from(value: String) -> Self {
26023 Self(value.into())
26024 }
26025 }
26026}
26027
26028pub mod output {
26029#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
26031pub struct Error {
26032 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26034 pub code: ::std::option::Option<i64>,
26035 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26037 pub message: ::std::option::Option<::std::string::String>,
26038 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26040 pub param: ::std::option::Option<::std::string::String>,
26041 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
26043 pub type_: ::std::option::Option<::std::string::String>,
26044}
26045impl Error {
26046 pub fn builder() -> builder::Error {
26047 Default::default()
26048 }
26049}
26050#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
26052pub struct Output {
26053 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26055 pub created_at: ::std::option::Option<::std::string::String>,
26056 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26058 pub description: ::std::option::Option<::std::string::String>,
26059 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26060 pub error: ::std::option::Option<Error>,
26061 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26063 pub latest_revision: ::std::option::Option<::std::string::String>,
26064 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26066 pub name: ::std::option::Option<::std::string::String>,
26067 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26069 pub revision: ::std::option::Option<::std::string::String>,
26070 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26072 pub skill_id: ::std::option::Option<::std::string::String>,
26073 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26075 pub updated_at: ::std::option::Option<::std::string::String>,
26076}
26077impl Output {
26078 pub fn builder() -> builder::Output {
26079 Default::default()
26080 }
26081}
26082pub mod builder {
26084 #[derive(Clone, Debug)]
26085 pub struct Error {
26086 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
26087 message: ::std::result::Result<
26088 ::std::option::Option<::std::string::String>,
26089 ::std::string::String,
26090 >,
26091 param: ::std::result::Result<
26092 ::std::option::Option<::std::string::String>,
26093 ::std::string::String,
26094 >,
26095 type_: ::std::result::Result<
26096 ::std::option::Option<::std::string::String>,
26097 ::std::string::String,
26098 >,
26099 }
26100 impl ::std::default::Default for Error {
26101 fn default() -> Self {
26102 Self {
26103 code: Ok(Default::default()),
26104 message: Ok(Default::default()),
26105 param: Ok(Default::default()),
26106 type_: Ok(Default::default()),
26107 }
26108 }
26109 }
26110 impl Error {
26111 pub fn code<T>(mut self, value: T) -> Self
26112 where
26113 T: ::std::convert::TryInto<::std::option::Option<i64>>,
26114 T::Error: ::std::fmt::Display,
26115 {
26116 self.code = value
26117 .try_into()
26118 .map_err(|e| format!("error converting supplied value for code: {e}"));
26119 self
26120 }
26121 pub fn message<T>(mut self, value: T) -> Self
26122 where
26123 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26124 T::Error: ::std::fmt::Display,
26125 {
26126 self.message = value
26127 .try_into()
26128 .map_err(|e| {
26129 format!("error converting supplied value for message: {e}")
26130 });
26131 self
26132 }
26133 pub fn param<T>(mut self, value: T) -> Self
26134 where
26135 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26136 T::Error: ::std::fmt::Display,
26137 {
26138 self.param = value
26139 .try_into()
26140 .map_err(|e| format!("error converting supplied value for param: {e}"));
26141 self
26142 }
26143 pub fn type_<T>(mut self, value: T) -> Self
26144 where
26145 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26146 T::Error: ::std::fmt::Display,
26147 {
26148 self.type_ = value
26149 .try_into()
26150 .map_err(|e| format!("error converting supplied value for type_: {e}"));
26151 self
26152 }
26153 }
26154 impl ::std::convert::TryFrom<Error> for super::Error {
26155 type Error = super::error::ConversionError;
26156 fn try_from(
26157 value: Error,
26158 ) -> ::std::result::Result<Self, super::error::ConversionError> {
26159 Ok(Self {
26160 code: value.code?,
26161 message: value.message?,
26162 param: value.param?,
26163 type_: value.type_?,
26164 })
26165 }
26166 }
26167 impl ::std::convert::From<super::Error> for Error {
26168 fn from(value: super::Error) -> Self {
26169 Self {
26170 code: Ok(value.code),
26171 message: Ok(value.message),
26172 param: Ok(value.param),
26173 type_: Ok(value.type_),
26174 }
26175 }
26176 }
26177 #[derive(Clone, Debug)]
26178 pub struct Output {
26179 created_at: ::std::result::Result<
26180 ::std::option::Option<::std::string::String>,
26181 ::std::string::String,
26182 >,
26183 description: ::std::result::Result<
26184 ::std::option::Option<::std::string::String>,
26185 ::std::string::String,
26186 >,
26187 error: ::std::result::Result<
26188 ::std::option::Option<super::Error>,
26189 ::std::string::String,
26190 >,
26191 latest_revision: ::std::result::Result<
26192 ::std::option::Option<::std::string::String>,
26193 ::std::string::String,
26194 >,
26195 name: ::std::result::Result<
26196 ::std::option::Option<::std::string::String>,
26197 ::std::string::String,
26198 >,
26199 revision: ::std::result::Result<
26200 ::std::option::Option<::std::string::String>,
26201 ::std::string::String,
26202 >,
26203 skill_id: ::std::result::Result<
26204 ::std::option::Option<::std::string::String>,
26205 ::std::string::String,
26206 >,
26207 updated_at: ::std::result::Result<
26208 ::std::option::Option<::std::string::String>,
26209 ::std::string::String,
26210 >,
26211 }
26212 impl ::std::default::Default for Output {
26213 fn default() -> Self {
26214 Self {
26215 created_at: Ok(Default::default()),
26216 description: Ok(Default::default()),
26217 error: Ok(Default::default()),
26218 latest_revision: Ok(Default::default()),
26219 name: Ok(Default::default()),
26220 revision: Ok(Default::default()),
26221 skill_id: Ok(Default::default()),
26222 updated_at: Ok(Default::default()),
26223 }
26224 }
26225 }
26226 impl Output {
26227 pub fn created_at<T>(mut self, value: T) -> Self
26228 where
26229 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26230 T::Error: ::std::fmt::Display,
26231 {
26232 self.created_at = value
26233 .try_into()
26234 .map_err(|e| {
26235 format!("error converting supplied value for created_at: {e}")
26236 });
26237 self
26238 }
26239 pub fn description<T>(mut self, value: T) -> Self
26240 where
26241 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26242 T::Error: ::std::fmt::Display,
26243 {
26244 self.description = value
26245 .try_into()
26246 .map_err(|e| {
26247 format!("error converting supplied value for description: {e}")
26248 });
26249 self
26250 }
26251 pub fn error<T>(mut self, value: T) -> Self
26252 where
26253 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
26254 T::Error: ::std::fmt::Display,
26255 {
26256 self.error = value
26257 .try_into()
26258 .map_err(|e| format!("error converting supplied value for error: {e}"));
26259 self
26260 }
26261 pub fn latest_revision<T>(mut self, value: T) -> Self
26262 where
26263 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26264 T::Error: ::std::fmt::Display,
26265 {
26266 self.latest_revision = value
26267 .try_into()
26268 .map_err(|e| {
26269 format!("error converting supplied value for latest_revision: {e}")
26270 });
26271 self
26272 }
26273 pub fn name<T>(mut self, value: T) -> Self
26274 where
26275 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26276 T::Error: ::std::fmt::Display,
26277 {
26278 self.name = value
26279 .try_into()
26280 .map_err(|e| format!("error converting supplied value for name: {e}"));
26281 self
26282 }
26283 pub fn revision<T>(mut self, value: T) -> Self
26284 where
26285 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26286 T::Error: ::std::fmt::Display,
26287 {
26288 self.revision = value
26289 .try_into()
26290 .map_err(|e| {
26291 format!("error converting supplied value for revision: {e}")
26292 });
26293 self
26294 }
26295 pub fn skill_id<T>(mut self, value: T) -> Self
26296 where
26297 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26298 T::Error: ::std::fmt::Display,
26299 {
26300 self.skill_id = value
26301 .try_into()
26302 .map_err(|e| {
26303 format!("error converting supplied value for skill_id: {e}")
26304 });
26305 self
26306 }
26307 pub fn updated_at<T>(mut self, value: T) -> Self
26308 where
26309 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26310 T::Error: ::std::fmt::Display,
26311 {
26312 self.updated_at = value
26313 .try_into()
26314 .map_err(|e| {
26315 format!("error converting supplied value for updated_at: {e}")
26316 });
26317 self
26318 }
26319 }
26320 impl ::std::convert::TryFrom<Output> for super::Output {
26321 type Error = super::error::ConversionError;
26322 fn try_from(
26323 value: Output,
26324 ) -> ::std::result::Result<Self, super::error::ConversionError> {
26325 Ok(Self {
26326 created_at: value.created_at?,
26327 description: value.description?,
26328 error: value.error?,
26329 latest_revision: value.latest_revision?,
26330 name: value.name?,
26331 revision: value.revision?,
26332 skill_id: value.skill_id?,
26333 updated_at: value.updated_at?,
26334 })
26335 }
26336 }
26337 impl ::std::convert::From<super::Output> for Output {
26338 fn from(value: super::Output) -> Self {
26339 Self {
26340 created_at: Ok(value.created_at),
26341 description: Ok(value.description),
26342 error: Ok(value.error),
26343 latest_revision: Ok(value.latest_revision),
26344 name: Ok(value.name),
26345 revision: Ok(value.revision),
26346 skill_id: Ok(value.skill_id),
26347 updated_at: Ok(value.updated_at),
26348 }
26349 }
26350 }
26351}
26352pub mod error {
26354 pub struct ConversionError(::std::borrow::Cow<'static, str>);
26356 impl ::std::error::Error for ConversionError {}
26357 impl ::std::fmt::Display for ConversionError {
26358 fn fmt(
26359 &self,
26360 f: &mut ::std::fmt::Formatter<'_>,
26361 ) -> Result<(), ::std::fmt::Error> {
26362 ::std::fmt::Display::fmt(&self.0, f)
26363 }
26364 }
26365 impl ::std::fmt::Debug for ConversionError {
26366 fn fmt(
26367 &self,
26368 f: &mut ::std::fmt::Formatter<'_>,
26369 ) -> Result<(), ::std::fmt::Error> {
26370 ::std::fmt::Debug::fmt(&self.0, f)
26371 }
26372 }
26373 impl From<&'static str> for ConversionError {
26374 fn from(value: &'static str) -> Self {
26375 Self(value.into())
26376 }
26377 }
26378 impl From<String> for ConversionError {
26379 fn from(value: String) -> Self {
26380 Self(value.into())
26381 }
26382 }
26383}
26384
26385}
26386
26387 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "skillId", part: ::one::Part::Path, key: Some("skillId") }, ::one::Route { field: "revision", part: ::one::Part::Query, key: Some("revision") }], required_parts: &[::one::Part::Path] };
26389
26390 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
26400 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DIN3eKA::yhjbogK_SHWQZIhg-SoceQ", Method::GET, "/v1/skills/{{skillId}}").with_routed(&input, &ROUTING)?
26401 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
26402 }
26403
26404 impl IntoOperation for Input {
26405 type Output = output::Output;
26406
26407 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
26408 build(self)
26409 }
26410 }
26411 impl IntoOperation for builder::Input {
26412 type Output = output::Output;
26413
26414 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
26415 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
26416 }
26417 }
26418}
26419pub fn get_skill() -> get_skill::builder::Input {
26421 get_skill::builder::Input::default()
26422}
26423pub mod create_skill {
26424 use ::one::{Error, IntoOperation, Method, Operation};
26425#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
26427#[serde(deny_unknown_fields)]
26428pub struct Input {
26429 pub body: ::std::string::String,
26431}
26432impl Input {
26433 pub fn builder() -> builder::Input {
26434 Default::default()
26435 }
26436}
26437pub mod builder {
26439 #[derive(Clone, Debug)]
26440 pub struct Input {
26441 body: ::std::result::Result<::std::string::String, ::std::string::String>,
26442 }
26443 impl ::std::default::Default for Input {
26444 fn default() -> Self {
26445 Self {
26446 body: Err("no value supplied for body".to_string()),
26447 }
26448 }
26449 }
26450 impl Input {
26451 pub fn body<T>(mut self, value: T) -> Self
26452 where
26453 T: ::std::convert::TryInto<::std::string::String>,
26454 T::Error: ::std::fmt::Display,
26455 {
26456 self.body = value
26457 .try_into()
26458 .map_err(|e| format!("error converting supplied value for body: {e}"));
26459 self
26460 }
26461 }
26462 impl ::std::convert::TryFrom<Input> for super::Input {
26463 type Error = super::error::ConversionError;
26464 fn try_from(
26465 value: Input,
26466 ) -> ::std::result::Result<Self, super::error::ConversionError> {
26467 Ok(Self { body: value.body? })
26468 }
26469 }
26470 impl ::std::convert::From<super::Input> for Input {
26471 fn from(value: super::Input) -> Self {
26472 Self { body: Ok(value.body) }
26473 }
26474 }
26475}
26476pub mod error {
26478 pub struct ConversionError(::std::borrow::Cow<'static, str>);
26480 impl ::std::error::Error for ConversionError {}
26481 impl ::std::fmt::Display for ConversionError {
26482 fn fmt(
26483 &self,
26484 f: &mut ::std::fmt::Formatter<'_>,
26485 ) -> Result<(), ::std::fmt::Error> {
26486 ::std::fmt::Display::fmt(&self.0, f)
26487 }
26488 }
26489 impl ::std::fmt::Debug for ConversionError {
26490 fn fmt(
26491 &self,
26492 f: &mut ::std::fmt::Formatter<'_>,
26493 ) -> Result<(), ::std::fmt::Error> {
26494 ::std::fmt::Debug::fmt(&self.0, f)
26495 }
26496 }
26497 impl From<&'static str> for ConversionError {
26498 fn from(value: &'static str) -> Self {
26499 Self(value.into())
26500 }
26501 }
26502 impl From<String> for ConversionError {
26503 fn from(value: String) -> Self {
26504 Self(value.into())
26505 }
26506 }
26507}
26508
26509pub mod output {
26510#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
26512pub struct Error {
26513 pub code: i64,
26515 pub message: ::std::string::String,
26517 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26519 pub param: ::std::option::Option<::std::string::String>,
26520 #[serde(rename = "type")]
26522 pub type_: ::std::string::String,
26523}
26524impl Error {
26525 pub fn builder() -> builder::Error {
26526 Default::default()
26527 }
26528}
26529#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
26531pub struct Output {
26532 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26534 pub created_at: ::std::option::Option<::std::string::String>,
26535 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26537 pub description: ::std::option::Option<::std::string::String>,
26538 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26539 pub error: ::std::option::Option<Error>,
26540 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26542 pub latest_revision: ::std::option::Option<::std::string::String>,
26543 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26545 pub name: ::std::option::Option<::std::string::String>,
26546 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26548 pub revision: ::std::option::Option<::std::string::String>,
26549 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26551 pub skill_id: ::std::option::Option<::std::string::String>,
26552 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
26554 pub updated_at: ::std::option::Option<::std::string::String>,
26555}
26556impl Output {
26557 pub fn builder() -> builder::Output {
26558 Default::default()
26559 }
26560}
26561pub mod builder {
26563 #[derive(Clone, Debug)]
26564 pub struct Error {
26565 code: ::std::result::Result<i64, ::std::string::String>,
26566 message: ::std::result::Result<::std::string::String, ::std::string::String>,
26567 param: ::std::result::Result<
26568 ::std::option::Option<::std::string::String>,
26569 ::std::string::String,
26570 >,
26571 type_: ::std::result::Result<::std::string::String, ::std::string::String>,
26572 }
26573 impl ::std::default::Default for Error {
26574 fn default() -> Self {
26575 Self {
26576 code: Err("no value supplied for code".to_string()),
26577 message: Err("no value supplied for message".to_string()),
26578 param: Ok(Default::default()),
26579 type_: Err("no value supplied for type_".to_string()),
26580 }
26581 }
26582 }
26583 impl Error {
26584 pub fn code<T>(mut self, value: T) -> Self
26585 where
26586 T: ::std::convert::TryInto<i64>,
26587 T::Error: ::std::fmt::Display,
26588 {
26589 self.code = value
26590 .try_into()
26591 .map_err(|e| format!("error converting supplied value for code: {e}"));
26592 self
26593 }
26594 pub fn message<T>(mut self, value: T) -> Self
26595 where
26596 T: ::std::convert::TryInto<::std::string::String>,
26597 T::Error: ::std::fmt::Display,
26598 {
26599 self.message = value
26600 .try_into()
26601 .map_err(|e| {
26602 format!("error converting supplied value for message: {e}")
26603 });
26604 self
26605 }
26606 pub fn param<T>(mut self, value: T) -> Self
26607 where
26608 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26609 T::Error: ::std::fmt::Display,
26610 {
26611 self.param = value
26612 .try_into()
26613 .map_err(|e| format!("error converting supplied value for param: {e}"));
26614 self
26615 }
26616 pub fn type_<T>(mut self, value: T) -> Self
26617 where
26618 T: ::std::convert::TryInto<::std::string::String>,
26619 T::Error: ::std::fmt::Display,
26620 {
26621 self.type_ = value
26622 .try_into()
26623 .map_err(|e| format!("error converting supplied value for type_: {e}"));
26624 self
26625 }
26626 }
26627 impl ::std::convert::TryFrom<Error> for super::Error {
26628 type Error = super::error::ConversionError;
26629 fn try_from(
26630 value: Error,
26631 ) -> ::std::result::Result<Self, super::error::ConversionError> {
26632 Ok(Self {
26633 code: value.code?,
26634 message: value.message?,
26635 param: value.param?,
26636 type_: value.type_?,
26637 })
26638 }
26639 }
26640 impl ::std::convert::From<super::Error> for Error {
26641 fn from(value: super::Error) -> Self {
26642 Self {
26643 code: Ok(value.code),
26644 message: Ok(value.message),
26645 param: Ok(value.param),
26646 type_: Ok(value.type_),
26647 }
26648 }
26649 }
26650 #[derive(Clone, Debug)]
26651 pub struct Output {
26652 created_at: ::std::result::Result<
26653 ::std::option::Option<::std::string::String>,
26654 ::std::string::String,
26655 >,
26656 description: ::std::result::Result<
26657 ::std::option::Option<::std::string::String>,
26658 ::std::string::String,
26659 >,
26660 error: ::std::result::Result<
26661 ::std::option::Option<super::Error>,
26662 ::std::string::String,
26663 >,
26664 latest_revision: ::std::result::Result<
26665 ::std::option::Option<::std::string::String>,
26666 ::std::string::String,
26667 >,
26668 name: ::std::result::Result<
26669 ::std::option::Option<::std::string::String>,
26670 ::std::string::String,
26671 >,
26672 revision: ::std::result::Result<
26673 ::std::option::Option<::std::string::String>,
26674 ::std::string::String,
26675 >,
26676 skill_id: ::std::result::Result<
26677 ::std::option::Option<::std::string::String>,
26678 ::std::string::String,
26679 >,
26680 updated_at: ::std::result::Result<
26681 ::std::option::Option<::std::string::String>,
26682 ::std::string::String,
26683 >,
26684 }
26685 impl ::std::default::Default for Output {
26686 fn default() -> Self {
26687 Self {
26688 created_at: Ok(Default::default()),
26689 description: Ok(Default::default()),
26690 error: Ok(Default::default()),
26691 latest_revision: Ok(Default::default()),
26692 name: Ok(Default::default()),
26693 revision: Ok(Default::default()),
26694 skill_id: Ok(Default::default()),
26695 updated_at: Ok(Default::default()),
26696 }
26697 }
26698 }
26699 impl Output {
26700 pub fn created_at<T>(mut self, value: T) -> Self
26701 where
26702 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26703 T::Error: ::std::fmt::Display,
26704 {
26705 self.created_at = value
26706 .try_into()
26707 .map_err(|e| {
26708 format!("error converting supplied value for created_at: {e}")
26709 });
26710 self
26711 }
26712 pub fn description<T>(mut self, value: T) -> Self
26713 where
26714 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26715 T::Error: ::std::fmt::Display,
26716 {
26717 self.description = value
26718 .try_into()
26719 .map_err(|e| {
26720 format!("error converting supplied value for description: {e}")
26721 });
26722 self
26723 }
26724 pub fn error<T>(mut self, value: T) -> Self
26725 where
26726 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
26727 T::Error: ::std::fmt::Display,
26728 {
26729 self.error = value
26730 .try_into()
26731 .map_err(|e| format!("error converting supplied value for error: {e}"));
26732 self
26733 }
26734 pub fn latest_revision<T>(mut self, value: T) -> Self
26735 where
26736 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26737 T::Error: ::std::fmt::Display,
26738 {
26739 self.latest_revision = value
26740 .try_into()
26741 .map_err(|e| {
26742 format!("error converting supplied value for latest_revision: {e}")
26743 });
26744 self
26745 }
26746 pub fn name<T>(mut self, value: T) -> Self
26747 where
26748 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26749 T::Error: ::std::fmt::Display,
26750 {
26751 self.name = value
26752 .try_into()
26753 .map_err(|e| format!("error converting supplied value for name: {e}"));
26754 self
26755 }
26756 pub fn revision<T>(mut self, value: T) -> Self
26757 where
26758 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26759 T::Error: ::std::fmt::Display,
26760 {
26761 self.revision = value
26762 .try_into()
26763 .map_err(|e| {
26764 format!("error converting supplied value for revision: {e}")
26765 });
26766 self
26767 }
26768 pub fn skill_id<T>(mut self, value: T) -> Self
26769 where
26770 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26771 T::Error: ::std::fmt::Display,
26772 {
26773 self.skill_id = value
26774 .try_into()
26775 .map_err(|e| {
26776 format!("error converting supplied value for skill_id: {e}")
26777 });
26778 self
26779 }
26780 pub fn updated_at<T>(mut self, value: T) -> Self
26781 where
26782 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
26783 T::Error: ::std::fmt::Display,
26784 {
26785 self.updated_at = value
26786 .try_into()
26787 .map_err(|e| {
26788 format!("error converting supplied value for updated_at: {e}")
26789 });
26790 self
26791 }
26792 }
26793 impl ::std::convert::TryFrom<Output> for super::Output {
26794 type Error = super::error::ConversionError;
26795 fn try_from(
26796 value: Output,
26797 ) -> ::std::result::Result<Self, super::error::ConversionError> {
26798 Ok(Self {
26799 created_at: value.created_at?,
26800 description: value.description?,
26801 error: value.error?,
26802 latest_revision: value.latest_revision?,
26803 name: value.name?,
26804 revision: value.revision?,
26805 skill_id: value.skill_id?,
26806 updated_at: value.updated_at?,
26807 })
26808 }
26809 }
26810 impl ::std::convert::From<super::Output> for Output {
26811 fn from(value: super::Output) -> Self {
26812 Self {
26813 created_at: Ok(value.created_at),
26814 description: Ok(value.description),
26815 error: Ok(value.error),
26816 latest_revision: Ok(value.latest_revision),
26817 name: Ok(value.name),
26818 revision: Ok(value.revision),
26819 skill_id: Ok(value.skill_id),
26820 updated_at: Ok(value.updated_at),
26821 }
26822 }
26823 }
26824}
26825pub mod error {
26827 pub struct ConversionError(::std::borrow::Cow<'static, str>);
26829 impl ::std::error::Error for ConversionError {}
26830 impl ::std::fmt::Display for ConversionError {
26831 fn fmt(
26832 &self,
26833 f: &mut ::std::fmt::Formatter<'_>,
26834 ) -> Result<(), ::std::fmt::Error> {
26835 ::std::fmt::Display::fmt(&self.0, f)
26836 }
26837 }
26838 impl ::std::fmt::Debug for ConversionError {
26839 fn fmt(
26840 &self,
26841 f: &mut ::std::fmt::Formatter<'_>,
26842 ) -> Result<(), ::std::fmt::Error> {
26843 ::std::fmt::Debug::fmt(&self.0, f)
26844 }
26845 }
26846 impl From<&'static str> for ConversionError {
26847 fn from(value: &'static str) -> Self {
26848 Self(value.into())
26849 }
26850 }
26851 impl From<String> for ConversionError {
26852 fn from(value: String) -> Self {
26853 Self(value.into())
26854 }
26855 }
26856}
26857
26858}
26859
26860 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "body", part: ::one::Part::Body, key: None }], required_parts: &[] };
26862
26863 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
26872 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DIbW82g::sDPpYm1SRS--29tChlbS8Q", Method::POST, "/v1/skills").with_routed(&input, &ROUTING)?
26873 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
26874 }
26875
26876 impl IntoOperation for Input {
26877 type Output = output::Output;
26878
26879 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
26880 build(self)
26881 }
26882 }
26883 impl IntoOperation for builder::Input {
26884 type Output = output::Output;
26885
26886 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
26887 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
26888 }
26889 }
26890}
26891pub fn create_skill() -> create_skill::builder::Input {
26893 create_skill::builder::Input::default()
26894}
26895pub mod delete_skill {
26896 use ::one::{Error, IntoOperation, Method, Operation};
26897#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
26899#[serde(deny_unknown_fields)]
26900pub struct Input {
26901 pub expected_revision: InputExpectedRevision,
26903 #[serde(rename = "skillId")]
26905 pub skill_id: InputSkillId,
26906}
26907impl Input {
26908 pub fn builder() -> builder::Input {
26909 Default::default()
26910 }
26911}
26912#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26914#[serde(transparent)]
26915pub struct InputExpectedRevision(::std::string::String);
26916impl ::std::ops::Deref for InputExpectedRevision {
26917 type Target = ::std::string::String;
26918 fn deref(&self) -> &::std::string::String {
26919 &self.0
26920 }
26921}
26922impl ::std::convert::From<InputExpectedRevision> for ::std::string::String {
26923 fn from(value: InputExpectedRevision) -> Self {
26924 value.0
26925 }
26926}
26927impl ::std::str::FromStr for InputExpectedRevision {
26928 type Err = self::error::ConversionError;
26929 fn from_str(
26930 value: &str,
26931 ) -> ::std::result::Result<Self, self::error::ConversionError> {
26932 ::std::convert::TryFrom::try_from(value)
26933 }
26934}
26935impl ::std::convert::TryFrom<&str> for InputExpectedRevision {
26936 type Error = self::error::ConversionError;
26937 fn try_from(
26938 value: &str,
26939 ) -> ::std::result::Result<Self, self::error::ConversionError> {
26940 if value.chars().count() < 1usize {
26941 return Err("shorter than 1 characters".into());
26942 }
26943 Ok(Self(value.to_string()))
26944 }
26945}
26946impl ::std::convert::TryFrom<::std::string::String> for InputExpectedRevision {
26947 type Error = self::error::ConversionError;
26948 fn try_from(
26949 value: ::std::string::String,
26950 ) -> ::std::result::Result<Self, self::error::ConversionError> {
26951 ::std::convert::TryFrom::try_from(value.as_str())
26952 }
26953}
26954impl<'de> ::serde::Deserialize<'de> for InputExpectedRevision {
26955 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
26956 where
26957 D: ::serde::Deserializer<'de>,
26958 {
26959 ::std::convert::TryFrom::try_from(
26960 ::std::string::String::deserialize(deserializer)?,
26961 )
26962 .map_err(|e: self::error::ConversionError| {
26963 <D::Error as ::serde::de::Error>::custom(e.to_string())
26964 })
26965 }
26966}
26967#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26969#[serde(transparent)]
26970pub struct InputSkillId(::std::string::String);
26971impl ::std::ops::Deref for InputSkillId {
26972 type Target = ::std::string::String;
26973 fn deref(&self) -> &::std::string::String {
26974 &self.0
26975 }
26976}
26977impl ::std::convert::From<InputSkillId> for ::std::string::String {
26978 fn from(value: InputSkillId) -> Self {
26979 value.0
26980 }
26981}
26982impl ::std::str::FromStr for InputSkillId {
26983 type Err = self::error::ConversionError;
26984 fn from_str(
26985 value: &str,
26986 ) -> ::std::result::Result<Self, self::error::ConversionError> {
26987 ::std::convert::TryFrom::try_from(value)
26988 }
26989}
26990impl ::std::convert::TryFrom<&str> for InputSkillId {
26991 type Error = self::error::ConversionError;
26992 fn try_from(
26993 value: &str,
26994 ) -> ::std::result::Result<Self, self::error::ConversionError> {
26995 if value.chars().count() < 1usize {
26996 return Err("shorter than 1 characters".into());
26997 }
26998 Ok(Self(value.to_string()))
26999 }
27000}
27001impl ::std::convert::TryFrom<::std::string::String> for InputSkillId {
27002 type Error = self::error::ConversionError;
27003 fn try_from(
27004 value: ::std::string::String,
27005 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27006 ::std::convert::TryFrom::try_from(value.as_str())
27007 }
27008}
27009impl<'de> ::serde::Deserialize<'de> for InputSkillId {
27010 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
27011 where
27012 D: ::serde::Deserializer<'de>,
27013 {
27014 ::std::convert::TryFrom::try_from(
27015 ::std::string::String::deserialize(deserializer)?,
27016 )
27017 .map_err(|e: self::error::ConversionError| {
27018 <D::Error as ::serde::de::Error>::custom(e.to_string())
27019 })
27020 }
27021}
27022pub mod builder {
27024 #[derive(Clone, Debug)]
27025 pub struct Input {
27026 expected_revision: ::std::result::Result<
27027 super::InputExpectedRevision,
27028 ::std::string::String,
27029 >,
27030 skill_id: ::std::result::Result<super::InputSkillId, ::std::string::String>,
27031 }
27032 impl ::std::default::Default for Input {
27033 fn default() -> Self {
27034 Self {
27035 expected_revision: Err(
27036 "no value supplied for expected_revision".to_string(),
27037 ),
27038 skill_id: Err("no value supplied for skill_id".to_string()),
27039 }
27040 }
27041 }
27042 impl Input {
27043 pub fn expected_revision<T>(mut self, value: T) -> Self
27044 where
27045 T: ::std::convert::TryInto<super::InputExpectedRevision>,
27046 T::Error: ::std::fmt::Display,
27047 {
27048 self.expected_revision = value
27049 .try_into()
27050 .map_err(|e| {
27051 format!("error converting supplied value for expected_revision: {e}")
27052 });
27053 self
27054 }
27055 pub fn skill_id<T>(mut self, value: T) -> Self
27056 where
27057 T: ::std::convert::TryInto<super::InputSkillId>,
27058 T::Error: ::std::fmt::Display,
27059 {
27060 self.skill_id = value
27061 .try_into()
27062 .map_err(|e| {
27063 format!("error converting supplied value for skill_id: {e}")
27064 });
27065 self
27066 }
27067 }
27068 impl ::std::convert::TryFrom<Input> for super::Input {
27069 type Error = super::error::ConversionError;
27070 fn try_from(
27071 value: Input,
27072 ) -> ::std::result::Result<Self, super::error::ConversionError> {
27073 Ok(Self {
27074 expected_revision: value.expected_revision?,
27075 skill_id: value.skill_id?,
27076 })
27077 }
27078 }
27079 impl ::std::convert::From<super::Input> for Input {
27080 fn from(value: super::Input) -> Self {
27081 Self {
27082 expected_revision: Ok(value.expected_revision),
27083 skill_id: Ok(value.skill_id),
27084 }
27085 }
27086 }
27087}
27088pub mod error {
27090 pub struct ConversionError(::std::borrow::Cow<'static, str>);
27092 impl ::std::error::Error for ConversionError {}
27093 impl ::std::fmt::Display for ConversionError {
27094 fn fmt(
27095 &self,
27096 f: &mut ::std::fmt::Formatter<'_>,
27097 ) -> Result<(), ::std::fmt::Error> {
27098 ::std::fmt::Display::fmt(&self.0, f)
27099 }
27100 }
27101 impl ::std::fmt::Debug for ConversionError {
27102 fn fmt(
27103 &self,
27104 f: &mut ::std::fmt::Formatter<'_>,
27105 ) -> Result<(), ::std::fmt::Error> {
27106 ::std::fmt::Debug::fmt(&self.0, f)
27107 }
27108 }
27109 impl From<&'static str> for ConversionError {
27110 fn from(value: &'static str) -> Self {
27111 Self(value.into())
27112 }
27113 }
27114 impl From<String> for ConversionError {
27115 fn from(value: String) -> Self {
27116 Self(value.into())
27117 }
27118 }
27119}
27120
27121pub mod output {
27122#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
27124pub struct Error {
27125 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27127 pub code: ::std::option::Option<ErrorCode>,
27128 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27130 pub message: ::std::option::Option<::std::string::String>,
27131 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27133 pub param: ::std::option::Option<::std::string::String>,
27134 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
27136 pub type_: ::std::option::Option<ErrorType>,
27137}
27138impl Error {
27139 pub fn builder() -> builder::Error {
27140 Default::default()
27141 }
27142}
27143#[derive(::serde::Serialize, Clone, Debug)]
27145#[serde(transparent)]
27146pub struct ErrorCode(i64);
27147impl ::std::ops::Deref for ErrorCode {
27148 type Target = i64;
27149 fn deref(&self) -> &i64 {
27150 &self.0
27151 }
27152}
27153impl ::std::convert::From<ErrorCode> for i64 {
27154 fn from(value: ErrorCode) -> Self {
27155 value.0
27156 }
27157}
27158impl ::std::str::FromStr for ErrorCode {
27159 type Err = self::error::ConversionError;
27160 fn from_str(
27161 value: &str,
27162 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27163 value
27164 .parse::<i64>()
27165 .map_err(|e| ::std::string::ToString::to_string(&e).into())
27166 .and_then(Self::try_from)
27167 }
27168}
27169impl ::std::convert::TryFrom<i64> for ErrorCode {
27170 type Error = self::error::ConversionError;
27171 fn try_from(
27172 value: i64,
27173 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27174 if ![400_i64, 404_i64, 409_i64, 429_i64, 502_i64].contains(&value) {
27175 Err("invalid value".into())
27176 } else {
27177 Ok(Self(value))
27178 }
27179 }
27180}
27181impl<'de> ::serde::Deserialize<'de> for ErrorCode {
27182 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
27183 where
27184 D: ::serde::Deserializer<'de>,
27185 {
27186 Self::try_from(<i64>::deserialize(deserializer)?)
27187 .map_err(|e| { <D::Error as ::serde::de::Error>::custom(e.to_string()) })
27188 }
27189}
27190#[derive(
27192 ::serde::Deserialize,
27193 ::serde::Serialize,
27194 Clone,
27195 Copy,
27196 Debug,
27197 Eq,
27198 Hash,
27199 Ord,
27200 PartialEq,
27201 PartialOrd
27202)]
27203pub enum ErrorType {
27204 #[serde(rename = "invalid_request_error")]
27205 InvalidRequestError,
27206 #[serde(rename = "not_found_error")]
27207 NotFoundError,
27208 #[serde(rename = "conflict_error")]
27209 ConflictError,
27210 #[serde(rename = "rate_limit_error")]
27211 RateLimitError,
27212 #[serde(rename = "service_unavailable_error")]
27213 ServiceUnavailableError,
27214}
27215impl ::std::fmt::Display for ErrorType {
27216 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
27217 match *self {
27218 Self::InvalidRequestError => f.write_str("invalid_request_error"),
27219 Self::NotFoundError => f.write_str("not_found_error"),
27220 Self::ConflictError => f.write_str("conflict_error"),
27221 Self::RateLimitError => f.write_str("rate_limit_error"),
27222 Self::ServiceUnavailableError => f.write_str("service_unavailable_error"),
27223 }
27224 }
27225}
27226impl ::std::str::FromStr for ErrorType {
27227 type Err = self::error::ConversionError;
27228 fn from_str(
27229 value: &str,
27230 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27231 match value {
27232 "invalid_request_error" => Ok(Self::InvalidRequestError),
27233 "not_found_error" => Ok(Self::NotFoundError),
27234 "conflict_error" => Ok(Self::ConflictError),
27235 "rate_limit_error" => Ok(Self::RateLimitError),
27236 "service_unavailable_error" => Ok(Self::ServiceUnavailableError),
27237 _ => Err("invalid value".into()),
27238 }
27239 }
27240}
27241impl ::std::convert::TryFrom<&str> for ErrorType {
27242 type Error = self::error::ConversionError;
27243 fn try_from(
27244 value: &str,
27245 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27246 value.parse()
27247 }
27248}
27249impl ::std::convert::TryFrom<::std::string::String> for ErrorType {
27250 type Error = self::error::ConversionError;
27251 fn try_from(
27252 value: ::std::string::String,
27253 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27254 value.parse()
27255 }
27256}
27257#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
27259pub struct Output {
27260 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27261 pub error: ::std::option::Option<Error>,
27262}
27263impl Output {
27264 pub fn builder() -> builder::Output {
27265 Default::default()
27266 }
27267}
27268pub mod builder {
27270 #[derive(Clone, Debug)]
27271 pub struct Error {
27272 code: ::std::result::Result<
27273 ::std::option::Option<super::ErrorCode>,
27274 ::std::string::String,
27275 >,
27276 message: ::std::result::Result<
27277 ::std::option::Option<::std::string::String>,
27278 ::std::string::String,
27279 >,
27280 param: ::std::result::Result<
27281 ::std::option::Option<::std::string::String>,
27282 ::std::string::String,
27283 >,
27284 type_: ::std::result::Result<
27285 ::std::option::Option<super::ErrorType>,
27286 ::std::string::String,
27287 >,
27288 }
27289 impl ::std::default::Default for Error {
27290 fn default() -> Self {
27291 Self {
27292 code: Ok(Default::default()),
27293 message: Ok(Default::default()),
27294 param: Ok(Default::default()),
27295 type_: Ok(Default::default()),
27296 }
27297 }
27298 }
27299 impl Error {
27300 pub fn code<T>(mut self, value: T) -> Self
27301 where
27302 T: ::std::convert::TryInto<::std::option::Option<super::ErrorCode>>,
27303 T::Error: ::std::fmt::Display,
27304 {
27305 self.code = value
27306 .try_into()
27307 .map_err(|e| format!("error converting supplied value for code: {e}"));
27308 self
27309 }
27310 pub fn message<T>(mut self, value: T) -> Self
27311 where
27312 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
27313 T::Error: ::std::fmt::Display,
27314 {
27315 self.message = value
27316 .try_into()
27317 .map_err(|e| {
27318 format!("error converting supplied value for message: {e}")
27319 });
27320 self
27321 }
27322 pub fn param<T>(mut self, value: T) -> Self
27323 where
27324 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
27325 T::Error: ::std::fmt::Display,
27326 {
27327 self.param = value
27328 .try_into()
27329 .map_err(|e| format!("error converting supplied value for param: {e}"));
27330 self
27331 }
27332 pub fn type_<T>(mut self, value: T) -> Self
27333 where
27334 T: ::std::convert::TryInto<::std::option::Option<super::ErrorType>>,
27335 T::Error: ::std::fmt::Display,
27336 {
27337 self.type_ = value
27338 .try_into()
27339 .map_err(|e| format!("error converting supplied value for type_: {e}"));
27340 self
27341 }
27342 }
27343 impl ::std::convert::TryFrom<Error> for super::Error {
27344 type Error = super::error::ConversionError;
27345 fn try_from(
27346 value: Error,
27347 ) -> ::std::result::Result<Self, super::error::ConversionError> {
27348 Ok(Self {
27349 code: value.code?,
27350 message: value.message?,
27351 param: value.param?,
27352 type_: value.type_?,
27353 })
27354 }
27355 }
27356 impl ::std::convert::From<super::Error> for Error {
27357 fn from(value: super::Error) -> Self {
27358 Self {
27359 code: Ok(value.code),
27360 message: Ok(value.message),
27361 param: Ok(value.param),
27362 type_: Ok(value.type_),
27363 }
27364 }
27365 }
27366 #[derive(Clone, Debug)]
27367 pub struct Output {
27368 error: ::std::result::Result<
27369 ::std::option::Option<super::Error>,
27370 ::std::string::String,
27371 >,
27372 }
27373 impl ::std::default::Default for Output {
27374 fn default() -> Self {
27375 Self {
27376 error: Ok(Default::default()),
27377 }
27378 }
27379 }
27380 impl Output {
27381 pub fn error<T>(mut self, value: T) -> Self
27382 where
27383 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
27384 T::Error: ::std::fmt::Display,
27385 {
27386 self.error = value
27387 .try_into()
27388 .map_err(|e| format!("error converting supplied value for error: {e}"));
27389 self
27390 }
27391 }
27392 impl ::std::convert::TryFrom<Output> for super::Output {
27393 type Error = super::error::ConversionError;
27394 fn try_from(
27395 value: Output,
27396 ) -> ::std::result::Result<Self, super::error::ConversionError> {
27397 Ok(Self { error: value.error? })
27398 }
27399 }
27400 impl ::std::convert::From<super::Output> for Output {
27401 fn from(value: super::Output) -> Self {
27402 Self { error: Ok(value.error) }
27403 }
27404 }
27405}
27406pub mod error {
27408 pub struct ConversionError(::std::borrow::Cow<'static, str>);
27410 impl ::std::error::Error for ConversionError {}
27411 impl ::std::fmt::Display for ConversionError {
27412 fn fmt(
27413 &self,
27414 f: &mut ::std::fmt::Formatter<'_>,
27415 ) -> Result<(), ::std::fmt::Error> {
27416 ::std::fmt::Display::fmt(&self.0, f)
27417 }
27418 }
27419 impl ::std::fmt::Debug for ConversionError {
27420 fn fmt(
27421 &self,
27422 f: &mut ::std::fmt::Formatter<'_>,
27423 ) -> Result<(), ::std::fmt::Error> {
27424 ::std::fmt::Debug::fmt(&self.0, f)
27425 }
27426 }
27427 impl From<&'static str> for ConversionError {
27428 fn from(value: &'static str) -> Self {
27429 Self(value.into())
27430 }
27431 }
27432 impl From<String> for ConversionError {
27433 fn from(value: String) -> Self {
27434 Self(value.into())
27435 }
27436 }
27437}
27438
27439}
27440
27441 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "skillId", part: ::one::Part::Path, key: Some("skillId") }, ::one::Route { field: "expected_revision", part: ::one::Part::Query, key: Some("expected_revision") }], required_parts: &[::one::Part::Path, ::one::Part::Query] };
27443
27444 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
27454 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DIr6ahA::g_T7ajOaRJiWdwnyT-FW1w", Method::DELETE, "/v1/skills/{{skillId}}").with_routed(&input, &ROUTING)?
27455 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
27456 }
27457
27458 impl IntoOperation for Input {
27459 type Output = output::Output;
27460
27461 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
27462 build(self)
27463 }
27464 }
27465 impl IntoOperation for builder::Input {
27466 type Output = output::Output;
27467
27468 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
27469 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
27470 }
27471 }
27472}
27473pub fn delete_skill() -> delete_skill::builder::Input {
27475 delete_skill::builder::Input::default()
27476}
27477pub mod add_skill_revision {
27478 use ::one::{Error, IntoOperation, Method, Operation};
27479#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
27481#[serde(deny_unknown_fields)]
27482pub struct Input {
27483 pub body: ::std::string::String,
27485 pub expected_revision: ::std::string::String,
27487 #[serde(rename = "skillId")]
27489 pub skill_id: InputSkillId,
27490}
27491impl Input {
27492 pub fn builder() -> builder::Input {
27493 Default::default()
27494 }
27495}
27496#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27498#[serde(transparent)]
27499pub struct InputSkillId(::std::string::String);
27500impl ::std::ops::Deref for InputSkillId {
27501 type Target = ::std::string::String;
27502 fn deref(&self) -> &::std::string::String {
27503 &self.0
27504 }
27505}
27506impl ::std::convert::From<InputSkillId> for ::std::string::String {
27507 fn from(value: InputSkillId) -> Self {
27508 value.0
27509 }
27510}
27511impl ::std::str::FromStr for InputSkillId {
27512 type Err = self::error::ConversionError;
27513 fn from_str(
27514 value: &str,
27515 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27516 ::std::convert::TryFrom::try_from(value)
27517 }
27518}
27519impl ::std::convert::TryFrom<&str> for InputSkillId {
27520 type Error = self::error::ConversionError;
27521 fn try_from(
27522 value: &str,
27523 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27524 if value.chars().count() < 1usize {
27525 return Err("shorter than 1 characters".into());
27526 }
27527 Ok(Self(value.to_string()))
27528 }
27529}
27530impl ::std::convert::TryFrom<::std::string::String> for InputSkillId {
27531 type Error = self::error::ConversionError;
27532 fn try_from(
27533 value: ::std::string::String,
27534 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27535 ::std::convert::TryFrom::try_from(value.as_str())
27536 }
27537}
27538impl<'de> ::serde::Deserialize<'de> for InputSkillId {
27539 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
27540 where
27541 D: ::serde::Deserializer<'de>,
27542 {
27543 ::std::convert::TryFrom::try_from(
27544 ::std::string::String::deserialize(deserializer)?,
27545 )
27546 .map_err(|e: self::error::ConversionError| {
27547 <D::Error as ::serde::de::Error>::custom(e.to_string())
27548 })
27549 }
27550}
27551pub mod builder {
27553 #[derive(Clone, Debug)]
27554 pub struct Input {
27555 body: ::std::result::Result<::std::string::String, ::std::string::String>,
27556 expected_revision: ::std::result::Result<
27557 ::std::string::String,
27558 ::std::string::String,
27559 >,
27560 skill_id: ::std::result::Result<super::InputSkillId, ::std::string::String>,
27561 }
27562 impl ::std::default::Default for Input {
27563 fn default() -> Self {
27564 Self {
27565 body: Err("no value supplied for body".to_string()),
27566 expected_revision: Err(
27567 "no value supplied for expected_revision".to_string(),
27568 ),
27569 skill_id: Err("no value supplied for skill_id".to_string()),
27570 }
27571 }
27572 }
27573 impl Input {
27574 pub fn body<T>(mut self, value: T) -> Self
27575 where
27576 T: ::std::convert::TryInto<::std::string::String>,
27577 T::Error: ::std::fmt::Display,
27578 {
27579 self.body = value
27580 .try_into()
27581 .map_err(|e| format!("error converting supplied value for body: {e}"));
27582 self
27583 }
27584 pub fn expected_revision<T>(mut self, value: T) -> Self
27585 where
27586 T: ::std::convert::TryInto<::std::string::String>,
27587 T::Error: ::std::fmt::Display,
27588 {
27589 self.expected_revision = value
27590 .try_into()
27591 .map_err(|e| {
27592 format!("error converting supplied value for expected_revision: {e}")
27593 });
27594 self
27595 }
27596 pub fn skill_id<T>(mut self, value: T) -> Self
27597 where
27598 T: ::std::convert::TryInto<super::InputSkillId>,
27599 T::Error: ::std::fmt::Display,
27600 {
27601 self.skill_id = value
27602 .try_into()
27603 .map_err(|e| {
27604 format!("error converting supplied value for skill_id: {e}")
27605 });
27606 self
27607 }
27608 }
27609 impl ::std::convert::TryFrom<Input> for super::Input {
27610 type Error = super::error::ConversionError;
27611 fn try_from(
27612 value: Input,
27613 ) -> ::std::result::Result<Self, super::error::ConversionError> {
27614 Ok(Self {
27615 body: value.body?,
27616 expected_revision: value.expected_revision?,
27617 skill_id: value.skill_id?,
27618 })
27619 }
27620 }
27621 impl ::std::convert::From<super::Input> for Input {
27622 fn from(value: super::Input) -> Self {
27623 Self {
27624 body: Ok(value.body),
27625 expected_revision: Ok(value.expected_revision),
27626 skill_id: Ok(value.skill_id),
27627 }
27628 }
27629 }
27630}
27631pub mod error {
27633 pub struct ConversionError(::std::borrow::Cow<'static, str>);
27635 impl ::std::error::Error for ConversionError {}
27636 impl ::std::fmt::Display for ConversionError {
27637 fn fmt(
27638 &self,
27639 f: &mut ::std::fmt::Formatter<'_>,
27640 ) -> Result<(), ::std::fmt::Error> {
27641 ::std::fmt::Display::fmt(&self.0, f)
27642 }
27643 }
27644 impl ::std::fmt::Debug for ConversionError {
27645 fn fmt(
27646 &self,
27647 f: &mut ::std::fmt::Formatter<'_>,
27648 ) -> Result<(), ::std::fmt::Error> {
27649 ::std::fmt::Debug::fmt(&self.0, f)
27650 }
27651 }
27652 impl From<&'static str> for ConversionError {
27653 fn from(value: &'static str) -> Self {
27654 Self(value.into())
27655 }
27656 }
27657 impl From<String> for ConversionError {
27658 fn from(value: String) -> Self {
27659 Self(value.into())
27660 }
27661 }
27662}
27663
27664pub mod output {
27665#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
27667pub struct Error {
27668 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27670 pub code: ::std::option::Option<ErrorCode>,
27671 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27673 pub message: ::std::option::Option<::std::string::String>,
27674 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27676 pub param: ::std::option::Option<::std::string::String>,
27677 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
27679 pub type_: ::std::option::Option<ErrorType>,
27680}
27681impl Error {
27682 pub fn builder() -> builder::Error {
27683 Default::default()
27684 }
27685}
27686#[derive(::serde::Serialize, Clone, Debug)]
27688#[serde(transparent)]
27689pub struct ErrorCode(i64);
27690impl ::std::ops::Deref for ErrorCode {
27691 type Target = i64;
27692 fn deref(&self) -> &i64 {
27693 &self.0
27694 }
27695}
27696impl ::std::convert::From<ErrorCode> for i64 {
27697 fn from(value: ErrorCode) -> Self {
27698 value.0
27699 }
27700}
27701impl ::std::str::FromStr for ErrorCode {
27702 type Err = self::error::ConversionError;
27703 fn from_str(
27704 value: &str,
27705 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27706 value
27707 .parse::<i64>()
27708 .map_err(|e| ::std::string::ToString::to_string(&e).into())
27709 .and_then(Self::try_from)
27710 }
27711}
27712impl ::std::convert::TryFrom<i64> for ErrorCode {
27713 type Error = self::error::ConversionError;
27714 fn try_from(
27715 value: i64,
27716 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27717 if ![400_i64, 404_i64, 409_i64, 413_i64, 429_i64, 502_i64].contains(&value) {
27718 Err("invalid value".into())
27719 } else {
27720 Ok(Self(value))
27721 }
27722 }
27723}
27724impl<'de> ::serde::Deserialize<'de> for ErrorCode {
27725 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
27726 where
27727 D: ::serde::Deserializer<'de>,
27728 {
27729 Self::try_from(<i64>::deserialize(deserializer)?)
27730 .map_err(|e| { <D::Error as ::serde::de::Error>::custom(e.to_string()) })
27731 }
27732}
27733#[derive(
27735 ::serde::Deserialize,
27736 ::serde::Serialize,
27737 Clone,
27738 Copy,
27739 Debug,
27740 Eq,
27741 Hash,
27742 Ord,
27743 PartialEq,
27744 PartialOrd
27745)]
27746pub enum ErrorType {
27747 #[serde(rename = "invalid_request_error")]
27748 InvalidRequestError,
27749 #[serde(rename = "not_found_error")]
27750 NotFoundError,
27751 #[serde(rename = "revision_conflict_error")]
27752 RevisionConflictError,
27753 #[serde(rename = "payload_too_large_error")]
27754 PayloadTooLargeError,
27755 #[serde(rename = "rate_limit_error")]
27756 RateLimitError,
27757 #[serde(rename = "service_unavailable_error")]
27758 ServiceUnavailableError,
27759}
27760impl ::std::fmt::Display for ErrorType {
27761 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
27762 match *self {
27763 Self::InvalidRequestError => f.write_str("invalid_request_error"),
27764 Self::NotFoundError => f.write_str("not_found_error"),
27765 Self::RevisionConflictError => f.write_str("revision_conflict_error"),
27766 Self::PayloadTooLargeError => f.write_str("payload_too_large_error"),
27767 Self::RateLimitError => f.write_str("rate_limit_error"),
27768 Self::ServiceUnavailableError => f.write_str("service_unavailable_error"),
27769 }
27770 }
27771}
27772impl ::std::str::FromStr for ErrorType {
27773 type Err = self::error::ConversionError;
27774 fn from_str(
27775 value: &str,
27776 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27777 match value {
27778 "invalid_request_error" => Ok(Self::InvalidRequestError),
27779 "not_found_error" => Ok(Self::NotFoundError),
27780 "revision_conflict_error" => Ok(Self::RevisionConflictError),
27781 "payload_too_large_error" => Ok(Self::PayloadTooLargeError),
27782 "rate_limit_error" => Ok(Self::RateLimitError),
27783 "service_unavailable_error" => Ok(Self::ServiceUnavailableError),
27784 _ => Err("invalid value".into()),
27785 }
27786 }
27787}
27788impl ::std::convert::TryFrom<&str> for ErrorType {
27789 type Error = self::error::ConversionError;
27790 fn try_from(
27791 value: &str,
27792 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27793 value.parse()
27794 }
27795}
27796impl ::std::convert::TryFrom<::std::string::String> for ErrorType {
27797 type Error = self::error::ConversionError;
27798 fn try_from(
27799 value: ::std::string::String,
27800 ) -> ::std::result::Result<Self, self::error::ConversionError> {
27801 value.parse()
27802 }
27803}
27804#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
27806pub struct Output {
27807 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27809 pub created_at: ::std::option::Option<::std::string::String>,
27810 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27812 pub description: ::std::option::Option<::std::string::String>,
27813 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27814 pub error: ::std::option::Option<Error>,
27815 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27817 pub latest_revision: ::std::option::Option<::std::string::String>,
27818 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27820 pub name: ::std::option::Option<::std::string::String>,
27821 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27823 pub revision: ::std::option::Option<::std::string::String>,
27824 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27826 pub skill_id: ::std::option::Option<::std::string::String>,
27827 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
27829 pub updated_at: ::std::option::Option<::std::string::String>,
27830}
27831impl Output {
27832 pub fn builder() -> builder::Output {
27833 Default::default()
27834 }
27835}
27836pub mod builder {
27838 #[derive(Clone, Debug)]
27839 pub struct Error {
27840 code: ::std::result::Result<
27841 ::std::option::Option<super::ErrorCode>,
27842 ::std::string::String,
27843 >,
27844 message: ::std::result::Result<
27845 ::std::option::Option<::std::string::String>,
27846 ::std::string::String,
27847 >,
27848 param: ::std::result::Result<
27849 ::std::option::Option<::std::string::String>,
27850 ::std::string::String,
27851 >,
27852 type_: ::std::result::Result<
27853 ::std::option::Option<super::ErrorType>,
27854 ::std::string::String,
27855 >,
27856 }
27857 impl ::std::default::Default for Error {
27858 fn default() -> Self {
27859 Self {
27860 code: Ok(Default::default()),
27861 message: Ok(Default::default()),
27862 param: Ok(Default::default()),
27863 type_: Ok(Default::default()),
27864 }
27865 }
27866 }
27867 impl Error {
27868 pub fn code<T>(mut self, value: T) -> Self
27869 where
27870 T: ::std::convert::TryInto<::std::option::Option<super::ErrorCode>>,
27871 T::Error: ::std::fmt::Display,
27872 {
27873 self.code = value
27874 .try_into()
27875 .map_err(|e| format!("error converting supplied value for code: {e}"));
27876 self
27877 }
27878 pub fn message<T>(mut self, value: T) -> Self
27879 where
27880 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
27881 T::Error: ::std::fmt::Display,
27882 {
27883 self.message = value
27884 .try_into()
27885 .map_err(|e| {
27886 format!("error converting supplied value for message: {e}")
27887 });
27888 self
27889 }
27890 pub fn param<T>(mut self, value: T) -> Self
27891 where
27892 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
27893 T::Error: ::std::fmt::Display,
27894 {
27895 self.param = value
27896 .try_into()
27897 .map_err(|e| format!("error converting supplied value for param: {e}"));
27898 self
27899 }
27900 pub fn type_<T>(mut self, value: T) -> Self
27901 where
27902 T: ::std::convert::TryInto<::std::option::Option<super::ErrorType>>,
27903 T::Error: ::std::fmt::Display,
27904 {
27905 self.type_ = value
27906 .try_into()
27907 .map_err(|e| format!("error converting supplied value for type_: {e}"));
27908 self
27909 }
27910 }
27911 impl ::std::convert::TryFrom<Error> for super::Error {
27912 type Error = super::error::ConversionError;
27913 fn try_from(
27914 value: Error,
27915 ) -> ::std::result::Result<Self, super::error::ConversionError> {
27916 Ok(Self {
27917 code: value.code?,
27918 message: value.message?,
27919 param: value.param?,
27920 type_: value.type_?,
27921 })
27922 }
27923 }
27924 impl ::std::convert::From<super::Error> for Error {
27925 fn from(value: super::Error) -> Self {
27926 Self {
27927 code: Ok(value.code),
27928 message: Ok(value.message),
27929 param: Ok(value.param),
27930 type_: Ok(value.type_),
27931 }
27932 }
27933 }
27934 #[derive(Clone, Debug)]
27935 pub struct Output {
27936 created_at: ::std::result::Result<
27937 ::std::option::Option<::std::string::String>,
27938 ::std::string::String,
27939 >,
27940 description: ::std::result::Result<
27941 ::std::option::Option<::std::string::String>,
27942 ::std::string::String,
27943 >,
27944 error: ::std::result::Result<
27945 ::std::option::Option<super::Error>,
27946 ::std::string::String,
27947 >,
27948 latest_revision: ::std::result::Result<
27949 ::std::option::Option<::std::string::String>,
27950 ::std::string::String,
27951 >,
27952 name: ::std::result::Result<
27953 ::std::option::Option<::std::string::String>,
27954 ::std::string::String,
27955 >,
27956 revision: ::std::result::Result<
27957 ::std::option::Option<::std::string::String>,
27958 ::std::string::String,
27959 >,
27960 skill_id: ::std::result::Result<
27961 ::std::option::Option<::std::string::String>,
27962 ::std::string::String,
27963 >,
27964 updated_at: ::std::result::Result<
27965 ::std::option::Option<::std::string::String>,
27966 ::std::string::String,
27967 >,
27968 }
27969 impl ::std::default::Default for Output {
27970 fn default() -> Self {
27971 Self {
27972 created_at: Ok(Default::default()),
27973 description: Ok(Default::default()),
27974 error: Ok(Default::default()),
27975 latest_revision: Ok(Default::default()),
27976 name: Ok(Default::default()),
27977 revision: Ok(Default::default()),
27978 skill_id: Ok(Default::default()),
27979 updated_at: Ok(Default::default()),
27980 }
27981 }
27982 }
27983 impl Output {
27984 pub fn created_at<T>(mut self, value: T) -> Self
27985 where
27986 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
27987 T::Error: ::std::fmt::Display,
27988 {
27989 self.created_at = value
27990 .try_into()
27991 .map_err(|e| {
27992 format!("error converting supplied value for created_at: {e}")
27993 });
27994 self
27995 }
27996 pub fn description<T>(mut self, value: T) -> Self
27997 where
27998 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
27999 T::Error: ::std::fmt::Display,
28000 {
28001 self.description = value
28002 .try_into()
28003 .map_err(|e| {
28004 format!("error converting supplied value for description: {e}")
28005 });
28006 self
28007 }
28008 pub fn error<T>(mut self, value: T) -> Self
28009 where
28010 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
28011 T::Error: ::std::fmt::Display,
28012 {
28013 self.error = value
28014 .try_into()
28015 .map_err(|e| format!("error converting supplied value for error: {e}"));
28016 self
28017 }
28018 pub fn latest_revision<T>(mut self, value: T) -> Self
28019 where
28020 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28021 T::Error: ::std::fmt::Display,
28022 {
28023 self.latest_revision = value
28024 .try_into()
28025 .map_err(|e| {
28026 format!("error converting supplied value for latest_revision: {e}")
28027 });
28028 self
28029 }
28030 pub fn name<T>(mut self, value: T) -> Self
28031 where
28032 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28033 T::Error: ::std::fmt::Display,
28034 {
28035 self.name = value
28036 .try_into()
28037 .map_err(|e| format!("error converting supplied value for name: {e}"));
28038 self
28039 }
28040 pub fn revision<T>(mut self, value: T) -> Self
28041 where
28042 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28043 T::Error: ::std::fmt::Display,
28044 {
28045 self.revision = value
28046 .try_into()
28047 .map_err(|e| {
28048 format!("error converting supplied value for revision: {e}")
28049 });
28050 self
28051 }
28052 pub fn skill_id<T>(mut self, value: T) -> Self
28053 where
28054 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28055 T::Error: ::std::fmt::Display,
28056 {
28057 self.skill_id = value
28058 .try_into()
28059 .map_err(|e| {
28060 format!("error converting supplied value for skill_id: {e}")
28061 });
28062 self
28063 }
28064 pub fn updated_at<T>(mut self, value: T) -> Self
28065 where
28066 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28067 T::Error: ::std::fmt::Display,
28068 {
28069 self.updated_at = value
28070 .try_into()
28071 .map_err(|e| {
28072 format!("error converting supplied value for updated_at: {e}")
28073 });
28074 self
28075 }
28076 }
28077 impl ::std::convert::TryFrom<Output> for super::Output {
28078 type Error = super::error::ConversionError;
28079 fn try_from(
28080 value: Output,
28081 ) -> ::std::result::Result<Self, super::error::ConversionError> {
28082 Ok(Self {
28083 created_at: value.created_at?,
28084 description: value.description?,
28085 error: value.error?,
28086 latest_revision: value.latest_revision?,
28087 name: value.name?,
28088 revision: value.revision?,
28089 skill_id: value.skill_id?,
28090 updated_at: value.updated_at?,
28091 })
28092 }
28093 }
28094 impl ::std::convert::From<super::Output> for Output {
28095 fn from(value: super::Output) -> Self {
28096 Self {
28097 created_at: Ok(value.created_at),
28098 description: Ok(value.description),
28099 error: Ok(value.error),
28100 latest_revision: Ok(value.latest_revision),
28101 name: Ok(value.name),
28102 revision: Ok(value.revision),
28103 skill_id: Ok(value.skill_id),
28104 updated_at: Ok(value.updated_at),
28105 }
28106 }
28107 }
28108}
28109pub mod error {
28111 pub struct ConversionError(::std::borrow::Cow<'static, str>);
28113 impl ::std::error::Error for ConversionError {}
28114 impl ::std::fmt::Display for ConversionError {
28115 fn fmt(
28116 &self,
28117 f: &mut ::std::fmt::Formatter<'_>,
28118 ) -> Result<(), ::std::fmt::Error> {
28119 ::std::fmt::Display::fmt(&self.0, f)
28120 }
28121 }
28122 impl ::std::fmt::Debug for ConversionError {
28123 fn fmt(
28124 &self,
28125 f: &mut ::std::fmt::Formatter<'_>,
28126 ) -> Result<(), ::std::fmt::Error> {
28127 ::std::fmt::Debug::fmt(&self.0, f)
28128 }
28129 }
28130 impl From<&'static str> for ConversionError {
28131 fn from(value: &'static str) -> Self {
28132 Self(value.into())
28133 }
28134 }
28135 impl From<String> for ConversionError {
28136 fn from(value: String) -> Self {
28137 Self(value.into())
28138 }
28139 }
28140}
28141
28142}
28143
28144 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "skillId", part: ::one::Part::Path, key: Some("skillId") }, ::one::Route { field: "expected_revision", part: ::one::Part::Query, key: Some("expected_revision") }, ::one::Route { field: "body", part: ::one::Part::Body, key: None }], required_parts: &[::one::Part::Path, ::one::Part::Query] };
28146
28147 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
28158 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DJZcdig::YyfJSqHhRQ28MhSJ5ZrWIw", Method::PUT, "/v1/skills/{{skillId}}").with_routed(&input, &ROUTING)?
28159 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
28160 }
28161
28162 impl IntoOperation for Input {
28163 type Output = output::Output;
28164
28165 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
28166 build(self)
28167 }
28168 }
28169 impl IntoOperation for builder::Input {
28170 type Output = output::Output;
28171
28172 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
28173 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
28174 }
28175 }
28176}
28177pub fn add_skill_revision() -> add_skill_revision::builder::Input {
28179 add_skill_revision::builder::Input::default()
28180}
28181pub mod get_skill_download_url {
28182 use ::one::{Error, IntoOperation, Method, Operation};
28183#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
28185#[serde(deny_unknown_fields)]
28186pub struct Input {
28187 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28189 pub revision: ::std::option::Option<::std::string::String>,
28190 #[serde(rename = "skillId")]
28192 pub skill_id: InputSkillId,
28193}
28194impl Input {
28195 pub fn builder() -> builder::Input {
28196 Default::default()
28197 }
28198}
28199#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28201#[serde(transparent)]
28202pub struct InputSkillId(::std::string::String);
28203impl ::std::ops::Deref for InputSkillId {
28204 type Target = ::std::string::String;
28205 fn deref(&self) -> &::std::string::String {
28206 &self.0
28207 }
28208}
28209impl ::std::convert::From<InputSkillId> for ::std::string::String {
28210 fn from(value: InputSkillId) -> Self {
28211 value.0
28212 }
28213}
28214impl ::std::str::FromStr for InputSkillId {
28215 type Err = self::error::ConversionError;
28216 fn from_str(
28217 value: &str,
28218 ) -> ::std::result::Result<Self, self::error::ConversionError> {
28219 ::std::convert::TryFrom::try_from(value)
28220 }
28221}
28222impl ::std::convert::TryFrom<&str> for InputSkillId {
28223 type Error = self::error::ConversionError;
28224 fn try_from(
28225 value: &str,
28226 ) -> ::std::result::Result<Self, self::error::ConversionError> {
28227 if value.chars().count() < 1usize {
28228 return Err("shorter than 1 characters".into());
28229 }
28230 Ok(Self(value.to_string()))
28231 }
28232}
28233impl ::std::convert::TryFrom<::std::string::String> for InputSkillId {
28234 type Error = self::error::ConversionError;
28235 fn try_from(
28236 value: ::std::string::String,
28237 ) -> ::std::result::Result<Self, self::error::ConversionError> {
28238 ::std::convert::TryFrom::try_from(value.as_str())
28239 }
28240}
28241impl<'de> ::serde::Deserialize<'de> for InputSkillId {
28242 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
28243 where
28244 D: ::serde::Deserializer<'de>,
28245 {
28246 ::std::convert::TryFrom::try_from(
28247 ::std::string::String::deserialize(deserializer)?,
28248 )
28249 .map_err(|e: self::error::ConversionError| {
28250 <D::Error as ::serde::de::Error>::custom(e.to_string())
28251 })
28252 }
28253}
28254pub mod builder {
28256 #[derive(Clone, Debug)]
28257 pub struct Input {
28258 revision: ::std::result::Result<
28259 ::std::option::Option<::std::string::String>,
28260 ::std::string::String,
28261 >,
28262 skill_id: ::std::result::Result<super::InputSkillId, ::std::string::String>,
28263 }
28264 impl ::std::default::Default for Input {
28265 fn default() -> Self {
28266 Self {
28267 revision: Ok(Default::default()),
28268 skill_id: Err("no value supplied for skill_id".to_string()),
28269 }
28270 }
28271 }
28272 impl Input {
28273 pub fn revision<T>(mut self, value: T) -> Self
28274 where
28275 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28276 T::Error: ::std::fmt::Display,
28277 {
28278 self.revision = value
28279 .try_into()
28280 .map_err(|e| {
28281 format!("error converting supplied value for revision: {e}")
28282 });
28283 self
28284 }
28285 pub fn skill_id<T>(mut self, value: T) -> Self
28286 where
28287 T: ::std::convert::TryInto<super::InputSkillId>,
28288 T::Error: ::std::fmt::Display,
28289 {
28290 self.skill_id = value
28291 .try_into()
28292 .map_err(|e| {
28293 format!("error converting supplied value for skill_id: {e}")
28294 });
28295 self
28296 }
28297 }
28298 impl ::std::convert::TryFrom<Input> for super::Input {
28299 type Error = super::error::ConversionError;
28300 fn try_from(
28301 value: Input,
28302 ) -> ::std::result::Result<Self, super::error::ConversionError> {
28303 Ok(Self {
28304 revision: value.revision?,
28305 skill_id: value.skill_id?,
28306 })
28307 }
28308 }
28309 impl ::std::convert::From<super::Input> for Input {
28310 fn from(value: super::Input) -> Self {
28311 Self {
28312 revision: Ok(value.revision),
28313 skill_id: Ok(value.skill_id),
28314 }
28315 }
28316 }
28317}
28318pub mod error {
28320 pub struct ConversionError(::std::borrow::Cow<'static, str>);
28322 impl ::std::error::Error for ConversionError {}
28323 impl ::std::fmt::Display for ConversionError {
28324 fn fmt(
28325 &self,
28326 f: &mut ::std::fmt::Formatter<'_>,
28327 ) -> Result<(), ::std::fmt::Error> {
28328 ::std::fmt::Display::fmt(&self.0, f)
28329 }
28330 }
28331 impl ::std::fmt::Debug for ConversionError {
28332 fn fmt(
28333 &self,
28334 f: &mut ::std::fmt::Formatter<'_>,
28335 ) -> Result<(), ::std::fmt::Error> {
28336 ::std::fmt::Debug::fmt(&self.0, f)
28337 }
28338 }
28339 impl From<&'static str> for ConversionError {
28340 fn from(value: &'static str) -> Self {
28341 Self(value.into())
28342 }
28343 }
28344 impl From<String> for ConversionError {
28345 fn from(value: String) -> Self {
28346 Self(value.into())
28347 }
28348 }
28349}
28350
28351pub mod output {
28352#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
28354pub struct Error {
28355 pub code: i64,
28357 pub message: ::std::string::String,
28359 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28361 pub param: ::std::option::Option<::std::string::String>,
28362 #[serde(rename = "type")]
28364 pub type_: ::std::string::String,
28365}
28366impl Error {
28367 pub fn builder() -> builder::Error {
28368 Default::default()
28369 }
28370}
28371#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
28373pub struct Output {
28374 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28376 pub download_url: ::std::option::Option<::std::string::String>,
28377 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28378 pub error: ::std::option::Option<Error>,
28379 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28381 pub name: ::std::option::Option<::std::string::String>,
28382 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28384 pub revision: ::std::option::Option<::std::string::String>,
28385}
28386impl Output {
28387 pub fn builder() -> builder::Output {
28388 Default::default()
28389 }
28390}
28391pub mod builder {
28393 #[derive(Clone, Debug)]
28394 pub struct Error {
28395 code: ::std::result::Result<i64, ::std::string::String>,
28396 message: ::std::result::Result<::std::string::String, ::std::string::String>,
28397 param: ::std::result::Result<
28398 ::std::option::Option<::std::string::String>,
28399 ::std::string::String,
28400 >,
28401 type_: ::std::result::Result<::std::string::String, ::std::string::String>,
28402 }
28403 impl ::std::default::Default for Error {
28404 fn default() -> Self {
28405 Self {
28406 code: Err("no value supplied for code".to_string()),
28407 message: Err("no value supplied for message".to_string()),
28408 param: Ok(Default::default()),
28409 type_: Err("no value supplied for type_".to_string()),
28410 }
28411 }
28412 }
28413 impl Error {
28414 pub fn code<T>(mut self, value: T) -> Self
28415 where
28416 T: ::std::convert::TryInto<i64>,
28417 T::Error: ::std::fmt::Display,
28418 {
28419 self.code = value
28420 .try_into()
28421 .map_err(|e| format!("error converting supplied value for code: {e}"));
28422 self
28423 }
28424 pub fn message<T>(mut self, value: T) -> Self
28425 where
28426 T: ::std::convert::TryInto<::std::string::String>,
28427 T::Error: ::std::fmt::Display,
28428 {
28429 self.message = value
28430 .try_into()
28431 .map_err(|e| {
28432 format!("error converting supplied value for message: {e}")
28433 });
28434 self
28435 }
28436 pub fn param<T>(mut self, value: T) -> Self
28437 where
28438 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28439 T::Error: ::std::fmt::Display,
28440 {
28441 self.param = value
28442 .try_into()
28443 .map_err(|e| format!("error converting supplied value for param: {e}"));
28444 self
28445 }
28446 pub fn type_<T>(mut self, value: T) -> Self
28447 where
28448 T: ::std::convert::TryInto<::std::string::String>,
28449 T::Error: ::std::fmt::Display,
28450 {
28451 self.type_ = value
28452 .try_into()
28453 .map_err(|e| format!("error converting supplied value for type_: {e}"));
28454 self
28455 }
28456 }
28457 impl ::std::convert::TryFrom<Error> for super::Error {
28458 type Error = super::error::ConversionError;
28459 fn try_from(
28460 value: Error,
28461 ) -> ::std::result::Result<Self, super::error::ConversionError> {
28462 Ok(Self {
28463 code: value.code?,
28464 message: value.message?,
28465 param: value.param?,
28466 type_: value.type_?,
28467 })
28468 }
28469 }
28470 impl ::std::convert::From<super::Error> for Error {
28471 fn from(value: super::Error) -> Self {
28472 Self {
28473 code: Ok(value.code),
28474 message: Ok(value.message),
28475 param: Ok(value.param),
28476 type_: Ok(value.type_),
28477 }
28478 }
28479 }
28480 #[derive(Clone, Debug)]
28481 pub struct Output {
28482 download_url: ::std::result::Result<
28483 ::std::option::Option<::std::string::String>,
28484 ::std::string::String,
28485 >,
28486 error: ::std::result::Result<
28487 ::std::option::Option<super::Error>,
28488 ::std::string::String,
28489 >,
28490 name: ::std::result::Result<
28491 ::std::option::Option<::std::string::String>,
28492 ::std::string::String,
28493 >,
28494 revision: ::std::result::Result<
28495 ::std::option::Option<::std::string::String>,
28496 ::std::string::String,
28497 >,
28498 }
28499 impl ::std::default::Default for Output {
28500 fn default() -> Self {
28501 Self {
28502 download_url: Ok(Default::default()),
28503 error: Ok(Default::default()),
28504 name: Ok(Default::default()),
28505 revision: Ok(Default::default()),
28506 }
28507 }
28508 }
28509 impl Output {
28510 pub fn download_url<T>(mut self, value: T) -> Self
28511 where
28512 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28513 T::Error: ::std::fmt::Display,
28514 {
28515 self.download_url = value
28516 .try_into()
28517 .map_err(|e| {
28518 format!("error converting supplied value for download_url: {e}")
28519 });
28520 self
28521 }
28522 pub fn error<T>(mut self, value: T) -> Self
28523 where
28524 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
28525 T::Error: ::std::fmt::Display,
28526 {
28527 self.error = value
28528 .try_into()
28529 .map_err(|e| format!("error converting supplied value for error: {e}"));
28530 self
28531 }
28532 pub fn name<T>(mut self, value: T) -> Self
28533 where
28534 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28535 T::Error: ::std::fmt::Display,
28536 {
28537 self.name = value
28538 .try_into()
28539 .map_err(|e| format!("error converting supplied value for name: {e}"));
28540 self
28541 }
28542 pub fn revision<T>(mut self, value: T) -> Self
28543 where
28544 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28545 T::Error: ::std::fmt::Display,
28546 {
28547 self.revision = value
28548 .try_into()
28549 .map_err(|e| {
28550 format!("error converting supplied value for revision: {e}")
28551 });
28552 self
28553 }
28554 }
28555 impl ::std::convert::TryFrom<Output> for super::Output {
28556 type Error = super::error::ConversionError;
28557 fn try_from(
28558 value: Output,
28559 ) -> ::std::result::Result<Self, super::error::ConversionError> {
28560 Ok(Self {
28561 download_url: value.download_url?,
28562 error: value.error?,
28563 name: value.name?,
28564 revision: value.revision?,
28565 })
28566 }
28567 }
28568 impl ::std::convert::From<super::Output> for Output {
28569 fn from(value: super::Output) -> Self {
28570 Self {
28571 download_url: Ok(value.download_url),
28572 error: Ok(value.error),
28573 name: Ok(value.name),
28574 revision: Ok(value.revision),
28575 }
28576 }
28577 }
28578}
28579pub mod error {
28581 pub struct ConversionError(::std::borrow::Cow<'static, str>);
28583 impl ::std::error::Error for ConversionError {}
28584 impl ::std::fmt::Display for ConversionError {
28585 fn fmt(
28586 &self,
28587 f: &mut ::std::fmt::Formatter<'_>,
28588 ) -> Result<(), ::std::fmt::Error> {
28589 ::std::fmt::Display::fmt(&self.0, f)
28590 }
28591 }
28592 impl ::std::fmt::Debug for ConversionError {
28593 fn fmt(
28594 &self,
28595 f: &mut ::std::fmt::Formatter<'_>,
28596 ) -> Result<(), ::std::fmt::Error> {
28597 ::std::fmt::Debug::fmt(&self.0, f)
28598 }
28599 }
28600 impl From<&'static str> for ConversionError {
28601 fn from(value: &'static str) -> Self {
28602 Self(value.into())
28603 }
28604 }
28605 impl From<String> for ConversionError {
28606 fn from(value: String) -> Self {
28607 Self(value.into())
28608 }
28609 }
28610}
28611
28612}
28613
28614 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "skillId", part: ::one::Part::Path, key: Some("skillId") }, ::one::Route { field: "revision", part: ::one::Part::Query, key: Some("revision") }], required_parts: &[::one::Part::Path] };
28616
28617 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
28627 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DJ1-dzA::KdBX1BYRQvaANmBsnzSnhw", Method::GET, "/v1/skills/{{skillId}}/download").with_routed(&input, &ROUTING)?
28628 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
28629 }
28630
28631 impl IntoOperation for Input {
28632 type Output = output::Output;
28633
28634 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
28635 build(self)
28636 }
28637 }
28638 impl IntoOperation for builder::Input {
28639 type Output = output::Output;
28640
28641 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
28642 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
28643 }
28644 }
28645}
28646pub fn get_skill_download_url() -> get_skill_download_url::builder::Input {
28648 get_skill_download_url::builder::Input::default()
28649}
28650pub mod list_skills {
28651 use ::one::{Error, IntoOperation, Method, Operation};
28652#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
28654#[serde(deny_unknown_fields)]
28655pub struct Input {
28656 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28658 pub limit: ::std::option::Option<i64>,
28659 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28661 pub page_token: ::std::option::Option<::std::string::String>,
28662}
28663impl Input {
28664 pub fn builder() -> builder::Input {
28665 Default::default()
28666 }
28667}
28668pub mod builder {
28670 #[derive(Clone, Debug)]
28671 pub struct Input {
28672 limit: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
28673 page_token: ::std::result::Result<
28674 ::std::option::Option<::std::string::String>,
28675 ::std::string::String,
28676 >,
28677 }
28678 impl ::std::default::Default for Input {
28679 fn default() -> Self {
28680 Self {
28681 limit: Ok(Default::default()),
28682 page_token: Ok(Default::default()),
28683 }
28684 }
28685 }
28686 impl Input {
28687 pub fn limit<T>(mut self, value: T) -> Self
28688 where
28689 T: ::std::convert::TryInto<::std::option::Option<i64>>,
28690 T::Error: ::std::fmt::Display,
28691 {
28692 self.limit = value
28693 .try_into()
28694 .map_err(|e| format!("error converting supplied value for limit: {e}"));
28695 self
28696 }
28697 pub fn page_token<T>(mut self, value: T) -> Self
28698 where
28699 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28700 T::Error: ::std::fmt::Display,
28701 {
28702 self.page_token = value
28703 .try_into()
28704 .map_err(|e| {
28705 format!("error converting supplied value for page_token: {e}")
28706 });
28707 self
28708 }
28709 }
28710 impl ::std::convert::TryFrom<Input> for super::Input {
28711 type Error = super::error::ConversionError;
28712 fn try_from(
28713 value: Input,
28714 ) -> ::std::result::Result<Self, super::error::ConversionError> {
28715 Ok(Self {
28716 limit: value.limit?,
28717 page_token: value.page_token?,
28718 })
28719 }
28720 }
28721 impl ::std::convert::From<super::Input> for Input {
28722 fn from(value: super::Input) -> Self {
28723 Self {
28724 limit: Ok(value.limit),
28725 page_token: Ok(value.page_token),
28726 }
28727 }
28728 }
28729}
28730pub mod error {
28732 pub struct ConversionError(::std::borrow::Cow<'static, str>);
28734 impl ::std::error::Error for ConversionError {}
28735 impl ::std::fmt::Display for ConversionError {
28736 fn fmt(
28737 &self,
28738 f: &mut ::std::fmt::Formatter<'_>,
28739 ) -> Result<(), ::std::fmt::Error> {
28740 ::std::fmt::Display::fmt(&self.0, f)
28741 }
28742 }
28743 impl ::std::fmt::Debug for ConversionError {
28744 fn fmt(
28745 &self,
28746 f: &mut ::std::fmt::Formatter<'_>,
28747 ) -> Result<(), ::std::fmt::Error> {
28748 ::std::fmt::Debug::fmt(&self.0, f)
28749 }
28750 }
28751 impl From<&'static str> for ConversionError {
28752 fn from(value: &'static str) -> Self {
28753 Self(value.into())
28754 }
28755 }
28756 impl From<String> for ConversionError {
28757 fn from(value: String) -> Self {
28758 Self(value.into())
28759 }
28760 }
28761}
28762
28763pub mod output {
28764#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
28766pub struct Error {
28767 pub code: i64,
28769 pub message: ::std::string::String,
28771 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28773 pub param: ::std::option::Option<::std::string::String>,
28774 #[serde(rename = "type")]
28776 pub type_: ::std::string::String,
28777}
28778impl Error {
28779 pub fn builder() -> builder::Error {
28780 Default::default()
28781 }
28782}
28783#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
28785pub struct Output {
28786 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28787 pub error: ::std::option::Option<Error>,
28788 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28790 pub next_page_token: ::std::option::Option<::std::string::String>,
28791 pub skills: ::std::vec::Vec<Skill>,
28793}
28794impl Output {
28795 pub fn builder() -> builder::Output {
28796 Default::default()
28797 }
28798}
28799#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
28801pub struct Skill {
28802 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28804 pub created_at: ::std::option::Option<::std::string::String>,
28805 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28807 pub name: ::std::option::Option<::std::string::String>,
28808 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28810 pub revision: ::std::option::Option<::std::string::String>,
28811 pub skill_id: ::std::string::String,
28813 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
28815 pub updated_at: ::std::option::Option<::std::string::String>,
28816}
28817impl Skill {
28818 pub fn builder() -> builder::Skill {
28819 Default::default()
28820 }
28821}
28822pub mod builder {
28824 #[derive(Clone, Debug)]
28825 pub struct Error {
28826 code: ::std::result::Result<i64, ::std::string::String>,
28827 message: ::std::result::Result<::std::string::String, ::std::string::String>,
28828 param: ::std::result::Result<
28829 ::std::option::Option<::std::string::String>,
28830 ::std::string::String,
28831 >,
28832 type_: ::std::result::Result<::std::string::String, ::std::string::String>,
28833 }
28834 impl ::std::default::Default for Error {
28835 fn default() -> Self {
28836 Self {
28837 code: Err("no value supplied for code".to_string()),
28838 message: Err("no value supplied for message".to_string()),
28839 param: Ok(Default::default()),
28840 type_: Err("no value supplied for type_".to_string()),
28841 }
28842 }
28843 }
28844 impl Error {
28845 pub fn code<T>(mut self, value: T) -> Self
28846 where
28847 T: ::std::convert::TryInto<i64>,
28848 T::Error: ::std::fmt::Display,
28849 {
28850 self.code = value
28851 .try_into()
28852 .map_err(|e| format!("error converting supplied value for code: {e}"));
28853 self
28854 }
28855 pub fn message<T>(mut self, value: T) -> Self
28856 where
28857 T: ::std::convert::TryInto<::std::string::String>,
28858 T::Error: ::std::fmt::Display,
28859 {
28860 self.message = value
28861 .try_into()
28862 .map_err(|e| {
28863 format!("error converting supplied value for message: {e}")
28864 });
28865 self
28866 }
28867 pub fn param<T>(mut self, value: T) -> Self
28868 where
28869 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28870 T::Error: ::std::fmt::Display,
28871 {
28872 self.param = value
28873 .try_into()
28874 .map_err(|e| format!("error converting supplied value for param: {e}"));
28875 self
28876 }
28877 pub fn type_<T>(mut self, value: T) -> Self
28878 where
28879 T: ::std::convert::TryInto<::std::string::String>,
28880 T::Error: ::std::fmt::Display,
28881 {
28882 self.type_ = value
28883 .try_into()
28884 .map_err(|e| format!("error converting supplied value for type_: {e}"));
28885 self
28886 }
28887 }
28888 impl ::std::convert::TryFrom<Error> for super::Error {
28889 type Error = super::error::ConversionError;
28890 fn try_from(
28891 value: Error,
28892 ) -> ::std::result::Result<Self, super::error::ConversionError> {
28893 Ok(Self {
28894 code: value.code?,
28895 message: value.message?,
28896 param: value.param?,
28897 type_: value.type_?,
28898 })
28899 }
28900 }
28901 impl ::std::convert::From<super::Error> for Error {
28902 fn from(value: super::Error) -> Self {
28903 Self {
28904 code: Ok(value.code),
28905 message: Ok(value.message),
28906 param: Ok(value.param),
28907 type_: Ok(value.type_),
28908 }
28909 }
28910 }
28911 #[derive(Clone, Debug)]
28912 pub struct Output {
28913 error: ::std::result::Result<
28914 ::std::option::Option<super::Error>,
28915 ::std::string::String,
28916 >,
28917 next_page_token: ::std::result::Result<
28918 ::std::option::Option<::std::string::String>,
28919 ::std::string::String,
28920 >,
28921 skills: ::std::result::Result<
28922 ::std::vec::Vec<super::Skill>,
28923 ::std::string::String,
28924 >,
28925 }
28926 impl ::std::default::Default for Output {
28927 fn default() -> Self {
28928 Self {
28929 error: Ok(Default::default()),
28930 next_page_token: Ok(Default::default()),
28931 skills: Err("no value supplied for skills".to_string()),
28932 }
28933 }
28934 }
28935 impl Output {
28936 pub fn error<T>(mut self, value: T) -> Self
28937 where
28938 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
28939 T::Error: ::std::fmt::Display,
28940 {
28941 self.error = value
28942 .try_into()
28943 .map_err(|e| format!("error converting supplied value for error: {e}"));
28944 self
28945 }
28946 pub fn next_page_token<T>(mut self, value: T) -> Self
28947 where
28948 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
28949 T::Error: ::std::fmt::Display,
28950 {
28951 self.next_page_token = value
28952 .try_into()
28953 .map_err(|e| {
28954 format!("error converting supplied value for next_page_token: {e}")
28955 });
28956 self
28957 }
28958 pub fn skills<T>(mut self, value: T) -> Self
28959 where
28960 T: ::std::convert::TryInto<::std::vec::Vec<super::Skill>>,
28961 T::Error: ::std::fmt::Display,
28962 {
28963 self.skills = value
28964 .try_into()
28965 .map_err(|e| format!("error converting supplied value for skills: {e}"));
28966 self
28967 }
28968 }
28969 impl ::std::convert::TryFrom<Output> for super::Output {
28970 type Error = super::error::ConversionError;
28971 fn try_from(
28972 value: Output,
28973 ) -> ::std::result::Result<Self, super::error::ConversionError> {
28974 Ok(Self {
28975 error: value.error?,
28976 next_page_token: value.next_page_token?,
28977 skills: value.skills?,
28978 })
28979 }
28980 }
28981 impl ::std::convert::From<super::Output> for Output {
28982 fn from(value: super::Output) -> Self {
28983 Self {
28984 error: Ok(value.error),
28985 next_page_token: Ok(value.next_page_token),
28986 skills: Ok(value.skills),
28987 }
28988 }
28989 }
28990 #[derive(Clone, Debug)]
28991 pub struct Skill {
28992 created_at: ::std::result::Result<
28993 ::std::option::Option<::std::string::String>,
28994 ::std::string::String,
28995 >,
28996 name: ::std::result::Result<
28997 ::std::option::Option<::std::string::String>,
28998 ::std::string::String,
28999 >,
29000 revision: ::std::result::Result<
29001 ::std::option::Option<::std::string::String>,
29002 ::std::string::String,
29003 >,
29004 skill_id: ::std::result::Result<::std::string::String, ::std::string::String>,
29005 updated_at: ::std::result::Result<
29006 ::std::option::Option<::std::string::String>,
29007 ::std::string::String,
29008 >,
29009 }
29010 impl ::std::default::Default for Skill {
29011 fn default() -> Self {
29012 Self {
29013 created_at: Ok(Default::default()),
29014 name: Ok(Default::default()),
29015 revision: Ok(Default::default()),
29016 skill_id: Err("no value supplied for skill_id".to_string()),
29017 updated_at: Ok(Default::default()),
29018 }
29019 }
29020 }
29021 impl Skill {
29022 pub fn created_at<T>(mut self, value: T) -> Self
29023 where
29024 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29025 T::Error: ::std::fmt::Display,
29026 {
29027 self.created_at = value
29028 .try_into()
29029 .map_err(|e| {
29030 format!("error converting supplied value for created_at: {e}")
29031 });
29032 self
29033 }
29034 pub fn name<T>(mut self, value: T) -> Self
29035 where
29036 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29037 T::Error: ::std::fmt::Display,
29038 {
29039 self.name = value
29040 .try_into()
29041 .map_err(|e| format!("error converting supplied value for name: {e}"));
29042 self
29043 }
29044 pub fn revision<T>(mut self, value: T) -> Self
29045 where
29046 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29047 T::Error: ::std::fmt::Display,
29048 {
29049 self.revision = value
29050 .try_into()
29051 .map_err(|e| {
29052 format!("error converting supplied value for revision: {e}")
29053 });
29054 self
29055 }
29056 pub fn skill_id<T>(mut self, value: T) -> Self
29057 where
29058 T: ::std::convert::TryInto<::std::string::String>,
29059 T::Error: ::std::fmt::Display,
29060 {
29061 self.skill_id = value
29062 .try_into()
29063 .map_err(|e| {
29064 format!("error converting supplied value for skill_id: {e}")
29065 });
29066 self
29067 }
29068 pub fn updated_at<T>(mut self, value: T) -> Self
29069 where
29070 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29071 T::Error: ::std::fmt::Display,
29072 {
29073 self.updated_at = value
29074 .try_into()
29075 .map_err(|e| {
29076 format!("error converting supplied value for updated_at: {e}")
29077 });
29078 self
29079 }
29080 }
29081 impl ::std::convert::TryFrom<Skill> for super::Skill {
29082 type Error = super::error::ConversionError;
29083 fn try_from(
29084 value: Skill,
29085 ) -> ::std::result::Result<Self, super::error::ConversionError> {
29086 Ok(Self {
29087 created_at: value.created_at?,
29088 name: value.name?,
29089 revision: value.revision?,
29090 skill_id: value.skill_id?,
29091 updated_at: value.updated_at?,
29092 })
29093 }
29094 }
29095 impl ::std::convert::From<super::Skill> for Skill {
29096 fn from(value: super::Skill) -> Self {
29097 Self {
29098 created_at: Ok(value.created_at),
29099 name: Ok(value.name),
29100 revision: Ok(value.revision),
29101 skill_id: Ok(value.skill_id),
29102 updated_at: Ok(value.updated_at),
29103 }
29104 }
29105 }
29106}
29107pub mod error {
29109 pub struct ConversionError(::std::borrow::Cow<'static, str>);
29111 impl ::std::error::Error for ConversionError {}
29112 impl ::std::fmt::Display for ConversionError {
29113 fn fmt(
29114 &self,
29115 f: &mut ::std::fmt::Formatter<'_>,
29116 ) -> Result<(), ::std::fmt::Error> {
29117 ::std::fmt::Display::fmt(&self.0, f)
29118 }
29119 }
29120 impl ::std::fmt::Debug for ConversionError {
29121 fn fmt(
29122 &self,
29123 f: &mut ::std::fmt::Formatter<'_>,
29124 ) -> Result<(), ::std::fmt::Error> {
29125 ::std::fmt::Debug::fmt(&self.0, f)
29126 }
29127 }
29128 impl From<&'static str> for ConversionError {
29129 fn from(value: &'static str) -> Self {
29130 Self(value.into())
29131 }
29132 }
29133 impl From<String> for ConversionError {
29134 fn from(value: String) -> Self {
29135 Self(value.into())
29136 }
29137 }
29138}
29139
29140}
29141
29142 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "limit", part: ::one::Part::Query, key: Some("limit") }, ::one::Route { field: "page_token", part: ::one::Part::Query, key: Some("page_token") }], required_parts: &[] };
29144
29145 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
29155 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DRK3CoA::ISxLnkcDQQGiA-6BuB4_Ag", Method::GET, "/v1/skills").with_routed(&input, &ROUTING)?
29156 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
29157 }
29158
29159 impl IntoOperation for Input {
29160 type Output = output::Output;
29161
29162 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
29163 build(self)
29164 }
29165 }
29166 impl IntoOperation for builder::Input {
29167 type Output = output::Output;
29168
29169 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
29170 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
29171 }
29172 }
29173}
29174pub fn list_skills() -> list_skills::builder::Input {
29176 list_skills::builder::Input::default()
29177}
29178pub mod list_skills_revisions {
29179 use ::one::{Error, IntoOperation, Method, Operation};
29180#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
29182#[serde(deny_unknown_fields)]
29183pub struct Input {
29184 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29186 pub limit: ::std::option::Option<::std::num::NonZeroU64>,
29187 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29189 pub page_token: ::std::option::Option<::std::string::String>,
29190 #[serde(rename = "skillId")]
29192 pub skill_id: InputSkillId,
29193}
29194impl Input {
29195 pub fn builder() -> builder::Input {
29196 Default::default()
29197 }
29198}
29199#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29201#[serde(transparent)]
29202pub struct InputSkillId(::std::string::String);
29203impl ::std::ops::Deref for InputSkillId {
29204 type Target = ::std::string::String;
29205 fn deref(&self) -> &::std::string::String {
29206 &self.0
29207 }
29208}
29209impl ::std::convert::From<InputSkillId> for ::std::string::String {
29210 fn from(value: InputSkillId) -> Self {
29211 value.0
29212 }
29213}
29214impl ::std::str::FromStr for InputSkillId {
29215 type Err = self::error::ConversionError;
29216 fn from_str(
29217 value: &str,
29218 ) -> ::std::result::Result<Self, self::error::ConversionError> {
29219 ::std::convert::TryFrom::try_from(value)
29220 }
29221}
29222impl ::std::convert::TryFrom<&str> for InputSkillId {
29223 type Error = self::error::ConversionError;
29224 fn try_from(
29225 value: &str,
29226 ) -> ::std::result::Result<Self, self::error::ConversionError> {
29227 if value.chars().count() < 1usize {
29228 return Err("shorter than 1 characters".into());
29229 }
29230 Ok(Self(value.to_string()))
29231 }
29232}
29233impl ::std::convert::TryFrom<::std::string::String> for InputSkillId {
29234 type Error = self::error::ConversionError;
29235 fn try_from(
29236 value: ::std::string::String,
29237 ) -> ::std::result::Result<Self, self::error::ConversionError> {
29238 ::std::convert::TryFrom::try_from(value.as_str())
29239 }
29240}
29241impl<'de> ::serde::Deserialize<'de> for InputSkillId {
29242 fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
29243 where
29244 D: ::serde::Deserializer<'de>,
29245 {
29246 ::std::convert::TryFrom::try_from(
29247 ::std::string::String::deserialize(deserializer)?,
29248 )
29249 .map_err(|e: self::error::ConversionError| {
29250 <D::Error as ::serde::de::Error>::custom(e.to_string())
29251 })
29252 }
29253}
29254pub mod builder {
29256 #[derive(Clone, Debug)]
29257 pub struct Input {
29258 limit: ::std::result::Result<
29259 ::std::option::Option<::std::num::NonZeroU64>,
29260 ::std::string::String,
29261 >,
29262 page_token: ::std::result::Result<
29263 ::std::option::Option<::std::string::String>,
29264 ::std::string::String,
29265 >,
29266 skill_id: ::std::result::Result<super::InputSkillId, ::std::string::String>,
29267 }
29268 impl ::std::default::Default for Input {
29269 fn default() -> Self {
29270 Self {
29271 limit: Ok(Default::default()),
29272 page_token: Ok(Default::default()),
29273 skill_id: Err("no value supplied for skill_id".to_string()),
29274 }
29275 }
29276 }
29277 impl Input {
29278 pub fn limit<T>(mut self, value: T) -> Self
29279 where
29280 T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
29281 T::Error: ::std::fmt::Display,
29282 {
29283 self.limit = value
29284 .try_into()
29285 .map_err(|e| format!("error converting supplied value for limit: {e}"));
29286 self
29287 }
29288 pub fn page_token<T>(mut self, value: T) -> Self
29289 where
29290 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29291 T::Error: ::std::fmt::Display,
29292 {
29293 self.page_token = value
29294 .try_into()
29295 .map_err(|e| {
29296 format!("error converting supplied value for page_token: {e}")
29297 });
29298 self
29299 }
29300 pub fn skill_id<T>(mut self, value: T) -> Self
29301 where
29302 T: ::std::convert::TryInto<super::InputSkillId>,
29303 T::Error: ::std::fmt::Display,
29304 {
29305 self.skill_id = value
29306 .try_into()
29307 .map_err(|e| {
29308 format!("error converting supplied value for skill_id: {e}")
29309 });
29310 self
29311 }
29312 }
29313 impl ::std::convert::TryFrom<Input> for super::Input {
29314 type Error = super::error::ConversionError;
29315 fn try_from(
29316 value: Input,
29317 ) -> ::std::result::Result<Self, super::error::ConversionError> {
29318 Ok(Self {
29319 limit: value.limit?,
29320 page_token: value.page_token?,
29321 skill_id: value.skill_id?,
29322 })
29323 }
29324 }
29325 impl ::std::convert::From<super::Input> for Input {
29326 fn from(value: super::Input) -> Self {
29327 Self {
29328 limit: Ok(value.limit),
29329 page_token: Ok(value.page_token),
29330 skill_id: Ok(value.skill_id),
29331 }
29332 }
29333 }
29334}
29335pub mod error {
29337 pub struct ConversionError(::std::borrow::Cow<'static, str>);
29339 impl ::std::error::Error for ConversionError {}
29340 impl ::std::fmt::Display for ConversionError {
29341 fn fmt(
29342 &self,
29343 f: &mut ::std::fmt::Formatter<'_>,
29344 ) -> Result<(), ::std::fmt::Error> {
29345 ::std::fmt::Display::fmt(&self.0, f)
29346 }
29347 }
29348 impl ::std::fmt::Debug for ConversionError {
29349 fn fmt(
29350 &self,
29351 f: &mut ::std::fmt::Formatter<'_>,
29352 ) -> Result<(), ::std::fmt::Error> {
29353 ::std::fmt::Debug::fmt(&self.0, f)
29354 }
29355 }
29356 impl From<&'static str> for ConversionError {
29357 fn from(value: &'static str) -> Self {
29358 Self(value.into())
29359 }
29360 }
29361 impl From<String> for ConversionError {
29362 fn from(value: String) -> Self {
29363 Self(value.into())
29364 }
29365 }
29366}
29367
29368pub mod output {
29369#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
29371pub struct Error {
29372 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29374 pub code: ::std::option::Option<i64>,
29375 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29377 pub message: ::std::option::Option<::std::string::String>,
29378 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29380 pub param: ::std::option::Option<::std::string::String>,
29381 #[serde(rename = "type", skip_serializing_if = "::std::option::Option::is_none")]
29383 pub type_: ::std::option::Option<::std::string::String>,
29384}
29385impl Error {
29386 pub fn builder() -> builder::Error {
29387 Default::default()
29388 }
29389}
29390#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
29392pub struct Output {
29393 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29394 pub error: ::std::option::Option<Error>,
29395 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29397 pub next_page_token: ::std::option::Option<::std::string::String>,
29398 #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
29400 pub revisions: ::std::vec::Vec<SkillRevision>,
29401}
29402impl Output {
29403 pub fn builder() -> builder::Output {
29404 Default::default()
29405 }
29406}
29407#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
29409pub struct SkillRevision {
29410 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29412 pub created_at: ::std::option::Option<::std::string::String>,
29413 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29415 pub name: ::std::option::Option<::std::string::String>,
29416 #[serde(skip_serializing_if = "::std::option::Option::is_none")]
29418 pub revision: ::std::option::Option<::std::string::String>,
29419}
29420impl SkillRevision {
29421 pub fn builder() -> builder::SkillRevision {
29422 Default::default()
29423 }
29424}
29425pub mod builder {
29427 #[derive(Clone, Debug)]
29428 pub struct Error {
29429 code: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
29430 message: ::std::result::Result<
29431 ::std::option::Option<::std::string::String>,
29432 ::std::string::String,
29433 >,
29434 param: ::std::result::Result<
29435 ::std::option::Option<::std::string::String>,
29436 ::std::string::String,
29437 >,
29438 type_: ::std::result::Result<
29439 ::std::option::Option<::std::string::String>,
29440 ::std::string::String,
29441 >,
29442 }
29443 impl ::std::default::Default for Error {
29444 fn default() -> Self {
29445 Self {
29446 code: Ok(Default::default()),
29447 message: Ok(Default::default()),
29448 param: Ok(Default::default()),
29449 type_: Ok(Default::default()),
29450 }
29451 }
29452 }
29453 impl Error {
29454 pub fn code<T>(mut self, value: T) -> Self
29455 where
29456 T: ::std::convert::TryInto<::std::option::Option<i64>>,
29457 T::Error: ::std::fmt::Display,
29458 {
29459 self.code = value
29460 .try_into()
29461 .map_err(|e| format!("error converting supplied value for code: {e}"));
29462 self
29463 }
29464 pub fn message<T>(mut self, value: T) -> Self
29465 where
29466 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29467 T::Error: ::std::fmt::Display,
29468 {
29469 self.message = value
29470 .try_into()
29471 .map_err(|e| {
29472 format!("error converting supplied value for message: {e}")
29473 });
29474 self
29475 }
29476 pub fn param<T>(mut self, value: T) -> Self
29477 where
29478 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29479 T::Error: ::std::fmt::Display,
29480 {
29481 self.param = value
29482 .try_into()
29483 .map_err(|e| format!("error converting supplied value for param: {e}"));
29484 self
29485 }
29486 pub fn type_<T>(mut self, value: T) -> Self
29487 where
29488 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29489 T::Error: ::std::fmt::Display,
29490 {
29491 self.type_ = value
29492 .try_into()
29493 .map_err(|e| format!("error converting supplied value for type_: {e}"));
29494 self
29495 }
29496 }
29497 impl ::std::convert::TryFrom<Error> for super::Error {
29498 type Error = super::error::ConversionError;
29499 fn try_from(
29500 value: Error,
29501 ) -> ::std::result::Result<Self, super::error::ConversionError> {
29502 Ok(Self {
29503 code: value.code?,
29504 message: value.message?,
29505 param: value.param?,
29506 type_: value.type_?,
29507 })
29508 }
29509 }
29510 impl ::std::convert::From<super::Error> for Error {
29511 fn from(value: super::Error) -> Self {
29512 Self {
29513 code: Ok(value.code),
29514 message: Ok(value.message),
29515 param: Ok(value.param),
29516 type_: Ok(value.type_),
29517 }
29518 }
29519 }
29520 #[derive(Clone, Debug)]
29521 pub struct Output {
29522 error: ::std::result::Result<
29523 ::std::option::Option<super::Error>,
29524 ::std::string::String,
29525 >,
29526 next_page_token: ::std::result::Result<
29527 ::std::option::Option<::std::string::String>,
29528 ::std::string::String,
29529 >,
29530 revisions: ::std::result::Result<
29531 ::std::vec::Vec<super::SkillRevision>,
29532 ::std::string::String,
29533 >,
29534 }
29535 impl ::std::default::Default for Output {
29536 fn default() -> Self {
29537 Self {
29538 error: Ok(Default::default()),
29539 next_page_token: Ok(Default::default()),
29540 revisions: Ok(Default::default()),
29541 }
29542 }
29543 }
29544 impl Output {
29545 pub fn error<T>(mut self, value: T) -> Self
29546 where
29547 T: ::std::convert::TryInto<::std::option::Option<super::Error>>,
29548 T::Error: ::std::fmt::Display,
29549 {
29550 self.error = value
29551 .try_into()
29552 .map_err(|e| format!("error converting supplied value for error: {e}"));
29553 self
29554 }
29555 pub fn next_page_token<T>(mut self, value: T) -> Self
29556 where
29557 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29558 T::Error: ::std::fmt::Display,
29559 {
29560 self.next_page_token = value
29561 .try_into()
29562 .map_err(|e| {
29563 format!("error converting supplied value for next_page_token: {e}")
29564 });
29565 self
29566 }
29567 pub fn revisions<T>(mut self, value: T) -> Self
29568 where
29569 T: ::std::convert::TryInto<::std::vec::Vec<super::SkillRevision>>,
29570 T::Error: ::std::fmt::Display,
29571 {
29572 self.revisions = value
29573 .try_into()
29574 .map_err(|e| {
29575 format!("error converting supplied value for revisions: {e}")
29576 });
29577 self
29578 }
29579 }
29580 impl ::std::convert::TryFrom<Output> for super::Output {
29581 type Error = super::error::ConversionError;
29582 fn try_from(
29583 value: Output,
29584 ) -> ::std::result::Result<Self, super::error::ConversionError> {
29585 Ok(Self {
29586 error: value.error?,
29587 next_page_token: value.next_page_token?,
29588 revisions: value.revisions?,
29589 })
29590 }
29591 }
29592 impl ::std::convert::From<super::Output> for Output {
29593 fn from(value: super::Output) -> Self {
29594 Self {
29595 error: Ok(value.error),
29596 next_page_token: Ok(value.next_page_token),
29597 revisions: Ok(value.revisions),
29598 }
29599 }
29600 }
29601 #[derive(Clone, Debug)]
29602 pub struct SkillRevision {
29603 created_at: ::std::result::Result<
29604 ::std::option::Option<::std::string::String>,
29605 ::std::string::String,
29606 >,
29607 name: ::std::result::Result<
29608 ::std::option::Option<::std::string::String>,
29609 ::std::string::String,
29610 >,
29611 revision: ::std::result::Result<
29612 ::std::option::Option<::std::string::String>,
29613 ::std::string::String,
29614 >,
29615 }
29616 impl ::std::default::Default for SkillRevision {
29617 fn default() -> Self {
29618 Self {
29619 created_at: Ok(Default::default()),
29620 name: Ok(Default::default()),
29621 revision: Ok(Default::default()),
29622 }
29623 }
29624 }
29625 impl SkillRevision {
29626 pub fn created_at<T>(mut self, value: T) -> Self
29627 where
29628 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29629 T::Error: ::std::fmt::Display,
29630 {
29631 self.created_at = value
29632 .try_into()
29633 .map_err(|e| {
29634 format!("error converting supplied value for created_at: {e}")
29635 });
29636 self
29637 }
29638 pub fn name<T>(mut self, value: T) -> Self
29639 where
29640 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29641 T::Error: ::std::fmt::Display,
29642 {
29643 self.name = value
29644 .try_into()
29645 .map_err(|e| format!("error converting supplied value for name: {e}"));
29646 self
29647 }
29648 pub fn revision<T>(mut self, value: T) -> Self
29649 where
29650 T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
29651 T::Error: ::std::fmt::Display,
29652 {
29653 self.revision = value
29654 .try_into()
29655 .map_err(|e| {
29656 format!("error converting supplied value for revision: {e}")
29657 });
29658 self
29659 }
29660 }
29661 impl ::std::convert::TryFrom<SkillRevision> for super::SkillRevision {
29662 type Error = super::error::ConversionError;
29663 fn try_from(
29664 value: SkillRevision,
29665 ) -> ::std::result::Result<Self, super::error::ConversionError> {
29666 Ok(Self {
29667 created_at: value.created_at?,
29668 name: value.name?,
29669 revision: value.revision?,
29670 })
29671 }
29672 }
29673 impl ::std::convert::From<super::SkillRevision> for SkillRevision {
29674 fn from(value: super::SkillRevision) -> Self {
29675 Self {
29676 created_at: Ok(value.created_at),
29677 name: Ok(value.name),
29678 revision: Ok(value.revision),
29679 }
29680 }
29681 }
29682}
29683pub mod error {
29685 pub struct ConversionError(::std::borrow::Cow<'static, str>);
29687 impl ::std::error::Error for ConversionError {}
29688 impl ::std::fmt::Display for ConversionError {
29689 fn fmt(
29690 &self,
29691 f: &mut ::std::fmt::Formatter<'_>,
29692 ) -> Result<(), ::std::fmt::Error> {
29693 ::std::fmt::Display::fmt(&self.0, f)
29694 }
29695 }
29696 impl ::std::fmt::Debug for ConversionError {
29697 fn fmt(
29698 &self,
29699 f: &mut ::std::fmt::Formatter<'_>,
29700 ) -> Result<(), ::std::fmt::Error> {
29701 ::std::fmt::Debug::fmt(&self.0, f)
29702 }
29703 }
29704 impl From<&'static str> for ConversionError {
29705 fn from(value: &'static str) -> Self {
29706 Self(value.into())
29707 }
29708 }
29709 impl From<String> for ConversionError {
29710 fn from(value: String) -> Self {
29711 Self(value.into())
29712 }
29713 }
29714}
29715
29716}
29717
29718 pub const ROUTING: ::one::Routing = ::one::Routing { routes: &[::one::Route { field: "skillId", part: ::one::Part::Path, key: Some("skillId") }, ::one::Route { field: "limit", part: ::one::Part::Query, key: Some("limit") }, ::one::Route { field: "page_token", part: ::one::Part::Query, key: Some("page_token") }], required_parts: &[::one::Part::Path] };
29720
29721 pub fn build(input: Input) -> ::std::result::Result<Operation<output::Output>, Error> {
29732 ::std::result::Result::Ok(Operation::action("conn_mod_def::GOQ4DUG-wng::WtvnvCI2RZ-uo9uDz5acFw", Method::GET, "/v1/skills/{{skillId}}/revisions").with_routed(&input, &ROUTING)?
29733 .merge_headers(::serde_json::from_str("{\"Accept\":\"application/json\"}").map_err(Error::Decode)?).returns::<output::Output>())
29734 }
29735
29736 impl IntoOperation for Input {
29737 type Output = output::Output;
29738
29739 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
29740 build(self)
29741 }
29742 }
29743 impl IntoOperation for builder::Input {
29744 type Output = output::Output;
29745
29746 fn into_operation(self) -> ::std::result::Result<Operation<output::Output>, Error> {
29747 Input::try_from(self).map_err(|error| Error::InvalidInput(::std::boxed::Box::new(error))).and_then(build)
29748 }
29749 }
29750}
29751pub fn list_skills_revisions() -> list_skills_revisions::builder::Input {
29753 list_skills_revisions::builder::Input::default()
29754}