@squonk/account-server-client 2.1.0-rc.1 → 2.1.0-rc.10

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 (78) hide show
  1. package/README.md +1 -1
  2. package/admin/admin.cjs +30 -8
  3. package/admin/admin.cjs.map +1 -1
  4. package/admin/admin.d.cts +50 -0
  5. package/admin/admin.d.ts +26 -6
  6. package/admin/admin.js +30 -8
  7. package/admin/admin.js.map +1 -1
  8. package/asset/asset.cjs +62 -22
  9. package/asset/asset.cjs.map +1 -1
  10. package/asset/asset.d.cts +260 -0
  11. package/asset/asset.d.ts +79 -36
  12. package/asset/asset.js +54 -14
  13. package/asset/asset.js.map +1 -1
  14. package/{chunk-3RNIDX7T.js → chunk-EBOQPVLG.js} +2 -2
  15. package/{chunk-3RNIDX7T.js.map → chunk-EBOQPVLG.js.map} +1 -1
  16. package/{chunk-UZTHSGDT.cjs → chunk-TKLTUR4R.cjs} +2 -2
  17. package/chunk-TKLTUR4R.cjs.map +1 -0
  18. package/event-stream/event-stream.cjs +64 -19
  19. package/event-stream/event-stream.cjs.map +1 -1
  20. package/event-stream/event-stream.d.cts +142 -0
  21. package/event-stream/event-stream.d.ts +66 -20
  22. package/event-stream/event-stream.js +61 -16
  23. package/event-stream/event-stream.js.map +1 -1
  24. package/index.cjs +10 -10
  25. package/index.cjs.map +1 -1
  26. package/{custom-instance-35e5d4fd.d.ts → index.d.cts} +163 -163
  27. package/index.d.ts +700 -2
  28. package/index.js +9 -9
  29. package/index.js.map +1 -1
  30. package/merchant/merchant.cjs +53 -14
  31. package/merchant/merchant.cjs.map +1 -1
  32. package/merchant/merchant.d.cts +91 -0
  33. package/merchant/merchant.d.ts +48 -8
  34. package/merchant/merchant.js +52 -13
  35. package/merchant/merchant.js.map +1 -1
  36. package/organisation/organisation.cjs +110 -28
  37. package/organisation/organisation.cjs.map +1 -1
  38. package/organisation/organisation.d.cts +271 -0
  39. package/organisation/organisation.d.ts +114 -25
  40. package/organisation/organisation.js +103 -21
  41. package/organisation/organisation.js.map +1 -1
  42. package/package.json +12 -12
  43. package/product/product.cjs +182 -47
  44. package/product/product.cjs.map +1 -1
  45. package/product/product.d.cts +399 -0
  46. package/product/product.d.ts +180 -31
  47. package/product/product.js +172 -37
  48. package/product/product.js.map +1 -1
  49. package/src/account-server-api.schemas.ts +272 -280
  50. package/src/admin/admin.ts +114 -84
  51. package/src/asset/asset.ts +480 -565
  52. package/src/custom-instance.ts +3 -4
  53. package/src/event-stream/event-stream.ts +300 -275
  54. package/src/merchant/merchant.ts +206 -142
  55. package/src/organisation/organisation.ts +549 -490
  56. package/src/product/product.ts +829 -688
  57. package/src/state/state.ts +112 -75
  58. package/src/unit/unit.ts +645 -599
  59. package/src/user/user.ts +489 -469
  60. package/state/state.cjs +29 -8
  61. package/state/state.cjs.map +1 -1
  62. package/state/state.d.cts +46 -0
  63. package/state/state.d.ts +26 -6
  64. package/state/state.js +29 -8
  65. package/state/state.js.map +1 -1
  66. package/unit/unit.cjs +120 -32
  67. package/unit/unit.cjs.map +1 -1
  68. package/unit/unit.d.cts +322 -0
  69. package/unit/unit.d.ts +133 -38
  70. package/unit/unit.js +112 -24
  71. package/unit/unit.js.map +1 -1
  72. package/user/user.cjs +96 -22
  73. package/user/user.cjs.map +1 -1
  74. package/user/user.d.cts +271 -0
  75. package/user/user.d.ts +96 -24
  76. package/user/user.js +90 -16
  77. package/user/user.js.map +1 -1
  78. package/chunk-UZTHSGDT.cjs.map +0 -1
