@wix/auto_sdk_email-subscriptions_email-subscriptions 1.0.4 → 1.0.6
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/build/cjs/index.d.ts +71 -1
- package/build/cjs/index.js +482 -15
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +491 -1
- package/build/cjs/index.typings.js +408 -15
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +209 -1
- package/build/cjs/meta.js +334 -15
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +71 -0
- package/build/es/index.mjs +453 -0
- package/build/es/index.mjs.map +1 -0
- package/build/{internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.d.ts → es/index.typings.d.mts} +74 -126
- package/build/es/index.typings.mjs +380 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +209 -0
- package/build/es/meta.mjs +306 -0
- package/build/es/meta.mjs.map +1 -0
- package/build/internal/cjs/index.d.ts +82 -1
- package/build/internal/cjs/index.js +482 -15
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +502 -1
- package/build/internal/cjs/index.typings.js +408 -15
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +209 -1
- package/build/internal/cjs/meta.js +334 -15
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.d.mts +82 -0
- package/build/internal/es/index.mjs +453 -0
- package/build/internal/es/index.mjs.map +1 -0
- package/build/internal/es/{src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.d.ts → index.typings.d.mts} +75 -116
- package/build/internal/es/index.typings.mjs +380 -0
- package/build/internal/es/index.typings.mjs.map +1 -0
- package/build/internal/es/meta.d.mts +209 -0
- package/build/internal/es/meta.mjs +306 -0
- package/build/internal/es/meta.mjs.map +1 -0
- package/package.json +12 -10
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.d.ts +0 -12
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js +0 -20
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js.map +0 -1
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.d.ts +0 -41
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js +0 -239
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js.map +0 -1
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.d.ts +0 -19
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js +0 -123
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js.map +0 -1
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.d.ts +0 -64
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js +0 -54
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js.map +0 -1
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.d.ts +0 -403
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js +0 -36
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js.map +0 -1
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.d.ts +0 -530
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js +0 -273
- package/build/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js.map +0 -1
- package/build/es/index.d.ts +0 -1
- package/build/es/index.js +0 -2
- package/build/es/index.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -1
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/meta.d.ts +0 -1
- package/build/es/meta.js +0 -2
- package/build/es/meta.js.map +0 -1
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.d.ts +0 -12
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js +0 -14
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js.map +0 -1
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.d.ts +0 -41
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js +0 -231
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js.map +0 -1
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.d.ts +0 -19
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js +0 -92
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js.map +0 -1
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.d.ts +0 -64
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js +0 -43
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js.map +0 -1
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.d.ts +0 -403
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js +0 -33
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js.map +0 -1
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.d.ts +0 -530
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js +0 -242
- package/build/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js.map +0 -1
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.d.ts +0 -14
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js +0 -20
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js.map +0 -1
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.d.ts +0 -41
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js +0 -239
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js.map +0 -1
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.d.ts +0 -19
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js +0 -123
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js.map +0 -1
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.d.ts +0 -73
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js +0 -54
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js.map +0 -1
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.d.ts +0 -403
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js +0 -36
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js.map +0 -1
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js +0 -273
- package/build/internal/cjs/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js.map +0 -1
- package/build/internal/es/index.d.ts +0 -1
- package/build/internal/es/index.js +0 -2
- package/build/internal/es/index.js.map +0 -1
- package/build/internal/es/index.typings.d.ts +0 -1
- package/build/internal/es/index.typings.js +0 -2
- package/build/internal/es/index.typings.js.map +0 -1
- package/build/internal/es/meta.d.ts +0 -1
- package/build/internal/es/meta.js +0 -2
- package/build/internal/es/meta.js.map +0 -1
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.d.ts +0 -14
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js +0 -14
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.context.js.map +0 -1
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.d.ts +0 -41
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js +0 -231
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js.map +0 -1
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.d.ts +0 -19
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js +0 -92
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.meta.js.map +0 -1
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.d.ts +0 -73
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js +0 -43
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.public.js.map +0 -1
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.d.ts +0 -403
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js +0 -33
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.types.js.map +0 -1
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js +0 -242
- package/build/internal/es/src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.js.map +0 -1
@@ -0,0 +1,380 @@
|
|
1
|
+
// src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.ts
|
2
|
+
import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
|
3
|
+
import {
|
4
|
+
renameKeysFromSDKRequestToRESTRequest,
|
5
|
+
renameKeysFromRESTResponseToSDKResponse
|
6
|
+
} from "@wix/sdk-runtime/rename-all-nested-keys";
|
7
|
+
|
8
|
+
// src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.ts
|
9
|
+
import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
|
10
|
+
import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
|
11
|
+
import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
|
12
|
+
import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
|
13
|
+
import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
|
14
|
+
function resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl(opts) {
|
15
|
+
const domainToMappings = {
|
16
|
+
"editor._base_domain_": [
|
17
|
+
{
|
18
|
+
srcPath: "/_api/email-marketing/v1/email-subscriptions",
|
19
|
+
destPath: "/v1/email-subscriptions"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"blocks._base_domain_": [
|
23
|
+
{
|
24
|
+
srcPath: "/_api/email-marketing/v1/email-subscriptions",
|
25
|
+
destPath: "/v1/email-subscriptions"
|
26
|
+
}
|
27
|
+
],
|
28
|
+
"create.editorx": [
|
29
|
+
{
|
30
|
+
srcPath: "/_api/email-marketing/v1/email-subscriptions",
|
31
|
+
destPath: "/v1/email-subscriptions"
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"manage._base_domain_": [
|
35
|
+
{
|
36
|
+
srcPath: "/_api/email-marketing/v1/email-subscriptions",
|
37
|
+
destPath: "/v1/email-subscriptions"
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"www._base_domain_": [
|
41
|
+
{
|
42
|
+
srcPath: "/_api/email-marketing/v1/email-subscriptions",
|
43
|
+
destPath: "/v1/email-subscriptions"
|
44
|
+
}
|
45
|
+
],
|
46
|
+
"www.wixapis.com": [
|
47
|
+
{
|
48
|
+
srcPath: "/email-marketing/v1/email-subscriptions",
|
49
|
+
destPath: "/v1/email-subscriptions"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
srcPath: "/email-marketing/v1/email-subscriptions/unsubscribe-link",
|
53
|
+
destPath: "/v1/email-subscriptions/unsubscribe-link"
|
54
|
+
}
|
55
|
+
]
|
56
|
+
};
|
57
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
58
|
+
}
|
59
|
+
var PACKAGE_NAME = "@wix/auto_sdk_email-subscriptions_email-subscriptions";
|
60
|
+
function getEmailSubscription(payload) {
|
61
|
+
function __getEmailSubscription({ host }) {
|
62
|
+
const metadata = {
|
63
|
+
entityFqdn: "wix.emailsubscriptions.v1.emailsubscription",
|
64
|
+
method: "GET",
|
65
|
+
methodFqn: "com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.GetEmailSubscription",
|
66
|
+
packageName: PACKAGE_NAME,
|
67
|
+
url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({
|
68
|
+
protoPath: "/v1/email-subscriptions/{id}",
|
69
|
+
data: payload,
|
70
|
+
host
|
71
|
+
}),
|
72
|
+
params: toURLSearchParams(payload),
|
73
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
74
|
+
{
|
75
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
76
|
+
paths: [
|
77
|
+
{ path: "emailSubscription.createdDate" },
|
78
|
+
{ path: "emailSubscription.updatedDate" }
|
79
|
+
]
|
80
|
+
}
|
81
|
+
])
|
82
|
+
};
|
83
|
+
return metadata;
|
84
|
+
}
|
85
|
+
return __getEmailSubscription;
|
86
|
+
}
|
87
|
+
function queryEmailSubscriptions(payload) {
|
88
|
+
function __queryEmailSubscriptions({ host }) {
|
89
|
+
const metadata = {
|
90
|
+
entityFqdn: "wix.emailsubscriptions.v1.emailsubscription",
|
91
|
+
method: "POST",
|
92
|
+
methodFqn: "com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.QueryEmailSubscriptions",
|
93
|
+
packageName: PACKAGE_NAME,
|
94
|
+
url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({
|
95
|
+
protoPath: "/v1/email-subscriptions/query",
|
96
|
+
data: payload,
|
97
|
+
host
|
98
|
+
}),
|
99
|
+
data: payload,
|
100
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
101
|
+
{
|
102
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
103
|
+
paths: [
|
104
|
+
{ path: "subscriptions.createdDate" },
|
105
|
+
{ path: "subscriptions.updatedDate" }
|
106
|
+
]
|
107
|
+
}
|
108
|
+
])
|
109
|
+
};
|
110
|
+
return metadata;
|
111
|
+
}
|
112
|
+
return __queryEmailSubscriptions;
|
113
|
+
}
|
114
|
+
function upsertEmailSubscription(payload) {
|
115
|
+
function __upsertEmailSubscription({ host }) {
|
116
|
+
const serializedData = transformPaths(payload, [
|
117
|
+
{
|
118
|
+
transformFn: transformSDKTimestampToRESTTimestamp,
|
119
|
+
paths: [
|
120
|
+
{ path: "subscription.createdDate" },
|
121
|
+
{ path: "subscription.updatedDate" }
|
122
|
+
]
|
123
|
+
}
|
124
|
+
]);
|
125
|
+
const metadata = {
|
126
|
+
entityFqdn: "wix.emailsubscriptions.v1.emailsubscription",
|
127
|
+
method: "POST",
|
128
|
+
methodFqn: "com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.UpsertEmailSubscription",
|
129
|
+
packageName: PACKAGE_NAME,
|
130
|
+
url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({
|
131
|
+
protoPath: "/v1/email-subscriptions",
|
132
|
+
data: serializedData,
|
133
|
+
host
|
134
|
+
}),
|
135
|
+
data: serializedData,
|
136
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
137
|
+
{
|
138
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
139
|
+
paths: [
|
140
|
+
{ path: "subscription.createdDate" },
|
141
|
+
{ path: "subscription.updatedDate" }
|
142
|
+
]
|
143
|
+
}
|
144
|
+
])
|
145
|
+
};
|
146
|
+
return metadata;
|
147
|
+
}
|
148
|
+
return __upsertEmailSubscription;
|
149
|
+
}
|
150
|
+
function bulkUpsertEmailSubscription(payload) {
|
151
|
+
function __bulkUpsertEmailSubscription({ host }) {
|
152
|
+
const serializedData = transformPaths(payload, [
|
153
|
+
{
|
154
|
+
transformFn: transformSDKTimestampToRESTTimestamp,
|
155
|
+
paths: [
|
156
|
+
{ path: "subscriptions.createdDate" },
|
157
|
+
{ path: "subscriptions.updatedDate" }
|
158
|
+
]
|
159
|
+
}
|
160
|
+
]);
|
161
|
+
const metadata = {
|
162
|
+
entityFqdn: "wix.emailsubscriptions.v1.emailsubscription",
|
163
|
+
method: "POST",
|
164
|
+
methodFqn: "com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.BulkUpsertEmailSubscription",
|
165
|
+
packageName: PACKAGE_NAME,
|
166
|
+
url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({
|
167
|
+
protoPath: "/v1/email-subscriptions/bulk",
|
168
|
+
data: serializedData,
|
169
|
+
host
|
170
|
+
}),
|
171
|
+
data: serializedData,
|
172
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
173
|
+
{
|
174
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
175
|
+
paths: [
|
176
|
+
{ path: "results.emailSubscription.createdDate" },
|
177
|
+
{ path: "results.emailSubscription.updatedDate" }
|
178
|
+
]
|
179
|
+
}
|
180
|
+
])
|
181
|
+
};
|
182
|
+
return metadata;
|
183
|
+
}
|
184
|
+
return __bulkUpsertEmailSubscription;
|
185
|
+
}
|
186
|
+
function generateUnsubscribeLink(payload) {
|
187
|
+
function __generateUnsubscribeLink({ host }) {
|
188
|
+
const metadata = {
|
189
|
+
entityFqdn: "wix.emailsubscriptions.v1.emailsubscription",
|
190
|
+
method: "POST",
|
191
|
+
methodFqn: "com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.GenerateUnsubscribeLink",
|
192
|
+
packageName: PACKAGE_NAME,
|
193
|
+
url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({
|
194
|
+
protoPath: "/v1/email-subscriptions/unsubscribe-link",
|
195
|
+
data: payload,
|
196
|
+
host
|
197
|
+
}),
|
198
|
+
data: payload
|
199
|
+
};
|
200
|
+
return metadata;
|
201
|
+
}
|
202
|
+
return __generateUnsubscribeLink;
|
203
|
+
}
|
204
|
+
|
205
|
+
// src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.ts
|
206
|
+
var SubscriptionEnumStatus = /* @__PURE__ */ ((SubscriptionEnumStatus2) => {
|
207
|
+
SubscriptionEnumStatus2["UNKNOWN"] = "UNKNOWN";
|
208
|
+
SubscriptionEnumStatus2["NOT_SET"] = "NOT_SET";
|
209
|
+
SubscriptionEnumStatus2["PENDING"] = "PENDING";
|
210
|
+
SubscriptionEnumStatus2["SUBSCRIBED"] = "SUBSCRIBED";
|
211
|
+
SubscriptionEnumStatus2["UNSUBSCRIBED"] = "UNSUBSCRIBED";
|
212
|
+
return SubscriptionEnumStatus2;
|
213
|
+
})(SubscriptionEnumStatus || {});
|
214
|
+
var Status = /* @__PURE__ */ ((Status2) => {
|
215
|
+
Status2["NOT_SET"] = "NOT_SET";
|
216
|
+
Status2["VALID"] = "VALID";
|
217
|
+
Status2["BOUNCED"] = "BOUNCED";
|
218
|
+
Status2["SPAM_COMPLAINT"] = "SPAM_COMPLAINT";
|
219
|
+
Status2["INACTIVE"] = "INACTIVE";
|
220
|
+
return Status2;
|
221
|
+
})(Status || {});
|
222
|
+
var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
223
|
+
WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
|
224
|
+
WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
225
|
+
WebhookIdentityType2["MEMBER"] = "MEMBER";
|
226
|
+
WebhookIdentityType2["WIX_USER"] = "WIX_USER";
|
227
|
+
WebhookIdentityType2["APP"] = "APP";
|
228
|
+
return WebhookIdentityType2;
|
229
|
+
})(WebhookIdentityType || {});
|
230
|
+
async function getEmailSubscription2(_id) {
|
231
|
+
const { httpClient, sideEffects } = arguments[1];
|
232
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
233
|
+
const reqOpts = getEmailSubscription(
|
234
|
+
payload
|
235
|
+
);
|
236
|
+
sideEffects?.onSiteCall?.();
|
237
|
+
try {
|
238
|
+
const result = await httpClient.request(reqOpts);
|
239
|
+
sideEffects?.onSuccess?.(result);
|
240
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data)?.emailSubscription;
|
241
|
+
} catch (err) {
|
242
|
+
const transformedError = sdkTransformError(
|
243
|
+
err,
|
244
|
+
{
|
245
|
+
spreadPathsToArguments: {},
|
246
|
+
explicitPathsToArguments: { id: "$[0]" },
|
247
|
+
singleArgumentUnchanged: false
|
248
|
+
},
|
249
|
+
["_id"]
|
250
|
+
);
|
251
|
+
sideEffects?.onError?.(err);
|
252
|
+
throw transformedError;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
async function queryEmailSubscriptions2(filter, options) {
|
256
|
+
const { httpClient, sideEffects } = arguments[2];
|
257
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
258
|
+
filter,
|
259
|
+
paging: options?.paging
|
260
|
+
});
|
261
|
+
const reqOpts = queryEmailSubscriptions(
|
262
|
+
payload
|
263
|
+
);
|
264
|
+
sideEffects?.onSiteCall?.();
|
265
|
+
try {
|
266
|
+
const result = await httpClient.request(reqOpts);
|
267
|
+
sideEffects?.onSuccess?.(result);
|
268
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
269
|
+
} catch (err) {
|
270
|
+
const transformedError = sdkTransformError(
|
271
|
+
err,
|
272
|
+
{
|
273
|
+
spreadPathsToArguments: {},
|
274
|
+
explicitPathsToArguments: { filter: "$[0]", paging: "$[1].paging" },
|
275
|
+
singleArgumentUnchanged: false
|
276
|
+
},
|
277
|
+
["filter", "options"]
|
278
|
+
);
|
279
|
+
sideEffects?.onError?.(err);
|
280
|
+
throw transformedError;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
async function upsertEmailSubscription2(options) {
|
284
|
+
const { httpClient, sideEffects } = arguments[1];
|
285
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
286
|
+
subscription: options?.subscription
|
287
|
+
});
|
288
|
+
const reqOpts = upsertEmailSubscription(
|
289
|
+
payload
|
290
|
+
);
|
291
|
+
sideEffects?.onSiteCall?.();
|
292
|
+
try {
|
293
|
+
const result = await httpClient.request(reqOpts);
|
294
|
+
sideEffects?.onSuccess?.(result);
|
295
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
296
|
+
} catch (err) {
|
297
|
+
const transformedError = sdkTransformError(
|
298
|
+
err,
|
299
|
+
{
|
300
|
+
spreadPathsToArguments: {},
|
301
|
+
explicitPathsToArguments: { subscription: "$[0].subscription" },
|
302
|
+
singleArgumentUnchanged: false
|
303
|
+
},
|
304
|
+
["options"]
|
305
|
+
);
|
306
|
+
sideEffects?.onError?.(err);
|
307
|
+
throw transformedError;
|
308
|
+
}
|
309
|
+
}
|
310
|
+
async function bulkUpsertEmailSubscription2(subscriptions) {
|
311
|
+
const { httpClient, sideEffects } = arguments[1];
|
312
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
313
|
+
subscriptions
|
314
|
+
});
|
315
|
+
const reqOpts = bulkUpsertEmailSubscription(
|
316
|
+
payload
|
317
|
+
);
|
318
|
+
sideEffects?.onSiteCall?.();
|
319
|
+
try {
|
320
|
+
const result = await httpClient.request(reqOpts);
|
321
|
+
sideEffects?.onSuccess?.(result);
|
322
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
323
|
+
} catch (err) {
|
324
|
+
const transformedError = sdkTransformError(
|
325
|
+
err,
|
326
|
+
{
|
327
|
+
spreadPathsToArguments: {},
|
328
|
+
explicitPathsToArguments: { subscriptions: "$[0]" },
|
329
|
+
singleArgumentUnchanged: false
|
330
|
+
},
|
331
|
+
["subscriptions"]
|
332
|
+
);
|
333
|
+
sideEffects?.onError?.(err);
|
334
|
+
throw transformedError;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
async function generateUnsubscribeLink2(emailAddress, options) {
|
338
|
+
const { httpClient, sideEffects } = arguments[2];
|
339
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
340
|
+
emailAddress,
|
341
|
+
metadata: options?.metadata,
|
342
|
+
language: options?.language
|
343
|
+
});
|
344
|
+
const reqOpts = generateUnsubscribeLink(
|
345
|
+
payload
|
346
|
+
);
|
347
|
+
sideEffects?.onSiteCall?.();
|
348
|
+
try {
|
349
|
+
const result = await httpClient.request(reqOpts);
|
350
|
+
sideEffects?.onSuccess?.(result);
|
351
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
352
|
+
} catch (err) {
|
353
|
+
const transformedError = sdkTransformError(
|
354
|
+
err,
|
355
|
+
{
|
356
|
+
spreadPathsToArguments: {},
|
357
|
+
explicitPathsToArguments: {
|
358
|
+
emailAddress: "$[0]",
|
359
|
+
metadata: "$[1].metadata",
|
360
|
+
language: "$[1].language"
|
361
|
+
},
|
362
|
+
singleArgumentUnchanged: false
|
363
|
+
},
|
364
|
+
["emailAddress", "options"]
|
365
|
+
);
|
366
|
+
sideEffects?.onError?.(err);
|
367
|
+
throw transformedError;
|
368
|
+
}
|
369
|
+
}
|
370
|
+
export {
|
371
|
+
Status,
|
372
|
+
SubscriptionEnumStatus,
|
373
|
+
WebhookIdentityType,
|
374
|
+
bulkUpsertEmailSubscription2 as bulkUpsertEmailSubscription,
|
375
|
+
generateUnsubscribeLink2 as generateUnsubscribeLink,
|
376
|
+
getEmailSubscription2 as getEmailSubscription,
|
377
|
+
queryEmailSubscriptions2 as queryEmailSubscriptions,
|
378
|
+
upsertEmailSubscription2 as upsertEmailSubscription
|
379
|
+
};
|
380
|
+
//# sourceMappingURL=index.typings.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/emailsubscriptions-v1-emailsubscription-email-subscriptions.universal.ts","../../src/emailsubscriptions-v1-emailsubscription-email-subscriptions.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixEmailsubscriptionsV1Emailsubscription from './emailsubscriptions-v1-emailsubscription-email-subscriptions.http.js';\n\nexport interface EmailSubscription {\n /**\n * Email subscription ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /**\n * Email address.\n * @format EMAIL\n */\n email?: string;\n /**\n * Indicates the recipient's opt-in or opt-out status\n * for marketing emails.\n *\n * - `NOT_SET`: No status specified. This is the default, initial value before any info about the email address is known.\n * - `PENDING`: Subscription confirmation was requested,\n * but recipient hasn't confirmed yet.\n * - `SUBSCRIBED`: Recipient has opted in to marketing emails.\n * - `UNSUBSCRIBED`: Recipient has opted out of marketing emails.\n *\n * Defaults to `NOT_SET`.\n */\n subscriptionStatus?: SubscriptionEnumStatusWithLiterals;\n /**\n * Indicates last reported status of sent emails.\n *\n * - `NOT_SET`: No status specified. This is the default, initial value before any info about the email address is known.\n * - `VALID`: Emails to this email address are being delivered successfully.\n * - `BOUNCED`: The last email to the recipient bounced or was rejected.\n * - `SPAM_COMPLAINT`: The recipient registered a spam complaint\n * with their email provider.\n * - `INACTIVE`: Multiple campaigns have been delivered to this address without any engagement from the recipient. (No emails were opened and no content was clicked.)\n * This status might impact subsequent emails sent to this address.\n *\n * Defaults to `NOT_SET`.\n */\n deliverabilityStatus?: StatusWithLiterals;\n /**\n * Date and time the email subscription was created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the email subscription was last updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n}\n\nexport enum SubscriptionEnumStatus {\n UNKNOWN = 'UNKNOWN',\n /** No Subscription exists */\n NOT_SET = 'NOT_SET',\n /** Pending Subscription */\n PENDING = 'PENDING',\n /** Subscribed */\n SUBSCRIBED = 'SUBSCRIBED',\n /** UnSubscribed */\n UNSUBSCRIBED = 'UNSUBSCRIBED',\n}\n\n/** @enumType */\nexport type SubscriptionEnumStatusWithLiterals =\n | SubscriptionEnumStatus\n | 'UNKNOWN'\n | 'NOT_SET'\n | 'PENDING'\n | 'SUBSCRIBED'\n | 'UNSUBSCRIBED';\n\nexport enum Status {\n NOT_SET = 'NOT_SET',\n /** valid/deferral */\n VALID = 'VALID',\n /** bounced/rejected/invalid */\n BOUNCED = 'BOUNCED',\n /** spam/complaint */\n SPAM_COMPLAINT = 'SPAM_COMPLAINT',\n /** valid, but no activity reported */\n INACTIVE = 'INACTIVE',\n}\n\n/** @enumType */\nexport type StatusWithLiterals =\n | Status\n | 'NOT_SET'\n | 'VALID'\n | 'BOUNCED'\n | 'SPAM_COMPLAINT'\n | 'INACTIVE';\n\n/** Triggered when an email subscription's status is changed. */\nexport interface EmailSubscriptionChanged {\n /** Email subscription that changed. */\n subscription?: EmailSubscription;\n}\n\nexport interface GetEmailSubscriptionRequest {\n /** @format GUID */\n _id: string;\n}\n\nexport interface GetEmailSubscriptionResponse {\n /** Returned email subscription */\n emailSubscription?: EmailSubscription;\n}\n\nexport interface UpdateEmailSubscriptionRequest {\n /** Email subscription to update */\n subscription?: EmailSubscription;\n}\n\nexport interface UpdateEmailSubscriptionResponse {\n /** Updated email subscription */\n subscription?: EmailSubscription;\n}\n\nexport interface QueryEmailSubscriptionsRequest {\n /**\n * Filter options.\n * Currently, querying is supported on the `email` field\n * with the `$in` array filter.\n */\n filter: Record<string, any> | null;\n /**\n * Pagination options. For more information, see\n * [Pagination](https://dev.wix.com/api/rest/getting-started/pagination).\n */\n paging?: Paging;\n}\n\nexport interface Paging {\n /** Number of items to load. */\n limit?: number | null;\n /** Number of items to skip in the current sort order. */\n offset?: number | null;\n}\n\nexport interface QueryEmailSubscriptionsResponse {\n /** List of subscribed emails that matched the query options. */\n subscriptions?: EmailSubscription[];\n /** Metadata for the paginated results. */\n metadata?: PagingMetadata;\n}\n\nexport interface PagingMetadata {\n /** Number of items returned in the response. */\n count?: number | null;\n /** Offset that was requested. */\n offset?: number | null;\n /** Total number of items that match the query. */\n total?: number | null;\n /** Flag that indicates the server failed to calculate the `total` field. */\n tooManyToCount?: boolean | null;\n}\n\nexport interface UpsertEmailSubscriptionRequest {\n /** Email subscription to update or create. */\n subscription?: EmailSubscription;\n}\n\nexport interface UpsertEmailSubscriptionResponse {\n /** Updated or created email subscription. */\n subscription?: EmailSubscription;\n}\n\nexport interface BulkUpsertEmailSubscriptionRequest {\n /**\n * List of email subscriptions to update or create.\n * @minSize 1\n * @maxSize 100\n */\n subscriptions: EmailSubscription[];\n}\n\nexport interface BulkUpsertEmailSubscriptionResponse {\n /** List of updated or created email subscriptions. */\n results?: BulkUpsertEmailSubscriptionResult[];\n /** Numbers of successful and failed actions. */\n metadata?: Metadata;\n}\n\nexport interface BulkUpsertEmailSubscriptionResult {\n /** Position of the requested email subscription in the bulk array. */\n originalIndex?: number;\n /** New or updated email subscription. */\n emailSubscription?: EmailSubscription;\n /**\n * Error information if the action failed.\n * Omitted from successful actions.\n */\n error?: Error;\n}\n\nexport interface Error {\n /** Error code. */\n errorCode?: string;\n /** Message that contains details about the error. */\n message?: string;\n}\n\nexport interface Metadata {\n /** Number of successful actions. */\n totalSuccess?: number;\n /** Number of failed actions. */\n totalFailure?: number;\n}\n\nexport interface GenerateUnsubscribeLinkRequest {\n /**\n * Email address the unsubscribe link is for.\n * @format EMAIL\n */\n emailAddress: string;\n /** Arbitrary parameters for closing-the-loop. */\n metadata?: Record<string, string>;\n /**\n * Language for displaying unsubscribe confirmation page.\n *\n * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `EN`\n * @format LANGUAGE\n */\n language?: string | null;\n}\n\nexport interface GenerateUnsubscribeLinkResponse {\n /** The unsubscribe link. */\n link?: string;\n}\n\nexport interface RenderUnsubscribePageRequest {\n /** Payload */\n payload?: string;\n /** Language */\n language?: string | null;\n}\n\nexport interface RawHttpResponse {\n body?: Uint8Array;\n statusCode?: number | null;\n headers?: HeadersEntry[];\n}\n\nexport interface HeadersEntry {\n key?: string;\n value?: string;\n}\n\nexport interface ConfirmUnsubscribeActionRequest {\n /** Payload */\n payload?: string;\n}\n\nexport interface Empty {}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\n\nexport interface V1RenderUnsubscribePageRequest {\n /** Payload */\n payload?: string;\n /** Language */\n language?: string | null;\n}\n\nexport interface V1ConfirmUnsubscribeActionRequest {\n /** Payload */\n payload?: string;\n}\n\nexport interface BaseEventMetadata {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n}\n\nexport interface EmailsubscriptionEmailSubscriptionChangedEnvelope {\n data: EmailSubscriptionChanged;\n metadata: BaseEventMetadata;\n}\n\n/** @permissionScope Manage Stores\n * @permissionScopeId SCOPE.STORES.MANAGE-STORES\n * @permissionScope Manage Email Subscriptions\n * @permissionScopeId SCOPE.DC-MANAGE.EMAIL-SUBSCRIPTIONS\n * @permissionId EMAIL_SUBSCRIPTIONS.VIEW\n * @webhook\n * @eventType com.wixpress.emailsubscriptions.v1.EmailSubscriptionChanged\n * @serviceIdentifier com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService\n * @slug email_subscription_changed\n * @documentationMaturity preview\n */\nexport declare function onEmailsubscriptionEmailSubscriptionChanged(\n handler: (\n event: EmailsubscriptionEmailSubscriptionChangedEnvelope\n ) => void | Promise<void>\n): void;\n\n/**\n * Get Email Subscription\n * @internal\n * @documentationMaturity preview\n * @requiredField _id\n * @permissionId EMAIL_SUBSCRIPTIONS.VIEW\n * @applicableIdentity APP\n * @returns Returned email subscription\n * @fqn com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.GetEmailSubscription\n */\nexport async function getEmailSubscription(\n _id: string\n): Promise<\n NonNullablePaths<\n EmailSubscription,\n `email` | `subscriptionStatus` | `deliverabilityStatus`,\n 2\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });\n\n const reqOpts =\n ambassadorWixEmailsubscriptionsV1Emailsubscription.getEmailSubscription(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)\n ?.emailSubscription!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { id: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['_id']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Retrieves email subscriptions,\n * given the provided paging, filtering, and sorting.\n *\n * Currently, querying is supported on the `email` field\n * with the `$in` array filter.\n * For example, to query for emails `\"me@my.com\"` and `\"you@your.org\"`,\n * the filter should be formed like this:\n *\n * ```json\n * { \"filter\": {\n * \"email\": {\n * \"$in\": [\"me@my.com\", \"you@your.org\"]\n * }\n * }\n * }\n * ```\n *\n * To learn how to query email subscriptions, see\n * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).\n * @param filter - Filter options.\n * Currently, querying is supported on the `email` field\n * with the `$in` array filter.\n * @public\n * @documentationMaturity preview\n * @requiredField filter\n * @permissionId EMAIL_SUBSCRIPTIONS.VIEW\n * @applicableIdentity APP\n * @fqn com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.QueryEmailSubscriptions\n */\nexport async function queryEmailSubscriptions(\n filter: Record<string, any>,\n options?: QueryEmailSubscriptionsOptions\n): Promise<\n NonNullablePaths<\n QueryEmailSubscriptionsResponse,\n | `subscriptions`\n | `subscriptions.${number}.email`\n | `subscriptions.${number}.subscriptionStatus`\n | `subscriptions.${number}.deliverabilityStatus`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n filter: filter,\n paging: options?.paging,\n });\n\n const reqOpts =\n ambassadorWixEmailsubscriptionsV1Emailsubscription.queryEmailSubscriptions(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { filter: '$[0]', paging: '$[1].paging' },\n singleArgumentUnchanged: false,\n },\n ['filter', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface QueryEmailSubscriptionsOptions {\n /**\n * Pagination options. For more information, see\n * [Pagination](https://dev.wix.com/api/rest/getting-started/pagination).\n */\n paging?: Paging;\n}\n\n/**\n * Updates or creates an email subscription for the requested email.\n *\n * An email subscription is returned in the response\n * whether it was updated or created.\n * @public\n * @documentationMaturity preview\n * @requiredField options.subscription.email\n * @permissionId EMAIL_SUBSCRIPTIONS.MODIFY\n * @applicableIdentity APP\n * @fqn com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.UpsertEmailSubscription\n */\nexport async function upsertEmailSubscription(\n options?: NonNullablePaths<\n UpsertEmailSubscriptionOptions,\n `subscription.email`,\n 3\n >\n): Promise<\n NonNullablePaths<\n UpsertEmailSubscriptionResponse,\n | `subscription.email`\n | `subscription.subscriptionStatus`\n | `subscription.deliverabilityStatus`,\n 3\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n subscription: options?.subscription,\n });\n\n const reqOpts =\n ambassadorWixEmailsubscriptionsV1Emailsubscription.upsertEmailSubscription(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { subscription: '$[0].subscription' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface UpsertEmailSubscriptionOptions {\n /** Email subscription to update or create. */\n subscription?: EmailSubscription;\n}\n\n/**\n * Updates or creates multiple email subscriptions.\n * @param subscriptions - List of email subscriptions to update or create.\n * @public\n * @documentationMaturity preview\n * @requiredField subscriptions\n * @permissionId EMAIL_SUBSCRIPTIONS.MODIFY\n * @applicableIdentity APP\n * @fqn com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.BulkUpsertEmailSubscription\n */\nexport async function bulkUpsertEmailSubscription(\n subscriptions: EmailSubscription[]\n): Promise<\n NonNullablePaths<\n BulkUpsertEmailSubscriptionResponse,\n | `results`\n | `results.${number}.originalIndex`\n | `results.${number}.emailSubscription.email`\n | `results.${number}.emailSubscription.subscriptionStatus`\n | `results.${number}.emailSubscription.deliverabilityStatus`\n | `results.${number}.error.errorCode`\n | `results.${number}.error.message`\n | `metadata.totalSuccess`\n | `metadata.totalFailure`,\n 5\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n subscriptions: subscriptions,\n });\n\n const reqOpts =\n ambassadorWixEmailsubscriptionsV1Emailsubscription.bulkUpsertEmailSubscription(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { subscriptions: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['subscriptions']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Creates an unsubscribe link to be shared with the relevant recipient.\n *\n * If someone clicks the **Unsubscribe** button on the confirmation page,\n * the recipient's `subscriptionStatus` is changed to `UNSUBSCRIBED`.\n * @param emailAddress - Email address the unsubscribe link is for.\n * @public\n * @documentationMaturity preview\n * @requiredField emailAddress\n * @permissionId EMAIL_SUBSCRIPTIONS.VIEW\n * @applicableIdentity APP\n * @fqn com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.GenerateUnsubscribeLink\n */\nexport async function generateUnsubscribeLink(\n emailAddress: string,\n options?: GenerateUnsubscribeLinkOptions\n): Promise<NonNullablePaths<GenerateUnsubscribeLinkResponse, `link`, 2>> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n emailAddress: emailAddress,\n metadata: options?.metadata,\n language: options?.language,\n });\n\n const reqOpts =\n ambassadorWixEmailsubscriptionsV1Emailsubscription.generateUnsubscribeLink(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n emailAddress: '$[0]',\n metadata: '$[1].metadata',\n language: '$[1].language',\n },\n singleArgumentUnchanged: false,\n },\n ['emailAddress', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GenerateUnsubscribeLinkOptions {\n /** Arbitrary parameters for closing-the-loop. */\n metadata?: Record<string, string>;\n /**\n * Language for displaying unsubscribe confirmation page.\n *\n * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.\n *\n * Default: `EN`\n * @format LANGUAGE\n */\n language?: string | null;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'editor._base_domain_': [\n {\n srcPath: '/_api/email-marketing/v1/email-subscriptions',\n destPath: '/v1/email-subscriptions',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/email-marketing/v1/email-subscriptions',\n destPath: '/v1/email-subscriptions',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/email-marketing/v1/email-subscriptions',\n destPath: '/v1/email-subscriptions',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/email-marketing/v1/email-subscriptions',\n destPath: '/v1/email-subscriptions',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/email-marketing/v1/email-subscriptions',\n destPath: '/v1/email-subscriptions',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/email-marketing/v1/email-subscriptions',\n destPath: '/v1/email-subscriptions',\n },\n {\n srcPath: '/email-marketing/v1/email-subscriptions/unsubscribe-link',\n destPath: '/v1/email-subscriptions/unsubscribe-link',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_email-subscriptions_email-subscriptions';\n\n/** Get Email Subscription */\nexport function getEmailSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __getEmailSubscription({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.emailsubscriptions.v1.emailsubscription',\n method: 'GET' as any,\n methodFqn:\n 'com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.GetEmailSubscription',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({\n protoPath: '/v1/email-subscriptions/{id}',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'emailSubscription.createdDate' },\n { path: 'emailSubscription.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getEmailSubscription;\n}\n\n/**\n * Retrieves email subscriptions,\n * given the provided paging, filtering, and sorting.\n *\n * Currently, querying is supported on the `email` field\n * with the `$in` array filter.\n * For example, to query for emails `\"me@my.com\"` and `\"you@your.org\"`,\n * the filter should be formed like this:\n *\n * ```json\n * { \"filter\": {\n * \"email\": {\n * \"$in\": [\"me@my.com\", \"you@your.org\"]\n * }\n * }\n * }\n * ```\n *\n * To learn how to query email subscriptions, see\n * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).\n */\nexport function queryEmailSubscriptions(\n payload: object\n): RequestOptionsFactory<any> {\n function __queryEmailSubscriptions({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.emailsubscriptions.v1.emailsubscription',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.QueryEmailSubscriptions',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({\n protoPath: '/v1/email-subscriptions/query',\n data: payload,\n host,\n }),\n data: payload,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'subscriptions.createdDate' },\n { path: 'subscriptions.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __queryEmailSubscriptions;\n}\n\n/**\n * Updates or creates an email subscription for the requested email.\n *\n * An email subscription is returned in the response\n * whether it was updated or created.\n */\nexport function upsertEmailSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __upsertEmailSubscription({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'subscription.createdDate' },\n { path: 'subscription.updatedDate' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.emailsubscriptions.v1.emailsubscription',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.UpsertEmailSubscription',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({\n protoPath: '/v1/email-subscriptions',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'subscription.createdDate' },\n { path: 'subscription.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __upsertEmailSubscription;\n}\n\n/** Updates or creates multiple email subscriptions. */\nexport function bulkUpsertEmailSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkUpsertEmailSubscription({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'subscriptions.createdDate' },\n { path: 'subscriptions.updatedDate' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.emailsubscriptions.v1.emailsubscription',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.BulkUpsertEmailSubscription',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({\n protoPath: '/v1/email-subscriptions/bulk',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'results.emailSubscription.createdDate' },\n { path: 'results.emailSubscription.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __bulkUpsertEmailSubscription;\n}\n\n/**\n * Creates an unsubscribe link to be shared with the relevant recipient.\n *\n * If someone clicks the **Unsubscribe** button on the confirmation page,\n * the recipient's `subscriptionStatus` is changed to `UNSUBSCRIBED`.\n */\nexport function generateUnsubscribeLink(\n payload: object\n): RequestOptionsFactory<any> {\n function __generateUnsubscribeLink({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.emailsubscriptions.v1.emailsubscription',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.emailsubscriptions.v1.EmailSubscriptionsService.GenerateUnsubscribeLink',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressEmailsubscriptionsV1EmailSubscriptionsServiceUrl({\n protoPath: '/v1/email-subscriptions/unsubscribe-link',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateUnsubscribeLink;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,mEACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA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AAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,cAAc;AAAA,UACd,UAAU;AAAA,UACV,UAAU;AAAA,QACZ;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,gBAAgB,SAAS;AAAA,IAC5B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["payload","SubscriptionEnumStatus","Status","WebhookIdentityType","getEmailSubscription","queryEmailSubscriptions","upsertEmailSubscription","bulkUpsertEmailSubscription","generateUnsubscribeLink"]}
|
@@ -0,0 +1,209 @@
|
|
1
|
+
import { GetEmailSubscriptionRequest as GetEmailSubscriptionRequest$1, GetEmailSubscriptionResponse as GetEmailSubscriptionResponse$1, QueryEmailSubscriptionsRequest as QueryEmailSubscriptionsRequest$1, QueryEmailSubscriptionsResponse as QueryEmailSubscriptionsResponse$1, UpsertEmailSubscriptionRequest as UpsertEmailSubscriptionRequest$1, UpsertEmailSubscriptionResponse as UpsertEmailSubscriptionResponse$1, BulkUpsertEmailSubscriptionRequest as BulkUpsertEmailSubscriptionRequest$1, BulkUpsertEmailSubscriptionResponse as BulkUpsertEmailSubscriptionResponse$1, GenerateUnsubscribeLinkRequest as GenerateUnsubscribeLinkRequest$1, GenerateUnsubscribeLinkResponse as GenerateUnsubscribeLinkResponse$1 } from './index.typings.mjs';
|
2
|
+
import '@wix/sdk-types';
|
3
|
+
|
4
|
+
interface EmailSubscription {
|
5
|
+
/**
|
6
|
+
* Email subscription ID.
|
7
|
+
* @format GUID
|
8
|
+
* @readonly
|
9
|
+
*/
|
10
|
+
id?: string | null;
|
11
|
+
/**
|
12
|
+
* Email address.
|
13
|
+
* @format EMAIL
|
14
|
+
*/
|
15
|
+
email?: string;
|
16
|
+
/**
|
17
|
+
* Indicates the recipient's opt-in or opt-out status
|
18
|
+
* for marketing emails.
|
19
|
+
*
|
20
|
+
* - `NOT_SET`: No status specified. This is the default, initial value before any info about the email address is known.
|
21
|
+
* - `PENDING`: Subscription confirmation was requested,
|
22
|
+
* but recipient hasn't confirmed yet.
|
23
|
+
* - `SUBSCRIBED`: Recipient has opted in to marketing emails.
|
24
|
+
* - `UNSUBSCRIBED`: Recipient has opted out of marketing emails.
|
25
|
+
*
|
26
|
+
* Defaults to `NOT_SET`.
|
27
|
+
*/
|
28
|
+
subscriptionStatus?: SubscriptionEnumStatusWithLiterals;
|
29
|
+
/**
|
30
|
+
* Indicates last reported status of sent emails.
|
31
|
+
*
|
32
|
+
* - `NOT_SET`: No status specified. This is the default, initial value before any info about the email address is known.
|
33
|
+
* - `VALID`: Emails to this email address are being delivered successfully.
|
34
|
+
* - `BOUNCED`: The last email to the recipient bounced or was rejected.
|
35
|
+
* - `SPAM_COMPLAINT`: The recipient registered a spam complaint
|
36
|
+
* with their email provider.
|
37
|
+
* - `INACTIVE`: Multiple campaigns have been delivered to this address without any engagement from the recipient. (No emails were opened and no content was clicked.)
|
38
|
+
* This status might impact subsequent emails sent to this address.
|
39
|
+
*
|
40
|
+
* Defaults to `NOT_SET`.
|
41
|
+
*/
|
42
|
+
deliverabilityStatus?: StatusWithLiterals;
|
43
|
+
/**
|
44
|
+
* Date and time the email subscription was created.
|
45
|
+
* @readonly
|
46
|
+
*/
|
47
|
+
createdDate?: Date | null;
|
48
|
+
/**
|
49
|
+
* Date and time the email subscription was last updated.
|
50
|
+
* @readonly
|
51
|
+
*/
|
52
|
+
updatedDate?: Date | null;
|
53
|
+
}
|
54
|
+
declare enum SubscriptionEnumStatus {
|
55
|
+
UNKNOWN = "UNKNOWN",
|
56
|
+
/** No Subscription exists */
|
57
|
+
NOT_SET = "NOT_SET",
|
58
|
+
/** Pending Subscription */
|
59
|
+
PENDING = "PENDING",
|
60
|
+
/** Subscribed */
|
61
|
+
SUBSCRIBED = "SUBSCRIBED",
|
62
|
+
/** UnSubscribed */
|
63
|
+
UNSUBSCRIBED = "UNSUBSCRIBED"
|
64
|
+
}
|
65
|
+
/** @enumType */
|
66
|
+
type SubscriptionEnumStatusWithLiterals = SubscriptionEnumStatus | 'UNKNOWN' | 'NOT_SET' | 'PENDING' | 'SUBSCRIBED' | 'UNSUBSCRIBED';
|
67
|
+
declare enum Status {
|
68
|
+
NOT_SET = "NOT_SET",
|
69
|
+
/** valid/deferral */
|
70
|
+
VALID = "VALID",
|
71
|
+
/** bounced/rejected/invalid */
|
72
|
+
BOUNCED = "BOUNCED",
|
73
|
+
/** spam/complaint */
|
74
|
+
SPAM_COMPLAINT = "SPAM_COMPLAINT",
|
75
|
+
/** valid, but no activity reported */
|
76
|
+
INACTIVE = "INACTIVE"
|
77
|
+
}
|
78
|
+
/** @enumType */
|
79
|
+
type StatusWithLiterals = Status | 'NOT_SET' | 'VALID' | 'BOUNCED' | 'SPAM_COMPLAINT' | 'INACTIVE';
|
80
|
+
interface GetEmailSubscriptionRequest {
|
81
|
+
/** @format GUID */
|
82
|
+
id: string;
|
83
|
+
}
|
84
|
+
interface GetEmailSubscriptionResponse {
|
85
|
+
/** Returned email subscription */
|
86
|
+
emailSubscription?: EmailSubscription;
|
87
|
+
}
|
88
|
+
interface QueryEmailSubscriptionsRequest {
|
89
|
+
/**
|
90
|
+
* Filter options.
|
91
|
+
* Currently, querying is supported on the `email` field
|
92
|
+
* with the `$in` array filter.
|
93
|
+
*/
|
94
|
+
filter: Record<string, any> | null;
|
95
|
+
/**
|
96
|
+
* Pagination options. For more information, see
|
97
|
+
* [Pagination](https://dev.wix.com/api/rest/getting-started/pagination).
|
98
|
+
*/
|
99
|
+
paging?: Paging;
|
100
|
+
}
|
101
|
+
interface Paging {
|
102
|
+
/** Number of items to load. */
|
103
|
+
limit?: number | null;
|
104
|
+
/** Number of items to skip in the current sort order. */
|
105
|
+
offset?: number | null;
|
106
|
+
}
|
107
|
+
interface QueryEmailSubscriptionsResponse {
|
108
|
+
/** List of subscribed emails that matched the query options. */
|
109
|
+
subscriptions?: EmailSubscription[];
|
110
|
+
/** Metadata for the paginated results. */
|
111
|
+
metadata?: PagingMetadata;
|
112
|
+
}
|
113
|
+
interface PagingMetadata {
|
114
|
+
/** Number of items returned in the response. */
|
115
|
+
count?: number | null;
|
116
|
+
/** Offset that was requested. */
|
117
|
+
offset?: number | null;
|
118
|
+
/** Total number of items that match the query. */
|
119
|
+
total?: number | null;
|
120
|
+
/** Flag that indicates the server failed to calculate the `total` field. */
|
121
|
+
tooManyToCount?: boolean | null;
|
122
|
+
}
|
123
|
+
interface UpsertEmailSubscriptionRequest {
|
124
|
+
/** Email subscription to update or create. */
|
125
|
+
subscription?: EmailSubscription;
|
126
|
+
}
|
127
|
+
interface UpsertEmailSubscriptionResponse {
|
128
|
+
/** Updated or created email subscription. */
|
129
|
+
subscription?: EmailSubscription;
|
130
|
+
}
|
131
|
+
interface BulkUpsertEmailSubscriptionRequest {
|
132
|
+
/**
|
133
|
+
* List of email subscriptions to update or create.
|
134
|
+
* @minSize 1
|
135
|
+
* @maxSize 100
|
136
|
+
*/
|
137
|
+
subscriptions: EmailSubscription[];
|
138
|
+
}
|
139
|
+
interface BulkUpsertEmailSubscriptionResponse {
|
140
|
+
/** List of updated or created email subscriptions. */
|
141
|
+
results?: BulkUpsertEmailSubscriptionResult[];
|
142
|
+
/** Numbers of successful and failed actions. */
|
143
|
+
metadata?: Metadata;
|
144
|
+
}
|
145
|
+
interface BulkUpsertEmailSubscriptionResult {
|
146
|
+
/** Position of the requested email subscription in the bulk array. */
|
147
|
+
originalIndex?: number;
|
148
|
+
/** New or updated email subscription. */
|
149
|
+
emailSubscription?: EmailSubscription;
|
150
|
+
/**
|
151
|
+
* Error information if the action failed.
|
152
|
+
* Omitted from successful actions.
|
153
|
+
*/
|
154
|
+
error?: Error;
|
155
|
+
}
|
156
|
+
interface Error {
|
157
|
+
/** Error code. */
|
158
|
+
errorCode?: string;
|
159
|
+
/** Message that contains details about the error. */
|
160
|
+
message?: string;
|
161
|
+
}
|
162
|
+
interface Metadata {
|
163
|
+
/** Number of successful actions. */
|
164
|
+
totalSuccess?: number;
|
165
|
+
/** Number of failed actions. */
|
166
|
+
totalFailure?: number;
|
167
|
+
}
|
168
|
+
interface GenerateUnsubscribeLinkRequest {
|
169
|
+
/**
|
170
|
+
* Email address the unsubscribe link is for.
|
171
|
+
* @format EMAIL
|
172
|
+
*/
|
173
|
+
emailAddress: string;
|
174
|
+
/** Arbitrary parameters for closing-the-loop. */
|
175
|
+
metadata?: Record<string, string>;
|
176
|
+
/**
|
177
|
+
* Language for displaying unsubscribe confirmation page.
|
178
|
+
*
|
179
|
+
* 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
|
180
|
+
*
|
181
|
+
* Default: `EN`
|
182
|
+
* @format LANGUAGE
|
183
|
+
*/
|
184
|
+
language?: string | null;
|
185
|
+
}
|
186
|
+
interface GenerateUnsubscribeLinkResponse {
|
187
|
+
/** The unsubscribe link. */
|
188
|
+
link?: string;
|
189
|
+
}
|
190
|
+
|
191
|
+
type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
|
192
|
+
getUrl: (context: any) => string;
|
193
|
+
httpMethod: K;
|
194
|
+
path: string;
|
195
|
+
pathParams: M;
|
196
|
+
__requestType: T;
|
197
|
+
__originalRequestType: S;
|
198
|
+
__responseType: Q;
|
199
|
+
__originalResponseType: R;
|
200
|
+
};
|
201
|
+
declare function getEmailSubscription(): __PublicMethodMetaInfo<'GET', {
|
202
|
+
id: string;
|
203
|
+
}, GetEmailSubscriptionRequest$1, GetEmailSubscriptionRequest, GetEmailSubscriptionResponse$1, GetEmailSubscriptionResponse>;
|
204
|
+
declare function queryEmailSubscriptions(): __PublicMethodMetaInfo<'POST', {}, QueryEmailSubscriptionsRequest$1, QueryEmailSubscriptionsRequest, QueryEmailSubscriptionsResponse$1, QueryEmailSubscriptionsResponse>;
|
205
|
+
declare function upsertEmailSubscription(): __PublicMethodMetaInfo<'POST', {}, UpsertEmailSubscriptionRequest$1, UpsertEmailSubscriptionRequest, UpsertEmailSubscriptionResponse$1, UpsertEmailSubscriptionResponse>;
|
206
|
+
declare function bulkUpsertEmailSubscription(): __PublicMethodMetaInfo<'POST', {}, BulkUpsertEmailSubscriptionRequest$1, BulkUpsertEmailSubscriptionRequest, BulkUpsertEmailSubscriptionResponse$1, BulkUpsertEmailSubscriptionResponse>;
|
207
|
+
declare function generateUnsubscribeLink(): __PublicMethodMetaInfo<'POST', {}, GenerateUnsubscribeLinkRequest$1, GenerateUnsubscribeLinkRequest, GenerateUnsubscribeLinkResponse$1, GenerateUnsubscribeLinkResponse>;
|
208
|
+
|
209
|
+
export { type __PublicMethodMetaInfo, bulkUpsertEmailSubscription, generateUnsubscribeLink, getEmailSubscription, queryEmailSubscriptions, upsertEmailSubscription };
|