twilio 5.2.3 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/lib/rest/Assistants.d.ts +4 -0
  2. package/lib/rest/Assistants.js +8 -0
  3. package/lib/rest/AssistantsBase.d.ts +13 -0
  4. package/lib/rest/AssistantsBase.js +31 -0
  5. package/lib/rest/Iam.d.ts +4 -0
  6. package/lib/rest/Iam.js +8 -0
  7. package/lib/rest/IamBase.d.ts +13 -0
  8. package/lib/rest/IamBase.js +31 -0
  9. package/lib/rest/Twilio.d.ts +10 -0
  10. package/lib/rest/Twilio.js +11 -0
  11. package/lib/rest/assistants/V1.d.ts +35 -0
  12. package/lib/rest/assistants/V1.js +60 -0
  13. package/lib/rest/assistants/v1/assistant/feedback.d.ts +231 -0
  14. package/lib/rest/assistants/v1/assistant/feedback.js +161 -0
  15. package/lib/rest/assistants/v1/assistant.d.ts +466 -0
  16. package/lib/rest/assistants/v1/assistant.js +284 -0
  17. package/lib/rest/assistants/v1/knowledge/chunk.d.ts +167 -0
  18. package/lib/rest/assistants/v1/knowledge/chunk.js +130 -0
  19. package/lib/rest/assistants/v1/knowledge.d.ts +385 -0
  20. package/lib/rest/assistants/v1/knowledge.js +273 -0
  21. package/lib/rest/assistants/v1/policy.d.ts +202 -0
  22. package/lib/rest/assistants/v1/policy.js +138 -0
  23. package/lib/rest/assistants/v1/session/message.d.ts +197 -0
  24. package/lib/rest/assistants/v1/session/message.js +140 -0
  25. package/lib/rest/assistants/v1/session.d.ts +231 -0
  26. package/lib/rest/assistants/v1/session.js +194 -0
  27. package/lib/rest/assistants/v1/tool.d.ts +378 -0
  28. package/lib/rest/assistants/v1/tool.js +242 -0
  29. package/lib/rest/content/v1/content/approvalFetch.d.ts +5 -5
  30. package/lib/rest/content/v1/content/approvalFetch.js +14 -14
  31. package/lib/rest/content/v1/content.d.ts +33 -3
  32. package/lib/rest/content/v1/content.js +16 -1
  33. package/lib/rest/iam/V1.d.ts +25 -0
  34. package/lib/rest/iam/V1.js +48 -0
  35. package/lib/rest/iam/v1/apiKey.d.ts +167 -0
  36. package/lib/rest/iam/v1/apiKey.js +161 -0
  37. package/lib/rest/iam/v1/getApiKeys.d.ts +163 -0
  38. package/lib/rest/iam/v1/getApiKeys.js +124 -0
  39. package/lib/rest/iam/v1/newApiKey.d.ts +90 -0
  40. package/lib/rest/iam/v1/newApiKey.js +90 -0
  41. package/lib/rest/intelligence/v2/operatorType.d.ts +1 -1
  42. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.d.ts +12 -18
  43. package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.js +3 -6
  44. package/lib/rest/marketplace/v1/moduleDataManagement.d.ts +14 -6
  45. package/lib/rest/marketplace/v1/moduleDataManagement.js +4 -0
  46. package/lib/rest/numbers/v1/portingPortIn.js +1 -1
  47. package/lib/rest/numbers/v2/bundleClone.d.ts +1 -1
  48. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +4 -4
  49. package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts +6 -0
  50. package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +2 -0
  51. package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.d.ts +1 -1
  52. package/package.json +2 -2
@@ -19,13 +19,13 @@ const deserialize = require("../../../../base/deserialize");
19
19
  const serialize = require("../../../../base/serialize");
20
20
  const utility_1 = require("../../../../base/utility");
