@djangocfg/api 1.2.3 → 1.2.5
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/dist/index.cjs +7221 -4039
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8464 -4517
- package/dist/index.d.ts +8464 -4517
- package/dist/index.mjs +7231 -4080
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_admin_api.ts +211 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_monitoring.ts +150 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_testing.ts +152 -0
- package/src/cfg/generated/_utils/fetchers/index.ts +3 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_admin_api.ts +246 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_monitoring.ts +137 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_testing.ts +171 -0
- package/src/cfg/generated/_utils/hooks/index.ts +3 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelInfo.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelsResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelsResult.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoClientInfo.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoError.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoHistoryResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoHistoryResult.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoInfoResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoInfoResult.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoMetrics.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoNodeInfo.schema.ts +30 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceResult.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoProcess.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPublication.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoStreamPosition.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ChannelList.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/ChannelStatsSerializer.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/ConnectionTokenRequestRequest.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ConnectionTokenResponse.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/HealthCheck.schema.ts +5 -7
- package/src/cfg/generated/_utils/schemas/ManualAckRequestRequest.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ManualAckResponse.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/OverviewStats.schema.ts +26 -0
- package/src/cfg/generated/_utils/schemas/PublishTestRequestRequest.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/PublishTestResponse.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/RecentPublishes.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/index.ts +32 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/client.ts +136 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/index.ts +2 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/models.ts +256 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/client.ts +160 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/index.ts +2 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/models.ts +86 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/client.ts +100 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/index.ts +2 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/models.ts +88 -0
- package/src/cfg/generated/cfg__health/models.ts +7 -11
- package/src/cfg/generated/client.ts +9 -0
- package/src/cfg/generated/index.ts +15 -0
- package/src/cfg/generated/schema.ts +5844 -3785
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for Centrifugo Admin API
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__centrifugo__centrifugo_admin_api'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'
|
|
22
|
+
import type { CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'
|
|
23
|
+
import type { CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'
|
|
24
|
+
import type { CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'
|
|
25
|
+
import type { CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'
|
|
26
|
+
import type { CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'
|
|
27
|
+
import type { CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'
|
|
28
|
+
import type { CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'
|
|
29
|
+
import type { CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get connection token for dashboard
|
|
33
|
+
*
|
|
34
|
+
* @method POST
|
|
35
|
+
* @path /cfg/centrifugo/admin/api/server/auth/token/
|
|
36
|
+
*/
|
|
37
|
+
export function useCreateCentrifugoAdminApiServerAuthTokenCreate() {
|
|
38
|
+
const { mutate } = useSWRConfig()
|
|
39
|
+
|
|
40
|
+
return async (client?: API): Promise<any> => {
|
|
41
|
+
const result = await Fetchers.createCentrifugoAdminApiServerAuthTokenCreate(client)
|
|
42
|
+
// Revalidate related queries
|
|
43
|
+
mutate('cfg-centrifugo-admin-api-server-auth-token')
|
|
44
|
+
return result
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* List active channels
|
|
51
|
+
*
|
|
52
|
+
* @method POST
|
|
53
|
+
* @path /cfg/centrifugo/admin/api/server/channels/
|
|
54
|
+
*/
|
|
55
|
+
export function useCreateCentrifugoAdminApiServerChannelsCreate() {
|
|
56
|
+
const { mutate } = useSWRConfig()
|
|
57
|
+
|
|
58
|
+
return async (data: CentrifugoChannelsRequestRequest, client?: API): Promise<CentrifugoChannelsResponse> => {
|
|
59
|
+
const result = await Fetchers.createCentrifugoAdminApiServerChannelsCreate(data, client)
|
|
60
|
+
// Revalidate related queries
|
|
61
|
+
mutate('cfg-centrifugo-admin-api-server-channels')
|
|
62
|
+
return result
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get channel history
|
|
69
|
+
*
|
|
70
|
+
* @method POST
|
|
71
|
+
* @path /cfg/centrifugo/admin/api/server/history/
|
|
72
|
+
*/
|
|
73
|
+
export function useCreateCentrifugoAdminApiServerHistoryCreate() {
|
|
74
|
+
const { mutate } = useSWRConfig()
|
|
75
|
+
|
|
76
|
+
return async (data: CentrifugoHistoryRequestRequest, client?: API): Promise<CentrifugoHistoryResponse> => {
|
|
77
|
+
const result = await Fetchers.createCentrifugoAdminApiServerHistoryCreate(data, client)
|
|
78
|
+
// Revalidate related queries
|
|
79
|
+
mutate('cfg-centrifugo-admin-api-server-history')
|
|
80
|
+
return result
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get Centrifugo server info
|
|
87
|
+
*
|
|
88
|
+
* @method POST
|
|
89
|
+
* @path /cfg/centrifugo/admin/api/server/info/
|
|
90
|
+
*/
|
|
91
|
+
export function useCreateCentrifugoAdminApiServerInfoCreate() {
|
|
92
|
+
const { mutate } = useSWRConfig()
|
|
93
|
+
|
|
94
|
+
return async (client?: API): Promise<CentrifugoInfoResponse> => {
|
|
95
|
+
const result = await Fetchers.createCentrifugoAdminApiServerInfoCreate(client)
|
|
96
|
+
// Revalidate related queries
|
|
97
|
+
mutate('cfg-centrifugo-admin-api-server-info')
|
|
98
|
+
return result
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get channel presence
|
|
105
|
+
*
|
|
106
|
+
* @method POST
|
|
107
|
+
* @path /cfg/centrifugo/admin/api/server/presence/
|
|
108
|
+
*/
|
|
109
|
+
export function useCreateCentrifugoAdminApiServerPresenceCreate() {
|
|
110
|
+
const { mutate } = useSWRConfig()
|
|
111
|
+
|
|
112
|
+
return async (data: CentrifugoPresenceRequestRequest, client?: API): Promise<CentrifugoPresenceResponse> => {
|
|
113
|
+
const result = await Fetchers.createCentrifugoAdminApiServerPresenceCreate(data, client)
|
|
114
|
+
// Revalidate related queries
|
|
115
|
+
mutate('cfg-centrifugo-admin-api-server-presence')
|
|
116
|
+
return result
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get channel presence statistics
|
|
123
|
+
*
|
|
124
|
+
* @method POST
|
|
125
|
+
* @path /cfg/centrifugo/admin/api/server/presence-stats/
|
|
126
|
+
*/
|
|
127
|
+
export function useCreateCentrifugoAdminApiServerPresenceStatsCreate() {
|
|
128
|
+
const { mutate } = useSWRConfig()
|
|
129
|
+
|
|
130
|
+
return async (data: CentrifugoPresenceStatsRequestRequest, client?: API): Promise<CentrifugoPresenceStatsResponse> => {
|
|
131
|
+
const result = await Fetchers.createCentrifugoAdminApiServerPresenceStatsCreate(data, client)
|
|
132
|
+
// Revalidate related queries
|
|
133
|
+
mutate('cfg-centrifugo-admin-api-server-presence-stats')
|
|
134
|
+
return result
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get connection token for dashboard
|
|
141
|
+
*
|
|
142
|
+
* @method POST
|
|
143
|
+
* @path /cfg/centrifugo/server/auth/token/
|
|
144
|
+
*/
|
|
145
|
+
export function useCreateCentrifugoServerAuthTokenCreate() {
|
|
146
|
+
const { mutate } = useSWRConfig()
|
|
147
|
+
|
|
148
|
+
return async (client?: API): Promise<any> => {
|
|
149
|
+
const result = await Fetchers.createCentrifugoServerAuthTokenCreate(client)
|
|
150
|
+
// Revalidate related queries
|
|
151
|
+
mutate('cfg-centrifugo-server-auth-token')
|
|
152
|
+
return result
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* List active channels
|
|
159
|
+
*
|
|
160
|
+
* @method POST
|
|
161
|
+
* @path /cfg/centrifugo/server/channels/
|
|
162
|
+
*/
|
|
163
|
+
export function useCreateCentrifugoServerChannelsCreate() {
|
|
164
|
+
const { mutate } = useSWRConfig()
|
|
165
|
+
|
|
166
|
+
return async (data: CentrifugoChannelsRequestRequest, client?: API): Promise<CentrifugoChannelsResponse> => {
|
|
167
|
+
const result = await Fetchers.createCentrifugoServerChannelsCreate(data, client)
|
|
168
|
+
// Revalidate related queries
|
|
169
|
+
mutate('cfg-centrifugo-server-channels')
|
|
170
|
+
return result
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Get channel history
|
|
177
|
+
*
|
|
178
|
+
* @method POST
|
|
179
|
+
* @path /cfg/centrifugo/server/history/
|
|
180
|
+
*/
|
|
181
|
+
export function useCreateCentrifugoServerHistoryCreate() {
|
|
182
|
+
const { mutate } = useSWRConfig()
|
|
183
|
+
|
|
184
|
+
return async (data: CentrifugoHistoryRequestRequest, client?: API): Promise<CentrifugoHistoryResponse> => {
|
|
185
|
+
const result = await Fetchers.createCentrifugoServerHistoryCreate(data, client)
|
|
186
|
+
// Revalidate related queries
|
|
187
|
+
mutate('cfg-centrifugo-server-history')
|
|
188
|
+
return result
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Get Centrifugo server info
|
|
195
|
+
*
|
|
196
|
+
* @method POST
|
|
197
|
+
* @path /cfg/centrifugo/server/info/
|
|
198
|
+
*/
|
|
199
|
+
export function useCreateCentrifugoServerInfoCreate() {
|
|
200
|
+
const { mutate } = useSWRConfig()
|
|
201
|
+
|
|
202
|
+
return async (client?: API): Promise<CentrifugoInfoResponse> => {
|
|
203
|
+
const result = await Fetchers.createCentrifugoServerInfoCreate(client)
|
|
204
|
+
// Revalidate related queries
|
|
205
|
+
mutate('cfg-centrifugo-server-info')
|
|
206
|
+
return result
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get channel presence
|
|
213
|
+
*
|
|
214
|
+
* @method POST
|
|
215
|
+
* @path /cfg/centrifugo/server/presence/
|
|
216
|
+
*/
|
|
217
|
+
export function useCreateCentrifugoServerPresenceCreate() {
|
|
218
|
+
const { mutate } = useSWRConfig()
|
|
219
|
+
|
|
220
|
+
return async (data: CentrifugoPresenceRequestRequest, client?: API): Promise<CentrifugoPresenceResponse> => {
|
|
221
|
+
const result = await Fetchers.createCentrifugoServerPresenceCreate(data, client)
|
|
222
|
+
// Revalidate related queries
|
|
223
|
+
mutate('cfg-centrifugo-server-presence')
|
|
224
|
+
return result
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Get channel presence statistics
|
|
231
|
+
*
|
|
232
|
+
* @method POST
|
|
233
|
+
* @path /cfg/centrifugo/server/presence-stats/
|
|
234
|
+
*/
|
|
235
|
+
export function useCreateCentrifugoServerPresenceStatsCreate() {
|
|
236
|
+
const { mutate } = useSWRConfig()
|
|
237
|
+
|
|
238
|
+
return async (data: CentrifugoPresenceStatsRequestRequest, client?: API): Promise<CentrifugoPresenceStatsResponse> => {
|
|
239
|
+
const result = await Fetchers.createCentrifugoServerPresenceStatsCreate(data, client)
|
|
240
|
+
// Revalidate related queries
|
|
241
|
+
mutate('cfg-centrifugo-server-presence-stats')
|
|
242
|
+
return result
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for Centrifugo Monitoring
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__centrifugo__centrifugo_monitoring'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { ChannelList } from '../schemas/ChannelList.schema'
|
|
22
|
+
import type { HealthCheck } from '../schemas/HealthCheck.schema'
|
|
23
|
+
import type { OverviewStats } from '../schemas/OverviewStats.schema'
|
|
24
|
+
import type { RecentPublishes } from '../schemas/RecentPublishes.schema'
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get channel statistics
|
|
28
|
+
*
|
|
29
|
+
* @method GET
|
|
30
|
+
* @path /cfg/centrifugo/admin/api/monitor/channels/
|
|
31
|
+
*/
|
|
32
|
+
export function useCentrifugoAdminApiMonitorChannelsRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<ChannelList>> {
|
|
33
|
+
return useSWR<ChannelList>(
|
|
34
|
+
params ? ['cfg-centrifugo-admin-api-monitor-channel', params] : 'cfg-centrifugo-admin-api-monitor-channel',
|
|
35
|
+
() => Fetchers.getCentrifugoAdminApiMonitorChannelsRetrieve(params, client)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get Centrifugo health status
|
|
42
|
+
*
|
|
43
|
+
* @method GET
|
|
44
|
+
* @path /cfg/centrifugo/admin/api/monitor/health/
|
|
45
|
+
*/
|
|
46
|
+
export function useCentrifugoAdminApiMonitorHealthRetrieve(client?: API): ReturnType<typeof useSWR<HealthCheck>> {
|
|
47
|
+
return useSWR<HealthCheck>(
|
|
48
|
+
'cfg-centrifugo-admin-api-monitor-health',
|
|
49
|
+
() => Fetchers.getCentrifugoAdminApiMonitorHealthRetrieve(client)
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get overview statistics
|
|
56
|
+
*
|
|
57
|
+
* @method GET
|
|
58
|
+
* @path /cfg/centrifugo/admin/api/monitor/overview/
|
|
59
|
+
*/
|
|
60
|
+
export function useCentrifugoAdminApiMonitorOverviewRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<OverviewStats>> {
|
|
61
|
+
return useSWR<OverviewStats>(
|
|
62
|
+
params ? ['cfg-centrifugo-admin-api-monitor-overview', params] : 'cfg-centrifugo-admin-api-monitor-overview',
|
|
63
|
+
() => Fetchers.getCentrifugoAdminApiMonitorOverviewRetrieve(params, client)
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get recent publishes
|
|
70
|
+
*
|
|
71
|
+
* @method GET
|
|
72
|
+
* @path /cfg/centrifugo/admin/api/monitor/publishes/
|
|
73
|
+
*/
|
|
74
|
+
export function useCentrifugoAdminApiMonitorPublishesRetrieve(params?: { channel?: string; count?: number }, client?: API): ReturnType<typeof useSWR<RecentPublishes>> {
|
|
75
|
+
return useSWR<RecentPublishes>(
|
|
76
|
+
params ? ['cfg-centrifugo-admin-api-monitor-publishe', params] : 'cfg-centrifugo-admin-api-monitor-publishe',
|
|
77
|
+
() => Fetchers.getCentrifugoAdminApiMonitorPublishesRetrieve(params, client)
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get channel statistics
|
|
84
|
+
*
|
|
85
|
+
* @method GET
|
|
86
|
+
* @path /cfg/centrifugo/monitor/channels/
|
|
87
|
+
*/
|
|
88
|
+
export function useCentrifugoMonitorChannelsRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<ChannelList>> {
|
|
89
|
+
return useSWR<ChannelList>(
|
|
90
|
+
params ? ['cfg-centrifugo-monitor-channel', params] : 'cfg-centrifugo-monitor-channel',
|
|
91
|
+
() => Fetchers.getCentrifugoMonitorChannelsRetrieve(params, client)
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get Centrifugo health status
|
|
98
|
+
*
|
|
99
|
+
* @method GET
|
|
100
|
+
* @path /cfg/centrifugo/monitor/health/
|
|
101
|
+
*/
|
|
102
|
+
export function useCentrifugoMonitorHealthRetrieve(client?: API): ReturnType<typeof useSWR<HealthCheck>> {
|
|
103
|
+
return useSWR<HealthCheck>(
|
|
104
|
+
'cfg-centrifugo-monitor-health',
|
|
105
|
+
() => Fetchers.getCentrifugoMonitorHealthRetrieve(client)
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get overview statistics
|
|
112
|
+
*
|
|
113
|
+
* @method GET
|
|
114
|
+
* @path /cfg/centrifugo/monitor/overview/
|
|
115
|
+
*/
|
|
116
|
+
export function useCentrifugoMonitorOverviewRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<OverviewStats>> {
|
|
117
|
+
return useSWR<OverviewStats>(
|
|
118
|
+
params ? ['cfg-centrifugo-monitor-overview', params] : 'cfg-centrifugo-monitor-overview',
|
|
119
|
+
() => Fetchers.getCentrifugoMonitorOverviewRetrieve(params, client)
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get recent publishes
|
|
126
|
+
*
|
|
127
|
+
* @method GET
|
|
128
|
+
* @path /cfg/centrifugo/monitor/publishes/
|
|
129
|
+
*/
|
|
130
|
+
export function useCentrifugoMonitorPublishesRetrieve(params?: { channel?: string; count?: number }, client?: API): ReturnType<typeof useSWR<RecentPublishes>> {
|
|
131
|
+
return useSWR<RecentPublishes>(
|
|
132
|
+
params ? ['cfg-centrifugo-monitor-publishe', params] : 'cfg-centrifugo-monitor-publishe',
|
|
133
|
+
() => Fetchers.getCentrifugoMonitorPublishesRetrieve(params, client)
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for Centrifugo Testing
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__centrifugo__centrifugo_testing'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { ConnectionTokenRequestRequest } from '../schemas/ConnectionTokenRequestRequest.schema'
|
|
22
|
+
import type { ConnectionTokenResponse } from '../schemas/ConnectionTokenResponse.schema'
|
|
23
|
+
import type { ManualAckRequestRequest } from '../schemas/ManualAckRequestRequest.schema'
|
|
24
|
+
import type { ManualAckResponse } from '../schemas/ManualAckResponse.schema'
|
|
25
|
+
import type { PublishTestRequestRequest } from '../schemas/PublishTestRequestRequest.schema'
|
|
26
|
+
import type { PublishTestResponse } from '../schemas/PublishTestResponse.schema'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generate connection token
|
|
30
|
+
*
|
|
31
|
+
* @method POST
|
|
32
|
+
* @path /cfg/centrifugo/admin/api/testing/connection-token/
|
|
33
|
+
*/
|
|
34
|
+
export function useCreateCentrifugoAdminApiTestingConnectionTokenCreate() {
|
|
35
|
+
const { mutate } = useSWRConfig()
|
|
36
|
+
|
|
37
|
+
return async (data: ConnectionTokenRequestRequest, client?: API): Promise<ConnectionTokenResponse> => {
|
|
38
|
+
const result = await Fetchers.createCentrifugoAdminApiTestingConnectionTokenCreate(data, client)
|
|
39
|
+
// Revalidate related queries
|
|
40
|
+
mutate('cfg-centrifugo-admin-api-testing-connection-token')
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Publish test message
|
|
48
|
+
*
|
|
49
|
+
* @method POST
|
|
50
|
+
* @path /cfg/centrifugo/admin/api/testing/publish-test/
|
|
51
|
+
*/
|
|
52
|
+
export function useCreateCentrifugoAdminApiTestingPublishTestCreate() {
|
|
53
|
+
const { mutate } = useSWRConfig()
|
|
54
|
+
|
|
55
|
+
return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {
|
|
56
|
+
const result = await Fetchers.createCentrifugoAdminApiTestingPublishTestCreate(data, client)
|
|
57
|
+
// Revalidate related queries
|
|
58
|
+
mutate('cfg-centrifugo-admin-api-testing-publish-test')
|
|
59
|
+
return result
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Publish with database logging
|
|
66
|
+
*
|
|
67
|
+
* @method POST
|
|
68
|
+
* @path /cfg/centrifugo/admin/api/testing/publish-with-logging/
|
|
69
|
+
*/
|
|
70
|
+
export function useCreateCentrifugoAdminApiTestingPublishWithLoggingCreate() {
|
|
71
|
+
const { mutate } = useSWRConfig()
|
|
72
|
+
|
|
73
|
+
return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {
|
|
74
|
+
const result = await Fetchers.createCentrifugoAdminApiTestingPublishWithLoggingCreate(data, client)
|
|
75
|
+
// Revalidate related queries
|
|
76
|
+
mutate('cfg-centrifugo-admin-api-testing-publish-with-logging')
|
|
77
|
+
return result
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Send manual ACK
|
|
84
|
+
*
|
|
85
|
+
* @method POST
|
|
86
|
+
* @path /cfg/centrifugo/admin/api/testing/send-ack/
|
|
87
|
+
*/
|
|
88
|
+
export function useCreateCentrifugoAdminApiTestingSendAckCreate() {
|
|
89
|
+
const { mutate } = useSWRConfig()
|
|
90
|
+
|
|
91
|
+
return async (data: ManualAckRequestRequest, client?: API): Promise<ManualAckResponse> => {
|
|
92
|
+
const result = await Fetchers.createCentrifugoAdminApiTestingSendAckCreate(data, client)
|
|
93
|
+
// Revalidate related queries
|
|
94
|
+
mutate('cfg-centrifugo-admin-api-testing-send-ack')
|
|
95
|
+
return result
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generate connection token
|
|
102
|
+
*
|
|
103
|
+
* @method POST
|
|
104
|
+
* @path /cfg/centrifugo/testing/connection-token/
|
|
105
|
+
*/
|
|
106
|
+
export function useCreateCentrifugoTestingConnectionTokenCreate() {
|
|
107
|
+
const { mutate } = useSWRConfig()
|
|
108
|
+
|
|
109
|
+
return async (data: ConnectionTokenRequestRequest, client?: API): Promise<ConnectionTokenResponse> => {
|
|
110
|
+
const result = await Fetchers.createCentrifugoTestingConnectionTokenCreate(data, client)
|
|
111
|
+
// Revalidate related queries
|
|
112
|
+
mutate('cfg-centrifugo-testing-connection-token')
|
|
113
|
+
return result
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Publish test message
|
|
120
|
+
*
|
|
121
|
+
* @method POST
|
|
122
|
+
* @path /cfg/centrifugo/testing/publish-test/
|
|
123
|
+
*/
|
|
124
|
+
export function useCreateCentrifugoTestingPublishTestCreate() {
|
|
125
|
+
const { mutate } = useSWRConfig()
|
|
126
|
+
|
|
127
|
+
return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {
|
|
128
|
+
const result = await Fetchers.createCentrifugoTestingPublishTestCreate(data, client)
|
|
129
|
+
// Revalidate related queries
|
|
130
|
+
mutate('cfg-centrifugo-testing-publish-test')
|
|
131
|
+
return result
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Publish with database logging
|
|
138
|
+
*
|
|
139
|
+
* @method POST
|
|
140
|
+
* @path /cfg/centrifugo/testing/publish-with-logging/
|
|
141
|
+
*/
|
|
142
|
+
export function useCreateCentrifugoTestingPublishWithLoggingCreate() {
|
|
143
|
+
const { mutate } = useSWRConfig()
|
|
144
|
+
|
|
145
|
+
return async (data: PublishTestRequestRequest, client?: API): Promise<PublishTestResponse> => {
|
|
146
|
+
const result = await Fetchers.createCentrifugoTestingPublishWithLoggingCreate(data, client)
|
|
147
|
+
// Revalidate related queries
|
|
148
|
+
mutate('cfg-centrifugo-testing-publish-with-logging')
|
|
149
|
+
return result
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Send manual ACK
|
|
156
|
+
*
|
|
157
|
+
* @method POST
|
|
158
|
+
* @path /cfg/centrifugo/testing/send-ack/
|
|
159
|
+
*/
|
|
160
|
+
export function useCreateCentrifugoTestingSendAckCreate() {
|
|
161
|
+
const { mutate } = useSWRConfig()
|
|
162
|
+
|
|
163
|
+
return async (data: ManualAckRequestRequest, client?: API): Promise<ManualAckResponse> => {
|
|
164
|
+
const result = await Fetchers.createCentrifugoTestingSendAckCreate(data, client)
|
|
165
|
+
// Revalidate related queries
|
|
166
|
+
mutate('cfg-centrifugo-testing-send-ack')
|
|
167
|
+
return result
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
export * from './cfg__accounts__auth'
|
|
27
27
|
export * from './cfg__newsletter__bulk_email'
|
|
28
28
|
export * from './cfg__newsletter__campaigns'
|
|
29
|
+
export * from './cfg__centrifugo__centrifugo_admin_api'
|
|
30
|
+
export * from './cfg__centrifugo__centrifugo_monitoring'
|
|
31
|
+
export * from './cfg__centrifugo__centrifugo_testing'
|
|
29
32
|
export * from './cfg__leads__lead_submission'
|
|
30
33
|
export * from './cfg__newsletter__logs'
|
|
31
34
|
export * from './cfg__newsletter__newsletters'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for CentrifugoChannelInfo
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Information about a single channel.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Information about a single channel.
|
|
11
|
+
*/
|
|
12
|
+
export const CentrifugoChannelInfoSchema = z.object({
|
|
13
|
+
num_clients: z.int(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Infer TypeScript type from Zod schema
|
|
18
|
+
*/
|
|
19
|
+
export type CentrifugoChannelInfo = z.infer<typeof CentrifugoChannelInfoSchema>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for CentrifugoChannelsRequestRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Request to list active channels.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Request to list active channels.
|
|
11
|
+
*/
|
|
12
|
+
export const CentrifugoChannelsRequestRequestSchema = z.object({
|
|
13
|
+
pattern: z.string().optional(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Infer TypeScript type from Zod schema
|
|
18
|
+
*/
|
|
19
|
+
export type CentrifugoChannelsRequestRequest = z.infer<typeof CentrifugoChannelsRequestRequestSchema>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for CentrifugoChannelsResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * List of active channels response.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import { CentrifugoChannelsResultSchema } from './CentrifugoChannelsResult.schema'
|
|
9
|
+
import { CentrifugoErrorSchema } from './CentrifugoError.schema'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* List of active channels response.
|
|
13
|
+
*/
|
|
14
|
+
export const CentrifugoChannelsResponseSchema = z.object({
|
|
15
|
+
error: CentrifugoErrorSchema.optional(),
|
|
16
|
+
result: CentrifugoChannelsResultSchema.optional(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Infer TypeScript type from Zod schema
|
|
21
|
+
*/
|
|
22
|
+
export type CentrifugoChannelsResponse = z.infer<typeof CentrifugoChannelsResponseSchema>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for CentrifugoChannelsResult
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Channels result wrapper.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Channels result wrapper.
|
|
11
|
+
*/
|
|
12
|
+
export const CentrifugoChannelsResultSchema = z.object({
|
|
13
|
+
channels: z.record(z.string(), z.any()),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Infer TypeScript type from Zod schema
|
|
18
|
+
*/
|
|
19
|
+
export type CentrifugoChannelsResult = z.infer<typeof CentrifugoChannelsResultSchema>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for CentrifugoClientInfo
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Information about connected client.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Information about connected client.
|
|
11
|
+
*/
|
|
12
|
+
export const CentrifugoClientInfoSchema = z.object({
|
|
13
|
+
user: z.string(),
|
|
14
|
+
client: z.string(),
|
|
15
|
+
conn_info: z.string().optional(),
|
|
16
|
+
chan_info: z.string().optional(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Infer TypeScript type from Zod schema
|
|
21
|
+
*/
|
|
22
|
+
export type CentrifugoClientInfo = z.infer<typeof CentrifugoClientInfoSchema>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for CentrifugoError
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Centrifugo API error structure.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Centrifugo API error structure.
|
|
11
|
+
*/
|
|
12
|
+
export const CentrifugoErrorSchema = z.object({
|
|
13
|
+
code: z.int().optional(),
|
|
14
|
+
message: z.string().optional(),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Infer TypeScript type from Zod schema
|
|
19
|
+
*/
|
|
20
|
+
export type CentrifugoError = z.infer<typeof CentrifugoErrorSchema>
|