@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
|
@@ -45,7 +45,13 @@ export const ContactUpdateParamsSchema = z.object({
|
|
|
45
45
|
// List contacts parameters schema
|
|
46
46
|
export const ListContactsParamsSchema = z.object({
|
|
47
47
|
page: z.number().int().positive().optional().default(1),
|
|
48
|
+
per_page: z.number().int().positive().optional(),
|
|
48
49
|
sort: z.string().optional().describe("Sort order for contacts"),
|
|
50
|
+
labels: z.string().optional().describe("Filter by labels (comma-separated)"),
|
|
51
|
+
include_contact_inboxes: z
|
|
52
|
+
.boolean()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("Whether to include contact inboxes in response"),
|
|
49
55
|
});
|
|
50
56
|
// List contacts response schema
|
|
51
57
|
export const ListContactsResponseSchema = z.object({
|
|
@@ -59,9 +65,170 @@ export const ListContactsResponseSchema = z.object({
|
|
|
59
65
|
});
|
|
60
66
|
// Search contacts parameters schema
|
|
61
67
|
export const SearchContactsParamsSchema = z.object({
|
|
62
|
-
q: z
|
|
68
|
+
q: z
|
|
69
|
+
.string()
|
|
70
|
+
.describe("Search query (name, identifier, email, phone, or company name)"),
|
|
63
71
|
page: z.number().int().positive().optional().default(1),
|
|
72
|
+
per_page: z.number().int().positive().optional(),
|
|
64
73
|
sort: z.string().optional().describe("Sort order for contacts"),
|
|
74
|
+
include_contact_inboxes: z
|
|
75
|
+
.boolean()
|
|
76
|
+
.optional()
|
|
77
|
+
.describe("Whether to include contact inboxes in response"),
|
|
78
|
+
});
|
|
79
|
+
// Filter operator schema
|
|
80
|
+
export const FilterOperatorSchema = z.enum([
|
|
81
|
+
"equal_to",
|
|
82
|
+
"not_equal_to",
|
|
83
|
+
"contains",
|
|
84
|
+
"does_not_contain",
|
|
85
|
+
"is_present",
|
|
86
|
+
"is_not_present",
|
|
87
|
+
"is_greater_than",
|
|
88
|
+
"is_less_than",
|
|
89
|
+
]);
|
|
90
|
+
// Query operator schema
|
|
91
|
+
export const QueryOperatorSchema = z.enum(["AND", "OR"]);
|
|
92
|
+
// Filter condition schema
|
|
93
|
+
export const FilterConditionSchema = z.object({
|
|
94
|
+
attribute_key: z.string().describe("Filter attribute name"),
|
|
95
|
+
filter_operator: FilterOperatorSchema.describe("Filter operator"),
|
|
96
|
+
values: z.array(z.string()).describe("Array of attribute values to filter"),
|
|
97
|
+
query_operator: QueryOperatorSchema.nullable()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Query operator for chaining"),
|
|
100
|
+
});
|
|
101
|
+
// Filter contacts parameters schema
|
|
102
|
+
export const FilterContactsParamsSchema = z.object({
|
|
103
|
+
page: z.number().int().positive().optional(),
|
|
104
|
+
per_page: z.number().int().positive().optional(),
|
|
105
|
+
include_contact_inboxes: z.boolean().optional(),
|
|
106
|
+
payload: z.array(FilterConditionSchema),
|
|
107
|
+
});
|
|
108
|
+
// Filter contacts response schema
|
|
109
|
+
export const FilterContactsResponseSchema = z.object({
|
|
110
|
+
payload: z.array(ContactSchema),
|
|
111
|
+
meta: z.object({
|
|
112
|
+
count: z.number(),
|
|
113
|
+
current_page: z.number(),
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
// Active contacts parameters schema
|
|
117
|
+
export const ActiveContactsParamsSchema = z.object({
|
|
118
|
+
page: z.number().int().positive().optional(),
|
|
119
|
+
per_page: z.number().int().positive().optional(),
|
|
120
|
+
});
|
|
121
|
+
// Import contacts response schema
|
|
122
|
+
export const ImportContactsResponseSchema = z.object({
|
|
123
|
+
message: z.string().optional(),
|
|
124
|
+
});
|
|
125
|
+
// Export contacts parameters schema
|
|
126
|
+
export const ExportContactsParamsSchema = z.object({
|
|
127
|
+
column_names: z
|
|
128
|
+
.array(z.string())
|
|
129
|
+
.optional()
|
|
130
|
+
.describe("Specific columns to include in export"),
|
|
131
|
+
payload: z
|
|
132
|
+
.array(z.record(z.unknown()))
|
|
133
|
+
.optional()
|
|
134
|
+
.describe("Filter conditions"),
|
|
135
|
+
label: z.string().optional().describe("Filter by label"),
|
|
136
|
+
});
|
|
137
|
+
// By tags parameters schema
|
|
138
|
+
export const ByTagsParamsSchema = z.object({
|
|
139
|
+
labels: z.array(z.number()).describe("Array of label IDs to filter by"),
|
|
140
|
+
});
|
|
141
|
+
// By tags response schema
|
|
142
|
+
export const ByTagsResponseSchema = z.object({
|
|
143
|
+
contacts: z.array(z.object({
|
|
144
|
+
id: z.number(),
|
|
145
|
+
name: z.string().optional(),
|
|
146
|
+
phone_number: z.string().optional(),
|
|
147
|
+
})),
|
|
148
|
+
});
|
|
149
|
+
// Bulk delete parameters schema
|
|
150
|
+
export const BulkDeleteParamsSchema = z.object({
|
|
151
|
+
payload: z
|
|
152
|
+
.array(z.record(z.unknown()))
|
|
153
|
+
.optional()
|
|
154
|
+
.describe("Filter conditions"),
|
|
155
|
+
label: z.string().optional().describe("Filter by label"),
|
|
156
|
+
});
|
|
157
|
+
// Filter all parameters schema
|
|
158
|
+
export const FilterAllParamsSchema = z.object({
|
|
159
|
+
payload: z
|
|
160
|
+
.array(z.record(z.unknown()))
|
|
161
|
+
.optional()
|
|
162
|
+
.describe("Filter conditions"),
|
|
163
|
+
label: z.string().optional().describe("Filter by label"),
|
|
164
|
+
});
|
|
165
|
+
// Filter all response schema
|
|
166
|
+
export const FilterAllResponseSchema = z.object({
|
|
167
|
+
meta: z.object({
|
|
168
|
+
count: z.number(),
|
|
169
|
+
}),
|
|
170
|
+
payload: z.array(z.object({
|
|
171
|
+
id: z.number(),
|
|
172
|
+
name: z.string().optional(),
|
|
173
|
+
phone_number: z.string().optional(),
|
|
174
|
+
thumbnail: z.string().optional(),
|
|
175
|
+
})),
|
|
176
|
+
});
|
|
177
|
+
// Filter all IDs response schema
|
|
178
|
+
export const FilterAllIdsResponseSchema = z.object({
|
|
179
|
+
meta: z.object({
|
|
180
|
+
count: z.number(),
|
|
181
|
+
}),
|
|
182
|
+
payload: z.array(z.number()),
|
|
183
|
+
});
|
|
184
|
+
// Contact inbox create parameters schema
|
|
185
|
+
export const ContactInboxCreateParamsSchema = z.object({
|
|
186
|
+
inbox_id: z.number().describe("The ID of the inbox"),
|
|
187
|
+
source_id: z.string().optional().describe("Contact Inbox Source Id"),
|
|
188
|
+
});
|
|
189
|
+
// Contactable inboxes response schema
|
|
190
|
+
export const ContactableInboxesResponseSchema = z.object({
|
|
191
|
+
payload: z.array(z.object({
|
|
192
|
+
source_id: z.string().optional(),
|
|
193
|
+
inbox: z.record(z.unknown()),
|
|
194
|
+
})),
|
|
195
|
+
});
|
|
196
|
+
// Destroy custom attributes parameters schema
|
|
197
|
+
export const DestroyCustomAttributesParamsSchema = z.object({
|
|
198
|
+
custom_attributes: z
|
|
199
|
+
.array(z.string())
|
|
200
|
+
.describe("Array of custom attribute keys to remove"),
|
|
201
|
+
});
|
|
202
|
+
// Contact orders parameters schema
|
|
203
|
+
export const ContactOrdersParamsSchema = z.object({
|
|
204
|
+
page: z.number().int().positive().optional(),
|
|
205
|
+
per_page: z.number().int().positive().optional(),
|
|
206
|
+
});
|
|
207
|
+
// Contact orders meta schema
|
|
208
|
+
export const ContactOrdersMetaSchema = z.object({
|
|
209
|
+
count: z.number(),
|
|
210
|
+
current_page: z.number(),
|
|
211
|
+
});
|
|
212
|
+
// Contact orders response schema
|
|
213
|
+
export const ContactOrdersResponseSchema = z.object({
|
|
214
|
+
meta: ContactOrdersMetaSchema,
|
|
215
|
+
payload: z.array(z.record(z.unknown())),
|
|
216
|
+
});
|
|
217
|
+
// Contact conversations response schema
|
|
218
|
+
export const ContactConversationsResponseSchema = z.object({
|
|
219
|
+
payload: z.array(z.record(z.unknown())),
|
|
220
|
+
});
|
|
221
|
+
// Create contact response schema (wrapped in payload)
|
|
222
|
+
export const CreateContactResponseSchema = z.object({
|
|
223
|
+
payload: ContactSchema,
|
|
224
|
+
});
|
|
225
|
+
// Get contact response schema (wrapped in payload)
|
|
226
|
+
export const GetContactResponseSchema = z.object({
|
|
227
|
+
payload: ContactSchema,
|
|
228
|
+
});
|
|
229
|
+
// Update contact response schema (wrapped in payload)
|
|
230
|
+
export const UpdateContactResponseSchema = z.object({
|
|
231
|
+
payload: ContactSchema,
|
|
65
232
|
});
|
|
66
233
|
// Re-export from conversations for convenience
|
|
67
234
|
export { ContactSchema, ContactInboxSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../resources/contacts/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,kBAAkB,GAGnB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACrE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC3E,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;IACrE,iBAAiB,EAAE,CAAC;SACjB,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACnB,QAAQ,EAAE;SACV,QAAQ,CAAC,mCAAmC,CAAC;CACjD,CAAC,CAAC;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,IAAI,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AC;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;CACxC,CAAC,CAAC;AAEH,wCAAwC;AACxC,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;CACxC,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEH,mDAAmD;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AA+CH,+CAA+C;AAC/C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides functionality for managing orders in Envoy
|
|
4
4
|
*/
|
|
5
5
|
import { BaseResource } from "../base-resource.js";
|
|
6
|
-
import type { ListOrdersParams, ListOrdersResponse, UpsertOrderParams, UpsertOrderResponse } from "./types.js";
|
|
6
|
+
import type { BulkUpsertOrderItem, BulkUpsertOrdersResponse, CreateOrderParams, CreateOrderResponse, ExportOrdersParams, GetOrderResponse, LastUpdatedOrderParams, LastUpdatedOrderResponse, ListOrdersParams, ListOrdersResponse, UpdateOrderParams, UpdateOrderResponse, UpsertOrderParams, UpsertOrderResponse } from "./types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Orders resource class for managing order-related operations
|
|
9
9
|
*/
|
|
@@ -32,16 +32,67 @@ export declare class Orders extends BaseResource {
|
|
|
32
32
|
* until: '2024-12-31',
|
|
33
33
|
* sort: '-created_at'
|
|
34
34
|
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
list(params?: ListOrdersParams): Promise<ListOrdersResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Get a specific order by ID
|
|
40
|
+
* @param orderId - The order ID to retrieve
|
|
41
|
+
* @returns The order wrapped in payload
|
|
35
42
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const response = await client.orders.get(123);
|
|
46
|
+
* console.log(response.payload); // The order
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
get(orderId: number): Promise<GetOrderResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a new order
|
|
52
|
+
* @param params - Order data
|
|
53
|
+
* @returns The created order wrapped in payload
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const result = await client.orders.create({
|
|
58
|
+
* name: 'ORD-12345',
|
|
59
|
+
* partyable_type: 'Contact',
|
|
60
|
+
* partyable_id: 101,
|
|
61
|
+
* currency_code: 'USD',
|
|
62
|
+
* payment_status: 'paid',
|
|
63
|
+
* source: 'shopify',
|
|
64
|
+
* source_id: '789456123'
|
|
41
65
|
* });
|
|
66
|
+
* console.log(result.payload);
|
|
42
67
|
* ```
|
|
43
68
|
*/
|
|
44
|
-
|
|
69
|
+
create(params: CreateOrderParams): Promise<CreateOrderResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Update an existing order
|
|
72
|
+
* @param orderId - The order ID to update
|
|
73
|
+
* @param params - Order data to update
|
|
74
|
+
* @returns The updated order wrapped in payload
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const result = await client.orders.update(123, {
|
|
79
|
+
* payment_status: 'paid',
|
|
80
|
+
* fulfillment_status: 'fulfilled'
|
|
81
|
+
* });
|
|
82
|
+
* console.log(result.payload);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
update(orderId: number, params: UpdateOrderParams): Promise<UpdateOrderResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Delete an order
|
|
88
|
+
* @param orderId - The order ID to delete
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* await client.orders.delete(123);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
delete(orderId: number): Promise<void>;
|
|
45
96
|
/**
|
|
46
97
|
* Create or update an order based on source and source_id
|
|
47
98
|
* If an order with the same source and source_id exists, it will be updated.
|
|
@@ -52,7 +103,6 @@ export declare class Orders extends BaseResource {
|
|
|
52
103
|
*
|
|
53
104
|
* @example
|
|
54
105
|
* ```typescript
|
|
55
|
-
* // Create or update an order
|
|
56
106
|
* const result = await client.orders.upsert({
|
|
57
107
|
* name: 'ORD-12345',
|
|
58
108
|
* partyable_type: 'Contact',
|
|
@@ -61,18 +111,61 @@ export declare class Orders extends BaseResource {
|
|
|
61
111
|
* payment_status: 'paid',
|
|
62
112
|
* fulfillment_status: 'fulfilled',
|
|
63
113
|
* source: 'shopify',
|
|
64
|
-
* source_id: '789456123'
|
|
65
|
-
* order_url: 'https://mystore.myshopify.com/admin/orders/789456123',
|
|
66
|
-
* notes: 'Customer requested gift wrapping',
|
|
67
|
-
* metadata: {
|
|
68
|
-
* line_items: [{ name: 'Widget', unit_price: 50, quantity: 3 }]
|
|
69
|
-
* }
|
|
114
|
+
* source_id: '789456123'
|
|
70
115
|
* });
|
|
71
|
-
* console.log(result.payload);
|
|
116
|
+
* console.log(result.payload);
|
|
72
117
|
* ```
|
|
73
118
|
*/
|
|
74
119
|
upsert(params: UpsertOrderParams): Promise<UpsertOrderResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Bulk create or update multiple orders
|
|
122
|
+
* Orders are matched by source and source_id combination.
|
|
123
|
+
* Maximum 1000 orders per request.
|
|
124
|
+
*
|
|
125
|
+
* @param orders - Array of orders to create or update
|
|
126
|
+
* @returns Summary of processed orders
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const result = await client.orders.bulkUpsert([
|
|
131
|
+
* { source: 'shopify', source_id: '123', name: 'ORD-1', payment_status: 'paid' },
|
|
132
|
+
* { source: 'shopify', source_id: '124', name: 'ORD-2', payment_status: 'pending' }
|
|
133
|
+
* ]);
|
|
134
|
+
* console.log(result.message); // "2 orders processed successfully"
|
|
135
|
+
* console.log(result.order_ids); // [1, 2]
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
bulkUpsert(orders: BulkUpsertOrderItem[]): Promise<BulkUpsertOrdersResponse>;
|
|
139
|
+
/**
|
|
140
|
+
* Get the most recently updated order
|
|
141
|
+
* @param params - Optional source filter
|
|
142
|
+
* @returns The last updated order
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* // Get last updated order across all sources
|
|
147
|
+
* const response = await client.orders.lastUpdated();
|
|
148
|
+
*
|
|
149
|
+
* // Get last updated order from specific source
|
|
150
|
+
* const response = await client.orders.lastUpdated({ source: 'shopify' });
|
|
151
|
+
* console.log(response.payload);
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
lastUpdated(params?: LastUpdatedOrderParams): Promise<LastUpdatedOrderResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Export orders to CSV (async, sent via email)
|
|
157
|
+
* @param params - Optional date filters and payload filters
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* await client.orders.export({
|
|
162
|
+
* since: '2024-01-01',
|
|
163
|
+
* until: '2024-12-31'
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
export(params?: ExportOrdersParams): Promise<void>;
|
|
75
168
|
}
|
|
76
|
-
export type { FulfillmentStatus, ListOrdersParams, ListOrdersResponse, Order, OrdersMeta, PartyableType, PaymentStatus, UpsertOrderParams, UpsertOrderRequest, UpsertOrderResponse,
|
|
77
|
-
export { FulfillmentStatusSchema, ListOrdersParamsSchema, ListOrdersResponseSchema,
|
|
169
|
+
export type { BulkUpsertOrderItem, BulkUpsertOrdersRequest, BulkUpsertOrdersResponse, CreateOrderParams, CreateOrderRequest, CreateOrderResponse, ExportOrdersParams, FulfillmentStatus, GetOrderResponse, LastUpdatedOrderParams, LastUpdatedOrderResponse, ListOrdersParams, ListOrdersResponse, Order, OrderLineItem, OrderMetadata, OrdersMeta, OrdersSummary, PartyableType, PaymentStatus, UpdateOrderParams, UpdateOrderRequest, UpdateOrderResponse, UpsertOrderParams, UpsertOrderRequest, UpsertOrderResponse, } from "./types.js";
|
|
170
|
+
export { BulkUpsertOrderItemSchema, BulkUpsertOrdersRequestSchema, BulkUpsertOrdersResponseSchema, CreateOrderParamsSchema, CreateOrderRequestSchema, CreateOrderResponseSchema, ExportOrdersParamsSchema, FulfillmentStatusSchema, GetOrderResponseSchema, LastUpdatedOrderParamsSchema, LastUpdatedOrderResponseSchema, ListOrdersParamsSchema, ListOrdersResponseSchema, OrderLineItemSchema, OrderMetadataSchema, OrderSchema, OrdersMetaSchema, OrdersSummarySchema, PartyableTypeSchema, PaymentStatusSchema, UpdateOrderParamsSchema, UpdateOrderRequestSchema, UpdateOrderResponseSchema, UpsertOrderParamsSchema, UpsertOrderRequestSchema, UpsertOrderResponseSchema, } from "./types.js";
|
|
78
171
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../resources/orders/index.ts"],"names":[],"mappings":"AAA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',
|
|
32
32
|
* sort: '-created_at'
|
|
33
33
|
* });
|
|
34
|
-
*
|
|
35
|
-
* // List orders with advanced filtering
|
|
36
|
-
* const response = await client.orders.list({
|
|
37
|
-
* payload: [
|
|
38
|
-
* { field: 'payment_status', operator: 'eq', value: 'paid' }
|
|
39
|
-
* ]
|
|
40
|
-
* });
|
|
41
34
|
* ```
|
|
42
35
|
*/
|
|
43
36
|
async list(params) {
|
|
@@ -65,6 +58,76 @@ export class Orders extends BaseResource {
|
|
|
65
58
|
params: queryParams,
|
|
66
59
|
});
|
|
67
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Get a specific order by ID
|
|
63
|
+
* @param orderId - The order ID to retrieve
|
|
64
|
+
* @returns The order wrapped in payload
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const response = await client.orders.get(123);
|
|
69
|
+
* console.log(response.payload); // The order
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async get(orderId) {
|
|
73
|
+
return await this.client.get(`/orders/${orderId}`);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a new order
|
|
77
|
+
* @param params - Order data
|
|
78
|
+
* @returns The created order wrapped in payload
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const result = await client.orders.create({
|
|
83
|
+
* name: 'ORD-12345',
|
|
84
|
+
* partyable_type: 'Contact',
|
|
85
|
+
* partyable_id: 101,
|
|
86
|
+
* currency_code: 'USD',
|
|
87
|
+
* payment_status: 'paid',
|
|
88
|
+
* source: 'shopify',
|
|
89
|
+
* source_id: '789456123'
|
|
90
|
+
* });
|
|
91
|
+
* console.log(result.payload);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
async create(params) {
|
|
95
|
+
return await this.client.post("/orders", {
|
|
96
|
+
order: params,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Update an existing order
|
|
101
|
+
* @param orderId - The order ID to update
|
|
102
|
+
* @param params - Order data to update
|
|
103
|
+
* @returns The updated order wrapped in payload
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const result = await client.orders.update(123, {
|
|
108
|
+
* payment_status: 'paid',
|
|
109
|
+
* fulfillment_status: 'fulfilled'
|
|
110
|
+
* });
|
|
111
|
+
* console.log(result.payload);
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
async update(orderId, params) {
|
|
115
|
+
return await this.client.patch(`/orders/${orderId}`, {
|
|
116
|
+
order: params,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Delete an order
|
|
121
|
+
* @param orderId - The order ID to delete
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* await client.orders.delete(123);
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
async delete(orderId) {
|
|
129
|
+
await this.client.delete(`/orders/${orderId}`);
|
|
130
|
+
}
|
|
68
131
|
/**
|
|
69
132
|
* Create or update an order based on source and source_id
|
|
70
133
|
* If an order with the same source and source_id exists, it will be updated.
|
|
@@ -75,7 +138,6 @@ export class Orders extends BaseResource {
|
|
|
75
138
|
*
|
|
76
139
|
* @example
|
|
77
140
|
* ```typescript
|
|
78
|
-
* // Create or update an order
|
|
79
141
|
* const result = await client.orders.upsert({
|
|
80
142
|
* name: 'ORD-12345',
|
|
81
143
|
* partyable_type: 'Contact',
|
|
@@ -84,14 +146,9 @@ export class Orders extends BaseResource {
|
|
|
84
146
|
* payment_status: 'paid',
|
|
85
147
|
* fulfillment_status: 'fulfilled',
|
|
86
148
|
* source: 'shopify',
|
|
87
|
-
* source_id: '789456123'
|
|
88
|
-
* order_url: 'https://mystore.myshopify.com/admin/orders/789456123',
|
|
89
|
-
* notes: 'Customer requested gift wrapping',
|
|
90
|
-
* metadata: {
|
|
91
|
-
* line_items: [{ name: 'Widget', unit_price: 50, quantity: 3 }]
|
|
92
|
-
* }
|
|
149
|
+
* source_id: '789456123'
|
|
93
150
|
* });
|
|
94
|
-
* console.log(result.payload);
|
|
151
|
+
* console.log(result.payload);
|
|
95
152
|
* ```
|
|
96
153
|
*/
|
|
97
154
|
async upsert(params) {
|
|
@@ -99,7 +156,70 @@ export class Orders extends BaseResource {
|
|
|
99
156
|
order: params,
|
|
100
157
|
});
|
|
101
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Bulk create or update multiple orders
|
|
161
|
+
* Orders are matched by source and source_id combination.
|
|
162
|
+
* Maximum 1000 orders per request.
|
|
163
|
+
*
|
|
164
|
+
* @param orders - Array of orders to create or update
|
|
165
|
+
* @returns Summary of processed orders
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const result = await client.orders.bulkUpsert([
|
|
170
|
+
* { source: 'shopify', source_id: '123', name: 'ORD-1', payment_status: 'paid' },
|
|
171
|
+
* { source: 'shopify', source_id: '124', name: 'ORD-2', payment_status: 'pending' }
|
|
172
|
+
* ]);
|
|
173
|
+
* console.log(result.message); // "2 orders processed successfully"
|
|
174
|
+
* console.log(result.order_ids); // [1, 2]
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
async bulkUpsert(orders) {
|
|
178
|
+
return await this.client.post("/orders/bulk_upsert", { orders });
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get the most recently updated order
|
|
182
|
+
* @param params - Optional source filter
|
|
183
|
+
* @returns The last updated order
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* // Get last updated order across all sources
|
|
188
|
+
* const response = await client.orders.lastUpdated();
|
|
189
|
+
*
|
|
190
|
+
* // Get last updated order from specific source
|
|
191
|
+
* const response = await client.orders.lastUpdated({ source: 'shopify' });
|
|
192
|
+
* console.log(response.payload);
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
async lastUpdated(params) {
|
|
196
|
+
return await this.client.get("/orders/last_updated", { params });
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Export orders to CSV (async, sent via email)
|
|
200
|
+
* @param params - Optional date filters and payload filters
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* await client.orders.export({
|
|
205
|
+
* since: '2024-01-01',
|
|
206
|
+
* until: '2024-12-31'
|
|
207
|
+
* });
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
async export(params) {
|
|
211
|
+
const queryParams = {};
|
|
212
|
+
if (params?.since) {
|
|
213
|
+
queryParams.since = params.since;
|
|
214
|
+
}
|
|
215
|
+
if (params?.until) {
|
|
216
|
+
queryParams.until = params.until;
|
|
217
|
+
}
|
|
218
|
+
await this.client.post("/orders/export", params?.payload, {
|
|
219
|
+
params: queryParams,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
102
222
|
}
|
|
103
223
|
// Re-export Zod schemas
|
|
104
|
-
export { FulfillmentStatusSchema, ListOrdersParamsSchema, ListOrdersResponseSchema,
|
|
224
|
+
export { BulkUpsertOrderItemSchema, BulkUpsertOrdersRequestSchema, BulkUpsertOrdersResponseSchema, CreateOrderParamsSchema, CreateOrderRequestSchema, CreateOrderResponseSchema, ExportOrdersParamsSchema, FulfillmentStatusSchema, GetOrderResponseSchema, LastUpdatedOrderParamsSchema, LastUpdatedOrderResponseSchema, ListOrdersParamsSchema, ListOrdersResponseSchema, OrderLineItemSchema, OrderMetadataSchema, OrderSchema, OrdersMetaSchema, OrdersSummarySchema, PartyableTypeSchema, PaymentStatusSchema, UpdateOrderParamsSchema, UpdateOrderRequestSchema, UpdateOrderResponseSchema, UpsertOrderParamsSchema, UpsertOrderRequestSchema, UpsertOrderResponseSchema, } from "./types.js";
|
|
105
225
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../resources/orders/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../resources/orders/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAkBnD;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,YAAY;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,KAAK,CAAC,IAAI,CAAC,MAAyB;QAClC,MAAM,WAAW,GAAoC,EAAE,CAAC;QAExD,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;YAC/B,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,EAAE,QAAQ,KAAK,SAAS,EAAE,CAAC;YACnC,WAAW,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACzC,CAAC;QACD,IAAI,MAAM,EAAE,KAAK,EAAE,CAAC;YAClB,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACnC,CAAC;QACD,IAAI,MAAM,EAAE,KAAK,EAAE,CAAC;YAClB,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACnC,CAAC;QACD,IAAI,MAAM,EAAE,IAAI,EAAE,CAAC;YACjB,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,2DAA2D;YAC3D,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAqB,SAAS,EAAE;YAC1D,MAAM,EAAE,WAAW;SAC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