@ringer-tel/ivy
Version:
TypeScript SDK for Ringer APIs
127 lines (105 loc) • 4.66 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 {
PaginatedPlanListResponse,
PlanResponse,
PlansComponentsSchemasError,
} from '../models/index';
import {
PaginatedPlanListResponseFromJSON,
PaginatedPlanListResponseToJSON,
PlanResponseFromJSON,
PlanResponseToJSON,
PlansComponentsSchemasErrorFromJSON,
PlansComponentsSchemasErrorToJSON,
} from '../models/index';
export interface GetPlanByIdRequest {
id: number;
}
export interface ListAccountPlansRequest {
page?: number;
pageSize?: number;
}
/**
*
*/
export class PlansApi extends runtime.BaseAPI {
/**
* Retrieves detailed information for a specific subscription plan by its ID.
* Get Plan Details
*/
async getPlanByIdRaw(requestParameters: GetPlanByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PlanResponse>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling getPlanById().'
);
}
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: `/plans/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PlanResponseFromJSON(jsonValue));
}
/**
* Retrieves detailed information for a specific subscription plan by its ID.
* Get Plan Details
*/
async getPlanById(requestParameters: GetPlanByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PlanResponse> {
const response = await this.getPlanByIdRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieves a paginated list of plan(s) currently active on the authenticated customer\'s account. Typically, an account has one primary active plan.
* List Current Account Plan(s)
*/
async listAccountPlansRaw(requestParameters: ListAccountPlansRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedPlanListResponse>> {
const queryParameters: any = {};
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['pageSize'] != null) {
queryParameters['page_size'] = requestParameters['pageSize'];
}
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: `/plans`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedPlanListResponseFromJSON(jsonValue));
}
/**
* Retrieves a paginated list of plan(s) currently active on the authenticated customer\'s account. Typically, an account has one primary active plan.
* List Current Account Plan(s)
*/
async listAccountPlans(requestParameters: ListAccountPlansRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedPlanListResponse> {
const response = await this.listAccountPlansRaw(requestParameters, initOverrides);
return await response.value();
}
}