twilio 6.0.1 → 6.0.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.
@@ -1,5 +1,6 @@
1
1
  import ConversationsBase from "../ConversationsBase";
2
2
  import Version from "../../base/Version";
3
+ import { ActionListInstance } from "./v2/action";
3
4
  import { CommunicationListInstance, CommunicationContext } from "./v2/communication";
4
5
  import { ConfigurationListInstance } from "./v2/configuration";
5
6
  import { ConversationListInstance } from "./v2/conversation";
@@ -18,6 +19,8 @@ export default class V2 extends Version {
18
19
  protected _conversations?: ConversationListInstance;
19
20
  /** operations - { Twilio.Conversations.V2.OperationListInstance } resource */
20
21
  protected _operations?: OperationListInstance;
22
+ /** Accessor for actions resource */
23
+ actions(ConversationId: string): ActionListInstance;
21
24
  /** Accessor for communications resource - list operations */
22
25
  communications(ConversationSid: string): CommunicationListInstance;
23
26
  /** Accessor for communications resource - instance operations */
@@ -17,6 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const Version_1 = __importDefault(require("../../base/Version"));
20
+ const action_1 = require("./v2/action");
20
21
  const communication_1 = require("./v2/communication");
21
22
  const configuration_1 = require("./v2/configuration");
22
23
  const conversation_1 = require("./v2/conversation");
@@ -31,6 +32,10 @@ class V2 extends Version_1.default {
31
32
  constructor(domain) {
32
33
  super(domain, "v2");
33
34
  }
35
+ /** Accessor for actions resource */
36
+ actions(ConversationId) {
37
+ return (0, action_1.ActionListInstance)(this, ConversationId);
38
+ }
34
39
  /** Implementation */
35
40
  communications(ConversationSid, sid) {
36
41
  const listInstance = (0, communication_1.CommunicationListInstance)(this, ConversationSid);
@@ -0,0 +1,241 @@
1
+ import { inspect, InspectOptions } from "util";
2
+ import V2 from "../V2";
3
+ import { ApiResponse } from "../../../base/ApiResponse";
4
+ /**
5
+ * Content for a SEND_MESSAGE action.
6
+ */
7
+ export declare class ConversationsV2SendMessageContent {
8
+ /**
9
+ * Plain text message body.
10
+ */
11
+ "text"?: string;
12
+ /**
13
+ * Content template ID (HX... format). When provided, the template is rendered with the variables map and sent to the recipient.
14
+ */
15
+ "contentId"?: string;
16
+ /**
17
+ * Variables to substitute into the content template.
18
+ */
19
+ "variables"?: {
20
+ [key: string]: string;
21
+ };
22
+ /**
23
+ * URLs of media attachments to include with the message.
24
+ */
25
+ "mediaUrls"?: Array<string>;
26
+ constructor(payload: any);
27
+ }
28
+ /**
29
+ * Identifies a participant for an Action. Supports three resolution modes: 1. participantId + channel: Resolves address from participant\'s registered addresses 2. participantId only: Resolves when participant has exactly one address 3. address + channel: Uses explicit address
30
+ */
31
+ export declare class ConversationsV2SendMessageParticipant {
32
+ /**
33
+ * Participant ID to resolve address from.
34
+ */
35
+ "participantId"?: string;
36
+ /**
37
+ * Explicit address formatted according to channel type.
38
+ */
39
+ "address"?: string;
40
+ /**
41
+ * Channel type for address resolution.
42
+ */
43
+ "channel"?: string;
44
+ constructor(payload: any);
45
+ }
46
+ export declare class ConversationsV2SendMessagePayload {
47
+ "from": ConversationsV2SendMessageParticipant;
48
+ /**
49
+ * The recipients of this action.
50
+ */
51
+ "to": Array<ConversationsV2SendMessageParticipant>;
52
+ "content": ConversationsV2SendMessageContent;
53
+ /**
54
+ * Channel-specific parameters forwarded as-is to the downstream sending service. Allows passing backend-specific fields without requiring API changes.
55
+ */
56
+ "channelSettings"?: {
57
+ [key: string]: any;
58
+ };
59
+ constructor(payload: any);
60
+ }
61
+ export declare class CreateConversationActionRequest {
62
+ /**
63
+ * Action type discriminator. Accepted values: SEND_MESSAGE.
64
+ */
65
+ "type": string;
66
+ "payload": ConversationsV2SendMessagePayload;
67
+ constructor(payload: any);
68
+ }
69
+ /**
70
+ * Options to pass to create a ActionInstance
71
+ */
72
+ export interface ActionListInstanceCreateOptions {
73
+ /** The action to perform. */
74
+ createConversationActionRequest: CreateConversationActionRequest;
75
+ }
76
+ export interface ActionContext {
77
+ /**
78
+ * Fetch a ActionInstance
79
+ *
80
+ * @param callback - Callback to handle processed record
81
+ *
82
+ * @returns Resolves to processed ActionInstance
83
+ */
84
+ fetch(callback?: (error: Error | null, item?: ActionInstance) => any): Promise<ActionInstance>;
85
+ /**
86
+ * Fetch a ActionInstance and return HTTP info
87
+ *
88
+ * @param callback - Callback to handle processed record
89
+ *
90
+ * @returns Resolves to processed ActionInstance with HTTP metadata
91
+ */
92
+ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ActionInstance>) => any): Promise<ApiResponse<ActionInstance>>;
93
+ /**
94
+ * Provide a user-friendly representation
95
+ */
96
+ toJSON(): any;
97
+ [inspect.custom](_depth: any, options: InspectOptions): any;
98
+ }
99
+ export interface ActionContextSolution {
100
+ conversationId: string;
101
+ actionId: string;
102
+ }
103
+ export declare class ActionContextImpl implements ActionContext {
104
+ protected _version: V2;
105
+ protected _solution: ActionContextSolution;
106
+ protected _uri: string;
107
+ constructor(_version: V2, conversationId: string, actionId: string);
108
+ fetch(callback?: (error: Error | null, item?: ActionInstance) => any): Promise<ActionInstance>;
109
+ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ActionInstance>) => any): Promise<ApiResponse<ActionInstance>>;
110
+ /**
111
+ * Provide a user-friendly representation
112
+ *
113
+ * @returns Object
114
+ */
115
+ toJSON(): ActionContextSolution;
116
+ [inspect.custom](_depth: any, options: InspectOptions): string;
117
+ }
118
+ interface ActionResource {
119
+ id: string;
120
+ type: string;
121
+ status: string;
122
+ conversationId: string;
123
+ related: {
124
+ [key: string]: string;
125
+ };
126
+ createdAt: Date;
127
+ updatedAt: Date;
128
+ completedAt: Date;
129
+ }
130
+ export declare class ActionInstance {
131
+ protected _version: V2;
132
+ protected _solution: ActionContextSolution;
133
+ protected _context?: ActionContext;
134
+ constructor(_version: V2, _payload: ActionResource, conversationId: string, actionId?: string);
135
+ /**
136
+ * Unique identifier for this Action.
137
+ */
138
+ id: string;
139
+ /**
140
+ * The type of action. Accepted values: SEND_MESSAGE.
141
+ */
142
+ type: string;
143
+ /**
144
+ * Current status of the Action. - PENDING: Action accepted, awaiting downstream confirmation - COMPLETED: Downstream backend confirmed the action - FAILED: Downstream backend reported a failure
145
+ */
146
+ status: string;
147
+ /**
148
+ * The conversation this action belongs to.
149
+ */
150
+ conversationId: string;
151
+ /**
152
+ * Named identifiers from downstream. For SEND_MESSAGE: - messageSid: The downstream message SID (present when PENDING or COMPLETED) - communicationId: The Communication ID (present when COMPLETED)
153
+ */
154
+ related: {
155
+ [key: string]: string;
156
+ };
157
+ /**
158
+ * Timestamp when the action was created.
159
+ */
160
+ createdAt: Date;
161
+ /**
162
+ * Timestamp when the action was last updated.
163
+ */
164
+ updatedAt: Date;
165
+ /**
166
+ * Timestamp when the action reached a terminal status.
167
+ */
168
+ completedAt: Date;
169
+ private get _proxy();
170
+ /**
171
+ * Fetch a ActionInstance
172
+ *
173
+ * @param callback - Callback to handle processed record
174
+ *
175
+ * @returns Resolves to processed ActionInstance
176
+ */
177
+ fetch(callback?: (error: Error | null, item?: ActionInstance) => any): Promise<ActionInstance>;
178
+ /**
179
+ * Fetch a ActionInstance and return HTTP info
180
+ *
181
+ * @param callback - Callback to handle processed record
182
+ *
183
+ * @returns Resolves to processed ActionInstance with HTTP metadata
184
+ */
185
+ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ActionInstance>) => any): Promise<ApiResponse<ActionInstance>>;
186
+ /**
187
+ * Provide a user-friendly representation
188
+ *
189
+ * @returns Object
190
+ */
191
+ toJSON(): {
192
+ id: string;
193
+ type: string;
194
+ status: string;
195
+ conversationId: string;
196
+ related: {
197
+ [key: string]: string;
198
+ };
199
+ createdAt: Date;
200
+ updatedAt: Date;
201
+ completedAt: Date;
202
+ };
203
+ [inspect.custom](_depth: any, options: InspectOptions): string;
204
+ }
205
+ export interface ActionSolution {
206
+ conversationId: string;
207
+ }
208
+ export interface ActionListInstance {
209
+ _version: V2;
210
+ _solution: ActionSolution;
211
+ _uri: string;
212
+ (actionId: string): ActionContext;
213
+ get(actionId: string): ActionContext;
214
+ /**
215
+ * Create a ActionInstance
216
+ *
217
+ * @param params - Body for request
218
+ * @param headers - header params for request
219
+ * @param callback - Callback to handle processed record
220
+ *
221
+ * @returns Resolves to processed ActionInstance
222
+ */
223
+ create(params: CreateConversationActionRequest, headers?: any, callback?: (error: Error | null, item?: ActionInstance) => any): Promise<ActionInstance>;
224
+ /**
225
+ * Create a ActionInstance and return HTTP info
226
+ *
227
+ * @param params - Body for request
228
+ * @param headers - header params for request
229
+ * @param callback - Callback to handle processed record
230
+ *
231
+ * @returns Resolves to processed ActionInstance with HTTP metadata
232
+ */
233
+ createWithHttpInfo(params: CreateConversationActionRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ActionInstance>) => any): Promise<ApiResponse<ActionInstance>>;
234
+ /**
235
+ * Provide a user-friendly representation
236
+ */
237
+ toJSON(): any;
238
+ [inspect.custom](_depth: any, options: InspectOptions): any;
239
+ }
240
+ export declare function ActionListInstance(version: V2, conversationId: string): ActionListInstance;
241
+ export {};
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Conversation Orchestrator
9
+ * Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications.
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.ActionInstance = exports.ActionContextImpl = exports.CreateConversationActionRequest = exports.ConversationsV2SendMessagePayload = exports.ConversationsV2SendMessageParticipant = exports.ConversationsV2SendMessageContent = void 0;
17
+ exports.ActionListInstance = ActionListInstance;
18
+ const util_1 = require("util");
19
+ const deserialize = require("../../../base/deserialize");
20
+ const serialize = require("../../../base/serialize");
21
+ const utility_1 = require("../../../base/utility");
22
+ /**
23
+ * Content for a SEND_MESSAGE action.
24
+ */
25
+ class ConversationsV2SendMessageContent {
26
+ constructor(payload) {
27
+ this.text = payload["text"];
28
+ this.contentId = payload["contentId"];
29
+ this.variables = payload["variables"];
30
+ this.mediaUrls = payload["mediaUrls"];
31
+ }
32
+ }
33
+ exports.ConversationsV2SendMessageContent = ConversationsV2SendMessageContent;
34
+ /**
35
+ * Identifies a participant for an Action. Supports three resolution modes: 1. participantId + channel: Resolves address from participant\'s registered addresses 2. participantId only: Resolves when participant has exactly one address 3. address + channel: Uses explicit address
36
+ */
37
+ class ConversationsV2SendMessageParticipant {
38
+ constructor(payload) {
39
+ this.participantId = payload["participantId"];
40
+ this.address = payload["address"];
41
+ this.channel = payload["channel"];
42
+ }
43
+ }
44
+ exports.ConversationsV2SendMessageParticipant = ConversationsV2SendMessageParticipant;
45
+ class ConversationsV2SendMessagePayload {
46
+ constructor(payload) {
47
+ this.from = payload["from"];
48
+ this.to = payload["to"];
49
+ this.content = payload["content"];
50
+ this.channelSettings = payload["channelSettings"];
51
+ }
52
+ }
53
+ exports.ConversationsV2SendMessagePayload = ConversationsV2SendMessagePayload;
54
+ class CreateConversationActionRequest {
55
+ constructor(payload) {
56
+ this.type = payload["type"];
57
+ this.payload = payload["payload"];
58
+ }
59
+ }
60
+ exports.CreateConversationActionRequest = CreateConversationActionRequest;
61
+ class ActionContextImpl {
62
+ constructor(_version, conversationId, actionId) {
63
+ this._version = _version;
64
+ if (!(0, utility_1.isValidPathParam)(conversationId)) {
65
+ throw new Error("Parameter 'conversationId' is not valid.");
66
+ }
67
+ if (!(0, utility_1.isValidPathParam)(actionId)) {
68
+ throw new Error("Parameter 'actionId' is not valid.");
69
+ }
70
+ this._solution = { conversationId, actionId };
71
+ this._uri = `/Conversations/${conversationId}/Actions/${actionId}`;
72
+ }
73
+ fetch(callback) {
74
+ const headers = {};
75
+ headers["Accept"] = "application/json";
76
+ const instance = this;
77
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
78
+ uri: instance._uri,
79
+ method: "get",
80
+ headers,
81
+ });
82
+ operationPromise = operationPromise.then((payload) => new ActionInstance(operationVersion, payload, instance._solution.conversationId, instance._solution.actionId));
83
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
84
+ return operationPromise;
85
+ }
86
+ fetchWithHttpInfo(callback) {
87
+ const headers = {};
88
+ headers["Accept"] = "application/json";
89
+ const instance = this;
90
+ let operationVersion = instance._version;
91
+ // CREATE, FETCH, UPDATE operations
92
+ let operationPromise = operationVersion
93
+ .fetchWithResponseInfo({
94
+ uri: instance._uri,
95
+ method: "get",
96
+ headers,
97
+ })
98
+ .then((response) => ({
99
+ ...response,
100
+ body: new ActionInstance(operationVersion, response.body, instance._solution.conversationId, instance._solution.actionId),
101
+ }));
102
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
103
+ return operationPromise;
104
+ }
105
+ /**
106
+ * Provide a user-friendly representation
107
+ *
108
+ * @returns Object
109
+ */
110
+ toJSON() {
111
+ return this._solution;
112
+ }
113
+ [util_1.inspect.custom](_depth, options) {
114
+ return (0, util_1.inspect)(this.toJSON(), options);
115
+ }
116
+ }
117
+ exports.ActionContextImpl = ActionContextImpl;
118
+ class ActionInstance {
119
+ constructor(_version, _payload, conversationId, actionId) {
120
+ this._version = _version;
121
+ const payload = _payload;
122
+ this.id = payload.id;
123
+ this.type = payload.type;
124
+ this.status = payload.status;
125
+ this.conversationId = payload.conversationId;
126
+ this.related = payload.related;
127
+ this.createdAt = deserialize.iso8601DateTime(payload.createdAt);
128
+ this.updatedAt = deserialize.iso8601DateTime(payload.updatedAt);
129
+ this.completedAt = deserialize.iso8601DateTime(payload.completedAt);
130
+ this._solution = { conversationId, actionId: actionId };
131
+ }
132
+ get _proxy() {
133
+ this._context =
134
+ this._context ||
135
+ new ActionContextImpl(this._version, this._solution.conversationId, this._solution.actionId);
136
+ return this._context;
137
+ }
138
+ /**
139
+ * Fetch a ActionInstance
140
+ *
141
+ * @param callback - Callback to handle processed record
142
+ *
143
+ * @returns Resolves to processed ActionInstance
144
+ */
145
+ fetch(callback) {
146
+ return this._proxy.fetch(callback);
147
+ }
148
+ /**
149
+ * Fetch a ActionInstance and return HTTP info
150
+ *
151
+ * @param callback - Callback to handle processed record
152
+ *
153
+ * @returns Resolves to processed ActionInstance with HTTP metadata
154
+ */
155
+ fetchWithHttpInfo(callback) {
156
+ return this._proxy.fetchWithHttpInfo(callback);
157
+ }
158
+ /**
159
+ * Provide a user-friendly representation
160
+ *
161
+ * @returns Object
162
+ */
163
+ toJSON() {
164
+ return {
165
+ id: this.id,
166
+ type: this.type,
167
+ status: this.status,
168
+ conversationId: this.conversationId,
169
+ related: this.related,
170
+ createdAt: this.createdAt,
171
+ updatedAt: this.updatedAt,
172
+ completedAt: this.completedAt,
173
+ };
174
+ }
175
+ [util_1.inspect.custom](_depth, options) {
176
+ return (0, util_1.inspect)(this.toJSON(), options);
177
+ }
178
+ }
179
+ exports.ActionInstance = ActionInstance;
180
+ function ActionListInstance(version, conversationId) {
181
+ if (!(0, utility_1.isValidPathParam)(conversationId)) {
182
+ throw new Error("Parameter 'conversationId' is not valid.");
183
+ }
184
+ const instance = ((actionId) => instance.get(actionId));
185
+ instance.get = function get(actionId) {
186
+ return new ActionContextImpl(version, conversationId, actionId);
187
+ };
188
+ instance._version = version;
189
+ instance._solution = { conversationId };
190
+ instance._uri = `/Conversations/${conversationId}/Actions`;
191
+ instance.create = function create(params, headers, callback) {
192
+ if (params === null || params === undefined) {
193
+ throw new Error('Required parameter "params" missing.');
194
+ }
195
+ let data = {};
196
+ data = params;
197
+ if (headers === null || headers === undefined) {
198
+ headers = {};
199
+ }
200
+ headers["Content-Type"] = "application/json";
201
+ headers["Accept"] = "application/json";
202
+ let operationVersion = version, operationPromise = operationVersion.create({
203
+ uri: instance._uri,
204
+ method: "post",
205
+ data,
206
+ headers,
207
+ });
208
+ operationPromise = operationPromise.then((payload) => new ActionInstance(operationVersion, payload, instance._solution.conversationId));
209
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
210
+ return operationPromise;
211
+ };
212
+ instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
213
+ if (params === null || params === undefined) {
214
+ throw new Error('Required parameter "params" missing.');
215
+ }
216
+ let data = {};
217
+ data = params;
218
+ if (headers === null || headers === undefined) {
219
+ headers = {};
220
+ }
221
+ headers["Content-Type"] = "application/json";
222
+ headers["Accept"] = "application/json";
223
+ let operationVersion = version;
224
+ // CREATE, FETCH, UPDATE operations
225
+ let operationPromise = operationVersion
226
+ .createWithResponseInfo({
227
+ uri: instance._uri,
228
+ method: "post",
229
+ data,
230
+ headers,
231
+ })
232
+ .then((response) => ({
233
+ ...response,
234
+ body: new ActionInstance(operationVersion, response.body, instance._solution.conversationId),
235
+ }));
236
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
237
+ return operationPromise;
238
+ };
239
+ instance.toJSON = function toJSON() {
240
+ return instance._solution;
241
+ };
242
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
243
+ return (0, util_1.inspect)(instance.toJSON(), options);
244
+ };
245
+ return instance;
246
+ }
@@ -38,6 +38,13 @@ export declare class ProfilesMeta {
38
38
  "previousToken"?: string;
39
39
  constructor(payload: any);
40
40
  }
