@novu/api 0.0.2 → 0.0.4

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.
@@ -4,6 +4,7 @@
4
4
  "/v1/health-check": {
5
5
  "get": {
6
6
  "operationId": "HealthController_healthCheck",
7
+ "x-ignore": true,
7
8
  "parameters": [
8
9
  {
9
10
  "name": "idempotency-key",
@@ -183,6 +184,7 @@
183
184
  "post": {
184
185
  "operationId": "HealthController_testIdempotency",
185
186
  "x-speakeasy-name-override": "testIdempotency",
187
+ "x-ignore": true,
186
188
  "parameters": [
187
189
  {
188
190
  "name": "idempotency-key",
@@ -661,6 +663,479 @@
661
663
  "api-key": []
662
664
  }
663
665
  ]
666
+ },
667
+ "get": {
668
+ "operationId": "HealthController_generateRandomNumber",
669
+ "x-speakeasy-name-override": "generateRandomNumber",
670
+ "x-ignore": true,
671
+ "parameters": [
672
+ {
673
+ "name": "idempotency-key",
674
+ "in": "header",
675
+ "description": "A header for idempotency purposes",
676
+ "required": false,
677
+ "schema": {
678
+ "type": "string"
679
+ }
680
+ }
681
+ ],
682
+ "responses": {
683
+ "201": {
684
+ "headers": {
685
+ "Content-Type": {
686
+ "$ref": "#/components/headers/Content-Type"
687
+ },
688
+ "RateLimit-Limit": {
689
+ "$ref": "#/components/headers/RateLimit-Limit"
690
+ },
691
+ "RateLimit-Remaining": {
692
+ "$ref": "#/components/headers/RateLimit-Remaining"
693
+ },
694
+ "RateLimit-Reset": {
695
+ "$ref": "#/components/headers/RateLimit-Reset"
696
+ },
697
+ "RateLimit-Policy": {
698
+ "$ref": "#/components/headers/RateLimit-Policy"
699
+ },
700
+ "Idempotency-Key": {
701
+ "$ref": "#/components/headers/Idempotency-Key"
702
+ },
703
+ "Idempotency-Replay": {
704
+ "$ref": "#/components/headers/Idempotency-Replay"
705
+ }
706
+ },
707
+ "description": "",
708
+ "content": {
709
+ "application/json": {
710
+ "schema": {
711
+ "$ref": "#/components/schemas/IdempotenceTestingResponse"
712
+ }
713
+ }
714
+ }
715
+ },
716
+ "400": {
717
+ "description": "Bad Request",
718
+ "headers": {
719
+ "Content-Type": {
720
+ "$ref": "#/components/headers/Content-Type"
721
+ },
722
+ "RateLimit-Limit": {
723
+ "$ref": "#/components/headers/RateLimit-Limit"
724
+ },
725
+ "RateLimit-Remaining": {
726
+ "$ref": "#/components/headers/RateLimit-Remaining"
727
+ },
728
+ "RateLimit-Reset": {
729
+ "$ref": "#/components/headers/RateLimit-Reset"
730
+ },
731
+ "RateLimit-Policy": {
732
+ "$ref": "#/components/headers/RateLimit-Policy"
733
+ },
734
+ "Idempotency-Key": {
735
+ "$ref": "#/components/headers/Idempotency-Key"
736
+ },
737
+ "Idempotency-Replay": {
738
+ "$ref": "#/components/headers/Idempotency-Replay"
739
+ }
740
+ },
741
+ "content": {
742
+ "application/json": {
743
+ "schema": {
744
+ "$ref": "#/components/schemas/ErrorDto"
745
+ }
746
+ }
747
+ }
748
+ },
749
+ "401": {
750
+ "description": "Unauthorized",
751
+ "headers": {
752
+ "Content-Type": {
753
+ "$ref": "#/components/headers/Content-Type"
754
+ },
755
+ "RateLimit-Limit": {
756
+ "$ref": "#/components/headers/RateLimit-Limit"
757
+ },
758
+ "RateLimit-Remaining": {
759
+ "$ref": "#/components/headers/RateLimit-Remaining"
760
+ },
761
+ "RateLimit-Reset": {
762
+ "$ref": "#/components/headers/RateLimit-Reset"
763
+ },
764
+ "RateLimit-Policy": {
765
+ "$ref": "#/components/headers/RateLimit-Policy"
766
+ },
767
+ "Idempotency-Key": {
768
+ "$ref": "#/components/headers/Idempotency-Key"
769
+ },
770
+ "Idempotency-Replay": {
771
+ "$ref": "#/components/headers/Idempotency-Replay"
772
+ }
773
+ },
774
+ "content": {
775
+ "application/json": {
776
+ "schema": {
777
+ "$ref": "#/components/schemas/ErrorDto"
778
+ }
779
+ }
780
+ }
781
+ },
782
+ "403": {
783
+ "description": "Forbidden",
784
+ "headers": {
785
+ "Content-Type": {
786
+ "$ref": "#/components/headers/Content-Type"
787
+ },
788
+ "RateLimit-Limit": {
789
+ "$ref": "#/components/headers/RateLimit-Limit"
790
+ },
791
+ "RateLimit-Remaining": {
792
+ "$ref": "#/components/headers/RateLimit-Remaining"
793
+ },
794
+ "RateLimit-Reset": {
795
+ "$ref": "#/components/headers/RateLimit-Reset"
796
+ },
797
+ "RateLimit-Policy": {
798
+ "$ref": "#/components/headers/RateLimit-Policy"
799
+ },
800
+ "Idempotency-Key": {
801
+ "$ref": "#/components/headers/Idempotency-Key"
802
+ },
803
+ "Idempotency-Replay": {
804
+ "$ref": "#/components/headers/Idempotency-Replay"
805
+ }
806
+ },
807
+ "content": {
808
+ "application/json": {
809
+ "schema": {
810
+ "$ref": "#/components/schemas/ErrorDto"
811
+ }
812
+ }
813
+ }
814
+ },
815
+ "404": {
816
+ "description": "Not Found",
817
+ "headers": {
818
+ "Content-Type": {
819
+ "$ref": "#/components/headers/Content-Type"
820
+ },
821
+ "RateLimit-Limit": {
822
+ "$ref": "#/components/headers/RateLimit-Limit"
823
+ },
824
+ "RateLimit-Remaining": {
825
+ "$ref": "#/components/headers/RateLimit-Remaining"
826
+ },
827
+ "RateLimit-Reset": {
828
+ "$ref": "#/components/headers/RateLimit-Reset"
829
+ },
830
+ "RateLimit-Policy": {
831
+ "$ref": "#/components/headers/RateLimit-Policy"
832
+ },
833
+ "Idempotency-Key": {
834
+ "$ref": "#/components/headers/Idempotency-Key"
835
+ },
836
+ "Idempotency-Replay": {
837
+ "$ref": "#/components/headers/Idempotency-Replay"
838
+ }
839
+ },
840
+ "content": {
841
+ "application/json": {
842
+ "schema": {
843
+ "$ref": "#/components/schemas/ErrorDto"
844
+ }
845
+ }
846
+ }
847
+ },
848
+ "405": {
849
+ "description": "Method Not Allowed",
850
+ "headers": {
851
+ "Content-Type": {
852
+ "$ref": "#/components/headers/Content-Type"
853
+ },
854
+ "RateLimit-Limit": {
855
+ "$ref": "#/components/headers/RateLimit-Limit"
856
+ },
857
+ "RateLimit-Remaining": {
858
+ "$ref": "#/components/headers/RateLimit-Remaining"
859
+ },
860
+ "RateLimit-Reset": {
861
+ "$ref": "#/components/headers/RateLimit-Reset"
862
+ },
863
+ "RateLimit-Policy": {
864
+ "$ref": "#/components/headers/RateLimit-Policy"
865
+ },
866
+ "Idempotency-Key": {
867
+ "$ref": "#/components/headers/Idempotency-Key"
868
+ },
869
+ "Idempotency-Replay": {
870
+ "$ref": "#/components/headers/Idempotency-Replay"
871
+ }
872
+ },
873
+ "content": {
874
+ "application/json": {
875
+ "schema": {
876
+ "$ref": "#/components/schemas/ErrorDto"
877
+ }
878
+ }
879
+ }
880
+ },
881
+ "409": {
882
+ "description": "Conflict",
883
+ "headers": {
884
+ "Content-Type": {
885
+ "$ref": "#/components/headers/Content-Type"
886
+ },
887
+ "RateLimit-Limit": {
888
+ "$ref": "#/components/headers/RateLimit-Limit"
889
+ },
890
+ "RateLimit-Remaining": {
891
+ "$ref": "#/components/headers/RateLimit-Remaining"
892
+ },
893
+ "RateLimit-Reset": {
894
+ "$ref": "#/components/headers/RateLimit-Reset"
895
+ },
896
+ "RateLimit-Policy": {
897
+ "$ref": "#/components/headers/RateLimit-Policy"
898
+ },
899
+ "Idempotency-Key": {
900
+ "$ref": "#/components/headers/Idempotency-Key"
901
+ },
902
+ "Idempotency-Replay": {
903
+ "$ref": "#/components/headers/Idempotency-Replay"
904
+ }
905
+ },
906
+ "content": {
907
+ "application/json": {
908
+ "schema": {
909
+ "$ref": "#/components/schemas/ErrorDto"
910
+ }
911
+ }
912
+ }
913
+ },
914
+ "413": {
915
+ "description": "Payload Too Large",
916
+ "headers": {
917
+ "Content-Type": {
918
+ "$ref": "#/components/headers/Content-Type"
919
+ },
920
+ "RateLimit-Limit": {
921
+ "$ref": "#/components/headers/RateLimit-Limit"
922
+ },
923
+ "RateLimit-Remaining": {
924
+ "$ref": "#/components/headers/RateLimit-Remaining"
925
+ },
926
+ "RateLimit-Reset": {
927
+ "$ref": "#/components/headers/RateLimit-Reset"
928
+ },
929
+ "RateLimit-Policy": {
930
+ "$ref": "#/components/headers/RateLimit-Policy"
931
+ },
932
+ "Idempotency-Key": {
933
+ "$ref": "#/components/headers/Idempotency-Key"
934
+ },
935
+ "Idempotency-Replay": {
936
+ "$ref": "#/components/headers/Idempotency-Replay"
937
+ }
938
+ },
939
+ "content": {
940
+ "application/json": {
941
+ "schema": {
942
+ "$ref": "#/components/schemas/ErrorDto"
943
+ }
944
+ }
945
+ }
946
+ },
947
+ "414": {
948
+ "description": "URI Too Long",
949
+ "content": {
950
+ "application/json": {
951
+ "schema": {
952
+ "$ref": "#/components/schemas/ErrorDto"
953
+ }
954
+ }
955
+ }
956
+ },
957
+ "415": {
958
+ "description": "Unsupported Media Type",
959
+ "headers": {
960
+ "Content-Type": {
961
+ "$ref": "#/components/headers/Content-Type"
962
+ },
963
+ "RateLimit-Limit": {
964
+ "$ref": "#/components/headers/RateLimit-Limit"
965
+ },
966
+ "RateLimit-Remaining": {
967
+ "$ref": "#/components/headers/RateLimit-Remaining"
968
+ },
969
+ "RateLimit-Reset": {
970
+ "$ref": "#/components/headers/RateLimit-Reset"
971
+ },
972
+ "RateLimit-Policy": {
973
+ "$ref": "#/components/headers/RateLimit-Policy"
974
+ },
975
+ "Idempotency-Key": {
976
+ "$ref": "#/components/headers/Idempotency-Key"
977
+ },
978
+ "Idempotency-Replay": {
979
+ "$ref": "#/components/headers/Idempotency-Replay"
980
+ }
981
+ },
982
+ "content": {
983
+ "application/json": {
984
+ "schema": {
985
+ "$ref": "#/components/schemas/ErrorDto"
986
+ }
987
+ }
988
+ }
989
+ },
990
+ "422": {
991
+ "description": "Unprocessable Entity",
992
+ "headers": {
993
+ "Content-Type": {
994
+ "$ref": "#/components/headers/Content-Type"
995
+ },
996
+ "RateLimit-Limit": {
997
+ "$ref": "#/components/headers/RateLimit-Limit"
998
+ },
999
+ "RateLimit-Remaining": {
1000
+ "$ref": "#/components/headers/RateLimit-Remaining"
1001
+ },
1002
+ "RateLimit-Reset": {
1003
+ "$ref": "#/components/headers/RateLimit-Reset"
1004
+ },
1005
+ "RateLimit-Policy": {
1006
+ "$ref": "#/components/headers/RateLimit-Policy"
1007
+ },
1008
+ "Idempotency-Key": {
1009
+ "$ref": "#/components/headers/Idempotency-Key"
1010
+ },
1011
+ "Idempotency-Replay": {
1012
+ "$ref": "#/components/headers/Idempotency-Replay"
1013
+ }
1014
+ },
1015
+ "content": {
1016
+ "application/json": {
1017
+ "schema": {
1018
+ "$ref": "#/components/schemas/ValidationErrorDto"
1019
+ }
1020
+ }
1021
+ }
1022
+ },
1023
+ "429": {
1024
+ "description": "The client has sent too many requests in a given amount of time. ",
1025
+ "headers": {
1026
+ "Content-Type": {
1027
+ "$ref": "#/components/headers/Content-Type"
1028
+ },
1029
+ "RateLimit-Limit": {
1030
+ "$ref": "#/components/headers/RateLimit-Limit"
1031
+ },
1032
+ "RateLimit-Remaining": {
1033
+ "$ref": "#/components/headers/RateLimit-Remaining"
1034
+ },
1035
+ "RateLimit-Reset": {
1036
+ "$ref": "#/components/headers/RateLimit-Reset"
1037
+ },
1038
+ "RateLimit-Policy": {
1039
+ "$ref": "#/components/headers/RateLimit-Policy"
1040
+ },
1041
+ "Idempotency-Key": {
1042
+ "$ref": "#/components/headers/Idempotency-Key"
1043
+ },
1044
+ "Idempotency-Replay": {
1045
+ "$ref": "#/components/headers/Idempotency-Replay"
1046
+ },
1047
+ "Retry-After": {
1048
+ "$ref": "#/components/headers/Retry-After"
1049
+ }
1050
+ },
1051
+ "content": {
1052
+ "application/json": {
1053
+ "schema": {
1054
+ "type": "string",
1055
+ "example": "API rate limit exceeded"
1056
+ }
1057
+ }
1058
+ }
1059
+ },
1060
+ "500": {
1061
+ "description": "Internal Server Error",
1062
+ "headers": {
1063
+ "Content-Type": {
1064
+ "$ref": "#/components/headers/Content-Type"
1065
+ },
1066
+ "RateLimit-Limit": {
1067
+ "$ref": "#/components/headers/RateLimit-Limit"
1068
+ },
1069
+ "RateLimit-Remaining": {
1070
+ "$ref": "#/components/headers/RateLimit-Remaining"
1071
+ },
1072
+ "RateLimit-Reset": {
1073
+ "$ref": "#/components/headers/RateLimit-Reset"
1074
+ },
1075
+ "RateLimit-Policy": {
1076
+ "$ref": "#/components/headers/RateLimit-Policy"
1077
+ },
1078
+ "Idempotency-Key": {
1079
+ "$ref": "#/components/headers/Idempotency-Key"
1080
+ },
1081
+ "Idempotency-Replay": {
1082
+ "$ref": "#/components/headers/Idempotency-Replay"
1083
+ }
1084
+ },
1085
+ "content": {
1086
+ "application/json": {
1087
+ "schema": {
1088
+ "$ref": "#/components/schemas/ErrorDto"
1089
+ }
1090
+ }
1091
+ }
1092
+ },
1093
+ "503": {
1094
+ "description": "The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.",
1095
+ "headers": {
1096
+ "Content-Type": {
1097
+ "$ref": "#/components/headers/Content-Type"
1098
+ },
1099
+ "RateLimit-Limit": {
1100
+ "$ref": "#/components/headers/RateLimit-Limit"
1101
+ },
1102
+ "RateLimit-Remaining": {
1103
+ "$ref": "#/components/headers/RateLimit-Remaining"
1104
+ },
1105
+ "RateLimit-Reset": {
1106
+ "$ref": "#/components/headers/RateLimit-Reset"
1107
+ },
1108
+ "RateLimit-Policy": {
1109
+ "$ref": "#/components/headers/RateLimit-Policy"
1110
+ },
1111
+ "Idempotency-Key": {
1112
+ "$ref": "#/components/headers/Idempotency-Key"
1113
+ },
1114
+ "Idempotency-Replay": {
1115
+ "$ref": "#/components/headers/Idempotency-Replay"
1116
+ },
1117
+ "Retry-After": {
1118
+ "$ref": "#/components/headers/Retry-After"
1119
+ }
1120
+ },
1121
+ "content": {
1122
+ "application/json": {
1123
+ "schema": {
1124
+ "type": "string",
1125
+ "example": "Please wait some time, then try again."
1126
+ }
1127
+ }
1128
+ }
1129
+ }
1130
+ },
1131
+ "tags": [
1132
+ "Admin"
1133
+ ],
1134
+ "security": [
1135
+ {
1136
+ "api-key": []
1137
+ }
1138
+ ]
664
1139
  }
665
1140
  },
666
1141
  "/v1/events/trigger": {
@@ -0,0 +1,183 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { NovuCore } from "../core.js";
6
+ import { 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
+ export async function adminGenerateRandomNumber(
27
+ client: NovuCore,
28
+ idempotencyKey?: string | undefined,
29
+ options?: RequestOptions,
30
+ ): Promise<
31
+ Result<
32
+ operations.HealthControllerGenerateRandomNumberResponse,
33
+ | errors.ErrorDto
34
+ | errors.ErrorDto
35
+ | errors.ValidationErrorDto
36
+ | errors.ErrorDto
37
+ | SDKError
38
+ | SDKValidationError
39
+ | UnexpectedClientError
40
+ | InvalidRequestError
41
+ | RequestAbortedError
42
+ | RequestTimeoutError
43
+ | ConnectionError
44
+ >
45
+ > {
46
+ const input: operations.HealthControllerGenerateRandomNumberRequest = {
47
+ idempotencyKey: idempotencyKey,
48
+ };
49
+
50
+ const parsed = safeParse(
51
+ input,
52
+ (value) =>
53
+ operations.HealthControllerGenerateRandomNumberRequest$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 = null;
62
+
63
+ const path = pathToFunc("/v1/health-check/test-idempotency")();
64
+
65
+ const headers = new Headers(compactMap({
66
+ Accept: "application/json",
67
+ "idempotency-key": encodeSimple(
68
+ "idempotency-key",
69
+ payload["idempotency-key"],
70
+ { explode: false, charEncoding: "none" },
71
+ ),
72
+ }));
73
+
74
+ const secConfig = await extractSecurity(client._options.apiKey);
75
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
76
+ const requestSecurity = resolveGlobalSecurity(securityInput);
77
+
78
+ const context = {
79
+ operationID: "HealthController_generateRandomNumber",
80
+ oAuth2Scopes: [],
81
+
82
+ resolvedSecurity: requestSecurity,
83
+
84
+ securitySource: client._options.apiKey,
85
+ retryConfig: options?.retries
86
+ || client._options.retryConfig
87
+ || {
88
+ strategy: "backoff",
89
+ backoff: {
90
+ initialInterval: 1000,
91
+ maxInterval: 30000,
92
+ exponent: 1.5,
93
+ maxElapsedTime: 3600000,
94
+ },
95
+ retryConnectionErrors: true,
96
+ }
97
+ || { strategy: "none" },
98
+ retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
99
+ };
100
+
101
+ const requestRes = client._createRequest(context, {
102
+ security: requestSecurity,
103
+ method: "GET",
104
+ baseURL: options?.serverURL,
105
+ path: path,
106
+ headers: headers,
107
+ body: body,
108
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
109
+ }, options);
110
+ if (!requestRes.ok) {
111
+ return requestRes;
112
+ }
113
+ const req = requestRes.value;
114
+
115
+ const doResult = await client._do(req, {
116
+ context,
117
+ errorCodes: [
118
+ "400",
119
+ "401",
120
+ "403",
121
+ "404",
122
+ "405",
123
+ "409",
124
+ "413",
125
+ "414",
126
+ "415",
127
+ "422",
128
+ "429",
129
+ "4XX",
130
+ "500",
131
+ "503",
132
+ "5XX",
133
+ ],
134
+ retryConfig: context.retryConfig,
135
+ retryCodes: context.retryCodes,
136
+ });
137
+ if (!doResult.ok) {
138
+ return doResult;
139
+ }
140
+ const response = doResult.value;
141
+
142
+ const responseFields = {
143
+ HttpMeta: { Response: response, Request: req },
144
+ };
145
+
146
+ const [result] = await M.match<
147
+ operations.HealthControllerGenerateRandomNumberResponse,
148
+ | errors.ErrorDto
149
+ | errors.ErrorDto
150
+ | errors.ValidationErrorDto
151
+ | errors.ErrorDto
152
+ | SDKError
153
+ | SDKValidationError
154
+ | UnexpectedClientError
155
+ | InvalidRequestError
156
+ | RequestAbortedError
157
+ | RequestTimeoutError
158
+ | ConnectionError
159
+ >(
160
+ M.json(
161
+ 201,
162
+ operations.HealthControllerGenerateRandomNumberResponse$inboundSchema,
163
+ { hdrs: true, key: "Result" },
164
+ ),
165
+ M.jsonErr(
166
+ [400, 401, 403, 404, 405, 409, 413, 415],
167
+ errors.ErrorDto$inboundSchema,
168
+ { hdrs: true },
169
+ ),
170
+ M.jsonErr(414, errors.ErrorDto$inboundSchema),
171
+ M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
172
+ M.fail(429),
173
+ M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
174
+ M.fail(503),
175
+ M.fail("4XX"),
176
+ M.fail("5XX"),
177
+ )(response, { extraFields: responseFields });
178
+ if (!result.ok) {
179
+ return result;
180
+ }
181
+
182
+ return result;
183
+ }
package/src/lib/config.ts CHANGED
@@ -55,7 +55,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
55
55
  export const SDK_METADATA = {
56
56
  language: "typescript",
57
57
  openapiDocVersion: "1.0",
58
- sdkVersion: "0.0.2",
58
+ sdkVersion: "0.0.4",
59
59
  genVersion: "2.493.21",
60
- userAgent: "speakeasy-sdk/typescript 0.0.2 2.493.21 1.0 @novu/api",
60
+ userAgent: "speakeasy-sdk/typescript 0.0.4 2.493.21 1.0 @novu/api",
61
61
  } as const;