@kanmon/sdk 2.0.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.
- package/README.md +2 -0
- package/package.json +45 -0
- package/src/index.ts +65 -0
- package/src/openapi/.openapi-generator/FILES +130 -0
- package/src/openapi/.openapi-generator/VERSION +1 -0
- package/src/openapi/.openapi-generator-ignore +30 -0
- package/src/openapi/apis/BankAccountsApi.ts +503 -0
- package/src/openapi/apis/BusinessesApi.ts +614 -0
- package/src/openapi/apis/ConnectTokensApi.ts +133 -0
- package/src/openapi/apis/DocumentsApi.ts +150 -0
- package/src/openapi/apis/DrawRequestsApi.ts +258 -0
- package/src/openapi/apis/EmbeddedSessionsApi.ts +141 -0
- package/src/openapi/apis/InvoicesApi.ts +272 -0
- package/src/openapi/apis/IssuedProductsApi.ts +251 -0
- package/src/openapi/apis/OffersApi.ts +251 -0
- package/src/openapi/apis/PaymentsApi.ts +268 -0
- package/src/openapi/apis/PrequalificationsApi.ts +141 -0
- package/src/openapi/apis/UsersApi.ts +622 -0
- package/src/openapi/apis/baseapi.ts +37 -0
- package/src/openapi/apis/exception.ts +15 -0
- package/src/openapi/auth/auth.ts +79 -0
- package/src/openapi/configuration.ts +82 -0
- package/src/openapi/http/http.ts +247 -0
- package/src/openapi/http/isomorphic-fetch.ts +32 -0
- package/src/openapi/index.ts +12 -0
- package/src/openapi/middleware.ts +66 -0
- package/src/openapi/models/ActivityLog.ts +98 -0
- package/src/openapi/models/Address.ts +140 -0
- package/src/openapi/models/BadRequestException.ts +63 -0
- package/src/openapi/models/BankAccountAlreadyExistException.ts +63 -0
- package/src/openapi/models/BankAccountNotFoundException.ts +63 -0
- package/src/openapi/models/BankStatementsInvalidException.ts +63 -0
- package/src/openapi/models/Business.ts +126 -0
- package/src/openapi/models/BusinessAddress.ts +143 -0
- package/src/openapi/models/BusinessAlreadyExistsException.ts +63 -0
- package/src/openapi/models/BusinessBankAccount.ts +126 -0
- package/src/openapi/models/BusinessDocument.ts +98 -0
- package/src/openapi/models/BusinessDocumentType.ts +17 -0
- package/src/openapi/models/BusinessHasNoInvoiceFinancingProductException.ts +63 -0
- package/src/openapi/models/BusinessHasNoPrimaryOwnerException.ts +63 -0
- package/src/openapi/models/BusinessNotFoundException.ts +63 -0
- package/src/openapi/models/BusinessPlaidBankAccountNotFoundException.ts +63 -0
- package/src/openapi/models/BusinessPrequalification.ts +116 -0
- package/src/openapi/models/CheckingAccountRequiredException.ts +63 -0
- package/src/openapi/models/ConnectToken.ts +38 -0
- package/src/openapi/models/CreateBusinessBankAccountRequestBody.ts +116 -0
- package/src/openapi/models/CreateBusinessDocumentsResponse.ts +39 -0
- package/src/openapi/models/CreateBusinessRequestBody.ts +99 -0
- package/src/openapi/models/CreateConnectTokenRequestBody.ts +48 -0
- package/src/openapi/models/CreateEmbeddedSession409Response.ts +65 -0
- package/src/openapi/models/CreateSessionTokenRequestBody.ts +56 -0
- package/src/openapi/models/CreateSessionTokenRequestBodyData.ts +56 -0
- package/src/openapi/models/CreateUser409Response.ts +66 -0
- package/src/openapi/models/CreateUserRequestBody.ts +125 -0
- package/src/openapi/models/DrawRequest.ts +138 -0
- package/src/openapi/models/DrawRequestNotFoundException.ts +63 -0
- package/src/openapi/models/DrawRequestState.ts +21 -0
- package/src/openapi/models/EmbeddedSession.ts +38 -0
- package/src/openapi/models/FixedDateInvoiceRepaymentWindow.ts +50 -0
- package/src/openapi/models/FixedDurationInvoiceRepaymentWindow.ts +50 -0
- package/src/openapi/models/ForbiddenException.ts +63 -0
- package/src/openapi/models/GetActivityLogsResponse.ts +50 -0
- package/src/openapi/models/GetBusinessBankAccountsResponse.ts +50 -0
- package/src/openapi/models/GetBusinessesResponse.ts +50 -0
- package/src/openapi/models/GetDrawRequestsResponse.ts +50 -0
- package/src/openapi/models/GetInvoice404Response.ts +65 -0
- package/src/openapi/models/GetInvoicesResponse.ts +50 -0
- package/src/openapi/models/GetIssuedProductsResponse.ts +50 -0
- package/src/openapi/models/GetOffersResponse.ts +50 -0
- package/src/openapi/models/GetPaymentScheduleResponse.ts +50 -0
- package/src/openapi/models/GetPrequalificationsResponse.ts +50 -0
- package/src/openapi/models/GetUsersResponse.ts +50 -0
- package/src/openapi/models/InternalServerErrorException.ts +63 -0
- package/src/openapi/models/InvalidInvoiceDueDateException.ts +63 -0
- package/src/openapi/models/Invoice.ts +281 -0
- package/src/openapi/models/InvoiceFinancingOfferTerms.ts +61 -0
- package/src/openapi/models/InvoiceFinancingServicingData.ts +71 -0
- package/src/openapi/models/InvoiceFlowSessionTokenData.ts +51 -0
- package/src/openapi/models/InvoiceFlowWithInvoiceFileSessionTokenData.ts +51 -0
- package/src/openapi/models/InvoiceNotFoundException.ts +63 -0
- package/src/openapi/models/InvoicePaymentPlan.ts +58 -0
- package/src/openapi/models/InvoicePayorAddress.ts +143 -0
- package/src/openapi/models/InvoiceRepaymentSchedule.ts +39 -0
- package/src/openapi/models/InvoiceRepaymentScheduleItem.ts +68 -0
- package/src/openapi/models/InvoiceStatus.ts +22 -0
- package/src/openapi/models/IssuedProduct.ts +115 -0
- package/src/openapi/models/IssuedProductNotFoundException.ts +63 -0
- package/src/openapi/models/IssuedProductServicingData.ts +234 -0
- package/src/openapi/models/LineOfCreditOfferTerms.ts +80 -0
- package/src/openapi/models/LineOfCreditServicingData.ts +90 -0
- package/src/openapi/models/McaOfferTerms.ts +96 -0
- package/src/openapi/models/McaServicingData.ts +116 -0
- package/src/openapi/models/MergeUsersRequestBody.ts +68 -0
- package/src/openapi/models/MergeUsersResponseBody.ts +39 -0
- package/src/openapi/models/MultipleDurationInvoiceRepaymentWindow.ts +48 -0
- package/src/openapi/models/ObjectSerializer.ts +643 -0
- package/src/openapi/models/Offer.ts +106 -0
- package/src/openapi/models/OfferAlreadySelectedException.ts +63 -0
- package/src/openapi/models/OfferNotFoundException.ts +63 -0
- package/src/openapi/models/OfferNotLockedException.ts +63 -0
- package/src/openapi/models/OfferTerms.ts +184 -0
- package/src/openapi/models/PaginationResult.ts +58 -0
- package/src/openapi/models/PaymentOrder.ts +198 -0
- package/src/openapi/models/PaymentOrderNotFoundException.ts +63 -0
- package/src/openapi/models/PaymentOrderStatus.ts +19 -0
- package/src/openapi/models/PaymentPlanRepaymentSchedule.ts +39 -0
- package/src/openapi/models/PaymentPlanRepaymentScheduleItem.ts +48 -0
- package/src/openapi/models/PaymentScheduleItem.ts +56 -0
- package/src/openapi/models/PaymentScheduleItemPaymentOrder.ts +201 -0
- package/src/openapi/models/PlaidAssetReportsInvalidException.ts +63 -0
- package/src/openapi/models/PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException.ts +63 -0
- package/src/openapi/models/PrimaryBusinessOwnerAlreadyExistsForBusinessException.ts +63 -0
- package/src/openapi/models/PrimaryBusinessOwnerAlreadyExistsWithEmailException.ts +63 -0
- package/src/openapi/models/PrimaryBusinessOwnerNotFoundException.ts +63 -0
- package/src/openapi/models/SessionInvoice.ts +165 -0
- package/src/openapi/models/SessionInvoiceWithInvoiceFile.ts +175 -0
- package/src/openapi/models/SomeOffersHaveExpiredException.ts +63 -0
- package/src/openapi/models/TermLoanOfferTerms.ts +90 -0
- package/src/openapi/models/TermLoanServicingData.ts +100 -0
- package/src/openapi/models/UnmergeableBusinessException.ts +63 -0
- package/src/openapi/models/UpdateBusinessAccountRequestBody.ts +68 -0
- package/src/openapi/models/UpdateBusinessRequestBody.ts +99 -0
- package/src/openapi/models/UpdateUser409Response.ts +65 -0
- package/src/openapi/models/UpdateUserRequestBody.ts +95 -0
- package/src/openapi/models/User.ts +152 -0
- package/src/openapi/models/UserAddress.ts +143 -0
- package/src/openapi/models/UserAlreadyExistsWithEmailException.ts +63 -0
- package/src/openapi/models/UserAlreadyExistsWithPlatformUserIdException.ts +63 -0
- package/src/openapi/models/UserNotFoundException.ts +63 -0
- package/src/openapi/models/all.ts +102 -0
- package/src/openapi/rxjsStub.ts +27 -0
- package/src/openapi/servers.ts +58 -0
- package/src/openapi/types/ObjectParamAPI.ts +1403 -0
- package/src/openapi/types/ObservableAPI.ts +1348 -0
- package/src/openapi/types/PromiseAPI.ts +995 -0
- package/src/openapi/util.ts +37 -0
- package/tsconfig.json +32 -0
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
export * from '../models/ActivityLog';
|
|
2
|
+
export * from '../models/Address';
|
|
3
|
+
export * from '../models/BadRequestException';
|
|
4
|
+
export * from '../models/BankAccountAlreadyExistException';
|
|
5
|
+
export * from '../models/BankAccountNotFoundException';
|
|
6
|
+
export * from '../models/BankStatementsInvalidException';
|
|
7
|
+
export * from '../models/Business';
|
|
8
|
+
export * from '../models/BusinessAddress';
|
|
9
|
+
export * from '../models/BusinessAlreadyExistsException';
|
|
10
|
+
export * from '../models/BusinessBankAccount';
|
|
11
|
+
export * from '../models/BusinessDocument';
|
|
12
|
+
export * from '../models/BusinessDocumentType';
|
|
13
|
+
export * from '../models/BusinessHasNoInvoiceFinancingProductException';
|
|
14
|
+
export * from '../models/BusinessHasNoPrimaryOwnerException';
|
|
15
|
+
export * from '../models/BusinessNotFoundException';
|
|
16
|
+
export * from '../models/BusinessPlaidBankAccountNotFoundException';
|
|
17
|
+
export * from '../models/BusinessPrequalification';
|
|
18
|
+
export * from '../models/CheckingAccountRequiredException';
|
|
19
|
+
export * from '../models/ConnectToken';
|
|
20
|
+
export * from '../models/CreateBusinessBankAccountRequestBody';
|
|
21
|
+
export * from '../models/CreateBusinessDocumentsResponse';
|
|
22
|
+
export * from '../models/CreateBusinessRequestBody';
|
|
23
|
+
export * from '../models/CreateConnectTokenRequestBody';
|
|
24
|
+
export * from '../models/CreateEmbeddedSession409Response';
|
|
25
|
+
export * from '../models/CreateSessionTokenRequestBody';
|
|
26
|
+
export * from '../models/CreateSessionTokenRequestBodyData';
|
|
27
|
+
export * from '../models/CreateUser409Response';
|
|
28
|
+
export * from '../models/CreateUserRequestBody';
|
|
29
|
+
export * from '../models/DrawRequest';
|
|
30
|
+
export * from '../models/DrawRequestNotFoundException';
|
|
31
|
+
export * from '../models/DrawRequestState';
|
|
32
|
+
export * from '../models/EmbeddedSession';
|
|
33
|
+
export * from '../models/FixedDateInvoiceRepaymentWindow';
|
|
34
|
+
export * from '../models/FixedDurationInvoiceRepaymentWindow';
|
|
35
|
+
export * from '../models/ForbiddenException';
|
|
36
|
+
export * from '../models/GetActivityLogsResponse';
|
|
37
|
+
export * from '../models/GetBusinessBankAccountsResponse';
|
|
38
|
+
export * from '../models/GetBusinessesResponse';
|
|
39
|
+
export * from '../models/GetDrawRequestsResponse';
|
|
40
|
+
export * from '../models/GetInvoice404Response';
|
|
41
|
+
export * from '../models/GetInvoicesResponse';
|
|
42
|
+
export * from '../models/GetIssuedProductsResponse';
|
|
43
|
+
export * from '../models/GetOffersResponse';
|
|
44
|
+
export * from '../models/GetPaymentScheduleResponse';
|
|
45
|
+
export * from '../models/GetPrequalificationsResponse';
|
|
46
|
+
export * from '../models/GetUsersResponse';
|
|
47
|
+
export * from '../models/InternalServerErrorException';
|
|
48
|
+
export * from '../models/InvalidInvoiceDueDateException';
|
|
49
|
+
export * from '../models/Invoice';
|
|
50
|
+
export * from '../models/InvoiceFinancingOfferTerms';
|
|
51
|
+
export * from '../models/InvoiceFinancingServicingData';
|
|
52
|
+
export * from '../models/InvoiceFlowSessionTokenData';
|
|
53
|
+
export * from '../models/InvoiceFlowWithInvoiceFileSessionTokenData';
|
|
54
|
+
export * from '../models/InvoiceNotFoundException';
|
|
55
|
+
export * from '../models/InvoicePaymentPlan';
|
|
56
|
+
export * from '../models/InvoicePayorAddress';
|
|
57
|
+
export * from '../models/InvoiceRepaymentSchedule';
|
|
58
|
+
export * from '../models/InvoiceRepaymentScheduleItem';
|
|
59
|
+
export * from '../models/InvoiceStatus';
|
|
60
|
+
export * from '../models/IssuedProduct';
|
|
61
|
+
export * from '../models/IssuedProductNotFoundException';
|
|
62
|
+
export * from '../models/IssuedProductServicingData';
|
|
63
|
+
export * from '../models/LineOfCreditOfferTerms';
|
|
64
|
+
export * from '../models/LineOfCreditServicingData';
|
|
65
|
+
export * from '../models/McaOfferTerms';
|
|
66
|
+
export * from '../models/McaServicingData';
|
|
67
|
+
export * from '../models/MergeUsersRequestBody';
|
|
68
|
+
export * from '../models/MergeUsersResponseBody';
|
|
69
|
+
export * from '../models/MultipleDurationInvoiceRepaymentWindow';
|
|
70
|
+
export * from '../models/Offer';
|
|
71
|
+
export * from '../models/OfferAlreadySelectedException';
|
|
72
|
+
export * from '../models/OfferNotFoundException';
|
|
73
|
+
export * from '../models/OfferNotLockedException';
|
|
74
|
+
export * from '../models/OfferTerms';
|
|
75
|
+
export * from '../models/PaginationResult';
|
|
76
|
+
export * from '../models/PaymentOrder';
|
|
77
|
+
export * from '../models/PaymentOrderNotFoundException';
|
|
78
|
+
export * from '../models/PaymentOrderStatus';
|
|
79
|
+
export * from '../models/PaymentPlanRepaymentSchedule';
|
|
80
|
+
export * from '../models/PaymentPlanRepaymentScheduleItem';
|
|
81
|
+
export * from '../models/PaymentScheduleItem';
|
|
82
|
+
export * from '../models/PaymentScheduleItemPaymentOrder';
|
|
83
|
+
export * from '../models/PlaidAssetReportsInvalidException';
|
|
84
|
+
export * from '../models/PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException';
|
|
85
|
+
export * from '../models/PrimaryBusinessOwnerAlreadyExistsForBusinessException';
|
|
86
|
+
export * from '../models/PrimaryBusinessOwnerAlreadyExistsWithEmailException';
|
|
87
|
+
export * from '../models/PrimaryBusinessOwnerNotFoundException';
|
|
88
|
+
export * from '../models/SessionInvoice';
|
|
89
|
+
export * from '../models/SessionInvoiceWithInvoiceFile';
|
|
90
|
+
export * from '../models/SomeOffersHaveExpiredException';
|
|
91
|
+
export * from '../models/TermLoanOfferTerms';
|
|
92
|
+
export * from '../models/TermLoanServicingData';
|
|
93
|
+
export * from '../models/UnmergeableBusinessException';
|
|
94
|
+
export * from '../models/UpdateBusinessAccountRequestBody';
|
|
95
|
+
export * from '../models/UpdateBusinessRequestBody';
|
|
96
|
+
export * from '../models/UpdateUser409Response';
|
|
97
|
+
export * from '../models/UpdateUserRequestBody';
|
|
98
|
+
export * from '../models/User';
|
|
99
|
+
export * from '../models/UserAddress';
|
|
100
|
+
export * from '../models/UserAlreadyExistsWithEmailException';
|
|
101
|
+
export * from '../models/UserAlreadyExistsWithPlatformUserIdException';
|
|
102
|
+
export * from '../models/UserNotFoundException';
|
|
103
|
+
|
|
104
|
+
import { ActivityLog } from '../models/ActivityLog';
|
|
105
|
+
import { Address , AddressStateEnum } from '../models/Address';
|
|
106
|
+
import { BadRequestException, BadRequestExceptionErrorCodeEnum } from '../models/BadRequestException';
|
|
107
|
+
import { BankAccountAlreadyExistException, BankAccountAlreadyExistExceptionErrorCodeEnum } from '../models/BankAccountAlreadyExistException';
|
|
108
|
+
import { BankAccountNotFoundException, BankAccountNotFoundExceptionErrorCodeEnum } from '../models/BankAccountNotFoundException';
|
|
109
|
+
import { BankStatementsInvalidException, BankStatementsInvalidExceptionErrorCodeEnum } from '../models/BankStatementsInvalidException';
|
|
110
|
+
import { Business } from '../models/Business';
|
|
111
|
+
import { BusinessAddress , BusinessAddressStateEnum } from '../models/BusinessAddress';
|
|
112
|
+
import { BusinessAlreadyExistsException, BusinessAlreadyExistsExceptionErrorCodeEnum } from '../models/BusinessAlreadyExistsException';
|
|
113
|
+
import { BusinessBankAccount , BusinessBankAccountAccountTypeEnum , BusinessBankAccountRolesEnum } from '../models/BusinessBankAccount';
|
|
114
|
+
import { BusinessDocument } from '../models/BusinessDocument';
|
|
115
|
+
import { BusinessDocumentType } from '../models/BusinessDocumentType';
|
|
116
|
+
import { BusinessHasNoInvoiceFinancingProductException, BusinessHasNoInvoiceFinancingProductExceptionErrorCodeEnum } from '../models/BusinessHasNoInvoiceFinancingProductException';
|
|
117
|
+
import { BusinessHasNoPrimaryOwnerException, BusinessHasNoPrimaryOwnerExceptionErrorCodeEnum } from '../models/BusinessHasNoPrimaryOwnerException';
|
|
118
|
+
import { BusinessNotFoundException, BusinessNotFoundExceptionErrorCodeEnum } from '../models/BusinessNotFoundException';
|
|
119
|
+
import { BusinessPlaidBankAccountNotFoundException, BusinessPlaidBankAccountNotFoundExceptionErrorCodeEnum } from '../models/BusinessPlaidBankAccountNotFoundException';
|
|
120
|
+
import { BusinessPrequalification, BusinessPrequalificationProductEnum } from '../models/BusinessPrequalification';
|
|
121
|
+
import { CheckingAccountRequiredException, CheckingAccountRequiredExceptionErrorCodeEnum } from '../models/CheckingAccountRequiredException';
|
|
122
|
+
import { ConnectToken } from '../models/ConnectToken';
|
|
123
|
+
import { CreateBusinessBankAccountRequestBody , CreateBusinessBankAccountRequestBodyAccountTypeEnum , CreateBusinessBankAccountRequestBodyRolesEnum } from '../models/CreateBusinessBankAccountRequestBody';
|
|
124
|
+
import { CreateBusinessDocumentsResponse } from '../models/CreateBusinessDocumentsResponse';
|
|
125
|
+
import { CreateBusinessRequestBody } from '../models/CreateBusinessRequestBody';
|
|
126
|
+
import { CreateConnectTokenRequestBody } from '../models/CreateConnectTokenRequestBody';
|
|
127
|
+
import { CreateEmbeddedSession409Response, CreateEmbeddedSession409ResponseErrorCodeEnum } from '../models/CreateEmbeddedSession409Response';
|
|
128
|
+
import { CreateSessionTokenRequestBody } from '../models/CreateSessionTokenRequestBody';
|
|
129
|
+
import { CreateSessionTokenRequestBodyData, CreateSessionTokenRequestBodyDataComponentEnum } from '../models/CreateSessionTokenRequestBodyData';
|
|
130
|
+
import { CreateUser409Response, CreateUser409ResponseErrorCodeEnum } from '../models/CreateUser409Response';
|
|
131
|
+
import { CreateUserRequestBody , CreateUserRequestBodyRolesEnum } from '../models/CreateUserRequestBody';
|
|
132
|
+
import { DrawRequest } from '../models/DrawRequest';
|
|
133
|
+
import { DrawRequestNotFoundException, DrawRequestNotFoundExceptionErrorCodeEnum } from '../models/DrawRequestNotFoundException';
|
|
134
|
+
import { DrawRequestState } from '../models/DrawRequestState';
|
|
135
|
+
import { EmbeddedSession } from '../models/EmbeddedSession';
|
|
136
|
+
import { FixedDateInvoiceRepaymentWindow, FixedDateInvoiceRepaymentWindowRepaymentTypeEnum } from '../models/FixedDateInvoiceRepaymentWindow';
|
|
137
|
+
import { FixedDurationInvoiceRepaymentWindow, FixedDurationInvoiceRepaymentWindowRepaymentTypeEnum } from '../models/FixedDurationInvoiceRepaymentWindow';
|
|
138
|
+
import { ForbiddenException, ForbiddenExceptionErrorCodeEnum } from '../models/ForbiddenException';
|
|
139
|
+
import { GetActivityLogsResponse } from '../models/GetActivityLogsResponse';
|
|
140
|
+
import { GetBusinessBankAccountsResponse } from '../models/GetBusinessBankAccountsResponse';
|
|
141
|
+
import { GetBusinessesResponse } from '../models/GetBusinessesResponse';
|
|
142
|
+
import { GetDrawRequestsResponse } from '../models/GetDrawRequestsResponse';
|
|
143
|
+
import { GetInvoice404Response, GetInvoice404ResponseErrorCodeEnum } from '../models/GetInvoice404Response';
|
|
144
|
+
import { GetInvoicesResponse } from '../models/GetInvoicesResponse';
|
|
145
|
+
import { GetIssuedProductsResponse } from '../models/GetIssuedProductsResponse';
|
|
146
|
+
import { GetOffersResponse } from '../models/GetOffersResponse';
|
|
147
|
+
import { GetPaymentScheduleResponse } from '../models/GetPaymentScheduleResponse';
|
|
148
|
+
import { GetPrequalificationsResponse } from '../models/GetPrequalificationsResponse';
|
|
149
|
+
import { GetUsersResponse } from '../models/GetUsersResponse';
|
|
150
|
+
import { InternalServerErrorException, InternalServerErrorExceptionErrorCodeEnum } from '../models/InternalServerErrorException';
|
|
151
|
+
import { InvalidInvoiceDueDateException, InvalidInvoiceDueDateExceptionErrorCodeEnum } from '../models/InvalidInvoiceDueDateException';
|
|
152
|
+
import { Invoice , InvoicePayorTypeEnum } from '../models/Invoice';
|
|
153
|
+
import { InvoiceFinancingOfferTerms, InvoiceFinancingOfferTermsProductTypeEnum } from '../models/InvoiceFinancingOfferTerms';
|
|
154
|
+
import { InvoiceFinancingServicingData, InvoiceFinancingServicingDataProductTypeEnum } from '../models/InvoiceFinancingServicingData';
|
|
155
|
+
import { InvoiceFlowSessionTokenData, InvoiceFlowSessionTokenDataComponentEnum } from '../models/InvoiceFlowSessionTokenData';
|
|
156
|
+
import { InvoiceFlowWithInvoiceFileSessionTokenData, InvoiceFlowWithInvoiceFileSessionTokenDataComponentEnum } from '../models/InvoiceFlowWithInvoiceFileSessionTokenData';
|
|
157
|
+
import { InvoiceNotFoundException, InvoiceNotFoundExceptionErrorCodeEnum } from '../models/InvoiceNotFoundException';
|
|
158
|
+
import { InvoicePaymentPlan } from '../models/InvoicePaymentPlan';
|
|
159
|
+
import { InvoicePayorAddress , InvoicePayorAddressStateEnum } from '../models/InvoicePayorAddress';
|
|
160
|
+
import { InvoiceRepaymentSchedule } from '../models/InvoiceRepaymentSchedule';
|
|
161
|
+
import { InvoiceRepaymentScheduleItem } from '../models/InvoiceRepaymentScheduleItem';
|
|
162
|
+
import { InvoiceStatus } from '../models/InvoiceStatus';
|
|
163
|
+
import { IssuedProduct , IssuedProductLoanStatusEnum } from '../models/IssuedProduct';
|
|
164
|
+
import { IssuedProductNotFoundException, IssuedProductNotFoundExceptionErrorCodeEnum } from '../models/IssuedProductNotFoundException';
|
|
165
|
+
import { IssuedProductServicingData, IssuedProductServicingDataProductTypeEnum , IssuedProductServicingDataRepaymentFrequencyEnum } from '../models/IssuedProductServicingData';
|
|
166
|
+
import { LineOfCreditOfferTerms, LineOfCreditOfferTermsProductTypeEnum } from '../models/LineOfCreditOfferTerms';
|
|
167
|
+
import { LineOfCreditServicingData, LineOfCreditServicingDataProductTypeEnum } from '../models/LineOfCreditServicingData';
|
|
168
|
+
import { McaOfferTerms, McaOfferTermsProductTypeEnum , McaOfferTermsRepaymentFrequencyEnum } from '../models/McaOfferTerms';
|
|
169
|
+
import { McaServicingData, McaServicingDataProductTypeEnum , McaServicingDataRepaymentFrequencyEnum } from '../models/McaServicingData';
|
|
170
|
+
import { MergeUsersRequestBody } from '../models/MergeUsersRequestBody';
|
|
171
|
+
import { MergeUsersResponseBody } from '../models/MergeUsersResponseBody';
|
|
172
|
+
import { MultipleDurationInvoiceRepaymentWindow, MultipleDurationInvoiceRepaymentWindowRepaymentTypeEnum } from '../models/MultipleDurationInvoiceRepaymentWindow';
|
|
173
|
+
import { Offer } from '../models/Offer';
|
|
174
|
+
import { OfferAlreadySelectedException, OfferAlreadySelectedExceptionErrorCodeEnum } from '../models/OfferAlreadySelectedException';
|
|
175
|
+
import { OfferNotFoundException, OfferNotFoundExceptionErrorCodeEnum } from '../models/OfferNotFoundException';
|
|
176
|
+
import { OfferNotLockedException, OfferNotLockedExceptionErrorCodeEnum } from '../models/OfferNotLockedException';
|
|
177
|
+
import { OfferTerms, OfferTermsProductTypeEnum , OfferTermsRepaymentFrequencyEnum } from '../models/OfferTerms';
|
|
178
|
+
import { PaginationResult } from '../models/PaginationResult';
|
|
179
|
+
import { PaymentOrder , PaymentOrderFeeTypeEnum , PaymentOrderDirectionEnum } from '../models/PaymentOrder';
|
|
180
|
+
import { PaymentOrderNotFoundException, PaymentOrderNotFoundExceptionErrorCodeEnum } from '../models/PaymentOrderNotFoundException';
|
|
181
|
+
import { PaymentOrderStatus } from '../models/PaymentOrderStatus';
|
|
182
|
+
import { PaymentPlanRepaymentSchedule } from '../models/PaymentPlanRepaymentSchedule';
|
|
183
|
+
import { PaymentPlanRepaymentScheduleItem } from '../models/PaymentPlanRepaymentScheduleItem';
|
|
184
|
+
import { PaymentScheduleItem } from '../models/PaymentScheduleItem';
|
|
185
|
+
import { PaymentScheduleItemPaymentOrder , PaymentScheduleItemPaymentOrderFeeTypeEnum , PaymentScheduleItemPaymentOrderDirectionEnum } from '../models/PaymentScheduleItemPaymentOrder';
|
|
186
|
+
import { PlaidAssetReportsInvalidException, PlaidAssetReportsInvalidExceptionErrorCodeEnum } from '../models/PlaidAssetReportsInvalidException';
|
|
187
|
+
import { PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException, PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductExceptionErrorCodeEnum } from '../models/PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException';
|
|
188
|
+
import { PrimaryBusinessOwnerAlreadyExistsForBusinessException, PrimaryBusinessOwnerAlreadyExistsForBusinessExceptionErrorCodeEnum } from '../models/PrimaryBusinessOwnerAlreadyExistsForBusinessException';
|
|
189
|
+
import { PrimaryBusinessOwnerAlreadyExistsWithEmailException, PrimaryBusinessOwnerAlreadyExistsWithEmailExceptionErrorCodeEnum } from '../models/PrimaryBusinessOwnerAlreadyExistsWithEmailException';
|
|
190
|
+
import { PrimaryBusinessOwnerNotFoundException, PrimaryBusinessOwnerNotFoundExceptionErrorCodeEnum } from '../models/PrimaryBusinessOwnerNotFoundException';
|
|
191
|
+
import { SessionInvoice , SessionInvoicePayorTypeEnum } from '../models/SessionInvoice';
|
|
192
|
+
import { SessionInvoiceWithInvoiceFile , SessionInvoiceWithInvoiceFilePayorTypeEnum } from '../models/SessionInvoiceWithInvoiceFile';
|
|
193
|
+
import { SomeOffersHaveExpiredException, SomeOffersHaveExpiredExceptionErrorCodeEnum } from '../models/SomeOffersHaveExpiredException';
|
|
194
|
+
import { TermLoanOfferTerms, TermLoanOfferTermsProductTypeEnum } from '../models/TermLoanOfferTerms';
|
|
195
|
+
import { TermLoanServicingData, TermLoanServicingDataProductTypeEnum } from '../models/TermLoanServicingData';
|
|
196
|
+
import { UnmergeableBusinessException, UnmergeableBusinessExceptionErrorCodeEnum } from '../models/UnmergeableBusinessException';
|
|
197
|
+
import { UpdateBusinessAccountRequestBody } from '../models/UpdateBusinessAccountRequestBody';
|
|
198
|
+
import { UpdateBusinessRequestBody } from '../models/UpdateBusinessRequestBody';
|
|
199
|
+
import { UpdateUser409Response, UpdateUser409ResponseErrorCodeEnum } from '../models/UpdateUser409Response';
|
|
200
|
+
import { UpdateUserRequestBody , UpdateUserRequestBodyRolesEnum } from '../models/UpdateUserRequestBody';
|
|
201
|
+
import { User , UserRolesEnum } from '../models/User';
|
|
202
|
+
import { UserAddress , UserAddressStateEnum } from '../models/UserAddress';
|
|
203
|
+
import { UserAlreadyExistsWithEmailException, UserAlreadyExistsWithEmailExceptionErrorCodeEnum } from '../models/UserAlreadyExistsWithEmailException';
|
|
204
|
+
import { UserAlreadyExistsWithPlatformUserIdException, UserAlreadyExistsWithPlatformUserIdExceptionErrorCodeEnum } from '../models/UserAlreadyExistsWithPlatformUserIdException';
|
|
205
|
+
import { UserNotFoundException, UserNotFoundExceptionErrorCodeEnum } from '../models/UserNotFoundException';
|
|
206
|
+
|
|
207
|
+
/* tslint:disable:no-unused-variable */
|
|
208
|
+
let primitives = [
|
|
209
|
+
"string",
|
|
210
|
+
"boolean",
|
|
211
|
+
"double",
|
|
212
|
+
"integer",
|
|
213
|
+
"long",
|
|
214
|
+
"float",
|
|
215
|
+
"number",
|
|
216
|
+
"any"
|
|
217
|
+
];
|
|
218
|
+
|
|
219
|
+
let enumsMap: Set<string> = new Set<string>([
|
|
220
|
+
"AddressStateEnum",
|
|
221
|
+
"BadRequestExceptionErrorCodeEnum",
|
|
222
|
+
"BankAccountAlreadyExistExceptionErrorCodeEnum",
|
|
223
|
+
"BankAccountNotFoundExceptionErrorCodeEnum",
|
|
224
|
+
"BankStatementsInvalidExceptionErrorCodeEnum",
|
|
225
|
+
"BusinessAddressStateEnum",
|
|
226
|
+
"BusinessAlreadyExistsExceptionErrorCodeEnum",
|
|
227
|
+
"BusinessBankAccountAccountTypeEnum",
|
|
228
|
+
"BusinessBankAccountRolesEnum",
|
|
229
|
+
"BusinessDocumentType",
|
|
230
|
+
"BusinessHasNoInvoiceFinancingProductExceptionErrorCodeEnum",
|
|
231
|
+
"BusinessHasNoPrimaryOwnerExceptionErrorCodeEnum",
|
|
232
|
+
"BusinessNotFoundExceptionErrorCodeEnum",
|
|
233
|
+
"BusinessPlaidBankAccountNotFoundExceptionErrorCodeEnum",
|
|
234
|
+
"BusinessPrequalificationProductEnum",
|
|
235
|
+
"CheckingAccountRequiredExceptionErrorCodeEnum",
|
|
236
|
+
"CreateBusinessBankAccountRequestBodyAccountTypeEnum",
|
|
237
|
+
"CreateBusinessBankAccountRequestBodyRolesEnum",
|
|
238
|
+
"CreateEmbeddedSession409ResponseErrorCodeEnum",
|
|
239
|
+
"CreateSessionTokenRequestBodyDataComponentEnum",
|
|
240
|
+
"CreateUser409ResponseErrorCodeEnum",
|
|
241
|
+
"CreateUserRequestBodyRolesEnum",
|
|
242
|
+
"DrawRequestNotFoundExceptionErrorCodeEnum",
|
|
243
|
+
"DrawRequestState",
|
|
244
|
+
"FixedDateInvoiceRepaymentWindowRepaymentTypeEnum",
|
|
245
|
+
"FixedDurationInvoiceRepaymentWindowRepaymentTypeEnum",
|
|
246
|
+
"ForbiddenExceptionErrorCodeEnum",
|
|
247
|
+
"GetInvoice404ResponseErrorCodeEnum",
|
|
248
|
+
"InternalServerErrorExceptionErrorCodeEnum",
|
|
249
|
+
"InvalidInvoiceDueDateExceptionErrorCodeEnum",
|
|
250
|
+
"InvoicePayorTypeEnum",
|
|
251
|
+
"InvoiceFinancingOfferTermsProductTypeEnum",
|
|
252
|
+
"InvoiceFinancingServicingDataProductTypeEnum",
|
|
253
|
+
"InvoiceFlowSessionTokenDataComponentEnum",
|
|
254
|
+
"InvoiceFlowWithInvoiceFileSessionTokenDataComponentEnum",
|
|
255
|
+
"InvoiceNotFoundExceptionErrorCodeEnum",
|
|
256
|
+
"InvoicePayorAddressStateEnum",
|
|
257
|
+
"InvoiceStatus",
|
|
258
|
+
"IssuedProductLoanStatusEnum",
|
|
259
|
+
"IssuedProductNotFoundExceptionErrorCodeEnum",
|
|
260
|
+
"IssuedProductServicingDataProductTypeEnum",
|
|
261
|
+
"IssuedProductServicingDataRepaymentFrequencyEnum",
|
|
262
|
+
"LineOfCreditOfferTermsProductTypeEnum",
|
|
263
|
+
"LineOfCreditServicingDataProductTypeEnum",
|
|
264
|
+
"McaOfferTermsProductTypeEnum",
|
|
265
|
+
"McaOfferTermsRepaymentFrequencyEnum",
|
|
266
|
+
"McaServicingDataProductTypeEnum",
|
|
267
|
+
"McaServicingDataRepaymentFrequencyEnum",
|
|
268
|
+
"MultipleDurationInvoiceRepaymentWindowRepaymentTypeEnum",
|
|
269
|
+
"OfferAlreadySelectedExceptionErrorCodeEnum",
|
|
270
|
+
"OfferNotFoundExceptionErrorCodeEnum",
|
|
271
|
+
"OfferNotLockedExceptionErrorCodeEnum",
|
|
272
|
+
"OfferTermsProductTypeEnum",
|
|
273
|
+
"OfferTermsRepaymentFrequencyEnum",
|
|
274
|
+
"PaymentOrderFeeTypeEnum",
|
|
275
|
+
"PaymentOrderDirectionEnum",
|
|
276
|
+
"PaymentOrderNotFoundExceptionErrorCodeEnum",
|
|
277
|
+
"PaymentOrderStatus",
|
|
278
|
+
"PaymentScheduleItemPaymentOrderFeeTypeEnum",
|
|
279
|
+
"PaymentScheduleItemPaymentOrderDirectionEnum",
|
|
280
|
+
"PlaidAssetReportsInvalidExceptionErrorCodeEnum",
|
|
281
|
+
"PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductExceptionErrorCodeEnum",
|
|
282
|
+
"PrimaryBusinessOwnerAlreadyExistsForBusinessExceptionErrorCodeEnum",
|
|
283
|
+
"PrimaryBusinessOwnerAlreadyExistsWithEmailExceptionErrorCodeEnum",
|
|
284
|
+
"PrimaryBusinessOwnerNotFoundExceptionErrorCodeEnum",
|
|
285
|
+
"SessionInvoicePayorTypeEnum",
|
|
286
|
+
"SessionInvoiceWithInvoiceFilePayorTypeEnum",
|
|
287
|
+
"SomeOffersHaveExpiredExceptionErrorCodeEnum",
|
|
288
|
+
"TermLoanOfferTermsProductTypeEnum",
|
|
289
|
+
"TermLoanServicingDataProductTypeEnum",
|
|
290
|
+
"UnmergeableBusinessExceptionErrorCodeEnum",
|
|
291
|
+
"UpdateUser409ResponseErrorCodeEnum",
|
|
292
|
+
"UpdateUserRequestBodyRolesEnum",
|
|
293
|
+
"UserRolesEnum",
|
|
294
|
+
"UserAddressStateEnum",
|
|
295
|
+
"UserAlreadyExistsWithEmailExceptionErrorCodeEnum",
|
|
296
|
+
"UserAlreadyExistsWithPlatformUserIdExceptionErrorCodeEnum",
|
|
297
|
+
"UserNotFoundExceptionErrorCodeEnum",
|
|
298
|
+
]);
|
|
299
|
+
|
|
300
|
+
let typeMap: {[index: string]: any} = {
|
|
301
|
+
"ActivityLog": ActivityLog,
|
|
302
|
+
"Address": Address,
|
|
303
|
+
"BadRequestException": BadRequestException,
|
|
304
|
+
"BankAccountAlreadyExistException": BankAccountAlreadyExistException,
|
|
305
|
+
"BankAccountNotFoundException": BankAccountNotFoundException,
|
|
306
|
+
"BankStatementsInvalidException": BankStatementsInvalidException,
|
|
307
|
+
"Business": Business,
|
|
308
|
+
"BusinessAddress": BusinessAddress,
|
|
309
|
+
"BusinessAlreadyExistsException": BusinessAlreadyExistsException,
|
|
310
|
+
"BusinessBankAccount": BusinessBankAccount,
|
|
311
|
+
"BusinessDocument": BusinessDocument,
|
|
312
|
+
"BusinessHasNoInvoiceFinancingProductException": BusinessHasNoInvoiceFinancingProductException,
|
|
313
|
+
"BusinessHasNoPrimaryOwnerException": BusinessHasNoPrimaryOwnerException,
|
|
314
|
+
"BusinessNotFoundException": BusinessNotFoundException,
|
|
315
|
+
"BusinessPlaidBankAccountNotFoundException": BusinessPlaidBankAccountNotFoundException,
|
|
316
|
+
"BusinessPrequalification": BusinessPrequalification,
|
|
317
|
+
"CheckingAccountRequiredException": CheckingAccountRequiredException,
|
|
318
|
+
"ConnectToken": ConnectToken,
|
|
319
|
+
"CreateBusinessBankAccountRequestBody": CreateBusinessBankAccountRequestBody,
|
|
320
|
+
"CreateBusinessDocumentsResponse": CreateBusinessDocumentsResponse,
|
|
321
|
+
"CreateBusinessRequestBody": CreateBusinessRequestBody,
|
|
322
|
+
"CreateConnectTokenRequestBody": CreateConnectTokenRequestBody,
|
|
323
|
+
"CreateEmbeddedSession409Response": CreateEmbeddedSession409Response,
|
|
324
|
+
"CreateSessionTokenRequestBody": CreateSessionTokenRequestBody,
|
|
325
|
+
"CreateSessionTokenRequestBodyData": CreateSessionTokenRequestBodyData,
|
|
326
|
+
"CreateUser409Response": CreateUser409Response,
|
|
327
|
+
"CreateUserRequestBody": CreateUserRequestBody,
|
|
328
|
+
"DrawRequest": DrawRequest,
|
|
329
|
+
"DrawRequestNotFoundException": DrawRequestNotFoundException,
|
|
330
|
+
"EmbeddedSession": EmbeddedSession,
|
|
331
|
+
"FixedDateInvoiceRepaymentWindow": FixedDateInvoiceRepaymentWindow,
|
|
332
|
+
"FixedDurationInvoiceRepaymentWindow": FixedDurationInvoiceRepaymentWindow,
|
|
333
|
+
"ForbiddenException": ForbiddenException,
|
|
334
|
+
"GetActivityLogsResponse": GetActivityLogsResponse,
|
|
335
|
+
"GetBusinessBankAccountsResponse": GetBusinessBankAccountsResponse,
|
|
336
|
+
"GetBusinessesResponse": GetBusinessesResponse,
|
|
337
|
+
"GetDrawRequestsResponse": GetDrawRequestsResponse,
|
|
338
|
+
"GetInvoice404Response": GetInvoice404Response,
|
|
339
|
+
"GetInvoicesResponse": GetInvoicesResponse,
|
|
340
|
+
"GetIssuedProductsResponse": GetIssuedProductsResponse,
|
|
341
|
+
"GetOffersResponse": GetOffersResponse,
|
|
342
|
+
"GetPaymentScheduleResponse": GetPaymentScheduleResponse,
|
|
343
|
+
"GetPrequalificationsResponse": GetPrequalificationsResponse,
|
|
344
|
+
"GetUsersResponse": GetUsersResponse,
|
|
345
|
+
"InternalServerErrorException": InternalServerErrorException,
|
|
346
|
+
"InvalidInvoiceDueDateException": InvalidInvoiceDueDateException,
|
|
347
|
+
"Invoice": Invoice,
|
|
348
|
+
"InvoiceFinancingOfferTerms": InvoiceFinancingOfferTerms,
|
|
349
|
+
"InvoiceFinancingServicingData": InvoiceFinancingServicingData,
|
|
350
|
+
"InvoiceFlowSessionTokenData": InvoiceFlowSessionTokenData,
|
|
351
|
+
"InvoiceFlowWithInvoiceFileSessionTokenData": InvoiceFlowWithInvoiceFileSessionTokenData,
|
|
352
|
+
"InvoiceNotFoundException": InvoiceNotFoundException,
|
|
353
|
+
"InvoicePaymentPlan": InvoicePaymentPlan,
|
|
354
|
+
"InvoicePayorAddress": InvoicePayorAddress,
|
|
355
|
+
"InvoiceRepaymentSchedule": InvoiceRepaymentSchedule,
|
|
356
|
+
"InvoiceRepaymentScheduleItem": InvoiceRepaymentScheduleItem,
|
|
357
|
+
"IssuedProduct": IssuedProduct,
|
|
358
|
+
"IssuedProductNotFoundException": IssuedProductNotFoundException,
|
|
359
|
+
"IssuedProductServicingData": IssuedProductServicingData,
|
|
360
|
+
"LineOfCreditOfferTerms": LineOfCreditOfferTerms,
|
|
361
|
+
"LineOfCreditServicingData": LineOfCreditServicingData,
|
|
362
|
+
"McaOfferTerms": McaOfferTerms,
|
|
363
|
+
"McaServicingData": McaServicingData,
|
|
364
|
+
"MergeUsersRequestBody": MergeUsersRequestBody,
|
|
365
|
+
"MergeUsersResponseBody": MergeUsersResponseBody,
|
|
366
|
+
"MultipleDurationInvoiceRepaymentWindow": MultipleDurationInvoiceRepaymentWindow,
|
|
367
|
+
"Offer": Offer,
|
|
368
|
+
"OfferAlreadySelectedException": OfferAlreadySelectedException,
|
|
369
|
+
"OfferNotFoundException": OfferNotFoundException,
|
|
370
|
+
"OfferNotLockedException": OfferNotLockedException,
|
|
371
|
+
"OfferTerms": OfferTerms,
|
|
372
|
+
"PaginationResult": PaginationResult,
|
|
373
|
+
"PaymentOrder": PaymentOrder,
|
|
374
|
+
"PaymentOrderNotFoundException": PaymentOrderNotFoundException,
|
|
375
|
+
"PaymentPlanRepaymentSchedule": PaymentPlanRepaymentSchedule,
|
|
376
|
+
"PaymentPlanRepaymentScheduleItem": PaymentPlanRepaymentScheduleItem,
|
|
377
|
+
"PaymentScheduleItem": PaymentScheduleItem,
|
|
378
|
+
"PaymentScheduleItemPaymentOrder": PaymentScheduleItemPaymentOrder,
|
|
379
|
+
"PlaidAssetReportsInvalidException": PlaidAssetReportsInvalidException,
|
|
380
|
+
"PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException": PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException,
|
|
381
|
+
"PrimaryBusinessOwnerAlreadyExistsForBusinessException": PrimaryBusinessOwnerAlreadyExistsForBusinessException,
|
|
382
|
+
"PrimaryBusinessOwnerAlreadyExistsWithEmailException": PrimaryBusinessOwnerAlreadyExistsWithEmailException,
|
|
383
|
+
"PrimaryBusinessOwnerNotFoundException": PrimaryBusinessOwnerNotFoundException,
|
|
384
|
+
"SessionInvoice": SessionInvoice,
|
|
385
|
+
"SessionInvoiceWithInvoiceFile": SessionInvoiceWithInvoiceFile,
|
|
386
|
+
"SomeOffersHaveExpiredException": SomeOffersHaveExpiredException,
|
|
387
|
+
"TermLoanOfferTerms": TermLoanOfferTerms,
|
|
388
|
+
"TermLoanServicingData": TermLoanServicingData,
|
|
389
|
+
"UnmergeableBusinessException": UnmergeableBusinessException,
|
|
390
|
+
"UpdateBusinessAccountRequestBody": UpdateBusinessAccountRequestBody,
|
|
391
|
+
"UpdateBusinessRequestBody": UpdateBusinessRequestBody,
|
|
392
|
+
"UpdateUser409Response": UpdateUser409Response,
|
|
393
|
+
"UpdateUserRequestBody": UpdateUserRequestBody,
|
|
394
|
+
"User": User,
|
|
395
|
+
"UserAddress": UserAddress,
|
|
396
|
+
"UserAlreadyExistsWithEmailException": UserAlreadyExistsWithEmailException,
|
|
397
|
+
"UserAlreadyExistsWithPlatformUserIdException": UserAlreadyExistsWithPlatformUserIdException,
|
|
398
|
+
"UserNotFoundException": UserNotFoundException,
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
type MimeTypeDescriptor = {
|
|
402
|
+
type: string;
|
|
403
|
+
subtype: string;
|
|
404
|
+
subtypeTokens: string[];
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Every mime-type consists of a type, subtype, and optional parameters.
|
|
409
|
+
* The subtype can be composite, including information about the content format.
|
|
410
|
+
* For example: `application/json-patch+json`, `application/merge-patch+json`.
|
|
411
|
+
*
|
|
412
|
+
* This helper transforms a string mime-type into an internal representation.
|
|
413
|
+
* This simplifies the implementation of predicates that in turn define common rules for parsing or stringifying
|
|
414
|
+
* the payload.
|
|
415
|
+
*/
|
|
416
|
+
const parseMimeType = (mimeType: string): MimeTypeDescriptor => {
|
|
417
|
+
const [type, subtype] = mimeType.split('/');
|
|
418
|
+
return {
|
|
419
|
+
type,
|
|
420
|
+
subtype,
|
|
421
|
+
subtypeTokens: subtype.split('+'),
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
type MimeTypePredicate = (mimeType: string) => boolean;
|
|
426
|
+
|
|
427
|
+
// This factory creates a predicate function that checks a string mime-type against defined rules.
|
|
428
|
+
const mimeTypePredicateFactory = (predicate: (descriptor: MimeTypeDescriptor) => boolean): MimeTypePredicate => (mimeType) => predicate(parseMimeType(mimeType));
|
|
429
|
+
|
|
430
|
+
// Use this factory when you need to define a simple predicate based only on type and, if applicable, subtype.
|
|
431
|
+
const mimeTypeSimplePredicateFactory = (type: string, subtype?: string): MimeTypePredicate => mimeTypePredicateFactory((descriptor) => {
|
|
432
|
+
if (descriptor.type !== type) return false;
|
|
433
|
+
if (subtype != null && descriptor.subtype !== subtype) return false;
|
|
434
|
+
return true;
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// Creating a set of named predicates that will help us determine how to handle different mime-types
|
|
438
|
+
const isTextLikeMimeType = mimeTypeSimplePredicateFactory('text');
|
|
439
|
+
const isJsonMimeType = mimeTypeSimplePredicateFactory('application', 'json');
|
|
440
|
+
const isJsonLikeMimeType = mimeTypePredicateFactory((descriptor) => descriptor.type === 'application' && descriptor.subtypeTokens.some((item) => item === 'json'));
|
|
441
|
+
const isOctetStreamMimeType = mimeTypeSimplePredicateFactory('application', 'octet-stream');
|
|
442
|
+
const isFormUrlencodedMimeType = mimeTypeSimplePredicateFactory('application', 'x-www-form-urlencoded');
|
|
443
|
+
|
|
444
|
+
// Defining a list of mime-types in the order of prioritization for handling.
|
|
445
|
+
const supportedMimeTypePredicatesWithPriority: MimeTypePredicate[] = [
|
|
446
|
+
isJsonMimeType,
|
|
447
|
+
isJsonLikeMimeType,
|
|
448
|
+
isTextLikeMimeType,
|
|
449
|
+
isOctetStreamMimeType,
|
|
450
|
+
isFormUrlencodedMimeType,
|
|
451
|
+
];
|
|
452
|
+
|
|
453
|
+
export class ObjectSerializer {
|
|
454
|
+
public static findCorrectType(data: any, expectedType: string) {
|
|
455
|
+
if (data == undefined) {
|
|
456
|
+
return expectedType;
|
|
457
|
+
} else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
|
|
458
|
+
return expectedType;
|
|
459
|
+
} else if (expectedType === "Date") {
|
|
460
|
+
return expectedType;
|
|
461
|
+
} else {
|
|
462
|
+
if (enumsMap.has(expectedType)) {
|
|
463
|
+
return expectedType;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (!typeMap[expectedType]) {
|
|
467
|
+
return expectedType; // w/e we don't know the type
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// Check the discriminator
|
|
471
|
+
let discriminatorProperty = typeMap[expectedType].discriminator;
|
|
472
|
+
if (discriminatorProperty == null) {
|
|
473
|
+
return expectedType; // the type does not have a discriminator. use it.
|
|
474
|
+
} else {
|
|
475
|
+
if (data[discriminatorProperty]) {
|
|
476
|
+
var discriminatorType = data[discriminatorProperty];
|
|
477
|
+
if(typeMap[discriminatorType]){
|
|
478
|
+
return discriminatorType; // use the type given in the discriminator
|
|
479
|
+
} else {
|
|
480
|
+
return expectedType; // discriminator did not map to a type
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
return expectedType; // discriminator was not present (or an empty string)
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
public static serialize(data: any, type: string, format: string) {
|
|
490
|
+
if (data == undefined) {
|
|
491
|
+
return data;
|
|
492
|
+
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
493
|
+
return data;
|
|
494
|
+
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
|
495
|
+
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
|
496
|
+
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
|
497
|
+
let transformedData: any[] = [];
|
|
498
|
+
for (let date of data) {
|
|
499
|
+
transformedData.push(ObjectSerializer.serialize(date, subType, format));
|
|
500
|
+
}
|
|
501
|
+
return transformedData;
|
|
502
|
+
} else if (type === "Date") {
|
|
503
|
+
if (format == "date") {
|
|
504
|
+
let month = data.getMonth()+1
|
|
505
|
+
month = month < 10 ? "0" + month.toString() : month.toString()
|
|
506
|
+
let day = data.getDate();
|
|
507
|
+
day = day < 10 ? "0" + day.toString() : day.toString();
|
|
508
|
+
|
|
509
|
+
return data.getFullYear() + "-" + month + "-" + day;
|
|
510
|
+
} else {
|
|
511
|
+
return data.toISOString();
|
|
512
|
+
}
|
|
513
|
+
} else {
|
|
514
|
+
if (enumsMap.has(type)) {
|
|
515
|
+
return data;
|
|
516
|
+
}
|
|
517
|
+
if (!typeMap[type]) { // in case we dont know the type
|
|
518
|
+
return data;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Get the actual type of this object
|
|
522
|
+
type = this.findCorrectType(data, type);
|
|
523
|
+
|
|
524
|
+
// get the map for the correct type.
|
|
525
|
+
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
|
526
|
+
let instance: {[index: string]: any} = {};
|
|
527
|
+
for (let attributeType of attributeTypes) {
|
|
528
|
+
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
|
|
529
|
+
}
|
|
530
|
+
return instance;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
public static deserialize(data: any, type: string, format: string) {
|
|
535
|
+
// polymorphism may change the actual type.
|
|
536
|
+
type = ObjectSerializer.findCorrectType(data, type);
|
|
537
|
+
if (data == undefined) {
|
|
538
|
+
return data;
|
|
539
|
+
} else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
540
|
+
return data;
|
|
541
|
+
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
|
542
|
+
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
|
543
|
+
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
|
544
|
+
let transformedData: any[] = [];
|
|
545
|
+
for (let date of data) {
|
|
546
|
+
transformedData.push(ObjectSerializer.deserialize(date, subType, format));
|
|
547
|
+
}
|
|
548
|
+
return transformedData;
|
|
549
|
+
} else if (type === "Date") {
|
|
550
|
+
return new Date(data);
|
|
551
|
+
} else {
|
|
552
|
+
if (enumsMap.has(type)) {// is Enum
|
|
553
|
+
return data;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (!typeMap[type]) { // dont know the type
|
|
557
|
+
return data;
|
|
558
|
+
}
|
|
559
|
+
let instance = new typeMap[type]();
|
|
560
|
+
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
|
561
|
+
for (let attributeType of attributeTypes) {
|
|
562
|
+
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
|
|
563
|
+
if (value !== undefined) {
|
|
564
|
+
instance[attributeType.name] = value;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return instance;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Normalize media type
|
|
574
|
+
*
|
|
575
|
+
* We currently do not handle any media types attributes, i.e. anything
|
|
576
|
+
* after a semicolon. All content is assumed to be UTF-8 compatible.
|
|
577
|
+
*/
|
|
578
|
+
public static normalizeMediaType(mediaType: string | undefined): string | undefined {
|
|
579
|
+
if (mediaType === undefined) {
|
|
580
|
+
return undefined;
|
|
581
|
+
}
|
|
582
|
+
return mediaType.split(";")[0].trim().toLowerCase();
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* From a list of possible media types, choose the one we can handle best.
|
|
587
|
+
*
|
|
588
|
+
* The order of the given media types does not have any impact on the choice
|
|
589
|
+
* made.
|
|
590
|
+
*/
|
|
591
|
+
public static getPreferredMediaType(mediaTypes: Array<string>): string {
|
|
592
|
+
/** According to OAS 3 we should default to json */
|
|
593
|
+
if (mediaTypes.length === 0) {
|
|
594
|
+
return "application/json";
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
const normalMediaTypes = mediaTypes.map(this.normalizeMediaType);
|
|
598
|
+
|
|
599
|
+
for (const predicate of supportedMimeTypePredicatesWithPriority) {
|
|
600
|
+
for (const mediaType of normalMediaTypes) {
|
|
601
|
+
if (mediaType != null && predicate(mediaType)) {
|
|
602
|
+
return mediaType;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
throw new Error("None of the given media types are supported: " + mediaTypes.join(", "));
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Convert data to a string according the given media type
|
|
612
|
+
*/
|
|
613
|
+
public static stringify(data: any, mediaType: string): string {
|
|
614
|
+
if (isTextLikeMimeType(mediaType)) {
|
|
615
|
+
return String(data);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
if (isJsonLikeMimeType(mediaType)) {
|
|
619
|
+
return JSON.stringify(data);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.stringify.");
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Parse data from a string according to the given media type
|
|
627
|
+
*/
|
|
628
|
+
public static parse(rawData: string, mediaType: string | undefined) {
|
|
629
|
+
if (mediaType === undefined) {
|
|
630
|
+
throw new Error("Cannot parse content. No Content-Type defined.");
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
if (isTextLikeMimeType(mediaType)) {
|
|
634
|
+
return rawData;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (isJsonLikeMimeType(mediaType)) {
|
|
638
|
+
return JSON.parse(rawData);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse.");
|
|
642
|
+
}
|
|
643
|
+
}
|