@skrybe/sdk 1.0.0 → 1.0.1

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 (2) hide show
  1. package/dist/index.js +14 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9,21 +9,21 @@ class SkrybeSDK {
9
9
  constructor(config) {
10
10
  this.apiKey = config.apiKey;
11
11
  this.client = axios_1.default.create({
12
- baseURL: config.baseURL || 'https://dashboard.skry.be',
12
+ baseURL: config.baseURL || "https://dashboard.skry.be",
13
13
  headers: {
14
- 'Content-Type': 'application/x-www-form-urlencoded'
15
- }
14
+ "Content-Type": "application/x-www-form-urlencoded",
15
+ },
16
16
  });
17
17
  }
18
18
  createFormData(data) {
19
19
  const formData = new URLSearchParams();
20
- formData.append('api_key', this.apiKey);
20
+ formData.append("api_key", this.apiKey);
21
21
  Object.entries(data).forEach(([key, value]) => {
22
22
  if (value !== undefined) {
23
23
  if (Array.isArray(value)) {
24
24
  formData.append(key, JSON.stringify(value));
25
25
  }
26
- else if (typeof value === 'object') {
26
+ else if (typeof value === "object") {
27
27
  formData.append(key, JSON.stringify(value));
28
28
  }
29
29
  else {
@@ -43,15 +43,16 @@ class SkrybeSDK {
43
43
  html_text: options.htmlText,
44
44
  plain_text: options.plainText,
45
45
  to: options.to,
46
- 'recipient-variables': options.recipientVariables,
47
- list_ids: (_a = options.listIds) === null || _a === void 0 ? void 0 : _a.join(','),
46
+ "recipient-variables": options.recipientVariables,
47
+ list_ids: (_a = options.listIds) === null || _a === void 0 ? void 0 : _a.join(","),
48
48
  query_string: options.queryString,
49
49
  track_opens: options.trackOpens,
50
50
  track_clicks: options.trackClicks,
51
51
  schedule_date_time: options.scheduleDateTime,
52
- schedule_timezone: options.scheduleTimezone
52
+ schedule_timezone: options.scheduleTimezone,
53
53
  });
54
- const response = await this.client.post('/api/emails/send.php', formData);
54
+ console.log(formData);
55
+ const response = await this.client.post("/api/emails/send.php", formData);
55
56
  return response.data;
56
57
  }
57
58
  async createCampaign(options) {
@@ -72,16 +73,16 @@ class SkrybeSDK {
72
73
  track_clicks: options.trackClicks,
73
74
  send_campaign: options.sendCampaign,
74
75
  schedule_date_time: options.scheduleDateTime,
75
- schedule_timezone: options.scheduleTimezone
76
+ schedule_timezone: options.scheduleTimezone,
76
77
  });
77
- const response = await this.client.post('/api/campaigns/create.php', formData);
78
+ const response = await this.client.post("/api/campaigns/create.php", formData);
78
79
  return response.data;
79
80
  }
80
81
  async getLists(includeHidden = false) {
81
82
  const formData = this.createFormData({
82
- include_hidden: includeHidden ? 'yes' : 'no'
83
+ include_hidden: includeHidden ? "yes" : "no",
83
84
  });
84
- const response = await this.client.post('/api/lists/get-lists.php', formData);
85
+ const response = await this.client.post("/api/lists/get-lists.php", formData);
85
86
  return response.data;
86
87
  }
87
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrybe/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Official TypeScript/JavaScript SDK for Skrybe API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,6 +35,6 @@
35
35
  },
36
36
  "repository": {
37
37
  "type": "git",
38
- "url": "https://github.com/skrybe/sdk"
38
+ "url": "https://github.com/skry-be/sdk"
39
39
  }
40
40
  }