@greensecurity/javascript-sdk 0.40.8-beta.3 → 0.40.8-beta.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.
Files changed (136) hide show
  1. package/README.md +9 -0
  2. package/dist/commonjs/__tests__/alerts.test.d.ts +2 -0
  3. package/dist/commonjs/__tests__/alerts.test.d.ts.map +1 -0
  4. package/dist/commonjs/__tests__/alerts.test.js +51 -0
  5. package/dist/commonjs/__tests__/alerts.test.js.map +1 -0
  6. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  7. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  8. package/dist/commonjs/__tests__/zones.test.js +19 -4
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/alertsListAlerts.d.ts +21 -0
  11. package/dist/commonjs/funcs/alertsListAlerts.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/alertsListAlerts.js +154 -0
  13. package/dist/commonjs/funcs/alertsListAlerts.js.map +1 -0
  14. package/dist/commonjs/funcs/alertsUpdateUserAlerts.d.ts +18 -0
  15. package/dist/commonjs/funcs/alertsUpdateUserAlerts.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/alertsUpdateUserAlerts.js +117 -0
  17. package/dist/commonjs/funcs/alertsUpdateUserAlerts.js.map +1 -0
  18. package/dist/commonjs/lib/config.d.ts +2 -2
  19. package/dist/commonjs/lib/config.js +2 -2
  20. package/dist/commonjs/models/components/alert.d.ts +48 -0
  21. package/dist/commonjs/models/components/alert.d.ts.map +1 -0
  22. package/dist/commonjs/models/components/alert.js +101 -0
  23. package/dist/commonjs/models/components/alert.js.map +1 -0
  24. package/dist/commonjs/models/components/index.d.ts +1 -0
  25. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/index.js +1 -0
  27. package/dist/commonjs/models/components/index.js.map +1 -1
  28. package/dist/commonjs/models/operations/index.d.ts +2 -0
  29. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  30. package/dist/commonjs/models/operations/index.js +2 -0
  31. package/dist/commonjs/models/operations/index.js.map +1 -1
  32. package/dist/commonjs/models/operations/listalerts.d.ts +106 -0
  33. package/dist/commonjs/models/operations/listalerts.d.ts.map +1 -0
  34. package/dist/commonjs/models/operations/listalerts.js +149 -0
  35. package/dist/commonjs/models/operations/listalerts.js.map +1 -0
  36. package/dist/commonjs/models/operations/updateuseralerts.d.ts +57 -0
  37. package/dist/commonjs/models/operations/updateuseralerts.d.ts.map +1 -0
  38. package/dist/commonjs/models/operations/updateuseralerts.js +105 -0
  39. package/dist/commonjs/models/operations/updateuseralerts.js.map +1 -0
  40. package/dist/commonjs/react-query/alertsListAlerts.d.ts +75 -0
  41. package/dist/commonjs/react-query/alertsListAlerts.d.ts.map +1 -0
  42. package/dist/commonjs/react-query/alertsListAlerts.js +150 -0
  43. package/dist/commonjs/react-query/alertsListAlerts.js.map +1 -0
  44. package/dist/commonjs/react-query/alertsUpdateUserAlerts.d.ts +23 -0
  45. package/dist/commonjs/react-query/alertsUpdateUserAlerts.d.ts.map +1 -0
  46. package/dist/commonjs/react-query/alertsUpdateUserAlerts.js +47 -0
  47. package/dist/commonjs/react-query/alertsUpdateUserAlerts.js.map +1 -0
  48. package/dist/commonjs/react-query/index.d.ts +2 -0
  49. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  50. package/dist/commonjs/react-query/index.js +2 -0
  51. package/dist/commonjs/react-query/index.js.map +1 -1
  52. package/dist/commonjs/sdk/alerts.d.ts +22 -0
  53. package/dist/commonjs/sdk/alerts.d.ts.map +1 -0
  54. package/dist/commonjs/sdk/alerts.js +33 -0
  55. package/dist/commonjs/sdk/alerts.js.map +1 -0
  56. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  57. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  58. package/dist/commonjs/sdk/sdk.js +4 -0
  59. package/dist/commonjs/sdk/sdk.js.map +1 -1
  60. package/dist/esm/__tests__/alerts.test.d.ts +2 -0
  61. package/dist/esm/__tests__/alerts.test.d.ts.map +1 -0
  62. package/dist/esm/__tests__/alerts.test.js +49 -0
  63. package/dist/esm/__tests__/alerts.test.js.map +1 -0
  64. package/dist/esm/__tests__/webhooks.test.js +1 -1
  65. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  66. package/dist/esm/__tests__/zones.test.js +19 -4
  67. package/dist/esm/__tests__/zones.test.js.map +1 -1
  68. package/dist/esm/funcs/alertsListAlerts.d.ts +21 -0
  69. package/dist/esm/funcs/alertsListAlerts.d.ts.map +1 -0
  70. package/dist/esm/funcs/alertsListAlerts.js +118 -0
  71. package/dist/esm/funcs/alertsListAlerts.js.map +1 -0
  72. package/dist/esm/funcs/alertsUpdateUserAlerts.d.ts +18 -0
  73. package/dist/esm/funcs/alertsUpdateUserAlerts.d.ts.map +1 -0
  74. package/dist/esm/funcs/alertsUpdateUserAlerts.js +81 -0
  75. package/dist/esm/funcs/alertsUpdateUserAlerts.js.map +1 -0
  76. package/dist/esm/lib/config.d.ts +2 -2
  77. package/dist/esm/lib/config.js +2 -2
  78. package/dist/esm/models/components/alert.d.ts +48 -0
  79. package/dist/esm/models/components/alert.d.ts.map +1 -0
  80. package/dist/esm/models/components/alert.js +63 -0
  81. package/dist/esm/models/components/alert.js.map +1 -0
  82. package/dist/esm/models/components/index.d.ts +1 -0
  83. package/dist/esm/models/components/index.d.ts.map +1 -1
  84. package/dist/esm/models/components/index.js +1 -0
  85. package/dist/esm/models/components/index.js.map +1 -1
  86. package/dist/esm/models/operations/index.d.ts +2 -0
  87. package/dist/esm/models/operations/index.d.ts.map +1 -1
  88. package/dist/esm/models/operations/index.js +2 -0
  89. package/dist/esm/models/operations/index.js.map +1 -1
  90. package/dist/esm/models/operations/listalerts.d.ts +106 -0
  91. package/dist/esm/models/operations/listalerts.d.ts.map +1 -0
  92. package/dist/esm/models/operations/listalerts.js +107 -0
  93. package/dist/esm/models/operations/listalerts.js.map +1 -0
  94. package/dist/esm/models/operations/updateuseralerts.d.ts +57 -0
  95. package/dist/esm/models/operations/updateuseralerts.d.ts.map +1 -0
  96. package/dist/esm/models/operations/updateuseralerts.js +65 -0
  97. package/dist/esm/models/operations/updateuseralerts.js.map +1 -0
  98. package/dist/esm/react-query/alertsListAlerts.d.ts +75 -0
  99. package/dist/esm/react-query/alertsListAlerts.d.ts.map +1 -0
  100. package/dist/esm/react-query/alertsListAlerts.js +137 -0
  101. package/dist/esm/react-query/alertsListAlerts.js.map +1 -0
  102. package/dist/esm/react-query/alertsUpdateUserAlerts.d.ts +23 -0
  103. package/dist/esm/react-query/alertsUpdateUserAlerts.d.ts.map +1 -0
  104. package/dist/esm/react-query/alertsUpdateUserAlerts.js +42 -0
  105. package/dist/esm/react-query/alertsUpdateUserAlerts.js.map +1 -0
  106. package/dist/esm/react-query/index.d.ts +2 -0
  107. package/dist/esm/react-query/index.d.ts.map +1 -1
  108. package/dist/esm/react-query/index.js +2 -0
  109. package/dist/esm/react-query/index.js.map +1 -1
  110. package/dist/esm/sdk/alerts.d.ts +22 -0
  111. package/dist/esm/sdk/alerts.d.ts.map +1 -0
  112. package/dist/esm/sdk/alerts.js +29 -0
  113. package/dist/esm/sdk/alerts.js.map +1 -0
  114. package/dist/esm/sdk/sdk.d.ts +3 -0
  115. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  116. package/dist/esm/sdk/sdk.js +4 -0
  117. package/dist/esm/sdk/sdk.js.map +1 -1
  118. package/examples/package-lock.json +1 -1
  119. package/jsr.json +1 -1
  120. package/package.json +1 -1
  121. package/src/__tests__/alerts.test.ts +55 -0
  122. package/src/__tests__/webhooks.test.ts +1 -1
  123. package/src/__tests__/zones.test.ts +19 -4
  124. package/src/funcs/alertsListAlerts.ts +245 -0
  125. package/src/funcs/alertsUpdateUserAlerts.ts +170 -0
  126. package/src/lib/config.ts +2 -2
  127. package/src/models/components/alert.ts +109 -0
  128. package/src/models/components/index.ts +1 -0
  129. package/src/models/operations/index.ts +2 -0
  130. package/src/models/operations/listalerts.ts +234 -0
  131. package/src/models/operations/updateuseralerts.ts +140 -0
  132. package/src/react-query/alertsListAlerts.ts +308 -0
  133. package/src/react-query/alertsUpdateUserAlerts.ts +89 -0
  134. package/src/react-query/index.ts +2 -0
  135. package/src/sdk/alerts.ts +46 -0
  136. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { encodeJSON } 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 { GreenSecurityError } from "../models/errors/greensecurityerror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Update user alerts
