UNPKG

twilio

Version:
267 lines (266 loc) 10.3 kB
"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.QueryInstance = exports.SmsPumpingRiskInfo = exports.SimSwapInfo = exports.RiskParameters = exports.ReassignedNumberParameters = exports.ReassignedNumberInfo = exports.LookupRequest = exports.LookupBatchResponse = exports.LookupBatchRequest = exports.LineTypeIntelligenceInfo = exports.LineStatusInfo = exports.LastSimSwapInfo = exports.IdentityMatchParameters = exports.IdentityMatchInfo = exports.CallerNameInfo = exports.CallForwardingInfo = void 0; exports.QueryListInstance = QueryListInstance; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class CallForwardingInfo { constructor(payload) { this.callForwardingEnabled = payload["call_forwarding_enabled"]; this.errorCode = payload["error_code"]; } } exports.CallForwardingInfo = CallForwardingInfo; class CallerNameInfo { constructor(payload) { this.callerName = payload["caller_name"]; this.callerType = payload["caller_type"]; this.errorCode = payload["error_code"]; } } exports.CallerNameInfo = CallerNameInfo; class IdentityMatchInfo { constructor(payload) { this.firstNameMatch = payload["first_name_match"]; this.lastNameMatch = payload["last_name_match"]; this.addressLinesMatch = payload["address_lines_match"]; this.cityMatch = payload["city_match"]; this.stateMatch = payload["state_match"]; this.postalCodeMatch = payload["postal_code_match"]; this.addressCountryMatch = payload["address_country_match"]; this.nationalIdMatch = payload["national_id_match"]; this.dateOfBirthMatch = payload["date_of_birth_match"]; this.summaryScore = payload["summary_score"]; this.errorCode = payload["error_code"]; this.errorMessage = payload["error_message"]; } } exports.IdentityMatchInfo = IdentityMatchInfo; class IdentityMatchParameters { constructor(payload) { this.firstName = payload["first_name"]; this.lastName = payload["last_name"]; this.addressLine1 = payload["address_line1"]; this.addressLine2 = payload["address_line2"]; this.city = payload["city"]; this.state = payload["state"]; this.postalCode = payload["postal_code"]; this.addressCountryCode = payload["address_country_code"]; this.nationalId = payload["national_id"]; this.dateOfBirth = payload["date_of_birth"]; } } exports.IdentityMatchParameters = IdentityMatchParameters; class LastSimSwapInfo { constructor(payload) { this.lastSimSwapDate = payload["last_sim_swap_date"]; this.swappedPeriod = payload["swapped_period"]; this.swappedInPeriod = payload["swapped_in_period"]; } } exports.LastSimSwapInfo = LastSimSwapInfo; class LineStatusInfo { constructor(payload) { this.status = payload["status"]; this.errorCode = payload["error_code"]; } } exports.LineStatusInfo = LineStatusInfo; class LineTypeIntelligenceInfo { constructor(payload) { this.mobileCountryCode = payload["mobile_country_code"]; this.mobileNetworkCode = payload["mobile_network_code"]; this.carrierName = payload["carrier_name"]; this.type = payload["type"]; this.errorCode = payload["error_code"]; } } exports.LineTypeIntelligenceInfo = LineTypeIntelligenceInfo; class LookupBatchRequest { constructor(payload) { this.correlationId = payload["correlation_id"]; this.phoneNumber = payload["phone_number"]; this.fields = payload["fields"]; this.countryCode = payload["country_code"]; this.identityMatch = payload["identity_match"]; this.reassignedNumber = payload["reassigned_number"]; this.smsPumpingRisk = payload["sms_pumping_risk"]; } } exports.LookupBatchRequest = LookupBatchRequest; class LookupBatchResponse { constructor(payload) { this.correlationId = payload["correlation_id"]; this.twilioErrorCode = payload["twilio_error_code"]; this.callingCountryCode = payload["calling_country_code"]; this.countryCode = payload["country_code"]; this.phoneNumber = payload["phone_number"]; this.nationalFormat = payload["national_format"]; this.valid = payload["valid"]; this.validationErrors = payload["validation_errors"]; this.callerName = payload["caller_name"]; this.simSwap = payload["sim_swap"]; this.callForwarding = payload["call_forwarding"]; this.lineTypeIntelligence = payload["line_type_intelligence"]; this.lineStatus = payload["line_status"]; this.identityMatch = payload["identity_match"]; this.reassignedNumber = payload["reassigned_number"]; this.smsPumpingRisk = payload["sms_pumping_risk"]; this.phoneNumberQualityScore = payload["phone_number_quality_score"]; this.preFill = payload["pre_fill"]; } } exports.LookupBatchResponse = LookupBatchResponse; class LookupRequest { constructor(payload) { this.phoneNumbers = payload["phone_numbers"]; } } exports.LookupRequest = LookupRequest; class ReassignedNumberInfo { constructor(payload) { this.lastVerifiedDate = payload["last_verified_date"]; this.isNumberReassigned = payload["is_number_reassigned"]; this.errorCode = payload["error_code"]; } } exports.ReassignedNumberInfo = ReassignedNumberInfo; class ReassignedNumberParameters { constructor(payload) { this.lastVerifiedDate = payload["last_verified_date"]; } } exports.ReassignedNumberParameters = ReassignedNumberParameters; class RiskParameters { constructor(payload) { this.partnerSubId = payload["partner_sub_id"]; } } exports.RiskParameters = RiskParameters; class SimSwapInfo { constructor(payload) { this.lastSimSwap = payload["last_sim_swap"]; this.carrierName = payload["carrier_name"]; this.mobileCountryCode = payload["mobile_country_code"]; this.mobileNetworkCode = payload["mobile_network_code"]; this.errorCode = payload["error_code"]; } } exports.SimSwapInfo = SimSwapInfo; class SmsPumpingRiskInfo { constructor(payload) { this.carrierRiskCategory = payload["carrier_risk_category"]; this.numberBlocked = payload["number_blocked"]; this.numberBlockedDate = payload["number_blocked_date"]; this.numberBlockedLast3Months = payload["number_blocked_last_3_months"]; this.smsPumpingRiskScore = payload["sms_pumping_risk_score"]; this.errorCode = payload["error_code"]; } } exports.SmsPumpingRiskInfo = SmsPumpingRiskInfo; function QueryListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/batch/query`; instance.create = function create(params, headers, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; if (headers === null || headers === undefined) { headers = {}; } headers["Content-Type"] = "application/json"; headers["Accept"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new QueryInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; if (headers === null || headers === undefined) { headers = {}; } headers["Content-Type"] = "application/json"; headers["Accept"] = "application/json"; let operationVersion = version; // CREATE, FETCH, UPDATE operations let operationPromise = operationVersion .createWithResponseInfo({ uri: instance._uri, method: "post", data, headers, }) .then((response) => ({ ...response, body: new QueryInstance(operationVersion, response.body), })); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.toJSON = function toJSON() { return instance._solution; }; instance[util_1.inspect.custom] = function inspectImpl(_depth, options) { return (0, util_1.inspect)(instance.toJSON(), options); }; return instance; } class QueryInstance { constructor(_version, payload) { this._version = _version; this.phoneNumbers = payload.phone_numbers !== null && payload.phone_numbers !== undefined ? payload.phone_numbers.map((payload) => new LookupBatchResponse(payload)) : null; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { phoneNumbers: this.phoneNumbers, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.QueryInstance = QueryInstance;