@@ -39,10 +39,9 @@ export const customInstance = <TReturn>(
39
39
  ({ data }) => data,
40
40
  );
41
41
 
42
- // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.
43
- // This can either be a any assertion or a @ts-ignore comment.
44
- (promise as any).cancel = () => {
45
- source.cancel('Query was cancelled by React Query');
42
+ // @ts-expect-error need to add a cancel method to the promise
43
+ promise.cancel = () => {
44
+ source.cancel('Query was cancelled');
46
45
  };
47
46
 
48
47
  return promise;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.15.0 🍺
2
+ * Generated by orval v6.25.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,29 +8,31 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 2.1
10
10
  */
11
- import { useQuery, useMutation } from "@tanstack/react-query";
11
+ import {
12
+ useMutation,
13
+ useQuery,
14
+ useSuspenseQuery
15
+ } from '@tanstack/react-query'
12
16
  import type {
13
- UseQueryOptions,
14
- UseMutationOptions,
15
- QueryFunction,
16
17
  MutationFunction,
17
- UseQueryResult,
18
+ QueryFunction,
18
19
  QueryKey,
19
- } from "@tanstack/react-query";
20
+ UseMutationOptions,
21
+ UseQueryOptions,
22
+ UseQueryResult,
23
+ UseSuspenseQueryOptions,
24
+ UseSuspenseQueryResult
25
+ } from '@tanstack/react-query'
20
26
  import type {
21
- EventStreamGetPostResponse,
22
27
  AsError,
23
- } from "../account-server-api.schemas";
24
- import { customInstance } from ".././custom-instance";
25
- import type { ErrorType } from ".././custom-instance";
26
-
27
- // eslint-disable-next-line
28
- type SecondParameter<T extends (...args: any) => any> = T extends (
29
- config: any,
30
- args: infer P
31
- ) => any
32
- ? P
33
- : never;
28
+ EventStreamGetPostResponse
29
+ } from '../account-server-api.schemas'
30
+ import { customInstance } from '.././custom-instance';
31
+ import type { ErrorType } from '.././custom-instance';
32
+
33
+
34
+ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
35
+
34
36
 
35
37
  /**
36
38
  * Gets your EventStream ID and read token, if you have created one.
@@ -38,69 +40,102 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
38
40
  * @summary Gets the details of your EventStream
39
41
  */
