postman_api/
request.rs

1use serde_json::json;
2use crate::model::*;
3use crate::PostmanClient;
4/**Create this with the associated client method.
5
6That method takes required values as arguments. Set optional values using builder methods on this struct.*/
7pub struct GetAllApisRequest<'a> {
8    pub(crate) client: &'a PostmanClient,
9    pub workspace: Option<String>,
10    pub since: Option<String>,
11    pub until: Option<String>,
12    pub created_by: Option<String>,
13    pub updated_by: Option<String>,
14    pub is_public: Option<bool>,
15    pub name: Option<String>,
16    pub summary: Option<String>,
17    pub description: Option<String>,
18    pub sort: Option<String>,
19    pub direction: Option<String>,
20}
21impl<'a> GetAllApisRequest<'a> {
22    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
23        let mut r = self.client.client.get("/apis");
24        if let Some(ref unwrapped) = self.workspace {
25            r = r.push_query("workspace", &unwrapped.to_string());
26        }
27        if let Some(ref unwrapped) = self.since {
28            r = r.push_query("since", &unwrapped.to_string());
29        }
30        if let Some(ref unwrapped) = self.until {
31            r = r.push_query("until", &unwrapped.to_string());
32        }
33        if let Some(ref unwrapped) = self.created_by {
34            r = r.push_query("createdBy", &unwrapped.to_string());
35        }
36        if let Some(ref unwrapped) = self.updated_by {
37            r = r.push_query("updatedBy", &unwrapped.to_string());
38        }
39        if let Some(ref unwrapped) = self.is_public {
40            r = r.push_query("isPublic", &unwrapped.to_string());
41        }
42        if let Some(ref unwrapped) = self.name {
43            r = r.push_query("name", &unwrapped.to_string());
44        }
45        if let Some(ref unwrapped) = self.summary {
46            r = r.push_query("summary", &unwrapped.to_string());
47        }
48        if let Some(ref unwrapped) = self.description {
49            r = r.push_query("description", &unwrapped.to_string());
50        }
51        if let Some(ref unwrapped) = self.sort {
52            r = r.push_query("sort", &unwrapped.to_string());
53        }
54        if let Some(ref unwrapped) = self.direction {
55            r = r.push_query("direction", &unwrapped.to_string());
56        }
57        r = self.client.authenticate(r);
58        let res = r.send().await.unwrap().error_for_status();
59        match res {
60            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
61            Err(res) => {
62                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
63                Err(anyhow::anyhow!("{:?}", text))
64            }
65        }
66    }
67    pub fn workspace(mut self, workspace: &str) -> Self {
68        self.workspace = Some(workspace.to_owned());
69        self
70    }
71    pub fn since(mut self, since: &str) -> Self {
72        self.since = Some(since.to_owned());
73        self
74    }
75    pub fn until(mut self, until: &str) -> Self {
76        self.until = Some(until.to_owned());
77        self
78    }
79    pub fn created_by(mut self, created_by: &str) -> Self {
80        self.created_by = Some(created_by.to_owned());
81        self
82    }
83    pub fn updated_by(mut self, updated_by: &str) -> Self {
84        self.updated_by = Some(updated_by.to_owned());
85        self
86    }
87    pub fn is_public(mut self, is_public: bool) -> Self {
88        self.is_public = Some(is_public);
89        self
90    }
91    pub fn name(mut self, name: &str) -> Self {
92        self.name = Some(name.to_owned());
93        self
94    }
95    pub fn summary(mut self, summary: &str) -> Self {
96        self.summary = Some(summary.to_owned());
97        self
98    }
99    pub fn description(mut self, description: &str) -> Self {
100        self.description = Some(description.to_owned());
101        self
102    }
103    pub fn sort(mut self, sort: &str) -> Self {
104        self.sort = Some(sort.to_owned());
105        self
106    }
107    pub fn direction(mut self, direction: &str) -> Self {
108        self.direction = Some(direction.to_owned());
109        self
110    }
111}
112/**Create this with the associated client method.
113
114That method takes required values as arguments. Set optional values using builder methods on this struct.*/
115pub struct CreateApiRequest<'a> {
116    pub(crate) client: &'a PostmanClient,
117    pub workspace_id: Option<String>,
118    pub api: Option<serde_json::Value>,
119}
120impl<'a> CreateApiRequest<'a> {
121    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
122        let mut r = self.client.client.post("/apis");
123        if let Some(ref unwrapped) = self.workspace_id {
124            r = r.push_query("workspaceId", &unwrapped.to_string());
125        }
126        if let Some(ref unwrapped) = self.api {
127            r = r.push_json(json!({ "api" : unwrapped }));
128        }
129        r = self.client.authenticate(r);
130        let res = r.send().await.unwrap().error_for_status();
131        match res {
132            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
133            Err(res) => {
134                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
135                Err(anyhow::anyhow!("{:?}", text))
136            }
137        }
138    }
139    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
140        self.workspace_id = Some(workspace_id.to_owned());
141        self
142    }
143    pub fn api(mut self, api: serde_json::Value) -> Self {
144        self.api = Some(api);
145        self
146    }
147}
148/**Create this with the associated client method.
149
150That method takes required values as arguments. Set optional values using builder methods on this struct.*/
151pub struct SingleApiRequest<'a> {
152    pub(crate) client: &'a PostmanClient,
153    pub api_id: String,
154}
155impl<'a> SingleApiRequest<'a> {
156    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
157        let mut r = self
158            .client
159            .client
160            .get(&format!("/apis/{api_id}", api_id = self.api_id));
161        r = self.client.authenticate(r);
162        let res = r.send().await.unwrap().error_for_status();
163        match res {
164            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
165            Err(res) => {
166                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
167                Err(anyhow::anyhow!("{:?}", text))
168            }
169        }
170    }
171}
172/**Create this with the associated client method.
173
174That method takes required values as arguments. Set optional values using builder methods on this struct.*/
175pub struct UpdateAnApiRequest<'a> {
176    pub(crate) client: &'a PostmanClient,
177    pub api_id: String,
178    pub api: Option<serde_json::Value>,
179}
180impl<'a> UpdateAnApiRequest<'a> {
181    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
182        let mut r = self
183            .client
184            .client
185            .put(&format!("/apis/{api_id}", api_id = self.api_id));
186        if let Some(ref unwrapped) = self.api {
187            r = r.push_json(json!({ "api" : unwrapped }));
188        }
189        r = self.client.authenticate(r);
190        let res = r.send().await.unwrap().error_for_status();
191        match res {
192            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
193            Err(res) => {
194                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
195                Err(anyhow::anyhow!("{:?}", text))
196            }
197        }
198    }
199    pub fn api(mut self, api: serde_json::Value) -> Self {
200        self.api = Some(api);
201        self
202    }
203}
204/**Create this with the associated client method.
205
206That method takes required values as arguments. Set optional values using builder methods on this struct.*/
207pub struct DeleteAnApiRequest<'a> {
208    pub(crate) client: &'a PostmanClient,
209    pub api_id: String,
210}
211impl<'a> DeleteAnApiRequest<'a> {
212    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
213        let mut r = self
214            .client
215            .client
216            .delete(&format!("/apis/{api_id}", api_id = self.api_id));
217        r = self.client.authenticate(r);
218        let res = r.send().await.unwrap().error_for_status();
219        match res {
220            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
221            Err(res) => {
222                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
223                Err(anyhow::anyhow!("{:?}", text))
224            }
225        }
226    }
227}
228/**Create this with the associated client method.
229
230That method takes required values as arguments. Set optional values using builder methods on this struct.*/
231pub struct GetAllApiVersionsRequest<'a> {
232    pub(crate) client: &'a PostmanClient,
233    pub api_id: String,
234}
235impl<'a> GetAllApiVersionsRequest<'a> {
236    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
237        let mut r = self
238            .client
239            .client
240            .get(&format!("/apis/{api_id}/versions", api_id = self.api_id));
241        r = self.client.authenticate(r);
242        let res = r.send().await.unwrap().error_for_status();
243        match res {
244            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
245            Err(res) => {
246                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
247                Err(anyhow::anyhow!("{:?}", text))
248            }
249        }
250    }
251}
252/**Create this with the associated client method.
253
254That method takes required values as arguments. Set optional values using builder methods on this struct.*/
255pub struct CreateApiVersionRequest<'a> {
256    pub(crate) client: &'a PostmanClient,
257    pub api_id: String,
258    pub version: Option<serde_json::Value>,
259}
260impl<'a> CreateApiVersionRequest<'a> {
261    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
262        let mut r = self
263            .client
264            .client
265            .post(&format!("/apis/{api_id}/versions", api_id = self.api_id));
266        if let Some(ref unwrapped) = self.version {
267            r = r.push_json(json!({ "version" : unwrapped }));
268        }
269        r = self.client.authenticate(r);
270        let res = r.send().await.unwrap().error_for_status();
271        match res {
272            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
273            Err(res) => {
274                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
275                Err(anyhow::anyhow!("{:?}", text))
276            }
277        }
278    }
279    pub fn version(mut self, version: serde_json::Value) -> Self {
280        self.version = Some(version);
281        self
282    }
283}
284/**Create this with the associated client method.
285
286That method takes required values as arguments. Set optional values using builder methods on this struct.*/
287pub struct GetAnApiVersionRequest<'a> {
288    pub(crate) client: &'a PostmanClient,
289    pub api_id: String,
290    pub api_version_id: String,
291}
292impl<'a> GetAnApiVersionRequest<'a> {
293    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
294        let mut r = self
295            .client
296            .client
297            .get(
298                &format!(
299                    "/apis/{api_id}/versions/{api_version_id}", api_id = self.api_id,
300                    api_version_id = self.api_version_id
301                ),
302            );
303        r = self.client.authenticate(r);
304        let res = r.send().await.unwrap().error_for_status();
305        match res {
306            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
307            Err(res) => {
308                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
309                Err(anyhow::anyhow!("{:?}", text))
310            }
311        }
312    }
313}
314/**Create this with the associated client method.
315
316That method takes required values as arguments. Set optional values using builder methods on this struct.*/
317pub struct UpdateAnApiVersionRequest<'a> {
318    pub(crate) client: &'a PostmanClient,
319    pub api_id: String,
320    pub api_version_id: String,
321    pub version: Option<serde_json::Value>,
322}
323impl<'a> UpdateAnApiVersionRequest<'a> {
324    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
325        let mut r = self
326            .client
327            .client
328            .put(
329                &format!(
330                    "/apis/{api_id}/versions/{api_version_id}", api_id = self.api_id,
331                    api_version_id = self.api_version_id
332                ),
333            );
334        if let Some(ref unwrapped) = self.version {
335            r = r.push_json(json!({ "version" : unwrapped }));
336        }
337        r = self.client.authenticate(r);
338        let res = r.send().await.unwrap().error_for_status();
339        match res {
340            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
341            Err(res) => {
342                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
343                Err(anyhow::anyhow!("{:?}", text))
344            }
345        }
346    }
347    pub fn version(mut self, version: serde_json::Value) -> Self {
348        self.version = Some(version);
349        self
350    }
351}
352/**Create this with the associated client method.
353
354That method takes required values as arguments. Set optional values using builder methods on this struct.*/
355pub struct DeleteAnApiVersionRequest<'a> {
356    pub(crate) client: &'a PostmanClient,
357    pub api_id: String,
358    pub api_version_id: String,
359}
360impl<'a> DeleteAnApiVersionRequest<'a> {
361    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
362        let mut r = self
363            .client
364            .client
365            .delete(
366                &format!(
367                    "/apis/{api_id}/versions/{api_version_id}", api_id = self.api_id,
368                    api_version_id = self.api_version_id
369                ),
370            );
371        r = self.client.authenticate(r);
372        let res = r.send().await.unwrap().error_for_status();
373        match res {
374            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
375            Err(res) => {
376                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
377                Err(anyhow::anyhow!("{:?}", text))
378            }
379        }
380    }
381}
382/**Create this with the associated client method.
383
384That method takes required values as arguments. Set optional values using builder methods on this struct.*/
385pub struct GetContractTestRelationsRequest<'a> {
386    pub(crate) client: &'a PostmanClient,
387    pub api_id: String,
388    pub api_version_id: String,
389}
390impl<'a> GetContractTestRelationsRequest<'a> {
391    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
392        let mut r = self
393            .client
394            .client
395            .get(
396                &format!(
397                    "/apis/{api_id}/versions/{api_version_id}/contracttest", api_id =
398                    self.api_id, api_version_id = self.api_version_id
399                ),
400            );
401        r = self.client.authenticate(r);
402        let res = r.send().await.unwrap().error_for_status();
403        match res {
404            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
405            Err(res) => {
406                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
407                Err(anyhow::anyhow!("{:?}", text))
408            }
409        }
410    }
411}
412/**Create this with the associated client method.
413
414That method takes required values as arguments. Set optional values using builder methods on this struct.*/
415pub struct GetDocumentationRelationsRequest<'a> {
416    pub(crate) client: &'a PostmanClient,
417    pub api_id: String,
418    pub api_version_id: String,
419}
420impl<'a> GetDocumentationRelationsRequest<'a> {
421    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
422        let mut r = self
423            .client
424            .client
425            .get(
426                &format!(
427                    "/apis/{api_id}/versions/{api_version_id}/documentation", api_id =
428                    self.api_id, api_version_id = self.api_version_id
429                ),
430            );
431        r = self.client.authenticate(r);
432        let res = r.send().await.unwrap().error_for_status();
433        match res {
434            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
435            Err(res) => {
436                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
437                Err(anyhow::anyhow!("{:?}", text))
438            }
439        }
440    }
441}
442/**Create this with the associated client method.
443
444That method takes required values as arguments. Set optional values using builder methods on this struct.*/
445pub struct GetEnvironmentRelationsRequest<'a> {
446    pub(crate) client: &'a PostmanClient,
447    pub api_id: String,
448    pub api_version_id: String,
449}
450impl<'a> GetEnvironmentRelationsRequest<'a> {
451    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
452        let mut r = self
453            .client
454            .client
455            .get(
456                &format!(
457                    "/apis/{api_id}/versions/{api_version_id}/environment", api_id = self
458                    .api_id, api_version_id = self.api_version_id
459                ),
460            );
461        r = self.client.authenticate(r);
462        let res = r.send().await.unwrap().error_for_status();
463        match res {
464            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
465            Err(res) => {
466                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
467                Err(anyhow::anyhow!("{:?}", text))
468            }
469        }
470    }
471}
472/**Create this with the associated client method.
473
474That method takes required values as arguments. Set optional values using builder methods on this struct.*/
475pub struct GetIntegrationTestRelationsRequest<'a> {
476    pub(crate) client: &'a PostmanClient,
477    pub api_id: String,
478    pub api_version_id: String,
479}
480impl<'a> GetIntegrationTestRelationsRequest<'a> {
481    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
482        let mut r = self
483            .client
484            .client
485            .get(
486                &format!(
487                    "/apis/{api_id}/versions/{api_version_id}/integrationtest", api_id =
488                    self.api_id, api_version_id = self.api_version_id
489                ),
490            );
491        r = self.client.authenticate(r);
492        let res = r.send().await.unwrap().error_for_status();
493        match res {
494            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
495            Err(res) => {
496                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
497                Err(anyhow::anyhow!("{:?}", text))
498            }
499        }
500    }
501}
502/**Create this with the associated client method.
503
504That method takes required values as arguments. Set optional values using builder methods on this struct.*/
505pub struct GetMockServerRelationsRequest<'a> {
506    pub(crate) client: &'a PostmanClient,
507    pub api_id: String,
508    pub api_version_id: String,
509}
510impl<'a> GetMockServerRelationsRequest<'a> {
511    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
512        let mut r = self
513            .client
514            .client
515            .get(
516                &format!(
517                    "/apis/{api_id}/versions/{api_version_id}/mock", api_id = self
518                    .api_id, api_version_id = self.api_version_id
519                ),
520            );
521        r = self.client.authenticate(r);
522        let res = r.send().await.unwrap().error_for_status();
523        match res {
524            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
525            Err(res) => {
526                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
527                Err(anyhow::anyhow!("{:?}", text))
528            }
529        }
530    }
531}
532/**Create this with the associated client method.
533
534That method takes required values as arguments. Set optional values using builder methods on this struct.*/
535pub struct GetMonitorRelationsRequest<'a> {
536    pub(crate) client: &'a PostmanClient,
537    pub api_id: String,
538    pub api_version_id: String,
539}
540impl<'a> GetMonitorRelationsRequest<'a> {
541    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
542        let mut r = self
543            .client
544            .client
545            .get(
546                &format!(
547                    "/apis/{api_id}/versions/{api_version_id}/monitor", api_id = self
548                    .api_id, api_version_id = self.api_version_id
549                ),
550            );
551        r = self.client.authenticate(r);
552        let res = r.send().await.unwrap().error_for_status();
553        match res {
554            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
555            Err(res) => {
556                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
557                Err(anyhow::anyhow!("{:?}", text))
558            }
559        }
560    }
561}
562/**Create this with the associated client method.
563
564That method takes required values as arguments. Set optional values using builder methods on this struct.*/
565pub struct GetLinkedRelationsRequest<'a> {
566    pub(crate) client: &'a PostmanClient,
567    pub api_id: String,
568    pub api_version_id: String,
569}
570impl<'a> GetLinkedRelationsRequest<'a> {
571    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
572        let mut r = self
573            .client
574            .client
575            .get(
576                &format!(
577                    "/apis/{api_id}/versions/{api_version_id}/relations", api_id = self
578                    .api_id, api_version_id = self.api_version_id
579                ),
580            );
581        r = self.client.authenticate(r);
582        let res = r.send().await.unwrap().error_for_status();
583        match res {
584            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
585            Err(res) => {
586                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
587                Err(anyhow::anyhow!("{:?}", text))
588            }
589        }
590    }
591}
592/**Create this with the associated client method.
593
594That method takes required values as arguments. Set optional values using builder methods on this struct.*/
595pub struct CreateRelationsRequest<'a> {
596    pub(crate) client: &'a PostmanClient,
597    pub api_id: String,
598    pub api_version_id: String,
599    pub documentation: Option<Vec<String>>,
600    pub environment: Option<Vec<String>>,
601    pub mock: Option<Vec<String>>,
602    pub monitor: Option<Vec<String>>,
603    pub test: Option<Vec<String>>,
604    pub contracttest: Option<Vec<String>>,
605    pub testsuite: Option<Vec<String>>,
606}
607impl<'a> CreateRelationsRequest<'a> {
608    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
609        let mut r = self
610            .client
611            .client
612            .post(
613                &format!(
614                    "/apis/{api_id}/versions/{api_version_id}/relations", api_id = self
615                    .api_id, api_version_id = self.api_version_id
616                ),
617            );
618        if let Some(ref unwrapped) = self.documentation {
619            r = r.push_json(json!({ "documentation" : unwrapped }));
620        }
621        if let Some(ref unwrapped) = self.environment {
622            r = r.push_json(json!({ "environment" : unwrapped }));
623        }
624        if let Some(ref unwrapped) = self.mock {
625            r = r.push_json(json!({ "mock" : unwrapped }));
626        }
627        if let Some(ref unwrapped) = self.monitor {
628            r = r.push_json(json!({ "monitor" : unwrapped }));
629        }
630        if let Some(ref unwrapped) = self.test {
631            r = r.push_json(json!({ "test" : unwrapped }));
632        }
633        if let Some(ref unwrapped) = self.contracttest {
634            r = r.push_json(json!({ "contracttest" : unwrapped }));
635        }
636        if let Some(ref unwrapped) = self.testsuite {
637            r = r.push_json(json!({ "testsuite" : unwrapped }));
638        }
639        r = self.client.authenticate(r);
640        let res = r.send().await.unwrap().error_for_status();
641        match res {
642            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
643            Err(res) => {
644                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
645                Err(anyhow::anyhow!("{:?}", text))
646            }
647        }
648    }
649    pub fn documentation(
650        mut self,
651        documentation: impl IntoIterator<Item = impl AsRef<str>>,
652    ) -> Self {
653        self
654            .documentation = Some(
655            documentation.into_iter().map(|s| s.as_ref().to_owned()).collect(),
656        );
657        self
658    }
659    pub fn environment(
660        mut self,
661        environment: impl IntoIterator<Item = impl AsRef<str>>,
662    ) -> Self {
663        self
664            .environment = Some(
665            environment.into_iter().map(|s| s.as_ref().to_owned()).collect(),
666        );
667        self
668    }
669    pub fn mock(mut self, mock: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
670        self.mock = Some(mock.into_iter().map(|s| s.as_ref().to_owned()).collect());
671        self
672    }
673    pub fn monitor(
674        mut self,
675        monitor: impl IntoIterator<Item = impl AsRef<str>>,
676    ) -> Self {
677        self
678            .monitor = Some(
679            monitor.into_iter().map(|s| s.as_ref().to_owned()).collect(),
680        );
681        self
682    }
683    pub fn test(mut self, test: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
684        self.test = Some(test.into_iter().map(|s| s.as_ref().to_owned()).collect());
685        self
686    }
687    pub fn contracttest(
688        mut self,
689        contracttest: impl IntoIterator<Item = impl AsRef<str>>,
690    ) -> Self {
691        self
692            .contracttest = Some(
693            contracttest.into_iter().map(|s| s.as_ref().to_owned()).collect(),
694        );
695        self
696    }
697    pub fn testsuite(
698        mut self,
699        testsuite: impl IntoIterator<Item = impl AsRef<str>>,
700    ) -> Self {
701        self
702            .testsuite = Some(
703            testsuite.into_iter().map(|s| s.as_ref().to_owned()).collect(),
704        );
705        self
706    }
707}
708/**Create this with the associated client method.
709
710That method takes required values as arguments. Set optional values using builder methods on this struct.*/
711pub struct CreateSchemaRequest<'a> {
712    pub(crate) client: &'a PostmanClient,
713    pub api_id: String,
714    pub api_version_id: String,
715    pub schema: Option<serde_json::Value>,
716}
717impl<'a> CreateSchemaRequest<'a> {
718    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
719        let mut r = self
720            .client
721            .client
722            .post(
723                &format!(
724                    "/apis/{api_id}/versions/{api_version_id}/schemas", api_id = self
725                    .api_id, api_version_id = self.api_version_id
726                ),
727            );
728        if let Some(ref unwrapped) = self.schema {
729            r = r.push_json(json!({ "schema" : unwrapped }));
730        }
731        r = self.client.authenticate(r);
732        let res = r.send().await.unwrap().error_for_status();
733        match res {
734            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
735            Err(res) => {
736                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
737                Err(anyhow::anyhow!("{:?}", text))
738            }
739        }
740    }
741    pub fn schema(mut self, schema: serde_json::Value) -> Self {
742        self.schema = Some(schema);
743        self
744    }
745}
746/**Create this with the associated client method.
747
748That method takes required values as arguments. Set optional values using builder methods on this struct.*/
749pub struct GetSchemaRequest<'a> {
750    pub(crate) client: &'a PostmanClient,
751    pub api_id: String,
752    pub api_version_id: String,
753    pub schema_id: String,
754}
755impl<'a> GetSchemaRequest<'a> {
756    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
757        let mut r = self
758            .client
759            .client
760            .get(
761                &format!(
762                    "/apis/{api_id}/versions/{api_version_id}/schemas/{schema_id}",
763                    api_id = self.api_id, api_version_id = self.api_version_id, schema_id
764                    = self.schema_id
765                ),
766            );
767        r = self.client.authenticate(r);
768        let res = r.send().await.unwrap().error_for_status();
769        match res {
770            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
771            Err(res) => {
772                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
773                Err(anyhow::anyhow!("{:?}", text))
774            }
775        }
776    }
777}
778/**Create this with the associated client method.
779
780That method takes required values as arguments. Set optional values using builder methods on this struct.*/
781pub struct UpdateSchemaRequest<'a> {
782    pub(crate) client: &'a PostmanClient,
783    pub api_id: String,
784    pub api_version_id: String,
785    pub schema_id: String,
786    pub schema: Option<serde_json::Value>,
787}
788impl<'a> UpdateSchemaRequest<'a> {
789    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
790        let mut r = self
791            .client
792            .client
793            .put(
794                &format!(
795                    "/apis/{api_id}/versions/{api_version_id}/schemas/{schema_id}",
796                    api_id = self.api_id, api_version_id = self.api_version_id, schema_id
797                    = self.schema_id
798                ),
799            );
800        if let Some(ref unwrapped) = self.schema {
801            r = r.push_json(json!({ "schema" : unwrapped }));
802        }
803        r = self.client.authenticate(r);
804        let res = r.send().await.unwrap().error_for_status();
805        match res {
806            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
807            Err(res) => {
808                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
809                Err(anyhow::anyhow!("{:?}", text))
810            }
811        }
812    }
813    pub fn schema(mut self, schema: serde_json::Value) -> Self {
814        self.schema = Some(schema);
815        self
816    }
817}
818/**Create this with the associated client method.
819
820That method takes required values as arguments. Set optional values using builder methods on this struct.*/
821pub struct CreateCollectionFromSchemaRequest<'a> {
822    pub(crate) client: &'a PostmanClient,
823    pub api_id: String,
824    pub api_version_id: String,
825    pub schema_id: String,
826    pub workspace_id: Option<String>,
827    pub name: String,
828    pub relations: Vec<serde_json::Value>,
829}
830impl<'a> CreateCollectionFromSchemaRequest<'a> {
831    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
832        let mut r = self
833            .client
834            .client
835            .post(
836                &format!(
837                    "/apis/{api_id}/versions/{api_version_id}/schemas/{schema_id}/collections",
838                    api_id = self.api_id, api_version_id = self.api_version_id, schema_id
839                    = self.schema_id
840                ),
841            );
842        if let Some(ref unwrapped) = self.workspace_id {
843            r = r.push_query("workspaceId", &unwrapped.to_string());
844        }
845        r = r.push_json(json!({ "name" : self.name }));
846        r = r.push_json(json!({ "relations" : self.relations }));
847        r = self.client.authenticate(r);
848        let res = r.send().await.unwrap().error_for_status();
849        match res {
850            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
851            Err(res) => {
852                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
853                Err(anyhow::anyhow!("{:?}", text))
854            }
855        }
856    }
857    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
858        self.workspace_id = Some(workspace_id.to_owned());
859        self
860    }
861}
862pub struct CreateCollectionFromSchemaRequired<'a> {
863    pub api_id: &'a str,
864    pub api_version_id: &'a str,
865    pub schema_id: &'a str,
866    pub name: &'a str,
867    pub relations: Vec<serde_json::Value>,
868}
869impl<'a> CreateCollectionFromSchemaRequired<'a> {}
870/**Create this with the associated client method.
871
872That method takes required values as arguments. Set optional values using builder methods on this struct.*/
873pub struct GetTestRelationsRequest<'a> {
874    pub(crate) client: &'a PostmanClient,
875    pub api_id: String,
876    pub api_version_id: String,
877}
878impl<'a> GetTestRelationsRequest<'a> {
879    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
880        let mut r = self
881            .client
882            .client
883            .get(
884                &format!(
885                    "/apis/{api_id}/versions/{api_version_id}/test", api_id = self
886                    .api_id, api_version_id = self.api_version_id
887                ),
888            );
889        r = self.client.authenticate(r);
890        let res = r.send().await.unwrap().error_for_status();
891        match res {
892            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
893            Err(res) => {
894                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
895                Err(anyhow::anyhow!("{:?}", text))
896            }
897        }
898    }
899}
900/**Create this with the associated client method.
901
902That method takes required values as arguments. Set optional values using builder methods on this struct.*/
903pub struct GetTestSuiteRelationsRequest<'a> {
904    pub(crate) client: &'a PostmanClient,
905    pub api_id: String,
906    pub api_version_id: String,
907}
908impl<'a> GetTestSuiteRelationsRequest<'a> {
909    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
910        let mut r = self
911            .client
912            .client
913            .get(
914                &format!(
915                    "/apis/{api_id}/versions/{api_version_id}/testsuite", api_id = self
916                    .api_id, api_version_id = self.api_version_id
917                ),
918            );
919        r = self.client.authenticate(r);
920        let res = r.send().await.unwrap().error_for_status();
921        match res {
922            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
923            Err(res) => {
924                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
925                Err(anyhow::anyhow!("{:?}", text))
926            }
927        }
928    }
929}
930/**Create this with the associated client method.
931
932That method takes required values as arguments. Set optional values using builder methods on this struct.*/
933pub struct SyncRelationsWithSchemaRequest<'a> {
934    pub(crate) client: &'a PostmanClient,
935    pub api_id: String,
936    pub api_version_id: String,
937    pub relation_type: String,
938    pub entity_id: String,
939}
940impl<'a> SyncRelationsWithSchemaRequest<'a> {
941    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
942        let mut r = self
943            .client
944            .client
945            .put(
946                &format!(
947                    "/apis/{api_id}/versions/{api_version_id}/{relation_type}/{entity_id}/syncWithSchema",
948                    api_id = self.api_id, api_version_id = self.api_version_id,
949                    relation_type = self.relation_type, entity_id = self.entity_id
950                ),
951            );
952        r = self.client.authenticate(r);
953        let res = r.send().await.unwrap().error_for_status();
954        match res {
955            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
956            Err(res) => {
957                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
958                Err(anyhow::anyhow!("{:?}", text))
959            }
960        }
961    }
962}
963pub struct SyncRelationsWithSchemaRequired<'a> {
964    pub api_id: &'a str,
965    pub api_version_id: &'a str,
966    pub relation_type: &'a str,
967    pub entity_id: &'a str,
968}
969impl<'a> SyncRelationsWithSchemaRequired<'a> {}
970/**Create this with the associated client method.
971
972That method takes required values as arguments. Set optional values using builder methods on this struct.*/
973pub struct AllCollectionsRequest<'a> {
974    pub(crate) client: &'a PostmanClient,
975    pub workspace_id: Option<String>,
976}
977impl<'a> AllCollectionsRequest<'a> {
978    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
979        let mut r = self.client.client.get("/collections");
980        if let Some(ref unwrapped) = self.workspace_id {
981            r = r.push_query("workspaceId", &unwrapped.to_string());
982        }
983        r = self.client.authenticate(r);
984        let res = r.send().await.unwrap().error_for_status();
985        match res {
986            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
987            Err(res) => {
988                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
989                Err(anyhow::anyhow!("{:?}", text))
990            }
991        }
992    }
993    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
994        self.workspace_id = Some(workspace_id.to_owned());
995        self
996    }
997}
998/**Create this with the associated client method.
999
1000That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1001pub struct CreateCollectionRequest<'a> {
1002    pub(crate) client: &'a PostmanClient,
1003    pub workspace_id: Option<String>,
1004    pub collection: Option<serde_json::Value>,
1005}
1006impl<'a> CreateCollectionRequest<'a> {
1007    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1008        let mut r = self.client.client.post("/collections");
1009        if let Some(ref unwrapped) = self.workspace_id {
1010            r = r.push_query("workspaceId", &unwrapped.to_string());
1011        }
1012        if let Some(ref unwrapped) = self.collection {
1013            r = r.push_json(json!({ "collection" : unwrapped }));
1014        }
1015        r = self.client.authenticate(r);
1016        let res = r.send().await.unwrap().error_for_status();
1017        match res {
1018            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1019            Err(res) => {
1020                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1021                Err(anyhow::anyhow!("{:?}", text))
1022            }
1023        }
1024    }
1025    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
1026        self.workspace_id = Some(workspace_id.to_owned());
1027        self
1028    }
1029    pub fn collection(mut self, collection: serde_json::Value) -> Self {
1030        self.collection = Some(collection);
1031        self
1032    }
1033}
1034/**Create this with the associated client method.
1035
1036That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1037pub struct CreateAForkRequest<'a> {
1038    pub(crate) client: &'a PostmanClient,
1039    pub workspace: String,
1040    pub collection_uid: String,
1041    pub label: Option<String>,
1042}
1043impl<'a> CreateAForkRequest<'a> {
1044    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1045        let mut r = self
1046            .client
1047            .client
1048            .post(
1049                &format!(
1050                    "/collections/fork/{collection_uid}", collection_uid = self
1051                    .collection_uid
1052                ),
1053            );
1054        r = r.push_query("workspace", &self.workspace.to_string());
1055        if let Some(ref unwrapped) = self.label {
1056            r = r.push_json(json!({ "label" : unwrapped }));
1057        }
1058        r = self.client.authenticate(r);
1059        let res = r.send().await.unwrap().error_for_status();
1060        match res {
1061            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1062            Err(res) => {
1063                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1064                Err(anyhow::anyhow!("{:?}", text))
1065            }
1066        }
1067    }
1068    pub fn label(mut self, label: &str) -> Self {
1069        self.label = Some(label.to_owned());
1070        self
1071    }
1072}
1073/**Create this with the associated client method.
1074
1075That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1076pub struct MergeAForkRequest<'a> {
1077    pub(crate) client: &'a PostmanClient,
1078    pub destination: Option<String>,
1079    pub source: Option<String>,
1080    pub strategy: Option<String>,
1081}
1082impl<'a> MergeAForkRequest<'a> {
1083    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1084        let mut r = self.client.client.post("/collections/merge");
1085        if let Some(ref unwrapped) = self.destination {
1086            r = r.push_json(json!({ "destination" : unwrapped }));
1087        }
1088        if let Some(ref unwrapped) = self.source {
1089            r = r.push_json(json!({ "source" : unwrapped }));
1090        }
1091        if let Some(ref unwrapped) = self.strategy {
1092            r = r.push_json(json!({ "strategy" : unwrapped }));
1093        }
1094        r = self.client.authenticate(r);
1095        let res = r.send().await.unwrap().error_for_status();
1096        match res {
1097            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1098            Err(res) => {
1099                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1100                Err(anyhow::anyhow!("{:?}", text))
1101            }
1102        }
1103    }
1104    pub fn destination(mut self, destination: &str) -> Self {
1105        self.destination = Some(destination.to_owned());
1106        self
1107    }
1108    pub fn source(mut self, source: &str) -> Self {
1109        self.source = Some(source.to_owned());
1110        self
1111    }
1112    pub fn strategy(mut self, strategy: &str) -> Self {
1113        self.strategy = Some(strategy.to_owned());
1114        self
1115    }
1116}
1117/**Create this with the associated client method.
1118
1119That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1120pub struct SingleCollectionRequest<'a> {
1121    pub(crate) client: &'a PostmanClient,
1122    pub collection_uid: String,
1123}
1124impl<'a> SingleCollectionRequest<'a> {
1125    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1126        let mut r = self
1127            .client
1128            .client
1129            .get(
1130                &format!(
1131                    "/collections/{collection_uid}", collection_uid = self.collection_uid
1132                ),
1133            );
1134        r = self.client.authenticate(r);
1135        let res = r.send().await.unwrap().error_for_status();
1136        match res {
1137            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1138            Err(res) => {
1139                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1140                Err(anyhow::anyhow!("{:?}", text))
1141            }
1142        }
1143    }
1144}
1145/**Create this with the associated client method.
1146
1147That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1148pub struct UpdateCollectionRequest<'a> {
1149    pub(crate) client: &'a PostmanClient,
1150    pub collection_uid: String,
1151    pub collection: Option<serde_json::Value>,
1152}
1153impl<'a> UpdateCollectionRequest<'a> {
1154    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1155        let mut r = self
1156            .client
1157            .client
1158            .put(
1159                &format!(
1160                    "/collections/{collection_uid}", collection_uid = self.collection_uid
1161                ),
1162            );
1163        if let Some(ref unwrapped) = self.collection {
1164            r = r.push_json(json!({ "collection" : unwrapped }));
1165        }
1166        r = self.client.authenticate(r);
1167        let res = r.send().await.unwrap().error_for_status();
1168        match res {
1169            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1170            Err(res) => {
1171                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1172                Err(anyhow::anyhow!("{:?}", text))
1173            }
1174        }
1175    }
1176    pub fn collection(mut self, collection: serde_json::Value) -> Self {
1177        self.collection = Some(collection);
1178        self
1179    }
1180}
1181/**Create this with the associated client method.
1182
1183That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1184pub struct DeleteCollectionRequest<'a> {
1185    pub(crate) client: &'a PostmanClient,
1186    pub collection_uid: String,
1187}
1188impl<'a> DeleteCollectionRequest<'a> {
1189    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1190        let mut r = self
1191            .client
1192            .client
1193            .delete(
1194                &format!(
1195                    "/collections/{collection_uid}", collection_uid = self.collection_uid
1196                ),
1197            );
1198        r = self.client.authenticate(r);
1199        let res = r.send().await.unwrap().error_for_status();
1200        match res {
1201            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1202            Err(res) => {
1203                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1204                Err(anyhow::anyhow!("{:?}", text))
1205            }
1206        }
1207    }
1208}
1209/**Create this with the associated client method.
1210
1211That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1212pub struct AllEnvironmentsRequest<'a> {
1213    pub(crate) client: &'a PostmanClient,
1214    pub workspace_id: Option<String>,
1215}
1216impl<'a> AllEnvironmentsRequest<'a> {
1217    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1218        let mut r = self.client.client.get("/environments");
1219        if let Some(ref unwrapped) = self.workspace_id {
1220            r = r.push_query("workspaceId", &unwrapped.to_string());
1221        }
1222        r = self.client.authenticate(r);
1223        let res = r.send().await.unwrap().error_for_status();
1224        match res {
1225            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1226            Err(res) => {
1227                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1228                Err(anyhow::anyhow!("{:?}", text))
1229            }
1230        }
1231    }
1232    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
1233        self.workspace_id = Some(workspace_id.to_owned());
1234        self
1235    }
1236}
1237/**Create this with the associated client method.
1238
1239That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1240pub struct CreateEnvironmentRequest<'a> {
1241    pub(crate) client: &'a PostmanClient,
1242    pub workspace_id: Option<String>,
1243    pub environment: Option<serde_json::Value>,
1244}
1245impl<'a> CreateEnvironmentRequest<'a> {
1246    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1247        let mut r = self.client.client.post("/environments");
1248        if let Some(ref unwrapped) = self.workspace_id {
1249            r = r.push_query("workspaceId", &unwrapped.to_string());
1250        }
1251        if let Some(ref unwrapped) = self.environment {
1252            r = r.push_json(json!({ "environment" : unwrapped }));
1253        }
1254        r = self.client.authenticate(r);
1255        let res = r.send().await.unwrap().error_for_status();
1256        match res {
1257            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1258            Err(res) => {
1259                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1260                Err(anyhow::anyhow!("{:?}", text))
1261            }
1262        }
1263    }
1264    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
1265        self.workspace_id = Some(workspace_id.to_owned());
1266        self
1267    }
1268    pub fn environment(mut self, environment: serde_json::Value) -> Self {
1269        self.environment = Some(environment);
1270        self
1271    }
1272}
1273/**Create this with the associated client method.
1274
1275That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1276pub struct SingleEnvironmentRequest<'a> {
1277    pub(crate) client: &'a PostmanClient,
1278    pub environment_uid: String,
1279}
1280impl<'a> SingleEnvironmentRequest<'a> {
1281    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1282        let mut r = self
1283            .client
1284            .client
1285            .get(
1286                &format!(
1287                    "/environments/{environment_uid}", environment_uid = self
1288                    .environment_uid
1289                ),
1290            );
1291        r = self.client.authenticate(r);
1292        let res = r.send().await.unwrap().error_for_status();
1293        match res {
1294            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1295            Err(res) => {
1296                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1297                Err(anyhow::anyhow!("{:?}", text))
1298            }
1299        }
1300    }
1301}
1302/**Create this with the associated client method.
1303
1304That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1305pub struct UpdateEnvironmentRequest<'a> {
1306    pub(crate) client: &'a PostmanClient,
1307    pub environment_uid: String,
1308    pub environment: Option<serde_json::Value>,
1309}
1310impl<'a> UpdateEnvironmentRequest<'a> {
1311    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1312        let mut r = self
1313            .client
1314            .client
1315            .put(
1316                &format!(
1317                    "/environments/{environment_uid}", environment_uid = self
1318                    .environment_uid
1319                ),
1320            );
1321        if let Some(ref unwrapped) = self.environment {
1322            r = r.push_json(json!({ "environment" : unwrapped }));
1323        }
1324        r = self.client.authenticate(r);
1325        let res = r.send().await.unwrap().error_for_status();
1326        match res {
1327            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1328            Err(res) => {
1329                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1330                Err(anyhow::anyhow!("{:?}", text))
1331            }
1332        }
1333    }
1334    pub fn environment(mut self, environment: serde_json::Value) -> Self {
1335        self.environment = Some(environment);
1336        self
1337    }
1338}
1339/**Create this with the associated client method.
1340
1341That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1342pub struct DeleteEnvironmentRequest<'a> {
1343    pub(crate) client: &'a PostmanClient,
1344    pub environment_uid: String,
1345}
1346impl<'a> DeleteEnvironmentRequest<'a> {
1347    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1348        let mut r = self
1349            .client
1350            .client
1351            .delete(
1352                &format!(
1353                    "/environments/{environment_uid}", environment_uid = self
1354                    .environment_uid
1355                ),
1356            );
1357        r = self.client.authenticate(r);
1358        let res = r.send().await.unwrap().error_for_status();
1359        match res {
1360            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1361            Err(res) => {
1362                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1363                Err(anyhow::anyhow!("{:?}", text))
1364            }
1365        }
1366    }
1367}
1368/**Create this with the associated client method.
1369
1370That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1371pub struct ImportExportedDataRequest<'a> {
1372    pub(crate) client: &'a PostmanClient,
1373}
1374impl<'a> ImportExportedDataRequest<'a> {
1375    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1376        let mut r = self.client.client.post("/import/exported");
1377        r = self.client.authenticate(r);
1378        let res = r.send().await.unwrap().error_for_status();
1379        match res {
1380            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1381            Err(res) => {
1382                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1383                Err(anyhow::anyhow!("{:?}", text))
1384            }
1385        }
1386    }
1387}
1388/**Create this with the associated client method.
1389
1390That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1391pub struct ImportExternalApiSpecificationRequest<'a> {
1392    pub(crate) client: &'a PostmanClient,
1393    pub workspace_id: Option<String>,
1394    pub body: serde_json::Value,
1395}
1396impl<'a> ImportExternalApiSpecificationRequest<'a> {
1397    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1398        let mut r = self.client.client.post("/import/openapi");
1399        if let Some(ref unwrapped) = self.workspace_id {
1400            r = r.push_query("workspaceId", &unwrapped.to_string());
1401        }
1402        r = r.push_json(json!({ "body" : self.body }));
1403        r = self.client.authenticate(r);
1404        let res = r.send().await.unwrap().error_for_status();
1405        match res {
1406            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1407            Err(res) => {
1408                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1409                Err(anyhow::anyhow!("{:?}", text))
1410            }
1411        }
1412    }
1413    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
1414        self.workspace_id = Some(workspace_id.to_owned());
1415        self
1416    }
1417}
1418/**Create this with the associated client method.
1419
1420That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1421pub struct ApiKeyOwnerRequest<'a> {
1422    pub(crate) client: &'a PostmanClient,
1423}
1424impl<'a> ApiKeyOwnerRequest<'a> {
1425    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1426        let mut r = self.client.client.get("/me");
1427        r = self.client.authenticate(r);
1428        let res = r.send().await.unwrap().error_for_status();
1429        match res {
1430            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1431            Err(res) => {
1432                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1433                Err(anyhow::anyhow!("{:?}", text))
1434            }
1435        }
1436    }
1437}
1438/**Create this with the associated client method.
1439
1440That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1441pub struct AllMocksRequest<'a> {
1442    pub(crate) client: &'a PostmanClient,
1443}
1444impl<'a> AllMocksRequest<'a> {
1445    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1446        let mut r = self.client.client.get("/mocks");
1447        r = self.client.authenticate(r);
1448        let res = r.send().await.unwrap().error_for_status();
1449        match res {
1450            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1451            Err(res) => {
1452                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1453                Err(anyhow::anyhow!("{:?}", text))
1454            }
1455        }
1456    }
1457}
1458/**Create this with the associated client method.
1459
1460That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1461pub struct CreateMockRequest<'a> {
1462    pub(crate) client: &'a PostmanClient,
1463    pub workspace_id: Option<String>,
1464    pub mock: Option<serde_json::Value>,
1465}
1466impl<'a> CreateMockRequest<'a> {
1467    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1468        let mut r = self.client.client.post("/mocks");
1469        if let Some(ref unwrapped) = self.workspace_id {
1470            r = r.push_query("workspaceId", &unwrapped.to_string());
1471        }
1472        if let Some(ref unwrapped) = self.mock {
1473            r = r.push_json(json!({ "mock" : unwrapped }));
1474        }
1475        r = self.client.authenticate(r);
1476        let res = r.send().await.unwrap().error_for_status();
1477        match res {
1478            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1479            Err(res) => {
1480                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1481                Err(anyhow::anyhow!("{:?}", text))
1482            }
1483        }
1484    }
1485    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
1486        self.workspace_id = Some(workspace_id.to_owned());
1487        self
1488    }
1489    pub fn mock(mut self, mock: serde_json::Value) -> Self {
1490        self.mock = Some(mock);
1491        self
1492    }
1493}
1494/**Create this with the associated client method.
1495
1496That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1497pub struct SingleMockRequest<'a> {
1498    pub(crate) client: &'a PostmanClient,
1499    pub mock_uid: String,
1500}
1501impl<'a> SingleMockRequest<'a> {
1502    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1503        let mut r = self
1504            .client
1505            .client
1506            .get(&format!("/mocks/{mock_uid}", mock_uid = self.mock_uid));
1507        r = self.client.authenticate(r);
1508        let res = r.send().await.unwrap().error_for_status();
1509        match res {
1510            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1511            Err(res) => {
1512                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1513                Err(anyhow::anyhow!("{:?}", text))
1514            }
1515        }
1516    }
1517}
1518/**Create this with the associated client method.
1519
1520That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1521pub struct UpdateMockRequest<'a> {
1522    pub(crate) client: &'a PostmanClient,
1523    pub mock_uid: String,
1524    pub mock: Option<serde_json::Value>,
1525}
1526impl<'a> UpdateMockRequest<'a> {
1527    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1528        let mut r = self
1529            .client
1530            .client
1531            .put(&format!("/mocks/{mock_uid}", mock_uid = self.mock_uid));
1532        if let Some(ref unwrapped) = self.mock {
1533            r = r.push_json(json!({ "mock" : unwrapped }));
1534        }
1535        r = self.client.authenticate(r);
1536        let res = r.send().await.unwrap().error_for_status();
1537        match res {
1538            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1539            Err(res) => {
1540                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1541                Err(anyhow::anyhow!("{:?}", text))
1542            }
1543        }
1544    }
1545    pub fn mock(mut self, mock: serde_json::Value) -> Self {
1546        self.mock = Some(mock);
1547        self
1548    }
1549}
1550/**Create this with the associated client method.
1551
1552That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1553pub struct DeleteMockRequest<'a> {
1554    pub(crate) client: &'a PostmanClient,
1555    pub mock_uid: String,
1556}
1557impl<'a> DeleteMockRequest<'a> {
1558    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1559        let mut r = self
1560            .client
1561            .client
1562            .delete(&format!("/mocks/{mock_uid}", mock_uid = self.mock_uid));
1563        r = self.client.authenticate(r);
1564        let res = r.send().await.unwrap().error_for_status();
1565        match res {
1566            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1567            Err(res) => {
1568                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1569                Err(anyhow::anyhow!("{:?}", text))
1570            }
1571        }
1572    }
1573}
1574/**Create this with the associated client method.
1575
1576That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1577pub struct PublishMockRequest<'a> {
1578    pub(crate) client: &'a PostmanClient,
1579    pub mock_uid: String,
1580}
1581impl<'a> PublishMockRequest<'a> {
1582    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1583        let mut r = self
1584            .client
1585            .client
1586            .post(&format!("/mocks/{mock_uid}/publish", mock_uid = self.mock_uid));
1587        r = self.client.authenticate(r);
1588        let res = r.send().await.unwrap().error_for_status();
1589        match res {
1590            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1591            Err(res) => {
1592                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1593                Err(anyhow::anyhow!("{:?}", text))
1594            }
1595        }
1596    }
1597}
1598/**Create this with the associated client method.
1599
1600That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1601pub struct UnpublishMockRequest<'a> {
1602    pub(crate) client: &'a PostmanClient,
1603    pub mock_uid: String,
1604}
1605impl<'a> UnpublishMockRequest<'a> {
1606    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1607        let mut r = self
1608            .client
1609            .client
1610            .delete(&format!("/mocks/{mock_uid}/unpublish", mock_uid = self.mock_uid));
1611        r = self.client.authenticate(r);
1612        let res = r.send().await.unwrap().error_for_status();
1613        match res {
1614            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1615            Err(res) => {
1616                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1617                Err(anyhow::anyhow!("{:?}", text))
1618            }
1619        }
1620    }
1621}
1622/**Create this with the associated client method.
1623
1624That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1625pub struct AllMonitorsRequest<'a> {
1626    pub(crate) client: &'a PostmanClient,
1627}
1628impl<'a> AllMonitorsRequest<'a> {
1629    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1630        let mut r = self.client.client.get("/monitors");
1631        r = self.client.authenticate(r);
1632        let res = r.send().await.unwrap().error_for_status();
1633        match res {
1634            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1635            Err(res) => {
1636                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1637                Err(anyhow::anyhow!("{:?}", text))
1638            }
1639        }
1640    }
1641}
1642/**Create this with the associated client method.
1643
1644That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1645pub struct CreateMonitorRequest<'a> {
1646    pub(crate) client: &'a PostmanClient,
1647    pub workspace_id: Option<String>,
1648    pub monitor: Option<serde_json::Value>,
1649}
1650impl<'a> CreateMonitorRequest<'a> {
1651    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1652        let mut r = self.client.client.post("/monitors");
1653        if let Some(ref unwrapped) = self.workspace_id {
1654            r = r.push_query("workspaceId", &unwrapped.to_string());
1655        }
1656        if let Some(ref unwrapped) = self.monitor {
1657            r = r.push_json(json!({ "monitor" : unwrapped }));
1658        }
1659        r = self.client.authenticate(r);
1660        let res = r.send().await.unwrap().error_for_status();
1661        match res {
1662            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1663            Err(res) => {
1664                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1665                Err(anyhow::anyhow!("{:?}", text))
1666            }
1667        }
1668    }
1669    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
1670        self.workspace_id = Some(workspace_id.to_owned());
1671        self
1672    }
1673    pub fn monitor(mut self, monitor: serde_json::Value) -> Self {
1674        self.monitor = Some(monitor);
1675        self
1676    }
1677}
1678/**Create this with the associated client method.
1679
1680That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1681pub struct SingleMonitorRequest<'a> {
1682    pub(crate) client: &'a PostmanClient,
1683    pub monitor_uid: String,
1684}
1685impl<'a> SingleMonitorRequest<'a> {
1686    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1687        let mut r = self
1688            .client
1689            .client
1690            .get(&format!("/monitors/{monitor_uid}", monitor_uid = self.monitor_uid));
1691        r = self.client.authenticate(r);
1692        let res = r.send().await.unwrap().error_for_status();
1693        match res {
1694            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1695            Err(res) => {
1696                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1697                Err(anyhow::anyhow!("{:?}", text))
1698            }
1699        }
1700    }
1701}
1702/**Create this with the associated client method.
1703
1704That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1705pub struct UpdateMonitorRequest<'a> {
1706    pub(crate) client: &'a PostmanClient,
1707    pub monitor_uid: String,
1708    pub monitor: Option<serde_json::Value>,
1709}
1710impl<'a> UpdateMonitorRequest<'a> {
1711    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1712        let mut r = self
1713            .client
1714            .client
1715            .put(&format!("/monitors/{monitor_uid}", monitor_uid = self.monitor_uid));
1716        if let Some(ref unwrapped) = self.monitor {
1717            r = r.push_json(json!({ "monitor" : unwrapped }));
1718        }
1719        r = self.client.authenticate(r);
1720        let res = r.send().await.unwrap().error_for_status();
1721        match res {
1722            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1723            Err(res) => {
1724                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1725                Err(anyhow::anyhow!("{:?}", text))
1726            }
1727        }
1728    }
1729    pub fn monitor(mut self, monitor: serde_json::Value) -> Self {
1730        self.monitor = Some(monitor);
1731        self
1732    }
1733}
1734/**Create this with the associated client method.
1735
1736That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1737pub struct DeleteMonitorRequest<'a> {
1738    pub(crate) client: &'a PostmanClient,
1739    pub monitor_uid: String,
1740}
1741impl<'a> DeleteMonitorRequest<'a> {
1742    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1743        let mut r = self
1744            .client
1745            .client
1746            .delete(&format!("/monitors/{monitor_uid}", monitor_uid = self.monitor_uid));
1747        r = self.client.authenticate(r);
1748        let res = r.send().await.unwrap().error_for_status();
1749        match res {
1750            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1751            Err(res) => {
1752                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1753                Err(anyhow::anyhow!("{:?}", text))
1754            }
1755        }
1756    }
1757}
1758/**Create this with the associated client method.
1759
1760That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1761pub struct RunAMonitorRequest<'a> {
1762    pub(crate) client: &'a PostmanClient,
1763    pub monitor_uid: String,
1764}
1765impl<'a> RunAMonitorRequest<'a> {
1766    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1767        let mut r = self
1768            .client
1769            .client
1770            .post(
1771                &format!("/monitors/{monitor_uid}/run", monitor_uid = self.monitor_uid),
1772            );
1773        r = self.client.authenticate(r);
1774        let res = r.send().await.unwrap().error_for_status();
1775        match res {
1776            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1777            Err(res) => {
1778                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1779                Err(anyhow::anyhow!("{:?}", text))
1780            }
1781        }
1782    }
1783}
1784/**Create this with the associated client method.
1785
1786That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1787pub struct GetResourceTypesRequest<'a> {
1788    pub(crate) client: &'a PostmanClient,
1789}
1790impl<'a> GetResourceTypesRequest<'a> {
1791    pub async fn send(self) -> anyhow::Result<Vec<serde_json::Value>> {
1792        let mut r = self.client.client.get("/scim/v2/ResourceTypes");
1793        r = self.client.authenticate(r);
1794        let res = r.send().await.unwrap().error_for_status();
1795        match res {
1796            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1797            Err(res) => {
1798                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1799                Err(anyhow::anyhow!("{:?}", text))
1800            }
1801        }
1802    }
1803}
1804/**Create this with the associated client method.
1805
1806That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1807pub struct ServiceProviderConfigRequest<'a> {
1808    pub(crate) client: &'a PostmanClient,
1809}
1810impl<'a> ServiceProviderConfigRequest<'a> {
1811    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1812        let mut r = self.client.client.get("/scim/v2/ServiceProviderConfig");
1813        r = self.client.authenticate(r);
1814        let res = r.send().await.unwrap().error_for_status();
1815        match res {
1816            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1817            Err(res) => {
1818                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1819                Err(anyhow::anyhow!("{:?}", text))
1820            }
1821        }
1822    }
1823}
1824/**Create this with the associated client method.
1825
1826That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1827pub struct FetchAllUserResourceRequest<'a> {
1828    pub(crate) client: &'a PostmanClient,
1829    pub start_index: Option<f64>,
1830    pub count: Option<f64>,
1831    pub filter: Option<String>,
1832}
1833impl<'a> FetchAllUserResourceRequest<'a> {
1834    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1835        let mut r = self.client.client.get("/scim/v2/Users");
1836        if let Some(ref unwrapped) = self.start_index {
1837            r = r.push_query("startIndex", &unwrapped.to_string());
1838        }
1839        if let Some(ref unwrapped) = self.count {
1840            r = r.push_query("count", &unwrapped.to_string());
1841        }
1842        if let Some(ref unwrapped) = self.filter {
1843            r = r.push_query("filter", &unwrapped.to_string());
1844        }
1845        r = self.client.authenticate(r);
1846        let res = r.send().await.unwrap().error_for_status();
1847        match res {
1848            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1849            Err(res) => {
1850                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1851                Err(anyhow::anyhow!("{:?}", text))
1852            }
1853        }
1854    }
1855    pub fn start_index(mut self, start_index: f64) -> Self {
1856        self.start_index = Some(start_index);
1857        self
1858    }
1859    pub fn count(mut self, count: f64) -> Self {
1860        self.count = Some(count);
1861        self
1862    }
1863    pub fn filter(mut self, filter: &str) -> Self {
1864        self.filter = Some(filter.to_owned());
1865        self
1866    }
1867}
1868/**Create this with the associated client method.
1869
1870That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1871pub struct CreateUserRequest<'a> {
1872    pub(crate) client: &'a PostmanClient,
1873    pub schemas: Option<Vec<String>>,
1874    pub user_name: Option<String>,
1875    pub active: Option<bool>,
1876    pub external_id: Option<String>,
1877    pub groups: Option<Vec<String>>,
1878    pub locale: Option<String>,
1879    pub name: Option<serde_json::Value>,
1880}
1881impl<'a> CreateUserRequest<'a> {
1882    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1883        let mut r = self.client.client.post("/scim/v2/Users");
1884        if let Some(ref unwrapped) = self.schemas {
1885            r = r.push_json(json!({ "schemas" : unwrapped }));
1886        }
1887        if let Some(ref unwrapped) = self.user_name {
1888            r = r.push_json(json!({ "userName" : unwrapped }));
1889        }
1890        if let Some(ref unwrapped) = self.active {
1891            r = r.push_json(json!({ "active" : unwrapped }));
1892        }
1893        if let Some(ref unwrapped) = self.external_id {
1894            r = r.push_json(json!({ "externalId" : unwrapped }));
1895        }
1896        if let Some(ref unwrapped) = self.groups {
1897            r = r.push_json(json!({ "groups" : unwrapped }));
1898        }
1899        if let Some(ref unwrapped) = self.locale {
1900            r = r.push_json(json!({ "locale" : unwrapped }));
1901        }
1902        if let Some(ref unwrapped) = self.name {
1903            r = r.push_json(json!({ "name" : unwrapped }));
1904        }
1905        r = self.client.authenticate(r);
1906        let res = r.send().await.unwrap().error_for_status();
1907        match res {
1908            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1909            Err(res) => {
1910                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1911                Err(anyhow::anyhow!("{:?}", text))
1912            }
1913        }
1914    }
1915    pub fn schemas(
1916        mut self,
1917        schemas: impl IntoIterator<Item = impl AsRef<str>>,
1918    ) -> Self {
1919        self
1920            .schemas = Some(
1921            schemas.into_iter().map(|s| s.as_ref().to_owned()).collect(),
1922        );
1923        self
1924    }
1925    pub fn user_name(mut self, user_name: &str) -> Self {
1926        self.user_name = Some(user_name.to_owned());
1927        self
1928    }
1929    pub fn active(mut self, active: bool) -> Self {
1930        self.active = Some(active);
1931        self
1932    }
1933    pub fn external_id(mut self, external_id: &str) -> Self {
1934        self.external_id = Some(external_id.to_owned());
1935        self
1936    }
1937    pub fn groups(mut self, groups: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
1938        self.groups = Some(groups.into_iter().map(|s| s.as_ref().to_owned()).collect());
1939        self
1940    }
1941    pub fn locale(mut self, locale: &str) -> Self {
1942        self.locale = Some(locale.to_owned());
1943        self
1944    }
1945    pub fn name(mut self, name: serde_json::Value) -> Self {
1946        self.name = Some(name);
1947        self
1948    }
1949}
1950/**Create this with the associated client method.
1951
1952That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1953pub struct FetchUserResourceRequest<'a> {
1954    pub(crate) client: &'a PostmanClient,
1955    pub user_id: String,
1956}
1957impl<'a> FetchUserResourceRequest<'a> {
1958    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1959        let mut r = self
1960            .client
1961            .client
1962            .get(&format!("/scim/v2/Users/{user_id}", user_id = self.user_id));
1963        r = self.client.authenticate(r);
1964        let res = r.send().await.unwrap().error_for_status();
1965        match res {
1966            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1967            Err(res) => {
1968                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
1969                Err(anyhow::anyhow!("{:?}", text))
1970            }
1971        }
1972    }
1973}
1974/**Create this with the associated client method.
1975
1976That method takes required values as arguments. Set optional values using builder methods on this struct.*/
1977pub struct UpdateUserInformationRequest<'a> {
1978    pub(crate) client: &'a PostmanClient,
1979    pub user_id: String,
1980    pub schemas: Option<Vec<String>>,
1981    pub name: Option<serde_json::Value>,
1982}
1983impl<'a> UpdateUserInformationRequest<'a> {
1984    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
1985        let mut r = self
1986            .client
1987            .client
1988            .put(&format!("/scim/v2/Users/{user_id}", user_id = self.user_id));
1989        if let Some(ref unwrapped) = self.schemas {
1990            r = r.push_json(json!({ "schemas" : unwrapped }));
1991        }
1992        if let Some(ref unwrapped) = self.name {
1993            r = r.push_json(json!({ "name" : unwrapped }));
1994        }
1995        r = self.client.authenticate(r);
1996        let res = r.send().await.unwrap().error_for_status();
1997        match res {
1998            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
1999            Err(res) => {
2000                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2001                Err(anyhow::anyhow!("{:?}", text))
2002            }
2003        }
2004    }
2005    pub fn schemas(
2006        mut self,
2007        schemas: impl IntoIterator<Item = impl AsRef<str>>,
2008    ) -> Self {
2009        self
2010            .schemas = Some(
2011            schemas.into_iter().map(|s| s.as_ref().to_owned()).collect(),
2012        );
2013        self
2014    }
2015    pub fn name(mut self, name: serde_json::Value) -> Self {
2016        self.name = Some(name);
2017        self
2018    }
2019}
2020/**Create this with the associated client method.
2021
2022That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2023pub struct UpdateUserStateRequest<'a> {
2024    pub(crate) client: &'a PostmanClient,
2025    pub user_id: String,
2026    pub schemas: Option<Vec<String>>,
2027    pub operations: Option<Vec<serde_json::Value>>,
2028}
2029impl<'a> UpdateUserStateRequest<'a> {
2030    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2031        let mut r = self
2032            .client
2033            .client
2034            .patch(&format!("/scim/v2/Users/{user_id}", user_id = self.user_id));
2035        if let Some(ref unwrapped) = self.schemas {
2036            r = r.push_json(json!({ "schemas" : unwrapped }));
2037        }
2038        if let Some(ref unwrapped) = self.operations {
2039            r = r.push_json(json!({ "Operations" : unwrapped }));
2040        }
2041        r = self.client.authenticate(r);
2042        let res = r.send().await.unwrap().error_for_status();
2043        match res {
2044            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2045            Err(res) => {
2046                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2047                Err(anyhow::anyhow!("{:?}", text))
2048            }
2049        }
2050    }
2051    pub fn schemas(
2052        mut self,
2053        schemas: impl IntoIterator<Item = impl AsRef<str>>,
2054    ) -> Self {
2055        self
2056            .schemas = Some(
2057            schemas.into_iter().map(|s| s.as_ref().to_owned()).collect(),
2058        );
2059        self
2060    }
2061    pub fn operations(mut self, operations: Vec<serde_json::Value>) -> Self {
2062        self.operations = Some(operations);
2063        self
2064    }
2065}
2066/**Create this with the associated client method.
2067
2068That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2069pub struct SchemaSecurityValidationRequest<'a> {
2070    pub(crate) client: &'a PostmanClient,
2071    pub schema: Option<serde_json::Value>,
2072}
2073impl<'a> SchemaSecurityValidationRequest<'a> {
2074    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2075        let mut r = self.client.client.post("/security/api-validation");
2076        if let Some(ref unwrapped) = self.schema {
2077            r = r.push_json(json!({ "schema" : unwrapped }));
2078        }
2079        r = self.client.authenticate(r);
2080        let res = r.send().await.unwrap().error_for_status();
2081        match res {
2082            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2083            Err(res) => {
2084                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2085                Err(anyhow::anyhow!("{:?}", text))
2086            }
2087        }
2088    }
2089    pub fn schema(mut self, schema: serde_json::Value) -> Self {
2090        self.schema = Some(schema);
2091        self
2092    }
2093}
2094/**Create this with the associated client method.
2095
2096That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2097pub struct CreateWebhookRequest<'a> {
2098    pub(crate) client: &'a PostmanClient,
2099    pub workspace_id: Option<String>,
2100    pub webhook: Option<serde_json::Value>,
2101}
2102impl<'a> CreateWebhookRequest<'a> {
2103    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2104        let mut r = self.client.client.post("/webhooks");
2105        if let Some(ref unwrapped) = self.workspace_id {
2106            r = r.push_query("workspaceId", &unwrapped.to_string());
2107        }
2108        if let Some(ref unwrapped) = self.webhook {
2109            r = r.push_json(json!({ "webhook" : unwrapped }));
2110        }
2111        r = self.client.authenticate(r);
2112        let res = r.send().await.unwrap().error_for_status();
2113        match res {
2114            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2115            Err(res) => {
2116                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2117                Err(anyhow::anyhow!("{:?}", text))
2118            }
2119        }
2120    }
2121    pub fn workspace_id(mut self, workspace_id: &str) -> Self {
2122        self.workspace_id = Some(workspace_id.to_owned());
2123        self
2124    }
2125    pub fn webhook(mut self, webhook: serde_json::Value) -> Self {
2126        self.webhook = Some(webhook);
2127        self
2128    }
2129}
2130/**Create this with the associated client method.
2131
2132That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2133pub struct AllWorkspacesRequest<'a> {
2134    pub(crate) client: &'a PostmanClient,
2135    pub type_: Option<String>,
2136}
2137impl<'a> AllWorkspacesRequest<'a> {
2138    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2139        let mut r = self.client.client.get("/workspaces");
2140        if let Some(ref unwrapped) = self.type_ {
2141            r = r.push_query("type", &unwrapped.to_string());
2142        }
2143        r = self.client.authenticate(r);
2144        let res = r.send().await.unwrap().error_for_status();
2145        match res {
2146            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2147            Err(res) => {
2148                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2149                Err(anyhow::anyhow!("{:?}", text))
2150            }
2151        }
2152    }
2153    pub fn type_(mut self, type_: &str) -> Self {
2154        self.type_ = Some(type_.to_owned());
2155        self
2156    }
2157}
2158/**Create this with the associated client method.
2159
2160That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2161pub struct CreateWorkspaceRequest<'a> {
2162    pub(crate) client: &'a PostmanClient,
2163    pub workspace: Option<serde_json::Value>,
2164}
2165impl<'a> CreateWorkspaceRequest<'a> {
2166    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2167        let mut r = self.client.client.post("/workspaces");
2168        if let Some(ref unwrapped) = self.workspace {
2169            r = r.push_json(json!({ "workspace" : unwrapped }));
2170        }
2171        r = self.client.authenticate(r);
2172        let res = r.send().await.unwrap().error_for_status();
2173        match res {
2174            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2175            Err(res) => {
2176                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2177                Err(anyhow::anyhow!("{:?}", text))
2178            }
2179        }
2180    }
2181    pub fn workspace(mut self, workspace: serde_json::Value) -> Self {
2182        self.workspace = Some(workspace);
2183        self
2184    }
2185}
2186/**Create this with the associated client method.
2187
2188That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2189pub struct SingleWorkspaceRequest<'a> {
2190    pub(crate) client: &'a PostmanClient,
2191    pub workspace_id: String,
2192}
2193impl<'a> SingleWorkspaceRequest<'a> {
2194    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2195        let mut r = self
2196            .client
2197            .client
2198            .get(
2199                &format!("/workspaces/{workspace_id}", workspace_id = self.workspace_id),
2200            );
2201        r = self.client.authenticate(r);
2202        let res = r.send().await.unwrap().error_for_status();
2203        match res {
2204            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2205            Err(res) => {
2206                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2207                Err(anyhow::anyhow!("{:?}", text))
2208            }
2209        }
2210    }
2211}
2212/**Create this with the associated client method.
2213
2214That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2215pub struct UpdateWorkspaceRequest<'a> {
2216    pub(crate) client: &'a PostmanClient,
2217    pub workspace_id: String,
2218    pub workspace: Option<serde_json::Value>,
2219}
2220impl<'a> UpdateWorkspaceRequest<'a> {
2221    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2222        let mut r = self
2223            .client
2224            .client
2225            .put(
2226                &format!("/workspaces/{workspace_id}", workspace_id = self.workspace_id),
2227            );
2228        if let Some(ref unwrapped) = self.workspace {
2229            r = r.push_json(json!({ "workspace" : unwrapped }));
2230        }
2231        r = self.client.authenticate(r);
2232        let res = r.send().await.unwrap().error_for_status();
2233        match res {
2234            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2235            Err(res) => {
2236                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2237                Err(anyhow::anyhow!("{:?}", text))
2238            }
2239        }
2240    }
2241    pub fn workspace(mut self, workspace: serde_json::Value) -> Self {
2242        self.workspace = Some(workspace);
2243        self
2244    }
2245}
2246/**Create this with the associated client method.
2247
2248That method takes required values as arguments. Set optional values using builder methods on this struct.*/
2249pub struct DeleteWorkspaceRequest<'a> {
2250    pub(crate) client: &'a PostmanClient,
2251    pub workspace_id: String,
2252}
2253impl<'a> DeleteWorkspaceRequest<'a> {
2254    pub async fn send(self) -> anyhow::Result<serde_json::Value> {
2255        let mut r = self
2256            .client
2257            .client
2258            .delete(
2259                &format!("/workspaces/{workspace_id}", workspace_id = self.workspace_id),
2260            );
2261        r = self.client.authenticate(r);
2262        let res = r.send().await.unwrap().error_for_status();
2263        match res {
2264            Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
2265            Err(res) => {
2266                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
2267                Err(anyhow::anyhow!("{:?}", text))
2268            }
2269        }
2270    }
2271}