twilio 5.10.0 → 5.10.2

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 (55) hide show
  1. package/README.md +0 -58
  2. package/lib/base/RequestClient.js +2 -2
  3. package/lib/http/bearer_token/ApiTokenManager.d.ts +1 -1
  4. package/lib/http/bearer_token/ApiTokenManager.js +4 -4
  5. package/lib/http/bearer_token/OrgsTokenManager.d.ts +1 -1
  6. package/lib/http/bearer_token/OrgsTokenManager.js +4 -4
  7. package/lib/rest/Knowledge.d.ts +4 -0
  8. package/lib/rest/Knowledge.js +8 -0
  9. package/lib/rest/KnowledgeBase.d.ts +13 -0
  10. package/lib/rest/KnowledgeBase.js +31 -0
  11. package/lib/rest/Twilio.d.ts +5 -0
  12. package/lib/rest/Twilio.js +5 -0
  13. package/lib/rest/api/v2010/account/conference/participant.d.ts +3 -1
  14. package/lib/rest/api/v2010/account/conference/participant.js +2 -0
  15. package/lib/rest/conversations/v1/service/binding.d.ts +5 -5
  16. package/lib/rest/conversations/v1/service/conversation.d.ts +1 -1
  17. package/lib/rest/knowledge/V1.d.ts +15 -0
  18. package/lib/rest/knowledge/V1.js +36 -0
  19. package/lib/rest/knowledge/v1/knowledge/chunk.d.ts +166 -0
  20. package/lib/rest/knowledge/v1/knowledge/chunk.js +131 -0
  21. package/lib/rest/knowledge/v1/knowledge/knowledgeStatus.d.ts +100 -0
  22. package/lib/rest/knowledge/v1/knowledge/knowledgeStatus.js +118 -0
  23. package/lib/rest/knowledge/v1/knowledge.d.ts +411 -0
  24. package/lib/rest/knowledge/v1/knowledge.js +302 -0
  25. package/lib/rest/lookups/v2/phoneNumber.d.ts +87 -52
  26. package/lib/rest/lookups/v2/phoneNumber.js +30 -3
  27. package/lib/rest/lookups/v2/query.d.ts +25 -23
  28. package/lib/rest/lookups/v2/query.js +14 -14
  29. package/lib/rest/messaging/V2.d.ts +5 -0
  30. package/lib/rest/messaging/V2.js +7 -0
  31. package/lib/rest/messaging/v1/tollfreeVerification.d.ts +78 -0
  32. package/lib/rest/messaging/v1/tollfreeVerification.js +28 -0
  33. package/lib/rest/messaging/v2/typingIndicator.d.ts +54 -0
  34. package/lib/rest/messaging/v2/typingIndicator.js +79 -0
  35. package/lib/rest/numbers/V1.d.ts +5 -0
  36. package/lib/rest/numbers/V1.js +7 -0
  37. package/lib/rest/numbers/v1/portingAllPortIn.d.ts +201 -0
  38. package/lib/rest/numbers/v1/portingAllPortIn.js +139 -0
  39. package/lib/rest/numbers/v1/portingPortIn.d.ts +173 -17
  40. package/lib/rest/numbers/v1/portingPortIn.js +20 -7
  41. package/lib/rest/oauth/v2/token.d.ts +10 -2
  42. package/lib/rest/oauth/v2/token.js +9 -9
  43. package/lib/rest/verify/V2.d.ts +0 -5
  44. package/lib/rest/verify/V2.js +0 -6
  45. package/lib/rest/verify/v2/service/approveChallenge.d.ts +202 -0
  46. package/lib/rest/verify/v2/service/approveChallenge.js +123 -0
  47. package/lib/rest/verify/v2/{newChallenge.d.ts → service/newChallenge.d.ts} +6 -5
  48. package/lib/rest/verify/v2/{newChallenge.js → service/newChallenge.js} +11 -8
  49. package/lib/rest/verify/v2/service/newVerifyFactor.d.ts +162 -0
  50. package/lib/rest/verify/v2/service/newVerifyFactor.js +111 -0
  51. package/lib/rest/verify/v2/service.d.ts +24 -0
  52. package/lib/rest/verify/v2/service.js +39 -0
  53. package/package.json +3 -14
  54. package/lib-esm/index.js +0 -49
  55. package/lib-esm/package.json +0 -3
package/README.md CHANGED
@@ -38,7 +38,6 @@ TypeScript is supported for TypeScript version 2.9 and above.
38
38
 
