@ecodrix/erix-api 1.0.3 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodrix/erix-api",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "author": "ECODrIx Team <contact@ecodrix.com>",
5
5
  "license": "MIT",
6
6
  "description": "Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",
@@ -45,16 +45,6 @@
45
45
  "src",
46
46
  "schema"
47
47
  ],
48
- "scripts": {
49
- "build": "tsup",
50
- "build:final": "pnpm clear && pnpm build",
51
- "dev": "tsup --watch",
52
- "clear": "rm -rf dist",
53
- "lint": "biome lint .",
54
- "format": "biome format --write .",
55
- "check": "biome check --write .",
56
- "prepublishOnly": "pnpm build"
57
- },
58
48
  "dependencies": {
59
49
  "axios": "^1.7.0",
60
50
  "axios-retry": "^4.5.0",
@@ -64,11 +54,21 @@
64
54
  "socket.io-client": "^4.7.5"
65
55
  },
66
56
  "devDependencies": {
57
+ "@biomejs/biome": "^1.9.4",
67
58
  "@types/node": "^25.5.0",
68
59
  "tsup": "^8.0.2",
69
60
  "typescript": "^5.4.5"
70
61
  },
71
62
  "publishConfig": {
72
63
  "access": "public"
64
+ },
65
+ "scripts": {
66
+ "build": "tsup",
67
+ "build:final": "pnpm clear && pnpm build",
68
+ "dev": "tsup --watch",
69
+ "clear": "rm -rf dist",
70
+ "lint": "biome lint .",
71
+ "format": "biome format --write .",
72
+ "check": "biome check --write ."
73
73
  }
74
- }
74
+ }
package/src/cli.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import repl from "node:repl";
1
2
  import { Command } from "commander";
2
3
  import dotenv from "dotenv";
3
4
  import pc from "picocolors";
4
- import repl from "node:repl";
5
5
  import { Ecodrix } from "./core";
6
6
 
7
7
  // Setup environment
@@ -26,9 +26,7 @@ function getClient(options: any): Ecodrix {
26
26
 
27
27
  if (!apiKey) {
28
28
  console.error(pc.red("Error: API Key is missing."));
29
- console.log(
30
- pc.yellow("Set ECOD_API_KEY environment variable or use --key <key>"),
31
- );
29
+ console.log(pc.yellow("Set ECOD_API_KEY environment variable or use --key <key>"));
32
30
  process.exit(1);
33
31
  }
34
32
 
@@ -57,13 +55,9 @@ program
57
55
  const me = (await ecod.request("GET", "/api/saas/me/profile")) as any;
58
56
  console.log(pc.green("✔ Authenticated successfully!"));
59
57
  console.log(`${pc.bold("User ID:")} ${me.id}`);
60
- console.log(
61
- `${pc.bold("Organisation:")} ${me.organisation?.name || "N/A"}`,
62
- );
58
+ console.log(`${pc.bold("Organisation:")} ${me.organisation?.name || "N/A"}`);
63
59
  if (globalOptions.client) {
64
- console.log(
65
- `${pc.bold("Tenant Code:")} ${pc.magenta(globalOptions.client)}`,
66
- );
60
+ console.log(`${pc.bold("Tenant Code:")} ${pc.magenta(globalOptions.client)}`);
67
61
  }
68
62
  } catch (error: any) {
69
63
  console.error(pc.red("✖ Authentication failed"));
@@ -73,9 +67,7 @@ program
73
67
  });
74
68
 
75
69
  // --- WHATSAPP ---
76
- const whatsapp = program
77
- .command("whatsapp")
78
- .description("WhatsApp Business API operations");
70
+ const whatsapp = program.command("whatsapp").description("WhatsApp Business API operations");
79
71
 
80
72
  whatsapp
81
73
  .command("send-template")
@@ -121,7 +113,7 @@ crm
121
113
  const ecod = getClient(globalOptions);
122
114
 
123
115
  try {
124
- const limit = parseInt(options.limit);
116
+ const limit = Number.parseInt(options.limit);
125
117
  console.log(pc.cyan(`Fetching last ${limit} leads...`));
126
118
 
127
119
  const queryParams: any = { limit };
@@ -179,7 +171,7 @@ crm
179
171
  ID: p.id || p._id,
180
172
  Name: p.name,
181
173
  Default: p.isDefault ? "Yes" : "No",
182
- Stages: p.stages?.length || 0
174
+ Stages: p.stages?.length || 0,
183
175
  })),
