1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
//! [`PostmanClient`](struct.PostmanClient.html) is the main entry point for this library.
//!
//! Library created with [`libninja`](https://www.libninja.com).
#![allow(non_camel_case_types)]
#![allow(unused)]
pub mod model;
pub mod request;
use crate::model::*;

pub struct PostmanClient {
    pub(crate) client: httpclient::Client,
    authentication: PostmanAuthentication,
}
impl PostmanClient {
    pub fn from_env() -> Self {
        let url = "https://api.getpostman.com".to_string();
        Self {
            client: httpclient::Client::new(Some(url)),
            authentication: PostmanAuthentication::from_env(),
        }
    }
}
impl PostmanClient {
    pub fn new(url: &str, authentication: PostmanAuthentication) -> Self {
        let client = httpclient::Client::new(Some(url.to_string()));
        Self { client, authentication }
    }
    pub fn with_authentication(mut self, authentication: PostmanAuthentication) -> Self {
        self.authentication = authentication;
        self
    }
    pub fn authenticate<'a>(
        &self,
        mut r: httpclient::RequestBuilder<'a>,
    ) -> httpclient::RequestBuilder<'a> {
        match &self.authentication {
            PostmanAuthentication::PostmanApiKey { postman_api_key } => {
                r = r.header("x-api-key", postman_api_key);
            }
        }
        r
    }
    pub fn with_middleware<M: httpclient::Middleware + 'static>(
        mut self,
        middleware: M,
    ) -> Self {
        self.client = self.client.with_middleware(middleware);
        self
    }
    /**Get all APIs

Gets information about all APIs.*/
    pub fn get_all_apis(&self) -> request::GetAllApisRequest {
        request::GetAllApisRequest {
            client: &self,
            workspace: None,
            since: None,
            until: None,
            created_by: None,
            updated_by: None,
            is_public: None,
            name: None,
            summary: None,
            description: None,
            sort: None,
            direction: None,
        }
    }
    /**Create an API

Creates an API.*/
    pub fn create_api(&self) -> request::CreateApiRequest {
        request::CreateApiRequest {
            client: &self,
            workspace_id: None,
            api: None,
        }
    }
    /**Get an API

Gets information about an API.*/
    pub fn single_api(&self, api_id: &str) -> request::SingleApiRequest {
        request::SingleApiRequest {
            client: &self,
            api_id: api_id.to_owned(),
        }
    }
    /**Update an API

Updates an API.*/
    pub fn update_an_api(&self, api_id: &str) -> request::UpdateAnApiRequest {
        request::UpdateAnApiRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api: None,
        }
    }
    /**Delete an API

Deletes an API.*/
    pub fn delete_an_api(&self, api_id: &str) -> request::DeleteAnApiRequest {
        request::DeleteAnApiRequest {
            client: &self,
            api_id: api_id.to_owned(),
        }
    }
    /**Get all API versions

Gets information about an API's versions.*/
    pub fn get_all_api_versions(
        &self,
        api_id: &str,
    ) -> request::GetAllApiVersionsRequest {
        request::GetAllApiVersionsRequest {
            client: &self,
            api_id: api_id.to_owned(),
        }
    }
    /**Create an API version

Creates a new API version.*/
    pub fn create_api_version(&self, api_id: &str) -> request::CreateApiVersionRequest {
        request::CreateApiVersionRequest {
            client: &self,
            api_id: api_id.to_owned(),
            version: None,
        }
    }
    /**Get an API version

Gets information about an API version.*/
    pub fn get_an_api_version(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetAnApiVersionRequest {
        request::GetAnApiVersionRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Update an API version

Updates an API version.*/
    pub fn update_an_api_version(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::UpdateAnApiVersionRequest {
        request::UpdateAnApiVersionRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
            version: None,
        }
    }
    /**Delete an API version

Deletes an API version.*/
    pub fn delete_an_api_version(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::DeleteAnApiVersionRequest {
        request::DeleteAnApiVersionRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get contract test relations

This endpoint is **deprecated**. Use the `/apis/{apiId}/versions/{apiVersionId}/test` endpoint.*/
    pub fn get_contract_test_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetContractTestRelationsRequest {
        request::GetContractTestRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get documentation relations

Gets an API version's documentation relations.*/
    pub fn get_documentation_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetDocumentationRelationsRequest {
        request::GetDocumentationRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get environment relations

Gets an API version's environment relations.*/
    pub fn get_environment_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetEnvironmentRelationsRequest {
        request::GetEnvironmentRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get integration test relations

This endpoint is **deprecated**. Use the `/apis/{apiId}/versions/{apiVersionId}/test` endpoint.*/
    pub fn get_integration_test_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetIntegrationTestRelationsRequest {
        request::GetIntegrationTestRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get mock server relations

Gets an API version's mock server relations.*/
    pub fn get_mock_server_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetMockServerRelationsRequest {
        request::GetMockServerRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get monitor relations

Gets an API version's monitor relations.*/
    pub fn get_monitor_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetMonitorRelationsRequest {
        request::GetMonitorRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get all linked relations

Gets all of an API version's relations.*/
    pub fn get_linked_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetLinkedRelationsRequest {
        request::GetLinkedRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Create relations

Creates a new relation for an API version. This endpoint accepts multiple relation arrays in a single call.*/
    pub fn create_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::CreateRelationsRequest {
        request::CreateRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
            documentation: None,
            environment: None,
            mock: None,
            monitor: None,
            test: None,
            contracttest: None,
            testsuite: None,
        }
    }
    /**Create a schema

Creates an API definition.*/
    pub fn create_schema(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::CreateSchemaRequest {
        request::CreateSchemaRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
            schema: None,
        }
    }
    /**Get a schema

Gets information about an API's definition.*/
    pub fn get_schema(
        &self,
        api_id: &str,
        api_version_id: &str,
        schema_id: &str,
    ) -> request::GetSchemaRequest {
        request::GetSchemaRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
            schema_id: schema_id.to_owned(),
        }
    }
    /**Update a schema

Updates an API definition.*/
    pub fn update_schema(
        &self,
        api_id: &str,
        api_version_id: &str,
        schema_id: &str,
    ) -> request::UpdateSchemaRequest {
        request::UpdateSchemaRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
            schema_id: schema_id.to_owned(),
            schema: None,
        }
    }
    /**Create collection from a schema

Creates a collection and links it to an API as one or multiple relations.*/
    pub fn create_collection_from_schema(
        &self,
        args: request::CreateCollectionFromSchemaRequired,
    ) -> request::CreateCollectionFromSchemaRequest {
        request::CreateCollectionFromSchemaRequest {
            client: &self,
            api_id: args.api_id.to_owned(),
            api_version_id: args.api_version_id.to_owned(),
            schema_id: args.schema_id.to_owned(),
            workspace_id: None,
            name: args.name.to_owned(),
            relations: args.relations,
        }
    }
    /**Get all test relations

Gets all of an API version's test relations.*/
    pub fn get_test_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetTestRelationsRequest {
        request::GetTestRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Get test suite relations

This endpoint is **deprecated**. Use the `/apis/{apiId}/versions/{apiVersionId}/test` endpoint.*/
    pub fn get_test_suite_relations(
        &self,
        api_id: &str,
        api_version_id: &str,
    ) -> request::GetTestSuiteRelationsRequest {
        request::GetTestSuiteRelationsRequest {
            client: &self,
            api_id: api_id.to_owned(),
            api_version_id: api_version_id.to_owned(),
        }
    }
    /**Sync API relations with definition

Syncs an API version's relation with the API's definition.*/
    pub fn sync_relations_with_schema(
        &self,
        args: request::SyncRelationsWithSchemaRequired,
    ) -> request::SyncRelationsWithSchemaRequest {
        request::SyncRelationsWithSchemaRequest {
            client: &self,
            api_id: args.api_id.to_owned(),
            api_version_id: args.api_version_id.to_owned(),
            relation_type: args.relation_type.to_owned(),
            entity_id: args.entity_id.to_owned(),
        }
    }
    /**Get all collections

Gets all of your [collections](https://www.getpostman.com/docs/collections). The response includes all of your subscribed collections.*/
    pub fn all_collections(&self) -> request::AllCollectionsRequest {
        request::AllCollectionsRequest {
            client: &self,
            workspace_id: None,
        }
    }
    /**Create a collection

Creates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html).

**Note:**

- 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):
  - `info` object — Use the `definitions.info` entry.
  - `item` object — Use the `definitions.items` entry.
- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).
*/
    pub fn create_collection(&self) -> request::CreateCollectionRequest {
        request::CreateCollectionRequest {
            client: &self,
            workspace_id: None,
            collection: None,
        }
    }
    /**Create a fork

Creates a [fork](https://learning.postman.com/docs/collaborating-in-postman/version-control/#creating-a-fork) from an existing collection into a workspace.*/
    pub fn create_a_fork(
        &self,
        workspace: &str,
        collection_uid: &str,
    ) -> request::CreateAForkRequest {
        request::CreateAForkRequest {
            client: &self,
            workspace: workspace.to_owned(),
            collection_uid: collection_uid.to_owned(),
            label: None,
        }
    }
    /**Merge a fork

Merges a forked collection back into its destination collection.*/
    pub fn merge_a_fork(&self) -> request::MergeAForkRequest {
        request::MergeAForkRequest {
            client: &self,
            destination: None,
            source: None,
            strategy: None,
        }
    }
    /**Get a collection

Gets 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).*/
    pub fn single_collection(
        &self,
        collection_uid: &str,
    ) -> request::SingleCollectionRequest {
        request::SingleCollectionRequest {
            client: &self,
            collection_uid: collection_uid.to_owned(),
        }
    }
    /**Update a collection

Updates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html).

> Use caution when using this endpoint. The system will **replace** the existing collection with the values passed in the request body.

**Note:**

- 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):
  - `info` object — Use the `definitions.info` entry.
  - `item` object — Use the `definitions.items` entry.
- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).
*/
    pub fn update_collection(
        &self,
        collection_uid: &str,
    ) -> request::UpdateCollectionRequest {
        request::UpdateCollectionRequest {
            client: &self,
            collection_uid: collection_uid.to_owned(),
            collection: None,
        }
    }
    /**Delete a collection

Deletes a collection.*/
    pub fn delete_collection(
        &self,
        collection_uid: &str,
    ) -> request::DeleteCollectionRequest {
        request::DeleteCollectionRequest {
            client: &self,
            collection_uid: collection_uid.to_owned(),
        }
    }
    /**Get all environments

Gets information about all of your [environments](https://learning.postman.com/docs/sending-requests/managing-environments/).*/
    pub fn all_environments(&self) -> request::AllEnvironmentsRequest {
        request::AllEnvironmentsRequest {
            client: &self,
            workspace_id: None,
        }
    }
    /**Create an environment

Creates an environment.*/
    pub fn create_environment(&self) -> request::CreateEnvironmentRequest {
        request::CreateEnvironmentRequest {
            client: &self,
            workspace_id: None,
            environment: None,
        }
    }
    /**Get an environment

Gets information about an environment.*/
    pub fn single_environment(
        &self,
        environment_uid: &str,
    ) -> request::SingleEnvironmentRequest {
        request::SingleEnvironmentRequest {
            client: &self,
            environment_uid: environment_uid.to_owned(),
        }
    }
    /**Update an environment

Updates an environment.*/
    pub fn update_environment(
        &self,
        environment_uid: &str,
    ) -> request::UpdateEnvironmentRequest {
        request::UpdateEnvironmentRequest {
            client: &self,
            environment_uid: environment_uid.to_owned(),
            environment: None,
        }
    }
    /**Delete an environment

Deletes an environment.*/
    pub fn delete_environment(
        &self,
        environment_uid: &str,
    ) -> request::DeleteEnvironmentRequest {
        request::DeleteEnvironmentRequest {
            client: &self,
            environment_uid: environment_uid.to_owned(),
        }
    }
    /**Import an exported Postman data dump file

**This endpoint is deprecated.**

Imports exported Postman data. This endpoint only accepts [export data dump files](https://postman.postman.co/me/export).

For more information, read our [Exporting data dumps](https://learning.postman.com/docs/getting-started/importing-and-exporting-data/#exporting-data-dumps) documentation.
*/
    pub fn import_exported_data(&self) -> request::ImportExportedDataRequest {
        request::ImportExportedDataRequest {
            client: &self,
        }
    }
    /**Import an OpenAPI definition

Imports an OpenAPI definition into Postman as a new [Postman Collection](https://learning.postman.com/docs/getting-started/creating-the-first-collection/).*/
    pub fn import_external_api_specification(
        &self,
        body: serde_json::Value,
    ) -> request::ImportExternalApiSpecificationRequest {
        request::ImportExternalApiSpecificationRequest {
            client: &self,
            workspace_id: None,
            body,
        }
    }
    /**Get authenticated user

Gets information about the authenticated user.*/
    pub fn api_key_owner(&self) -> request::ApiKeyOwnerRequest {
        request::ApiKeyOwnerRequest {
            client: &self,
        }
    }
    /**Get all mock servers

Gets all mock servers.*/
    pub fn all_mocks(&self) -> request::AllMocksRequest {
        request::AllMocksRequest {
            client: &self,
        }
    }
    /**Create a mock server

Creates a mock server in a collection.*/
    pub fn create_mock(&self) -> request::CreateMockRequest {
        request::CreateMockRequest {
            client: &self,
            workspace_id: None,
            mock: None,
        }
    }
    /**Get a mock server

Gets information about a mock server.*/
    pub fn single_mock(&self, mock_uid: &str) -> request::SingleMockRequest {
        request::SingleMockRequest {
            client: &self,
            mock_uid: mock_uid.to_owned(),
        }
    }
    /**Update a mock server

Updates a mock server.*/
    pub fn update_mock(&self, mock_uid: &str) -> request::UpdateMockRequest {
        request::UpdateMockRequest {
            client: &self,
            mock_uid: mock_uid.to_owned(),
            mock: None,
        }
    }
    /**Delete a mock server

Deletes a mock server.*/
    pub fn delete_mock(&self, mock_uid: &str) -> request::DeleteMockRequest {
        request::DeleteMockRequest {
            client: &self,
            mock_uid: mock_uid.to_owned(),
        }
    }
    /**Publish a mock server

Publishes a mock server. Publishing a mock server sets its **Access Control** configuration setting to public.*/
    pub fn publish_mock(&self, mock_uid: &str) -> request::PublishMockRequest {
        request::PublishMockRequest {
            client: &self,
            mock_uid: mock_uid.to_owned(),
        }
    }
    /**Unpublish a mock server

Unpublishes a mock server. Unpublishing a mock server sets its **Access Control** configuration setting to private.*/
    pub fn unpublish_mock(&self, mock_uid: &str) -> request::UnpublishMockRequest {
        request::UnpublishMockRequest {
            client: &self,
            mock_uid: mock_uid.to_owned(),
        }
    }
    /**Get all monitors

Gets all monitors.*/
    pub fn all_monitors(&self) -> request::AllMonitorsRequest {
        request::AllMonitorsRequest {
            client: &self,
        }
    }
    /**Create a monitor

Creates a monitor.*/
    pub fn create_monitor(&self) -> request::CreateMonitorRequest {
        request::CreateMonitorRequest {
            client: &self,
            workspace_id: None,
            monitor: None,
        }
    }
    /**Get a monitor

Gets information about a monitor.*/
    pub fn single_monitor(&self, monitor_uid: &str) -> request::SingleMonitorRequest {
        request::SingleMonitorRequest {
            client: &self,
            monitor_uid: monitor_uid.to_owned(),
        }
    }
    /**Update a monitor

Updates a monitor.*/
    pub fn update_monitor(&self, monitor_uid: &str) -> request::UpdateMonitorRequest {
        request::UpdateMonitorRequest {
            client: &self,
            monitor_uid: monitor_uid.to_owned(),
            monitor: None,
        }
    }
    /**Delete a monitor

Deletes a monitor.*/
    pub fn delete_monitor(&self, monitor_uid: &str) -> request::DeleteMonitorRequest {
        request::DeleteMonitorRequest {
            client: &self,
            monitor_uid: monitor_uid.to_owned(),
        }
    }
    /**Run a monitor

Runs a monitor and returns its run results.*/
    pub fn run_a_monitor(&self, monitor_uid: &str) -> request::RunAMonitorRequest {
        request::RunAMonitorRequest {
            client: &self,
            monitor_uid: monitor_uid.to_owned(),
        }
    }
    /**Get resource types

Gets all the resource types supported by Postman's SCIM API.*/
    pub fn get_resource_types(&self) -> request::GetResourceTypesRequest {
        request::GetResourceTypesRequest {
            client: &self,
        }
    }
    /**Get service provider configuration

Gets the Postman SCIM API configuration information. This includes a list of supported operations.*/
    pub fn service_provider_config(&self) -> request::ServiceProviderConfigRequest {
        request::ServiceProviderConfigRequest {
            client: &self,
        }
    }
    /**Get all user resources

Gets information about all Postman team members.*/
    pub fn fetch_all_user_resource(&self) -> request::FetchAllUserResourceRequest {
        request::FetchAllUserResourceRequest {
            client: &self,
            start_index: None,
            count: None,
            filter: None,
        }
    }
    /**Create a user

Creates 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.

If 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.

By 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).
*/
    pub fn create_user(&self) -> request::CreateUserRequest {
        request::CreateUserRequest {
            client: &self,
            schemas: None,
            user_name: None,
            active: None,
            external_id: None,
            groups: None,
            locale: None,
            name: None,
        }
    }
    /**Get user resource

Gets information about a Postman team member.*/
    pub fn fetch_user_resource(
        &self,
        user_id: &str,
    ) -> request::FetchUserResourceRequest {
        request::FetchUserResourceRequest {
            client: &self,
            user_id: user_id.to_owned(),
        }
    }
    /**Update a user

Updates a user's first and last name in Postman.

**Note:**

You 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.
*/
    pub fn update_user_information(
        &self,
        user_id: &str,
    ) -> request::UpdateUserInformationRequest {
        request::UpdateUserInformationRequest {
            client: &self,
            user_id: user_id.to_owned(),
            schemas: None,
            name: None,
        }
    }
    /**Update a user's state

Updates a user's active state in Postman.

### Reactivating users

By 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.
*/
    pub fn update_user_state(&self, user_id: &str) -> request::UpdateUserStateRequest {
        request::UpdateUserStateRequest {
            client: &self,
            user_id: user_id.to_owned(),
            schemas: None,
            operations: None,
        }
    }
    /**Schema security validation

Performs 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.

For more information, read our [API definition warnings](https://learning.postman-beta.com/docs/api-governance/api-definition/api-definition-warnings/) documentation.

**Note:**

The maximum allowed size of the definition is 10 MB.
*/
    pub fn schema_security_validation(
        &self,
    ) -> request::SchemaSecurityValidationRequest {
        request::SchemaSecurityValidationRequest {
            client: &self,
            schema: None,
        }
    }
    /**Create a webhook

Creates 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.*/
    pub fn create_webhook(&self) -> request::CreateWebhookRequest {
        request::CreateWebhookRequest {
            client: &self,
            workspace_id: None,
            webhook: None,
        }
    }
    /**Get all workspaces

Gets 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.

**Note:**

This endpoint's response contains the visibility field. Visibility determines who can access the workspace:

- `only-me` — Applies to the **My Workspace** workspace.
- `personal` — Only you can access the workspace.
- `team` — All team members can access the workspace.
- `private-team` — Only invited team members can access the workspace.
- `public` — Everyone can access the workspace.
*/
    pub fn all_workspaces(&self) -> request::AllWorkspacesRequest {
        request::AllWorkspacesRequest {
            client: &self,
            type_: None,
        }
    }
    /**Create a workspace

Creates a new [workspace](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/creating-workspaces/).

### Important:

We **deprecated** linking collections or environments between workspaces. We do **not** recommend that you do this.

If you have a linked collection or environment, note the following:

- The endpoint does **not** create a clone of a collection or environment.
- Any changes you make to a linked collection or environment changes them in **all** workspaces.
- If you delete a collection or environment linked between workspaces, the system deletes it in **all** the workspaces.
*/
    pub fn create_workspace(&self) -> request::CreateWorkspaceRequest {
        request::CreateWorkspaceRequest {
            client: &self,
            workspace: None,
        }
    }
    /**Get a workspace

Gets information about a workspace.

**Note:**

This 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:

- `only-me` — Applies to the **My Workspace** workspace.
- `personal` — Only you can access the workspace.
- `team` — All team members can access the workspace.
- `private-team` — Only invited team members can access the workspace.
- `public` — Everyone can access the workspace.
*/
    pub fn single_workspace(
        &self,
        workspace_id: &str,
    ) -> request::SingleWorkspaceRequest {
        request::SingleWorkspaceRequest {
            client: &self,
            workspace_id: workspace_id.to_owned(),
        }
    }
    /**Update a workspace

Updates a workspace.

**Note:**

You can change a workspace's type from `personal` to `team`, but you **cannot** change a workspace from `team` to `personal`.

### Important:

We **deprecated** linking collections or environments between workspaces. We do **not** recommend that you do this.

If you have a linked collection or environment, note the following:

- The endpoint does **not** create a clone of a collection or environment.
- Any changes you make to a linked collection or environment changes them in **all** workspaces.
- If you delete a collection or environment linked between workspaces, the system deletes it in **all** the workspaces.
*/
    pub fn update_workspace(
        &self,
        workspace_id: &str,
    ) -> request::UpdateWorkspaceRequest {
        request::UpdateWorkspaceRequest {
            client: &self,
            workspace_id: workspace_id.to_owned(),
            workspace: None,
        }
    }
    /**Delete a workspace

Deletes an existing workspace.

### Important:

If you delete a workspace that has a linked collection or environment with another workspace, this will delete the collection and environment in **all** workspaces.
*/
    pub fn delete_workspace(
        &self,
        workspace_id: &str,
    ) -> request::DeleteWorkspaceRequest {
        request::DeleteWorkspaceRequest {
            client: &self,
            workspace_id: workspace_id.to_owned(),
        }
    }
}
pub enum PostmanAuthentication {
    PostmanApiKey { postman_api_key: String },
}
impl PostmanAuthentication {
    pub fn from_env() -> Self {
        Self::PostmanApiKey {
            postman_api_key: std::env::var("POSTMAN_API_KEY")
                .expect("Environment variable POSTMAN_API_KEY is not set."),
        }
    }
}