@novu/api 0.1.6 → 0.2.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/FUNCTIONS.md +1 -1
- package/README.md +14 -31
- package/docs/sdks/authentication/README.md +4 -4
- package/docs/sdks/credentials/README.md +6 -6
- package/docs/sdks/integrations/README.md +12 -12
- package/docs/sdks/messages/README.md +6 -6
- package/docs/sdks/notifications/README.md +4 -4
- package/docs/sdks/novu/README.md +8 -8
- package/docs/sdks/novumessages/README.md +6 -6
- package/docs/sdks/novunotifications/README.md +4 -4
- package/docs/sdks/novusubscribers/README.md +6 -6
- package/docs/sdks/preferences/README.md +9 -260
- package/docs/sdks/properties/README.md +2 -2
- package/docs/sdks/stats/README.md +4 -4
- package/docs/sdks/subscribers/README.md +50 -322
- package/docs/sdks/topics/README.md +10 -10
- package/docs/sdks/webhooks/README.md +2 -2
- package/funcs/subscribersCreate.d.ts +2 -2
- package/funcs/subscribersCreate.d.ts.map +1 -1
- package/funcs/subscribersCreate.js +5 -5
- package/funcs/subscribersCreate.js.map +1 -1
- package/funcs/{subscribersPreferencesRetrieve.d.ts → subscribersPreferencesList.d.ts} +2 -2
- package/funcs/subscribersPreferencesList.d.ts.map +1 -0
- package/funcs/{subscribersPreferencesRetrieve.js → subscribersPreferencesList.js} +4 -4
- package/funcs/subscribersPreferencesList.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/index.d.ts +0 -14
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +0 -14
- package/models/components/index.js.map +1 -1
- package/models/components/subscriberresponsedto.d.ts +5 -0
- package/models/components/subscriberresponsedto.d.ts.map +1 -1
- package/models/components/subscriberresponsedto.js +2 -0
- package/models/components/subscriberresponsedto.js.map +1 -1
- package/models/operations/index.d.ts +1 -8
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -8
- package/models/operations/index.js.map +1 -1
- package/models/operations/subscriberscontrollercreatesubscriber.d.ts +66 -0
- package/models/operations/subscriberscontrollercreatesubscriber.d.ts.map +1 -0
- package/models/operations/subscriberscontrollercreatesubscriber.js +112 -0
- package/models/operations/subscriberscontrollercreatesubscriber.js.map +1 -0
- package/package.json +1 -1
- package/sdk/preferences.d.ts +1 -20
- package/sdk/preferences.d.ts.map +1 -1
- package/sdk/preferences.js +3 -32
- package/sdk/preferences.js.map +1 -1
- package/sdk/subscribers.d.ts +9 -32
- package/sdk/subscribers.d.ts.map +1 -1
- package/sdk/subscribers.js +12 -44
- package/sdk/subscribers.js.map +1 -1
- package/sources/json-development.json +2313 -6112
- package/src/funcs/subscribersCreate.ts +9 -9
- package/src/funcs/{subscribersPreferencesRetrieve.ts → subscribersPreferencesList.ts} +1 -1
- package/src/lib/config.ts +3 -3
- package/src/models/components/index.ts +0 -14
- package/src/models/components/subscriberresponsedto.ts +7 -0
- package/src/models/operations/index.ts +1 -8
- package/src/models/operations/subscriberscontrollercreatesubscriber.ts +185 -0
- package/src/sdk/preferences.ts +3 -70
- package/src/sdk/subscribers.ts +24 -90
- package/docs/sdks/legacy/README.md +0 -86
- package/funcs/subscribersDeleteLegacy.d.ts +0 -18
- package/funcs/subscribersDeleteLegacy.d.ts.map +0 -1
- package/funcs/subscribersDeleteLegacy.js +0 -141
- package/funcs/subscribersDeleteLegacy.js.map +0 -1
- package/funcs/subscribersPreferencesLegacyUpdateGlobal.d.ts +0 -14
- package/funcs/subscribersPreferencesLegacyUpdateGlobal.d.ts.map +0 -1
- package/funcs/subscribersPreferencesLegacyUpdateGlobal.js +0 -140
- package/funcs/subscribersPreferencesLegacyUpdateGlobal.js.map +0 -1
- package/funcs/subscribersPreferencesListLegacy.d.ts +0 -15
- package/funcs/subscribersPreferencesListLegacy.d.ts.map +0 -1
- package/funcs/subscribersPreferencesListLegacy.js +0 -145
- package/funcs/subscribersPreferencesListLegacy.js.map +0 -1
- package/funcs/subscribersPreferencesRetrieve.d.ts.map +0 -1
- package/funcs/subscribersPreferencesRetrieve.js.map +0 -1
- package/funcs/subscribersPreferencesRetrieveByLevelLegacy.d.ts +0 -15
- package/funcs/subscribersPreferencesRetrieveByLevelLegacy.d.ts.map +0 -1
- package/funcs/subscribersPreferencesRetrieveByLevelLegacy.js +0 -144
- package/funcs/subscribersPreferencesRetrieveByLevelLegacy.js.map +0 -1
- package/funcs/subscribersPreferencesUpdateLegacy.d.ts +0 -13
- package/funcs/subscribersPreferencesUpdateLegacy.d.ts.map +0 -1
- package/funcs/subscribersPreferencesUpdateLegacy.js +0 -139
- package/funcs/subscribersPreferencesUpdateLegacy.js.map +0 -1
- package/funcs/subscribersRetrieveLegacy.d.ts +0 -16
- package/funcs/subscribersRetrieveLegacy.d.ts.map +0 -1
- package/funcs/subscribersRetrieveLegacy.js +0 -144
- package/funcs/subscribersRetrieveLegacy.js.map +0 -1
- package/funcs/subscribersUpdateLegacy.d.ts +0 -17
- package/funcs/subscribersUpdateLegacy.d.ts.map +0 -1
- package/funcs/subscribersUpdateLegacy.js +0 -143
- package/funcs/subscribersUpdateLegacy.js.map +0 -1
- package/models/components/channelpreference.d.ts +0 -38
- package/models/components/channelpreference.d.ts.map +0 -1
- package/models/components/channelpreference.js +0 -62
- package/models/components/channelpreference.js.map +0 -1
- package/models/components/deletesubscriberresponsedto.d.ts +0 -66
- package/models/components/deletesubscriberresponsedto.d.ts.map +0 -1
- package/models/components/deletesubscriberresponsedto.js +0 -82
- package/models/components/deletesubscriberresponsedto.js.map +0 -1
- package/models/components/getsubscriberpreferencesresponsedto.d.ts +0 -39
- package/models/components/getsubscriberpreferencesresponsedto.d.ts.map +0 -1
- package/models/components/getsubscriberpreferencesresponsedto.js +0 -63
- package/models/components/getsubscriberpreferencesresponsedto.js.map +0 -1
- package/models/components/notificationtriggerresponse.d.ts +0 -55
- package/models/components/notificationtriggerresponse.d.ts.map +0 -1
- package/models/components/notificationtriggerresponse.js +0 -72
- package/models/components/notificationtriggerresponse.js.map +0 -1
- package/models/components/notificationtriggervariableresponse.d.ts +0 -101
- package/models/components/notificationtriggervariableresponse.d.ts.map +0 -1
- package/models/components/notificationtriggervariableresponse.js +0 -112
- package/models/components/notificationtriggervariableresponse.js.map +0 -1
- package/models/components/preference.d.ts +0 -38
- package/models/components/preference.d.ts.map +0 -1
- package/models/components/preference.js +0 -62
- package/models/components/preference.js.map +0 -1
- package/models/components/templateresponse.d.ts +0 -48
- package/models/components/templateresponse.d.ts.map +0 -1
- package/models/components/templateresponse.js +0 -75
- package/models/components/templateresponse.js.map +0 -1
- package/models/components/triggerreservedvariableresponse.d.ts +0 -69
- package/models/components/triggerreservedvariableresponse.d.ts.map +0 -1
- package/models/components/triggerreservedvariableresponse.js +0 -83
- package/models/components/triggerreservedvariableresponse.js.map +0 -1
- package/models/components/triggertypeenum.d.ts +0 -31
- package/models/components/triggertypeenum.d.ts.map +0 -1
- package/models/components/triggertypeenum.js +0 -52
- package/models/components/triggertypeenum.js.map +0 -1
- package/models/components/updatesubscriberglobalpreferencesrequestdto.d.ts +0 -38
- package/models/components/updatesubscriberglobalpreferencesrequestdto.d.ts.map +0 -1
- package/models/components/updatesubscriberglobalpreferencesrequestdto.js +0 -62
- package/models/components/updatesubscriberglobalpreferencesrequestdto.js.map +0 -1
- package/models/components/updatesubscriberpreferenceglobalresponsedto.d.ts +0 -33
- package/models/components/updatesubscriberpreferenceglobalresponsedto.d.ts.map +0 -1
- package/models/components/updatesubscriberpreferenceglobalresponsedto.js +0 -60
- package/models/components/updatesubscriberpreferenceglobalresponsedto.js.map +0 -1
- package/models/components/updatesubscriberpreferencerequestdto.d.ts +0 -38
- package/models/components/updatesubscriberpreferencerequestdto.d.ts.map +0 -1
- package/models/components/updatesubscriberpreferencerequestdto.js +0 -62
- package/models/components/updatesubscriberpreferencerequestdto.js.map +0 -1
- package/models/components/updatesubscriberpreferenceresponsedto.d.ts +0 -39
- package/models/components/updatesubscriberpreferenceresponsedto.d.ts.map +0 -1
- package/models/components/updatesubscriberpreferenceresponsedto.js +0 -63
- package/models/components/updatesubscriberpreferenceresponsedto.js.map +0 -1
- package/models/components/updatesubscriberrequestdto.d.ts +0 -72
- package/models/components/updatesubscriberrequestdto.d.ts.map +0 -1
- package/models/components/updatesubscriberrequestdto.js +0 -74
- package/models/components/updatesubscriberrequestdto.js.map +0 -1
- package/models/operations/subscribersv1controllercreatesubscriber.d.ts +0 -66
- package/models/operations/subscribersv1controllercreatesubscriber.d.ts.map +0 -1
- package/models/operations/subscribersv1controllercreatesubscriber.js +0 -112
- package/models/operations/subscribersv1controllercreatesubscriber.js.map +0 -1
- package/models/operations/subscribersv1controllergetsubscriber.d.ts +0 -71
- package/models/operations/subscribersv1controllergetsubscriber.d.ts.map +0 -1
- package/models/operations/subscribersv1controllergetsubscriber.js +0 -112
- package/models/operations/subscribersv1controllergetsubscriber.js.map +0 -1
- package/models/operations/subscribersv1controllergetsubscriberpreferencebylevel.d.ts +0 -108
- package/models/operations/subscribersv1controllergetsubscriberpreferencebylevel.d.ts.map +0 -1
- package/models/operations/subscribersv1controllergetsubscriberpreferencebylevel.js +0 -141
- package/models/operations/subscribersv1controllergetsubscriberpreferencebylevel.js.map +0 -1
- package/models/operations/subscribersv1controllerlistsubscriberpreferences.d.ts +0 -71
- package/models/operations/subscribersv1controllerlistsubscriberpreferences.d.ts.map +0 -1
- package/models/operations/subscribersv1controllerlistsubscriberpreferences.js +0 -116
- package/models/operations/subscribersv1controllerlistsubscriberpreferences.js.map +0 -1
- package/models/operations/subscribersv1controllerremovesubscriber.d.ts +0 -66
- package/models/operations/subscribersv1controllerremovesubscriber.d.ts.map +0 -1
- package/models/operations/subscribersv1controllerremovesubscriber.js +0 -110
- package/models/operations/subscribersv1controllerremovesubscriber.js.map +0 -1
- package/models/operations/subscribersv1controllerupdatesubscriber.d.ts +0 -68
- package/models/operations/subscribersv1controllerupdatesubscriber.d.ts.map +0 -1
- package/models/operations/subscribersv1controllerupdatesubscriber.js +0 -114
- package/models/operations/subscribersv1controllerupdatesubscriber.js.map +0 -1
- package/models/operations/subscribersv1controllerupdatesubscriberglobalpreferences.d.ts +0 -68
- package/models/operations/subscribersv1controllerupdatesubscriberglobalpreferences.d.ts.map +0 -1
- package/models/operations/subscribersv1controllerupdatesubscriberglobalpreferences.js +0 -118
- package/models/operations/subscribersv1controllerupdatesubscriberglobalpreferences.js.map +0 -1
- package/models/operations/subscribersv1controllerupdatesubscriberpreference.d.ts +0 -70
- package/models/operations/subscribersv1controllerupdatesubscriberpreference.d.ts.map +0 -1
- package/models/operations/subscribersv1controllerupdatesubscriberpreference.js +0 -120
- package/models/operations/subscribersv1controllerupdatesubscriberpreference.js.map +0 -1
- package/sdk/legacy.d.ts +0 -10
- package/sdk/legacy.d.ts.map +0 -1
- package/sdk/legacy.js +0 -19
- package/sdk/legacy.js.map +0 -1
- package/src/funcs/subscribersDeleteLegacy.ts +0 -200
- package/src/funcs/subscribersPreferencesLegacyUpdateGlobal.ts +0 -211
- package/src/funcs/subscribersPreferencesListLegacy.ts +0 -209
- package/src/funcs/subscribersPreferencesRetrieveByLevelLegacy.ts +0 -205
- package/src/funcs/subscribersPreferencesUpdateLegacy.ts +0 -202
- package/src/funcs/subscribersRetrieveLegacy.ts +0 -205
- package/src/funcs/subscribersUpdateLegacy.ts +0 -204
- package/src/models/components/channelpreference.ts +0 -81
- package/src/models/components/deletesubscriberresponsedto.ts +0 -114
- package/src/models/components/getsubscriberpreferencesresponsedto.ts +0 -93
- package/src/models/components/notificationtriggerresponse.ts +0 -126
- package/src/models/components/notificationtriggervariableresponse.ts +0 -193
- package/src/models/components/preference.ts +0 -78
- package/src/models/components/templateresponse.ts +0 -105
- package/src/models/components/triggerreservedvariableresponse.ts +0 -116
- package/src/models/components/triggertypeenum.ts +0 -38
- package/src/models/components/updatesubscriberglobalpreferencesrequestdto.ts +0 -95
- package/src/models/components/updatesubscriberpreferenceglobalresponsedto.ts +0 -88
- package/src/models/components/updatesubscriberpreferencerequestdto.ts +0 -87
- package/src/models/components/updatesubscriberpreferenceresponsedto.ts +0 -93
- package/src/models/components/updatesubscriberrequestdto.ts +0 -124
- package/src/models/operations/subscribersv1controllercreatesubscriber.ts +0 -187
- package/src/models/operations/subscribersv1controllergetsubscriber.ts +0 -188
- package/src/models/operations/subscribersv1controllergetsubscriberpreferencebylevel.ts +0 -231
- package/src/models/operations/subscribersv1controllerlistsubscriberpreferences.ts +0 -191
- package/src/models/operations/subscribersv1controllerremovesubscriber.ts +0 -183
- package/src/models/operations/subscribersv1controllerupdatesubscriber.ts +0 -191
- package/src/models/operations/subscribersv1controllerupdatesubscriberglobalpreferences.ts +0 -195
- package/src/models/operations/subscribersv1controllerupdatesubscriberpreference.ts +0 -197
- package/src/sdk/legacy.ts +0 -32
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { NovuCore } from "../core.js";
|
|
6
|
-
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
-
import * as M from "../lib/matchers.js";
|
|
8
|
-
import { compactMap } from "../lib/primitives.js";
|
|
9
|
-
import { safeParse } from "../lib/schemas.js";
|
|
10
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
-
import { pathToFunc } from "../lib/url.js";
|
|
13
|
-
import {
|
|
14
|
-
ConnectionError,
|
|
15
|
-
InvalidRequestError,
|
|
16
|
-
RequestAbortedError,
|
|
17
|
-
RequestTimeoutError,
|
|
18
|
-
UnexpectedClientError,
|
|
19
|
-
} from "../models/errors/httpclienterrors.js";
|
|
20
|
-
import * as errors from "../models/errors/index.js";
|
|
21
|
-
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
|
-
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
-
import * as operations from "../models/operations/index.js";
|
|
24
|
-
import { Result } from "../types/fp.js";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get subscriber preferences
|
|
28
|
-
*
|
|
29
|
-
* @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
30
|
-
*/
|
|
31
|
-
export async function subscribersPreferencesListLegacy(
|
|
32
|
-
client: NovuCore,
|
|
33
|
-
subscriberId: string,
|
|
34
|
-
includeInactiveChannels?: boolean | undefined,
|
|
35
|
-
idempotencyKey?: string | undefined,
|
|
36
|
-
options?: RequestOptions,
|
|
37
|
-
): Promise<
|
|
38
|
-
Result<
|
|
39
|
-
operations.SubscribersV1ControllerListSubscriberPreferencesResponse,
|
|
40
|
-
| errors.ErrorDto
|
|
41
|
-
| errors.ErrorDto
|
|
42
|
-
| errors.ValidationErrorDto
|
|
43
|
-
| errors.ErrorDto
|
|
44
|
-
| SDKError
|
|
45
|
-
| SDKValidationError
|
|
46
|
-
| UnexpectedClientError
|
|
47
|
-
| InvalidRequestError
|
|
48
|
-
| RequestAbortedError
|
|
49
|
-
| RequestTimeoutError
|
|
50
|
-
| ConnectionError
|
|
51
|
-
>
|
|
52
|
-
> {
|
|
53
|
-
const input:
|
|
54
|
-
operations.SubscribersV1ControllerListSubscriberPreferencesRequest = {
|
|
55
|
-
subscriberId: subscriberId,
|
|
56
|
-
includeInactiveChannels: includeInactiveChannels,
|
|
57
|
-
idempotencyKey: idempotencyKey,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const parsed = safeParse(
|
|
61
|
-
input,
|
|
62
|
-
(value) =>
|
|
63
|
-
operations
|
|
64
|
-
.SubscribersV1ControllerListSubscriberPreferencesRequest$outboundSchema
|
|
65
|
-
.parse(value),
|
|
66
|
-
"Input validation failed",
|
|
67
|
-
);
|
|
68
|
-
if (!parsed.ok) {
|
|
69
|
-
return parsed;
|
|
70
|
-
}
|
|
71
|
-
const payload = parsed.value;
|
|
72
|
-
const body = null;
|
|
73
|
-
|
|
74
|
-
const pathParams = {
|
|
75
|
-
subscriberId: encodeSimple("subscriberId", payload.subscriberId, {
|
|
76
|
-
explode: false,
|
|
77
|
-
charEncoding: "percent",
|
|
78
|
-
}),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const path = pathToFunc("/v1/subscribers/{subscriberId}/preferences")(
|
|
82
|
-
pathParams,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const query = encodeFormQuery({
|
|
86
|
-
"includeInactiveChannels": payload.includeInactiveChannels,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const headers = new Headers(compactMap({
|
|
90
|
-
Accept: "application/json",
|
|
91
|
-
"idempotency-key": encodeSimple(
|
|
92
|
-
"idempotency-key",
|
|
93
|
-
payload["idempotency-key"],
|
|
94
|
-
{ explode: false, charEncoding: "none" },
|
|
95
|
-
),
|
|
96
|
-
}));
|
|
97
|
-
|
|
98
|
-
const secConfig = await extractSecurity(client._options.secretKey);
|
|
99
|
-
const securityInput = secConfig == null ? {} : { secretKey: secConfig };
|
|
100
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
101
|
-
|
|
102
|
-
const context = {
|
|
103
|
-
operationID: "SubscribersV1Controller_listSubscriberPreferences",
|
|
104
|
-
oAuth2Scopes: [],
|
|
105
|
-
|
|
106
|
-
resolvedSecurity: requestSecurity,
|
|
107
|
-
|
|
108
|
-
securitySource: client._options.secretKey,
|
|
109
|
-
retryConfig: options?.retries
|
|
110
|
-
|| client._options.retryConfig
|
|
111
|
-
|| {
|
|
112
|
-
strategy: "backoff",
|
|
113
|
-
backoff: {
|
|
114
|
-
initialInterval: 1000,
|
|
115
|
-
maxInterval: 30000,
|
|
116
|
-
exponent: 1.5,
|
|
117
|
-
maxElapsedTime: 3600000,
|
|
118
|
-
},
|
|
119
|
-
retryConnectionErrors: true,
|
|
120
|
-
}
|
|
121
|
-
|| { strategy: "none" },
|
|
122
|
-
retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const requestRes = client._createRequest(context, {
|
|
126
|
-
security: requestSecurity,
|
|
127
|
-
method: "GET",
|
|
128
|
-
baseURL: options?.serverURL,
|
|
129
|
-
path: path,
|
|
130
|
-
headers: headers,
|
|
131
|
-
query: query,
|
|
132
|
-
body: body,
|
|
133
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
134
|
-
}, options);
|
|
135
|
-
if (!requestRes.ok) {
|
|
136
|
-
return requestRes;
|
|
137
|
-
}
|
|
138
|
-
const req = requestRes.value;
|
|
139
|
-
|
|
140
|
-
const doResult = await client._do(req, {
|
|
141
|
-
context,
|
|
142
|
-
errorCodes: [
|
|
143
|
-
"400",
|
|
144
|
-
"401",
|
|
145
|
-
"403",
|
|
146
|
-
"404",
|
|
147
|
-
"405",
|
|
148
|
-
"409",
|
|
149
|
-
"413",
|
|
150
|
-
"414",
|
|
151
|
-
"415",
|
|
152
|
-
"422",
|
|
153
|
-
"429",
|
|
154
|
-
"4XX",
|
|
155
|
-
"500",
|
|
156
|
-
"503",
|
|
157
|
-
"5XX",
|
|
158
|
-
],
|
|
159
|
-
retryConfig: context.retryConfig,
|
|
160
|
-
retryCodes: context.retryCodes,
|
|
161
|
-
});
|
|
162
|
-
if (!doResult.ok) {
|
|
163
|
-
return doResult;
|
|
164
|
-
}
|
|
165
|
-
const response = doResult.value;
|
|
166
|
-
|
|
167
|
-
const responseFields = {
|
|
168
|
-
HttpMeta: { Response: response, Request: req },
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const [result] = await M.match<
|
|
172
|
-
operations.SubscribersV1ControllerListSubscriberPreferencesResponse,
|
|
173
|
-
| errors.ErrorDto
|
|
174
|
-
| errors.ErrorDto
|
|
175
|
-
| errors.ValidationErrorDto
|
|
176
|
-
| errors.ErrorDto
|
|
177
|
-
| SDKError
|
|
178
|
-
| SDKValidationError
|
|
179
|
-
| UnexpectedClientError
|
|
180
|
-
| InvalidRequestError
|
|
181
|
-
| RequestAbortedError
|
|
182
|
-
| RequestTimeoutError
|
|
183
|
-
| ConnectionError
|
|
184
|
-
>(
|
|
185
|
-
M.json(
|
|
186
|
-
200,
|
|
187
|
-
operations
|
|
188
|
-
.SubscribersV1ControllerListSubscriberPreferencesResponse$inboundSchema,
|
|
189
|
-
{ hdrs: true, key: "Result" },
|
|
190
|
-
),
|
|
191
|
-
M.jsonErr(414, errors.ErrorDto$inboundSchema),
|
|
192
|
-
M.jsonErr(
|
|
193
|
-
[400, 401, 403, 404, 405, 409, 413, 415],
|
|
194
|
-
errors.ErrorDto$inboundSchema,
|
|
195
|
-
{ hdrs: true },
|
|
196
|
-
),
|
|
197
|
-
M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
|
|
198
|
-
M.fail(429),
|
|
199
|
-
M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
|
|
200
|
-
M.fail(503),
|
|
201
|
-
M.fail("4XX"),
|
|
202
|
-
M.fail("5XX"),
|
|
203
|
-
)(response, { extraFields: responseFields });
|
|
204
|
-
if (!result.ok) {
|
|
205
|
-
return result;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return result;
|
|
209
|
-
}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { NovuCore } from "../core.js";
|
|
6
|
-
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
-
import * as M from "../lib/matchers.js";
|
|
8
|
-
import { compactMap } from "../lib/primitives.js";
|
|
9
|
-
import { safeParse } from "../lib/schemas.js";
|
|
10
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
-
import { pathToFunc } from "../lib/url.js";
|
|
13
|
-
import {
|
|
14
|
-
ConnectionError,
|
|
15
|
-
InvalidRequestError,
|
|
16
|
-
RequestAbortedError,
|
|
17
|
-
RequestTimeoutError,
|
|
18
|
-
UnexpectedClientError,
|
|
19
|
-
} from "../models/errors/httpclienterrors.js";
|
|
20
|
-
import * as errors from "../models/errors/index.js";
|
|
21
|
-
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
|
-
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
-
import * as operations from "../models/operations/index.js";
|
|
24
|
-
import { Result } from "../types/fp.js";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get subscriber preferences by level
|
|
28
|
-
*
|
|
29
|
-
* @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
30
|
-
*/
|
|
31
|
-
export async function subscribersPreferencesRetrieveByLevelLegacy(
|
|
32
|
-
client: NovuCore,
|
|
33
|
-
request:
|
|
34
|
-
operations.SubscribersV1ControllerGetSubscriberPreferenceByLevelRequest,
|
|
35
|
-
options?: RequestOptions,
|
|
36
|
-
): Promise<
|
|
37
|
-
Result<
|
|
38
|
-
operations.SubscribersV1ControllerGetSubscriberPreferenceByLevelResponse,
|
|
39
|
-
| errors.ErrorDto
|
|
40
|
-
| errors.ErrorDto
|
|
41
|
-
| errors.ValidationErrorDto
|
|
42
|
-
| errors.ErrorDto
|
|
43
|
-
| SDKError
|
|
44
|
-
| SDKValidationError
|
|
45
|
-
| UnexpectedClientError
|
|
46
|
-
| InvalidRequestError
|
|
47
|
-
| RequestAbortedError
|
|
48
|
-
| RequestTimeoutError
|
|
49
|
-
| ConnectionError
|
|
50
|
-
>
|
|
51
|
-
> {
|
|
52
|
-
const parsed = safeParse(
|
|
53
|
-
request,
|
|
54
|
-
(value) =>
|
|
55
|
-
operations
|
|
56
|
-
.SubscribersV1ControllerGetSubscriberPreferenceByLevelRequest$outboundSchema
|
|
57
|
-
.parse(value),
|
|
58
|
-
"Input validation failed",
|
|
59
|
-
);
|
|
60
|
-
if (!parsed.ok) {
|
|
61
|
-
return parsed;
|
|
62
|
-
}
|
|
63
|
-
const payload = parsed.value;
|
|
64
|
-
const body = null;
|
|
65
|
-
|
|
66
|
-
const pathParams = {
|
|
67
|
-
parameter: encodeSimple("parameter", payload.preferenceLevel, {
|
|
68
|
-
explode: false,
|
|
69
|
-
charEncoding: "percent",
|
|
70
|
-
}),
|
|
71
|
-
subscriberId: encodeSimple("subscriberId", payload.subscriberId, {
|
|
72
|
-
explode: false,
|
|
73
|
-
charEncoding: "percent",
|
|
74
|
-
}),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const path = pathToFunc(
|
|
78
|
-
"/v1/subscribers/{subscriberId}/preferences/{parameter}",
|
|
79
|
-
)(pathParams);
|
|
80
|
-
|
|
81
|
-
const query = encodeFormQuery({
|
|
82
|
-
"includeInactiveChannels": payload.includeInactiveChannels,
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const headers = new Headers(compactMap({
|
|
86
|
-
Accept: "application/json",
|
|
87
|
-
"idempotency-key": encodeSimple(
|
|
88
|
-
"idempotency-key",
|
|
89
|
-
payload["idempotency-key"],
|
|
90
|
-
{ explode: false, charEncoding: "none" },
|
|
91
|
-
),
|
|
92
|
-
}));
|
|
93
|
-
|
|
94
|
-
const secConfig = await extractSecurity(client._options.secretKey);
|
|
95
|
-
const securityInput = secConfig == null ? {} : { secretKey: secConfig };
|
|
96
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
97
|
-
|
|
98
|
-
const context = {
|
|
99
|
-
operationID: "SubscribersV1Controller_getSubscriberPreferenceByLevel",
|
|
100
|
-
oAuth2Scopes: [],
|
|
101
|
-
|
|
102
|
-
resolvedSecurity: requestSecurity,
|
|
103
|
-
|
|
104
|
-
securitySource: client._options.secretKey,
|
|
105
|
-
retryConfig: options?.retries
|
|
106
|
-
|| client._options.retryConfig
|
|
107
|
-
|| {
|
|
108
|
-
strategy: "backoff",
|
|
109
|
-
backoff: {
|
|
110
|
-
initialInterval: 1000,
|
|
111
|
-
maxInterval: 30000,
|
|
112
|
-
exponent: 1.5,
|
|
113
|
-
maxElapsedTime: 3600000,
|
|
114
|
-
},
|
|
115
|
-
retryConnectionErrors: true,
|
|
116
|
-
}
|
|
117
|
-
|| { strategy: "none" },
|
|
118
|
-
retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const requestRes = client._createRequest(context, {
|
|
122
|
-
security: requestSecurity,
|
|
123
|
-
method: "GET",
|
|
124
|
-
baseURL: options?.serverURL,
|
|
125
|
-
path: path,
|
|
126
|
-
headers: headers,
|
|
127
|
-
query: query,
|
|
128
|
-
body: body,
|
|
129
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
130
|
-
}, options);
|
|
131
|
-
if (!requestRes.ok) {
|
|
132
|
-
return requestRes;
|
|
133
|
-
}
|
|
134
|
-
const req = requestRes.value;
|
|
135
|
-
|
|
136
|
-
const doResult = await client._do(req, {
|
|
137
|
-
context,
|
|
138
|
-
errorCodes: [
|
|
139
|
-
"400",
|
|
140
|
-
"401",
|
|
141
|
-
"403",
|
|
142
|
-
"404",
|
|
143
|
-
"405",
|
|
144
|
-
"409",
|
|
145
|
-
"413",
|
|
146
|
-
"414",
|
|
147
|
-
"415",
|
|
148
|
-
"422",
|
|
149
|
-
"429",
|
|
150
|
-
"4XX",
|
|
151
|
-
"500",
|
|
152
|
-
"503",
|
|
153
|
-
"5XX",
|
|
154
|
-
],
|
|
155
|
-
retryConfig: context.retryConfig,
|
|
156
|
-
retryCodes: context.retryCodes,
|
|
157
|
-
});
|
|
158
|
-
if (!doResult.ok) {
|
|
159
|
-
return doResult;
|
|
160
|
-
}
|
|
161
|
-
const response = doResult.value;
|
|
162
|
-
|
|
163
|
-
const responseFields = {
|
|
164
|
-
HttpMeta: { Response: response, Request: req },
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const [result] = await M.match<
|
|
168
|
-
operations.SubscribersV1ControllerGetSubscriberPreferenceByLevelResponse,
|
|
169
|
-
| errors.ErrorDto
|
|
170
|
-
| errors.ErrorDto
|
|
171
|
-
| errors.ValidationErrorDto
|
|
172
|
-
| errors.ErrorDto
|
|
173
|
-
| SDKError
|
|
174
|
-
| SDKValidationError
|
|
175
|
-
| UnexpectedClientError
|
|
176
|
-
| InvalidRequestError
|
|
177
|
-
| RequestAbortedError
|
|
178
|
-
| RequestTimeoutError
|
|
179
|
-
| ConnectionError
|
|
180
|
-
>(
|
|
181
|
-
M.json(
|
|
182
|
-
200,
|
|
183
|
-
operations
|
|
184
|
-
.SubscribersV1ControllerGetSubscriberPreferenceByLevelResponse$inboundSchema,
|
|
185
|
-
{ hdrs: true, key: "Result" },
|
|
186
|
-
),
|
|
187
|
-
M.jsonErr(414, errors.ErrorDto$inboundSchema),
|
|
188
|
-
M.jsonErr(
|
|
189
|
-
[400, 401, 403, 404, 405, 409, 413, 415],
|
|
190
|
-
errors.ErrorDto$inboundSchema,
|
|
191
|
-
{ hdrs: true },
|
|
192
|
-
),
|
|
193
|
-
M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
|
|
194
|
-
M.fail(429),
|
|
195
|
-
M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
|
|
196
|
-
M.fail(503),
|
|
197
|
-
M.fail("4XX"),
|
|
198
|
-
M.fail("5XX"),
|
|
199
|
-
)(response, { extraFields: responseFields });
|
|
200
|
-
if (!result.ok) {
|
|
201
|
-
return result;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return result;
|
|
205
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { NovuCore } from "../core.js";
|
|
6
|
-
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
-
import * as M from "../lib/matchers.js";
|
|
8
|
-
import { compactMap } from "../lib/primitives.js";
|
|
9
|
-
import { safeParse } from "../lib/schemas.js";
|
|
10
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
-
import { pathToFunc } from "../lib/url.js";
|
|
13
|
-
import {
|
|
14
|
-
ConnectionError,
|
|
15
|
-
InvalidRequestError,
|
|
16
|
-
RequestAbortedError,
|
|
17
|
-
RequestTimeoutError,
|
|
18
|
-
UnexpectedClientError,
|
|
19
|
-
} from "../models/errors/httpclienterrors.js";
|
|
20
|
-
import * as errors from "../models/errors/index.js";
|
|
21
|
-
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
|
-
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
-
import * as operations from "../models/operations/index.js";
|
|
24
|
-
import { Result } from "../types/fp.js";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Update subscriber preference
|
|
28
|
-
*/
|
|
29
|
-
export async function subscribersPreferencesUpdateLegacy(
|
|
30
|
-
client: NovuCore,
|
|
31
|
-
request: operations.SubscribersV1ControllerUpdateSubscriberPreferenceRequest,
|
|
32
|
-
options?: RequestOptions,
|
|
33
|
-
): Promise<
|
|
34
|
-
Result<
|
|
35
|
-
operations.SubscribersV1ControllerUpdateSubscriberPreferenceResponse,
|
|
36
|
-
| errors.ErrorDto
|
|
37
|
-
| errors.ErrorDto
|
|
38
|
-
| errors.ValidationErrorDto
|
|
39
|
-
| errors.ErrorDto
|
|
40
|
-
| SDKError
|
|
41
|
-
| SDKValidationError
|
|
42
|
-
| UnexpectedClientError
|
|
43
|
-
| InvalidRequestError
|
|
44
|
-
| RequestAbortedError
|
|
45
|
-
| RequestTimeoutError
|
|
46
|
-
| ConnectionError
|
|
47
|
-
>
|
|
48
|
-
> {
|
|
49
|
-
const parsed = safeParse(
|
|
50
|
-
request,
|
|
51
|
-
(value) =>
|
|
52
|
-
operations
|
|
53
|
-
.SubscribersV1ControllerUpdateSubscriberPreferenceRequest$outboundSchema
|
|
54
|
-
.parse(value),
|
|
55
|
-
"Input validation failed",
|
|
56
|
-
);
|
|
57
|
-
if (!parsed.ok) {
|
|
58
|
-
return parsed;
|
|
59
|
-
}
|
|
60
|
-
const payload = parsed.value;
|
|
61
|
-
const body = encodeJSON(
|
|
62
|
-
"body",
|
|
63
|
-
payload.UpdateSubscriberPreferenceRequestDto,
|
|
64
|
-
{ explode: true },
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
const pathParams = {
|
|
68
|
-
subscriberId: encodeSimple("subscriberId", payload.subscriberId, {
|
|
69
|
-
explode: false,
|
|
70
|
-
charEncoding: "percent",
|
|
71
|
-
}),
|
|
72
|
-
parameter: encodeSimple("parameter", payload.workflowId, {
|
|
73
|
-
explode: false,
|
|
74
|
-
charEncoding: "percent",
|
|
75
|
-
}),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const path = pathToFunc(
|
|
79
|
-
"/v1/subscribers/{subscriberId}/preferences/{parameter}",
|
|
80
|
-
)(pathParams);
|
|
81
|
-
|
|
82
|
-
const headers = new Headers(compactMap({
|
|
83
|
-
"Content-Type": "application/json",
|
|
84
|
-
Accept: "application/json",
|
|
85
|
-
"idempotency-key": encodeSimple(
|
|
86
|
-
"idempotency-key",
|
|
87
|
-
payload["idempotency-key"],
|
|
88
|
-
{ explode: false, charEncoding: "none" },
|
|
89
|
-
),
|
|
90
|
-
}));
|
|
91
|
-
|
|
92
|
-
const secConfig = await extractSecurity(client._options.secretKey);
|
|
93
|
-
const securityInput = secConfig == null ? {} : { secretKey: secConfig };
|
|
94
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
95
|
-
|
|
96
|
-
const context = {
|
|
97
|
-
operationID: "SubscribersV1Controller_updateSubscriberPreference",
|
|
98
|
-
oAuth2Scopes: [],
|
|
99
|
-
|
|
100
|
-
resolvedSecurity: requestSecurity,
|
|
101
|
-
|
|
102
|
-
securitySource: client._options.secretKey,
|
|
103
|
-
retryConfig: options?.retries
|
|
104
|
-
|| client._options.retryConfig
|
|
105
|
-
|| {
|
|
106
|
-
strategy: "backoff",
|
|
107
|
-
backoff: {
|
|
108
|
-
initialInterval: 1000,
|
|
109
|
-
maxInterval: 30000,
|
|
110
|
-
exponent: 1.5,
|
|
111
|
-
maxElapsedTime: 3600000,
|
|
112
|
-
},
|
|
113
|
-
retryConnectionErrors: true,
|
|
114
|
-
}
|
|
115
|
-
|| { strategy: "none" },
|
|
116
|
-
retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const requestRes = client._createRequest(context, {
|
|
120
|
-
security: requestSecurity,
|
|
121
|
-
method: "PATCH",
|
|
122
|
-
baseURL: options?.serverURL,
|
|
123
|
-
path: path,
|
|
124
|
-
headers: headers,
|
|
125
|
-
body: body,
|
|
126
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
127
|
-
}, options);
|
|
128
|
-
if (!requestRes.ok) {
|
|
129
|
-
return requestRes;
|
|
130
|
-
}
|
|
131
|
-
const req = requestRes.value;
|
|
132
|
-
|
|
133
|
-
const doResult = await client._do(req, {
|
|
134
|
-
context,
|
|
135
|
-
errorCodes: [
|
|
136
|
-
"400",
|
|
137
|
-
"401",
|
|
138
|
-
"403",
|
|
139
|
-
"404",
|
|
140
|
-
"405",
|
|
141
|
-
"409",
|
|
142
|
-
"413",
|
|
143
|
-
"414",
|
|
144
|
-
"415",
|
|
145
|
-
"422",
|
|
146
|
-
"429",
|
|
147
|
-
"4XX",
|
|
148
|
-
"500",
|
|
149
|
-
"503",
|
|
150
|
-
"5XX",
|
|
151
|
-
],
|
|
152
|
-
retryConfig: context.retryConfig,
|
|
153
|
-
retryCodes: context.retryCodes,
|
|
154
|
-
});
|
|
155
|
-
if (!doResult.ok) {
|
|
156
|
-
return doResult;
|
|
157
|
-
}
|
|
158
|
-
const response = doResult.value;
|
|
159
|
-
|
|
160
|
-
const responseFields = {
|
|
161
|
-
HttpMeta: { Response: response, Request: req },
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const [result] = await M.match<
|
|
165
|
-
operations.SubscribersV1ControllerUpdateSubscriberPreferenceResponse,
|
|
166
|
-
| errors.ErrorDto
|
|
167
|
-
| errors.ErrorDto
|
|
168
|
-
| errors.ValidationErrorDto
|
|
169
|
-
| errors.ErrorDto
|
|
170
|
-
| SDKError
|
|
171
|
-
| SDKValidationError
|
|
172
|
-
| UnexpectedClientError
|
|
173
|
-
| InvalidRequestError
|
|
174
|
-
| RequestAbortedError
|
|
175
|
-
| RequestTimeoutError
|
|
176
|
-
| ConnectionError
|
|
177
|
-
>(
|
|
178
|
-
M.json(
|
|
179
|
-
200,
|
|
180
|
-
operations
|
|
181
|
-
.SubscribersV1ControllerUpdateSubscriberPreferenceResponse$inboundSchema,
|
|
182
|
-
{ hdrs: true, key: "Result" },
|
|
183
|
-
),
|
|
184
|
-
M.jsonErr(414, errors.ErrorDto$inboundSchema),
|
|
185
|
-
M.jsonErr(
|
|
186
|
-
[400, 401, 403, 404, 405, 409, 413, 415],
|
|
187
|
-
errors.ErrorDto$inboundSchema,
|
|
188
|
-
{ hdrs: true },
|
|
189
|
-
),
|
|
190
|
-
M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
|
|
191
|
-
M.fail(429),
|
|
192
|
-
M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
|
|
193
|
-
M.fail(503),
|
|
194
|
-
M.fail("4XX"),
|
|
195
|
-
M.fail("5XX"),
|
|
196
|
-
)(response, { extraFields: responseFields });
|
|
197
|
-
if (!result.ok) {
|
|
198
|
-
return result;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return result;
|
|
202
|
-
}
|