184
176
  );
185
177
  } catch (error: any) {
@@ -204,13 +196,12 @@ analytics
204
196
  const response: any = await ecod.crm.analytics.overview({ range: options.range });
205
197
  const data = response.data || response;
206
198
 
207
- console.log("\n" + pc.bold("OVERVIEW KPIs:"));
199
+ console.log(`\n${pc.bold("OVERVIEW KPIs:")}`);
208
200
  console.log(`Total Leads: ${pc.green(data.totalLeads || 0)}`);
209
- console.log(`Open Value: ${pc.yellow("$" + (data.openValue || 0).toLocaleString())}`);
210
- console.log(`Won Revenue: ${pc.green("$" + (data.wonRevenue || 0).toLocaleString())}`);
201
+ console.log(`Open Value: ${pc.yellow(`$${(data.openValue || 0).toLocaleString()}`)}`);
202
+ console.log(`Won Revenue: ${pc.green(`$${(data.wonRevenue || 0).toLocaleString()}`)}`);
211
203
  console.log(`Avg Score: ${pc.blue(data.avgScore?.toFixed(1) || 0)}`);
212
- console.log(`Conversion: ${pc.magenta((data.conversionRate || 0).toFixed(2) + "%")}\n`);
213
-
204
+ console.log(`Conversion: ${pc.magenta(`${(data.conversionRate || 0).toFixed(2)}%`)}\n`);
214
205
  } catch (error: any) {
215
206
  console.error(pc.red("✖ Failed to fetch analytics overview"));
216
207
  console.error(pc.dim(error.message));
@@ -218,9 +209,7 @@ analytics
218
209
  });
219
210
 
220
211
  // --- WEBHOOKS ---
221
- const webhooks = program
222
- .command("webhooks")
223
- .description("Webhook utility tools");
212
+ const webhooks = program.command("webhooks").description("Webhook utility tools");
224
213
 
225
214
  webhooks
226
215
  .command("verify")
@@ -286,23 +275,23 @@ _erix_completions() {
286
275
  opts="whoami whatsapp crm analytics webhooks shell completion"
287
276
 
288
277
  if [[ \${COMP_CWORD} -eq 1 ]] ; then
289
- COMPREPLY=( \$(compgen -W "\${opts}" -- \${cur}) )
278
+ COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
290
279
  return 0
291
280
  fi
292
281
 
293
282
  # Simple sub-command completion
294
283
  case "\${COMP_WORDS[1]}" in
295
284
  whatsapp)
296
- COMPREPLY=( \$(compgen -W "send-template" -- \${cur}) )
285
+ COMPREPLY=( $(compgen -W "send-template" -- \${cur}) )
297
286
  ;;
298
287
  crm)
299
- COMPREPLY=( \$(compgen -W "leads pipelines" -- \${cur}) )
288
+ COMPREPLY=( $(compgen -W "leads pipelines" -- \${cur}) )
300
289
  ;;
301
290
  analytics)
302
- COMPREPLY=( \$(compgen -W "overview" -- \${cur}) )
291
+ COMPREPLY=( $(compgen -W "overview" -- \${cur}) )
303
292
  ;;
304
293
  webhooks)
305
- COMPREPLY=( \$(compgen -W "verify" -- \${cur}) )
294
+ COMPREPLY=( $(compgen -W "verify" -- \${cur}) )
306
295
  ;;
307
296
  esac
308
297
  }
