[typescript-rxjs] support HEAD method, improve formatting (#3766)

* feat(typescript-rxjs): add support for HEAD method

* feat(typescript-rxjs): improve formatting

* feat(typescript-rxjs): regenerate samples

* feat(typescript-rxjs): generate samples

* feat(typescript-rxjs): use better white space, regnerate samples
This commit is contained in:
Bernd Hacker 2019-08-27 11:17:41 +02:00 committed by Esteban Gehring
parent d0d545bbdd
commit 5bd63074c4
18 changed files with 126 additions and 126 deletions

View File

@ -175,7 +175,7 @@ export class {{classname}} extends BaseAPI {
responseType: 'blob'
{{/isResponseFile}}
});
}
};
{{/operation}}
}

View File

@ -65,7 +65,7 @@ export class BaseAPI {
const next = this.clone<T>();
next.middleware = next.middleware.concat(middlewares);
return next;
}
};
withPreMiddleware = <T extends BaseAPI>(preMiddlewares: Array<Middleware['pre']>) =>
this.withMiddleware<T>(preMiddlewares.map((pre) => ({ pre })));
@ -97,7 +97,7 @@ export class BaseAPI {
method: requestOpts.method,
headers: requestOpts.headers,
body: requestOpts.body instanceof FormData ? requestOpts.body : JSON.stringify(requestOpts.body),
responseType: requestOpts.responseType || 'json'
responseType: requestOpts.responseType || 'json',
};
}
@ -122,7 +122,7 @@ export class BaseAPI {
* and then shallow cloning data members.
*/
private clone = <T extends BaseAPI>(): T =>
Object.assign(Object.create(Object.getPrototypeOf(this)), this)
Object.assign(Object.create(Object.getPrototypeOf(this)), this);
}
// export for not being a breaking change
@ -138,7 +138,7 @@ export const COLLECTION_FORMATS = {
};
export type Json = any;
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
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> };
export type HttpBody = Json | FormData;
@ -153,7 +153,7 @@ export interface RequestOpts {
responseType?: 'json' | 'blob' | 'arraybuffer' | 'text';
}
export const encodeURI = (value: any) => encodeURIComponent(String(value))
export const encodeURI = (value: any) => encodeURIComponent(String(value));
const queryString = (params: HttpQuery): string => Object.keys(params)
.map((key) => {
@ -171,7 +171,7 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn
if (!params || params[key] === null || params[key] === undefined) {
throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`);
}
}
};
// alias for easier importing
export interface RequestArgs extends AjaxRequest {}

View File

@ -82,7 +82,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Deletes a pet
@ -105,7 +105,7 @@ export class PetApi extends BaseAPI {
method: 'DELETE',
headers,
});
}
};
/**
* Multiple status values can be provided with comma separated strings
@ -133,7 +133,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -161,7 +161,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Returns a single pet
@ -179,7 +179,7 @@ export class PetApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* Update an existing pet
@ -203,7 +203,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Updates a pet in the store with form data
@ -235,7 +235,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
/**
* uploads an image
@ -267,7 +267,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
}

View File

@ -45,7 +45,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'DELETE',
});
}
};
/**
* Returns a map of status codes to quantities
@ -61,7 +61,7 @@ export class StoreApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -74,7 +74,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'GET',
});
}
};
/**
* Place an order for a pet
@ -92,6 +92,6 @@ export class StoreApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -69,7 +69,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -87,7 +87,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -105,7 +105,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* This can only be done by the logged in user.
@ -118,7 +118,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'DELETE',
});
}
};
/**
* Get user by user name
@ -130,7 +130,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'GET',
});
}
};
/**
* Logs user into the system
@ -149,7 +149,7 @@ export class UserApi extends BaseAPI {
method: 'GET',
query,
});
}
};
/**
* Logs out current logged in user session
@ -159,7 +159,7 @@ export class UserApi extends BaseAPI {
path: '/user/logout',
method: 'GET',
});
}
};
/**
* This can only be done by the logged in user.
@ -179,6 +179,6 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -76,7 +76,7 @@ export class BaseAPI {
const next = this.clone<T>();
next.middleware = next.middleware.concat(middlewares);
return next;
}
};
withPreMiddleware = <T extends BaseAPI>(preMiddlewares: Array<Middleware['pre']>) =>
this.withMiddleware<T>(preMiddlewares.map((pre) => ({ pre })));
@ -108,7 +108,7 @@ export class BaseAPI {
method: requestOpts.method,
headers: requestOpts.headers,
body: requestOpts.body instanceof FormData ? requestOpts.body : JSON.stringify(requestOpts.body),
responseType: requestOpts.responseType || 'json'
responseType: requestOpts.responseType || 'json',
};
}
@ -133,7 +133,7 @@ export class BaseAPI {
* and then shallow cloning data members.
*/
private clone = <T extends BaseAPI>(): T =>
Object.assign(Object.create(Object.getPrototypeOf(this)), this)
Object.assign(Object.create(Object.getPrototypeOf(this)), this);
}
// export for not being a breaking change
@ -149,7 +149,7 @@ export const COLLECTION_FORMATS = {
};
export type Json = any;
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
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> };
export type HttpBody = Json | FormData;
@ -164,7 +164,7 @@ export interface RequestOpts {
responseType?: 'json' | 'blob' | 'arraybuffer' | 'text';
}
export const encodeURI = (value: any) => encodeURIComponent(String(value))
export const encodeURI = (value: any) => encodeURIComponent(String(value));
const queryString = (params: HttpQuery): string => Object.keys(params)
.map((key) => {
@ -182,7 +182,7 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn
if (!params || params[key] === null || params[key] === undefined) {
throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`);
}
}
};
// alias for easier importing
export interface RequestArgs extends AjaxRequest {}