30
+ *
31
+ * @remarks
32
+ * Update user alerts
33
+ */
34
+ export function alertsUpdateUserAlerts(
35
+ client: GreenSecurityCore,
36
+ request: operations.UpdateUserAlertsRequestBody,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.UpdateUserAlertsResponseBody,
41
+ | errors.ApiErrorResponse
42
+ | GreenSecurityError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: GreenSecurityCore,
61
+ request: operations.UpdateUserAlertsRequestBody,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ operations.UpdateUserAlertsResponseBody,
67
+ | errors.ApiErrorResponse
68
+ | GreenSecurityError
69
+ | ResponseValidationError
70
+ | ConnectionError
71
+ | RequestAbortedError
72
+ | RequestTimeoutError
73
+ | InvalidRequestError
74
+ | UnexpectedClientError
75
+ | SDKValidationError
76
+ >,
77
+ APICall,
78
+ ]
79
+ > {
80
+ const parsed = safeParse(
81
+ request,
82
+ (value) =>
83
+ operations.UpdateUserAlertsRequestBody$outboundSchema.parse(value),
84
+ "Input validation failed",
85
+ );
86
+ if (!parsed.ok) {
87
+ return [parsed, { status: "invalid" }];
88
+ }
89
+ const payload = parsed.value;
90
+ const body = encodeJSON("body", payload, { explode: true });
91
+
92
+ const path = pathToFunc("/user-alerts")();
93
+
94
+ const headers = new Headers(compactMap({
95
+ "Content-Type": "application/json",
96
+ Accept: "application/json",
97
+ }));
98
+
99
+ const securityInput = await extractSecurity(client._options.security);
100
+ const requestSecurity = resolveGlobalSecurity(securityInput);
101
+
102
+ const context = {
103
+ options: client._options,
104
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
105
+ operationID: "updateUserAlerts",
106
+ oAuth2Scopes: [],
107
+
108
+ resolvedSecurity: requestSecurity,
109
+
110
+ securitySource: client._options.security,
111
+ retryConfig: options?.retries
112
+ || client._options.retryConfig
113
+ || { strategy: "none" },
114
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
115
+ };
116
+
117
+ const requestRes = client._createRequest(context, {
118
+ security: requestSecurity,
119
+ method: "PUT",
120
+ baseURL: options?.serverURL,
121
+ path: path,
122
+ headers: headers,
123
+ body: body,
124
+ userAgent: client._options.userAgent,
125
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
126
+ }, options);
127
+ if (!requestRes.ok) {
128
+ return [requestRes, { status: "invalid" }];
129
+ }
130
+ const req = requestRes.value;
131
+
132
+ const doResult = await client._do(req, {
133
+ context,
134
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
135
+ retryConfig: context.retryConfig,
136
+ retryCodes: context.retryCodes,
137
+ });
138
+ if (!doResult.ok) {
139
+ return [doResult, { status: "request-error", request: req }];
140
+ }
141
+ const response = doResult.value;
142
+
143
+ const responseFields = {
144
+ HttpMeta: { Response: response, Request: req },
145
+ };
146
+
147
+ const [result] = await M.match<
148
+ operations.UpdateUserAlertsResponseBody,
149
+ | errors.ApiErrorResponse
150
+ | GreenSecurityError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, operations.UpdateUserAlertsResponseBody$inboundSchema),
160
+ M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
161
+ M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
162
+ M.fail("4XX"),
163
+ M.fail("5XX"),
164
+ )(response, req, { extraFields: responseFields });
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.0.4",
83
- sdkVersion: "0.40.8-beta.2",
83
+ sdkVersion: "0.40.8-beta.3",
84
84
  genVersion: "2.687.1",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.40.8-beta.2 2.687.1 0.0.4 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.40.8-beta.3 2.687.1 0.0.4 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * A simplified representation of a Alert, typically used in list views.