40
42
  export const getEventStream = (
41
- options?: SecondParameter<typeof customInstance>,
42
- signal?: AbortSignal
43
+
44
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
45
+ ) => {
46
+
47
+
48
+ return customInstance<EventStreamGetPostResponse>(
49
+ {url: `/event-stream`, method: 'GET', signal
50
+ },
51
+ options);
52
+ }
53
+
54
+
55
+ export const getGetEventStreamQueryKey = () => {
56
+ return ["account-server-api", `/event-stream`] as const;
57
+ }
58
+
59
+
60
+ export const getGetEventStreamQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
61
+ ) => {
62
+
63
+ const {query: queryOptions, request: requestOptions} = options ?? {};
64
+
65
+ const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
66
+
67
+
68
+
69
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);
70
+
71
+
72
+
73
+
74
+
75
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: QueryKey }
76
+ }
77
+
78
+ export type GetEventStreamQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>
79
+ export type GetEventStreamQueryError = ErrorType<void | AsError>
80
+
81
+ /**
82
+ * @summary Gets the details of your EventStream
83
+ */
84
+ export const useGetEventStream = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
85
+ options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
86
+
87
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
88
+
89
+ const queryOptions = getGetEventStreamQueryOptions(options)
90
+
91
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
92
+
93
+ query.queryKey = queryOptions.queryKey ;
94
+
95
+ return query;
96
+ }
97
+
98
+
99
+
100
+ export const getGetEventStreamSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
43
101
  ) => {
44
- return customInstance<EventStreamGetPostResponse>(
45
- { url: `/event-stream`, method: "get", signal },
46
- options
47
- );
48
- };
49
-
50
- export const getGetEventStreamQueryKey = () => ["account-server-api", `/event-stream`] as const;
51
-
52
- export const getGetEventStreamQueryOptions = <
53
- TData = Awaited<ReturnType<typeof getEventStream>>,
54
- TError = ErrorType<void | AsError>
55
- >(options?: {
56
- query?: UseQueryOptions<
57
- Awaited<ReturnType<typeof getEventStream>>,
58
- TError,
59
- TData
60
- >;
61
- request?: SecondParameter<typeof customInstance>;
62
- }): UseQueryOptions<
63
- Awaited<ReturnType<typeof getEventStream>>,
64
- TError,
65
- TData
66
- > & { queryKey: QueryKey } => {
67
- const { query: queryOptions, request: requestOptions } = options ?? {};
68
-
69
- const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
70
-
71
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({
72
- signal,
73
- }) => getEventStream(requestOptions, signal);
74
-
75
- return { queryKey, queryFn, ...queryOptions };
76
- };
77
-
78
- export type GetEventStreamQueryResult = NonNullable<
79
- Awaited<ReturnType<typeof getEventStream>>
80
- >;
81
- export type GetEventStreamQueryError = ErrorType<void | AsError>;
82
-
83
- export const useGetEventStream = <
84
- TData = Awaited<ReturnType<typeof getEventStream>>,
85
- TError = ErrorType<void | AsError>
86
- >(options?: {
87
- query?: UseQueryOptions<
88
- Awaited<ReturnType<typeof getEventStream>>,
89
- TError,
90
- TData
91
- >;
92
- request?: SecondParameter<typeof customInstance>;
93
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
94
- const queryOptions = getGetEventStreamQueryOptions(options);
95
-
96
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
97
- queryKey: QueryKey;
98
- };
99
-
100
- query.queryKey = queryOptions.queryKey;
102
+
103
+ const {query: queryOptions, request: requestOptions} = options ?? {};
104
+
105
+ const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
106
+
107
+
108
+
109
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);
110
+
111
+
112
+
113
+
114
+
115
+ return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: QueryKey }
116
+ }
117
+
118
+ export type GetEventStreamSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>
119
+ export type GetEventStreamSuspenseQueryError = ErrorType<void | AsError>
120
+
121
+ /**
122
+ * @summary Gets the details of your EventStream
123
+ */
124
+ export const useGetEventStreamSuspense = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
125
+ options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
126
+
127
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
128
+
129
+ const queryOptions = getGetEventStreamSuspenseQueryOptions(options)
130
+
131
+ const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
132
+
133
+ query.queryKey = queryOptions.queryKey ;
101
134
 
102
135
  return query;
103
- };
136
+ }
137
+
138
+
104
139
 
105
140
  /**
106
141
  * Creates a new event stream (based on the **Server Sent Events** framework) for the authenticated user.
@@ -110,151 +145,156 @@ A user is only permitted one event stream.
110
145
  * @summary Create a new Server-Sent Events EventStream
111
146
  */
