@ecodrix/erix-api 1.0.1 → 1.0.4

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.
Files changed (41) hide show
  1. package/dist/cli.js +38 -0
  2. package/dist/index.d.cts +1979 -0
  3. package/dist/index.d.ts +1173 -313
  4. package/dist/ts/browser/index.global.js +14 -14
  5. package/dist/ts/browser/index.global.js.map +1 -1
  6. package/dist/ts/cjs/index.cjs +1 -1
  7. package/dist/ts/cjs/index.cjs.map +1 -1
  8. package/dist/ts/cjs/index.d.cts +1173 -313
  9. package/dist/ts/esm/index.d.ts +1173 -313
  10. package/dist/ts/esm/index.js +1 -1
  11. package/dist/ts/esm/index.js.map +1 -1
  12. package/package.json +18 -13
  13. package/src/cli.ts +305 -0
  14. package/src/core.ts +28 -12
  15. package/src/index.ts +22 -8
  16. package/src/resource.ts +21 -1
  17. package/src/resources/crm/activities.ts +89 -0
  18. package/src/resources/crm/analytics.ts +89 -0
  19. package/src/resources/crm/automationDashboard.ts +24 -0
  20. package/src/resources/crm/automations.ts +151 -0
  21. package/src/resources/crm/index.ts +25 -1
  22. package/src/resources/crm/leads.ts +178 -45
  23. package/src/resources/crm/payments.ts +16 -0
  24. package/src/resources/crm/pipelines.ts +119 -0
  25. package/src/resources/crm/scoring.ts +33 -0
  26. package/src/resources/crm/sequences.ts +28 -0
  27. package/src/resources/email.ts +2 -5
  28. package/src/resources/events.ts +52 -2
  29. package/src/resources/health.ts +63 -0
  30. package/src/resources/marketing.ts +111 -0
  31. package/src/resources/media.ts +1 -4
  32. package/src/resources/meet.ts +12 -2
  33. package/src/resources/notifications.ts +30 -0
  34. package/src/resources/queue.ts +39 -0
  35. package/src/resources/storage.ts +72 -0
  36. package/src/resources/webhooks.ts +3 -8
  37. package/src/resources/whatsapp/broadcasts.ts +31 -0
  38. package/src/resources/whatsapp/conversations.ts +39 -9
  39. package/src/resources/whatsapp/index.ts +20 -2
  40. package/src/resources/whatsapp/messages.ts +24 -0
  41. package/src/resources/whatsapp/templates.ts +109 -0
@@ -122,6 +122,30 @@ export class Messages extends APIResource {
122
122
  });
123
123
  }
124
124
 
125
+ /**
126
+ * Star or unstar a message.
127
+ *
128
+ * @param messageId - The ID of the message.
129
+ * @param isStarred - Boolean indicating whether to star or unstar.
130
+ */
131
+ async star<T = any>(messageId: string, isStarred: boolean) {
132
+ return this.post<T>(`/api/saas/chat/messages/${messageId}/star`, {
133
+ isStarred,
134
+ });
135
+ }
136
+
137
+ /**
138
+ * React to a message with an emoji.
139
+ *
140
+ * @param messageId - The ID of the message.
141
+ * @param reaction - The emoji (e.g. "👍") to react with, or empty string to remove.
142
+ */
143
+ async react<T = any>(messageId: string, reaction: string) {
144
+ return this.post<T>(`/api/saas/chat/messages/${messageId}/react`, {
145
+ reaction,
146
+ });
147
+ }
148
+
125
149
  /**
126
150
  * Mark all messages in a conversation as read (double-tick).
127
151
  *
@@ -0,0 +1,109 @@
1
+ import { APIResource } from "../../resource";
2
+
3
+ export interface TemplateMapping {
4
+ mappings: any[];
5
+ onEmptyVariable: string;
6
+ }
7
+
8
+ export class Templates extends APIResource {
9
+ /**
10
+ * List all templates from the tenant database.
11
+ */
12
+ async list<T = any>(params?: { status?: string; mappingStatus?: string; channel?: string }) {
13
+ return this.get<T>("/api/saas/whatsapp/templates", { params } as any);
14
+ }
15
+
16
+ /**
17
+ * Synchronize templates from Meta API.
18
+ */
19
+ async sync<T = any>() {
20
+ return this.post<T>("/api/saas/whatsapp/templates/sync", {});
21
+ }
22
+
23
+ /**
24
+ * Get template details.
25
+ */
26
+ async retrieve<T = any>(templateIdentifier: string) {
27
+ return this.get<T>(`/api/saas/whatsapp/templates/${encodeURIComponent(templateIdentifier)}`);
28
+ }
29
+
30
+ /**
31
+ * Create a new template manually.
32
+ */
33
+ async create<T = any>(payload: any) {
34
+ return this.post<T>("/api/saas/whatsapp/templates", payload);
35
+ }
36
+
37
+ /**
38
+ * Update an existing template.
39
+ */
40
+ async update<T = any>(templateId: string, payload: any) {
41
+ return this.put<T>(`/api/saas/whatsapp/templates/${templateId}`, payload);
42
+ }
43
+
44
+ /**
45
+ * Delete a template.
46
+ */
47
+ async deleteTemplate<T = any>(templateName: string, force?: boolean) {
48
+ return this.deleteRequest<T>(
49
+ `/api/saas/whatsapp/templates/${encodeURIComponent(templateName)}${force ? "?force=true" : ""}`,
50
+ );
51
+ }
52
+
53
+ /**
54
+ * List curated mapping config options.
55
+ */
56
+ async mappingConfig<T = any>() {
57
+ return this.get<T>("/api/saas/whatsapp/templates/mapping/config");
58
+ }
59
+
60
+ /**
61
+ * List CRM collections for variable mapping.
62
+ */
63
+ async collections<T = any>() {
64
+ return this.get<T>("/api/saas/whatsapp/templates/collections");
65
+ }
66
+
67
+ /**
68
+ * List CRM fields for a collection.
69
+ */
70
+ async collectionFields<T = any>(collectionName: string) {
71
+ return this.get<T>(
72
+ `/api/saas/whatsapp/templates/collections/${encodeURIComponent(collectionName)}/fields`,
73
+ );
74
+ }
75
+
76
+ /**
77
+ * Update variable mappings for a template.
78
+ */
79
+ async updateMapping<T = any>(templateName: string, payload: TemplateMapping) {
80
+ return this.put<T>(
81
+ `/api/saas/whatsapp/templates/${encodeURIComponent(templateName)}/mapping`,
82
+ payload,
83
+ );
84
+ }
85
+
86
+ /**
87
+ * Validate mapping readiness.
88
+ */
89
+ async validate<T = any>(templateName: string) {
90
+ return this.get<T>(`/api/saas/whatsapp/templates/${encodeURIComponent(templateName)}/validate`);
91
+ }
92
+
93
+ /**
94
+ * Preview a template resolution.
95
+ */
96
+ async preview<T = any>(templateName: string, context: { lead?: any; vars?: any }) {
97
+ return this.post<T>(
98
+ `/api/saas/whatsapp/templates/${encodeURIComponent(templateName)}/preview`,
99
+ { context },
100
+ );
101
+ }
102
+
103
+ /**
104
+ * Check automation usage of a template.
105
+ */
106
+ async checkUsage<T = any>(templateName: string) {
107
+ return this.get<T>(`/api/saas/whatsapp/templates/${encodeURIComponent(templateName)}/usage`);
108
+ }
109
+ }