13
+ */
14
+ export type Alert = {
15
+ id?: number | undefined;
16
+ dateAdded?: string | null | undefined;
17
+ dateStarts?: string | null | undefined;
18
+ message?: string | null | undefined;
19
+ status?: string | null | undefined;
20
+ title?: string | null | undefined;
21
+ plainText?: string | null | undefined;
22
+ viewed?: boolean | null | undefined;
23
+ dateViewed?: string | null | undefined;
24
+ };
25
+
26
+ /** @internal */
27
+ export const Alert$inboundSchema: z.ZodType<Alert, z.ZodTypeDef, unknown> = z
28
+ .object({
29
+ id: z.number().int().optional(),
30
+ date_added: z.nullable(z.string()).optional(),
31
+ date_starts: z.nullable(z.string()).optional(),
32
+ message: z.nullable(z.string()).optional(),
33
+ status: z.nullable(z.string()).optional(),
34
+ title: z.nullable(z.string()).optional(),
35
+ plain_text: z.nullable(z.string()).optional(),
36
+ viewed: z.nullable(z.boolean()).optional(),
37
+ date_viewed: z.nullable(z.string()).optional(),
38
+ }).transform((v) => {
39
+ return remap$(v, {
40
+ "date_added": "dateAdded",
41
+ "date_starts": "dateStarts",
42
+ "plain_text": "plainText",
43
+ "date_viewed": "dateViewed",
44
+ });
45
+ });
46
+
47
+ /** @internal */
48
+ export type Alert$Outbound = {
49
+ id?: number | undefined;
50
+ date_added?: string | null | undefined;
51
+ date_starts?: string | null | undefined;
52
+ message?: string | null | undefined;
53
+ status?: string | null | undefined;
54
+ title?: string | null | undefined;
55
+ plain_text?: string | null | undefined;
56
+ viewed?: boolean | null | undefined;
57
+ date_viewed?: string | null | undefined;
58
+ };
59
+
60
+ /** @internal */
61
+ export const Alert$outboundSchema: z.ZodType<
62
+ Alert$Outbound,
63
+ z.ZodTypeDef,
64
+ Alert
65
+ > = z.object({
66
+ id: z.number().int().optional(),
67
+ dateAdded: z.nullable(z.string()).optional(),
68
+ dateStarts: z.nullable(z.string()).optional(),
69
+ message: z.nullable(z.string()).optional(),
70
+ status: z.nullable(z.string()).optional(),
71
+ title: z.nullable(z.string()).optional(),
72
+ plainText: z.nullable(z.string()).optional(),
73
+ viewed: z.nullable(z.boolean()).optional(),
74
+ dateViewed: z.nullable(z.string()).optional(),
75
+ }).transform((v) => {
76
+ return remap$(v, {
77
+ dateAdded: "date_added",
78
+ dateStarts: "date_starts",
79
+ plainText: "plain_text",
80
+ dateViewed: "date_viewed",
81
+ });
82
+ });
83
+
84
+ /**
85
+ * @internal
86
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
87
+ */
88
+ export namespace Alert$ {
89
+ /** @deprecated use `Alert$inboundSchema` instead. */
90
+ export const inboundSchema = Alert$inboundSchema;
91
+ /** @deprecated use `Alert$outboundSchema` instead. */
92
+ export const outboundSchema = Alert$outboundSchema;
93
+ /** @deprecated use `Alert$Outbound` instead. */
94
+ export type Outbound = Alert$Outbound;
95
+ }
96
+
97
+ export function alertToJSON(alert: Alert): string {
98
+ return JSON.stringify(Alert$outboundSchema.parse(alert));
99
+ }
100
+
101
+ export function alertFromJSON(
102
+ jsonString: string,
103
+ ): SafeParseResult<Alert, SDKValidationError> {
104
+ return safeParse(
105
+ jsonString,
106
+ (x) => Alert$inboundSchema.parse(JSON.parse(x)),
107
+ `Failed to parse 'Alert' from JSON`,
108
+ );
109
+ }
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  export * from "./activestatus.js";
6
+ export * from "./alert.js";
6
7
  export * from "./backgroundcheckresult.js";
