@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,141 @@
|
|
|
1
|
+
// TODO: better import syntax?
|
|
2
|
+
import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi';
|
|
3
|
+
import {Configuration} from '../configuration';
|
|
4
|
+
import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http';
|
|
5
|
+
import FormData from "form-data";
|
|
6
|
+
import { URLSearchParams } from 'url';
|
|
7
|
+
import {ObjectSerializer} from '../models/ObjectSerializer';
|
|
8
|
+
import {ApiException} from './exception';
|
|
9
|
+
import {canConsumeForm, isCodeInRange} from '../util';
|
|
10
|
+
import {SecurityAuthentication} from '../auth/auth';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import { BadRequestException } from '../models/BadRequestException';
|
|
14
|
+
import { BusinessNotFoundException } from '../models/BusinessNotFoundException';
|
|
15
|
+
import { CreateEmbeddedSession409Response } from '../models/CreateEmbeddedSession409Response';
|
|
16
|
+
import { CreateSessionTokenRequestBody } from '../models/CreateSessionTokenRequestBody';
|
|
17
|
+
import { EmbeddedSession } from '../models/EmbeddedSession';
|
|
18
|
+
import { ForbiddenException } from '../models/ForbiddenException';
|
|
19
|
+
import { InternalServerErrorException } from '../models/InternalServerErrorException';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* no description
|
|
23
|
+
*/
|
|
24
|
+
export class EmbeddedSessionsApiRequestFactory extends BaseAPIRequestFactory {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create an embedded session
|
|
28
|
+
* @param createSessionTokenRequestBody
|
|
29
|
+
*/
|
|
30
|
+
public async createEmbeddedSession(createSessionTokenRequestBody: CreateSessionTokenRequestBody, _options?: Configuration): Promise<RequestContext> {
|
|
31
|
+
let _config = _options || this.configuration;
|
|
32
|
+
|
|
33
|
+
// verify required parameter 'createSessionTokenRequestBody' is not null or undefined
|
|
34
|
+
if (createSessionTokenRequestBody === null || createSessionTokenRequestBody === undefined) {
|
|
35
|
+
throw new RequiredError("EmbeddedSessionsApi", "createEmbeddedSession", "createSessionTokenRequestBody");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// Path Params
|
|
40
|
+
const localVarPath = '/api/platform/v2/embedded-session';
|
|
41
|
+
|
|
42
|
+
// Make Request Context
|
|
43
|
+
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
|
|
44
|
+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// Body Params
|
|
48
|
+
const contentType = ObjectSerializer.getPreferredMediaType([
|
|
49
|
+
"application/json"
|
|
50
|
+
]);
|
|
51
|
+
requestContext.setHeaderParam("Content-Type", contentType);
|
|
52
|
+
const serializedBody = ObjectSerializer.stringify(
|
|
53
|
+
ObjectSerializer.serialize(createSessionTokenRequestBody, "CreateSessionTokenRequestBody", ""),
|
|
54
|
+
contentType
|
|
55
|
+
);
|
|
56
|
+
requestContext.setBody(serializedBody);
|
|
57
|
+
|
|
58
|
+
let authMethod: SecurityAuthentication | undefined;
|
|
59
|
+
// Apply auth methods
|
|
60
|
+
authMethod = _config.authMethods["Authorization"]
|
|
61
|
+
if (authMethod?.applySecurityAuthentication) {
|
|
62
|
+
await authMethod?.applySecurityAuthentication(requestContext);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
|
66
|
+
if (defaultAuth?.applySecurityAuthentication) {
|
|
67
|
+
await defaultAuth?.applySecurityAuthentication(requestContext);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return requestContext;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class EmbeddedSessionsApiResponseProcessor {
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
|
|
79
|
+
* to the expected objects
|
|
80
|
+
*
|
|
81
|
+
* @params response Response returned by the server for a request to createEmbeddedSession
|
|
82
|
+
* @throws ApiException if the response code was not in [200, 299]
|
|
83
|
+
*/
|
|
84
|
+
public async createEmbeddedSessionWithHttpInfo(response: ResponseContext): Promise<HttpInfo<EmbeddedSession >> {
|
|
85
|
+
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
|
|
86
|
+
if (isCodeInRange("201", response.httpStatusCode)) {
|
|
87
|
+
const body: EmbeddedSession = ObjectSerializer.deserialize(
|
|
88
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
89
|
+
"EmbeddedSession", ""
|
|
90
|
+
) as EmbeddedSession;
|
|
91
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
92
|
+
}
|
|
93
|
+
if (isCodeInRange("400", response.httpStatusCode)) {
|
|
94
|
+
const body: BadRequestException = ObjectSerializer.deserialize(
|
|
95
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
96
|
+
"BadRequestException", ""
|
|
97
|
+
) as BadRequestException;
|
|
98
|
+
throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
|
|
99
|
+
}
|
|
100
|
+
if (isCodeInRange("403", response.httpStatusCode)) {
|
|
101
|
+
const body: ForbiddenException = ObjectSerializer.deserialize(
|
|
102
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
103
|
+
"ForbiddenException", ""
|
|
104
|
+
) as ForbiddenException;
|
|
105
|
+
throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
|
|
106
|
+
}
|
|
107
|
+
if (isCodeInRange("404", response.httpStatusCode)) {
|
|
108
|
+
const body: BusinessNotFoundException = ObjectSerializer.deserialize(
|
|
109
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
110
|
+
"BusinessNotFoundException", ""
|
|
111
|
+
) as BusinessNotFoundException;
|
|
112
|
+
throw new ApiException<BusinessNotFoundException>(response.httpStatusCode, "BusinessNotFoundException", body, response.headers);
|
|
113
|
+
}
|
|
114
|
+
if (isCodeInRange("409", response.httpStatusCode)) {
|
|
115
|
+
const body: CreateEmbeddedSession409Response = ObjectSerializer.deserialize(
|
|
116
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
117
|
+
"CreateEmbeddedSession409Response", ""
|
|
118
|
+
) as CreateEmbeddedSession409Response;
|
|
119
|
+
throw new ApiException<CreateEmbeddedSession409Response>(response.httpStatusCode, "BusinessHasNoInvoiceFinancingProductException, PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException", body, response.headers);
|
|
120
|
+
}
|
|
121
|
+
if (isCodeInRange("500", response.httpStatusCode)) {
|
|
122
|
+
const body: InternalServerErrorException = ObjectSerializer.deserialize(
|
|
123
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
124
|
+
"InternalServerErrorException", ""
|
|
125
|
+
) as InternalServerErrorException;
|
|
126
|
+
throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Work around for missing responses in specification, e.g. for petstore.yaml
|
|
130
|
+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
|
|
131
|
+
const body: EmbeddedSession = ObjectSerializer.deserialize(
|
|
132
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
133
|
+
"EmbeddedSession", ""
|
|
134
|
+
) as EmbeddedSession;
|
|
135
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// TODO: better import syntax?
|
|
2
|
+
import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi';
|
|
3
|
+
import {Configuration} from '../configuration';
|
|
4
|
+
import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http';
|
|
5
|
+
import FormData from "form-data";
|
|
6
|
+
import { URLSearchParams } from 'url';
|
|
7
|
+
import {ObjectSerializer} from '../models/ObjectSerializer';
|
|
8
|
+
import {ApiException} from './exception';
|
|
9
|
+
import {canConsumeForm, isCodeInRange} from '../util';
|
|
10
|
+
import {SecurityAuthentication} from '../auth/auth';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import { BadRequestException } from '../models/BadRequestException';
|
|
14
|
+
import { ForbiddenException } from '../models/ForbiddenException';
|
|
15
|
+
import { GetInvoice404Response } from '../models/GetInvoice404Response';
|
|
16
|
+
import { GetInvoicesResponse } from '../models/GetInvoicesResponse';
|
|
17
|
+
import { InternalServerErrorException } from '../models/InternalServerErrorException';
|
|
18
|
+
import { Invoice } from '../models/Invoice';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* no description
|
|
22
|
+
*/
|
|
23
|
+
export class InvoicesApiRequestFactory extends BaseAPIRequestFactory {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Fetch an invoice
|
|
27
|
+
* @param id Either the Kanmon invoice UUID or your platform’s invoice ID, depending on `idType`.
|
|
28
|
+
* @param idType Which ID type to query the invoice by. Defaults to `KANMON`. Use `PLATFORM` if you want to query by your platform’s ID.
|
|
29
|
+
*/
|
|
30
|
+
public async getInvoice(id: string, idType?: 'KANMON' | 'PLATFORM', _options?: Configuration): Promise<RequestContext> {
|
|
31
|
+
let _config = _options || this.configuration;
|
|
32
|
+
|
|
33
|
+
// verify required parameter 'id' is not null or undefined
|
|
34
|
+
if (id === null || id === undefined) {
|
|
35
|
+
throw new RequiredError("InvoicesApi", "getInvoice", "id");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// Path Params
|
|
41
|
+
const localVarPath = '/api/platform/v2/invoices/{id}'
|
|
42
|
+
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|
43
|
+
|
|
44
|
+
// Make Request Context
|
|
45
|
+
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
|
|
46
|
+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
|
47
|
+
|
|
48
|
+
// Query Params
|
|
49
|
+
if (idType !== undefined) {
|
|
50
|
+
requestContext.setQueryParam("idType", ObjectSerializer.serialize(idType, "'KANMON' | 'PLATFORM'", ""));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
let authMethod: SecurityAuthentication | undefined;
|
|
55
|
+
// Apply auth methods
|
|
56
|
+
authMethod = _config.authMethods["Authorization"]
|
|
57
|
+
if (authMethod?.applySecurityAuthentication) {
|
|
58
|
+
await authMethod?.applySecurityAuthentication(requestContext);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
|
62
|
+
if (defaultAuth?.applySecurityAuthentication) {
|
|
63
|
+
await defaultAuth?.applySecurityAuthentication(requestContext);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return requestContext;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Fetch invoices
|
|
71
|
+
* @param statuses A comma delimited list of invoice statuses.
|
|
72
|
+
* @param ids A comma delimited list of Kanmon’s unique IDs for invoices.
|
|
73
|
+
* @param platformBusinessIds A comma delimited list of your platform’s unique IDs for businesses.
|
|
74
|
+
* @param businessIds A comma delimited list of Kanmon’s unique IDs for businesses.
|
|
75
|
+
* @param platformInvoiceIds A comma delimited list of your platforms’s unique IDs for invoices.
|
|
76
|
+
* @param offset The number of records to skip when performing pagination. Defaults to `0`.
|
|
77
|
+
* @param limit The number of records to limit when performing pagination. Defaults to `100`, which is the max.
|
|
78
|
+
* @param createdAtStart Filter for records where `createdAt` is greater than or equal to this value. ISO 8601 format.
|
|
79
|
+
* @param createdAtEnd Filter for records where `createdAt` is less than or equal to this value. ISO 8601 format.
|
|
80
|
+
*/
|
|
81
|
+
public async getInvoices(statuses?: string, ids?: string, platformBusinessIds?: string, businessIds?: string, platformInvoiceIds?: string, offset?: number, limit?: number, createdAtStart?: string, createdAtEnd?: string, _options?: Configuration): Promise<RequestContext> {
|
|
82
|
+
let _config = _options || this.configuration;
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
// Path Params
|
|
94
|
+
const localVarPath = '/api/platform/v2/invoices';
|
|
95
|
+
|
|
96
|
+
// Make Request Context
|
|
97
|
+
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
|
|
98
|
+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
|
99
|
+
|
|
100
|
+
// Query Params
|
|
101
|
+
if (statuses !== undefined) {
|
|
102
|
+
requestContext.setQueryParam("statuses", ObjectSerializer.serialize(statuses, "string", ""));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Query Params
|
|
106
|
+
if (ids !== undefined) {
|
|
107
|
+
requestContext.setQueryParam("ids", ObjectSerializer.serialize(ids, "string", ""));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Query Params
|
|
111
|
+
if (platformBusinessIds !== undefined) {
|
|
112
|
+
requestContext.setQueryParam("platformBusinessIds", ObjectSerializer.serialize(platformBusinessIds, "string", ""));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Query Params
|
|
116
|
+
if (businessIds !== undefined) {
|
|
117
|
+
requestContext.setQueryParam("businessIds", ObjectSerializer.serialize(businessIds, "string", ""));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Query Params
|
|
121
|
+
if (platformInvoiceIds !== undefined) {
|
|
122
|
+
requestContext.setQueryParam("platformInvoiceIds", ObjectSerializer.serialize(platformInvoiceIds, "string", ""));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Query Params
|
|
126
|
+
if (offset !== undefined) {
|
|
127
|
+
requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Query Params
|
|
131
|
+
if (limit !== undefined) {
|
|
132
|
+
requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Query Params
|
|
136
|
+
if (createdAtStart !== undefined) {
|
|
137
|
+
requestContext.setQueryParam("createdAtStart", ObjectSerializer.serialize(createdAtStart, "string", ""));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Query Params
|
|
141
|
+
if (createdAtEnd !== undefined) {
|
|
142
|
+
requestContext.setQueryParam("createdAtEnd", ObjectSerializer.serialize(createdAtEnd, "string", ""));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
let authMethod: SecurityAuthentication | undefined;
|
|
147
|
+
// Apply auth methods
|
|
148
|
+
authMethod = _config.authMethods["Authorization"]
|
|
149
|
+
if (authMethod?.applySecurityAuthentication) {
|
|
150
|
+
await authMethod?.applySecurityAuthentication(requestContext);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
|
154
|
+
if (defaultAuth?.applySecurityAuthentication) {
|
|
155
|
+
await defaultAuth?.applySecurityAuthentication(requestContext);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return requestContext;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export class InvoicesApiResponseProcessor {
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
|
|
167
|
+
* to the expected objects
|
|
168
|
+
*
|
|
169
|
+
* @params response Response returned by the server for a request to getInvoice
|
|
170
|
+
* @throws ApiException if the response code was not in [200, 299]
|
|
171
|
+
*/
|
|
172
|
+
public async getInvoiceWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Invoice >> {
|
|
173
|
+
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
|
|
174
|
+
if (isCodeInRange("200", response.httpStatusCode)) {
|
|
175
|
+
const body: Invoice = ObjectSerializer.deserialize(
|
|
176
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
177
|
+
"Invoice", ""
|
|
178
|
+
) as Invoice;
|
|
179
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
180
|
+
}
|
|
181
|
+
if (isCodeInRange("400", response.httpStatusCode)) {
|
|
182
|
+
const body: BadRequestException = ObjectSerializer.deserialize(
|
|
183
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
184
|
+
"BadRequestException", ""
|
|
185
|
+
) as BadRequestException;
|
|
186
|
+
throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
|
|
187
|
+
}
|
|
188
|
+
if (isCodeInRange("403", response.httpStatusCode)) {
|
|
189
|
+
const body: ForbiddenException = ObjectSerializer.deserialize(
|
|
190
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
191
|
+
"ForbiddenException", ""
|
|
192
|
+
) as ForbiddenException;
|
|
193
|
+
throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
|
|
194
|
+
}
|
|
195
|
+
if (isCodeInRange("404", response.httpStatusCode)) {
|
|
196
|
+
const body: GetInvoice404Response = ObjectSerializer.deserialize(
|
|
197
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
198
|
+
"GetInvoice404Response", ""
|
|
199
|
+
) as GetInvoice404Response;
|
|
200
|
+
throw new ApiException<GetInvoice404Response>(response.httpStatusCode, "InvoiceNotFoundException, BusinessNotFoundException", body, response.headers);
|
|
201
|
+
}
|
|
202
|
+
if (isCodeInRange("500", response.httpStatusCode)) {
|
|
203
|
+
const body: InternalServerErrorException = ObjectSerializer.deserialize(
|
|
204
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
205
|
+
"InternalServerErrorException", ""
|
|
206
|
+
) as InternalServerErrorException;
|
|
207
|
+
throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Work around for missing responses in specification, e.g. for petstore.yaml
|
|
211
|
+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
|
|
212
|
+
const body: Invoice = ObjectSerializer.deserialize(
|
|
213
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
214
|
+
"Invoice", ""
|
|
215
|
+
) as Invoice;
|
|
216
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
|
|
224
|
+
* to the expected objects
|
|
225
|
+
*
|
|
226
|
+
* @params response Response returned by the server for a request to getInvoices
|
|
227
|
+
* @throws ApiException if the response code was not in [200, 299]
|
|
228
|
+
*/
|
|
229
|
+
public async getInvoicesWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetInvoicesResponse >> {
|
|
230
|
+
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
|
|
231
|
+
if (isCodeInRange("200", response.httpStatusCode)) {
|
|
232
|
+
const body: GetInvoicesResponse = ObjectSerializer.deserialize(
|
|
233
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
234
|
+
"GetInvoicesResponse", ""
|
|
235
|
+
) as GetInvoicesResponse;
|
|
236
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
237
|
+
}
|
|
238
|
+
if (isCodeInRange("400", response.httpStatusCode)) {
|
|
239
|
+
const body: BadRequestException = ObjectSerializer.deserialize(
|
|
240
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
241
|
+
"BadRequestException", ""
|
|
242
|
+
) as BadRequestException;
|
|
243
|
+
throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
|
|
244
|
+
}
|
|
245
|
+
if (isCodeInRange("403", response.httpStatusCode)) {
|
|
246
|
+
const body: ForbiddenException = ObjectSerializer.deserialize(
|
|
247
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
248
|
+
"ForbiddenException", ""
|
|
249
|
+
) as ForbiddenException;
|
|
250
|
+
throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
|
|
251
|
+
}
|
|
252
|
+
if (isCodeInRange("500", response.httpStatusCode)) {
|
|
253
|
+
const body: InternalServerErrorException = ObjectSerializer.deserialize(
|
|
254
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
255
|
+
"InternalServerErrorException", ""
|
|
256
|
+
) as InternalServerErrorException;
|
|
257
|
+
throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Work around for missing responses in specification, e.g. for petstore.yaml
|
|
261
|
+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
|
|
262
|
+
const body: GetInvoicesResponse = ObjectSerializer.deserialize(
|
|
263
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
264
|
+
"GetInvoicesResponse", ""
|
|
265
|
+
) as GetInvoicesResponse;
|
|
266
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// TODO: better import syntax?
|
|
2
|
+
import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi';
|
|
3
|
+
import {Configuration} from '../configuration';
|
|
4
|
+
import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http';
|
|
5
|
+
import FormData from "form-data";
|
|
6
|
+
import { URLSearchParams } from 'url';
|
|
7
|
+
import {ObjectSerializer} from '../models/ObjectSerializer';
|
|
8
|
+
import {ApiException} from './exception';
|
|
9
|
+
import {canConsumeForm, isCodeInRange} from '../util';
|
|
10
|
+
import {SecurityAuthentication} from '../auth/auth';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import { BadRequestException } from '../models/BadRequestException';
|
|
14
|
+
import { ForbiddenException } from '../models/ForbiddenException';
|
|
15
|
+
import { GetIssuedProductsResponse } from '../models/GetIssuedProductsResponse';
|
|
16
|
+
import { InternalServerErrorException } from '../models/InternalServerErrorException';
|
|
17
|
+
import { IssuedProduct } from '../models/IssuedProduct';
|
|
18
|
+
import { IssuedProductNotFoundException } from '../models/IssuedProductNotFoundException';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* no description
|
|
22
|
+
*/
|
|
23
|
+
export class IssuedProductsApiRequestFactory extends BaseAPIRequestFactory {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Fetch issued products
|
|
27
|
+
* @param ids A comma delimited list of Kanmon’s unique IDs for offers.
|
|
28
|
+
* @param platformBusinessIds A comma delimited list of your platform’s unique IDs for businesses.
|
|
29
|
+
* @param businessIds A comma delimited list of Kanmon’s unique IDs for businesses.
|
|
30
|
+
* @param offset The number of records to skip when performing pagination. Defaults to `0`.
|
|
31
|
+
* @param limit The number of records to limit when performing pagination. Defaults to `100`, which is the max.
|
|
32
|
+
* @param createdAtStart Filter for records where `createdAt` is greater than or equal to this value. ISO 8601 format.
|
|
33
|
+
* @param createdAtEnd Filter for records where `createdAt` is less than or equal to this value. ISO 8601 format.
|
|
34
|
+
*/
|
|
35
|
+
public async getAllIssuedProducts(ids?: string, platformBusinessIds?: string, businessIds?: string, offset?: number, limit?: number, createdAtStart?: string, createdAtEnd?: string, _options?: Configuration): Promise<RequestContext> {
|
|
36
|
+
let _config = _options || this.configuration;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// Path Params
|
|
46
|
+
const localVarPath = '/api/platform/v2/issued-products';
|
|
47
|
+
|
|
48
|
+
// Make Request Context
|
|
49
|
+
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
|
|
50
|
+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
|
51
|
+
|
|
52
|
+
// Query Params
|
|
53
|
+
if (ids !== undefined) {
|
|
54
|
+
requestContext.setQueryParam("ids", ObjectSerializer.serialize(ids, "string", ""));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Query Params
|
|
58
|
+
if (platformBusinessIds !== undefined) {
|
|
59
|
+
requestContext.setQueryParam("platformBusinessIds", ObjectSerializer.serialize(platformBusinessIds, "string", ""));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Query Params
|
|
63
|
+
if (businessIds !== undefined) {
|
|
64
|
+
requestContext.setQueryParam("businessIds", ObjectSerializer.serialize(businessIds, "string", ""));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Query Params
|
|
68
|
+
if (offset !== undefined) {
|
|
69
|
+
requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Query Params
|
|
73
|
+
if (limit !== undefined) {
|
|
74
|
+
requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Query Params
|
|
78
|
+
if (createdAtStart !== undefined) {
|
|
79
|
+
requestContext.setQueryParam("createdAtStart", ObjectSerializer.serialize(createdAtStart, "string", ""));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Query Params
|
|
83
|
+
if (createdAtEnd !== undefined) {
|
|
84
|
+
requestContext.setQueryParam("createdAtEnd", ObjectSerializer.serialize(createdAtEnd, "string", ""));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
let authMethod: SecurityAuthentication | undefined;
|
|
89
|
+
// Apply auth methods
|
|
90
|
+
authMethod = _config.authMethods["Authorization"]
|
|
91
|
+
if (authMethod?.applySecurityAuthentication) {
|
|
92
|
+
await authMethod?.applySecurityAuthentication(requestContext);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
|
96
|
+
if (defaultAuth?.applySecurityAuthentication) {
|
|
97
|
+
await defaultAuth?.applySecurityAuthentication(requestContext);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return requestContext;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Fetch an issued product
|
|
105
|
+
* @param id The Kanmon issued product UUID.
|
|
106
|
+
*/
|
|
107
|
+
public async getIssuedProductById(id: string, _options?: Configuration): Promise<RequestContext> {
|
|
108
|
+
let _config = _options || this.configuration;
|
|
109
|
+
|
|
110
|
+
// verify required parameter 'id' is not null or undefined
|
|
111
|
+
if (id === null || id === undefined) {
|
|
112
|
+
throw new RequiredError("IssuedProductsApi", "getIssuedProductById", "id");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// Path Params
|
|
117
|
+
const localVarPath = '/api/platform/v2/issued-products/{id}'
|
|
118
|
+
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|
119
|
+
|
|
120
|
+
// Make Request Context
|
|
121
|
+
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
|
|
122
|
+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
let authMethod: SecurityAuthentication | undefined;
|
|
126
|
+
// Apply auth methods
|
|
127
|
+
authMethod = _config.authMethods["Authorization"]
|
|
128
|
+
if (authMethod?.applySecurityAuthentication) {
|
|
129
|
+
await authMethod?.applySecurityAuthentication(requestContext);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
|
133
|
+
if (defaultAuth?.applySecurityAuthentication) {
|
|
134
|
+
await defaultAuth?.applySecurityAuthentication(requestContext);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return requestContext;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export class IssuedProductsApiResponseProcessor {
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
|
|
146
|
+
* to the expected objects
|
|
147
|
+
*
|
|
148
|
+
* @params response Response returned by the server for a request to getAllIssuedProducts
|
|
149
|
+
* @throws ApiException if the response code was not in [200, 299]
|
|
150
|
+
*/
|
|
151
|
+
public async getAllIssuedProductsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetIssuedProductsResponse >> {
|
|
152
|
+
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
|
|
153
|
+
if (isCodeInRange("200", response.httpStatusCode)) {
|
|
154
|
+
const body: GetIssuedProductsResponse = ObjectSerializer.deserialize(
|
|
155
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
156
|
+
"GetIssuedProductsResponse", ""
|
|
157
|
+
) as GetIssuedProductsResponse;
|
|
158
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
159
|
+
}
|
|
160
|
+
if (isCodeInRange("400", response.httpStatusCode)) {
|
|
161
|
+
const body: BadRequestException = ObjectSerializer.deserialize(
|
|
162
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
163
|
+
"BadRequestException", ""
|
|
164
|
+
) as BadRequestException;
|
|
165
|
+
throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
|
|
166
|
+
}
|
|
167
|
+
if (isCodeInRange("403", response.httpStatusCode)) {
|
|
168
|
+
const body: ForbiddenException = ObjectSerializer.deserialize(
|
|
169
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
170
|
+
"ForbiddenException", ""
|
|
171
|
+
) as ForbiddenException;
|
|
172
|
+
throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
|
|
173
|
+
}
|
|
174
|
+
if (isCodeInRange("500", response.httpStatusCode)) {
|
|
175
|
+
const body: InternalServerErrorException = ObjectSerializer.deserialize(
|
|
176
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
177
|
+
"InternalServerErrorException", ""
|
|
178
|
+
) as InternalServerErrorException;
|
|
179
|
+
throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Work around for missing responses in specification, e.g. for petstore.yaml
|
|
183
|
+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
|
|
184
|
+
const body: GetIssuedProductsResponse = ObjectSerializer.deserialize(
|
|
185
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
186
|
+
"GetIssuedProductsResponse", ""
|
|
187
|
+
) as GetIssuedProductsResponse;
|
|
188
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
|
|
196
|
+
* to the expected objects
|
|
197
|
+
*
|
|
198
|
+
* @params response Response returned by the server for a request to getIssuedProductById
|
|
199
|
+
* @throws ApiException if the response code was not in [200, 299]
|
|
200
|
+
*/
|
|
201
|
+
public async getIssuedProductByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<IssuedProduct >> {
|
|
202
|
+
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
|
|
203
|
+
if (isCodeInRange("200", response.httpStatusCode)) {
|
|
204
|
+
const body: IssuedProduct = ObjectSerializer.deserialize(
|
|
205
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
206
|
+
"IssuedProduct", ""
|
|
207
|
+
) as IssuedProduct;
|
|
208
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
209
|
+
}
|
|
210
|
+
if (isCodeInRange("400", response.httpStatusCode)) {
|
|
211
|
+
const body: BadRequestException = ObjectSerializer.deserialize(
|
|
212
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
213
|
+
"BadRequestException", ""
|
|
214
|
+
) as BadRequestException;
|
|
215
|
+
throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
|
|
216
|
+
}
|
|
217
|
+
if (isCodeInRange("403", response.httpStatusCode)) {
|
|
218
|
+
const body: ForbiddenException = ObjectSerializer.deserialize(
|
|
219
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
220
|
+
"ForbiddenException", ""
|
|
221
|
+
) as ForbiddenException;
|
|
222
|
+
throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
|
|
223
|
+
}
|
|
224
|
+
if (isCodeInRange("404", response.httpStatusCode)) {
|
|
225
|
+
const body: IssuedProductNotFoundException = ObjectSerializer.deserialize(
|
|
226
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
227
|
+
"IssuedProductNotFoundException", ""
|
|
228
|
+
) as IssuedProductNotFoundException;
|
|
229
|
+
throw new ApiException<IssuedProductNotFoundException>(response.httpStatusCode, "IssuedProductNotFoundException", body, response.headers);
|
|
230
|
+
}
|
|
231
|
+
if (isCodeInRange("500", response.httpStatusCode)) {
|
|
232
|
+
const body: InternalServerErrorException = ObjectSerializer.deserialize(
|
|
233
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
234
|
+
"InternalServerErrorException", ""
|
|
235
|
+
) as InternalServerErrorException;
|
|
236
|
+
throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Work around for missing responses in specification, e.g. for petstore.yaml
|
|
240
|
+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
|
|
241
|
+
const body: IssuedProduct = ObjectSerializer.deserialize(
|
|
242
|
+
ObjectSerializer.parse(await response.body.text(), contentType),
|
|
243
|
+
"IssuedProduct", ""
|
|
244
|
+
) as IssuedProduct;
|
|
245
|
+
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
}
|