twilio 5.0.3 → 5.1.0

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 (79) hide show
  1. package/README.md +1 -0
  2. package/lib/rest/ContentBase.d.ts +3 -0
  3. package/lib/rest/ContentBase.js +5 -0
  4. package/lib/rest/Twilio.d.ts +0 -5
  5. package/lib/rest/Twilio.js +0 -6
  6. package/lib/rest/api/v2010/account/call/stream.d.ts +5 -5
  7. package/lib/rest/api/v2010/account/message.d.ts +1 -1
  8. package/lib/rest/content/V2.d.ts +20 -0
  9. package/lib/rest/content/V2.js +43 -0
  10. package/lib/rest/content/v2/content.d.ts +196 -0
  11. package/lib/rest/content/v2/content.js +136 -0
  12. package/lib/rest/content/v2/contentAndApprovals.d.ts +190 -0
  13. package/lib/rest/content/v2/contentAndApprovals.js +134 -0
  14. package/lib/rest/flexApi/V2.d.ts +5 -0
  15. package/lib/rest/flexApi/V2.js +6 -0
  16. package/lib/rest/flexApi/v1/interaction.d.ts +1 -1
  17. package/lib/rest/flexApi/v1/interaction.js +2 -4
  18. package/lib/rest/flexApi/v1/plugin/pluginVersions.d.ts +4 -1
  19. package/lib/rest/flexApi/v1/plugin/pluginVersions.js +2 -0
  20. package/lib/rest/flexApi/v2/flexUser.d.ts +170 -0
  21. package/lib/rest/flexApi/v2/flexUser.js +142 -0
  22. package/lib/rest/flexApi/v2/webChannels.d.ts +2 -0
  23. package/lib/rest/flexApi/v2/webChannels.js +2 -0
  24. package/lib/rest/intelligence/V2.d.ts +30 -0
  25. package/lib/rest/intelligence/V2.js +40 -0
  26. package/lib/rest/intelligence/v2/customOperator.d.ts +330 -0
  27. package/lib/rest/intelligence/v2/customOperator.js +279 -0
  28. package/lib/rest/intelligence/v2/operator.d.ts +263 -0
  29. package/lib/rest/intelligence/v2/operator.js +197 -0
  30. package/lib/rest/intelligence/v2/operatorAttachment.d.ts +112 -0
  31. package/lib/rest/intelligence/v2/operatorAttachment.js +135 -0
  32. package/lib/rest/intelligence/v2/operatorAttachments.d.ts +94 -0
  33. package/lib/rest/intelligence/v2/operatorAttachments.js +110 -0
  34. package/lib/rest/intelligence/v2/operatorType.d.ts +259 -0
  35. package/lib/rest/intelligence/v2/operatorType.js +197 -0
  36. package/lib/rest/intelligence/v2/prebuiltOperator.d.ts +263 -0
  37. package/lib/rest/intelligence/v2/prebuiltOperator.js +197 -0
  38. package/lib/rest/intelligence/v2/service.d.ts +8 -4
  39. package/lib/rest/intelligence/v2/service.js +3 -2
  40. package/lib/rest/messaging/v1/service.d.ts +0 -6
  41. package/lib/rest/messaging/v1/service.js +0 -2
  42. package/lib/rest/numbers/V1.d.ts +20 -10
  43. package/lib/rest/numbers/V1.js +31 -14
  44. package/lib/rest/numbers/v1/portingPortIn.d.ts +133 -14
  45. package/lib/rest/numbers/v1/portingPortIn.js +116 -24
  46. package/lib/rest/numbers/v1/portingPortInPhoneNumber.d.ts +175 -0
  47. package/lib/rest/numbers/v1/portingPortInPhoneNumber.js +157 -0
  48. package/lib/rest/numbers/v1/portingWebhookConfiguration.d.ts +79 -0
  49. package/lib/rest/{previewMessaging/v1/broadcast.js → numbers/v1/portingWebhookConfiguration.js} +19 -32
  50. package/lib/rest/numbers/v1/portingWebhookConfigurationDelete.d.ts +51 -0
  51. package/lib/rest/numbers/v1/portingWebhookConfigurationDelete.js +68 -0
  52. package/lib/rest/numbers/v1/portingWebhookConfigurationFetch.d.ts +75 -0
  53. package/lib/rest/numbers/v1/portingWebhookConfigurationFetch.js +72 -0
  54. package/lib/rest/taskrouter/v1/workspace/task.d.ts +24 -0
  55. package/lib/rest/taskrouter/v1/workspace/task.js +12 -0
  56. package/lib/rest/trusthub/v1/complianceTollfreeInquiries.d.ts +2 -0
  57. package/lib/rest/trusthub/v1/complianceTollfreeInquiries.js +2 -0
  58. package/lib/rest/trusthub/v1/customerProfiles.d.ts +6 -0
  59. package/lib/rest/trusthub/v1/customerProfiles.js +2 -0
  60. package/lib/rest/trusthub/v1/trustProducts.d.ts +6 -0
  61. package/lib/rest/trusthub/v1/trustProducts.js +2 -0
  62. package/lib/rest/verify/v2/service/verification.d.ts +1 -1
  63. package/lib/rest/verify/v2/service/verificationCheck.d.ts +1 -1
  64. package/lib/rest/verify/v2/service.d.ts +1 -1
  65. package/lib/webhooks/webhooks.js +9 -11
  66. package/package.json +4 -6
  67. package/lib/rest/PreviewMessaging.d.ts +0 -9
  68. package/lib/rest/PreviewMessaging.js +0 -15
  69. package/lib/rest/PreviewMessagingBase.d.ts +0 -13
  70. package/lib/rest/PreviewMessagingBase.js +0 -31
  71. package/lib/rest/numbers/v1/portingBulkPortability.d.ts +0 -120
  72. package/lib/rest/numbers/v1/portingBulkPortability.js +0 -136
  73. package/lib/rest/numbers/v1/portingPortInFetch.d.ts +0 -142
  74. package/lib/rest/numbers/v1/portingPortInFetch.js +0 -128
  75. package/lib/rest/previewMessaging/V1.d.ts +0 -20
  76. package/lib/rest/previewMessaging/V1.js +0 -42
  77. package/lib/rest/previewMessaging/v1/broadcast.d.ts +0 -108
  78. package/lib/rest/previewMessaging/v1/message.d.ts +0 -178
  79. package/lib/rest/previewMessaging/v1/message.js +0 -91
