@sendmailos/sdk 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -391,6 +391,41 @@ interface WorkflowStatusResponse {
391
391
  status: WorkflowStatus;
392
392
  };
393
393
  }
394
+ interface Pixel$1 {
395
+ id: string;
396
+ name: string;
397
+ domain: string;
398
+ token: string;
399
+ active: boolean;
400
+ workspaceId?: string;
401
+ workspace?: {
402
+ id: string;
403
+ name: string;
404
+ };
405
+ createdAt: string;
406
+ }
407
+ interface CreatePixelRequest {
408
+ /** Pixel name (for identification) */
409
+ name: string;
410
+ /** Domain where the pixel will be installed */
411
+ domain: string;
412
+ /** Workspace ID (for agency accounts) - use this OR domain auto-detection */
413
+ workspace_id?: string;
414
+ }
415
+ interface CreatePixelResponse {
416
+ success: boolean;
417
+ pixel: Pixel$1;
418
+ }
419
+ interface ListPixelsRequest {
420
+ /** Filter by workspace ID (for agency accounts) */
421
+ workspace_id?: string;
422
+ /** Filter by domain (alternative to workspace_id) */
423
+ domain?: string;
424
+ }
425
+ interface ListPixelsResponse {
426
+ success: boolean;
427
+ pixels: Pixel$1[];
428
+ }
394
429
  interface ApiError {
395
430
  success: false;
396
431
  error: string;
@@ -1215,6 +1250,55 @@ declare class WebhooksResource {
1215
1250
  }>;
1216
1251
  }
1217
1252
 
1253
+ /**
1254
+ * Pixels resource for managing tracking pixels
1255
+ */
1256
+ declare class PixelsResource {
1257
+ private request;
1258
+ constructor(request: <T>(endpoint: string, options?: RequestInit) => Promise<T>);
1259
+ /**
1260
+ * Create a new tracking pixel
1261
+ * Returns a pixel with token for installation
1262
+ *
1263
+ * @example
1264
+ * ```ts
1265
+ * const { pixel } = await client.pixels.create({
1266
+ * name: 'Main Website',
1267
+ * domain: 'example.com'
1268
+ * });
1269
+ *
1270
+ * console.log('Pixel token:', pixel.token);
1271
+ * ```
1272
+ */
1273
+ create(params: CreatePixelRequest): Promise<CreatePixelResponse>;
1274
+ /**
1275
+ * List all pixels for the organization
1276
+ *
1277
+ * @example
1278
+ * ```ts
1279
+ * // List all pixels
1280
+ * const { pixels } = await client.pixels.list();
1281
+ *
1282
+ * // List pixels for a specific domain (agency accounts)
1283
+ * const { pixels } = await client.pixels.list({ domain: 'client.com' });
1284
+ * ```
1285
+ */
1286
+ list(params?: ListPixelsRequest): Promise<ListPixelsResponse>;
1287
+ /**
1288
+ * Get a single pixel by ID
1289
+ */
1290
+ get(pixelId: string): Promise<{
1291
+ success: boolean;
1292
+ pixel: Pixel$1;
1293
+ }>;
1294
+ /**
1295
+ * Delete a pixel
1296
+ */
1297
+ delete(pixelId: string): Promise<{
1298
+ success: boolean;
1299
+ }>;
1300
+ }
1301
+
1218
1302
  /**
1219
1303
  * SendMailOS SDK Client
1220
1304
  *
@@ -1259,6 +1343,8 @@ declare class SendMailOS {
1259
1343
  readonly workflows: WorkflowsResource;
1260
1344
  /** Webhook management */
1261
1345
  readonly webhooks: WebhooksResource;
1346
+ /** Tracking pixel management */
1347
+ readonly pixels: PixelsResource;
1262
1348
  constructor(apiKey: string, options?: SendMailOSOptions);
1263
1349
  /**
1264
1350
  * Make an authenticated request to the API
package/dist/index.d.ts CHANGED
@@ -391,6 +391,41 @@ interface WorkflowStatusResponse {
391
391
  status: WorkflowStatus;
392
392
  };
393
393
  }
394
+ interface Pixel$1 {
395
+ id: string;
396
+ name: string;
397
+ domain: string;
398
+ token: string;
399
+ active: boolean;
400
+ workspaceId?: string;
401
+ workspace?: {
402
+ id: string;
403
+ name: string;
404
+ };
405
+ createdAt: string;
406
+ }
407
+ interface CreatePixelRequest {
408
+ /** Pixel name (for identification) */
409
+ name: string;
410
+ /** Domain where the pixel will be installed */
411
+ domain: string;
412
+ /** Workspace ID (for agency accounts) - use this OR domain auto-detection */
413
+ workspace_id?: string;
414
+ }
415
+ interface CreatePixelResponse {
416
+ success: boolean;
417
+ pixel: Pixel$1;
418
+ }
419
+ interface ListPixelsRequest {
420
+ /** Filter by workspace ID (for agency accounts) */
421
+ workspace_id?: string;
422
+ /** Filter by domain (alternative to workspace_id) */
423
+ domain?: string;
424
+ }
425
+ interface ListPixelsResponse {
426
+ success: boolean;
427
+ pixels: Pixel$1[];
428
+ }
394
429
  interface ApiError {
395
430
  success: false;
396
431
  error: string;
@@ -1215,6 +1250,55 @@ declare class WebhooksResource {
1215
1250
  }>;
1216
1251
  }
1217
1252
 