View File

@ -82,7 +82,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Deletes a pet
@ -105,7 +105,7 @@ export class PetApi extends BaseAPI {
method: 'DELETE',
headers,
});
}
};
/**
* Multiple status values can be provided with comma separated strings
@ -133,7 +133,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -161,7 +161,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Returns a single pet
@ -179,7 +179,7 @@ export class PetApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* Update an existing pet
@ -203,7 +203,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Updates a pet in the store with form data
@ -235,7 +235,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
/**
* uploads an image
@ -267,7 +267,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
}

View File

@ -45,7 +45,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'DELETE',
});
}
};
/**
* Returns a map of status codes to quantities
@ -61,7 +61,7 @@ export class StoreApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -74,7 +74,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'GET',
});
}
};
/**
* Place an order for a pet
@ -92,6 +92,6 @@ export class StoreApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -69,7 +69,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -87,7 +87,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -105,7 +105,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* This can only be done by the logged in user.
@ -118,7 +118,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'DELETE',
});
}
};
/**
* Get user by user name
@ -130,7 +130,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'GET',
});
}
};
/**
* Logs user into the system
@ -149,7 +149,7 @@ export class UserApi extends BaseAPI {
method: 'GET',
query,
});
}
};
/**
* Logs out current logged in user session
@ -159,7 +159,7 @@ export class UserApi extends BaseAPI {
path: '/user/logout',
method: 'GET',
});
}
};
/**
* This can only be done by the logged in user.
@ -179,6 +179,6 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -76,7 +76,7 @@ export class BaseAPI {
const next = this.clone<T>();
next.middleware = next.middleware.concat(middlewares);
return next;
}
};
withPreMiddleware = <T extends BaseAPI>(preMiddlewares: Array<Middleware['pre']>) =>
this.withMiddleware<T>(preMiddlewares.map((pre) => ({ pre })));
@ -108,7 +108,7 @@ export class BaseAPI {
method: requestOpts.method,
headers: requestOpts.headers,
body: requestOpts.body instanceof FormData ? requestOpts.body : JSON.stringify(requestOpts.body),
responseType: requestOpts.responseType || 'json'
responseType: requestOpts.responseType || 'json',
};
}
@ -133,7 +133,7 @@ export class BaseAPI {
* and then shallow cloning data members.
*/
private clone = <T extends BaseAPI>(): T =>
Object.assign(Object.create(Object.getPrototypeOf(this)), this)
Object.assign(Object.create(Object.getPrototypeOf(this)), this);
}
// export for not being a breaking change
@ -149,7 +149,7 @@ export const COLLECTION_FORMATS = {
};
export type Json = any;
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
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> };
export type HttpBody = Json | FormData;
@ -164,7 +164,7 @@ export interface RequestOpts {
responseType?: 'json' | 'blob' | 'arraybuffer' | 'text';
}
export const encodeURI = (value: any) => encodeURIComponent(String(value))
export const encodeURI = (value: any) => encodeURIComponent(String(value));
const queryString = (params: HttpQuery): string => Object.keys(params)
.map((key) => {
@ -182,7 +182,7 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn
if (!params || params[key] === null || params[key] === undefined) {
throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`);
}
}
};
// alias for easier importing
export interface RequestArgs extends AjaxRequest {}

View File

@ -82,7 +82,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Deletes a pet
@ -105,7 +105,7 @@ export class PetApi extends BaseAPI {
method: 'DELETE',
headers,
});
}
};
/**
* Multiple status values can be provided with comma separated strings
@ -133,7 +133,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -161,7 +161,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Returns a single pet
@ -179,7 +179,7 @@ export class PetApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* Update an existing pet
@ -203,7 +203,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Updates a pet in the store with form data
@ -235,7 +235,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
/**
* uploads an image
@ -267,7 +267,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
}

View File

@ -45,7 +45,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'DELETE',
});
}
};
/**
* Returns a map of status codes to quantities
@ -61,7 +61,7 @@ export class StoreApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -74,7 +74,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'GET',
});
}
};
/**
* Place an order for a pet
@ -92,6 +92,6 @@ export class StoreApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -69,7 +69,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -87,7 +87,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -105,7 +105,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* This can only be done by the logged in user.
@ -118,7 +118,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'DELETE',
});
}
};
/**
* Get user by user name
@ -130,7 +130,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'GET',
});
}
};
/**
* Logs user into the system
@ -149,7 +149,7 @@ export class UserApi extends BaseAPI {
method: 'GET',
query,
});
}
};
/**
* Logs out current logged in user session
@ -159,7 +159,7 @@ export class UserApi extends BaseAPI {
path: '/user/logout',
method: 'GET',
});
}
};
/**
* This can only be done by the logged in user.
@ -179,6 +179,6 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -76,7 +76,7 @@ export class BaseAPI {
const next = this.clone<T>();
next.middleware = next.middleware.concat(middlewares);
return next;
}
};
withPreMiddleware = <T extends BaseAPI>(preMiddlewares: Array<Middleware['pre']>) =>
this.withMiddleware<T>(preMiddlewares.map((pre) => ({ pre })));
@ -108,7 +108,7 @@ export class BaseAPI {
method: requestOpts.method,
headers: requestOpts.headers,
body: requestOpts.body instanceof FormData ? requestOpts.body : JSON.stringify(requestOpts.body),
responseType: requestOpts.responseType || 'json'
responseType: requestOpts.responseType || 'json',
};
}
@ -133,7 +133,7 @@ export class BaseAPI {
* and then shallow cloning data members.
*/
private clone = <T extends BaseAPI>(): T =>
Object.assign(Object.create(Object.getPrototypeOf(this)), this)
Object.assign(Object.create(Object.getPrototypeOf(this)), this);
}
// export for not being a breaking change
@ -149,7 +149,7 @@ export const COLLECTION_FORMATS = {
};
export type Json = any;
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
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> };
export type HttpBody = Json | FormData;
@ -164,7 +164,7 @@ export interface RequestOpts {
responseType?: 'json' | 'blob' | 'arraybuffer' | 'text';
}
export const encodeURI = (value: any) => encodeURIComponent(String(value))
export const encodeURI = (value: any) => encodeURIComponent(String(value));
const queryString = (params: HttpQuery): string => Object.keys(params)
.map((key) => {
@ -182,7 +182,7 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn
if (!params || params[key] === null || params[key] === undefined) {
throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`);
}
}
};
// alias for easier importing
export interface RequestArgs extends AjaxRequest {}

