@sendmailos/sdk 1.3.1 → 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.mjs CHANGED
@@ -996,10 +996,75 @@ var WebhooksResource = class {
996
996
  }
997
997
  };
998
998
 
999
+ // src/resources/pixels.ts
1000
+ var PixelsResource = class {
1001
+ constructor(request) {
1002
+ this.request = request;
1003
+ }
1004
+ /**
1005
+ * Create a new tracking pixel
1006
+ * Returns a pixel with token for installation
1007
+ *
1008
+ * @example
1009
+ * ```ts
1010
+ * const { pixel } = await client.pixels.create({
1011
+ * name: 'Main Website',
1012
+ * domain: 'example.com'
1013
+ * });
1014
+ *
1015
+ * console.log('Pixel token:', pixel.token);
1016
+ * ```
1017
+ */
1018
+ async create(params) {
1019
+ return this.request("/pixels", {
1020
+ method: "POST",
1021
+ body: JSON.stringify(params)
1022
+ });
1023
+ }
1024
+ /**
1025
+ * List all pixels for the organization
1026
+ *
1027
+ * @example
1028
+ * ```ts
1029
+ * // List all pixels
1030
+ * const { pixels } = await client.pixels.list();
1031
+ *
1032
+ * // List pixels for a specific domain (agency accounts)
1033
+ * const { pixels } = await client.pixels.list({ domain: 'client.com' });
1034
+ * ```
1035
+ */
1036
+ async list(params) {
1037
+ const searchParams = new URLSearchParams();
1038
+ if (params?.workspace_id) searchParams.set("workspace_id", params.workspace_id);
1039
+ if (params?.domain) searchParams.set("domain", params.domain);
1040
+ const query = searchParams.toString();
1041
+ const endpoint = query ? `/pixels?${query}` : "/pixels";
1042
+ return this.request(endpoint, {
1043
+ method: "GET"
1044
+ });
1045
+ }
1046
+ /**
1047
+ * Get a single pixel by ID
1048
+ */
1049
+ async get(pixelId) {
1050
+ return this.request(`/pixels/${pixelId}`, {
1051
+ method: "GET"
1052
+ });
1053
+ }
1054
+ /**
1055
+ * Delete a pixel
1056
+ */
1057
+ async delete(pixelId) {
1058
+ return this.request(`/pixels/${pixelId}`, {
1059
+ method: "DELETE"
1060
+ });
1061
+ }
1062
+ };
1063
+
999
1064
  // src/client.ts
1000
1065
  var DEFAULT_BASE_URL = "https://sendmailos.com/api/v1";
1001
1066
  var DEFAULT_TIMEOUT = 3e4;
1002
- var SDK_VERSION = "1.3.1";
1067
+ var SDK_VERSION = "1.4.0";
1003
1068
  var SendMailOS = class {
1004
1069
  constructor(apiKey, options = {}) {
1005
1070
  if (!apiKey) {
@@ -1028,6 +1093,7 @@ var SendMailOS = class {
1028
1093
  this.workspaces = new WorkspacesResource(boundRequest);
1029
1094
  this.workflows = new WorkflowsResource(boundRequest);
1030
1095
  this.webhooks = new WebhooksResource(boundRequest);
1096
+ this.pixels = new PixelsResource(boundRequest);
1031
1097
  }
1032
1098
  /**
1033
1099
  * Make an authenticated request to the API