21
21
  class ApprovalFetchContextImpl {
22
- constructor(_version, contentSid) {
22
+ constructor(_version, sid) {
23
23
  this._version = _version;
24
- if (!(0, utility_1.isValidPathParam)(contentSid)) {
25
- throw new Error("Parameter 'contentSid' is not valid.");
24
+ if (!(0, utility_1.isValidPathParam)(sid)) {
25
+ throw new Error("Parameter 'sid' is not valid.");
26
26
  }
27
- this._solution = { contentSid };
28
- this._uri = `/Content/${contentSid}/ApprovalRequests`;
27
+ this._solution = { sid };
28
+ this._uri = `/Content/${sid}/ApprovalRequests`;
29
29
  }
30
30
  fetch(callback) {
31
31
  const instance = this;
@@ -33,7 +33,7 @@ class ApprovalFetchContextImpl {
33
33
  uri: instance._uri,
34
34
  method: "get",
35
35
  });
36
- operationPromise = operationPromise.then((payload) => new ApprovalFetchInstance(operationVersion, payload, instance._solution.contentSid));
36
+ operationPromise = operationPromise.then((payload) => new ApprovalFetchInstance(operationVersion, payload, instance._solution.sid));
37
37
  operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
38
38
  return operationPromise;
39
39
  }
@@ -51,18 +51,18 @@ class ApprovalFetchContextImpl {
51
51
  }
52
52
  exports.ApprovalFetchContextImpl = ApprovalFetchContextImpl;
53
53
  class ApprovalFetchInstance {
54
- constructor(_version, payload, contentSid) {
54
+ constructor(_version, payload, sid) {
55
55
  this._version = _version;
56
56
  this.sid = payload.sid;
57
57
  this.accountSid = payload.account_sid;
58
58
  this.whatsapp = payload.whatsapp;
59
59
  this.url = payload.url;
60
- this._solution = { contentSid };
60
+ this._solution = { sid };
61
61
  }
62
62
  get _proxy() {
63
63
  this._context =
64
64
  this._context ||
65
- new ApprovalFetchContextImpl(this._version, this._solution.contentSid);
65
+ new ApprovalFetchContextImpl(this._version, this._solution.sid);
66
66
  return this._context;
67
67
  }
68
68
  /**
@@ -93,16 +93,16 @@ class ApprovalFetchInstance {
93
93
  }
94
94
  }
95
95
  exports.ApprovalFetchInstance = ApprovalFetchInstance;
96
- function ApprovalFetchListInstance(version, contentSid) {
97
- if (!(0, utility_1.isValidPathParam)(contentSid)) {
98
- throw new Error("Parameter 'contentSid' is not valid.");
96
+ function ApprovalFetchListInstance(version, sid) {
97
+ if (!(0, utility_1.isValidPathParam)(sid)) {
98
+ throw new Error("Parameter 'sid' is not valid.");
99
99
  }
100
100
  const instance = (() => instance.get());
101
101
  instance.get = function get() {
102
- return new ApprovalFetchContextImpl(version, contentSid);
102
+ return new ApprovalFetchContextImpl(version, sid);
103
103
  };
104
104
  instance._version = version;
105
- instance._solution = { contentSid };
105
+ instance._solution = { sid };
106
106
  instance._uri = ``;
107
107
  instance.toJSON = function toJSON() {
108
108
  return instance._solution;
@@ -15,17 +15,18 @@ export declare class CallToActionAction {
15
15
  "title": string;
16
16
  "url"?: string;
17
17
  "phone"?: string;
18
- "id"?: string;
18
+ "code"?: string;
19
19
  }
20
- export type CallToActionActionType = "URL" | "PHONE_NUMBER";
20
+ export type CallToActionActionType = "URL" | "PHONE_NUMBER" | "COPY_CODE" | "VOICE_CALL";
21
21
  export declare class CardAction {
22
22
  "type": CardActionType;
23
23
  "title": string;
24
24
  "url"?: string;
25
25
  "phone"?: string;
26
26
  "id"?: string;
27
+ "code"?: string;
27
28
  }
28
- export type CardActionType = "URL" | "PHONE_NUMBER" | "QUICK_REPLY";
29
+ export type CardActionType = "URL" | "PHONE_NUMBER" | "QUICK_REPLY" | "COPY_CODE" | "VOICE_CALL";
29
30
  export declare class CarouselAction {
30
31
  "type": CarouselActionType;
31
32
  "title": string;
@@ -68,6 +69,23 @@ export declare class ContentCreateRequest {
68
69
  "language": string;
69
70
  "types": Types;
70
71
  }
72
+ export declare class FlowsPage {
73
+ "id": string;
74
+ "nextPageId"?: string;
75
+ "title"?: string;
76
+ "subtitle"?: string;
77
+ "layout": Array<FlowsPageComponent>;
78
+ }
79
+ export declare class FlowsPageComponent {
80
+ "label": string;
81
+ "type": string;
82
+ "text"?: string;
83
+ "options"?: Array<FlowsPageComponentSelectItem>;
84
+ }
85
+ export declare class FlowsPageComponentSelectItem {
86
+ "id": string;
87
+ "title": string;
88
+ }
71
89
  export declare class ListItem {
72
90
  "id": string;
73
91
  "item": string;
@@ -113,6 +131,17 @@ export declare class TwilioCatalog {
113
131
  "items"?: Array<CatalogItem>;
114
132
  "dynamicItems"?: string;
115
133
  }
134
+ /**
135
+ * twilio/flows templates allow you to send multiple messages in a set order with text or select options
136
+ */
137
+ export declare class TwilioFlows {
138
+ "body": string;
139
+ "buttonText": string;
140
+ "subtitle": string;
141
+ "mediaUrl": string;
142
+ "pages": Array<FlowsPage>;
143
+ "type": string;
144
+ }
116
145
  /**
117
146
  * twilio/list-picker includes a menu of up to 10 options, which offers a simple way for users to make a selection.
118
147
  */
@@ -162,6 +191,7 @@ export declare class Types {
162
191
  "twilioCard"?: TwilioCard | null;
163
192
  "twilioCatalog"?: TwilioCatalog | null;
164
193
  "twilioCarousel"?: TwilioCarousel | null;
194
+ "twilioFlows"?: TwilioFlows | null;
165
195
  "whatsappCard"?: WhatsappCard | null;
166
196
  "whatsappAuthentication"?: WhatsappAuthentication | null;
167
197
  }
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  return (mod && mod.__esModule) ? mod : { "default": mod };
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.ContentPage = exports.ContentListInstance = exports.ContentInstance = exports.ContentContextImpl = exports.WhatsappCard = exports.WhatsappAuthentication = exports.Types = exports.TwilioText = exports.TwilioQuickReply = exports.TwilioMedia = exports.TwilioLocation = exports.TwilioListPicker = exports.TwilioCatalog = exports.TwilioCarousel = exports.TwilioCard = exports.TwilioCallToAction = exports.QuickReplyAction = exports.ListItem = exports.ContentCreateRequest = exports.CatalogItem = exports.CarouselCard = exports.CarouselAction = exports.CardAction = exports.CallToActionAction = exports.AuthenticationAction = void 0;
19
+ exports.ContentPage = exports.ContentListInstance = exports.ContentInstance = exports.ContentContextImpl = exports.WhatsappCard = exports.WhatsappAuthentication = exports.Types = exports.TwilioText = exports.TwilioQuickReply = exports.TwilioMedia = exports.TwilioLocation = exports.TwilioListPicker = exports.TwilioFlows = exports.TwilioCatalog = exports.TwilioCarousel = exports.TwilioCard = exports.TwilioCallToAction = exports.QuickReplyAction = exports.ListItem = exports.FlowsPageComponentSelectItem = exports.FlowsPageComponent = exports.FlowsPage = exports.ContentCreateRequest = exports.CatalogItem = exports.CarouselCard = exports.CarouselAction = exports.CardAction = exports.CallToActionAction = exports.AuthenticationAction = void 0;
20
20
  const util_1 = require("util");
21
21
  const Page_1 = __importDefault(require("../../../base/Page"));
22
22
  const deserialize = require("../../../base/deserialize");
@@ -48,6 +48,15 @@ exports.CatalogItem = CatalogItem;
48
48
  class ContentCreateRequest {
49
49
  }
50
50
  exports.ContentCreateRequest = ContentCreateRequest;
51
+ class FlowsPage {
52
+ }
53
+ exports.FlowsPage = FlowsPage;
54
+ class FlowsPageComponent {
55
+ }
56
+ exports.FlowsPageComponent = FlowsPageComponent;
57
+ class FlowsPageComponentSelectItem {
58
+ }
59
+ exports.FlowsPageComponentSelectItem = FlowsPageComponentSelectItem;
51
60
  class ListItem {
52
61
  }
53
62
  exports.ListItem = ListItem;
@@ -78,6 +87,12 @@ exports.TwilioCarousel = TwilioCarousel;
78
87
  class TwilioCatalog {
79
88
  }
80
89
  exports.TwilioCatalog = TwilioCatalog;
90
+ /**
91
+ * twilio/flows templates allow you to send multiple messages in a set order with text or select options
92
+ */
93
+ class TwilioFlows {
94
+ }
95
+ exports.TwilioFlows = TwilioFlows;
81
96
  /**
82
97
  * twilio/list-picker includes a menu of up to 10 options, which offers a simple way for users to make a selection.
83
98
  */
@@ -0,0 +1,25 @@
1
+ import IamBase from "../IamBase";
2
+ import Version from "../../base/Version";
3
+ import { ApiKeyListInstance } from "./v1/apiKey";
4
+ import { GetApiKeysListInstance } from "./v1/getApiKeys";
5
+ import { NewApiKeyListInstance } from "./v1/newApiKey";
6
+ export default class V1 extends Version {
7
+ /**
8
+ * Initialize the V1 version of Iam
9
+ *
10
+ * @param domain - The Twilio (Twilio.Iam) domain
11
+ */
12
+ constructor(domain: IamBase);
13
+ /** apiKey - { Twilio.Iam.V1.ApiKeyListInstance } resource */
14
+ protected _apiKey?: ApiKeyListInstance;
15
+ /** getApiKeys - { Twilio.Iam.V1.GetApiKeysListInstance } resource */
16
+ protected _getApiKeys?: GetApiKeysListInstance;
17
+ /** newApiKey - { Twilio.Iam.V1.NewApiKeyListInstance } resource */
18
+ protected _newApiKey?: NewApiKeyListInstance;
19
+ /** Getter for apiKey resource */
20
+ get apiKey(): ApiKeyListInstance;
21
+ /** Getter for getApiKeys resource */
22
+ get getApiKeys(): GetApiKeysListInstance;
23
+ /** Getter for newApiKey resource */
24
+ get newApiKey(): NewApiKeyListInstance;
25
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Iam
9
+ * This is the public Twilio REST API.
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator.
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const Version_1 = __importDefault(require("../../base/Version"));
20
+ const apiKey_1 = require("./v1/apiKey");
21
+ const getApiKeys_1 = require("./v1/getApiKeys");
22
+ const newApiKey_1 = require("./v1/newApiKey");
23
+ class V1 extends Version_1.default {
24
+ /**
25
+ * Initialize the V1 version of Iam
26
+ *
27
+ * @param domain - The Twilio (Twilio.Iam) domain
28
+ */
29
+ constructor(domain) {
30
+ super(domain, "v1");
31
+ }
32
+ /** Getter for apiKey resource */
33
+ get apiKey() {
34
+ this._apiKey = this._apiKey || (0, apiKey_1.ApiKeyListInstance)(this);
35
+ return this._apiKey;
36
+ }
37
+ /** Getter for getApiKeys resource */
38
+ get getApiKeys() {
39
+ this._getApiKeys = this._getApiKeys || (0, getApiKeys_1.GetApiKeysListInstance)(this);
40
+ return this._getApiKeys;
41
+ }
42
+ /** Getter for newApiKey resource */
43
+ get newApiKey() {
44
+ this._newApiKey = this._newApiKey || (0, newApiKey_1.NewApiKeyListInstance)(this);
45
+ return this._newApiKey;
46
+ }
47
+ }
48
+ exports.default = V1;
@@ -0,0 +1,167 @@
1
+ /// <reference types="node" />
2
+ import { inspect, InspectOptions } from "util";
3
+ import V1 from "../V1";
4
+ /**
5
+ * Options to pass to update a ApiKeyInstance
6
+ */
7
+ export interface ApiKeyContextUpdateOptions {
8
+ /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
9
+ friendlyName?: string;
10
+ /** The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). */
11
+ policy?: any;
12
+ }
13
+ export interface ApiKeyContext {
14
+ /**
15
+ * Remove a ApiKeyInstance
16
+ *
17
+ * @param callback - Callback to handle processed record
18
+ *
19
+ * @returns Resolves to processed boolean
20
+ */
21
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
22
+ /**
23
+ * Fetch a ApiKeyInstance
24
+ *
25
+ * @param callback - Callback to handle processed record
26
+ *
27
+ * @returns Resolves to processed ApiKeyInstance
28
+ */
29
+ fetch(callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
30
+ /**
31
+ * Update a ApiKeyInstance
32
+ *
33
+ * @param callback - Callback to handle processed record
34
+ *
35
+ * @returns Resolves to processed ApiKeyInstance
36
+ */
37
+ update(callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
38
+ /**
39
+ * Update a ApiKeyInstance
40
+ *
41
+ * @param params - Parameter for request
42
+ * @param callback - Callback to handle processed record
43
+ *
44
+ * @returns Resolves to processed ApiKeyInstance
45
+ */
46
+ update(params: ApiKeyContextUpdateOptions, callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
47
+ /**
48
+ * Provide a user-friendly representation
49
+ */
50
+ toJSON(): any;
51
+ [inspect.custom](_depth: any, options: InspectOptions): any;
52
+ }
53
+ export interface ApiKeyContextSolution {
54
+ sid: string;
55
+ }
56
+ export declare class ApiKeyContextImpl implements ApiKeyContext {
57
+ protected _version: V1;
58
+ protected _solution: ApiKeyContextSolution;
59
+ protected _uri: string;
60
+ constructor(_version: V1, sid: string);
61
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
62
+ fetch(callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
63
+ update(params?: ApiKeyContextUpdateOptions | ((error: Error | null, item?: ApiKeyInstance) => any), callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
64
+ /**
65
+ * Provide a user-friendly representation
66
+ *
67
+ * @returns Object
68
+ */
69
+ toJSON(): ApiKeyContextSolution;
70
+ [inspect.custom](_depth: any, options: InspectOptions): string;
71
+ }
72
+ interface ApiKeyResource {
73
+ sid: string;
74
+ friendly_name: string;
75
+ date_created: Date;
76
+ date_updated: Date;
77
+ policy: any;
78
+ }
79
+ export declare class ApiKeyInstance {
80
+ protected _version: V1;
81
+ protected _solution: ApiKeyContextSolution;
82
+ protected _context?: ApiKeyContext;
83
+ constructor(_version: V1, payload: ApiKeyResource, sid?: string);
84
+ /**
85
+ * The unique string that we created to identify the Key resource.
86
+ */
87
+ sid: string;
88
+ /**
89
+ * The string that you assigned to describe the resource.
90
+ */
91
+ friendlyName: string;
92
+ /**
93
+ * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
94
+ */
95
+ dateCreated: Date;
96
+ /**
97
+ * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
98
+ */
99
+ dateUpdated: Date;
100
+ /**
101
+ * The \\`Policy\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
102
+ */
103
+ policy: any;
104
+ private get _proxy();
105
+ /**
106
+ * Remove a ApiKeyInstance
107
+ *
108
+ * @param callback - Callback to handle processed record
109
+ *
110
+ * @returns Resolves to processed boolean
111
+ */
112
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
113
+ /**
114
+ * Fetch a ApiKeyInstance
115
+ *
116
+ * @param callback - Callback to handle processed record
117
+ *
118
+ * @returns Resolves to processed ApiKeyInstance
119
+ */
120
+ fetch(callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
121
+ /**
122
+ * Update a ApiKeyInstance
123
+ *
124
+ * @param callback - Callback to handle processed record
125
+ *
126
+ * @returns Resolves to processed ApiKeyInstance
127
+ */
128
+ update(callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
129
+ /**
130
+ * Update a ApiKeyInstance
131
+ *
132
+ * @param params - Parameter for request
133
+ * @param callback - Callback to handle processed record
134
+ *
135
+ * @returns Resolves to processed ApiKeyInstance
136
+ */
137
+ update(params: ApiKeyContextUpdateOptions, callback?: (error: Error | null, item?: ApiKeyInstance) => any): Promise<ApiKeyInstance>;
138
+ /**
139
+ * Provide a user-friendly representation
140
+ *
141
+ * @returns Object
142
+ */
143
+ toJSON(): {
144
+ sid: string;
145
+ friendlyName: string;
146
+ dateCreated: Date;
147
+ dateUpdated: Date;
148
+ policy: any;
149
+ };
150
+ [inspect.custom](_depth: any, options: InspectOptions): string;
151
+ }
152
+ export interface ApiKeySolution {
153
+ }
154
+ export interface ApiKeyListInstance {
155
+ _version: V1;
156
+ _solution: ApiKeySolution;
157
+ _uri: string;
158
+ (sid: string): ApiKeyContext;
159
+ get(sid: string): ApiKeyContext;
160
+ /**
161
+ * Provide a user-friendly representation
162
+ */
163
+ toJSON(): any;
164
+ [inspect.custom](_depth: any, options: InspectOptions): any;
165
+ }
166
+ export declare function ApiKeyListInstance(version: V1): ApiKeyListInstance;
167
+ export {};
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Iam
9
+ * This is the public Twilio REST API.
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator.
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ApiKeyListInstance = exports.ApiKeyInstance = exports.ApiKeyContextImpl = void 0;
17
+ const util_1 = require("util");
18
+ const deserialize = require("../../../base/deserialize");
19
+ const serialize = require("../../../base/serialize");
20
+ const utility_1 = require("../../../base/utility");
21
+ class ApiKeyContextImpl {
22
+ constructor(_version, sid) {
23
+ this._version = _version;
24
+ if (!(0, utility_1.isValidPathParam)(sid)) {
25
+ throw new Error("Parameter 'sid' is not valid.");
26
+ }
27
+ this._solution = { sid };
28
+ this._uri = `/Keys/${sid}`;
29
+ }
30
+ remove(callback) {
31
+ const instance = this;
32
+ let operationVersion = instance._version, operationPromise = operationVersion.remove({
33
+ uri: instance._uri,
34
+ method: "delete",
35
+ });
36
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
37
+ return operationPromise;
38
+ }
39
+ fetch(callback) {
40
+ const instance = this;
41
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
42
+ uri: instance._uri,
43
+ method: "get",
44
+ });
45
+ operationPromise = operationPromise.then((payload) => new ApiKeyInstance(operationVersion, payload, instance._solution.sid));
46
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
47
+ return operationPromise;
48
+ }
49
+ update(params, callback) {
50
+ if (params instanceof Function) {
51
+ callback = params;
52
+ params = {};
53
+ }
54
+ else {
55
+ params = params || {};
56
+ }
57
+ let data = {};
58
+ if (params["friendlyName"] !== undefined)
59
+ data["FriendlyName"] = params["friendlyName"];
60
+ if (params["policy"] !== undefined)
61
+ data["Policy"] = serialize.object(params["policy"]);
62
+ const headers = {};
63
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
64
+ const instance = this;
65
+ let operationVersion = instance._version, operationPromise = operationVersion.update({
66
+ uri: instance._uri,
67
+ method: "post",
68
+ data,
69
+ headers,
70
+ });
71
+ operationPromise = operationPromise.then((payload) => new ApiKeyInstance(operationVersion, payload, instance._solution.sid));
72
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
73
+ return operationPromise;
74
+ }
75
+ /**
76
+ * Provide a user-friendly representation
77
+ *
78
+ * @returns Object
79
+ */
80
+ toJSON() {
81
+ return this._solution;
82
+ }
83
+ [util_1.inspect.custom](_depth, options) {
84
+ return (0, util_1.inspect)(this.toJSON(), options);
85
+ }
86
+ }
87
+ exports.ApiKeyContextImpl = ApiKeyContextImpl;
88
+ class ApiKeyInstance {
89
+ constructor(_version, payload, sid) {
90
+ this._version = _version;
91
+ this.sid = payload.sid;
92
+ this.friendlyName = payload.friendly_name;
93
+ this.dateCreated = deserialize.rfc2822DateTime(payload.date_created);
94
+ this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated);
95
+ this.policy = payload.policy;
96
+ this._solution = { sid: sid || this.sid };
97
+ }
98
+ get _proxy() {
99
+ this._context =
100
+ this._context || new ApiKeyContextImpl(this._version, this._solution.sid);
101
+ return this._context;
102
+ }
103
+ /**
104
+ * Remove a ApiKeyInstance
105
+ *
106
+ * @param callback - Callback to handle processed record
107
+ *
108
+ * @returns Resolves to processed boolean
109
+ */
110
+ remove(callback) {
111
+ return this._proxy.remove(callback);
112
+ }
113
+ /**
114
+ * Fetch a ApiKeyInstance
115
+ *
116
+ * @param callback - Callback to handle processed record
117
+ *
118
+ * @returns Resolves to processed ApiKeyInstance
119
+ */
120
+ fetch(callback) {
121
+ return this._proxy.fetch(callback);
122
+ }
123
+ update(params, callback) {
124
+ return this._proxy.update(params, callback);
125
+ }
126
+ /**
127
+ * Provide a user-friendly representation
128
+ *
129
+ * @returns Object
130
+ */
131
+ toJSON() {
132
+ return {
133
+ sid: this.sid,
134
+ friendlyName: this.friendlyName,
135
+ dateCreated: this.dateCreated,
136
+ dateUpdated: this.dateUpdated,
137
+ policy: this.policy,
138
+ };
139
+ }
140
+ [util_1.inspect.custom](_depth, options) {
141
+ return (0, util_1.inspect)(this.toJSON(), options);
142
+ }
143
+ }
144
+ exports.ApiKeyInstance = ApiKeyInstance;
145
+ function ApiKeyListInstance(version) {
146
+ const instance = ((sid) => instance.get(sid));
147
+ instance.get = function get(sid) {
148
+ return new ApiKeyContextImpl(version, sid);
149
+ };
150
+ instance._version = version;
151
+ instance._solution = {};
152
+ instance._uri = ``;
153
+ instance.toJSON = function toJSON() {
154
+ return instance._solution;
155
+ };
156
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
157
+ return (0, util_1.inspect)(instance.toJSON(), options);
158
+ };
159
+ return instance;
160
+ }
161
+ exports.ApiKeyListInstance = ApiKeyListInstance;