@ringer-tel/telique
Version:
TypeScript SDK for Ringer APIs
117 lines (96 loc) • 4.68 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 {
DnoResponse,
} from '../models/index';
import {
DnoResponseFromJSON,
DnoResponseToJSON,
} from '../models/index';
export interface GetDnoRequest {
num: string;
}
export interface GetDnoXmlRequest {
num: string;
}
/**
*
*/
export class DNOApi extends runtime.BaseAPI {
/**
* Check if a phone number is in the Do Not Originate (DNO) database. Returns a JSON response indicating whether the number exists in the database.
* DNO Lookup
*/
async getDnoRaw(requestParameters: GetDnoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DnoResponse>> {
if (requestParameters['num'] == null) {
throw new runtime.RequiredError(
'num',
'Required parameter "num" was null or undefined when calling getDno().'
);
}
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/dno/{num}`.replace(`{${"num"}}`, encodeURIComponent(String(requestParameters['num']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => DnoResponseFromJSON(jsonValue));
}
/**
* Check if a phone number is in the Do Not Originate (DNO) database. Returns a JSON response indicating whether the number exists in the database.
* DNO Lookup
*/
async getDno(requestParameters: GetDnoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DnoResponse> {
const response = await this.getDnoRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Check if a phone number is in the Do Not Originate (DNO) database. Returns an XML response indicating whether the number exists in the database.
* DNO Lookup (XML)
*/
async getDnoXmlRaw(requestParameters: GetDnoXmlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DnoResponse>> {
if (requestParameters['num'] == null) {
throw new runtime.RequiredError(
'num',
'Required parameter "num" was null or undefined when calling getDnoXml().'
);
}
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/dno/{num}/xml`.replace(`{${"num"}}`, encodeURIComponent(String(requestParameters['num']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => DnoResponseFromJSON(jsonValue));
}
/**
* Check if a phone number is in the Do Not Originate (DNO) database. Returns an XML response indicating whether the number exists in the database.
* DNO Lookup (XML)
*/
async getDnoXml(requestParameters: GetDnoXmlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DnoResponse> {
const response = await this.getDnoXmlRaw(requestParameters, initOverrides);
return await response.value();
}
}