vayu-ts 0.0.4 → 0.0.13
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 +1 -1
- package/package.json +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -17
- package/dist/openapi/apis/AuthApi.d.ts +0 -26
- package/dist/openapi/apis/AuthApi.js +0 -93
- package/dist/openapi/apis/ContractsApi.d.ts +0 -72
- package/dist/openapi/apis/ContractsApi.js +0 -307
- package/dist/openapi/apis/CreditsApi.d.ts +0 -57
- package/dist/openapi/apis/CreditsApi.js +0 -248
- package/dist/openapi/apis/CustomersApi.d.ts +0 -89
- package/dist/openapi/apis/CustomersApi.js +0 -388
- package/dist/openapi/apis/EventsApi.d.ts +0 -91
- package/dist/openapi/apis/EventsApi.js +0 -408
- package/dist/openapi/apis/IntegrationsApi.d.ts +0 -41
- package/dist/openapi/apis/IntegrationsApi.js +0 -170
- package/dist/openapi/apis/InvoicesApi.d.ts +0 -41
- package/dist/openapi/apis/InvoicesApi.js +0 -166
- package/dist/openapi/apis/MetersApi.d.ts +0 -73
- package/dist/openapi/apis/MetersApi.js +0 -316
- package/dist/openapi/apis/PlansApi.d.ts +0 -56
- package/dist/openapi/apis/PlansApi.js +0 -235
- package/dist/openapi/apis/ReportsApi.d.ts +0 -41
- package/dist/openapi/apis/ReportsApi.js +0 -166
- package/dist/openapi/apis/WebhooksApi.d.ts +0 -25
- package/dist/openapi/apis/WebhooksApi.js +0 -101
- package/dist/openapi/apis/baseapi.d.ts +0 -33
- package/dist/openapi/apis/baseapi.js +0 -41
- package/dist/openapi/apis/exception.d.ts +0 -19
- package/dist/openapi/apis/exception.js +0 -22
- package/dist/openapi/auth/auth.d.ts +0 -54
- package/dist/openapi/auth/auth.js +0 -50
- package/dist/openapi/configuration.d.ts +0 -63
- package/dist/openapi/configuration.js +0 -34
- package/dist/openapi/http/http.d.ts +0 -142
- package/dist/openapi/http/http.js +0 -229
- package/dist/openapi/http/isomorphic-fetch.d.ts +0 -5
- package/dist/openapi/http/isomorphic-fetch.js +0 -33
- package/dist/openapi/index.d.ts +0 -10
- package/dist/openapi/index.js +0 -38
- package/dist/openapi/middleware.d.ts +0 -54
- package/dist/openapi/middleware.js +0 -16
- package/dist/openapi/models/AggregationMethod.d.ts +0 -40
- package/dist/openapi/models/AggregationMethod.js +0 -46
- package/dist/openapi/models/AggregationOperator.d.ts +0 -24
- package/dist/openapi/models/AggregationOperator.js +0 -28
- package/dist/openapi/models/BillingCycleStatus.d.ts +0 -15
- package/dist/openapi/models/BillingCycleStatus.js +0 -19
- package/dist/openapi/models/BillingInterval.d.ts +0 -18
- package/dist/openapi/models/BillingInterval.js +0 -22
- package/dist/openapi/models/Condition.d.ts +0 -29
- package/dist/openapi/models/Condition.js +0 -31
- package/dist/openapi/models/ContractStatus.d.ts +0 -18
- package/dist/openapi/models/ContractStatus.js +0 -22
- package/dist/openapi/models/CreateContractRequest.d.ts +0 -43
- package/dist/openapi/models/CreateContractRequest.js +0 -49
- package/dist/openapi/models/CreateContractResponse.d.ts +0 -29
- package/dist/openapi/models/CreateContractResponse.js +0 -31
- package/dist/openapi/models/CreateCustomerRequest.d.ts +0 -35
- package/dist/openapi/models/CreateCustomerRequest.js +0 -37
- package/dist/openapi/models/CreateCustomerResponse.d.ts +0 -29
- package/dist/openapi/models/CreateCustomerResponse.js +0 -31
- package/dist/openapi/models/CreateCustomerResponseCustomer.d.ts +0 -38
- package/dist/openapi/models/CreateCustomerResponseCustomer.js +0 -55
- package/dist/openapi/models/CreditLedgerEntry.d.ts +0 -32
- package/dist/openapi/models/CreditLedgerEntry.js +0 -49
- package/dist/openapi/models/Criterion.d.ts +0 -31
- package/dist/openapi/models/Criterion.js +0 -43
- package/dist/openapi/models/CriterionOperator.d.ts +0 -23
- package/dist/openapi/models/CriterionOperator.js +0 -27
- package/dist/openapi/models/Currency.d.ts +0 -17
- package/dist/openapi/models/Currency.js +0 -21
- package/dist/openapi/models/DeductCreditsRequest.d.ts +0 -35
- package/dist/openapi/models/DeductCreditsRequest.js +0 -37
- package/dist/openapi/models/DeleteContractResponse.d.ts +0 -29
- package/dist/openapi/models/DeleteContractResponse.js +0 -31
- package/dist/openapi/models/DeleteContractResponseContract.d.ts +0 -47
- package/dist/openapi/models/DeleteContractResponseContract.js +0 -73
- package/dist/openapi/models/DeleteCustomerResponse.d.ts +0 -29
- package/dist/openapi/models/DeleteCustomerResponse.js +0 -31
- package/dist/openapi/models/DeleteCustomerResponseCustomer.d.ts +0 -39
- package/dist/openapi/models/DeleteCustomerResponseCustomer.js +0 -61
- package/dist/openapi/models/DeleteEventResponse.d.ts +0 -29
- package/dist/openapi/models/DeleteEventResponse.js +0 -31
- package/dist/openapi/models/DeleteEventResponseEvent.d.ts +0 -56
- package/dist/openapi/models/DeleteEventResponseEvent.js +0 -82
- package/dist/openapi/models/DeleteMeterResponse.d.ts +0 -29
- package/dist/openapi/models/DeleteMeterResponse.js +0 -31
- package/dist/openapi/models/DeleteMeterResponseMeter.d.ts +0 -43
- package/dist/openapi/models/DeleteMeterResponseMeter.js +0 -73
- package/dist/openapi/models/DeletePlanResponse.d.ts +0 -29
- package/dist/openapi/models/DeletePlanResponse.js +0 -31
- package/dist/openapi/models/DeletePlanResponsePlan.d.ts +0 -39
- package/dist/openapi/models/DeletePlanResponsePlan.js +0 -67
- package/dist/openapi/models/Event.d.ts +0 -49
- package/dist/openapi/models/Event.js +0 -55
- package/dist/openapi/models/EventsDryRunRequest.d.ts +0 -29
- package/dist/openapi/models/EventsDryRunRequest.js +0 -31
- package/dist/openapi/models/EventsDryRunResponse.d.ts +0 -29
- package/dist/openapi/models/EventsDryRunResponse.js +0 -31
- package/dist/openapi/models/EventsDryRunResponseObject.d.ts +0 -32
- package/dist/openapi/models/EventsDryRunResponseObject.js +0 -43
- package/dist/openapi/models/EventsDryRunResponseObjectEvent.d.ts +0 -35
- package/dist/openapi/models/EventsDryRunResponseObjectEvent.js +0 -61
- package/dist/openapi/models/EventsDryRunResponseObjectMeterWithValuesInner.d.ts +0 -41
- package/dist/openapi/models/EventsDryRunResponseObjectMeterWithValuesInner.js +0 -61
- package/dist/openapi/models/Filter.d.ts +0 -32
- package/dist/openapi/models/Filter.js +0 -34
- package/dist/openapi/models/GetCommitmentReportResponse.d.ts +0 -44
- package/dist/openapi/models/GetCommitmentReportResponse.js +0 -115
- package/dist/openapi/models/GetContractResponse.d.ts +0 -29
- package/dist/openapi/models/GetContractResponse.js +0 -31
- package/dist/openapi/models/GetContractResponseContract.d.ts +0 -46
- package/dist/openapi/models/GetContractResponseContract.js +0 -67
- package/dist/openapi/models/GetCustomerResponse.d.ts +0 -29
- package/dist/openapi/models/GetCustomerResponse.js +0 -31
- package/dist/openapi/models/GetEventResponse.d.ts +0 -29
- package/dist/openapi/models/GetEventResponse.js +0 -31
- package/dist/openapi/models/GetEventResponseEvent.d.ts +0 -55
- package/dist/openapi/models/GetEventResponseEvent.js +0 -76
- package/dist/openapi/models/GetInvoiceResponse.d.ts +0 -29
- package/dist/openapi/models/GetInvoiceResponse.js +0 -31
- package/dist/openapi/models/GetInvoiceResponseInvoice.d.ts +0 -50
- package/dist/openapi/models/GetInvoiceResponseInvoice.js +0 -79
- package/dist/openapi/models/GetMeterResponse.d.ts +0 -29
- package/dist/openapi/models/GetMeterResponse.js +0 -31
- package/dist/openapi/models/GetMeterResponseMeter.d.ts +0 -42
- package/dist/openapi/models/GetMeterResponseMeter.js +0 -67
- package/dist/openapi/models/GetPlanResponse.d.ts +0 -29
- package/dist/openapi/models/GetPlanResponse.js +0 -31
- package/dist/openapi/models/GetPlanResponsePlan.d.ts +0 -38
- package/dist/openapi/models/GetPlanResponsePlan.js +0 -61
- package/dist/openapi/models/GetProductsUsageReportResponse.d.ts +0 -44
- package/dist/openapi/models/GetProductsUsageReportResponse.js +0 -115
- package/dist/openapi/models/GrantCreditsRequest.d.ts +0 -35
- package/dist/openapi/models/GrantCreditsRequest.js +0 -37
- package/dist/openapi/models/InvalidEvent.d.ts +0 -33
- package/dist/openapi/models/InvalidEvent.js +0 -37
- package/dist/openapi/models/LineItem.d.ts +0 -35
- package/dist/openapi/models/LineItem.js +0 -37
- package/dist/openapi/models/ListContractsResponse.d.ts +0 -32
- package/dist/openapi/models/ListContractsResponse.js +0 -49
- package/dist/openapi/models/ListCreditLedgerEntriesResponse.d.ts +0 -32
- package/dist/openapi/models/ListCreditLedgerEntriesResponse.js +0 -31
- package/dist/openapi/models/ListCustomersResponse.d.ts +0 -32
- package/dist/openapi/models/ListCustomersResponse.js +0 -49
- package/dist/openapi/models/ListInvoicesResponse.d.ts +0 -32
- package/dist/openapi/models/ListInvoicesResponse.js +0 -49
- package/dist/openapi/models/ListMetersResponse.d.ts +0 -32
- package/dist/openapi/models/ListMetersResponse.js +0 -49
- package/dist/openapi/models/ListPlansResponse.d.ts +0 -32
- package/dist/openapi/models/ListPlansResponse.js +0 -49
- package/dist/openapi/models/LoginRequest.d.ts +0 -31
- package/dist/openapi/models/LoginRequest.js +0 -31
- package/dist/openapi/models/LoginResponse.d.ts +0 -31
- package/dist/openapi/models/LoginResponse.js +0 -31
- package/dist/openapi/models/Meter.d.ts +0 -39
- package/dist/openapi/models/Meter.js +0 -49
- package/dist/openapi/models/NetSuiteExportSalesOrderRequest.d.ts +0 -30
- package/dist/openapi/models/NetSuiteExportSalesOrderRequest.js +0 -43
- package/dist/openapi/models/NetSuiteSyncInvoicesRequest.d.ts +0 -34
- package/dist/openapi/models/NetSuiteSyncInvoicesRequest.js +0 -47
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestData.d.ts +0 -39
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestData.js +0 -85
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataEntity.d.ts +0 -28
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataEntity.js +0 -31
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItem.d.ts +0 -29
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItem.js +0 -31
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItemItemsInner.d.ts +0 -33
- package/dist/openapi/models/NetSuiteSyncInvoicesRequestDataItemItemsInner.js +0 -55
- package/dist/openapi/models/NetSuiteSyncInvoicesResponse.d.ts +0 -29
- package/dist/openapi/models/NetSuiteSyncInvoicesResponse.js +0 -37
- package/dist/openapi/models/NotificationEventType.d.ts +0 -17
- package/dist/openapi/models/NotificationEventType.js +0 -21
- package/dist/openapi/models/ObjectSerializer.d.ts +0 -106
- package/dist/openapi/models/ObjectSerializer.js +0 -488
- package/dist/openapi/models/PaymentTerm.d.ts +0 -15
- package/dist/openapi/models/PaymentTerm.js +0 -19
- package/dist/openapi/models/Period.d.ts +0 -32
- package/dist/openapi/models/Period.js +0 -40
- package/dist/openapi/models/PlanBillingData.d.ts +0 -37
- package/dist/openapi/models/PlanBillingData.js +0 -58
- package/dist/openapi/models/PlanStatus.d.ts +0 -19
- package/dist/openapi/models/PlanStatus.js +0 -23
- package/dist/openapi/models/QueryEventsResponse.d.ts +0 -32
- package/dist/openapi/models/QueryEventsResponse.js +0 -31
- package/dist/openapi/models/QueryEventsResponseEventsInner.d.ts +0 -52
- package/dist/openapi/models/QueryEventsResponseEventsInner.js +0 -73
- package/dist/openapi/models/SendEventsRequest.d.ts +0 -29
- package/dist/openapi/models/SendEventsRequest.js +0 -31
- package/dist/openapi/models/SendEventsResponse.d.ts +0 -37
- package/dist/openapi/models/SendEventsResponse.js +0 -37
- package/dist/openapi/models/UpdateCustomerRequest.d.ts +0 -35
- package/dist/openapi/models/UpdateCustomerRequest.js +0 -37
- package/dist/openapi/models/UpdateCustomerResponse.d.ts +0 -29
- package/dist/openapi/models/UpdateCustomerResponse.js +0 -31
- package/dist/openapi/models/UpdateMeterRequest.d.ts +0 -39
- package/dist/openapi/models/UpdateMeterRequest.js +0 -49
- package/dist/openapi/models/UpdateMeterResponse.d.ts +0 -29
- package/dist/openapi/models/UpdateMeterResponse.js +0 -31
- package/dist/openapi/models/WebhookSubscribeRequest.d.ts +0 -30
- package/dist/openapi/models/WebhookSubscribeRequest.js +0 -37
- package/dist/openapi/models/all.d.ts +0 -79
- package/dist/openapi/models/all.js +0 -95
- package/dist/openapi/rxjsStub.d.ts +0 -10
- package/dist/openapi/rxjsStub.js +0 -31
- package/dist/openapi/servers.d.ts +0 -39
- package/dist/openapi/servers.js +0 -52
- package/dist/openapi/types/ObjectParamAPI.d.ts +0 -825
- package/dist/openapi/types/ObjectParamAPI.js +0 -590
- package/dist/openapi/types/ObservableAPI.d.ts +0 -532
- package/dist/openapi/types/ObservableAPI.js +0 -1060
- package/dist/openapi/types/PromiseAPI.d.ts +0 -509
- package/dist/openapi/types/PromiseAPI.js +0 -684
- package/dist/openapi/util.d.ts +0 -15
- package/dist/openapi/util.js +0 -42
- package/dist/sdk/clients/ContractsClient.d.ts +0 -10
- package/dist/sdk/clients/ContractsClient.js +0 -42
- package/dist/sdk/clients/CustomersClient.d.ts +0 -11
- package/dist/sdk/clients/CustomersClient.js +0 -47
- package/dist/sdk/clients/EventsClient.d.ts +0 -11
- package/dist/sdk/clients/EventsClient.js +0 -49
- package/dist/sdk/clients/InvoicesClient.d.ts +0 -7
- package/dist/sdk/clients/InvoicesClient.js +0 -32
- package/dist/sdk/clients/MetersClient.d.ts +0 -10
- package/dist/sdk/clients/MetersClient.js +0 -42
- package/dist/sdk/clients/PlansClient.d.ts +0 -8
- package/dist/sdk/clients/PlansClient.js +0 -37
- package/dist/sdk/clients/index.d.ts +0 -6
- package/dist/sdk/clients/index.js +0 -22
- package/dist/sdk/index.d.ts +0 -13
- package/dist/sdk/index.js +0 -59
- package/dist/sdk/services/configuration.service.d.ts +0 -21
- package/dist/sdk/services/configuration.service.js +0 -104
- package/dist/sdk/services/index.d.ts +0 -1
- package/dist/sdk/services/index.js +0 -17
- package/dist/sdk/types/Contracts.d.ts +0 -1
- package/dist/sdk/types/Contracts.js +0 -2
- package/dist/sdk/types/Customers.d.ts +0 -1
- package/dist/sdk/types/Customers.js +0 -2
- package/dist/sdk/types/Events.d.ts +0 -1
- package/dist/sdk/types/Events.js +0 -2
- package/dist/sdk/types/Invoices.d.ts +0 -1
- package/dist/sdk/types/Invoices.js +0 -2
- package/dist/sdk/types/Meters.d.ts +0 -1
- package/dist/sdk/types/Meters.js +0 -2
- package/dist/sdk/types/Plans.d.ts +0 -1
- package/dist/sdk/types/Plans.js +0 -2
- package/dist/sdk/types/index.d.ts +0 -7
- package/dist/sdk/types/index.js +0 -23
- package/dist/sdk/types/pagination-options.d.ts +0 -4
- package/dist/sdk/types/pagination-options.js +0 -2
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -17
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents an error caused by an api call i.e. it has attributes for a HTTP status code
|
|
3
|
-
* and the returned body object.
|
|
4
|
-
*
|
|
5
|
-
* Example
|
|
6
|
-
* API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299]
|
|
7
|
-
* => ApiException(404, someErrorMessageObject)
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare class ApiException<T> extends Error {
|
|
11
|
-
code: number;
|
|
12
|
-
body: T;
|
|
13
|
-
headers: {
|
|
14
|
-
[key: string]: string;
|
|
15
|
-
};
|
|
16
|
-
constructor(code: number, message: string, body: T, headers: {
|
|
17
|
-
[key: string]: string;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiException = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Represents an error caused by an api call i.e. it has attributes for a HTTP status code
|
|
6
|
-
* and the returned body object.
|
|
7
|
-
*
|
|
8
|
-
* Example
|
|
9
|
-
* API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299]
|
|
10
|
-
* => ApiException(404, someErrorMessageObject)
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
class ApiException extends Error {
|
|
14
|
-
constructor(code, message, body, headers) {
|
|
15
|
-
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
|
|
16
|
-
JSON.stringify(headers));
|
|
17
|
-
this.code = code;
|
|
18
|
-
this.body = body;
|
|
19
|
-
this.headers = headers;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.ApiException = ApiException;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { RequestContext } from "../http/http";
|
|
2
|
-
/**
|
|
3
|
-
* Interface authentication schemes.
|
|
4
|
-
*/
|
|
5
|
-
export interface SecurityAuthentication {
|
|
6
|
-
getName(): string;
|
|
7
|
-
/**
|
|
8
|
-
* Applies the authentication scheme to the request context
|
|
9
|
-
*
|
|
10
|
-
* @params context the request context which should use this authentication scheme
|
|
11
|
-
*/
|
|
12
|
-
applySecurityAuthentication(context: RequestContext): void | Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
export interface TokenProvider {
|
|
15
|
-
getToken(): Promise<string> | string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Applies http authentication to the request context.
|
|
19
|
-
*/
|
|
20
|
-
export declare class BearerAuthorizerAuthentication implements SecurityAuthentication {
|
|
21
|
-
private tokenProvider;
|
|
22
|
-
/**
|
|
23
|
-
* Configures the http authentication with the required details.
|
|
24
|
-
*
|
|
25
|
-
* @param tokenProvider service that can provide the up-to-date token when needed
|
|
26
|
-
*/
|
|
27
|
-
constructor(tokenProvider: TokenProvider);
|
|
28
|
-
getName(): string;
|
|
29
|
-
applySecurityAuthentication(context: RequestContext): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
export type AuthMethods = {
|
|
32
|
-
"default"?: SecurityAuthentication;
|
|
33
|
-
"BearerAuthorizer"?: SecurityAuthentication;
|
|
34
|
-
};
|
|
35
|
-
export type ApiKeyConfiguration = string;
|
|
36
|
-
export type HttpBasicConfiguration = {
|
|
37
|
-
"username": string;
|
|
38
|
-
"password": string;
|
|
39
|
-
};
|
|
40
|
-
export type HttpBearerConfiguration = {
|
|
41
|
-
tokenProvider: TokenProvider;
|
|
42
|
-
};
|
|
43
|
-
export type OAuth2Configuration = {
|
|
44
|
-
accessToken: string;
|
|
45
|
-
};
|
|
46
|
-
export type AuthMethodsConfiguration = {
|
|
47
|
-
"default"?: SecurityAuthentication;
|
|
48
|
-
"BearerAuthorizer"?: HttpBearerConfiguration;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Creates the authentication methods from a swagger description.
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
export declare function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.configureAuthMethods = exports.BearerAuthorizerAuthentication = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* Applies http authentication to the request context.
|
|
15
|
-
*/
|
|
16
|
-
class BearerAuthorizerAuthentication {
|
|
17
|
-
/**
|
|
18
|
-
* Configures the http authentication with the required details.
|
|
19
|
-
*
|
|
20
|
-
* @param tokenProvider service that can provide the up-to-date token when needed
|
|
21
|
-
*/
|
|
22
|
-
constructor(tokenProvider) {
|
|
23
|
-
this.tokenProvider = tokenProvider;
|
|
24
|
-
}
|
|
25
|
-
getName() {
|
|
26
|
-
return "BearerAuthorizer";
|
|
27
|
-
}
|
|
28
|
-
applySecurityAuthentication(context) {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
context.setHeaderParam("Authorization", "Bearer " + (yield this.tokenProvider.getToken()));
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.BearerAuthorizerAuthentication = BearerAuthorizerAuthentication;
|
|
35
|
-
/**
|
|
36
|
-
* Creates the authentication methods from a swagger description.
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
function configureAuthMethods(config) {
|
|
40
|
-
let authMethods = {};
|
|
41
|
-
if (!config) {
|
|
42
|
-
return authMethods;
|
|
43
|
-
}
|
|
44
|
-
authMethods["default"] = config["default"];
|
|
45
|
-
if (config["BearerAuthorizer"]) {
|
|
46
|
-
authMethods["BearerAuthorizer"] = new BearerAuthorizerAuthentication(config["BearerAuthorizer"]["tokenProvider"]);
|
|
47
|
-
}
|
|
48
|
-
return authMethods;
|
|
49
|
-
}
|
|
50
|
-
exports.configureAuthMethods = configureAuthMethods;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { HttpLibrary } from "./http/http";
|
|
2
|
-
import { Middleware, PromiseMiddleware } from "./middleware";
|
|
3
|
-
import { BaseServerConfiguration } from "./servers";
|
|
4
|
-
import { AuthMethods, AuthMethodsConfiguration } from "./auth/auth";
|
|
5
|
-
export interface Configuration {
|
|
6
|
-
readonly baseServer: BaseServerConfiguration;
|
|
7
|
-
readonly httpApi: HttpLibrary;
|
|
8
|
-
readonly middleware: Middleware[];
|
|
9
|
-
readonly authMethods: AuthMethods;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Interface with which a configuration object can be configured.
|
|
13
|
-
*/
|
|
14
|
-
export interface ConfigurationParameters {
|
|
15
|
-
/**
|
|
16
|
-
* Default server to use - a list of available servers (according to the
|
|
17
|
-
* OpenAPI yaml definition) is included in the `servers` const in `./servers`. You can also
|
|
18
|
-
* create your own server with the `ServerConfiguration` class from the same
|
|
19
|
-
* file.
|
|
20
|
-
*/
|
|
21
|
-
baseServer?: BaseServerConfiguration;
|
|
22
|
-
/**
|
|
23
|
-
* HTTP library to use e.g. IsomorphicFetch. This can usually be skipped as
|
|
24
|
-
* all generators come with a default library.
|
|
25
|
-
* If available, additional libraries can be imported from `./http/*`
|
|
26
|
-
*/
|
|
27
|
-
httpApi?: HttpLibrary;
|
|
28
|
-
/**
|
|
29
|
-
* The middlewares which will be applied to requests and responses. You can
|
|
30
|
-
* add any number of middleware components to modify requests before they
|
|
31
|
-
* are sent or before they are deserialized by implementing the `Middleware`
|
|
32
|
-
* interface defined in `./middleware`
|
|
33
|
-
*/
|
|
34
|
-
middleware?: Middleware[];
|
|
35
|
-
/**
|
|
36
|
-
* Configures middleware functions that return promises instead of
|
|
37
|
-
* Observables (which are used by `middleware`). Otherwise allows for the
|
|
38
|
-
* same functionality as `middleware`, i.e., modifying requests before they
|
|
39
|
-
* are sent and before they are deserialized.
|
|
40
|
-
*/
|
|
41
|
-
promiseMiddleware?: PromiseMiddleware[];
|
|
42
|
-
/**
|
|
43
|
-
* Configuration for the available authentication methods (e.g., api keys)
|
|
44
|
-
* according to the OpenAPI yaml definition. For the definition, please refer to
|
|
45
|
-
* `./auth/auth`
|
|
46
|
-
*/
|
|
47
|
-
authMethods?: AuthMethodsConfiguration;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Provide your `ConfigurationParameters` to this function to get a `Configuration`
|
|
51
|
-
* object that can be used to configure your APIs (in the constructor or
|
|
52
|
-
* for each request individually).
|
|
53
|
-
*
|
|
54
|
-
* If a property is not included in conf, a default is used:
|
|
55
|
-
* - baseServer: server1
|
|
56
|
-
* - httpApi: IsomorphicFetchHttpLibrary
|
|
57
|
-
* - middleware: []
|
|
58
|
-
* - promiseMiddleware: []
|
|
59
|
-
* - authMethods: {}
|
|
60
|
-
*
|
|
61
|
-
* @param conf partial configuration
|
|
62
|
-
*/
|
|
63
|
-
export declare function createConfiguration(conf?: ConfigurationParameters): Configuration;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createConfiguration = void 0;
|
|
4
|
-
const middleware_1 = require("./middleware");
|
|
5
|
-
const isomorphic_fetch_1 = require("./http/isomorphic-fetch");
|
|
6
|
-
const servers_1 = require("./servers");
|
|
7
|
-
const auth_1 = require("./auth/auth");
|
|
8
|
-
/**
|
|
9
|
-
* Provide your `ConfigurationParameters` to this function to get a `Configuration`
|
|
10
|
-
* object that can be used to configure your APIs (in the constructor or
|
|
11
|
-
* for each request individually).
|
|
12
|
-
*
|
|
13
|
-
* If a property is not included in conf, a default is used:
|
|
14
|
-
* - baseServer: server1
|
|
15
|
-
* - httpApi: IsomorphicFetchHttpLibrary
|
|
16
|
-
* - middleware: []
|
|
17
|
-
* - promiseMiddleware: []
|
|
18
|
-
* - authMethods: {}
|
|
19
|
-
*
|
|
20
|
-
* @param conf partial configuration
|
|
21
|
-
*/
|
|
22
|
-
function createConfiguration(conf = {}) {
|
|
23
|
-
const configuration = {
|
|
24
|
-
baseServer: conf.baseServer !== undefined ? conf.baseServer : servers_1.server1,
|
|
25
|
-
httpApi: conf.httpApi || new isomorphic_fetch_1.IsomorphicFetchHttpLibrary(),
|
|
26
|
-
middleware: conf.middleware || [],
|
|
27
|
-
authMethods: (0, auth_1.configureAuthMethods)(conf.authMethods)
|
|
28
|
-
};
|
|
29
|
-
if (conf.promiseMiddleware) {
|
|
30
|
-
conf.promiseMiddleware.forEach(m => configuration.middleware.push(new middleware_1.PromiseMiddlewareWrapper(m)));
|
|
31
|
-
}
|
|
32
|
-
return configuration;
|
|
33
|
-
}
|
|
34
|
-
exports.createConfiguration = createConfiguration;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
/// <reference types="node" />
|
|
5
|
-
import * as FormData from "form-data";
|
|
6
|
-
import { URLSearchParams } from 'url';
|
|
7
|
-
import * as http from 'http';
|
|
8
|
-
import * as https from 'https';
|
|
9
|
-
import { Observable } from '../rxjsStub';
|
|
10
|
-
export * from './isomorphic-fetch';
|
|
11
|
-
/**
|
|
12
|
-
* Represents an HTTP method.
|
|
13
|
-
*/
|
|
14
|
-
export declare enum HttpMethod {
|
|
15
|
-
GET = "GET",
|
|
16
|
-
HEAD = "HEAD",
|
|
17
|
-
POST = "POST",
|
|
18
|
-
PUT = "PUT",
|
|
19
|
-
DELETE = "DELETE",
|
|
20
|
-
CONNECT = "CONNECT",
|
|
21
|
-
OPTIONS = "OPTIONS",
|
|
22
|
-
TRACE = "TRACE",
|
|
23
|
-
PATCH = "PATCH"
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Represents an HTTP file which will be transferred from or to a server.
|
|
27
|
-
*/
|
|
28
|
-
export type HttpFile = {
|
|
29
|
-
data: Buffer;
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
32
|
-
export declare class HttpException extends Error {
|
|
33
|
-
constructor(msg: string);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Represents the body of an outgoing HTTP request.
|
|
37
|
-
*/
|
|
38
|
-
export type RequestBody = undefined | string | FormData | URLSearchParams;
|
|
39
|
-
/**
|
|
40
|
-
* Represents an HTTP request context
|
|
41
|
-
*/
|
|
42
|
-
export declare class RequestContext {
|
|
43
|
-
private httpMethod;
|
|
44
|
-
private headers;
|
|
45
|
-
private body;
|
|
46
|
-
private url;
|
|
47
|
-
private agent;
|
|
48
|
-
/**
|
|
49
|
-
* Creates the request context using a http method and request resource url
|
|
50
|
-
*
|
|
51
|
-
* @param url url of the requested resource
|
|
52
|
-
* @param httpMethod http method
|
|
53
|
-
*/
|
|
54
|
-
constructor(url: string, httpMethod: HttpMethod);
|
|
55
|
-
getUrl(): string;
|
|
56
|
-
/**
|
|
57
|
-
* Replaces the url set in the constructor with this url.
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
|
-
setUrl(url: string): void;
|
|
61
|
-
/**
|
|
62
|
-
* Sets the body of the http request either as a string or FormData
|
|
63
|
-
*
|
|
64
|
-
* Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE
|
|
65
|
-
* request is discouraged.
|
|
66
|
-
* https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1
|
|
67
|
-
*
|
|
68
|
-
* @param body the body of the request
|
|
69
|
-
*/
|
|
70
|
-
setBody(body: RequestBody): void;
|
|
71
|
-
getHttpMethod(): HttpMethod;
|
|
72
|
-
getHeaders(): {
|
|
73
|
-
[key: string]: string;
|
|
74
|
-
};
|
|
75
|
-
getBody(): RequestBody;
|
|
76
|
-
setQueryParam(name: string, value: string): void;
|
|
77
|
-
/**
|
|
78
|
-
* Sets a cookie with the name and value. NO check for duplicate cookies is performed
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
addCookie(name: string, value: string): void;
|
|
82
|
-
setHeaderParam(key: string, value: string): void;
|
|
83
|
-
setAgent(agent: http.Agent | https.Agent): void;
|
|
84
|
-
getAgent(): http.Agent | https.Agent | undefined;
|
|
85
|
-
}
|
|
86
|
-
export interface ResponseBody {
|
|
87
|
-
text(): Promise<string>;
|
|
88
|
-
binary(): Promise<Buffer>;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Helper class to generate a `ResponseBody` from binary data
|
|
92
|
-
*/
|
|
93
|
-
export declare class SelfDecodingBody implements ResponseBody {
|
|
94
|
-
private dataSource;
|
|
95
|
-
constructor(dataSource: Promise<Buffer>);
|
|
96
|
-
binary(): Promise<Buffer>;
|
|
97
|
-
text(): Promise<string>;
|
|
98
|
-
}
|
|
99
|
-
export declare class ResponseContext {
|
|
100
|
-
httpStatusCode: number;
|
|
101
|
-
headers: {
|
|
102
|
-
[key: string]: string;
|
|
103
|
-
};
|
|
104
|
-
body: ResponseBody;
|
|
105
|
-
constructor(httpStatusCode: number, headers: {
|
|
106
|
-
[key: string]: string;
|
|
107
|
-
}, body: ResponseBody);
|
|
108
|
-
/**
|
|
109
|
-
* Parse header value in the form `value; param1="value1"`
|
|
110
|
-
*
|
|
111
|
-
* E.g. for Content-Type or Content-Disposition
|
|
112
|
-
* Parameter names are converted to lower case
|
|
113
|
-
* The first parameter is returned with the key `""`
|
|
114
|
-
*/
|
|
115
|
-
getParsedHeader(headerName: string): {
|
|
116
|
-
[parameter: string]: string;
|
|
117
|
-
};
|
|
118
|
-
getBodyAsFile(): Promise<HttpFile>;
|
|
119
|
-
/**
|
|
120
|
-
* Use a heuristic to get a body of unknown data structure.
|
|
121
|
-
* Return as string if possible, otherwise as binary.
|
|
122
|
-
*/
|
|
123
|
-
getBodyAsAny(): Promise<string | Buffer | undefined>;
|
|
124
|
-
}
|
|
125
|
-
export interface HttpLibrary {
|
|
126
|
-
send(request: RequestContext): Observable<ResponseContext>;
|
|
127
|
-
}
|
|
128
|
-
export interface PromiseHttpLibrary {
|
|
129
|
-
send(request: RequestContext): Promise<ResponseContext>;
|
|
130
|
-
}
|
|
131
|
-
export declare function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary;
|
|
132
|
-
export declare class HttpInfo<T> extends ResponseContext {
|
|
133
|
-
httpStatusCode: number;
|
|
134
|
-
headers: {
|
|
135
|
-
[key: string]: string;
|
|
136
|
-
};
|
|
137
|
-
body: ResponseBody;
|
|
138
|
-
data: T;
|
|
139
|
-
constructor(httpStatusCode: number, headers: {
|
|
140
|
-
[key: string]: string;
|
|
141
|
-
}, body: ResponseBody, data: T);
|
|
142
|
-
}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.HttpInfo = exports.wrapHttpLibrary = exports.ResponseContext = exports.SelfDecodingBody = exports.RequestContext = exports.HttpException = exports.HttpMethod = void 0;
|
|
27
|
-
const url_1 = require("url");
|
|
28
|
-
const rxjsStub_1 = require("../rxjsStub");
|
|
29
|
-
__exportStar(require("./isomorphic-fetch"), exports);
|
|
30
|
-
/**
|
|
31
|
-
* Represents an HTTP method.
|
|
32
|
-
*/
|
|
33
|
-
var HttpMethod;
|
|
34
|
-
(function (HttpMethod) {
|
|
35
|
-
HttpMethod["GET"] = "GET";
|
|
36
|
-
HttpMethod["HEAD"] = "HEAD";
|
|
37
|
-
HttpMethod["POST"] = "POST";
|
|
38
|
-
HttpMethod["PUT"] = "PUT";
|
|
39
|
-
HttpMethod["DELETE"] = "DELETE";
|
|
40
|
-
HttpMethod["CONNECT"] = "CONNECT";
|
|
41
|
-
HttpMethod["OPTIONS"] = "OPTIONS";
|
|
42
|
-
HttpMethod["TRACE"] = "TRACE";
|
|
43
|
-
HttpMethod["PATCH"] = "PATCH";
|
|
44
|
-
})(HttpMethod = exports.HttpMethod || (exports.HttpMethod = {}));
|
|
45
|
-
class HttpException extends Error {
|
|
46
|
-
constructor(msg) {
|
|
47
|
-
super(msg);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.HttpException = HttpException;
|
|
51
|
-
function ensureAbsoluteUrl(url) {
|
|
52
|
-
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
53
|
-
return url;
|
|
54
|
-
}
|
|
55
|
-
throw new Error("You need to define an absolute base url for the server.");
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Represents an HTTP request context
|
|
59
|
-
*/
|
|
60
|
-
class RequestContext {
|
|
61
|
-
/**
|
|
62
|
-
* Creates the request context using a http method and request resource url
|
|
63
|
-
*
|
|
64
|
-
* @param url url of the requested resource
|
|
65
|
-
* @param httpMethod http method
|
|
66
|
-
*/
|
|
67
|
-
constructor(url, httpMethod) {
|
|
68
|
-
this.httpMethod = httpMethod;
|
|
69
|
-
this.headers = {};
|
|
70
|
-
this.body = undefined;
|
|
71
|
-
this.agent = undefined;
|
|
72
|
-
this.url = new url_1.URL(ensureAbsoluteUrl(url));
|
|
73
|
-
}
|
|
74
|
-
/*
|
|
75
|
-
* Returns the url set in the constructor including the query string
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
getUrl() {
|
|
79
|
-
return this.url.toString().endsWith("/") ?
|
|
80
|
-
this.url.toString().slice(0, -1)
|
|
81
|
-
: this.url.toString();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Replaces the url set in the constructor with this url.
|
|
85
|
-
*
|
|
86
|
-
*/
|
|
87
|
-
setUrl(url) {
|
|
88
|
-
this.url = new url_1.URL(ensureAbsoluteUrl(url));
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Sets the body of the http request either as a string or FormData
|
|
92
|
-
*
|
|
93
|
-
* Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE
|
|
94
|
-
* request is discouraged.
|
|
95
|
-
* https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1
|
|
96
|
-
*
|
|
97
|
-
* @param body the body of the request
|
|
98
|
-
*/
|
|
99
|
-
setBody(body) {
|
|
100
|
-
this.body = body;
|
|
101
|
-
}
|
|
102
|
-
getHttpMethod() {
|
|
103
|
-
return this.httpMethod;
|
|
104
|
-
}
|
|
105
|
-
getHeaders() {
|
|
106
|
-
return this.headers;
|
|
107
|
-
}
|
|
108
|
-
getBody() {
|
|
109
|
-
return this.body;
|
|
110
|
-
}
|
|
111
|
-
setQueryParam(name, value) {
|
|
112
|
-
this.url.searchParams.set(name, value);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Sets a cookie with the name and value. NO check for duplicate cookies is performed
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
addCookie(name, value) {
|
|
119
|
-
if (!this.headers["Cookie"]) {
|
|
120
|
-
this.headers["Cookie"] = "";
|
|
121
|
-
}
|
|
122
|
-
this.headers["Cookie"] += name + "=" + value + "; ";
|
|
123
|
-
}
|
|
124
|
-
setHeaderParam(key, value) {
|
|
125
|
-
this.headers[key] = value;
|
|
126
|
-
}
|
|
127
|
-
setAgent(agent) {
|
|
128
|
-
this.agent = agent;
|
|
129
|
-
}
|
|
130
|
-
getAgent() {
|
|
131
|
-
return this.agent;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.RequestContext = RequestContext;
|
|
135
|
-
/**
|
|
136
|
-
* Helper class to generate a `ResponseBody` from binary data
|
|
137
|
-
*/
|
|
138
|
-
class SelfDecodingBody {
|
|
139
|
-
constructor(dataSource) {
|
|
140
|
-
this.dataSource = dataSource;
|
|
141
|
-
}
|
|
142
|
-
binary() {
|
|
143
|
-
return this.dataSource;
|
|
144
|
-
}
|
|
145
|
-
text() {
|
|
146
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const data = yield this.dataSource;
|
|
148
|
-
return data.toString();
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.SelfDecodingBody = SelfDecodingBody;
|
|
153
|
-
class ResponseContext {
|
|
154
|
-
constructor(httpStatusCode, headers, body) {
|
|
155
|
-
this.httpStatusCode = httpStatusCode;
|
|
156
|
-
this.headers = headers;
|
|
157
|
-
this.body = body;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Parse header value in the form `value; param1="value1"`
|
|
161
|
-
*
|
|
162
|
-
* E.g. for Content-Type or Content-Disposition
|
|
163
|
-
* Parameter names are converted to lower case
|
|
164
|
-
* The first parameter is returned with the key `""`
|
|
165
|
-
*/
|
|
166
|
-
getParsedHeader(headerName) {
|
|
167
|
-
const result = {};
|
|
168
|
-
if (!this.headers[headerName]) {
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
|
-
const parameters = this.headers[headerName].split(";");
|
|
172
|
-
for (const parameter of parameters) {
|
|
173
|
-
let [key, value] = parameter.split("=", 2);
|
|
174
|
-
key = key.toLowerCase().trim();
|
|
175
|
-
if (value === undefined) {
|
|
176
|
-
result[""] = key;
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
value = value.trim();
|
|
180
|
-
if (value.startsWith('"') && value.endsWith('"')) {
|
|
181
|
-
value = value.substring(1, value.length - 1);
|
|
182
|
-
}
|
|
183
|
-
result[key] = value;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return result;
|
|
187
|
-
}
|
|
188
|
-
getBodyAsFile() {
|
|
189
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
-
const data = yield this.body.binary();
|
|
191
|
-
const fileName = this.getParsedHeader("content-disposition")["filename"] || "";
|
|
192
|
-
return { data, name: fileName };
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Use a heuristic to get a body of unknown data structure.
|
|
197
|
-
* Return as string if possible, otherwise as binary.
|
|
198
|
-
*/
|
|
199
|
-
getBodyAsAny() {
|
|
200
|
-
try {
|
|
201
|
-
return this.body.text();
|
|
202
|
-
}
|
|
203
|
-
catch (_a) { }
|
|
204
|
-
try {
|
|
205
|
-
return this.body.binary();
|
|
206
|
-
}
|
|
207
|
-
catch (_b) { }
|
|
208
|
-
return Promise.resolve(undefined);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
exports.ResponseContext = ResponseContext;
|
|
212
|
-
function wrapHttpLibrary(promiseHttpLibrary) {
|
|
213
|
-
return {
|
|
214
|
-
send(request) {
|
|
215
|
-
return (0, rxjsStub_1.from)(promiseHttpLibrary.send(request));
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
exports.wrapHttpLibrary = wrapHttpLibrary;
|
|
220
|
-
class HttpInfo extends ResponseContext {
|
|
221
|
-
constructor(httpStatusCode, headers, body, data) {
|
|
222
|
-
super(httpStatusCode, headers, body);
|
|
223
|
-
this.httpStatusCode = httpStatusCode;
|
|
224
|
-
this.headers = headers;
|
|
225
|
-
this.body = body;
|
|
226
|
-
this.data = data;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
exports.HttpInfo = HttpInfo;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IsomorphicFetchHttpLibrary = void 0;
|
|
7
|
-
const http_1 = require("./http");
|
|
8
|
-
const rxjsStub_1 = require("../rxjsStub");
|
|
9
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
10
|
-
class IsomorphicFetchHttpLibrary {
|
|
11
|
-
send(request) {
|
|
12
|
-
let method = request.getHttpMethod().toString();
|
|
13
|
-
let body = request.getBody();
|
|
14
|
-
const resultPromise = (0, node_fetch_1.default)(request.getUrl(), {
|
|
15
|
-
method: method,
|
|
16
|
-
body: body,
|
|
17
|
-
headers: request.getHeaders(),
|
|
18
|
-
agent: request.getAgent(),
|
|
19
|
-
}).then((resp) => {
|
|
20
|
-
const headers = {};
|
|
21
|
-
resp.headers.forEach((value, name) => {
|
|
22
|
-
headers[name] = value;
|
|
23
|
-
});
|
|
24
|
-
const body = {
|
|
25
|
-
text: () => resp.text(),
|
|
26
|
-
binary: () => resp.buffer()
|
|
27
|
-
};
|
|
28
|
-
return new http_1.ResponseContext(resp.status, headers, body);
|
|
29
|
-
});
|
|
30
|
-
return (0, rxjsStub_1.from)(resultPromise);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.IsomorphicFetchHttpLibrary = IsomorphicFetchHttpLibrary;
|
package/dist/openapi/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./http/http";
|
|
2
|
-
export * from "./auth/auth";
|
|
3
|
-
export * from "./models/all";
|
|
4
|
-
export { createConfiguration } from "./configuration";
|
|
5
|
-
export { Configuration } from "./configuration";
|
|
6
|
-
export * from "./apis/exception";
|
|
7
|
-
export * from "./servers";
|
|
8
|
-
export { RequiredError } from "./apis/baseapi";
|
|
9
|
-
export { PromiseMiddleware as Middleware } from './middleware';
|
|
10
|
-
export { PromiseAuthApi as AuthApi, PromiseContractsApi as ContractsApi, PromiseCreditsApi as CreditsApi, PromiseCustomersApi as CustomersApi, PromiseEventsApi as EventsApi, PromiseIntegrationsApi as IntegrationsApi, PromiseInvoicesApi as InvoicesApi, PromiseMetersApi as MetersApi, PromisePlansApi as PlansApi, PromiseReportsApi as ReportsApi, PromiseWebhooksApi as WebhooksApi } from './types/PromiseAPI';
|