@voltade/envoy-sdk 1.2.16 → 1.3.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from "./http-client.js";
2
- import { Companies, Conversations, Inboxes, Orders } from "./resources/index.js";
2
+ import { Companies, Contacts, Conversations, Inboxes, Orders } from "./resources/index.js";
3
3
  /**
4
4
  * Configuration options for EnvoyClient
5
5
  */
@@ -43,6 +43,10 @@ export declare class EnvoyClient {
43
43
  * Companies resource for managing companies
44
44
  */
45
45
  readonly companies: Companies;
46
+ /**
47
+ * Contacts resource for managing contacts
48
+ */
49
+ readonly contacts: Contacts;
46
50
  /**
47
51
  * Conversations resource for managing conversations and messages
48
52
  */
@@ -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,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,MAAM,EACP,MAAM,sBAAsB,CAAC;AAE9B;;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,SAAS,EAAE,SAAS,CAAC;IAErC;;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;IAcrC;;;OAGG;IACH,aAAa,IAAI,UAAU;CAG5B"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,OAAO,EACP,MAAM,EACP,MAAM,sBAAsB,CAAC;AAE9B;;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,SAAS,EAAE,SAAS,CAAC;IAErC;;OAEG;IACH,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAEnC;;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;IAerC;;;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 { Companies, Conversations, Inboxes, Orders, } from "./resources/index.js";
2
+ import { Companies, Contacts, 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
@@ -36,6 +36,7 @@ export class EnvoyClient {
36
36
  this.httpClient = new HttpClient(httpConfig);
37
37
  // Initialize resources
38
38
  this.companies = new Companies(this.httpClient);
39
+ this.contacts = new Contacts(this.httpClient);
39
40
  this.conversations = new Conversations(this.httpClient);
40
41
  this.inboxes = new Inboxes(this.httpClient);
41
42
  this.orders = new Orders(this.httpClient);
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,MAAM,GACP,MAAM,sBAAsB,CAAC;AAY9B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,WAAW;IAuBtB,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,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,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"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,OAAO,EACP,MAAM,GACP,MAAM,sBAAsB,CAAC;AAY9B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,WAAW;IA4BtB,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,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,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"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Contacts resource module
3
+ * Provides functionality for managing contacts in Envoy
4
+ */
5
+ import type { HttpClient } from "../../http-client.js";
6
+ import type { Contact } from "../conversations/types.js";
7
+ import type { ContactCreateParams, ContactUpdateParams, ListContactsParams, ListContactsResponse, SearchContactsParams } from "./types.js";
8
+ /**
9
+ * Base resource class that all resource classes extend from
10
+ */
11
+ declare abstract class BaseResource {
12
+ protected readonly client: HttpClient;
13
+ constructor(client: HttpClient);
14
+ }
15
+ /**
16
+ * Contacts resource class for managing contact-related operations
17
+ */
18
+ export declare class Contacts extends BaseResource {
19
+ /**
20
+ * Create a new contact
21
+ * @param params - Contact creation parameters (inbox_id is required)
22
+ * @returns The created contact
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const contact = await client.contacts.create({
27
+ * inbox_id: 1,
28
+ * name: 'John Doe',
29
+ * email: 'john@example.com',
30
+ * phone_number: '+1234567890',
31
+ * custom_attributes: { plan: 'enterprise' }
32
+ * });
33
+ * console.log(contact.id);
34
+ * ```
35
+ */
36
+ create(params: ContactCreateParams): Promise<Contact>;
37
+ /**
38
+ * Update an existing contact
39
+ * @param contactId - ID of the contact to update
40
+ * @param params - Contact update parameters
41
+ * @returns The updated contact
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const contact = await client.contacts.update(123, {
46
+ * name: 'Jane Doe',
47
+ * email: 'jane@example.com',
48
+ * custom_attributes: { plan: 'pro' }
49
+ * });
50
+ * ```
51
+ */
52
+ update(contactId: number, params: ContactUpdateParams): Promise<Contact>;
53
+ /**
54
+ * Get a contact by ID
55
+ * @param contactId - ID of the contact
56
+ * @returns The contact details
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const contact = await client.contacts.get(123);
61
+ * console.log(contact.name, contact.email);
62
+ * ```
63
+ */
64
+ get(contactId: number): Promise<Contact>;
65
+ /**
66
+ * Delete a contact
67
+ * @param contactId - ID of the contact to delete
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * await client.contacts.delete(123);
72
+ * ```
73
+ */
74
+ delete(contactId: number): Promise<void>;
75
+ /**
76
+ * List all contacts with pagination
77
+ * @param params - Query parameters for pagination and sorting
78
+ * @returns Paginated list of contacts
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const response = await client.contacts.list({ page: 1 });
83
+ * console.log(response.payload); // Array of contacts
84
+ * ```
85
+ */
86
+ list(params?: ListContactsParams): Promise<ListContactsResponse>;
87
+ /**
88
+ * Search contacts by name, identifier, email, or phone number
89
+ * @param params - Search query and pagination parameters
90
+ * @returns Matching contacts
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const response = await client.contacts.search({
95
+ * q: 'john@example.com',
96
+ * page: 1
97
+ * });
98
+ * console.log(response.payload);
99
+ * ```
100
+ */
101
+ search(params: SearchContactsParams): Promise<ListContactsResponse>;
102
+ }
103
+ export type { ContactCreateParams, ContactUpdateParams, ListContactsParams, ListContactsResponse, SearchContactsParams, } from "./types.js";
104
+ export { ContactCreateParamsSchema, ContactUpdateParamsSchema, ListContactsParamsSchema, ListContactsResponseSchema, SearchContactsParamsSchema, } from "./types.js";
105
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../resources/contacts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACrB,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,QAAS,SAAQ,YAAY;IACxC;;;;;;;;;;;;;;;;OAgBG;IACG,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAI3D;;;;;;;;;;;;;;OAcG;IACG,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;;;;OAUG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI9C;;;;;;;;OAQG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C;;;;;;;;;;OAUG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAetE;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAgB1E;AAGD,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Contacts resource module
3
+ * Provides functionality for managing contacts 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
+ * Contacts resource class for managing contact-related operations
15
+ */
16
+ export class Contacts extends BaseResource {
17
+ /**
18
+ * Create a new contact
19
+ * @param params - Contact creation parameters (inbox_id is required)
20
+ * @returns The created contact
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const contact = await client.contacts.create({
25
+ * inbox_id: 1,
26
+ * name: 'John Doe',
27
+ * email: 'john@example.com',
28
+ * phone_number: '+1234567890',
29
+ * custom_attributes: { plan: 'enterprise' }
30
+ * });
31
+ * console.log(contact.id);
32
+ * ```
33
+ */
34
+ async create(params) {
35
+ return await this.client.post("/contacts", params);
36
+ }
37
+ /**
38
+ * Update an existing contact
39
+ * @param contactId - ID of the contact to update
40
+ * @param params - Contact update parameters
41
+ * @returns The updated contact
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const contact = await client.contacts.update(123, {
46
+ * name: 'Jane Doe',
47
+ * email: 'jane@example.com',
48
+ * custom_attributes: { plan: 'pro' }
49
+ * });
50
+ * ```
51
+ */
52
+ async update(contactId, params) {
53
+ return await this.client.put(`/contacts/${contactId}`, params);
54
+ }
55
+ /**
56
+ * Get a contact by ID
57
+ * @param contactId - ID of the contact
58
+ * @returns The contact details
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const contact = await client.contacts.get(123);
63
+ * console.log(contact.name, contact.email);
64
+ * ```
65
+ */
66
+ async get(contactId) {
67
+ return await this.client.get(`/contacts/${contactId}`);
68
+ }
69
+ /**
70
+ * Delete a contact
71
+ * @param contactId - ID of the contact to delete
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * await client.contacts.delete(123);
76
+ * ```
77
+ */
78
+ async delete(contactId) {
79
+ await this.client.delete(`/contacts/${contactId}`);
80
+ }
81
+ /**
82
+ * List all contacts with pagination
83
+ * @param params - Query parameters for pagination and sorting
84
+ * @returns Paginated list of contacts
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const response = await client.contacts.list({ page: 1 });
89
+ * console.log(response.payload); // Array of contacts
90
+ * ```
91
+ */
92
+ async list(params) {
93
+ const queryParams = {};
94
+ if (params?.page !== undefined) {
95
+ queryParams.page = params.page;
96
+ }
97
+ if (params?.sort) {
98
+ queryParams.sort = params.sort;
99
+ }
100
+ return await this.client.get("/contacts", {
101
+ params: queryParams,
102
+ });
103
+ }
104
+ /**
105
+ * Search contacts by name, identifier, email, or phone number
106
+ * @param params - Search query and pagination parameters
107
+ * @returns Matching contacts
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const response = await client.contacts.search({
112
+ * q: 'john@example.com',
113
+ * page: 1
114
+ * });
115
+ * console.log(response.payload);
116
+ * ```
117
+ */
118
+ async search(params) {
119
+ const queryParams = {
120
+ q: params.q,
121
+ };
122
+ if (params.page !== undefined) {
123
+ queryParams.page = params.page;
124
+ }
125
+ if (params.sort) {
126
+ queryParams.sort = params.sort;
127
+ }
128
+ return await this.client.get("/contacts/search", {
129
+ params: queryParams,
130
+ });
131
+ }
132
+ }
133
+ // Re-export Zod schemas
134
+ export { ContactCreateParamsSchema, ContactUpdateParamsSchema, ListContactsParamsSchema, ListContactsResponseSchema, SearchContactsParamsSchema, } from "./types.js";
135
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../resources/contacts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;GAEG;AACH,MAAe,YAAY;IACzB,YAA+B,MAAkB;QAAlB,WAAM,GAAN,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B;QACvC,MAAM,WAAW,GAAoC;YACnD,CAAC,EAAE,MAAM,CAAC,CAAC;SACZ,CAAC;QAEF,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9B,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACjC,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAuB,kBAAkB,EAAE;YACrE,MAAM,EAAE,WAAW;SACpB,CAAC,CAAC;IACL,CAAC;CACF;AAWD,wBAAwB;AACxB,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,176 @@
1
+ import { z } from "zod";
2
+ import { ContactSchema, ContactInboxSchema, type Contact, type ContactInbox } from "../conversations/types.js";
3
+ /**
4
+ * Zod Schemas for Contacts
5
+ */
6
+ export declare const ContactCreateParamsSchema: z.ZodObject<{
7
+ inbox_id: z.ZodNumber;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ email: z.ZodOptional<z.ZodString>;
10
+ phone_number: z.ZodOptional<z.ZodString>;
11
+ avatar_url: z.ZodOptional<z.ZodString>;
12
+ identifier: z.ZodOptional<z.ZodString>;
13
+ custom_attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ inbox_id: number;
16
+ name?: string | undefined;
17
+ email?: string | undefined;
18
+ avatar_url?: string | undefined;
19
+ phone_number?: string | undefined;
20
+ identifier?: string | undefined;
21
+ custom_attributes?: Record<string, unknown> | undefined;
22
+ }, {
23
+ inbox_id: number;
24
+ name?: string | undefined;
25
+ email?: string | undefined;
26
+ avatar_url?: string | undefined;
27
+ phone_number?: string | undefined;
28
+ identifier?: string | undefined;
29
+ custom_attributes?: Record<string, unknown> | undefined;
30
+ }>;
31
+ export declare const ContactUpdateParamsSchema: z.ZodObject<{
32
+ name: z.ZodOptional<z.ZodString>;
33
+ email: z.ZodOptional<z.ZodString>;
34
+ phone_number: z.ZodOptional<z.ZodString>;
35
+ avatar_url: z.ZodOptional<z.ZodString>;
36
+ identifier: z.ZodOptional<z.ZodString>;
37
+ custom_attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ name?: string | undefined;
40
+ email?: string | undefined;
41
+ avatar_url?: string | undefined;
42
+ phone_number?: string | undefined;
43
+ identifier?: string | undefined;
44
+ custom_attributes?: Record<string, unknown> | undefined;
45
+ }, {
46
+ name?: string | undefined;
47
+ email?: string | undefined;
48
+ avatar_url?: string | undefined;
49
+ phone_number?: string | undefined;
50
+ identifier?: string | undefined;
51
+ custom_attributes?: Record<string, unknown> | undefined;
52
+ }>;
53
+ export declare const ListContactsParamsSchema: z.ZodObject<{
54
+ page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
55
+ sort: z.ZodOptional<z.ZodString>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ page: number;
58
+ sort?: string | undefined;
59
+ }, {
60
+ sort?: string | undefined;
61
+ page?: number | undefined;
62
+ }>;
63
+ export declare const ListContactsResponseSchema: z.ZodObject<{
64
+ payload: z.ZodArray<z.ZodObject<{
65
+ id: z.ZodNumber;
66
+ name: z.ZodNullable<z.ZodString>;
67
+ email: z.ZodNullable<z.ZodString>;
68
+ phone_number: z.ZodNullable<z.ZodString>;
69
+ thumbnail: z.ZodString;
70
+ identifier: z.ZodNullable<z.ZodString>;
71
+ additional_attributes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
72
+ custom_attributes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
73
+ blocked: z.ZodBoolean;
74
+ customer_stage: z.ZodString;
75
+ customer_stage_explanation: z.ZodNullable<z.ZodString>;
76
+ type: z.ZodOptional<z.ZodString>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ name: string | null;
79
+ id: number;
80
+ email: string | null;
81
+ thumbnail: string;
82
+ phone_number: string | null;
83
+ identifier: string | null;
84
+ additional_attributes: Record<string, unknown>;
85
+ custom_attributes: Record<string, unknown>;
86
+ blocked: boolean;
87
+ customer_stage: string;
88
+ customer_stage_explanation: string | null;
89
+ type?: string | undefined;
90
+ }, {
91
+ name: string | null;
92
+ id: number;
93
+ email: string | null;
94
+ thumbnail: string;
95
+ phone_number: string | null;
96
+ identifier: string | null;
97
+ additional_attributes: Record<string, unknown>;
98
+ custom_attributes: Record<string, unknown>;
99
+ blocked: boolean;
100
+ customer_stage: string;
101
+ customer_stage_explanation: string | null;
102
+ type?: string | undefined;
103
+ }>, "many">;
104
+ meta: z.ZodOptional<z.ZodObject<{
105
+ count: z.ZodOptional<z.ZodNumber>;
106
+ current_page: z.ZodOptional<z.ZodNumber>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ count?: number | undefined;
109
+ current_page?: number | undefined;
110
+ }, {
111
+ count?: number | undefined;
112
+ current_page?: number | undefined;
113
+ }>>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ payload: {
116
+ name: string | null;
117
+ id: number;
118
+ email: string | null;
119
+ thumbnail: string;
120
+ phone_number: string | null;
121
+ identifier: string | null;
122
+ additional_attributes: Record<string, unknown>;
123
+ custom_attributes: Record<string, unknown>;
124
+ blocked: boolean;
125
+ customer_stage: string;
126
+ customer_stage_explanation: string | null;
127
+ type?: string | undefined;
128
+ }[];
129
+ meta?: {
130
+ count?: number | undefined;
131
+ current_page?: number | undefined;
132
+ } | undefined;
133
+ }, {
134
+ payload: {
135
+ name: string | null;
136
+ id: number;
137
+ email: string | null;
138
+ thumbnail: string;
139
+ phone_number: string | null;
140
+ identifier: string | null;
141
+ additional_attributes: Record<string, unknown>;
142
+ custom_attributes: Record<string, unknown>;
143
+ blocked: boolean;
144
+ customer_stage: string;
145
+ customer_stage_explanation: string | null;
146
+ type?: string | undefined;
147
+ }[];
148
+ meta?: {
149
+ count?: number | undefined;
150
+ current_page?: number | undefined;
151
+ } | undefined;
152
+ }>;
153
+ export declare const SearchContactsParamsSchema: z.ZodObject<{
154
+ q: z.ZodString;
155
+ page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
156
+ sort: z.ZodOptional<z.ZodString>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ page: number;
159
+ q: string;
160
+ sort?: string | undefined;
161
+ }, {
162
+ q: string;
163
+ sort?: string | undefined;
164
+ page?: number | undefined;
165
+ }>;
166
+ /**
167
+ * TypeScript Types (inferred from Zod schemas)
168
+ */
169
+ export type ContactCreateParams = z.infer<typeof ContactCreateParamsSchema>;
170
+ export type ContactUpdateParams = z.infer<typeof ContactUpdateParamsSchema>;
171
+ export type ListContactsParams = z.infer<typeof ListContactsParamsSchema>;
172
+ export type ListContactsResponse = z.infer<typeof ListContactsResponseSchema>;
173
+ export type SearchContactsParams = z.infer<typeof SearchContactsParamsSchema>;
174
+ export { ContactSchema, ContactInboxSchema };
175
+ export type { Contact, ContactInbox };
176
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../resources/contacts/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,KAAK,OAAO,EACZ,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AAGH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAkBpC,CAAC;AAGH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;EAiBpC,CAAC;AAGH,eAAO,MAAM,wBAAwB;;;;;;;;;EAGnC,CAAC;AAGH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrC,CAAC;AAGH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAIrC,CAAC;AAEH;;GAEG;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { z } from "zod";
2
+ import { ContactSchema, ContactInboxSchema, } from "../conversations/types.js";
3
+ /**
4
+ * Zod Schemas for Contacts
5
+ */
6
+ // Contact create parameters schema
7
+ export const ContactCreateParamsSchema = z.object({
8
+ inbox_id: z.number().describe("ID of the inbox"),
9
+ name: z.string().optional().describe("Name of the contact"),
10
+ email: z.string().email().optional().describe("Email of the contact"),
11
+ phone_number: z.string().optional().describe("Phone number of the contact"),
12
+ avatar_url: z
13
+ .string()
14
+ .url()
15
+ .optional()
16
+ .describe("URL to a jpeg, png file for the contact avatar"),
17
+ identifier: z
18
+ .string()
19
+ .optional()
20
+ .describe("A unique identifier for the contact in external system"),
21
+ custom_attributes: z
22
+ .record(z.unknown())
23
+ .optional()
24
+ .describe("Custom attributes for the contact"),
25
+ });
26
+ // Contact update parameters schema
27
+ export const ContactUpdateParamsSchema = z.object({
28
+ name: z.string().optional().describe("Name of the contact"),
29
+ email: z.string().email().optional().describe("Email of the contact"),
30
+ phone_number: z.string().optional().describe("Phone number of the contact"),
31
+ avatar_url: z
32
+ .string()
33
+ .url()
34
+ .optional()
35
+ .describe("URL to a jpeg, png file for the contact avatar"),
36
+ identifier: z
37
+ .string()
38
+ .optional()
39
+ .describe("A unique identifier for the contact in external system"),
40
+ custom_attributes: z
41
+ .record(z.unknown())
42
+ .optional()
43
+ .describe("Custom attributes for the contact"),
44
+ });
45
+ // List contacts parameters schema
46
+ export const ListContactsParamsSchema = z.object({
47
+ page: z.number().int().positive().optional().default(1),
48
+ sort: z.string().optional().describe("Sort order for contacts"),
49
+ });
50
+ // List contacts response schema
51
+ export const ListContactsResponseSchema = z.object({
52
+ payload: z.array(ContactSchema),
53
+ meta: z
54
+ .object({
55
+ count: z.number().optional(),
56
+ current_page: z.number().optional(),
57
+ })
58
+ .optional(),
59
+ });
60
+ // Search contacts parameters schema
61
+ export const SearchContactsParamsSchema = z.object({
62
+ q: z.string().describe("Search query (name, identifier, email, or phone)"),
63
+ page: z.number().int().positive().optional().default(1),
64
+ sort: z.string().optional().describe("Sort order for contacts"),
65
+ });
66
+ // Re-export from conversations for convenience
67
+ export { ContactSchema, ContactInboxSchema };
68
+ //# sourceMappingURL=types.js.map
@@ -0,0 +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,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4,6 +4,7 @@
4
4
  */
5
5
  export * from "./companies/index.js";
6
6
  export * from "./company-members/index.js";
7
+ export * from "./contacts/index.js";
7
8
  export * from "./conversations/index.js";
8
9
  export * from "./inboxes/index.js";
9
10
  export * from "./orders/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from "./companies/index.js";
6
6
  export * from "./company-members/index.js";
7
+ export * from "./contacts/index.js";
7
8
  export * from "./conversations/index.js";
8
9
  export * from "./inboxes/index.js";
9
10
  export * from "./orders/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltade/envoy-sdk",
3
- "version": "1.2.16",
3
+ "version": "1.3.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",