package/README.md CHANGED
@@ -22,6 +22,7 @@ This library supports the following Node.js implementations:
22
22
  - Node.js 14
23
23
  - Node.js 16
24
24
  - Node.js 18
25
+ - Node.js LTS (20)
25
26
 
26
27
  TypeScript is supported for TypeScript version 2.9 and above.
27
28
 
@@ -1,7 +1,9 @@
1
1
  import Domain from "../base/Domain";
2
2
  import V1 from "./content/V1";
3
+ import V2 from "./content/V2";
3
4
  declare class ContentBase extends Domain {
4
5
  _v1?: V1;
6
+ _v2?: V2;
5
7
  /**
6
8
  * Initialize content domain
7
9
  *
@@ -9,5 +11,6 @@ declare class ContentBase extends Domain {
9
11
  */
10
12
  constructor(twilio: any);
11
13
  get v1(): V1;
14
+ get v2(): V2;
12
15
  }
13
16
  export = ContentBase;
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  };
15
15
  const Domain_1 = __importDefault(require("../base/Domain"));
16
16
  const V1_1 = __importDefault(require("./content/V1"));
17
+ const V2_1 = __importDefault(require("./content/V2"));
17
18
  class ContentBase extends Domain_1.default {
18
19
  /**
19
20
  * Initialize content domain
@@ -27,5 +28,9 @@ class ContentBase extends Domain_1.default {
27
28
  this._v1 = this._v1 || new V1_1.default(this);
28
29
  return this._v1;
29
30
  }
31
+ get v2() {
32
+ this._v2 = this._v2 || new V2_1.default(this);
33
+ return this._v2;
34
+ }
30
35
  }
31
36
  module.exports = ContentBase;
@@ -12,7 +12,6 @@ import Insights from "./Insights";
12
12
  import Intelligence from "./Intelligence";
13
13
  import IpMessaging from "./IpMessaging";
14
14
  import Lookups from "./Lookups";
15
- import PreviewMessaging from "./PreviewMessaging";
16
15
  import Messaging from "./Messaging";
17
16
  import Microvisor from "./Microvisor";
18
17
  import Monitor from "./Monitor";
@@ -88,8 +87,6 @@ declare class Twilio extends Client {
88
87
  _ipMessaging?: IpMessaging;
89
88
  /** (Twilio.Lookups) - lookups domain */
90
89
  _lookups?: Lookups;
91
- /** (Twilio.PreviewMessaging) - previewMessaging domain */
92
- _previewMessaging?: PreviewMessaging;
93
90
  /** (Twilio.Messaging) - messaging domain */
94
91
  _messaging?: Messaging;
95
92
  /** (Twilio.Microvisor) - microvisor domain */
@@ -170,8 +167,6 @@ declare class Twilio extends Client {
170
167
  get ipMessaging(): IpMessaging;
171
168
  /** Getter for (Twilio.Lookups) domain */
172
169
  get lookups(): Lookups;
173
- /** Getter for (Twilio.PreviewMessaging) domain */
174
- get previewMessaging(): PreviewMessaging;
175
170
  /** Getter for (Twilio.Messaging) domain */
176
171
  get messaging(): Messaging;
177
172
  /** Getter for (Twilio.Microvisor) domain */
@@ -45,7 +45,6 @@ class Twilio extends BaseTwilio_1.Client {
45
45
  this.intelligence;
46
46
  this.ipMessaging;
47
47
  this.lookups;
48
- this.previewMessaging;
49
48
  this.messaging;
50
49
  this.microvisor;
51
50
  this.monitor;
@@ -127,11 +126,6 @@ class Twilio extends BaseTwilio_1.Client {
127
126
  get lookups() {
128
127
  return this._lookups ?? (this._lookups = new (require("./Lookups"))(this));
129
128
  }
130
- /** Getter for (Twilio.PreviewMessaging) domain */
131
- get previewMessaging() {
132
- return (this._previewMessaging ??
133
- (this._previewMessaging = new (require("./PreviewMessaging"))(this)));
134
- }
135
129
  /** Getter for (Twilio.Messaging) domain */
136
130
  get messaging() {
137
131
  return (this._messaging ?? (this._messaging = new (require("./Messaging"))(this)));
@@ -15,15 +15,15 @@ export interface StreamContextUpdateOptions {
15
15
  * Options to pass to create a StreamInstance
16
16
  */
17
17
  export interface StreamListInstanceCreateOptions {
18
- /** Relative or absolute url where WebSocket connection will be established. */
18
+ /** Relative or absolute URL where WebSocket connection will be established. */
19
19
  url: string;
20
- /** The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. */
20
+ /** The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream. */
21
21
  name?: string;
22
22
  /** */
23
23
  track?: StreamTrack;
24
- /** Absolute URL of the status callback. */
24
+ /** Absolute URL to which Twilio sends status callback HTTP requests. */
25
25
  statusCallback?: string;
26
- /** The http method for the status_callback (one of GET, POST). */
26
+ /** The HTTP method Twilio uses when sending `status_callback` requests. Possible values are `GET` and `POST`. Default is `POST`. */
27
27
  statusCallbackMethod?: string;
28
28
  /** Parameter name */
29
29
  "parameter1.name"?: string;
@@ -484,7 +484,7 @@ export declare class StreamInstance {
484
484
  */
485
485
  callSid: string;
486
486
  /**
487
- * The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream.
487
+ * The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream.
488
488
  */
489
489
  name: string;
490
490
  status: StreamStatus;
@@ -274,7 +274,7 @@ export declare class MessageInstance {
274
274
  numMedia: string;
275
275
  status: MessageStatus;
276
276
  /**
277
- * The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. The value is `null` if a Messaging Service was not used.
277
+ * The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. A unique default value is assigned if a Messaging Service is not used.
278
278
  */
279
279
  messagingServiceSid: string;
280
280
  /**
@@ -0,0 +1,20 @@
1
+ import ContentBase from "../ContentBase";
2
+ import Version from "../../base/Version";
3
+ import { ContentListInstance } from "./v2/content";
4
+ import { ContentAndApprovalsListInstance } from "./v2/contentAndApprovals";
5
+ export default class V2 extends Version {
6
+ /**
7
+ * Initialize the V2 version of Content
8
+ *
9
+ * @param domain - The Twilio (Twilio.Content) domain
10
+ */
11
+ constructor(domain: ContentBase);
12
+ /** contents - { Twilio.Content.V2.ContentListInstance } resource */
13
+ protected _contents?: ContentListInstance;
14
+ /** contentAndApprovals - { Twilio.Content.V2.ContentAndApprovalsListInstance } resource */
15
+ protected _contentAndApprovals?: ContentAndApprovalsListInstance;
16
+ /** Getter for contents resource */
17
+ get contents(): ContentListInstance;
18
+ /** Getter for contentAndApprovals resource */
19
+ get contentAndApprovals(): ContentAndApprovalsListInstance;
20
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Content
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 content_1 = require("./v2/content");
21
+ const contentAndApprovals_1 = require("./v2/contentAndApprovals");
22
+ class V2 extends Version_1.default {
23
+ /**
24
+ * Initialize the V2 version of Content
25
+ *
26
+ * @param domain - The Twilio (Twilio.Content) domain
27
+ */
28
+ constructor(domain) {
29
+ super(domain, "v2");
30
+ }
31
+ /** Getter for contents resource */
32
+ get contents() {
33
+ this._contents = this._contents || (0, content_1.ContentListInstance)(this);
34
+ return this._contents;
35
+ }
36
+ /** Getter for contentAndApprovals resource */
37
+ get contentAndApprovals() {
38
+ this._contentAndApprovals =
39
+ this._contentAndApprovals || (0, contentAndApprovals_1.ContentAndApprovalsListInstance)(this);
40
+ return this._contentAndApprovals;
41
+ }
42
+ }
43
+ exports.default = V2;
@@ -0,0 +1,196 @@
1
+ /// <reference types="node" />
2
+ import { inspect, InspectOptions } from "util";
3
+ import Page, { TwilioResponsePayload } from "../../../base/Page";
4
+ import Response from "../../../http/response";
5
+ import V2 from "../V2";
6
+ /**
7
+ * Options to pass to each
8
+ */
9
+ export interface ContentListInstanceEachOptions {
10
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
11
+ pageSize?: number;
12
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
13
+ callback?: (item: ContentInstance, done: (err?: Error) => void) => void;
14
+ /** Function to be called upon completion of streaming */
15
+ done?: Function;
16
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
17
+ limit?: number;
18
+ }
19
+ /**
20
+ * Options to pass to list
21
+ */
22
+ export interface ContentListInstanceOptions {
23
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
24
+ pageSize?: number;
25
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
26
+ limit?: number;
27
+ }
28
+ /**
29
+ * Options to pass to page
30
+ */
31
+ export interface ContentListInstancePageOptions {
32
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
33
+ pageSize?: number;
34
+ /** Page Number, this value is simply for client state */
35
+ pageNumber?: number;
36
+ /** PageToken provided by the API */
37
+ pageToken?: string;
38
+ }
39
+ export interface ContentSolution {
40
+ }
41
+ export interface ContentListInstance {
42
+ _version: V2;
43
+ _solution: ContentSolution;
44
+ _uri: string;
45
+ /**
46
+ * Streams ContentInstance records from the API.
47
+ *
48
+ * This operation lazily loads records as efficiently as possible until the limit
49
+ * is reached.
50
+ *
51
+ * The results are passed into the callback function, so this operation is memory
52
+ * efficient.
53
+ *
54
+ * If a function is passed as the first argument, it will be used as the callback
55
+ * function.
56
+ *
57
+ * @param { ContentListInstanceEachOptions } [params] - Options for request
58
+ * @param { function } [callback] - Function to process each record
59
+ */
60
+ each(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
61
+ each(params: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
62
+ /**
63
+ * Retrieve a single target page of ContentInstance records from the API.
64
+ *
65
+ * The request is executed immediately.
66
+ *
67
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
68
+ * @param { function } [callback] - Callback to handle list of records
69
+ */
70
+ getPage(targetUrl: string, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
71
+ /**
72
+ * Lists ContentInstance records from the API as a list.
73
+ *
74
+ * If a function is passed as the first argument, it will be used as the callback
75
+ * function.
76
+ *
77
+ * @param { ContentListInstanceOptions } [params] - Options for request
78
+ * @param { function } [callback] - Callback to handle list of records
79
+ */
80
+ list(callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
81
+ list(params: ContentListInstanceOptions, callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
82
+ /**
83
+ * Retrieve a single page of ContentInstance records from the API.
84
+ *
85
+ * The request is executed immediately.
86
+ *
87
+ * If a function is passed as the first argument, it will be used as the callback
88
+ * function.
89
+ *
90
+ * @param { ContentListInstancePageOptions } [params] - Options for request
91
+ * @param { function } [callback] - Callback to handle list of records
92
+ */
93
+ page(callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
94
+ page(params: ContentListInstancePageOptions, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
95
+ /**
96
+ * Provide a user-friendly representation
97
+ */
98
+ toJSON(): any;
99
+ [inspect.custom](_depth: any, options: InspectOptions): any;
100
+ }
101
+ export declare function ContentListInstance(version: V2): ContentListInstance;
102
+ interface ContentPayload extends TwilioResponsePayload {
103
+ contents: ContentResource[];
104
+ }
105
+ interface ContentResource {
106
+ date_created: Date;
107
+ date_updated: Date;
108
+ sid: string;
109
+ account_sid: string;
110
+ friendly_name: string;
111
+ language: string;
112
+ variables: any;
113
+ types: any;
114
+ url: string;
115
+ links: Record<string, string>;
116
+ }
117
+ export declare class ContentInstance {
118
+ protected _version: V2;
119
+ constructor(_version: V2, payload: ContentResource);
120
+ /**
121
+ * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
122
+ */
123
+ dateCreated: Date;
124
+ /**
125
+ * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
126
+ */
127
+ dateUpdated: Date;
128
+ /**
129
+ * The unique string that that we created to identify the Content resource.
130
+ */
131
+ sid: string;
132
+ /**
133
+ * The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
134
+ */
135
+ accountSid: string;
136
+ /**
137
+ * A string name used to describe the Content resource. Not visible to the end recipient.
138
+ */
139
+ friendlyName: string;
140
+ /**
141
+ * Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in.
142
+ */
143
+ language: string;
144
+ /**
145
+ * Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}.
146
+ */
147
+ variables: any;
148
+ /**
149
+ * The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource.
150
+ */
151
+ types: any;
152
+ /**
153
+ * The URL of the resource, relative to `https://content.twilio.com`.
154
+ */
155
+ url: string;
156
+ /**
157
+ * A list of links related to the Content resource, such as approval_fetch and approval_create
158
+ */
159
+ links: Record<string, string>;
160
+ /**
161
+ * Provide a user-friendly representation
162
+ *
163
+ * @returns Object
164
+ */
165
+ toJSON(): {
166
+ dateCreated: Date;
167
+ dateUpdated: Date;
168
+ sid: string;
169
+ accountSid: string;
170
+ friendlyName: string;
171
+ language: string;
172
+ variables: any;
173
+ types: any;
174
+ url: string;
175
+ links: Record<string, string>;
176
+ };
177
+ [inspect.custom](_depth: any, options: InspectOptions): string;
178
+ }
179
+ export declare class ContentPage extends Page<V2, ContentPayload, ContentResource, ContentInstance> {
180
+ /**
181
+ * Initialize the ContentPage
182
+ *
183
+ * @param version - Version of the resource
184
+ * @param response - Response from the API
185
+ * @param solution - Path solution
186
+ */
187
+ constructor(version: V2, response: Response<string>, solution: ContentSolution);
188
+ /**
189
+ * Build an instance of ContentInstance
190
+ *
191
+ * @param payload - Payload response from the API
192
+ */
193
+ getInstance(payload: ContentResource): ContentInstance;
194
+ [inspect.custom](depth: any, options: InspectOptions): string;
195
+ }
196
+ export {};
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Content
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
+ exports.ContentPage = exports.ContentInstance = exports.ContentListInstance = void 0;
20
+ const util_1 = require("util");
21
+ const Page_1 = __importDefault(require("../../../base/Page"));
22
+ const deserialize = require("../../../base/deserialize");
23
+ const serialize = require("../../../base/serialize");
24
+ function ContentListInstance(version) {
25
+ const instance = {};
26
+ instance._version = version;
27
+ instance._solution = {};
28
+ instance._uri = `/Content`;
29
+ instance.page = function page(params, callback) {
30
+ if (params instanceof Function) {
31
+ callback = params;
32
+ params = {};
33
+ }
34
+ else {
35
+ params = params || {};
36
+ }
37
+ let data = {};
38
+ if (params["pageSize"] !== undefined)
39
+ data["PageSize"] = params["pageSize"];
40
+ if (params.pageNumber !== undefined)
41
+ data["Page"] = params.pageNumber;
42
+ if (params.pageToken !== undefined)
43
+ data["PageToken"] = params.pageToken;
44
+ const headers = {};
45
+ let operationVersion = version, operationPromise = operationVersion.page({
46
+ uri: instance._uri,
47
+ method: "get",
48
+ params: data,
49
+ headers,
50
+ });
51
+ operationPromise = operationPromise.then((payload) => new ContentPage(operationVersion, payload, instance._solution));
52
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
53
+ return operationPromise;
54
+ };
55
+ instance.each = instance._version.each;
56
+ instance.list = instance._version.list;
57
+ instance.getPage = function getPage(targetUrl, callback) {
58
+ const operationPromise = instance._version._domain.twilio.request({
59
+ method: "get",
60
+ uri: targetUrl,
61
+ });
62
+ let pagePromise = operationPromise.then((payload) => new ContentPage(instance._version, payload, instance._solution));
63
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
64
+ return pagePromise;
65
+ };
66
+ instance.toJSON = function toJSON() {
67
+ return instance._solution;
68
+ };
69
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
70
+ return (0, util_1.inspect)(instance.toJSON(), options);
71
+ };
72
+ return instance;
73
+ }
74
+ exports.ContentListInstance = ContentListInstance;
75
+ class ContentInstance {
76
+ constructor(_version, payload) {
77
+ this._version = _version;
78
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
79
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
80
+ this.sid = payload.sid;
81
+ this.accountSid = payload.account_sid;
82
+ this.friendlyName = payload.friendly_name;
83
+ this.language = payload.language;
84
+ this.variables = payload.variables;
85
+ this.types = payload.types;
86
+ this.url = payload.url;
87
+ this.links = payload.links;
88
+ }
89
+ /**
90
+ * Provide a user-friendly representation
91
+ *
92
+ * @returns Object
93
+ */
94
+ toJSON() {
95
+ return {
96
+ dateCreated: this.dateCreated,
97
+ dateUpdated: this.dateUpdated,
98
+ sid: this.sid,
99
+ accountSid: this.accountSid,
100
+ friendlyName: this.friendlyName,
101
+ language: this.language,
102
+ variables: this.variables,
103
+ types: this.types,
104
+ url: this.url,
105
+ links: this.links,
106
+ };
107
+ }
108
+ [util_1.inspect.custom](_depth, options) {
109
+ return (0, util_1.inspect)(this.toJSON(), options);
110
+ }
111
+ }
112
+ exports.ContentInstance = ContentInstance;
113
+ class ContentPage extends Page_1.default {
114
+ /**
115
+ * Initialize the ContentPage
116
+ *
117
+ * @param version - Version of the resource
118
+ * @param response - Response from the API
119
+ * @param solution - Path solution
120
+ */
121
+ constructor(version, response, solution) {
122
+ super(version, response, solution);
123
+ }
124
+ /**
125
+ * Build an instance of ContentInstance
126
+ *
127
+ * @param payload - Payload response from the API
128
+ */
129
+ getInstance(payload) {
130
+ return new ContentInstance(this._version, payload);
131
+ }
132
+ [util_1.inspect.custom](depth, options) {
133
+ return (0, util_1.inspect)(this.toJSON(), options);
134
+ }
135
+ }
136
+ exports.ContentPage = ContentPage;