1#![doc = r" This module contains the generated types for the library."]
2
3use std::collections::HashMap;
4#[cfg(feature = "tabled")]
5use tabled::Tabled;
6pub mod base64 {
7 #![doc = " Base64 data that encodes to url safe base64, but can decode from multiple"]
8 #![doc = " base64 implementations to account for various clients and libraries. Compatible"]
9 #![doc = " with serde and JsonSchema."]
10 use std::{convert::TryFrom, fmt};
11
12 use serde::{
13 de::{Error, Unexpected, Visitor},
14 Deserialize, Deserializer, Serialize, Serializer,
15 };
16 static ALLOWED_DECODING_FORMATS: &[data_encoding::Encoding] = &[
17 data_encoding::BASE64,
18 data_encoding::BASE64URL,
19 data_encoding::BASE64URL_NOPAD,
20 data_encoding::BASE64_MIME,
21 data_encoding::BASE64_NOPAD,
22 ];
23 #[derive(Debug, Clone, PartialEq, Eq)]
24 #[doc = " A container for binary that should be base64 encoded in serialisation. In reverse"]
25 #[doc = " when deserializing, will decode from many different types of base64 possible."]
26 pub struct Base64Data(pub Vec<u8>);
27 impl Base64Data {
28 #[doc = " Return is the data is empty."]
29 pub fn is_empty(&self) -> bool {
30 self.0.is_empty()
31 }
32 }
33
34 impl fmt::Display for Base64Data {
35 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
36 write!(f, "{}", data_encoding::BASE64URL_NOPAD.encode(&self.0))
37 }
38 }
39
40 impl From<Base64Data> for Vec<u8> {
41 fn from(data: Base64Data) -> Vec<u8> {
42 data.0
43 }
44 }
45
46 impl From<Vec<u8>> for Base64Data {
47 fn from(data: Vec<u8>) -> Base64Data {
48 Base64Data(data)
49 }
50 }
51
52 impl AsRef<[u8]> for Base64Data {
53 fn as_ref(&self) -> &[u8] {
54 &self.0
55 }
56 }
57
58 impl TryFrom<&str> for Base64Data {
59 type Error = anyhow::Error;
60 fn try_from(v: &str) -> Result<Self, Self::Error> {
61 for config in ALLOWED_DECODING_FORMATS {
62 if let Ok(data) = config.decode(v.as_bytes()) {
63 return Ok(Base64Data(data));
64 }
65 }
66 anyhow::bail!("Could not decode base64 data: {}", v);
67 }
68 }
69
70 struct Base64DataVisitor;
71 impl Visitor<'_> for Base64DataVisitor {
72 type Value = Base64Data;
73 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
74 write!(formatter, "a base64 encoded string")
75 }
76
77 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
78 where
79 E: Error,
80 {
81 for config in ALLOWED_DECODING_FORMATS {
82 if let Ok(data) = config.decode(v.as_bytes()) {
83 return Ok(Base64Data(data));
84 }
85 }
86 Err(serde::de::Error::invalid_value(Unexpected::Str(v), &self))
87 }
88 }
89
90 impl<'de> Deserialize<'de> for Base64Data {
91 fn deserialize<D>(deserializer: D) -> Result<Self, <D as Deserializer<'de>>::Error>
92 where
93 D: Deserializer<'de>,
94 {
95 deserializer.deserialize_str(Base64DataVisitor)
96 }
97 }
98
99 impl Serialize for Base64Data {
100 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
101 where
102 S: Serializer,
103 {
104 let encoded = data_encoding::BASE64URL_NOPAD.encode(&self.0);
105 serializer.serialize_str(&encoded)
106 }
107 }
108
109 impl schemars::JsonSchema for Base64Data {
110 fn schema_name() -> String {
111 "Base64Data".to_string()
112 }
113
114 fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
115 let mut obj = gen.root_schema_for::<String>().schema;
116 obj.format = Some("byte".to_string());
117 schemars::schema::Schema::Object(obj)
118 }
119
120 fn is_referenceable() -> bool {
121 false
122 }
123 }
124
125 #[cfg(test)]
126 mod tests {
127 use std::convert::TryFrom;
128
129 use super::Base64Data;
130 #[test]
131 fn test_base64_try_from() {
132 assert!(Base64Data::try_from("aGVsbG8=").is_ok());
133 assert!(Base64Data::try_from("abcdefghij").is_err());
134 }
135 }
136}
137
138#[cfg(feature = "requests")]
139pub mod multipart {
140 #![doc = " Multipart form data types."]
141 use std::path::PathBuf;
142 #[doc = " An attachement to a multipart form."]
143 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
144 pub struct Attachment {
145 #[doc = " The name of the field."]
146 pub name: String,
147 #[doc = " The file path of the attachment."]
148 pub filepath: Option<PathBuf>,
149 #[doc = " The content type of the attachment."]
150 pub content_type: Option<String>,
151 #[doc = " The data of the attachment."]
152 pub data: Vec<u8>,
153 }
154
155 impl std::convert::TryFrom<Attachment> for reqwest::multipart::Part {
156 type Error = reqwest::Error;
157 fn try_from(attachment: Attachment) -> Result<Self, Self::Error> {
158 let mut part = reqwest::multipart::Part::bytes(attachment.data);
159 if let Some(filepath) = attachment.filepath {
160 part = part.file_name(filepath.to_string_lossy().to_string());
161 }
162 if let Some(content_type) = attachment.content_type {
163 part = part.mime_str(&content_type)?;
164 }
165 Ok(part)
166 }
167 }
168
169 impl std::convert::TryFrom<std::path::PathBuf> for Attachment {
170 type Error = std::io::Error;
171 fn try_from(path: std::path::PathBuf) -> Result<Self, Self::Error> {
172 let content_type = mime_guess::from_path(&path).first_raw();
173 let data = std::fs::read(&path)?;
174 Ok(Attachment {
175 name: "file".to_string(),
176 filepath: Some(path),
177 content_type: content_type.map(|s| s.to_string()),
178 data,
179 })
180 }
181 }
182}
183
184#[cfg(feature = "requests")]
185pub mod paginate {
186 #![doc = " Utility functions used for pagination."]
187 use anyhow::Result;
188 #[doc = " A trait for types that allow pagination."]
189 pub trait Pagination {
190 #[doc = " The item that is paginated."]
191 type Item: serde::de::DeserializeOwned;
192 #[doc = " Returns true if the response has more pages."]
193 fn has_more_pages(&self) -> bool;
194 #[doc = " Returns the next page token."]
195 fn next_page_token(&self) -> Option<String>;
196 #[doc = " Modify a request to get the next page."]
197 fn next_page(
198 &self,
199 req: reqwest::Request,
200 ) -> Result<reqwest::Request, crate::types::error::Error>;
201 #[doc = " Get the items from a page."]
202 fn items(&self) -> Vec<Self::Item>;
203 }
204}
205
206pub mod phone_number {
207 #![doc = " A library to implement phone numbers for our database and JSON serialization and \
208 deserialization."]
209 use std::str::FromStr;
210
211 use schemars::JsonSchema;
212 #[doc = " A phone number."]
213 #[derive(Debug, Default, Clone, PartialEq, Hash, Eq)]
214 pub struct PhoneNumber(pub Option<phonenumber::PhoneNumber>);
215 impl From<phonenumber::PhoneNumber> for PhoneNumber {
216 fn from(id: phonenumber::PhoneNumber) -> PhoneNumber {
217 PhoneNumber(Some(id))
218 }
219 }
220
221 impl AsRef<Option<phonenumber::PhoneNumber>> for PhoneNumber {
222 fn as_ref(&self) -> &Option<phonenumber::PhoneNumber> {
223 &self.0
224 }
225 }
226
227 impl std::ops::Deref for PhoneNumber {
228 type Target = Option<phonenumber::PhoneNumber>;
229 fn deref(&self) -> &Self::Target {
230 &self.0
231 }
232 }
233
234 impl serde::ser::Serialize for PhoneNumber {
235 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
236 where
237 S: serde::ser::Serializer,
238 {
239 serializer.serialize_str(&self.to_string())
240 }
241 }
242
243 impl<'de> serde::de::Deserialize<'de> for PhoneNumber {
244 fn deserialize<D>(deserializer: D) -> Result<PhoneNumber, D::Error>
245 where
246 D: serde::de::Deserializer<'de>,
247 {
248 let s = String::deserialize(deserializer).unwrap_or_default();
249 PhoneNumber::from_str(&s).map_err(serde::de::Error::custom)
250 }
251 }
252
253 impl std::str::FromStr for PhoneNumber {
254 type Err = anyhow::Error;
255 fn from_str(s: &str) -> Result<Self, Self::Err> {
256 if s.trim().is_empty() {
257 return Ok(PhoneNumber(None));
258 }
259 let s = if !s.trim().starts_with('+') {
260 format!("+1{s}")
261 } else {
262 s.to_string()
263 }
264 .replace(['-', '(', ')', ' '], "");
265 Ok(PhoneNumber(Some(phonenumber::parse(None, &s).map_err(
266 |e| anyhow::anyhow!("invalid phone number `{}`: {}", s, e),
267 )?)))
268 }
269 }
270
271 impl std::fmt::Display for PhoneNumber {
272 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
273 let s = if let Some(phone) = &self.0 {
274 phone
275 .format()
276 .mode(phonenumber::Mode::International)
277 .to_string()
278 } else {
279 String::new()
280 };
281 write!(f, "{}", s)
282 }
283 }
284
285 impl JsonSchema for PhoneNumber {
286 fn schema_name() -> String {
287 "PhoneNumber".to_string()
288 }
289
290 fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
291 let mut obj = gen.root_schema_for::<String>().schema;
292 obj.format = Some("phone".to_string());
293 schemars::schema::Schema::Object(obj)
294 }
295
296 fn is_referenceable() -> bool {
297 false
298 }
299 }
300
301 #[cfg(test)]
302 mod test {
303 use pretty_assertions::assert_eq;
304
305 use super::PhoneNumber;
306 #[test]
307 fn test_parse_phone_number() {
308 let mut phone = "+1-555-555-5555";
309 let mut phone_parsed: PhoneNumber =
310 serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
311 let mut expected = PhoneNumber(Some(phonenumber::parse(None, phone).unwrap()));
312 assert_eq!(phone_parsed, expected);
313 let mut expected_str = "+1 555-555-5555";
314 assert_eq!(expected_str, serde_json::json!(phone_parsed));
315 phone = "555-555-5555";
316 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
317 assert_eq!(phone_parsed, expected);
318 assert_eq!(expected_str, serde_json::json!(phone_parsed));
319 phone = "+1 555-555-5555";
320 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
321 assert_eq!(phone_parsed, expected);
322 assert_eq!(expected_str, serde_json::json!(phone_parsed));
323 phone = "5555555555";
324 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
325 assert_eq!(phone_parsed, expected);
326 assert_eq!(expected_str, serde_json::json!(phone_parsed));
327 phone = "(510) 864-1234";
328 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
329 expected = PhoneNumber(Some(phonenumber::parse(None, "+15108641234").unwrap()));
330 assert_eq!(phone_parsed, expected);
331 expected_str = "+1 510-864-1234";
332 assert_eq!(expected_str, serde_json::json!(phone_parsed));
333 phone = "(510)8641234";
334 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
335 assert_eq!(phone_parsed, expected);
336 expected_str = "+1 510-864-1234";
337 assert_eq!(expected_str, serde_json::json!(phone_parsed));
338 phone = "";
339 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
340 assert_eq!(phone_parsed, PhoneNumber(None));
341 assert_eq!("", serde_json::json!(phone_parsed));
342 phone = "+49 30 1234 1234";
343 phone_parsed = serde_json::from_str(&format!(r#""{}""#, phone)).unwrap();
344 expected = PhoneNumber(Some(phonenumber::parse(None, phone).unwrap()));
345 assert_eq!(phone_parsed, expected);
346 expected_str = "+49 30 12341234";
347 assert_eq!(expected_str, serde_json::json!(phone_parsed));
348 }
349 }
350}
351
352#[cfg(feature = "requests")]
353pub mod error {
354 #![doc = " Error methods."]
355 #[doc = " Error produced by generated client methods."]
356 pub enum Error {
357 #[doc = " The request did not conform to API requirements."]
358 InvalidRequest(String),
359 #[cfg(feature = "retry")]
360 #[doc = " A server error either due to the data, or with the connection."]
361 CommunicationError(reqwest_middleware::Error),
362 #[doc = " A request error, caused when building the request."]
363 RequestError(reqwest::Error),
364 #[doc = " An expected response whose deserialization failed."]
365 SerdeError {
366 #[doc = " The error."]
367 error: format_serde_error::SerdeError,
368 #[doc = " The response status."]
369 status: reqwest::StatusCode,
370 },
371 #[doc = " An expected error response."]
372 InvalidResponsePayload {
373 #[cfg(feature = "retry")]
374 #[doc = " The error."]
375 error: reqwest_middleware::Error,
376 #[cfg(not(feature = "retry"))]
377 #[doc = " The error."]
378 error: reqwest::Error,
379 #[doc = " The full response."]
380 response: reqwest::Response,
381 },
382 #[doc = " An error from the server."]
383 Server {
384 #[doc = " The text from the body."]
385 body: String,
386 #[doc = " The response status."]
387 status: reqwest::StatusCode,
388 },
389 #[doc = " A response not listed in the API description. This may represent a"]
390 #[doc = " success or failure response; check `status().is_success()`."]
391 UnexpectedResponse(reqwest::Response),
392 }
393
394 impl Error {
395 #[doc = " Returns the status code, if the error was generated from a response."]
396 pub fn status(&self) -> Option<reqwest::StatusCode> {
397 match self {
398 Error::InvalidRequest(_) => None,
399 Error::RequestError(e) => e.status(),
400 #[cfg(feature = "retry")]
401 Error::CommunicationError(reqwest_middleware::Error::Reqwest(e)) => e.status(),
402 #[cfg(feature = "retry")]
403 Error::CommunicationError(reqwest_middleware::Error::Middleware(_)) => None,
404 Error::SerdeError { error: _, status } => Some(*status),
405 Error::InvalidResponsePayload { error: _, response } => Some(response.status()),
406 Error::Server { body: _, status } => Some(*status),
407 Error::UnexpectedResponse(r) => Some(r.status()),
408 }
409 }
410
411 #[doc = " Creates a new error from a response status and a serde error."]
412 pub fn from_serde_error(
413 e: format_serde_error::SerdeError,
414 status: reqwest::StatusCode,
415 ) -> Self {
416 Self::SerdeError { error: e, status }
417 }
418 }
419
420 #[cfg(feature = "retry")]
421 impl From<reqwest_middleware::Error> for Error {
422 fn from(e: reqwest_middleware::Error) -> Self {
423 Self::CommunicationError(e)
424 }
425 }
426
427 impl From<reqwest::Error> for Error {
428 fn from(e: reqwest::Error) -> Self {
429 Self::RequestError(e)
430 }
431 }
432
433 impl From<serde_json::Error> for Error {
434 fn from(e: serde_json::Error) -> Self {
435 Self::SerdeError {
436 error: format_serde_error::SerdeError::new(String::new(), e),
437 status: reqwest::StatusCode::INTERNAL_SERVER_ERROR,
438 }
439 }
440 }
441
442 impl std::fmt::Display for Error {
443 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
444 match self {
445 Error::InvalidRequest(s) => {
446 write!(f, "Invalid Request: {}", s)
447 }
448 #[cfg(feature = "retry")]
449 Error::CommunicationError(e) => {
450 write!(f, "Communication Error: {}", e)
451 }
452 Error::RequestError(e) => {
453 write!(f, "Request Error: {}", e)
454 }
455 Error::SerdeError { error, status: _ } => {
456 write!(f, "Serde Error: {}", error)
457 }
458 Error::InvalidResponsePayload { error, response: _ } => {
459 write!(f, "Invalid Response Payload: {}", error)
460 }
461 Error::Server { body, status } => {
462 write!(f, "Server Error: {} {}", status, body)
463 }
464 Error::UnexpectedResponse(r) => {
465 write!(f, "Unexpected Response: {:?}", r)
466 }
467 }
468 }
469 }
470
471 impl std::fmt::Debug for Error {
472 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
473 std::fmt::Display::fmt(self, f)
474 }
475 }
476
477 impl std::error::Error for Error {
478 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
479 match self {
480 #[cfg(feature = "retry")]
481 Error::CommunicationError(e) => Some(e),
482 Error::SerdeError { error, status: _ } => Some(error),
483 Error::InvalidResponsePayload { error, response: _ } => Some(error),
484 _ => None,
485 }
486 }
487 }
488}
489
490#[derive(
491 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
492)]
493pub struct StandardError {
494 #[serde(
495 rename = "subCategory",
496 default,
497 skip_serializing_if = "Option::is_none"
498 )]
499 pub sub_category: Option<HashMap<String, String>>,
500 pub context: std::collections::HashMap<String, Vec<String>>,
501 pub links: std::collections::HashMap<String, String>,
502 #[serde(default, skip_serializing_if = "Option::is_none")]
503 pub id: Option<String>,
504 pub category: String,
505 pub message: String,
506 pub errors: Vec<ErrorDetail>,
507 pub status: String,
508}
509
510impl std::fmt::Display for StandardError {
511 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
512 write!(
513 f,
514 "{}",
515 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
516 )
517 }
518}
519
520#[cfg(feature = "tabled")]
521impl tabled::Tabled for StandardError {
522 const LENGTH: usize = 8;
523 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
524 vec![
525 if let Some(sub_category) = &self.sub_category {
526 format!("{:?}", sub_category).into()
527 } else {
528 String::new().into()
529 },
530 format!("{:?}", self.context).into(),
531 format!("{:?}", self.links).into(),
532 if let Some(id) = &self.id {
533 format!("{:?}", id).into()
534 } else {
535 String::new().into()
536 },
537 self.category.clone().into(),
538 self.message.clone().into(),
539 format!("{:?}", self.errors).into(),
540 self.status.clone().into(),
541 ]
542 }
543
544 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
545 vec![
546 "sub_category".into(),
547 "context".into(),
548 "links".into(),
549 "id".into(),
550 "category".into(),
551 "message".into(),
552 "errors".into(),
553 "status".into(),
554 ]
555 }
556}
557
558#[derive(
559 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
560)]
561pub struct CollectionResponseAssociatedId {
562 #[serde(default, skip_serializing_if = "Option::is_none")]
563 pub paging: Option<Paging>,
564 pub results: Vec<AssociatedId>,
565}
566
567impl std::fmt::Display for CollectionResponseAssociatedId {
568 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
569 write!(
570 f,
571 "{}",
572 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
573 )
574 }
575}
576
577#[cfg(feature = "tabled")]
578impl tabled::Tabled for CollectionResponseAssociatedId {
579 const LENGTH: usize = 2;
580 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
581 vec![
582 if let Some(paging) = &self.paging {
583 format!("{:?}", paging).into()
584 } else {
585 String::new().into()
586 },
587 format!("{:?}", self.results).into(),
588 ]
589 }
590
591 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
592 vec!["paging".into(), "results".into()]
593 }
594}
595
596#[derive(
597 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
598)]
599pub struct PublicAssociationsForObject {
600 pub types: Vec<AssociationSpec>,
601 pub to: PublicObjectId,
602}
603
604impl std::fmt::Display for PublicAssociationsForObject {
605 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
606 write!(
607 f,
608 "{}",
609 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
610 )
611 }
612}
613
614#[cfg(feature = "tabled")]
615impl tabled::Tabled for PublicAssociationsForObject {
616 const LENGTH: usize = 2;
617 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
618 vec![
619 format!("{:?}", self.types).into(),
620 format!("{:?}", self.to).into(),
621 ]
622 }
623
624 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
625 vec!["types".into(), "to".into()]
626 }
627}
628
629#[derive(
630 serde :: Serialize,
631 serde :: Deserialize,
632 PartialEq,
633 Hash,
634 Debug,
635 Clone,
636 schemars :: JsonSchema,
637 parse_display :: FromStr,
638 parse_display :: Display,
639)]
640#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
641#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
642pub enum Status {
643 #[serde(rename = "PENDING")]
644 #[display("PENDING")]
645 Pending,
646 #[serde(rename = "PROCESSING")]
647 #[display("PROCESSING")]
648 Processing,
649 #[serde(rename = "CANCELED")]
650 #[display("CANCELED")]
651 Canceled,
652 #[serde(rename = "COMPLETE")]
653 #[display("COMPLETE")]
654 Complete,
655}
656
657#[derive(
658 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
659)]
660pub struct BatchResponseSimplePublicObject {
661 #[serde(rename = "completedAt")]
662 pub completed_at: chrono::DateTime<chrono::Utc>,
663 #[serde(
664 rename = "requestedAt",
665 default,
666 skip_serializing_if = "Option::is_none"
667 )]
668 pub requested_at: Option<chrono::DateTime<chrono::Utc>>,
669 #[serde(rename = "startedAt")]
670 pub started_at: chrono::DateTime<chrono::Utc>,
671 #[serde(default, skip_serializing_if = "Option::is_none")]
672 pub links: Option<std::collections::HashMap<String, String>>,
673 pub results: Vec<SimplePublicObject>,
674 pub status: Status,
675}
676
677impl std::fmt::Display for BatchResponseSimplePublicObject {
678 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
679 write!(
680 f,
681 "{}",
682 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
683 )
684 }
685}
686
687#[cfg(feature = "tabled")]
688impl tabled::Tabled for BatchResponseSimplePublicObject {
689 const LENGTH: usize = 6;
690 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
691 vec![
692 format!("{:?}", self.completed_at).into(),
693 if let Some(requested_at) = &self.requested_at {
694 format!("{:?}", requested_at).into()
695 } else {
696 String::new().into()
697 },
698 format!("{:?}", self.started_at).into(),
699 if let Some(links) = &self.links {
700 format!("{:?}", links).into()
701 } else {
702 String::new().into()
703 },
704 format!("{:?}", self.results).into(),
705 format!("{:?}", self.status).into(),
706 ]
707 }
708
709 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
710 vec![
711 "completed_at".into(),
712 "requested_at".into(),
713 "started_at".into(),
714 "links".into(),
715 "results".into(),
716 "status".into(),
717 ]
718 }
719}
720
721#[derive(
722 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
723)]
724pub struct FilterGroup {
725 pub filters: Vec<Filter>,
726}
727
728impl std::fmt::Display for FilterGroup {
729 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
730 write!(
731 f,
732 "{}",
733 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
734 )
735 }
736}
737
738#[cfg(feature = "tabled")]
739impl tabled::Tabled for FilterGroup {
740 const LENGTH: usize = 1;
741 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
742 vec![format!("{:?}", self.filters).into()]
743 }
744
745 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
746 vec!["filters".into()]
747 }
748}
749
750#[derive(
751 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
752)]
753pub struct ErrorDetail {
754 #[doc = "A specific category that contains more specific detail about the error"]
755 #[serde(
756 rename = "subCategory",
757 default,
758 skip_serializing_if = "Option::is_none"
759 )]
760 pub sub_category: Option<String>,
761 #[doc = "The status code associated with the error detail"]
762 #[serde(default, skip_serializing_if = "Option::is_none")]
763 pub code: Option<String>,
764 #[doc = "The name of the field or parameter in which the error was found."]
765 #[serde(rename = "in", default, skip_serializing_if = "Option::is_none")]
766 pub in_: Option<String>,
767 #[doc = "Context about the error condition"]
768 #[serde(default, skip_serializing_if = "Option::is_none")]
769 pub context: Option<std::collections::HashMap<String, Vec<String>>>,
770 #[doc = "A human readable message describing the error along with remediation steps where \
771 appropriate"]
772 pub message: String,
773}
774
775impl std::fmt::Display for ErrorDetail {
776 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
777 write!(
778 f,
779 "{}",
780 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
781 )
782 }
783}
784
785#[cfg(feature = "tabled")]
786impl tabled::Tabled for ErrorDetail {
787 const LENGTH: usize = 5;
788 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
789 vec![
790 if let Some(sub_category) = &self.sub_category {
791 format!("{:?}", sub_category).into()
792 } else {
793 String::new().into()
794 },
795 if let Some(code) = &self.code {
796 format!("{:?}", code).into()
797 } else {
798 String::new().into()
799 },
800 if let Some(in_) = &self.in_ {
801 format!("{:?}", in_).into()
802 } else {
803 String::new().into()
804 },
805 if let Some(context) = &self.context {
806 format!("{:?}", context).into()
807 } else {
808 String::new().into()
809 },
810 self.message.clone().into(),
811 ]
812 }
813
814 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
815 vec![
816 "sub_category".into(),
817 "code".into(),
818 "in_".into(),
819 "context".into(),
820 "message".into(),
821 ]
822 }
823}
824
825#[derive(
826 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
827)]
828pub struct ForwardPaging {
829 #[serde(default, skip_serializing_if = "Option::is_none")]
830 pub next: Option<NextPage>,
831}
832
833impl std::fmt::Display for ForwardPaging {
834 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
835 write!(
836 f,
837 "{}",
838 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
839 )
840 }
841}
842
843#[cfg(feature = "tabled")]
844impl tabled::Tabled for ForwardPaging {
845 const LENGTH: usize = 1;
846 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
847 vec![if let Some(next) = &self.next {
848 format!("{:?}", next).into()
849 } else {
850 String::new().into()
851 }]
852 }
853
854 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
855 vec!["next".into()]
856 }
857}
858
859#[derive(
860 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
861)]
862pub struct SimplePublicObjectId {
863 pub id: String,
864}
865
866impl std::fmt::Display for SimplePublicObjectId {
867 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
868 write!(
869 f,
870 "{}",
871 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
872 )
873 }
874}
875
876#[cfg(feature = "tabled")]
877impl tabled::Tabled for SimplePublicObjectId {
878 const LENGTH: usize = 1;
879 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
880 vec![self.id.clone().into()]
881 }
882
883 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
884 vec!["id".into()]
885 }
886}
887
888#[derive(
889 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
890)]
891pub struct BatchReadInputSimplePublicObjectId {
892 #[serde(rename = "propertiesWithHistory")]
893 pub properties_with_history: Vec<String>,
894 #[serde(
895 rename = "idProperty",
896 default,
897 skip_serializing_if = "Option::is_none"
898 )]
899 pub id_property: Option<String>,
900 pub inputs: Vec<SimplePublicObjectId>,
901 pub properties: Vec<String>,
902}
903
904impl std::fmt::Display for BatchReadInputSimplePublicObjectId {
905 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
906 write!(
907 f,
908 "{}",
909 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
910 )
911 }
912}
913
914#[cfg(feature = "tabled")]
915impl tabled::Tabled for BatchReadInputSimplePublicObjectId {
916 const LENGTH: usize = 4;
917 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
918 vec![
919 format!("{:?}", self.properties_with_history).into(),
920 if let Some(id_property) = &self.id_property {
921 format!("{:?}", id_property).into()
922 } else {
923 String::new().into()
924 },
925 format!("{:?}", self.inputs).into(),
926 format!("{:?}", self.properties).into(),
927 ]
928 }
929
930 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
931 vec![
932 "properties_with_history".into(),
933 "id_property".into(),
934 "inputs".into(),
935 "properties".into(),
936 ]
937 }
938}
939
940#[derive(
941 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
942)]
943pub struct BatchInputSimplePublicObjectId {
944 pub inputs: Vec<SimplePublicObjectId>,
945}
946
947impl std::fmt::Display for BatchInputSimplePublicObjectId {
948 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
949 write!(
950 f,
951 "{}",
952 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
953 )
954 }
955}
956
957#[cfg(feature = "tabled")]
958impl tabled::Tabled for BatchInputSimplePublicObjectId {
959 const LENGTH: usize = 1;
960 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
961 vec![format!("{:?}", self.inputs).into()]
962 }
963
964 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
965 vec!["inputs".into()]
966 }
967}
968
969#[derive(
970 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
971)]
972pub struct ValueWithTimestamp {
973 #[serde(rename = "sourceId", default, skip_serializing_if = "Option::is_none")]
974 pub source_id: Option<String>,
975 #[serde(rename = "sourceType")]
976 pub source_type: String,
977 #[serde(
978 rename = "sourceLabel",
979 default,
980 skip_serializing_if = "Option::is_none"
981 )]
982 pub source_label: Option<String>,
983 #[serde(
984 rename = "updatedByUserId",
985 default,
986 skip_serializing_if = "Option::is_none"
987 )]
988 pub updated_by_user_id: Option<i32>,
989 pub value: String,
990 pub timestamp: chrono::DateTime<chrono::Utc>,
991}
992
993impl std::fmt::Display for ValueWithTimestamp {
994 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
995 write!(
996 f,
997 "{}",
998 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
999 )
1000 }
1001}
1002
1003#[cfg(feature = "tabled")]
1004impl tabled::Tabled for ValueWithTimestamp {
1005 const LENGTH: usize = 6;
1006 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1007 vec![
1008 if let Some(source_id) = &self.source_id {
1009 format!("{:?}", source_id).into()
1010 } else {
1011 String::new().into()
1012 },
1013 self.source_type.clone().into(),
1014 if let Some(source_label) = &self.source_label {
1015 format!("{:?}", source_label).into()
1016 } else {
1017 String::new().into()
1018 },
1019 if let Some(updated_by_user_id) = &self.updated_by_user_id {
1020 format!("{:?}", updated_by_user_id).into()
1021 } else {
1022 String::new().into()
1023 },
1024 self.value.clone().into(),
1025 format!("{:?}", self.timestamp).into(),
1026 ]
1027 }
1028
1029 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1030 vec![
1031 "source_id".into(),
1032 "source_type".into(),
1033 "source_label".into(),
1034 "updated_by_user_id".into(),
1035 "value".into(),
1036 "timestamp".into(),
1037 ]
1038 }
1039}
1040
1041#[derive(
1042 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1043)]
1044pub struct CollectionResponseWithTotalSimplePublicObjectForwardPaging {
1045 pub total: i32,
1046 #[serde(default, skip_serializing_if = "Option::is_none")]
1047 pub paging: Option<ForwardPaging>,
1048 pub results: Vec<SimplePublicObject>,
1049}
1050
1051impl std::fmt::Display for CollectionResponseWithTotalSimplePublicObjectForwardPaging {
1052 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1053 write!(
1054 f,
1055 "{}",
1056 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1057 )
1058 }
1059}
1060
1061#[cfg(feature = "tabled")]
1062impl tabled::Tabled for CollectionResponseWithTotalSimplePublicObjectForwardPaging {
1063 const LENGTH: usize = 3;
1064 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1065 vec![
1066 format!("{:?}", self.total).into(),
1067 if let Some(paging) = &self.paging {
1068 format!("{:?}", paging).into()
1069 } else {
1070 String::new().into()
1071 },
1072 format!("{:?}", self.results).into(),
1073 ]
1074 }
1075
1076 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1077 vec!["total".into(), "paging".into(), "results".into()]
1078 }
1079}
1080
1081#[derive(
1082 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1083)]
1084pub struct SimplePublicObject {
1085 #[serde(rename = "createdAt")]
1086 pub created_at: chrono::DateTime<chrono::Utc>,
1087 #[serde(default, skip_serializing_if = "Option::is_none")]
1088 pub archived: Option<bool>,
1089 #[serde(
1090 rename = "archivedAt",
1091 default,
1092 skip_serializing_if = "Option::is_none"
1093 )]
1094 pub archived_at: Option<chrono::DateTime<chrono::Utc>>,
1095 #[serde(
1096 rename = "propertiesWithHistory",
1097 default,
1098 skip_serializing_if = "Option::is_none"
1099 )]
1100 pub properties_with_history: Option<std::collections::HashMap<String, Vec<ValueWithTimestamp>>>,
1101 pub id: String,
1102 pub properties: std::collections::HashMap<String, Option<String>>,
1103 #[serde(rename = "updatedAt")]
1104 pub updated_at: chrono::DateTime<chrono::Utc>,
1105}
1106
1107impl std::fmt::Display for SimplePublicObject {
1108 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1109 write!(
1110 f,
1111 "{}",
1112 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1113 )
1114 }
1115}
1116
1117#[cfg(feature = "tabled")]
1118impl tabled::Tabled for SimplePublicObject {
1119 const LENGTH: usize = 7;
1120 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1121 vec![
1122 format!("{:?}", self.created_at).into(),
1123 if let Some(archived) = &self.archived {
1124 format!("{:?}", archived).into()
1125 } else {
1126 String::new().into()
1127 },
1128 if let Some(archived_at) = &self.archived_at {
1129 format!("{:?}", archived_at).into()
1130 } else {
1131 String::new().into()
1132 },
1133 if let Some(properties_with_history) = &self.properties_with_history {
1134 format!("{:?}", properties_with_history).into()
1135 } else {
1136 String::new().into()
1137 },
1138 self.id.clone().into(),
1139 format!("{:?}", self.properties).into(),
1140 format!("{:?}", self.updated_at).into(),
1141 ]
1142 }
1143
1144 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1145 vec![
1146 "created_at".into(),
1147 "archived".into(),
1148 "archived_at".into(),
1149 "properties_with_history".into(),
1150 "id".into(),
1151 "properties".into(),
1152 "updated_at".into(),
1153 ]
1154 }
1155}
1156
1157#[derive(
1158 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1159)]
1160pub struct PublicObjectId {
1161 pub id: String,
1162}
1163
1164impl std::fmt::Display for PublicObjectId {
1165 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1166 write!(
1167 f,
1168 "{}",
1169 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1170 )
1171 }
1172}
1173
1174#[cfg(feature = "tabled")]
1175impl tabled::Tabled for PublicObjectId {
1176 const LENGTH: usize = 1;
1177 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1178 vec![self.id.clone().into()]
1179 }
1180
1181 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1182 vec!["id".into()]
1183 }
1184}
1185
1186#[derive(
1187 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1188)]
1189pub struct Paging {
1190 #[serde(default, skip_serializing_if = "Option::is_none")]
1191 pub next: Option<NextPage>,
1192 #[serde(default, skip_serializing_if = "Option::is_none")]
1193 pub prev: Option<PreviousPage>,
1194}
1195
1196impl std::fmt::Display for Paging {
1197 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1198 write!(
1199 f,
1200 "{}",
1201 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1202 )
1203 }
1204}
1205
1206#[cfg(feature = "tabled")]
1207impl tabled::Tabled for Paging {
1208 const LENGTH: usize = 2;
1209 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1210 vec![
1211 if let Some(next) = &self.next {
1212 format!("{:?}", next).into()
1213 } else {
1214 String::new().into()
1215 },
1216 if let Some(prev) = &self.prev {
1217 format!("{:?}", prev).into()
1218 } else {
1219 String::new().into()
1220 },
1221 ]
1222 }
1223
1224 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1225 vec!["next".into(), "prev".into()]
1226 }
1227}
1228
1229#[derive(
1230 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1231)]
1232pub struct PublicObjectSearchRequest {
1233 #[serde(default, skip_serializing_if = "Option::is_none")]
1234 pub query: Option<String>,
1235 pub limit: i32,
1236 pub after: String,
1237 pub sorts: Vec<String>,
1238 pub properties: Vec<String>,
1239 #[serde(rename = "filterGroups")]
1240 pub filter_groups: Vec<FilterGroup>,
1241}
1242
1243impl std::fmt::Display for PublicObjectSearchRequest {
1244 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1245 write!(
1246 f,
1247 "{}",
1248 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1249 )
1250 }
1251}
1252
1253#[cfg(feature = "tabled")]
1254impl tabled::Tabled for PublicObjectSearchRequest {
1255 const LENGTH: usize = 6;
1256 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1257 vec![
1258 if let Some(query) = &self.query {
1259 format!("{:?}", query).into()
1260 } else {
1261 String::new().into()
1262 },
1263 format!("{:?}", self.limit).into(),
1264 self.after.clone().into(),
1265 format!("{:?}", self.sorts).into(),
1266 format!("{:?}", self.properties).into(),
1267 format!("{:?}", self.filter_groups).into(),
1268 ]
1269 }
1270
1271 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1272 vec![
1273 "query".into(),
1274 "limit".into(),
1275 "after".into(),
1276 "sorts".into(),
1277 "properties".into(),
1278 "filter_groups".into(),
1279 ]
1280 }
1281}
1282
1283#[derive(
1284 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1285)]
1286pub struct Error {
1287 #[doc = "A specific category that contains more specific detail about the error"]
1288 #[serde(
1289 rename = "subCategory",
1290 default,
1291 skip_serializing_if = "Option::is_none"
1292 )]
1293 pub sub_category: Option<String>,
1294 #[doc = "Context about the error condition"]
1295 #[serde(default, skip_serializing_if = "Option::is_none")]
1296 pub context: Option<std::collections::HashMap<String, Vec<String>>>,
1297 #[doc = "A unique identifier for the request. Include this value with any error reports or \
1298 support tickets"]
1299 #[serde(rename = "correlationId")]
1300 pub correlation_id: uuid::Uuid,
1301 #[doc = "A map of link names to associated URIs containing documentation about the error or \
1302 recommended remediation steps"]
1303 #[serde(default, skip_serializing_if = "Option::is_none")]
1304 pub links: Option<std::collections::HashMap<String, String>>,
1305 #[doc = "A human readable message describing the error along with remediation steps where \
1306 appropriate"]
1307 pub message: String,
1308 #[doc = "The error category"]
1309 pub category: String,
1310 #[doc = "further information about the error"]
1311 #[serde(default, skip_serializing_if = "Option::is_none")]
1312 pub errors: Option<Vec<ErrorDetail>>,
1313}
1314
1315impl std::fmt::Display for Error {
1316 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1317 write!(
1318 f,
1319 "{}",
1320 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1321 )
1322 }
1323}
1324
1325#[cfg(feature = "tabled")]
1326impl tabled::Tabled for Error {
1327 const LENGTH: usize = 7;
1328 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1329 vec![
1330 if let Some(sub_category) = &self.sub_category {
1331 format!("{:?}", sub_category).into()
1332 } else {
1333 String::new().into()
1334 },
1335 if let Some(context) = &self.context {
1336 format!("{:?}", context).into()
1337 } else {
1338 String::new().into()
1339 },
1340 format!("{:?}", self.correlation_id).into(),
1341 if let Some(links) = &self.links {
1342 format!("{:?}", links).into()
1343 } else {
1344 String::new().into()
1345 },
1346 self.message.clone().into(),
1347 self.category.clone().into(),
1348 if let Some(errors) = &self.errors {
1349 format!("{:?}", errors).into()
1350 } else {
1351 String::new().into()
1352 },
1353 ]
1354 }
1355
1356 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1357 vec![
1358 "sub_category".into(),
1359 "context".into(),
1360 "correlation_id".into(),
1361 "links".into(),
1362 "message".into(),
1363 "category".into(),
1364 "errors".into(),
1365 ]
1366 }
1367}
1368
1369#[derive(
1370 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1371)]
1372pub struct BatchResponseSimplePublicObjectWithErrors {
1373 #[serde(rename = "completedAt")]
1374 pub completed_at: chrono::DateTime<chrono::Utc>,
1375 #[serde(rename = "numErrors", default, skip_serializing_if = "Option::is_none")]
1376 pub num_errors: Option<i32>,
1377 #[serde(
1378 rename = "requestedAt",
1379 default,
1380 skip_serializing_if = "Option::is_none"
1381 )]
1382 pub requested_at: Option<chrono::DateTime<chrono::Utc>>,
1383 #[serde(rename = "startedAt")]
1384 pub started_at: chrono::DateTime<chrono::Utc>,
1385 #[serde(default, skip_serializing_if = "Option::is_none")]
1386 pub links: Option<std::collections::HashMap<String, String>>,
1387 pub results: Vec<SimplePublicObject>,
1388 #[serde(default, skip_serializing_if = "Option::is_none")]
1389 pub errors: Option<Vec<StandardError>>,
1390 pub status: Status,
1391}
1392
1393impl std::fmt::Display for BatchResponseSimplePublicObjectWithErrors {
1394 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1395 write!(
1396 f,
1397 "{}",
1398 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1399 )
1400 }
1401}
1402
1403#[cfg(feature = "tabled")]
1404impl tabled::Tabled for BatchResponseSimplePublicObjectWithErrors {
1405 const LENGTH: usize = 8;
1406 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1407 vec![
1408 format!("{:?}", self.completed_at).into(),
1409 if let Some(num_errors) = &self.num_errors {
1410 format!("{:?}", num_errors).into()
1411 } else {
1412 String::new().into()
1413 },
1414 if let Some(requested_at) = &self.requested_at {
1415 format!("{:?}", requested_at).into()
1416 } else {
1417 String::new().into()
1418 },
1419 format!("{:?}", self.started_at).into(),
1420 if let Some(links) = &self.links {
1421 format!("{:?}", links).into()
1422 } else {
1423 String::new().into()
1424 },
1425 format!("{:?}", self.results).into(),
1426 if let Some(errors) = &self.errors {
1427 format!("{:?}", errors).into()
1428 } else {
1429 String::new().into()
1430 },
1431 format!("{:?}", self.status).into(),
1432 ]
1433 }
1434
1435 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1436 vec![
1437 "completed_at".into(),
1438 "num_errors".into(),
1439 "requested_at".into(),
1440 "started_at".into(),
1441 "links".into(),
1442 "results".into(),
1443 "errors".into(),
1444 "status".into(),
1445 ]
1446 }
1447}
1448
1449#[derive(
1450 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1451)]
1452pub struct PublicGdprDeleteInput {
1453 #[serde(
1454 rename = "idProperty",
1455 default,
1456 skip_serializing_if = "Option::is_none"
1457 )]
1458 pub id_property: Option<String>,
1459 #[serde(rename = "objectId")]
1460 pub object_id: String,
1461}
1462
1463impl std::fmt::Display for PublicGdprDeleteInput {
1464 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1465 write!(
1466 f,
1467 "{}",
1468 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1469 )
1470 }
1471}
1472
1473#[cfg(feature = "tabled")]
1474impl tabled::Tabled for PublicGdprDeleteInput {
1475 const LENGTH: usize = 2;
1476 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1477 vec![
1478 if let Some(id_property) = &self.id_property {
1479 format!("{:?}", id_property).into()
1480 } else {
1481 String::new().into()
1482 },
1483 self.object_id.clone().into(),
1484 ]
1485 }
1486
1487 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1488 vec!["id_property".into(), "object_id".into()]
1489 }
1490}
1491
1492#[derive(
1493 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1494)]
1495pub struct SimplePublicObjectInput {
1496 pub properties: std::collections::HashMap<String, String>,
1497}
1498
1499impl std::fmt::Display for SimplePublicObjectInput {
1500 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1501 write!(
1502 f,
1503 "{}",
1504 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1505 )
1506 }
1507}
1508
1509#[cfg(feature = "tabled")]
1510impl tabled::Tabled for SimplePublicObjectInput {
1511 const LENGTH: usize = 1;
1512 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1513 vec![format!("{:?}", self.properties).into()]
1514 }
1515
1516 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1517 vec!["properties".into()]
1518 }
1519}
1520
1521#[derive(
1522 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1523)]
1524pub struct CollectionResponseSimplePublicObjectWithAssociationsForwardPaging {
1525 #[serde(default, skip_serializing_if = "Option::is_none")]
1526 pub paging: Option<ForwardPaging>,
1527 pub results: Vec<SimplePublicObjectWithAssociations>,
1528}
1529
1530impl std::fmt::Display for CollectionResponseSimplePublicObjectWithAssociationsForwardPaging {
1531 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1532 write!(
1533 f,
1534 "{}",
1535 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1536 )
1537 }
1538}
1539
1540#[cfg(feature = "tabled")]
1541impl tabled::Tabled for CollectionResponseSimplePublicObjectWithAssociationsForwardPaging {
1542 const LENGTH: usize = 2;
1543 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1544 vec![
1545 if let Some(paging) = &self.paging {
1546 format!("{:?}", paging).into()
1547 } else {
1548 String::new().into()
1549 },
1550 format!("{:?}", self.results).into(),
1551 ]
1552 }
1553
1554 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1555 vec!["paging".into(), "results".into()]
1556 }
1557}
1558
1559#[derive(
1560 serde :: Serialize,
1561 serde :: Deserialize,
1562 PartialEq,
1563 Hash,
1564 Debug,
1565 Clone,
1566 schemars :: JsonSchema,
1567 parse_display :: FromStr,
1568 parse_display :: Display,
1569)]
1570#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1571#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1572pub enum AssociationCategory {
1573 #[serde(rename = "HUBSPOT_DEFINED")]
1574 #[display("HUBSPOT_DEFINED")]
1575 HubspotDefined,
1576 #[serde(rename = "USER_DEFINED")]
1577 #[display("USER_DEFINED")]
1578 UserDefined,
1579 #[serde(rename = "INTEGRATOR_DEFINED")]
1580 #[display("INTEGRATOR_DEFINED")]
1581 IntegratorDefined,
1582}
1583
1584#[derive(
1585 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1586)]
1587pub struct AssociationSpec {
1588 #[serde(rename = "associationCategory")]
1589 pub association_category: AssociationCategory,
1590 #[serde(rename = "associationTypeId")]
1591 pub association_type_id: i32,
1592}
1593
1594impl std::fmt::Display for AssociationSpec {
1595 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1596 write!(
1597 f,
1598 "{}",
1599 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1600 )
1601 }
1602}
1603
1604#[cfg(feature = "tabled")]
1605impl tabled::Tabled for AssociationSpec {
1606 const LENGTH: usize = 2;
1607 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1608 vec![
1609 format!("{:?}", self.association_category).into(),
1610 format!("{:?}", self.association_type_id).into(),
1611 ]
1612 }
1613
1614 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1615 vec!["association_category".into(), "association_type_id".into()]
1616 }
1617}
1618
1619#[derive(
1620 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1621)]
1622pub struct PublicMergeInput {
1623 #[serde(rename = "objectIdToMerge")]
1624 pub object_id_to_merge: String,
1625 #[serde(rename = "primaryObjectId")]
1626 pub primary_object_id: String,
1627}
1628
1629impl std::fmt::Display for PublicMergeInput {
1630 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1631 write!(
1632 f,
1633 "{}",
1634 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1635 )
1636 }
1637}
1638
1639#[cfg(feature = "tabled")]
1640impl tabled::Tabled for PublicMergeInput {
1641 const LENGTH: usize = 2;
1642 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1643 vec![
1644 self.object_id_to_merge.clone().into(),
1645 self.primary_object_id.clone().into(),
1646 ]
1647 }
1648
1649 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1650 vec!["object_id_to_merge".into(), "primary_object_id".into()]
1651 }
1652}
1653
1654#[derive(
1655 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1656)]
1657pub struct SimplePublicObjectWithAssociations {
1658 #[serde(default, skip_serializing_if = "Option::is_none")]
1659 pub associations: Option<std::collections::HashMap<String, CollectionResponseAssociatedId>>,
1660 #[serde(rename = "createdAt")]
1661 pub created_at: chrono::DateTime<chrono::Utc>,
1662 #[serde(default, skip_serializing_if = "Option::is_none")]
1663 pub archived: Option<bool>,
1664 #[serde(
1665 rename = "archivedAt",
1666 default,
1667 skip_serializing_if = "Option::is_none"
1668 )]
1669 pub archived_at: Option<chrono::DateTime<chrono::Utc>>,
1670 #[serde(
1671 rename = "propertiesWithHistory",
1672 default,
1673 skip_serializing_if = "Option::is_none"
1674 )]
1675 pub properties_with_history: Option<std::collections::HashMap<String, Vec<ValueWithTimestamp>>>,
1676 pub id: String,
1677 pub properties: std::collections::HashMap<String, Option<String>>,
1678 #[serde(rename = "updatedAt")]
1679 pub updated_at: chrono::DateTime<chrono::Utc>,
1680}
1681
1682impl std::fmt::Display for SimplePublicObjectWithAssociations {
1683 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1684 write!(
1685 f,
1686 "{}",
1687 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1688 )
1689 }
1690}
1691
1692#[cfg(feature = "tabled")]
1693impl tabled::Tabled for SimplePublicObjectWithAssociations {
1694 const LENGTH: usize = 8;
1695 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1696 vec![
1697 if let Some(associations) = &self.associations {
1698 format!("{:?}", associations).into()
1699 } else {
1700 String::new().into()
1701 },
1702 format!("{:?}", self.created_at).into(),
1703 if let Some(archived) = &self.archived {
1704 format!("{:?}", archived).into()
1705 } else {
1706 String::new().into()
1707 },
1708 if let Some(archived_at) = &self.archived_at {
1709 format!("{:?}", archived_at).into()
1710 } else {
1711 String::new().into()
1712 },
1713 if let Some(properties_with_history) = &self.properties_with_history {
1714 format!("{:?}", properties_with_history).into()
1715 } else {
1716 String::new().into()
1717 },
1718 self.id.clone().into(),
1719 format!("{:?}", self.properties).into(),
1720 format!("{:?}", self.updated_at).into(),
1721 ]
1722 }
1723
1724 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1725 vec![
1726 "associations".into(),
1727 "created_at".into(),
1728 "archived".into(),
1729 "archived_at".into(),
1730 "properties_with_history".into(),
1731 "id".into(),
1732 "properties".into(),
1733 "updated_at".into(),
1734 ]
1735 }
1736}
1737
1738#[doc = "null"]
1739#[derive(
1740 serde :: Serialize,
1741 serde :: Deserialize,
1742 PartialEq,
1743 Hash,
1744 Debug,
1745 Clone,
1746 schemars :: JsonSchema,
1747 parse_display :: FromStr,
1748 parse_display :: Display,
1749)]
1750#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
1751#[cfg_attr(feature = "tabled", derive(tabled::Tabled))]
1752pub enum Operator {
1753 #[serde(rename = "EQ")]
1754 #[display("EQ")]
1755 Eq,
1756 #[serde(rename = "NEQ")]
1757 #[display("NEQ")]
1758 Neq,
1759 #[serde(rename = "LT")]
1760 #[display("LT")]
1761 Lt,
1762 #[serde(rename = "LTE")]
1763 #[display("LTE")]
1764 Lte,
1765 #[serde(rename = "GT")]
1766 #[display("GT")]
1767 Gt,
1768 #[serde(rename = "GTE")]
1769 #[display("GTE")]
1770 Gte,
1771 #[serde(rename = "BETWEEN")]
1772 #[display("BETWEEN")]
1773 Between,
1774 #[serde(rename = "IN")]
1775 #[display("IN")]
1776 In,
1777 #[serde(rename = "NOT_IN")]
1778 #[display("NOT_IN")]
1779 NotIn,
1780 #[serde(rename = "HAS_PROPERTY")]
1781 #[display("HAS_PROPERTY")]
1782 HasProperty,
1783 #[serde(rename = "NOT_HAS_PROPERTY")]
1784 #[display("NOT_HAS_PROPERTY")]
1785 NotHasProperty,
1786 #[serde(rename = "CONTAINS_TOKEN")]
1787 #[display("CONTAINS_TOKEN")]
1788 ContainsToken,
1789 #[serde(rename = "NOT_CONTAINS_TOKEN")]
1790 #[display("NOT_CONTAINS_TOKEN")]
1791 NotContainsToken,
1792}
1793
1794#[derive(
1795 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1796)]
1797pub struct Filter {
1798 #[serde(rename = "highValue", default, skip_serializing_if = "Option::is_none")]
1799 pub high_value: Option<String>,
1800 #[serde(rename = "propertyName")]
1801 pub property_name: String,
1802 #[serde(default, skip_serializing_if = "Option::is_none")]
1803 pub values: Option<Vec<String>>,
1804 #[serde(default, skip_serializing_if = "Option::is_none")]
1805 pub value: Option<String>,
1806 #[doc = "null"]
1807 pub operator: Operator,
1808}
1809
1810impl std::fmt::Display for Filter {
1811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1812 write!(
1813 f,
1814 "{}",
1815 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1816 )
1817 }
1818}
1819
1820#[cfg(feature = "tabled")]
1821impl tabled::Tabled for Filter {
1822 const LENGTH: usize = 5;
1823 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1824 vec![
1825 if let Some(high_value) = &self.high_value {
1826 format!("{:?}", high_value).into()
1827 } else {
1828 String::new().into()
1829 },
1830 self.property_name.clone().into(),
1831 if let Some(values) = &self.values {
1832 format!("{:?}", values).into()
1833 } else {
1834 String::new().into()
1835 },
1836 if let Some(value) = &self.value {
1837 format!("{:?}", value).into()
1838 } else {
1839 String::new().into()
1840 },
1841 format!("{:?}", self.operator).into(),
1842 ]
1843 }
1844
1845 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1846 vec![
1847 "high_value".into(),
1848 "property_name".into(),
1849 "values".into(),
1850 "value".into(),
1851 "operator".into(),
1852 ]
1853 }
1854}
1855
1856#[derive(
1857 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1858)]
1859pub struct BatchInputSimplePublicObjectBatchInput {
1860 pub inputs: Vec<SimplePublicObjectBatchInput>,
1861}
1862
1863impl std::fmt::Display for BatchInputSimplePublicObjectBatchInput {
1864 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1865 write!(
1866 f,
1867 "{}",
1868 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1869 )
1870 }
1871}
1872
1873#[cfg(feature = "tabled")]
1874impl tabled::Tabled for BatchInputSimplePublicObjectBatchInput {
1875 const LENGTH: usize = 1;
1876 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1877 vec![format!("{:?}", self.inputs).into()]
1878 }
1879
1880 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1881 vec!["inputs".into()]
1882 }
1883}
1884
1885#[derive(
1886 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1887)]
1888pub struct BatchInputSimplePublicObjectInputForCreate {
1889 pub inputs: Vec<SimplePublicObjectInputForCreate>,
1890}
1891
1892impl std::fmt::Display for BatchInputSimplePublicObjectInputForCreate {
1893 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1894 write!(
1895 f,
1896 "{}",
1897 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1898 )
1899 }
1900}
1901
1902#[cfg(feature = "tabled")]
1903impl tabled::Tabled for BatchInputSimplePublicObjectInputForCreate {
1904 const LENGTH: usize = 1;
1905 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1906 vec![format!("{:?}", self.inputs).into()]
1907 }
1908
1909 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1910 vec!["inputs".into()]
1911 }
1912}
1913
1914#[derive(
1915 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1916)]
1917pub struct PreviousPage {
1918 pub before: String,
1919 #[serde(default, skip_serializing_if = "Option::is_none")]
1920 pub link: Option<String>,
1921}
1922
1923impl std::fmt::Display for PreviousPage {
1924 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1925 write!(
1926 f,
1927 "{}",
1928 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1929 )
1930 }
1931}
1932
1933#[cfg(feature = "tabled")]
1934impl tabled::Tabled for PreviousPage {
1935 const LENGTH: usize = 2;
1936 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1937 vec![
1938 self.before.clone().into(),
1939 if let Some(link) = &self.link {
1940 format!("{:?}", link).into()
1941 } else {
1942 String::new().into()
1943 },
1944 ]
1945 }
1946
1947 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1948 vec!["before".into(), "link".into()]
1949 }
1950}
1951
1952#[derive(
1953 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1954)]
1955pub struct SimplePublicObjectBatchInput {
1956 #[serde(
1957 rename = "idProperty",
1958 default,
1959 skip_serializing_if = "Option::is_none"
1960 )]
1961 pub id_property: Option<String>,
1962 pub id: String,
1963 pub properties: std::collections::HashMap<String, String>,
1964}
1965
1966impl std::fmt::Display for SimplePublicObjectBatchInput {
1967 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
1968 write!(
1969 f,
1970 "{}",
1971 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
1972 )
1973 }
1974}
1975
1976#[cfg(feature = "tabled")]
1977impl tabled::Tabled for SimplePublicObjectBatchInput {
1978 const LENGTH: usize = 3;
1979 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
1980 vec![
1981 if let Some(id_property) = &self.id_property {
1982 format!("{:?}", id_property).into()
1983 } else {
1984 String::new().into()
1985 },
1986 self.id.clone().into(),
1987 format!("{:?}", self.properties).into(),
1988 ]
1989 }
1990
1991 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
1992 vec!["id_property".into(), "id".into(), "properties".into()]
1993 }
1994}
1995
1996#[derive(
1997 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
1998)]
1999pub struct AssociatedId {
2000 pub id: String,
2001 #[serde(rename = "type")]
2002 pub type_: String,
2003}
2004
2005impl std::fmt::Display for AssociatedId {
2006 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2007 write!(
2008 f,
2009 "{}",
2010 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2011 )
2012 }
2013}
2014
2015#[cfg(feature = "tabled")]
2016impl tabled::Tabled for AssociatedId {
2017 const LENGTH: usize = 2;
2018 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2019 vec![self.id.clone().into(), self.type_.clone().into()]
2020 }
2021
2022 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2023 vec!["id".into(), "type_".into()]
2024 }
2025}
2026
2027#[derive(
2028 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2029)]
2030pub struct NextPage {
2031 #[serde(default, skip_serializing_if = "Option::is_none")]
2032 pub link: Option<String>,
2033 pub after: String,
2034}
2035
2036impl std::fmt::Display for NextPage {
2037 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2038 write!(
2039 f,
2040 "{}",
2041 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2042 )
2043 }
2044}
2045
2046#[cfg(feature = "tabled")]
2047impl tabled::Tabled for NextPage {
2048 const LENGTH: usize = 2;
2049 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2050 vec![
2051 if let Some(link) = &self.link {
2052 format!("{:?}", link).into()
2053 } else {
2054 String::new().into()
2055 },
2056 self.after.clone().into(),
2057 ]
2058 }
2059
2060 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2061 vec!["link".into(), "after".into()]
2062 }
2063}
2064
2065#[derive(
2066 serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema,
2067)]
2068pub struct SimplePublicObjectInputForCreate {
2069 pub associations: Vec<PublicAssociationsForObject>,
2070 pub properties: std::collections::HashMap<String, String>,
2071}
2072
2073impl std::fmt::Display for SimplePublicObjectInputForCreate {
2074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
2075 write!(
2076 f,
2077 "{}",
2078 serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)?
2079 )
2080 }
2081}
2082
2083#[cfg(feature = "tabled")]
2084impl tabled::Tabled for SimplePublicObjectInputForCreate {
2085 const LENGTH: usize = 2;
2086 fn fields(&self) -> Vec<std::borrow::Cow<'static, str>> {
2087 vec![
2088 format!("{:?}", self.associations).into(),
2089 format!("{:?}", self.properties).into(),
2090 ]
2091 }
2092
2093 fn headers() -> Vec<std::borrow::Cow<'static, str>> {
2094 vec!["associations".into(), "properties".into()]
2095 }
2096}