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
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
extern crate serde_json;

//use serde_json::value::RawValue;
use std::collections::HashMap;

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Spec {
    #[serde(rename = "auth")]
    pub auth: Option<Auth>,

    /// Provide a long description of this collection using this field. This field supports
    /// markdown syntax to better format the description.
    #[serde(rename = "description")]
    pub description: Option<String>,

    #[serde(rename = "events")]
    pub events: Option<Vec<Event>>,

    /// Folders are the way to go if you want to group your requests and to keep things
    /// organised. Folders can also be useful in sequentially requesting a part of the entire
    /// collection by using [Postman Collection
    /// Runner](https://www.getpostman.com/docs/jetpacks_running_collections) or
    /// [Newman](https://github.com/postmanlabs/newman) on a particular folder.
    #[serde(rename = "folders")]
    pub folders: Option<Vec<Folder>>,

    /// The folders order array ensures that your requests and folders don't randomly get
    /// shuffled up. It holds a sequence of
    /// [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier) corresponding to
    /// folders and requests.
    /// *Note that if a folder ID or a request ID (if the request is not already part of a
    /// folder) is not included in the order array, the request or the folder will not show up in
    /// the collection.*
    #[serde(rename = "folders_order")]
    pub folders_order: Option<Vec<String>>,

    /// Every collection is identified by the unique value of this field. The value of this field
    /// is usually easiest to generate using a
    /// [UID](https://tools.ietf.org/html/rfc4122#section-4.4%29) generator function. If you
    /// already have a collection, it is recommended that you maintain the same id since changing
    /// the id usually implies that this is a different collection than it was originally.
    #[serde(rename = "id")]
    pub id: String,

    /// A collection's friendly name is defined by this field. You would want to set this field
    /// to a value that would allow you to easily identify this collection among a bunch of other
    /// collections, as such outlining its usage or content.
    #[serde(rename = "name")]
    pub name: String,

    /// The order array ensures that your requests and folders don't randomly get shuffled up. It
    /// holds a sequence of [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier)
    /// corresponding to folders and requests.
    /// *Note that if a folder ID or a request ID (if the request is not already part of a
    /// folder) is not included in the order array, the request or the folder will not show up in
    /// the collection.*
    #[serde(rename = "order")]
    pub order: Vec<String>,

    #[serde(rename = "requests")]
    pub requests: Vec<Request>,

    #[serde(rename = "timestamp")]
    pub timestamp: Option<f64>,

    #[serde(rename = "variables")]
    pub variables: Option<Vec<Variable>>,
}

/// Represents authentication helpers provided by Postman
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Auth {
    /// The auth type. Either `noauth`, `awsv4`, `basic`, `bearer`, `digest`, `hawk`, `ntlm`, `oauth1`, or `oauth2`.
    #[serde(rename = "type")]
    pub auth_type: AuthType,

    /// No authentication
    #[serde(rename = "noauth")]
    pub noauth: Option<serde_json::Value>,

    /// The attributes for [AWS Auth](http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html).
    #[serde(rename = "awsv4")]
    pub awsv4: Option<Vec<AuthAttribute>>,

    /// The attributes for [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication).
    #[serde(rename = "basic")]
    pub basic: Option<Vec<AuthAttribute>>,

    /// The helper attributes for [Bearer Token Authentication](https://tools.ietf.org/html/rfc6750).
    #[serde(rename = "bearer")]
    pub bearer: Option<Vec<AuthAttribute>>,

    /// The attributes for [Digest Authentication](https://en.wikipedia.org/wiki/Digest_access_authentication).
    #[serde(rename = "digest")]
    pub digest: Option<Vec<AuthAttribute>>,

    /// The attributes for [Hawk Authentication](https://github.com/hueniverse/hawk).
    #[serde(rename = "hawk")]
    pub hawk: Option<Vec<AuthAttribute>>,

    /// The attributes for [NTLM Authentication](https://msdn.microsoft.com/en-us/library/cc237488.aspx).
    #[serde(rename = "ntlm")]
    pub ntlm: Option<Vec<AuthAttribute>>,

    /// The attributes for [OAuth2](https://oauth.net/1/).
    #[serde(rename = "oauth1")]
    pub oauth1: Option<Vec<AuthAttribute>>,

    /// Helper attributes for [OAuth2](https://oauth.net/2/).
    #[serde(rename = "oauth2")]
    pub oauth2: Option<Vec<AuthAttribute>>,
}