@@ -310,9 +299,7 @@ complete -F _erix_completions erix
310
299
  `;
311
300
  console.log(script.trim());
312
301
  console.error(pc.yellow('\n# To enable, run: eval "$(erix completion)"'));
313
- console.error(
314
- pc.dim("# Or add it to your ~/.bashrc: erix completion >> ~/.bashrc"),
315
- );
302
+ console.error(pc.dim("# Or add it to your ~/.bashrc: erix completion >> ~/.bashrc"));
316
303
  });
317
304
 
318
305
  program.parse();
package/src/core.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import axios, { type AxiosInstance, type Method } from "axios";
2
2
  import axiosRetry from "axios-retry";
3
- import { AuthenticationError, APIError } from "./error";
4
- import { WhatsApp } from "./resources/whatsapp";
3
+ import { type Socket, io } from "socket.io-client";
4
+ import { APIError, AuthenticationError } from "./error";
5
5
  import { CRM } from "./resources/crm";
6
- import { MediaResource } from "./resources/media";
7
- import { Meetings } from "./resources/meet";
8
- import { Notifications } from "./resources/notifications";
9
6
  import { EmailResource } from "./resources/email";
10
7
  import { EventsResource } from "./resources/events";
11
- import { Webhooks } from "./resources/webhooks";
12
- import { Storage } from "./resources/storage";
13
- import { Marketing } from "./resources/marketing";
14
8
  import { Health } from "./resources/health";
9
+ import { Marketing } from "./resources/marketing";
10
+ import { MediaResource } from "./resources/media";
11
+ import { Meetings } from "./resources/meet";
12
+ import { Notifications } from "./resources/notifications";
15
13
  import { Queue } from "./resources/queue";
16
- import { io, type Socket } from "socket.io-client";
14
+ import { Storage } from "./resources/storage";
15
+ import { Webhooks } from "./resources/webhooks";
16
+ import { WhatsApp } from "./resources/whatsapp";
17
17
 
18
18
  declare const process: any;
19
19
 
@@ -118,8 +118,7 @@ export class Ecodrix {
118
118
  const baseUrl = options.baseUrl || "https://api.ecodrix.com";
119
119
  const socketUrl = options.socketUrl || baseUrl;
120
120
 
121
- const isBrowser =
122
- typeof window !== "undefined" && typeof window.document !== "undefined";
121
+ const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
123
122
  const runtime = isBrowser
124
123
  ? "browser"
125
124
  : typeof process !== "undefined"
@@ -152,8 +151,7 @@ export class Ecodrix {
152
151
  retryDelay: axiosRetry.exponentialDelay,
153
152
  retryCondition: (error) => {
154
153
  return (
155
- axiosRetry.isNetworkOrIdempotentRequestError(error) ||
156
- error.response?.status === 429
154
+ axiosRetry.isNetworkOrIdempotentRequestError(error) || error.response?.status === 429
157
155
  );
158
156
  },
159
157
  });
@@ -269,9 +267,7 @@ export class Ecodrix {
269
267
  } catch (error: any) {
270
268
  if (error.response) {
271
269
  throw new APIError(
272
- error.response.data?.message ||
273
- error.response.data?.error ||
274
- "Raw Execution Failed",
270
+ error.response.data?.message || error.response.data?.error || "Raw Execution Failed",
275
271
  error.response.status,
276
272
  error.response.data?.code,
277
273
  );
package/src/index.ts CHANGED
@@ -1,33 +1,31 @@
1
1
  export { Ecodrix, type EcodrixOptions } from "./core";
2
2
  export * from "./error";
3
-
4
- // Resource Type Exports
5
- export * from "./resources/whatsapp/index";
6
- export * from "./resources/whatsapp/messages";
7
- export * from "./resources/whatsapp/conversations";
8
- export * from "./resources/whatsapp/templates";
9
- export * from "./resources/whatsapp/broadcasts";
10
-
3
+ export * from "./resources/crm/activities";
4
+ export * from "./resources/crm/analytics";
5
+ export * from "./resources/crm/automationDashboard";
6
+ export * from "./resources/crm/automations";
11
7
  export * from "./resources/crm/index";
12
8
  export * from "./resources/crm/leads";
13
- export * from "./resources/crm/automations";
9
+ export * from "./resources/crm/payments";
14
10
  export * from "./resources/crm/pipelines";
15
- export * from "./resources/crm/activities";
16
- export * from "./resources/crm/analytics";
17
- export * from "./resources/crm/sequences";
18
11
  export * from "./resources/crm/scoring";
19
- export * from "./resources/crm/payments";
20
- export * from "./resources/crm/automationDashboard";
21
- export * from "./resources/meet";
22
- export * from "./resources/media";
23
- export * from "./resources/notifications";
12
+ export * from "./resources/crm/sequences";
24
13
  export * from "./resources/email";
25
14
  export * from "./resources/events";
26
- export * from "./resources/webhooks";
27
- export * from "./resources/storage";
28
- export * from "./resources/marketing";
29
15
  export * from "./resources/health";
16
+ export * from "./resources/marketing";
17
+ export * from "./resources/media";
18
+ export * from "./resources/meet";
19
+ export * from "./resources/notifications";
30
20
  export * from "./resources/queue";
21
+ export * from "./resources/storage";
22
+ export * from "./resources/webhooks";
23
+ export * from "./resources/whatsapp/broadcasts";
24
+ export * from "./resources/whatsapp/conversations";
25
+ // Resource Type Exports
26
+ export * from "./resources/whatsapp/index";
27
+ export * from "./resources/whatsapp/messages";
28
+ export * from "./resources/whatsapp/templates";
31
29
 
32
30
  // Export the main client also as default for better ergonomics
33
31
  import { Ecodrix } from "./core";
package/src/resource.ts CHANGED
@@ -17,11 +17,7 @@ export interface RequestOptions extends AxiosRequestConfig {
17
17
  export abstract class APIResource {
18
18
  public constructor(protected readonly client: AxiosInstance) {}
19
19
 
20
- protected async post<T>(
21
- url: string,
22
- data?: any,
23
- options?: RequestOptions,
24
- ): Promise<T> {
20
+ protected async post<T>(url: string, data?: any, options?: RequestOptions): Promise<T> {
25
21
  try {
26
22
  const config = this.buildConfig(options);
27
23
  const response = await this.client.post(url, data, config);
@@ -41,11 +37,7 @@ export abstract class APIResource {
41
37
  }
42
38
  }
43
39
 
44
- protected async patch<T>(
45
- url: string,
46
- data?: any,
47
- options?: RequestOptions,
48
- ): Promise<T> {
40
+ protected async patch<T>(url: string, data?: any, options?: RequestOptions): Promise<T> {
49
41
  try {
50
42
  const config = this.buildConfig(options);
51
43
  const response = await this.client.patch(url, data, config);
@@ -55,11 +47,7 @@ export abstract class APIResource {
55
47
  }
56
48
  }
57
49
 
58
- protected async put<T>(
59
- url: string,
60
- data?: any,
61
- options?: RequestOptions,
62
- ): Promise<T> {
50
+ protected async put<T>(url: string, data?: any, options?: RequestOptions): Promise<T> {
63
51
  try {
64
52
  const config = this.buildConfig(options);
65
53
  const response = await this.client.put(url, data, config);
@@ -69,10 +57,7 @@ export abstract class APIResource {
69
57
  }
70
58
  }
71
59
 
72
- protected async deleteRequest<T>(
73
- url: string,
74
- options?: RequestOptions,
75
- ): Promise<T> {
60
+ protected async deleteRequest<T>(url: string, options?: RequestOptions): Promise<T> {
76
61
  try {
77
62
  const config = this.buildConfig(options);
78
63
  const response = await this.client.delete(url, config);
@@ -82,9 +67,7 @@ export abstract class APIResource {
82
67
  }
83
68
  }
84
69
 
85
- private buildConfig(
86
- options?: RequestOptions,
87
- ): AxiosRequestConfig | undefined {
70
+ private buildConfig(options?: RequestOptions): AxiosRequestConfig | undefined {
88
71
  if (!options) return undefined;
89
72
 
90
73
  const config: AxiosRequestConfig = { ...options };
@@ -100,9 +83,7 @@ export abstract class APIResource {
100
83
  private handleError(error: any): never {
101
84
  if (error.response) {
102
85
  throw new APIError(
103
- error.response.data?.message ||
104
- error.response.data?.error ||
105
- "API Request Failed",
86
+ error.response.data?.message || error.response.data?.error || "API Request Failed",
106
87
  error.response.status,
107
88
  error.response.data?.code,
108
89
  );
@@ -70,7 +70,7 @@ export class Activities extends APIResource {
70
70
  * List specific activities (filtered by type).
71
71
  */
72
72
  async list<T = any>(leadId: string, params?: { type?: string; page?: number; limit?: number }) {
73
- return this.get<T>(`/api/saas/crm/activities`, { params: { leadId, ...params } } as any);
73
+ return this.get<T>("/api/saas/crm/activities", { params: { leadId, ...params } } as any);
74
74
  }
75
75
 
76
76
  /**
@@ -76,7 +76,7 @@ export class Automations extends APIResource {
76
76
  limit?: number;
77
77
  startDate?: string;
78
78
  endDate?: string;
79
- }
79
+ },
80
80
  ) {
81
81
  return this.get<T>(`/api/saas/crm/automations/${ruleId}/enrollments`, { params });
82
82
  }
@@ -92,14 +92,20 @@ export class Automations extends APIResource {
92
92
  * Pause an enrollment.
93
93
  */
94
94
  async pauseEnrollment<T = any>(ruleId: string, enrollmentId: string) {
95
- return this.post<T>(`/api/saas/crm/automations/${ruleId}/enrollments/${enrollmentId}/pause`, {});
95
+ return this.post<T>(
96
+ `/api/saas/crm/automations/${ruleId}/enrollments/${enrollmentId}/pause`,
97
+ {},
98
+ );
96
99
  }
97
100
 
98
101
  /**
99
102
  * Resume an enrollment.
100
103
  */
101
104
  async resumeEnrollment<T = any>(ruleId: string, enrollmentId: string) {
102
- return this.post<T>(`/api/saas/crm/automations/${ruleId}/enrollments/${enrollmentId}/resume`, {});
105
+ return this.post<T>(
106
+ `/api/saas/crm/automations/${ruleId}/enrollments/${enrollmentId}/resume`,
107
+ {},
108
+ );
103
109
  }
104
110
 
105
111
  /**
@@ -1,13 +1,13 @@
1
- import { Leads } from "./leads";
2
- import { Pipelines } from "./pipelines";
1
+ import type { AxiosInstance } from "axios";
3
2
  import { Activities } from "./activities";
4
3
  import { Analytics } from "./analytics";
4
+ import { AutomationDashboard } from "./automationDashboard";
5
5
  import { Automations } from "./automations";
6
- import { Sequences } from "./sequences";
7
- import { Scoring } from "./scoring";
6
+ import { Leads } from "./leads";
8
7
  import { Payments } from "./payments";
9
- import { AutomationDashboard } from "./automationDashboard";
10
- import type { AxiosInstance } from "axios";
8
+ import { Pipelines } from "./pipelines";
9
+ import { Scoring } from "./scoring";
10
+ import { Sequences } from "./sequences";
11
11
 
12
12
  export class CRM {
13
13
  public leads: Leads;
@@ -114,13 +114,13 @@ export class Leads extends APIResource {
114
114
  */
115
115
  async createMany(leads: CreateLeadParams[], chunkSize = 50): Promise<any[]> {
116
116
  const results: any[] = [];
117
-
117
+
118
118
  for (let i = 0; i < leads.length; i += chunkSize) {
119
119
  const chunk = leads.slice(i, i + chunkSize);
120
-
120
+
121
121
  const chunkPromises = chunk.map((lead) => this.create(lead));
122
122
  const chunkResults = await Promise.allSettled(chunkPromises);
123
-
123
+
124
124
  for (const res of chunkResults) {
125
125
  if (res.status === "fulfilled") {
126
126
  results.push(res.value);
@@ -149,7 +149,7 @@ export class Leads extends APIResource {
149
149
  * @returns Paginated list of Lead documents.
150
150
  */
151
151
  async list<T = any>(params?: ListLeadsParams) {
152
- let queryParams = { ...params } as any;
152
+ const queryParams = { ...params } as any;
153
153
  if (Array.isArray(queryParams.tags)) {
154
154
  queryParams.tags = queryParams.tags.join(",");
155
155
  }
@@ -159,7 +159,7 @@ export class Leads extends APIResource {
159
159
  /**
160
160
  * Auto-paginating iterator for leads.
161
161
  * Seamlessly fetches leads page by page as you iterate.
162
- *
162
+ *
163
163
  * @example
164
164
  * ```typescript
