@squonk/account-server-client 4.1.1 → 4.2.0-4-2.1834811920
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/asset/asset.cjs +16 -16
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.js +16 -16
- package/asset/asset.js.map +1 -1
- package/charges/charges.cjs.map +1 -1
- package/charges/charges.js.map +1 -1
- package/event-stream/event-stream.cjs +44 -41
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +89 -78
- package/event-stream/event-stream.d.ts +89 -78
- package/event-stream/event-stream.js +50 -47
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +11 -1
- package/index.cjs.map +1 -1
- package/index.d.cts +58 -32
- package/index.d.ts +58 -32
- package/index.js +10 -0
- package/index.js.map +1 -1
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +8 -6
- package/product/product.d.ts +8 -6
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +69 -33
- package/src/asset/asset.ts +17 -17
- package/src/charges/charges.ts +1 -1
- package/src/event-stream/event-stream.ts +160 -154
- package/src/merchant/merchant.ts +1 -1
- package/src/organisation/organisation.ts +1 -1
- package/src/product/product.ts +9 -7
- package/src/state/state.ts +1 -1
- package/src/unit/unit.ts +1 -1
- package/src/user/user.ts +1 -1
- package/state/state.cjs.map +1 -1
- package/state/state.js.map +1 -1
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.js.map +1 -1
- package/user/user.cjs.map +1 -1
- package/user/user.js.map +1 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
9
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
10
|
+
* OpenAPI spec version: 4.2
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
13
13
|
useMutation,
|
|
@@ -31,7 +31,9 @@ import type {
|
|
|
31
31
|
} from '@tanstack/react-query'
|
|
32
32
|
import type {
|
|
33
33
|
AsError,
|
|
34
|
-
EventStreamGetPostResponse
|
|
34
|
+
EventStreamGetPostResponse,
|
|
35
|
+
EventStreamPostBodyBody,
|
|
36
|
+
EventStreamVersionGetResponse
|
|
35
37
|
} from '../account-server-api.schemas'
|
|
36
38
|
import { customInstance } from '.././custom-instance';
|
|
37
39
|
import type { ErrorType } from '.././custom-instance';
|
|
@@ -41,84 +43,84 @@ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
|
-
* Gets
|
|
46
|
+
* Gets the details of the installed event stream, which includes its **category**, and **name**.
|
|
45
47
|
|
|
46
|
-
* @summary Gets the details of
|
|
48
|
+
* @summary Gets the details of the installed event stream
|
|
47
49
|
*/
|
|
48
|
-
export const
|
|
50
|
+
export const getEventStreamVersion = (
|
|
49
51
|
|
|
50
52
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
51
53
|
) => {
|
|
52
54
|
|
|
53
55
|
|
|
54
|
-
return customInstance<
|
|
55
|
-
{url: `/event-stream`, method: 'GET', signal
|
|
56
|
+
return customInstance<EventStreamVersionGetResponse>(
|
|
57
|
+
{url: `/event-stream/version`, method: 'GET', signal
|
|
56
58
|
},
|
|
57
59
|
options);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
|
|
61
|
-
export const
|
|
62
|
-
return ["account-server-api", `/event-stream`] as const;
|
|
63
|
+
export const getGetEventStreamVersionQueryKey = () => {
|
|
64
|
+
return ["account-server-api", `/event-stream/version`] as const;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
|
|
66
|
-
export const
|
|
68
|
+
export const getGetEventStreamVersionQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
67
69
|
) => {
|
|
68
70
|
|
|
69
71
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
70
72
|
|
|
71
|
-
const queryKey = queryOptions?.queryKey ??
|
|
73
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamVersionQueryKey();
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
|
|
75
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof
|
|
77
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamVersion>>> = ({ signal }) => getEventStreamVersion(requestOptions, signal);
|
|
76
78
|
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
|
|
80
82
|
|
|
81
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof
|
|
83
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
export type
|
|
85
|
-
export type
|
|
86
|
+
export type GetEventStreamVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamVersion>>>
|
|
87
|
+
export type GetEventStreamVersionQueryError = ErrorType<void | AsError>
|
|
86
88
|
|
|
87
89
|
|
|
88
|
-
export function
|
|
89
|
-
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof
|
|
90
|
+
export function useGetEventStreamVersion<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
91
|
+
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>> & Pick<
|
|
90
92
|
DefinedInitialDataOptions<
|
|
91
|
-
Awaited<ReturnType<typeof
|
|
93
|
+
Awaited<ReturnType<typeof getEventStreamVersion>>,
|
|
92
94
|
TError,
|
|
93
95
|
TData
|
|
94
96
|
> , 'initialData'
|
|
95
97
|
>, request?: SecondParameter<typeof customInstance>}
|
|
96
98
|
|
|
97
99
|
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
98
|
-
export function
|
|
99
|
-
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof
|
|
100
|
+
export function useGetEventStreamVersion<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
101
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>> & Pick<
|
|
100
102
|
UndefinedInitialDataOptions<
|
|
101
|
-
Awaited<ReturnType<typeof
|
|
103
|
+
Awaited<ReturnType<typeof getEventStreamVersion>>,
|
|
102
104
|
TError,
|
|
103
105
|
TData
|
|
104
106
|
> , 'initialData'
|
|
105
107
|
>, request?: SecondParameter<typeof customInstance>}
|
|
106
108
|
|
|
107
109
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
108
|
-
export function
|
|
109
|
-
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof
|
|
110
|
+
export function useGetEventStreamVersion<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
111
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
110
112
|
|
|
111
113
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
112
114
|
/**
|
|
113
|
-
* @summary Gets the details of
|
|
115
|
+
* @summary Gets the details of the installed event stream
|
|
114
116
|
*/
|
|
115
117
|
|
|
116
|
-
export function
|
|
117
|
-
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof
|
|
118
|
+
export function useGetEventStreamVersion<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
119
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
118
120
|
|
|
119
121
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
120
122
|
|
|
121
|
-
const queryOptions =
|
|
123
|
+
const queryOptions = getGetEventStreamVersionQueryOptions(options)
|
|
122
124
|
|
|
123
125
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
124
126
|
|
|
@@ -129,50 +131,50 @@ export function useGetEventStream<TData = Awaited<ReturnType<typeof getEventStre
|
|
|
129
131
|
|
|
130
132
|
|
|
131
133
|
|
|
132
|
-
export const
|
|
134
|
+
export const getGetEventStreamVersionSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
133
135
|
) => {
|
|
134
136
|
|
|
135
137
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
136
138
|
|
|
137
|
-
const queryKey = queryOptions?.queryKey ??
|
|
139
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamVersionQueryKey();
|
|
138
140
|
|
|
139
141
|
|
|
140
142
|
|
|
141
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof
|
|
143
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamVersion>>> = ({ signal }) => getEventStreamVersion(requestOptions, signal);
|
|
142
144
|
|
|
143
145
|
|
|
144
146
|
|
|
145
147
|
|
|
146
148
|
|
|
147
|
-
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof
|
|
149
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
export type
|
|
151
|
-
export type
|
|
152
|
+
export type GetEventStreamVersionSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamVersion>>>
|
|
153
|
+
export type GetEventStreamVersionSuspenseQueryError = ErrorType<void | AsError>
|
|
152
154
|
|
|
153
155
|
|
|
154
|
-
export function
|
|
155
|
-
options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof
|
|
156
|
+
export function useGetEventStreamVersionSuspense<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
157
|
+
options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
156
158
|
|
|
157
159
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
158
|
-
export function
|
|
159
|
-
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof
|
|
160
|
+
export function useGetEventStreamVersionSuspense<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
161
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
160
162
|
|
|
161
163
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
162
|
-
export function
|
|
163
|
-
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof
|
|
164
|
+
export function useGetEventStreamVersionSuspense<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
165
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
164
166
|
|
|
165
167
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
166
168
|
/**
|
|
167
|
-
* @summary Gets the details of
|
|
169
|
+
* @summary Gets the details of the installed event stream
|
|
168
170
|
*/
|
|
169
171
|
|
|
170
|
-
export function
|
|
171
|
-
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof
|
|
172
|
+
export function useGetEventStreamVersionSuspense<TData = Awaited<ReturnType<typeof getEventStreamVersion>>, TError = ErrorType<void | AsError>>(
|
|
173
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
172
174
|
|
|
173
175
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
174
176
|
|
|
175
|
-
const queryOptions =
|
|
177
|
+
const queryOptions = getGetEventStreamVersionSuspenseQueryOptions(options)
|
|
176
178
|
|
|
177
179
|
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
178
180
|
|
|
@@ -184,151 +186,84 @@ export function useGetEventStreamSuspense<TData = Awaited<ReturnType<typeof getE
|
|
|
184
186
|
|
|
185
187
|
|
|
186
188
|
/**
|
|
187
|
-
*
|
|
188
|
-
|
|
189
|
-
A user is only permitted one event stream.
|
|
189
|
+
* Gets the details of your event stream, if you have created one. The response includes the event stream **id** and the **location** where events can be accessed.
|
|
190
190
|
|
|
191
|
-
* @summary
|
|
191
|
+
* @summary Gets the details of your event stream
|
|
192
192
|
*/
|
|
193
|
-
export const
|
|
193
|
+
export const getEventStream = (
|
|
194
194
|
|
|
195
195
|
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
196
196
|
) => {
|
|
197
197
|
|
|
198
198
|
|
|
199
199
|
return customInstance<EventStreamGetPostResponse>(
|
|
200
|
-
{url: `/event-stream`, method: '
|
|
201
|
-
},
|
|
202
|
-
options);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
export const getCreateEventStreamMutationOptions = <TData = Awaited<ReturnType<typeof createEventStream>>, TError = ErrorType<AsError | void>,
|
|
208
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
209
|
-
) => {
|
|
210
|
-
const mutationKey = ['createEventStream'];
|
|
211
|
-
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
212
|
-
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
213
|
-
options
|
|
214
|
-
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
215
|
-
: {mutation: { mutationKey, }, request: undefined};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createEventStream>>, void> = () => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return createEventStream(requestOptions)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,void, TContext>}
|
|
230
|
-
|
|
231
|
-
export type CreateEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof createEventStream>>>
|
|
232
|
-
|
|
233
|
-
export type CreateEventStreamMutationError = ErrorType<AsError | void>
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* @summary Create a new Server-Sent Events EventStream
|
|
237
|
-
*/
|
|
238
|
-
export const useCreateEventStream = <TData = Awaited<ReturnType<typeof createEventStream>>, TError = ErrorType<AsError | void>,
|
|
239
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
240
|
-
): UseMutationResult<
|
|
241
|
-
TData,
|
|
242
|
-
TError,
|
|
243
|
-
void,
|
|
244
|
-
TContext
|
|
245
|
-
> => {
|
|
246
|
-
|
|
247
|
-
const mutationOptions = getCreateEventStreamMutationOptions(options);
|
|
248
|
-
|
|
249
|
-
return useMutation(mutationOptions);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* 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.
|
|
253
|
-
|
|
254
|
-
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`.
|
|
255
|
-
|
|
256
|
-
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
257
|
-
*/
|
|
258
|
-
export const getEventStreamEvents = (
|
|
259
|
-
eventStreamId: number,
|
|
260
|
-
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
261
|
-
) => {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return customInstance<string>(
|
|
265
|
-
{url: `/event-stream/${eventStreamId}`, method: 'GET', signal
|
|
200
|
+
{url: `/event-stream`, method: 'GET', signal
|
|
266
201
|
},
|
|
267
202
|
options);
|
|
268
203
|
}
|
|
269
204
|
|
|
270
205
|
|
|
271
|
-
export const
|
|
272
|
-
return ["account-server-api", `/event-stream
|
|
206
|
+
export const getGetEventStreamQueryKey = () => {
|
|
207
|
+
return ["account-server-api", `/event-stream`] as const;
|
|
273
208
|
}
|
|
274
209
|
|
|
275
210
|
|
|
276
|
-
export const
|
|
211
|
+
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>}
|
|
277
212
|
) => {
|
|
278
213
|
|
|
279
214
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
280
215
|
|
|
281
|
-
const queryKey = queryOptions?.queryKey ??
|
|
216
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
|
|
282
217
|
|
|
283
218
|
|
|
284
219
|
|
|
285
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof
|
|
220
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);
|
|
286
221
|
|
|
287
222
|
|
|
288
223
|
|
|
289
224
|
|
|
290
225
|
|
|
291
|
-
return { queryKey, queryFn,
|
|
226
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
292
227
|
}
|
|
293
228
|
|
|
294
|
-
export type
|
|
295
|
-
export type
|
|
229
|
+
export type GetEventStreamQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>
|
|
230
|
+
export type GetEventStreamQueryError = ErrorType<void | AsError>
|
|
296
231
|
|
|
297
232
|
|
|
298
|
-
export function
|
|
299
|
-
|
|
233
|
+
export function useGetEventStream<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
234
|
+
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>> & Pick<
|
|
300
235
|
DefinedInitialDataOptions<
|
|
301
|
-
Awaited<ReturnType<typeof
|
|
236
|
+
Awaited<ReturnType<typeof getEventStream>>,
|
|
302
237
|
TError,
|
|
303
238
|
TData
|
|
304
239
|
> , 'initialData'
|
|
305
240
|
>, request?: SecondParameter<typeof customInstance>}
|
|
306
241
|
|
|
307
242
|
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
308
|
-
export function
|
|
309
|
-
|
|
243
|
+
export function useGetEventStream<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
244
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>> & Pick<
|
|
310
245
|
UndefinedInitialDataOptions<
|
|
311
|
-
Awaited<ReturnType<typeof
|
|
246
|
+
Awaited<ReturnType<typeof getEventStream>>,
|
|
312
247
|
TError,
|
|
313
248
|
TData
|
|
314
249
|
> , 'initialData'
|
|
315
250
|
>, request?: SecondParameter<typeof customInstance>}
|
|
316
251
|
|
|
317
252
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
318
|
-
export function
|
|
319
|
-
|
|
253
|
+
export function useGetEventStream<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
254
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
320
255
|
|
|
321
256
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
322
257
|
/**
|
|
323
|
-
* @summary
|
|
258
|
+
* @summary Gets the details of your event stream
|
|
324
259
|
*/
|
|
325
260
|
|
|
326
|
-
export function
|
|
327
|
-
|
|
261
|
+
export function useGetEventStream<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
262
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
328
263
|
|
|
329
264
|
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
330
265
|
|
|
331
|
-
const queryOptions =
|
|
266
|
+
const queryOptions = getGetEventStreamQueryOptions(options)
|
|
332
267
|
|
|
333
268
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
334
269
|
|
|
@@ -339,50 +274,50 @@ export function useGetEventStreamEvents<TData = Awaited<ReturnType<typeof getEve
|
|
|
339
274
|
|
|
340
275
|
|
|
341
276
|
|
|
342
|
-
export const
|
|
277
|
+
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>}
|
|
343
278
|
) => {
|
|
344
279
|
|
|
345
280
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
346
281
|
|
|
347
|
-
const queryKey = queryOptions?.queryKey ??
|
|
282
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
|
|
348
283
|
|
|
349
284
|
|
|
350
285
|
|
|
351
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof
|
|
286
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);
|
|
352
287
|
|
|
353
288
|
|
|
354
289
|
|
|
355
290
|
|
|
356
291
|
|
|
357
|
-
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof
|
|
292
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
358
293
|
}
|
|
359
294
|
|
|
360
|
-
export type
|
|
361
|
-
export type
|
|
295
|
+
export type GetEventStreamSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>
|
|
296
|
+
export type GetEventStreamSuspenseQueryError = ErrorType<void | AsError>
|
|
362
297
|
|
|
363
298
|
|
|
364
|
-
export function
|
|
365
|
-
|
|
299
|
+
export function useGetEventStreamSuspense<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
300
|
+
options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
366
301
|
|
|
367
302
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
368
|
-
export function
|
|
369
|
-
|
|
303
|
+
export function useGetEventStreamSuspense<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
304
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
370
305
|
|
|
371
306
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
372
|
-
export function
|
|
373
|
-
|
|
307
|
+
export function useGetEventStreamSuspense<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
308
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
374
309
|
|
|
375
310
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
|
376
311
|
/**
|
|
377
|
-
* @summary
|
|
312
|
+
* @summary Gets the details of your event stream
|
|
378
313
|
*/
|
|
379
314
|
|
|
380
|
-
export function
|
|
381
|
-
|
|
315
|
+
export function useGetEventStreamSuspense<TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
316
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
382
317
|
|
|
383
318
|
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
384
319
|
|
|
385
|
-
const queryOptions =
|
|
320
|
+
const queryOptions = getGetEventStreamSuspenseQueryOptions(options)
|
|
386
321
|
|
|
387
322
|
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
388
323
|
|
|
@@ -394,11 +329,82 @@ export function useGetEventStreamEventsSuspense<TData = Awaited<ReturnType<typeo
|
|
|
394
329
|
|
|
395
330
|
|
|
396
331
|
/**
|
|
397
|
-
*
|
|
332
|
+
* Creates a new event stream for the authenticated user. Event streams deliver near-real-time events to the user, typically through a long-running *Socket*. The protocol is dependent on the Event Stream Service that has been installed. Our **Python FastAPI WebSocket** service is one such service.
|
|
333
|
+
|
|
334
|
+
Events are delivered to the client using the a `format` chosen here. Internally, events are **Protocol Buffer** objects that are delivered, by default as a single-line string using `MessageToString`. This is the `PROTOCOL_STRING` format. Clients can choose to receive messages as a JSON string using the format `JSON_STRING`. Using JSON strings will incur a small processing penalty but they are useful if the client does not have access to a library that can decode protocol buffer strings.
|
|
335
|
+
|
|
336
|
+
The response will include the event stream **id** and the **location** where events can be accessed.
|
|
337
|
+
|
|
338
|
+
The event streaming service is an optional component of the Account Server. If a service is not installed you will receive a corresponding **404** error response.
|
|
339
|
+
|
|
340
|
+
A user is only permitted one event stream.
|
|
341
|
+
|
|
342
|
+
* @summary Create a new event stream
|
|
343
|
+
*/
|
|
344
|
+
export const createEventStream = (
|
|
345
|
+
eventStreamPostBodyBody: EventStreamPostBodyBody,
|
|
346
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
347
|
+
) => {
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
return customInstance<EventStreamGetPostResponse>(
|
|
351
|
+
{url: `/event-stream`, method: 'POST',
|
|
352
|
+
headers: {'Content-Type': 'application/json', },
|
|
353
|
+
data: eventStreamPostBodyBody, signal
|
|
354
|
+
},
|
|
355
|
+
options);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
398
359
|
|
|
399
|
-
|
|
360
|
+
export const getCreateEventStreamMutationOptions = <TData = Awaited<ReturnType<typeof createEventStream>>, TError = ErrorType<AsError | void>,
|
|
361
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{data: EventStreamPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
362
|
+
) => {
|
|
363
|
+
const mutationKey = ['createEventStream'];
|
|
364
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
365
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
366
|
+
options
|
|
367
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
368
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createEventStream>>, {data: EventStreamPostBodyBody}> = (props) => {
|
|
374
|
+
const {data} = props ?? {};
|
|
375
|
+
|
|
376
|
+
return createEventStream(data,requestOptions)
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{data: EventStreamPostBodyBody}, TContext>}
|
|
383
|
+
|
|
384
|
+
export type CreateEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof createEventStream>>>
|
|
385
|
+
export type CreateEventStreamMutationBody = EventStreamPostBodyBody
|
|
386
|
+
export type CreateEventStreamMutationError = ErrorType<AsError | void>
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @summary Create a new event stream
|
|
390
|
+
*/
|
|
391
|
+
export const useCreateEventStream = <TData = Awaited<ReturnType<typeof createEventStream>>, TError = ErrorType<AsError | void>,
|
|
392
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{data: EventStreamPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
393
|
+
): UseMutationResult<
|
|
394
|
+
TData,
|
|
395
|
+
TError,
|
|
396
|
+
{data: EventStreamPostBodyBody},
|
|
397
|
+
TContext
|
|
398
|
+
> => {
|
|
399
|
+
|
|
400
|
+
const mutationOptions = getCreateEventStreamMutationOptions(options);
|
|
401
|
+
|
|
402
|
+
return useMutation(mutationOptions);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* You must be the user who created the event stream.
|
|
400
406
|
|
|
401
|
-
* @summary Deletes an existing
|
|
407
|
+
* @summary Deletes an existing event stream (that you created)
|
|
402
408
|
*/
|
|
403
409
|
export const deleteEventStream = (
|
|
404
410
|
eventStreamId: number,
|
|
@@ -442,7 +448,7 @@ const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
|
442
448
|
export type DeleteEventStreamMutationError = ErrorType<void | AsError>
|
|
443
449
|
|
|
444
450
|
/**
|
|
445
|
-
* @summary Deletes an existing
|
|
451
|
+
* @summary Deletes an existing event stream (that you created)
|
|
446
452
|
*/
|
|
447
453
|
export const useDeleteEventStream = <TData = Awaited<ReturnType<typeof deleteEventStream>>, TError = ErrorType<void | AsError>,
|
|
448
454
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
package/src/merchant/merchant.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
9
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
10
|
+
* OpenAPI spec version: 4.2
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
13
13
|
useQuery,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
9
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
10
|
+
* OpenAPI spec version: 4.2
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
13
13
|
useMutation,
|
package/src/product/product.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
9
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
10
|
+
* OpenAPI spec version: 4.2
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
13
13
|
useMutation,
|
|
@@ -619,15 +619,17 @@ export function useGetProductsForOrganisationSuspense<TData = Awaited<ReturnType
|
|
|
619
619
|
|
|
620
620
|
|
|
621
621
|
/**
|
|
622
|
-
* Products are **Subscriptions** that you create in a Unit
|
|
622
|
+
* Products are **Subscriptions** that you create in a **Unit** that allow you to use services provided by a **Merchant**. To create products you need to be a member of the **Unit** or the Unit's **Organisation**.
|
|
623
623
|
|
|
624
|
-
|
|
624
|
+
Supported subscription **types** include `DATA_MANAGER_STORAGE_SUBSCRIPTION`, and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.
|
|
625
625
|
|
|
626
|
-
|
|
626
|
+
The `DATA_MANAGER_STORAGE_SUBSCRIPTION` **type** needs a **name**, an **allowance**, and an optional **limit** (that cannot be less than the **allowance**). If no **limit** is provided the **allowance** is used.
|
|
627
627
|
|
|
628
|
-
|
|
628
|
+
The `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` **type** needs a **name**, and a **flavour**. The **flavour**, a string, should typically be one of `EVALUATION`, `BRONZE`, `SILVER` or `GOLD`.
|
|
629
629
|
|
|
630
|
-
|
|
630
|
+
Users who are **Evaluators** can only create products in their Personal Unit, and where products support flavours, are restricted to `EVALUATION`` flavours .
|
|
631
|
+
|
|
632
|
+
* @summary Creates a Product for a Unit
|
|
631
633
|
*/
|
|
632
634
|
export const createUnitProduct = (
|
|
633
635
|
unitId: string,
|
|
@@ -675,7 +677,7 @@ const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
|
675
677
|
export type CreateUnitProductMutationError = ErrorType<AsError | void>
|
|
676
678
|
|
|
677
679
|
/**
|
|
678
|
-
* @summary Creates a Product for
|
|
680
|
+
* @summary Creates a Product for a Unit
|
|
679
681
|
*/
|
|
680
682
|
export const useCreateUnitProduct = <TData = Awaited<ReturnType<typeof createUnitProduct>>, TError = ErrorType<AsError | void>,
|
|
681
683
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{unitId: string;data: UnitProductPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
package/src/state/state.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
9
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
10
|
+
* OpenAPI spec version: 4.2
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
13
13
|
useQuery,
|
package/src/unit/unit.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
9
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
10
|
+
* OpenAPI spec version: 4.2
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
13
13
|
useMutation,
|
package/src/user/user.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
9
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
10
|
+
* OpenAPI spec version: 4.2
|
|
11
11
|
*/
|
|
12
12
|
import {
|
|
13
13
|
useMutation,
|