@equisoft/equisoft-plan-sdk-typescript
Advanced tools
Comparing version 6.68.0 to 6.68.1-snapshot.20220706154338
@@ -23,6 +23,6 @@ /** | ||
*/ | ||
cmdCopyFNARaw(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<CmdCopyFNAResponse>>; | ||
cmdCopyFNARaw(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<CmdCopyFNAResponse>>; | ||
/** | ||
*/ | ||
cmdCopyFNA(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit): Promise<CmdCopyFNAResponse>; | ||
cmdCopyFNA(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<CmdCopyFNAResponse>; | ||
} |
@@ -44,3 +44,7 @@ "use strict"; | ||
// oauth required | ||
headerParameters["Authorization"] = yield this.configuration.accessToken("OAuth2", ["plan:plan"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = yield token("OAuth2", ["plan:plan"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -47,0 +51,0 @@ const response = yield this.request({ |
@@ -29,18 +29,18 @@ /** | ||
*/ | ||
getOrganizationRaw(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<OrganizationsOrganization>>; | ||
getOrganizationRaw(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<OrganizationsOrganization>>; | ||
/** | ||
*/ | ||
getOrganization(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit): Promise<OrganizationsOrganization>; | ||
getOrganization(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<OrganizationsOrganization>; | ||
/** | ||
*/ | ||
listOrganizationUsersRaw(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<UsersListUsersResponse>>; | ||
listOrganizationUsersRaw(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<UsersListUsersResponse>>; | ||
/** | ||
*/ | ||
listOrganizationUsers(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit): Promise<UsersListUsersResponse>; | ||
listOrganizationUsers(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<UsersListUsersResponse>; | ||
/** | ||
*/ | ||
listOrganizationsRaw(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<OrganizationsListOrganizationsResponse>>; | ||
listOrganizationsRaw(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<OrganizationsListOrganizationsResponse>>; | ||
/** | ||
*/ | ||
listOrganizations(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit): Promise<OrganizationsListOrganizationsResponse>; | ||
listOrganizations(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<OrganizationsListOrganizationsResponse>; | ||
} |
@@ -43,3 +43,7 @@ "use strict"; | ||
// oauth required | ||
headerParameters["Authorization"] = yield this.configuration.accessToken("OAuth2", ["plan:organization"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = yield token("OAuth2", ["plan:organization"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -74,3 +78,7 @@ const response = yield this.request({ | ||
// oauth required | ||
headerParameters["Authorization"] = yield this.configuration.accessToken("OAuth2", ["plan:organization", "plan:user"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = yield token("OAuth2", ["plan:organization", "plan:user"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -108,3 +116,7 @@ const response = yield this.request({ | ||
// oauth required | ||
headerParameters["Authorization"] = yield this.configuration.accessToken("OAuth2", ["plan:organization"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = yield token("OAuth2", ["plan:organization"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -111,0 +123,0 @@ const response = yield this.request({ |
@@ -23,6 +23,6 @@ /** | ||
*/ | ||
listPlansRaw(requestParameters: ListPlansRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<PlansListPlansResponse>>; | ||
listPlansRaw(requestParameters: ListPlansRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<PlansListPlansResponse>>; | ||
/** | ||
*/ | ||
listPlans(requestParameters: ListPlansRequest, initOverrides?: RequestInit): Promise<PlansListPlansResponse>; | ||
listPlans(requestParameters?: ListPlansRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<PlansListPlansResponse>; | ||
} |
@@ -43,3 +43,7 @@ "use strict"; | ||
// oauth required | ||
headerParameters["Authorization"] = yield this.configuration.accessToken("OAuth2", ["plan:plan"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = yield token("OAuth2", ["plan:plan"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -57,3 +61,3 @@ const response = yield this.request({ | ||
*/ | ||
listPlans(requestParameters, initOverrides) { | ||
listPlans(requestParameters = {}, initOverrides) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -60,0 +64,0 @@ const response = yield this.listPlansRaw(requestParameters, initOverrides); |
@@ -28,15 +28,15 @@ /** | ||
*/ | ||
getPlanRaw(requestParameters: GetPlanRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>>; | ||
getPlanRaw(requestParameters: GetPlanRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>>; | ||
/** | ||
* Returns the plan | ||
*/ | ||
getPlan(requestParameters: GetPlanRequest, initOverrides?: RequestInit): Promise<void>; | ||
getPlan(requestParameters: GetPlanRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<void>; | ||
/** | ||
* Update client UUID id of an FNA | ||
*/ | ||
updatePlanExternalIdRaw(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>>; | ||
updatePlanExternalIdRaw(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>>; | ||
/** | ||
* Update client UUID id of an FNA | ||
*/ | ||
updatePlanExternalId(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit): Promise<void>; | ||
updatePlanExternalId(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<void>; | ||
} |
@@ -23,12 +23,12 @@ /** | ||
*/ | ||
getUserRaw(requestParameters: GetUserRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<UsersUser>>; | ||
getUserRaw(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<UsersUser>>; | ||
/** | ||
*/ | ||
getUser(requestParameters: GetUserRequest, initOverrides?: RequestInit): Promise<UsersUser>; | ||
getUser(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<UsersUser>; | ||
/** | ||
*/ | ||
getUserContextRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<UsersUserContext>>; | ||
getUserContextRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<UsersUserContext>>; | ||
/** | ||
*/ | ||
getUserContext(initOverrides?: RequestInit): Promise<UsersUserContext>; | ||
getUserContext(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<UsersUserContext>; | ||
} |
@@ -43,3 +43,7 @@ "use strict"; | ||
// oauth required | ||
headerParameters["Authorization"] = yield this.configuration.accessToken("OAuth2", ["plan:user"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = yield token("OAuth2", ["plan:user"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -71,3 +75,7 @@ const response = yield this.request({ | ||
// oauth required | ||
headerParameters["Authorization"] = yield this.configuration.accessToken("OAuth2", ["plan:user"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = yield token("OAuth2", ["plan:user"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -74,0 +82,0 @@ const response = yield this.request({ |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
import { OrganizationsOrganization } from './'; | ||
import { OrganizationsOrganization } from './OrganizationsOrganization'; | ||
/** | ||
@@ -15,0 +15,0 @@ * |
@@ -17,3 +17,3 @@ "use strict"; | ||
exports.OrganizationsListOrganizationsResponseToJSON = exports.OrganizationsListOrganizationsResponseFromJSONTyped = exports.OrganizationsListOrganizationsResponseFromJSON = void 0; | ||
const _1 = require("./"); | ||
const OrganizationsOrganization_1 = require("./OrganizationsOrganization"); | ||
function OrganizationsListOrganizationsResponseFromJSON(json) { | ||
@@ -28,3 +28,3 @@ return OrganizationsListOrganizationsResponseFromJSONTyped(json, false); | ||
return { | ||
'results': (json['results'].map(_1.OrganizationsOrganizationFromJSON)), | ||
'results': (json['results'].map(OrganizationsOrganization_1.OrganizationsOrganizationFromJSON)), | ||
}; | ||
@@ -41,5 +41,5 @@ } | ||
return { | ||
'results': (value.results.map(_1.OrganizationsOrganizationToJSON)), | ||
'results': (value.results.map(OrganizationsOrganization_1.OrganizationsOrganizationToJSON)), | ||
}; | ||
} | ||
exports.OrganizationsListOrganizationsResponseToJSON = OrganizationsListOrganizationsResponseToJSON; |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
import { PlansPlan } from './'; | ||
import { PlansPlan } from './PlansPlan'; | ||
/** | ||
@@ -15,0 +15,0 @@ * |
@@ -17,3 +17,3 @@ "use strict"; | ||
exports.PlansListPlansResponseToJSON = exports.PlansListPlansResponseFromJSONTyped = exports.PlansListPlansResponseFromJSON = void 0; | ||
const _1 = require("./"); | ||
const PlansPlan_1 = require("./PlansPlan"); | ||
function PlansListPlansResponseFromJSON(json) { | ||
@@ -28,3 +28,3 @@ return PlansListPlansResponseFromJSONTyped(json, false); | ||
return { | ||
'plans': (json['plans'].map(_1.PlansPlanFromJSON)), | ||
'plans': (json['plans'].map(PlansPlan_1.PlansPlanFromJSON)), | ||
'createPlanUrl': json['createPlanUrl'], | ||
@@ -42,3 +42,3 @@ }; | ||
return { | ||
'plans': (value.plans.map(_1.PlansPlanToJSON)), | ||
'plans': (value.plans.map(PlansPlan_1.PlansPlanToJSON)), | ||
'createPlanUrl': value.createPlanUrl, | ||
@@ -45,0 +45,0 @@ }; |
@@ -68,19 +68,20 @@ /** | ||
/** | ||
* @export | ||
* @enum {string} | ||
*/ | ||
export declare enum PlansPlanTypeEnum { | ||
INDIVIDUAL = "INDIVIDUAL", | ||
SPOUSAL = "SPOUSAL" | ||
} /** | ||
* @export | ||
* @enum {string} | ||
*/ | ||
export declare enum PlansPlanStatusEnum { | ||
PARTIAL = "PARTIAL", | ||
COMPLETED = "COMPLETED", | ||
EXPIRED = "EXPIRED" | ||
} | ||
* @export | ||
*/ | ||
export declare const PlansPlanTypeEnum: { | ||
readonly INDIVIDUAL: "INDIVIDUAL"; | ||
readonly SPOUSAL: "SPOUSAL"; | ||
}; | ||
export declare type PlansPlanTypeEnum = typeof PlansPlanTypeEnum[keyof typeof PlansPlanTypeEnum]; | ||
/** | ||
* @export | ||
*/ | ||
export declare const PlansPlanStatusEnum: { | ||
readonly PARTIAL: "PARTIAL"; | ||
readonly COMPLETED: "COMPLETED"; | ||
readonly EXPIRED: "EXPIRED"; | ||
}; | ||
export declare type PlansPlanStatusEnum = typeof PlansPlanStatusEnum[keyof typeof PlansPlanStatusEnum]; | ||
export declare function PlansPlanFromJSON(json: any): PlansPlan; | ||
export declare function PlansPlanFromJSONTyped(json: any, ignoreDiscriminator: boolean): PlansPlan; | ||
export declare function PlansPlanToJSON(value?: PlansPlan | null): any; |
@@ -19,19 +19,16 @@ "use strict"; | ||
/** | ||
* @export | ||
* @enum {string} | ||
*/ | ||
var PlansPlanTypeEnum; | ||
(function (PlansPlanTypeEnum) { | ||
PlansPlanTypeEnum["INDIVIDUAL"] = "INDIVIDUAL"; | ||
PlansPlanTypeEnum["SPOUSAL"] = "SPOUSAL"; | ||
})(PlansPlanTypeEnum = exports.PlansPlanTypeEnum || (exports.PlansPlanTypeEnum = {})); /** | ||
* @export | ||
* @enum {string} | ||
*/ | ||
var PlansPlanStatusEnum; | ||
(function (PlansPlanStatusEnum) { | ||
PlansPlanStatusEnum["PARTIAL"] = "PARTIAL"; | ||
PlansPlanStatusEnum["COMPLETED"] = "COMPLETED"; | ||
PlansPlanStatusEnum["EXPIRED"] = "EXPIRED"; | ||
})(PlansPlanStatusEnum = exports.PlansPlanStatusEnum || (exports.PlansPlanStatusEnum = {})); | ||
* @export | ||
*/ | ||
exports.PlansPlanTypeEnum = { | ||
INDIVIDUAL: 'INDIVIDUAL', | ||
SPOUSAL: 'SPOUSAL' | ||
}; | ||
/** | ||
* @export | ||
*/ | ||
exports.PlansPlanStatusEnum = { | ||
PARTIAL: 'PARTIAL', | ||
COMPLETED: 'COMPLETED', | ||
EXPIRED: 'EXPIRED' | ||
}; | ||
function PlansPlanFromJSON(json) { | ||
@@ -38,0 +35,0 @@ return PlansPlanFromJSONTyped(json, false); |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
import { UsersUser } from './'; | ||
import { UsersUser } from './UsersUser'; | ||
/** | ||
@@ -15,0 +15,0 @@ * |
@@ -17,3 +17,3 @@ "use strict"; | ||
exports.UsersListUsersResponseToJSON = exports.UsersListUsersResponseFromJSONTyped = exports.UsersListUsersResponseFromJSON = void 0; | ||
const _1 = require("./"); | ||
const UsersUser_1 = require("./UsersUser"); | ||
function UsersListUsersResponseFromJSON(json) { | ||
@@ -28,3 +28,3 @@ return UsersListUsersResponseFromJSONTyped(json, false); | ||
return { | ||
'results': (json['results'].map(_1.UsersUserFromJSON)), | ||
'results': (json['results'].map(UsersUser_1.UsersUserFromJSON)), | ||
}; | ||
@@ -41,5 +41,5 @@ } | ||
return { | ||
'results': (value.results.map(_1.UsersUserToJSON)), | ||
'results': (value.results.map(UsersUser_1.UsersUserToJSON)), | ||
}; | ||
} | ||
exports.UsersListUsersResponseToJSON = UsersListUsersResponseToJSON; |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
import { V1ErrorResponseData } from './'; | ||
import { V1ErrorResponseData } from './V1ErrorResponseData'; | ||
/** | ||
@@ -15,0 +15,0 @@ * |
@@ -18,3 +18,3 @@ "use strict"; | ||
const runtime_1 = require("../runtime"); | ||
const _1 = require("./"); | ||
const V1ErrorResponseData_1 = require("./V1ErrorResponseData"); | ||
function V1ErrorResponseFromJSON(json) { | ||
@@ -30,3 +30,3 @@ return V1ErrorResponseFromJSONTyped(json, false); | ||
'status': json['status'], | ||
'data': !runtime_1.exists(json, 'data') ? undefined : _1.V1ErrorResponseDataFromJSON(json['data']), | ||
'data': !runtime_1.exists(json, 'data') ? undefined : V1ErrorResponseData_1.V1ErrorResponseDataFromJSON(json['data']), | ||
}; | ||
@@ -44,5 +44,5 @@ } | ||
'status': value.status, | ||
'data': _1.V1ErrorResponseDataToJSON(value.data), | ||
'data': V1ErrorResponseData_1.V1ErrorResponseDataToJSON(value.data), | ||
}; | ||
} | ||
exports.V1ErrorResponseToJSON = V1ErrorResponseToJSON; |
@@ -13,2 +13,30 @@ /** | ||
export declare const BASE_PATH: string; | ||
export interface ConfigurationParameters { | ||
basePath?: string; | ||
fetchApi?: FetchAPI; | ||
middleware?: Middleware[]; | ||
queryParamsStringify?: (params: HTTPQuery) => string; | ||
username?: string; | ||
password?: string; | ||
apiKey?: string | ((name: string) => string); | ||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); | ||
headers?: HTTPHeaders; | ||
credentials?: RequestCredentials; | ||
} | ||
export declare class Configuration { | ||
private configuration; | ||
constructor(configuration?: ConfigurationParameters); | ||
set config(configuration: Configuration); | ||
get basePath(): string; | ||
get fetchApi(): FetchAPI | undefined; | ||
get middleware(): Middleware[]; | ||
get queryParamsStringify(): (params: HTTPQuery) => string; | ||
get username(): string | undefined; | ||
get password(): string | undefined; | ||
get apiKey(): ((name: string) => string) | undefined; | ||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined; | ||
get headers(): HTTPHeaders | undefined; | ||
get credentials(): RequestCredentials | undefined; | ||
} | ||
export declare const DefaultConfig: Configuration; | ||
/** | ||
@@ -24,3 +52,3 @@ * This is the base class for all generated API classes. | ||
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T; | ||
protected request(context: RequestOpts, initOverrides?: RequestInit): Promise<Response>; | ||
protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverideFunction): Promise<Response>; | ||
private createFetchParams; | ||
@@ -34,2 +62,7 @@ private fetchApi; | ||
} | ||
export declare class ResponseError extends Error { | ||
response: Response; | ||
name: "ResponseError"; | ||
constructor(response: Response, msg?: string); | ||
} | ||
export declare class RequiredError extends Error { | ||
@@ -47,28 +80,2 @@ field: string; | ||
export declare type FetchAPI = WindowOrWorkerGlobalScope['fetch']; | ||
export interface ConfigurationParameters { | ||
basePath?: string; | ||
fetchApi?: FetchAPI; | ||
middleware?: Middleware[]; | ||
queryParamsStringify?: (params: HTTPQuery) => string; | ||
username?: string; | ||
password?: string; | ||
apiKey?: string | ((name: string) => string); | ||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); | ||
headers?: HTTPHeaders; | ||
credentials?: RequestCredentials; | ||
} | ||
export declare class Configuration { | ||
private configuration; | ||
constructor(configuration?: ConfigurationParameters); | ||
get basePath(): string; | ||
get fetchApi(): FetchAPI; | ||
get middleware(): Middleware[]; | ||
get queryParamsStringify(): (params: HTTPQuery) => string; | ||
get username(): string | undefined; | ||
get password(): string | undefined; | ||
get apiKey(): ((name: string) => string) | undefined; | ||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined; | ||
get headers(): HTTPHeaders | undefined; | ||
get credentials(): RequestCredentials | undefined; | ||
} | ||
export declare type Json = any; | ||
@@ -80,6 +87,16 @@ export declare type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; | ||
export declare type HTTPQuery = { | ||
[key: string]: string | number | null | boolean | Array<string | number | null | boolean> | HTTPQuery; | ||
[key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery; | ||
}; | ||
export declare type HTTPBody = Json | FormData | URLSearchParams; | ||
export declare type HTTPRequestInit = { | ||
headers?: HTTPHeaders; | ||
method: HTTPMethod; | ||
credentials?: RequestCredentials; | ||
body?: HTTPBody; | ||
}; | ||
export declare type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; | ||
export declare type InitOverideFunction = (requestContext: { | ||
init: HTTPRequestInit; | ||
context: RequestOpts; | ||
}) => Promise<RequestInit>; | ||
export interface FetchParams { | ||
@@ -86,0 +103,0 @@ url: string; |
@@ -25,5 +25,52 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.canConsumeForm = exports.mapValues = exports.querystring = exports.exists = exports.Configuration = exports.COLLECTION_FORMATS = exports.RequiredError = exports.BaseAPI = exports.BASE_PATH = void 0; | ||
exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.canConsumeForm = exports.mapValues = exports.querystring = exports.exists = exports.COLLECTION_FORMATS = exports.RequiredError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0; | ||
exports.BASE_PATH = "http://localhost".replace(/\/+$/, ""); | ||
const isBlob = (value) => typeof Blob !== 'undefined' && value instanceof Blob; | ||
class Configuration { | ||
constructor(configuration = {}) { | ||
this.configuration = configuration; | ||
} | ||
set config(configuration) { | ||
this.configuration = configuration; | ||
} | ||
get basePath() { | ||
return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH; | ||
} | ||
get fetchApi() { | ||
return this.configuration.fetchApi; | ||
} | ||
get middleware() { | ||
return this.configuration.middleware || []; | ||
} | ||
get queryParamsStringify() { | ||
return this.configuration.queryParamsStringify || querystring; | ||
} | ||
get username() { | ||
return this.configuration.username; | ||
} | ||
get password() { | ||
return this.configuration.password; | ||
} | ||
get apiKey() { | ||
const apiKey = this.configuration.apiKey; | ||
if (apiKey) { | ||
return typeof apiKey === 'function' ? apiKey : () => apiKey; | ||
} | ||
return undefined; | ||
} | ||
get accessToken() { | ||
const accessToken = this.configuration.accessToken; | ||
if (accessToken) { | ||
return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; }); | ||
} | ||
return undefined; | ||
} | ||
get headers() { | ||
return this.configuration.headers; | ||
} | ||
get credentials() { | ||
return this.configuration.credentials; | ||
} | ||
} | ||
exports.Configuration = Configuration; | ||
exports.DefaultConfig = new Configuration(); | ||
/** | ||
@@ -33,3 +80,3 @@ * This is the base class for all generated API classes. | ||
class BaseAPI { | ||
constructor(configuration = new Configuration()) { | ||
constructor(configuration = exports.DefaultConfig) { | ||
this.configuration = configuration; | ||
@@ -73,3 +120,3 @@ this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { url, init } = this.createFetchParams(context, initOverrides); | ||
const { url, init } = yield this.createFetchParams(context, initOverrides); | ||
const response = yield this.fetchApi(url, init); | ||
@@ -79,19 +126,36 @@ if (response.status >= 200 && response.status < 300) { | ||
} | ||
throw response; | ||
throw new ResponseError(response, 'Response returned an error code'); | ||
}); | ||
} | ||
createFetchParams(context, initOverrides) { | ||
let url = this.configuration.basePath + context.path; | ||
if (context.query !== undefined && Object.keys(context.query).length !== 0) { | ||
// only add the querystring to the URL if there are query parameters. | ||
// this is done to avoid urls ending with a "?" character which buggy webservers | ||
// do not handle correctly sometimes. | ||
url += '?' + this.configuration.queryParamsStringify(context.query); | ||
} | ||
const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) | ||
? context.body | ||
: JSON.stringify(context.body); | ||
const headers = Object.assign({}, this.configuration.headers, context.headers); | ||
const init = Object.assign({ method: context.method, headers: headers, body, credentials: this.configuration.credentials }, initOverrides); | ||
return { url, init }; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let url = this.configuration.basePath + context.path; | ||
if (context.query !== undefined && Object.keys(context.query).length !== 0) { | ||
// only add the querystring to the URL if there are query parameters. | ||
// this is done to avoid urls ending with a "?" character which buggy webservers | ||
// do not handle correctly sometimes. | ||
url += '?' + this.configuration.queryParamsStringify(context.query); | ||
} | ||
const headers = Object.assign({}, this.configuration.headers, context.headers); | ||
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); | ||
const initOverrideFn = typeof initOverrides === "function" | ||
? initOverrides | ||
: () => __awaiter(this, void 0, void 0, function* () { return initOverrides; }); | ||
const initParams = { | ||
method: context.method, | ||
headers, | ||
body: context.body, | ||
credentials: this.configuration.credentials, | ||
}; | ||
const overridedInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({ | ||
init: initParams, | ||
context, | ||
}))); | ||
const init = Object.assign(Object.assign({}, overridedInit), { body: isFormData(overridedInit.body) || | ||
overridedInit.body instanceof URLSearchParams || | ||
isBlob(overridedInit.body) | ||
? overridedInit.body | ||
: JSON.stringify(overridedInit.body) }); | ||
return { url, init }; | ||
}); | ||
} | ||
@@ -111,2 +175,16 @@ /** | ||
; | ||
function isBlob(value) { | ||
return typeof Blob !== 'undefined' && value instanceof Blob; | ||
} | ||
function isFormData(value) { | ||
return typeof FormData !== "undefined" && value instanceof FormData; | ||
} | ||
class ResponseError extends Error { | ||
constructor(response, msg) { | ||
super(msg); | ||
this.response = response; | ||
this.name = "ResponseError"; | ||
} | ||
} | ||
exports.ResponseError = ResponseError; | ||
class RequiredError extends Error { | ||
@@ -126,46 +204,2 @@ constructor(field, msg) { | ||
}; | ||
class Configuration { | ||
constructor(configuration = {}) { | ||
this.configuration = configuration; | ||
} | ||
get basePath() { | ||
return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH; | ||
} | ||
get fetchApi() { | ||
return this.configuration.fetchApi; | ||
} | ||
get middleware() { | ||
return this.configuration.middleware || []; | ||
} | ||
get queryParamsStringify() { | ||
return this.configuration.queryParamsStringify || querystring; | ||
} | ||
get username() { | ||
return this.configuration.username; | ||
} | ||
get password() { | ||
return this.configuration.password; | ||
} | ||
get apiKey() { | ||
const apiKey = this.configuration.apiKey; | ||
if (apiKey) { | ||
return typeof apiKey === 'function' ? apiKey : () => apiKey; | ||
} | ||
return undefined; | ||
} | ||
get accessToken() { | ||
const accessToken = this.configuration.accessToken; | ||
if (accessToken) { | ||
return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; }); | ||
} | ||
return undefined; | ||
} | ||
get headers() { | ||
return this.configuration.headers; | ||
} | ||
get credentials() { | ||
return this.configuration.credentials; | ||
} | ||
} | ||
exports.Configuration = Configuration; | ||
function exists(json, key) { | ||
@@ -178,18 +212,3 @@ const value = json[key]; | ||
return Object.keys(params) | ||
.map((key) => { | ||
const fullKey = prefix + (prefix.length ? `[${key}]` : key); | ||
const value = params[key]; | ||
if (value instanceof Array) { | ||
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) | ||
.join(`&${encodeURIComponent(fullKey)}=`); | ||
return `${encodeURIComponent(fullKey)}=${multiValue}`; | ||
} | ||
if (value instanceof Date) { | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; | ||
} | ||
if (value instanceof Object) { | ||
return querystring(value, fullKey); | ||
} | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; | ||
}) | ||
.map(key => querystringSingleKey(key, params[key], prefix)) | ||
.filter(part => part.length > 0) | ||
@@ -199,2 +218,21 @@ .join('&'); | ||
exports.querystring = querystring; | ||
function querystringSingleKey(key, value, keyPrefix = '') { | ||
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); | ||
if (value instanceof Array) { | ||
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) | ||
.join(`&${encodeURIComponent(fullKey)}=`); | ||
return `${encodeURIComponent(fullKey)}=${multiValue}`; | ||
} | ||
if (value instanceof Set) { | ||
const valueAsArray = Array.from(value); | ||
return querystringSingleKey(key, valueAsArray, keyPrefix); | ||
} | ||
if (value instanceof Date) { | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; | ||
} | ||
if (value instanceof Object) { | ||
return querystring(value, fullKey); | ||
} | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; | ||
} | ||
function mapValues(data, fn) { | ||
@@ -201,0 +239,0 @@ return Object.keys(data).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: fn(data[key]) })), {}); |
{ | ||
"name": "@equisoft/equisoft-plan-sdk-typescript", | ||
"version": "6.68.0", | ||
"version": "6.68.1-snapshot.20220706154338", | ||
"description": "OpenAPI client for @equisoft/equisoft-plan-sdk-typescript", | ||
@@ -5,0 +5,0 @@ "author": "OpenAPI-Generator", |
@@ -40,3 +40,3 @@ /* tslint:disable */ | ||
*/ | ||
async cmdCopyFNARaw(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<CmdCopyFNAResponse>> { | ||
async cmdCopyFNARaw(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<CmdCopyFNAResponse>> { | ||
if (requestParameters.cmdCopyFNA === null || requestParameters.cmdCopyFNA === undefined) { | ||
@@ -54,3 +54,8 @@ throw new runtime.RequiredError('cmdCopyFNA','Required parameter requestParameters.cmdCopyFNA was null or undefined when calling cmdCopyFNA.'); | ||
// oauth required | ||
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["plan:plan"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("OAuth2", ["plan:plan"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -71,3 +76,3 @@ | ||
*/ | ||
async cmdCopyFNA(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit): Promise<CmdCopyFNAResponse> { | ||
async cmdCopyFNA(requestParameters: CmdCopyFNARequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<CmdCopyFNAResponse> { | ||
const response = await this.cmdCopyFNARaw(requestParameters, initOverrides); | ||
@@ -74,0 +79,0 @@ return await response.value(); |
@@ -51,3 +51,3 @@ /* tslint:disable */ | ||
*/ | ||
async getOrganizationRaw(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<OrganizationsOrganization>> { | ||
async getOrganizationRaw(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<OrganizationsOrganization>> { | ||
if (requestParameters.id === null || requestParameters.id === undefined) { | ||
@@ -63,3 +63,8 @@ throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getOrganization.'); | ||
// oauth required | ||
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["plan:organization"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("OAuth2", ["plan:organization"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -79,3 +84,3 @@ | ||
*/ | ||
async getOrganization(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit): Promise<OrganizationsOrganization> { | ||
async getOrganization(requestParameters: GetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<OrganizationsOrganization> { | ||
const response = await this.getOrganizationRaw(requestParameters, initOverrides); | ||
@@ -87,3 +92,3 @@ return await response.value(); | ||
*/ | ||
async listOrganizationUsersRaw(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<UsersListUsersResponse>> { | ||
async listOrganizationUsersRaw(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<UsersListUsersResponse>> { | ||
if (requestParameters.id === null || requestParameters.id === undefined) { | ||
@@ -99,3 +104,8 @@ throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling listOrganizationUsers.'); | ||
// oauth required | ||
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["plan:organization", "plan:user"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("OAuth2", ["plan:organization", "plan:user"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -115,3 +125,3 @@ | ||
*/ | ||
async listOrganizationUsers(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit): Promise<UsersListUsersResponse> { | ||
async listOrganizationUsers(requestParameters: ListOrganizationUsersRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<UsersListUsersResponse> { | ||
const response = await this.listOrganizationUsersRaw(requestParameters, initOverrides); | ||
@@ -123,3 +133,3 @@ return await response.value(); | ||
*/ | ||
async listOrganizationsRaw(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<OrganizationsListOrganizationsResponse>> { | ||
async listOrganizationsRaw(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<OrganizationsListOrganizationsResponse>> { | ||
if (requestParameters.organizationUuid === null || requestParameters.organizationUuid === undefined) { | ||
@@ -139,3 +149,8 @@ throw new runtime.RequiredError('organizationUuid','Required parameter requestParameters.organizationUuid was null or undefined when calling listOrganizations.'); | ||
// oauth required | ||
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["plan:organization"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("OAuth2", ["plan:organization"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -155,3 +170,3 @@ | ||
*/ | ||
async listOrganizations(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit): Promise<OrganizationsListOrganizationsResponse> { | ||
async listOrganizations(requestParameters: ListOrganizationsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<OrganizationsListOrganizationsResponse> { | ||
const response = await this.listOrganizationsRaw(requestParameters, initOverrides); | ||
@@ -158,0 +173,0 @@ return await response.value(); |
@@ -37,3 +37,3 @@ /* tslint:disable */ | ||
*/ | ||
async listPlansRaw(requestParameters: ListPlansRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<PlansListPlansResponse>> { | ||
async listPlansRaw(requestParameters: ListPlansRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<PlansListPlansResponse>> { | ||
const queryParameters: any = {}; | ||
@@ -49,3 +49,8 @@ | ||
// oauth required | ||
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["plan:plan"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("OAuth2", ["plan:plan"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -65,3 +70,3 @@ | ||
*/ | ||
async listPlans(requestParameters: ListPlansRequest, initOverrides?: RequestInit): Promise<PlansListPlansResponse> { | ||
async listPlans(requestParameters: ListPlansRequest = {}, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<PlansListPlansResponse> { | ||
const response = await this.listPlansRaw(requestParameters, initOverrides); | ||
@@ -68,0 +73,0 @@ return await response.value(); |
@@ -41,3 +41,3 @@ /* tslint:disable */ | ||
*/ | ||
async getPlanRaw(requestParameters: GetPlanRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { | ||
async getPlanRaw(requestParameters: GetPlanRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>> { | ||
if (requestParameters.id === null || requestParameters.id === undefined) { | ||
@@ -64,3 +64,3 @@ throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getPlan.'); | ||
*/ | ||
async getPlan(requestParameters: GetPlanRequest, initOverrides?: RequestInit): Promise<void> { | ||
async getPlan(requestParameters: GetPlanRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<void> { | ||
await this.getPlanRaw(requestParameters, initOverrides); | ||
@@ -72,3 +72,3 @@ } | ||
*/ | ||
async updatePlanExternalIdRaw(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { | ||
async updatePlanExternalIdRaw(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<void>> { | ||
if (requestParameters.fnaUuid === null || requestParameters.fnaUuid === undefined) { | ||
@@ -106,3 +106,3 @@ throw new runtime.RequiredError('fnaUuid','Required parameter requestParameters.fnaUuid was null or undefined when calling updatePlanExternalId.'); | ||
*/ | ||
async updatePlanExternalId(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit): Promise<void> { | ||
async updatePlanExternalId(requestParameters: UpdatePlanExternalIdRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<void> { | ||
await this.updatePlanExternalIdRaw(requestParameters, initOverrides); | ||
@@ -109,0 +109,0 @@ } |
@@ -40,3 +40,3 @@ /* tslint:disable */ | ||
*/ | ||
async getUserRaw(requestParameters: GetUserRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<UsersUser>> { | ||
async getUserRaw(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<UsersUser>> { | ||
if (requestParameters.id === null || requestParameters.id === undefined) { | ||
@@ -52,3 +52,8 @@ throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getUser.'); | ||
// oauth required | ||
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["plan:user"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("OAuth2", ["plan:user"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -68,3 +73,3 @@ | ||
*/ | ||
async getUser(requestParameters: GetUserRequest, initOverrides?: RequestInit): Promise<UsersUser> { | ||
async getUser(requestParameters: GetUserRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<UsersUser> { | ||
const response = await this.getUserRaw(requestParameters, initOverrides); | ||
@@ -76,3 +81,3 @@ return await response.value(); | ||
*/ | ||
async getUserContextRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<UsersUserContext>> { | ||
async getUserContextRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<UsersUserContext>> { | ||
const queryParameters: any = {}; | ||
@@ -84,3 +89,8 @@ | ||
// oauth required | ||
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", ["plan:user"]); | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("OAuth2", ["plan:user"]); | ||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
@@ -100,3 +110,3 @@ | ||
*/ | ||
async getUserContext(initOverrides?: RequestInit): Promise<UsersUserContext> { | ||
async getUserContext(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<UsersUserContext> { | ||
const response = await this.getUserContextRaw(initOverrides); | ||
@@ -103,0 +113,0 @@ return await response.value(); |
@@ -73,2 +73,1 @@ /* tslint:disable */ | ||
@@ -57,2 +57,1 @@ /* tslint:disable */ | ||
@@ -73,2 +73,1 @@ /* tslint:disable */ | ||
@@ -21,3 +21,3 @@ /* tslint:disable */ | ||
OrganizationsOrganizationToJSON, | ||
} from './'; | ||
} from './OrganizationsOrganization'; | ||
@@ -65,2 +65,1 @@ /** | ||
@@ -81,2 +81,1 @@ /* tslint:disable */ | ||
@@ -21,3 +21,3 @@ /* tslint:disable */ | ||
PlansPlanToJSON, | ||
} from './'; | ||
} from './PlansPlan'; | ||
@@ -73,2 +73,1 @@ /** | ||
@@ -72,19 +72,23 @@ /* tslint:disable */ | ||
/** | ||
* @export | ||
* @enum {string} | ||
*/ | ||
export enum PlansPlanTypeEnum { | ||
INDIVIDUAL = 'INDIVIDUAL', | ||
SPOUSAL = 'SPOUSAL' | ||
}/** | ||
* @export | ||
* @enum {string} | ||
*/ | ||
export enum PlansPlanStatusEnum { | ||
PARTIAL = 'PARTIAL', | ||
COMPLETED = 'COMPLETED', | ||
EXPIRED = 'EXPIRED' | ||
} | ||
* @export | ||
*/ | ||
export const PlansPlanTypeEnum = { | ||
INDIVIDUAL: 'INDIVIDUAL', | ||
SPOUSAL: 'SPOUSAL' | ||
} as const; | ||
export type PlansPlanTypeEnum = typeof PlansPlanTypeEnum[keyof typeof PlansPlanTypeEnum]; | ||
/** | ||
* @export | ||
*/ | ||
export const PlansPlanStatusEnum = { | ||
PARTIAL: 'PARTIAL', | ||
COMPLETED: 'COMPLETED', | ||
EXPIRED: 'EXPIRED' | ||
} as const; | ||
export type PlansPlanStatusEnum = typeof PlansPlanStatusEnum[keyof typeof PlansPlanStatusEnum]; | ||
export function PlansPlanFromJSON(json: any): PlansPlan { | ||
@@ -131,2 +135,1 @@ return PlansPlanFromJSONTyped(json, false); | ||
@@ -21,3 +21,3 @@ /* tslint:disable */ | ||
UsersUserToJSON, | ||
} from './'; | ||
} from './UsersUser'; | ||
@@ -65,2 +65,1 @@ /** | ||
@@ -97,2 +97,1 @@ /* tslint:disable */ | ||
@@ -21,3 +21,3 @@ /* tslint:disable */ | ||
UsersUserToJSON, | ||
} from './'; | ||
} from './UsersUser'; | ||
@@ -105,2 +105,1 @@ /** | ||
@@ -21,3 +21,3 @@ /* tslint:disable */ | ||
V1ErrorResponseDataToJSON, | ||
} from './'; | ||
} from './V1ErrorResponseData'; | ||
@@ -73,2 +73,1 @@ /** | ||
@@ -65,2 +65,1 @@ /* tslint:disable */ | ||
@@ -18,4 +18,73 @@ /* tslint:disable */ | ||
const isBlob = (value: any) => typeof Blob !== 'undefined' && value instanceof Blob; | ||
export interface ConfigurationParameters { | ||
basePath?: string; // override base path | ||
fetchApi?: FetchAPI; // override for fetch implementation | ||
middleware?: Middleware[]; // middleware to apply before/after fetch requests | ||
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings | ||
username?: string; // parameter for basic security | ||
password?: string; // parameter for basic security | ||
apiKey?: string | ((name: string) => string); // parameter for apiKey security | ||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security | ||
headers?: HTTPHeaders; //header params we want to use on every request | ||
credentials?: RequestCredentials; //value for the credentials param we want to use on each request | ||
} | ||
export class Configuration { | ||
constructor(private configuration: ConfigurationParameters = {}) {} | ||
set config(configuration: Configuration) { | ||
this.configuration = configuration; | ||
} | ||
get basePath(): string { | ||
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; | ||
} | ||
get fetchApi(): FetchAPI | undefined { | ||
return this.configuration.fetchApi; | ||
} | ||
get middleware(): Middleware[] { | ||
return this.configuration.middleware || []; | ||
} | ||
get queryParamsStringify(): (params: HTTPQuery) => string { | ||
return this.configuration.queryParamsStringify || querystring; | ||
} | ||
get username(): string | undefined { | ||
return this.configuration.username; | ||
} | ||
get password(): string | undefined { | ||
return this.configuration.password; | ||
} | ||
get apiKey(): ((name: string) => string) | undefined { | ||
const apiKey = this.configuration.apiKey; | ||
if (apiKey) { | ||
return typeof apiKey === 'function' ? apiKey : () => apiKey; | ||
} | ||
return undefined; | ||
} | ||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined { | ||
const accessToken = this.configuration.accessToken; | ||
if (accessToken) { | ||
return typeof accessToken === 'function' ? accessToken : async () => accessToken; | ||
} | ||
return undefined; | ||
} | ||
get headers(): HTTPHeaders | undefined { | ||
return this.configuration.headers; | ||
} | ||
get credentials(): RequestCredentials | undefined { | ||
return this.configuration.credentials; | ||
} | ||
} | ||
export const DefaultConfig = new Configuration(); | ||
/** | ||
@@ -28,3 +97,3 @@ * This is the base class for all generated API classes. | ||
constructor(protected configuration = new Configuration()) { | ||
constructor(protected configuration = DefaultConfig) { | ||
this.middleware = configuration.middleware; | ||
@@ -49,4 +118,4 @@ } | ||
protected async request(context: RequestOpts, initOverrides?: RequestInit): Promise<Response> { | ||
const { url, init } = this.createFetchParams(context, initOverrides); | ||
protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverideFunction): Promise<Response> { | ||
const { url, init } = await this.createFetchParams(context, initOverrides); | ||
const response = await this.fetchApi(url, init); | ||
@@ -56,6 +125,6 @@ if (response.status >= 200 && response.status < 300) { | ||
} | ||
throw response; | ||
throw new ResponseError(response, 'Response returned an error code'); | ||
} | ||
private createFetchParams(context: RequestOpts, initOverrides?: RequestInit) { | ||
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverideFunction) { | ||
let url = this.configuration.basePath + context.path; | ||
@@ -68,14 +137,36 @@ if (context.query !== undefined && Object.keys(context.query).length !== 0) { | ||
} | ||
const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) | ||
? context.body | ||
: JSON.stringify(context.body); | ||
const headers = Object.assign({}, this.configuration.headers, context.headers); | ||
const init = { | ||
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); | ||
const initOverrideFn = | ||
typeof initOverrides === "function" | ||
? initOverrides | ||
: async () => initOverrides; | ||
const initParams = { | ||
method: context.method, | ||
headers: headers, | ||
body, | ||
headers, | ||
body: context.body, | ||
credentials: this.configuration.credentials, | ||
...initOverrides | ||
}; | ||
const overridedInit: RequestInit = { | ||
...initParams, | ||
...(await initOverrideFn({ | ||
init: initParams, | ||
context, | ||
})) | ||
} | ||
const init: RequestInit = { | ||
...overridedInit, | ||
body: | ||
isFormData(overridedInit.body) || | ||
overridedInit.body instanceof URLSearchParams || | ||
isBlob(overridedInit.body) | ||
? overridedInit.body | ||
: JSON.stringify(overridedInit.body), | ||
}; | ||
return { url, init }; | ||
@@ -120,2 +211,17 @@ } | ||
function isBlob(value: any): value is Blob { | ||
return typeof Blob !== 'undefined' && value instanceof Blob | ||
} | ||
function isFormData(value: any): value is FormData { | ||
return typeof FormData !== "undefined" && value instanceof FormData | ||
} | ||
export class ResponseError extends Error { | ||
name: "ResponseError" = "ResponseError"; | ||
constructor(public response: Response, msg?: string) { | ||
super(msg); | ||
} | ||
} | ||
export class RequiredError extends Error { | ||
@@ -137,74 +243,12 @@ name: "RequiredError" = "RequiredError"; | ||
export interface ConfigurationParameters { | ||
basePath?: string; // override base path | ||
fetchApi?: FetchAPI; // override for fetch implementation | ||
middleware?: Middleware[]; // middleware to apply before/after fetch requests | ||
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings | ||
username?: string; // parameter for basic security | ||
password?: string; // parameter for basic security | ||
apiKey?: string | ((name: string) => string); // parameter for apiKey security | ||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security | ||
headers?: HTTPHeaders; //header params we want to use on every request | ||
credentials?: RequestCredentials; //value for the credentials param we want to use on each request | ||
} | ||
export class Configuration { | ||
constructor(private configuration: ConfigurationParameters = {}) {} | ||
get basePath(): string { | ||
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; | ||
} | ||
get fetchApi(): FetchAPI { | ||
return this.configuration.fetchApi; | ||
} | ||
get middleware(): Middleware[] { | ||
return this.configuration.middleware || []; | ||
} | ||
get queryParamsStringify(): (params: HTTPQuery) => string { | ||
return this.configuration.queryParamsStringify || querystring; | ||
} | ||
get username(): string | undefined { | ||
return this.configuration.username; | ||
} | ||
get password(): string | undefined { | ||
return this.configuration.password; | ||
} | ||
get apiKey(): ((name: string) => string) | undefined { | ||
const apiKey = this.configuration.apiKey; | ||
if (apiKey) { | ||
return typeof apiKey === 'function' ? apiKey : () => apiKey; | ||
} | ||
return undefined; | ||
} | ||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined { | ||
const accessToken = this.configuration.accessToken; | ||
if (accessToken) { | ||
return typeof accessToken === 'function' ? accessToken : async () => accessToken; | ||
} | ||
return undefined; | ||
} | ||
get headers(): HTTPHeaders | undefined { | ||
return this.configuration.headers; | ||
} | ||
get credentials(): RequestCredentials | undefined { | ||
return this.configuration.credentials; | ||
} | ||
} | ||
export type Json = any; | ||
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; | ||
export type HTTPHeaders = { [key: string]: string }; | ||
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | HTTPQuery }; | ||
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery }; | ||
export type HTTPBody = Json | FormData | URLSearchParams; | ||
export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody } | ||
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; | ||
export type InitOverideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit> | ||
export interface FetchParams { | ||
@@ -230,18 +274,3 @@ url: string; | ||
return Object.keys(params) | ||
.map((key) => { | ||
const fullKey = prefix + (prefix.length ? `[${key}]` : key); | ||
const value = params[key]; | ||
if (value instanceof Array) { | ||
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) | ||
.join(`&${encodeURIComponent(fullKey)}=`); | ||
return `${encodeURIComponent(fullKey)}=${multiValue}`; | ||
} | ||
if (value instanceof Date) { | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; | ||
} | ||
if (value instanceof Object) { | ||
return querystring(value as HTTPQuery, fullKey); | ||
} | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; | ||
}) | ||
.map(key => querystringSingleKey(key, params[key], prefix)) | ||
.filter(part => part.length > 0) | ||
@@ -251,2 +280,22 @@ .join('&'); | ||
function querystringSingleKey(key: string, value: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery, keyPrefix: string = ''): string { | ||
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); | ||
if (value instanceof Array) { | ||
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) | ||
.join(`&${encodeURIComponent(fullKey)}=`); | ||
return `${encodeURIComponent(fullKey)}=${multiValue}`; | ||
} | ||
if (value instanceof Set) { | ||
const valueAsArray = Array.from(value); | ||
return querystringSingleKey(key, valueAsArray, keyPrefix); | ||
} | ||
if (value instanceof Date) { | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; | ||
} | ||
if (value instanceof Object) { | ||
return querystring(value as HTTPQuery, fullKey); | ||
} | ||
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; | ||
} | ||
export function mapValues(data: any, fn: (item: any) => any) { | ||
@@ -253,0 +302,0 @@ return Object.keys(data).reduce( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
673841
72
5993
3