165
165
  * for await (const lead of ecod.crm.leads.listAutoPaging<Lead>()) {
@@ -173,9 +173,9 @@ export class Leads extends APIResource {
173
173
 
174
174
  while (hasMore) {
175
175
  const response: any = await this.list<any>({ ...params, page: currentPage });
176
-
176
+
177
177
  const items = Array.isArray(response.data) ? response.data : response || [];
178
-
178
+
179
179
  if (items.length === 0) {
180
180
  hasMore = false;
181
181
  break;
@@ -223,7 +223,9 @@ export class Leads extends APIResource {
223
223
  * @param refValue - Reference value.
224
224
  */
225
225
  async retrieveByRef<T = any>(refKey: string, refValue: string) {
226
- return this.get<T>(`/api/services/leads/ref/${encodeURIComponent(refKey)}/${encodeURIComponent(refValue)}`);
226
+ return this.get<T>(
227
+ `/api/services/leads/ref/${encodeURIComponent(refKey)}/${encodeURIComponent(refValue)}`,
228
+ );
227
229
  }
228
230
 
229
231
  /**
@@ -239,7 +241,7 @@ export class Leads extends APIResource {
239
241
 
240
242
  /**
241
243
  * Move a lead to a new stage in a pipeline.
242
- *
244
+ *
243
245
  * @param leadId - ID of the lead.
244
246
  * @param stageId - Target stage ID.
245
247
  */
@@ -249,7 +251,7 @@ export class Leads extends APIResource {
249
251
 
250
252
  /**
251
253
  * Convert a lead (mark as won or lost with reason).
252
- *
254
+ *
253
255
  * @param leadId - ID of the lead.
254
256
  * @param outcome - "won" | "lost"
255
257
  * @param reason - Reason for the outcome.
@@ -260,7 +262,7 @@ export class Leads extends APIResource {
260
262
 
261
263
  /**
262
264
  * Update the tags of a lead.
263
- *
265
+ *
264
266
  * @param leadId - ID of the lead.
265
267
  * @param options - Tags to add or remove.
266
268
  */
@@ -270,7 +272,7 @@ export class Leads extends APIResource {
270
272
 
271
273
  /**
272
274
  * Recalculate lead score based on activities and interactions.
273
- *
275
+ *
274
276
  * @param leadId - ID of the lead.
275
277
  */
276
278
  async recalculateScore<T = any>(leadId: string) {
@@ -279,11 +281,14 @@ export class Leads extends APIResource {
279
281
 
280
282
  /**
281
283
  * Update embedded metadata/references of a lead without touching core fields.
282
- *
284
+ *
283
285
  * @param leadId - ID of the lead.
284
286
  * @param metadata - Metadata object indicating { refs, extra }
285
287
  */
286
- async updateMetadata<T = any>(leadId: string, metadata: { refs?: Record<string, any>; extra?: Record<string, any> }) {
288
+ async updateMetadata<T = any>(
289
+ leadId: string,
290
+ metadata: { refs?: Record<string, any>; extra?: Record<string, any> },
291
+ ) {
287
292
  return this.patch<T>(`/api/services/leads/${leadId}/metadata`, metadata);
288
293
  }
289
294
 
@@ -305,7 +310,7 @@ export class Leads extends APIResource {
305
310
 
306
311
  /**
307
312
  * Bulk archive multiple leads.
308
- *
313
+ *
309
314
  * @param ids - Array of lead IDs to archive.
310
315
  */
311
316
  async bulkDelete(ids: string[]) {
@@ -4,7 +4,13 @@ export class Payments extends APIResource {
4
4
  /**
5
5
  * Record an inbound payment against a lead or appointment.
6
6
  */
7
- async capture<T = any>(payload: { leadId: string; amount: number; currency?: string; description?: string; appointmentId?: string }) {
7
+ async capture<T = any>(payload: {
8
+ leadId: string;
9
+ amount: number;
10
+ currency?: string;
11
+ description?: string;
12
+ appointmentId?: string;
13
+ }) {
8
14
  return this.post<T>("/api/saas/crm/payments/capture", payload);
9
15
  }
10
16
  }
@@ -96,7 +96,9 @@ export class Pipelines extends APIResource {
96
96
  * Change the order of stages inside the pipeline.
97
97
  */
98
98
  async reorderStages<T = any>(pipelineId: string, orderArray: string[]) {
99
- return this.put<T>(`/api/saas/crm/pipelines/${pipelineId}/stages/reorder`, { order: orderArray });
99
+ return this.put<T>(`/api/saas/crm/pipelines/${pipelineId}/stages/reorder`, {
100
+ order: orderArray,
101
+ });
100
102
  }
101
103
 
102
104
  /**
@@ -4,7 +4,11 @@ export class Sequences extends APIResource {
4
4
  /**
5
5
  * Manually enroll a lead in a drip sequence (automation rule).
6
6
  */
7
- async enroll<T = any>(payload: { leadId: string; ruleId: string; variables?: Record<string, any> }) {
7
+ async enroll<T = any>(payload: {
8
+ leadId: string;
9
+ ruleId: string;
10
+ variables?: Record<string, any>;
11
+ }) {
8
12
  return this.post<T>("/api/saas/crm/sequences/enroll", payload);
9
13
  }
10
14
 
@@ -1,6 +1,6 @@
1
1
  import type { AxiosInstance } from "axios";
2
- import { APIResource } from "../resource";
3
2
  import { APIError } from "../error";
3
+ import { APIResource } from "../resource";
4
4
 
5
5
  /**
6
6
  * Payload to send a high-throughput email campaign.
@@ -14,7 +14,6 @@ export interface SendCampaignPayload {
14
14
  html: string;
15
15
  }
16
16
 
17
-
18
17
  /**
19
18
  * Interface representing the result of a campaign dispatch.
20
19
  */
@@ -31,9 +30,7 @@ export class EmailResource extends APIResource {
31
30
  * @param payload - The campaign details (recipients, subject, html).
32
31
  * @returns The dispatch result.
33
32
  */
34
- async sendEmailCampaign(
35
- payload: SendCampaignPayload,
36
- ): Promise<CampaignResult> {
33
+ async sendEmailCampaign(payload: SendCampaignPayload): Promise<CampaignResult> {
37
34
  return this.post<CampaignResult>("/api/saas/emails/campaign", payload);
38
35
  }
39
36
 
@@ -105,7 +105,10 @@ export class EventsResource extends APIResource {
105
105
  * Useful when introducing new granular triggers.
106
106
  */
107
107
  async assign(payload: AssignEventPayload): Promise<{ success: boolean; data: EventDefinition }> {
108
- return this.post<{ success: boolean; data: EventDefinition }>("/api/saas/events/assign", payload);
108
+ return this.post<{ success: boolean; data: EventDefinition }>(
109
+ "/api/saas/events/assign",
110
+ payload,
111
+ );
109
112
  }
110
113
 
111
114
  /**
@@ -119,7 +122,9 @@ export class EventsResource extends APIResource {
119
122
  * Deactivate multiple custom event assignments simultaneously.
120
123
  */
121
124
  async unassignBulk(names: string[]): Promise<{ success: boolean; message: string }> {
122
- return this.post<{ success: boolean; message: string }>("/api/saas/events/unassign/bulk", { names });
125
+ return this.post<{ success: boolean; message: string }>("/api/saas/events/unassign/bulk", {
126
+ names,
127
+ });
123
128
  }
124
129
 
125
130
  /**
@@ -142,7 +147,11 @@ export class EventsResource extends APIResource {
142
147
  /**
143
148
  * Create or upsert a custom event definition.
144
149
  */
145
- async createCustomEvent<T = any>(payload: { name: string; displayName: string; description?: string }) {
150
+ async createCustomEvent<T = any>(payload: {
151
+ name: string;
152
+ displayName: string;
153
+ description?: string;
154
+ }) {
146
155
  return this.post<T>("/api/saas/crm/custom-events", payload);
147
156
  }
148
157
 
@@ -39,7 +39,9 @@ export class Health extends APIResource {
39
39
  * Global platform health check.
40
40
  */
41
41
  async system(): Promise<SystemHealth> {
42
- const res = await this.get<{ data: SystemHealth }>("/api/saas/health", { headers: { accept: "application/json" } });
42
+ const res = await this.get<{ data: SystemHealth }>("/api/saas/health", {
43
+ headers: { accept: "application/json" },
44
+ });
43
45
  return res.data;
44
46
  }
45
47