@novu/api 0.2.1 → 0.3.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/README.md +4 -4
- package/funcs/cancel.d.ts +2 -1
- package/funcs/cancel.d.ts.map +1 -1
- package/funcs/cancel.js +11 -7
- package/funcs/cancel.js.map +1 -1
- package/funcs/integrationsCreate.d.ts +2 -1
- package/funcs/integrationsCreate.d.ts.map +1 -1
- package/funcs/integrationsCreate.js +11 -7
- package/funcs/integrationsCreate.js.map +1 -1
- package/funcs/integrationsDelete.d.ts +2 -1
- package/funcs/integrationsDelete.d.ts.map +1 -1
- package/funcs/integrationsDelete.js +11 -7
- package/funcs/integrationsDelete.js.map +1 -1
- package/funcs/integrationsList.d.ts +2 -1
- package/funcs/integrationsList.d.ts.map +1 -1
- package/funcs/integrationsList.js +11 -7
- package/funcs/integrationsList.js.map +1 -1
- package/funcs/integrationsListActive.d.ts +2 -1
- package/funcs/integrationsListActive.d.ts.map +1 -1
- package/funcs/integrationsListActive.js +11 -7
- package/funcs/integrationsListActive.js.map +1 -1
- package/funcs/integrationsSetAsPrimary.d.ts +2 -1
- package/funcs/integrationsSetAsPrimary.d.ts.map +1 -1
- package/funcs/integrationsSetAsPrimary.js +11 -7
- package/funcs/integrationsSetAsPrimary.js.map +1 -1
- package/funcs/integrationsUpdate.d.ts +2 -1
- package/funcs/integrationsUpdate.d.ts.map +1 -1
- package/funcs/integrationsUpdate.js +11 -7
- package/funcs/integrationsUpdate.js.map +1 -1
- package/funcs/integrationsWebhooksRetrieve.d.ts +2 -1
- package/funcs/integrationsWebhooksRetrieve.d.ts.map +1 -1
- package/funcs/integrationsWebhooksRetrieve.js +11 -7
- package/funcs/integrationsWebhooksRetrieve.js.map +1 -1
- package/funcs/messagesDelete.d.ts +2 -1
- package/funcs/messagesDelete.d.ts.map +1 -1
- package/funcs/messagesDelete.js +11 -7
- package/funcs/messagesDelete.js.map +1 -1
- package/funcs/messagesDeleteByTransactionId.d.ts +2 -1
- package/funcs/messagesDeleteByTransactionId.d.ts.map +1 -1
- package/funcs/messagesDeleteByTransactionId.js +11 -7
- package/funcs/messagesDeleteByTransactionId.js.map +1 -1
- package/funcs/messagesRetrieve.d.ts +2 -1
- package/funcs/messagesRetrieve.d.ts.map +1 -1
- package/funcs/messagesRetrieve.js +11 -7
- package/funcs/messagesRetrieve.js.map +1 -1
- package/funcs/notificationsList.d.ts +2 -1
- package/funcs/notificationsList.d.ts.map +1 -1
- package/funcs/notificationsList.js +12 -7
- package/funcs/notificationsList.js.map +1 -1
- package/funcs/notificationsRetrieve.d.ts +2 -1
- package/funcs/notificationsRetrieve.d.ts.map +1 -1
- package/funcs/notificationsRetrieve.js +11 -7
- package/funcs/notificationsRetrieve.js.map +1 -1
- package/funcs/notificationsStatsGraph.d.ts +2 -1
- package/funcs/notificationsStatsGraph.d.ts.map +1 -1
- package/funcs/notificationsStatsGraph.js +11 -7
- package/funcs/notificationsStatsGraph.js.map +1 -1
- package/funcs/notificationsStatsRetrieve.d.ts +2 -1
- package/funcs/notificationsStatsRetrieve.d.ts.map +1 -1
- package/funcs/notificationsStatsRetrieve.js +11 -7
- package/funcs/notificationsStatsRetrieve.js.map +1 -1
- package/funcs/subscribersAuthenticationChatAccessOauth.d.ts +2 -1
- package/funcs/subscribersAuthenticationChatAccessOauth.d.ts.map +1 -1
- package/funcs/subscribersAuthenticationChatAccessOauth.js +11 -7
- package/funcs/subscribersAuthenticationChatAccessOauth.js.map +1 -1
- package/funcs/subscribersAuthenticationChatAccessOauthCallBack.d.ts +2 -1
- package/funcs/subscribersAuthenticationChatAccessOauthCallBack.d.ts.map +1 -1
- package/funcs/subscribersAuthenticationChatAccessOauthCallBack.js +11 -7
- package/funcs/subscribersAuthenticationChatAccessOauthCallBack.js.map +1 -1
- package/funcs/subscribersCreate.d.ts +2 -1
- package/funcs/subscribersCreate.d.ts.map +1 -1
- package/funcs/subscribersCreate.js +12 -8
- package/funcs/subscribersCreate.js.map +1 -1
- package/funcs/subscribersCreateBulk.d.ts +2 -1
- package/funcs/subscribersCreateBulk.d.ts.map +1 -1
- package/funcs/subscribersCreateBulk.js +11 -7
- package/funcs/subscribersCreateBulk.js.map +1 -1
- package/funcs/subscribersCredentialsAppend.d.ts +2 -1
- package/funcs/subscribersCredentialsAppend.d.ts.map +1 -1
- package/funcs/subscribersCredentialsAppend.js +11 -7
- package/funcs/subscribersCredentialsAppend.js.map +1 -1
- package/funcs/subscribersCredentialsDelete.d.ts +2 -1
- package/funcs/subscribersCredentialsDelete.d.ts.map +1 -1
- package/funcs/subscribersCredentialsDelete.js +11 -7
- package/funcs/subscribersCredentialsDelete.js.map +1 -1
- package/funcs/subscribersCredentialsUpdate.d.ts +2 -1
- package/funcs/subscribersCredentialsUpdate.d.ts.map +1 -1
- package/funcs/subscribersCredentialsUpdate.js +11 -7
- package/funcs/subscribersCredentialsUpdate.js.map +1 -1
- package/funcs/subscribersDelete.d.ts +2 -1
- package/funcs/subscribersDelete.d.ts.map +1 -1
- package/funcs/subscribersDelete.js +11 -7
- package/funcs/subscribersDelete.js.map +1 -1
- package/funcs/subscribersList.d.ts +2 -1
- package/funcs/subscribersList.d.ts.map +1 -1
- package/funcs/subscribersList.js +19 -7
- package/funcs/subscribersList.js.map +1 -1
- package/funcs/subscribersMessagesMarkAll.d.ts +2 -1
- package/funcs/subscribersMessagesMarkAll.d.ts.map +1 -1
- package/funcs/subscribersMessagesMarkAll.js +11 -7
- package/funcs/subscribersMessagesMarkAll.js.map +1 -1
- package/funcs/subscribersMessagesMarkAllAs.d.ts +2 -1
- package/funcs/subscribersMessagesMarkAllAs.d.ts.map +1 -1
- package/funcs/subscribersMessagesMarkAllAs.js +11 -7
- package/funcs/subscribersMessagesMarkAllAs.js.map +1 -1
- package/funcs/subscribersMessagesUpdateAsSeen.d.ts +2 -1
- package/funcs/subscribersMessagesUpdateAsSeen.d.ts.map +1 -1
- package/funcs/subscribersMessagesUpdateAsSeen.js +11 -7
- package/funcs/subscribersMessagesUpdateAsSeen.js.map +1 -1
- package/funcs/subscribersNotificationsFeed.d.ts +2 -1
- package/funcs/subscribersNotificationsFeed.d.ts.map +1 -1
- package/funcs/subscribersNotificationsFeed.js +11 -7
- package/funcs/subscribersNotificationsFeed.js.map +1 -1
- package/funcs/subscribersNotificationsUnseenCount.d.ts +2 -1
- package/funcs/subscribersNotificationsUnseenCount.d.ts.map +1 -1
- package/funcs/subscribersNotificationsUnseenCount.js +11 -7
- package/funcs/subscribersNotificationsUnseenCount.js.map +1 -1
- package/funcs/subscribersPatch.d.ts +2 -1
- package/funcs/subscribersPatch.d.ts.map +1 -1
- package/funcs/subscribersPatch.js +11 -7
- package/funcs/subscribersPatch.js.map +1 -1
- package/funcs/subscribersPreferencesList.d.ts +2 -1
- package/funcs/subscribersPreferencesList.d.ts.map +1 -1
- package/funcs/subscribersPreferencesList.js +11 -7
- package/funcs/subscribersPreferencesList.js.map +1 -1
- package/funcs/subscribersPreferencesUpdate.d.ts +2 -1
- package/funcs/subscribersPreferencesUpdate.d.ts.map +1 -1
- package/funcs/subscribersPreferencesUpdate.js +11 -7
- package/funcs/subscribersPreferencesUpdate.js.map +1 -1
- package/funcs/subscribersPropertiesUpdateOnlineFlag.d.ts +2 -1
- package/funcs/subscribersPropertiesUpdateOnlineFlag.d.ts.map +1 -1
- package/funcs/subscribersPropertiesUpdateOnlineFlag.js +11 -7
- package/funcs/subscribersPropertiesUpdateOnlineFlag.js.map +1 -1
- package/funcs/subscribersRetrieve.d.ts +2 -1
- package/funcs/subscribersRetrieve.d.ts.map +1 -1
- package/funcs/subscribersRetrieve.js +11 -7
- package/funcs/subscribersRetrieve.js.map +1 -1
- package/funcs/subscribersSearch.d.ts +2 -1
- package/funcs/subscribersSearch.d.ts.map +1 -1
- package/funcs/subscribersSearch.js +11 -7
- package/funcs/subscribersSearch.js.map +1 -1
- package/funcs/topicsCreate.d.ts +2 -1
- package/funcs/topicsCreate.d.ts.map +1 -1
- package/funcs/topicsCreate.js +11 -7
- package/funcs/topicsCreate.js.map +1 -1
- package/funcs/topicsDelete.d.ts +2 -1
- package/funcs/topicsDelete.d.ts.map +1 -1
- package/funcs/topicsDelete.js +11 -7
- package/funcs/topicsDelete.js.map +1 -1
- package/funcs/topicsList.d.ts +2 -1
- package/funcs/topicsList.d.ts.map +1 -1
- package/funcs/topicsList.js +11 -7
- package/funcs/topicsList.js.map +1 -1
- package/funcs/topicsRename.d.ts +2 -1
- package/funcs/topicsRename.d.ts.map +1 -1
- package/funcs/topicsRename.js +11 -7
- package/funcs/topicsRename.js.map +1 -1
- package/funcs/topicsRetrieve.d.ts +2 -1
- package/funcs/topicsRetrieve.d.ts.map +1 -1
- package/funcs/topicsRetrieve.js +11 -7
- package/funcs/topicsRetrieve.js.map +1 -1
- package/funcs/topicsSubscribersAssign.d.ts +2 -1
- package/funcs/topicsSubscribersAssign.d.ts.map +1 -1
- package/funcs/topicsSubscribersAssign.js +11 -7
- package/funcs/topicsSubscribersAssign.js.map +1 -1
- package/funcs/topicsSubscribersRemove.d.ts +2 -1
- package/funcs/topicsSubscribersRemove.d.ts.map +1 -1
- package/funcs/topicsSubscribersRemove.js +11 -7
- package/funcs/topicsSubscribersRemove.js.map +1 -1
- package/funcs/topicsSubscribersRetrieve.d.ts +2 -1
- package/funcs/topicsSubscribersRetrieve.d.ts.map +1 -1
- package/funcs/topicsSubscribersRetrieve.js +11 -7
- package/funcs/topicsSubscribersRetrieve.js.map +1 -1
- package/funcs/trigger.d.ts +2 -1
- package/funcs/trigger.d.ts.map +1 -1
- package/funcs/trigger.js +11 -7
- package/funcs/trigger.js.map +1 -1
- package/funcs/triggerBroadcast.d.ts +2 -1
- package/funcs/triggerBroadcast.d.ts.map +1 -1
- package/funcs/triggerBroadcast.js +11 -7
- package/funcs/triggerBroadcast.js.map +1 -1
- package/funcs/triggerBulk.d.ts +2 -1
- package/funcs/triggerBulk.d.ts.map +1 -1
- package/funcs/triggerBulk.js +11 -7
- package/funcs/triggerBulk.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/activitynotificationtemplateresponsedto.d.ts +6 -0
- package/models/components/activitynotificationtemplateresponsedto.d.ts.map +1 -1
- package/models/components/activitynotificationtemplateresponsedto.js +3 -0
- package/models/components/activitynotificationtemplateresponsedto.js.map +1 -1
- package/models/components/createsubscriberrequestdto.d.ts +28 -50
- package/models/components/createsubscriberrequestdto.d.ts.map +1 -1
- package/models/components/createsubscriberrequestdto.js +17 -41
- package/models/components/createsubscriberrequestdto.js.map +1 -1
- package/models/components/index.d.ts +1 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +1 -0
- package/models/components/index.js.map +1 -1
- package/models/components/patchsubscriberrequestdto.d.ts +0 -5
- package/models/components/patchsubscriberrequestdto.d.ts.map +1 -1
- package/models/components/patchsubscriberrequestdto.js +0 -2
- package/models/components/patchsubscriberrequestdto.js.map +1 -1
- package/models/components/subscriberpayloaddto.d.ts +5 -0
- package/models/components/subscriberpayloaddto.d.ts.map +1 -1
- package/models/components/subscriberpayloaddto.js +2 -0
- package/models/components/subscriberpayloaddto.js.map +1 -1
- package/models/components/triggereventresponsedto.d.ts +3 -0
- package/models/components/triggereventresponsedto.d.ts.map +1 -1
- package/models/components/triggereventresponsedto.js +1 -0
- package/models/components/triggereventresponsedto.js.map +1 -1
- package/models/components/workfloworiginenum.d.ts +37 -0
- package/models/components/workfloworiginenum.d.ts.map +1 -0
- package/models/components/workfloworiginenum.js +54 -0
- package/models/components/workfloworiginenum.js.map +1 -0
- package/models/operations/notificationscontrollerlistnotifications.d.ts +5 -0
- package/models/operations/notificationscontrollerlistnotifications.d.ts.map +1 -1
- package/models/operations/notificationscontrollerlistnotifications.js +2 -0
- package/models/operations/notificationscontrollerlistnotifications.js.map +1 -1
- package/package.json +1 -1
- package/sources/json-development.json +57 -45
- package/src/funcs/cancel.ts +40 -7
- package/src/funcs/integrationsCreate.ts +40 -7
- package/src/funcs/integrationsDelete.ts +40 -7
- package/src/funcs/integrationsList.ts +38 -7
- package/src/funcs/integrationsListActive.ts +38 -7
- package/src/funcs/integrationsSetAsPrimary.ts +40 -7
- package/src/funcs/integrationsUpdate.ts +42 -7
- package/src/funcs/integrationsWebhooksRetrieve.ts +40 -7
- package/src/funcs/messagesDelete.ts +40 -7
- package/src/funcs/messagesDeleteByTransactionId.ts +43 -7
- package/src/funcs/messagesRetrieve.ts +38 -7
- package/src/funcs/notificationsList.ts +39 -7
- package/src/funcs/notificationsRetrieve.ts +40 -7
- package/src/funcs/notificationsStatsGraph.ts +40 -7
- package/src/funcs/notificationsStatsRetrieve.ts +38 -7
- package/src/funcs/subscribersAuthenticationChatAccessOauth.ts +38 -7
- package/src/funcs/subscribersAuthenticationChatAccessOauthCallBack.ts +40 -7
- package/src/funcs/subscribersCreate.ts +41 -8
- package/src/funcs/subscribersCreateBulk.ts +40 -7
- package/src/funcs/subscribersCredentialsAppend.ts +43 -7
- package/src/funcs/subscribersCredentialsDelete.ts +43 -7
- package/src/funcs/subscribersCredentialsUpdate.ts +43 -7
- package/src/funcs/subscribersDelete.ts +40 -7
- package/src/funcs/subscribersList.ts +53 -7
- package/src/funcs/subscribersMessagesMarkAll.ts +42 -7
- package/src/funcs/subscribersMessagesMarkAllAs.ts +42 -7
- package/src/funcs/subscribersMessagesUpdateAsSeen.ts +38 -7
- package/src/funcs/subscribersNotificationsFeed.ts +38 -7
- package/src/funcs/subscribersNotificationsUnseenCount.ts +38 -7
- package/src/funcs/subscribersPatch.ts +42 -7
- package/src/funcs/subscribersPreferencesList.ts +40 -7
- package/src/funcs/subscribersPreferencesUpdate.ts +42 -7
- package/src/funcs/subscribersPropertiesUpdateOnlineFlag.ts +43 -7
- package/src/funcs/subscribersRetrieve.ts +40 -7
- package/src/funcs/subscribersSearch.ts +38 -7
- package/src/funcs/topicsCreate.ts +40 -7
- package/src/funcs/topicsDelete.ts +40 -7
- package/src/funcs/topicsList.ts +38 -7
- package/src/funcs/topicsRename.ts +42 -7
- package/src/funcs/topicsRetrieve.ts +40 -7
- package/src/funcs/topicsSubscribersAssign.ts +42 -7
- package/src/funcs/topicsSubscribersRemove.ts +42 -7
- package/src/funcs/topicsSubscribersRetrieve.ts +42 -7
- package/src/funcs/trigger.ts +40 -7
- package/src/funcs/triggerBroadcast.ts +40 -7
- package/src/funcs/triggerBulk.ts +40 -7
- package/src/lib/config.ts +3 -3
- package/src/models/components/activitynotificationtemplateresponsedto.ts +12 -0
- package/src/models/components/createsubscriberrequestdto.ts +41 -111
- package/src/models/components/index.ts +1 -0
- package/src/models/components/patchsubscriberrequestdto.ts +0 -7
- package/src/models/components/subscriberpayloaddto.ts +7 -0
- package/src/models/components/triggereventresponsedto.ts +1 -0
- package/src/models/components/workfloworiginenum.ts +40 -0
- package/src/models/operations/notificationscontrollerlistnotifications.ts +7 -0
- package/src/types/async.ts +68 -0
- package/types/async.d.ts +23 -0
- package/types/async.d.ts.map +1 -0
- package/types/async.js +44 -0
- package/types/async.js.map +1 -0
|
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
|
|
|
22
22
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
23
23
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
24
|
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
26
|
import { Result } from "../types/fp.js";
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -30,13 +31,13 @@ import { Result } from "../types/fp.js";
|
|
|
30
31
|
* @remarks
|
|
31
32
|
* Patch subscriber by your internal id used to identify the subscriber
|
|
32
33
|
*/
|
|
33
|
-
export
|
|
34
|
+
export function subscribersPatch(
|
|
34
35
|
client: NovuCore,
|
|
35
36
|
patchSubscriberRequestDto: components.PatchSubscriberRequestDto,
|
|
36
37
|
subscriberId: string,
|
|
37
38
|
idempotencyKey?: string | undefined,
|
|
38
39
|
options?: RequestOptions,
|
|
39
|
-
):
|
|
40
|
+
): APIPromise<
|
|
40
41
|
Result<
|
|
41
42
|
operations.SubscribersControllerPatchSubscriberResponse,
|
|
42
43
|
| errors.ErrorDto
|
|
@@ -51,6 +52,40 @@ export async function subscribersPatch(
|
|
|
51
52
|
| RequestTimeoutError
|
|
52
53
|
| ConnectionError
|
|
53
54
|
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
patchSubscriberRequestDto,
|
|
59
|
+
subscriberId,
|
|
60
|
+
idempotencyKey,
|
|
61
|
+
options,
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function $do(
|
|
66
|
+
client: NovuCore,
|
|
67
|
+
patchSubscriberRequestDto: components.PatchSubscriberRequestDto,
|
|
68
|
+
subscriberId: string,
|
|
69
|
+
idempotencyKey?: string | undefined,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
operations.SubscribersControllerPatchSubscriberResponse,
|
|
75
|
+
| errors.ErrorDto
|
|
76
|
+
| errors.ErrorDto
|
|
77
|
+
| errors.ValidationErrorDto
|
|
78
|
+
| errors.ErrorDto
|
|
79
|
+
| SDKError
|
|
80
|
+
| SDKValidationError
|
|
81
|
+
| UnexpectedClientError
|
|
82
|
+
| InvalidRequestError
|
|
83
|
+
| RequestAbortedError
|
|
84
|
+
| RequestTimeoutError
|
|
85
|
+
| ConnectionError
|
|
86
|
+
>,
|
|
87
|
+
APICall,
|
|
88
|
+
]
|
|
54
89
|
> {
|
|
55
90
|
const input: operations.SubscribersControllerPatchSubscriberRequest = {
|
|
56
91
|
patchSubscriberRequestDto: patchSubscriberRequestDto,
|
|
@@ -66,7 +101,7 @@ export async function subscribersPatch(
|
|
|
66
101
|
"Input validation failed",
|
|
67
102
|
);
|
|
68
103
|
if (!parsed.ok) {
|
|
69
|
-
return parsed;
|
|
104
|
+
return [parsed, { status: "invalid" }];
|
|
70
105
|
}
|
|
71
106
|
const payload = parsed.value;
|
|
72
107
|
const body = encodeJSON("body", payload.PatchSubscriberRequestDto, {
|
|
@@ -130,7 +165,7 @@ export async function subscribersPatch(
|
|
|
130
165
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
131
166
|
}, options);
|
|
132
167
|
if (!requestRes.ok) {
|
|
133
|
-
return requestRes;
|
|
168
|
+
return [requestRes, { status: "invalid" }];
|
|
134
169
|
}
|
|
135
170
|
const req = requestRes.value;
|
|
136
171
|
|
|
@@ -157,7 +192,7 @@ export async function subscribersPatch(
|
|
|
157
192
|
retryCodes: context.retryCodes,
|
|
158
193
|
});
|
|
159
194
|
if (!doResult.ok) {
|
|
160
|
-
return doResult;
|
|
195
|
+
return [doResult, { status: "request-error", request: req }];
|
|
161
196
|
}
|
|
162
197
|
const response = doResult.value;
|
|
163
198
|
|
|
@@ -198,8 +233,8 @@ export async function subscribersPatch(
|
|
|
198
233
|
M.fail("5XX"),
|
|
199
234
|
)(response, { extraFields: responseFields });
|
|
200
235
|
if (!result.ok) {
|
|
201
|
-
return result;
|
|
236
|
+
return [result, { status: "complete", request: req, response }];
|
|
202
237
|
}
|
|
203
238
|
|
|
204
|
-
return result;
|
|
239
|
+
return [result, { status: "complete", request: req, response }];
|
|
205
240
|
}
|
|
@@ -21,6 +21,7 @@ import * as errors from "../models/errors/index.js";
|
|
|
21
21
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
22
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
23
|
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
25
|
import { Result } from "../types/fp.js";
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -29,12 +30,12 @@ import { Result } from "../types/fp.js";
|
|
|
29
30
|
* @remarks
|
|
30
31
|
* Get subscriber global and workflow specific preferences
|
|
31
32
|
*/
|
|
32
|
-
export
|
|
33
|
+
export function subscribersPreferencesList(
|
|
33
34
|
client: NovuCore,
|
|
34
35
|
subscriberId: string,
|
|
35
36
|
idempotencyKey?: string | undefined,
|
|
36
37
|
options?: RequestOptions,
|
|
37
|
-
):
|
|
38
|
+
): APIPromise<
|
|
38
39
|
Result<
|
|
39
40
|
operations.SubscribersControllerGetSubscriberPreferencesResponse,
|
|
40
41
|
| errors.ErrorDto
|
|
@@ -49,6 +50,38 @@ export async function subscribersPreferencesList(
|
|
|
49
50
|
| RequestTimeoutError
|
|
50
51
|
| ConnectionError
|
|
51
52
|
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
subscriberId,
|
|
57
|
+
idempotencyKey,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: NovuCore,
|
|
64
|
+
subscriberId: string,
|
|
65
|
+
idempotencyKey?: string | undefined,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
operations.SubscribersControllerGetSubscriberPreferencesResponse,
|
|
71
|
+
| errors.ErrorDto
|
|
72
|
+
| errors.ErrorDto
|
|
73
|
+
| errors.ValidationErrorDto
|
|
74
|
+
| errors.ErrorDto
|
|
75
|
+
| SDKError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| InvalidRequestError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| ConnectionError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
52
85
|
> {
|
|
53
86
|
const input: operations.SubscribersControllerGetSubscriberPreferencesRequest =
|
|
54
87
|
{
|
|
@@ -65,7 +98,7 @@ export async function subscribersPreferencesList(
|
|
|
65
98
|
"Input validation failed",
|
|
66
99
|
);
|
|
67
100
|
if (!parsed.ok) {
|
|
68
|
-
return parsed;
|
|
101
|
+
return [parsed, { status: "invalid" }];
|
|
69
102
|
}
|
|
70
103
|
const payload = parsed.value;
|
|
71
104
|
const body = null;
|
|
@@ -128,7 +161,7 @@ export async function subscribersPreferencesList(
|
|
|
128
161
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
129
162
|
}, options);
|
|
130
163
|
if (!requestRes.ok) {
|
|
131
|
-
return requestRes;
|
|
164
|
+
return [requestRes, { status: "invalid" }];
|
|
132
165
|
}
|
|
133
166
|
const req = requestRes.value;
|
|
134
167
|
|
|
@@ -155,7 +188,7 @@ export async function subscribersPreferencesList(
|
|
|
155
188
|
retryCodes: context.retryCodes,
|
|
156
189
|
});
|
|
157
190
|
if (!doResult.ok) {
|
|
158
|
-
return doResult;
|
|
191
|
+
return [doResult, { status: "request-error", request: req }];
|
|
159
192
|
}
|
|
160
193
|
const response = doResult.value;
|
|
161
194
|
|
|
@@ -197,8 +230,8 @@ export async function subscribersPreferencesList(
|
|
|
197
230
|
M.fail("5XX"),
|
|
198
231
|
)(response, { extraFields: responseFields });
|
|
199
232
|
if (!result.ok) {
|
|
200
|
-
return result;
|
|
233
|
+
return [result, { status: "complete", request: req, response }];
|
|
201
234
|
}
|
|
202
235
|
|
|
203
|
-
return result;
|
|
236
|
+
return [result, { status: "complete", request: req, response }];
|
|
204
237
|
}
|
|
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
|
|
|
22
22
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
23
23
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
24
|
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
26
|
import { Result } from "../types/fp.js";
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -30,13 +31,13 @@ import { Result } from "../types/fp.js";
|
|
|
30
31
|
* @remarks
|
|
31
32
|
* Update subscriber global or workflow specific preferences
|
|
32
33
|
*/
|
|
33
|
-
export
|
|
34
|
+
export function subscribersPreferencesUpdate(
|
|
34
35
|
client: NovuCore,
|
|
35
36
|
patchSubscriberPreferencesDto: components.PatchSubscriberPreferencesDto,
|
|
36
37
|
subscriberId: string,
|
|
37
38
|
idempotencyKey?: string | undefined,
|
|
38
39
|
options?: RequestOptions,
|
|
39
|
-
):
|
|
40
|
+
): APIPromise<
|
|
40
41
|
Result<
|
|
41
42
|
operations.SubscribersControllerUpdateSubscriberPreferencesResponse,
|
|
42
43
|
| errors.ErrorDto
|
|
@@ -51,6 +52,40 @@ export async function subscribersPreferencesUpdate(
|
|
|
51
52
|
| RequestTimeoutError
|
|
52
53
|
| ConnectionError
|
|
53
54
|
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
patchSubscriberPreferencesDto,
|
|
59
|
+
subscriberId,
|
|
60
|
+
idempotencyKey,
|
|
61
|
+
options,
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function $do(
|
|
66
|
+
client: NovuCore,
|
|
67
|
+
patchSubscriberPreferencesDto: components.PatchSubscriberPreferencesDto,
|
|
68
|
+
subscriberId: string,
|
|
69
|
+
idempotencyKey?: string | undefined,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
operations.SubscribersControllerUpdateSubscriberPreferencesResponse,
|
|
75
|
+
| errors.ErrorDto
|
|
76
|
+
| errors.ErrorDto
|
|
77
|
+
| errors.ValidationErrorDto
|
|
78
|
+
| errors.ErrorDto
|
|
79
|
+
| SDKError
|
|
80
|
+
| SDKValidationError
|
|
81
|
+
| UnexpectedClientError
|
|
82
|
+
| InvalidRequestError
|
|
83
|
+
| RequestAbortedError
|
|
84
|
+
| RequestTimeoutError
|
|
85
|
+
| ConnectionError
|
|
86
|
+
>,
|
|
87
|
+
APICall,
|
|
88
|
+
]
|
|
54
89
|
> {
|
|
55
90
|
const input:
|
|
56
91
|
operations.SubscribersControllerUpdateSubscriberPreferencesRequest = {
|
|
@@ -68,7 +103,7 @@ export async function subscribersPreferencesUpdate(
|
|
|
68
103
|
"Input validation failed",
|
|
69
104
|
);
|
|
70
105
|
if (!parsed.ok) {
|
|
71
|
-
return parsed;
|
|
106
|
+
return [parsed, { status: "invalid" }];
|
|
72
107
|
}
|
|
73
108
|
const payload = parsed.value;
|
|
74
109
|
const body = encodeJSON("body", payload.PatchSubscriberPreferencesDto, {
|
|
@@ -134,7 +169,7 @@ export async function subscribersPreferencesUpdate(
|
|
|
134
169
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
135
170
|
}, options);
|
|
136
171
|
if (!requestRes.ok) {
|
|
137
|
-
return requestRes;
|
|
172
|
+
return [requestRes, { status: "invalid" }];
|
|
138
173
|
}
|
|
139
174
|
const req = requestRes.value;
|
|
140
175
|
|
|
@@ -161,7 +196,7 @@ export async function subscribersPreferencesUpdate(
|
|
|
161
196
|
retryCodes: context.retryCodes,
|
|
162
197
|
});
|
|
163
198
|
if (!doResult.ok) {
|
|
164
|
-
return doResult;
|
|
199
|
+
return [doResult, { status: "request-error", request: req }];
|
|
165
200
|
}
|
|
166
201
|
const response = doResult.value;
|
|
167
202
|
|
|
@@ -203,8 +238,8 @@ export async function subscribersPreferencesUpdate(
|
|
|
203
238
|
M.fail("5XX"),
|
|
204
239
|
)(response, { extraFields: responseFields });
|
|
205
240
|
if (!result.ok) {
|
|
206
|
-
return result;
|
|
241
|
+
return [result, { status: "complete", request: req, response }];
|
|
207
242
|
}
|
|
208
243
|
|
|
209
|
-
return result;
|
|
244
|
+
return [result, { status: "complete", request: req, response }];
|
|
210
245
|
}
|
|
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
|
|
|
22
22
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
23
23
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
24
|
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
26
|
import { Result } from "../types/fp.js";
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -30,14 +31,14 @@ import { Result } from "../types/fp.js";
|
|
|
30
31
|
* @remarks
|
|
31
32
|
* Used to update the subscriber isOnline flag.
|
|
32
33
|
*/
|
|
33
|
-
export
|
|
34
|
+
export function subscribersPropertiesUpdateOnlineFlag(
|
|
34
35
|
client: NovuCore,
|
|
35
36
|
updateSubscriberOnlineFlagRequestDto:
|
|
36
37
|
components.UpdateSubscriberOnlineFlagRequestDto,
|
|
37
38
|
subscriberId: string,
|
|
38
39
|
idempotencyKey?: string | undefined,
|
|
39
40
|
options?: RequestOptions,
|
|
40
|
-
):
|
|
41
|
+
): APIPromise<
|
|
41
42
|
Result<
|
|
42
43
|
operations.SubscribersV1ControllerUpdateSubscriberOnlineFlagResponse,
|
|
43
44
|
| errors.ErrorDto
|
|
@@ -52,6 +53,41 @@ export async function subscribersPropertiesUpdateOnlineFlag(
|
|
|
52
53
|
| RequestTimeoutError
|
|
53
54
|
| ConnectionError
|
|
54
55
|
>
|
|
56
|
+
> {
|
|
57
|
+
return new APIPromise($do(
|
|
58
|
+
client,
|
|
59
|
+
updateSubscriberOnlineFlagRequestDto,
|
|
60
|
+
subscriberId,
|
|
61
|
+
idempotencyKey,
|
|
62
|
+
options,
|
|
63
|
+
));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function $do(
|
|
67
|
+
client: NovuCore,
|
|
68
|
+
updateSubscriberOnlineFlagRequestDto:
|
|
69
|
+
components.UpdateSubscriberOnlineFlagRequestDto,
|
|
70
|
+
subscriberId: string,
|
|
71
|
+
idempotencyKey?: string | undefined,
|
|
72
|
+
options?: RequestOptions,
|
|
73
|
+
): Promise<
|
|
74
|
+
[
|
|
75
|
+
Result<
|
|
76
|
+
operations.SubscribersV1ControllerUpdateSubscriberOnlineFlagResponse,
|
|
77
|
+
| errors.ErrorDto
|
|
78
|
+
| errors.ErrorDto
|
|
79
|
+
| errors.ValidationErrorDto
|
|
80
|
+
| errors.ErrorDto
|
|
81
|
+
| SDKError
|
|
82
|
+
| SDKValidationError
|
|
83
|
+
| UnexpectedClientError
|
|
84
|
+
| InvalidRequestError
|
|
85
|
+
| RequestAbortedError
|
|
86
|
+
| RequestTimeoutError
|
|
87
|
+
| ConnectionError
|
|
88
|
+
>,
|
|
89
|
+
APICall,
|
|
90
|
+
]
|
|
55
91
|
> {
|
|
56
92
|
const input:
|
|
57
93
|
operations.SubscribersV1ControllerUpdateSubscriberOnlineFlagRequest = {
|
|
@@ -70,7 +106,7 @@ export async function subscribersPropertiesUpdateOnlineFlag(
|
|
|
70
106
|
"Input validation failed",
|
|
71
107
|
);
|
|
72
108
|
if (!parsed.ok) {
|
|
73
|
-
return parsed;
|
|
109
|
+
return [parsed, { status: "invalid" }];
|
|
74
110
|
}
|
|
75
111
|
const payload = parsed.value;
|
|
76
112
|
const body = encodeJSON(
|
|
@@ -138,7 +174,7 @@ export async function subscribersPropertiesUpdateOnlineFlag(
|
|
|
138
174
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
175
|
}, options);
|
|
140
176
|
if (!requestRes.ok) {
|
|
141
|
-
return requestRes;
|
|
177
|
+
return [requestRes, { status: "invalid" }];
|
|
142
178
|
}
|
|
143
179
|
const req = requestRes.value;
|
|
144
180
|
|
|
@@ -165,7 +201,7 @@ export async function subscribersPropertiesUpdateOnlineFlag(
|
|
|
165
201
|
retryCodes: context.retryCodes,
|
|
166
202
|
});
|
|
167
203
|
if (!doResult.ok) {
|
|
168
|
-
return doResult;
|
|
204
|
+
return [doResult, { status: "request-error", request: req }];
|
|
169
205
|
}
|
|
170
206
|
const response = doResult.value;
|
|
171
207
|
|
|
@@ -207,8 +243,8 @@ export async function subscribersPropertiesUpdateOnlineFlag(
|
|
|
207
243
|
M.fail("5XX"),
|
|
208
244
|
)(response, { extraFields: responseFields });
|
|
209
245
|
if (!result.ok) {
|
|
210
|
-
return result;
|
|
246
|
+
return [result, { status: "complete", request: req, response }];
|
|
211
247
|
}
|
|
212
248
|
|
|
213
|
-
return result;
|
|
249
|
+
return [result, { status: "complete", request: req, response }];
|
|
214
250
|
}
|
|
@@ -21,6 +21,7 @@ import * as errors from "../models/errors/index.js";
|
|
|
21
21
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
22
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
23
|
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
25
|
import { Result } from "../types/fp.js";
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -29,12 +30,12 @@ import { Result } from "../types/fp.js";
|
|
|
29
30
|
* @remarks
|
|
30
31
|
* Get subscriber by your internal id used to identify the subscriber
|
|
31
32
|
*/
|
|
32
|
-
export
|
|
33
|
+
export function subscribersRetrieve(
|
|
33
34
|
client: NovuCore,
|
|
34
35
|
subscriberId: string,
|
|
35
36
|
idempotencyKey?: string | undefined,
|
|
36
37
|
options?: RequestOptions,
|
|
37
|
-
):
|
|
38
|
+
): APIPromise<
|
|
38
39
|
Result<
|
|
39
40
|
operations.SubscribersControllerGetSubscriberResponse,
|
|
40
41
|
| errors.ErrorDto
|
|
@@ -49,6 +50,38 @@ export async function subscribersRetrieve(
|
|
|
49
50
|
| RequestTimeoutError
|
|
50
51
|
| ConnectionError
|
|
51
52
|
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
subscriberId,
|
|
57
|
+
idempotencyKey,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: NovuCore,
|
|
64
|
+
subscriberId: string,
|
|
65
|
+
idempotencyKey?: string | undefined,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
operations.SubscribersControllerGetSubscriberResponse,
|
|
71
|
+
| errors.ErrorDto
|
|
72
|
+
| errors.ErrorDto
|
|
73
|
+
| errors.ValidationErrorDto
|
|
74
|
+
| errors.ErrorDto
|
|
75
|
+
| SDKError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| InvalidRequestError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| ConnectionError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
52
85
|
> {
|
|
53
86
|
const input: operations.SubscribersControllerGetSubscriberRequest = {
|
|
54
87
|
subscriberId: subscriberId,
|
|
@@ -64,7 +97,7 @@ export async function subscribersRetrieve(
|
|
|
64
97
|
"Input validation failed",
|
|
65
98
|
);
|
|
66
99
|
if (!parsed.ok) {
|
|
67
|
-
return parsed;
|
|
100
|
+
return [parsed, { status: "invalid" }];
|
|
68
101
|
}
|
|
69
102
|
const payload = parsed.value;
|
|
70
103
|
const body = null;
|
|
@@ -125,7 +158,7 @@ export async function subscribersRetrieve(
|
|
|
125
158
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
126
159
|
}, options);
|
|
127
160
|
if (!requestRes.ok) {
|
|
128
|
-
return requestRes;
|
|
161
|
+
return [requestRes, { status: "invalid" }];
|
|
129
162
|
}
|
|
130
163
|
const req = requestRes.value;
|
|
131
164
|
|
|
@@ -152,7 +185,7 @@ export async function subscribersRetrieve(
|
|
|
152
185
|
retryCodes: context.retryCodes,
|
|
153
186
|
});
|
|
154
187
|
if (!doResult.ok) {
|
|
155
|
-
return doResult;
|
|
188
|
+
return [doResult, { status: "request-error", request: req }];
|
|
156
189
|
}
|
|
157
190
|
const response = doResult.value;
|
|
158
191
|
|
|
@@ -193,8 +226,8 @@ export async function subscribersRetrieve(
|
|
|
193
226
|
M.fail("5XX"),
|
|
194
227
|
)(response, { extraFields: responseFields });
|
|
195
228
|
if (!result.ok) {
|
|
196
|
-
return result;
|
|
229
|
+
return [result, { status: "complete", request: req, response }];
|
|
197
230
|
}
|
|
198
231
|
|
|
199
|
-
return result;
|
|
232
|
+
return [result, { status: "complete", request: req, response }];
|
|
200
233
|
}
|
|
@@ -21,16 +21,17 @@ import * as errors from "../models/errors/index.js";
|
|
|
21
21
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
22
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
23
|
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
25
|
import { Result } from "../types/fp.js";
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Search for subscribers
|
|
28
29
|
*/
|
|
29
|
-
export
|
|
30
|
+
export function subscribersSearch(
|
|
30
31
|
client: NovuCore,
|
|
31
32
|
request: operations.SubscribersControllerSearchSubscribersRequest,
|
|
32
33
|
options?: RequestOptions,
|
|
33
|
-
):
|
|
34
|
+
): APIPromise<
|
|
34
35
|
Result<
|
|
35
36
|
operations.SubscribersControllerSearchSubscribersResponse,
|
|
36
37
|
| errors.ErrorDto
|
|
@@ -45,6 +46,36 @@ export async function subscribersSearch(
|
|
|
45
46
|
| RequestTimeoutError
|
|
46
47
|
| ConnectionError
|
|
47
48
|
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
request,
|
|
53
|
+
options,
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function $do(
|
|
58
|
+
client: NovuCore,
|
|
59
|
+
request: operations.SubscribersControllerSearchSubscribersRequest,
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<
|
|
62
|
+
[
|
|
63
|
+
Result<
|
|
64
|
+
operations.SubscribersControllerSearchSubscribersResponse,
|
|
65
|
+
| errors.ErrorDto
|
|
66
|
+
| errors.ErrorDto
|
|
67
|
+
| errors.ValidationErrorDto
|
|
68
|
+
| errors.ErrorDto
|
|
69
|
+
| SDKError
|
|
70
|
+
| SDKValidationError
|
|
71
|
+
| UnexpectedClientError
|
|
72
|
+
| InvalidRequestError
|
|
73
|
+
| RequestAbortedError
|
|
74
|
+
| RequestTimeoutError
|
|
75
|
+
| ConnectionError
|
|
76
|
+
>,
|
|
77
|
+
APICall,
|
|
78
|
+
]
|
|
48
79
|
> {
|
|
49
80
|
const parsed = safeParse(
|
|
50
81
|
request,
|
|
@@ -54,7 +85,7 @@ export async function subscribersSearch(
|
|
|
54
85
|
"Input validation failed",
|
|
55
86
|
);
|
|
56
87
|
if (!parsed.ok) {
|
|
57
|
-
return parsed;
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
58
89
|
}
|
|
59
90
|
const payload = parsed.value;
|
|
60
91
|
const body = null;
|
|
@@ -121,7 +152,7 @@ export async function subscribersSearch(
|
|
|
121
152
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
122
153
|
}, options);
|
|
123
154
|
if (!requestRes.ok) {
|
|
124
|
-
return requestRes;
|
|
155
|
+
return [requestRes, { status: "invalid" }];
|
|
125
156
|
}
|
|
126
157
|
const req = requestRes.value;
|
|
127
158
|
|
|
@@ -148,7 +179,7 @@ export async function subscribersSearch(
|
|
|
148
179
|
retryCodes: context.retryCodes,
|
|
149
180
|
});
|
|
150
181
|
if (!doResult.ok) {
|
|
151
|
-
return doResult;
|
|
182
|
+
return [doResult, { status: "request-error", request: req }];
|
|
152
183
|
}
|
|
153
184
|
const response = doResult.value;
|
|
154
185
|
|
|
@@ -189,8 +220,8 @@ export async function subscribersSearch(
|
|
|
189
220
|
M.fail("5XX"),
|
|
190
221
|
)(response, { extraFields: responseFields });
|
|
191
222
|
if (!result.ok) {
|
|
192
|
-
return result;
|
|
223
|
+
return [result, { status: "complete", request: req, response }];
|
|
193
224
|
}
|
|
194
225
|
|
|
195
|
-
return result;
|
|
226
|
+
return [result, { status: "complete", request: req, response }];
|
|
196
227
|
}
|
|
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
|
|
|
22
22
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
23
23
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
24
|
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
26
|
import { Result } from "../types/fp.js";
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -30,12 +31,12 @@ import { Result } from "../types/fp.js";
|
|
|
30
31
|
* @remarks
|
|
31
32
|
* Create a topic
|
|
32
33
|
*/
|
|
33
|
-
export
|
|
34
|
+
export function topicsCreate(
|
|
34
35
|
client: NovuCore,
|
|
35
36
|
createTopicRequestDto: components.CreateTopicRequestDto,
|
|
36
37
|
idempotencyKey?: string | undefined,
|
|
37
38
|
options?: RequestOptions,
|
|
38
|
-
):
|
|
39
|
+
): APIPromise<
|
|
39
40
|
Result<
|
|
40
41
|
operations.TopicsControllerCreateTopicResponse,
|
|
41
42
|
| errors.ErrorDto
|
|
@@ -50,6 +51,38 @@ export async function topicsCreate(
|
|
|
50
51
|
| RequestTimeoutError
|
|
51
52
|
| ConnectionError
|
|
52
53
|
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
createTopicRequestDto,
|
|
58
|
+
idempotencyKey,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: NovuCore,
|
|
65
|
+
createTopicRequestDto: components.CreateTopicRequestDto,
|
|
66
|
+
idempotencyKey?: string | undefined,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.TopicsControllerCreateTopicResponse,
|
|
72
|
+
| errors.ErrorDto
|
|
73
|
+
| errors.ErrorDto
|
|
74
|
+
| errors.ValidationErrorDto
|
|
75
|
+
| errors.ErrorDto
|
|
76
|
+
| SDKError
|
|
77
|
+
| SDKValidationError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| RequestAbortedError
|
|
81
|
+
| RequestTimeoutError
|
|
82
|
+
| ConnectionError
|
|
83
|
+
>,
|
|
84
|
+
APICall,
|
|
85
|
+
]
|
|
53
86
|
> {
|
|
54
87
|
const input: operations.TopicsControllerCreateTopicRequest = {
|
|
55
88
|
createTopicRequestDto: createTopicRequestDto,
|
|
@@ -63,7 +96,7 @@ export async function topicsCreate(
|
|
|
63
96
|
"Input validation failed",
|
|
64
97
|
);
|
|
65
98
|
if (!parsed.ok) {
|
|
66
|
-
return parsed;
|
|
99
|
+
return [parsed, { status: "invalid" }];
|
|
67
100
|
}
|
|
68
101
|
const payload = parsed.value;
|
|
69
102
|
const body = encodeJSON("body", payload.CreateTopicRequestDto, {
|
|
@@ -120,7 +153,7 @@ export async function topicsCreate(
|
|
|
120
153
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
121
154
|
}, options);
|
|
122
155
|
if (!requestRes.ok) {
|
|
123
|
-
return requestRes;
|
|
156
|
+
return [requestRes, { status: "invalid" }];
|
|
124
157
|
}
|
|
125
158
|
const req = requestRes.value;
|
|
126
159
|
|
|
@@ -147,7 +180,7 @@ export async function topicsCreate(
|
|
|
147
180
|
retryCodes: context.retryCodes,
|
|
148
181
|
});
|
|
149
182
|
if (!doResult.ok) {
|
|
150
|
-
return doResult;
|
|
183
|
+
return [doResult, { status: "request-error", request: req }];
|
|
151
184
|
}
|
|
152
185
|
const response = doResult.value;
|
|
153
186
|
|
|
@@ -187,8 +220,8 @@ export async function topicsCreate(
|
|
|
187
220
|
M.fail("5XX"),
|
|
188
221
|
)(response, { extraFields: responseFields });
|
|
189
222
|
if (!result.ok) {
|
|
190
|
-
return result;
|
|
223
|
+
return [result, { status: "complete", request: req, response }];
|
|
191
224
|
}
|
|
192
225
|
|
|
193
|
-
return result;
|
|
226
|
+
return [result, { status: "complete", request: req, response }];
|
|
194
227
|
}
|