View File

@ -82,7 +82,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Deletes a pet
@ -105,7 +105,7 @@ export class PetApi extends BaseAPI {
method: 'DELETE',
headers,
});
}
};
/**
* Multiple status values can be provided with comma separated strings
@ -133,7 +133,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@ -161,7 +161,7 @@ export class PetApi extends BaseAPI {
headers,
query,
});
}
};
/**
* Returns a single pet
@ -179,7 +179,7 @@ export class PetApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* Update an existing pet
@ -203,7 +203,7 @@ export class PetApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Updates a pet in the store with form data
@ -235,7 +235,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
/**
* uploads an image
@ -267,7 +267,7 @@ export class PetApi extends BaseAPI {
headers,
body: formData,
});
}
};
}

View File

@ -45,7 +45,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'DELETE',
});
}
};
/**
* Returns a map of status codes to quantities
@ -61,7 +61,7 @@ export class StoreApi extends BaseAPI {
method: 'GET',
headers,
});
}
};
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -74,7 +74,7 @@ export class StoreApi extends BaseAPI {
path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(requestParameters.orderId)),
method: 'GET',
});
}
};
/**
* Place an order for a pet
@ -92,6 +92,6 @@ export class StoreApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -69,7 +69,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -87,7 +87,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* Creates list of users with given input array
@ -105,7 +105,7 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
/**
* This can only be done by the logged in user.
@ -118,7 +118,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'DELETE',
});
}
};
/**
* Get user by user name
@ -130,7 +130,7 @@ export class UserApi extends BaseAPI {
path: '/user/{username}'.replace('{username}', encodeURI(requestParameters.username)),
method: 'GET',
});
}
};
/**
* Logs user into the system
@ -149,7 +149,7 @@ export class UserApi extends BaseAPI {
method: 'GET',
query,
});
}
};
/**
* Logs out current logged in user session
@ -159,7 +159,7 @@ export class UserApi extends BaseAPI {
path: '/user/logout',
method: 'GET',
});
}
};
/**
* This can only be done by the logged in user.
@ -179,6 +179,6 @@ export class UserApi extends BaseAPI {
headers,
body: requestParameters.body,
});
}
};
}

View File

@ -76,7 +76,7 @@ export class BaseAPI {
const next = this.clone<T>();
next.middleware = next.middleware.concat(middlewares);
return next;
}
};
withPreMiddleware = <T extends BaseAPI>(preMiddlewares: Array<Middleware['pre']>) =>
this.withMiddleware<T>(preMiddlewares.map((pre) => ({ pre })));
@ -108,7 +108,7 @@ export class BaseAPI {
method: requestOpts.method,
headers: requestOpts.headers,
body: requestOpts.body instanceof FormData ? requestOpts.body : JSON.stringify(requestOpts.body),
responseType: requestOpts.responseType || 'json'
responseType: requestOpts.responseType || 'json',
};
}
@ -133,7 +133,7 @@ export class BaseAPI {
* and then shallow cloning data members.
*/
private clone = <T extends BaseAPI>(): T =>
Object.assign(Object.create(Object.getPrototypeOf(this)), this)
Object.assign(Object.create(Object.getPrototypeOf(this)), this);
}
// export for not being a breaking change
@ -149,7 +149,7 @@ export const COLLECTION_FORMATS = {
};
export type Json = any;
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
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> };
export type HttpBody = Json | FormData;
@ -164,7 +164,7 @@ export interface RequestOpts {
responseType?: 'json' | 'blob' | 'arraybuffer' | 'text';
}
export const encodeURI = (value: any) => encodeURIComponent(String(value))
export const encodeURI = (value: any) => encodeURIComponent(String(value));
const queryString = (params: HttpQuery): string => Object.keys(params)
.map((key) => {
@ -182,7 +182,7 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn
if (!params || params[key] === null || params[key] === undefined) {
throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`);
}
}
};
// alias for easier importing
export interface RequestArgs extends AjaxRequest {}