@voltade/envoy-sdk 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +5 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/client.js.map +1 -1
- 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/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +1 -0
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/orders/index.d.ts +83 -0
- package/dist/resources/orders/index.d.ts.map +1 -0
- package/dist/resources/orders/index.js +110 -0
- package/dist/resources/orders/index.js.map +1 -0
- package/dist/resources/orders/types.d.ts +338 -0
- package/dist/resources/orders/types.d.ts.map +1 -0
- package/dist/resources/orders/types.js +69 -0
- package/dist/resources/orders/types.js.map +1 -0
- package/dist/test.d.ts +6 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +115 -0
- package/dist/test.js.map +1 -0
- package/package.json +3 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from './http-client.js';
|
|
2
|
-
import { Conversations, Inboxes } from './resources/index.js';
|
|
2
|
+
import { Conversations, Inboxes, Orders } from './resources/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for EnvoyClient
|
|
5
5
|
*/
|
|
@@ -47,6 +47,10 @@ export declare class EnvoyClient {
|
|
|
47
47
|
* Inboxes resource for managing inboxes and searching knowledge base
|
|
48
48
|
*/
|
|
49
49
|
readonly inboxes: Inboxes;
|
|
50
|
+
/**
|
|
51
|
+
* Orders resource for managing orders
|
|
52
|
+
*/
|
|
53
|
+
readonly orders: Orders;
|
|
50
54
|
constructor(config: EnvoyClientConfig);
|
|
51
55
|
/**
|
|
52
56
|
* Get the HTTP client instance (for advanced use cases)
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;OAEG;IACH,SAAgB,aAAa,EAAE,aAAa,CAAC;IAE7C;;OAEG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEnB,MAAM,EAAE,iBAAiB;IAarC;;;OAGG;IACH,aAAa,IAAI,UAAU;CAG5B"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from './http-client.js';
|
|
2
|
-
import { Conversations, Inboxes } from './resources/index.js';
|
|
2
|
+
import { Conversations, Inboxes, Orders } from './resources/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Envoy API Client
|
|
5
5
|
* A comprehensive SDK for interacting with the Envoy API
|
|
@@ -37,6 +37,7 @@ export class EnvoyClient {
|
|
|
37
37
|
// Initialize resources
|
|
38
38
|
this.conversations = new Conversations(this.httpClient);
|
|
39
39
|
this.inboxes = new Inboxes(this.httpClient);
|
|
40
|
+
this.orders = new Orders(this.httpClient);
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* Get the HTTP client instance (for advanced use cases)
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAYtE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,WAAW;IAkBtB,YAAY,MAAyB;QACnC,MAAM,UAAU,GAAqB;YACnC,GAAG,MAAM;SACV,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;QAE7C,uBAAuB;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export { EnvoyClient, type EnvoyClientConfig } from "./client.js";
|
|
26
|
-
export type { Agent, Article, Assignee, Contact, ContactInbox, Conversation, ConversationMeta, ConversationStatus, ContentType, CreateMessageParams, EscalationResponse, EscalationType, Message, MessageType, MessagesResponse, MessagesResponseMeta, Priority, SearchParams, SearchResponse, Team, } from "./resources/index.js";
|
|
26
|
+
export type { Agent, Article, Assignee, Contact, ContactInbox, Conversation, ConversationMeta, ConversationStatus, ContentType, CreateMessageParams, EscalationResponse, EscalationType, ListOrdersParams, ListOrdersResponse, Message, MessageType, MessagesResponse, MessagesResponseMeta, Order, OrdersMeta, Priority, UpsertOrderParams, UpsertOrderRequest, UpsertOrderResponse, UpsertOrderResponsePayload, SearchParams, SearchResponse, Team, } from "./resources/index.js";
|
|
27
27
|
export { webhookEvent } from "./resources/webhooks/index.js";
|
|
28
|
-
export { Conversations, Inboxes } from
|
|
29
|
-
export { AgentSchema, ArticleSchema, AssigneeSchema, ContactInboxSchema, ContactSchema, ConversationMetaSchema, ConversationSchema, ConversationStatusSchema, ContentTypeSchema, CreateMessageParamsSchema, EscalationResponseSchema, EscalationTypeSchema, MessageSchema, MessagesResponseMetaSchema, MessagesResponseSchema, MessageTypeSchema, PrioritySchema, SearchParamsSchema, SearchResponseSchema, TeamSchema, } from "./resources/index.js";
|
|
28
|
+
export { Conversations, Inboxes, Orders } from './resources/index.js';
|
|
29
|
+
export { AgentSchema, ArticleSchema, AssigneeSchema, ContactInboxSchema, ContactSchema, ConversationMetaSchema, ConversationSchema, ConversationStatusSchema, ContentTypeSchema, CreateMessageParamsSchema, EscalationResponseSchema, EscalationTypeSchema, ListOrdersParamsSchema, ListOrdersResponseSchema, MessageSchema, MessagesResponseMetaSchema, MessagesResponseSchema, MessageTypeSchema, OrdersMetaSchema, OrderSchema, PrioritySchema, UpsertOrderParamsSchema, UpsertOrderRequestSchema, UpsertOrderResponsePayloadSchema, UpsertOrderResponseSchema, SearchParamsSchema, SearchResponseSchema, TeamSchema, } from "./resources/index.js";
|
|
30
30
|
export { HttpClient } from "./http-client.js";
|
|
31
31
|
export { AuthenticationError, BadRequestError, EnvoyError, NetworkError, NotFoundError, RateLimitError, ServerError, ValidationError, } from "./errors.js";
|
|
32
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGlE,YAAY,EACV,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGlE,YAAY,EACV,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,EACL,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGtE,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,GACX,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
// Main client export
|
|
26
26
|
export { EnvoyClient } from "./client.js";
|
|
27
27
|
export { webhookEvent } from "./resources/webhooks/index.js";
|
|
28
|
-
export { Conversations, Inboxes } from
|
|
28
|
+
export { Conversations, Inboxes, Orders } from './resources/index.js';
|
|
29
29
|
// Zod schema exports
|
|
30
|
-
export { AgentSchema, ArticleSchema, AssigneeSchema, ContactInboxSchema, ContactSchema, ConversationMetaSchema, ConversationSchema, ConversationStatusSchema, ContentTypeSchema, CreateMessageParamsSchema, EscalationResponseSchema, EscalationTypeSchema, MessageSchema, MessagesResponseMetaSchema, MessagesResponseSchema, MessageTypeSchema, PrioritySchema, SearchParamsSchema, SearchResponseSchema, TeamSchema, } from "./resources/index.js";
|
|
30
|
+
export { AgentSchema, ArticleSchema, AssigneeSchema, ContactInboxSchema, ContactSchema, ConversationMetaSchema, ConversationSchema, ConversationStatusSchema, ContentTypeSchema, CreateMessageParamsSchema, EscalationResponseSchema, EscalationTypeSchema, ListOrdersParamsSchema, ListOrdersResponseSchema, MessageSchema, MessagesResponseMetaSchema, MessagesResponseSchema, MessageTypeSchema, OrdersMetaSchema, OrderSchema, PrioritySchema, UpsertOrderParamsSchema, UpsertOrderRequestSchema, UpsertOrderResponsePayloadSchema, UpsertOrderResponseSchema, SearchParamsSchema, SearchResponseSchema, TeamSchema, } from "./resources/index.js";
|
|
31
31
|
// Utility exports
|
|
32
32
|
export { HttpClient } from "./http-client.js";
|
|
33
33
|
// Error exports
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,qBAAqB;AACrB,OAAO,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,qBAAqB;AACrB,OAAO,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAC;AAiClE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtE,qBAAqB;AACrB,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,gBAAgB;AAChB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
package/dist/resources/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orders resource module
|
|
3
|
+
* Provides functionality for managing orders in Envoy
|
|
4
|
+
*/
|
|
5
|
+
import type { HttpClient } from '../../http-client.js';
|
|
6
|
+
import type { ListOrdersParams, ListOrdersResponse, UpsertOrderParams, UpsertOrderResponse } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Base resource class that all resource classes extend from
|
|
9
|
+
*/
|
|
10
|
+
declare abstract class BaseResource {
|
|
11
|
+
protected readonly client: HttpClient;
|
|
12
|
+
constructor(client: HttpClient);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Orders resource class for managing order-related operations
|
|
16
|
+
*/
|
|
17
|
+
export declare class Orders extends BaseResource {
|
|
18
|
+
/**
|
|
19
|
+
* List all orders with pagination and filtering
|
|
20
|
+
* @param params - Query parameters for filtering and pagination
|
|
21
|
+
* @returns Paginated list of orders with metadata
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // List orders with default pagination
|
|
26
|
+
* const response = await client.orders.list();
|
|
27
|
+
* console.log(response.data); // Array of orders
|
|
28
|
+
* console.log(response.meta); // Pagination metadata
|
|
29
|
+
*
|
|
30
|
+
* // List orders with custom pagination
|
|
31
|
+
* const response = await client.orders.list({
|
|
32
|
+
* page: 2,
|
|
33
|
+
* per_page: 50
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // List orders with date filtering
|
|
37
|
+
* const response = await client.orders.list({
|
|
38
|
+
* since: '2024-01-01',
|
|
39
|
+
* until: '2024-12-31',
|
|
40
|
+
* sort: '-created_at'
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // List orders with advanced filtering
|
|
44
|
+
* const response = await client.orders.list({
|
|
45
|
+
* payload: [
|
|
46
|
+
* { field: 'financial_status', operator: 'eq', value: 'paid' }
|
|
47
|
+
* ]
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
list(params?: ListOrdersParams): Promise<ListOrdersResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Create or update an order based on source and source_id
|
|
54
|
+
* If an order with the same source and source_id exists, it will be updated.
|
|
55
|
+
* Otherwise, a new order will be created.
|
|
56
|
+
*
|
|
57
|
+
* @param params - Order data with required source and source_id
|
|
58
|
+
* @returns The created or updated order
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* // Create or update an order
|
|
63
|
+
* const result = await client.orders.upsert({
|
|
64
|
+
* name: 'ORD-12345',
|
|
65
|
+
* contact_id: 101,
|
|
66
|
+
* total_amount: 150,
|
|
67
|
+
* currency_code: 'USD',
|
|
68
|
+
* financial_status: 'paid',
|
|
69
|
+
* fulfillment_status: 'fulfilled',
|
|
70
|
+
* source: 'shopify',
|
|
71
|
+
* source_id: '789456123',
|
|
72
|
+
* order_url: 'https://mystore.myshopify.com/admin/orders/789456123',
|
|
73
|
+
* notes: 'Customer requested gift wrapping',
|
|
74
|
+
* metadata: {}
|
|
75
|
+
* });
|
|
76
|
+
* console.log(result.payload); // The created/updated order
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
upsert(params: UpsertOrderParams): Promise<UpsertOrderResponse>;
|
|
80
|
+
}
|
|
81
|
+
export type { ListOrdersParams, ListOrdersResponse, Order, OrdersMeta, UpsertOrderParams, UpsertOrderRequest, UpsertOrderResponse, UpsertOrderResponsePayload, } from './types.js';
|
|
82
|
+
export { ListOrdersParamsSchema, ListOrdersResponseSchema, OrdersMetaSchema, OrderSchema, UpsertOrderParamsSchema, UpsertOrderRequestSchema, UpsertOrderResponsePayloadSchema, UpsertOrderResponseSchema, } from './types.js';
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../resources/orders/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,uBAAe,YAAY;IACb,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU;gBAAlB,MAAM,EAAE,UAAU;CAClD;AAED;;GAEG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4BlE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAKtE;AAGD,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orders resource module
|
|
3
|
+
* Provides functionality for managing orders in Envoy
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base resource class that all resource classes extend from
|
|
7
|
+
*/
|
|
8
|
+
class BaseResource {
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Orders resource class for managing order-related operations
|
|
15
|
+
*/
|
|
16
|
+
export class Orders extends BaseResource {
|
|
17
|
+
/**
|
|
18
|
+
* List all orders with pagination and filtering
|
|
19
|
+
* @param params - Query parameters for filtering and pagination
|
|
20
|
+
* @returns Paginated list of orders with metadata
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // List orders with default pagination
|
|
25
|
+
* const response = await client.orders.list();
|
|
26
|
+
* console.log(response.data); // Array of orders
|
|
27
|
+
* console.log(response.meta); // Pagination metadata
|
|
28
|
+
*
|
|
29
|
+
* // List orders with custom pagination
|
|
30
|
+
* const response = await client.orders.list({
|
|
31
|
+
* page: 2,
|
|
32
|
+
* per_page: 50
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // List orders with date filtering
|
|
36
|
+
* const response = await client.orders.list({
|
|
37
|
+
* since: '2024-01-01',
|
|
38
|
+
* until: '2024-12-31',
|
|
39
|
+
* sort: '-created_at'
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // List orders with advanced filtering
|
|
43
|
+
* const response = await client.orders.list({
|
|
44
|
+
* payload: [
|
|
45
|
+
* { field: 'financial_status', operator: 'eq', value: 'paid' }
|
|
46
|
+
* ]
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
async list(params) {
|
|
51
|
+
const queryParams = {};
|
|
52
|
+
if (params?.page !== undefined) {
|
|
53
|
+
queryParams.page = params.page;
|
|
54
|
+
}
|
|
55
|
+
if (params?.per_page !== undefined) {
|
|
56
|
+
queryParams.per_page = params.per_page;
|
|
57
|
+
}
|
|
58
|
+
if (params?.since) {
|
|
59
|
+
queryParams.since = params.since;
|
|
60
|
+
}
|
|
61
|
+
if (params?.until) {
|
|
62
|
+
queryParams.until = params.until;
|
|
63
|
+
}
|
|
64
|
+
if (params?.sort) {
|
|
65
|
+
queryParams.sort = params.sort;
|
|
66
|
+
}
|
|
67
|
+
if (params?.payload) {
|
|
68
|
+
// Convert payload array to JSON string for query parameter
|
|
69
|
+
queryParams.payload = JSON.stringify(params.payload);
|
|
70
|
+
}
|
|
71
|
+
return await this.client.get('/orders', {
|
|
72
|
+
params: queryParams,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create or update an order based on source and source_id
|
|
77
|
+
* If an order with the same source and source_id exists, it will be updated.
|
|
78
|
+
* Otherwise, a new order will be created.
|
|
79
|
+
*
|
|
80
|
+
* @param params - Order data with required source and source_id
|
|
81
|
+
* @returns The created or updated order
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // Create or update an order
|
|
86
|
+
* const result = await client.orders.upsert({
|
|
87
|
+
* name: 'ORD-12345',
|
|
88
|
+
* contact_id: 101,
|
|
89
|
+
* total_amount: 150,
|
|
90
|
+
* currency_code: 'USD',
|
|
91
|
+
* financial_status: 'paid',
|
|
92
|
+
* fulfillment_status: 'fulfilled',
|
|
93
|
+
* source: 'shopify',
|
|
94
|
+
* source_id: '789456123',
|
|
95
|
+
* order_url: 'https://mystore.myshopify.com/admin/orders/789456123',
|
|
96
|
+
* notes: 'Customer requested gift wrapping',
|
|
97
|
+
* metadata: {}
|
|
98
|
+
* });
|
|
99
|
+
* console.log(result.payload); // The created/updated order
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
async upsert(params) {
|
|
103
|
+
return await this.client.post('/orders/upsert', {
|
|
104
|
+
order: params,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Re-export Zod schemas
|
|
109
|
+
export { ListOrdersParamsSchema, ListOrdersResponseSchema, OrdersMetaSchema, OrderSchema, UpsertOrderParamsSchema, UpsertOrderRequestSchema, UpsertOrderResponsePayloadSchema, UpsertOrderResponseSchema, } from './types.js';
|
|
110
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AAC,MAAM,CAAC,MAAyB;QACpC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAsB,gBAAgB,EAAE;YACnE,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC;CACF;AAcD,wBAAwB;AACxB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod Schemas for Orders
|
|
4
|
+
*/
|
|
5
|
+
export declare const OrderSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
6
|
+
export declare const UpsertOrderParamsSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
contact_id: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
total_amount: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
currency_code: z.ZodOptional<z.ZodString>;
|
|
11
|
+
financial_status: z.ZodOptional<z.ZodString>;
|
|
12
|
+
fulfillment_status: z.ZodOptional<z.ZodString>;
|
|
13
|
+
source: z.ZodString;
|
|
14
|
+
source_id: z.ZodString;
|
|
15
|
+
order_url: z.ZodOptional<z.ZodString>;
|
|
16
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
17
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
source_id: string;
|
|
20
|
+
source: string;
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
contact_id?: number | undefined;
|
|
23
|
+
total_amount?: number | undefined;
|
|
24
|
+
currency_code?: string | undefined;
|
|
25
|
+
financial_status?: string | undefined;
|
|
26
|
+
fulfillment_status?: string | undefined;
|
|
27
|
+
order_url?: string | undefined;
|
|
28
|
+
notes?: string | undefined;
|
|
29
|
+
metadata?: Record<string, unknown> | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
source_id: string;
|
|
32
|
+
source: string;
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
contact_id?: number | undefined;
|
|
35
|
+
total_amount?: number | undefined;
|
|
36
|
+
currency_code?: string | undefined;
|
|
37
|
+
financial_status?: string | undefined;
|
|
38
|
+
fulfillment_status?: string | undefined;
|
|
39
|
+
order_url?: string | undefined;
|
|
40
|
+
notes?: string | undefined;
|
|
41
|
+
metadata?: Record<string, unknown> | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const UpsertOrderRequestSchema: z.ZodObject<{
|
|
44
|
+
order: z.ZodObject<{
|
|
45
|
+
name: z.ZodOptional<z.ZodString>;
|
|
46
|
+
contact_id: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
total_amount: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
currency_code: z.ZodOptional<z.ZodString>;
|
|
49
|
+
financial_status: z.ZodOptional<z.ZodString>;
|
|
50
|
+
fulfillment_status: z.ZodOptional<z.ZodString>;
|
|
51
|
+
source: z.ZodString;
|
|
52
|
+
source_id: z.ZodString;
|
|
53
|
+
order_url: z.ZodOptional<z.ZodString>;
|
|
54
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
55
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
source_id: string;
|
|
58
|
+
source: string;
|
|
59
|
+
name?: string | undefined;
|
|
60
|
+
contact_id?: number | undefined;
|
|
61
|
+
total_amount?: number | undefined;
|
|
62
|
+
currency_code?: string | undefined;
|
|
63
|
+
financial_status?: string | undefined;
|
|
64
|
+
fulfillment_status?: string | undefined;
|
|
65
|
+
order_url?: string | undefined;
|
|
66
|
+
notes?: string | undefined;
|
|
67
|
+
metadata?: Record<string, unknown> | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
source_id: string;
|
|
70
|
+
source: string;
|
|
71
|
+
name?: string | undefined;
|
|
72
|
+
contact_id?: number | undefined;
|
|
73
|
+
total_amount?: number | undefined;
|
|
74
|
+
currency_code?: string | undefined;
|
|
75
|
+
financial_status?: string | undefined;
|
|
76
|
+
fulfillment_status?: string | undefined;
|
|
77
|
+
order_url?: string | undefined;
|
|
78
|
+
notes?: string | undefined;
|
|
79
|
+
metadata?: Record<string, unknown> | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
order: {
|
|
83
|
+
source_id: string;
|
|
84
|
+
source: string;
|
|
85
|
+
name?: string | undefined;
|
|
86
|
+
contact_id?: number | undefined;
|
|
87
|
+
total_amount?: number | undefined;
|
|
88
|
+
currency_code?: string | undefined;
|
|
89
|
+
financial_status?: string | undefined;
|
|
90
|
+
fulfillment_status?: string | undefined;
|
|
91
|
+
order_url?: string | undefined;
|
|
92
|
+
notes?: string | undefined;
|
|
93
|
+
metadata?: Record<string, unknown> | undefined;
|
|
94
|
+
};
|
|
95
|
+
}, {
|
|
96
|
+
order: {
|
|
97
|
+
source_id: string;
|
|
98
|
+
source: string;
|
|
99
|
+
name?: string | undefined;
|
|
100
|
+
contact_id?: number | undefined;
|
|
101
|
+
total_amount?: number | undefined;
|
|
102
|
+
currency_code?: string | undefined;
|
|
103
|
+
financial_status?: string | undefined;
|
|
104
|
+
fulfillment_status?: string | undefined;
|
|
105
|
+
order_url?: string | undefined;
|
|
106
|
+
notes?: string | undefined;
|
|
107
|
+
metadata?: Record<string, unknown> | undefined;
|
|
108
|
+
};
|
|
109
|
+
}>;
|
|
110
|
+
export declare const UpsertOrderResponsePayloadSchema: z.ZodObject<{
|
|
111
|
+
id: z.ZodNumber;
|
|
112
|
+
name: z.ZodOptional<z.ZodString>;
|
|
113
|
+
contact_id: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
contact_name: z.ZodOptional<z.ZodString>;
|
|
115
|
+
total_amount: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
currency_code: z.ZodOptional<z.ZodString>;
|
|
117
|
+
financial_status: z.ZodOptional<z.ZodString>;
|
|
118
|
+
fulfillment_status: z.ZodOptional<z.ZodString>;
|
|
119
|
+
source: z.ZodString;
|
|
120
|
+
source_id: z.ZodString;
|
|
121
|
+
order_url: z.ZodOptional<z.ZodString>;
|
|
122
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
123
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
124
|
+
created_at: z.ZodString;
|
|
125
|
+
updated_at: z.ZodString;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
id: number;
|
|
128
|
+
created_at: string;
|
|
129
|
+
source_id: string;
|
|
130
|
+
updated_at: string;
|
|
131
|
+
source: string;
|
|
132
|
+
name?: string | undefined;
|
|
133
|
+
contact_id?: number | undefined;
|
|
134
|
+
total_amount?: number | undefined;
|
|
135
|
+
currency_code?: string | undefined;
|
|
136
|
+
financial_status?: string | undefined;
|
|
137
|
+
fulfillment_status?: string | undefined;
|
|
138
|
+
order_url?: string | undefined;
|
|
139
|
+
notes?: string | undefined;
|
|
140
|
+
metadata?: Record<string, unknown> | undefined;
|
|
141
|
+
contact_name?: string | undefined;
|
|
142
|
+
}, {
|
|
143
|
+
id: number;
|
|
144
|
+
created_at: string;
|
|
145
|
+
source_id: string;
|
|
146
|
+
updated_at: string;
|
|
147
|
+
source: string;
|
|
148
|
+
name?: string | undefined;
|
|
149
|
+
contact_id?: number | undefined;
|
|
150
|
+
total_amount?: number | undefined;
|
|
151
|
+
currency_code?: string | undefined;
|
|
152
|
+
financial_status?: string | undefined;
|
|
153
|
+
fulfillment_status?: string | undefined;
|
|
154
|
+
order_url?: string | undefined;
|
|
155
|
+
notes?: string | undefined;
|
|
156
|
+
metadata?: Record<string, unknown> | undefined;
|
|
157
|
+
contact_name?: string | undefined;
|
|
158
|
+
}>;
|
|
159
|
+
export declare const UpsertOrderResponseSchema: z.ZodObject<{
|
|
160
|
+
payload: z.ZodObject<{
|
|
161
|
+
id: z.ZodNumber;
|
|
162
|
+
name: z.ZodOptional<z.ZodString>;
|
|
163
|
+
contact_id: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
contact_name: z.ZodOptional<z.ZodString>;
|
|
165
|
+
total_amount: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
currency_code: z.ZodOptional<z.ZodString>;
|
|
167
|
+
financial_status: z.ZodOptional<z.ZodString>;
|
|
168
|
+
fulfillment_status: z.ZodOptional<z.ZodString>;
|
|
169
|
+
source: z.ZodString;
|
|
170
|
+
source_id: z.ZodString;
|
|
171
|
+
order_url: z.ZodOptional<z.ZodString>;
|
|
172
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
173
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
174
|
+
created_at: z.ZodString;
|
|
175
|
+
updated_at: z.ZodString;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
id: number;
|
|
178
|
+
created_at: string;
|
|
179
|
+
source_id: string;
|
|
180
|
+
updated_at: string;
|
|
181
|
+
source: string;
|
|
182
|
+
name?: string | undefined;
|
|
183
|
+
contact_id?: number | undefined;
|
|
184
|
+
total_amount?: number | undefined;
|
|
185
|
+
currency_code?: string | undefined;
|
|
186
|
+
financial_status?: string | undefined;
|
|
187
|
+
fulfillment_status?: string | undefined;
|
|
188
|
+
order_url?: string | undefined;
|
|
189
|
+
notes?: string | undefined;
|
|
190
|
+
metadata?: Record<string, unknown> | undefined;
|
|
191
|
+
contact_name?: string | undefined;
|
|
192
|
+
}, {
|
|
193
|
+
id: number;
|
|
194
|
+
created_at: string;
|
|
195
|
+
source_id: string;
|
|
196
|
+
updated_at: string;
|
|
197
|
+
source: string;
|
|
198
|
+
name?: string | undefined;
|
|
199
|
+
contact_id?: number | undefined;
|
|
200
|
+
total_amount?: number | undefined;
|
|
201
|
+
currency_code?: string | undefined;
|
|
202
|
+
financial_status?: string | undefined;
|
|
203
|
+
fulfillment_status?: string | undefined;
|
|
204
|
+
order_url?: string | undefined;
|
|
205
|
+
notes?: string | undefined;
|
|
206
|
+
metadata?: Record<string, unknown> | undefined;
|
|
207
|
+
contact_name?: string | undefined;
|
|
208
|
+
}>;
|
|
209
|
+
}, "strip", z.ZodTypeAny, {
|
|
210
|
+
payload: {
|
|
211
|
+
id: number;
|
|
212
|
+
created_at: string;
|
|
213
|
+
source_id: string;
|
|
214
|
+
updated_at: string;
|
|
215
|
+
source: string;
|
|
216
|
+
name?: string | undefined;
|
|
217
|
+
contact_id?: number | undefined;
|
|
218
|
+
total_amount?: number | undefined;
|
|
219
|
+
currency_code?: string | undefined;
|
|
220
|
+
financial_status?: string | undefined;
|
|
221
|
+
fulfillment_status?: string | undefined;
|
|
222
|
+
order_url?: string | undefined;
|
|
223
|
+
notes?: string | undefined;
|
|
224
|
+
metadata?: Record<string, unknown> | undefined;
|
|
225
|
+
contact_name?: string | undefined;
|
|
226
|
+
};
|
|
227
|
+
}, {
|
|
228
|
+
payload: {
|
|
229
|
+
id: number;
|
|
230
|
+
created_at: string;
|
|
231
|
+
source_id: string;
|
|
232
|
+
updated_at: string;
|
|
233
|
+
source: string;
|
|
234
|
+
name?: string | undefined;
|
|
235
|
+
contact_id?: number | undefined;
|
|
236
|
+
total_amount?: number | undefined;
|
|
237
|
+
currency_code?: string | undefined;
|
|
238
|
+
financial_status?: string | undefined;
|
|
239
|
+
fulfillment_status?: string | undefined;
|
|
240
|
+
order_url?: string | undefined;
|
|
241
|
+
notes?: string | undefined;
|
|
242
|
+
metadata?: Record<string, unknown> | undefined;
|
|
243
|
+
contact_name?: string | undefined;
|
|
244
|
+
};
|
|
245
|
+
}>;
|
|
246
|
+
export declare const ListOrdersParamsSchema: z.ZodObject<{
|
|
247
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
248
|
+
per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
249
|
+
since: z.ZodOptional<z.ZodString>;
|
|
250
|
+
until: z.ZodOptional<z.ZodString>;
|
|
251
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
252
|
+
payload: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
253
|
+
}, "strip", z.ZodTypeAny, {
|
|
254
|
+
page: number;
|
|
255
|
+
per_page: number;
|
|
256
|
+
sort?: string | undefined;
|
|
257
|
+
payload?: Record<string, unknown>[] | undefined;
|
|
258
|
+
since?: string | undefined;
|
|
259
|
+
until?: string | undefined;
|
|
260
|
+
}, {
|
|
261
|
+
sort?: string | undefined;
|
|
262
|
+
payload?: Record<string, unknown>[] | undefined;
|
|
263
|
+
page?: number | undefined;
|
|
264
|
+
per_page?: number | undefined;
|
|
265
|
+
since?: string | undefined;
|
|
266
|
+
until?: string | undefined;
|
|
267
|
+
}>;
|
|
268
|
+
export declare const OrdersMetaSchema: z.ZodObject<{
|
|
269
|
+
count: z.ZodNumber;
|
|
270
|
+
current_page: z.ZodNumber;
|
|
271
|
+
per_page: z.ZodNumber;
|
|
272
|
+
total_pages: z.ZodNumber;
|
|
273
|
+
summary: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
per_page: number;
|
|
276
|
+
count: number;
|
|
277
|
+
current_page: number;
|
|
278
|
+
total_pages: number;
|
|
279
|
+
summary: Record<string, unknown>;
|
|
280
|
+
}, {
|
|
281
|
+
per_page: number;
|
|
282
|
+
count: number;
|
|
283
|
+
current_page: number;
|
|
284
|
+
total_pages: number;
|
|
285
|
+
summary: Record<string, unknown>;
|
|
286
|
+
}>;
|
|
287
|
+
export declare const ListOrdersResponseSchema: z.ZodObject<{
|
|
288
|
+
meta: z.ZodObject<{
|
|
289
|
+
count: z.ZodNumber;
|
|
290
|
+
current_page: z.ZodNumber;
|
|
291
|
+
per_page: z.ZodNumber;
|
|
292
|
+
total_pages: z.ZodNumber;
|
|
293
|
+
summary: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
per_page: number;
|
|
296
|
+
count: number;
|
|
297
|
+
current_page: number;
|
|
298
|
+
total_pages: number;
|
|
299
|
+
summary: Record<string, unknown>;
|
|
300
|
+
}, {
|
|
301
|
+
per_page: number;
|
|
302
|
+
count: number;
|
|
303
|
+
current_page: number;
|
|
304
|
+
total_pages: number;
|
|
305
|
+
summary: Record<string, unknown>;
|
|
306
|
+
}>;
|
|
307
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
meta: {
|
|
310
|
+
per_page: number;
|
|
311
|
+
count: number;
|
|
312
|
+
current_page: number;
|
|
313
|
+
total_pages: number;
|
|
314
|
+
summary: Record<string, unknown>;
|
|
315
|
+
};
|
|
316
|
+
data: Record<string, unknown>[];
|
|
317
|
+
}, {
|
|
318
|
+
meta: {
|
|
319
|
+
per_page: number;
|
|
320
|
+
count: number;
|
|
321
|
+
current_page: number;
|
|
322
|
+
total_pages: number;
|
|
323
|
+
summary: Record<string, unknown>;
|
|
324
|
+
};
|
|
325
|
+
data: Record<string, unknown>[];
|
|
326
|
+
}>;
|
|
327
|
+
/**
|
|
328
|
+
* TypeScript Types (inferred from Zod schemas)
|
|
329
|
+
*/
|
|
330
|
+
export type Order = z.infer<typeof OrderSchema>;
|
|
331
|
+
export type ListOrdersParams = z.infer<typeof ListOrdersParamsSchema>;
|
|
332
|
+
export type OrdersMeta = z.infer<typeof OrdersMetaSchema>;
|
|
333
|
+
export type ListOrdersResponse = z.infer<typeof ListOrdersResponseSchema>;
|
|
334
|
+
export type UpsertOrderParams = z.infer<typeof UpsertOrderParamsSchema>;
|
|
335
|
+
export type UpsertOrderRequest = z.infer<typeof UpsertOrderRequestSchema>;
|
|
336
|
+
export type UpsertOrderResponsePayload = z.infer<typeof UpsertOrderResponsePayloadSchema>;
|
|
337
|
+
export type UpsertOrderResponse = z.infer<typeof UpsertOrderResponseSchema>;
|
|
338
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../resources/orders/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAGH,eAAO,MAAM,WAAW,wCAAwB,CAAC;AAGjD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYlC,CAAC;AAGH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEnC,CAAC;AAGH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB3C,CAAC;AAGH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpC,CAAC;AAGH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAGH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAGH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGnC,CAAC;AAEH;;GAEG;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod Schemas for Orders
|
|
4
|
+
*/
|
|
5
|
+
// Order schema - minimal structure as per API docs
|
|
6
|
+
export const OrderSchema = z.record(z.unknown());
|
|
7
|
+
// Upsert order parameters schema
|
|
8
|
+
export const UpsertOrderParamsSchema = z.object({
|
|
9
|
+
name: z.string().optional(),
|
|
10
|
+
contact_id: z.number().optional(),
|
|
11
|
+
total_amount: z.number().optional(),
|
|
12
|
+
currency_code: z.string().optional(),
|
|
13
|
+
financial_status: z.string().optional(),
|
|
14
|
+
fulfillment_status: z.string().optional(),
|
|
15
|
+
source: z.string(),
|
|
16
|
+
source_id: z.string(),
|
|
17
|
+
order_url: z.string().optional(),
|
|
18
|
+
notes: z.string().optional(),
|
|
19
|
+
metadata: z.record(z.unknown()).optional(),
|
|
20
|
+
});
|
|
21
|
+
// Upsert order request schema (wraps order in an object)
|
|
22
|
+
export const UpsertOrderRequestSchema = z.object({
|
|
23
|
+
order: UpsertOrderParamsSchema,
|
|
24
|
+
});
|
|
25
|
+
// Upsert order response payload schema
|
|
26
|
+
export const UpsertOrderResponsePayloadSchema = z.object({
|
|
27
|
+
id: z.number(),
|
|
28
|
+
name: z.string().optional(),
|
|
29
|
+
contact_id: z.number().optional(),
|
|
30
|
+
contact_name: z.string().optional(),
|
|
31
|
+
total_amount: z.number().optional(),
|
|
32
|
+
currency_code: z.string().optional(),
|
|
33
|
+
financial_status: z.string().optional(),
|
|
34
|
+
fulfillment_status: z.string().optional(),
|
|
35
|
+
source: z.string(),
|
|
36
|
+
source_id: z.string(),
|
|
37
|
+
order_url: z.string().optional(),
|
|
38
|
+
notes: z.string().optional(),
|
|
39
|
+
metadata: z.record(z.unknown()).optional(),
|
|
40
|
+
created_at: z.string(),
|
|
41
|
+
updated_at: z.string(),
|
|
42
|
+
});
|
|
43
|
+
// Upsert order response schema
|
|
44
|
+
export const UpsertOrderResponseSchema = z.object({
|
|
45
|
+
payload: UpsertOrderResponsePayloadSchema,
|
|
46
|
+
});
|
|
47
|
+
// List orders query parameters schema
|
|
48
|
+
export const ListOrdersParamsSchema = z.object({
|
|
49
|
+
page: z.number().int().positive().optional().default(1),
|
|
50
|
+
per_page: z.number().int().positive().max(100).optional().default(25),
|
|
51
|
+
since: z.string().optional(),
|
|
52
|
+
until: z.string().optional(),
|
|
53
|
+
sort: z.string().optional(),
|
|
54
|
+
payload: z.array(z.record(z.unknown())).optional(),
|
|
55
|
+
});
|
|
56
|
+
// List orders response meta schema
|
|
57
|
+
export const OrdersMetaSchema = z.object({
|
|
58
|
+
count: z.number(),
|
|
59
|
+
current_page: z.number(),
|
|
60
|
+
per_page: z.number(),
|
|
61
|
+
total_pages: z.number(),
|
|
62
|
+
summary: z.record(z.unknown()),
|
|
63
|
+
});
|
|
64
|
+
// List orders response schema
|
|
65
|
+
export const ListOrdersResponseSchema = z.object({
|
|
66
|
+
meta: OrdersMetaSchema,
|
|
67
|
+
data: z.array(OrderSchema),
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../resources/orders/types.ts"],"names":[],"m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AG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACrE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;CAC/B,CAAC,CAAC;AAEH,8BAA8B;AAC9B,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;CAC3B,CAAC,CAAC"}
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/test.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test script for all GET endpoints in Envoy SDK
|
|
3
|
+
* Run with: npx tsx test.ts or npm run test:get
|
|
4
|
+
*/
|
|
5
|
+
import { EnvoyClient } from './index.js';
|
|
6
|
+
// Configuration - Replace with your actual credentials
|
|
7
|
+
const config = {
|
|
8
|
+
apiKey: process.env.ENVOY_API_KEY || 'your-api-key-here',
|
|
9
|
+
accountId: process.env.ENVOY_ACCOUNT_ID || 'your-account-id-here',
|
|
10
|
+
baseUrl: process.env.ENVOY_BASE_URL || 'https://envoy-crm.voltade.com',
|
|
11
|
+
};
|
|
12
|
+
async function testGetEndpoints() {
|
|
13
|
+
console.log('🚀 Initializing Envoy Client...\n');
|
|
14
|
+
const client = new EnvoyClient(config);
|
|
15
|
+
try {
|
|
16
|
+
// ========================================
|
|
17
|
+
// ORDERS API - GET ENDPOINTS
|
|
18
|
+
// ========================================
|
|
19
|
+
console.log('\n' + '='.repeat(60));
|
|
20
|
+
console.log('📦 ORDERS API - GET ENDPOINTS');
|
|
21
|
+
console.log('='.repeat(60) + '\n');
|
|
22
|
+
// Test 1: List Orders (default pagination)
|
|
23
|
+
console.log('📋 Test 1: List Orders (Default Pagination)');
|
|
24
|
+
console.log('-'.repeat(50));
|
|
25
|
+
const listResponse = await client.orders.list({
|
|
26
|
+
page: 1,
|
|
27
|
+
per_page: 10,
|
|
28
|
+
});
|
|
29
|
+
console.log('✅ Success!');
|
|
30
|
+
console.log('Meta:', JSON.stringify(listResponse.meta, null, 2));
|
|
31
|
+
console.log(`Found ${listResponse.data.length} orders`);
|
|
32
|
+
if (listResponse.data.length > 0) {
|
|
33
|
+
console.log('First order sample:', JSON.stringify(listResponse.data[0], null, 2));
|
|
34
|
+
}
|
|
35
|
+
console.log('\n');
|
|
36
|
+
// Test 2: List Orders with Filters
|
|
37
|
+
console.log('📋 Test 2: List Orders with Filters');
|
|
38
|
+
console.log('-'.repeat(50));
|
|
39
|
+
const filteredResponse = await client.orders.list({
|
|
40
|
+
page: 1,
|
|
41
|
+
per_page: 5,
|
|
42
|
+
sort: '-created_at',
|
|
43
|
+
});
|
|
44
|
+
console.log('✅ Success!');
|
|
45
|
+
console.log('Meta:', JSON.stringify(filteredResponse.meta, null, 2));
|
|
46
|
+
console.log(`Found ${filteredResponse.data.length} orders`);
|
|
47
|
+
console.log('\n');
|
|
48
|
+
// ========================================
|
|
49
|
+
// CONVERSATIONS API - GET ENDPOINTS
|
|
50
|
+
// ========================================
|
|
51
|
+
console.log('='.repeat(60));
|
|
52
|
+
console.log('💬 CONVERSATIONS API - GET ENDPOINTS');
|
|
53
|
+
console.log('='.repeat(60) + '\n');
|
|
54
|
+
// Test 3: Get Conversation
|
|
55
|
+
console.log('📋 Test 3: Get Conversation by ID');
|
|
56
|
+
console.log('-'.repeat(50));
|
|
57
|
+
// Note: Replace with an actual conversation ID from your system
|
|
58
|
+
const conversationId = 1; // Change this to a valid conversation ID
|
|
59
|
+
try {
|
|
60
|
+
const conversation = await client.conversations.get(conversationId);
|
|
61
|
+
console.log('✅ Success!');
|
|
62
|
+
console.log('Conversation ID:', conversation.id);
|
|
63
|
+
console.log('Status:', conversation.status);
|
|
64
|
+
console.log('Account ID:', conversation.account_id);
|
|
65
|
+
console.log('Inbox ID:', conversation.inbox_id);
|
|
66
|
+
console.log('Full conversation:', JSON.stringify(conversation, null, 2));
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.log('⚠️ Skipped (conversation not found or invalid ID)');
|
|
70
|
+
console.log('Error:', error.message);
|
|
71
|
+
}
|
|
72
|
+
console.log('\n');
|
|
73
|
+
// Test 4: Get Messages
|
|
74
|
+
console.log('📋 Test 4: Get Conversation Messages');
|
|
75
|
+
console.log('-'.repeat(50));
|
|
76
|
+
try {
|
|
77
|
+
const messages = await client.conversations.getMessages(conversationId);
|
|
78
|
+
console.log('✅ Success!');
|
|
79
|
+
console.log('Meta:', JSON.stringify(messages.meta, null, 2));
|
|
80
|
+
console.log(`Found ${messages.payload.length} messages`);
|
|
81
|
+
if (messages.payload.length > 0) {
|
|
82
|
+
console.log('First message:', JSON.stringify(messages.payload[0], null, 2));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.log('⚠️ Skipped (conversation not found or invalid ID)');
|
|
87
|
+
console.log('Error:', error.message);
|
|
88
|
+
}
|
|
89
|
+
console.log('\n');
|
|
90
|
+
// ========================================
|
|
91
|
+
// TEST SUMMARY
|
|
92
|
+
// ========================================
|
|
93
|
+
console.log('='.repeat(60));
|
|
94
|
+
console.log('🎉 All GET endpoint tests completed!');
|
|
95
|
+
console.log('='.repeat(60));
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error('\n' + '='.repeat(60));
|
|
99
|
+
console.error('❌ Test failed with error:');
|
|
100
|
+
console.error('='.repeat(60));
|
|
101
|
+
console.error('Error name:', error.name);
|
|
102
|
+
console.error('Error message:', error.message);
|
|
103
|
+
if (error.response) {
|
|
104
|
+
console.error('Response data:', JSON.stringify(error.response, null, 2));
|
|
105
|
+
}
|
|
106
|
+
if (error.statusCode) {
|
|
107
|
+
console.error('Status code:', error.statusCode);
|
|
108
|
+
}
|
|
109
|
+
console.error('='.repeat(60));
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Run tests
|
|
114
|
+
testGetEndpoints();
|
|
115
|
+
//# sourceMappingURL=test.js.map
|
package/dist/test.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,uDAAuD;AACvD,MAAM,MAAM,GAAG;IACb,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,mBAAmB;IACxD,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,sBAAsB;IACjE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,+BAA+B;CACvE,CAAC;AAEF,KAAK,UAAU,gBAAgB;IAC7B,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,C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AAK,CAAC,cAAc,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,YAAY;AACZ,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltade/envoy-sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A comprehensive TypeScript SDK for the Envoy API with built-in error handling and resource-based architecture",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
39
|
"prepublishOnly": "npm run clean && npm run build",
|
|
40
40
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
41
|
+
"test:get": "tsx test.ts",
|
|
41
42
|
"lint": "tsc --noEmit"
|
|
42
43
|
},
|
|
43
44
|
"keywords": [
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
76
|
"@types/node": "^20.0.0",
|
|
77
|
+
"tsx": "^4.21.0",
|
|
76
78
|
"typescript": "^5.0.0"
|
|
77
79
|
}
|
|
78
80
|
}
|