112
147
  export const createEventStream = (
113
- options?: SecondParameter<typeof customInstance>
148
+
149
+ options?: SecondParameter<typeof customInstance>,) => {
150
+
151
+
152
+ return customInstance<EventStreamGetPostResponse>(
153
+ {url: `/event-stream`, method: 'POST'
154
+ },
155
+ options);
156
+ }
157
+
158
+
159
+
160
+ export const getCreateEventStreamMutationOptions = <TError = ErrorType<AsError | void>,
161
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
162
+ ): UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext> => {
163
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
164
+
165
+
166
+
167
+
168
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof createEventStream>>, void> = () => {
169
+
170
+
171
+ return createEventStream(requestOptions)
172
+ }
173
+
174
+
175
+
176
+
177
+ return { mutationFn, ...mutationOptions }}
178
+
179
+ export type CreateEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof createEventStream>>>
180
+
181
+ export type CreateEventStreamMutationError = ErrorType<AsError | void>
182
+
183
+ /**
184
+ * @summary Create a new Server-Sent Events EventStream
185
+ */
186
+ export const useCreateEventStream = <TError = ErrorType<AsError | void>,
187
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
114
188
  ) => {
115
- return customInstance<EventStreamGetPostResponse>(
116
- { url: `/event-stream`, method: "post" },
117
- options
118
- );
119
- };
120
-
121
- export const getCreateEventStreamMutationOptions = <
122
- TError = ErrorType<AsError | void>,
123
- TVariables = void,
124
- TContext = unknown
125
- >(options?: {
126
- mutation?: UseMutationOptions<
127
- Awaited<ReturnType<typeof createEventStream>>,
128
- TError,
129
- TVariables,
130
- TContext
131
- >;
132
- request?: SecondParameter<typeof customInstance>;
133
- }): UseMutationOptions<
134
- Awaited<ReturnType<typeof createEventStream>>,
135
- TError,
136
- TVariables,
137
- TContext
138
- > => {
139
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
140
-
141
- const mutationFn: MutationFunction<
142
- Awaited<ReturnType<typeof createEventStream>>,
143
- TVariables
144
- > = () => {
145
- return createEventStream(requestOptions);
146
- };
147
-
148
- return { mutationFn, ...mutationOptions };
149
- };
150
-
151
- export type CreateEventStreamMutationResult = NonNullable<
152
- Awaited<ReturnType<typeof createEventStream>>
153
- >;
154
-
155
- export type CreateEventStreamMutationError = ErrorType<AsError | void>;
156
-
157
- export const useCreateEventStream = <
158
- TError = ErrorType<AsError | void>,
159
- TVariables = void,
160
- TContext = unknown
161
- >(options?: {
162
- mutation?: UseMutationOptions<
163
- Awaited<ReturnType<typeof createEventStream>>,
164
- TError,
165
- TVariables,
166
- TContext
167
- >;
168
- request?: SecondParameter<typeof customInstance>;
169
- }) => {
170
- const mutationOptions = getCreateEventStreamMutationOptions(options);
171
-
172
- return useMutation(mutationOptions);
173
- };
174
- /**
189
+
190
+ const mutationOptions = getCreateEventStreamMutationOptions(options);
191
+
192
+ return useMutation(mutationOptions);
193
+ }
194
+ /**
175
195
  * Gets events that you are entitled to receive. Events are delivered as **Server Sent Events** and you are expected to continuously read form this endpoint or it will be closed.
176
196
 
177
- This is an un-authenticated endpoint. In order to read from the stream the caller must provide the **read token** they were allocated when the stream was created The token must be provided in the request header property `X-IM-AS-EventStreamReadToken`.
197
+ This is an un-authenticated endpoint. In order to read from the stream the caller must provide either the User access token that belongs to the event stream or the **read token** that was allocated when the stream was created. The **read token** must be provided in the request header property `X-IM-AS-EventStreamReadToken`.
178
198
 
179
199
  * @summary Subscribe to Server-Sent Events events from an EventStream
180
200
  */
