@wastesentry/trak-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/.openapi-generator/FILES +120 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/apis/DefaultApi.ts +176 -0
  5. package/apis/InfoApi.ts +80 -0
  6. package/apis/ManifestApi.ts +604 -0
  7. package/apis/MyProfileApi.ts +63 -0
  8. package/apis/OrgsApi.ts +172 -0
  9. package/apis/PegasusApi.ts +336 -0
  10. package/apis/ProfileApi.ts +229 -0
  11. package/apis/SiteApi.ts +108 -0
  12. package/apis/SitesApi.ts +119 -0
  13. package/apis/SyncApi.ts +55 -0
  14. package/apis/TeamsApi.ts +673 -0
  15. package/apis/index.ts +12 -0
  16. package/docs/AdditionalInfo.md +41 -0
  17. package/docs/DefaultApi.md +235 -0
  18. package/docs/ESignature.md +43 -0
  19. package/docs/Handler.md +41 -0
  20. package/docs/HandlerSearch.md +34 -0
  21. package/docs/HandlerSearchSiteTypeEnum.md +31 -0
  22. package/docs/InfoApi.md +81 -0
  23. package/docs/Invitation.md +42 -0
  24. package/docs/LockReasonEnum.md +31 -0
  25. package/docs/Manifest.md +93 -0
  26. package/docs/ManifestApi.md +907 -0
  27. package/docs/ManifestPhone.md +35 -0
  28. package/docs/Membership.md +42 -0
  29. package/docs/Mtn.md +39 -0
  30. package/docs/MyProfileApi.md +73 -0
  31. package/docs/NullEnum.md +30 -0
  32. package/docs/OpenInvitation.md +38 -0
  33. package/docs/Org.md +39 -0
  34. package/docs/OrgsApi.md +232 -0
  35. package/docs/PaginatedInvitationList.md +38 -0
  36. package/docs/PaginatedMtnList.md +38 -0
  37. package/docs/PaginatedOrgList.md +38 -0
  38. package/docs/PaginatedSiteList.md +38 -0
  39. package/docs/PaginatedTeamList.md +38 -0
  40. package/docs/PaperSignature.md +35 -0
  41. package/docs/PatchedInvitation.md +42 -0
  42. package/docs/PatchedProfile.md +35 -0
  43. package/docs/PatchedRcrainfoProfile.md +45 -0
  44. package/docs/PatchedTeam.md +48 -0
  45. package/docs/Price.md +42 -0
  46. package/docs/Profile.md +35 -0
  47. package/docs/ProfileApi.md +241 -0
  48. package/docs/QuickerSign.md +43 -0
  49. package/docs/RcraAddress.md +45 -0
  50. package/docs/RcraContact.md +43 -0
  51. package/docs/RcraPhone.md +35 -0
  52. package/docs/RcraSite.md +57 -0
  53. package/docs/RcraSitePermission.md +45 -0
  54. package/docs/RcraSiteSiteTypeEnum.md +31 -0
  55. package/docs/RcrainfoProfile.md +45 -0
  56. package/docs/RoleEnum.md +31 -0
  57. package/docs/Signer.md +49 -0
  58. package/docs/Site.md +35 -0
  59. package/docs/SiteApi.md +147 -0
  60. package/docs/SiteManifestSyncRequest.md +32 -0
  61. package/docs/SiteManifestSyncResponse.md +32 -0
  62. package/docs/SitesApi.md +155 -0
  63. package/docs/StatusC23Enum.md +31 -0
  64. package/docs/Subscription.md +51 -0
  65. package/docs/SubscriptionItem.md +36 -0
  66. package/docs/SubscriptionStatusEnum.md +31 -0
  67. package/docs/SyncApi.md +73 -0
  68. package/docs/Team.md +48 -0
  69. package/docs/TeamsApi.md +965 -0
  70. package/docs/TrakUser.md +43 -0
  71. package/docs/Transporter.md +41 -0
  72. package/docs/UserInvitationsResponse.md +32 -0
  73. package/docs/WasteLine.md +55 -0
  74. package/index.ts +5 -0
  75. package/models/AdditionalInfo.ts +96 -0
  76. package/models/AggregateEmployeeData.ts +83 -0
  77. package/models/DepartmentEnum.ts +59 -0
  78. package/models/ESignature.ts +112 -0
  79. package/models/Employee.ts +125 -0
  80. package/models/Handler.ts +126 -0
  81. package/models/HandlerSearch.ts +84 -0
  82. package/models/HandlerSearchSiteTypeEnum.ts +57 -0
  83. package/models/Invitation.ts +116 -0
  84. package/models/LockReasonEnum.ts +55 -0
  85. package/models/Manifest.ts +353 -0
  86. package/models/ManifestPhone.ts +73 -0
  87. package/models/Membership.ts +115 -0
  88. package/models/Mtn.ts +98 -0
  89. package/models/NullEnum.ts +50 -0
  90. package/models/OpenInvitation.ts +88 -0
  91. package/models/Org.ts +88 -0
  92. package/models/PaginatedEmployeeList.ts +98 -0
  93. package/models/PaginatedInvitationList.ts +98 -0
  94. package/models/PaginatedMtnList.ts +98 -0
  95. package/models/PaginatedOrgList.ts +98 -0
  96. package/models/PaginatedSiteList.ts +98 -0
  97. package/models/PaginatedTeamList.ts +98 -0
  98. package/models/PaperSignature.ts +74 -0
  99. package/models/PatchedEmployee.ts +118 -0
  100. package/models/PatchedInvitation.ts +112 -0
  101. package/models/PatchedProfile.ts +79 -0
  102. package/models/PatchedRcrainfoProfile.ts +119 -0
  103. package/models/PatchedTeam.ts +143 -0
  104. package/models/Price.ts +106 -0
  105. package/models/Profile.ts +80 -0
  106. package/models/QuickerSign.ts +108 -0
  107. package/models/RcraAddress.ts +113 -0
  108. package/models/RcraContact.ts +112 -0
  109. package/models/RcraPhone.ts +73 -0
  110. package/models/RcraSite.ts +200 -0
  111. package/models/RcraSitePermission.ts +121 -0
  112. package/models/RcraSiteSiteTypeEnum.ts +57 -0
  113. package/models/RcrainfoProfile.ts +120 -0
  114. package/models/RoleEnum.ts +53 -0
  115. package/models/Signer.ts +136 -0
  116. package/models/Site.ts +81 -0
  117. package/models/SiteManifestSyncRequest.ts +65 -0
  118. package/models/SiteManifestSyncResponse.ts +65 -0
  119. package/models/StatusC23Enum.ts +67 -0
  120. package/models/StatusEnum.ts +63 -0
  121. package/models/Subscription.ts +168 -0
  122. package/models/SubscriptionItem.ts +90 -0
  123. package/models/SubscriptionStatusEnum.ts +63 -0
  124. package/models/Team.ts +151 -0
  125. package/models/TrakUser.ts +106 -0
  126. package/models/Transporter.ts +120 -0
  127. package/models/UserInvitationsResponse.ts +73 -0
  128. package/models/WasteLine.ts +157 -0
  129. package/models/index.ts +50 -0
  130. package/package.json +17 -0
  131. package/runtime.ts +432 -0
