Auto-commit 2026-04-29 16:31
This commit is contained in:
20
node_modules/twilio/lib/rest/previewIam/V1.d.ts
generated
vendored
Normal file
20
node_modules/twilio/lib/rest/previewIam/V1.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import PreviewIamBase from "../PreviewIamBase";
|
||||
import Version from "../../base/Version";
|
||||
import { AuthorizeListInstance } from "./v1/authorize";
|
||||
import { TokenListInstance } from "./v1/token";
|
||||
export default class V1 extends Version {
|
||||
/**
|
||||
* Initialize the V1 version of PreviewIam
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.PreviewIam) domain
|
||||
*/
|
||||
constructor(domain: PreviewIamBase);
|
||||
/** authorize - { Twilio.PreviewIam.V1.AuthorizeListInstance } resource */
|
||||
protected _authorize?: AuthorizeListInstance;
|
||||
/** token - { Twilio.PreviewIam.V1.TokenListInstance } resource */
|
||||
protected _token?: TokenListInstance;
|
||||
/** Getter for authorize resource */
|
||||
get authorize(): AuthorizeListInstance;
|
||||
/** Getter for token resource */
|
||||
get token(): TokenListInstance;
|
||||
}
|
||||
42
node_modules/twilio/lib/rest/previewIam/V1.js
generated
vendored
Normal file
42
node_modules/twilio/lib/rest/previewIam/V1.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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 authorize_1 = require("./v1/authorize");
|
||||
const token_1 = require("./v1/token");
|
||||
class V1 extends Version_1.default {
|
||||
/**
|
||||
* Initialize the V1 version of PreviewIam
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.PreviewIam) domain
|
||||
*/
|
||||
constructor(domain) {
|
||||
super(domain, "v1");
|
||||
}
|
||||
/** Getter for authorize resource */
|
||||
get authorize() {
|
||||
this._authorize = this._authorize || (0, authorize_1.AuthorizeListInstance)(this);
|
||||
return this._authorize;
|
||||
}
|
||||
/** Getter for token resource */
|
||||
get token() {
|
||||
this._token = this._token || (0, token_1.TokenListInstance)(this);
|
||||
return this._token;
|
||||
}
|
||||
}
|
||||
exports.default = V1;
|
||||
15
node_modules/twilio/lib/rest/previewIam/Versionless.d.ts
generated
vendored
Normal file
15
node_modules/twilio/lib/rest/previewIam/Versionless.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import PreviewIamBase from "../PreviewIamBase";
|
||||
import Version from "../../base/Version";
|
||||
import { OrganizationListInstance } from "./versionless/organization";
|
||||
export default class Versionless extends Version {
|
||||
/**
|
||||
* Initialize the Versionless version of PreviewIam
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.PreviewIam) domain
|
||||
*/
|
||||
constructor(domain: PreviewIamBase);
|
||||
/** organization - { Twilio.PreviewIam.Versionless.OrganizationListInstance } resource */
|
||||
protected _organization?: OrganizationListInstance;
|
||||
/** Getter for organization resource */
|
||||
get organization(): OrganizationListInstance;
|
||||
}
|
||||
36
node_modules/twilio/lib/rest/previewIam/Versionless.js
generated
vendored
Normal file
36
node_modules/twilio/lib/rest/previewIam/Versionless.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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 organization_1 = require("./versionless/organization");
|
||||
class Versionless extends Version_1.default {
|
||||
/**
|
||||
* Initialize the Versionless version of PreviewIam
|
||||
*
|
||||
* @param domain - The Twilio (Twilio.PreviewIam) domain
|
||||
*/
|
||||
constructor(domain) {
|
||||
super(domain, "Organizations");
|
||||
}
|
||||
/** Getter for organization resource */
|
||||
get organization() {
|
||||
this._organization = this._organization || (0, organization_1.OrganizationListInstance)(this);
|
||||
return this._organization;
|
||||
}
|
||||
}
|
||||
exports.default = Versionless;
|
||||
86
node_modules/twilio/lib/rest/previewIam/v1/authorize.d.ts
generated
vendored
Normal file
86
node_modules/twilio/lib/rest/previewIam/v1/authorize.d.ts
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../V1";
|
||||
import { ApiResponse } from "../../../base/ApiResponse";
|
||||
/**
|
||||
* Options to pass to fetch a AuthorizeInstance
|
||||
*/
|
||||
export interface AuthorizeListInstanceFetchOptions {
|
||||
/** Response Type */
|
||||
responseType?: string;
|
||||
/** The Client Identifier */
|
||||
clientId?: string;
|
||||
/** The url to which response will be redirected to */
|
||||
redirectUri?: string;
|
||||
/** The scope of the access request */
|
||||
scope?: string;
|
||||
/** An opaque value which can be used to maintain state between the request and callback */
|
||||
state?: string;
|
||||
}
|
||||
export interface AuthorizeSolution {
|
||||
}
|
||||
export interface AuthorizeListInstance {
|
||||
_version: V1;
|
||||
_solution: AuthorizeSolution;
|
||||
_uri: string;
|
||||
/**
|
||||
* Fetch a AuthorizeInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AuthorizeInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: AuthorizeInstance) => any): Promise<AuthorizeInstance>;
|
||||
/**
|
||||
* Fetch a AuthorizeInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AuthorizeInstance
|
||||
*/
|
||||
fetch(params: AuthorizeListInstanceFetchOptions, callback?: (error: Error | null, item?: AuthorizeInstance) => any): Promise<AuthorizeInstance>;
|
||||
/**
|
||||
* Fetch a AuthorizeInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AuthorizeInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthorizeInstance>) => any): Promise<ApiResponse<AuthorizeInstance>>;
|
||||
/**
|
||||
* Fetch a AuthorizeInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AuthorizeInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(params: AuthorizeListInstanceFetchOptions, callback?: (error: Error | null, item?: ApiResponse<AuthorizeInstance>) => any): Promise<ApiResponse<AuthorizeInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function AuthorizeListInstance(version: V1): AuthorizeListInstance;
|
||||
interface AuthorizeResource {
|
||||
redirect_to: string;
|
||||
}
|
||||
export declare class AuthorizeInstance {
|
||||
protected _version: V1;
|
||||
constructor(_version: V1, payload: AuthorizeResource);
|
||||
/**
|
||||
* The callback URL
|
||||
*/
|
||||
redirectTo: string;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
redirectTo: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
121
node_modules/twilio/lib/rest/previewIam/v1/authorize.js
generated
vendored
Normal file
121
node_modules/twilio/lib/rest/previewIam/v1/authorize.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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.AuthorizeInstance = void 0;
|
||||
exports.AuthorizeListInstance = AuthorizeListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../base/deserialize");
|
||||
const serialize = require("../../../base/serialize");
|
||||
function AuthorizeListInstance(version) {
|
||||
const instance = {};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = `/authorize`;
|
||||
instance.fetch = function fetch(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["responseType"] !== undefined)
|
||||
data["response_type"] = params["responseType"];
|
||||
if (params["clientId"] !== undefined)
|
||||
data["client_id"] = params["clientId"];
|
||||
if (params["redirectUri"] !== undefined)
|
||||
data["redirect_uri"] = params["redirectUri"];
|
||||
if (params["scope"] !== undefined)
|
||||
data["scope"] = params["scope"];
|
||||
if (params["state"] !== undefined)
|
||||
data["state"] = params["state"];
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.fetch({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new AuthorizeInstance(operationVersion, payload));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.fetchWithHttpInfo = function fetchWithHttpInfo(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["responseType"] !== undefined)
|
||||
data["response_type"] = params["responseType"];
|
||||
if (params["clientId"] !== undefined)
|
||||
data["client_id"] = params["clientId"];
|
||||
if (params["redirectUri"] !== undefined)
|
||||
data["redirect_uri"] = params["redirectUri"];
|
||||
if (params["scope"] !== undefined)
|
||||
data["scope"] = params["scope"];
|
||||
if (params["state"] !== undefined)
|
||||
data["state"] = params["state"];
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.fetchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new AuthorizeInstance(operationVersion, response.body),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.toJSON = function toJSON() {
|
||||
return instance._solution;
|
||||
};
|
||||
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
||||
return (0, util_1.inspect)(instance.toJSON(), options);
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
class AuthorizeInstance {
|
||||
constructor(_version, payload) {
|
||||
this._version = _version;
|
||||
this.redirectTo = payload.redirect_to;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
redirectTo: this.redirectTo,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AuthorizeInstance = AuthorizeInstance;
|
||||
97
node_modules/twilio/lib/rest/previewIam/v1/token.d.ts
generated
vendored
Normal file
97
node_modules/twilio/lib/rest/previewIam/v1/token.d.ts
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import V1 from "../V1";
|
||||
import { ApiResponse } from "../../../base/ApiResponse";
|
||||
/**
|
||||
* Options to pass to create a TokenInstance
|
||||
*/
|
||||
export interface TokenListInstanceCreateOptions {
|
||||
/** Grant type is a credential representing resource owner\\\'s authorization which can be used by client to obtain access token. */
|
||||
grantType: string;
|
||||
/** A 34 character string that uniquely identifies this OAuth App. */
|
||||
clientId: string;
|
||||
/** The credential for confidential OAuth App. */
|
||||
clientSecret?: string;
|
||||
/** JWT token related to the authorization code grant type. */
|
||||
code?: string;
|
||||
/** The redirect uri */
|
||||
redirectUri?: string;
|
||||
/** The targeted audience uri */
|
||||
audience?: string;
|
||||
/** JWT token related to refresh access token. */
|
||||
refreshToken?: string;
|
||||
/** The scope of token */
|
||||
scope?: string;
|
||||
}
|
||||
export interface TokenSolution {
|
||||
}
|
||||
export interface TokenListInstance {
|
||||
_version: V1;
|
||||
_solution: TokenSolution;
|
||||
_uri: string;
|
||||
/**
|
||||
* Create a TokenInstance
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed TokenInstance
|
||||
*/
|
||||
create(params: TokenListInstanceCreateOptions, callback?: (error: Error | null, item?: TokenInstance) => any): Promise<TokenInstance>;
|
||||
/**
|
||||
* Create a TokenInstance and return HTTP info
|
||||
*
|
||||
* @param params - Parameter for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed TokenInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: TokenListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TokenInstance>) => any): Promise<ApiResponse<TokenInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function TokenListInstance(version: V1): TokenListInstance;
|
||||
interface TokenResource {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
id_token: string;
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
}
|
||||
export declare class TokenInstance {
|
||||
protected _version: V1;
|
||||
constructor(_version: V1, payload: TokenResource);
|
||||
/**
|
||||
* Token which carries the necessary information to access a Twilio resource directly.
|
||||
*/
|
||||
accessToken: string;
|
||||
/**
|
||||
* Token which carries the information necessary to get a new access token.
|
||||
*/
|
||||
refreshToken: string;
|
||||
/**
|
||||
* Token which carries the information necessary of user profile.
|
||||
*/
|
||||
idToken: string;
|
||||
/**
|
||||
* Token type
|
||||
*/
|
||||
tokenType: string;
|
||||
expiresIn: number;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
idToken: string;
|
||||
tokenType: string;
|
||||
expiresIn: number;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
143
node_modules/twilio/lib/rest/previewIam/v1/token.js
generated
vendored
Normal file
143
node_modules/twilio/lib/rest/previewIam/v1/token.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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.TokenInstance = void 0;
|
||||
exports.TokenListInstance = TokenListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../base/deserialize");
|
||||
const serialize = require("../../../base/serialize");
|
||||
function TokenListInstance(version) {
|
||||
const instance = {};
|
||||
instance._version = version;
|
||||
instance._solution = {};
|
||||
instance._uri = `/token`;
|
||||
instance.create = function create(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["grantType"] === null || params["grantType"] === undefined) {
|
||||
throw new Error("Required parameter \"params['grantType']\" missing.");
|
||||
}
|
||||
if (params["clientId"] === null || params["clientId"] === undefined) {
|
||||
throw new Error("Required parameter \"params['clientId']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["grant_type"] = params["grantType"];
|
||||
data["client_id"] = params["clientId"];
|
||||
if (params["clientSecret"] !== undefined)
|
||||
data["client_secret"] = params["clientSecret"];
|
||||
if (params["code"] !== undefined)
|
||||
data["code"] = params["code"];
|
||||
if (params["redirectUri"] !== undefined)
|
||||
data["redirect_uri"] = params["redirectUri"];
|
||||
if (params["audience"] !== undefined)
|
||||
data["audience"] = params["audience"];
|
||||
if (params["refreshToken"] !== undefined)
|
||||
data["refresh_token"] = params["refreshToken"];
|
||||
if (params["scope"] !== undefined)
|
||||
data["scope"] = params["scope"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new TokenInstance(operationVersion, payload));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
if (params["grantType"] === null || params["grantType"] === undefined) {
|
||||
throw new Error("Required parameter \"params['grantType']\" missing.");
|
||||
}
|
||||
if (params["clientId"] === null || params["clientId"] === undefined) {
|
||||
throw new Error("Required parameter \"params['clientId']\" missing.");
|
||||
}
|
||||
let data = {};
|
||||
data["grant_type"] = params["grantType"];
|
||||
data["client_id"] = params["clientId"];
|
||||
if (params["clientSecret"] !== undefined)
|
||||
data["client_secret"] = params["clientSecret"];
|
||||
if (params["code"] !== undefined)
|
||||
data["code"] = params["code"];
|
||||
if (params["redirectUri"] !== undefined)
|
||||
data["redirect_uri"] = params["redirectUri"];
|
||||
if (params["audience"] !== undefined)
|
||||
data["audience"] = params["audience"];
|
||||
if (params["refreshToken"] !== undefined)
|
||||
data["refresh_token"] = params["refreshToken"];
|
||||
if (params["scope"] !== undefined)
|
||||
data["scope"] = params["scope"];
|
||||
const headers = {};
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new TokenInstance(operationVersion, response.body),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.toJSON = function toJSON() {
|
||||
return instance._solution;
|
||||
};
|
||||
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
||||
return (0, util_1.inspect)(instance.toJSON(), options);
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
class TokenInstance {
|
||||
constructor(_version, payload) {
|
||||
this._version = _version;
|
||||
this.accessToken = payload.access_token;
|
||||
this.refreshToken = payload.refresh_token;
|
||||
this.idToken = payload.id_token;
|
||||
this.tokenType = payload.token_type;
|
||||
this.expiresIn = payload.expires_in;
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
accessToken: this.accessToken,
|
||||
refreshToken: this.refreshToken,
|
||||
idToken: this.idToken,
|
||||
tokenType: this.tokenType,
|
||||
expiresIn: this.expiresIn,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.TokenInstance = TokenInstance;
|
||||
52
node_modules/twilio/lib/rest/previewIam/versionless/organization.d.ts
generated
vendored
Normal file
52
node_modules/twilio/lib/rest/previewIam/versionless/organization.d.ts
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import Versionless from "../Versionless";
|
||||
import { AccountListInstance } from "./organization/account";
|
||||
import { RoleAssignmentListInstance } from "./organization/roleAssignment";
|
||||
import { UserListInstance } from "./organization/user";
|
||||
export interface OrganizationContext {
|
||||
accounts: AccountListInstance;
|
||||
roleAssignments: RoleAssignmentListInstance;
|
||||
users: UserListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface OrganizationContextSolution {
|
||||
organizationSid: string;
|
||||
}
|
||||
export declare class OrganizationContextImpl implements OrganizationContext {
|
||||
protected _version: Versionless;
|
||||
protected _solution: OrganizationContextSolution;
|
||||
protected _uri: string;
|
||||
protected _accounts?: AccountListInstance;
|
||||
protected _roleAssignments?: RoleAssignmentListInstance;
|
||||
protected _users?: UserListInstance;
|
||||
constructor(_version: Versionless, organizationSid: string);
|
||||
get accounts(): AccountListInstance;
|
||||
get roleAssignments(): RoleAssignmentListInstance;
|
||||
get users(): UserListInstance;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): OrganizationContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface OrganizationSolution {
|
||||
}
|
||||
export interface OrganizationListInstance {
|
||||
_version: Versionless;
|
||||
_solution: OrganizationSolution;
|
||||
_uri: string;
|
||||
(organizationSid: string): OrganizationContext;
|
||||
get(organizationSid: string): OrganizationContext;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function OrganizationListInstance(version: Versionless): OrganizationListInstance;
|
||||
80
node_modules/twilio/lib/rest/previewIam/versionless/organization.js
generated
vendored
Normal file
80
node_modules/twilio/lib/rest/previewIam/versionless/organization.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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.OrganizationContextImpl = void 0;
|
||||
exports.OrganizationListInstance = OrganizationListInstance;
|
||||
const util_1 = require("util");
|
||||
const deserialize = require("../../../base/deserialize");
|
||||
const serialize = require("../../../base/serialize");
|
||||
const utility_1 = require("../../../base/utility");
|
||||
const account_1 = require("./organization/account");
|
||||
const roleAssignment_1 = require("./organization/roleAssignment");
|
||||
const user_1 = require("./organization/user");
|
||||
class OrganizationContextImpl {
|
||||
constructor(_version, organizationSid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(organizationSid)) {
|
||||
throw new Error("Parameter 'organizationSid' is not valid.");
|
||||
}
|
||||
this._solution = { organizationSid };
|
||||
this._uri = `/${organizationSid}`;
|
||||
}
|
||||
get accounts() {
|
||||
this._accounts =
|
||||
this._accounts ||
|
||||
(0, account_1.AccountListInstance)(this._version, this._solution.organizationSid);
|
||||
return this._accounts;
|
||||
}
|
||||
get roleAssignments() {
|
||||
this._roleAssignments =
|
||||
this._roleAssignments ||
|
||||
(0, roleAssignment_1.RoleAssignmentListInstance)(this._version, this._solution.organizationSid);
|
||||
return this._roleAssignments;
|
||||
}
|
||||
get users() {
|
||||
this._users =
|
||||
this._users ||
|
||||
(0, user_1.UserListInstance)(this._version, this._solution.organizationSid);
|
||||
return this._users;
|
||||
}
|
||||
/**
|
||||
* 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.OrganizationContextImpl = OrganizationContextImpl;
|
||||
function OrganizationListInstance(version) {
|
||||
const instance = ((organizationSid) => instance.get(organizationSid));
|
||||
instance.get = function get(organizationSid) {
|
||||
return new OrganizationContextImpl(version, organizationSid);
|
||||
};
|
||||
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;
|
||||
}
|
||||
285
node_modules/twilio/lib/rest/previewIam/versionless/organization/account.d.ts
generated
vendored
Normal file
285
node_modules/twilio/lib/rest/previewIam/versionless/organization/account.d.ts
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import Page, { TwilioResponsePayload } from "../../../../base/Page";
|
||||
import Response from "../../../../http/response";
|
||||
import Versionless from "../../Versionless";
|
||||
import { ApiResponse } from "../../../../base/ApiResponse";
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface AccountListInstanceEachOptions {
|
||||
/** */
|
||||
pageSize?: number;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: AccountInstance, 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 AccountListInstanceOptions {
|
||||
/** */
|
||||
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 AccountListInstancePageOptions {
|
||||
/** */
|
||||
pageSize?: number;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface AccountContext {
|
||||
/**
|
||||
* Fetch a AccountInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AccountInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>;
|
||||
/**
|
||||
* Fetch a AccountInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AccountInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AccountInstance>) => any): Promise<ApiResponse<AccountInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface AccountContextSolution {
|
||||
organizationSid: string;
|
||||
accountSid: string;
|
||||
}
|
||||
export declare class AccountContextImpl implements AccountContext {
|
||||
protected _version: Versionless;
|
||||
protected _solution: AccountContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: Versionless, organizationSid: string, accountSid: string);
|
||||
fetch(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AccountInstance>) => any): Promise<ApiResponse<AccountInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): AccountContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface AccountPayload extends TwilioResponsePayload {
|
||||
content: AccountResource[];
|
||||
}
|
||||
interface AccountResource {
|
||||
account_sid: string;
|
||||
friendly_name: string;
|
||||
status: string;
|
||||
owner_sid: string;
|
||||
date_created: Date;
|
||||
}
|
||||
/**
|
||||
* Page content
|
||||
*/
|
||||
export declare class AccountInstance {
|
||||
protected _version: Versionless;
|
||||
protected _solution: AccountContextSolution;
|
||||
protected _context?: AccountContext;
|
||||
constructor(_version: Versionless, payload: AccountResource, organizationSid: string, accountSid?: string);
|
||||
/**
|
||||
* Twilio account sid
|
||||
*/
|
||||
accountSid: string;
|
||||
/**
|
||||
* Account friendly name
|
||||
*/
|
||||
friendlyName: string;
|
||||
/**
|
||||
* Account status
|
||||
*/
|
||||
status: string;
|
||||
/**
|
||||
* Twilio account sid
|
||||
*/
|
||||
ownerSid: string;
|
||||
/**
|
||||
* The date and time when the account was created in the system
|
||||
*/
|
||||
dateCreated: Date;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Fetch a AccountInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AccountInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>;
|
||||
/**
|
||||
* Fetch a AccountInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AccountInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AccountInstance>) => any): Promise<ApiResponse<AccountInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
accountSid: string;
|
||||
friendlyName: string;
|
||||
status: string;
|
||||
ownerSid: string;
|
||||
dateCreated: Date;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface AccountSolution {
|
||||
organizationSid: string;
|
||||
}
|
||||
export interface AccountListInstance {
|
||||
_version: Versionless;
|
||||
_solution: AccountSolution;
|
||||
_uri: string;
|
||||
(accountSid: string): AccountContext;
|
||||
get(accountSid: string): AccountContext;
|
||||
/**
|
||||
* Streams AccountInstance 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 { AccountListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: AccountInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: AccountListInstanceEachOptions, callback?: (item: AccountInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams AccountInstance 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 { AccountListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: AccountInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: AccountListInstanceEachOptions, callback?: (item: AccountInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of AccountInstance 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: AccountPage) => any): Promise<AccountPage>;
|
||||
/**
|
||||
* Retrieve a single target page of AccountInstance 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<AccountPage>) => any): Promise<ApiResponse<AccountPage>>;
|
||||
/**
|
||||
* Lists AccountInstance 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 { AccountListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: AccountInstance[]) => any): Promise<AccountInstance[]>;
|
||||
list(params: AccountListInstanceOptions, callback?: (error: Error | null, items: AccountInstance[]) => any): Promise<AccountInstance[]>;
|
||||
/**
|
||||
* Lists AccountInstance 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 { AccountListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AccountInstance[]>) => any): Promise<ApiResponse<AccountInstance[]>>;
|
||||
listWithHttpInfo(params: AccountListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AccountInstance[]>) => any): Promise<ApiResponse<AccountInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of AccountInstance 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 { AccountListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: AccountPage) => any): Promise<AccountPage>;
|
||||
page(params: AccountListInstancePageOptions, callback?: (error: Error | null, items: AccountPage) => any): Promise<AccountPage>;
|
||||
/**
|
||||
* Retrieve a single page of AccountInstance 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 { AccountListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AccountPage>) => any): Promise<ApiResponse<AccountPage>>;
|
||||
pageWithHttpInfo(params: AccountListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AccountPage>) => any): Promise<ApiResponse<AccountPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function AccountListInstance(version: Versionless, organizationSid: string): AccountListInstance;
|
||||
export declare class AccountPage extends Page<Versionless, AccountPayload, AccountResource, AccountInstance> {
|
||||
/**
|
||||
* Initialize the AccountPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: Versionless, response: Response<string>, solution: AccountSolution);
|
||||
/**
|
||||
* Build an instance of AccountInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: AccountResource): AccountInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
272
node_modules/twilio/lib/rest/previewIam/versionless/organization/account.js
generated
vendored
Normal file
272
node_modules/twilio/lib/rest/previewIam/versionless/organization/account.js
generated
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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.AccountPage = exports.AccountInstance = exports.AccountContextImpl = void 0;
|
||||
exports.AccountListInstance = AccountListInstance;
|
||||
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 AccountContextImpl {
|
||||
constructor(_version, organizationSid, accountSid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(organizationSid)) {
|
||||
throw new Error("Parameter 'organizationSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(accountSid)) {
|
||||
throw new Error("Parameter 'accountSid' is not valid.");
|
||||
}
|
||||
this._solution = { organizationSid, accountSid };
|
||||
this._uri = `/${organizationSid}/Accounts/${accountSid}`;
|
||||
}
|
||||
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 AccountInstance(operationVersion, payload, instance._solution.organizationSid, instance._solution.accountSid));
|
||||
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 AccountInstance(operationVersion, response.body, instance._solution.organizationSid, instance._solution.accountSid),
|
||||
}));
|
||||
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.AccountContextImpl = AccountContextImpl;
|
||||
/**
|
||||
* Page content
|
||||
*/
|
||||
class AccountInstance {
|
||||
constructor(_version, payload, organizationSid, accountSid) {
|
||||
this._version = _version;
|
||||
this.accountSid = payload.account_sid;
|
||||
this.friendlyName = payload.friendly_name;
|
||||
this.status = payload.status;
|
||||
this.ownerSid = payload.owner_sid;
|
||||
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
||||
this._solution = {
|
||||
organizationSid,
|
||||
accountSid: accountSid || this.accountSid,
|
||||
};
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new AccountContextImpl(this._version, this._solution.organizationSid, this._solution.accountSid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Fetch a AccountInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AccountInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a AccountInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed AccountInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
accountSid: this.accountSid,
|
||||
friendlyName: this.friendlyName,
|
||||
status: this.status,
|
||||
ownerSid: this.ownerSid,
|
||||
dateCreated: this.dateCreated,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AccountInstance = AccountInstance;
|
||||
function AccountListInstance(version, organizationSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(organizationSid)) {
|
||||
throw new Error("Parameter 'organizationSid' is not valid.");
|
||||
}
|
||||
const instance = ((accountSid) => instance.get(accountSid));
|
||||
instance.get = function get(accountSid) {
|
||||
return new AccountContextImpl(version, organizationSid, accountSid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { organizationSid };
|
||||
instance._uri = `/${organizationSid}/Accounts`;
|
||||
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 AccountPage(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 AccountPage(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 AccountPage(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 AccountPage(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 AccountPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the AccountPage
|
||||
*
|
||||
* @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 AccountInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new AccountInstance(this._version, payload, this._solution.organizationSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.AccountPage = AccountPage;
|
||||
354
node_modules/twilio/lib/rest/previewIam/versionless/organization/roleAssignment.d.ts
generated
vendored
Normal file
354
node_modules/twilio/lib/rest/previewIam/versionless/organization/roleAssignment.d.ts
generated
vendored
Normal file
@@ -0,0 +1,354 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import Page, { TwilioResponsePayload } from "../../../../base/Page";
|
||||
import Response from "../../../../http/response";
|
||||
import Versionless from "../../Versionless";
|
||||
import { ApiResponse } from "../../../../base/ApiResponse";
|
||||
export declare class PublicApiCreateRoleAssignmentRequest {
|
||||
/**
|
||||
* Twilio Role Sid representing assigned role
|
||||
*/
|
||||
"roleSid": string;
|
||||
/**
|
||||
* Twilio Sid representing scope of this assignment
|
||||
*/
|
||||
"scope": string;
|
||||
/**
|
||||
* Twilio Sid representing identity of this assignment
|
||||
*/
|
||||
"identity": string;
|
||||
constructor(payload: any);
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a RoleAssignmentInstance
|
||||
*/
|
||||
export interface RoleAssignmentListInstanceCreateOptions {
|
||||
/** */
|
||||
publicApiCreateRoleAssignmentRequest: PublicApiCreateRoleAssignmentRequest;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface RoleAssignmentListInstanceEachOptions {
|
||||
/** */
|
||||
pageSize?: number;
|
||||
/** */
|
||||
identity?: string;
|
||||
/** */
|
||||
scope?: string;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: RoleAssignmentInstance, 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 RoleAssignmentListInstanceOptions {
|
||||
/** */
|
||||
pageSize?: number;
|
||||
/** */
|
||||
identity?: string;
|
||||
/** */
|
||||
scope?: string;
|
||||
/** 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 RoleAssignmentListInstancePageOptions {
|
||||
/** */
|
||||
pageSize?: number;
|
||||
/** */
|
||||
identity?: string;
|
||||
/** */
|
||||
scope?: string;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface RoleAssignmentContext {
|
||||
/**
|
||||
* Remove a RoleAssignmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a RoleAssignmentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface RoleAssignmentContextSolution {
|
||||
organizationSid: string;
|
||||
sid: string;
|
||||
}
|
||||
export declare class RoleAssignmentContextImpl implements RoleAssignmentContext {
|
||||
protected _version: Versionless;
|
||||
protected _solution: RoleAssignmentContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: Versionless, organizationSid: string, sid: string);
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): RoleAssignmentContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface RoleAssignmentPayload extends TwilioResponsePayload {
|
||||
content: RoleAssignmentResource[];
|
||||
}
|
||||
interface RoleAssignmentResource {
|
||||
sid: string;
|
||||
role_sid: string;
|
||||
scope: string;
|
||||
identity: string;
|
||||
code: number;
|
||||
message: string;
|
||||
moreInfo: string;
|
||||
status: number;
|
||||
}
|
||||
export declare class RoleAssignmentInstance {
|
||||
protected _version: Versionless;
|
||||
protected _solution: RoleAssignmentContextSolution;
|
||||
protected _context?: RoleAssignmentContext;
|
||||
constructor(_version: Versionless, payload: RoleAssignmentResource, organizationSid: string, sid?: string);
|
||||
/**
|
||||
* Twilio Role Assignment Sid representing this role assignment
|
||||
*/
|
||||
sid: string;
|
||||
/**
|
||||
* Twilio Role Sid representing assigned role
|
||||
*/
|
||||
roleSid: string;
|
||||
/**
|
||||
* Twilio Sid representing identity of this assignment
|
||||
*/
|
||||
scope: string;
|
||||
/**
|
||||
* Twilio Sid representing scope of this assignment
|
||||
*/
|
||||
identity: string;
|
||||
/**
|
||||
* Twilio-specific error code
|
||||
*/
|
||||
code: number;
|
||||
/**
|
||||
* Error message
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* Link to Error Code References
|
||||
*/
|
||||
moreInfo: string;
|
||||
/**
|
||||
* HTTP response status code
|
||||
*/
|
||||
status: number;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a RoleAssignmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a RoleAssignmentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
sid: string;
|
||||
roleSid: string;
|
||||
scope: string;
|
||||
identity: string;
|
||||
code: number;
|
||||
message: string;
|
||||
moreInfo: string;
|
||||
status: number;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface RoleAssignmentSolution {
|
||||
organizationSid: string;
|
||||
}
|
||||
export interface RoleAssignmentListInstance {
|
||||
_version: Versionless;
|
||||
_solution: RoleAssignmentSolution;
|
||||
_uri: string;
|
||||
(sid: string): RoleAssignmentContext;
|
||||
get(sid: string): RoleAssignmentContext;
|
||||
/**
|
||||
* Create a RoleAssignmentInstance
|
||||
*
|
||||
* @param params - Body for request
|
||||
* @param headers - header params for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed RoleAssignmentInstance
|
||||
*/
|
||||
create(params: PublicApiCreateRoleAssignmentRequest, headers?: any, callback?: (error: Error | null, item?: RoleAssignmentInstance) => any): Promise<RoleAssignmentInstance>;
|
||||
/**
|
||||
* Create a RoleAssignmentInstance 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 RoleAssignmentInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: PublicApiCreateRoleAssignmentRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<RoleAssignmentInstance>) => any): Promise<ApiResponse<RoleAssignmentInstance>>;
|
||||
/**
|
||||
* Streams RoleAssignmentInstance 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 { RoleAssignmentListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: RoleAssignmentInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: RoleAssignmentListInstanceEachOptions, callback?: (item: RoleAssignmentInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams RoleAssignmentInstance 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 { RoleAssignmentListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: RoleAssignmentInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: RoleAssignmentListInstanceEachOptions, callback?: (item: RoleAssignmentInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of RoleAssignmentInstance 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: RoleAssignmentPage) => any): Promise<RoleAssignmentPage>;
|
||||
/**
|
||||
* Retrieve a single target page of RoleAssignmentInstance 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<RoleAssignmentPage>) => any): Promise<ApiResponse<RoleAssignmentPage>>;
|
||||
/**
|
||||
* Lists RoleAssignmentInstance 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 { RoleAssignmentListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: RoleAssignmentInstance[]) => any): Promise<RoleAssignmentInstance[]>;
|
||||
list(params: RoleAssignmentListInstanceOptions, callback?: (error: Error | null, items: RoleAssignmentInstance[]) => any): Promise<RoleAssignmentInstance[]>;
|
||||
/**
|
||||
* Lists RoleAssignmentInstance 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 { RoleAssignmentListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RoleAssignmentInstance[]>) => any): Promise<ApiResponse<RoleAssignmentInstance[]>>;
|
||||
listWithHttpInfo(params: RoleAssignmentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<RoleAssignmentInstance[]>) => any): Promise<ApiResponse<RoleAssignmentInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of RoleAssignmentInstance 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 { RoleAssignmentListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: RoleAssignmentPage) => any): Promise<RoleAssignmentPage>;
|
||||
page(params: RoleAssignmentListInstancePageOptions, callback?: (error: Error | null, items: RoleAssignmentPage) => any): Promise<RoleAssignmentPage>;
|
||||
/**
|
||||
* Retrieve a single page of RoleAssignmentInstance 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 { RoleAssignmentListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RoleAssignmentPage>) => any): Promise<ApiResponse<RoleAssignmentPage>>;
|
||||
pageWithHttpInfo(params: RoleAssignmentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<RoleAssignmentPage>) => any): Promise<ApiResponse<RoleAssignmentPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function RoleAssignmentListInstance(version: Versionless, organizationSid: string): RoleAssignmentListInstance;
|
||||
export declare class RoleAssignmentPage extends Page<Versionless, RoleAssignmentPayload, RoleAssignmentResource, RoleAssignmentInstance> {
|
||||
/**
|
||||
* Initialize the RoleAssignmentPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: Versionless, response: Response<string>, solution: RoleAssignmentSolution);
|
||||
/**
|
||||
* Build an instance of RoleAssignmentInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: RoleAssignmentResource): RoleAssignmentInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
329
node_modules/twilio/lib/rest/previewIam/versionless/organization/roleAssignment.js
generated
vendored
Normal file
329
node_modules/twilio/lib/rest/previewIam/versionless/organization/roleAssignment.js
generated
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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.RoleAssignmentPage = exports.RoleAssignmentInstance = exports.RoleAssignmentContextImpl = exports.PublicApiCreateRoleAssignmentRequest = void 0;
|
||||
exports.RoleAssignmentListInstance = RoleAssignmentListInstance;
|
||||
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 PublicApiCreateRoleAssignmentRequest {
|
||||
constructor(payload) {
|
||||
this.roleSid = payload["role_sid"];
|
||||
this.scope = payload["scope"];
|
||||
this.identity = payload["identity"];
|
||||
}
|
||||
}
|
||||
exports.PublicApiCreateRoleAssignmentRequest = PublicApiCreateRoleAssignmentRequest;
|
||||
class RoleAssignmentContextImpl {
|
||||
constructor(_version, organizationSid, sid) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(organizationSid)) {
|
||||
throw new Error("Parameter 'organizationSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(sid)) {
|
||||
throw new Error("Parameter 'sid' is not valid.");
|
||||
}
|
||||
this._solution = { organizationSid, sid };
|
||||
this._uri = `/${organizationSid}/RoleAssignments/${sid}`;
|
||||
}
|
||||
remove(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
||||
uri: instance._uri,
|
||||
method: "delete",
|
||||
headers,
|
||||
});
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
removeWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// DELETE operation - returns boolean based on status code
|
||||
let operationPromise = operationVersion
|
||||
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: response.statusCode === 204,
|
||||
}));
|
||||
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.RoleAssignmentContextImpl = RoleAssignmentContextImpl;
|
||||
class RoleAssignmentInstance {
|
||||
constructor(_version, payload, organizationSid, sid) {
|
||||
this._version = _version;
|
||||
this.sid = payload.sid;
|
||||
this.roleSid = payload.role_sid;
|
||||
this.scope = payload.scope;
|
||||
this.identity = payload.identity;
|
||||
this.code = payload.code;
|
||||
this.message = payload.message;
|
||||
this.moreInfo = payload.moreInfo;
|
||||
this.status = payload.status;
|
||||
this._solution = { organizationSid, sid: sid || this.sid };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new RoleAssignmentContextImpl(this._version, this._solution.organizationSid, this._solution.sid);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a RoleAssignmentInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a RoleAssignmentInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback) {
|
||||
return this._proxy.removeWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON() {
|
||||
return {
|
||||
sid: this.sid,
|
||||
roleSid: this.roleSid,
|
||||
scope: this.scope,
|
||||
identity: this.identity,
|
||||
code: this.code,
|
||||
message: this.message,
|
||||
moreInfo: this.moreInfo,
|
||||
status: this.status,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.RoleAssignmentInstance = RoleAssignmentInstance;
|
||||
function RoleAssignmentListInstance(version, organizationSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(organizationSid)) {
|
||||
throw new Error("Parameter 'organizationSid' is not valid.");
|
||||
}
|
||||
const instance = ((sid) => instance.get(sid));
|
||||
instance.get = function get(sid) {
|
||||
return new RoleAssignmentContextImpl(version, organizationSid, sid);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { organizationSid };
|
||||
instance._uri = `/${organizationSid}/RoleAssignments`;
|
||||
instance.create = function create(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new RoleAssignmentInstance(operationVersion, payload, instance._solution.organizationSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new RoleAssignmentInstance(operationVersion, response.body, instance._solution.organizationSid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
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["identity"] !== undefined)
|
||||
data["Identity"] = params["identity"];
|
||||
if (params["scope"] !== undefined)
|
||||
data["Scope"] = params["scope"];
|
||||
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 RoleAssignmentPage(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 RoleAssignmentPage(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["identity"] !== undefined)
|
||||
data["Identity"] = params["identity"];
|
||||
if (params["scope"] !== undefined)
|
||||
data["Scope"] = params["scope"];
|
||||
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 RoleAssignmentPage(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 RoleAssignmentPage(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 RoleAssignmentPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the RoleAssignmentPage
|
||||
*
|
||||
* @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 RoleAssignmentInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new RoleAssignmentInstance(this._version, payload, this._solution.organizationSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.RoleAssignmentPage = RoleAssignmentPage;
|
||||
634
node_modules/twilio/lib/rest/previewIam/versionless/organization/user.d.ts
generated
vendored
Normal file
634
node_modules/twilio/lib/rest/previewIam/versionless/organization/user.d.ts
generated
vendored
Normal file
@@ -0,0 +1,634 @@
|
||||
import { inspect, InspectOptions } from "util";
|
||||
import Page, { TwilioResponsePayload } from "../../../../base/Page";
|
||||
import Response from "../../../../http/response";
|
||||
import Versionless from "../../Versionless";
|
||||
import { ApiResponse } from "../../../../base/ApiResponse";
|
||||
/**
|
||||
* Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username.
|
||||
*/
|
||||
export declare class ScimEmailAddress {
|
||||
/**
|
||||
* Indicates if this email address is the primary one
|
||||
*/
|
||||
"primary"?: boolean;
|
||||
/**
|
||||
* The actual email address value
|
||||
*/
|
||||
"value"?: string;
|
||||
/**
|
||||
* The type of email address (e.g., work, home, etc.)
|
||||
*/
|
||||
"type"?: string;
|
||||
constructor(payload: any);
|
||||
}
|
||||
/**
|
||||
* Meta
|
||||
*/
|
||||
export declare class ScimMeta {
|
||||
/**
|
||||
* Indicates the type of the resource
|
||||
*/
|
||||
"resourceType"?: string;
|
||||
/**
|
||||
* The date and time when the resource was created in the system
|
||||
*/
|
||||
"created"?: Date;
|
||||
/**
|
||||
* The date and time when the resource was last modified
|
||||
*/
|
||||
"lastModified"?: Date;
|
||||
/**
|
||||
* A version identifier for the resource. This can be used to manage resource versioning and concurrency control.
|
||||
*/
|
||||
"version"?: string;
|
||||
constructor(payload: any);
|
||||
}
|
||||
/**
|
||||
* User\'s name
|
||||
*/
|
||||
export declare class ScimName {
|
||||
/**
|
||||
* The user\'s first or given name
|
||||
*/
|
||||
"givenName"?: string;
|
||||
/**
|
||||
* The user\'s last or family name
|
||||
*/
|
||||
"familyName"?: string;
|
||||
constructor(payload: any);
|
||||
}
|
||||
export declare class ScimPatchOperation {
|
||||
/**
|
||||
* The operation to perform
|
||||
*/
|
||||
"op"?: string;
|
||||
"path"?: string;
|
||||
"value"?: Record<string, object>;
|
||||
constructor(payload: any);
|
||||
}
|
||||
export declare class ScimPatchRequest {
|
||||
"schemas"?: Array<string>;
|
||||
"operations"?: Array<ScimPatchOperation>;
|
||||
constructor(payload: any);
|
||||
}
|
||||
export declare class ScimUser {
|
||||
/**
|
||||
* Unique Twilio user sid
|
||||
*/
|
||||
"id"?: string;
|
||||
/**
|
||||
* External unique resource id defined by provisioning client
|
||||
*/
|
||||
"externalId"?: string;
|
||||
/**
|
||||
* Unique username, MUST be same as primary email address
|
||||
*/
|
||||
"userName": string;
|
||||
/**
|
||||
* User friendly display name
|
||||
*/
|
||||
"displayName"?: string;
|
||||
"name"?: ScimName;
|
||||
/**
|
||||
* Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username.
|
||||
*/
|
||||
"emails"?: Array<ScimEmailAddress>;
|
||||
/**
|
||||
* Indicates whether the user is active
|
||||
*/
|
||||
"active"?: boolean;
|
||||
/**
|
||||
* User\'s locale
|
||||
*/
|
||||
"locale"?: string;
|
||||
/**
|
||||
* User\'s time zone
|
||||
*/
|
||||
"timezone"?: string;
|
||||
/**
|
||||
* An array of URIs that indicate the schemas supported for this user resource
|
||||
*/
|
||||
"schemas"?: Array<string>;
|
||||
"meta"?: ScimMeta;
|
||||
/**
|
||||
* A human-readable description of the error
|
||||
*/
|
||||
"detail"?: string;
|
||||
/**
|
||||
* A scimType error code as defined in RFC7644
|
||||
*/
|
||||
"scimType"?: string;
|
||||
/**
|
||||
* Http status code
|
||||
*/
|
||||
"status"?: string;
|
||||
/**
|
||||
* Twilio-specific error code
|
||||
*/
|
||||
"code"?: number;
|
||||
/**
|
||||
* Link to Error Code References
|
||||
*/
|
||||
"moreInfo"?: string;
|
||||
constructor(payload: any);
|
||||
}
|
||||
/**
|
||||
* Options to pass to patch a UserInstance
|
||||
*/
|
||||
export interface UserContextPatchOptions {
|
||||
/** */
|
||||
scimPatchRequest: ScimPatchRequest;
|
||||
/** */
|
||||
ifMatch?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to update a UserInstance
|
||||
*/
|
||||
export interface UserContextUpdateOptions {
|
||||
/** */
|
||||
scimUser: ScimUser;
|
||||
/** */
|
||||
ifMatch?: string;
|
||||
}
|
||||
/**
|
||||
* Options to pass to create a UserInstance
|
||||
*/
|
||||
export interface UserListInstanceCreateOptions {
|
||||
/** */
|
||||
scimUser: ScimUser;
|
||||
}
|
||||
/**
|
||||
* Options to pass to each
|
||||
*/
|
||||
export interface UserListInstanceEachOptions {
|
||||
/** */
|
||||
filter?: string;
|
||||
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
||||
callback?: (item: UserInstance, 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 UserListInstanceOptions {
|
||||
/** */
|
||||
filter?: string;
|
||||
/** 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 UserListInstancePageOptions {
|
||||
/** */
|
||||
filter?: string;
|
||||
/** Page Number, this value is simply for client state */
|
||||
pageNumber?: number;
|
||||
/** PageToken provided by the API */
|
||||
pageToken?: string;
|
||||
}
|
||||
export interface UserContext {
|
||||
/**
|
||||
* Remove a UserInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a UserInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Fetch a UserInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
/**
|
||||
* Fetch a UserInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Patch a UserInstance
|
||||
*
|
||||
* @param params - Body for request
|
||||
* @param headers - header params for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
patch(params: ScimPatchRequest, headers?: any, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
/**
|
||||
* Patch a UserInstance 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 UserInstance with HTTP metadata
|
||||
*/
|
||||
patchWithHttpInfo(params: ScimPatchRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Update a UserInstance
|
||||
*
|
||||
* @param params - Body for request
|
||||
* @param headers - header params for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
update(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
/**
|
||||
* Update a UserInstance 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 UserInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export interface UserContextSolution {
|
||||
organizationSid: string;
|
||||
id: string;
|
||||
}
|
||||
export declare class UserContextImpl implements UserContext {
|
||||
protected _version: Versionless;
|
||||
protected _solution: UserContextSolution;
|
||||
protected _uri: string;
|
||||
constructor(_version: Versionless, organizationSid: string, id: string);
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
patch(params: ScimPatchRequest, headers?: any, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
patchWithHttpInfo(params: ScimPatchRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
update(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
updateWithHttpInfo(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): UserContextSolution;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
interface UserPayload extends TwilioResponsePayload {
|
||||
Resources: UserResource[];
|
||||
}
|
||||
interface UserResource {
|
||||
id: string;
|
||||
externalId: string;
|
||||
userName: string;
|
||||
displayName: string;
|
||||
name: ScimName;
|
||||
emails: Array<ScimEmailAddress>;
|
||||
active: boolean;
|
||||
locale: string;
|
||||
timezone: string;
|
||||
schemas: Array<string>;
|
||||
meta: ScimMeta;
|
||||
detail: string;
|
||||
scimType: string;
|
||||
status: string;
|
||||
code: number;
|
||||
moreInfo: string;
|
||||
}
|
||||
export declare class UserInstance {
|
||||
protected _version: Versionless;
|
||||
protected _solution: UserContextSolution;
|
||||
protected _context?: UserContext;
|
||||
constructor(_version: Versionless, payload: UserResource, organizationSid: string, id?: string);
|
||||
/**
|
||||
* Unique Twilio user sid
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* External unique resource id defined by provisioning client
|
||||
*/
|
||||
externalId: string;
|
||||
/**
|
||||
* Unique username, MUST be same as primary email address
|
||||
*/
|
||||
userName: string;
|
||||
/**
|
||||
* User friendly display name
|
||||
*/
|
||||
displayName: string;
|
||||
name: ScimName;
|
||||
/**
|
||||
* Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username.
|
||||
*/
|
||||
emails: Array<ScimEmailAddress>;
|
||||
/**
|
||||
* Indicates whether the user is active
|
||||
*/
|
||||
active: boolean;
|
||||
/**
|
||||
* User\'s locale
|
||||
*/
|
||||
locale: string;
|
||||
/**
|
||||
* User\'s time zone
|
||||
*/
|
||||
timezone: string;
|
||||
/**
|
||||
* An array of URIs that indicate the schemas supported for this user resource
|
||||
*/
|
||||
schemas: Array<string>;
|
||||
meta: ScimMeta;
|
||||
/**
|
||||
* A human-readable description of the error
|
||||
*/
|
||||
detail: string;
|
||||
/**
|
||||
* A scimType error code as defined in RFC7644
|
||||
*/
|
||||
scimType: string;
|
||||
/**
|
||||
* Http status code
|
||||
*/
|
||||
status: string;
|
||||
/**
|
||||
* Twilio-specific error code
|
||||
*/
|
||||
code: number;
|
||||
/**
|
||||
* Link to Error Code References
|
||||
*/
|
||||
moreInfo: string;
|
||||
private get _proxy();
|
||||
/**
|
||||
* Remove a UserInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
||||
/**
|
||||
* Remove a UserInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
|
||||
/**
|
||||
* Fetch a UserInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
/**
|
||||
* Fetch a UserInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Patch a UserInstance
|
||||
*
|
||||
* @param params - Body for request
|
||||
* @param headers - header params for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
patch(params: ScimPatchRequest, headers?: any, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
/**
|
||||
* Patch a UserInstance 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 UserInstance with HTTP metadata
|
||||
*/
|
||||
patchWithHttpInfo(params: ScimPatchRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Update a UserInstance
|
||||
*
|
||||
* @param params - Body for request
|
||||
* @param headers - header params for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
update(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
/**
|
||||
* Update a UserInstance 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 UserInstance with HTTP metadata
|
||||
*/
|
||||
updateWithHttpInfo(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*
|
||||
* @returns Object
|
||||
*/
|
||||
toJSON(): {
|
||||
id: string;
|
||||
externalId: string;
|
||||
userName: string;
|
||||
displayName: string;
|
||||
name: ScimName;
|
||||
emails: ScimEmailAddress[];
|
||||
active: boolean;
|
||||
locale: string;
|
||||
timezone: string;
|
||||
schemas: string[];
|
||||
meta: ScimMeta;
|
||||
detail: string;
|
||||
scimType: string;
|
||||
status: string;
|
||||
code: number;
|
||||
moreInfo: string;
|
||||
};
|
||||
[inspect.custom](_depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export interface UserSolution {
|
||||
organizationSid: string;
|
||||
}
|
||||
export interface UserListInstance {
|
||||
_version: Versionless;
|
||||
_solution: UserSolution;
|
||||
_uri: string;
|
||||
(id: string): UserContext;
|
||||
get(id: string): UserContext;
|
||||
/**
|
||||
* Create a UserInstance
|
||||
*
|
||||
* @param params - Body for request
|
||||
* @param headers - header params for request
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
create(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>;
|
||||
/**
|
||||
* Create a UserInstance 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 UserInstance with HTTP metadata
|
||||
*/
|
||||
createWithHttpInfo(params: ScimUser, headers?: any, callback?: (error: Error | null, item?: ApiResponse<UserInstance>) => any): Promise<ApiResponse<UserInstance>>;
|
||||
/**
|
||||
* Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
each(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void;
|
||||
each(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Function to process each record
|
||||
*/
|
||||
eachWithHttpInfo(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void;
|
||||
eachWithHttpInfo(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void;
|
||||
/**
|
||||
* Retrieve a single target page of UserInstance 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: UserPage) => any): Promise<UserPage>;
|
||||
/**
|
||||
* Retrieve a single target page of UserInstance 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<UserPage>) => any): Promise<ApiResponse<UserPage>>;
|
||||
/**
|
||||
* Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
list(callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>;
|
||||
list(params: UserListInstanceOptions, callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>;
|
||||
/**
|
||||
* Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<UserInstance[]>) => any): Promise<ApiResponse<UserInstance[]>>;
|
||||
listWithHttpInfo(params: UserListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<UserInstance[]>) => any): Promise<ApiResponse<UserInstance[]>>;
|
||||
/**
|
||||
* Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records
|
||||
*/
|
||||
page(callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>;
|
||||
page(params: UserListInstancePageOptions, callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>;
|
||||
/**
|
||||
* Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request
|
||||
* @param { function } [callback] - Callback to handle list of records with metadata
|
||||
*/
|
||||
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<UserPage>) => any): Promise<ApiResponse<UserPage>>;
|
||||
pageWithHttpInfo(params: UserListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<UserPage>) => any): Promise<ApiResponse<UserPage>>;
|
||||
/**
|
||||
* Provide a user-friendly representation
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect.custom](_depth: any, options: InspectOptions): any;
|
||||
}
|
||||
export declare function UserListInstance(version: Versionless, organizationSid: string): UserListInstance;
|
||||
export declare class UserPage extends Page<Versionless, UserPayload, UserResource, UserInstance> {
|
||||
/**
|
||||
* Initialize the UserPage
|
||||
*
|
||||
* @param version - Version of the resource
|
||||
* @param response - Response from the API
|
||||
* @param solution - Path solution
|
||||
*/
|
||||
constructor(version: Versionless, response: Response<string>, solution: UserSolution);
|
||||
/**
|
||||
* Build an instance of UserInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload: UserResource): UserInstance;
|
||||
[inspect.custom](depth: any, options: InspectOptions): string;
|
||||
}
|
||||
export {};
|
||||
571
node_modules/twilio/lib/rest/previewIam/versionless/organization/user.js
generated
vendored
Normal file
571
node_modules/twilio/lib/rest/previewIam/versionless/organization/user.js
generated
vendored
Normal file
@@ -0,0 +1,571 @@
|
||||
"use strict";
|
||||
/*
|
||||
* This code was generated by
|
||||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
*
|
||||
* Organization Public API
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* 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.UserPage = exports.UserInstance = exports.UserContextImpl = exports.ScimUser = exports.ScimPatchRequest = exports.ScimPatchOperation = exports.ScimName = exports.ScimMeta = exports.ScimEmailAddress = void 0;
|
||||
exports.UserListInstance = UserListInstance;
|
||||
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");
|
||||
/**
|
||||
* Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username.
|
||||
*/
|
||||
class ScimEmailAddress {
|
||||
constructor(payload) {
|
||||
this.primary = payload["primary"];
|
||||
this.value = payload["value"];
|
||||
this.type = payload["type"];
|
||||
}
|
||||
}
|
||||
exports.ScimEmailAddress = ScimEmailAddress;
|
||||
/**
|
||||
* Meta
|
||||
*/
|
||||
class ScimMeta {
|
||||
constructor(payload) {
|
||||
this.resourceType = payload["resourceType"];
|
||||
this.created = payload["created"];
|
||||
this.lastModified = payload["lastModified"];
|
||||
this.version = payload["version"];
|
||||
}
|
||||
}
|
||||
exports.ScimMeta = ScimMeta;
|
||||
/**
|
||||
* User\'s name
|
||||
*/
|
||||
class ScimName {
|
||||
constructor(payload) {
|
||||
this.givenName = payload["givenName"];
|
||||
this.familyName = payload["familyName"];
|
||||
}
|
||||
}
|
||||
exports.ScimName = ScimName;
|
||||
class ScimPatchOperation {
|
||||
constructor(payload) {
|
||||
this.op = payload["op"];
|
||||
this.path = payload["path"];
|
||||
this.value = payload["value"];
|
||||
}
|
||||
}
|
||||
exports.ScimPatchOperation = ScimPatchOperation;
|
||||
class ScimPatchRequest {
|
||||
constructor(payload) {
|
||||
this.schemas = payload["schemas"];
|
||||
this.operations = payload["Operations"];
|
||||
}
|
||||
}
|
||||
exports.ScimPatchRequest = ScimPatchRequest;
|
||||
class ScimUser {
|
||||
constructor(payload) {
|
||||
this.id = payload["id"];
|
||||
this.externalId = payload["externalId"];
|
||||
this.userName = payload["userName"];
|
||||
this.displayName = payload["displayName"];
|
||||
this.name = payload["name"];
|
||||
this.emails = payload["emails"];
|
||||
this.active = payload["active"];
|
||||
this.locale = payload["locale"];
|
||||
this.timezone = payload["timezone"];
|
||||
this.schemas = payload["schemas"];
|
||||
this.meta = payload["meta"];
|
||||
this.detail = payload["detail"];
|
||||
this.scimType = payload["scimType"];
|
||||
this.status = payload["status"];
|
||||
this.code = payload["code"];
|
||||
this.moreInfo = payload["moreInfo"];
|
||||
}
|
||||
}
|
||||
exports.ScimUser = ScimUser;
|
||||
class UserContextImpl {
|
||||
constructor(_version, organizationSid, id) {
|
||||
this._version = _version;
|
||||
if (!(0, utility_1.isValidPathParam)(organizationSid)) {
|
||||
throw new Error("Parameter 'organizationSid' is not valid.");
|
||||
}
|
||||
if (!(0, utility_1.isValidPathParam)(id)) {
|
||||
throw new Error("Parameter 'id' is not valid.");
|
||||
}
|
||||
this._solution = { organizationSid, id };
|
||||
this._uri = `/${organizationSid}/scim/Users/${id}`;
|
||||
}
|
||||
remove(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
||||
uri: instance._uri,
|
||||
method: "delete",
|
||||
headers,
|
||||
});
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
removeWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// DELETE operation - returns boolean based on status code
|
||||
let operationPromise = operationVersion
|
||||
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: response.statusCode === 204,
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetch(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/scim+json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.organizationSid, instance._solution.id));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
fetchWithHttpInfo(callback) {
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/scim+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 UserInstance(operationVersion, response.body, instance._solution.organizationSid, instance._solution.id),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
patch(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/scim+json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.patch({
|
||||
uri: instance._uri,
|
||||
method: "patch",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.organizationSid, instance._solution.id));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
patchWithHttpInfo(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/scim+json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.patchWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "patch",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new UserInstance(operationVersion, response.body, instance._solution.organizationSid, instance._solution.id),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
update(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/scim+json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version, operationPromise = operationVersion.update({
|
||||
uri: instance._uri,
|
||||
method: "put",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.organizationSid, instance._solution.id));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
}
|
||||
updateWithHttpInfo(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/scim+json";
|
||||
const instance = this;
|
||||
let operationVersion = instance._version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.updateWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "put",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new UserInstance(operationVersion, response.body, instance._solution.organizationSid, instance._solution.id),
|
||||
}));
|
||||
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.UserContextImpl = UserContextImpl;
|
||||
class UserInstance {
|
||||
constructor(_version, payload, organizationSid, id) {
|
||||
this._version = _version;
|
||||
this.id = payload.id;
|
||||
this.externalId = payload.externalId;
|
||||
this.userName = payload.userName;
|
||||
this.displayName = payload.displayName;
|
||||
this.name =
|
||||
payload.name !== null && payload.name !== undefined
|
||||
? new ScimName(payload.name)
|
||||
: null;
|
||||
this.emails =
|
||||
payload.emails !== null && payload.emails !== undefined
|
||||
? payload.emails.map((payload) => new ScimEmailAddress(payload))
|
||||
: null;
|
||||
this.active = payload.active;
|
||||
this.locale = payload.locale;
|
||||
this.timezone = payload.timezone;
|
||||
this.schemas = payload.schemas;
|
||||
this.meta =
|
||||
payload.meta !== null && payload.meta !== undefined
|
||||
? new ScimMeta(payload.meta)
|
||||
: null;
|
||||
this.detail = payload.detail;
|
||||
this.scimType = payload.scimType;
|
||||
this.status = payload.status;
|
||||
this.code = payload.code;
|
||||
this.moreInfo = payload.moreInfo;
|
||||
this._solution = { organizationSid, id: id || this.id };
|
||||
}
|
||||
get _proxy() {
|
||||
this._context =
|
||||
this._context ||
|
||||
new UserContextImpl(this._version, this._solution.organizationSid, this._solution.id);
|
||||
return this._context;
|
||||
}
|
||||
/**
|
||||
* Remove a UserInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean
|
||||
*/
|
||||
remove(callback) {
|
||||
return this._proxy.remove(callback);
|
||||
}
|
||||
/**
|
||||
* Remove a UserInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed boolean with HTTP metadata
|
||||
*/
|
||||
removeWithHttpInfo(callback) {
|
||||
return this._proxy.removeWithHttpInfo(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a UserInstance
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance
|
||||
*/
|
||||
fetch(callback) {
|
||||
return this._proxy.fetch(callback);
|
||||
}
|
||||
/**
|
||||
* Fetch a UserInstance and return HTTP info
|
||||
*
|
||||
* @param callback - Callback to handle processed record
|
||||
*
|
||||
* @returns Resolves to processed UserInstance with HTTP metadata
|
||||
*/
|
||||
fetchWithHttpInfo(callback) {
|
||||
return this._proxy.fetchWithHttpInfo(callback);
|
||||
}
|
||||
patch(params, callback) {
|
||||
return this._proxy.patch(params, callback);
|
||||
}
|
||||
patchWithHttpInfo(params, callback) {
|
||||
return this._proxy.patchWithHttpInfo(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 {
|
||||
id: this.id,
|
||||
externalId: this.externalId,
|
||||
userName: this.userName,
|
||||
displayName: this.displayName,
|
||||
name: this.name,
|
||||
emails: this.emails,
|
||||
active: this.active,
|
||||
locale: this.locale,
|
||||
timezone: this.timezone,
|
||||
schemas: this.schemas,
|
||||
meta: this.meta,
|
||||
detail: this.detail,
|
||||
scimType: this.scimType,
|
||||
status: this.status,
|
||||
code: this.code,
|
||||
moreInfo: this.moreInfo,
|
||||
};
|
||||
}
|
||||
[util_1.inspect.custom](_depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.UserInstance = UserInstance;
|
||||
function UserListInstance(version, organizationSid) {
|
||||
if (!(0, utility_1.isValidPathParam)(organizationSid)) {
|
||||
throw new Error("Parameter 'organizationSid' is not valid.");
|
||||
}
|
||||
const instance = ((id) => instance.get(id));
|
||||
instance.get = function get(id) {
|
||||
return new UserContextImpl(version, organizationSid, id);
|
||||
};
|
||||
instance._version = version;
|
||||
instance._solution = { organizationSid };
|
||||
instance._uri = `/${organizationSid}/scim/Users`;
|
||||
instance.create = function create(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/scim+json";
|
||||
let operationVersion = version, operationPromise = operationVersion.create({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.organizationSid));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
|
||||
if (params === null || params === undefined) {
|
||||
throw new Error('Required parameter "params" missing.');
|
||||
}
|
||||
let data = {};
|
||||
data = params;
|
||||
if (headers === null || headers === undefined) {
|
||||
headers = {};
|
||||
}
|
||||
headers["Content-Type"] = "application/json";
|
||||
headers["Accept"] = "application/scim+json";
|
||||
let operationVersion = version;
|
||||
// CREATE, FETCH, UPDATE operations
|
||||
let operationPromise = operationVersion
|
||||
.createWithResponseInfo({
|
||||
uri: instance._uri,
|
||||
method: "post",
|
||||
data,
|
||||
headers,
|
||||
})
|
||||
.then((response) => ({
|
||||
...response,
|
||||
body: new UserInstance(operationVersion, response.body, instance._solution.organizationSid),
|
||||
}));
|
||||
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
||||
return operationPromise;
|
||||
};
|
||||
instance.page = function page(params, callback) {
|
||||
if (params instanceof Function) {
|
||||
callback = params;
|
||||
params = {};
|
||||
}
|
||||
else {
|
||||
params = params || {};
|
||||
}
|
||||
let data = {};
|
||||
if (params["filter"] !== undefined)
|
||||
data["filter"] = params["filter"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/scim+json";
|
||||
let operationVersion = version, operationPromise = operationVersion.page({
|
||||
uri: instance._uri,
|
||||
method: "get",
|
||||
params: data,
|
||||
headers,
|
||||
});
|
||||
operationPromise = operationPromise.then((payload) => new UserPage(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 UserPage(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["filter"] !== undefined)
|
||||
data["filter"] = params["filter"];
|
||||
if (params.pageNumber !== undefined)
|
||||
data["Page"] = params.pageNumber;
|
||||
if (params.pageToken !== undefined)
|
||||
data["PageToken"] = params.pageToken;
|
||||
const headers = {};
|
||||
headers["Accept"] = "application/scim+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 UserPage(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 UserPage(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 UserPage extends Page_1.default {
|
||||
/**
|
||||
* Initialize the UserPage
|
||||
*
|
||||
* @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 UserInstance
|
||||
*
|
||||
* @param payload - Payload response from the API
|
||||
*/
|
||||
getInstance(payload) {
|
||||
return new UserInstance(this._version, payload, this._solution.organizationSid);
|
||||
}
|
||||
[util_1.inspect.custom](depth, options) {
|
||||
return (0, util_1.inspect)(this.toJSON(), options);
|
||||
}
|
||||
}
|
||||
exports.UserPage = UserPage;
|
||||
Reference in New Issue
Block a user