181
201
  export const getEventStreamEvents = (
182
- eventStreamId: number,
183
- options?: SecondParameter<typeof customInstance>,
184
- signal?: AbortSignal
202
+ eventStreamId: number,
203
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
185
204
  ) => {
186
- return customInstance<string>(
187
- { url: `/event-stream/${eventStreamId}`, method: "get", signal },
188
- options
189
- );
190
- };
191
-
192
- export const getGetEventStreamEventsQueryKey = (eventStreamId: number) =>
193
- ["account-server-api", `/event-stream/${eventStreamId}`] as const;
194
-
195
- export const getGetEventStreamEventsQueryOptions = <
196
- TData = Awaited<ReturnType<typeof getEventStreamEvents>>,
197
- TError = ErrorType<void | AsError>
198
- >(
199
- eventStreamId: number,
200
- options?: {
201
- query?: UseQueryOptions<
202
- Awaited<ReturnType<typeof getEventStreamEvents>>,
203
- TError,
204
- TData
205
- >;
206
- request?: SecondParameter<typeof customInstance>;
207
- }
208
- ): UseQueryOptions<
209
- Awaited<ReturnType<typeof getEventStreamEvents>>,
210
- TError,
211
- TData
212
- > & { queryKey: QueryKey } => {
213
- const { query: queryOptions, request: requestOptions } = options ?? {};
214
-
215
- const queryKey =
216
- queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);
217
-
218
- const queryFn: QueryFunction<
219
- Awaited<ReturnType<typeof getEventStreamEvents>>
220
- > = ({ signal }) =>
221
- getEventStreamEvents(eventStreamId, requestOptions, signal);
222
-
223
- return { queryKey, queryFn, enabled: !!eventStreamId, ...queryOptions };
224
- };
225
-
226
- export type GetEventStreamEventsQueryResult = NonNullable<
227
- Awaited<ReturnType<typeof getEventStreamEvents>>
228
- >;
229
- export type GetEventStreamEventsQueryError = ErrorType<void | AsError>;
230
-
231
- export const useGetEventStreamEvents = <
232
- TData = Awaited<ReturnType<typeof getEventStreamEvents>>,
233
- TError = ErrorType<void | AsError>
234
- >(
235
- eventStreamId: number,
236
- options?: {
237
- query?: UseQueryOptions<
238
- Awaited<ReturnType<typeof getEventStreamEvents>>,
239
- TError,
240
- TData
241
- >;
242
- request?: SecondParameter<typeof customInstance>;
243
- }
244
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
245
- const queryOptions = getGetEventStreamEventsQueryOptions(
246
- eventStreamId,
247
- options
248
- );
249
-
250
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
251
- queryKey: QueryKey;
252
- };
253
-
254
- query.queryKey = queryOptions.queryKey;
205
+
206
+
207
+ return customInstance<string>(
208
+ {url: `/event-stream/${eventStreamId}`, method: 'GET', signal
209
+ },
210
+ options);
211
+ }
212
+
213
+
214
+ export const getGetEventStreamEventsQueryKey = (eventStreamId: number,) => {
215
+ return ["account-server-api", `/event-stream/${eventStreamId}`] as const;
216
+ }
217
+
218
+
219
+ export const getGetEventStreamEventsQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
220
+ ) => {
221
+
222
+ const {query: queryOptions, request: requestOptions} = options ?? {};
223
+
224
+ const queryKey = queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);
225
+
226
+
227
+
228
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamEvents>>> = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
229
+
230
+
231
+
232
+
233
+
234
+ return { queryKey, queryFn, enabled: !!(eventStreamId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData> & { queryKey: QueryKey }
235
+ }
236
+
237
+ export type GetEventStreamEventsQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>
238
+ export type GetEventStreamEventsQueryError = ErrorType<void | AsError>
239
+
240
+ /**
241
+ * @summary Subscribe to Server-Sent Events events from an EventStream
242
+ */
243
+ export const useGetEventStreamEvents = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(
244
+ eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
245
+
246
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
247
+
248
+ const queryOptions = getGetEventStreamEventsQueryOptions(eventStreamId,options)
249
+
250
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
251
+
252
+ query.queryKey = queryOptions.queryKey ;
253
+
254
+ return query;
255
+ }
256
+
257
+
258
+
259
+ export const getGetEventStreamEventsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
260
+ ) => {
261
+
262
+ const {query: queryOptions, request: requestOptions} = options ?? {};
263
+
264
+ const queryKey = queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);
265
+
266
+
267
+
268
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamEvents>>> = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
269
+
270
+
271
+
272
+
273
+
274
+ return { queryKey, queryFn, enabled: !!(eventStreamId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData> & { queryKey: QueryKey }
275
+ }
276
+
277
+ export type GetEventStreamEventsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>
278
+ export type GetEventStreamEventsSuspenseQueryError = ErrorType<void | AsError>
279
+
280
+ /**
281
+ * @summary Subscribe to Server-Sent Events events from an EventStream
282
+ */
283
+ export const useGetEventStreamEventsSuspense = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(
284
+ eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
285
+
286
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
287
+
288
+ const queryOptions = getGetEventStreamEventsSuspenseQueryOptions(eventStreamId,options)
289
+
290
+ const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
291
+
292
+ query.queryKey = queryOptions.queryKey ;
255
293
 
256
294
  return query;
257
- };
295
+ }
296
+
297
+
258
298
 
