@djangocfg/api 1.2.4 → 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.
Files changed (80) hide show
  1. package/dist/index.cjs +6912 -5124
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +6992 -4881
  4. package/dist/index.d.ts +6992 -4881
  5. package/dist/index.mjs +7024 -5247
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +2 -2
  8. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_admin_api.ts +211 -0
  9. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_monitoring.ts +150 -0
  10. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_testing.ts +152 -0
  11. package/src/cfg/generated/_utils/fetchers/index.ts +3 -2
  12. package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_admin_api.ts +246 -0
  13. package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_monitoring.ts +137 -0
  14. package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_testing.ts +171 -0
  15. package/src/cfg/generated/_utils/hooks/index.ts +3 -2
  16. package/src/cfg/generated/_utils/schemas/CentrifugoChannelInfo.schema.ts +19 -0
  17. package/src/cfg/generated/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts +19 -0
  18. package/src/cfg/generated/_utils/schemas/CentrifugoChannelsResponse.schema.ts +22 -0
  19. package/src/cfg/generated/_utils/schemas/CentrifugoChannelsResult.schema.ts +19 -0
  20. package/src/cfg/generated/_utils/schemas/CentrifugoClientInfo.schema.ts +22 -0
  21. package/src/cfg/generated/_utils/schemas/CentrifugoError.schema.ts +20 -0
  22. package/src/cfg/generated/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts +23 -0
  23. package/src/cfg/generated/_utils/schemas/CentrifugoHistoryResponse.schema.ts +22 -0
  24. package/src/cfg/generated/_utils/schemas/CentrifugoHistoryResult.schema.ts +22 -0
  25. package/src/cfg/generated/_utils/schemas/CentrifugoInfoResponse.schema.ts +22 -0
  26. package/src/cfg/generated/_utils/schemas/CentrifugoInfoResult.schema.ts +20 -0
  27. package/src/cfg/generated/_utils/schemas/CentrifugoMetrics.schema.ts +20 -0
  28. package/src/cfg/generated/_utils/schemas/CentrifugoNodeInfo.schema.ts +30 -0
  29. package/src/cfg/generated/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts +19 -0
  30. package/src/cfg/generated/_utils/schemas/CentrifugoPresenceResponse.schema.ts +22 -0
  31. package/src/cfg/generated/_utils/schemas/CentrifugoPresenceResult.schema.ts +19 -0
  32. package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts +19 -0
  33. package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts +22 -0
  34. package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts +20 -0
  35. package/src/cfg/generated/_utils/schemas/CentrifugoProcess.schema.ts +20 -0
  36. package/src/cfg/generated/_utils/schemas/CentrifugoPublication.schema.ts +23 -0
  37. package/src/cfg/generated/_utils/schemas/CentrifugoStreamPosition.schema.ts +20 -0
  38. package/src/cfg/generated/_utils/schemas/ChannelList.schema.ts +21 -0
  39. package/src/cfg/generated/_utils/schemas/ChannelStatsSerializer.schema.ts +24 -0
  40. package/src/cfg/generated/_utils/schemas/ConnectionTokenRequestRequest.schema.ts +20 -0
  41. package/src/cfg/generated/_utils/schemas/ConnectionTokenResponse.schema.ts +21 -0
  42. package/src/cfg/generated/_utils/schemas/HealthCheck.schema.ts +5 -7
  43. package/src/cfg/generated/_utils/schemas/ManualAckRequestRequest.schema.ts +20 -0
  44. package/src/cfg/generated/_utils/schemas/ManualAckResponse.schema.ts +21 -0
  45. package/src/cfg/generated/_utils/schemas/OverviewStats.schema.ts +9 -12
  46. package/src/cfg/generated/_utils/schemas/PublishTestRequestRequest.schema.ts +22 -0
  47. package/src/cfg/generated/_utils/schemas/PublishTestResponse.schema.ts +24 -0
  48. package/src/cfg/generated/_utils/schemas/RecentPublishes.schema.ts +21 -0
  49. package/src/cfg/generated/_utils/schemas/index.ts +31 -10
  50. package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/client.ts +136 -0
  51. package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/models.ts +256 -0
  52. package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/client.ts +160 -0
  53. package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/models.ts +86 -0
  54. package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/client.ts +100 -0
  55. package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/index.ts +2 -0
  56. package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/models.ts +88 -0
  57. package/src/cfg/generated/cfg__health/models.ts +7 -11
  58. package/src/cfg/generated/client.ts +9 -6
  59. package/src/cfg/generated/index.ts +15 -10
  60. package/src/cfg/generated/schema.ts +4463 -3169
  61. package/src/cfg/generated/_utils/fetchers/cfg__ipc__ipcrpc_monitoring.ts +0 -179
  62. package/src/cfg/generated/_utils/fetchers/cfg__ipc__ipcrpc_testing.ts +0 -151
  63. package/src/cfg/generated/_utils/hooks/cfg__ipc__ipcrpc_monitoring.ts +0 -166
  64. package/src/cfg/generated/_utils/hooks/cfg__ipc__ipcrpc_testing.ts +0 -162
  65. package/src/cfg/generated/_utils/schemas/LoadTestRequestRequest.schema.ts +0 -22
  66. package/src/cfg/generated/_utils/schemas/LoadTestResponse.schema.ts +0 -21
  67. package/src/cfg/generated/_utils/schemas/LoadTestStatus.schema.ts +0 -27
  68. package/src/cfg/generated/_utils/schemas/MethodStat.schema.ts +0 -25
  69. package/src/cfg/generated/_utils/schemas/MethodStats.schema.ts +0 -22
  70. package/src/cfg/generated/_utils/schemas/NotificationStats.schema.ts +0 -25
  71. package/src/cfg/generated/_utils/schemas/RPCRequest.schema.ts +0 -25
  72. package/src/cfg/generated/_utils/schemas/RecentRequests.schema.ts +0 -22
  73. package/src/cfg/generated/_utils/schemas/TestRPCRequestRequest.schema.ts +0 -21
  74. package/src/cfg/generated/_utils/schemas/TestRPCResponse.schema.ts +0 -23
  75. package/src/cfg/generated/cfg__ipc__ipcrpc_monitoring/client.ts +0 -136
  76. package/src/cfg/generated/cfg__ipc__ipcrpc_monitoring/models.ts +0 -144
  77. package/src/cfg/generated/cfg__ipc__ipcrpc_testing/client.ts +0 -96
  78. package/src/cfg/generated/cfg__ipc__ipcrpc_testing/models.ts +0 -88
  79. /package/src/cfg/generated/{cfg__ipc__ipcrpc_monitoring → cfg__centrifugo__centrifugo_admin_api}/index.ts +0 -0
  80. /package/src/cfg/generated/{cfg__ipc__ipcrpc_testing → cfg__centrifugo__centrifugo_monitoring}/index.ts +0 -0
@@ -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,8 +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__ipc__ipcrpc_monitoring'
30
- export * from './cfg__ipc__ipcrpc_testing'
29
+ export * from './cfg__centrifugo__centrifugo_admin_api'
30
+ export * from './cfg__centrifugo__centrifugo_monitoring'
31
+ export * from './cfg__centrifugo__centrifugo_testing'
31
32
  export * from './cfg__leads__lead_submission'
32
33
  export * from './cfg__newsletter__logs'
33
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>