/// Represents an attribute for any authorization method provided by Postman. For example
/// `username` and `password` are set as auth attributes for Basic Authentication method.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct AuthAttribute {
    #[serde(rename = "key")]
    pub key: String,

    #[serde(rename = "type")]
    pub auth_type: Option<String>,

    #[serde(rename = "value")]
    pub value: Option<serde_json::Value>,
}

/// Defines a script associated with an associated event name
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Event {
    /// Indicates whether the event is disabled. If absent, the event is assumed to be enabled.
    #[serde(rename = "disabled")]
    pub disabled: Option<bool>,

    /// A unique identifier for the enclosing event.
    #[serde(rename = "id")]
    pub id: Option<String>,

    /// Can be set to `test` or `prerequest` for test scripts or pre-request scripts respectively.
    #[serde(rename = "listen")]
    pub listen: String,

    #[serde(rename = "script")]
    pub script: Option<Script>,
}

/// A script is a snippet of Javascript code that can be used to to perform setup or teardown
/// operations on a particular response.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Script {
    #[serde(rename = "exec")]
    pub exec: Option<Host>,

    /// A unique, user defined identifier that can  be used to refer to this script from requests.
    #[serde(rename = "id")]
    pub id: Option<String>,

    /// Script name
    #[serde(rename = "name")]
    pub name: Option<String>,

    #[serde(rename = "src")]
    pub src: Option<Url>,

    /// Type of the script. E.g: 'text/javascript'
    #[serde(rename = "type")]
    pub script_type: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct UrlClass {
    /// Contains the URL fragment (if any). Usually this is not transmitted over the network, but
    /// it could be useful to store this in some cases.
    #[serde(rename = "hash")]
    pub hash: Option<String>,

    /// The host for the URL, E.g: api.yourdomain.com. Can be stored as a string or as an array
    /// of strings.
    #[serde(rename = "host")]
    pub host: Option<Host>,

    #[serde(rename = "path")]
    pub path: Option<UrlPath>,

    /// The port number present in this URL. An empty value implies 80/443 depending on whether
    /// the protocol field contains http/https.
    #[serde(rename = "port")]
    pub port: Option<String>,

    /// The protocol associated with the request, E.g: 'http'
    #[serde(rename = "protocol")]
    pub protocol: Option<String>,

    /// An array of QueryParams, which is basically the query string part of the URL, parsed into
    /// separate variables
    #[serde(rename = "query")]
    pub query: Option<Vec<QueryParam>>,

    /// The string representation of the request URL, including the protocol, host, path, hash,
    /// query parameter(s) and path variable(s).
    #[serde(rename = "raw")]
    pub raw: Option<String>,

    /// Postman supports path variables with the syntax `/path/:variableName/to/somewhere`. These
    /// variables are stored in this field.
    #[serde(rename = "variable")]
    pub variable: Option<Vec<Variable>>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct PathClass {
    #[serde(rename = "type")]
    pub path_type: Option<String>,

    #[serde(rename = "value")]
    pub value: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct QueryParam {
    #[serde(rename = "description")]
    pub description: Option<Description>,

    /// If set to true, the current query parameter will not be sent with the request.
    #[serde(rename = "disabled")]
    pub disabled: Option<bool>,

    #[serde(rename = "key")]
    pub key: Option<String>,

    #[serde(rename = "value")]
    pub value: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct DescriptionClass {
    /// The content of the description goes here, as a raw string.
    #[serde(rename = "content")]
    pub content: Option<String>,

    /// Holds the mime type of the raw description content. E.g: 'text/markdown' or 'text/html'.
    /// The type is used to correctly render the description when generating documentation, or in
    /// the Postman app.
    #[serde(rename = "type")]
    pub description_type: Option<String>,

    /// Description can have versions associated with it, which should be put in this property.
    #[serde(rename = "version")]
    pub version: Option<serde_json::Value>,
}

/// Collection variables allow you to define a set of variables, that are a *part of the
/// collection*, as opposed to environments, which are separate entities.
/// *Note: Collection variables must not contain any sensitive information.*
///
/// Using variables in your Postman requests eliminates the need to duplicate requests, which
/// can save a lot of time. Variables can be defined, and referenced to from any part of a
/// request.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Variable {
    #[serde(rename = "description")]
    pub description: Option<Description>,

    #[serde(rename = "disabled")]
    pub disabled: Option<bool>,

    /// A variable ID is a unique user-defined value that identifies the variable within a
    /// collection. In traditional terms, this would be a variable name.
    #[serde(rename = "id")]
    pub id: Option<String>,

    /// A variable key is a human friendly value that identifies the variable within a
    /// collection. In traditional terms, this would be a variable name.
    #[serde(rename = "key")]
    pub key: Option<String>,

    /// Variable name
    #[serde(rename = "name")]
    pub name: Option<String>,

    /// When set to true, indicates that this variable has been set by Postman
    #[serde(rename = "system")]
    pub system: Option<bool>,

    /// A variable may have multiple types. This field specifies the type of the variable.
    #[serde(rename = "type")]
    pub variable_type: Option<VariableType>,

    /// The value that a variable holds in this collection. Ultimately, the variables will be
    /// replaced by this value, when say running a set of requests from a collection
    #[serde(rename = "value")]
    pub value: Option<serde_json::Value>,
}

/// One of the primary goals of Postman is to organize the development of APIs. To this end,
/// it is necessary to be able to group requests together. This can be achived using
/// 'Folders'. A folder just is an ordered set of requests.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Folder {
    #[serde(rename = "auth")]
    pub auth: Option<Auth>,

    /// Postman folders are always a part of a collection. That collection's unique ID (which is
    /// a [UUID](https://en.wikipedia.org/wiki/Globally_unique_identifier)) is stored in this
    /// field.
    #[serde(rename = "collection")]
    pub collection: Option<String>,

    /// Postman folders are always a part of a collection. That collection's unique ID (which is
    /// a [UUID](https://en.wikipedia.org/wiki/Globally_unique_identifier)) is stored in this
    /// field.
    #[serde(rename = "collection_id")]
    pub collection_id: Option<String>,

    /// Essays about the folder go into this field!
    #[serde(rename = "description")]
    pub description: String,

    #[serde(rename = "events")]
    pub events: Option<Vec<Event>>,

    /// Postman preserves the order of your folders within each folder. This field holds a
    /// sequence of [UUIDs](https://en.wikipedia.org/wiki/Globally_unique_identifier), where each
    /// ID corresponds to a particular collection folder.
    #[serde(rename = "folders_order")]
    pub folders_order: Option<Vec<String>>,

    /// In order to be able to uniquely identify different folders within a collection, Postman
    /// assigns each folder a unique ID (a
    /// [UUID](https://en.wikipedia.org/wiki/Globally_unique_identifier)). This field contains
    /// that value.
    #[serde(rename = "id")]
    pub id: String,

    /// A folder's friendly name is defined by this field. You would want to set this field to a
    /// value that would allow you to easily identify this folder.
    #[serde(rename = "name")]
    pub name: String,

    /// Postman preserves the order of your requests within each folder. This field holds a
    /// sequence of [UUIDs](https://en.wikipedia.org/wiki/Globally_unique_identifier), where each
    /// ID corresponds to a particular Postman request.
    #[serde(rename = "order")]
    pub order: Vec<String>,

    #[serde(rename = "variables")]
    pub variables: Option<Vec<Variable>>,
}

/// A request represents an HTTP request.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Request {
    #[serde(rename = "auth")]
    pub auth: Option<Auth>,

    /// This field contains the unique ID of the collection to which this request belongs.
    #[serde(rename = "collection")]
    pub collection: Option<String>,

    /// This field contains the unique ID of the collection to which this request belongs.
    #[serde(rename = "collectionId")]
    pub collection_id: Option<String>,

    #[serde(rename = "currentHelper")]
    pub current_helper: Option<String>,

    #[serde(rename = "data")]
    pub data: Option<Vec<Datum>>,

    /// When set to true, prevents request body from being sent.
    #[serde(rename = "dataDisabled")]
    pub data_disabled: Option<bool>,

    #[serde(rename = "dataMode")]
    pub data_mode: Option<DataMode>,

    /// The description of this request. Can be as long as you want. Postman also supports two
    /// formats for your description, ``markdown`` and ``html``.
    #[serde(rename = "description")]
    pub description: Option<String>,

    /// A request can have an associated description text. Since description is meant to be long,
    /// it can be in either ``html`` or ``markdown`` formats. This field specifies that format.
    #[serde(rename = "descriptionFormat")]
    pub description_format: Option<DescriptionFormat>,

    #[serde(rename = "events")]
    pub events: Option<Vec<Event>>,

    /// Postman requests may or may not be a part of a folder. If this request belongs to a
    /// folder, that folder's unique ID (which is a
    /// [UUID](https://en.wikipedia.org/wiki/Globally_unique_identifier)) is stored in this field.
    #[serde(rename = "folder")]
    pub folder: Option<String>,

    #[serde(rename = "headerData")]
    pub header_data: Option<Vec<Option<Header>>>,

    /// No HTTP request is complete without its headers, and the same is true for a Postman
    /// request. This field contains all the HTTP Headers in a raw string format.
    #[serde(rename = "headers")]
    pub headers: String,

    #[serde(rename = "helperAttributes")]
    pub helper_attributes: Option<HelperAttributes>,

    /// Postman can store a number of requests in each collection. In order to preserve the order
    /// of each request, we need to be able to identify requests uniquely. This field is a UUID
    /// assigned to each request.
    #[serde(rename = "id")]
    pub id: String,

    #[serde(rename = "method")]
    pub method: String,

    /// Sometimes, you just need to call your request 'Bob'. Postman will let you do that, and
    /// store the name you give in this field.
    #[serde(rename = "name")]
    pub name: String,

    #[serde(rename = "pathVariableData")]
    pub path_variable_data: Option<Vec<Option<PathVariable>>>,

    /// A Postman request allows you to use Path Variables in a request, e.g:
    /// ``/search/:bookId``. This field stores these variables.
    #[serde(rename = "pathVariables")]
    pub path_variables: Option<PathVariables>,

    #[serde(rename = "preRequestScript")]
    pub pre_request_script: Option<String>,

    /// Set of configurations used to alter the usual behavior of sending the request
    #[serde(rename = "protocolProfileBehavior")]
    pub protocol_profile_behavior: Option<ProtocolProfileBehavior>,

    #[serde(rename = "queryParams")]
    pub query_params: Option<Vec<Option<UrlParam>>>,

    /// Contains the raw data (parameters) that Postman sends to the server
    #[serde(rename = "rawModeData")]
    pub raw_mode_data: Option<RawModeData>,

    /// A Postman request can have multiple responses associated with it. These responses are
    /// stored in this field.
    #[serde(rename = "responses")]
    pub responses: Option<Vec<Option<Response>>>,

    #[serde(rename = "tests")]
    pub tests: Option<String>,

    /// The timestamp for this request.
    #[serde(rename = "time")]
    pub time: Option<f64>,

    /// Contains the complete URL for this request, along with the path variables, if any.
    #[serde(rename = "url")]
    pub url: String,

    #[serde(rename = "variables")]
    pub variables: Option<Vec<Variable>>,
}