259
299
  /**
260
300
  * Deletes an Event Stream.
@@ -264,65 +304,50 @@ You must be the user who created the event stream.
264
304
  * @summary Deletes an existing EventStream (that you created)
265
305
  */
266
306
  export const deleteEventStream = (
267
- eventStreamId: number,
268
- options?: SecondParameter<typeof customInstance>
307
+ eventStreamId: number,
308
+ options?: SecondParameter<typeof customInstance>,) => {
309
+
310
+
311
+ return customInstance<void>(
312
+ {url: `/event-stream/${eventStreamId}`, method: 'DELETE'
313
+ },
314
+ options);
315
+ }
316
+
317
+
318
+
319
+ export const getDeleteEventStreamMutationOptions = <TError = ErrorType<AsError>,
320
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
321
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext> => {
322
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
323
+
324
+
325
+
326
+
327
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteEventStream>>, {eventStreamId: number}> = (props) => {
328
+ const {eventStreamId} = props ?? {};
329
+
330
+ return deleteEventStream(eventStreamId,requestOptions)
331
+ }
332
+
333
+
334
+
335
+
336
+ return { mutationFn, ...mutationOptions }}
337
+
338
+ export type DeleteEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof deleteEventStream>>>
339
+
340
+ export type DeleteEventStreamMutationError = ErrorType<AsError>
341
+
342
+ /**
343
+ * @summary Deletes an existing EventStream (that you created)
344
+ */
345
+ export const useDeleteEventStream = <TError = ErrorType<AsError>,
346
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
269
347
  ) => {
270
- return customInstance<void>(
271
- { url: `/event-stream/${eventStreamId}`, method: "delete" },
272
- options
273
- );
274
- };
275
-
276
- export const getDeleteEventStreamMutationOptions = <
277
- TError = ErrorType<AsError>,
278
- TContext = unknown
279
- >(options?: {
280
- mutation?: UseMutationOptions<
281
- Awaited<ReturnType<typeof deleteEventStream>>,
282
- TError,
283
- { eventStreamId: number },
284
- TContext
285
- >;
286
- request?: SecondParameter<typeof customInstance>;
287
- }): UseMutationOptions<
288
- Awaited<ReturnType<typeof deleteEventStream>>,
289
- TError,
290
- { eventStreamId: number },
291
- TContext
292
- > => {
293
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
294
-
295
- const mutationFn: MutationFunction<
296
- Awaited<ReturnType<typeof deleteEventStream>>,
297
- { eventStreamId: number }
298
- > = (props) => {
299
- const { eventStreamId } = props ?? {};
300
-
301
- return deleteEventStream(eventStreamId, requestOptions);
302
- };
303
-
304
- return { mutationFn, ...mutationOptions };
305
- };
306
-
307
- export type DeleteEventStreamMutationResult = NonNullable<
308
- Awaited<ReturnType<typeof deleteEventStream>>
309
- >;
310
-
311
- export type DeleteEventStreamMutationError = ErrorType<AsError>;
312
-
313
- export const useDeleteEventStream = <
314
- TError = ErrorType<AsError>,
315
- TContext = unknown
316
- >(options?: {
317
- mutation?: UseMutationOptions<
318
- Awaited<ReturnType<typeof deleteEventStream>>,
319
- TError,
320
- { eventStreamId: number },
321
- TContext
322
- >;
323
- request?: SecondParameter<typeof customInstance>;
324
- }) => {
325
- const mutationOptions = getDeleteEventStreamMutationOptions(options);
326
-
327
- return useMutation(mutationOptions);
328
- };
348
+
349
+ const mutationOptions = getDeleteEventStreamMutationOptions(options);
350
+
351
+ return useMutation(mutationOptions);
352
+ }
353
+