@@ -0,0 +1,136 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * trak
5
+ * Hazardous waste tracking application
6
+ *
7
+ * The version of the OpenAPI document: 0.7.2
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { RcraPhone } from './RcraPhone';
17
+ import {
18
+ RcraPhoneFromJSON,
19
+ RcraPhoneFromJSONTyped,
20
+ RcraPhoneToJSON,
21
+ RcraPhoneToJSONTyped,
22
+ } from './RcraPhone';
23
+
24
+ /**
25
+ * Serializer for EPA Signer Object.
26
+ * @export
27
+ * @interface Signer
28
+ */
29
+ export interface Signer {
30
+ /**
31
+ *
32
+ * @type {string}
33
+ * @memberof Signer
34
+ */
35
+ userId?: string;
36
+ /**
37
+ *
38
+ * @type {string}
39
+ * @memberof Signer
40
+ */
41
+ firstName?: string;
42
+ /**
43
+ *
44
+ * @type {string}
45
+ * @memberof Signer
46
+ */
47
+ middleInitial?: string;
48
+ /**
49
+ *
50
+ * @type {string}
51
+ * @memberof Signer
52
+ */
53
+ lastName?: string;
54
+ /**
55
+ *
56
+ * @type {RcraPhone}
57
+ * @memberof Signer
58
+ */
59
+ phone?: RcraPhone;
60
+ /**
61
+ *
62
+ * @type {string}
63
+ * @memberof Signer
64
+ */
65
+ email?: string;
66
+ /**
67
+ *
68
+ * @type {string}
69
+ * @memberof Signer
70
+ */
71
+ contactType?: string;
72
+ /**
73
+ *
74
+ * @type {string}
75
+ * @memberof Signer
76
+ */
77
+ companyName?: string;
78
+ /**
79
+ *
80
+ * @type {string}
81
+ * @memberof Signer
82
+ */
83
+ signerRole?: string;
84
+ }
85
+
86
+ /**
87
+ * Check if a given object implements the Signer interface.
88
+ */
89
+ export function instanceOfSigner(value: object): value is Signer {
90
+ return true;
91
+ }
92
+
93
+ export function SignerFromJSON(json: any): Signer {
94
+ return SignerFromJSONTyped(json, false);
95
+ }
96
+
97
+ export function SignerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Signer {
98
+ if (json == null) {
99
+ return json;
100
+ }
101
+ return {
102
+
103
+ 'userId': json['userId'] == null ? undefined : json['userId'],
104
+ 'firstName': json['firstName'] == null ? undefined : json['firstName'],
105
+ 'middleInitial': json['middleInitial'] == null ? undefined : json['middleInitial'],
106
+ 'lastName': json['lastName'] == null ? undefined : json['lastName'],
107
+ 'phone': json['phone'] == null ? undefined : RcraPhoneFromJSON(json['phone']),
108
+ 'email': json['email'] == null ? undefined : json['email'],
109
+ 'contactType': json['contactType'] == null ? undefined : json['contactType'],
110
+ 'companyName': json['companyName'] == null ? undefined : json['companyName'],
111
+ 'signerRole': json['signerRole'] == null ? undefined : json['signerRole'],
112
+ };
113
+ }
114
+
115
+ export function SignerToJSON(json: any): Signer {
116
+ return SignerToJSONTyped(json, false);
117
+ }
118
+
119
+ export function SignerToJSONTyped(value?: Signer | null, ignoreDiscriminator: boolean = false): any {
120
+ if (value == null) {
121
+ return value;
122
+ }
123
+
124
+ return {
125
+
126
+ 'userId': value['userId'],
127
+ 'firstName': value['firstName'],
128
+ 'middleInitial': value['middleInitial'],
129
+ 'lastName': value['lastName'],
130
+ 'phone': RcraPhoneToJSON(value['phone']),
131
+ 'email': value['email'],
132
+ 'contactType': value['contactType'],
133
+ 'companyName': value['companyName'],
134
+ 'signerRole': value['signerRole'],
135
+ };
136
+ }
package/models/Site.ts ADDED
@@ -0,0 +1,81 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * trak
5
+ * Hazardous waste tracking application
6
+ *
7
+ * The version of the OpenAPI document: 0.7.2
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { RcraSite } from './RcraSite';
17
+ import {
18
+ RcraSiteFromJSON,
19
+ RcraSiteFromJSONTyped,
20
+ RcraSiteToJSON,
21
+ RcraSiteToJSONTyped,
22
+ } from './RcraSite';
23
+
24
+ /**
25
+ * Site model serializer for JSON marshalling/unmarshalling.
26
+ * @export
27
+ * @interface Site
28
+ */
29
+ export interface Site {
30
+ /**
31
+ *
32
+ * @type {string}
33
+ * @memberof Site
34
+ */
35
+ name?: string;
36
+ /**
37
+ *
38
+ * @type {RcraSite}
39
+ * @memberof Site
40
+ */
41
+ handler: RcraSite;
42
+ }
43
+
44
+ /**
45
+ * Check if a given object implements the Site interface.
46
+ */
47
+ export function instanceOfSite(value: object): value is Site {
48
+ if (!('handler' in value) || value['handler'] === undefined) return false;
49
+ return true;
50
+ }
51
+
52
+ export function SiteFromJSON(json: any): Site {
53
+ return SiteFromJSONTyped(json, false);
54
+ }
55
+
56
+ export function SiteFromJSONTyped(json: any, ignoreDiscriminator: boolean): Site {
57
+ if (json == null) {
58
+ return json;
59
+ }
60
+ return {
61
+
62
+ 'name': json['name'] == null ? undefined : json['name'],
63
+ 'handler': RcraSiteFromJSON(json['handler']),
64
+ };
65
+ }
66
+
67
+ export function SiteToJSON(json: any): Site {
68
+ return SiteToJSONTyped(json, false);
69
+ }
70
+
71
+ export function SiteToJSONTyped(value?: Site | null, ignoreDiscriminator: boolean = false): any {
72
+ if (value == null) {
73
+ return value;
74
+ }
75
+
76
+ return {
77
+
78
+ 'name': value['name'],
79
+ 'handler': RcraSiteToJSON(value['handler']),
80
+ };
81
+ }
@@ -0,0 +1,65 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * trak
5
+ * Hazardous waste tracking application
6
+ *
7
+ * The version of the OpenAPI document: 0.7.2
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface SiteManifestSyncRequest
20
+ */
21
+ export interface SiteManifestSyncRequest {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof SiteManifestSyncRequest
26
+ */
27
+ siteId: string;
28
+ }
29
+
30
+ /**
31
+ * Check if a given object implements the SiteManifestSyncRequest interface.
32
+ */
33
+ export function instanceOfSiteManifestSyncRequest(value: object): value is SiteManifestSyncRequest {
34
+ if (!('siteId' in value) || value['siteId'] === undefined) return false;
35
+ return true;
36
+ }
37
+
38
+ export function SiteManifestSyncRequestFromJSON(json: any): SiteManifestSyncRequest {
39
+ return SiteManifestSyncRequestFromJSONTyped(json, false);
40
+ }
41
+
42
+ export function SiteManifestSyncRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SiteManifestSyncRequest {
43
+ if (json == null) {
44
+ return json;
45
+ }
46
+ return {
47
+
48
+ 'siteId': json['siteId'],
49
+ };
50
+ }
51
+
52
+ export function SiteManifestSyncRequestToJSON(json: any): SiteManifestSyncRequest {
53
+ return SiteManifestSyncRequestToJSONTyped(json, false);
54
+ }
55
+
56
+ export function SiteManifestSyncRequestToJSONTyped(value?: SiteManifestSyncRequest | null, ignoreDiscriminator: boolean = false): any {
57
+ if (value == null) {
58
+ return value;
59
+ }
60
+
61
+ return {
62
+
63
+ 'siteId': value['siteId'],
64
+ };
65
+ }
@@ -0,0 +1,65 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * trak
5
+ * Hazardous waste tracking application
6
+ *
7
+ * The version of the OpenAPI document: 0.7.2
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface SiteManifestSyncResponse
20
+ */
21
+ export interface SiteManifestSyncResponse {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof SiteManifestSyncResponse
26
+ */
27
+ task: string;
28
+ }
29
+
30
+ /**
31
+ * Check if a given object implements the SiteManifestSyncResponse interface.
32
+ */
33
+ export function instanceOfSiteManifestSyncResponse(value: object): value is SiteManifestSyncResponse {
34
+ if (!('task' in value) || value['task'] === undefined) return false;
35
+ return true;
36
+ }
37
+
38
+ export function SiteManifestSyncResponseFromJSON(json: any): SiteManifestSyncResponse {
39
+ return SiteManifestSyncResponseFromJSONTyped(json, false);
40
+ }
41
+
42
+ export function SiteManifestSyncResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SiteManifestSyncResponse {
43
+ if (json == null) {
44
+ return json;
45
+ }
46
+ return {
47
+
48
+ 'task': json['task'],
49
+ };
50
+ }
51
+
52
+ export function SiteManifestSyncResponseToJSON(json: any): SiteManifestSyncResponse {
53
+ return SiteManifestSyncResponseToJSONTyped(json, false);
54
+ }
55
+
56
+ export function SiteManifestSyncResponseToJSONTyped(value?: SiteManifestSyncResponse | null, ignoreDiscriminator: boolean = false): any {
57
+ if (value == null) {
58
+ return value;
59
+ }
60
+
61
+ return {
62
+
63
+ 'task': value['task'],
64
+ };
65
+ }
@@ -0,0 +1,67 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * trak
5
+ * Hazardous waste tracking application
6
+ *
7
+ * The version of the OpenAPI document: 0.7.2
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ /**
17
+ * * `NotAssigned` - Not Assigned
18
+ * * `Pending` - Pending
19
+ * * `Scheduled` - Scheduled
20
+ * * `InTransit` - In Transit
21
+ * * `ReadyForSignature` - Ready for Signature
22
+ * * `Signed` - Signed
23
+ * * `Corrected` - Corrected
24
+ * * `UnderCorrection` - Under Correction
25
+ * * `MtnValidationFailed` - MTN Validation Failed
26
+ * @export
27
+ */
28
+ export const StatusC23Enum = {
29
+ NotAssigned: 'NotAssigned',
30
+ Pending: 'Pending',
31
+ Scheduled: 'Scheduled',
32
+ InTransit: 'InTransit',
33
+ ReadyForSignature: 'ReadyForSignature',
34
+ Signed: 'Signed',
35
+ Corrected: 'Corrected',
36
+ UnderCorrection: 'UnderCorrection',
37
+ MtnValidationFailed: 'MtnValidationFailed'
38
+ } as const;
39
+ export type StatusC23Enum = typeof StatusC23Enum[keyof typeof StatusC23Enum];
40
+
41
+
42
+ export function instanceOfStatusC23Enum(value: any): boolean {
43
+ for (const key in StatusC23Enum) {
44
+ if (Object.prototype.hasOwnProperty.call(StatusC23Enum, key)) {
45
+ if (StatusC23Enum[key as keyof typeof StatusC23Enum] === value) {
46
+ return true;
47
+ }
48
+ }
49
+ }
50
+ return false;
51
+ }
52
+
53
+ export function StatusC23EnumFromJSON(json: any): StatusC23Enum {
54
+ return StatusC23EnumFromJSONTyped(json, false);
55
+ }
56
+
57
+ export function StatusC23EnumFromJSONTyped(json: any, ignoreDiscriminator: boolean): StatusC23Enum {
58
+ return json as StatusC23Enum;
59
+ }
60
+
61
+ export function StatusC23EnumToJSON(value?: StatusC23Enum | null): any {
62
+ return value as any;
63
+ }
64
+
65
+ export function StatusC23EnumToJSONTyped(value: any, ignoreDiscriminator: boolean): StatusC23Enum {
66
+ return value as StatusC23Enum;
67
+ }
@@ -0,0 +1,63 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * trak
5
+ * Hazardous waste tracking application
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ /**
17
+ * * `active` - Active
18
+ * * `canceled` - Canceled
19
+ * * `incomplete` - Incomplete
20
+ * * `incomplete_expired` - Incomplete Expired
21
+ * * `past_due` - Past due
22
+ * * `trialing` - Trialing
23
+ * * `unpaid` - Unpaid
24
+ * @export
25
+ */
26
+ export const StatusEnum = {
27
+ Active: 'active',
28
+ Canceled: 'canceled',
29
+ Incomplete: 'incomplete',
30
+ IncompleteExpired: 'incomplete_expired',
31
+ PastDue: 'past_due',
32
+ Trialing: 'trialing',
33
+ Unpaid: 'unpaid'
34
+ } as const;
35
+ export type StatusEnum = typeof StatusEnum[keyof typeof StatusEnum];
36
+
37
+
38
+ export function instanceOfStatusEnum(value: any): boolean {
39
+ for (const key in StatusEnum) {
40
+ if (Object.prototype.hasOwnProperty.call(StatusEnum, key)) {
41
+ if (StatusEnum[key as keyof typeof StatusEnum] === value) {
42
+ return true;
43
+ }
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+
49
+ export function StatusEnumFromJSON(json: any): StatusEnum {
50
+ return StatusEnumFromJSONTyped(json, false);
51
+ }
52
+
53
+ export function StatusEnumFromJSONTyped(json: any, ignoreDiscriminator: boolean): StatusEnum {
54
+ return json as StatusEnum;
55
+ }
56
+
57
+ export function StatusEnumToJSON(value?: StatusEnum | null): any {
58
+ return value as any;
59
+ }
60
+
61
+ export function StatusEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): StatusEnum {
62
+ return value as StatusEnum;
63
+ }
@@ -0,0 +1,168 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * trak
5
+ * Hazardous waste tracking application
6
+ *
7
+ * The version of the OpenAPI document: 0.7.2
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { SubscriptionItem } from './SubscriptionItem';
17
+ import {
18
+ SubscriptionItemFromJSON,
19
+ SubscriptionItemFromJSONTyped,
20
+ SubscriptionItemToJSON,
21
+ SubscriptionItemToJSONTyped,
22
+ } from './SubscriptionItem';
23
+ import type { SubscriptionStatusEnum } from './SubscriptionStatusEnum';
24
+ import {
25
+ SubscriptionStatusEnumFromJSON,
26
+ SubscriptionStatusEnumFromJSONTyped,
27
+ SubscriptionStatusEnumToJSON,
28
+ SubscriptionStatusEnumToJSONTyped,
29
+ } from './SubscriptionStatusEnum';
30
+
31
+ /**
32
+ * A serializer for Subscriptions which uses the SubscriptionWrapper object under the hood
33
+ * @export
34
+ * @interface Subscription
35
+ */
36
+ export interface Subscription {
37
+ /**
38
+ *
39
+ * @type {string}
40
+ * @memberof Subscription
41
+ */
42
+ id: string;
43
+ /**
44
+ *
45
+ * @type {string}
46
+ * @memberof Subscription
47
+ */
48
+ displayName: string;
49
+ /**
50
+ * Date when the subscription was first created. The date might differ from the created date due to backdating.
51
+ * @type {Date}
52
+ * @memberof Subscription
53
+ */
54
+ startDate?: Date | null;
55
+ /**
56
+ *
57
+ * @type {string}
58
+ * @memberof Subscription
59
+ */
60
+ billingInterval: string;
61
+ /**
62
+ * Start of the current period for which the subscription has been invoiced.
63
+ * @type {Date}
64
+ * @memberof Subscription
65
+ */
66
+ currentPeriodStart: Date;
67
+ /**
68
+ * End of the current period for which the subscription has been invoiced. At the end of this period, a new invoice will be created.
69
+ * @type {Date}
70
+ * @memberof Subscription
71
+ */
72
+ currentPeriodEnd: Date;
73
+ /**
74
+ * If the subscription has been canceled with the ``at_period_end`` flag set to true, ``cancel_at_period_end`` on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.
75
+ * @type {boolean}
76
+ * @memberof Subscription
77
+ */
78
+ cancelAtPeriodEnd?: boolean;
79
+ /**
80
+ * The status of this subscription.
81
+ *
82
+ * * `active` - Active
83
+ * * `canceled` - Canceled
84
+ * * `incomplete` - Incomplete
85
+ * * `incomplete_expired` - Incomplete Expired
86
+ * * `past_due` - Past due
87
+ * * `trialing` - Trialing
88
+ * * `unpaid` - Unpaid
89
+ * @type {SubscriptionStatusEnum}
90
+ * @memberof Subscription
91
+ */
92
+ status: SubscriptionStatusEnum;
93
+ /**
94
+ * The quantity applied to this subscription. This value will be `null` for multi-plan subscriptions
95
+ * @type {number}
96
+ * @memberof Subscription
97
+ */
98
+ quantity?: number | null;
99
+ /**
100
+ *
101
+ * @type {Array<SubscriptionItem>}
102
+ * @memberof Subscription
103
+ */
104
+ items: Array<SubscriptionItem>;
105
+ }
106
+
107
+
108
+
109
+ /**
110
+ * Check if a given object implements the Subscription interface.
111
+ */
112
+ export function instanceOfSubscription(value: object): value is Subscription {
113
+ if (!('id' in value) || value['id'] === undefined) return false;
114
+ if (!('displayName' in value) || value['displayName'] === undefined) return false;
115
+ if (!('billingInterval' in value) || value['billingInterval'] === undefined) return false;
116
+ if (!('currentPeriodStart' in value) || value['currentPeriodStart'] === undefined) return false;
117
+ if (!('currentPeriodEnd' in value) || value['currentPeriodEnd'] === undefined) return false;
118
+ if (!('status' in value) || value['status'] === undefined) return false;
119
+ if (!('items' in value) || value['items'] === undefined) return false;
120
+ return true;
121
+ }
122
+
123
+ export function SubscriptionFromJSON(json: any): Subscription {
124
+ return SubscriptionFromJSONTyped(json, false);
125
+ }
126
+
127
+ export function SubscriptionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Subscription {
128
+ if (json == null) {
129
+ return json;
130
+ }
131
+ return {
132
+
133
+ 'id': json['id'],
134
+ 'displayName': json['display_name'],
135
+ 'startDate': json['start_date'] == null ? undefined : (new Date(json['start_date'])),
136
+ 'billingInterval': json['billing_interval'],
137
+ 'currentPeriodStart': (new Date(json['current_period_start'])),
138
+ 'currentPeriodEnd': (new Date(json['current_period_end'])),
139
+ 'cancelAtPeriodEnd': json['cancel_at_period_end'] == null ? undefined : json['cancel_at_period_end'],
140
+ 'status': SubscriptionStatusEnumFromJSON(json['status']),
141
+ 'quantity': json['quantity'] == null ? undefined : json['quantity'],
142
+ 'items': ((json['items'] as Array<any>).map(SubscriptionItemFromJSON)),
143
+ };
144
+ }
145
+
146
+ export function SubscriptionToJSON(json: any): Subscription {
147
+ return SubscriptionToJSONTyped(json, false);
148
+ }
149
+
150
+ export function SubscriptionToJSONTyped(value?: Subscription | null, ignoreDiscriminator: boolean = false): any {
151
+ if (value == null) {
152
+ return value;
153
+ }
154
+
155
+ return {
156
+
157
+ 'id': value['id'],
158
+ 'display_name': value['displayName'],
159
+ 'start_date': value['startDate'] == null ? value['startDate'] : value['startDate'].toISOString(),
160
+ 'billing_interval': value['billingInterval'],
161
+ 'current_period_start': value['currentPeriodStart'].toISOString(),
162
+ 'current_period_end': value['currentPeriodEnd'].toISOString(),
163
+ 'cancel_at_period_end': value['cancelAtPeriodEnd'],
164
+ 'status': SubscriptionStatusEnumToJSON(value['status']),
165
+ 'quantity': value['quantity'],
166
+ 'items': ((value['items'] as Array<any>).map(SubscriptionItemToJSON)),
167
+ };
168
+ }