39
39
  To make sure the installation was successful, try sending yourself an SMS message, like this:
40
40
 
41
- **CommonJS:**
42
41
  ```js
43
42
  // Your AccountSID and Auth Token from console.twilio.com
44
43
  const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
@@ -55,25 +54,6 @@ client.messages
55
54
  .then((message) => console.log(message.sid));
56
55
  ```
57
56
 
58
- **ESM/ES6 Modules:**
59
- ```js
60
- // Your AccountSID and Auth Token from console.twilio.com
61
- import twilio from 'twilio';
62
-
63
- const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
64
- const authToken = 'your_auth_token';
65
-
66
- const client = twilio(accountSid, authToken);
67
-
68
- client.messages
69
- .create({
70
- body: 'Hello from twilio-node',
71
- to: '+12345678901', // Text your number
72
- from: '+12345678901', // From a valid Twilio number
73
- })
74
- .then((message) => console.log(message.sid));
75
- ```
76
-
77
57
  After a brief delay, you will receive the text message on your phone.
78
58
 
79
59
  > **Warning**
@@ -112,48 +92,10 @@ const mainAccountCalls = client.api.v2010.account.calls.list; // SID not specifi
112
92
  const subaccountCalls = client.api.v2010.account(subaccountSid).calls.list; // SID specified as subaccountSid
113
93
  ```
114
94
 
115
- **ESM/ES6 Modules:**
116
- ```javascript
117
- // Your Account SID, Subaccount SID Auth Token from console.twilio.com
118
- import twilio from 'twilio';
119
-
120
- const accountSid = process.env.TWILIO_ACCOUNT_SID;
121
- const authToken = process.env.TWILIO_AUTH_TOKEN;
122
- const subaccountSid = process.env.TWILIO_ACCOUNT_SUBACCOUNT_SID;
123
-
124
- const client = twilio(accountSid, authToken);
125
- const mainAccountCalls = client.api.v2010.account.calls.list; // SID not specified, so defaults to accountSid
126
- const subaccountCalls = client.api.v2010.account(subaccountSid).calls.list; // SID specified as subaccountSid
127
- ```
128
-
129
95
  ### Lazy Loading
130
96
 
131
97
  `twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is enabled by default. To disable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `false`:
132
98
 
133
- **CommonJS:**
134
- ```javascript
135
- // Your Account SID and Auth Token from console.twilio.com
136
- const accountSid = process.env.TWILIO_ACCOUNT_SID;
137
- const authToken = process.env.TWILIO_AUTH_TOKEN;
138
-
139
- const client = require('twilio')(accountSid, authToken, {
140
- lazyLoading: false,
141
- });
142
- ```
143
-
144
- **ESM/ES6 Modules:**
145
- ```javascript
146
- // Your Account SID and Auth Token from console.twilio.com
147
- import twilio from 'twilio';
148
-
149
- const accountSid = process.env.TWILIO_ACCOUNT_SID;
150
- const authToken = process.env.TWILIO_AUTH_TOKEN;
151
-
152
- const client = twilio(accountSid, authToken, {
153
- lazyLoading: false,
154
- });
155
- ```
156
-
157
99
  ### Enable Auto-Retry with Exponential Backoff
158
100
 