41
+ /**
42
+ * Options to pass to fetch a ProfileInstance
43
+ */
44
+ export interface ProfileContextFetchOptions {
45
+ /** Comma separated list of trait group names to include. */
46
+ traitGroups?: string;
47
+ }
41
48
  /**
42
49
  * Options to pass to patch a ProfileInstance
43
50
  */
@@ -110,6 +117,40 @@ export interface ProfileContext {
110
117
  * @returns Resolves to processed ProfileInstance with HTTP metadata
111
118
  */
112
119
  removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
120
+ /**
121
+ * Fetch a ProfileInstance
122
+ *
123
+ * @param callback - Callback to handle processed record
124
+ *
125
+ * @returns Resolves to processed ProfileInstance
126
+ */
127
+ fetch(callback?: (error: Error | null, item?: ProfileInstance) => any): Promise<ProfileInstance>;
128
+ /**
129
+ * Fetch a ProfileInstance
130
+ *
131
+ * @param params - Parameter for request
132
+ * @param callback - Callback to handle processed record
133
+ *
134
+ * @returns Resolves to processed ProfileInstance
135
+ */
136
+ fetch(params: ProfileContextFetchOptions, callback?: (error: Error | null, item?: ProfileInstance) => any): Promise<ProfileInstance>;
137
+ /**
138
+ * Fetch a ProfileInstance and return HTTP info
139
+ *
140
+ * @param callback - Callback to handle processed record
141
+ *
142
+ * @returns Resolves to processed ProfileInstance with HTTP metadata
143
+ */
144
+ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
145
+ /**
146
+ * Fetch a ProfileInstance and return HTTP info
147
+ *
148
+ * @param params - Parameter for request
149
+ * @param callback - Callback to handle processed record
150
+ *
151
+ * @returns Resolves to processed ProfileInstance with HTTP metadata
152
+ */
153
+ fetchWithHttpInfo(params: ProfileContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
113
154
  /**
114
155
  * Patch a ProfileInstance
115
156
  *
@@ -147,6 +188,8 @@ export declare class ProfileContextImpl implements ProfileContext {
147
188
  constructor(_version: V1, storeId: string, profileId: string);
148
189
  remove(callback?: (error: Error | null, item?: ProfileInstance) => any): Promise<ProfileInstance>;
149
190
  removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
191
+ fetch(params?: ProfileContextFetchOptions | ((error: Error | null, item?: ProfileInstance) => any), callback?: (error: Error | null, item?: ProfileInstance) => any): Promise<ProfileInstance>;
192
+ fetchWithHttpInfo(params?: ProfileContextFetchOptions | ((error: Error | null, item?: ApiResponse<ProfileInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
150
193
  patch(params: ProfilePatch, headers?: any, callback?: (error: Error | null, item?: ProfileInstance) => any): Promise<ProfileInstance>;
151
194
  patchWithHttpInfo(params: ProfilePatch, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
152
195
  /**
@@ -215,10 +258,22 @@ interface ListProfiles200Response_ResponseResource {
215
258
  profiles?: Array<string>;
216
259
  meta?: ProfilesMeta;
217
260
  }
261
+ /**
262
+ * Response model for Profile operations
263
+ */
264
+ interface Profile_ResponseResource {
265
+ id?: string;
266
+ createdAt?: Date;
267
+ traits?: {
268
+ [key: string]: {
269
+ [key: string]: any;
270
+ };
271
+ };
272
+ }
218
273
  /**
219
274
  * Union type for all possible response models
220
275
  */
221
- type ProfileResource = CreateProfile202Response_ResponseResource | DeleteProfile202Response_ResponseResource | PatchProfileTraits202Response_ResponseResource | ListProfiles200Response_ResponseResource;
276
+ type ProfileResource = CreateProfile202Response_ResponseResource | DeleteProfile202Response_ResponseResource | PatchProfileTraits202Response_ResponseResource | ListProfiles200Response_ResponseResource | Profile_ResponseResource;
222
277
  export declare class ProfileInstance {
223
278
  protected _version: V1;
224
279
  protected _solution: ProfileContextSolution;
@@ -231,6 +286,18 @@ export declare class ProfileInstance {
231
286
  message?: string;
232
287
  profiles?: Array<string>;
233
288
  meta?: ProfilesMeta;
289
+ /**
290
+ * The time the profile was created.
291
+ */
292
+ createdAt?: Date;
293
+ /**
294
+ * Multiple trait groups.
295
+ */
296
+ traits?: {
297
+ [key: string]: {
298
+ [key: string]: any;
299
+ };
300
+ };
234
301
  private get _proxy();
235
302
  /**
236
303
  * Remove a ProfileInstance
@@ -248,6 +315,40 @@ export declare class ProfileInstance {
248
315
  * @returns Resolves to processed ProfileInstance with HTTP metadata
249
316
  */
250
317
  removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
318
+ /**
319
+ * Fetch a ProfileInstance
320
+ *
321
+ * @param callback - Callback to handle processed record
322
+ *
323
+ * @returns Resolves to processed ProfileInstance
324
+ */
325
+ fetch(callback?: (error: Error | null, item?: ProfileInstance) => any): Promise<ProfileInstance>;
326
+ /**
327
+ * Fetch a ProfileInstance
328
+ *
329
+ * @param params - Parameter for request
330
+ * @param callback - Callback to handle processed record
331
+ *
332
+ * @returns Resolves to processed ProfileInstance
333
+ */
334
+ fetch(params: ProfileContextFetchOptions, callback?: (error: Error | null, item?: ProfileInstance) => any): Promise<ProfileInstance>;
335
+ /**
336
+ * Fetch a ProfileInstance and return HTTP info
337
+ *
338
+ * @param callback - Callback to handle processed record
339
+ *
340
+ * @returns Resolves to processed ProfileInstance with HTTP metadata
341
+ */
342
+ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
343
+ /**
344
+ * Fetch a ProfileInstance and return HTTP info
345
+ *
346
+ * @param params - Parameter for request
347
+ * @param callback - Callback to handle processed record
348
+ *
349
+ * @returns Resolves to processed ProfileInstance with HTTP metadata
350
+ */
351
+ fetchWithHttpInfo(params: ProfileContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<ProfileInstance>) => any): Promise<ApiResponse<ProfileInstance>>;
251
352
  /**
252
353
  * Patch a ProfileInstance
253
354
  *
@@ -278,6 +379,12 @@ export declare class ProfileInstance {
278
379
  message: string;
279
380
  profiles: string[];
280
381
  meta: ProfilesMeta;
382
+ createdAt: Date;
383
+ traits: {
384
+ [key: string]: {
385
+ [key: string]: any;
386
+ };
387
+ };
281
388
  };
282
389
  [inspect.custom](_depth: any, options: InspectOptions): string;
283
390
  }
@@ -91,6 +91,60 @@ class ProfileContextImpl {
91
91
  operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
92
92
  return operationPromise;
93
93
  }
94
+ fetch(params, callback) {
95
+ if (params instanceof Function) {
96
+ callback = params;
97
+ params = {};
98
+ }
99
+ else {
100
+ params = params || {};
101
+ }
102
+ let data = {};
103
+ if (params["traitGroups"] !== undefined)
104
+ data["traitGroups"] = params["traitGroups"];
105
+ const headers = {};
106
+ headers["Accept"] = "application/json";
107
+ const instance = this;
108
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
109
+ uri: instance._uri,
110
+ method: "get",
111
+ params: data,
112
+ headers,
113
+ });
114
+ operationPromise = operationPromise.then((payload) => new ProfileInstance(operationVersion, payload, instance._solution.storeId, instance._solution.profileId));
115
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
116
+ return operationPromise;
117
+ }
118
+ fetchWithHttpInfo(params, callback) {
119
+ if (params instanceof Function) {
120
+ callback = params;
121
+ params = {};
122
+ }
123
+ else {
124
+ params = params || {};
125
+ }
126
+ let data = {};
127
+ if (params["traitGroups"] !== undefined)
128
+ data["traitGroups"] = params["traitGroups"];
129
+ const headers = {};
130
+ headers["Accept"] = "application/json";
131
+ const instance = this;
132
+ let operationVersion = instance._version;
133
+ // CREATE, FETCH, UPDATE operations
134
+ let operationPromise = operationVersion
135
+ .fetchWithResponseInfo({
136
+ uri: instance._uri,
137
+ method: "get",
138
+ params: data,
139
+ headers,
140
+ })
141
+ .then((response) => ({
142
+ ...response,
143
+ body: new ProfileInstance(operationVersion, response.body, instance._solution.storeId, instance._solution.profileId),
144
+ }));
145
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
146
+ return operationPromise;
147
+ }
94
148
  patch(params, headers, callback) {
95
149
  if (params === null || params === undefined) {
96
150
  throw new Error('Required parameter "params" missing.');
@@ -165,6 +219,8 @@ class ProfileInstance {
165
219
  payload.meta !== null && payload.meta !== undefined
166
220
  ? new ProfilesMeta(payload.meta)
167
221
  : null;
222
+ this.createdAt = deserialize.iso8601DateTime(payload.createdAt);
223
+ this.traits = payload.traits;
168
224
  this._solution = { storeId, profileId: profileId };
169
225
  }
170
226
  get _proxy() {
@@ -193,6 +249,12 @@ class ProfileInstance {
193
249
  removeWithHttpInfo(callback) {
194
250
  return this._proxy.removeWithHttpInfo(callback);
195
251
  }
252
+ fetch(params, callback) {
253
+ return this._proxy.fetch(params, callback);
254
+ }
255
+ fetchWithHttpInfo(params, callback) {
256
+ return this._proxy.fetchWithHttpInfo(params, callback);
257
+ }
196
258
  patch(params, callback) {
197
259
  return this._proxy.patch(params, callback);
198
260
  }
@@ -210,6 +272,8 @@ class ProfileInstance {
210
272
  message: this.message,
211
273
  profiles: this.profiles,
212
274
  meta: this.meta,
275
+ createdAt: this.createdAt,
276
+ traits: this.traits,
213
277
  };
214
278
  }
215
279
  [util_1.inspect.custom](_depth, options) {
@@ -93,6 +93,22 @@ export interface StoreListInstancePageOptions {
93
93
  orderBy?: "ASC" | "DESC";
94
94
  }
95
95
  export interface StoreContext {
96
+ /**
97
+ * Remove a StoreInstance
98
+ *
99
+ * @param callback - Callback to handle processed record
100
+ *
101
+ * @returns Resolves to processed StoreInstance
102
+ */
103
+ remove(callback?: (error: Error | null, item?: StoreInstance) => any): Promise<StoreInstance>;
104
+ /**
105
+ * Remove a StoreInstance and return HTTP info
106
+ *
107
+ * @param callback - Callback to handle processed record
108
+ *
109
+ * @returns Resolves to processed StoreInstance with HTTP metadata
110
+ */
111
+ removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StoreInstance>) => any): Promise<ApiResponse<StoreInstance>>;
96
112
  /**
97
113
  * Fetch a StoreInstance
98
114
  *
@@ -159,6 +175,8 @@ export declare class StoreContextImpl implements StoreContext {
159
175
  protected _solution: StoreContextSolution;
160
176
  protected _uri: string;
161
177
  constructor(_version: V1, storeId: string);
178
+ remove(callback?: (error: Error | null, item?: StoreInstance) => any): Promise<StoreInstance>;
179
+ removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StoreInstance>) => any): Promise<ApiResponse<StoreInstance>>;
162
180
  fetch(callback?: (error: Error | null, item?: StoreInstance) => any): Promise<StoreInstance>;
163
181
  fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StoreInstance>) => any): Promise<ApiResponse<StoreInstance>>;
164
182
  patch(params?: PatchStoreRequest | ((error: Error | null, item?: StoreInstance) => any), headers?: any, callback?: (error: Error | null, item?: StoreInstance) => any): Promise<StoreInstance>;
@@ -218,6 +236,13 @@ interface ServiceList_ResponseResource {
218
236
  stores?: Array<string>;
219
237
  meta?: Meta;
220
238
  }
239
+ /**
240
+ * Response model for DeleteStore202Response operations
241
+ */
242
+ interface DeleteStore202Response_ResponseResource {
243
+ message?: string;
244
+ statusUrl?: string;
245
+ }
221
246
  /**
222
247
  * Response model for Store operations
223
248
  */
@@ -232,7 +257,7 @@ interface Store_ResponseResource {
232
257
  /**
233
258
  * Union type for all possible response models
234
259
  */
235
- type StoreResource = PatchStore202Response_ResponseResource | CreateStore202Response_ResponseResource | ServiceList_ResponseResource | Store_ResponseResource;
260
+ type StoreResource = PatchStore202Response_ResponseResource | CreateStore202Response_ResponseResource | ServiceList_ResponseResource | DeleteStore202Response_ResponseResource | Store_ResponseResource;
236
261
  export declare class StoreInstance {
237
262
  protected _version: V1;
238
263
  protected _solution: StoreContextSolution;
@@ -273,6 +298,22 @@ export declare class StoreInstance {
273
298
  */
274
299
  version?: number;
275
300
  private get _proxy();
301
+ /**
302
+ * Remove a StoreInstance
303
+ *
304
+ * @param callback - Callback to handle processed record
305
+ *
306
+ * @returns Resolves to processed StoreInstance
307
+ */
308
+ remove(callback?: (error: Error | null, item?: StoreInstance) => any): Promise<StoreInstance>;
309
+ /**
310
+ * Remove a StoreInstance and return HTTP info
311
+ *
312
+ * @param callback - Callback to handle processed record
313
+ *
314
+ * @returns Resolves to processed StoreInstance with HTTP metadata
315
+ */
316
+ removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StoreInstance>) => any): Promise<ApiResponse<StoreInstance>>;
276
317
  /**
277
318
  * Fetch a StoreInstance
278
319
  *
@@ -55,6 +55,38 @@ class StoreContextImpl {
55
55
  this._solution = { storeId };
56
56
  this._uri = `/ControlPlane/Stores/${storeId}`;
57
57
  }
58
+ remove(callback) {
59
+ const headers = {};
60
+ headers["Accept"] = "application/json";
61
+ const instance = this;
62
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
63
+ uri: instance._uri,
64
+ method: "delete",
65
+ headers,
66
+ });
67
+ operationPromise = operationPromise.then((payload) => new StoreInstance(operationVersion, payload, instance._solution.storeId));
68
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
69
+ return operationPromise;
70
+ }
71
+ removeWithHttpInfo(callback) {
72
+ const headers = {};
73
+ headers["Accept"] = "application/json";
74
+ const instance = this;
75
+ let operationVersion = instance._version;
76
+ // DELETE operation that returns a response model
77
+ let operationPromise = operationVersion
78
+ .fetchWithResponseInfo({
79
+ uri: instance._uri,
80
+ method: "delete",
81
+ headers,
82
+ })
83
+ .then((response) => ({
84
+ ...response,
85
+ body: new StoreInstance(operationVersion, response.body, instance._solution.storeId),
86
+ }));
87
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
88
+ return operationPromise;
89
+ }
58
90
  fetch(callback) {
59
91
  const headers = {};
60
92
  headers["Accept"] = "application/json";
@@ -185,6 +217,26 @@ class StoreInstance {
185
217
  new StoreContextImpl(this._version, this._solution.storeId);
186
218
  return this._context;
187
219
  }
220
+ /**
221
+ * Remove a StoreInstance
222
+ *
223
+ * @param callback - Callback to handle processed record
224
+ *
225
+ * @returns Resolves to processed StoreInstance
226
+ */
227
+ remove(callback) {
228
+ return this._proxy.remove(callback);
229
+ }
230
+ /**
231
+ * Remove a StoreInstance and return HTTP info
232
+ *
233
+ * @param callback - Callback to handle processed record
234
+ *
235
+ * @returns Resolves to processed StoreInstance with HTTP metadata
236
+ */
237
+ removeWithHttpInfo(callback) {
238
+ return this._proxy.removeWithHttpInfo(callback);
239
+ }
188
240
  /**
189
241
  * Fetch a StoreInstance
190
242
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "twilio",
3
3
  "description": "A Twilio helper library",
4
- "version": "6.0.1",
4
+ "version": "6.0.2",
5
5
  "author": "API Team <api@twilio.com>",
6
6
  "contributors": [
7
7
  {