/// Data is an array of key-values that the request goes with. POST data, PUT data, etc goes
/// here.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Datum {
    /// Override Content-Type header of this form data entity.
    #[serde(rename = "contentType")]
    pub content_type: Option<String>,

    #[serde(rename = "description")]
    pub description: Option<String>,

    #[serde(rename = "enabled")]
    pub enabled: Option<bool>,

    #[serde(rename = "key")]
    pub key: Option<String>,

    #[serde(rename = "type")]
    pub datum_type: Option<serde_json::Value>,

    #[serde(rename = "value")]
    pub value: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct HeaderClass {
    /// You can associate descriptions with headers too.
    #[serde(rename = "description")]
    pub description: Option<String>,

    /// Name of the header goes here. e.g: `Content-Type`
    #[serde(rename = "key")]
    pub key: Option<String>,

    /// The value of the header
    #[serde(rename = "value")]
    pub value: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct HelperClass {
    /// The helper type. Either `awsSigV4`, `basic`, `bearer`, `digest`, `hawk`, `ntlm`, `oAuth1`, or `oAuth2`.
    #[serde(rename = "id")]
    pub id: Option<HelperType>,

    /* TODO: Get boxed raw values working
    /// The attributes for [AWS Auth](http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html). e.g.
    /// accessKey, secretKey, region, service.
    ///
    /// The attributes for [Digest Authentication](https://en.wikipedia.org/wiki/Digest_access_authentication). e.g.
    /// username, password, realm, nonce, nonceCount, algorithm, qop, opaque, clientNonce.
    ///
    /// The attributes for [Hawk Authentication](https://github.com/hueniverse/hawk). e.g.
    /// authId, authKey, algorith, user, nonce, extraData, appId, delegation, timestamp.
    ///
    /// The attributes for [NTLM Authentication](https://msdn.microsoft.com/en-us/library/cc237488.aspx). e.g. username,
    /// password, domain, workstation.
    ///
    /// The attributes for [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). e.g.
    /// username, password.
    ///
    /// The attributes for [Bearer Token Authentication](https://tools.ietf.org/html/rfc6750).
    /// e.g. token.
    ///
    /// The attributes for [OAuth1](https://oauth.net/1/). e.g. consumerKey, consumerSecret,
    /// token, tokenSecret, signatureMethod, timestamp, nonce, version, realm, encodeOAuthSign.
    ///
    /// The attributes for [OAuth2](https://oauth.net/2/). e.g. accessToken, addTokenTo.
    #[serde(flatten)]
    pub attributes: Box<RawValue>,
    */
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct PathVariableClass {
    /// Extra description about a path variable may be added in this field.
    #[serde(rename = "description")]
    pub description: Option<String>,

    /// The identifier of a path variable goes here.
    #[serde(rename = "key")]
    pub key: Option<String>,

    /// The value of the path variable will be substituted in place of the key.
    #[serde(rename = "value")]
    pub value: Option<String>,
}

/// Set of configurations used to alter the usual behavior of sending the request
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct ProtocolProfileBehavior {
    /// Disable body pruning for GET, COPY, HEAD, PURGE and UNLOCK request methods.
    #[serde(rename = "disableBodyPruning")]
    pub disable_body_pruning: Option<bool>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct UrlParamClass {
    /// You can associate descriptions with URL parameters, which are stored in this field.
    #[serde(rename = "description")]
    pub description: Option<String>,

    /// The key of a URL parameter.
    #[serde(rename = "key")]
    pub key: Option<String>,

    /// The value of a URL parameter
    #[serde(rename = "value")]
    pub value: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct ResponseClass {
    #[serde(rename = "cookies")]
    pub cookies: Option<Vec<Cookie>>,

    #[serde(rename = "headers")]
    pub headers: Option<Vec<HeaderElement>>,

    /// In order to unambiguously identify a response, Postman assigns a UUID to it, and stores
    /// it in this field.
    #[serde(rename = "id")]
    pub id: String,

    /// The language associated with the response.
    #[serde(rename = "language")]
    pub language: Option<Language>,

    /// Mimetype of the response.
    #[serde(rename = "mime")]
    pub mime: Option<String>,

    /// A response can have a friendly name, which goes here.
    #[serde(rename = "name")]
    pub name: Option<String>,

    /// The data type of the raw response.
    #[serde(rename = "rawDataType")]
    pub raw_data_type: Option<String>,

    /// A response is associated with a request. This fields contains the UUID of the request
    /// corresponding to this response.
    #[serde(rename = "request")]
    pub request: Option<PathVariables>,

    #[serde(rename = "responseCode")]
    pub response_code: ResponseCode,

    #[serde(rename = "status")]
    pub status: Option<String>,

    /// The raw text of the response.
    #[serde(rename = "text")]
    pub text: Option<String>,

    /// The time taken by this particular HTTP transaction to complete is stored in this field.
    /// For manually created responses, this field can be set to ``null``.
    #[serde(rename = "time")]
    pub time: Option<Time>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct Cookie {
    /// The domain for which this cookie is valid.
    #[serde(rename = "domain")]
    pub domain: String,

    /// The timestamp of the time when the cookie expires.
    #[serde(rename = "expirationDate")]
    pub expiration_date: f64,

    /// Human readable expiration time.
    #[serde(rename = "expires")]
    pub expires: String,

    /// Indicates if this cookie is Host Only.
    #[serde(rename = "hostOnly")]
    pub host_only: bool,

    /// Indicates if this cookie is HTTP Only.
    #[serde(rename = "httpOnly")]
    pub http_only: bool,

    /// This is the name of the Cookie.
    #[serde(rename = "name")]
    pub name: String,

    /// The path associated with the Cookie.
    #[serde(rename = "path")]
    pub path: String,

    /// Indicates if the 'secure' flag is set on the Cookie.
    #[serde(rename = "secure")]
    pub secure: bool,

    /// True if the cookie is a session cookie.
    #[serde(rename = "session")]
    pub session: bool,

    /// The ID of the cookie store containing this cookie.
    #[serde(rename = "storeId")]
    pub store_id: String,

    /// The value of the Cookie.
    #[serde(rename = "value")]
    pub value: String,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct HeaderElement {
    /// An optional description about the header.
    #[serde(rename = "description")]
    pub description: Option<String>,

    /// The left hand side (LHS) or 'key' of the header.
    #[serde(rename = "key")]
    pub key: String,

    /// Some headers can have names associated with them, which are stored in this field.
    #[serde(rename = "name")]
    pub name: Option<String>,

    /// Value of the header, or the right hand side (RHS).
    #[serde(rename = "value")]
    pub value: String,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Default)]
pub struct ResponseCode {
    /// The numeric HTTP response code.
    #[serde(rename = "code")]
    pub code: f64,

    /// Detailed explanation of the response code.
    #[serde(rename = "detail")]
    pub detail: Option<String>,

    /// The textual HTTP response code.
    #[serde(rename = "name")]
    pub name: String,
}

/// The host for the URL, E.g: api.yourdomain.com. Can be stored as a string or as an array
/// of strings.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum Host {
    String(String),

    StringArray(Vec<String>),
}

/// If object, contains the complete broken-down URL for this request. If string, contains
/// the literal request URL.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum Url {
    String(String),

    UrlClass(UrlClass),
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum UrlPath {
    String(String),

    UnionArray(Vec<PathElement>),
}

/// The complete path of the current url, broken down into segments. A segment could be a
/// string, or a path variable.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum PathElement {
    String(String),

    PathClass(PathClass),
}

/// A Description can be a raw text, or be an object, which holds the description along with
/// its format.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum Description {
    String(String),

    DescriptionClass(DescriptionClass),
}

/// A response represents an HTTP response.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum Header {
    AnythingArray(Vec<Option<serde_json::Value>>),

    Bool(bool),

    Double(f64),

    HeaderClass(HeaderClass),

    Integer(i64),

    String(String),
}

/// A helper may require a number of parameters to actually be helpful. The parameters used
/// by the helper can be stored in this field, as an object. E.g when using Basic
/// Authentication, the username and password will be stored here.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum HelperAttributes {
    String(String),

    HelperClass(HelperClass),
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum HelperType {
    #[serde(rename = "awsSigV4")]
    AwsSigV4,

    #[serde(rename = "basic")]
    Basic,

    #[serde(rename = "bearer")]
    Bearer,

    #[serde(rename = "digest")]
    Digest,

    #[serde(rename = "hawk")]
    Hawk,

    #[serde(rename = "ntlm")]
    Ntlm,

    #[serde(rename = "oAuth1")]
    OAuth1,

    #[serde(rename = "oAuth2")]
    OAuth2,
}

/// A request URL may contain one or more path variables (e.g: `:varname`)
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum PathVariable {
    AnythingArray(Vec<Option<serde_json::Value>>),

    Bool(bool),

    Double(f64),

    Integer(i64),

    PathVariableClass(PathVariableClass),

    String(String),
}

/// A Postman request allows you to use Path Variables in a request, e.g:
/// ``/search/:bookId``. This field stores these variables.
///
/// A response is associated with a request. This fields contains the UUID of the request
/// corresponding to this response.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum PathVariables {
    AnythingMap(HashMap<String, Option<serde_json::Value>>),

    String(String),
}