159
101
  `twilio-node` supports automatic retry with exponential backoff when API requests receive an [Error 429 response](https://support.twilio.com/hc/en-us/articles/360044308153-Twilio-API-response-Error-429-Too-Many-Requests-). This retry with exponential backoff feature is disabled by default. To enable this feature, instantiate the Twilio client with the `autoRetry` flag set to `true`.
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
- const axios_1 = __importDefault(require("axios"));
38
+ const axios_1 = __importStar(require("axios"));
39
39
  const fs = __importStar(require("fs"));
40
40
  const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
41
41
  const qs_1 = __importDefault(require("qs"));
@@ -252,7 +252,7 @@ class RequestClient {
252
252
  */
253
253
  validationInterceptor(validationClient) {
254
254
  return function (config) {
255
- config.headers = config.headers || {};
255
+ config.headers = config.headers || new axios_1.AxiosHeaders();
256
256
  try {
257
257
  config.headers["Twilio-Client-Validation"] = new ValidationToken_1.default(validationClient).fromHttpRequest(config);
258
258
  }
@@ -1,5 +1,5 @@
1
1
  import TokenManager from "./TokenManager";
2
- import { TokenListInstanceCreateOptions } from "../../rest/iam/v1/token";
2
+ import { TokenListInstanceCreateOptions } from "../../rest/oauth/v2/token";
3
3
  export default class ApiTokenManager implements TokenManager {
4
4
  private params;
5
5
  constructor(params: TokenListInstanceCreateOptions);
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const token_1 = require("../../rest/iam/v1/token");
7
- const IamBase_1 = __importDefault(require("../../rest/IamBase"));
8
- const V1_1 = __importDefault(require("../../rest/iam/V1"));
6
+ const token_1 = require("../../rest/oauth/v2/token");
7
+ const OauthBase_1 = __importDefault(require("../../rest/OauthBase"));
8
+ const V2_1 = __importDefault(require("../../rest/oauth/V2"));
9
9
  const NoAuthCredentialProvider_1 = __importDefault(require("../../credential_provider/NoAuthCredentialProvider"));
10
10
  const BaseTwilio_1 = require("../../base/BaseTwilio");
11
11
  class ApiTokenManager {
@@ -19,7 +19,7 @@ class ApiTokenManager {
19
19
  const noAuthCredentialProvider = new NoAuthCredentialProvider_1.default.NoAuthCredentialProvider();
20
20
  const client = new BaseTwilio_1.Client();
21
21
  client.setCredentialProvider(noAuthCredentialProvider);
22
- const tokenListInstance = (0, token_1.TokenListInstance)(new V1_1.default(new IamBase_1.default(client)));
22
+ const tokenListInstance = (0, token_1.TokenListInstance)(new V2_1.default(new OauthBase_1.default(client)));
23
23
  return tokenListInstance
24
24
  .create(this.params)
25
25
  .then((token) => {
@@ -1,5 +1,5 @@
1
1
  import TokenManager from "./TokenManager";
2
- import { TokenListInstanceCreateOptions } from "../../rest/iam/v1/token";
2
+ import { TokenListInstanceCreateOptions } from "../../rest/oauth/v2/token";
3
3
  export default class OrgsTokenManager implements TokenManager {
4
4
  private readonly params;
5
5
  constructor(params: TokenListInstanceCreateOptions);
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const token_1 = require("../../rest/iam/v1/token");
7
- const IamBase_1 = __importDefault(require("../../rest/IamBase"));
8
- const V1_1 = __importDefault(require("../../rest/iam/V1"));
6
+ const token_1 = require("../../rest/oauth/v2/token");
7
+ const OauthBase_1 = __importDefault(require("../../rest/OauthBase"));
8
+ const V2_1 = __importDefault(require("../../rest/oauth/V2"));
9
9
  const NoAuthCredentialProvider_1 = __importDefault(require("../../credential_provider/NoAuthCredentialProvider"));
10
10
  const BaseTwilio_1 = require("../../base/BaseTwilio");
11
11
  class OrgsTokenManager {
@@ -19,7 +19,7 @@ class OrgsTokenManager {
19
19
  const noAuthCredentialProvider = new NoAuthCredentialProvider_1.default.NoAuthCredentialProvider();
20
20
  const client = new BaseTwilio_1.Client();
21
21
  client.setCredentialProvider(noAuthCredentialProvider);
22
- const tokenListInstance = (0, token_1.TokenListInstance)(new V1_1.default(new IamBase_1.default(client)));
22
+ const tokenListInstance = (0, token_1.TokenListInstance)(new V2_1.default(new OauthBase_1.default(client)));
23
23
  return tokenListInstance
24
24
  .create(this.params)
25
25
  .then((token) => {
@@ -0,0 +1,4 @@
1
+ import KnowledgeBase from "./KnowledgeBase";
2
+ declare class Knowledge extends KnowledgeBase {
3
+ }
4
+ export = Knowledge;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const KnowledgeBase_1 = __importDefault(require("./KnowledgeBase"));
6
+ class Knowledge extends KnowledgeBase_1.default {
7
+ }
8
+ module.exports = Knowledge;
@@ -0,0 +1,13 @@
1
+ import Domain from "../base/Domain";
2
+ import V1 from "./knowledge/V1";
3
+ declare class KnowledgeBase extends Domain {
4
+ _v1?: V1;
5
+ /**
6
+ * Initialize knowledge domain
7
+ *
8
+ * @param twilio - The twilio client
9
+ */
10
+ constructor(twilio: any);
11
+ get v1(): V1;
12
+ }
13
+ export = KnowledgeBase;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator.
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ const Domain_1 = __importDefault(require("../base/Domain"));
16
+ const V1_1 = __importDefault(require("./knowledge/V1"));
17
+ class KnowledgeBase extends Domain_1.default {
18
+ /**
19
+ * Initialize knowledge domain
20
+ *
21
+ * @param twilio - The twilio client
22
+ */
23
+ constructor(twilio) {
24
+ super(twilio, "https://knowledge.twilio.com");
25
+ }
26
+ get v1() {
27
+ this._v1 = this._v1 || new V1_1.default(this);
28
+ return this._v1;
29
+ }
30
+ }
31
+ module.exports = KnowledgeBase;
@@ -14,6 +14,7 @@ import Iam from "./Iam";
14
14
  import Insights from "./Insights";
15
15
  import Intelligence from "./Intelligence";
16
16
  import IpMessaging from "./IpMessaging";
17
+ import Knowledge from "./Knowledge";
17
18
  import Lookups from "./Lookups";
18
19
  import Marketplace from "./Marketplace";
19
20
  import Messaging from "./Messaging";
@@ -94,6 +95,8 @@ declare class Twilio extends Client {
94
95
  _intelligence?: Intelligence;
95
96
  /** (Twilio.IpMessaging) - ipMessaging domain */
96
97
  _ipMessaging?: IpMessaging;
98
+ /** (Twilio.Knowledge) - knowledge domain */
99
+ _knowledge?: Knowledge;
97
100
  /** (Twilio.Lookups) - lookups domain */
98
101
  _lookups?: Lookups;
99
102
  /** (Twilio.Marketplace) - marketplace domain */
@@ -180,6 +183,8 @@ declare class Twilio extends Client {
180
183
  get intelligence(): Intelligence;
181
184
  /** Getter for (Twilio.IpMessaging) domain */
182
185
  get ipMessaging(): IpMessaging;
186
+ /** Getter for (Twilio.Knowledge) domain */
187
+ get knowledge(): Knowledge;
183
188
  /** Getter for (Twilio.Lookups) domain */
184
189
  get lookups(): Lookups;
185
190
  /** Getter for (Twilio.Marketplace) domain */
@@ -47,6 +47,7 @@ class Twilio extends BaseTwilio_1.Client {
47
47
  this.insights;
48
48
  this.intelligence;
49
49
  this.ipMessaging;
50
+ this.knowledge;
50
51
  this.lookups;
51
52
  this.marketplace;
52
53
  this.messaging;
@@ -139,6 +140,10 @@ class Twilio extends BaseTwilio_1.Client {
139
140
  return (this._ipMessaging ??
140
141
  (this._ipMessaging = new (require("./IpMessaging"))(this)));
141
142
  }
143
+ /** Getter for (Twilio.Knowledge) domain */
144
+ get knowledge() {
145
+ return (this._knowledge ?? (this._knowledge = new (require("./Knowledge"))(this)));
146
+ }
142
147
  /** Getter for (Twilio.Lookups) domain */
143
148
  get lookups() {
144
149
  return this._lookups ?? (this._lookups = new (require("./Lookups"))(this));
@@ -41,7 +41,7 @@ export interface ParticipantContextUpdateOptions {
41
41
  export interface ParticipantListInstanceCreateOptions {
42
42
  /** The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `from` must also be a phone number. If `to` is sip address, this value of `from` should be a username portion to be used to populate the P-Asserted-Identity header that is passed to the SIP endpoint. */
43
43
  from: string;
44
- /** The phone number, SIP address, or Client identifier that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `sip:name@company.com`. Client identifiers are formatted `client:name`. [Custom parameters](https://www.twilio.com/docs/voice/api/conference-participant-resource#custom-parameters) may also be specified. */
44
+ /** The phone number, SIP address, Client, TwiML App identifier that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `sip:name@company.com`. Client identifiers are formatted `client:name`. TwiML App identifiers are formatted `app:<APP_SID>`. [Custom parameters](https://www.twilio.com/docs/voice/api/conference-participant-resource#custom-parameters) may also be specified. */
45
45
  to: string;
46
46
  /** The URL we should call using the `status_callback_method` to send status information to your application. */
47
47
  statusCallback?: string;
@@ -135,6 +135,8 @@ export interface ParticipantListInstanceCreateOptions {
135
135
  trim?: string;
136
136
  /** A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call\\\'s call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. */
137
137
  callToken?: string;
138
+ /** The name that appears to the called party for this call. Must be between 2 and 255 characters. */
139
+ callerDisplayName?: string;
138
140
  }
139
141
  /**
140
142
  * Options to pass to each
@@ -330,6 +330,8 @@ function ParticipantListInstance(version, accountSid, conferenceSid) {
330
330
  data["Trim"] = params["trim"];
331
331
  if (params["callToken"] !== undefined)
332
332
  data["CallToken"] = params["callToken"];
333
+ if (params["callerDisplayName"] !== undefined)
334
+ data["CallerDisplayName"] = params["callerDisplayName"];
333
335
  const headers = {};
334
336
  headers["Content-Type"] = "application/x-www-form-urlencoded";
335
337
  headers["Accept"] = "application/json";
@@ -3,14 +3,14 @@ import Page, { TwilioResponsePayload } from "../../../../base/Page";
3
3
  import Response from "../../../../http/response";
4
4
  import V1 from "../../V1";
5
5
  /**
6
- * The push technology to use for the Binding. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
6
+ * The push technology to use for the Binding. Can be: `apn`, `gcm`, `fcm`, or `twilsock`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
7
7
  */
8
- export type BindingBindingType = "apn" | "gcm" | "fcm";
8
+ export type BindingBindingType = "apn" | "gcm" | "fcm" | "twilsock";
9
9
  /**
10
10
  * Options to pass to each
11
11
  */
12
12
  export interface BindingListInstanceEachOptions {
13
- /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */
13
+ /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, `fcm`, or `twilsock`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */
14
14
  bindingType?: Array<BindingBindingType>;
15
15
  /** The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. */
16
16
  identity?: Array<string>;
@@ -27,7 +27,7 @@ export interface BindingListInstanceEachOptions {
27
27
  * Options to pass to list
28
28
  */
29
29
  export interface BindingListInstanceOptions {
30
- /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */
30
+ /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, `fcm`, or `twilsock`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */
31
31
  bindingType?: Array<BindingBindingType>;
32
32
  /** The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. */
33
33
  identity?: Array<string>;
@@ -40,7 +40,7 @@ export interface BindingListInstanceOptions {
40
40
  * Options to pass to page
41
41
  */
42
42
  export interface BindingListInstancePageOptions {
43
- /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */
43
+ /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, `fcm`, or `twilsock`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */
44
44
  bindingType?: Array<BindingBindingType>;
45
45
  /** The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. */
46
46
  identity?: Array<string>;
@@ -8,7 +8,7 @@ import { WebhookListInstance } from "./conversation/webhook";
8
8
  /**
9
9
  * Current state of this conversation. Can be either `initializing`, `active`, `inactive` or `closed` and defaults to `active`
10
10
  */
11
- export type ConversationState = "inactive" | "active" | "closed";
11
+ export type ConversationState = "inactive" | "active" | "closed" | "initializing";
12
12
  export type ConversationWebhookEnabledType = "true" | "false";
13
13
  /**
14
14
  * Options to pass to remove a ConversationInstance
@@ -0,0 +1,15 @@
1
+ import KnowledgeBase from "../KnowledgeBase";
2
+ import Version from "../../base/Version";
3
+ import { KnowledgeListInstance } from "./v1/knowledge";
4
+ export default class V1 extends Version {
5
+ /**
6
+ * Initialize the V1 version of Knowledge
7
+ *
8
+ * @param domain - The Twilio (Twilio.Knowledge) domain
9
+ */
10
+ constructor(domain: KnowledgeBase);
11
+ /** knowledge - { Twilio.Knowledge.V1.KnowledgeListInstance } resource */
12
+ protected _knowledge?: KnowledgeListInstance;
13
+ /** Getter for knowledge resource */
14
+ get knowledge(): KnowledgeListInstance;
15
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Knowledge
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 knowledge_1 = require("./v1/knowledge");
21
+ class V1 extends Version_1.default {
22
+ /**
23
+ * Initialize the V1 version of Knowledge
24
+ *
25
+ * @param domain - The Twilio (Twilio.Knowledge) domain
26
+ */
27
+ constructor(domain) {
28
+ super(domain, "v1");
29
+ }
30
+ /** Getter for knowledge resource */
31
+ get knowledge() {
32
+ this._knowledge = this._knowledge || (0, knowledge_1.KnowledgeListInstance)(this);
33
+ return this._knowledge;
34
+ }
35
+ }
36
+ exports.default = V1;
@@ -0,0 +1,166 @@
1
+ import { inspect, InspectOptions } from "util";
2
+ import Page, { TwilioResponsePayload } from "../../../../base/Page";
3
+ import Response from "../../../../http/response";
4
+ import V1 from "../../V1";
5
+ /**
6
+ * Options to pass to each
7
+ */
8
+ export interface ChunkListInstanceEachOptions {
9
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
10
+ pageSize?: number;
11
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
12
+ callback?: (item: ChunkInstance, done: (err?: Error) => void) => void;
13
+ /** Function to be called upon completion of streaming */
14
+ done?: Function;
15
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
16
+ limit?: number;
17
+ }
18
+ /**
19
+ * Options to pass to list
20
+ */
21
+ export interface ChunkListInstanceOptions {
22
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
23
+ pageSize?: number;
24
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
25
+ limit?: number;
26
+ }
27
+ /**
28
+ * Options to pass to page
29
+ */
30
+ export interface ChunkListInstancePageOptions {
31
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
32
+ pageSize?: number;
33
+ /** Page Number, this value is simply for client state */
34
+ pageNumber?: number;
35
+ /** PageToken provided by the API */
36
+ pageToken?: string;
37
+ }
38
+ export interface ChunkSolution {
39
+ id: string;
40
+ }
41
+ export interface ChunkListInstance {
42
+ _version: V1;
43
+ _solution: ChunkSolution;
44
+ _uri: string;
45
+ /**
46
+ * Streams ChunkInstance 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 { ChunkListInstanceEachOptions } [params] - Options for request
58
+ * @param { function } [callback] - Function to process each record
59
+ */
60
+ each(callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
61
+ each(params: ChunkListInstanceEachOptions, callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
62
+ /**
63
+ * Retrieve a single target page of ChunkInstance 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: ChunkPage) => any): Promise<ChunkPage>;
71
+ /**
72
+ * Lists ChunkInstance 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 { ChunkListInstanceOptions } [params] - Options for request
78
+ * @param { function } [callback] - Callback to handle list of records
79
+ */
80
+ list(callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
81
+ list(params: ChunkListInstanceOptions, callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
82
+ /**
83
+ * Retrieve a single page of ChunkInstance 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 { ChunkListInstancePageOptions } [params] - Options for request
91
+ * @param { function } [callback] - Callback to handle list of records
92
+ */
93
+ page(callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
94
+ page(params: ChunkListInstancePageOptions, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
95
+ /**
96
+ * Provide a user-friendly representation
97
+ */
98
+ toJSON(): any;
99
+ [inspect.custom](_depth: any, options: InspectOptions): any;
100
+ }
101
+ export declare function ChunkListInstance(version: V1, id: string): ChunkListInstance;
102
+ interface ChunkPayload extends TwilioResponsePayload {
103
+ chunks: ChunkResource[];
104
+ }
105
+ interface ChunkResource {
106
+ account_sid: string;
107
+ content: string;
108
+ metadata: Record<string, object>;
109
+ date_created: Date;
110
+ date_updated: Date;
111
+ }
112
+ export declare class ChunkInstance {
113
+ protected _version: V1;
114
+ constructor(_version: V1, payload: ChunkResource, id: string);
115
+ /**
116
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
117
+ */
118
+ accountSid: string;
119
+ /**
120
+ * The chunk content.
121
+ */
122
+ content: string;
123
+ /**
124
+ * The metadata of the chunk.
125
+ */
126
+ metadata: Record<string, object>;
127
+ /**
128
+ * The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
129
+ */
130
+ dateCreated: Date;
131
+ /**
132
+ * The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
133
+ */
134
+ dateUpdated: Date;
135
+ /**
136
+ * Provide a user-friendly representation
137
+ *
138
+ * @returns Object
139
+ */
140
+ toJSON(): {
141
+ accountSid: string;
142
+ content: string;
143
+ metadata: Record<string, object>;
144
+ dateCreated: Date;
145
+ dateUpdated: Date;
146
+ };
147
+ [inspect.custom](_depth: any, options: InspectOptions): string;
148
+ }
149
+ export declare class ChunkPage extends Page<V1, ChunkPayload, ChunkResource, ChunkInstance> {
150
+ /**
151
+ * Initialize the ChunkPage
152
+ *
153
+ * @param version - Version of the resource
154
+ * @param response - Response from the API
155
+ * @param solution - Path solution
156
+ */
157
+ constructor(version: V1, response: Response<string>, solution: ChunkSolution);
158
+ /**
159
+ * Build an instance of ChunkInstance
160
+ *
161
+ * @param payload - Payload response from the API
162
+ */
163
+ getInstance(payload: ChunkResource): ChunkInstance;
164
+ [inspect.custom](depth: any, options: InspectOptions): string;
165
+ }
166
+ export {};