Auto-commit 2026-04-29 16:31

This commit is contained in:
2026-04-29 16:31:27 -04:00
parent e8687bb6b2
commit 0495ee5bd2
19691 changed files with 3272886 additions and 138 deletions

35
node_modules/twilio/lib/rest/insights/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import InsightsBase from "../InsightsBase";
import Version from "../../base/Version";
import { CallListInstance } from "./v1/call";
import { CallSummariesListInstance } from "./v1/callSummaries";
import { ConferenceListInstance } from "./v1/conference";
import { RoomListInstance } from "./v1/room";
import { SettingListInstance } from "./v1/setting";
export default class V1 extends Version {
/**
* Initialize the V1 version of Insights
*
* @param domain - The Twilio (Twilio.Insights) domain
*/
constructor(domain: InsightsBase);
/** calls - { Twilio.Insights.V1.CallListInstance } resource */
protected _calls?: CallListInstance;
/** callSummaries - { Twilio.Insights.V1.CallSummariesListInstance } resource */
protected _callSummaries?: CallSummariesListInstance;
/** conferences - { Twilio.Insights.V1.ConferenceListInstance } resource */
protected _conferences?: ConferenceListInstance;
/** rooms - { Twilio.Insights.V1.RoomListInstance } resource */
protected _rooms?: RoomListInstance;
/** settings - { Twilio.Insights.V1.SettingListInstance } resource */
protected _settings?: SettingListInstance;
/** Getter for calls resource */
get calls(): CallListInstance;
/** Getter for callSummaries resource */
get callSummaries(): CallSummariesListInstance;
/** Getter for conferences resource */
get conferences(): ConferenceListInstance;
/** Getter for rooms resource */
get rooms(): RoomListInstance;
/** Getter for settings resource */
get settings(): SettingListInstance;
}

61
node_modules/twilio/lib/rest/insights/V1.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const call_1 = require("./v1/call");
const callSummaries_1 = require("./v1/callSummaries");
const conference_1 = require("./v1/conference");
const room_1 = require("./v1/room");
const setting_1 = require("./v1/setting");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Insights
*
* @param domain - The Twilio (Twilio.Insights) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for calls resource */
get calls() {
this._calls = this._calls || (0, call_1.CallListInstance)(this);
return this._calls;
}
/** Getter for callSummaries resource */
get callSummaries() {
this._callSummaries =
this._callSummaries || (0, callSummaries_1.CallSummariesListInstance)(this);
return this._callSummaries;
}
/** Getter for conferences resource */
get conferences() {
this._conferences = this._conferences || (0, conference_1.ConferenceListInstance)(this);
return this._conferences;
}
/** Getter for rooms resource */
get rooms() {
this._rooms = this._rooms || (0, room_1.RoomListInstance)(this);
return this._rooms;
}
/** Getter for settings resource */
get settings() {
this._settings = this._settings || (0, setting_1.SettingListInstance)(this);
return this._settings;
}
}
exports.default = V1;

21
node_modules/twilio/lib/rest/insights/V2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import InsightsBase from "../InsightsBase";
import Version from "../../base/Version";
import { InboundListInstance } from "./v2/inbound";
import { OutboundListInstance } from "./v2/outbound";
import { ReportListInstance } from "./v2/report";
export default class V2 extends Version {
/**
* Initialize the V2 version of Insights
*
* @param domain - The Twilio (Twilio.Insights) domain
*/
constructor(domain: InsightsBase);
/** reports - { Twilio.Insights.V2.ReportListInstance } resource */
protected _reports?: ReportListInstance;
/** Accessor for inbound resource */
inbound(reportId: string): InboundListInstance;
/** Accessor for outbound resource */
outbound(reportId: string): OutboundListInstance;
/** Getter for reports resource */
get reports(): ReportListInstance;
}

46
node_modules/twilio/lib/rest/insights/V2.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Sample/reference Twilio API.
* This is the reference API for the rest-proxy server.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const inbound_1 = require("./v2/inbound");
const outbound_1 = require("./v2/outbound");
const report_1 = require("./v2/report");
class V2 extends Version_1.default {
/**
* Initialize the V2 version of Insights
*
* @param domain - The Twilio (Twilio.Insights) domain
*/
constructor(domain) {
super(domain, "v2");
}
/** Accessor for inbound resource */
inbound(reportId) {
return (0, inbound_1.InboundListInstance)(this, reportId);
}
/** Accessor for outbound resource */
outbound(reportId) {
return (0, outbound_1.OutboundListInstance)(this, reportId);
}
/** Getter for reports resource */
get reports() {
this._reports = this._reports || (0, report_1.ReportListInstance)(this);
return this._reports;
}
}
exports.default = V2;

134
node_modules/twilio/lib/rest/insights/v1/call.d.ts generated vendored Normal file
View File

