@greensecurity/javascript-sdk 0.40.8-beta.2 → 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.
- package/README.md +9 -0
- package/dist/commonjs/__tests__/alerts.test.d.ts +2 -0
- package/dist/commonjs/__tests__/alerts.test.d.ts.map +1 -0
- package/dist/commonjs/__tests__/alerts.test.js +51 -0
- package/dist/commonjs/__tests__/alerts.test.js.map +1 -0
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +12 -22
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/alertsListAlerts.d.ts +21 -0
- package/dist/commonjs/funcs/alertsListAlerts.d.ts.map +1 -0
- package/dist/commonjs/funcs/alertsListAlerts.js +154 -0
- package/dist/commonjs/funcs/alertsListAlerts.js.map +1 -0
- package/dist/commonjs/funcs/alertsUpdateUserAlerts.d.ts +18 -0
- package/dist/commonjs/funcs/alertsUpdateUserAlerts.d.ts.map +1 -0
- package/dist/commonjs/funcs/alertsUpdateUserAlerts.js +117 -0
- package/dist/commonjs/funcs/alertsUpdateUserAlerts.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/alert.d.ts +48 -0
- package/dist/commonjs/models/components/alert.d.ts.map +1 -0
- package/dist/commonjs/models/components/alert.js +101 -0
- package/dist/commonjs/models/components/alert.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listalerts.d.ts +106 -0
- package/dist/commonjs/models/operations/listalerts.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listalerts.js +149 -0
- package/dist/commonjs/models/operations/listalerts.js.map +1 -0
- package/dist/commonjs/models/operations/updateuseralerts.d.ts +57 -0
- package/dist/commonjs/models/operations/updateuseralerts.d.ts.map +1 -0
- package/dist/commonjs/models/operations/updateuseralerts.js +105 -0
- package/dist/commonjs/models/operations/updateuseralerts.js.map +1 -0
- package/dist/commonjs/react-query/alertsListAlerts.d.ts +75 -0
- package/dist/commonjs/react-query/alertsListAlerts.d.ts.map +1 -0
- package/dist/commonjs/react-query/alertsListAlerts.js +150 -0
- package/dist/commonjs/react-query/alertsListAlerts.js.map +1 -0
- package/dist/commonjs/react-query/alertsUpdateUserAlerts.d.ts +23 -0
- package/dist/commonjs/react-query/alertsUpdateUserAlerts.d.ts.map +1 -0
- package/dist/commonjs/react-query/alertsUpdateUserAlerts.js +47 -0
- package/dist/commonjs/react-query/alertsUpdateUserAlerts.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/sdk/alerts.d.ts +22 -0
- package/dist/commonjs/sdk/alerts.d.ts.map +1 -0
- package/dist/commonjs/sdk/alerts.js +33 -0
- package/dist/commonjs/sdk/alerts.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/__tests__/alerts.test.d.ts +2 -0
- package/dist/esm/__tests__/alerts.test.d.ts.map +1 -0
- package/dist/esm/__tests__/alerts.test.js +49 -0
- package/dist/esm/__tests__/alerts.test.js.map +1 -0
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/__tests__/webhooks.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +12 -22
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/alertsListAlerts.d.ts +21 -0
- package/dist/esm/funcs/alertsListAlerts.d.ts.map +1 -0
- package/dist/esm/funcs/alertsListAlerts.js +118 -0
- package/dist/esm/funcs/alertsListAlerts.js.map +1 -0
- package/dist/esm/funcs/alertsUpdateUserAlerts.d.ts +18 -0
- package/dist/esm/funcs/alertsUpdateUserAlerts.d.ts.map +1 -0
- package/dist/esm/funcs/alertsUpdateUserAlerts.js +81 -0
- package/dist/esm/funcs/alertsUpdateUserAlerts.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/alert.d.ts +48 -0
- package/dist/esm/models/components/alert.d.ts.map +1 -0
- package/dist/esm/models/components/alert.js +63 -0
- package/dist/esm/models/components/alert.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listalerts.d.ts +106 -0
- package/dist/esm/models/operations/listalerts.d.ts.map +1 -0
- package/dist/esm/models/operations/listalerts.js +107 -0
- package/dist/esm/models/operations/listalerts.js.map +1 -0
- package/dist/esm/models/operations/updateuseralerts.d.ts +57 -0
- package/dist/esm/models/operations/updateuseralerts.d.ts.map +1 -0
- package/dist/esm/models/operations/updateuseralerts.js +65 -0
- package/dist/esm/models/operations/updateuseralerts.js.map +1 -0
- package/dist/esm/react-query/alertsListAlerts.d.ts +75 -0
- package/dist/esm/react-query/alertsListAlerts.d.ts.map +1 -0
- package/dist/esm/react-query/alertsListAlerts.js +137 -0
- package/dist/esm/react-query/alertsListAlerts.js.map +1 -0
- package/dist/esm/react-query/alertsUpdateUserAlerts.d.ts +23 -0
- package/dist/esm/react-query/alertsUpdateUserAlerts.d.ts.map +1 -0
- package/dist/esm/react-query/alertsUpdateUserAlerts.js +42 -0
- package/dist/esm/react-query/alertsUpdateUserAlerts.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/sdk/alerts.d.ts +22 -0
- package/dist/esm/sdk/alerts.d.ts.map +1 -0
- package/dist/esm/sdk/alerts.js +29 -0
- package/dist/esm/sdk/alerts.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/alerts.test.ts +55 -0
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +12 -22
- package/src/funcs/alertsListAlerts.ts +245 -0
- package/src/funcs/alertsUpdateUserAlerts.ts +170 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/alert.ts +109 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/listalerts.ts +234 -0
- package/src/models/operations/updateuseralerts.ts +140 -0
- package/src/react-query/alertsListAlerts.ts +308 -0
- package/src/react-query/alertsUpdateUserAlerts.ts +89 -0
- package/src/react-query/index.ts +2 -0
- package/src/sdk/alerts.ts +46 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
InfiniteData,
|
|
7
|
+
InvalidateQueryFilters,
|
|
8
|
+
QueryClient,
|
|
9
|
+
QueryFunctionContext,
|
|
10
|
+
QueryKey,
|
|
11
|
+
useInfiniteQuery,
|
|
12
|
+
UseInfiniteQueryResult,
|
|
13
|
+
useQuery,
|
|
14
|
+
UseQueryResult,
|
|
15
|
+
useSuspenseInfiniteQuery,
|
|
16
|
+
UseSuspenseInfiniteQueryResult,
|
|
17
|
+
useSuspenseQuery,
|
|
18
|
+
UseSuspenseQueryResult,
|
|
19
|
+
} from "@tanstack/react-query";
|
|
20
|
+
import { GreenSecurityCore } from "../core.js";
|
|
21
|
+
import { alertsListAlerts } from "../funcs/alertsListAlerts.js";
|
|
22
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
23
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
24
|
+
import * as components from "../models/components/index.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
27
|
+
import { PageIterator, unwrapResultIterator } from "../types/operations.js";
|
|
28
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
29
|
+
import {
|
|
30
|
+
InfiniteQueryHookOptions,
|
|
31
|
+
QueryHookOptions,
|
|
32
|
+
SuspenseInfiniteQueryHookOptions,
|
|
33
|
+
SuspenseQueryHookOptions,
|
|
34
|
+
TupleToPrefixes,
|
|
35
|
+
} from "./_types.js";
|
|
36
|
+
|
|
37
|
+
export type AlertsListAlertsQueryData = operations.ListAlertsResponse;
|
|
38
|
+
|
|
39
|
+
export type AlertsListAlertsInfiniteQueryData = PageIterator<
|
|
40
|
+
operations.ListAlertsResponse,
|
|
41
|
+
{ page: number }
|
|
42
|
+
>;
|
|
43
|
+
|
|
44
|
+
export type AlertsListAlertsPageParams = PageIterator<
|
|
45
|
+
operations.ListAlertsResponse,
|
|
46
|
+
{ page: number }
|
|
47
|
+
>["~next"];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* List alerts
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* List alerts for user.
|
|
54
|
+
*/
|
|
55
|
+
export function useAlertsListAlerts(
|
|
56
|
+
request: operations.ListAlertsRequest,
|
|
57
|
+
options?: QueryHookOptions<AlertsListAlertsQueryData>,
|
|
58
|
+
): UseQueryResult<AlertsListAlertsQueryData, Error> {
|
|
59
|
+
const client = useGreenSecurityContext();
|
|
60
|
+
return useQuery({
|
|
61
|
+
...buildAlertsListAlertsQuery(
|
|
62
|
+
client,
|
|
63
|
+
request,
|
|
64
|
+
options,
|
|
65
|
+
),
|
|
66
|
+
...options,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* List alerts
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* List alerts for user.
|
|
75
|
+
*/
|
|
76
|
+
export function useAlertsListAlertsSuspense(
|
|
77
|
+
request: operations.ListAlertsRequest,
|
|
78
|
+
options?: SuspenseQueryHookOptions<AlertsListAlertsQueryData>,
|
|
79
|
+
): UseSuspenseQueryResult<AlertsListAlertsQueryData, Error> {
|
|
80
|
+
const client = useGreenSecurityContext();
|
|
81
|
+
return useSuspenseQuery({
|
|
82
|
+
...buildAlertsListAlertsQuery(
|
|
83
|
+
client,
|
|
84
|
+
request,
|
|
85
|
+
options,
|
|
86
|
+
),
|
|
87
|
+
...options,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* List alerts
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* List alerts for user.
|
|
96
|
+
*/
|
|
97
|
+
export function useAlertsListAlertsInfinite(
|
|
98
|
+
request: operations.ListAlertsRequest,
|
|
99
|
+
options?: InfiniteQueryHookOptions<AlertsListAlertsInfiniteQueryData>,
|
|
100
|
+
): UseInfiniteQueryResult<
|
|
101
|
+
InfiniteData<AlertsListAlertsInfiniteQueryData, AlertsListAlertsPageParams>,
|
|
102
|
+
Error
|
|
103
|
+
> {
|
|
104
|
+
const client = useGreenSecurityContext();
|
|
105
|
+
return useInfiniteQuery<
|
|
106
|
+
AlertsListAlertsInfiniteQueryData,
|
|
107
|
+
Error,
|
|
108
|
+
InfiniteData<AlertsListAlertsInfiniteQueryData, AlertsListAlertsPageParams>,
|
|
109
|
+
QueryKey,
|
|
110
|
+
AlertsListAlertsPageParams
|
|
111
|
+
>({
|
|
112
|
+
...buildAlertsListAlertsInfiniteQuery(
|
|
113
|
+
client,
|
|
114
|
+
request,
|
|
115
|
+
options,
|
|
116
|
+
),
|
|
117
|
+
initialPageParam: options?.initialPageParam,
|
|
118
|
+
getNextPageParam: (previousPage) => previousPage["~next"],
|
|
119
|
+
...options,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* List alerts
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* List alerts for user.
|
|
128
|
+
*/
|
|
129
|
+
export function useAlertsListAlertsInfiniteSuspense(
|
|
130
|
+
request: operations.ListAlertsRequest,
|
|
131
|
+
options?: SuspenseInfiniteQueryHookOptions<AlertsListAlertsInfiniteQueryData>,
|
|
132
|
+
): UseSuspenseInfiniteQueryResult<
|
|
133
|
+
InfiniteData<AlertsListAlertsInfiniteQueryData, AlertsListAlertsPageParams>,
|
|
134
|
+
Error
|
|
135
|
+
> {
|
|
136
|
+
const client = useGreenSecurityContext();
|
|
137
|
+
return useSuspenseInfiniteQuery<
|
|
138
|
+
AlertsListAlertsInfiniteQueryData,
|
|
139
|
+
Error,
|
|
140
|
+
InfiniteData<AlertsListAlertsInfiniteQueryData, AlertsListAlertsPageParams>,
|
|
141
|
+
QueryKey,
|
|
142
|
+
AlertsListAlertsPageParams
|
|
143
|
+
>({
|
|
144
|
+
...buildAlertsListAlertsInfiniteQuery(
|
|
145
|
+
client,
|
|
146
|
+
request,
|
|
147
|
+
options,
|
|
148
|
+
),
|
|
149
|
+
initialPageParam: options?.initialPageParam,
|
|
150
|
+
getNextPageParam: (previousPage) => previousPage["~next"],
|
|
151
|
+
...options,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function prefetchAlertsListAlerts(
|
|
156
|
+
queryClient: QueryClient,
|
|
157
|
+
client$: GreenSecurityCore,
|
|
158
|
+
request: operations.ListAlertsRequest,
|
|
159
|
+
): Promise<void> {
|
|
160
|
+
return queryClient.prefetchQuery({
|
|
161
|
+
...buildAlertsListAlertsQuery(
|
|
162
|
+
client$,
|
|
163
|
+
request,
|
|
164
|
+
),
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function setAlertsListAlertsData(
|
|
169
|
+
client: QueryClient,
|
|
170
|
+
queryKeyBase: [
|
|
171
|
+
parameters: {
|
|
172
|
+
sort?: string | null | undefined;
|
|
173
|
+
desc?: components.Desc | undefined;
|
|
174
|
+
page?: number | undefined;
|
|
175
|
+
itemsPerPage?: number | undefined;
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
data: AlertsListAlertsQueryData,
|
|
179
|
+
): AlertsListAlertsQueryData | undefined {
|
|
180
|
+
const key = queryKeyAlertsListAlerts(...queryKeyBase);
|
|
181
|
+
|
|
182
|
+
return client.setQueryData<AlertsListAlertsQueryData>(key, data);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function invalidateAlertsListAlerts(
|
|
186
|
+
client: QueryClient,
|
|
187
|
+
queryKeyBase: TupleToPrefixes<
|
|
188
|
+
[parameters: {
|
|
189
|
+
sort?: string | null | undefined;
|
|
190
|
+
desc?: components.Desc | undefined;
|
|
191
|
+
page?: number | undefined;
|
|
192
|
+
itemsPerPage?: number | undefined;
|
|
193
|
+
}]
|
|
194
|
+
>,
|
|
195
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
196
|
+
): Promise<void> {
|
|
197
|
+
return client.invalidateQueries({
|
|
198
|
+
...filters,
|
|
199
|
+
queryKey: [
|
|
200
|
+
"@greensecurity/javascript-sdk",
|
|
201
|
+
"alerts",
|
|
202
|
+
"listAlerts",
|
|
203
|
+
...queryKeyBase,
|
|
204
|
+
],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function invalidateAllAlertsListAlerts(
|
|
209
|
+
client: QueryClient,
|
|
210
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
211
|
+
): Promise<void> {
|
|
212
|
+
return client.invalidateQueries({
|
|
213
|
+
...filters,
|
|
214
|
+
queryKey: ["@greensecurity/javascript-sdk", "alerts", "listAlerts"],
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function buildAlertsListAlertsQuery(
|
|
219
|
+
client$: GreenSecurityCore,
|
|
220
|
+
request: operations.ListAlertsRequest,
|
|
221
|
+
options?: RequestOptions,
|
|
222
|
+
): {
|
|
223
|
+
queryKey: QueryKey;
|
|
224
|
+
queryFn: (
|
|
225
|
+
context: QueryFunctionContext,
|
|
226
|
+
) => Promise<AlertsListAlertsQueryData>;
|
|
227
|
+
} {
|
|
228
|
+
return {
|
|
229
|
+
queryKey: queryKeyAlertsListAlerts({
|
|
230
|
+
sort: request.sort,
|
|
231
|
+
desc: request.desc,
|
|
232
|
+
page: request.page,
|
|
233
|
+
itemsPerPage: request.itemsPerPage,
|
|
234
|
+
}),
|
|
235
|
+
queryFn: async function alertsListAlertsQueryFn(
|
|
236
|
+
ctx,
|
|
237
|
+
): Promise<AlertsListAlertsQueryData> {
|
|
238
|
+
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
239
|
+
const mergedOptions = {
|
|
240
|
+
...options,
|
|
241
|
+
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
return unwrapAsync(alertsListAlerts(
|
|
245
|
+
client$,
|
|
246
|
+
request,
|
|
247
|
+
mergedOptions,
|
|
248
|
+
));
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export function buildAlertsListAlertsInfiniteQuery(
|
|
254
|
+
client$: GreenSecurityCore,
|
|
255
|
+
request: operations.ListAlertsRequest,
|
|
256
|
+
options?: RequestOptions,
|
|
257
|
+
): {
|
|
258
|
+
queryKey: QueryKey;
|
|
259
|
+
queryFn: (
|
|
260
|
+
context: QueryFunctionContext<QueryKey, AlertsListAlertsPageParams>,
|
|
261
|
+
) => Promise<AlertsListAlertsInfiniteQueryData>;
|
|
262
|
+
} {
|
|
263
|
+
return {
|
|
264
|
+
queryKey: queryKeyAlertsListAlerts({
|
|
265
|
+
sort: request.sort,
|
|
266
|
+
desc: request.desc,
|
|
267
|
+
page: request.page,
|
|
268
|
+
itemsPerPage: request.itemsPerPage,
|
|
269
|
+
}),
|
|
270
|
+
queryFn: async function alertsListAlertsQuery(
|
|
271
|
+
ctx,
|
|
272
|
+
): Promise<AlertsListAlertsInfiniteQueryData> {
|
|
273
|
+
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
274
|
+
const mergedOptions = {
|
|
275
|
+
...options,
|
|
276
|
+
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
if (!ctx.pageParam) {
|
|
280
|
+
return unwrapResultIterator(alertsListAlerts(
|
|
281
|
+
client$,
|
|
282
|
+
request,
|
|
283
|
+
mergedOptions,
|
|
284
|
+
));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return unwrapResultIterator(alertsListAlerts(
|
|
288
|
+
client$,
|
|
289
|
+
{
|
|
290
|
+
...request,
|
|
291
|
+
page: ctx.pageParam.page,
|
|
292
|
+
},
|
|
293
|
+
mergedOptions,
|
|
294
|
+
));
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function queryKeyAlertsListAlerts(
|
|
300
|
+
parameters: {
|
|
301
|
+
sort?: string | null | undefined;
|
|
302
|
+
desc?: components.Desc | undefined;
|
|
303
|
+
page?: number | undefined;
|
|
304
|
+
itemsPerPage?: number | undefined;
|
|
305
|
+
},
|
|
306
|
+
): QueryKey {
|
|
307
|
+
return ["@greensecurity/javascript-sdk", "alerts", "listAlerts", parameters];
|
|
308
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
MutationKey,
|
|
7
|
+
useMutation,
|
|
8
|
+
UseMutationResult,
|
|
9
|
+
} from "@tanstack/react-query";
|
|
10
|
+
import { GreenSecurityCore } from "../core.js";
|
|
11
|
+
import { alertsUpdateUserAlerts } from "../funcs/alertsUpdateUserAlerts.js";
|
|
12
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
13
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
16
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
17
|
+
import { MutationHookOptions } from "./_types.js";
|
|
18
|
+
|
|
19
|
+
export type AlertsUpdateUserAlertsMutationVariables = {
|
|
20
|
+
request: operations.UpdateUserAlertsRequestBody;
|
|
21
|
+
options?: RequestOptions;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type AlertsUpdateUserAlertsMutationData =
|
|
25
|
+
operations.UpdateUserAlertsResponseBody;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Update user alerts
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Update user alerts
|
|
32
|
+
*/
|
|
33
|
+
export function useAlertsUpdateUserAlertsMutation(
|
|
34
|
+
options?: MutationHookOptions<
|
|
35
|
+
AlertsUpdateUserAlertsMutationData,
|
|
36
|
+
Error,
|
|
37
|
+
AlertsUpdateUserAlertsMutationVariables
|
|
38
|
+
>,
|
|
39
|
+
): UseMutationResult<
|
|
40
|
+
AlertsUpdateUserAlertsMutationData,
|
|
41
|
+
Error,
|
|
42
|
+
AlertsUpdateUserAlertsMutationVariables
|
|
43
|
+
> {
|
|
44
|
+
const client = useGreenSecurityContext();
|
|
45
|
+
return useMutation({
|
|
46
|
+
...buildAlertsUpdateUserAlertsMutation(client, options),
|
|
47
|
+
...options,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function mutationKeyAlertsUpdateUserAlerts(): MutationKey {
|
|
52
|
+
return ["@greensecurity/javascript-sdk", "alerts", "updateUserAlerts"];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function buildAlertsUpdateUserAlertsMutation(
|
|
56
|
+
client$: GreenSecurityCore,
|
|
57
|
+
hookOptions?: RequestOptions,
|
|
58
|
+
): {
|
|
59
|
+
mutationKey: MutationKey;
|
|
60
|
+
mutationFn: (
|
|
61
|
+
variables: AlertsUpdateUserAlertsMutationVariables,
|
|
62
|
+
) => Promise<AlertsUpdateUserAlertsMutationData>;
|
|
63
|
+
} {
|
|
64
|
+
return {
|
|
65
|
+
mutationKey: mutationKeyAlertsUpdateUserAlerts(),
|
|
66
|
+
mutationFn: function alertsUpdateUserAlertsMutationFn({
|
|
67
|
+
request,
|
|
68
|
+
options,
|
|
69
|
+
}): Promise<AlertsUpdateUserAlertsMutationData> {
|
|
70
|
+
const mergedOptions = {
|
|
71
|
+
...hookOptions,
|
|
72
|
+
...options,
|
|
73
|
+
fetchOptions: {
|
|
74
|
+
...hookOptions?.fetchOptions,
|
|
75
|
+
...options?.fetchOptions,
|
|
76
|
+
signal: combineSignals(
|
|
77
|
+
hookOptions?.fetchOptions?.signal,
|
|
78
|
+
options?.fetchOptions?.signal,
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return unwrapAsync(alertsUpdateUserAlerts(
|
|
83
|
+
client$,
|
|
84
|
+
request,
|
|
85
|
+
mergedOptions,
|
|
86
|
+
));
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
package/src/react-query/index.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
export { GreenSecurityProvider, useGreenSecurityContext } from "./_context.js";
|
|
6
6
|
export * from "./_types.js";
|
|
7
7
|
|
|
8
|
+
export * from "./alertsListAlerts.js";
|
|
9
|
+
export * from "./alertsUpdateUserAlerts.js";
|
|
8
10
|
export * from "./companiesListOrSearchCompanies.js";
|
|
9
11
|
export * from "./dataRequestsAddDataRequestFile.js";
|
|
10
12
|
export * from "./dataRequestsDeleteDataRequestFile.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { alertsListAlerts } from "../funcs/alertsListAlerts.js";
|
|
6
|
+
import { alertsUpdateUserAlerts } from "../funcs/alertsUpdateUserAlerts.js";
|
|
7
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
10
|
+
import { PageIterator, unwrapResultIterator } from "../types/operations.js";
|
|
11
|
+
|
|
12
|
+
export class Alerts extends ClientSDK {
|
|
13
|
+
/**
|
|
14
|
+
* List alerts
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* List alerts for user.
|
|
18
|
+
*/
|
|
19
|
+
async listAlerts(
|
|
20
|
+
request: operations.ListAlertsRequest,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): Promise<PageIterator<operations.ListAlertsResponse, { page: number }>> {
|
|
23
|
+
return unwrapResultIterator(alertsListAlerts(
|
|
24
|
+
this,
|
|
25
|
+
request,
|
|
26
|
+
options,
|
|
27
|
+
));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Update user alerts
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Update user alerts
|
|
35
|
+
*/
|
|
36
|
+
async updateUserAlerts(
|
|
37
|
+
request: operations.UpdateUserAlertsRequestBody,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): Promise<operations.UpdateUserAlertsResponseBody> {
|
|
40
|
+
return unwrapAsync(alertsUpdateUserAlerts(
|
|
41
|
+
this,
|
|
42
|
+
request,
|
|
43
|
+
options,
|
|
44
|
+
));
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
|
+
import { Alerts } from "./alerts.js";
|
|
6
7
|
import { Companies } from "./companies.js";
|
|
7
8
|
import { DataRequests } from "./datarequests.js";
|
|
8
9
|
import { Events } from "./events.js";
|
|
@@ -79,6 +80,11 @@ export class GreenSecurity extends ClientSDK {
|
|
|
79
80
|
return (this._systems ??= new Systems(this._options));
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
private _alerts?: Alerts;
|
|
84
|
+
get alerts(): Alerts {
|
|
85
|
+
return (this._alerts ??= new Alerts(this._options));
|
|
86
|
+
}
|
|
87
|
+
|
|
82
88
|
private _mobileDevices?: MobileDevices;
|
|
83
89
|
get mobileDevices(): MobileDevices {
|
|
84
90
|
return (this._mobileDevices ??= new MobileDevices(this._options));
|