UNPKG

@ringer-tel/telique

Version:
152 lines (125 loc) 5.98 kB
/* 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 { DncUpdateReportInner, DnoResponse, } from '../models/index'; import { DncUpdateReportInnerFromJSON, DncUpdateReportInnerToJSON, DnoResponseFromJSON, DnoResponseToJSON, } from '../models/index'; export interface GetDncRequest { num: string; } export interface GetDncXmlRequest { num: string; } /** * */ export class DNCApi extends runtime.BaseAPI { /** * Check if a phone number is in the Do Not Call (DNC) database. Returns a JSON response indicating whether the number exists in the database. * DNC Lookup */ async getDncRaw(requestParameters: GetDncRequest, 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 getDnc().' ); } 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/dnc/{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 Call (DNC) database. Returns a JSON response indicating whether the number exists in the database. * DNC Lookup */ async getDnc(requestParameters: GetDncRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DnoResponse> { const response = await this.getDncRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve a report of DNC updates by area code (NPA). * DNC Update Report */ async getDncReportRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<DncUpdateReportInner>>> { 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/dncreport`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(DncUpdateReportInnerFromJSON)); } /** * Retrieve a report of DNC updates by area code (NPA). * DNC Update Report */ async getDncReport(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<DncUpdateReportInner>> { const response = await this.getDncReportRaw(initOverrides); return await response.value(); } /** * Check if a phone number is in the Do Not Call (DNC) database. Returns an XML response indicating whether the number exists in the database. * DNC Lookup (XML) */ async getDncXmlRaw(requestParameters: GetDncXmlRequest, 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 getDncXml().' ); } 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/dnc/{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 Call (DNC) database. Returns an XML response indicating whether the number exists in the database. * DNC Lookup (XML) */ async getDncXml(requestParameters: GetDncXmlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DnoResponse> { const response = await this.getDncXmlRaw(requestParameters, initOverrides); return await response.value(); } }