7
8
  export * from "./company.js";
8
9
  export * from "./companyvendortyperestriction.js";
@@ -39,6 +39,7 @@ export * from "./getvendorinvoicereceipt.js";
39
39
  export * from "./getvendorlegalname.js";
40
40
  export * from "./getvendorsdetails.js";
41
41
  export * from "./getwebhookendpoint.js";
42
+ export * from "./listalerts.js";
42
43
  export * from "./listallwebhookendpoints.js";
43
44
  export * from "./listfeed.js";
44
45
  export * from "./listlocations.js";
@@ -82,6 +83,7 @@ export * from "./updateevent.js";
82
83
  export * from "./updatefhirconfigbyid.js";
83
84
  export * from "./updateinvoice.js";
84
85
  export * from "./updatesthewebhookendpointwiththegivenid.js";
86
+ export * from "./updateuseralerts.js";
85
87
  export * from "./updatevendorcredentialdata.js";
86
88
  export * from "./updatevendorcredentialfile.js";
87
89
  export * from "./updatevendordetails.js";
@@ -0,0 +1,234 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as components from "../components/index.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export type ListAlertsRequest = {
13
+ /**
14
+ * A comma-separated list of object attributes to sort on.
15
+ */
16
+ sort?: string | null | undefined;
17
+ /**
18
+ * Sort desc
19
+ */
20
+ desc?: components.Desc | undefined;
21
+ /**
22
+ * A 1-based offset for which page to request (defaults to 1)
23
+ */
24
+ page?: number | undefined;
25
+ /**
26
+ * Number of items to show in a given page
27
+ */
28
+ itemsPerPage?: number | undefined;
29
+ };
30
+
31
+ /**
32
+ * The request was successful, and the server has returned the requested resource in the response body.
33
+ */
34
+ export type ListAlertsResponseBody = {
35
+ /**
36
+ * Pagination information for a pageable list
37
+ */
38
+ pager: components.Pager;
39
+ items: Array<components.Alert>;
40
+ };
41
+
42
+ export type ListAlertsResponse = {
43
+ result: ListAlertsResponseBody;
44
+ };
45
+
46
+ /** @internal */
47
+ export const ListAlertsRequest$inboundSchema: z.ZodType<
48
+ ListAlertsRequest,
49
+ z.ZodTypeDef,
50
+ unknown
51
+ > = z.object({
52
+ sort: z.nullable(z.string()).optional(),
53
+ desc: components.Desc$inboundSchema.optional(),
54
+ page: z.number().int().optional(),
55
+ items_per_page: z.number().int().optional(),
56
+ }).transform((v) => {
57
+ return remap$(v, {
58
+ "items_per_page": "itemsPerPage",
59
+ });
60
+ });
61
+
62
+ /** @internal */
63
+ export type ListAlertsRequest$Outbound = {
64
+ sort?: string | null | undefined;
65
+ desc?: components.Desc$Outbound | undefined;
66
+ page?: number | undefined;
67
+ items_per_page?: number | undefined;
68
+ };
69
+
70
+ /** @internal */
71
+ export const ListAlertsRequest$outboundSchema: z.ZodType<
72
+ ListAlertsRequest$Outbound,
73
+ z.ZodTypeDef,
74
+ ListAlertsRequest
75
+ > = z.object({
76
+ sort: z.nullable(z.string()).optional(),
77
+ desc: components.Desc$outboundSchema.optional(),
78
+ page: z.number().int().optional(),
79
+ itemsPerPage: z.number().int().optional(),
80
+ }).transform((v) => {
81
+ return remap$(v, {
82
+ itemsPerPage: "items_per_page",
83
+ });
84
+ });
85
+
86
+ /**
87
+ * @internal
88
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
89
+ */
90
+ export namespace ListAlertsRequest$ {
91
+ /** @deprecated use `ListAlertsRequest$inboundSchema` instead. */
92
+ export const inboundSchema = ListAlertsRequest$inboundSchema;
93
+ /** @deprecated use `ListAlertsRequest$outboundSchema` instead. */
94
+ export const outboundSchema = ListAlertsRequest$outboundSchema;
95
+ /** @deprecated use `ListAlertsRequest$Outbound` instead. */
96
+ export type Outbound = ListAlertsRequest$Outbound;
97
+ }
98
+
99
+ export function listAlertsRequestToJSON(
100
+ listAlertsRequest: ListAlertsRequest,
101
+ ): string {
102
+ return JSON.stringify(
103
+ ListAlertsRequest$outboundSchema.parse(listAlertsRequest),
104
+ );
105
+ }
106
+
107
+ export function listAlertsRequestFromJSON(
108
+ jsonString: string,
109
+ ): SafeParseResult<ListAlertsRequest, SDKValidationError> {
110
+ return safeParse(
111
+ jsonString,
112
+ (x) => ListAlertsRequest$inboundSchema.parse(JSON.parse(x)),
113
+ `Failed to parse 'ListAlertsRequest' from JSON`,
114
+ );
115
+ }
116
+
117
+ /** @internal */
118
+ export const ListAlertsResponseBody$inboundSchema: z.ZodType<
119
+ ListAlertsResponseBody,
120
+ z.ZodTypeDef,
121
+ unknown
122
+ > = z.object({
123
+ pager: components.Pager$inboundSchema,
124
+ items: z.array(components.Alert$inboundSchema),
125
+ });
126
+
127
+ /** @internal */
128
+ export type ListAlertsResponseBody$Outbound = {
129
+ pager: components.Pager$Outbound;
130
+ items: Array<components.Alert$Outbound>;
131
+ };
132
+
133
+ /** @internal */
134
+ export const ListAlertsResponseBody$outboundSchema: z.ZodType<
135
+ ListAlertsResponseBody$Outbound,
136
+ z.ZodTypeDef,
137
+ ListAlertsResponseBody
138
+ > = z.object({
139
+ pager: components.Pager$outboundSchema,
140
+ items: z.array(components.Alert$outboundSchema),
141
+ });
142
+
143
+ /**
144
+ * @internal
145
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
146
+ */
147
+ export namespace ListAlertsResponseBody$ {
148
+ /** @deprecated use `ListAlertsResponseBody$inboundSchema` instead. */
149
+ export const inboundSchema = ListAlertsResponseBody$inboundSchema;
150
+ /** @deprecated use `ListAlertsResponseBody$outboundSchema` instead. */
151
+ export const outboundSchema = ListAlertsResponseBody$outboundSchema;
152
+ /** @deprecated use `ListAlertsResponseBody$Outbound` instead. */
153
+ export type Outbound = ListAlertsResponseBody$Outbound;
154
+ }
155
+
156
+ export function listAlertsResponseBodyToJSON(
157
+ listAlertsResponseBody: ListAlertsResponseBody,
158
+ ): string {
159
+ return JSON.stringify(
160
+ ListAlertsResponseBody$outboundSchema.parse(listAlertsResponseBody),
161
+ );
162
+ }
163
+
164
+ export function listAlertsResponseBodyFromJSON(
165
+ jsonString: string,
166
+ ): SafeParseResult<ListAlertsResponseBody, SDKValidationError> {
167
+ return safeParse(
168
+ jsonString,
169
+ (x) => ListAlertsResponseBody$inboundSchema.parse(JSON.parse(x)),
170
+ `Failed to parse 'ListAlertsResponseBody' from JSON`,
171
+ );
172
+ }
173
+
174
+ /** @internal */
175
+ export const ListAlertsResponse$inboundSchema: z.ZodType<
176
+ ListAlertsResponse,
177
+ z.ZodTypeDef,
178
+ unknown
179
+ > = z.object({
180
+ Result: z.lazy(() => ListAlertsResponseBody$inboundSchema),
181
+ }).transform((v) => {
182
+ return remap$(v, {
183
+ "Result": "result",
184
+ });
185
+ });
186
+
187
+ /** @internal */
188
+ export type ListAlertsResponse$Outbound = {
189
+ Result: ListAlertsResponseBody$Outbound;
190
+ };
191
+
192
+ /** @internal */
193
+ export const ListAlertsResponse$outboundSchema: z.ZodType<
194
+ ListAlertsResponse$Outbound,
195
+ z.ZodTypeDef,
196
+ ListAlertsResponse
197
+ > = z.object({
198
+ result: z.lazy(() => ListAlertsResponseBody$outboundSchema),
199
+ }).transform((v) => {
200
+ return remap$(v, {
201
+ result: "Result",
202
+ });
203
+ });
204
+
205
+ /**
206
+ * @internal
207
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
208
+ */
209
+ export namespace ListAlertsResponse$ {
210
+ /** @deprecated use `ListAlertsResponse$inboundSchema` instead. */
211
+ export const inboundSchema = ListAlertsResponse$inboundSchema;
212
+ /** @deprecated use `ListAlertsResponse$outboundSchema` instead. */
213
+ export const outboundSchema = ListAlertsResponse$outboundSchema;
214
+ /** @deprecated use `ListAlertsResponse$Outbound` instead. */
215
+ export type Outbound = ListAlertsResponse$Outbound;
216
+ }
217
+
218
+ export function listAlertsResponseToJSON(
219
+ listAlertsResponse: ListAlertsResponse,
220
+ ): string {
221
+ return JSON.stringify(
222
+ ListAlertsResponse$outboundSchema.parse(listAlertsResponse),
223
+ );
224
+ }
225
+
226
+ export function listAlertsResponseFromJSON(
227
+ jsonString: string,
228
+ ): SafeParseResult<ListAlertsResponse, SDKValidationError> {
229
+ return safeParse(
230
+ jsonString,
231
+ (x) => ListAlertsResponse$inboundSchema.parse(JSON.parse(x)),
232
+ `Failed to parse 'ListAlertsResponse' from JSON`,
233
+ );
234
+ }
@@ -0,0 +1,140 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type UpdateUserAlertsRequestBody = {
12
+ alertIds?: Array<number> | undefined;
13
+ };
14
+
15
+ /**
16
+ * The request was successful, and the server has returned the requested resource in the response body.
17
+ */
18
+ export type UpdateUserAlertsResponseBody = {
19
+ success?: boolean | undefined;
20
+ };
21
+
22
+ /** @internal */
23
+ export const UpdateUserAlertsRequestBody$inboundSchema: z.ZodType<
24
+ UpdateUserAlertsRequestBody,
25
+ z.ZodTypeDef,
26
+ unknown
27
+ > = z.object({
28
+ alert_ids: z.array(z.number().int()).optional(),
29
+ }).transform((v) => {
30
+ return remap$(v, {
31
+ "alert_ids": "alertIds",
32
+ });
33
+ });
34
+
35
+ /** @internal */
36
+ export type UpdateUserAlertsRequestBody$Outbound = {
37
+ alert_ids?: Array<number> | undefined;
38
+ };
39
+
40
+ /** @internal */
41
+ export const UpdateUserAlertsRequestBody$outboundSchema: z.ZodType<
42
+ UpdateUserAlertsRequestBody$Outbound,
43
+ z.ZodTypeDef,
44
+ UpdateUserAlertsRequestBody
45
+ > = z.object({
46
+ alertIds: z.array(z.number().int()).optional(),
47
+ }).transform((v) => {
48
+ return remap$(v, {
49
+ alertIds: "alert_ids",
50
+ });
51
+ });
52
+
53
+ /**
54
+ * @internal
55
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
56
+ */
57
+ export namespace UpdateUserAlertsRequestBody$ {
58
+ /** @deprecated use `UpdateUserAlertsRequestBody$inboundSchema` instead. */
59
+ export const inboundSchema = UpdateUserAlertsRequestBody$inboundSchema;
60
+ /** @deprecated use `UpdateUserAlertsRequestBody$outboundSchema` instead. */
61
+ export const outboundSchema = UpdateUserAlertsRequestBody$outboundSchema;
62
+ /** @deprecated use `UpdateUserAlertsRequestBody$Outbound` instead. */
63
+ export type Outbound = UpdateUserAlertsRequestBody$Outbound;
64
+ }
65
+
66
+ export function updateUserAlertsRequestBodyToJSON(
67
+ updateUserAlertsRequestBody: UpdateUserAlertsRequestBody,
68
+ ): string {
69
+ return JSON.stringify(
70
+ UpdateUserAlertsRequestBody$outboundSchema.parse(
71
+ updateUserAlertsRequestBody,
72
+ ),
73
+ );
74
+ }
75
+
76
+ export function updateUserAlertsRequestBodyFromJSON(
77
+ jsonString: string,
78
+ ): SafeParseResult<UpdateUserAlertsRequestBody, SDKValidationError> {
79
+ return safeParse(
80
+ jsonString,
81
+ (x) => UpdateUserAlertsRequestBody$inboundSchema.parse(JSON.parse(x)),
82
+ `Failed to parse 'UpdateUserAlertsRequestBody' from JSON`,
83
+ );
84
+ }
85
+
86
+ /** @internal */
87
+ export const UpdateUserAlertsResponseBody$inboundSchema: z.ZodType<
88
+ UpdateUserAlertsResponseBody,
89
+ z.ZodTypeDef,
90
+ unknown
91
+ > = z.object({
92
+ success: z.boolean().optional(),
93
+ });
94
+
95
+ /** @internal */
96
+ export type UpdateUserAlertsResponseBody$Outbound = {
97
+ success?: boolean | undefined;
98
+ };
99
+
100
+ /** @internal */
101
+ export const UpdateUserAlertsResponseBody$outboundSchema: z.ZodType<
102
+ UpdateUserAlertsResponseBody$Outbound,
103
+ z.ZodTypeDef,
104
+ UpdateUserAlertsResponseBody
105
+ > = z.object({
106
+ success: z.boolean().optional(),
107
+ });
108
+
109
+ /**
110
+ * @internal
111
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
112
+ */
113
+ export namespace UpdateUserAlertsResponseBody$ {
114
+ /** @deprecated use `UpdateUserAlertsResponseBody$inboundSchema` instead. */
115
+ export const inboundSchema = UpdateUserAlertsResponseBody$inboundSchema;
116
+ /** @deprecated use `UpdateUserAlertsResponseBody$outboundSchema` instead. */
117
+ export const outboundSchema = UpdateUserAlertsResponseBody$outboundSchema;
118
+ /** @deprecated use `UpdateUserAlertsResponseBody$Outbound` instead. */
119
+ export type Outbound = UpdateUserAlertsResponseBody$Outbound;
120
+ }
121
+
122
+ export function updateUserAlertsResponseBodyToJSON(
123
+ updateUserAlertsResponseBody: UpdateUserAlertsResponseBody,
124
+ ): string {
125
+ return JSON.stringify(
126
+ UpdateUserAlertsResponseBody$outboundSchema.parse(
127
+ updateUserAlertsResponseBody,
128
+ ),
129
+ );
130
+ }
131
+
132
+ export function updateUserAlertsResponseBodyFromJSON(
133
+ jsonString: string,
134
+ ): SafeParseResult<UpdateUserAlertsResponseBody, SDKValidationError> {
135
+ return safeParse(
136
+ jsonString,
137
+ (x) => UpdateUserAlertsResponseBody$inboundSchema.parse(JSON.parse(x)),
138
+ `Failed to parse 'UpdateUserAlertsResponseBody' from JSON`,
139
+ );
140
+ }