1253
+ /**
1254
+ * Pixels resource for managing tracking pixels
1255
+ */
1256
+ declare class PixelsResource {
1257
+ private request;
1258
+ constructor(request: <T>(endpoint: string, options?: RequestInit) => Promise<T>);
1259
+ /**
1260
+ * Create a new tracking pixel
1261
+ * Returns a pixel with token for installation
1262
+ *
1263
+ * @example
1264
+ * ```ts
1265
+ * const { pixel } = await client.pixels.create({
1266
+ * name: 'Main Website',
1267
+ * domain: 'example.com'
1268
+ * });
1269
+ *
1270
+ * console.log('Pixel token:', pixel.token);
1271
+ * ```
1272
+ */
1273
+ create(params: CreatePixelRequest): Promise<CreatePixelResponse>;
1274
+ /**
1275
+ * List all pixels for the organization
1276
+ *
1277
+ * @example
1278
+ * ```ts
1279
+ * // List all pixels
1280
+ * const { pixels } = await client.pixels.list();
1281
+ *
1282
+ * // List pixels for a specific domain (agency accounts)
1283
+ * const { pixels } = await client.pixels.list({ domain: 'client.com' });
1284
+ * ```
1285
+ */
1286
+ list(params?: ListPixelsRequest): Promise<ListPixelsResponse>;
1287
+ /**
1288
+ * Get a single pixel by ID
1289
+ */
1290
+ get(pixelId: string): Promise<{
1291
+ success: boolean;
1292
+ pixel: Pixel$1;
1293
+ }>;
1294
+ /**
1295
+ * Delete a pixel
1296
+ */
1297
+ delete(pixelId: string): Promise<{
1298
+ success: boolean;
1299
+ }>;
1300
+ }
1301
+
1218
1302
  /**
1219
1303
  * SendMailOS SDK Client
1220
1304
  *
@@ -1259,6 +1343,8 @@ declare class SendMailOS {
1259
1343
  readonly workflows: WorkflowsResource;
1260
1344
  /** Webhook management */
1261
1345
  readonly webhooks: WebhooksResource;
1346
+ /** Tracking pixel management */
1347
+ readonly pixels: PixelsResource;
1262
1348
  constructor(apiKey: string, options?: SendMailOSOptions);
1263
1349
  /**
1264
1350
  * Make an authenticated request to the API
package/dist/index.js CHANGED
@@ -1000,10 +1000,75 @@ var WebhooksResource = class {
1000
1000
  }
1001
1001
  };
1002
1002
 
1003
+ // src/resources/pixels.ts
1004
+ var PixelsResource = class {
1005
+ constructor(request) {
1006
+ this.request = request;
1007
+ }
1008
+ /**
1009
+ * Create a new tracking pixel
1010
+ * Returns a pixel with token for installation
1011
+ *
1012
+ * @example
1013
+ * ```ts
1014
+ * const { pixel } = await client.pixels.create({
1015
+ * name: 'Main Website',
1016
+ * domain: 'example.com'
1017
+ * });
1018
+ *
1019
+ * console.log('Pixel token:', pixel.token);
1020
+ * ```
1021
+ */
1022
+ async create(params) {
1023
+ return this.request("/pixels", {
1024
+ method: "POST",
1025
+ body: JSON.stringify(params)
1026
+ });
1027
+ }
1028
+ /**
1029
+ * List all pixels for the organization
1030
+ *
1031
+ * @example
1032
+ * ```ts
1033
+ * // List all pixels
1034
+ * const { pixels } = await client.pixels.list();
1035
+ *
1036
+ * // List pixels for a specific domain (agency accounts)
1037
+ * const { pixels } = await client.pixels.list({ domain: 'client.com' });
1038
+ * ```
1039
+ */
1040
+ async list(params) {
1041
+ const searchParams = new URLSearchParams();
1042
+ if (params?.workspace_id) searchParams.set("workspace_id", params.workspace_id);
1043
+ if (params?.domain) searchParams.set("domain", params.domain);
1044
+ const query = searchParams.toString();
1045
+ const endpoint = query ? `/pixels?${query}` : "/pixels";
1046
+ return this.request(endpoint, {
1047
+ method: "GET"
1048
+ });
1049
+ }
1050
+ /**
1051
+ * Get a single pixel by ID
1052
+ */
1053
+ async get(pixelId) {
1054
+ return this.request(`/pixels/${pixelId}`, {
1055
+ method: "GET"
1056
+ });
1057
+ }
1058
+ /**
1059
+ * Delete a pixel
1060
+ */
1061
+ async delete(pixelId) {
1062
+ return this.request(`/pixels/${pixelId}`, {
1063
+ method: "DELETE"
1064
+ });
1065
+ }
1066
+ };
1067
+
1003
1068
  // src/client.ts
1004
1069
  var DEFAULT_BASE_URL = "https://sendmailos.com/api/v1";
1005
1070
  var DEFAULT_TIMEOUT = 3e4;
1006
- var SDK_VERSION = "1.3.2";
1071
+ var SDK_VERSION = "1.4.0";
1007
1072
  var SendMailOS = class {
1008
1073
  constructor(apiKey, options = {}) {
1009
1074
  if (!apiKey) {
@@ -1032,6 +1097,7 @@ var SendMailOS = class {
1032
1097
  this.workspaces = new WorkspacesResource(boundRequest);
1033
1098
  this.workflows = new WorkflowsResource(boundRequest);
1034
1099
  this.webhooks = new WebhooksResource(boundRequest);
1100
+ this.pixels = new PixelsResource(boundRequest);
1035
1101
  }
1036
1102
  /**
1037
1103
  * Make an authenticated request to the API