@ringer-tel/ivy
Version:
TypeScript SDK for Ringer APIs
182 lines (150 loc) • 7.55 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* Ringer Business API
* This API provides comprehensive endpoints for the Ringer Business system. It includes functionality for managing customer accounts, addresses, sites, phone numbers, payments, users, and other business resources. Operations typically require authentication and appropriate permissions.
*
* The version of the OpenAPI document: 1.0.6
* Contact: support@ringer.tel
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
AccountResponse,
AccountUpdateRequest,
SchemasError,
} from '../models/index';
import {
AccountResponseFromJSON,
AccountResponseToJSON,
AccountUpdateRequestFromJSON,
AccountUpdateRequestToJSON,
SchemasErrorFromJSON,
SchemasErrorToJSON,
} from '../models/index';
export interface UpdateAccountRequest {
accountUpdateRequest: AccountUpdateRequest;
}
/**
*
*/
export class AccountsApi extends runtime.BaseAPI {
/**
* Activates an inactive account, making it operational. This operation is typically restricted to users with an administrator role and can only be performed on accounts that are currently inactive and ready for activation (e.g., after confirmation and initial setup).
* Activate Current Account
*/
async activateAccountRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountResponse>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("oAuth2", []);
}
const response = await this.request({
path: `/account`,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AccountResponseFromJSON(jsonValue));
}
/**
* Activates an inactive account, making it operational. This operation is typically restricted to users with an administrator role and can only be performed on accounts that are currently inactive and ready for activation (e.g., after confirmation and initial setup).
* Activate Current Account
*/
async activateAccount(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountResponse> {
const response = await this.activateAccountRaw(initOverrides);
return await response.value();
}
/**
* Closes the authenticated user\'s account. This action is typically permanent and may have prerequisites (e.g., settling outstanding balances). Restricted to users with an administrator role.
* Close Current Account
*/
async closeAccountRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("oAuth2", []);
}
const response = await this.request({
path: `/account`,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Closes the authenticated user\'s account. This action is typically permanent and may have prerequisites (e.g., settling outstanding balances). Restricted to users with an administrator role.
* Close Current Account
*/
async closeAccount(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.closeAccountRaw(initOverrides);
}
/**
* Retrieves detailed information about the authenticated user\'s account. The level of detail and available actions might differ based on the user\'s role (e.g., administrator vs. regular user).
* Get Current Account Details
*/
async getAccountDetailsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountResponse>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("oAuth2", []);
}
const response = await this.request({
path: `/account`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AccountResponseFromJSON(jsonValue));
}
/**
* Retrieves detailed information about the authenticated user\'s account. The level of detail and available actions might differ based on the user\'s role (e.g., administrator vs. regular user).
* Get Current Account Details
*/
async getAccountDetails(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountResponse> {
const response = await this.getAccountDetailsRaw(initOverrides);
return await response.value();
}
/**
* Updates information for the authenticated user\'s account. Certain fields may only be modifiable by users with an administrator role.
* Update Current Account Information
*/
async updateAccountRaw(requestParameters: UpdateAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountResponse>> {
if (requestParameters['accountUpdateRequest'] == null) {
throw new runtime.RequiredError(
'accountUpdateRequest',
'Required parameter "accountUpdateRequest" was null or undefined when calling updateAccount().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
// oauth required
headerParameters["Authorization"] = await this.configuration.accessToken("oAuth2", []);
}
const response = await this.request({
path: `/account`,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: AccountUpdateRequestToJSON(requestParameters['accountUpdateRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AccountResponseFromJSON(jsonValue));
}
/**
* Updates information for the authenticated user\'s account. Certain fields may only be modifiable by users with an administrator role.
* Update Current Account Information
*/
async updateAccount(requestParameters: UpdateAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountResponse> {
const response = await this.updateAccountRaw(requestParameters, initOverrides);
return await response.value();
}
}