@ringer-tel/telique
Version:
TypeScript SDK for Ringer APIs
121 lines (100 loc) • 4.66 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* Telique API
* The Ringer Telique API provides access to telecommunications data, including caller name (CNAM) data, line type information, and more. The API also includes services for checking phone numbers against Do Not Originate (DNO) and Do Not Call (DNC) databases, as well as STIR/SHAKEN call authentication validation. ## Authentication This API uses IP whitelist authentication. Your server\'s IP address must be registered with Ringer before making API calls. Contact support@ringer.tel to register your IP address.
*
* The version of the OpenAPI document: 1.0.18
* 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 {
RORResponse,
} from '../models/index';
import {
RORResponseFromJSON,
RORResponseToJSON,
} from '../models/index';
export interface GetRorInfoRequest {
crn: number;
}
export interface GetRorInfoPlainTextRequest {
crn: number;
}
/**
*
*/
export class RORApi extends runtime.BaseAPI {
/**
* Retrieve Responsible Organization (ROR) information for the specified CRN.
* Get ROR information
*/
async getRorInfoRaw(requestParameters: GetRorInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RORResponse>> {
if (requestParameters['crn'] == null) {
throw new runtime.RequiredError(
'crn',
'Required parameter "crn" was null or undefined when calling getRorInfo().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Forwarded-For"] = await this.configuration.apiKey("X-Forwarded-For"); // ipWhitelist authentication
}
const response = await this.request({
path: `/telique/ror/{crn}`.replace(`{${"crn"}}`, encodeURIComponent(String(requestParameters['crn']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RORResponseFromJSON(jsonValue));
}
/**
* Retrieve Responsible Organization (ROR) information for the specified CRN.
* Get ROR information
*/
async getRorInfo(requestParameters: GetRorInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RORResponse> {
const response = await this.getRorInfoRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve Responsible Organization (ROR) information in plain text format.
* Get ROR information (plain text)
*/
async getRorInfoPlainTextRaw(requestParameters: GetRorInfoPlainTextRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>> {
if (requestParameters['crn'] == null) {
throw new runtime.RequiredError(
'crn',
'Required parameter "crn" was null or undefined when calling getRorInfoPlainText().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-Forwarded-For"] = await this.configuration.apiKey("X-Forwarded-For"); // ipWhitelist authentication
}
const response = await this.request({
path: `/telique/ror/{crn}/plain`.replace(`{${"crn"}}`, encodeURIComponent(String(requestParameters['crn']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse<string>(response);
} else {
return new runtime.TextApiResponse(response) as any;
}
}
/**
* Retrieve Responsible Organization (ROR) information in plain text format.
* Get ROR information (plain text)
*/
async getRorInfoPlainText(requestParameters: GetRorInfoPlainTextRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
const response = await this.getRorInfoPlainTextRaw(requestParameters, initOverrides);
return await response.value();
}
}