@ringer-tel/ivy
Version:
TypeScript SDK for Ringer APIs
92 lines (77 loc) • 3.6 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 {
ItemResponse,
ItemUpdateRequest,
ItemsComponentsSchemasError,
} from '../models/index';
import {
ItemResponseFromJSON,
ItemResponseToJSON,
ItemUpdateRequestFromJSON,
ItemUpdateRequestToJSON,
ItemsComponentsSchemasErrorFromJSON,
ItemsComponentsSchemasErrorToJSON,
} from '../models/index';
export interface UpdateItemByIdRequest {
id: number;
itemUpdateRequest: ItemUpdateRequest;
}
/**
*
*/
export class ItemsApi extends runtime.BaseAPI {
/**
* Updates attributes of a specific billable item, such as its name, pricing, or tax information, often within the context of a price deck. This operation is typically restricted to users with administrative privileges for managing pricing and service definitions.
* Update Item Details
*/
async updateItemByIdRaw(requestParameters: UpdateItemByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ItemResponse>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling updateItemById().'
);
}
if (requestParameters['itemUpdateRequest'] == null) {
throw new runtime.RequiredError(
'itemUpdateRequest',
'Required parameter "itemUpdateRequest" was null or undefined when calling updateItemById().'
);
}
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: `/items/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: ItemUpdateRequestToJSON(requestParameters['itemUpdateRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ItemResponseFromJSON(jsonValue));
}
/**
* Updates attributes of a specific billable item, such as its name, pricing, or tax information, often within the context of a price deck. This operation is typically restricted to users with administrative privileges for managing pricing and service definitions.
* Update Item Details
*/
async updateItemById(requestParameters: UpdateItemByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ItemResponse> {
const response = await this.updateItemByIdRaw(requestParameters, initOverrides);
return await response.value();
}
}