/// A response represents an HTTP response.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum UrlParam {
    AnythingArray(Vec<Option<serde_json::Value>>),

    Bool(bool),

    Double(f64),

    Integer(i64),

    String(String),

    UrlParamClass(UrlParamClass),
}

/// Contains the raw data (parameters) that Postman sends to the server
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum RawModeData {
    AnythingArray(Vec<Option<serde_json::Value>>),

    String(String),
}

/// A response represents an HTTP response.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum Response {
    AnythingArray(Vec<Option<serde_json::Value>>),

    Bool(bool),

    Double(f64),

    Integer(i64),

    ResponseClass(ResponseClass),

    String(String),
}

/// The time taken by this particular HTTP transaction to complete is stored in this field.
/// For manually created responses, this field can be set to ``null``.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
#[serde(untagged)]
pub enum Time {
    Double(f64),

    String(String),
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum AuthType {
    #[serde(rename = "awsv4")]
    Awsv4,

    #[serde(rename = "basic")]
    Basic,

    #[serde(rename = "bearer")]
    Bearer,

    #[serde(rename = "digest")]
    Digest,

    #[serde(rename = "hawk")]
    Hawk,

    #[serde(rename = "noauth")]
    Noauth,

    #[serde(rename = "ntlm")]
    Ntlm,

    #[serde(rename = "oauth1")]
    Oauth1,

    #[serde(rename = "oauth2")]
    Oauth2,
}

/// Returns `Noauth` for AuthType by default
impl Default for AuthType {
    fn default() -> AuthType {
        AuthType::Noauth
    }
}

/// A variable may have multiple types. This field specifies the type of the variable.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum VariableType {
    #[serde(rename = "any")]
    Any,

    #[serde(rename = "boolean")]
    Boolean,

    #[serde(rename = "number")]
    Number,

    #[serde(rename = "string")]
    String,
}

/// A request can have a specific data mode, and Postman supports these.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum DataMode {
    #[serde(rename = "binary")]
    Binary,

    #[serde(rename = "params")]
    Params,

    #[serde(rename = "raw")]
    Raw,

    #[serde(rename = "urlencoded")]
    Urlencoded,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum DescriptionFormat {
    #[serde(rename = "html")]
    Html,

    #[serde(rename = "markdown")]
    Markdown,
}

/// The language associated with the response.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum Language {
    #[serde(rename = "html")]
    Html,

    #[serde(rename = "javascript")]
    Javascript,

    #[serde(rename = "Text")]
    Text,

    #[serde(rename = "xml")]
    Xml,
}