879 lines
56 KiB
TypeScript
879 lines
56 KiB
TypeScript
|
/**
|
|||
|
* Hetzner Cloud API
|
|||
|
* This is the official documentation for the Hetzner Cloud API. ## Introduction The Hetzner Cloud API operates over HTTPS and uses JSON as its data format. The API is a RESTful API and utilizes HTTP methods and HTTP status codes to specify requests and responses. As an alternative to working directly with our API you may also consider to use: - Our CLI program [hcloud](https://github.com/hetznercloud/cli) - Our [library for Go](https://github.com/hetznercloud/hcloud-go) - Our [library for Python](https://github.com/hetznercloud/hcloud-python) Also you can find a [list of libraries, tools, and integrations on GitHub](https://github.com/hetznercloud/awesome-hcloud). If you are developing integrations based on our API and your product is Open Source you may be eligible for a free one time €50 (excl. VAT) credit on your account. Please contact us via the the support page on your Cloud Console and let us know the following: - The type of integration you would like to develop - Link to the GitHub repo you will use for the Project - Link to some other Open Source work you have already done (if you have done so) ## Getting Started To get started using the API you first need an API token. Sign in into the [Hetzner Cloud Console](https://console.hetzner.cloud/) choose a Project, go to `Security` → `API Tokens`, and generate a new token. Make sure to copy the token because it won’t be shown to you again. A token is bound to a Project, to interact with the API of another Project you have to create a new token inside the Project. Let’s say your new token is `LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj`. You’re now ready to do your first request against the API. To get a list of all Servers in your Project, issue the example request on the right side using [curl](https://curl.se/). Make sure to replace the token in the example command with the token you have just created. Since your Project probably does not contain any Servers yet, the example response will look like the response on the right side. We will almost always provide a resource root like `servers` inside the example response. A response can also contain a `meta` object with information like [Pagination](#pagination). **Example Request** ```bash curl -H \"Authorization: Bearer LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj\" \\ https://api.hetzner.cloud/v1/servers ``` **Example Response** ```json { \"servers\": [], \"meta\": { \"pagination\": { \"page\": 1, \"per_page\": 25, \"previous_page\": null, \"next_page\": null, \"last_page\": 1, \"total_entries\": 0 } } } ``` ## Authentication All requests to the Hetzner Cloud API must be authenticated via a API token. Include your secret API token in every request you send to the API with the `Authorization` HTTP header. To create a new API token for your Project, switch into the [Hetzner Cloud Console](https://console.hetzner.cloud/) choose a Project, go to `Security` → `API Tokens`, and generate a new token. **Example Authorization header** ```http Authorization: Bearer LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj ``` ## Errors Errors are indicated by HTTP status codes. Further, the response of the request which generated the error contains an error code, an error message, and, optionally, error details. The schema of the error details object depends on the error code. The error response contains the following keys: | Keys | Meaning | | --------- | --------------------------------------------------------------------- | | `code` | Short string indicating the type of error (machine-parsable) | | `message` | Textual description on what has gone wrong | | `details` | An object providing for details on the error (schema depends on code) | **Example response** ```json { \"error\": { \"code\": \"invalid_input\", \"message\": \"invalid input in field \'broken_field\': is too
|
|||
|
*
|
|||
|
* The version of the OpenAPI document: 1.0.0
|
|||
|
*
|
|||
|
*
|
|||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|||
|
* https://openapi-generator.tech
|
|||
|
* Do not edit the class manually.
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
import localVarRequest from 'request';
|
|||
|
import http from 'http';
|
|||
|
|
|||
|
/* tslint:disable:no-unused-locals */
|
|||
|
import { ActionResponse } from '../model/actionResponse';
|
|||
|
import { ActionsResponse } from '../model/actionsResponse';
|
|||
|
import { AddDeleteRouteRequest } from '../model/addDeleteRouteRequest';
|
|||
|
import { AddSubnetRequest } from '../model/addSubnetRequest';
|
|||
|
import { ChangeIPRangeRequest } from '../model/changeIPRangeRequest';
|
|||
|
import { ChangeProtectionRequest1 } from '../model/changeProtectionRequest1';
|
|||
|
import { DeleteSubnetRequest } from '../model/deleteSubnetRequest';
|
|||
|
|
|||
|
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
|
|||
|
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
|
|||
|
|
|||
|
import { HttpError, RequestFile } from './apis';
|
|||
|
|
|||
|
let defaultBasePath = 'https://api.hetzner.cloud/v1';
|
|||
|
|
|||
|
// ===============================================
|
|||
|
// This file is autogenerated - Please do not edit
|
|||
|
// ===============================================
|
|||
|
|
|||
|
export enum NetworkActionsApiApiKeys {
|
|||
|
}
|
|||
|
|
|||
|
export class NetworkActionsApi {
|
|||
|
protected _basePath = defaultBasePath;
|
|||
|
protected _defaultHeaders : any = {};
|
|||
|
protected _useQuerystring : boolean = false;
|
|||
|
|
|||
|
protected authentications = {
|
|||
|
'default': <Authentication>new VoidAuth(),
|
|||
|
'APIToken': new HttpBearerAuth(),
|
|||
|
}
|
|||
|
|
|||
|
protected interceptors: Interceptor[] = [];
|
|||
|
|
|||
|
constructor(basePath?: string);
|
|||
|
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
|
|||
|
if (password) {
|
|||
|
if (basePath) {
|
|||
|
this.basePath = basePath;
|
|||
|
}
|
|||
|
} else {
|
|||
|
if (basePathOrUsername) {
|
|||
|
this.basePath = basePathOrUsername
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
set useQuerystring(value: boolean) {
|
|||
|
this._useQuerystring = value;
|
|||
|
}
|
|||
|
|
|||
|
set basePath(basePath: string) {
|
|||
|
this._basePath = basePath;
|
|||
|
}
|
|||
|
|
|||
|
set defaultHeaders(defaultHeaders: any) {
|
|||
|
this._defaultHeaders = defaultHeaders;
|
|||
|
}
|
|||
|
|
|||
|
get defaultHeaders() {
|
|||
|
return this._defaultHeaders;
|
|||
|
}
|
|||
|
|
|||
|
get basePath() {
|
|||
|
return this._basePath;
|
|||
|
}
|
|||
|
|
|||
|
public setDefaultAuthentication(auth: Authentication) {
|
|||
|
this.authentications.default = auth;
|
|||
|
}
|
|||
|
|
|||
|
public setApiKey(key: NetworkActionsApiApiKeys, value: string) {
|
|||
|
(this.authentications as any)[NetworkActionsApiApiKeys[key]].apiKey = value;
|
|||
|
}
|
|||
|
|
|||
|
set accessToken(accessToken: string | (() => string)) {
|
|||
|
this.authentications.APIToken.accessToken = accessToken;
|
|||
|
}
|
|||
|
|
|||
|
public addInterceptor(interceptor: Interceptor) {
|
|||
|
this.interceptors.push(interceptor);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Returns all Action objects. You can `sort` the results by using the sort URI parameter, and filter them with the `status` and `id` parameter.
|
|||
|
* @summary Get all Actions
|
|||
|
* @param id Can be used multiple times, the response will contain only Actions with specified IDs.
|
|||
|
* @param sort Can be used multiple times.
|
|||
|
* @param status Can be used multiple times, the response will contain only Actions with specified statuses
|
|||
|
* @param page Page to load.
|
|||
|
* @param perPage Items to load per page.
|
|||
|
*/
|
|||
|
public async networksActionsGet (id?: number, sort?: 'id' | 'id:asc' | 'id:desc' | 'command' | 'command:asc' | 'command:desc' | 'status' | 'status:asc' | 'status:desc' | 'started' | 'started:asc' | 'started:desc' | 'finished' | 'finished:asc' | 'finished:desc', status?: 'running' | 'success' | 'error', page?: number, perPage?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionsResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/actions';
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
if (id !== undefined) {
|
|||
|
localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "number");
|
|||
|
}
|
|||
|
|
|||
|
if (sort !== undefined) {
|
|||
|
localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'id' | 'id:asc' | 'id:desc' | 'command' | 'command:asc' | 'command:desc' | 'status' | 'status:asc' | 'status:desc' | 'started' | 'started:asc' | 'started:desc' | 'finished' | 'finished:asc' | 'finished:desc'");
|
|||
|
}
|
|||
|
|
|||
|
if (status !== undefined) {
|
|||
|
localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "'running' | 'success' | 'error'");
|
|||
|
}
|
|||
|
|
|||
|
if (page !== undefined) {
|
|||
|
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
|
|||
|
}
|
|||
|
|
|||
|
if (perPage !== undefined) {
|
|||
|
localVarQueryParameters['per_page'] = ObjectSerializer.serialize(perPage, "number");
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'GET',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionsResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionsResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Returns a specific Action object.
|
|||
|
* @summary Get an Action
|
|||
|
* @param id ID of the Resource
|
|||
|
*/
|
|||
|
public async networksActionsIdGet (id: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/actions/{id}'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksActionsIdGet.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'GET',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Returns a specific Action for a Network.
|
|||
|
* @summary Get an Action for a Network
|
|||
|
* @param id ID of the Network
|
|||
|
* @param actionId ID of the Action
|
|||
|
*/
|
|||
|
public async networksIdActionsActionIdGet (id: number, actionId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions/{action_id}'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)))
|
|||
|
.replace('{' + 'action_id' + '}', encodeURIComponent(String(actionId)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsActionIdGet.');
|
|||
|
}
|
|||
|
|
|||
|
// verify required parameter 'actionId' is not null or undefined
|
|||
|
if (actionId === null || actionId === undefined) {
|
|||
|
throw new Error('Required parameter actionId was null or undefined when calling networksIdActionsActionIdGet.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'GET',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Adds a route entry to a Network. Note: if the Network object changes during the request, the response will be a “conflict” error.
|
|||
|
* @summary Add a route to a Network
|
|||
|
* @param id ID of the Network
|
|||
|
* @param addDeleteRouteRequest
|
|||
|
*/
|
|||
|
public async networksIdActionsAddRoutePost (id: number, addDeleteRouteRequest?: AddDeleteRouteRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions/add_route'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsAddRoutePost.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'POST',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
body: ObjectSerializer.serialize(addDeleteRouteRequest, "AddDeleteRouteRequest")
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Adds a new subnet object to the Network. If you do not specify an `ip_range` for the subnet we will automatically pick the first available /24 range for you if possible. Note: if the parent Network object changes during the request, the response will be a “conflict” error.
|
|||
|
* @summary Add a subnet to a Network
|
|||
|
* @param id ID of the Network
|
|||
|
* @param addSubnetRequest
|
|||
|
*/
|
|||
|
public async networksIdActionsAddSubnetPost (id: number, addSubnetRequest?: AddSubnetRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions/add_subnet'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsAddSubnetPost.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'POST',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
body: ObjectSerializer.serialize(addSubnetRequest, "AddSubnetRequest")
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Changes the IP range of a Network. IP ranges can only be extended and never shrunk. You can only add IPs at the end of an existing IP range. This means that the IP part of your existing range must stay the same and you can only change its netmask. For example if you have a range `10.0.0.0/16` you want to extend then your new range must also start with the IP `10.0.0.0`. Your CIDR netmask `/16` may change to a number that is smaller than `16` thereby increasing the IP range. So valid entries would be `10.0.0.0/15`, `10.0.0.0/14`, `10.0.0.0/13` and so on. After changing the IP range you will have to adjust the routes on your connected Servers by either rebooting them or manually changing the routes to your private Network interface. Note: if the Network object changes during the request, the response will be a “conflict” error.
|
|||
|
* @summary Change IP range of a Network
|
|||
|
* @param id ID of the Network
|
|||
|
* @param changeIPRangeRequest
|
|||
|
*/
|
|||
|
public async networksIdActionsChangeIpRangePost (id: number, changeIPRangeRequest?: ChangeIPRangeRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions/change_ip_range'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsChangeIpRangePost.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'POST',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
body: ObjectSerializer.serialize(changeIPRangeRequest, "ChangeIPRangeRequest")
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Changes the protection configuration of a Network. Note: if the Network object changes during the request, the response will be a “conflict” error.
|
|||
|
* @summary Change Network Protection
|
|||
|
* @param id ID of the Network
|
|||
|
* @param changeProtectionRequest1
|
|||
|
*/
|
|||
|
public async networksIdActionsChangeProtectionPost (id: number, changeProtectionRequest1?: ChangeProtectionRequest1, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions/change_protection'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsChangeProtectionPost.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'POST',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
body: ObjectSerializer.serialize(changeProtectionRequest1, "ChangeProtectionRequest1")
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Delete a route entry from a Network. Note: if the Network object changes during the request, the response will be a “conflict” error.
|
|||
|
* @summary Delete a route from a Network
|
|||
|
* @param id ID of the Network
|
|||
|
* @param addDeleteRouteRequest
|
|||
|
*/
|
|||
|
public async networksIdActionsDeleteRoutePost (id: number, addDeleteRouteRequest?: AddDeleteRouteRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions/delete_route'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsDeleteRoutePost.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'POST',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
body: ObjectSerializer.serialize(addDeleteRouteRequest, "AddDeleteRouteRequest")
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Deletes a single subnet entry from a Network. You cannot delete subnets which still have Servers attached. If you have Servers attached you first need to detach all Servers that use IPs from this subnet before you can delete the subnet. Note: if the Network object changes during the request, the response will be a “conflict” error.
|
|||
|
* @summary Delete a subnet from a Network
|
|||
|
* @param id ID of the Network
|
|||
|
* @param deleteSubnetRequest
|
|||
|
*/
|
|||
|
public async networksIdActionsDeleteSubnetPost (id: number, deleteSubnetRequest?: DeleteSubnetRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions/delete_subnet'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsDeleteSubnetPost.');
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'POST',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
body: ObjectSerializer.serialize(deleteSubnetRequest, "DeleteSubnetRequest")
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* Returns all Action objects for a Network. You can sort the results by using the `sort` URI parameter, and filter them with the `status` parameter.
|
|||
|
* @summary Get all Actions for a Network
|
|||
|
* @param id ID of the Network
|
|||
|
* @param sort Can be used multiple times.
|
|||
|
* @param status Can be used multiple times, the response will contain only Actions with specified statuses
|
|||
|
* @param page Page to load.
|
|||
|
* @param perPage Items to load per page.
|
|||
|
*/
|
|||
|
public async networksIdActionsGet (id: number, sort?: 'id' | 'id:asc' | 'id:desc' | 'command' | 'command:asc' | 'command:desc' | 'status' | 'status:asc' | 'status:desc' | 'started' | 'started:asc' | 'started:desc' | 'finished' | 'finished:asc' | 'finished:desc', status?: 'running' | 'success' | 'error', page?: number, perPage?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ActionsResponse; }> {
|
|||
|
const localVarPath = this.basePath + '/networks/{id}/actions'
|
|||
|
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
|
|||
|
let localVarQueryParameters: any = {};
|
|||
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|||
|
const produces = ['application/json'];
|
|||
|
// give precedence to 'application/json'
|
|||
|
if (produces.indexOf('application/json') >= 0) {
|
|||
|
localVarHeaderParams.Accept = 'application/json';
|
|||
|
} else {
|
|||
|
localVarHeaderParams.Accept = produces.join(',');
|
|||
|
}
|
|||
|
let localVarFormParams: any = {};
|
|||
|
|
|||
|
// verify required parameter 'id' is not null or undefined
|
|||
|
if (id === null || id === undefined) {
|
|||
|
throw new Error('Required parameter id was null or undefined when calling networksIdActionsGet.');
|
|||
|
}
|
|||
|
|
|||
|
if (sort !== undefined) {
|
|||
|
localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'id' | 'id:asc' | 'id:desc' | 'command' | 'command:asc' | 'command:desc' | 'status' | 'status:asc' | 'status:desc' | 'started' | 'started:asc' | 'started:desc' | 'finished' | 'finished:asc' | 'finished:desc'");
|
|||
|
}
|
|||
|
|
|||
|
if (status !== undefined) {
|
|||
|
localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "'running' | 'success' | 'error'");
|
|||
|
}
|
|||
|
|
|||
|
if (page !== undefined) {
|
|||
|
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
|
|||
|
}
|
|||
|
|
|||
|
if (perPage !== undefined) {
|
|||
|
localVarQueryParameters['per_page'] = ObjectSerializer.serialize(perPage, "number");
|
|||
|
}
|
|||
|
|
|||
|
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|||
|
|
|||
|
let localVarUseFormData = false;
|
|||
|
|
|||
|
let localVarRequestOptions: localVarRequest.Options = {
|
|||
|
method: 'GET',
|
|||
|
qs: localVarQueryParameters,
|
|||
|
headers: localVarHeaderParams,
|
|||
|
uri: localVarPath,
|
|||
|
useQuerystring: this._useQuerystring,
|
|||
|
json: true,
|
|||
|
};
|
|||
|
|
|||
|
let authenticationPromise = Promise.resolve();
|
|||
|
if (this.authentications.APIToken.accessToken) {
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.APIToken.applyToRequest(localVarRequestOptions));
|
|||
|
}
|
|||
|
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|||
|
|
|||
|
let interceptorPromise = authenticationPromise;
|
|||
|
for (const interceptor of this.interceptors) {
|
|||
|
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|||
|
}
|
|||
|
|
|||
|
return interceptorPromise.then(() => {
|
|||
|
if (Object.keys(localVarFormParams).length) {
|
|||
|
if (localVarUseFormData) {
|
|||
|
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|||
|
} else {
|
|||
|
localVarRequestOptions.form = localVarFormParams;
|
|||
|
}
|
|||
|
}
|
|||
|
return new Promise<{ response: http.IncomingMessage; body: ActionsResponse; }>((resolve, reject) => {
|
|||
|
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|||
|
if (error) {
|
|||
|
reject(error);
|
|||
|
} else {
|
|||
|
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|||
|
body = ObjectSerializer.deserialize(body, "ActionsResponse");
|
|||
|
resolve({ response: response, body: body });
|
|||
|
} else {
|
|||
|
reject(new HttpError(response, body, response.statusCode));
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
}
|