@ringer-tel/telique
Version:
TypeScript SDK for Ringer APIs
278 lines (233 loc) • 11.3 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 {
CICRORResponse,
CICResponse,
} from '../models/index';
import {
CICRORResponseFromJSON,
CICRORResponseToJSON,
CICResponseFromJSON,
CICResponseToJSON,
} from '../models/index';
export interface GetCicInfoRequest {
crn: number;
ani: number;
lata: number;
}
export interface GetCicInfoPlainTextRequest {
crn: number;
ani: number;
lata: number;
}
export interface GetCicRorInfoRequest {
crn: number;
ani: number;
lata: number;
}
export interface GetCicRorInfoPlainTextRequest {
crn: number;
ani: number;
lata: number;
}
/**
*
*/
export class CICApi extends runtime.BaseAPI {
/**
* Retrieve Carrier Identification Code (CIC) information for the specified parameters.
* Get CIC information
*/
async getCicInfoRaw(requestParameters: GetCicInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CICResponse>> {
if (requestParameters['crn'] == null) {
throw new runtime.RequiredError(
'crn',
'Required parameter "crn" was null or undefined when calling getCicInfo().'
);
}
if (requestParameters['ani'] == null) {
throw new runtime.RequiredError(
'ani',
'Required parameter "ani" was null or undefined when calling getCicInfo().'
);
}
if (requestParameters['lata'] == null) {
throw new runtime.RequiredError(
'lata',
'Required parameter "lata" was null or undefined when calling getCicInfo().'
);
}
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/cic/{crn}/{ani}/{lata}`.replace(`{${"crn"}}`, encodeURIComponent(String(requestParameters['crn']))).replace(`{${"ani"}}`, encodeURIComponent(String(requestParameters['ani']))).replace(`{${"lata"}}`, encodeURIComponent(String(requestParameters['lata']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => CICResponseFromJSON(jsonValue));
}
/**
* Retrieve Carrier Identification Code (CIC) information for the specified parameters.
* Get CIC information
*/
async getCicInfo(requestParameters: GetCicInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CICResponse> {
const response = await this.getCicInfoRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve Carrier Identification Code (CIC) information in plain text format.
* Get CIC information (plain text)
*/
async getCicInfoPlainTextRaw(requestParameters: GetCicInfoPlainTextRequest, 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 getCicInfoPlainText().'
);
}
if (requestParameters['ani'] == null) {
throw new runtime.RequiredError(
'ani',
'Required parameter "ani" was null or undefined when calling getCicInfoPlainText().'
);
}
if (requestParameters['lata'] == null) {
throw new runtime.RequiredError(
'lata',
'Required parameter "lata" was null or undefined when calling getCicInfoPlainText().'
);
}
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/cic/{crn}/{ani}/{lata}/plain`.replace(`{${"crn"}}`, encodeURIComponent(String(requestParameters['crn']))).replace(`{${"ani"}}`, encodeURIComponent(String(requestParameters['ani']))).replace(`{${"lata"}}`, encodeURIComponent(String(requestParameters['lata']))),
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 Carrier Identification Code (CIC) information in plain text format.
* Get CIC information (plain text)
*/
async getCicInfoPlainText(requestParameters: GetCicInfoPlainTextRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
const response = await this.getCicInfoPlainTextRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve Carrier Identification Code (CIC) information including Responsible Organization (ROR) data.
* Get CIC information with ROR
*/
async getCicRorInfoRaw(requestParameters: GetCicRorInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CICRORResponse>> {
if (requestParameters['crn'] == null) {
throw new runtime.RequiredError(
'crn',
'Required parameter "crn" was null or undefined when calling getCicRorInfo().'
);
}
if (requestParameters['ani'] == null) {
throw new runtime.RequiredError(
'ani',
'Required parameter "ani" was null or undefined when calling getCicRorInfo().'
);
}
if (requestParameters['lata'] == null) {
throw new runtime.RequiredError(
'lata',
'Required parameter "lata" was null or undefined when calling getCicRorInfo().'
);
}
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/cicror/{crn}/{ani}/{lata}`.replace(`{${"crn"}}`, encodeURIComponent(String(requestParameters['crn']))).replace(`{${"ani"}}`, encodeURIComponent(String(requestParameters['ani']))).replace(`{${"lata"}}`, encodeURIComponent(String(requestParameters['lata']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => CICRORResponseFromJSON(jsonValue));
}
/**
* Retrieve Carrier Identification Code (CIC) information including Responsible Organization (ROR) data.
* Get CIC information with ROR
*/
async getCicRorInfo(requestParameters: GetCicRorInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CICRORResponse> {
const response = await this.getCicRorInfoRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve Carrier Identification Code (CIC) and Responsible Organization (ROR) information in plain text format.
* Get CIC information with ROR (plain text)
*/
async getCicRorInfoPlainTextRaw(requestParameters: GetCicRorInfoPlainTextRequest, 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 getCicRorInfoPlainText().'
);
}
if (requestParameters['ani'] == null) {
throw new runtime.RequiredError(
'ani',
'Required parameter "ani" was null or undefined when calling getCicRorInfoPlainText().'
);
}
if (requestParameters['lata'] == null) {
throw new runtime.RequiredError(
'lata',
'Required parameter "lata" was null or undefined when calling getCicRorInfoPlainText().'
);
}
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/cicror/{crn}/{ani}/{lata}/plain`.replace(`{${"crn"}}`, encodeURIComponent(String(requestParameters['crn']))).replace(`{${"ani"}}`, encodeURIComponent(String(requestParameters['ani']))).replace(`{${"lata"}}`, encodeURIComponent(String(requestParameters['lata']))),
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 Carrier Identification Code (CIC) and Responsible Organization (ROR) information in plain text format.
* Get CIC information with ROR (plain text)
*/
async getCicRorInfoPlainText(requestParameters: GetCicRorInfoPlainTextRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
const response = await this.getCicRorInfoPlainTextRaw(requestParameters, initOverrides);
return await response.value();
}
}