resend 6.10.0-preview-workflows.1 → 6.10.0-preview-workflows.2
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.cjs +140 -120
- package/dist/index.d.cts +252 -17
- package/dist/index.d.mts +252 -17
- package/dist/index.mjs +133 -108
- package/package.json +23 -21
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
20
16
|
}
|
|
21
17
|
return to;
|
|
22
18
|
};
|
|
@@ -24,15 +20,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
20
|
value: mod,
|
|
25
21
|
enumerable: true
|
|
26
22
|
}) : target, mod));
|
|
27
|
-
|
|
28
23
|
//#endregion
|
|
29
24
|
let postal_mime = require("postal-mime");
|
|
30
25
|
postal_mime = __toESM(postal_mime);
|
|
31
26
|
let svix = require("svix");
|
|
32
|
-
|
|
33
27
|
//#region package.json
|
|
34
|
-
var version = "6.10.0-preview-workflows.
|
|
35
|
-
|
|
28
|
+
var version = "6.10.0-preview-workflows.2";
|
|
36
29
|
//#endregion
|
|
37
30
|
//#region src/common/utils/build-pagination-query.ts
|
|
38
31
|
/**
|
|
@@ -47,7 +40,6 @@ function buildPaginationQuery(options) {
|
|
|
47
40
|
if ("before" in options && options.before !== void 0) searchParams.set("before", options.before);
|
|
48
41
|
return searchParams.toString();
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
//#endregion
|
|
52
44
|
//#region src/api-keys/api-keys.ts
|
|
53
45
|
var ApiKeys = class {
|
|
@@ -66,7 +58,126 @@ var ApiKeys = class {
|
|
|
66
58
|
return await this.resend.delete(`/api-keys/${id}`);
|
|
67
59
|
}
|
|
68
60
|
};
|
|
69
|
-
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/automation-run-steps/automation-run-steps.ts
|
|
63
|
+
var AutomationRunSteps = class {
|
|
64
|
+
constructor(resend) {
|
|
65
|
+
this.resend = resend;
|
|
66
|
+
}
|
|
67
|
+
async get(options) {
|
|
68
|
+
return await this.resend.get(`/automations/${options.automationId}/runs/${options.runId}/steps/${options.stepId}`);
|
|
69
|
+
}
|
|
70
|
+
async list(options) {
|
|
71
|
+
const queryString = buildPaginationQuery(options);
|
|
72
|
+
const url = queryString ? `/automations/${options.automationId}/runs/${options.runId}/steps?${queryString}` : `/automations/${options.automationId}/runs/${options.runId}/steps`;
|
|
73
|
+
return await this.resend.get(url);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/automation-runs/automation-runs.ts
|
|
78
|
+
var AutomationRuns = class {
|
|
79
|
+
constructor(resend) {
|
|
80
|
+
this.resend = resend;
|
|
81
|
+
this.steps = new AutomationRunSteps(resend);
|
|
82
|
+
}
|
|
83
|
+
async get(options) {
|
|
84
|
+
return await this.resend.get(`/automations/${options.automationId}/runs/${options.runId}`);
|
|
85
|
+
}
|
|
86
|
+
async list(options) {
|
|
87
|
+
const queryString = buildPaginationQuery(options);
|
|
88
|
+
const url = queryString ? `/automations/${options.automationId}/runs?${queryString}` : `/automations/${options.automationId}/runs`;
|
|
89
|
+
return await this.resend.get(url);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/common/utils/parse-automation-to-api-options.ts
|
|
94
|
+
function parseStepConfig(step) {
|
|
95
|
+
switch (step.type) {
|
|
96
|
+
case "trigger": return {
|
|
97
|
+
ref: step.ref,
|
|
98
|
+
type: step.type,
|
|
99
|
+
config: { event_name: step.config.eventName }
|
|
100
|
+
};
|
|
101
|
+
case "delay": return {
|
|
102
|
+
ref: step.ref,
|
|
103
|
+
type: step.type,
|
|
104
|
+
config: step.config
|
|
105
|
+
};
|
|
106
|
+
case "send_email": return {
|
|
107
|
+
ref: step.ref,
|
|
108
|
+
type: step.type,
|
|
109
|
+
config: {
|
|
110
|
+
template_id: step.config.templateId,
|
|
111
|
+
subject: step.config.subject,
|
|
112
|
+
from: step.config.from,
|
|
113
|
+
reply_to: step.config.replyTo,
|
|
114
|
+
variables: step.config.variables
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
case "wait_for_event": return {
|
|
118
|
+
ref: step.ref,
|
|
119
|
+
type: step.type,
|
|
120
|
+
config: {
|
|
121
|
+
event_name: step.config.eventName,
|
|
122
|
+
timeout_seconds: step.config.timeoutSeconds,
|
|
123
|
+
filter_rule: step.config.filterRule
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
case "condition": return {
|
|
127
|
+
ref: step.ref,
|
|
128
|
+
type: step.type,
|
|
129
|
+
config: step.config
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function parseEdge(edge) {
|
|
134
|
+
return {
|
|
135
|
+
from: edge.from,
|
|
136
|
+
to: edge.to,
|
|
137
|
+
edge_type: edge.edgeType
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function parseAutomationToApiOptions(automation) {
|
|
141
|
+
return {
|
|
142
|
+
name: automation.name,
|
|
143
|
+
status: automation.status,
|
|
144
|
+
steps: automation.steps.map(parseStepConfig),
|
|
145
|
+
edges: automation.edges.map(parseEdge)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function parseEventToApiOptions(event) {
|
|
149
|
+
return {
|
|
150
|
+
event: event.event,
|
|
151
|
+
contact_id: event.contactId,
|
|
152
|
+
email: event.email,
|
|
153
|
+
payload: event.payload
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/automations/automations.ts
|
|
158
|
+
var Automations = class {
|
|
159
|
+
constructor(resend) {
|
|
160
|
+
this.resend = resend;
|
|
161
|
+
this.runs = new AutomationRuns(this.resend);
|
|
162
|
+
}
|
|
163
|
+
async create(payload) {
|
|
164
|
+
return await this.resend.post("/automations", parseAutomationToApiOptions(payload));
|
|
165
|
+
}
|
|
166
|
+
async list(options = {}) {
|
|
167
|
+
const queryString = buildPaginationQuery(options);
|
|
168
|
+
const url = queryString ? `/automations?${queryString}` : "/automations";
|
|
169
|
+
return await this.resend.get(url);
|
|
170
|
+
}
|
|
171
|
+
async get(id) {
|
|
172
|
+
return await this.resend.get(`/automations/${id}`);
|
|
173
|
+
}
|
|
174
|
+
async remove(id) {
|
|
175
|
+
return await this.resend.delete(`/automations/${id}`);
|
|
176
|
+
}
|
|
177
|
+
async update(id, payload) {
|
|
178
|
+
return await this.resend.patch(`/automations/${id}`, payload);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
70
181
|
//#endregion
|
|
71
182
|
//#region src/common/utils/parse-email-to-api-options.ts
|
|
72
183
|
function parseAttachments(attachments) {
|
|
@@ -99,7 +210,6 @@ function parseEmailToApiOptions(email) {
|
|
|
99
210
|
topic_id: email.topicId
|
|
100
211
|
};
|
|
101
212
|
}
|
|
102
|
-
|
|
103
213
|
//#endregion
|
|
104
214
|
//#region src/render.ts
|
|
105
215
|
async function render(node) {
|
|
@@ -111,7 +221,6 @@ async function render(node) {
|
|
|
111
221
|
}
|
|
112
222
|
return render(node);
|
|
113
223
|
}
|
|
114
|
-
|
|
115
224
|
//#endregion
|
|
116
225
|
//#region src/batch/batch.ts
|
|
117
226
|
var Batch = class {
|
|
@@ -139,7 +248,6 @@ var Batch = class {
|
|
|
139
248
|
});
|
|
140
249
|
}
|
|
141
250
|
};
|
|
142
|
-
|
|
143
251
|
//#endregion
|
|
144
252
|
//#region src/broadcasts/broadcasts.ts
|
|
145
253
|
var Broadcasts = class {
|
|
@@ -193,7 +301,6 @@ var Broadcasts = class {
|
|
|
193
301
|
});
|
|
194
302
|
}
|
|
195
303
|
};
|
|
196
|
-
|
|
197
304
|
//#endregion
|
|
198
305
|
//#region src/common/utils/parse-contact-properties-to-api-options.ts
|
|
199
306
|
function parseContactPropertyFromApi(contactProperty) {
|
|
@@ -213,7 +320,6 @@ function parseContactPropertyToApiOptions(contactProperty) {
|
|
|
213
320
|
};
|
|
214
321
|
return { fallback_value: contactProperty.fallbackValue };
|
|
215
322
|
}
|
|
216
|
-
|
|
217
323
|
//#endregion
|
|
218
324
|
//#region src/contact-properties/contact-properties.ts
|
|
219
325
|
var ContactProperties = class {
|
|
@@ -285,7 +391,6 @@ var ContactProperties = class {
|
|
|
285
391
|
return await this.resend.delete(`/contact-properties/${id}`);
|
|
286
392
|
}
|
|
287
393
|
};
|
|
288
|
-
|
|
289
394
|
//#endregion
|
|
290
395
|
//#region src/contacts/segments/contact-segments.ts
|
|
291
396
|
var ContactSegments = class {
|
|
@@ -334,7 +439,6 @@ var ContactSegments = class {
|
|
|
334
439
|
return this.resend.delete(`/contacts/${identifier}/segments/${options.segmentId}`);
|
|
335
440
|
}
|
|
336
441
|
};
|
|
337
|
-
|
|
338
442
|
//#endregion
|
|
339
443
|
//#region src/contacts/topics/contact-topics.ts
|
|
340
444
|
var ContactTopics = class {
|
|
@@ -370,7 +474,6 @@ var ContactTopics = class {
|
|
|
370
474
|
return this.resend.get(url);
|
|
371
475
|
}
|
|
372
476
|
};
|
|
373
|
-
|
|
374
477
|
//#endregion
|
|
375
478
|
//#region src/contacts/contacts.ts
|
|
376
479
|
var Contacts = class {
|
|
@@ -471,7 +574,6 @@ var Contacts = class {
|
|
|
471
574
|
return this.resend.delete(`/audiences/${payload.audienceId}/contacts/${payload?.email ? payload?.email : payload?.id}`);
|
|
472
575
|
}
|
|
473
576
|
};
|
|
474
|
-
|
|
475
577
|
//#endregion
|
|
476
578
|
//#region src/common/utils/parse-domain-to-api-options.ts
|
|
477
579
|
function parseDomainToApiOptions(domain) {
|
|
@@ -485,7 +587,6 @@ function parseDomainToApiOptions(domain) {
|
|
|
485
587
|
tls: domain.tls
|
|
486
588
|
};
|
|
487
589
|
}
|
|
488
|
-
|
|
489
590
|
//#endregion
|
|
490
591
|
//#region src/domains/domains.ts
|
|
491
592
|
var Domains = class {
|
|
@@ -518,7 +619,6 @@ var Domains = class {
|
|
|
518
619
|
return await this.resend.post(`/domains/${id}/verify`);
|
|
519
620
|
}
|
|
520
621
|
};
|
|
521
|
-
|
|
522
622
|
//#endregion
|
|
523
623
|
//#region src/emails/attachments/attachments.ts
|
|
524
624
|
var Attachments$1 = class {
|
|
@@ -536,7 +636,6 @@ var Attachments$1 = class {
|
|
|
536
636
|
return await this.resend.get(url);
|
|
537
637
|
}
|
|
538
638
|
};
|
|
539
|
-
|
|
540
639
|
//#endregion
|
|
541
640
|
//#region src/emails/receiving/attachments/attachments.ts
|
|
542
641
|
var Attachments = class {
|
|
@@ -554,7 +653,6 @@ var Attachments = class {
|
|
|
554
653
|
return await this.resend.get(url);
|
|
555
654
|
}
|
|
556
655
|
};
|
|
557
|
-
|
|
558
656
|
//#endregion
|
|
559
657
|
//#region src/emails/receiving/receiving.ts
|
|
560
658
|
var Receiving = class {
|
|
@@ -672,7 +770,6 @@ var Receiving = class {
|
|
|
672
770
|
});
|
|
673
771
|
}
|
|
674
772
|
};
|
|
675
|
-
|
|
676
773
|
//#endregion
|
|
677
774
|
//#region src/emails/emails.ts
|
|
678
775
|
var Emails = class {
|
|
@@ -703,72 +800,6 @@ var Emails = class {
|
|
|
703
800
|
return await this.resend.post(`/emails/${id}/cancel`);
|
|
704
801
|
}
|
|
705
802
|
};
|
|
706
|
-
|
|
707
|
-
//#endregion
|
|
708
|
-
//#region src/common/utils/parse-workflow-to-api-options.ts
|
|
709
|
-
function parseStepConfig(step) {
|
|
710
|
-
switch (step.type) {
|
|
711
|
-
case "trigger": return {
|
|
712
|
-
ref: step.ref,
|
|
713
|
-
type: step.type,
|
|
714
|
-
config: { event_name: step.config.eventName }
|
|
715
|
-
};
|
|
716
|
-
case "delay": return {
|
|
717
|
-
ref: step.ref,
|
|
718
|
-
type: step.type,
|
|
719
|
-
config: step.config
|
|
720
|
-
};
|
|
721
|
-
case "send_email": return {
|
|
722
|
-
ref: step.ref,
|
|
723
|
-
type: step.type,
|
|
724
|
-
config: {
|
|
725
|
-
template_id: step.config.templateId,
|
|
726
|
-
subject: step.config.subject,
|
|
727
|
-
from: step.config.from,
|
|
728
|
-
reply_to: step.config.replyTo,
|
|
729
|
-
variables: step.config.variables
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
case "wait_for_event": return {
|
|
733
|
-
ref: step.ref,
|
|
734
|
-
type: step.type,
|
|
735
|
-
config: {
|
|
736
|
-
event_name: step.config.eventName,
|
|
737
|
-
timeout_seconds: step.config.timeoutSeconds,
|
|
738
|
-
filter_rule: step.config.filterRule
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
case "condition": return {
|
|
742
|
-
ref: step.ref,
|
|
743
|
-
type: step.type,
|
|
744
|
-
config: step.config
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
function parseEdge(edge) {
|
|
749
|
-
return {
|
|
750
|
-
from: edge.from,
|
|
751
|
-
to: edge.to,
|
|
752
|
-
edge_type: edge.edgeType
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
function parseWorkflowToApiOptions(workflow) {
|
|
756
|
-
return {
|
|
757
|
-
name: workflow.name,
|
|
758
|
-
status: workflow.status,
|
|
759
|
-
steps: workflow.steps.map(parseStepConfig),
|
|
760
|
-
edges: workflow.edges.map(parseEdge)
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
function parseWorkflowEventToApiOptions(event) {
|
|
764
|
-
return {
|
|
765
|
-
event: event.event,
|
|
766
|
-
contact_id: event.contactId,
|
|
767
|
-
email: event.email,
|
|
768
|
-
payload: event.payload
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
|
|
772
803
|
//#endregion
|
|
773
804
|
//#region src/events/events.ts
|
|
774
805
|
var Events = class {
|
|
@@ -776,7 +807,7 @@ var Events = class {
|
|
|
776
807
|
this.resend = resend;
|
|
777
808
|
}
|
|
778
809
|
async send(payload) {
|
|
779
|
-
return await this.resend.post("/events/send",
|
|
810
|
+
return await this.resend.post("/events/send", parseEventToApiOptions(payload));
|
|
780
811
|
}
|
|
781
812
|
async create(payload) {
|
|
782
813
|
return await this.resend.post("/events", payload);
|
|
@@ -796,7 +827,6 @@ var Events = class {
|
|
|
796
827
|
return await this.resend.delete(`/events/${encodeURIComponent(identifier)}`);
|
|
797
828
|
}
|
|
798
829
|
};
|
|
799
|
-
|
|
800
830
|
//#endregion
|
|
801
831
|
//#region src/segments/segments.ts
|
|
802
832
|
var Segments = class {
|
|
@@ -818,7 +848,6 @@ var Segments = class {
|
|
|
818
848
|
return await this.resend.delete(`/segments/${id}`);
|
|
819
849
|
}
|
|
820
850
|
};
|
|
821
|
-
|
|
822
851
|
//#endregion
|
|
823
852
|
//#region src/common/utils/get-pagination-query-properties.ts
|
|
824
853
|
function getPaginationQueryProperties(options = {}) {
|
|
@@ -828,7 +857,6 @@ function getPaginationQueryProperties(options = {}) {
|
|
|
828
857
|
if (options.limit) query.set("limit", options.limit.toString());
|
|
829
858
|
return query.size > 0 ? `?${query.toString()}` : "";
|
|
830
859
|
}
|
|
831
|
-
|
|
832
860
|
//#endregion
|
|
833
861
|
//#region src/common/utils/parse-template-to-api-options.ts
|
|
834
862
|
function parseVariables(variables) {
|
|
@@ -850,7 +878,6 @@ function parseTemplateToApiOptions(template) {
|
|
|
850
878
|
variables: parseVariables(template.variables)
|
|
851
879
|
};
|
|
852
880
|
}
|
|
853
|
-
|
|
854
881
|
//#endregion
|
|
855
882
|
//#region src/templates/chainable-template-result.ts
|
|
856
883
|
var ChainableTemplateResult = class {
|
|
@@ -871,7 +898,6 @@ var ChainableTemplateResult = class {
|
|
|
871
898
|
return this.publishFn(data.id);
|
|
872
899
|
}
|
|
873
900
|
};
|
|
874
|
-
|
|
875
901
|
//#endregion
|
|
876
902
|
//#region src/templates/templates.ts
|
|
877
903
|
var Templates = class {
|
|
@@ -912,7 +938,6 @@ var Templates = class {
|
|
|
912
938
|
return await this.resend.patch(`/templates/${identifier}`, parseTemplateToApiOptions(payload));
|
|
913
939
|
}
|
|
914
940
|
};
|
|
915
|
-
|
|
916
941
|
//#endregion
|
|
917
942
|
//#region src/topics/topics.ts
|
|
918
943
|
var Topics = class {
|
|
@@ -966,7 +991,6 @@ var Topics = class {
|
|
|
966
991
|
return await this.resend.delete(`/topics/${id}`);
|
|
967
992
|
}
|
|
968
993
|
};
|
|
969
|
-
|
|
970
994
|
//#endregion
|
|
971
995
|
//#region src/webhooks/webhooks.ts
|
|
972
996
|
var Webhooks = class {
|
|
@@ -998,7 +1022,6 @@ var Webhooks = class {
|
|
|
998
1022
|
});
|
|
999
1023
|
}
|
|
1000
1024
|
};
|
|
1001
|
-
|
|
1002
1025
|
//#endregion
|
|
1003
1026
|
//#region src/workflow-run-steps/workflow-run-steps.ts
|
|
1004
1027
|
var WorkflowRunSteps = class {
|
|
@@ -1006,15 +1029,14 @@ var WorkflowRunSteps = class {
|
|
|
1006
1029
|
this.resend = resend;
|
|
1007
1030
|
}
|
|
1008
1031
|
async get(options) {
|
|
1009
|
-
return await this.resend.get(`/
|
|
1032
|
+
return await this.resend.get(`/automations/${options.workflowId}/runs/${options.runId}/steps/${options.stepId}`);
|
|
1010
1033
|
}
|
|
1011
1034
|
async list(options) {
|
|
1012
1035
|
const queryString = buildPaginationQuery(options);
|
|
1013
|
-
const url = queryString ? `/
|
|
1036
|
+
const url = queryString ? `/automations/${options.workflowId}/runs/${options.runId}/steps?${queryString}` : `/automations/${options.workflowId}/runs/${options.runId}/steps`;
|
|
1014
1037
|
return await this.resend.get(url);
|
|
1015
1038
|
}
|
|
1016
1039
|
};
|
|
1017
|
-
|
|
1018
1040
|
//#endregion
|
|
1019
1041
|
//#region src/workflow-runs/workflow-runs.ts
|
|
1020
1042
|
var WorkflowRuns = class {
|
|
@@ -1023,15 +1045,14 @@ var WorkflowRuns = class {
|
|
|
1023
1045
|
this.steps = new WorkflowRunSteps(resend);
|
|
1024
1046
|
}
|
|
1025
1047
|
async get(options) {
|
|
1026
|
-
return await this.resend.get(`/
|
|
1048
|
+
return await this.resend.get(`/automations/${options.workflowId}/runs/${options.runId}`);
|
|
1027
1049
|
}
|
|
1028
1050
|
async list(options) {
|
|
1029
1051
|
const queryString = buildPaginationQuery(options);
|
|
1030
|
-
const url = queryString ? `/
|
|
1052
|
+
const url = queryString ? `/automations/${options.workflowId}/runs?${queryString}` : `/automations/${options.workflowId}/runs`;
|
|
1031
1053
|
return await this.resend.get(url);
|
|
1032
1054
|
}
|
|
1033
1055
|
};
|
|
1034
|
-
|
|
1035
1056
|
//#endregion
|
|
1036
1057
|
//#region src/workflows/workflows.ts
|
|
1037
1058
|
var Workflows = class {
|
|
@@ -1040,24 +1061,23 @@ var Workflows = class {
|
|
|
1040
1061
|
this.runs = new WorkflowRuns(this.resend);
|
|
1041
1062
|
}
|
|
1042
1063
|
async create(payload) {
|
|
1043
|
-
return await this.resend.post("/
|
|
1064
|
+
return await this.resend.post("/automations", parseAutomationToApiOptions(payload));
|
|
1044
1065
|
}
|
|
1045
1066
|
async list(options = {}) {
|
|
1046
1067
|
const queryString = buildPaginationQuery(options);
|
|
1047
|
-
const url = queryString ? `/
|
|
1068
|
+
const url = queryString ? `/automations?${queryString}` : "/automations";
|
|
1048
1069
|
return await this.resend.get(url);
|
|
1049
1070
|
}
|
|
1050
1071
|
async get(id) {
|
|
1051
|
-
return await this.resend.get(`/
|
|
1072
|
+
return await this.resend.get(`/automations/${id}`);
|
|
1052
1073
|
}
|
|
1053
1074
|
async remove(id) {
|
|
1054
|
-
return await this.resend.delete(`/
|
|
1075
|
+
return await this.resend.delete(`/automations/${id}`);
|
|
1055
1076
|
}
|
|
1056
1077
|
async update(id, payload) {
|
|
1057
|
-
return await this.resend.patch(`/
|
|
1078
|
+
return await this.resend.patch(`/automations/${id}`, payload);
|
|
1058
1079
|
}
|
|
1059
1080
|
};
|
|
1060
|
-
|
|
1061
1081
|
//#endregion
|
|
1062
1082
|
//#region src/resend.ts
|
|
1063
1083
|
const defaultBaseUrl = "https://api.resend.com";
|
|
@@ -1070,6 +1090,7 @@ var Resend = class {
|
|
|
1070
1090
|
this.apiKeys = new ApiKeys(this);
|
|
1071
1091
|
this.segments = new Segments(this);
|
|
1072
1092
|
this.audiences = this.segments;
|
|
1093
|
+
this.automations = new Automations(this);
|
|
1073
1094
|
this.batch = new Batch(this);
|
|
1074
1095
|
this.broadcasts = new Broadcasts(this);
|
|
1075
1096
|
this.contacts = new Contacts(this);
|
|
@@ -1200,6 +1221,5 @@ var Resend = class {
|
|
|
1200
1221
|
return this.fetchRequest(path, requestOptions);
|
|
1201
1222
|
}
|
|
1202
1223
|
};
|
|
1203
|
-
|
|
1204
1224
|
//#endregion
|
|
1205
|
-
exports.Resend = Resend;
|
|
1225
|
+
exports.Resend = Resend;
|