Comparing version 4.1.0 to 4.1.1
import lib from "./lib"; | ||
export default lib; | ||
export = lib; |
@@ -9,2 +9,2 @@ "use strict"; | ||
const lib_1 = __importDefault(require("./lib")); | ||
exports.default = lib_1.default; | ||
module.exports = lib_1.default; |
/// <reference types="node" /> | ||
import RequestClient from "./RequestClient"; | ||
import { HttpMethod } from "../interfaces"; | ||
export interface ClientOpts { | ||
httpClient?: RequestClient; | ||
accountSid?: string; | ||
env?: NodeJS.ProcessEnv; | ||
edge?: string; | ||
region?: string; | ||
lazyLoading?: boolean; | ||
logLevel?: string; | ||
userAgentExtensions?: string[]; | ||
autoRetry?: boolean; | ||
maxRetries?: number; | ||
} | ||
export interface RequestOpts { | ||
method?: HttpMethod; | ||
uri?: string; | ||
username?: string; | ||
password?: string; | ||
headers?: Headers; | ||
params?: object; | ||
data?: object; | ||
timeout?: number; | ||
allowRedirects?: boolean; | ||
logLevel?: string; | ||
} | ||
/** | ||
* Parent class for Twilio Client that implements request & validation logic | ||
*/ | ||
export declare class BaseTwilio { | ||
username: string; | ||
password: string; | ||
accountSid: string; | ||
opts?: ClientOpts; | ||
env?: NodeJS.ProcessEnv; | ||
edge?: string; | ||
region?: string; | ||
logLevel?: string; | ||
autoRetry: boolean; | ||
maxRetries?: number; | ||
userAgentExtensions?: string[]; | ||
_httpClient?: RequestClient; | ||
declare namespace Twilio { | ||
interface ClientOpts { | ||
httpClient?: RequestClient; | ||
accountSid?: string; | ||
env?: NodeJS.ProcessEnv; | ||
edge?: string; | ||
region?: string; | ||
lazyLoading?: boolean; | ||
logLevel?: string; | ||
userAgentExtensions?: string[]; | ||
autoRetry?: boolean; | ||
maxRetries?: number; | ||
} | ||
interface RequestOpts { | ||
method?: HttpMethod; | ||
uri?: string; | ||
username?: string; | ||
password?: string; | ||
headers?: Headers; | ||
params?: object; | ||
data?: object; | ||
timeout?: number; | ||
allowRedirects?: boolean; | ||
logLevel?: string; | ||
} | ||
/** | ||
* Create a BaseTwilio instance | ||
* | ||
* @param username - | ||
* The username used for authentication. This is normally account sid, but if using key/secret auth will be | ||
* the api key sid. | ||
* @param password - | ||
* The password used for authentication. This is normally auth token, but if using key/secret auth will be | ||
* the secret. | ||
* @param opts - The options argument | ||
* | ||
* @returns A new instance of BaseTwilio | ||
* Parent class for Twilio Client that implements request & validation logic | ||
*/ | ||
constructor(username?: string, password?: string, opts?: ClientOpts); | ||
get httpClient(): RequestClient; | ||
/** | ||
* Makes a request to the Twilio API using the configured http client. | ||
* Authentication information is automatically added if none is provided. | ||
* | ||
* @param opts - The options argument | ||
*/ | ||
request(opts: RequestOpts): Promise<any>; | ||
/** | ||
* Adds a region and/or edge to a given hostname | ||
* | ||
* @param hostname - A URI hostname (e.g. api.twilio.com) | ||
* @param targetEdge - The targeted edge location (e.g. sydney) | ||
* @param targetRegion - The targeted region location (e.g. au1) | ||
*/ | ||
getHostname(hostname: string, targetEdge: string | undefined, targetRegion: string | undefined): string; | ||
/** | ||
* Validates that a request to the new SSL certificate is successful. | ||
* | ||
* @throws RestException if the request fails | ||
* | ||
*/ | ||
validateSslCert(): Promise<any>; | ||
class Client { | ||
username: string; | ||
password: string; | ||
accountSid: string; | ||
opts?: ClientOpts; | ||
env?: NodeJS.ProcessEnv; | ||
edge?: string; | ||
region?: string; | ||
logLevel?: string; | ||
autoRetry: boolean; | ||
maxRetries?: number; | ||
userAgentExtensions?: string[]; | ||
_httpClient?: RequestClient; | ||
/** | ||
* Create a BaseTwilio instance | ||
* | ||
* @param username - | ||
* The username used for authentication. This is normally account sid, but if using key/secret auth will be | ||
* the api key sid. | ||
* @param password - | ||
* The password used for authentication. This is normally auth token, but if using key/secret auth will be | ||
* the secret. | ||
* @param opts - The options argument | ||
* | ||
* @returns A new instance of BaseTwilio | ||
*/ | ||
constructor(username?: string, password?: string, opts?: ClientOpts); | ||
get httpClient(): RequestClient; | ||
/** | ||
* Makes a request to the Twilio API using the configured http client. | ||
* Authentication information is automatically added if none is provided. | ||
* | ||
* @param opts - The options argument | ||
*/ | ||
request(opts: RequestOpts): Promise<any>; | ||
/** | ||
* Adds a region and/or edge to a given hostname | ||
* | ||
* @param hostname - A URI hostname (e.g. api.twilio.com) | ||
* @param targetEdge - The targeted edge location (e.g. sydney) | ||
* @param targetRegion - The targeted region location (e.g. au1) | ||
*/ | ||
getHostname(hostname: string, targetEdge: string | undefined, targetRegion: string | undefined): string; | ||
/** | ||
* Validates that a request to the new SSL certificate is successful. | ||
* | ||
* @throws RestException if the request fails | ||
* | ||
*/ | ||
validateSslCert(): Promise<any>; | ||
} | ||
} | ||
export = Twilio; |
@@ -5,4 +5,2 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseTwilio = void 0; | ||
const RequestClient_1 = __importDefault(require("./RequestClient")); /* jshint ignore:line */ | ||
@@ -14,161 +12,165 @@ const os = require("os"); /* jshint ignore:line */ | ||
const RestException = require("../base/RestException"); /* jshint ignore:line */ | ||
/* jshint ignore:start */ | ||
/** | ||
* Parent class for Twilio Client that implements request & validation logic | ||
*/ | ||
/* jshint ignore:end */ | ||
class BaseTwilio { | ||
var Twilio; | ||
(function (Twilio) { | ||
/* jshint ignore:start */ | ||
/** | ||
* Create a BaseTwilio instance | ||
* | ||
* @param username - | ||
* The username used for authentication. This is normally account sid, but if using key/secret auth will be | ||
* the api key sid. | ||
* @param password - | ||
* The password used for authentication. This is normally auth token, but if using key/secret auth will be | ||
* the secret. | ||
* @param opts - The options argument | ||
* | ||
* @returns A new instance of BaseTwilio | ||
* Parent class for Twilio Client that implements request & validation logic | ||
*/ | ||
/* jshint ignore:end */ | ||
constructor(username, password, opts) { | ||
this.opts = opts || {}; | ||
this.env = this.opts.env || process.env; | ||
this.username = | ||
username || | ||
this.env.TWILIO_ACCOUNT_SID || | ||
(() => { | ||
throw new Error("username is required"); | ||
})(); | ||
this.password = | ||
password || | ||
this.env.TWILIO_AUTH_TOKEN || | ||
(() => { | ||
throw new Error("password is required"); | ||
})(); | ||
this.accountSid = this.opts.accountSid || this.username; | ||
this.edge = this.opts.edge || this.env.TWILIO_EDGE; | ||
this.region = this.opts.region || this.env.TWILIO_REGION; | ||
this.logLevel = this.opts.logLevel || this.env.TWILIO_LOG_LEVEL; | ||
this.autoRetry = this.opts.autoRetry || false; | ||
this.maxRetries = this.opts.maxRetries; | ||
this.userAgentExtensions = this.opts.userAgentExtensions || []; | ||
this._httpClient = this.opts.httpClient; | ||
if (this.opts.lazyLoading === false) { | ||
this._httpClient = this.httpClient; | ||
class Client { | ||
/* jshint ignore:start */ | ||
/** | ||
* Create a BaseTwilio instance | ||
* | ||
* @param username - | ||
* The username used for authentication. This is normally account sid, but if using key/secret auth will be | ||
* the api key sid. | ||
* @param password - | ||
* The password used for authentication. This is normally auth token, but if using key/secret auth will be | ||
* the secret. | ||
* @param opts - The options argument | ||
* | ||
* @returns A new instance of BaseTwilio | ||
*/ | ||
/* jshint ignore:end */ | ||
constructor(username, password, opts) { | ||
this.opts = opts || {}; | ||
this.env = this.opts.env || process.env; | ||
this.username = | ||
username || | ||
this.env.TWILIO_ACCOUNT_SID || | ||
(() => { | ||
throw new Error("username is required"); | ||
})(); | ||
this.password = | ||
password || | ||
this.env.TWILIO_AUTH_TOKEN || | ||
(() => { | ||
throw new Error("password is required"); | ||
})(); | ||
this.accountSid = this.opts.accountSid || this.username; | ||
this.edge = this.opts.edge || this.env.TWILIO_EDGE; | ||
this.region = this.opts.region || this.env.TWILIO_REGION; | ||
this.logLevel = this.opts.logLevel || this.env.TWILIO_LOG_LEVEL; | ||
this.autoRetry = this.opts.autoRetry || false; | ||
this.maxRetries = this.opts.maxRetries; | ||
this.userAgentExtensions = this.opts.userAgentExtensions || []; | ||
this._httpClient = this.opts.httpClient; | ||
if (this.opts.lazyLoading === false) { | ||
this._httpClient = this.httpClient; | ||
} | ||
if (!this.accountSid.startsWith("AC")) { | ||
const apiKeyMsg = this.accountSid.startsWith("SK") | ||
? ". The given SID indicates an API Key which requires the accountSid to be passed as an additional option" | ||
: ""; | ||
throw new Error("accountSid must start with AC" + apiKeyMsg); | ||
} | ||
} | ||
if (!this.accountSid.startsWith("AC")) { | ||
const apiKeyMsg = this.accountSid.startsWith("SK") | ||
? ". The given SID indicates an API Key which requires the accountSid to be passed as an additional option" | ||
: ""; | ||
throw new Error("accountSid must start with AC" + apiKeyMsg); | ||
get httpClient() { | ||
if (!this._httpClient) { | ||
this._httpClient = new RequestClient_1.default({ | ||
autoRetry: this.autoRetry, | ||
maxRetries: this.maxRetries, | ||
}); | ||
} | ||
return this._httpClient; | ||
} | ||
} | ||
get httpClient() { | ||
if (!this._httpClient) { | ||
this._httpClient = new RequestClient_1.default({ | ||
autoRetry: this.autoRetry, | ||
maxRetries: this.maxRetries, | ||
/* jshint ignore:start */ | ||
/** | ||
* Makes a request to the Twilio API using the configured http client. | ||
* Authentication information is automatically added if none is provided. | ||
* | ||
* @param opts - The options argument | ||
*/ | ||
/* jshint ignore:end */ | ||
request(opts) { | ||
opts = opts || {}; | ||
if (!opts.method) { | ||
throw new Error("method is required"); | ||
} | ||
if (!opts.uri) { | ||
throw new Error("uri is required"); | ||
} | ||
const username = opts.username || this.username; | ||
const password = opts.password || this.password; | ||
const headers = opts.headers || {}; | ||
const pkgVersion = moduleInfo.version; | ||
const osName = os.platform(); | ||
const osArch = os.arch(); | ||
const nodeVersion = process.version; | ||
headers["User-Agent"] = util.format("twilio-node/%s (%s %s) node/%s", pkgVersion, osName, osArch, nodeVersion); | ||
this.userAgentExtensions?.forEach((extension) => { | ||
headers["User-Agent"] += ` ${extension}`; | ||
}); | ||
headers["Accept-Charset"] = "utf-8"; | ||
if (opts.method === "post" && !headers["Content-Type"]) { | ||
headers["Content-Type"] = "application/x-www-form-urlencoded"; | ||
} | ||
if (!headers["Accept"]) { | ||
headers["Accept"] = "application/json"; | ||
} | ||
var uri = new url.URL(opts.uri); | ||
uri.hostname = this.getHostname(uri.hostname, this.edge, this.region); | ||
return this.httpClient?.request({ | ||
method: opts.method, | ||
uri: uri.href, | ||
username: username, | ||
password: password, | ||
headers: headers, | ||
params: opts.params, | ||
data: opts.data, | ||
timeout: opts.timeout, | ||
allowRedirects: opts.allowRedirects, | ||
logLevel: opts.logLevel, | ||
}); | ||
} | ||
return this._httpClient; | ||
} | ||
/* jshint ignore:start */ | ||
/** | ||
* Makes a request to the Twilio API using the configured http client. | ||
* Authentication information is automatically added if none is provided. | ||
* | ||
* @param opts - The options argument | ||
*/ | ||
/* jshint ignore:end */ | ||
request(opts) { | ||
opts = opts || {}; | ||
if (!opts.method) { | ||
throw new Error("method is required"); | ||
/* jshint ignore:start */ | ||
/** | ||
* Adds a region and/or edge to a given hostname | ||
* | ||
* @param hostname - A URI hostname (e.g. api.twilio.com) | ||
* @param targetEdge - The targeted edge location (e.g. sydney) | ||
* @param targetRegion - The targeted region location (e.g. au1) | ||
*/ | ||
/* jshint ignore:end */ | ||
getHostname(hostname, targetEdge, targetRegion) { | ||
const defaultRegion = "us1"; | ||
const domain = hostname.split(".").slice(-2).join("."); | ||
const prefix = hostname.split("." + domain)[0]; | ||
let [product, edge, region] = prefix.split("."); | ||
if (edge && !region) { | ||
region = edge; | ||
edge = undefined; | ||
} | ||
region = targetRegion || region || (targetEdge && defaultRegion); | ||
if (!region) { | ||
return hostname; | ||
} | ||
edge = targetEdge || edge; | ||
return [product, edge, region, domain].filter((part) => part).join("."); | ||
} | ||
if (!opts.uri) { | ||
throw new Error("uri is required"); | ||
/* jshint ignore:start */ | ||
/** | ||
* Validates that a request to the new SSL certificate is successful. | ||
* | ||
* @throws RestException if the request fails | ||
* | ||
*/ | ||
/* jshint ignore:end */ | ||
validateSslCert() { | ||
return this.httpClient | ||
?.request({ | ||
method: "get", | ||
uri: "https://api.twilio.com:8443/2010-04-01/.json", | ||
}) | ||
.then((response) => { | ||
if (response["statusCode"] < 200 || response["statusCode"] >= 300) { | ||
throw new RestException(response); | ||
} | ||
return response; | ||
}); | ||
} | ||
const username = opts.username || this.username; | ||
const password = opts.password || this.password; | ||
const headers = opts.headers || {}; | ||
const pkgVersion = moduleInfo.version; | ||
const osName = os.platform(); | ||
const osArch = os.arch(); | ||
const nodeVersion = process.version; | ||
headers["User-Agent"] = util.format("twilio-node/%s (%s %s) node/%s", pkgVersion, osName, osArch, nodeVersion); | ||
this.userAgentExtensions?.forEach((extension) => { | ||
headers["User-Agent"] += ` ${extension}`; | ||
}); | ||
headers["Accept-Charset"] = "utf-8"; | ||
if (opts.method === "post" && !headers["Content-Type"]) { | ||
headers["Content-Type"] = "application/x-www-form-urlencoded"; | ||
} | ||
if (!headers["Accept"]) { | ||
headers["Accept"] = "application/json"; | ||
} | ||
var uri = new url.URL(opts.uri); | ||
uri.hostname = this.getHostname(uri.hostname, this.edge, this.region); | ||
return this.httpClient?.request({ | ||
method: opts.method, | ||
uri: uri.href, | ||
username: username, | ||
password: password, | ||
headers: headers, | ||
params: opts.params, | ||
data: opts.data, | ||
timeout: opts.timeout, | ||
allowRedirects: opts.allowRedirects, | ||
logLevel: opts.logLevel, | ||
}); | ||
} | ||
/* jshint ignore:start */ | ||
/** | ||
* Adds a region and/or edge to a given hostname | ||
* | ||
* @param hostname - A URI hostname (e.g. api.twilio.com) | ||
* @param targetEdge - The targeted edge location (e.g. sydney) | ||
* @param targetRegion - The targeted region location (e.g. au1) | ||
*/ | ||
/* jshint ignore:end */ | ||
getHostname(hostname, targetEdge, targetRegion) { | ||
const defaultRegion = "us1"; | ||
const domain = hostname.split(".").slice(-2).join("."); | ||
const prefix = hostname.split("." + domain)[0]; | ||
let [product, edge, region] = prefix.split("."); | ||
if (edge && !region) { | ||
region = edge; | ||
edge = undefined; | ||
} | ||
region = targetRegion || region || (targetEdge && defaultRegion); | ||
if (!region) { | ||
return hostname; | ||
} | ||
edge = targetEdge || edge; | ||
return [product, edge, region, domain].filter((part) => part).join("."); | ||
} | ||
/* jshint ignore:start */ | ||
/** | ||
* Validates that a request to the new SSL certificate is successful. | ||
* | ||
* @throws RestException if the request fails | ||
* | ||
*/ | ||
/* jshint ignore:end */ | ||
validateSslCert() { | ||
return this.httpClient | ||
?.request({ | ||
method: "get", | ||
uri: "https://api.twilio.com:8443/2010-04-01/.json", | ||
}) | ||
.then((response) => { | ||
if (response["statusCode"] < 200 || response["statusCode"] >= 300) { | ||
throw new RestException(response); | ||
} | ||
return response; | ||
}); | ||
} | ||
} | ||
exports.BaseTwilio = BaseTwilio; | ||
Twilio.Client = Client; | ||
})(Twilio || (Twilio = {})); | ||
module.exports = Twilio; |
@@ -1,2 +0,2 @@ | ||
import { BaseTwilio, RequestOpts } from "./BaseTwilio"; | ||
import { Client as BaseTwilio, RequestOpts } from "./BaseTwilio"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Base domain object |
@@ -5,100 +5,4 @@ /// <reference types="node" /> | ||
import Response from "../http/response"; | ||
import Request from "../http/request"; | ||
import { Headers } from "../http/request"; | ||
export interface RequestOptions<TData = any, TParams = object> { | ||
/** | ||
* The HTTP method | ||
*/ | ||
method: HttpMethod; | ||
/** | ||
* The request URI | ||
*/ | ||
uri: string; | ||
/** | ||
* The username used for auth | ||
*/ | ||
username?: string; | ||
/** | ||
* The password used for auth | ||
*/ | ||
password?: string; | ||
/** | ||
* The request headers | ||
*/ | ||
headers?: Headers; | ||
/** | ||
* The object of params added as query string to the request | ||
*/ | ||
params?: TParams; | ||
/** | ||
* The form data that should be submitted | ||
*/ | ||
data?: TData; | ||
/** | ||
* The request timeout in milliseconds | ||
*/ | ||
timeout?: number; | ||
/** | ||
* Should the client follow redirects | ||
*/ | ||
allowRedirects?: boolean; | ||
/** | ||
* Set to true to use the forever-agent | ||
*/ | ||
forever?: boolean; | ||
/** | ||
* Set to 'debug' to enable debug logging | ||
*/ | ||
logLevel?: string; | ||
} | ||
export interface RequestClientOptions { | ||
/** | ||
* A timeout in milliseconds. This will be used as the HTTPS agent's socket | ||
* timeout, AND as the default request timeout. | ||
*/ | ||
timeout?: number; | ||
/** | ||
* https.Agent keepAlive option | ||
*/ | ||
keepAlive?: boolean; | ||
/** | ||
* https.Agent keepAliveMSecs option | ||
*/ | ||
keepAliveMsecs?: number; | ||
/** | ||
* https.Agent maxSockets option | ||
*/ | ||
maxSockets?: number; | ||
/** | ||
* https.Agent maxTotalSockets option | ||
*/ | ||
maxTotalSockets?: number; | ||
/** | ||
* https.Agent maxFreeSockets option | ||
*/ | ||
maxFreeSockets?: number; | ||
/** | ||
* https.Agent scheduling option | ||
*/ | ||
scheduling?: "fifo" | "lifo" | undefined; | ||
/** | ||
* The private CA certificate bundle (if private SSL certificate) | ||
*/ | ||
ca?: string | Buffer; | ||
/** | ||
* Enable auto-retry with exponential backoff when receiving 429 Errors from | ||
* the API. Disabled by default. | ||
*/ | ||
autoRetry?: boolean; | ||
/** | ||
* Maximum retry delay in milliseconds for 429 Error response retries. | ||
* Defaults to 3000. | ||
*/ | ||
maxRetryDelay?: number; | ||
/** | ||
* Maximum number of request retries for 429 Error responses. Defaults to 3. | ||
*/ | ||
maxRetries?: number; | ||
} | ||
export default class RequestClient { | ||
import Request, { Headers } from "../http/request"; | ||
declare class RequestClient { | ||
defaultTimeout: number; | ||
@@ -125,3 +29,3 @@ axios: AxiosInstance; | ||
*/ | ||
constructor(opts?: RequestClientOptions); | ||
constructor(opts?: RequestClient.RequestClientOptions); | ||
/** | ||
@@ -142,5 +46,103 @@ * Make http request | ||
*/ | ||
request<TData>(opts: RequestOptions<TData>): Promise<Response<TData>>; | ||
request<TData>(opts: RequestClient.RequestOptions<TData>): Promise<Response<TData>>; | ||
filterLoggingHeaders(headers: Headers): string[]; | ||
private logRequest; | ||
} | ||
declare namespace RequestClient { | ||
interface RequestOptions<TData = any, TParams = object> { | ||
/** | ||
* The HTTP method | ||
*/ | ||
method: HttpMethod; | ||
/** | ||
* The request URI | ||
*/ | ||
uri: string; | ||
/** | ||
* The username used for auth | ||
*/ | ||
username?: string; | ||
/** | ||
* The password used for auth | ||
*/ | ||
password?: string; | ||
/** | ||
* The request headers | ||
*/ | ||
headers?: Headers; | ||
/** | ||
* The object of params added as query string to the request | ||
*/ | ||
params?: TParams; | ||
/** | ||
* The form data that should be submitted | ||
*/ | ||
data?: TData; | ||
/** | ||
* The request timeout in milliseconds | ||
*/ | ||
timeout?: number; | ||
/** | ||
* Should the client follow redirects | ||
*/ | ||
allowRedirects?: boolean; | ||
/** | ||
* Set to true to use the forever-agent | ||
*/ | ||
forever?: boolean; | ||
/** | ||
* Set to 'debug' to enable debug logging | ||
*/ | ||
logLevel?: string; | ||
} | ||
interface RequestClientOptions { | ||
/** | ||
* A timeout in milliseconds. This will be used as the HTTPS agent's socket | ||
* timeout, AND as the default request timeout. | ||
*/ | ||
timeout?: number; | ||
/** | ||
* https.Agent keepAlive option | ||
*/ | ||
keepAlive?: boolean; | ||
/** | ||
* https.Agent keepAliveMSecs option | ||
*/ | ||
keepAliveMsecs?: number; | ||
/** | ||
* https.Agent maxSockets option | ||
*/ | ||
maxSockets?: number; | ||
/** | ||
* https.Agent maxTotalSockets option | ||
*/ | ||
maxTotalSockets?: number; | ||
/** | ||
* https.Agent maxFreeSockets option | ||
*/ | ||
maxFreeSockets?: number; | ||
/** | ||
* https.Agent scheduling option | ||
*/ | ||
scheduling?: "fifo" | "lifo" | undefined; | ||
/** | ||
* The private CA certificate bundle (if private SSL certificate) | ||
*/ | ||
ca?: string | Buffer; | ||
/** | ||
* Enable auto-retry with exponential backoff when receiving 429 Errors from | ||
* the API. Disabled by default. | ||
*/ | ||
autoRetry?: boolean; | ||
/** | ||
* Maximum retry delay in milliseconds for 429 Error response retries. | ||
* Defaults to 3000. | ||
*/ | ||
maxRetryDelay?: number; | ||
/** | ||
* Maximum number of request retries for 429 Error responses. Defaults to 3. | ||
*/ | ||
maxRetries?: number; | ||
} | ||
} | ||
export = RequestClient; |
@@ -28,3 +28,2 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const axios_1 = __importDefault(require("axios")); | ||
@@ -42,3 +41,3 @@ const fs = __importStar(require("fs")); | ||
const DEFAULT_MAX_RETRIES = 3; | ||
function getExpontentialBackoffResponseHandler(axios, opts) { | ||
function getExponentialBackoffResponseHandler(axios, opts) { | ||
const maxIntervalMillis = opts.maxIntervalMillis; | ||
@@ -115,3 +114,3 @@ const maxRetries = opts.maxRetries; | ||
if (opts.autoRetry) { | ||
this.axios.interceptors.response.use(getExpontentialBackoffResponseHandler(this.axios, { | ||
this.axios.interceptors.response.use(getExponentialBackoffResponseHandler(this.axios, { | ||
maxIntervalMillis: this.maxRetryDelay, | ||
@@ -226,2 +225,2 @@ maxRetries: this.maxRetries, | ||
} | ||
exports.default = RequestClient; | ||
module.exports = RequestClient; |
@@ -1,2 +0,2 @@ | ||
import { BaseTwilio, ClientOpts } from "../base/BaseTwilio"; | ||
import { Client, ClientOpts, RequestOpts } from "../base/BaseTwilio"; | ||
import Accounts from "./Accounts"; | ||
@@ -64,3 +64,3 @@ import Api from "./Api"; | ||
*/ | ||
declare class Twilio extends BaseTwilio { | ||
declare class Twilio extends Client { | ||
/** (Twilio.Accounts) - accounts domain */ | ||
@@ -267,2 +267,8 @@ _accounts?: Accounts; | ||
} | ||
declare namespace Twilio { | ||
interface RequestClientOptions extends ClientOpts { | ||
} | ||
interface RequestOptions extends RequestOpts { | ||
} | ||
} | ||
export = Twilio; |
@@ -18,3 +18,3 @@ "use strict"; | ||
/* jshint ignore:end */ | ||
class Twilio extends BaseTwilio_1.BaseTwilio { | ||
class Twilio extends BaseTwilio_1.Client { | ||
/* jshint ignore:start */ | ||
@@ -21,0 +21,0 @@ /** |
@@ -66,2 +66,2 @@ /** | ||
} | ||
export default FaxResponse; | ||
export = FaxResponse; |
@@ -11,3 +11,2 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const TwiML_1 = __importDefault(require("./TwiML")); | ||
@@ -68,2 +67,2 @@ class FaxResponse extends TwiML_1.default { | ||
})(FaxResponse || (FaxResponse = {})); | ||
exports.default = FaxResponse; | ||
module.exports = FaxResponse; |
@@ -117,2 +117,2 @@ /** | ||
} | ||
export default MessagingResponse; | ||
export = MessagingResponse; |
@@ -11,3 +11,2 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const TwiML_1 = __importDefault(require("./TwiML")); | ||
@@ -121,2 +120,2 @@ class MessagingResponse extends TwiML_1.default { | ||
})(MessagingResponse || (MessagingResponse = {})); | ||
exports.default = MessagingResponse; | ||
module.exports = MessagingResponse; |
@@ -11,3 +11,2 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const TwiML_1 = __importDefault(require("./TwiML")); | ||
@@ -1435,2 +1434,2 @@ class VoiceResponse extends TwiML_1.default { | ||
})(VoiceResponse || (VoiceResponse = {})); | ||
exports.default = VoiceResponse; | ||
module.exports = VoiceResponse; |
{ | ||
"name": "twilio", | ||
"description": "A Twilio helper library", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"author": "API Team <api@twilio.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9668876
239792