-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtime-in-transit.ts
853 lines (834 loc) · 33.5 KB
/
time-in-transit.ts
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
/// <reference path="./custom.d.ts" />
// tslint:disable
/**
* Time In Transit
* The Time In Transit API is used to determine the length of time required to ship a particular package, and compare delivery times for various UPS services.
*
* OpenAPI spec version: 1.0.1
*
*
* NOTE: This file is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the file manually.
*/
import * as url from "url";
import isomorphicFetch, { Response } from "node-fetch";
import { Configuration } from "./configuration";
const BASE_PATH = "https://wwwcie.ups.com/api/".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface FetchAPI
*/
export interface FetchAPI {
(url: string, init?: any): Promise<Response>;
}
/**
*
* @export
* @interface FetchArgs
*/
export interface FetchArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
constructor(public field: string, msg?: string) {
super(msg);
}
}
/**
*
* @export
* @interface CandidateAddress
*/
export interface CandidateAddress {
/**
* Spelled out country name.
* @type {string}
* @memberof CandidateAddress
*/
countryName: string;
/**
* Country code, follows ISO-defined country codes.
* @type {string}
* @memberof CandidateAddress
*/
countryCode?: string;
/**
* Present on response when candidate valu ehas a political division 1 value available.
* @type {string}
* @memberof CandidateAddress
*/
stateProvince?: string;
/**
* Present on response when candidate value has a political division 2 value available.
* @type {string}
* @memberof CandidateAddress
*/
city?: string;
/**
* Present on response when candidate value has a political divison 3 value available.
* @type {string}
* @memberof CandidateAddress
*/
town?: string;
/**
* Present on response when candidate has a postal code value available
* @type {string}
* @memberof CandidateAddress
*/
postalCode?: string;
/**
* Present on response when vandidate value has a postal code range value available, this is the postal range low value.
* @type {string}
* @memberof CandidateAddress
*/
postalCodeLow?: string;
/**
* Present on response when candidate value has a postal code range value available, this is the postal range high value.
* @type {string}
* @memberof CandidateAddress
*/
postalCodeHigh?: string;
}
/**
*
* @export
*/
export type DestinationPickList = Array<CandidateAddress>
/**
*
* @export
* @interface EmsResponse
*/
export interface EmsResponse {
/**
* The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. Valid Format: YYYY-MM-DD
* @type {string}
* @memberof EmsResponse
*/
shipDate: string;
/**
* The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). Valid Format: HH:MM:SS
* @type {string}
* @memberof EmsResponse
*/
shipTime: string;
/**
* Service Levels being returned. A = all service levels. Blank is the default for all Service Level values.
* @type {string}
* @memberof EmsResponse
*/
serviceLevel: string;
/**
* Represents the shipment type. Valid values: \"02\",\"03\",\"04\",\"07\" 02 - Document 03 - Non-Document 04 - WWEF 07 - Pallet
* @type {string}
* @memberof EmsResponse
*/
billType: string;
/**
* Populated with valid duty types for international transactions only. Valid Duty Types: \"01\",\"02\",\"03\",\"04\",\"05\",\"06\",\"07\",\"08\",\"09\" 01 - Dutiable 02 - Non Dutiable 03 - Low Value 04 - Courier Remission 05 - Gift 06 - Military 07 - Exception 08 - Line Release 09 - Low Value
* @type {string}
* @memberof EmsResponse
*/
dutyType?: string;
/**
* residential Indicator that was sent in on the request. Valid values: \"01\",\"02\" 01 - Residential 02 - Commercial
* @type {string}
* @memberof EmsResponse
*/
residentialIndicator: string;
/**
* Destination country name value
* @type {string}
* @memberof EmsResponse
*/
destinationCountryName: string;
/**
* Destination country code, conforms to ISO-defined country codes.
* @type {string}
* @memberof EmsResponse
*/
destinationCountryCode: string;
/**
* The shipment destination postal code. Required for US domestic requests. Either 5- or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
destinationPostalCode?: string;
/**
* The shipment destination postal code low range. Value may or may not differ from destinationPostalCode. Either 5- or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
destinationPostalCodeLow?: string;
/**
* The shipment destination postal code high range. Value may or may not differ from destinationPostalCode. Either 5- or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
destinationPostalCodeHigh?: string;
/**
* The shipment destination state or province. For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). For non-U.S. addresses the full State or Province name will be returned.
* @type {string}
* @memberof EmsResponse
*/
destinationStateProvince?: string;
/**
* The shipment destination city. Required for International requests for thsoe countries that do not utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
destinationCityName?: string;
/**
* Origin country name value
* @type {string}
* @memberof EmsResponse
*/
originCountryName: string;
/**
* Origin country code, conforms to ISO-defined country codes.
* @type {string}
* @memberof EmsResponse
*/
originCountryCode: string;
/**
* The shipment origin postal code. Required for US domestic requests. Either 5- or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
originPostalCode?: string;
/**
* The shipment origin postal code low range. Value may or may not differ from destinationPostalCode. Either 5- or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
originPostalCodeLow?: string;
/**
* The shipment origin postal code high range. Value may or may not differ from destinationPostalCode. Either 5- or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
originPostalCodeHigh?: string;
/**
* The shipment origin state or province. For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). For non-U.S. addresses the full State or Province name will be returned.
* @type {string}
* @memberof EmsResponse
*/
originStateProvince?: string;
/**
* The shipment origin city. Required for International requests for thsoe countries that do not utilize postal codes.
* @type {string}
* @memberof EmsResponse
*/
originCityName?: string;
/**
* Shipment weight. Value is only requried for international shipment. Defaults to 0.0
* @type {string}
* @memberof EmsResponse
*/
weight?: string;
/**
* Returned on response when weight was present on the request.
* @type {string}
* @memberof EmsResponse
*/
weightUnitOfMeasure?: string;
/**
* Shipment contents value. Value is only required for international shipment. Defaults to 0.0
* @type {string}
* @memberof EmsResponse
*/
shipmentContentsValue?: string;
/**
* Returned on response when shipmentContentsValue was present on the request.
* @type {string}
* @memberof EmsResponse
*/
shipmentContentsCurrencyCode?: string;
/**
* Returns TRUE if the shipment dates fall within a defined peak date range. When the guarantee is suspended, it is suspended for all services in the response. The logic for determining if guarantees are suspended applies per origin country. The following wil be used to determine if a shipment falls within a defined peak date range: shipDate (from the response), deliveryDate (from the response), server Date. Defined peak date range (range for when guarantees are suspended) is inclusive of start and end dates.
* @type {boolean}
* @memberof EmsResponse
*/
guaranteeSuspended: boolean;
/**
* Number of services being returned in the services array.
* @type {number}
* @memberof EmsResponse
*/
numberOfServices: number;
/**
*
* @type {Array<Services>}
* @memberof EmsResponse
*/
services?: Array<Services>;
}
/**
*
* @export
* @interface ErrorResponse
*/
export interface ErrorResponse {
/**
*
* @type {Array<Errors>}
* @memberof ErrorResponse
*/
errors?: Array<Errors>;
}
/**
*
* @export
* @interface Errors
*/
export interface Errors {
/**
* Error code
* @type {string}
* @memberof Errors
*/
code?: string;
/**
* Error message
* @type {string}
* @memberof Errors
*/
message?: string;
}
/**
*
* @export
*/
export type OriginPickList = Array<CandidateAddress>
/**
*
* @export
* @interface Services
*/
export interface Services {
/**
* Service level code Valid domestic service codes: \"1DMS\",\"1DAS\",\"1DM\",\"1DA\",\"1DP\",\"2DM\",\"2DA\",\"3DS\",\"GND\". Valid International service codes (not a complete list) ,\"01\",\"02\",\"03\",\"05\",\"08\",\"09\",\"10\",\"11\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"28\",\"29\",\"33\",\"68\".
* @type {string}
* @memberof Services
*/
serviceLevel: string;
/**
* Service name, examples are: UPS Next Day Air, UPS Ground, UPS Expedited, UPS Worldwide Express Frieght
* @type {string}
* @memberof Services
*/
serviceLevelDescription: string;
/**
* The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. Valid Format: YYYY-MM-DD
* @type {string}
* @memberof Services
*/
shipDate: string;
/**
* Scheduled delivery date. Valid format: YYYY-MM-DD
* @type {string}
* @memberof Services
*/
deliveryDate: string;
/**
* Scheduled commit time. For international shipments the value always come back from SE (OPSYS data) but for domestic, value may be used from NRF commit time. Valid format: HH:MM:SS
* @type {string}
* @memberof Services
*/
commitTime: string;
/**
* Scheduled Delivery Time, value may be later then commit time. Valid format: HH:MM:SS
* @type {string}
* @memberof Services
*/
deliveryTime: string;
/**
* Three character scheduled delivery day of week. Valid values: \"MON\",\"TUE\",\"WED\",\"THU\",\"FRI\", \"SAT\"
* @type {string}
* @memberof Services
*/
deliveryDayOfWeek: string;
/**
* Returns a \"1\" if the requested shipped on date was changed. This data is available only for international transactions. When this flag is set, WWDTDisclaimer.getNextDayDisclaimer method could be called to return the next day disclaimer message.
* @type {string}
* @memberof Services
*/
nextDayPickupIndicator: string;
/**
* Returns \"1\" if Saturday Pickup is available for an extra charge otherwise it will return \"0\". When this flag is set, WWDTDisclaimer.getSaturdayPickupDisclaimer method could be called to return the Saturday pickup extra charge message
* @type {string}
* @memberof Services
*/
saturdayPickupIndicator: string;
/**
* Delivery date of Saturday Delivery Valid Format: YYYY-MM-DD
* @type {string}
* @memberof Services
*/
saturdayDeliveryDate?: string;
/**
* Delivery time of Saturday deliver Valid format: HH:MM:SS
* @type {string}
* @memberof Services
*/
saturdayDeliveryTime?: string;
/**
* Service remarks text. The contents of this field will represent text that the back end application/function needs to display to clarify the time in transit calculation.
* @type {string}
* @memberof Services
*/
serviceRemarksText?: string;
/**
* Return \"1\" Guaranteed, or \"0\" Not Guaranteed based on below conditions: If the ship date, delivery date, and system date are not within a defined peak date range, and a value for service guaranetee is available in SE (OPSYS data) that will be returned. If the ship date or delivery date or system date are within a defined peak date range and the service is within the list of servies to remove guarantees for, \"0\" wil be returned.
* @type {string}
* @memberof Services
*/
guaranteeIndicator: string;
/**
* Available for International requests. Number of calendar days from origin location to destination location. TotalTransitDays = BusinessTransitDays + RestDaysCount + HolidayCount. Defaults to 0.
* @type {number}
* @memberof Services
*/
totalTransitDays: number;
/**
* Returns the number of UPS business days from origin location to destination location.
* @type {number}
* @memberof Services
*/
businessTransitDays: number;
/**
* Returns the number of rest days encountered at the origin location. this data is available only for international transactions. Defaults to 0.
* @type {number}
* @memberof Services
*/
restDaysCount: number;
/**
* Returns the number of holidays encountered at the origin and destination location, if it effects the time and transit. This data is available only for international transactions. Defaults to 0.
* @type {number}
* @memberof Services
*/
holidayCount: number;
/**
* Returns the number of delay needed for customs encounter at the origin or destination location. This data is available only for international transactions. Defaults to 0.
* @type {number}
* @memberof Services
*/
delayCount: number;
/**
* Planned pickup date. Note: This value may not equal the shipped on value requested. This could happen when the requested shipped on date is a holiday or for locations needing 24 hour notice before a pickup could be made.
* @type {string}
* @memberof Services
*/
pickupDate: string;
/**
* Latest possible pickup time. This data is available only for international transactions. If the package was not actually picked by UPS before this time, the services will not meet the guarantee commitment.
* @type {string}
* @memberof Services
*/
pickupTime: string;
/**
* Latest time a customer can contact UPS CST needs to be notified for requesting a pickup. This data is available only for international transactions. If customer does not notify UPS for a pickup before this time, the services will not meet the guarantee commitment.
* @type {string}
* @memberof Services
*/
cstccutoffTime: string;
/**
* Returns the date proof of delivery informatino will be available. This data is available only for international transactions.
* @type {string}
* @memberof Services
*/
poddate?: string;
/**
* Returns the number of days proof of delivery information will be available. This data is available only for international transactions.
* @type {number}
* @memberof Services
*/
poddays?: number;
}
/**
* N/A
* @export
* @interface TimeInTransitRequest
*/
export interface TimeInTransitRequest {
/**
* The country code of the origin shipment. Valid Values: Must conform to the ISO-defined country codes. Refer to Country or Territory Codoes in the Appendix for valid values.
* @type {string}
* @memberof TimeInTransitRequest
*/
originCountryCode: string;
/**
* The shipment origin state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards) For non-U.S. addresses the full State or Province name should be provided.
* @type {string}
* @memberof TimeInTransitRequest
*/
originStateProvince?: string;
/**
* Required for International requests for those countries that do not utilize postal codes. The shipment origin city.
* @type {string}
* @memberof TimeInTransitRequest
*/
originCityName?: string;
/**
* The shipment origin town. Town is a subdivision of city.
* @type {string}
* @memberof TimeInTransitRequest
*/
originTownName?: string;
/**
* Required for Domestic requests. The shipment origin postal code. Either 5- or 9- digit US zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof TimeInTransitRequest
*/
originPostalCode?: string;
/**
* The country code of the destination. Valid values: Must conform to ISO-defined country codes.
* @type {string}
* @memberof TimeInTransitRequest
*/
destinationCountryCode?: string;
/**
* The shipment destination state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards). For non-U.S. addresses the full State or Province name should be provided.
* @type {string}
* @memberof TimeInTransitRequest
*/
destinationStateProvince?: string;
/**
* Required for International Requests for those countries that do not utilize postal codes. The shipment destination city.
* @type {string}
* @memberof TimeInTransitRequest
*/
destinationCityName?: string;
/**
* The shipment destination town. Town is a subdivision of city.
* @type {string}
* @memberof TimeInTransitRequest
*/
destinationTownName?: string;
/**
* The shipment destination postal code. Required for Domestic requests. Either 5- or 9-digit U.S. zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes.
* @type {string}
* @memberof TimeInTransitRequest
*/
destinationPostalCode?: string;
/**
* Required for Domestic requests. Valid values: \"01\", \"02\" 01 = Residential 02 = Commercial Defaults to commercial for International Requests.
* @type {string}
* @memberof TimeInTransitRequest
*/
residentialIndicator?: string;
/**
* The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. Format is YYYY-MM-DD. YYYY = 4 digit year; MM = 2 digit month, valid values 01-12; DD = 2 digit day of month, valid values 01-31 If no value is provided, defaults to current system date.
* @type {string}
* @memberof TimeInTransitRequest
*/
shipDate?: string;
/**
* The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). Format is HH:MM:SS
* @type {string}
* @memberof TimeInTransitRequest
*/
shipTime?: string;
/**
* Required for International requests. The weight of the shipment. Note: If decimal values are used, valid values will be rounded to the tenths. Note: Maximum value is 70 kilograms or 150 pounds.
* @type {number}
* @memberof TimeInTransitRequest
*/
weight?: number;
/**
* Required for International requests and when weight value is provided. Valid Values: \"LBS\", \"KGS\"
* @type {string}
* @memberof TimeInTransitRequest
*/
weightUnitOfMeasure?: string;
/**
* The monetary value of shpment contents. Required when origin country does not equal destination country and BillType is 03 (non-documented) or 04 (WWEF) Required when origin country does not equal destination country, and destination country = CA, and BIllType = 02 (document). Note: If decimal values are used, valid values will be rounded to the tenths.
* @type {number}
* @memberof TimeInTransitRequest
*/
shipmentContentsValue?: number;
/**
* Required if ShipmentContentsValue is populated. The unit of currency used for values. Valid value: must conform to ISO standards.
* @type {string}
* @memberof TimeInTransitRequest
*/
shipmentContentsCurrencyCode?: string;
/**
* Required for International Requests. Valid values: \"02\",\"03\",\"04\" 02 - Document 03 - Non Document 04 - WWEF (Pallet)
* @type {string}
* @memberof TimeInTransitRequest
*/
billType?: string;
/**
* Used to bypass address validation when the address has already been validated by the calling application. Valid values: true, false Defaults to true Note: not to be exposed to external customers.
* @type {boolean}
* @memberof TimeInTransitRequest
*/
avvFlag?: boolean;
/**
* Sets the number of packages in shipment. Default value is 1.
* @type {number}
* @memberof TimeInTransitRequest
*/
numberOfPackages?: number;
/**
* Sets the indicator for an international Freight Pallet shipment that is going to be dropped off by shipper to a UPS facility. The indicator is used when the Bill Type is \"04\". Valid values: \"0\", \"1\". 0 = WWDTProcessIF.PICKUP_BY_UPS 1 = WWDTProcessIf.DROPOFF_BY_SHIPPER The default value is \"0\"
* @type {number}
* @memberof TimeInTransitRequest
*/
dropOffAtFacilityIndicator?: number;
/**
* Sets the indicator for an international Freight Pallet shipment that is going to be pick-up by consignee in a destination facility. The indicator is used when the Bill Type is \"04\". Valid values: \"0\", \"1\". 0 = WWDTProcessIF.DELIVERY_BY_UPS 1 = WWDTProcessIf.PICKUP_BY_CONSIGNEE The default value is \"0\"
* @type {number}
* @memberof TimeInTransitRequest
*/
holdForPickupIndicator?: number;
/**
* Used to get back a full list of services - bypassing current WWDT business rules to remove services from the list being returned to clients for US domestic that are slower than UPS Ground. Default value is false.
* @type {boolean}
* @memberof TimeInTransitRequest
*/
returnUnfilterdServices?: boolean;
/**
* Sets the limit for the number of candidates returned in candidate list. Default value is 200.
* @type {number}
* @memberof TimeInTransitRequest
*/
maxList?: number;
}
/**
* N/A
* @export
* @interface TimeInTransitResponse
*/
export interface TimeInTransitResponse {
/**
*
* @type {ValidationList}
* @memberof TimeInTransitResponse
*/
validationList?: ValidationList;
/**
*
* @type {DestinationPickList}
* @memberof TimeInTransitResponse
*/
destinationPickList?: DestinationPickList;
/**
*
* @type {OriginPickList}
* @memberof TimeInTransitResponse
*/
originPickList?: OriginPickList;
/**
*
* @type {EmsResponse}
* @memberof TimeInTransitResponse
*/
emsResponse?: EmsResponse;
}
/**
*
* @export
* @interface ValidationList
*/
export interface ValidationList {
/**
*
* @type {Array<string>}
* @memberof ValidationList
*/
invalidFieldList?: Array<string>;
/**
*
* @type {Array<string>}
* @memberof ValidationList
*/
invalidFieldListCodes?: Array<string>;
/**
* Returned as true when destination address has a candidate list
* @type {boolean}
* @memberof ValidationList
*/
destinationAmbiguous?: boolean;
/**
* Returned as true when origina ddress has a candidate list.
* @type {boolean}
* @memberof ValidationList
*/
originAmbiguous?: boolean;
}
/**
* DefaultApi - fetch parameter creator
* @export
*/
export const DefaultApiFetchParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Get Time and Transit Response
* @param {TimeInTransitRequest} body Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click "Authorize" and enter your application credentials, then populate the required parameters above and click "Try it out".
* @param {string} version API Version
* @param {string} transId An identifier unique to the request. Length 32
* @param {string} transactionSrc Identifies the clients/source application that is calling. Length 512
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
timeInTransit(body: TimeInTransitRequest, version: string, transId: string, transactionSrc: string, options: any = {}): FetchArgs {
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('body','Required parameter body was null or undefined when calling timeInTransit.');
}
// verify required parameter 'version' is not null or undefined
if (version === null || version === undefined) {
throw new RequiredError('version','Required parameter version was null or undefined when calling timeInTransit.');
}
// verify required parameter 'transId' is not null or undefined
if (transId === null || transId === undefined) {
throw new RequiredError('transId','Required parameter transId was null or undefined when calling timeInTransit.');
}
// verify required parameter 'transactionSrc' is not null or undefined
if (transactionSrc === null || transactionSrc === undefined) {
throw new RequiredError('transactionSrc','Required parameter transactionSrc was null or undefined when calling timeInTransit.');
}
const localVarPath = `/shipments/{version}/transittimes`
.replace(`{${"version"}}`, encodeURIComponent(String(version)));
const localVarUrlObj = url.parse(localVarPath, true);
const localVarRequestOptions = Object.assign({ method: 'POST' }, options);
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication oauth2 required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("oauth2", [])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
if (transId !== undefined && transId !== null) {
localVarHeaderParameter['transId'] = String(transId);
}
if (transactionSrc !== undefined && transactionSrc !== null) {
localVarHeaderParameter['transactionSrc'] = String(transactionSrc);
}
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"TimeInTransitRequest" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* DefaultApi - functional programming interface
* @export
*/
export const DefaultApiFp = function(configuration?: Configuration) {
return {
/**
*
* @summary Get Time and Transit Response
* @param {TimeInTransitRequest} body Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click "Authorize" and enter your application credentials, then populate the required parameters above and click "Try it out".
* @param {string} version API Version
* @param {string} transId An identifier unique to the request. Length 32
* @param {string} transactionSrc Identifies the clients/source application that is calling. Length 512
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
timeInTransit(body: TimeInTransitRequest, version: string, transId: string, transactionSrc: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<TimeInTransitResponse> {
const localVarFetchArgs = DefaultApiFetchParamCreator(configuration).timeInTransit(body, version, transId, transactionSrc, options);
return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response.json();
} else {
throw response;
}
});
};
},
}
};
/**
* DefaultApi - factory interface
* @export
*/
export const DefaultApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) {
return {
/**
*
* @summary Get Time and Transit Response
* @param {TimeInTransitRequest} body Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click "Authorize" and enter your application credentials, then populate the required parameters above and click "Try it out".
* @param {string} version API Version
* @param {string} transId An identifier unique to the request. Length 32
* @param {string} transactionSrc Identifies the clients/source application that is calling. Length 512
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
timeInTransit(body: TimeInTransitRequest, version: string, transId: string, transactionSrc: string, options?: any) {
return DefaultApiFp(configuration).timeInTransit(body, version, transId, transactionSrc, options)(fetch, basePath);
},
};
};
/**
* DefaultApi - object-oriented interface
* @export
* @class DefaultApi
* @extends {BaseAPI}
*/
export class DefaultApi extends BaseAPI {
/**
*
* @summary Get Time and Transit Response
* @param {TimeInTransitRequest} body Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click "Authorize" and enter your application credentials, then populate the required parameters above and click "Try it out".
* @param {string} version API Version
* @param {string} transId An identifier unique to the request. Length 32
* @param {string} transactionSrc Identifies the clients/source application that is calling. Length 512
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
public timeInTransit(body: TimeInTransitRequest, version: string, transId: string, transactionSrc: string, options?: any) {
return DefaultApiFp(this.configuration).timeInTransit(body, version, transId, transactionSrc, options)(this.fetch, this.basePath);
}
}