@voltade/envoy-sdk 1.4.3 → 1.5.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.
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/resources/campaigns/index.d.ts.map +1 -1
- package/dist/resources/campaigns/index.js +3 -2
- package/dist/resources/campaigns/index.js.map +1 -1
- package/dist/resources/campaigns/types.d.ts +3 -0
- package/dist/resources/campaigns/types.d.ts.map +1 -1
- package/dist/resources/campaigns/types.js +1 -0
- package/dist/resources/campaigns/types.js.map +1 -1
- package/dist/resources/companies/index.d.ts +35 -14
- package/dist/resources/companies/index.d.ts.map +1 -1
- package/dist/resources/companies/index.js +35 -12
- package/dist/resources/companies/index.js.map +1 -1
- package/dist/resources/companies/types.d.ts +301 -82
- package/dist/resources/companies/types.d.ts.map +1 -1
- package/dist/resources/companies/types.js +36 -5
- package/dist/resources/companies/types.js.map +1 -1
- package/dist/resources/contacts/index.d.ts +211 -18
- package/dist/resources/contacts/index.d.ts.map +1 -1
- package/dist/resources/contacts/index.js +279 -14
- package/dist/resources/contacts/index.js.map +1 -1
- package/dist/resources/contacts/types.d.ts +643 -0
- package/dist/resources/contacts/types.d.ts.map +1 -1
- package/dist/resources/contacts/types.js +168 -1
- package/dist/resources/contacts/types.js.map +1 -1
- package/dist/resources/orders/index.d.ts +110 -17
- package/dist/resources/orders/index.d.ts.map +1 -1
- package/dist/resources/orders/index.js +136 -16
- package/dist/resources/orders/index.js.map +1 -1
- package/dist/resources/orders/types.d.ts +2732 -290
- package/dist/resources/orders/types.d.ts.map +1 -1
- package/dist/resources/orders/types.js +125 -19
- package/dist/resources/orders/types.js.map +1 -1
- package/dist/test/bulk-order-upsert.d.ts +6 -0
- package/dist/test/bulk-order-upsert.d.ts.map +1 -0
- package/dist/test/bulk-order-upsert.js +122 -0
- package/dist/test/bulk-order-upsert.js.map +1 -0
- package/package.json +1 -1
|
@@ -8,12 +8,14 @@ const CompanyContactSchema = z.object({
|
|
|
8
8
|
name: z.string().optional(),
|
|
9
9
|
email: z.string().optional(),
|
|
10
10
|
phone_number: z.string().optional(),
|
|
11
|
+
thumbnail: z.string().optional(),
|
|
11
12
|
});
|
|
12
13
|
// Company schema
|
|
13
14
|
export const CompanySchema = z.object({
|
|
14
15
|
id: z.number(),
|
|
15
16
|
name: z.string(),
|
|
16
17
|
account_id: z.number().optional(),
|
|
18
|
+
custom_attributes: z.record(z.unknown()).optional(),
|
|
17
19
|
created_at: z.number().optional(),
|
|
18
20
|
updated_at: z.number().optional(),
|
|
19
21
|
contacts: z.array(CompanyContactSchema).optional(),
|
|
@@ -22,12 +24,23 @@ export const CompanySchema = z.object({
|
|
|
22
24
|
export const ListCompaniesParamsSchema = z.object({
|
|
23
25
|
page: z.number().optional(),
|
|
24
26
|
per_page: z.number().optional(),
|
|
27
|
+
sort: z.string().optional(),
|
|
28
|
+
payload: z.string().optional(), // JSON encoded filter conditions
|
|
29
|
+
});
|
|
30
|
+
// List companies meta schema
|
|
31
|
+
export const ListCompaniesMetaSchema = z.object({
|
|
32
|
+
count: z.number(),
|
|
33
|
+
current_page: z.union([z.string(), z.number()]),
|
|
34
|
+
});
|
|
35
|
+
// List companies response - returns meta and payload
|
|
36
|
+
export const ListCompaniesResponseSchema = z.object({
|
|
37
|
+
meta: ListCompaniesMetaSchema,
|
|
38
|
+
payload: z.array(CompanySchema),
|
|
25
39
|
});
|
|
26
|
-
// List companies response - returns array directly
|
|
27
|
-
export const ListCompaniesResponseSchema = z.array(CompanySchema);
|
|
28
40
|
// Create company parameters schema
|
|
29
41
|
export const CreateCompanyParamsSchema = z.object({
|
|
30
42
|
name: z.string(),
|
|
43
|
+
custom_attributes: z.record(z.unknown()).optional(),
|
|
31
44
|
});
|
|
32
45
|
// Create company request schema (wraps in company object)
|
|
33
46
|
export const CreateCompanyRequestSchema = z.object({
|
|
@@ -35,11 +48,14 @@ export const CreateCompanyRequestSchema = z.object({
|
|
|
35
48
|
});
|
|
36
49
|
// Create company response - returns company directly
|
|
37
50
|
export const CreateCompanyResponseSchema = CompanySchema;
|
|
38
|
-
// Get company response - returns
|
|
39
|
-
export const GetCompanyResponseSchema =
|
|
51
|
+
// Get company response - returns payload wrapper
|
|
52
|
+
export const GetCompanyResponseSchema = z.object({
|
|
53
|
+
payload: CompanySchema,
|
|
54
|
+
});
|
|
40
55
|
// Update company parameters schema
|
|
41
56
|
export const UpdateCompanyParamsSchema = z.object({
|
|
42
|
-
name: z.string(),
|
|
57
|
+
name: z.string().optional(),
|
|
58
|
+
custom_attributes: z.record(z.unknown()).optional(),
|
|
43
59
|
});
|
|
44
60
|
// Update company request schema (wraps in company object)
|
|
45
61
|
export const UpdateCompanyRequestSchema = z.object({
|
|
@@ -63,4 +79,19 @@ export const SearchCompaniesResponseSchema = z.object({
|
|
|
63
79
|
meta: SearchCompaniesMetaSchema,
|
|
64
80
|
payload: z.array(CompanySchema),
|
|
65
81
|
});
|
|
82
|
+
// Company orders params schema
|
|
83
|
+
export const CompanyOrdersParamsSchema = z.object({
|
|
84
|
+
page: z.number().optional(),
|
|
85
|
+
per_page: z.number().optional(),
|
|
86
|
+
});
|
|
87
|
+
// Company orders meta schema
|
|
88
|
+
export const CompanyOrdersMetaSchema = z.object({
|
|
89
|
+
count: z.number(),
|
|
90
|
+
current_page: z.number(),
|
|
91
|
+
});
|
|
92
|
+
// Company orders response schema
|
|
93
|
+
export const CompanyOrdersResponseSchema = z.object({
|
|
94
|
+
meta: CompanyOrdersMetaSchema,
|
|
95
|
+
payload: z.array(z.record(z.unknown())), // Order objects
|
|
96
|
+
});
|
|
66
97
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../resources/companies/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;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IACpD,IAAI,EAAE,yBAAyB;IAC/B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CAChC,CAAC,CAAC;AAEH,+BAA+B;AAC/B,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEH,6BAA6B;AAC7B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC;AAEH,iCAAiC;AACjC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,gBAAgB;CAC1D,CAAC,CAAC"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Provides functionality for managing contacts in Envoy
|
|
4
4
|
*/
|
|
5
5
|
import { BaseResource } from "../base-resource.js";
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
6
|
+
import type { ActiveContactsParams, BulkDeleteParams, ByTagsParams, ByTagsResponse, ContactableInboxesResponse, ContactConversationsResponse, ContactCreateParams, ContactInboxCreateParams, ContactOrdersParams, ContactOrdersResponse, ContactUpdateParams, CreateContactResponse, DestroyCustomAttributesParams, ExportContactsParams, FilterAllParams, FilterAllIdsResponse, FilterAllResponse, FilterContactsParams, FilterContactsResponse, GetContactResponse, ListContactsParams, ListContactsResponse, SearchContactsParams, UpdateContactResponse } from "./types.js";
|
|
7
|
+
import type { ContactInbox } from "../conversations/types.js";
|
|
8
8
|
/**
|
|
9
9
|
* Contacts resource class for managing contact-related operations
|
|
10
10
|
*/
|
|
@@ -12,49 +12,50 @@ export declare class Contacts extends BaseResource {
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a new contact
|
|
14
14
|
* @param params - Contact creation parameters (inbox_id is required)
|
|
15
|
-
* @returns The created contact
|
|
15
|
+
* @returns The created contact wrapped in payload
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```typescript
|
|
19
|
-
* const
|
|
19
|
+
* const response = await client.contacts.create({
|
|
20
20
|
* inbox_id: 1,
|
|
21
21
|
* name: 'John Doe',
|
|
22
22
|
* email: 'john@example.com',
|
|
23
23
|
* phone_number: '+1234567890',
|
|
24
24
|
* custom_attributes: { plan: 'enterprise' }
|
|
25
25
|
* });
|
|
26
|
-
* console.log(
|
|
26
|
+
* console.log(response.payload.id);
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
create(params: ContactCreateParams): Promise<
|
|
29
|
+
create(params: ContactCreateParams): Promise<CreateContactResponse>;
|
|
30
30
|
/**
|
|
31
31
|
* Update an existing contact
|
|
32
32
|
* @param contactId - ID of the contact to update
|
|
33
33
|
* @param params - Contact update parameters
|
|
34
|
-
* @returns The updated contact
|
|
34
|
+
* @returns The updated contact wrapped in payload
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* ```typescript
|
|
38
|
-
* const
|
|
38
|
+
* const response = await client.contacts.update(123, {
|
|
39
39
|
* name: 'Jane Doe',
|
|
40
40
|
* email: 'jane@example.com',
|
|
41
41
|
* custom_attributes: { plan: 'pro' }
|
|
42
42
|
* });
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
update(contactId: number, params: ContactUpdateParams): Promise<
|
|
45
|
+
update(contactId: number, params: ContactUpdateParams): Promise<UpdateContactResponse>;
|
|
46
46
|
/**
|
|
47
47
|
* Get a contact by ID
|
|
48
48
|
* @param contactId - ID of the contact
|
|
49
|
-
* @
|
|
49
|
+
* @param includeContactInboxes - Whether to include contact inboxes (default true)
|
|
50
|
+
* @returns The contact details wrapped in payload
|
|
50
51
|
*
|
|
51
52
|
* @example
|
|
52
53
|
* ```typescript
|
|
53
|
-
* const
|
|
54
|
-
* console.log(
|
|
54
|
+
* const response = await client.contacts.get(123);
|
|
55
|
+
* console.log(response.payload.name, response.payload.email);
|
|
55
56
|
* ```
|
|
56
57
|
*/
|
|
57
|
-
get(contactId: number): Promise<
|
|
58
|
+
get(contactId: number, includeContactInboxes?: boolean): Promise<GetContactResponse>;
|
|
58
59
|
/**
|
|
59
60
|
* Delete a contact
|
|
60
61
|
* @param contactId - ID of the contact to delete
|
|
@@ -67,18 +68,18 @@ export declare class Contacts extends BaseResource {
|
|
|
67
68
|
delete(contactId: number): Promise<void>;
|
|
68
69
|
/**
|
|
69
70
|
* List all contacts with pagination
|
|
70
|
-
* @param params - Query parameters for pagination and
|
|
71
|
+
* @param params - Query parameters for pagination, sorting, and filtering
|
|
71
72
|
* @returns Paginated list of contacts
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
74
75
|
* ```typescript
|
|
75
|
-
* const response = await client.contacts.list({ page: 1 });
|
|
76
|
+
* const response = await client.contacts.list({ page: 1, per_page: 25 });
|
|
76
77
|
* console.log(response.payload); // Array of contacts
|
|
77
78
|
* ```
|
|
78
79
|
*/
|
|
79
80
|
list(params?: ListContactsParams): Promise<ListContactsResponse>;
|
|
80
81
|
/**
|
|
81
|
-
* Search contacts by name, identifier, email, or
|
|
82
|
+
* Search contacts by name, identifier, email, phone number, or company name
|
|
82
83
|
* @param params - Search query and pagination parameters
|
|
83
84
|
* @returns Matching contacts
|
|
84
85
|
*
|
|
@@ -92,7 +93,199 @@ export declare class Contacts extends BaseResource {
|
|
|
92
93
|
* ```
|
|
93
94
|
*/
|
|
94
95
|
search(params: SearchContactsParams): Promise<ListContactsResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* Filter contacts with custom filter options
|
|
98
|
+
* @param params - Filter conditions and pagination
|
|
99
|
+
* @returns Filtered contacts
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const response = await client.contacts.filter({
|
|
104
|
+
* page: 1,
|
|
105
|
+
* payload: [
|
|
106
|
+
* { attribute_key: 'name', filter_operator: 'contains', values: ['John'], query_operator: 'AND' },
|
|
107
|
+
* { attribute_key: 'country_code', filter_operator: 'equal_to', values: ['SG'], query_operator: null }
|
|
108
|
+
* ]
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
filter(params: FilterContactsParams): Promise<FilterContactsResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* List all active (online) contacts
|
|
115
|
+
* @param params - Pagination parameters
|
|
116
|
+
* @returns Active contacts
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const response = await client.contacts.active({ page: 1 });
|
|
121
|
+
* console.log(response.payload);
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
active(params?: ActiveContactsParams): Promise<ListContactsResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Import contacts from a CSV file
|
|
127
|
+
* @param file - CSV file to import
|
|
128
|
+
* @param headerMapping - Optional JSON mapping of CSV headers to contact fields
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const file = new File([csvContent], 'contacts.csv');
|
|
133
|
+
* await client.contacts.import(file, { name: 'Name', email: 'Email' });
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
import(file: File | Blob, headerMapping?: Record<string, string>): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Export contacts to CSV (async, sent via email)
|
|
139
|
+
* @param params - Export parameters including filters and columns
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* await client.contacts.export({
|
|
144
|
+
* column_names: ['name', 'email', 'phone_number']
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export(params?: ExportContactsParams): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Get contacts by tags/labels
|
|
151
|
+
* @param params - Array of label IDs
|
|
152
|
+
* @returns Contacts matching the labels
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const response = await client.contacts.byTags({ labels: [1, 2, 3] });
|
|
157
|
+
* console.log(response.contacts);
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
byTags(params: ByTagsParams): Promise<ByTagsResponse>;
|
|
161
|
+
/**
|
|
162
|
+
* Bulk delete contacts matching filter criteria
|
|
163
|
+
* @param params - Filter conditions for deletion
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* await client.contacts.bulkDelete({
|
|
168
|
+
* payload: [{ attribute_key: 'status', filter_operator: 'equal_to', values: ['inactive'] }]
|
|
169
|
+
* });
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
bulkDelete(params?: BulkDeleteParams): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Download sample CSV for import
|
|
175
|
+
* @returns CSV content as string
|
|
176
|
+
*/
|
|
177
|
+
importSample(): Promise<string>;
|
|
178
|
+
/**
|
|
179
|
+
* Download custom attributes CSV
|
|
180
|
+
* @param attributeKey - The custom attribute key to export
|
|
181
|
+
* @returns CSV content
|
|
182
|
+
*/
|
|
183
|
+
downloadCustomAttributes(attributeKey: string): Promise<string>;
|
|
184
|
+
/**
|
|
185
|
+
* Filter all contacts without pagination (for campaigns)
|
|
186
|
+
* @param params - Filter conditions
|
|
187
|
+
* @returns All matching contacts with phone numbers
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const response = await client.contacts.filterAll({
|
|
192
|
+
* payload: [{ attribute_key: 'status', filter_operator: 'equal_to', values: ['active'] }]
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
filterAll(params?: FilterAllParams): Promise<FilterAllResponse>;
|
|
197
|
+
/**
|
|
198
|
+
* Filter all contact IDs without pagination
|
|
199
|
+
* @param params - Filter conditions
|
|
200
|
+
* @returns Array of contact IDs
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const response = await client.contacts.filterAllIds({
|
|
205
|
+
* label: 'vip'
|
|
206
|
+
* });
|
|
207
|
+
* console.log(response.payload); // [1, 2, 3, ...]
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
filterAllIds(params?: FilterAllParams): Promise<FilterAllIdsResponse>;
|
|
211
|
+
/**
|
|
212
|
+
* Get conversations for a contact
|
|
213
|
+
* @param contactId - ID of the contact
|
|
214
|
+
* @returns Conversations associated with the contact
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const response = await client.contacts.conversations(123);
|
|
219
|
+
* console.log(response.payload);
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
conversations(contactId: number): Promise<ContactConversationsResponse>;
|
|
223
|
+
/**
|
|
224
|
+
* Create a contact inbox record
|
|
225
|
+
* @param contactId - ID of the contact
|
|
226
|
+
* @param params - Inbox ID and optional source ID
|
|
227
|
+
* @returns The created contact inbox
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* const inbox = await client.contacts.createContactInbox(123, {
|
|
232
|
+
* inbox_id: 1,
|
|
233
|
+
* source_id: 'whatsapp:+1234567890'
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
createContactInbox(contactId: number, params: ContactInboxCreateParams): Promise<ContactInbox>;
|
|
238
|
+
/**
|
|
239
|
+
* Get all inboxes that can be used to contact this contact
|
|
240
|
+
* @param contactId - ID of the contact
|
|
241
|
+
* @returns Contactable inboxes
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* const response = await client.contacts.contactableInboxes(123);
|
|
246
|
+
* console.log(response.payload);
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
contactableInboxes(contactId: number): Promise<ContactableInboxesResponse>;
|
|
250
|
+
/**
|
|
251
|
+
* Remove specific custom attributes from a contact
|
|
252
|
+
* @param contactId - ID of the contact
|
|
253
|
+
* @param params - Array of custom attribute keys to remove
|
|
254
|
+
* @returns The updated contact
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* const response = await client.contacts.destroyCustomAttributes(123, {
|
|
259
|
+
* custom_attributes: ['old_field', 'deprecated_attribute']
|
|
260
|
+
* });
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
destroyCustomAttributes(contactId: number, params: DestroyCustomAttributesParams): Promise<GetContactResponse>;
|
|
264
|
+
/**
|
|
265
|
+
* Remove avatar from a contact
|
|
266
|
+
* @param contactId - ID of the contact
|
|
267
|
+
* @returns The updated contact
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* const response = await client.contacts.deleteAvatar(123);
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
deleteAvatar(contactId: number): Promise<GetContactResponse>;
|
|
275
|
+
/**
|
|
276
|
+
* List orders for a contact
|
|
277
|
+
* @param contactId - ID of the contact
|
|
278
|
+
* @param params - Pagination parameters
|
|
279
|
+
* @returns Orders associated with the contact
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```typescript
|
|
283
|
+
* const response = await client.contacts.orders(123, { page: 1 });
|
|
284
|
+
* console.log(response.payload);
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
orders(contactId: number, params?: ContactOrdersParams): Promise<ContactOrdersResponse>;
|
|
95
288
|
}
|
|
96
|
-
export type { ContactCreateParams, ContactUpdateParams, ListContactsParams, ListContactsResponse, SearchContactsParams, } from "./types.js";
|
|
97
|
-
export { ContactCreateParamsSchema, ContactUpdateParamsSchema, ListContactsParamsSchema, ListContactsResponseSchema, SearchContactsParamsSchema, } from "./types.js";
|
|
289
|
+
export type { ActiveContactsParams, BulkDeleteParams, ByTagsParams, ByTagsResponse, Contact, ContactableInboxesResponse, ContactConversationsResponse, ContactCreateParams, ContactInbox, ContactInboxCreateParams, ContactOrdersParams, ContactOrdersResponse, ContactUpdateParams, CreateContactResponse, DestroyCustomAttributesParams, ExportContactsParams, FilterAllParams, FilterAllIdsResponse, FilterAllResponse, FilterCondition, FilterContactsParams, FilterContactsResponse, FilterOperator, GetContactResponse, ListContactsParams, ListContactsResponse, QueryOperator, SearchContactsParams, UpdateContactResponse, } from "./types.js";
|
|
290
|
+
export { ActiveContactsParamsSchema, BulkDeleteParamsSchema, ByTagsParamsSchema, ByTagsResponseSchema, ContactableInboxesResponseSchema, ContactConversationsResponseSchema, ContactCreateParamsSchema, ContactInboxCreateParamsSchema, ContactInboxSchema, ContactOrdersParamsSchema, ContactOrdersResponseSchema, ContactSchema, ContactUpdateParamsSchema, CreateContactResponseSchema, DestroyCustomAttributesParamsSchema, ExportContactsParamsSchema, FilterAllIdsResponseSchema, FilterAllParamsSchema, FilterAllResponseSchema, FilterConditionSchema, FilterContactsParamsSchema, FilterContactsResponseSchema, FilterOperatorSchema, GetContactResponseSchema, ListContactsParamsSchema, ListContactsResponseSchema, QueryOperatorSchema, SearchContactsParamsSchema, UpdateContactResponseSchema, } from "./types.js";
|
|
98
291
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../resources/contacts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts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