postman_api/
lib.rs

1//! [`PostmanClient`](struct.PostmanClient.html) is the main entry point for this library.
2//!
3//! Library created with [`libninja`](https://www.libninja.com).
4#![allow(non_camel_case_types)]
5#![allow(unused)]
6pub mod model;
7pub mod request;
8use crate::model::*;
9
10pub struct PostmanClient {
11    pub(crate) client: httpclient::Client,
12    authentication: PostmanAuthentication,
13}
14impl PostmanClient {
15    pub fn from_env() -> Self {
16        let url = "https://api.getpostman.com".to_string();
17        Self {
18            client: httpclient::Client::new(Some(url)),
19            authentication: PostmanAuthentication::from_env(),
20        }
21    }
22}
23impl PostmanClient {
24    pub fn new(url: &str, authentication: PostmanAuthentication) -> Self {
25        let client = httpclient::Client::new(Some(url.to_string()));
26        Self { client, authentication }
27    }
28    pub fn with_authentication(mut self, authentication: PostmanAuthentication) -> Self {
29        self.authentication = authentication;
30        self
31    }
32    pub fn authenticate<'a>(
33        &self,
34        mut r: httpclient::RequestBuilder<'a>,
35    ) -> httpclient::RequestBuilder<'a> {
36        match &self.authentication {
37            PostmanAuthentication::PostmanApiKey { postman_api_key } => {
38                r = r.header("x-api-key", postman_api_key);
39            }
40        }
41        r
42    }
43    pub fn with_middleware<M: httpclient::Middleware + 'static>(
44        mut self,
45        middleware: M,
46    ) -> Self {
47        self.client = self.client.with_middleware(middleware);
48        self
49    }
50    /**Get all APIs
51
52Gets information about all APIs.*/
53    pub fn get_all_apis(&self) -> request::GetAllApisRequest {
54        request::GetAllApisRequest {
55            client: &self,
56            workspace: None,
57            since: None,
58            until: None,
59            created_by: None,
60            updated_by: None,
61            is_public: None,
62            name: None,
63            summary: None,
64            description: None,
65            sort: None,
66            direction: None,
67        }
68    }
69    /**Create an API
70
71Creates an API.*/
72    pub fn create_api(&self) -> request::CreateApiRequest {
73        request::CreateApiRequest {
74            client: &self,
75            workspace_id: None,
76            api: None,
77        }
78    }
79    /**Get an API
80
81Gets information about an API.*/
82    pub fn single_api(&self, api_id: &str) -> request::SingleApiRequest {
83        request::SingleApiRequest {
84            client: &self,
85            api_id: api_id.to_owned(),
86        }
87    }
88    /**Update an API
89
90Updates an API.*/
91    pub fn update_an_api(&self, api_id: &str) -> request::UpdateAnApiRequest {
92        request::UpdateAnApiRequest {
93            client: &self,
94            api_id: api_id.to_owned(),
95            api: None,
96        }
97    }
98    /**Delete an API
99
100Deletes an API.*/
101    pub fn delete_an_api(&self, api_id: &str) -> request::DeleteAnApiRequest {
102        request::DeleteAnApiRequest {
103            client: &self,
104            api_id: api_id.to_owned(),
105        }
106    }
107    /**Get all API versions
108
109Gets information about an API's versions.*/
110    pub fn get_all_api_versions(
111        &self,
112        api_id: &str,
113    ) -> request::GetAllApiVersionsRequest {
114        request::GetAllApiVersionsRequest {
115            client: &self,
116            api_id: api_id.to_owned(),
117        }
118    }
119    /**Create an API version
120
121Creates a new API version.*/
122    pub fn create_api_version(&self, api_id: &str) -> request::CreateApiVersionRequest {
123        request::CreateApiVersionRequest {
124            client: &self,
125            api_id: api_id.to_owned(),
126            version: None,
127        }
128    }
129    /**Get an API version
130
131Gets information about an API version.*/
132    pub fn get_an_api_version(
133        &self,
134        api_id: &str,
135        api_version_id: &str,
136    ) -> request::GetAnApiVersionRequest {
137        request::GetAnApiVersionRequest {
138            client: &self,
139            api_id: api_id.to_owned(),
140            api_version_id: api_version_id.to_owned(),
141        }
142    }
143    /**Update an API version
144
145Updates an API version.*/
146    pub fn update_an_api_version(
147        &self,
148        api_id: &str,
149        api_version_id: &str,
150    ) -> request::UpdateAnApiVersionRequest {
151        request::UpdateAnApiVersionRequest {
152            client: &self,
153            api_id: api_id.to_owned(),
154            api_version_id: api_version_id.to_owned(),
155            version: None,
156        }
157    }
158    /**Delete an API version
159
160Deletes an API version.*/
161    pub fn delete_an_api_version(
162        &self,
163        api_id: &str,
164        api_version_id: &str,
165    ) -> request::DeleteAnApiVersionRequest {
166        request::DeleteAnApiVersionRequest {
167            client: &self,
168            api_id: api_id.to_owned(),
169            api_version_id: api_version_id.to_owned(),
170        }
171    }
172    /**Get contract test relations
173
174This endpoint is **deprecated**. Use the `/apis/{apiId}/versions/{apiVersionId}/test` endpoint.*/
175    pub fn get_contract_test_relations(
176        &self,
177        api_id: &str,
178        api_version_id: &str,
179    ) -> request::GetContractTestRelationsRequest {
180        request::GetContractTestRelationsRequest {
181            client: &self,
182            api_id: api_id.to_owned(),
183            api_version_id: api_version_id.to_owned(),
184        }
185    }
186    /**Get documentation relations
187
188Gets an API version's documentation relations.*/
189    pub fn get_documentation_relations(
190        &self,
191        api_id: &str,
192        api_version_id: &str,
193    ) -> request::GetDocumentationRelationsRequest {
194        request::GetDocumentationRelationsRequest {
195            client: &self,
196            api_id: api_id.to_owned(),
197            api_version_id: api_version_id.to_owned(),
198        }
199    }
200    /**Get environment relations
201
202Gets an API version's environment relations.*/
203    pub fn get_environment_relations(
204        &self,
205        api_id: &str,
206        api_version_id: &str,
207    ) -> request::GetEnvironmentRelationsRequest {
208        request::GetEnvironmentRelationsRequest {
209            client: &self,
210            api_id: api_id.to_owned(),
211            api_version_id: api_version_id.to_owned(),
212        }
213    }
214    /**Get integration test relations
215
216This endpoint is **deprecated**. Use the `/apis/{apiId}/versions/{apiVersionId}/test` endpoint.*/
217    pub fn get_integration_test_relations(
218        &self,
219        api_id: &str,
220        api_version_id: &str,
221    ) -> request::GetIntegrationTestRelationsRequest {
222        request::GetIntegrationTestRelationsRequest {
223            client: &self,
224            api_id: api_id.to_owned(),
225            api_version_id: api_version_id.to_owned(),
226        }
227    }
228    /**Get mock server relations
229
230Gets an API version's mock server relations.*/
231    pub fn get_mock_server_relations(
232        &self,
233        api_id: &str,
234        api_version_id: &str,
235    ) -> request::GetMockServerRelationsRequest {
236        request::GetMockServerRelationsRequest {
237            client: &self,
238            api_id: api_id.to_owned(),
239            api_version_id: api_version_id.to_owned(),
240        }
241    }
242    /**Get monitor relations
243
244Gets an API version's monitor relations.*/
245    pub fn get_monitor_relations(
246        &self,
247        api_id: &str,
248        api_version_id: &str,
249    ) -> request::GetMonitorRelationsRequest {
250        request::GetMonitorRelationsRequest {
251            client: &self,
252            api_id: api_id.to_owned(),
253            api_version_id: api_version_id.to_owned(),
254        }
255    }
256    /**Get all linked relations
257
258Gets all of an API version's relations.*/
259    pub fn get_linked_relations(
260        &self,
261        api_id: &str,
262        api_version_id: &str,
263    ) -> request::GetLinkedRelationsRequest {
264        request::GetLinkedRelationsRequest {
265            client: &self,
266            api_id: api_id.to_owned(),
267            api_version_id: api_version_id.to_owned(),
268        }
269    }
270    /**Create relations
271
272Creates a new relation for an API version. This endpoint accepts multiple relation arrays in a single call.*/
273    pub fn create_relations(
274        &self,
275        api_id: &str,
276        api_version_id: &str,
277    ) -> request::CreateRelationsRequest {
278        request::CreateRelationsRequest {
279            client: &self,
280            api_id: api_id.to_owned(),
281            api_version_id: api_version_id.to_owned(),
282            documentation: None,
283            environment: None,
284            mock: None,
285            monitor: None,
286            test: None,
287            contracttest: None,
288            testsuite: None,
289        }
290    }
291    /**Create a schema
292
293Creates an API definition.*/
294    pub fn create_schema(
295        &self,
296        api_id: &str,
297        api_version_id: &str,
298    ) -> request::CreateSchemaRequest {
299        request::CreateSchemaRequest {
300            client: &self,
301            api_id: api_id.to_owned(),
302            api_version_id: api_version_id.to_owned(),
303            schema: None,
304        }
305    }
306    /**Get a schema
307
308Gets information about an API's definition.*/
309    pub fn get_schema(
310        &self,
311        api_id: &str,
312        api_version_id: &str,
313        schema_id: &str,
314    ) -> request::GetSchemaRequest {
315        request::GetSchemaRequest {
316            client: &self,
317            api_id: api_id.to_owned(),
318            api_version_id: api_version_id.to_owned(),
319            schema_id: schema_id.to_owned(),
320        }
321    }
322    /**Update a schema
323
324Updates an API definition.*/
325    pub fn update_schema(
326        &self,
327        api_id: &str,
328        api_version_id: &str,
329        schema_id: &str,
330    ) -> request::UpdateSchemaRequest {
331        request::UpdateSchemaRequest {
332            client: &self,
333            api_id: api_id.to_owned(),
334            api_version_id: api_version_id.to_owned(),
335            schema_id: schema_id.to_owned(),
336            schema: None,
337        }
338    }
339    /**Create collection from a schema
340
341Creates a collection and links it to an API as one or multiple relations.*/
342    pub fn create_collection_from_schema(
343        &self,
344        args: request::CreateCollectionFromSchemaRequired,
345    ) -> request::CreateCollectionFromSchemaRequest {
346        request::CreateCollectionFromSchemaRequest {
347            client: &self,
348            api_id: args.api_id.to_owned(),
349            api_version_id: args.api_version_id.to_owned(),
350            schema_id: args.schema_id.to_owned(),
351            workspace_id: None,
352            name: args.name.to_owned(),
353            relations: args.relations,
354        }
355    }
356    /**Get all test relations
357
358Gets all of an API version's test relations.*/
359    pub fn get_test_relations(
360        &self,
361        api_id: &str,
362        api_version_id: &str,
363    ) -> request::GetTestRelationsRequest {
364        request::GetTestRelationsRequest {
365            client: &self,
366            api_id: api_id.to_owned(),
367            api_version_id: api_version_id.to_owned(),
368        }
369    }
370    /**Get test suite relations
371
372This endpoint is **deprecated**. Use the `/apis/{apiId}/versions/{apiVersionId}/test` endpoint.*/
373    pub fn get_test_suite_relations(
374        &self,
375        api_id: &str,
376        api_version_id: &str,
377    ) -> request::GetTestSuiteRelationsRequest {
378        request::GetTestSuiteRelationsRequest {
379            client: &self,
380            api_id: api_id.to_owned(),
381            api_version_id: api_version_id.to_owned(),
382        }
383    }
384    /**Sync API relations with definition
385
386Syncs an API version's relation with the API's definition.*/
387    pub fn sync_relations_with_schema(
388        &self,
389        args: request::SyncRelationsWithSchemaRequired,
390    ) -> request::SyncRelationsWithSchemaRequest {
391        request::SyncRelationsWithSchemaRequest {
392            client: &self,
393            api_id: args.api_id.to_owned(),
394            api_version_id: args.api_version_id.to_owned(),
395            relation_type: args.relation_type.to_owned(),
396            entity_id: args.entity_id.to_owned(),
397        }
398    }
399    /**Get all collections
400
401Gets all of your [collections](https://www.getpostman.com/docs/collections). The response includes all of your subscribed collections.*/
402    pub fn all_collections(&self) -> request::AllCollectionsRequest {
403        request::AllCollectionsRequest {
404            client: &self,
405            workspace_id: None,
406        }
407    }
408    /**Create a collection
409
410Creates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html).
411
412**Note:**
413
414- For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json):
415  - `info` object — Use the `definitions.info` entry.
416  - `item` object — Use the `definitions.items` entry.
417- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).
418*/
419    pub fn create_collection(&self) -> request::CreateCollectionRequest {
420        request::CreateCollectionRequest {
421            client: &self,
422            workspace_id: None,
423            collection: None,
424        }
425    }
426    /**Create a fork
427
428Creates a [fork](https://learning.postman.com/docs/collaborating-in-postman/version-control/#creating-a-fork) from an existing collection into a workspace.*/
429    pub fn create_a_fork(
430        &self,
431        workspace: &str,
432        collection_uid: &str,
433    ) -> request::CreateAForkRequest {
434        request::CreateAForkRequest {
435            client: &self,
436            workspace: workspace.to_owned(),
437            collection_uid: collection_uid.to_owned(),
438            label: None,
439        }
440    }
441    /**Merge a fork
442
443Merges a forked collection back into its destination collection.*/
444    pub fn merge_a_fork(&self) -> request::MergeAForkRequest {
445        request::MergeAForkRequest {
446            client: &self,
447            destination: None,
448            source: None,
449            strategy: None,
450        }
451    }
452    /**Get a collection
453
454Gets information about a collection. For a complete list of this endpoint's possible values, use the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).*/
455    pub fn single_collection(
456        &self,
457        collection_uid: &str,
458    ) -> request::SingleCollectionRequest {
459        request::SingleCollectionRequest {
460            client: &self,
461            collection_uid: collection_uid.to_owned(),
462        }
463    }
464    /**Update a collection
465
466Updates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html).
467
468> Use caution when using this endpoint. The system will **replace** the existing collection with the values passed in the request body.
469
470**Note:**
471
472- For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json):
473  - `info` object — Use the `definitions.info` entry.
474  - `item` object — Use the `definitions.items` entry.
475- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).
476*/
477    pub fn update_collection(
478        &self,
479        collection_uid: &str,
480    ) -> request::UpdateCollectionRequest {
481        request::UpdateCollectionRequest {
482            client: &self,
483            collection_uid: collection_uid.to_owned(),
484            collection: None,
485        }
486    }
487    /**Delete a collection
488
489Deletes a collection.*/
490    pub fn delete_collection(
491        &self,
492        collection_uid: &str,
493    ) -> request::DeleteCollectionRequest {
494        request::DeleteCollectionRequest {
495            client: &self,
496            collection_uid: collection_uid.to_owned(),
497        }
498    }
499    /**Get all environments
500
501Gets information about all of your [environments](https://learning.postman.com/docs/sending-requests/managing-environments/).*/
502    pub fn all_environments(&self) -> request::AllEnvironmentsRequest {
503        request::AllEnvironmentsRequest {
504            client: &self,
505            workspace_id: None,
506        }
507    }
508    /**Create an environment
509
510Creates an environment.*/
511    pub fn create_environment(&self) -> request::CreateEnvironmentRequest {
512        request::CreateEnvironmentRequest {
513            client: &self,
514            workspace_id: None,
515            environment: None,
516        }
517    }
518    /**Get an environment
519
520Gets information about an environment.*/
521    pub fn single_environment(
522        &self,
523        environment_uid: &str,
524    ) -> request::SingleEnvironmentRequest {
525        request::SingleEnvironmentRequest {
526            client: &self,
527            environment_uid: environment_uid.to_owned(),
528        }
529    }
530    /**Update an environment
531
532Updates an environment.*/
533    pub fn update_environment(
534        &self,
535        environment_uid: &str,
536    ) -> request::UpdateEnvironmentRequest {
537        request::UpdateEnvironmentRequest {
538            client: &self,
539            environment_uid: environment_uid.to_owned(),
540            environment: None,
541        }
542    }
543    /**Delete an environment
544
545Deletes an environment.*/
546    pub fn delete_environment(
547        &self,
548        environment_uid: &str,
549    ) -> request::DeleteEnvironmentRequest {
550        request::DeleteEnvironmentRequest {
551            client: &self,
552            environment_uid: environment_uid.to_owned(),
553        }
554    }
555    /**Import an exported Postman data dump file
556
557**This endpoint is deprecated.**
558
559Imports exported Postman data. This endpoint only accepts [export data dump files](https://postman.postman.co/me/export).
560
561For more information, read our [Exporting data dumps](https://learning.postman.com/docs/getting-started/importing-and-exporting-data/#exporting-data-dumps) documentation.
562*/
563    pub fn import_exported_data(&self) -> request::ImportExportedDataRequest {
564        request::ImportExportedDataRequest {
565            client: &self,
566        }
567    }
568    /**Import an OpenAPI definition
569
570Imports an OpenAPI definition into Postman as a new [Postman Collection](https://learning.postman.com/docs/getting-started/creating-the-first-collection/).*/
571    pub fn import_external_api_specification(
572        &self,
573        body: serde_json::Value,
574    ) -> request::ImportExternalApiSpecificationRequest {
575        request::ImportExternalApiSpecificationRequest {
576            client: &self,
577            workspace_id: None,
578            body,
579        }
580    }
581    /**Get authenticated user
582
583Gets information about the authenticated user.*/
584    pub fn api_key_owner(&self) -> request::ApiKeyOwnerRequest {
585        request::ApiKeyOwnerRequest {
586            client: &self,
587        }
588    }
589    /**Get all mock servers
590
591Gets all mock servers.*/
592    pub fn all_mocks(&self) -> request::AllMocksRequest {
593        request::AllMocksRequest {
594            client: &self,
595        }
596    }
597    /**Create a mock server
598
599Creates a mock server in a collection.*/
600    pub fn create_mock(&self) -> request::CreateMockRequest {
601        request::CreateMockRequest {
602            client: &self,
603            workspace_id: None,
604            mock: None,
605        }
606    }
607    /**Get a mock server
608
609Gets information about a mock server.*/
610    pub fn single_mock(&self, mock_uid: &str) -> request::SingleMockRequest {
611        request::SingleMockRequest {
612            client: &self,
613            mock_uid: mock_uid.to_owned(),
614        }
615    }
616    /**Update a mock server
617
618Updates a mock server.*/
619    pub fn update_mock(&self, mock_uid: &str) -> request::UpdateMockRequest {
620        request::UpdateMockRequest {
621            client: &self,
622            mock_uid: mock_uid.to_owned(),
623            mock: None,
624        }
625    }
626    /**Delete a mock server
627
628Deletes a mock server.*/
629    pub fn delete_mock(&self, mock_uid: &str) -> request::DeleteMockRequest {
630        request::DeleteMockRequest {
631            client: &self,
632            mock_uid: mock_uid.to_owned(),
633        }
634    }
635    /**Publish a mock server
636
637Publishes a mock server. Publishing a mock server sets its **Access Control** configuration setting to public.*/
638    pub fn publish_mock(&self, mock_uid: &str) -> request::PublishMockRequest {
639        request::PublishMockRequest {
640            client: &self,
641            mock_uid: mock_uid.to_owned(),
642        }
643    }
644    /**Unpublish a mock server
645
646Unpublishes a mock server. Unpublishing a mock server sets its **Access Control** configuration setting to private.*/
647    pub fn unpublish_mock(&self, mock_uid: &str) -> request::UnpublishMockRequest {
648        request::UnpublishMockRequest {
649            client: &self,
650            mock_uid: mock_uid.to_owned(),
651        }
652    }
653    /**Get all monitors
654
655Gets all monitors.*/
656    pub fn all_monitors(&self) -> request::AllMonitorsRequest {
657        request::AllMonitorsRequest {
658            client: &self,
659        }
660    }
661    /**Create a monitor
662
663Creates a monitor.*/
664    pub fn create_monitor(&self) -> request::CreateMonitorRequest {
665        request::CreateMonitorRequest {
666            client: &self,
667            workspace_id: None,
668            monitor: None,
669        }
670    }
671    /**Get a monitor
672
673Gets information about a monitor.*/
674    pub fn single_monitor(&self, monitor_uid: &str) -> request::SingleMonitorRequest {
675        request::SingleMonitorRequest {
676            client: &self,
677            monitor_uid: monitor_uid.to_owned(),
678        }
679    }
680    /**Update a monitor
681
682Updates a monitor.*/
683    pub fn update_monitor(&self, monitor_uid: &str) -> request::UpdateMonitorRequest {
684        request::UpdateMonitorRequest {
685            client: &self,
686            monitor_uid: monitor_uid.to_owned(),
687            monitor: None,
688        }
689    }
690    /**Delete a monitor
691
692Deletes a monitor.*/
693    pub fn delete_monitor(&self, monitor_uid: &str) -> request::DeleteMonitorRequest {
694        request::DeleteMonitorRequest {
695            client: &self,
696            monitor_uid: monitor_uid.to_owned(),
697        }
698    }
699    /**Run a monitor
700
701Runs a monitor and returns its run results.*/
702    pub fn run_a_monitor(&self, monitor_uid: &str) -> request::RunAMonitorRequest {
703        request::RunAMonitorRequest {
704            client: &self,
705            monitor_uid: monitor_uid.to_owned(),
706        }
707    }
708    /**Get resource types
709
710Gets all the resource types supported by Postman's SCIM API.*/
711    pub fn get_resource_types(&self) -> request::GetResourceTypesRequest {
712        request::GetResourceTypesRequest {
713            client: &self,
714        }
715    }
716    /**Get service provider configuration
717
718Gets the Postman SCIM API configuration information. This includes a list of supported operations.*/
719    pub fn service_provider_config(&self) -> request::ServiceProviderConfigRequest {
720        request::ServiceProviderConfigRequest {
721            client: &self,
722        }
723    }
724    /**Get all user resources
725
726Gets information about all Postman team members.*/
727    pub fn fetch_all_user_resource(&self) -> request::FetchAllUserResourceRequest {
728        request::FetchAllUserResourceRequest {
729            client: &self,
730            start_index: None,
731            count: None,
732            filter: None,
733        }
734    }
735    /**Create a user
736
737Creates a new user account in Postman and adds the user to your organization's Postman team. If the account does not already exist, this also activates the user so they can authenticate in to your Postman team.
738
739If the account already exists, the system sends the user an [email invite](https://learning.postman.com/docs/administration/managing-your-team/managing-your-team/#inviting-users) to join the Postman team. The user joins the team once they accept the invite.
740
741By default, the system assigns new users the developer role. You can [update user roles in Postman](https://learning.postman.com/docs/administration/managing-your-team/managing-your-team/#managing-team-roles).
742*/
743    pub fn create_user(&self) -> request::CreateUserRequest {
744        request::CreateUserRequest {
745            client: &self,
746            schemas: None,
747            user_name: None,
748            active: None,
749            external_id: None,
750            groups: None,
751            locale: None,
752            name: None,
753        }
754    }
755    /**Get user resource
756
757Gets information about a Postman team member.*/
758    pub fn fetch_user_resource(
759        &self,
760        user_id: &str,
761    ) -> request::FetchUserResourceRequest {
762        request::FetchUserResourceRequest {
763            client: &self,
764            user_id: user_id.to_owned(),
765        }
766    }
767    /**Update a user
768
769Updates a user's first and last name in Postman.
770
771**Note:**
772
773You can only use the SCIM API to update a user's first and last name. You cannot update any other user attributes with the API.
774*/
775    pub fn update_user_information(
776        &self,
777        user_id: &str,
778    ) -> request::UpdateUserInformationRequest {
779        request::UpdateUserInformationRequest {
780            client: &self,
781            user_id: user_id.to_owned(),
782            schemas: None,
783            name: None,
784        }
785    }
786    /**Update a user's state
787
788Updates a user's active state in Postman.
789
790### Reactivating users
791
792By setting the `active` property from `false` to `true`, this reactivates an account. This allows the account to authenticate in to Postman and adds the account back on to your Postman team.
793*/
794    pub fn update_user_state(&self, user_id: &str) -> request::UpdateUserStateRequest {
795        request::UpdateUserStateRequest {
796            client: &self,
797            user_id: user_id.to_owned(),
798            schemas: None,
799            operations: None,
800        }
801    }
802    /**Schema security validation
803
804Performs a security analysis on the given definition and returns any issues. This can help you understand their impact and provides solutions to help you resolve the errors. You can include this endpoint to your CI/CD process to automate schema validation.
805
806For more information, read our [API definition warnings](https://learning.postman-beta.com/docs/api-governance/api-definition/api-definition-warnings/) documentation.
807
808**Note:**
809
810The maximum allowed size of the definition is 10 MB.
811*/
812    pub fn schema_security_validation(
813        &self,
814    ) -> request::SchemaSecurityValidationRequest {
815        request::SchemaSecurityValidationRequest {
816            client: &self,
817            schema: None,
818        }
819    }
820    /**Create a webhook
821
822Creates a webhook that triggers a collection with a custom payload. You can get the webhook's URL from the `webhookUrl` property in the endpoint's response.*/
823    pub fn create_webhook(&self) -> request::CreateWebhookRequest {
824        request::CreateWebhookRequest {
825            client: &self,
826            workspace_id: None,
827            webhook: None,
828        }
829    }
830    /**Get all workspaces
831
832Gets all [workspaces](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/creating-workspaces/). The response includes your workspaces and any workspaces that you have access to.
833
834**Note:**
835
836This endpoint's response contains the visibility field. Visibility determines who can access the workspace:
837
838- `only-me` — Applies to the **My Workspace** workspace.
839- `personal` — Only you can access the workspace.
840- `team` — All team members can access the workspace.
841- `private-team` — Only invited team members can access the workspace.
842- `public` — Everyone can access the workspace.
843*/
844    pub fn all_workspaces(&self) -> request::AllWorkspacesRequest {
845        request::AllWorkspacesRequest {
846            client: &self,
847            type_: None,
848        }
849    }
850    /**Create a workspace
851
852Creates a new [workspace](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/creating-workspaces/).
853
854### Important:
855
856We **deprecated** linking collections or environments between workspaces. We do **not** recommend that you do this.
857
858If you have a linked collection or environment, note the following:
859
860- The endpoint does **not** create a clone of a collection or environment.
861- Any changes you make to a linked collection or environment changes them in **all** workspaces.
862- If you delete a collection or environment linked between workspaces, the system deletes it in **all** the workspaces.
863*/
864    pub fn create_workspace(&self) -> request::CreateWorkspaceRequest {
865        request::CreateWorkspaceRequest {
866            client: &self,
867            workspace: None,
868        }
869    }
870    /**Get a workspace
871
872Gets information about a workspace.
873
874**Note:**
875
876This endpoint's response contains the `visibility` field. [Visibility](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/managing-workspaces/#changing-workspace-visibility) determines who can access the workspace:
877
878- `only-me` — Applies to the **My Workspace** workspace.
879- `personal` — Only you can access the workspace.
880- `team` — All team members can access the workspace.
881- `private-team` — Only invited team members can access the workspace.
882- `public` — Everyone can access the workspace.
883*/
884    pub fn single_workspace(
885        &self,
886        workspace_id: &str,
887    ) -> request::SingleWorkspaceRequest {
888        request::SingleWorkspaceRequest {
889            client: &self,
890            workspace_id: workspace_id.to_owned(),
891        }
892    }
893    /**Update a workspace
894
895Updates a workspace.
896
897**Note:**
898
899You can change a workspace's type from `personal` to `team`, but you **cannot** change a workspace from `team` to `personal`.
900
901### Important:
902
903We **deprecated** linking collections or environments between workspaces. We do **not** recommend that you do this.
904
905If you have a linked collection or environment, note the following:
906
907- The endpoint does **not** create a clone of a collection or environment.
908- Any changes you make to a linked collection or environment changes them in **all** workspaces.
909- If you delete a collection or environment linked between workspaces, the system deletes it in **all** the workspaces.
910*/
911    pub fn update_workspace(
912        &self,
913        workspace_id: &str,
914    ) -> request::UpdateWorkspaceRequest {
915        request::UpdateWorkspaceRequest {
916            client: &self,
917            workspace_id: workspace_id.to_owned(),
918            workspace: None,
919        }
920    }
921    /**Delete a workspace
922
923Deletes an existing workspace.
924
925### Important:
926
927If you delete a workspace that has a linked collection or environment with another workspace, this will delete the collection and environment in **all** workspaces.
928*/
929    pub fn delete_workspace(
930        &self,
931        workspace_id: &str,
932    ) -> request::DeleteWorkspaceRequest {
933        request::DeleteWorkspaceRequest {
934            client: &self,
935            workspace_id: workspace_id.to_owned(),
936        }
937    }
938}
939pub enum PostmanAuthentication {
940    PostmanApiKey { postman_api_key: String },
941}
942impl PostmanAuthentication {
943    pub fn from_env() -> Self {
944        Self::PostmanApiKey {
945            postman_api_key: std::env::var("POSTMAN_API_KEY")
946                .expect("Environment variable POSTMAN_API_KEY is not set."),
947        }
948    }
949}