@@ -0,0 +1,134 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { AnnotationListInstance } from "./call/annotation";
import { CallSummaryListInstance } from "./call/callSummary";
import { EventListInstance } from "./call/event";
import { MetricListInstance } from "./call/metric";
export interface CallContext {
annotation: AnnotationListInstance;
summary: CallSummaryListInstance;
events: EventListInstance;
metrics: MetricListInstance;
/**
* Fetch a CallInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallInstance
*/
fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>;
/**
* Fetch a CallInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CallInstance>) => any): Promise<ApiResponse<CallInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CallContextSolution {
sid: string;
}
export declare class CallContextImpl implements CallContext {
protected _version: V1;
protected _solution: CallContextSolution;
protected _uri: string;
protected _annotation?: AnnotationListInstance;
protected _summary?: CallSummaryListInstance;
protected _events?: EventListInstance;
protected _metrics?: MetricListInstance;
constructor(_version: V1, sid: string);
get annotation(): AnnotationListInstance;
get summary(): CallSummaryListInstance;
get events(): EventListInstance;
get metrics(): MetricListInstance;
fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CallInstance>) => any): Promise<ApiResponse<CallInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CallContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CallResource {
sid: string;
url: string;
links: Record<string, string>;
}
export declare class CallInstance {
protected _version: V1;
protected _solution: CallContextSolution;
protected _context?: CallContext;
constructor(_version: V1, payload: CallResource, sid?: string);
sid: string;
url: string;
links: Record<string, string>;
private get _proxy();
/**
* Fetch a CallInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallInstance
*/
fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>;
/**
* Fetch a CallInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CallInstance>) => any): Promise<ApiResponse<CallInstance>>;
/**
* Access the annotation.
*/
annotation(): AnnotationListInstance;
/**
* Access the summary.
*/
summary(): CallSummaryListInstance;
/**
* Access the events.
*/
events(): EventListInstance;
/**
* Access the metrics.
*/
metrics(): MetricListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CallSolution {
}
export interface CallListInstance {
_version: V1;
_solution: CallSolution;
_uri: string;
(sid: string): CallContext;
get(sid: string): CallContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CallListInstance(version: V1): CallListInstance;
export {};

191
node_modules/twilio/lib/rest/insights/v1/call.js generated vendored Normal file
View File

@@ -0,0 +1,191 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.CallInstance = exports.CallContextImpl = void 0;
exports.CallListInstance = CallListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const annotation_1 = require("./call/annotation");
const callSummary_1 = require("./call/callSummary");
const event_1 = require("./call/event");
const metric_1 = require("./call/metric");
class CallContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Voice/${sid}`;
}
get annotation() {
this._annotation =
this._annotation ||
(0, annotation_1.AnnotationListInstance)(this._version, this._solution.sid);
return this._annotation;
}
get summary() {
this._summary =
this._summary ||
(0, callSummary_1.CallSummaryListInstance)(this._version, this._solution.sid);
return this._summary;
}
get events() {
this._events =
this._events || (0, event_1.EventListInstance)(this._version, this._solution.sid);
return this._events;
}
get metrics() {
this._metrics =
this._metrics || (0, metric_1.MetricListInstance)(this._version, this._solution.sid);
return this._metrics;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new CallInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new CallInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CallContextImpl = CallContextImpl;
class CallInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context || new CallContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a CallInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CallInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the annotation.
*/
annotation() {
return this._proxy.annotation;
}
/**
* Access the summary.
*/
summary() {
return this._proxy.summary;
}
/**
* Access the events.
*/
events() {
return this._proxy.events;
}
/**
* Access the metrics.
*/
metrics() {
return this._proxy.metrics;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CallInstance = CallInstance;
function CallListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CallContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
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;
}

View File

@@ -0,0 +1,236 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export type AnnotationAnsweredBy = "unknown_answered_by" | "human" | "machine";
export type AnnotationConnectivityIssue = "unknown_connectivity_issue" | "no_connectivity_issue" | "invalid_number" | "caller_id" | "dropped_call" | "number_reachability";
/**
* Options to pass to update a AnnotationInstance
*/
export interface AnnotationContextUpdateOptions {
/** */
answeredBy?: AnnotationAnsweredBy;
/** */
connectivityIssue?: AnnotationConnectivityIssue;
/** Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call. */
qualityIssues?: string;
/** A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call. */
spam?: boolean;
/** Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */
callScore?: number;
/** Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`. */
comment?: string;
/** Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. */
incident?: string;
}
export interface AnnotationContext {
/**
* Fetch a AnnotationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance
*/
fetch(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
/**
* Fetch a AnnotationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
/**
* Update a AnnotationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance
*/
update(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
/**
* Update a AnnotationInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance
*/
update(params: AnnotationContextUpdateOptions, callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
/**
* Update a AnnotationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
/**
* Update a AnnotationInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance with HTTP metadata
*/
updateWithHttpInfo(params: AnnotationContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AnnotationContextSolution {
callSid: string;
}
export declare class AnnotationContextImpl implements AnnotationContext {
protected _version: V1;
protected _solution: AnnotationContextSolution;
protected _uri: string;
constructor(_version: V1, callSid: string);
fetch(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
update(params?: AnnotationContextUpdateOptions | ((error: Error | null, item?: AnnotationInstance) => any), callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
updateWithHttpInfo(params?: AnnotationContextUpdateOptions | ((error: Error | null, item?: ApiResponse<AnnotationInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AnnotationContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AnnotationResource {
call_sid: string;
account_sid: string;
answered_by: AnnotationAnsweredBy;
connectivity_issue: AnnotationConnectivityIssue;
quality_issues: Array<string>;
spam: boolean;
call_score: number;
comment: string;
incident: string;
url: string;
}
export declare class AnnotationInstance {
protected _version: V1;
protected _solution: AnnotationContextSolution;
protected _context?: AnnotationContext;
constructor(_version: V1, payload: AnnotationResource, callSid: string);
/**
* The unique SID identifier of the Call.
*/
callSid: string;
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
answeredBy: AnnotationAnsweredBy;
connectivityIssue: AnnotationConnectivityIssue;
/**
* Specifies if the call had any subjective quality issues. Possible values are one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, or `static_noise`.
*/
qualityIssues: Array<string>;
/**
* Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call.
*/
spam: boolean;
/**
* Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
*/
callScore: number;
/**
* Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments.
*/
comment: string;
/**
* Incident or support ticket associated with this call. The `incident` property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`.
*/
incident: string;
url: string;
private get _proxy();
/**
* Fetch a AnnotationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance
*/
fetch(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
/**
* Fetch a AnnotationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
/**
* Update a AnnotationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance
*/
update(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
/**
* Update a AnnotationInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance
*/
update(params: AnnotationContextUpdateOptions, callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>;
/**
* Update a AnnotationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
/**
* Update a AnnotationInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance with HTTP metadata
*/
updateWithHttpInfo(params: AnnotationContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AnnotationInstance>) => any): Promise<ApiResponse<AnnotationInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
callSid: string;
accountSid: string;
answeredBy: AnnotationAnsweredBy;
connectivityIssue: AnnotationConnectivityIssue;
qualityIssues: string[];
spam: boolean;
callScore: number;
comment: string;
incident: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AnnotationSolution {
callSid: string;
}
export interface AnnotationListInstance {
_version: V1;
_solution: AnnotationSolution;
_uri: string;
(): AnnotationContext;
get(): AnnotationContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AnnotationListInstance(version: V1, callSid: string): AnnotationListInstance;
export {};

View File

@@ -0,0 +1,245 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.AnnotationInstance = exports.AnnotationContextImpl = void 0;
exports.AnnotationListInstance = AnnotationListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class AnnotationContextImpl {
constructor(_version, callSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(callSid)) {
throw new Error("Parameter 'callSid' is not valid.");
}
this._solution = { callSid };
this._uri = `/Voice/${callSid}/Annotation`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new AnnotationInstance(operationVersion, payload, instance._solution.callSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new AnnotationInstance(operationVersion, response.body, instance._solution.callSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["answeredBy"] !== undefined)
data["AnsweredBy"] = params["answeredBy"];
if (params["connectivityIssue"] !== undefined)
data["ConnectivityIssue"] = params["connectivityIssue"];
if (params["qualityIssues"] !== undefined)
data["QualityIssues"] = params["qualityIssues"];
if (params["spam"] !== undefined)
data["Spam"] = serialize.bool(params["spam"]);
if (params["callScore"] !== undefined)
data["CallScore"] = params["callScore"];
if (params["comment"] !== undefined)
data["Comment"] = params["comment"];
if (params["incident"] !== undefined)
data["Incident"] = params["incident"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new AnnotationInstance(operationVersion, payload, instance._solution.callSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["answeredBy"] !== undefined)
data["AnsweredBy"] = params["answeredBy"];
if (params["connectivityIssue"] !== undefined)
data["ConnectivityIssue"] = params["connectivityIssue"];
if (params["qualityIssues"] !== undefined)
data["QualityIssues"] = params["qualityIssues"];
if (params["spam"] !== undefined)
data["Spam"] = serialize.bool(params["spam"]);
if (params["callScore"] !== undefined)
data["CallScore"] = params["callScore"];
if (params["comment"] !== undefined)
data["Comment"] = params["comment"];
if (params["incident"] !== undefined)
data["Incident"] = params["incident"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new AnnotationInstance(operationVersion, response.body, instance._solution.callSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AnnotationContextImpl = AnnotationContextImpl;
class AnnotationInstance {
constructor(_version, payload, callSid) {
this._version = _version;
this.callSid = payload.call_sid;
this.accountSid = payload.account_sid;
this.answeredBy = payload.answered_by;
this.connectivityIssue = payload.connectivity_issue;
this.qualityIssues = payload.quality_issues;
this.spam = payload.spam;
this.callScore = deserialize.integer(payload.call_score);
this.comment = payload.comment;
this.incident = payload.incident;
this.url = payload.url;
this._solution = { callSid };
}
get _proxy() {
this._context =
this._context ||
new AnnotationContextImpl(this._version, this._solution.callSid);
return this._context;
}
/**
* Fetch a AnnotationInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a AnnotationInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AnnotationInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
callSid: this.callSid,
accountSid: this.accountSid,
answeredBy: this.answeredBy,
connectivityIssue: this.connectivityIssue,
qualityIssues: this.qualityIssues,
spam: this.spam,
callScore: this.callScore,
comment: this.comment,
incident: this.incident,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AnnotationInstance = AnnotationInstance;
function AnnotationListInstance(version, callSid) {
if (!(0, utility_1.isValidPathParam)(callSid)) {
throw new Error("Parameter 'callSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new AnnotationContextImpl(version, callSid);
};
instance._version = version;
instance._solution = { callSid };
instance._uri = ``;
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;
}

View File

@@ -0,0 +1,267 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export type CallSummaryAnsweredBy = "unknown" | "machine_start" | "machine_end_beep" | "machine_end_silence" | "machine_end_other" | "human" | "fax";
export type CallSummaryCallState = "ringing" | "completed" | "busy" | "fail" | "noanswer" | "canceled" | "answered" | "undialed";
export type CallSummaryCallType = "carrier" | "sip" | "trunking" | "client" | "whatsapp";
export type CallSummaryProcessingState = "complete" | "partial";
/**
* Options to pass to fetch a CallSummaryInstance
*/
export interface CallSummaryContextFetchOptions {
/** The Processing State of this Call Summary. One of `complete`, `partial` or `all`. */
processingState?: CallSummaryProcessingState;
}
export interface CallSummaryContext {
/**
* Fetch a CallSummaryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance
*/
fetch(callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>;
/**
* Fetch a CallSummaryInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance
*/
fetch(params: CallSummaryContextFetchOptions, callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>;
/**
* Fetch a CallSummaryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CallSummaryInstance>) => any): Promise<ApiResponse<CallSummaryInstance>>;
/**
* Fetch a CallSummaryInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance with HTTP metadata
*/
fetchWithHttpInfo(params: CallSummaryContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<CallSummaryInstance>) => any): Promise<ApiResponse<CallSummaryInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CallSummaryContextSolution {
callSid: string;
}
export declare class CallSummaryContextImpl implements CallSummaryContext {
protected _version: V1;
protected _solution: CallSummaryContextSolution;
protected _uri: string;
constructor(_version: V1, callSid: string);
fetch(params?: CallSummaryContextFetchOptions | ((error: Error | null, item?: CallSummaryInstance) => any), callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>;
fetchWithHttpInfo(params?: CallSummaryContextFetchOptions | ((error: Error | null, item?: ApiResponse<CallSummaryInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<CallSummaryInstance>) => any): Promise<ApiResponse<CallSummaryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CallSummaryContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CallSummaryResource {
account_sid: string;
call_sid: string;
call_type: CallSummaryCallType;
call_state: CallSummaryCallState;
answered_by: CallSummaryAnsweredBy;
processing_state: CallSummaryProcessingState;
created_time: Date;
start_time: Date;
end_time: Date;
duration: number;
connect_duration: number;
from: any;
to: any;
carrier_edge: any;
client_edge: any;
sdk_edge: any;
sip_edge: any;
tags: Array<string>;
url: string;
attributes: any;
properties: any;
trust: any;
annotation: any;
}
export declare class CallSummaryInstance {
protected _version: V1;
protected _solution: CallSummaryContextSolution;
protected _context?: CallSummaryContext;
constructor(_version: V1, payload: CallSummaryResource, callSid: string);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* The unique SID identifier of the Call.
*/
callSid: string;
callType: CallSummaryCallType;
callState: CallSummaryCallState;
answeredBy: CallSummaryAnsweredBy;
processingState: CallSummaryProcessingState;
/**
* The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS
*/
createdTime: Date;
/**
* The time at which the Call was started, given in ISO 8601 format.
*/
startTime: Date;
/**
* The time at which the Call was ended, given in ISO 8601 format.
*/
endTime: Date;
/**
* Duration between when the call was initiated and the call was ended
*/
duration: number;
/**
* Duration between when the call was answered and when it ended
*/
connectDuration: number;
/**
* The calling party.
*/
from: any;
/**
* The called party.
*/
to: any;
/**
* Contains metrics and properties for the Twilio media gateway of a PSTN call.
*/
carrierEdge: any;
/**
* Contains metrics and properties for the Twilio media gateway of a Client call.
*/
clientEdge: any;
/**
* Contains metrics and properties for the SDK sensor library for Client calls.
*/
sdkEdge: any;
/**
* Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
*/
sipEdge: any;
/**
* Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality.
*/
tags: Array<string>;
/**
* The URL of this resource.
*/
url: string;
/**
* Attributes capturing call-flow-specific details.
*/
attributes: any;
/**
* Contains edge-agnostic call-level details.
*/
properties: any;
/**
* Contains trusted communications details including Branded Call and verified caller ID.
*/
trust: any;
/**
* Programmatically labeled annotations for the Call. Developers can update the Call Summary records with Annotation during or after a Call. Annotations can be updated as long as the Call Summary record is addressable via the API.
*/
annotation: any;
private get _proxy();
/**
* Fetch a CallSummaryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance
*/
fetch(callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>;
/**
* Fetch a CallSummaryInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance
*/
fetch(params: CallSummaryContextFetchOptions, callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>;
/**
* Fetch a CallSummaryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CallSummaryInstance>) => any): Promise<ApiResponse<CallSummaryInstance>>;
/**
* Fetch a CallSummaryInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CallSummaryInstance with HTTP metadata
*/
fetchWithHttpInfo(params: CallSummaryContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<CallSummaryInstance>) => any): Promise<ApiResponse<CallSummaryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
callSid: string;
callType: CallSummaryCallType;
callState: CallSummaryCallState;
answeredBy: CallSummaryAnsweredBy;
processingState: CallSummaryProcessingState;
createdTime: Date;
startTime: Date;
endTime: Date;
duration: number;
connectDuration: number;
from: any;
to: any;
carrierEdge: any;
clientEdge: any;
sdkEdge: any;
sipEdge: any;
tags: string[];
url: string;
attributes: any;
properties: any;
trust: any;
annotation: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CallSummarySolution {
callSid: string;
}
export interface CallSummaryListInstance {
_version: V1;
_solution: CallSummarySolution;
_uri: string;
(): CallSummaryContext;
get(): CallSummaryContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CallSummaryListInstance(version: V1, callSid: string): CallSummaryListInstance;
export {};

View File

@@ -0,0 +1,193 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.CallSummaryInstance = exports.CallSummaryContextImpl = void 0;
exports.CallSummaryListInstance = CallSummaryListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class CallSummaryContextImpl {
constructor(_version, callSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(callSid)) {
throw new Error("Parameter 'callSid' is not valid.");
}
this._solution = { callSid };
this._uri = `/Voice/${callSid}/Summary`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["processingState"] !== undefined)
data["ProcessingState"] = params["processingState"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new CallSummaryInstance(operationVersion, payload, instance._solution.callSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["processingState"] !== undefined)
data["ProcessingState"] = params["processingState"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new CallSummaryInstance(operationVersion, response.body, instance._solution.callSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CallSummaryContextImpl = CallSummaryContextImpl;
class CallSummaryInstance {
constructor(_version, payload, callSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.callSid = payload.call_sid;
this.callType = payload.call_type;
this.callState = payload.call_state;
this.answeredBy = payload.answered_by;
this.processingState = payload.processing_state;
this.createdTime = deserialize.iso8601DateTime(payload.created_time);
this.startTime = deserialize.iso8601DateTime(payload.start_time);
this.endTime = deserialize.iso8601DateTime(payload.end_time);
this.duration = deserialize.integer(payload.duration);
this.connectDuration = deserialize.integer(payload.connect_duration);
this.from = payload.from;
this.to = payload.to;
this.carrierEdge = payload.carrier_edge;
this.clientEdge = payload.client_edge;
this.sdkEdge = payload.sdk_edge;
this.sipEdge = payload.sip_edge;
this.tags = payload.tags;
this.url = payload.url;
this.attributes = payload.attributes;
this.properties = payload.properties;
this.trust = payload.trust;
this.annotation = payload.annotation;
this._solution = { callSid };
}
get _proxy() {
this._context =
this._context ||
new CallSummaryContextImpl(this._version, this._solution.callSid);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
callSid: this.callSid,
callType: this.callType,
callState: this.callState,
answeredBy: this.answeredBy,
processingState: this.processingState,
createdTime: this.createdTime,
startTime: this.startTime,
endTime: this.endTime,
duration: this.duration,
connectDuration: this.connectDuration,
from: this.from,
to: this.to,
carrierEdge: this.carrierEdge,
clientEdge: this.clientEdge,
sdkEdge: this.sdkEdge,
sipEdge: this.sipEdge,
tags: this.tags,
url: this.url,
attributes: this.attributes,
properties: this.properties,
trust: this.trust,
annotation: this.annotation,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CallSummaryInstance = CallSummaryInstance;
function CallSummaryListInstance(version, callSid) {
if (!(0, utility_1.isValidPathParam)(callSid)) {
throw new Error("Parameter 'callSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new CallSummaryContextImpl(version, callSid);
};
instance._version = version;
instance._solution = { callSid };
instance._uri = ``;
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;
}

View File

@@ -0,0 +1,257 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export type EventLevel = "UNKNOWN" | "DEBUG" | "INFO" | "WARNING" | "ERROR";
export type EventTwilioEdge = "unknown_edge" | "carrier_edge" | "sip_edge" | "sdk_edge" | "client_edge";
/**
* Options to pass to each
*/
export interface EventListInstanceEachOptions {
/** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
edge?: EventTwilioEdge;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: EventInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface EventListInstanceOptions {
/** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
edge?: EventTwilioEdge;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface EventListInstancePageOptions {
/** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
edge?: EventTwilioEdge;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface EventSolution {
callSid: string;
}
export interface EventListInstance {
_version: V1;
_solution: EventSolution;
_uri: string;
/**
* Streams EventInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EventListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: EventInstance, done: (err?: Error) => void) => void): void;
each(params: EventListInstanceEachOptions, callback?: (item: EventInstance, done: (err?: Error) => void) => void): void;
/**
* Streams EventInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EventListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: EventInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: EventListInstanceEachOptions, callback?: (item: EventInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of EventInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>;
/**
* Retrieve a single target page of EventInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<EventPage>) => any): Promise<ApiResponse<EventPage>>;
/**
* Lists EventInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EventListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>;
list(params: EventListInstanceOptions, callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>;
/**
* Lists EventInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EventListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EventInstance[]>) => any): Promise<ApiResponse<EventInstance[]>>;
listWithHttpInfo(params: EventListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<EventInstance[]>) => any): Promise<ApiResponse<EventInstance[]>>;
/**
* Retrieve a single page of EventInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EventListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>;
page(params: EventListInstancePageOptions, callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>;
/**
* Retrieve a single page of EventInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EventListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EventPage>) => any): Promise<ApiResponse<EventPage>>;
pageWithHttpInfo(params: EventListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<EventPage>) => any): Promise<ApiResponse<EventPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EventListInstance(version: V1, callSid: string): EventListInstance;
interface EventPayload extends TwilioResponsePayload {
events: EventResource[];
}
interface EventResource {
timestamp: string;
call_sid: string;
account_sid: string;
edge: EventTwilioEdge;
group: string;
level: EventLevel;
name: string;
carrier_edge: any;
sip_edge: any;
sdk_edge: any;
client_edge: any;
}
export declare class EventInstance {
protected _version: V1;
constructor(_version: V1, payload: EventResource, callSid: string);
/**
* Event time.
*/
timestamp: string;
/**
* The unique SID identifier of the Call.
*/
callSid: string;
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
edge: EventTwilioEdge;
/**
* Event group.
*/
group: string;
level: EventLevel;
/**
* Event name.
*/
name: string;
/**
* Represents the connection between Twilio and our immediate carrier partners. The events here describe the call lifecycle as reported by Twilio\'s carrier media gateways.
*/
carrierEdge: any;
/**
* Represents the Twilio media gateway for SIP interface and SIP trunking calls. The events here describe the call lifecycle as reported by Twilio\'s public media gateways.
*/
sipEdge: any;
/**
* Represents the Voice SDK running locally in the browser or in the Android/iOS application. The events here are emitted by the Voice SDK in response to certain call progress events, network changes, or call quality conditions.
*/
sdkEdge: any;
/**
* Represents the Twilio media gateway for Client calls. The events here describe the call lifecycle as reported by Twilio\'s Voice SDK media gateways.
*/
clientEdge: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
timestamp: string;
callSid: string;
accountSid: string;
edge: EventTwilioEdge;
group: string;
level: EventLevel;
name: string;
carrierEdge: any;
sipEdge: any;
sdkEdge: any;
clientEdge: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class EventPage extends Page<V1, EventPayload, EventResource, EventInstance> {
/**
* Initialize the EventPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: EventSolution);
/**
* Build an instance of EventInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: EventResource): EventInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

195
node_modules/twilio/lib/rest/insights/v1/call/event.js generated vendored Normal file
View File

@@ -0,0 +1,195 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventPage = exports.EventInstance = void 0;
exports.EventListInstance = EventListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
function EventListInstance(version, callSid) {
if (!(0, utility_1.isValidPathParam)(callSid)) {
throw new Error("Parameter 'callSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { callSid };
instance._uri = `/Voice/${callSid}/Events`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["edge"] !== undefined)
data["Edge"] = params["edge"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new EventPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new EventPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["edge"] !== undefined)
data["Edge"] = params["edge"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new EventPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new EventPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 EventInstance {
constructor(_version, payload, callSid) {
this._version = _version;
this.timestamp = payload.timestamp;
this.callSid = payload.call_sid;
this.accountSid = payload.account_sid;
this.edge = payload.edge;
this.group = payload.group;
this.level = payload.level;
this.name = payload.name;
this.carrierEdge = payload.carrier_edge;
this.sipEdge = payload.sip_edge;
this.sdkEdge = payload.sdk_edge;
this.clientEdge = payload.client_edge;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
timestamp: this.timestamp,
callSid: this.callSid,
accountSid: this.accountSid,
edge: this.edge,
group: this.group,
level: this.level,
name: this.name,
carrierEdge: this.carrierEdge,
sipEdge: this.sipEdge,
sdkEdge: this.sdkEdge,
clientEdge: this.clientEdge,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EventInstance = EventInstance;
class EventPage extends Page_1.default {
/**
* Initialize the EventPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of EventInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new EventInstance(this._version, payload, this._solution.callSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EventPage = EventPage;

View File

@@ -0,0 +1,251 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export type MetricStreamDirection = "unknown" | "inbound" | "outbound" | "both";
export type MetricTwilioEdge = "unknown_edge" | "carrier_edge" | "sip_edge" | "sdk_edge" | "client_edge";
/**
* Options to pass to each
*/
export interface MetricListInstanceEachOptions {
/** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
edge?: MetricTwilioEdge;
/** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */
direction?: MetricStreamDirection;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: MetricInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface MetricListInstanceOptions {
/** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
edge?: MetricTwilioEdge;
/** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */
direction?: MetricStreamDirection;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface MetricListInstancePageOptions {
/** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
edge?: MetricTwilioEdge;
/** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */
direction?: MetricStreamDirection;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface MetricSolution {
callSid: string;
}
export interface MetricListInstance {
_version: V1;
_solution: MetricSolution;
_uri: string;
/**
* Streams MetricInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { MetricListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: MetricInstance, done: (err?: Error) => void) => void): void;
each(params: MetricListInstanceEachOptions, callback?: (item: MetricInstance, done: (err?: Error) => void) => void): void;
/**
* Streams MetricInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { MetricListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: MetricInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: MetricListInstanceEachOptions, callback?: (item: MetricInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of MetricInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: MetricPage) => any): Promise<MetricPage>;
/**
* Retrieve a single target page of MetricInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<MetricPage>) => any): Promise<ApiResponse<MetricPage>>;
/**
* Lists MetricInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { MetricListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: MetricInstance[]) => any): Promise<MetricInstance[]>;
list(params: MetricListInstanceOptions, callback?: (error: Error | null, items: MetricInstance[]) => any): Promise<MetricInstance[]>;
/**
* Lists MetricInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { MetricListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<MetricInstance[]>) => any): Promise<ApiResponse<MetricInstance[]>>;
listWithHttpInfo(params: MetricListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<MetricInstance[]>) => any): Promise<ApiResponse<MetricInstance[]>>;
/**
* Retrieve a single page of MetricInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { MetricListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: MetricPage) => any): Promise<MetricPage>;
page(params: MetricListInstancePageOptions, callback?: (error: Error | null, items: MetricPage) => any): Promise<MetricPage>;
/**
* Retrieve a single page of MetricInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { MetricListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<MetricPage>) => any): Promise<ApiResponse<MetricPage>>;
pageWithHttpInfo(params: MetricListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<MetricPage>) => any): Promise<ApiResponse<MetricPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function MetricListInstance(version: V1, callSid: string): MetricListInstance;
interface MetricPayload extends TwilioResponsePayload {
metrics: MetricResource[];
}
interface MetricResource {
timestamp: string;
call_sid: string;
account_sid: string;
edge: MetricTwilioEdge;
direction: MetricStreamDirection;
carrier_edge: any;
sip_edge: any;
sdk_edge: any;
client_edge: any;
}
export declare class MetricInstance {
protected _version: V1;
constructor(_version: V1, payload: MetricResource, callSid: string);
/**
* Timestamp of metric sample. Samples are taken every 10 seconds and contain the metrics for the previous 10 seconds.
*/
timestamp: string;
/**
* The unique SID identifier of the Call.
*/
callSid: string;
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
edge: MetricTwilioEdge;
direction: MetricStreamDirection;
/**
* Contains metrics and properties for the Twilio media gateway of a PSTN call.
*/
carrierEdge: any;
/**
* Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
*/
sipEdge: any;
/**
* Contains metrics and properties for the SDK sensor library for Client calls.
*/
sdkEdge: any;
/**
* Contains metrics and properties for the Twilio media gateway of a Client call.
*/
clientEdge: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
timestamp: string;
callSid: string;
accountSid: string;
edge: MetricTwilioEdge;
direction: MetricStreamDirection;
carrierEdge: any;
sipEdge: any;
sdkEdge: any;
clientEdge: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class MetricPage extends Page<V1, MetricPayload, MetricResource, MetricInstance> {
/**
* Initialize the MetricPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: MetricSolution);
/**
* Build an instance of MetricInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: MetricResource): MetricInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

195
node_modules/twilio/lib/rest/insights/v1/call/metric.js generated vendored Normal file
View File

@@ -0,0 +1,195 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MetricPage = exports.MetricInstance = void 0;
exports.MetricListInstance = MetricListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
function MetricListInstance(version, callSid) {
if (!(0, utility_1.isValidPathParam)(callSid)) {
throw new Error("Parameter 'callSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { callSid };
instance._uri = `/Voice/${callSid}/Metrics`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["edge"] !== undefined)
data["Edge"] = params["edge"];
if (params["direction"] !== undefined)
data["Direction"] = params["direction"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new MetricPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new MetricPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["edge"] !== undefined)
data["Edge"] = params["edge"];
if (params["direction"] !== undefined)
data["Direction"] = params["direction"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new MetricPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new MetricPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 MetricInstance {
constructor(_version, payload, callSid) {
this._version = _version;
this.timestamp = payload.timestamp;
this.callSid = payload.call_sid;
this.accountSid = payload.account_sid;
this.edge = payload.edge;
this.direction = payload.direction;
this.carrierEdge = payload.carrier_edge;
this.sipEdge = payload.sip_edge;
this.sdkEdge = payload.sdk_edge;
this.clientEdge = payload.client_edge;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
timestamp: this.timestamp,
callSid: this.callSid,
accountSid: this.accountSid,
edge: this.edge,
direction: this.direction,
carrierEdge: this.carrierEdge,
sipEdge: this.sipEdge,
sdkEdge: this.sdkEdge,
clientEdge: this.clientEdge,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.MetricInstance = MetricInstance;
class MetricPage extends Page_1.default {
/**
* Initialize the MetricPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of MetricInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new MetricInstance(this._version, payload, this._solution.callSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.MetricPage = MetricPage;

View File

@@ -0,0 +1,533 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export type CallSummariesAnsweredBy = "unknown" | "machine_start" | "machine_end_beep" | "machine_end_silence" | "machine_end_other" | "human" | "fax";
export type CallSummariesCallState = "ringing" | "completed" | "busy" | "fail" | "noanswer" | "canceled" | "answered" | "undialed";
export type CallSummariesCallType = "carrier" | "sip" | "trunking" | "client" | "whatsapp";
export type CallSummariesProcessingState = "complete" | "partial";
export type CallSummariesProcessingStateRequest = "completed" | "started" | "partial" | "all";
export type CallSummariesSortBy = "start_time" | "end_time";
/**
* Options to pass to each
*/
export interface CallSummariesListInstanceEachOptions {
/** A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */
from?: string;
/** A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */
to?: string;
/** An origination carrier. */
fromCarrier?: string;
/** A destination carrier. */
toCarrier?: string;
/** A source country code based on phone number in From. */
fromCountryCode?: string;
/** A destination country code. Based on phone number in To. */
toCountryCode?: string;
/** A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of \'true\' or \'false\'. */
verifiedCaller?: boolean;
/** A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). */
hasTag?: boolean;
/** A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. */
startTime?: string;
/** An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. */
endTime?: string;
/** A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. */
callType?: string;
/** A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. */
callState?: string;
/** A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. */
direction?: string;
/** A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. */
processingState?: CallSummariesProcessingStateRequest;
/** A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. */
sortBy?: CallSummariesSortBy;
/** A unique SID identifier of a Subaccount. */
subaccount?: string;
/** A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. */
abnormalSession?: boolean;
/** An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. */
answeredBy?: CallSummariesAnsweredBy;
/** Either machine or human. */
answeredByAnnotation?: string;
/** A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. */
connectivityIssueAnnotation?: string;
/** A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. */
qualityIssueAnnotation?: string;
/** A boolean flag indicating spam calls. */
spamAnnotation?: boolean;
/** A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */
callScoreAnnotation?: string;
/** A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of \'true\' or \'false\' */
brandedEnabled?: boolean;
/** A boolean flag indicating whether or not the phone number had voice integrity enabled.One of \'true\' or \'false\' */
voiceIntegrityEnabled?: boolean;
/** A unique SID identifier of the Branded Call. */
brandedBundleSid?: string;
/** Indicates whether the branded logo was displayed during the in_brand branded call. Possible values are true (logo was present) or false (logo was not present). */
brandedLogo?: boolean;
/** Indicates whether the Branded Call is in_band vs out_of_band. */
brandedType?: string;
/** Specifies the user-defined purpose for the call, as provided during the setup of in_band branded calling. */
brandedUseCase?: string;
/** Specifies the user-defined reason for the call, which will be displayed to the end user on their mobile device during an in_band branded call. */
brandedCallReason?: string;
/** A unique SID identifier of the Voice Integrity Profile. */
voiceIntegrityBundleSid?: string;
/** A Voice Integrity Use Case . Is of type enum. One of \'abandoned_cart\', \'appointment_reminders\', \'appointment_scheduling\', \'asset_management\', \'automated_support\', \'call_tracking\', \'click_to_call\', \'contact_tracing\', \'contactless_delivery\', \'customer_support\', \'dating/social\', \'delivery_notifications\', \'distance_learning\', \'emergency_notifications\', \'employee_notifications\', \'exam_proctoring\', \'field_notifications\', \'first_responder\', \'fraud_alerts\', \'group_messaging\', \'identify_&_verification\', \'intelligent_routing\', \'lead_alerts\', \'lead_distribution\', \'lead_generation\', \'lead_management\', \'lead_nurturing\', \'marketing_events\', \'mass_alerts\', \'meetings/collaboration\', \'order_notifications\', \'outbound_dialer\', \'pharmacy\', \'phone_system\', \'purchase_confirmation\', \'remote_appointments\', \'rewards_program\', \'self-service\', \'service_alerts\', \'shift_management\', \'survey/research\', \'telehealth\', \'telemarketing\', \'therapy_(individual+group)\'. */
voiceIntegrityUseCase?: string;
/** A Business Identity of the calls. Is of type enum. One of \'direct_customer\', \'isv_reseller_or_partner\'. */
businessProfileIdentity?: string;
/** A Business Industry of the calls. Is of type enum. One of \'automotive\', \'agriculture\', \'banking\', \'consumer\', \'construction\', \'education\', \'engineering\', \'energy\', \'oil_and_gas\', \'fast_moving_consumer_goods\', \'financial\', \'fintech\', \'food_and_beverage\', \'government\', \'healthcare\', \'hospitality\', \'insurance\', \'legal\', \'manufacturing\', \'media\', \'online\', \'professional_services\', \'raw_materials\', \'real_estate\', \'religion\', \'retail\', \'jewelry\', \'technology\', \'telecommunications\', \'transportation\', \'travel\', \'electronics\', \'not_for_profit\' */
businessProfileIndustry?: string;
/** A unique SID identifier of the Business Profile. */
businessProfileBundleSid?: string;
/** A Business Profile Type of the calls. Is of type enum. One of \'primary\', \'secondary\'. */
businessProfileType?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: CallSummariesInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface CallSummariesListInstanceOptions {
/** A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */
from?: string;
/** A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */
to?: string;
/** An origination carrier. */
fromCarrier?: string;
/** A destination carrier. */
toCarrier?: string;
/** A source country code based on phone number in From. */
fromCountryCode?: string;
/** A destination country code. Based on phone number in To. */
toCountryCode?: string;
/** A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of \'true\' or \'false\'. */
verifiedCaller?: boolean;
/** A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). */
hasTag?: boolean;
/** A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. */
startTime?: string;
/** An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. */
endTime?: string;
/** A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. */
callType?: string;
/** A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. */
callState?: string;
/** A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. */
direction?: string;
/** A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. */
processingState?: CallSummariesProcessingStateRequest;
/** A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. */
sortBy?: CallSummariesSortBy;
/** A unique SID identifier of a Subaccount. */
subaccount?: string;
/** A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. */
abnormalSession?: boolean;
/** An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. */
answeredBy?: CallSummariesAnsweredBy;
/** Either machine or human. */
answeredByAnnotation?: string;
/** A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. */
connectivityIssueAnnotation?: string;
/** A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. */
qualityIssueAnnotation?: string;
/** A boolean flag indicating spam calls. */
spamAnnotation?: boolean;
/** A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */
callScoreAnnotation?: string;
/** A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of \'true\' or \'false\' */
brandedEnabled?: boolean;
/** A boolean flag indicating whether or not the phone number had voice integrity enabled.One of \'true\' or \'false\' */
voiceIntegrityEnabled?: boolean;
/** A unique SID identifier of the Branded Call. */
brandedBundleSid?: string;
/** Indicates whether the branded logo was displayed during the in_brand branded call. Possible values are true (logo was present) or false (logo was not present). */
brandedLogo?: boolean;
/** Indicates whether the Branded Call is in_band vs out_of_band. */
brandedType?: string;
/** Specifies the user-defined purpose for the call, as provided during the setup of in_band branded calling. */
brandedUseCase?: string;
/** Specifies the user-defined reason for the call, which will be displayed to the end user on their mobile device during an in_band branded call. */
brandedCallReason?: string;
/** A unique SID identifier of the Voice Integrity Profile. */
voiceIntegrityBundleSid?: string;
/** A Voice Integrity Use Case . Is of type enum. One of \'abandoned_cart\', \'appointment_reminders\', \'appointment_scheduling\', \'asset_management\', \'automated_support\', \'call_tracking\', \'click_to_call\', \'contact_tracing\', \'contactless_delivery\', \'customer_support\', \'dating/social\', \'delivery_notifications\', \'distance_learning\', \'emergency_notifications\', \'employee_notifications\', \'exam_proctoring\', \'field_notifications\', \'first_responder\', \'fraud_alerts\', \'group_messaging\', \'identify_&_verification\', \'intelligent_routing\', \'lead_alerts\', \'lead_distribution\', \'lead_generation\', \'lead_management\', \'lead_nurturing\', \'marketing_events\', \'mass_alerts\', \'meetings/collaboration\', \'order_notifications\', \'outbound_dialer\', \'pharmacy\', \'phone_system\', \'purchase_confirmation\', \'remote_appointments\', \'rewards_program\', \'self-service\', \'service_alerts\', \'shift_management\', \'survey/research\', \'telehealth\', \'telemarketing\', \'therapy_(individual+group)\'. */
voiceIntegrityUseCase?: string;
/** A Business Identity of the calls. Is of type enum. One of \'direct_customer\', \'isv_reseller_or_partner\'. */
businessProfileIdentity?: string;
/** A Business Industry of the calls. Is of type enum. One of \'automotive\', \'agriculture\', \'banking\', \'consumer\', \'construction\', \'education\', \'engineering\', \'energy\', \'oil_and_gas\', \'fast_moving_consumer_goods\', \'financial\', \'fintech\', \'food_and_beverage\', \'government\', \'healthcare\', \'hospitality\', \'insurance\', \'legal\', \'manufacturing\', \'media\', \'online\', \'professional_services\', \'raw_materials\', \'real_estate\', \'religion\', \'retail\', \'jewelry\', \'technology\', \'telecommunications\', \'transportation\', \'travel\', \'electronics\', \'not_for_profit\' */
businessProfileIndustry?: string;
/** A unique SID identifier of the Business Profile. */
businessProfileBundleSid?: string;
/** A Business Profile Type of the calls. Is of type enum. One of \'primary\', \'secondary\'. */
businessProfileType?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface CallSummariesListInstancePageOptions {
/** A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */
from?: string;
/** A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */
to?: string;
/** An origination carrier. */
fromCarrier?: string;
/** A destination carrier. */
toCarrier?: string;
/** A source country code based on phone number in From. */
fromCountryCode?: string;
/** A destination country code. Based on phone number in To. */
toCountryCode?: string;
/** A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of \'true\' or \'false\'. */
verifiedCaller?: boolean;
/** A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). */
hasTag?: boolean;
/** A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. */
startTime?: string;
/** An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. */
endTime?: string;
/** A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. */
callType?: string;
/** A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. */
callState?: string;
/** A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. */
direction?: string;
/** A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. */
processingState?: CallSummariesProcessingStateRequest;
/** A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. */
sortBy?: CallSummariesSortBy;
/** A unique SID identifier of a Subaccount. */
subaccount?: string;
/** A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. */
abnormalSession?: boolean;
/** An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. */
answeredBy?: CallSummariesAnsweredBy;
/** Either machine or human. */
answeredByAnnotation?: string;
/** A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. */
connectivityIssueAnnotation?: string;
/** A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. */
qualityIssueAnnotation?: string;
/** A boolean flag indicating spam calls. */
spamAnnotation?: boolean;
/** A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */
callScoreAnnotation?: string;
/** A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of \'true\' or \'false\' */
brandedEnabled?: boolean;
/** A boolean flag indicating whether or not the phone number had voice integrity enabled.One of \'true\' or \'false\' */
voiceIntegrityEnabled?: boolean;
/** A unique SID identifier of the Branded Call. */
brandedBundleSid?: string;
/** Indicates whether the branded logo was displayed during the in_brand branded call. Possible values are true (logo was present) or false (logo was not present). */
brandedLogo?: boolean;
/** Indicates whether the Branded Call is in_band vs out_of_band. */
brandedType?: string;
/** Specifies the user-defined purpose for the call, as provided during the setup of in_band branded calling. */
brandedUseCase?: string;
/** Specifies the user-defined reason for the call, which will be displayed to the end user on their mobile device during an in_band branded call. */
brandedCallReason?: string;
/** A unique SID identifier of the Voice Integrity Profile. */
voiceIntegrityBundleSid?: string;
/** A Voice Integrity Use Case . Is of type enum. One of \'abandoned_cart\', \'appointment_reminders\', \'appointment_scheduling\', \'asset_management\', \'automated_support\', \'call_tracking\', \'click_to_call\', \'contact_tracing\', \'contactless_delivery\', \'customer_support\', \'dating/social\', \'delivery_notifications\', \'distance_learning\', \'emergency_notifications\', \'employee_notifications\', \'exam_proctoring\', \'field_notifications\', \'first_responder\', \'fraud_alerts\', \'group_messaging\', \'identify_&_verification\', \'intelligent_routing\', \'lead_alerts\', \'lead_distribution\', \'lead_generation\', \'lead_management\', \'lead_nurturing\', \'marketing_events\', \'mass_alerts\', \'meetings/collaboration\', \'order_notifications\', \'outbound_dialer\', \'pharmacy\', \'phone_system\', \'purchase_confirmation\', \'remote_appointments\', \'rewards_program\', \'self-service\', \'service_alerts\', \'shift_management\', \'survey/research\', \'telehealth\', \'telemarketing\', \'therapy_(individual+group)\'. */
voiceIntegrityUseCase?: string;
/** A Business Identity of the calls. Is of type enum. One of \'direct_customer\', \'isv_reseller_or_partner\'. */
businessProfileIdentity?: string;
/** A Business Industry of the calls. Is of type enum. One of \'automotive\', \'agriculture\', \'banking\', \'consumer\', \'construction\', \'education\', \'engineering\', \'energy\', \'oil_and_gas\', \'fast_moving_consumer_goods\', \'financial\', \'fintech\', \'food_and_beverage\', \'government\', \'healthcare\', \'hospitality\', \'insurance\', \'legal\', \'manufacturing\', \'media\', \'online\', \'professional_services\', \'raw_materials\', \'real_estate\', \'religion\', \'retail\', \'jewelry\', \'technology\', \'telecommunications\', \'transportation\', \'travel\', \'electronics\', \'not_for_profit\' */
businessProfileIndustry?: string;
/** A unique SID identifier of the Business Profile. */
businessProfileBundleSid?: string;
/** A Business Profile Type of the calls. Is of type enum. One of \'primary\', \'secondary\'. */
businessProfileType?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface CallSummariesSolution {
}
export interface CallSummariesListInstance {
_version: V1;
_solution: CallSummariesSolution;
_uri: string;
/**
* Streams CallSummariesInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CallSummariesListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CallSummariesInstance, done: (err?: Error) => void) => void): void;
each(params: CallSummariesListInstanceEachOptions, callback?: (item: CallSummariesInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CallSummariesInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CallSummariesListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CallSummariesInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CallSummariesListInstanceEachOptions, callback?: (item: CallSummariesInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CallSummariesInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: CallSummariesPage) => any): Promise<CallSummariesPage>;
/**
* Retrieve a single target page of CallSummariesInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<CallSummariesPage>) => any): Promise<ApiResponse<CallSummariesPage>>;
/**
* Lists CallSummariesInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CallSummariesListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CallSummariesInstance[]) => any): Promise<CallSummariesInstance[]>;
list(params: CallSummariesListInstanceOptions, callback?: (error: Error | null, items: CallSummariesInstance[]) => any): Promise<CallSummariesInstance[]>;
/**
* Lists CallSummariesInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CallSummariesListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CallSummariesInstance[]>) => any): Promise<ApiResponse<CallSummariesInstance[]>>;
listWithHttpInfo(params: CallSummariesListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CallSummariesInstance[]>) => any): Promise<ApiResponse<CallSummariesInstance[]>>;
/**
* Retrieve a single page of CallSummariesInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CallSummariesListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CallSummariesPage) => any): Promise<CallSummariesPage>;
page(params: CallSummariesListInstancePageOptions, callback?: (error: Error | null, items: CallSummariesPage) => any): Promise<CallSummariesPage>;
/**
* Retrieve a single page of CallSummariesInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CallSummariesListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CallSummariesPage>) => any): Promise<ApiResponse<CallSummariesPage>>;
pageWithHttpInfo(params: CallSummariesListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CallSummariesPage>) => any): Promise<ApiResponse<CallSummariesPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CallSummariesListInstance(version: V1): CallSummariesListInstance;
interface CallSummariesPayload extends TwilioResponsePayload {
call_summaries: CallSummariesResource[];
}
interface CallSummariesResource {
account_sid: string;
call_sid: string;
answered_by: CallSummariesAnsweredBy;
call_type: CallSummariesCallType;
call_state: CallSummariesCallState;
processing_state: CallSummariesProcessingState;
created_time: Date;
start_time: Date;
end_time: Date;
duration: number;
connect_duration: number;
from: any;
to: any;
carrier_edge: any;
client_edge: any;
sdk_edge: any;
sip_edge: any;
tags: Array<string>;
url: string;
attributes: any;
properties: any;
trust: any;
annotation: any;
}
export declare class CallSummariesInstance {
protected _version: V1;
constructor(_version: V1, payload: CallSummariesResource);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* The unique SID identifier of the Call.
*/
callSid: string;
answeredBy: CallSummariesAnsweredBy;
callType: CallSummariesCallType;
callState: CallSummariesCallState;
processingState: CallSummariesProcessingState;
/**
* The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS
*/
createdTime: Date;
/**
* The time at which the Call was started, given in ISO 8601 format.
*/
startTime: Date;
/**
* The time at which the Call was ended, given in ISO 8601 format.
*/
endTime: Date;
/**
* Duration between when the call was initiated and the call was ended
*/
duration: number;
/**
* Duration between when the call was answered and when it ended
*/
connectDuration: number;
/**
* The calling party.
*/
from: any;
/**
* The called party.
*/
to: any;
/**
* Contains metrics and properties for the Twilio media gateway of a PSTN call.
*/
carrierEdge: any;
/**
* Contains metrics and properties for the Twilio media gateway of a Client call.
*/
clientEdge: any;
/**
* Contains metrics and properties for the SDK sensor library for Client calls.
*/
sdkEdge: any;
/**
* Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
*/
sipEdge: any;
/**
* Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality.
*/
tags: Array<string>;
/**
* The URL of this resource.
*/
url: string;
/**
* Attributes capturing call-flow-specific details.
*/
attributes: any;
/**
* Contains edge-agnostic call-level details.
*/
properties: any;
/**
* Contains trusted communications details including Branded Call and verified caller ID.
*/
trust: any;
annotation: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
callSid: string;
answeredBy: CallSummariesAnsweredBy;
callType: CallSummariesCallType;
callState: CallSummariesCallState;
processingState: CallSummariesProcessingState;
createdTime: Date;
startTime: Date;
endTime: Date;
duration: number;
connectDuration: number;
from: any;
to: any;
carrierEdge: any;
clientEdge: any;
sdkEdge: any;
sipEdge: any;
tags: string[];
url: string;
attributes: any;
properties: any;
trust: any;
annotation: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class CallSummariesPage extends Page<V1, CallSummariesPayload, CallSummariesResource, CallSummariesInstance> {
/**
* Initialize the CallSummariesPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CallSummariesSolution);
/**
* Build an instance of CallSummariesInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CallSummariesResource): CallSummariesInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,357 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CallSummariesPage = exports.CallSummariesInstance = void 0;
exports.CallSummariesListInstance = CallSummariesListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function CallSummariesListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Voice/Summaries`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["from"] !== undefined)
data["From"] = params["from"];
if (params["to"] !== undefined)
data["To"] = params["to"];
if (params["fromCarrier"] !== undefined)
data["FromCarrier"] = params["fromCarrier"];
if (params["toCarrier"] !== undefined)
data["ToCarrier"] = params["toCarrier"];
if (params["fromCountryCode"] !== undefined)
data["FromCountryCode"] = params["fromCountryCode"];
if (params["toCountryCode"] !== undefined)
data["ToCountryCode"] = params["toCountryCode"];
if (params["verifiedCaller"] !== undefined)
data["VerifiedCaller"] = serialize.bool(params["verifiedCaller"]);
if (params["hasTag"] !== undefined)
data["HasTag"] = serialize.bool(params["hasTag"]);
if (params["startTime"] !== undefined)
data["StartTime"] = params["startTime"];
if (params["endTime"] !== undefined)
data["EndTime"] = params["endTime"];
if (params["callType"] !== undefined)
data["CallType"] = params["callType"];
if (params["callState"] !== undefined)
data["CallState"] = params["callState"];
if (params["direction"] !== undefined)
data["Direction"] = params["direction"];
if (params["processingState"] !== undefined)
data["ProcessingState"] = params["processingState"];
if (params["sortBy"] !== undefined)
data["SortBy"] = params["sortBy"];
if (params["subaccount"] !== undefined)
data["Subaccount"] = params["subaccount"];
if (params["abnormalSession"] !== undefined)
data["AbnormalSession"] = serialize.bool(params["abnormalSession"]);
if (params["answeredBy"] !== undefined)
data["AnsweredBy"] = params["answeredBy"];
if (params["answeredByAnnotation"] !== undefined)
data["AnsweredByAnnotation"] = params["answeredByAnnotation"];
if (params["connectivityIssueAnnotation"] !== undefined)
data["ConnectivityIssueAnnotation"] =
params["connectivityIssueAnnotation"];
if (params["qualityIssueAnnotation"] !== undefined)
data["QualityIssueAnnotation"] = params["qualityIssueAnnotation"];
if (params["spamAnnotation"] !== undefined)
data["SpamAnnotation"] = serialize.bool(params["spamAnnotation"]);
if (params["callScoreAnnotation"] !== undefined)
data["CallScoreAnnotation"] = params["callScoreAnnotation"];
if (params["brandedEnabled"] !== undefined)
data["BrandedEnabled"] = serialize.bool(params["brandedEnabled"]);
if (params["voiceIntegrityEnabled"] !== undefined)
data["VoiceIntegrityEnabled"] = serialize.bool(params["voiceIntegrityEnabled"]);
if (params["brandedBundleSid"] !== undefined)
data["BrandedBundleSid"] = params["brandedBundleSid"];
if (params["brandedLogo"] !== undefined)
data["BrandedLogo"] = serialize.bool(params["brandedLogo"]);
if (params["brandedType"] !== undefined)
data["BrandedType"] = params["brandedType"];
if (params["brandedUseCase"] !== undefined)
data["BrandedUseCase"] = params["brandedUseCase"];
if (params["brandedCallReason"] !== undefined)
data["BrandedCallReason"] = params["brandedCallReason"];
if (params["voiceIntegrityBundleSid"] !== undefined)
data["VoiceIntegrityBundleSid"] = params["voiceIntegrityBundleSid"];
if (params["voiceIntegrityUseCase"] !== undefined)
data["VoiceIntegrityUseCase"] = params["voiceIntegrityUseCase"];
if (params["businessProfileIdentity"] !== undefined)
data["BusinessProfileIdentity"] = params["businessProfileIdentity"];
if (params["businessProfileIndustry"] !== undefined)
data["BusinessProfileIndustry"] = params["businessProfileIndustry"];
if (params["businessProfileBundleSid"] !== undefined)
data["BusinessProfileBundleSid"] = params["businessProfileBundleSid"];
if (params["businessProfileType"] !== undefined)
data["BusinessProfileType"] = params["businessProfileType"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new CallSummariesPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new CallSummariesPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["from"] !== undefined)
data["From"] = params["from"];
if (params["to"] !== undefined)
data["To"] = params["to"];
if (params["fromCarrier"] !== undefined)
data["FromCarrier"] = params["fromCarrier"];
if (params["toCarrier"] !== undefined)
data["ToCarrier"] = params["toCarrier"];
if (params["fromCountryCode"] !== undefined)
data["FromCountryCode"] = params["fromCountryCode"];
if (params["toCountryCode"] !== undefined)
data["ToCountryCode"] = params["toCountryCode"];
if (params["verifiedCaller"] !== undefined)
data["VerifiedCaller"] = serialize.bool(params["verifiedCaller"]);
if (params["hasTag"] !== undefined)
data["HasTag"] = serialize.bool(params["hasTag"]);
if (params["startTime"] !== undefined)
data["StartTime"] = params["startTime"];
if (params["endTime"] !== undefined)
data["EndTime"] = params["endTime"];
if (params["callType"] !== undefined)
data["CallType"] = params["callType"];
if (params["callState"] !== undefined)
data["CallState"] = params["callState"];
if (params["direction"] !== undefined)
data["Direction"] = params["direction"];
if (params["processingState"] !== undefined)
data["ProcessingState"] = params["processingState"];
if (params["sortBy"] !== undefined)
data["SortBy"] = params["sortBy"];
if (params["subaccount"] !== undefined)
data["Subaccount"] = params["subaccount"];
if (params["abnormalSession"] !== undefined)
data["AbnormalSession"] = serialize.bool(params["abnormalSession"]);
if (params["answeredBy"] !== undefined)
data["AnsweredBy"] = params["answeredBy"];
if (params["answeredByAnnotation"] !== undefined)
data["AnsweredByAnnotation"] = params["answeredByAnnotation"];
if (params["connectivityIssueAnnotation"] !== undefined)
data["ConnectivityIssueAnnotation"] =
params["connectivityIssueAnnotation"];
if (params["qualityIssueAnnotation"] !== undefined)
data["QualityIssueAnnotation"] = params["qualityIssueAnnotation"];
if (params["spamAnnotation"] !== undefined)
data["SpamAnnotation"] = serialize.bool(params["spamAnnotation"]);
if (params["callScoreAnnotation"] !== undefined)
data["CallScoreAnnotation"] = params["callScoreAnnotation"];
if (params["brandedEnabled"] !== undefined)
data["BrandedEnabled"] = serialize.bool(params["brandedEnabled"]);
if (params["voiceIntegrityEnabled"] !== undefined)
data["VoiceIntegrityEnabled"] = serialize.bool(params["voiceIntegrityEnabled"]);
if (params["brandedBundleSid"] !== undefined)
data["BrandedBundleSid"] = params["brandedBundleSid"];
if (params["brandedLogo"] !== undefined)
data["BrandedLogo"] = serialize.bool(params["brandedLogo"]);
if (params["brandedType"] !== undefined)
data["BrandedType"] = params["brandedType"];
if (params["brandedUseCase"] !== undefined)
data["BrandedUseCase"] = params["brandedUseCase"];
if (params["brandedCallReason"] !== undefined)
data["BrandedCallReason"] = params["brandedCallReason"];
if (params["voiceIntegrityBundleSid"] !== undefined)
data["VoiceIntegrityBundleSid"] = params["voiceIntegrityBundleSid"];
if (params["voiceIntegrityUseCase"] !== undefined)
data["VoiceIntegrityUseCase"] = params["voiceIntegrityUseCase"];
if (params["businessProfileIdentity"] !== undefined)
data["BusinessProfileIdentity"] = params["businessProfileIdentity"];
if (params["businessProfileIndustry"] !== undefined)
data["BusinessProfileIndustry"] = params["businessProfileIndustry"];
if (params["businessProfileBundleSid"] !== undefined)
data["BusinessProfileBundleSid"] = params["businessProfileBundleSid"];
if (params["businessProfileType"] !== undefined)
data["BusinessProfileType"] = params["businessProfileType"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new CallSummariesPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new CallSummariesPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 CallSummariesInstance {
constructor(_version, payload) {
this._version = _version;
this.accountSid = payload.account_sid;
this.callSid = payload.call_sid;
this.answeredBy = payload.answered_by;
this.callType = payload.call_type;
this.callState = payload.call_state;
this.processingState = payload.processing_state;
this.createdTime = deserialize.iso8601DateTime(payload.created_time);
this.startTime = deserialize.iso8601DateTime(payload.start_time);
this.endTime = deserialize.iso8601DateTime(payload.end_time);
this.duration = deserialize.integer(payload.duration);
this.connectDuration = deserialize.integer(payload.connect_duration);
this.from = payload.from;
this.to = payload.to;
this.carrierEdge = payload.carrier_edge;
this.clientEdge = payload.client_edge;
this.sdkEdge = payload.sdk_edge;
this.sipEdge = payload.sip_edge;
this.tags = payload.tags;
this.url = payload.url;
this.attributes = payload.attributes;
this.properties = payload.properties;
this.trust = payload.trust;
this.annotation = payload.annotation;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
callSid: this.callSid,
answeredBy: this.answeredBy,
callType: this.callType,
callState: this.callState,
processingState: this.processingState,
createdTime: this.createdTime,
startTime: this.startTime,
endTime: this.endTime,
duration: this.duration,
connectDuration: this.connectDuration,
from: this.from,
to: this.to,
carrierEdge: this.carrierEdge,
clientEdge: this.clientEdge,
sdkEdge: this.sdkEdge,
sipEdge: this.sipEdge,
tags: this.tags,
url: this.url,
attributes: this.attributes,
properties: this.properties,
trust: this.trust,
annotation: this.annotation,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CallSummariesInstance = CallSummariesInstance;
class CallSummariesPage extends Page_1.default {
/**
* Initialize the CallSummariesPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of CallSummariesInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CallSummariesInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CallSummariesPage = CallSummariesPage;

View File

@@ -0,0 +1,446 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { ConferenceParticipantListInstance } from "./conference/conferenceParticipant";
export type ConferenceConferenceEndReason = "last_participant_left" | "conference_ended_via_api" | "participant_with_end_conference_on_exit_left" | "last_participant_kicked" | "participant_with_end_conference_on_exit_kicked";
export type ConferenceConferenceStatus = "in_progress" | "not_started" | "completed" | "summary_timeout";
export type ConferenceProcessingState = "complete" | "in_progress" | "timeout";
export type ConferenceRegion = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1" | "in1";
export type ConferenceTag = "invalid_requested_region" | "duplicate_identity" | "start_failure" | "region_configuration_issues" | "quality_warnings" | "participant_behavior_issues" | "high_packet_loss" | "high_jitter" | "high_latency" | "low_mos" | "detected_silence" | "no_concurrent_participants";
/**
* Options to pass to each
*/
export interface ConferenceListInstanceEachOptions {
/** The SID of the conference. */
conferenceSid?: string;
/** Custom label for the conference resource, up to 64 characters. */
friendlyName?: string;
/** Conference status. */
status?: string;
/** Conferences created after the provided timestamp specified in ISO 8601 format */
createdAfter?: string;
/** Conferences created before the provided timestamp specified in ISO 8601 format. */
createdBefore?: string;
/** Twilio region where the conference media was mixed. */
mixerRegion?: string;
/** Tags applied by Twilio for common potential configuration, quality, or performance issues. */
tags?: string;
/** Account SID for the subaccount whose resources you wish to retrieve. */
subaccount?: string;
/** Potential configuration, behavior, or performance issues detected during the conference. */
detectedIssues?: string;
/** Conference end reason; e.g. last participant left, modified by API, etc. */
endReason?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface ConferenceListInstanceOptions {
/** The SID of the conference. */
conferenceSid?: string;
/** Custom label for the conference resource, up to 64 characters. */
friendlyName?: string;
/** Conference status. */
status?: string;
/** Conferences created after the provided timestamp specified in ISO 8601 format */
createdAfter?: string;
/** Conferences created before the provided timestamp specified in ISO 8601 format. */
createdBefore?: string;
/** Twilio region where the conference media was mixed. */
mixerRegion?: string;
/** Tags applied by Twilio for common potential configuration, quality, or performance issues. */
tags?: string;
/** Account SID for the subaccount whose resources you wish to retrieve. */
subaccount?: string;
/** Potential configuration, behavior, or performance issues detected during the conference. */
detectedIssues?: string;
/** Conference end reason; e.g. last participant left, modified by API, etc. */
endReason?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface ConferenceListInstancePageOptions {
/** The SID of the conference. */
conferenceSid?: string;
/** Custom label for the conference resource, up to 64 characters. */
friendlyName?: string;
/** Conference status. */
status?: string;
/** Conferences created after the provided timestamp specified in ISO 8601 format */
createdAfter?: string;
/** Conferences created before the provided timestamp specified in ISO 8601 format. */
createdBefore?: string;
/** Twilio region where the conference media was mixed. */
mixerRegion?: string;
/** Tags applied by Twilio for common potential configuration, quality, or performance issues. */
tags?: string;
/** Account SID for the subaccount whose resources you wish to retrieve. */
subaccount?: string;
/** Potential configuration, behavior, or performance issues detected during the conference. */
detectedIssues?: string;
/** Conference end reason; e.g. last participant left, modified by API, etc. */
endReason?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ConferenceContext {
conferenceParticipants: ConferenceParticipantListInstance;
/**
* Fetch a ConferenceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceInstance
*/
fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>;
/**
* Fetch a ConferenceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ConferenceInstance>) => any): Promise<ApiResponse<ConferenceInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ConferenceContextSolution {
conferenceSid: string;
}
export declare class ConferenceContextImpl implements ConferenceContext {
protected _version: V1;
protected _solution: ConferenceContextSolution;
protected _uri: string;
protected _conferenceParticipants?: ConferenceParticipantListInstance;
constructor(_version: V1, conferenceSid: string);
get conferenceParticipants(): ConferenceParticipantListInstance;
fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ConferenceInstance>) => any): Promise<ApiResponse<ConferenceInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ConferenceContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ConferencePayload extends TwilioResponsePayload {
conferences: ConferenceResource[];
}
interface ConferenceResource {
conference_sid: string;
account_sid: string;
friendly_name: string;
create_time: Date;
start_time: Date;
end_time: Date;
duration_seconds: number;
connect_duration_seconds: number;
status: ConferenceConferenceStatus;
max_participants: number;
max_concurrent_participants: number;
unique_participants: number;
end_reason: ConferenceConferenceEndReason;
ended_by: string;
mixer_region: ConferenceRegion;
mixer_region_requested: ConferenceRegion;
recording_enabled: boolean;
detected_issues: any;
tags: Array<ConferenceTag>;
tag_info: any;
processing_state: ConferenceProcessingState;
url: string;
links: Record<string, string>;
}
export declare class ConferenceInstance {
protected _version: V1;
protected _solution: ConferenceContextSolution;
protected _context?: ConferenceContext;
constructor(_version: V1, payload: ConferenceResource, conferenceSid?: string);
/**
* The unique SID identifier of the Conference.
*/
conferenceSid: string;
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* Custom label for the conference resource, up to 64 characters.
*/
friendlyName: string;
/**
* Conference creation date and time in ISO 8601 format.
*/
createTime: Date;
/**
* Timestamp in ISO 8601 format when the conference started. Conferences do not start until at least two participants join, at least one of whom has startConferenceOnEnter=true.
*/
startTime: Date;
/**
* Conference end date and time in ISO 8601 format.
*/
endTime: Date;
/**
* Conference duration in seconds.
*/
durationSeconds: number;
/**
* Duration of the between conference start event and conference end event in seconds.
*/
connectDurationSeconds: number;
status: ConferenceConferenceStatus;
/**
* Maximum number of concurrent participants as specified by the configuration.
*/
maxParticipants: number;
/**
* Actual maximum number of concurrent participants in the conference.
*/
maxConcurrentParticipants: number;
/**
* Unique conference participants based on caller ID.
*/
uniqueParticipants: number;
endReason: ConferenceConferenceEndReason;
/**
* Call SID of the participant whose actions ended the conference.
*/
endedBy: string;
mixerRegion: ConferenceRegion;
mixerRegionRequested: ConferenceRegion;
/**
* Boolean. Indicates whether recording was enabled at the conference mixer.
*/
recordingEnabled: boolean;
/**
* Potential issues detected by Twilio during the conference.
*/
detectedIssues: any;
/**
* Tags for detected conference conditions and participant behaviors which may be of interest.
*/
tags: Array<ConferenceTag>;
/**
* Object. Contains details about conference tags including severity.
*/
tagInfo: any;
processingState: ConferenceProcessingState;
/**
* The URL of this resource.
*/
url: string;
/**
* Contains a dictionary of URL links to nested resources of this Conference.
*/
links: Record<string, string>;
private get _proxy();
/**
* Fetch a ConferenceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceInstance
*/
fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>;
/**
* Fetch a ConferenceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ConferenceInstance>) => any): Promise<ApiResponse<ConferenceInstance>>;
/**
* Access the conferenceParticipants.
*/
conferenceParticipants(): ConferenceParticipantListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
conferenceSid: string;
accountSid: string;
friendlyName: string;
createTime: Date;
startTime: Date;
endTime: Date;
durationSeconds: number;
connectDurationSeconds: number;
status: ConferenceConferenceStatus;
maxParticipants: number;
maxConcurrentParticipants: number;
uniqueParticipants: number;
endReason: ConferenceConferenceEndReason;
endedBy: string;
mixerRegion: ConferenceRegion;
mixerRegionRequested: ConferenceRegion;
recordingEnabled: boolean;
detectedIssues: any;
tags: ConferenceTag[];
tagInfo: any;
processingState: ConferenceProcessingState;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ConferenceSolution {
}
export interface ConferenceListInstance {
_version: V1;
_solution: ConferenceSolution;
_uri: string;
(conferenceSid: string): ConferenceContext;
get(conferenceSid: string): ConferenceContext;
/**
* Streams ConferenceInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void;
each(params: ConferenceListInstanceEachOptions, callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ConferenceInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ConferenceListInstanceEachOptions, callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ConferenceInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: ConferencePage) => any): Promise<ConferencePage>;
/**
* Retrieve a single target page of ConferenceInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ConferencePage>) => any): Promise<ApiResponse<ConferencePage>>;
/**
* Lists ConferenceInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ConferenceInstance[]) => any): Promise<ConferenceInstance[]>;
list(params: ConferenceListInstanceOptions, callback?: (error: Error | null, items: ConferenceInstance[]) => any): Promise<ConferenceInstance[]>;
/**
* Lists ConferenceInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ConferenceInstance[]>) => any): Promise<ApiResponse<ConferenceInstance[]>>;
listWithHttpInfo(params: ConferenceListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ConferenceInstance[]>) => any): Promise<ApiResponse<ConferenceInstance[]>>;
/**
* Retrieve a single page of ConferenceInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ConferencePage) => any): Promise<ConferencePage>;
page(params: ConferenceListInstancePageOptions, callback?: (error: Error | null, items: ConferencePage) => any): Promise<ConferencePage>;
/**
* Retrieve a single page of ConferenceInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ConferencePage>) => any): Promise<ApiResponse<ConferencePage>>;
pageWithHttpInfo(params: ConferenceListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ConferencePage>) => any): Promise<ApiResponse<ConferencePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ConferenceListInstance(version: V1): ConferenceListInstance;
export declare class ConferencePage extends Page<V1, ConferencePayload, ConferenceResource, ConferenceInstance> {
/**
* Initialize the ConferencePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ConferenceSolution);
/**
* Build an instance of ConferenceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ConferenceResource): ConferenceInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

349
node_modules/twilio/lib/rest/insights/v1/conference.js generated vendored Normal file
View File

@@ -0,0 +1,349 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConferencePage = exports.ConferenceInstance = exports.ConferenceContextImpl = void 0;
exports.ConferenceListInstance = ConferenceListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const conferenceParticipant_1 = require("./conference/conferenceParticipant");
class ConferenceContextImpl {
constructor(_version, conferenceSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(conferenceSid)) {
throw new Error("Parameter 'conferenceSid' is not valid.");
}
this._solution = { conferenceSid };
this._uri = `/Conferences/${conferenceSid}`;
}
get conferenceParticipants() {
this._conferenceParticipants =
this._conferenceParticipants ||
(0, conferenceParticipant_1.ConferenceParticipantListInstance)(this._version, this._solution.conferenceSid);
return this._conferenceParticipants;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ConferenceInstance(operationVersion, payload, instance._solution.conferenceSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ConferenceInstance(operationVersion, response.body, instance._solution.conferenceSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ConferenceContextImpl = ConferenceContextImpl;
class ConferenceInstance {
constructor(_version, payload, conferenceSid) {
this._version = _version;
this.conferenceSid = payload.conference_sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.createTime = deserialize.iso8601DateTime(payload.create_time);
this.startTime = deserialize.iso8601DateTime(payload.start_time);
this.endTime = deserialize.iso8601DateTime(payload.end_time);
this.durationSeconds = deserialize.integer(payload.duration_seconds);
this.connectDurationSeconds = deserialize.integer(payload.connect_duration_seconds);
this.status = payload.status;
this.maxParticipants = deserialize.integer(payload.max_participants);
this.maxConcurrentParticipants = deserialize.integer(payload.max_concurrent_participants);
this.uniqueParticipants = deserialize.integer(payload.unique_participants);
this.endReason = payload.end_reason;
this.endedBy = payload.ended_by;
this.mixerRegion = payload.mixer_region;
this.mixerRegionRequested = payload.mixer_region_requested;
this.recordingEnabled = payload.recording_enabled;
this.detectedIssues = payload.detected_issues;
this.tags = payload.tags;
this.tagInfo = payload.tag_info;
this.processingState = payload.processing_state;
this.url = payload.url;
this.links = payload.links;
this._solution = { conferenceSid: conferenceSid || this.conferenceSid };
}
get _proxy() {
this._context =
this._context ||
new ConferenceContextImpl(this._version, this._solution.conferenceSid);
return this._context;
}
/**
* Fetch a ConferenceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ConferenceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the conferenceParticipants.
*/
conferenceParticipants() {
return this._proxy.conferenceParticipants;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
conferenceSid: this.conferenceSid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
createTime: this.createTime,
startTime: this.startTime,
endTime: this.endTime,
durationSeconds: this.durationSeconds,
connectDurationSeconds: this.connectDurationSeconds,
status: this.status,
maxParticipants: this.maxParticipants,
maxConcurrentParticipants: this.maxConcurrentParticipants,
uniqueParticipants: this.uniqueParticipants,
endReason: this.endReason,
endedBy: this.endedBy,
mixerRegion: this.mixerRegion,
mixerRegionRequested: this.mixerRegionRequested,
recordingEnabled: this.recordingEnabled,
detectedIssues: this.detectedIssues,
tags: this.tags,
tagInfo: this.tagInfo,
processingState: this.processingState,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ConferenceInstance = ConferenceInstance;
function ConferenceListInstance(version) {
const instance = ((conferenceSid) => instance.get(conferenceSid));
instance.get = function get(conferenceSid) {
return new ConferenceContextImpl(version, conferenceSid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Conferences`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["conferenceSid"] !== undefined)
data["ConferenceSid"] = params["conferenceSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["createdAfter"] !== undefined)
data["CreatedAfter"] = params["createdAfter"];
if (params["createdBefore"] !== undefined)
data["CreatedBefore"] = params["createdBefore"];
if (params["mixerRegion"] !== undefined)
data["MixerRegion"] = params["mixerRegion"];
if (params["tags"] !== undefined)
data["Tags"] = params["tags"];
if (params["subaccount"] !== undefined)
data["Subaccount"] = params["subaccount"];
if (params["detectedIssues"] !== undefined)
data["DetectedIssues"] = params["detectedIssues"];
if (params["endReason"] !== undefined)
data["EndReason"] = params["endReason"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ConferencePage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ConferencePage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["conferenceSid"] !== undefined)
data["ConferenceSid"] = params["conferenceSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["createdAfter"] !== undefined)
data["CreatedAfter"] = params["createdAfter"];
if (params["createdBefore"] !== undefined)
data["CreatedBefore"] = params["createdBefore"];
if (params["mixerRegion"] !== undefined)
data["MixerRegion"] = params["mixerRegion"];
if (params["tags"] !== undefined)
data["Tags"] = params["tags"];
if (params["subaccount"] !== undefined)
data["Subaccount"] = params["subaccount"];
if (params["detectedIssues"] !== undefined)
data["DetectedIssues"] = params["detectedIssues"];
if (params["endReason"] !== undefined)
data["EndReason"] = params["endReason"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ConferencePage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ConferencePage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 ConferencePage extends Page_1.default {
/**
* Initialize the ConferencePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ConferenceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ConferenceInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ConferencePage = ConferencePage;

View File

@@ -0,0 +1,462 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export type ConferenceParticipantCallDirection = "inbound" | "outbound";
export type ConferenceParticipantCallStatus = "answered" | "completed" | "busy" | "fail" | "noanswer" | "ringing" | "canceled";
export type ConferenceParticipantCallType = "carrier" | "client" | "sip";
export type ConferenceParticipantJitterBufferSize = "large" | "small" | "medium" | "off";
export type ConferenceParticipantProcessingState = "complete" | "in_progress" | "timeout";
export type ConferenceParticipantRegion = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1" | "in1";
/**
* Options to pass to fetch a ConferenceParticipantInstance
*/
export interface ConferenceParticipantContextFetchOptions {
/** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */
events?: string;
/** Object. Contains participant call quality metrics. */
metrics?: string;
}
/**
* Options to pass to each
*/
export interface ConferenceParticipantListInstanceEachOptions {
/** The unique SID identifier of the Participant. */
participantSid?: string;
/** User-specified label for a participant. */
label?: string;
/** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */
events?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ConferenceParticipantInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface ConferenceParticipantListInstanceOptions {
/** The unique SID identifier of the Participant. */
participantSid?: string;
/** User-specified label for a participant. */
label?: string;
/** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */
events?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface ConferenceParticipantListInstancePageOptions {
/** The unique SID identifier of the Participant. */
participantSid?: string;
/** User-specified label for a participant. */
label?: string;
/** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */
events?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ConferenceParticipantContext {
/**
* Fetch a ConferenceParticipantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance
*/
fetch(callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>;
/**
* Fetch a ConferenceParticipantInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance
*/
fetch(params: ConferenceParticipantContextFetchOptions, callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>;
/**
* Fetch a ConferenceParticipantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ConferenceParticipantInstance>) => any): Promise<ApiResponse<ConferenceParticipantInstance>>;
/**
* Fetch a ConferenceParticipantInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance with HTTP metadata
*/
fetchWithHttpInfo(params: ConferenceParticipantContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<ConferenceParticipantInstance>) => any): Promise<ApiResponse<ConferenceParticipantInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ConferenceParticipantContextSolution {
conferenceSid: string;
participantSid: string;
}
export declare class ConferenceParticipantContextImpl implements ConferenceParticipantContext {
protected _version: V1;
protected _solution: ConferenceParticipantContextSolution;
protected _uri: string;
constructor(_version: V1, conferenceSid: string, participantSid: string);
fetch(params?: ConferenceParticipantContextFetchOptions | ((error: Error | null, item?: ConferenceParticipantInstance) => any), callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>;
fetchWithHttpInfo(params?: ConferenceParticipantContextFetchOptions | ((error: Error | null, item?: ApiResponse<ConferenceParticipantInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<ConferenceParticipantInstance>) => any): Promise<ApiResponse<ConferenceParticipantInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ConferenceParticipantContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ConferenceParticipantPayload extends TwilioResponsePayload {
participants: ConferenceParticipantResource[];
}
interface ConferenceParticipantResource {
participant_sid: string;
label: string;
conference_sid: string;
call_sid: string;
account_sid: string;
call_direction: ConferenceParticipantCallDirection;
from: string;
to: string;
call_status: ConferenceParticipantCallStatus;
country_code: string;
is_moderator: boolean;
join_time: Date;
leave_time: Date;
duration_seconds: number;
outbound_queue_length: number;
outbound_time_in_queue: number;
jitter_buffer_size: ConferenceParticipantJitterBufferSize;
is_coach: boolean;
coached_participants: Array<string>;
participant_region: ConferenceParticipantRegion;
conference_region: ConferenceParticipantRegion;
call_type: ConferenceParticipantCallType;
processing_state: ConferenceParticipantProcessingState;
properties: any;
events: any;
metrics: any;
url: string;
}
export declare class ConferenceParticipantInstance {
protected _version: V1;
protected _solution: ConferenceParticipantContextSolution;
protected _context?: ConferenceParticipantContext;
constructor(_version: V1, payload: ConferenceParticipantResource, conferenceSid: string, participantSid?: string);
/**
* SID for this participant.
*/
participantSid: string;
/**
* The user-specified label of this participant.
*/
label: string;
/**
* The unique SID identifier of the Conference.
*/
conferenceSid: string;
/**
* Unique SID identifier of the call that generated the Participant resource.
*/
callSid: string;
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
callDirection: ConferenceParticipantCallDirection;
/**
* Caller ID of the calling party.
*/
from: string;
/**
* Called party.
*/
to: string;
callStatus: ConferenceParticipantCallStatus;
/**
* ISO alpha-2 country code of the participant based on caller ID or called number.
*/
countryCode: string;
/**
* Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true.
*/
isModerator: boolean;
/**
* ISO 8601 timestamp of participant join event.
*/
joinTime: Date;
/**
* ISO 8601 timestamp of participant leave event.
*/
leaveTime: Date;
/**
* Participant durations in seconds.
*/
durationSeconds: number;
/**
* Add Participant API only. Estimated time in queue at call creation.
*/
outboundQueueLength: number;
/**
* Add Participant API only. Actual time in queue in seconds.
*/
outboundTimeInQueue: number;
jitterBufferSize: ConferenceParticipantJitterBufferSize;
/**
* Boolean. Indicated whether participant was a coach.
*/
isCoach: boolean;
/**
* Call SIDs coached by this participant.
*/
coachedParticipants: Array<string>;
participantRegion: ConferenceParticipantRegion;
conferenceRegion: ConferenceParticipantRegion;
callType: ConferenceParticipantCallType;
processingState: ConferenceParticipantProcessingState;
/**
* Participant properties and metadata.
*/
properties: any;
/**
* Object containing information of actions taken by participants. Contains a dictionary of URL links to nested resources of this Conference Participant.
*/
events: any;
/**
* Object. Contains participant call quality metrics.
*/
metrics: any;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a ConferenceParticipantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance
*/
fetch(callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>;
/**
* Fetch a ConferenceParticipantInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance
*/
fetch(params: ConferenceParticipantContextFetchOptions, callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>;
/**
* Fetch a ConferenceParticipantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ConferenceParticipantInstance>) => any): Promise<ApiResponse<ConferenceParticipantInstance>>;
/**
* Fetch a ConferenceParticipantInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ConferenceParticipantInstance with HTTP metadata
*/
fetchWithHttpInfo(params: ConferenceParticipantContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<ConferenceParticipantInstance>) => any): Promise<ApiResponse<ConferenceParticipantInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
participantSid: string;
label: string;
conferenceSid: string;
callSid: string;
accountSid: string;
callDirection: ConferenceParticipantCallDirection;
from: string;
to: string;
callStatus: ConferenceParticipantCallStatus;
countryCode: string;
isModerator: boolean;
joinTime: Date;
leaveTime: Date;
durationSeconds: number;
outboundQueueLength: number;
outboundTimeInQueue: number;
jitterBufferSize: ConferenceParticipantJitterBufferSize;
isCoach: boolean;
coachedParticipants: string[];
participantRegion: ConferenceParticipantRegion;
conferenceRegion: ConferenceParticipantRegion;
callType: ConferenceParticipantCallType;
processingState: ConferenceParticipantProcessingState;
properties: any;
events: any;
metrics: any;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ConferenceParticipantSolution {
conferenceSid: string;
}
export interface ConferenceParticipantListInstance {
_version: V1;
_solution: ConferenceParticipantSolution;
_uri: string;
(participantSid: string): ConferenceParticipantContext;
get(participantSid: string): ConferenceParticipantContext;
/**
* Streams ConferenceParticipantInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceParticipantListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ConferenceParticipantInstance, done: (err?: Error) => void) => void): void;
each(params: ConferenceParticipantListInstanceEachOptions, callback?: (item: ConferenceParticipantInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ConferenceParticipantInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceParticipantListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ConferenceParticipantInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ConferenceParticipantListInstanceEachOptions, callback?: (item: ConferenceParticipantInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ConferenceParticipantInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: ConferenceParticipantPage) => any): Promise<ConferenceParticipantPage>;
/**
* Retrieve a single target page of ConferenceParticipantInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ConferenceParticipantPage>) => any): Promise<ApiResponse<ConferenceParticipantPage>>;
/**
* Lists ConferenceParticipantInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceParticipantListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ConferenceParticipantInstance[]) => any): Promise<ConferenceParticipantInstance[]>;
list(params: ConferenceParticipantListInstanceOptions, callback?: (error: Error | null, items: ConferenceParticipantInstance[]) => any): Promise<ConferenceParticipantInstance[]>;
/**
* Lists ConferenceParticipantInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceParticipantListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ConferenceParticipantInstance[]>) => any): Promise<ApiResponse<ConferenceParticipantInstance[]>>;
listWithHttpInfo(params: ConferenceParticipantListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ConferenceParticipantInstance[]>) => any): Promise<ApiResponse<ConferenceParticipantInstance[]>>;
/**
* Retrieve a single page of ConferenceParticipantInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceParticipantListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ConferenceParticipantPage) => any): Promise<ConferenceParticipantPage>;
page(params: ConferenceParticipantListInstancePageOptions, callback?: (error: Error | null, items: ConferenceParticipantPage) => any): Promise<ConferenceParticipantPage>;
/**
* Retrieve a single page of ConferenceParticipantInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ConferenceParticipantListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ConferenceParticipantPage>) => any): Promise<ApiResponse<ConferenceParticipantPage>>;
pageWithHttpInfo(params: ConferenceParticipantListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ConferenceParticipantPage>) => any): Promise<ApiResponse<ConferenceParticipantPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ConferenceParticipantListInstance(version: V1, conferenceSid: string): ConferenceParticipantListInstance;
export declare class ConferenceParticipantPage extends Page<V1, ConferenceParticipantPayload, ConferenceParticipantResource, ConferenceParticipantInstance> {
/**
* Initialize the ConferenceParticipantPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ConferenceParticipantSolution);
/**
* Build an instance of ConferenceParticipantInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ConferenceParticipantResource): ConferenceParticipantInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,337 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConferenceParticipantPage = exports.ConferenceParticipantInstance = exports.ConferenceParticipantContextImpl = void 0;
exports.ConferenceParticipantListInstance = ConferenceParticipantListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class ConferenceParticipantContextImpl {
constructor(_version, conferenceSid, participantSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(conferenceSid)) {
throw new Error("Parameter 'conferenceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(participantSid)) {
throw new Error("Parameter 'participantSid' is not valid.");
}
this._solution = { conferenceSid, participantSid };
this._uri = `/Conferences/${conferenceSid}/Participants/${participantSid}`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["events"] !== undefined)
data["Events"] = params["events"];
if (params["metrics"] !== undefined)
data["Metrics"] = params["metrics"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ConferenceParticipantInstance(operationVersion, payload, instance._solution.conferenceSid, instance._solution.participantSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["events"] !== undefined)
data["Events"] = params["events"];
if (params["metrics"] !== undefined)
data["Metrics"] = params["metrics"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new ConferenceParticipantInstance(operationVersion, response.body, instance._solution.conferenceSid, instance._solution.participantSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ConferenceParticipantContextImpl = ConferenceParticipantContextImpl;
class ConferenceParticipantInstance {
constructor(_version, payload, conferenceSid, participantSid) {
this._version = _version;
this.participantSid = payload.participant_sid;
this.label = payload.label;
this.conferenceSid = payload.conference_sid;
this.callSid = payload.call_sid;
this.accountSid = payload.account_sid;
this.callDirection = payload.call_direction;
this.from = payload.from;
this.to = payload.to;
this.callStatus = payload.call_status;
this.countryCode = payload.country_code;
this.isModerator = payload.is_moderator;
this.joinTime = deserialize.iso8601DateTime(payload.join_time);
this.leaveTime = deserialize.iso8601DateTime(payload.leave_time);
this.durationSeconds = deserialize.integer(payload.duration_seconds);
this.outboundQueueLength = deserialize.integer(payload.outbound_queue_length);
this.outboundTimeInQueue = deserialize.integer(payload.outbound_time_in_queue);
this.jitterBufferSize = payload.jitter_buffer_size;
this.isCoach = payload.is_coach;
this.coachedParticipants = payload.coached_participants;
this.participantRegion = payload.participant_region;
this.conferenceRegion = payload.conference_region;
this.callType = payload.call_type;
this.processingState = payload.processing_state;
this.properties = payload.properties;
this.events = payload.events;
this.metrics = payload.metrics;
this.url = payload.url;
this._solution = {
conferenceSid,
participantSid: participantSid || this.participantSid,
};
}
get _proxy() {
this._context =
this._context ||
new ConferenceParticipantContextImpl(this._version, this._solution.conferenceSid, this._solution.participantSid);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
participantSid: this.participantSid,
label: this.label,
conferenceSid: this.conferenceSid,
callSid: this.callSid,
accountSid: this.accountSid,
callDirection: this.callDirection,
from: this.from,
to: this.to,
callStatus: this.callStatus,
countryCode: this.countryCode,
isModerator: this.isModerator,
joinTime: this.joinTime,
leaveTime: this.leaveTime,
durationSeconds: this.durationSeconds,
outboundQueueLength: this.outboundQueueLength,
outboundTimeInQueue: this.outboundTimeInQueue,
jitterBufferSize: this.jitterBufferSize,
isCoach: this.isCoach,
coachedParticipants: this.coachedParticipants,
participantRegion: this.participantRegion,
conferenceRegion: this.conferenceRegion,
callType: this.callType,
processingState: this.processingState,
properties: this.properties,
events: this.events,
metrics: this.metrics,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ConferenceParticipantInstance = ConferenceParticipantInstance;
function ConferenceParticipantListInstance(version, conferenceSid) {
if (!(0, utility_1.isValidPathParam)(conferenceSid)) {
throw new Error("Parameter 'conferenceSid' is not valid.");
}
const instance = ((participantSid) => instance.get(participantSid));
instance.get = function get(participantSid) {
return new ConferenceParticipantContextImpl(version, conferenceSid, participantSid);
};
instance._version = version;
instance._solution = { conferenceSid };
instance._uri = `/Conferences/${conferenceSid}/Participants`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["participantSid"] !== undefined)
data["ParticipantSid"] = params["participantSid"];
if (params["label"] !== undefined)
data["Label"] = params["label"];
if (params["events"] !== undefined)
data["Events"] = params["events"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ConferenceParticipantPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ConferenceParticipantPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["participantSid"] !== undefined)
data["ParticipantSid"] = params["participantSid"];
if (params["label"] !== undefined)
data["Label"] = params["label"];
if (params["events"] !== undefined)
data["Events"] = params["events"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ConferenceParticipantPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ConferenceParticipantPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 ConferenceParticipantPage extends Page_1.default {
/**
* Initialize the ConferenceParticipantPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ConferenceParticipantInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ConferenceParticipantInstance(this._version, payload, this._solution.conferenceSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ConferenceParticipantPage = ConferenceParticipantPage;

431
node_modules/twilio/lib/rest/insights/v1/room.d.ts generated vendored Normal file
View File

@@ -0,0 +1,431 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { ParticipantListInstance } from "./room/participant";
export type RoomCodec = "VP8" | "H264" | "VP9" | "opus";
export type RoomCreatedMethod = "sdk" | "ad_hoc" | "api";
export type RoomEdgeLocation = "ashburn" | "dublin" | "frankfurt" | "singapore" | "sydney" | "sao_paulo" | "roaming" | "umatilla" | "tokyo";
export type RoomEndReason = "room_ended_via_api" | "timeout";
export type RoomProcessingState = "complete" | "in_progress" | "timeout" | "not_started";
export type RoomRoomStatus = "in_progress" | "completed";
export type RoomRoomType = "go" | "peer_to_peer" | "group" | "group_small";
export type RoomTwilioRealm = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "in1" | "de1" | "gll";
/**
* Options to pass to each
*/
export interface RoomListInstanceEachOptions {
/** Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. */
roomType?: Array<RoomRoomType>;
/** Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. */
codec?: Array<RoomCodec>;
/** Room friendly name. */
roomName?: string;
/** Only read rooms that started on or after this ISO 8601 timestamp. */
createdAfter?: Date;
/** Only read rooms that started before this ISO 8601 timestamp. */
createdBefore?: Date;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: RoomInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface RoomListInstanceOptions {
/** Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. */
roomType?: Array<RoomRoomType>;
/** Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. */
codec?: Array<RoomCodec>;
/** Room friendly name. */
roomName?: string;
/** Only read rooms that started on or after this ISO 8601 timestamp. */
createdAfter?: Date;
/** Only read rooms that started before this ISO 8601 timestamp. */
createdBefore?: Date;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface RoomListInstancePageOptions {
/** Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. */
roomType?: Array<RoomRoomType>;
/** Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. */
codec?: Array<RoomCodec>;
/** Room friendly name. */
roomName?: string;
/** Only read rooms that started on or after this ISO 8601 timestamp. */
createdAfter?: Date;
/** Only read rooms that started before this ISO 8601 timestamp. */
createdBefore?: Date;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface RoomContext {
participants: ParticipantListInstance;
/**
* Fetch a RoomInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RoomInstance
*/
fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>;
/**
* Fetch a RoomInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RoomInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RoomInstance>) => any): Promise<ApiResponse<RoomInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface RoomContextSolution {
roomSid: string;
}
export declare class RoomContextImpl implements RoomContext {
protected _version: V1;
protected _solution: RoomContextSolution;
protected _uri: string;
protected _participants?: ParticipantListInstance;
constructor(_version: V1, roomSid: string);
get participants(): ParticipantListInstance;
fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RoomInstance>) => any): Promise<ApiResponse<RoomInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): RoomContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface RoomPayload extends TwilioResponsePayload {
rooms: RoomResource[];
}
interface RoomResource {
account_sid: string;
room_sid: string;
room_name: string;
create_time: Date;
end_time: Date;
room_type: RoomRoomType;
room_status: RoomRoomStatus;
status_callback: string;
status_callback_method: string;
created_method: RoomCreatedMethod;
end_reason: RoomEndReason;
max_participants: number;
unique_participants: number;
unique_participant_identities: number;
concurrent_participants: number;
max_concurrent_participants: number;
codecs: Array<RoomCodec>;
media_region: RoomTwilioRealm;
duration_sec: number;
total_participant_duration_sec: number;
total_recording_duration_sec: number;
processing_state: RoomProcessingState;
recording_enabled: boolean;
edge_location: RoomEdgeLocation;
url: string;
links: Record<string, string>;
}
export declare class RoomInstance {
protected _version: V1;
protected _solution: RoomContextSolution;
protected _context?: RoomContext;
constructor(_version: V1, payload: RoomResource, roomSid?: string);
/**
* Account SID associated with this room.
*/
accountSid: string;
/**
* Unique identifier for the room.
*/
roomSid: string;
/**
* Room friendly name.
*/
roomName: string;
/**
* Creation time of the room.
*/
createTime: Date;
/**
* End time for the room.
*/
endTime: Date;
roomType: RoomRoomType;
roomStatus: RoomRoomStatus;
/**
* Webhook provided for status callbacks.
*/
statusCallback: string;
/**
* HTTP method provided for status callback URL.
*/
statusCallbackMethod: string;
createdMethod: RoomCreatedMethod;
endReason: RoomEndReason;
/**
* Max number of total participants allowed by the application settings.
*/
maxParticipants: number;
/**
* Number of participants. May include duplicate identities for participants who left and rejoined.
*/
uniqueParticipants: number;
/**
* Unique number of participant identities.
*/
uniqueParticipantIdentities: number;
/**
* Actual number of concurrent participants.
*/
concurrentParticipants: number;
/**
* Maximum number of participants allowed in the room at the same time allowed by the application settings.
*/
maxConcurrentParticipants: number;
/**
* Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
*/
codecs: Array<RoomCodec>;
mediaRegion: RoomTwilioRealm;
/**
* Total room duration from create time to end time.
*/
durationSec: number;
/**
* Combined amount of participant time in the room.
*/
totalParticipantDurationSec: number;
/**
* Combined amount of recorded seconds for participants in the room.
*/
totalRecordingDurationSec: number;
processingState: RoomProcessingState;
/**
* Boolean indicating if recording is enabled for the room.
*/
recordingEnabled: boolean;
edgeLocation: RoomEdgeLocation;
/**
* URL for the room resource.
*/
url: string;
/**
* Room subresources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Fetch a RoomInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RoomInstance
*/
fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>;
/**
* Fetch a RoomInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RoomInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RoomInstance>) => any): Promise<ApiResponse<RoomInstance>>;
/**
* Access the participants.
*/
participants(): ParticipantListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
roomSid: string;
roomName: string;
createTime: Date;
endTime: Date;
roomType: RoomRoomType;
roomStatus: RoomRoomStatus;
statusCallback: string;
statusCallbackMethod: string;
createdMethod: RoomCreatedMethod;
endReason: RoomEndReason;
maxParticipants: number;
uniqueParticipants: number;
uniqueParticipantIdentities: number;
concurrentParticipants: number;
maxConcurrentParticipants: number;
codecs: RoomCodec[];
mediaRegion: RoomTwilioRealm;
durationSec: number;
totalParticipantDurationSec: number;
totalRecordingDurationSec: number;
processingState: RoomProcessingState;
recordingEnabled: boolean;
edgeLocation: RoomEdgeLocation;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface RoomSolution {
}
export interface RoomListInstance {
_version: V1;
_solution: RoomSolution;
_uri: string;
(roomSid: string): RoomContext;
get(roomSid: string): RoomContext;
/**
* Streams RoomInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RoomListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void;
each(params: RoomListInstanceEachOptions, callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void;
/**
* Streams RoomInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RoomListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: RoomListInstanceEachOptions, callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of RoomInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>;
/**
* Retrieve a single target page of RoomInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<RoomPage>) => any): Promise<ApiResponse<RoomPage>>;
/**
* Lists RoomInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RoomListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>;
list(params: RoomListInstanceOptions, callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>;
/**
* Lists RoomInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RoomListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RoomInstance[]>) => any): Promise<ApiResponse<RoomInstance[]>>;
listWithHttpInfo(params: RoomListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<RoomInstance[]>) => any): Promise<ApiResponse<RoomInstance[]>>;
/**
* Retrieve a single page of RoomInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RoomListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>;
page(params: RoomListInstancePageOptions, callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>;
/**
* Retrieve a single page of RoomInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RoomListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RoomPage>) => any): Promise<ApiResponse<RoomPage>>;
pageWithHttpInfo(params: RoomListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<RoomPage>) => any): Promise<ApiResponse<RoomPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function RoomListInstance(version: V1): RoomListInstance;
export declare class RoomPage extends Page<V1, RoomPayload, RoomResource, RoomInstance> {
/**
* Initialize the RoomPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: RoomSolution);
/**
* Build an instance of RoomInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: RoomResource): RoomInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

335
node_modules/twilio/lib/rest/insights/v1/room.js generated vendored Normal file
View File

@@ -0,0 +1,335 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoomPage = exports.RoomInstance = exports.RoomContextImpl = void 0;
exports.RoomListInstance = RoomListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const participant_1 = require("./room/participant");
class RoomContextImpl {
constructor(_version, roomSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(roomSid)) {
throw new Error("Parameter 'roomSid' is not valid.");
}
this._solution = { roomSid };
this._uri = `/Video/Rooms/${roomSid}`;
}
get participants() {
this._participants =
this._participants ||
(0, participant_1.ParticipantListInstance)(this._version, this._solution.roomSid);
return this._participants;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new RoomInstance(operationVersion, payload, instance._solution.roomSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new RoomInstance(operationVersion, response.body, instance._solution.roomSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RoomContextImpl = RoomContextImpl;
class RoomInstance {
constructor(_version, payload, roomSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.roomSid = payload.room_sid;
this.roomName = payload.room_name;
this.createTime = deserialize.iso8601DateTime(payload.create_time);
this.endTime = deserialize.iso8601DateTime(payload.end_time);
this.roomType = payload.room_type;
this.roomStatus = payload.room_status;
this.statusCallback = payload.status_callback;
this.statusCallbackMethod = payload.status_callback_method;
this.createdMethod = payload.created_method;
this.endReason = payload.end_reason;
this.maxParticipants = deserialize.integer(payload.max_participants);
this.uniqueParticipants = deserialize.integer(payload.unique_participants);
this.uniqueParticipantIdentities = deserialize.integer(payload.unique_participant_identities);
this.concurrentParticipants = deserialize.integer(payload.concurrent_participants);
this.maxConcurrentParticipants = deserialize.integer(payload.max_concurrent_participants);
this.codecs = payload.codecs;
this.mediaRegion = payload.media_region;
this.durationSec = payload.duration_sec;
this.totalParticipantDurationSec = payload.total_participant_duration_sec;
this.totalRecordingDurationSec = payload.total_recording_duration_sec;
this.processingState = payload.processing_state;
this.recordingEnabled = payload.recording_enabled;
this.edgeLocation = payload.edge_location;
this.url = payload.url;
this.links = payload.links;
this._solution = { roomSid: roomSid || this.roomSid };
}
get _proxy() {
this._context =
this._context ||
new RoomContextImpl(this._version, this._solution.roomSid);
return this._context;
}
/**
* Fetch a RoomInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RoomInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a RoomInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RoomInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the participants.
*/
participants() {
return this._proxy.participants;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
roomSid: this.roomSid,
roomName: this.roomName,
createTime: this.createTime,
endTime: this.endTime,
roomType: this.roomType,
roomStatus: this.roomStatus,
statusCallback: this.statusCallback,
statusCallbackMethod: this.statusCallbackMethod,
createdMethod: this.createdMethod,
endReason: this.endReason,
maxParticipants: this.maxParticipants,
uniqueParticipants: this.uniqueParticipants,
uniqueParticipantIdentities: this.uniqueParticipantIdentities,
concurrentParticipants: this.concurrentParticipants,
maxConcurrentParticipants: this.maxConcurrentParticipants,
codecs: this.codecs,
mediaRegion: this.mediaRegion,
durationSec: this.durationSec,
totalParticipantDurationSec: this.totalParticipantDurationSec,
totalRecordingDurationSec: this.totalRecordingDurationSec,
processingState: this.processingState,
recordingEnabled: this.recordingEnabled,
edgeLocation: this.edgeLocation,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RoomInstance = RoomInstance;
function RoomListInstance(version) {
const instance = ((roomSid) => instance.get(roomSid));
instance.get = function get(roomSid) {
return new RoomContextImpl(version, roomSid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Video/Rooms`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["roomType"] !== undefined)
data["RoomType"] = serialize.map(params["roomType"], (e) => e);
if (params["codec"] !== undefined)
data["Codec"] = serialize.map(params["codec"], (e) => e);
if (params["roomName"] !== undefined)
data["RoomName"] = params["roomName"];
if (params["createdAfter"] !== undefined)
data["CreatedAfter"] = serialize.iso8601DateTime(params["createdAfter"]);
if (params["createdBefore"] !== undefined)
data["CreatedBefore"] = serialize.iso8601DateTime(params["createdBefore"]);
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new RoomPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new RoomPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["roomType"] !== undefined)
data["RoomType"] = serialize.map(params["roomType"], (e) => e);
if (params["codec"] !== undefined)
data["Codec"] = serialize.map(params["codec"], (e) => e);
if (params["roomName"] !== undefined)
data["RoomName"] = params["roomName"];
if (params["createdAfter"] !== undefined)
data["CreatedAfter"] = serialize.iso8601DateTime(params["createdAfter"]);
if (params["createdBefore"] !== undefined)
data["CreatedBefore"] = serialize.iso8601DateTime(params["createdBefore"]);
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new RoomPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new RoomPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 RoomPage extends Page_1.default {
/**
* Initialize the RoomPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of RoomInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new RoomInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RoomPage = RoomPage;

View File

@@ -0,0 +1,349 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export type ParticipantCodec = "VP8" | "H264" | "VP9" | "opus";
export type ParticipantEdgeLocation = "ashburn" | "dublin" | "frankfurt" | "singapore" | "sydney" | "sao_paulo" | "roaming" | "umatilla" | "tokyo";
export type ParticipantRoomStatus = "in_progress" | "connected" | "completed" | "disconnected";
export type ParticipantTwilioRealm = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "in1" | "de1" | "gll";
/**
* Options to pass to each
*/
export interface ParticipantListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface ParticipantListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface ParticipantListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface ParticipantContext {
/**
* Fetch a ParticipantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ParticipantInstance
*/
fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>;
/**
* Fetch a ParticipantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ParticipantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ParticipantInstance>) => any): Promise<ApiResponse<ParticipantInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ParticipantContextSolution {
roomSid: string;
participantSid: string;
}
export declare class ParticipantContextImpl implements ParticipantContext {
protected _version: V1;
protected _solution: ParticipantContextSolution;
protected _uri: string;
constructor(_version: V1, roomSid: string, participantSid: string);
fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ParticipantInstance>) => any): Promise<ApiResponse<ParticipantInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ParticipantContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ParticipantPayload extends TwilioResponsePayload {
participants: ParticipantResource[];
}
interface ParticipantResource {
participant_sid: string;
participant_identity: string;
join_time: Date;
leave_time: Date;
duration_sec: number;
account_sid: string;
room_sid: string;
status: ParticipantRoomStatus;
codecs: Array<ParticipantCodec>;
end_reason: string;
error_code: number;
error_code_url: string;
media_region: ParticipantTwilioRealm;
properties: any;
edge_location: ParticipantEdgeLocation;
publisher_info: any;
url: string;
}
export declare class ParticipantInstance {
protected _version: V1;
protected _solution: ParticipantContextSolution;
protected _context?: ParticipantContext;
constructor(_version: V1, payload: ParticipantResource, roomSid: string, participantSid?: string);
/**
* Unique identifier for the participant.
*/
participantSid: string;
/**
* The application-defined string that uniquely identifies the participant within a Room.
*/
participantIdentity: string;
/**
* When the participant joined the room.
*/
joinTime: Date;
/**
* When the participant left the room.
*/
leaveTime: Date;
/**
* Amount of time in seconds the participant was in the room.
*/
durationSec: number;
/**
* Account SID associated with the room.
*/
accountSid: string;
/**
* Unique identifier for the room.
*/
roomSid: string;
status: ParticipantRoomStatus;
/**
* Codecs detected from the participant. Can be `VP8`, `H264`, or `VP9`.
*/
codecs: Array<ParticipantCodec>;
/**
* Reason the participant left the room. See [the list of possible values here](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#end_reason).
*/
endReason: string;
/**
* Errors encountered by the participant.
*/
errorCode: number;
/**
* Twilio error code dictionary link.
*/
errorCodeUrl: string;
mediaRegion: ParticipantTwilioRealm;
/**
* Object containing information about the participant\'s data from the room. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#properties) for more information.
*/
properties: any;
edgeLocation: ParticipantEdgeLocation;
/**
* Object containing information about the SDK name and version. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#publisher_info) for more information.
*/
publisherInfo: any;
/**
* URL of the participant resource.
*/
url: string;
private get _proxy();
/**
* Fetch a ParticipantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ParticipantInstance
*/
fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>;
/**
* Fetch a ParticipantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ParticipantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ParticipantInstance>) => any): Promise<ApiResponse<ParticipantInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
participantSid: string;
participantIdentity: string;
joinTime: Date;
leaveTime: Date;
durationSec: number;
accountSid: string;
roomSid: string;
status: ParticipantRoomStatus;
codecs: ParticipantCodec[];
endReason: string;
errorCode: number;
errorCodeUrl: string;
mediaRegion: ParticipantTwilioRealm;
properties: any;
edgeLocation: ParticipantEdgeLocation;
publisherInfo: any;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ParticipantSolution {
roomSid: string;
}
export interface ParticipantListInstance {
_version: V1;
_solution: ParticipantSolution;
_uri: string;
(participantSid: string): ParticipantContext;
get(participantSid: string): ParticipantContext;
/**
* Streams ParticipantInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ParticipantListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void;
each(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ParticipantInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ParticipantListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ParticipantInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>;
/**
* Retrieve a single target page of ParticipantInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ParticipantPage>) => any): Promise<ApiResponse<ParticipantPage>>;
/**
* Lists ParticipantInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ParticipantListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>;
list(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>;
/**
* Lists ParticipantInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ParticipantListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ParticipantInstance[]>) => any): Promise<ApiResponse<ParticipantInstance[]>>;
listWithHttpInfo(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ParticipantInstance[]>) => any): Promise<ApiResponse<ParticipantInstance[]>>;
/**
* Retrieve a single page of ParticipantInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ParticipantListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>;
page(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>;
/**
* Retrieve a single page of ParticipantInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ParticipantListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ParticipantPage>) => any): Promise<ApiResponse<ParticipantPage>>;
pageWithHttpInfo(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ParticipantPage>) => any): Promise<ApiResponse<ParticipantPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ParticipantListInstance(version: V1, roomSid: string): ParticipantListInstance;
export declare class ParticipantPage extends Page<V1, ParticipantPayload, ParticipantResource, ParticipantInstance> {
/**
* Initialize the ParticipantPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ParticipantSolution);
/**
* Build an instance of ParticipantInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ParticipantResource): ParticipantInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,293 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParticipantPage = exports.ParticipantInstance = exports.ParticipantContextImpl = void 0;
exports.ParticipantListInstance = ParticipantListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class ParticipantContextImpl {
constructor(_version, roomSid, participantSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(roomSid)) {
throw new Error("Parameter 'roomSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(participantSid)) {
throw new Error("Parameter 'participantSid' is not valid.");
}
this._solution = { roomSid, participantSid };
this._uri = `/Video/Rooms/${roomSid}/Participants/${participantSid}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.roomSid, instance._solution.participantSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ParticipantInstance(operationVersion, response.body, instance._solution.roomSid, instance._solution.participantSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ParticipantContextImpl = ParticipantContextImpl;
class ParticipantInstance {
constructor(_version, payload, roomSid, participantSid) {
this._version = _version;
this.participantSid = payload.participant_sid;
this.participantIdentity = payload.participant_identity;
this.joinTime = deserialize.iso8601DateTime(payload.join_time);
this.leaveTime = deserialize.iso8601DateTime(payload.leave_time);
this.durationSec = payload.duration_sec;
this.accountSid = payload.account_sid;
this.roomSid = payload.room_sid;
this.status = payload.status;
this.codecs = payload.codecs;
this.endReason = payload.end_reason;
this.errorCode = deserialize.integer(payload.error_code);
this.errorCodeUrl = payload.error_code_url;
this.mediaRegion = payload.media_region;
this.properties = payload.properties;
this.edgeLocation = payload.edge_location;
this.publisherInfo = payload.publisher_info;
this.url = payload.url;
this._solution = {
roomSid,
participantSid: participantSid || this.participantSid,
};
}
get _proxy() {
this._context =
this._context ||
new ParticipantContextImpl(this._version, this._solution.roomSid, this._solution.participantSid);
return this._context;
}
/**
* Fetch a ParticipantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ParticipantInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ParticipantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ParticipantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
participantSid: this.participantSid,
participantIdentity: this.participantIdentity,
joinTime: this.joinTime,
leaveTime: this.leaveTime,
durationSec: this.durationSec,
accountSid: this.accountSid,
roomSid: this.roomSid,
status: this.status,
codecs: this.codecs,
endReason: this.endReason,
errorCode: this.errorCode,
errorCodeUrl: this.errorCodeUrl,
mediaRegion: this.mediaRegion,
properties: this.properties,
edgeLocation: this.edgeLocation,
publisherInfo: this.publisherInfo,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ParticipantInstance = ParticipantInstance;
function ParticipantListInstance(version, roomSid) {
if (!(0, utility_1.isValidPathParam)(roomSid)) {
throw new Error("Parameter 'roomSid' is not valid.");
}
const instance = ((participantSid) => instance.get(participantSid));
instance.get = function get(participantSid) {
return new ParticipantContextImpl(version, roomSid, participantSid);
};
instance._version = version;
instance._solution = { roomSid };
instance._uri = `/Video/Rooms/${roomSid}/Participants`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ParticipantPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ParticipantPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ParticipantPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ParticipantPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 ParticipantPage extends Page_1.default {
/**
* Initialize the ParticipantPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ParticipantInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ParticipantInstance(this._version, payload, this._solution.roomSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ParticipantPage = ParticipantPage;

240
node_modules/twilio/lib/rest/insights/v1/setting.d.ts generated vendored Normal file
View File

@@ -0,0 +1,240 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to fetch a SettingInstance
*/
export interface SettingContextFetchOptions {
/** The unique SID identifier of the Subaccount. */
subaccountSid?: string;
}
/**
* Options to pass to update a SettingInstance
*/
export interface SettingContextUpdateOptions {
/** A boolean flag to enable Advanced Features for Voice Insights. */
advancedFeatures?: boolean;
/** A boolean flag to enable Voice Trace. */
voiceTrace?: boolean;
/** The unique SID identifier of the Subaccount. */
subaccountSid?: string;
}
export interface SettingContext {
/**
* Fetch a SettingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
fetch(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Fetch a SettingInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
fetch(params: SettingContextFetchOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Fetch a SettingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Fetch a SettingInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
fetchWithHttpInfo(params: SettingContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Update a SettingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
update(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Update a SettingInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
update(params: SettingContextUpdateOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Update a SettingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Update a SettingInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
updateWithHttpInfo(params: SettingContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface SettingContextSolution {
}
export declare class SettingContextImpl implements SettingContext {
protected _version: V1;
protected _solution: SettingContextSolution;
protected _uri: string;
constructor(_version: V1);
fetch(params?: SettingContextFetchOptions | ((error: Error | null, item?: SettingInstance) => any), callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
fetchWithHttpInfo(params?: SettingContextFetchOptions | ((error: Error | null, item?: ApiResponse<SettingInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
update(params?: SettingContextUpdateOptions | ((error: Error | null, item?: SettingInstance) => any), callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
updateWithHttpInfo(params?: SettingContextUpdateOptions | ((error: Error | null, item?: ApiResponse<SettingInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SettingContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SettingResource {
account_sid: string;
advanced_features: boolean;
voice_trace: boolean;
url: string;
}
export declare class SettingInstance {
protected _version: V1;
protected _solution: SettingContextSolution;
protected _context?: SettingContext;
constructor(_version: V1, payload: SettingResource);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* A boolean flag indicating whether Advanced Features for Voice Insights are enabled.
*/
advancedFeatures: boolean;
/**
* A boolean flag indicating whether Voice Trace is enabled.
*/
voiceTrace: boolean;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a SettingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
fetch(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Fetch a SettingInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
fetch(params: SettingContextFetchOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Fetch a SettingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Fetch a SettingInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
fetchWithHttpInfo(params: SettingContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Update a SettingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
update(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Update a SettingInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance
*/
update(params: SettingContextUpdateOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>;
/**
* Update a SettingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Update a SettingInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SettingInstance with HTTP metadata
*/
updateWithHttpInfo(params: SettingContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SettingInstance>) => any): Promise<ApiResponse<SettingInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
advancedFeatures: boolean;
voiceTrace: boolean;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface SettingSolution {
}
export interface SettingListInstance {
_version: V1;
_solution: SettingSolution;
_uri: string;
(): SettingContext;
get(): SettingContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SettingListInstance(version: V1): SettingListInstance;
export {};

216
node_modules/twilio/lib/rest/insights/v1/setting.js generated vendored Normal file
View File

@@ -0,0 +1,216 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* 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.SettingInstance = exports.SettingContextImpl = void 0;
exports.SettingListInstance = SettingListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
class SettingContextImpl {
constructor(_version) {
this._version = _version;
this._solution = {};
this._uri = `/Voice/Settings`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["subaccountSid"] !== undefined)
data["SubaccountSid"] = params["subaccountSid"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new SettingInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["subaccountSid"] !== undefined)
data["SubaccountSid"] = params["subaccountSid"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new SettingInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["advancedFeatures"] !== undefined)
data["AdvancedFeatures"] = serialize.bool(params["advancedFeatures"]);
if (params["voiceTrace"] !== undefined)
data["VoiceTrace"] = serialize.bool(params["voiceTrace"]);
if (params["subaccountSid"] !== undefined)
data["SubaccountSid"] = params["subaccountSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new SettingInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["advancedFeatures"] !== undefined)
data["AdvancedFeatures"] = serialize.bool(params["advancedFeatures"]);
if (params["voiceTrace"] !== undefined)
data["VoiceTrace"] = serialize.bool(params["voiceTrace"]);
if (params["subaccountSid"] !== undefined)
data["SubaccountSid"] = params["subaccountSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new SettingInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SettingContextImpl = SettingContextImpl;
class SettingInstance {
constructor(_version, payload) {
this._version = _version;
this.accountSid = payload.account_sid;
this.advancedFeatures = payload.advanced_features;
this.voiceTrace = payload.voice_trace;
this.url = payload.url;
this._solution = {};
}
get _proxy() {
this._context = this._context || new SettingContextImpl(this._version);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
advancedFeatures: this.advancedFeatures,
voiceTrace: this.voiceTrace,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SettingInstance = SettingInstance;
function SettingListInstance(version) {
const instance = (() => instance.get());
instance.get = function get() {
return new SettingContextImpl(version);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
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;
}

436
node_modules/twilio/lib/rest/insights/v2/inbound.d.ts generated vendored Normal file
View File

@@ -0,0 +1,436 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class InsightsV2CreatePhoneNumbersReportRequest {
"timeRange"?: InsightsV2CreatePhoneNumbersReportRequestTimeRange;
"filters"?: Array<PhoneNumberReportFilter>;
/**
* The number of max available top Phone Numbers to generate.
*/
"size"?: number;
constructor(payload: any);
}
export declare class InsightsV2CreatePhoneNumbersReportRequestTimeRange {
/**
* Start time of the report
*/
"startTime"?: Date;
/**
* End time of the report
*/
"endTime"?: Date;
constructor(payload: any);
}
/**
* Percentage of calls made in each state.
*/
export declare class InsightsV2InboundPhoneNumberReportCallStatePercentage {
/**
* Percentage of completed inbound calls.
*/
"completed"?: number;
/**
* Percentage of failed inbound calls.
*/
"fail"?: number;
/**
* Percentage of busy inbound calls.
*/
"busy"?: number;
/**
* Percentage of no-answer inbound calls.
*/
"noanswer"?: number;
/**
* Percentage of canceled inbound calls.
*/
"canceled"?: number;
constructor(payload: any);
}
export declare class PhoneNumberReportFilter {
/**
* The name of the filter
*/
"key"?: string;
/**
* List of supported filter values for the field name
*/
"values"?: Array<string>;
constructor(payload: any);
}
export declare class ReportFilter {
/**
* The name of the filter \'call_state\', \'call_direction\', \'call_type\', \'twilio_regions\', \'caller_country_code\', \'callee_country_code\', \'silent\'
*/
"key"?: string;
/**
* List of supported filter values for the field name
*/
"values"?: Array<string>;
constructor(payload: any);
}
export declare class ReportMetadata {
/**
* Start time of the report
*/
"startTime"?: Date;
/**
* End time of the report
*/
"endTime"?: Date;
/**
* Filter values applied to the report
*/
"filters"?: Array<ReportFilter>;
constructor(payload: any);
}
/**
* The status of the report.
*/
export type ReportStatus = "created" | "running" | "completed";
/**
* Options to pass to create a InboundInstance
*/
export interface InboundContextCreateOptions {
/** */
insightsV2CreatePhoneNumbersReportRequest?: InsightsV2CreatePhoneNumbersReportRequest;
}
/**
* Options to pass to each
*/
export interface InboundListInstanceEachOptions {
/** How many resources to return in each list page. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: InboundInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface InboundListInstanceOptions {
/** How many resources to return in each list page. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface InboundListInstancePageOptions {
/** How many resources to return in each list page. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface InboundContext {
/**
* Create a InboundInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance
*/
create(callback?: (error: Error | null, item?: InboundInstance) => any): Promise<InboundInstance>;
/**
* Create a InboundInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance
*/
create(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: InboundInstance) => any): Promise<InboundInstance>;
/**
* Create a InboundInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InboundInstance>) => any): Promise<ApiResponse<InboundInstance>>;
/**
* Create a InboundInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance with HTTP metadata
*/
createWithHttpInfo(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<InboundInstance>) => any): Promise<ApiResponse<InboundInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface InboundContextSolution {
reportId: string;
}
export declare class InboundContextImpl implements InboundContext {
protected _version: V2;
protected _solution: InboundContextSolution;
protected _uri: string;
constructor(_version: V2, reportId: string);
create(params?: InsightsV2CreatePhoneNumbersReportRequest | ((error: Error | null, item?: InboundInstance) => any), headers?: any, callback?: (error: Error | null, item?: InboundInstance) => any): Promise<InboundInstance>;
createWithHttpInfo(params?: InsightsV2CreatePhoneNumbersReportRequest | ((error: Error | null, item?: ApiResponse<InboundInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<InboundInstance>) => any): Promise<ApiResponse<InboundInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): InboundContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface InboundPayload extends TwilioResponsePayload {
reports: InboundResource[];
}
interface InboundResource {
account_sid: string;
report_id: string;
status: ReportStatus;
request_meta: ReportMetadata;
url: string;
handle: string;
total_calls: number;
call_answer_score: number;
call_state_percentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
silent_calls_percentage: number;
}
export declare class InboundInstance {
protected _version: V2;
protected _solution: InboundContextSolution;
protected _context?: InboundContext;
constructor(_version: V2, payload: InboundResource, reportId?: string);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* The report identifier as Voice Insights Report TTID.
*/
reportId: string;
status: ReportStatus;
requestMeta: ReportMetadata;
/**
* The URL of this resource.
*/
url: string;
/**
* Inbound phone number handle represented in the report.
*/
handle: string;
/**
* Total number of calls made with the given handle during the report period.
*/
totalCalls: number;
/**
* The call answer score measures customers behavior to the delivered calls. The score is a value between 0 and 100, where 100 indicates that all calls were successfully answered.
*/
callAnswerScore: number;
callStatePercentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
/**
* Percentage of inbound calls with silence tags over total outbound calls. A silent tag is indicative of a connectivity issue or muted audio.
*/
silentCallsPercentage: number;
private get _proxy();
/**
* Create a InboundInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance
*/
create(callback?: (error: Error | null, item?: InboundInstance) => any): Promise<InboundInstance>;
/**
* Create a InboundInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance
*/
create(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: InboundInstance) => any): Promise<InboundInstance>;
/**
* Create a InboundInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InboundInstance>) => any): Promise<ApiResponse<InboundInstance>>;
/**
* Create a InboundInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InboundInstance with HTTP metadata
*/
createWithHttpInfo(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<InboundInstance>) => any): Promise<ApiResponse<InboundInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
reportId: string;
status: ReportStatus;
requestMeta: ReportMetadata;
url: string;
handle: string;
totalCalls: number;
callAnswerScore: number;
callStatePercentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
silentCallsPercentage: number;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface InboundSolution {
reportId: string;
}
export interface InboundListInstance {
_version: V2;
_solution: InboundSolution;
_uri: string;
(reportId: string): InboundContext;
get(reportId: string): InboundContext;
/**
* Streams InboundInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InboundListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: InboundInstance, done: (err?: Error) => void) => void): void;
each(params: InboundListInstanceEachOptions, callback?: (item: InboundInstance, done: (err?: Error) => void) => void): void;
/**
* Streams InboundInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InboundListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: InboundInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: InboundListInstanceEachOptions, callback?: (item: InboundInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of InboundInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: InboundPage) => any): Promise<InboundPage>;
/**
* Retrieve a single target page of InboundInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<InboundPage>) => any): Promise<ApiResponse<InboundPage>>;
/**
* Lists InboundInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InboundListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: InboundInstance[]) => any): Promise<InboundInstance[]>;
list(params: InboundListInstanceOptions, callback?: (error: Error | null, items: InboundInstance[]) => any): Promise<InboundInstance[]>;
/**
* Lists InboundInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InboundListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<InboundInstance[]>) => any): Promise<ApiResponse<InboundInstance[]>>;
listWithHttpInfo(params: InboundListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<InboundInstance[]>) => any): Promise<ApiResponse<InboundInstance[]>>;
/**
* Retrieve a single page of InboundInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InboundListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: InboundPage) => any): Promise<InboundPage>;
page(params: InboundListInstancePageOptions, callback?: (error: Error | null, items: InboundPage) => any): Promise<InboundPage>;
/**
* Retrieve a single page of InboundInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InboundListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<InboundPage>) => any): Promise<ApiResponse<InboundPage>>;
pageWithHttpInfo(params: InboundListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<InboundPage>) => any): Promise<ApiResponse<InboundPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function InboundListInstance(version: V2, reportId: string): InboundListInstance;
export declare class InboundPage extends Page<V2, InboundPayload, InboundResource, InboundInstance> {
/**
* Initialize the InboundPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: InboundSolution);
/**
* Build an instance of InboundInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: InboundResource): InboundInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

342
node_modules/twilio/lib/rest/insights/v2/inbound.js generated vendored Normal file
View File

@@ -0,0 +1,342 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Sample/reference Twilio API.
* This is the reference API for the rest-proxy server.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InboundPage = exports.InboundInstance = exports.InboundContextImpl = exports.ReportMetadata = exports.ReportFilter = exports.PhoneNumberReportFilter = exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = exports.InsightsV2CreatePhoneNumbersReportRequest = void 0;
exports.InboundListInstance = InboundListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class InsightsV2CreatePhoneNumbersReportRequest {
constructor(payload) {
this.timeRange = payload["time_range"];
this.filters = payload["filters"];
this.size = payload["size"];
}
}
exports.InsightsV2CreatePhoneNumbersReportRequest = InsightsV2CreatePhoneNumbersReportRequest;
class InsightsV2CreatePhoneNumbersReportRequestTimeRange {
constructor(payload) {
this.startTime = payload["start_time"];
this.endTime = payload["end_time"];
}
}
exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = InsightsV2CreatePhoneNumbersReportRequestTimeRange;
/**
* Percentage of calls made in each state.
*/
class InsightsV2InboundPhoneNumberReportCallStatePercentage {
constructor(payload) {
this.completed = payload["completed"];
this.fail = payload["fail"];
this.busy = payload["busy"];
this.noanswer = payload["noanswer"];
this.canceled = payload["canceled"];
}
}
exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = InsightsV2InboundPhoneNumberReportCallStatePercentage;
class PhoneNumberReportFilter {
constructor(payload) {
this.key = payload["key"];
this.values = payload["values"];
}
}
exports.PhoneNumberReportFilter = PhoneNumberReportFilter;
class ReportFilter {
constructor(payload) {
this.key = payload["key"];
this.values = payload["values"];
}
}
exports.ReportFilter = ReportFilter;
class ReportMetadata {
constructor(payload) {
this.startTime = payload["start_time"];
this.endTime = payload["end_time"];
this.filters = payload["filters"];
}
}
exports.ReportMetadata = ReportMetadata;
class InboundContextImpl {
constructor(_version, reportId) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(reportId)) {
throw new Error("Parameter 'reportId' is not valid.");
}
this._solution = { reportId };
this._uri = `/Voice/Reports/PhoneNumbers/Inbound`;
}
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";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new InboundInstance(operationVersion, payload, instance._solution.reportId));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
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";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new InboundInstance(operationVersion, response.body, instance._solution.reportId),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InboundContextImpl = InboundContextImpl;
class InboundInstance {
constructor(_version, payload, reportId) {
this._version = _version;
this.accountSid = payload.account_sid;
this.reportId = payload.report_id;
this.status = payload.status;
this.requestMeta =
payload.request_meta !== null && payload.request_meta !== undefined
? new ReportMetadata(payload.request_meta)
: null;
this.url = payload.url;
this.handle = payload.handle;
this.totalCalls = deserialize.integer(payload.total_calls);
this.callAnswerScore = payload.call_answer_score;
this.callStatePercentage =
payload.call_state_percentage !== null &&
payload.call_state_percentage !== undefined
? new InsightsV2InboundPhoneNumberReportCallStatePercentage(payload.call_state_percentage)
: null;
this.silentCallsPercentage = payload.silent_calls_percentage;
this._solution = { reportId: reportId || this.reportId };
}
get _proxy() {
this._context =
this._context ||
new InboundContextImpl(this._version, this._solution.reportId);
return this._context;
}
create(params, callback) {
return this._proxy.create(params, callback);
}
createWithHttpInfo(params, callback) {
return this._proxy.createWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
reportId: this.reportId,
status: this.status,
requestMeta: this.requestMeta,
url: this.url,
handle: this.handle,
totalCalls: this.totalCalls,
callAnswerScore: this.callAnswerScore,
callStatePercentage: this.callStatePercentage,
silentCallsPercentage: this.silentCallsPercentage,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InboundInstance = InboundInstance;
function InboundListInstance(version, reportId) {
if (!(0, utility_1.isValidPathParam)(reportId)) {
throw new Error("Parameter 'reportId' is not valid.");
}
const instance = ((reportId) => instance.get(reportId));
instance.get = function get(reportId) {
return new InboundContextImpl(version, reportId);
};
instance._version = version;
instance._solution = { reportId };
instance._uri = `/Voice/Reports/PhoneNumbers/Inbound/${reportId}`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new InboundPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new InboundPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new InboundPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new InboundPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 InboundPage extends Page_1.default {
/**
* Initialize the InboundPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of InboundInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new InboundInstance(this._version, payload, this._solution.reportId);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InboundPage = InboundPage;

529
node_modules/twilio/lib/rest/insights/v2/outbound.d.ts generated vendored Normal file
View File

@@ -0,0 +1,529 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class CountyCarrierValue {
"country"?: string;
"carriers"?: Array<CountyCarrierValueCarriers>;
constructor(payload: any);
}
export declare class CountyCarrierValueCarriers {
/**
* The name of the carrier.
*/
"carrier"?: string;
/**
* Total number of outbound calls for the carrier in the country.
*/
"totalCalls"?: number;
/**
* Total number of blocked outbound calls for the carrier in the country.
*/
"blockedCalls"?: number;
/**
* Percentage of blocked outbound calls for the carrier in the country.
*/
"blockedCallsPercentage"?: number;
constructor(payload: any);
}
export declare class InsightsV2CreatePhoneNumbersReportRequest {
"timeRange"?: InsightsV2CreatePhoneNumbersReportRequestTimeRange;
"filters"?: Array<PhoneNumberReportFilter>;
/**
* The number of max available top Phone Numbers to generate.
*/
"size"?: number;
constructor(payload: any);
}
export declare class InsightsV2CreatePhoneNumbersReportRequestTimeRange {
/**
* Start time of the report
*/
"startTime"?: Date;
/**
* End time of the report
*/
"endTime"?: Date;
constructor(payload: any);
}
/**
* Percentage of calls made in each state.
*/
export declare class InsightsV2InboundPhoneNumberReportCallStatePercentage {
/**
* Percentage of completed inbound calls.
*/
"completed"?: number;
/**
* Percentage of failed inbound calls.
*/
"fail"?: number;
/**
* Percentage of busy inbound calls.
*/
"busy"?: number;
/**
* Percentage of no-answer inbound calls.
*/
"noanswer"?: number;
/**
* Percentage of canceled inbound calls.
*/
"canceled"?: number;
constructor(payload: any);
}
/**
* Number of calls made in answering machine detection (AMD) enabled.
*/
export declare class InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection {
/**
* Total number of calls with answering machine detection (AMD) enabled.
*/
"totalCalls"?: number;
/**
* Percentage of calls marked as answered by human.
*/
"answeredByHumanPercentage"?: number;
/**
* Percentage of calls marked as answered by machined related like the following: `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `fax`
*/
"answeredByMachinePercentage"?: number;
constructor(payload: any);
}
export declare class PhoneNumberReportFilter {
/**
* The name of the filter
*/
"key"?: string;
/**
* List of supported filter values for the field name
*/
"values"?: Array<string>;
constructor(payload: any);
}
export declare class ReportFilter {
/**
* The name of the filter \'call_state\', \'call_direction\', \'call_type\', \'twilio_regions\', \'caller_country_code\', \'callee_country_code\', \'silent\'
*/
"key"?: string;
/**
* List of supported filter values for the field name
*/
"values"?: Array<string>;
constructor(payload: any);
}
export declare class ReportMetadata {
/**
* Start time of the report
*/
"startTime"?: Date;
/**
* End time of the report
*/
"endTime"?: Date;
/**
* Filter values applied to the report
*/
"filters"?: Array<ReportFilter>;
constructor(payload: any);
}
/**
* The status of the report.
*/
export type ReportStatus = "created" | "running" | "completed";
/**
* Options to pass to create a OutboundInstance
*/
export interface OutboundContextCreateOptions {
/** */
insightsV2CreatePhoneNumbersReportRequest?: InsightsV2CreatePhoneNumbersReportRequest;
}
/**
* Options to pass to each
*/
export interface OutboundListInstanceEachOptions {
/** How many resources to return in each list page. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: OutboundInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface OutboundListInstanceOptions {
/** How many resources to return in each list page. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface OutboundListInstancePageOptions {
/** How many resources to return in each list page. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface OutboundContext {
/**
* Create a OutboundInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance
*/
create(callback?: (error: Error | null, item?: OutboundInstance) => any): Promise<OutboundInstance>;
/**
* Create a OutboundInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance
*/
create(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: OutboundInstance) => any): Promise<OutboundInstance>;
/**
* Create a OutboundInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OutboundInstance>) => any): Promise<ApiResponse<OutboundInstance>>;
/**
* Create a OutboundInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance with HTTP metadata
*/
createWithHttpInfo(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<OutboundInstance>) => any): Promise<ApiResponse<OutboundInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface OutboundContextSolution {
reportId: string;
}
export declare class OutboundContextImpl implements OutboundContext {
protected _version: V2;
protected _solution: OutboundContextSolution;
protected _uri: string;
constructor(_version: V2, reportId: string);
create(params?: InsightsV2CreatePhoneNumbersReportRequest | ((error: Error | null, item?: OutboundInstance) => any), headers?: any, callback?: (error: Error | null, item?: OutboundInstance) => any): Promise<OutboundInstance>;
createWithHttpInfo(params?: InsightsV2CreatePhoneNumbersReportRequest | ((error: Error | null, item?: ApiResponse<OutboundInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<OutboundInstance>) => any): Promise<ApiResponse<OutboundInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): OutboundContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface OutboundPayload extends TwilioResponsePayload {
reports: OutboundResource[];
}
interface OutboundResource {
account_sid: string;
report_id: string;
status: ReportStatus;
request_meta: ReportMetadata;
url: string;
handle: string;
total_calls: number;
call_answer_score: number;
call_state_percentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
silent_calls_percentage: number;
calls_by_device_type: {
[key: string]: number;
};
answer_rate_device_type: {
[key: string]: number;
};
blocked_calls_by_carrier: Array<CountyCarrierValue>;
short_duration_calls_percentage: number;
long_duration_calls_percentage: number;
potential_robocalls_percentage: number;
answering_machine_detection: InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
}
export declare class OutboundInstance {
protected _version: V2;
protected _solution: OutboundContextSolution;
protected _context?: OutboundContext;
constructor(_version: V2, payload: OutboundResource, reportId?: string);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* The report identifier as Voice Insights Report TTID.
*/
reportId: string;
status: ReportStatus;
requestMeta: ReportMetadata;
/**
* The URL of this resource.
*/
url: string;
/**
* Inbound phone number handle represented in the report.
*/
handle: string;
/**
* Total number of calls made with the given handle during the report period.
*/
totalCalls: number;
/**
* The call answer score measures customers behavior to the delivered calls. The score is a value between 0 and 100, where 100 indicates that all calls were successfully answered.
*/
callAnswerScore: number;
callStatePercentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
/**
* Percentage of inbound calls with silence tags over total outbound calls. A silent tag is indicative of a connectivity issue or muted audio.
*/
silentCallsPercentage: number;
/**
* Number of calls made with each device type. `voip`, `mobile`, `landline`, `unknown`
*/
callsByDeviceType: {
[key: string]: number;
};
/**
* Answer rate for each device type. `voip`, `mobile`, `landline`, `unknown`
*/
answerRateDeviceType: {
[key: string]: number;
};
/**
* Percentage of blocked calls by carrier per country.
*/
blockedCallsByCarrier: Array<CountyCarrierValue>;
/**
* Percentage of completed outbound calls under 10 seconds (PSTN Short call tags); More than 15% is typically low trust measured.
*/
shortDurationCallsPercentage: number;
/**
* Percentage of long duration calls ( >= 60 seconds)
*/
longDurationCallsPercentage: number;
/**
* Percentage of completed outbound calls to unassigned or unallocated phone numbers.
*/
potentialRobocallsPercentage: number;
answeringMachineDetection: InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
private get _proxy();
/**
* Create a OutboundInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance
*/
create(callback?: (error: Error | null, item?: OutboundInstance) => any): Promise<OutboundInstance>;
/**
* Create a OutboundInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance
*/
create(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: OutboundInstance) => any): Promise<OutboundInstance>;
/**
* Create a OutboundInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OutboundInstance>) => any): Promise<ApiResponse<OutboundInstance>>;
/**
* Create a OutboundInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OutboundInstance with HTTP metadata
*/
createWithHttpInfo(params: InsightsV2CreatePhoneNumbersReportRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<OutboundInstance>) => any): Promise<ApiResponse<OutboundInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
reportId: string;
status: ReportStatus;
requestMeta: ReportMetadata;
url: string;
handle: string;
totalCalls: number;
callAnswerScore: number;
callStatePercentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
silentCallsPercentage: number;
callsByDeviceType: {
[key: string]: number;
};
answerRateDeviceType: {
[key: string]: number;
};
blockedCallsByCarrier: CountyCarrierValue[];
shortDurationCallsPercentage: number;
longDurationCallsPercentage: number;
potentialRobocallsPercentage: number;
answeringMachineDetection: InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface OutboundSolution {
reportId: string;
}
export interface OutboundListInstance {
_version: V2;
_solution: OutboundSolution;
_uri: string;
(reportId: string): OutboundContext;
get(reportId: string): OutboundContext;
/**
* Streams OutboundInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { OutboundListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: OutboundInstance, done: (err?: Error) => void) => void): void;
each(params: OutboundListInstanceEachOptions, callback?: (item: OutboundInstance, done: (err?: Error) => void) => void): void;
/**
* Streams OutboundInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { OutboundListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: OutboundInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: OutboundListInstanceEachOptions, callback?: (item: OutboundInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of OutboundInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: OutboundPage) => any): Promise<OutboundPage>;
/**
* Retrieve a single target page of OutboundInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<OutboundPage>) => any): Promise<ApiResponse<OutboundPage>>;
/**
* Lists OutboundInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { OutboundListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: OutboundInstance[]) => any): Promise<OutboundInstance[]>;
list(params: OutboundListInstanceOptions, callback?: (error: Error | null, items: OutboundInstance[]) => any): Promise<OutboundInstance[]>;
/**
* Lists OutboundInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { OutboundListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OutboundInstance[]>) => any): Promise<ApiResponse<OutboundInstance[]>>;
listWithHttpInfo(params: OutboundListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<OutboundInstance[]>) => any): Promise<ApiResponse<OutboundInstance[]>>;
/**
* Retrieve a single page of OutboundInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { OutboundListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: OutboundPage) => any): Promise<OutboundPage>;
page(params: OutboundListInstancePageOptions, callback?: (error: Error | null, items: OutboundPage) => any): Promise<OutboundPage>;
/**
* Retrieve a single page of OutboundInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { OutboundListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OutboundPage>) => any): Promise<ApiResponse<OutboundPage>>;
pageWithHttpInfo(params: OutboundListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<OutboundPage>) => any): Promise<ApiResponse<OutboundPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function OutboundListInstance(version: V2, reportId: string): OutboundListInstance;
export declare class OutboundPage extends Page<V2, OutboundPayload, OutboundResource, OutboundInstance> {
/**
* Initialize the OutboundPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: OutboundSolution);
/**
* Build an instance of OutboundInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: OutboundResource): OutboundInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

392
node_modules/twilio/lib/rest/insights/v2/outbound.js generated vendored Normal file
View File

@@ -0,0 +1,392 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Sample/reference Twilio API.
* This is the reference API for the rest-proxy server.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OutboundPage = exports.OutboundInstance = exports.OutboundContextImpl = exports.ReportMetadata = exports.ReportFilter = exports.PhoneNumberReportFilter = exports.InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection = exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = exports.InsightsV2CreatePhoneNumbersReportRequest = exports.CountyCarrierValueCarriers = exports.CountyCarrierValue = void 0;
exports.OutboundListInstance = OutboundListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class CountyCarrierValue {
constructor(payload) {
this.country = payload["country"];
this.carriers = payload["carriers"];
}
}
exports.CountyCarrierValue = CountyCarrierValue;
class CountyCarrierValueCarriers {
constructor(payload) {
this.carrier = payload["carrier"];
this.totalCalls = payload["total_calls"];
this.blockedCalls = payload["blocked_calls"];
this.blockedCallsPercentage = payload["blocked_calls_percentage"];
}
}
exports.CountyCarrierValueCarriers = CountyCarrierValueCarriers;
class InsightsV2CreatePhoneNumbersReportRequest {
constructor(payload) {
this.timeRange = payload["time_range"];
this.filters = payload["filters"];
this.size = payload["size"];
}
}
exports.InsightsV2CreatePhoneNumbersReportRequest = InsightsV2CreatePhoneNumbersReportRequest;
class InsightsV2CreatePhoneNumbersReportRequestTimeRange {
constructor(payload) {
this.startTime = payload["start_time"];
this.endTime = payload["end_time"];
}
}
exports.InsightsV2CreatePhoneNumbersReportRequestTimeRange = InsightsV2CreatePhoneNumbersReportRequestTimeRange;
/**
* Percentage of calls made in each state.
*/
class InsightsV2InboundPhoneNumberReportCallStatePercentage {
constructor(payload) {
this.completed = payload["completed"];
this.fail = payload["fail"];
this.busy = payload["busy"];
this.noanswer = payload["noanswer"];
this.canceled = payload["canceled"];
}
}
exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = InsightsV2InboundPhoneNumberReportCallStatePercentage;
/**
* Number of calls made in answering machine detection (AMD) enabled.
*/
class InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection {
constructor(payload) {
this.totalCalls = payload["total_calls"];
this.answeredByHumanPercentage = payload["answered_by_human_percentage"];
this.answeredByMachinePercentage =
payload["answered_by_machine_percentage"];
}
}
exports.InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection = InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
class PhoneNumberReportFilter {
constructor(payload) {
this.key = payload["key"];
this.values = payload["values"];
}
}
exports.PhoneNumberReportFilter = PhoneNumberReportFilter;
class ReportFilter {
constructor(payload) {
this.key = payload["key"];
this.values = payload["values"];
}
}
exports.ReportFilter = ReportFilter;
class ReportMetadata {
constructor(payload) {
this.startTime = payload["start_time"];
this.endTime = payload["end_time"];
this.filters = payload["filters"];
}
}
exports.ReportMetadata = ReportMetadata;
class OutboundContextImpl {
constructor(_version, reportId) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(reportId)) {
throw new Error("Parameter 'reportId' is not valid.");
}
this._solution = { reportId };
this._uri = `/Voice/Reports/PhoneNumbers/Outbound`;
}
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";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new OutboundInstance(operationVersion, payload, instance._solution.reportId));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
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";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new OutboundInstance(operationVersion, response.body, instance._solution.reportId),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OutboundContextImpl = OutboundContextImpl;
class OutboundInstance {
constructor(_version, payload, reportId) {
this._version = _version;
this.accountSid = payload.account_sid;
this.reportId = payload.report_id;
this.status = payload.status;
this.requestMeta =
payload.request_meta !== null && payload.request_meta !== undefined
? new ReportMetadata(payload.request_meta)
: null;
this.url = payload.url;
this.handle = payload.handle;
this.totalCalls = deserialize.integer(payload.total_calls);
this.callAnswerScore = payload.call_answer_score;
this.callStatePercentage =
payload.call_state_percentage !== null &&
payload.call_state_percentage !== undefined
? new InsightsV2InboundPhoneNumberReportCallStatePercentage(payload.call_state_percentage)
: null;
this.silentCallsPercentage = payload.silent_calls_percentage;
this.callsByDeviceType = payload.calls_by_device_type;
this.answerRateDeviceType = payload.answer_rate_device_type;
this.blockedCallsByCarrier =
payload.blocked_calls_by_carrier !== null &&
payload.blocked_calls_by_carrier !== undefined
? payload.blocked_calls_by_carrier.map((payload) => new CountyCarrierValue(payload))
: null;
this.shortDurationCallsPercentage = payload.short_duration_calls_percentage;
this.longDurationCallsPercentage = payload.long_duration_calls_percentage;
this.potentialRobocallsPercentage = payload.potential_robocalls_percentage;
this.answeringMachineDetection =
payload.answering_machine_detection !== null &&
payload.answering_machine_detection !== undefined
? new InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection(payload.answering_machine_detection)
: null;
this._solution = { reportId: reportId || this.reportId };
}
get _proxy() {
this._context =
this._context ||
new OutboundContextImpl(this._version, this._solution.reportId);
return this._context;
}
create(params, callback) {
return this._proxy.create(params, callback);
}
createWithHttpInfo(params, callback) {
return this._proxy.createWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
reportId: this.reportId,
status: this.status,
requestMeta: this.requestMeta,
url: this.url,
handle: this.handle,
totalCalls: this.totalCalls,
callAnswerScore: this.callAnswerScore,
callStatePercentage: this.callStatePercentage,
silentCallsPercentage: this.silentCallsPercentage,
callsByDeviceType: this.callsByDeviceType,
answerRateDeviceType: this.answerRateDeviceType,
blockedCallsByCarrier: this.blockedCallsByCarrier,
shortDurationCallsPercentage: this.shortDurationCallsPercentage,
longDurationCallsPercentage: this.longDurationCallsPercentage,
potentialRobocallsPercentage: this.potentialRobocallsPercentage,
answeringMachineDetection: this.answeringMachineDetection,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OutboundInstance = OutboundInstance;
function OutboundListInstance(version, reportId) {
if (!(0, utility_1.isValidPathParam)(reportId)) {
throw new Error("Parameter 'reportId' is not valid.");
}
const instance = ((reportId) => instance.get(reportId));
instance.get = function get(reportId) {
return new OutboundContextImpl(version, reportId);
};
instance._version = version;
instance._solution = { reportId };
instance._uri = `/Voice/Reports/PhoneNumbers/Outbound/${reportId}`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new OutboundPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new OutboundPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new OutboundPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new OutboundPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
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 OutboundPage extends Page_1.default {
/**
* Initialize the OutboundPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of OutboundInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new OutboundInstance(this._version, payload, this._solution.reportId);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OutboundPage = OutboundPage;

783
node_modules/twilio/lib/rest/insights/v2/report.d.ts generated vendored Normal file
View File

@@ -0,0 +1,783 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class AccountReport {
/**
* The call deliverability score measures the network effectiveness in delivering calls by scoring calls reach the intended recipient. The score is a value between 0 and 100, where 100 indicates that all calls were successfully delivered.
*/
"callDeliverabilityScore"?: number;
/**
* The call answer score measures customers behavior to the delivered calls. The score is a value between 0 and 100, where 100 indicates that all calls were successfully answered.
*/
"callAnswerScore"?: number;
/**
* Total number of calls made during the report period.
*/
"totalCalls"?: number;
"callDirection"?: AccountReportCallDirection;
"callState"?: AccountReportCallState;
"callType"?: AccountReportCallType;
/**
* Average length of call in seconds.
*/
"aloc"?: number;
/**
* Number of calls made in each Twilio Edge location. Refer to [Public Edge Locations](https://www.twilio.com/docs/global-infrastructure/edge-locations#public-edge-locations) for more detail.
*/
"twilioEdgeLocation"?: {
[key: string]: number;
};
/**
* Number of calls originating from each country (ISO alpha-2).
*/
"callerCountryCode"?: {
[key: string]: number;
};
/**
* Number of calls terminating in each country (ISO alpha-2).
*/
"calleeCountryCode"?: {
[key: string]: number;
};
/**
* Average queue time in milliseconds.
*/
"averageQueueTimeMs"?: number;
/**
* Percentage of silent calls.
*/
"silentCallsPercentage"?: number;
"networkIssues"?: AccountReportNetworkIssues;
"kYT"?: AccountReportKYT;
"answeringMachineDetection"?: AccountReportAnsweringMachineDetection;
constructor(payload: any);
}
/**
* Number of calls made in each answering machine detection.
*/
export declare class AccountReportAnsweringMachineDetection {
/**
* Total number of calls with answering machine detection enabled (AMD).
*/
"totalCalls"?: number;
/**
* Percentage of calls marked as answered by human.
*/
"answeredByHumanPercentage"?: number;
/**
* Percentage of calls marked as answered by machined related like the following: `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `fax`
*/
"answeredByMachinePercentage"?: number;
constructor(payload: any);
}
/**
* Number of calls made in each direction.
*/
export declare class AccountReportCallDirection {
/**
* Number of outbound calls
*/
"outbound"?: number;
/**
* Number of inbound calls
*/
"inbound"?: number;
constructor(payload: any);
}
/**
* Number of calls made in each state.
*/
export declare class AccountReportCallState {
/**
* Number of completed calls
*/
"completed"?: number;
/**
* Number of failed calls
*/
"fail"?: number;
/**
* Number of busy calls
*/
"busy"?: number;
/**
* Number of no-answer calls
*/
"noanswer"?: number;
/**
* Number of canceled calls
*/
"canceled"?: number;
constructor(payload: any);
}
/**
* Number of calls made in each type. `carrier`, `sip`, `trunking`, `client`, `whatsapp`
*/
export declare class AccountReportCallType {
/**
* Number of carrier calls
*/
"carrier"?: number;
/**
* Number of SIP calls
*/
"sip"?: number;
/**
* Number of trunking calls
*/
"trunking"?: number;
/**
* Number of client calls
*/
"client"?: number;
/**
* Number of WhatsApp Business calls
*/
"whatsapp"?: number;
constructor(payload: any);
}
/**
* Know Your Traffic (KYT) metrics focused on outbound carrier performance and trust signals for the report period.
*/
export declare class AccountReportKYT {
"outboundCarrierCalling"?: AccountReportKYTOutboundCarrierCalling;
constructor(payload: any);
}
/**
* KYT metrics for outbound carrier calling.
*/
export declare class AccountReportKYTOutboundCarrierCalling {
/**
* Number of unique PSTN calling numbers to non-Twilio numbers during the report period.
*/
"uniqueCallingNumbers"?: number;
/**
* Number of unique non-Twilio PSTN called numbers during the report period.
*/
"uniqueCalledNumbers"?: number;
/**
* Percentage of blocked calls by carrier per country.
*/
"blockedCallsByCarrier"?: Array<CountyCarrierValue>;
/**
* Percentage of completed outbound calls under 10 seconds (PSTN Short call tags); More than 15% is typically low trust measured.
*/
"shortDurationCallsPercentage"?: number;
/**
* Percentage of long duration calls ( >= 60 seconds)
*/
"longDurationCallsPercentage"?: number;
/**
* Percentage of completed outbound calls to unassigned or unallocated phone numbers.
*/
"potentialRobocallsPercentage"?: number;
"brandedCalling"?: BrandedCalling;
"voiceIntegrity"?: VoiceIntegrity;
"stirShaken"?: StirShaken;
constructor(payload: any);
}
/**
* Network-quality indicators for SDK and Twilio Gateway traffic during the report period.
*/
export declare class AccountReportNetworkIssues {
"sdk"?: AccountReportNetworkIssuesSdk;
"twilioGateway"?: AccountReportNetworkIssuesTwilioGateway;
constructor(payload: any);
}
/**
* Network issues of calls for client type. This is indicative of local network issues.
*/
export declare class AccountReportNetworkIssuesSdk {
/**
* Percentage of ICE connection failure tag that ICE candidates have failed to find compatible connection.
*/
"iceFailuresPercentage"?: number;
/**
* Percentage of calls with high latency.
*/
"highLatencyPercentage"?: number;
/**
* Percentage of calls with high packet loss.
*/
"highPacketLossPercentage"?: number;
/**
* Percentage of calls with high jitter.
*/
"highJitterPercentage"?: number;
constructor(payload: any);
}
/**
* Network related metrics for Twilio Gateway calls only.
*/
export declare class AccountReportNetworkIssuesTwilioGateway {
/**
* Percentage of calls with high latency.
*/
"highLatencyPercentage"?: number;
/**
* Percentage of calls with high packet loss.
*/
"highPacketLossPercentage"?: number;
/**
* Percentage of calls with high jitter.
*/
"highJitterPercentage"?: number;
constructor(payload: any);
}
/**
* Metrics related to Branded Calling bundled calls including CTIA for the report period.
*/
export declare class BrandedCalling {
/**
* Total number of Branded bundled calls.
*/
"totalBrandedCalls"?: number;
/**
* Percentage of Branded bundled calls over total outbound calls.
*/
"percentBrandedCalls"?: number;
/**
* Answer rate for Branded bundled calls.
*/
"answerRate"?: number;
/**
* Rate of Branded bundled calls that were answered by Human.
*/
"humanAnswerRate"?: number;
/**
* Engagement Rate for Branded bundled calls where its call length is longer than 60 seconds.
*/
"engagementRate"?: number;
/**
* Details of branded calls by use case.
*/
"byUseCase"?: Array<BrandedUseCaseDetail>;
constructor(payload: any);
}
/**
* Associated metrics for Branded calls grouped by each use case.
*/
export declare class BrandedUseCaseDetail {
/**
* The name of supported use case for Branded calls.
*/
"useCase"?: string;
/**
* The number of phone numbers enabled Branded calls.
*/
"enabledPhonenumbers"?: number;
/**
* The number of total outbound calls for the use case.
*/
"totalCalls"?: number;
/**
* Answer rate per each use case for Branded bundled calls.
*/
"answerRate"?: number;
/**
* Rate of Branded bundled calls that were answered by Human per each use case for Branded bundled calls.
*/
"humanAnswerRate"?: number;
/**
* Engagement Rate for Branded bundled calls where its call length is longer than 60 seconds per each use case for Branded bundled calls.
*/
"engagementRate"?: number;
constructor(payload: any);
}
export declare class CountyCarrierValue {
"country"?: string;
"carriers"?: Array<CountyCarrierValueCarriers>;
constructor(payload: any);
}
export declare class CountyCarrierValueCarriers {
/**
* The name of the carrier.
*/
"carrier"?: string;
/**
* Total number of outbound calls for the carrier in the country.
*/
"totalCalls"?: number;
/**
* Total number of blocked outbound calls for the carrier in the country.
*/
"blockedCalls"?: number;
/**
* Percentage of blocked outbound calls for the carrier in the country.
*/
"blockedCallsPercentage"?: number;
constructor(payload: any);
}
export declare class InsightsV2CreateAccountReportRequest {
"timeRange"?: InsightsV2CreateAccountReportRequestTimeRange;
"filters"?: Array<ReportFilter>;
constructor(payload: any);
}
/**
* Optional start and end date time for the report window. Defaults to the most recent 7 days when omitted.
*/
export declare class InsightsV2CreateAccountReportRequestTimeRange {
/**
* Start time of the report
*/
"startTime"?: Date;
/**
* End time of the report
*/
"endTime"?: Date;
constructor(payload: any);
}
/**
* Percentage of calls made in each state.
*/
export declare class InsightsV2InboundPhoneNumberReportCallStatePercentage {
/**
* Percentage of completed inbound calls.
*/
"completed"?: number;
/**
* Percentage of failed inbound calls.
*/
"fail"?: number;
/**
* Percentage of busy inbound calls.
*/
"busy"?: number;
/**
* Percentage of no-answer inbound calls.
*/
"noanswer"?: number;
/**
* Percentage of canceled inbound calls.
*/
"canceled"?: number;
constructor(payload: any);
}
/**
* Number of calls made in answering machine detection (AMD) enabled.
*/
export declare class InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection {
/**
* Total number of calls with answering machine detection (AMD) enabled.
*/
"totalCalls"?: number;
/**
* Percentage of calls marked as answered by human.
*/
"answeredByHumanPercentage"?: number;
/**
* Percentage of calls marked as answered by machined related like the following: `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `fax`
*/
"answeredByMachinePercentage"?: number;
constructor(payload: any);
}
export declare class ReportFilter {
/**
* The name of the filter \'call_state\', \'call_direction\', \'call_type\', \'twilio_regions\', \'caller_country_code\', \'callee_country_code\', \'silent\'
*/
"key"?: string;
/**
* List of supported filter values for the field name
*/
"values"?: Array<string>;
constructor(payload: any);
}
export declare class ReportMetadata {
/**
* Start time of the report
*/
"startTime"?: Date;
/**
* End time of the report
*/
"endTime"?: Date;
/**
* Filter values applied to the report
*/
"filters"?: Array<ReportFilter>;
constructor(payload: any);
}
/**
* The status of the report.
*/
export type ReportStatus = "created" | "running" | "completed";
/**
* Metrics related to STIR/SHAKEN attestation A, B, and C for the report period.
*/
export declare class StirShaken {
"callCount"?: StirShakenCallCount;
"percentage"?: StirShakenPercentage;
"answerRate"?: StirShakenAnswerRate;
constructor(payload: any);
}
/**
* Answer rate for each STIR/SHAKEN attestation category.
*/
export declare class StirShakenAnswerRate {
/**
* Answer rate for Stir Shaken category A.
*/
"stshA"?: number;
/**
* Answer rate for Stir Shaken category B.
*/
"stshB"?: number;
/**
* Answer rate for Stir Shaken category C.
*/
"stshC"?: number;
constructor(payload: any);
}
/**
* Total number of calls for each STIR/SHAKEN attestation category.
*/
export declare class StirShakenCallCount {
/**
* Total number of calls for Stir Shaken category A.
*/
"stshA"?: number;
/**
* Total number of calls for Stir Shaken category B.
*/
"stshB"?: number;
/**
* Total number of calls for Stir Shaken category C.
*/
"stshC"?: number;
constructor(payload: any);
}
/**
* Percentage of calls for each STIR/SHAKEN attestation category.
*/
export declare class StirShakenPercentage {
/**
* Percentage of calls for Stir Shaken category A.
*/
"stshA"?: number;
/**
* Percentage of calls for Stir Shaken category B.
*/
"stshB"?: number;
/**
* Percentage of calls for Stir Shaken category C.
*/
"stshC"?: number;
constructor(payload: any);
}
/**
* Metrics related to Voice Integrity enabled calls for the report period.
*/
export declare class VoiceIntegrity {
/**
* Total number of calls with Voice Integrity enabled.
*/
"enabledCalls"?: number;
/**
* Percentage of calls with Voice Integrity enabled.
*/
"enabledPercentage"?: number;
/**
* Number of calls per Voice Integrity enabled Bundle Sid.
*/
"callsPerBundle"?: Array<VoiceIntegrityCallsPerBundle>;
constructor(payload: any);
}
export declare class VoiceIntegrityCallsPerBundle {
/**
* Voice Integrity Approved Profile Sid.
*/
"bundleSid"?: string;
/**
* The number of Voice Integrity enabled and registered phone numbers per Bundle Sid.
*/
"enabledPhonenumbers"?: number;
/**
* The number of outbound calls on Voice Integrity enabled and registered number per Bundle Sid.
*/
"totalCalls"?: number;
/**
* Answer rate for calls on Voice Integrity enabled and registered number per Bundle Sid.
*/
"answerRate"?: number;
/**
* Rate for calls on Voice Integrity enabled and registered number per Bundle Sid that were answered by Human per each use case for Branded bundled calls.
*/
"humanAnswerRate"?: number;
constructor(payload: any);
}
/**
* Options to pass to create a ReportInstance
*/
export interface ReportContextCreateOptions {
/** */
insightsV2CreateAccountReportRequest?: InsightsV2CreateAccountReportRequest;
}
export interface ReportContext {
/**
* Create a ReportInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance
*/
create(callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
/**
* Create a ReportInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance
*/
create(params: InsightsV2CreateAccountReportRequest, headers?: any, callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
/**
* Create a ReportInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
/**
* Create a ReportInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance with HTTP metadata
*/
createWithHttpInfo(params: InsightsV2CreateAccountReportRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
/**
* Fetch a ReportInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance
*/
fetch(callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
/**
* Fetch a ReportInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ReportContextSolution {
reportId: string;
}
export declare class ReportContextImpl implements ReportContext {
protected _version: V2;
protected _solution: ReportContextSolution;
protected _uri: string;
constructor(_version: V2, reportId: string);
create(params?: InsightsV2CreateAccountReportRequest | ((error: Error | null, item?: ReportInstance) => any), headers?: any, callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
createWithHttpInfo(params?: InsightsV2CreateAccountReportRequest | ((error: Error | null, item?: ApiResponse<ReportInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
fetch(callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ReportContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ReportResource {
account_sid: string;
report_id: string;
status: ReportStatus;
request_meta: ReportMetadata;
url: string;
handle: string;
total_calls: number;
call_answer_score: number;
call_state_percentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
silent_calls_percentage: number;
calls_by_device_type: {
[key: string]: number;
};
answer_rate_device_type: {
[key: string]: number;
};
blocked_calls_by_carrier: Array<CountyCarrierValue>;
short_duration_calls_percentage: number;
long_duration_calls_percentage: number;
potential_robocalls_percentage: number;
answering_machine_detection: InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
report: AccountReport;
}
export declare class ReportInstance {
protected _version: V2;
protected _solution: ReportContextSolution;
protected _context?: ReportContext;
constructor(_version: V2, payload: ReportResource, reportId?: string);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* The report identifier as Voice Insights Report TTID.
*/
reportId: string;
status: ReportStatus;
requestMeta: ReportMetadata;
/**
* The URL of this resource.
*/
url: string;
/**
* Inbound phone number handle represented in the report.
*/
handle: string;
/**
* Total number of calls made with the given handle during the report period.
*/
totalCalls: number;
/**
* The call answer score measures customers behavior to the delivered calls. The score is a value between 0 and 100, where 100 indicates that all calls were successfully answered.
*/
callAnswerScore: number;
callStatePercentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
/**
* Percentage of inbound calls with silence tags over total outbound calls. A silent tag is indicative of a connectivity issue or muted audio.
*/
silentCallsPercentage: number;
/**
* Number of calls made with each device type. `voip`, `mobile`, `landline`, `unknown`
*/
callsByDeviceType: {
[key: string]: number;
};
/**
* Answer rate for each device type. `voip`, `mobile`, `landline`, `unknown`
*/
answerRateDeviceType: {
[key: string]: number;
};
/**
* Percentage of blocked calls by carrier per country.
*/
blockedCallsByCarrier: Array<CountyCarrierValue>;
/**
* Percentage of completed outbound calls under 10 seconds (PSTN Short call tags); More than 15% is typically low trust measured.
*/
shortDurationCallsPercentage: number;
/**
* Percentage of long duration calls ( >= 60 seconds)
*/
longDurationCallsPercentage: number;
/**
* Percentage of completed outbound calls to unassigned or unallocated phone numbers.
*/
potentialRobocallsPercentage: number;
answeringMachineDetection: InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
report: AccountReport;
private get _proxy();
/**
* Create a ReportInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance
*/
create(callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
/**
* Create a ReportInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance
*/
create(params: InsightsV2CreateAccountReportRequest, headers?: any, callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
/**
* Create a ReportInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
/**
* Create a ReportInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance with HTTP metadata
*/
createWithHttpInfo(params: InsightsV2CreateAccountReportRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
/**
* Fetch a ReportInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance
*/
fetch(callback?: (error: Error | null, item?: ReportInstance) => any): Promise<ReportInstance>;
/**
* Fetch a ReportInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ReportInstance>) => any): Promise<ApiResponse<ReportInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
reportId: string;
status: ReportStatus;
requestMeta: ReportMetadata;
url: string;
handle: string;
totalCalls: number;
callAnswerScore: number;
callStatePercentage: InsightsV2InboundPhoneNumberReportCallStatePercentage;
silentCallsPercentage: number;
callsByDeviceType: {
[key: string]: number;
};
answerRateDeviceType: {
[key: string]: number;
};
blockedCallsByCarrier: CountyCarrierValue[];
shortDurationCallsPercentage: number;
longDurationCallsPercentage: number;
potentialRobocallsPercentage: number;
answeringMachineDetection: InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
report: AccountReport;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ReportSolution {
}
export interface ReportListInstance {
_version: V2;
_solution: ReportSolution;
_uri: string;
(reportId: string): ReportContext;
get(reportId: string): ReportContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ReportListInstance(version: V2): ReportListInstance;
export {};

550
node_modules/twilio/lib/rest/insights/v2/report.js generated vendored Normal file
View File

@@ -0,0 +1,550 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Sample/reference Twilio API.
* This is the reference API for the rest-proxy server.
*
* 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.ReportInstance = exports.ReportContextImpl = exports.VoiceIntegrityCallsPerBundle = exports.VoiceIntegrity = exports.StirShakenPercentage = exports.StirShakenCallCount = exports.StirShakenAnswerRate = exports.StirShaken = exports.ReportMetadata = exports.ReportFilter = exports.InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection = exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = exports.InsightsV2CreateAccountReportRequestTimeRange = exports.InsightsV2CreateAccountReportRequest = exports.CountyCarrierValueCarriers = exports.CountyCarrierValue = exports.BrandedUseCaseDetail = exports.BrandedCalling = exports.AccountReportNetworkIssuesTwilioGateway = exports.AccountReportNetworkIssuesSdk = exports.AccountReportNetworkIssues = exports.AccountReportKYTOutboundCarrierCalling = exports.AccountReportKYT = exports.AccountReportCallType = exports.AccountReportCallState = exports.AccountReportCallDirection = exports.AccountReportAnsweringMachineDetection = exports.AccountReport = void 0;
exports.ReportListInstance = ReportListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class AccountReport {
constructor(payload) {
this.callDeliverabilityScore = payload["call_deliverability_score"];
this.callAnswerScore = payload["call_answer_score"];
this.totalCalls = payload["total_calls"];
this.callDirection = payload["call_direction"];
this.callState = payload["call_state"];
this.callType = payload["call_type"];
this.aloc = payload["aloc"];
this.twilioEdgeLocation = payload["twilio_edge_location"];
this.callerCountryCode = payload["caller_country_code"];
this.calleeCountryCode = payload["callee_country_code"];
this.averageQueueTimeMs = payload["average_queue_time_ms"];
this.silentCallsPercentage = payload["silent_calls_percentage"];
this.networkIssues = payload["network_issues"];
this.kYT = payload["KYT"];
this.answeringMachineDetection = payload["answering_machine_detection"];
}
}
exports.AccountReport = AccountReport;
/**
* Number of calls made in each answering machine detection.
*/
class AccountReportAnsweringMachineDetection {
constructor(payload) {
this.totalCalls = payload["total_calls"];
this.answeredByHumanPercentage = payload["answered_by_human_percentage"];
this.answeredByMachinePercentage =
payload["answered_by_machine_percentage"];
}
}
exports.AccountReportAnsweringMachineDetection = AccountReportAnsweringMachineDetection;
/**
* Number of calls made in each direction.
*/
class AccountReportCallDirection {
constructor(payload) {
this.outbound = payload["outbound"];
this.inbound = payload["inbound"];
}
}
exports.AccountReportCallDirection = AccountReportCallDirection;
/**
* Number of calls made in each state.
*/
class AccountReportCallState {
constructor(payload) {
this.completed = payload["completed"];
this.fail = payload["fail"];
this.busy = payload["busy"];
this.noanswer = payload["noanswer"];
this.canceled = payload["canceled"];
}
}
exports.AccountReportCallState = AccountReportCallState;
/**
* Number of calls made in each type. `carrier`, `sip`, `trunking`, `client`, `whatsapp`
*/
class AccountReportCallType {
constructor(payload) {
this.carrier = payload["carrier"];
this.sip = payload["sip"];
this.trunking = payload["trunking"];
this.client = payload["client"];
this.whatsapp = payload["whatsapp"];
}
}
exports.AccountReportCallType = AccountReportCallType;
/**
* Know Your Traffic (KYT) metrics focused on outbound carrier performance and trust signals for the report period.
*/
class AccountReportKYT {
constructor(payload) {
this.outboundCarrierCalling = payload["outbound_carrier_calling"];
}
}
exports.AccountReportKYT = AccountReportKYT;
/**
* KYT metrics for outbound carrier calling.
*/
class AccountReportKYTOutboundCarrierCalling {
constructor(payload) {
this.uniqueCallingNumbers = payload["unique_calling_numbers"];
this.uniqueCalledNumbers = payload["unique_called_numbers"];
this.blockedCallsByCarrier = payload["blocked_calls_by_carrier"];
this.shortDurationCallsPercentage =
payload["short_duration_calls_percentage"];
this.longDurationCallsPercentage =
payload["long_duration_calls_percentage"];
this.potentialRobocallsPercentage =
payload["potential_robocalls_percentage"];
this.brandedCalling = payload["branded_calling"];
this.voiceIntegrity = payload["voice_integrity"];
this.stirShaken = payload["stir_shaken"];
}
}
exports.AccountReportKYTOutboundCarrierCalling = AccountReportKYTOutboundCarrierCalling;
/**
* Network-quality indicators for SDK and Twilio Gateway traffic during the report period.
*/
class AccountReportNetworkIssues {
constructor(payload) {
this.sdk = payload["sdk"];
this.twilioGateway = payload["twilio_gateway"];
}
}
exports.AccountReportNetworkIssues = AccountReportNetworkIssues;
/**
* Network issues of calls for client type. This is indicative of local network issues.
*/
class AccountReportNetworkIssuesSdk {
constructor(payload) {
this.iceFailuresPercentage = payload["ice_failures_percentage"];
this.highLatencyPercentage = payload["high_latency_percentage"];
this.highPacketLossPercentage = payload["high_packet_loss_percentage"];
this.highJitterPercentage = payload["high_jitter_percentage"];
}
}
exports.AccountReportNetworkIssuesSdk = AccountReportNetworkIssuesSdk;
/**
* Network related metrics for Twilio Gateway calls only.
*/
class AccountReportNetworkIssuesTwilioGateway {
constructor(payload) {
this.highLatencyPercentage = payload["high_latency_percentage"];
this.highPacketLossPercentage = payload["high_packet_loss_percentage"];
this.highJitterPercentage = payload["high_jitter_percentage"];
}
}
exports.AccountReportNetworkIssuesTwilioGateway = AccountReportNetworkIssuesTwilioGateway;
/**
* Metrics related to Branded Calling bundled calls including CTIA for the report period.
*/
class BrandedCalling {
constructor(payload) {
this.totalBrandedCalls = payload["total_branded_calls"];
this.percentBrandedCalls = payload["percent_branded_calls"];
this.answerRate = payload["answer_rate"];
this.humanAnswerRate = payload["human_answer_rate"];
this.engagementRate = payload["engagement_rate"];
this.byUseCase = payload["by_use_case"];
}
}
exports.BrandedCalling = BrandedCalling;
/**
* Associated metrics for Branded calls grouped by each use case.
*/
class BrandedUseCaseDetail {
constructor(payload) {
this.useCase = payload["use_case"];
this.enabledPhonenumbers = payload["enabled_phonenumbers"];
this.totalCalls = payload["total_calls"];
this.answerRate = payload["answer_rate"];
this.humanAnswerRate = payload["human_answer_rate"];
this.engagementRate = payload["engagement_rate"];
}
}
exports.BrandedUseCaseDetail = BrandedUseCaseDetail;
class CountyCarrierValue {
constructor(payload) {
this.country = payload["country"];
this.carriers = payload["carriers"];
}
}
exports.CountyCarrierValue = CountyCarrierValue;
class CountyCarrierValueCarriers {
constructor(payload) {
this.carrier = payload["carrier"];
this.totalCalls = payload["total_calls"];
this.blockedCalls = payload["blocked_calls"];
this.blockedCallsPercentage = payload["blocked_calls_percentage"];
}
}
exports.CountyCarrierValueCarriers = CountyCarrierValueCarriers;
class InsightsV2CreateAccountReportRequest {
constructor(payload) {
this.timeRange = payload["time_range"];
this.filters = payload["filters"];
}
}
exports.InsightsV2CreateAccountReportRequest = InsightsV2CreateAccountReportRequest;
/**
* Optional start and end date time for the report window. Defaults to the most recent 7 days when omitted.
*/
class InsightsV2CreateAccountReportRequestTimeRange {
constructor(payload) {
this.startTime = payload["start_time"];
this.endTime = payload["end_time"];
}
}
exports.InsightsV2CreateAccountReportRequestTimeRange = InsightsV2CreateAccountReportRequestTimeRange;
/**
* Percentage of calls made in each state.
*/
class InsightsV2InboundPhoneNumberReportCallStatePercentage {
constructor(payload) {
this.completed = payload["completed"];
this.fail = payload["fail"];
this.busy = payload["busy"];
this.noanswer = payload["noanswer"];
this.canceled = payload["canceled"];
}
}
exports.InsightsV2InboundPhoneNumberReportCallStatePercentage = InsightsV2InboundPhoneNumberReportCallStatePercentage;
/**
* Number of calls made in answering machine detection (AMD) enabled.
*/
class InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection {
constructor(payload) {
this.totalCalls = payload["total_calls"];
this.answeredByHumanPercentage = payload["answered_by_human_percentage"];
this.answeredByMachinePercentage =
payload["answered_by_machine_percentage"];
}
}
exports.InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection = InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection;
class ReportFilter {
constructor(payload) {
this.key = payload["key"];
this.values = payload["values"];
}
}
exports.ReportFilter = ReportFilter;
class ReportMetadata {
constructor(payload) {
this.startTime = payload["start_time"];
this.endTime = payload["end_time"];
this.filters = payload["filters"];
}
}
exports.ReportMetadata = ReportMetadata;
/**
* Metrics related to STIR/SHAKEN attestation A, B, and C for the report period.
*/
class StirShaken {
constructor(payload) {
this.callCount = payload["call_count"];
this.percentage = payload["percentage"];
this.answerRate = payload["answer_rate"];
}
}
exports.StirShaken = StirShaken;
/**
* Answer rate for each STIR/SHAKEN attestation category.
*/
class StirShakenAnswerRate {
constructor(payload) {
this.stshA = payload["stsh_a"];
this.stshB = payload["stsh_b"];
this.stshC = payload["stsh_c"];
}
}
exports.StirShakenAnswerRate = StirShakenAnswerRate;
/**
* Total number of calls for each STIR/SHAKEN attestation category.
*/
class StirShakenCallCount {
constructor(payload) {
this.stshA = payload["stsh_a"];
this.stshB = payload["stsh_b"];
this.stshC = payload["stsh_c"];
}
}
exports.StirShakenCallCount = StirShakenCallCount;
/**
* Percentage of calls for each STIR/SHAKEN attestation category.
*/
class StirShakenPercentage {
constructor(payload) {
this.stshA = payload["stsh_a"];
this.stshB = payload["stsh_b"];
this.stshC = payload["stsh_c"];
}
}
exports.StirShakenPercentage = StirShakenPercentage;
/**
* Metrics related to Voice Integrity enabled calls for the report period.
*/
class VoiceIntegrity {
constructor(payload) {
this.enabledCalls = payload["enabled_calls"];
this.enabledPercentage = payload["enabled_percentage"];
this.callsPerBundle = payload["calls_per_bundle"];
}
}
exports.VoiceIntegrity = VoiceIntegrity;
class VoiceIntegrityCallsPerBundle {
constructor(payload) {
this.bundleSid = payload["bundle_sid"];
this.enabledPhonenumbers = payload["enabled_phonenumbers"];
this.totalCalls = payload["total_calls"];
this.answerRate = payload["answer_rate"];
this.humanAnswerRate = payload["human_answer_rate"];
}
}
exports.VoiceIntegrityCallsPerBundle = VoiceIntegrityCallsPerBundle;
class ReportContextImpl {
constructor(_version, reportId) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(reportId)) {
throw new Error("Parameter 'reportId' is not valid.");
}
this._solution = { reportId };
this._uri = `/Voice/Reports/${reportId}`;
}
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";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ReportInstance(operationVersion, payload, instance._solution.reportId));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
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";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ReportInstance(operationVersion, response.body, instance._solution.reportId),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ReportInstance(operationVersion, payload, instance._solution.reportId));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ReportInstance(operationVersion, response.body, instance._solution.reportId),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ReportContextImpl = ReportContextImpl;
class ReportInstance {
constructor(_version, payload, reportId) {
this._version = _version;
this.accountSid = payload.account_sid;
this.reportId = payload.report_id;
this.status = payload.status;
this.requestMeta =
payload.request_meta !== null && payload.request_meta !== undefined
? new ReportMetadata(payload.request_meta)
: null;
this.url = payload.url;
this.handle = payload.handle;
this.totalCalls = deserialize.integer(payload.total_calls);
this.callAnswerScore = payload.call_answer_score;
this.callStatePercentage =
payload.call_state_percentage !== null &&
payload.call_state_percentage !== undefined
? new InsightsV2InboundPhoneNumberReportCallStatePercentage(payload.call_state_percentage)
: null;
this.silentCallsPercentage = payload.silent_calls_percentage;
this.callsByDeviceType = payload.calls_by_device_type;
this.answerRateDeviceType = payload.answer_rate_device_type;
this.blockedCallsByCarrier =
payload.blocked_calls_by_carrier !== null &&
payload.blocked_calls_by_carrier !== undefined
? payload.blocked_calls_by_carrier.map((payload) => new CountyCarrierValue(payload))
: null;
this.shortDurationCallsPercentage = payload.short_duration_calls_percentage;
this.longDurationCallsPercentage = payload.long_duration_calls_percentage;
this.potentialRobocallsPercentage = payload.potential_robocalls_percentage;
this.answeringMachineDetection =
payload.answering_machine_detection !== null &&
payload.answering_machine_detection !== undefined
? new InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection(payload.answering_machine_detection)
: null;
this.report =
payload.report !== null && payload.report !== undefined
? new AccountReport(payload.report)
: null;
this._solution = { reportId: reportId || this.reportId };
}
get _proxy() {
this._context =
this._context ||
new ReportContextImpl(this._version, this._solution.reportId);
return this._context;
}
create(params, callback) {
return this._proxy.create(params, callback);
}
createWithHttpInfo(params, callback) {
return this._proxy.createWithHttpInfo(params, callback);
}
/**
* Fetch a ReportInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ReportInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ReportInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
reportId: this.reportId,
status: this.status,
requestMeta: this.requestMeta,
url: this.url,
handle: this.handle,
totalCalls: this.totalCalls,
callAnswerScore: this.callAnswerScore,
callStatePercentage: this.callStatePercentage,
silentCallsPercentage: this.silentCallsPercentage,
callsByDeviceType: this.callsByDeviceType,
answerRateDeviceType: this.answerRateDeviceType,
blockedCallsByCarrier: this.blockedCallsByCarrier,
shortDurationCallsPercentage: this.shortDurationCallsPercentage,
longDurationCallsPercentage: this.longDurationCallsPercentage,
potentialRobocallsPercentage: this.potentialRobocallsPercentage,
answeringMachineDetection: this.answeringMachineDetection,
report: this.report,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ReportInstance = ReportInstance;
function ReportListInstance(version) {
const instance = ((reportId) => instance.get(reportId));
instance.get = function get(reportId) {
return new ReportContextImpl(version, reportId);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
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;
}