@djangocfg/api 1.2.5 → 1.2.6
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 +3407 -1386
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2418 -409
- package/dist/index.d.ts +2418 -409
- package/dist/index.mjs +3309 -1304
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/contexts/TasksContext.tsx +242 -0
- package/src/cfg/contexts/index.ts +3 -0
- package/src/cfg/generated/_utils/fetchers/cfg__accounts.ts +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__accounts__auth.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__accounts__user_profile.ts +6 -6
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo.ts +62 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_admin_api.ts +12 -12
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_monitoring.ts +25 -25
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_testing.ts +8 -8
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard.ts +150 -0
- package/src/cfg/generated/_utils/fetchers/cfg__endpoints.ts +30 -1
- package/src/cfg/generated/_utils/fetchers/cfg__health.ts +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__knowbase.ts +57 -57
- package/src/cfg/generated/_utils/fetchers/cfg__leads.ts +6 -6
- package/src/cfg/generated/_utils/fetchers/cfg__leads__lead_submission.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter.ts +3 -3
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__bulk_email.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__campaigns.ts +6 -6
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__logs.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__newsletters.ts +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__subscriptions.ts +3 -3
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__testing.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__payments.ts +8 -8
- package/src/cfg/generated/_utils/fetchers/cfg__support.ts +12 -12
- package/src/cfg/generated/_utils/fetchers/cfg__tasks.ts +10 -10
- package/src/cfg/generated/_utils/fetchers/index.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo.ts +49 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_monitoring.ts +20 -20
- package/src/cfg/generated/_utils/hooks/cfg__dashboard.ts +137 -0
- package/src/cfg/generated/_utils/hooks/cfg__endpoints.ts +29 -0
- package/src/cfg/generated/_utils/hooks/index.ts +2 -0
- package/src/cfg/generated/_utils/schemas/ActivityEntry.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/AppStatistics.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/CentrifugoClientInfo.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/CentrifugoPublication.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ChannelStatsSerializer.schema.ts +1 -0
- package/src/cfg/generated/_utils/schemas/DashboardOverview.schema.ts +27 -0
- package/src/cfg/generated/_utils/schemas/ManualAckResponse.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PublishTestResponse.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/QuickAction.schema.ts +29 -0
- package/src/cfg/generated/_utils/schemas/RecentPublishes.schema.ts +2 -0
- package/src/cfg/generated/_utils/schemas/StatCard.schema.ts +30 -0
- package/src/cfg/generated/_utils/schemas/SystemHealth.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/SystemHealthItem.schema.ts +28 -0
- package/src/cfg/generated/_utils/schemas/SystemMetrics.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/URLPattern.schema.ts +26 -0
- package/src/cfg/generated/_utils/schemas/URLsList.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/UserStatistics.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/index.ts +11 -0
- package/src/cfg/generated/cfg__centrifugo/client.ts +30 -0
- package/src/cfg/generated/cfg__centrifugo/index.ts +2 -0
- package/src/cfg/generated/cfg__centrifugo/models.ts +0 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/models.ts +6 -6
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/client.ts +32 -32
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/models.ts +18 -12
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/models.ts +2 -2
- package/src/cfg/generated/cfg__dashboard/client.ts +106 -0
- package/src/cfg/generated/cfg__dashboard/index.ts +2 -0
- package/src/cfg/generated/cfg__dashboard/models.ts +108 -0
- package/src/cfg/generated/cfg__endpoints/client.ts +16 -0
- package/src/cfg/generated/cfg__endpoints/models.ts +44 -0
- package/src/cfg/generated/client.ts +6 -0
- package/src/cfg/generated/enums.ts +56 -0
- package/src/cfg/generated/index.ts +17 -10
- package/src/cfg/generated/schema.ts +1546 -127
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "DjangoCFG",
|
|
6
6
|
"url": "https://djangocfg.com"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "^22.15.3",
|
|
69
69
|
"@types/react": "19.2.2",
|
|
70
70
|
"@types/react-dom": "19.2.1",
|
|
71
|
-
"@djangocfg/typescript-config": "^1.2.
|
|
71
|
+
"@djangocfg/typescript-config": "^1.2.6",
|
|
72
72
|
"react": "^19.1.0",
|
|
73
73
|
"react-dom": "^19.1.0",
|
|
74
74
|
"tsup": "^8.5.0",
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, ReactNode } from 'react';
|
|
4
|
+
import { useSWRConfig } from 'swr';
|
|
5
|
+
import { api } from '../BaseClient';
|
|
6
|
+
import {
|
|
7
|
+
useTasksApiTasksStatsRetrieve,
|
|
8
|
+
useTasksApiQueuesStatusRetrieve,
|
|
9
|
+
useTasksApiWorkersListRetrieve,
|
|
10
|
+
useCreateTasksApiClearCreate,
|
|
11
|
+
useCreateTasksApiClearQueuesCreate,
|
|
12
|
+
useCreateTasksApiPurgeFailedCreate,
|
|
13
|
+
useCreateTasksApiQueuesManageCreate,
|
|
14
|
+
useCreateTasksApiWorkersManageCreate,
|
|
15
|
+
} from '../generated/_utils/hooks/cfg__tasks';
|
|
16
|
+
import type { API } from '../generated';
|
|
17
|
+
import type {
|
|
18
|
+
TaskStatistics,
|
|
19
|
+
QueueStatus,
|
|
20
|
+
APIResponseRequest,
|
|
21
|
+
APIResponse,
|
|
22
|
+
QueueActionRequest,
|
|
23
|
+
QueueAction,
|
|
24
|
+
WorkerActionRequest,
|
|
25
|
+
WorkerAction,
|
|
26
|
+
} from '../generated/_utils/schemas';
|
|
27
|
+
|
|
28
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
29
|
+
// Context Type
|
|
30
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
interface TasksContextValue {
|
|
33
|
+
// Statistics
|
|
34
|
+
stats: TaskStatistics | undefined;
|
|
35
|
+
isLoadingStats: boolean;
|
|
36
|
+
statsError: Error | null;
|
|
37
|
+
|
|
38
|
+
// Queues
|
|
39
|
+
queues: QueueStatus | undefined;
|
|
40
|
+
isLoadingQueues: boolean;
|
|
41
|
+
queuesError: Error | null;
|
|
42
|
+
|
|
43
|
+
// Workers
|
|
44
|
+
workers: APIResponse | undefined;
|
|
45
|
+
isLoadingWorkers: boolean;
|
|
46
|
+
workersError: Error | null;
|
|
47
|
+
|
|
48
|
+
// Management operations
|
|
49
|
+
clearTasks: (data: APIResponseRequest) => Promise<APIResponse>;
|
|
50
|
+
clearQueues: (data: APIResponseRequest) => Promise<APIResponse>;
|
|
51
|
+
purgeFailedTasks: (data: APIResponseRequest) => Promise<APIResponse>;
|
|
52
|
+
queueAction: (data: QueueActionRequest) => Promise<QueueAction>;
|
|
53
|
+
workerAction: (data: WorkerActionRequest) => Promise<WorkerAction>;
|
|
54
|
+
|
|
55
|
+
// Refresh functions
|
|
56
|
+
refreshStats: () => void;
|
|
57
|
+
refreshQueues: () => void;
|
|
58
|
+
refreshWorkers: () => void;
|
|
59
|
+
refreshAll: () => void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
63
|
+
// Context
|
|
64
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
const TasksContext = createContext<TasksContextValue | undefined>(undefined);
|
|
67
|
+
|
|
68
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
69
|
+
// Provider Props
|
|
70
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
interface TasksProviderProps {
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
autoRefresh?: boolean;
|
|
75
|
+
refreshInterval?: number; // in milliseconds
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
79
|
+
// Provider Component
|
|
80
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
81
|
+
|
|
82
|
+
export function TasksProvider({
|
|
83
|
+
children,
|
|
84
|
+
autoRefresh = false,
|
|
85
|
+
refreshInterval = 5000,
|
|
86
|
+
}: TasksProviderProps) {
|
|
87
|
+
const { mutate } = useSWRConfig();
|
|
88
|
+
|
|
89
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
90
|
+
// Fetch Statistics
|
|
91
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
92
|
+
|
|
93
|
+
const {
|
|
94
|
+
data: stats,
|
|
95
|
+
error: statsError,
|
|
96
|
+
isLoading: isLoadingStats,
|
|
97
|
+
mutate: mutateStats,
|
|
98
|
+
} = useTasksApiTasksStatsRetrieve(api as unknown as API);
|
|
99
|
+
|
|
100
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
101
|
+
// Fetch Queues
|
|
102
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
const {
|
|
105
|
+
data: queues,
|
|
106
|
+
error: queuesError,
|
|
107
|
+
isLoading: isLoadingQueues,
|
|
108
|
+
mutate: mutateQueues,
|
|
109
|
+
} = useTasksApiQueuesStatusRetrieve(api as unknown as API);
|
|
110
|
+
|
|
111
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
112
|
+
// Fetch Workers
|
|
113
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
const {
|
|
116
|
+
data: workers,
|
|
117
|
+
error: workersError,
|
|
118
|
+
isLoading: isLoadingWorkers,
|
|
119
|
+
mutate: mutateWorkers,
|
|
120
|
+
} = useTasksApiWorkersListRetrieve(api as unknown as API);
|
|
121
|
+
|
|
122
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
123
|
+
// Mutation Hooks
|
|
124
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
125
|
+
|
|
126
|
+
const clearTasksMutation = useCreateTasksApiClearCreate();
|
|
127
|
+
const clearQueuesMutation = useCreateTasksApiClearQueuesCreate();
|
|
128
|
+
const purgeFailedMutation = useCreateTasksApiPurgeFailedCreate();
|
|
129
|
+
const queueActionMutation = useCreateTasksApiQueuesManageCreate();
|
|
130
|
+
const workerActionMutation = useCreateTasksApiWorkersManageCreate();
|
|
131
|
+
|
|
132
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
133
|
+
// Operations
|
|
134
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
const clearTasks = async (data: APIResponseRequest): Promise<APIResponse> => {
|
|
137
|
+
const result = await clearTasksMutation(data, api as unknown as API);
|
|
138
|
+
// Refresh all data after clearing
|
|
139
|
+
await mutateStats();
|
|
140
|
+
await mutateQueues();
|
|
141
|
+
return result as APIResponse;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const clearQueues = async (data: APIResponseRequest): Promise<APIResponse> => {
|
|
145
|
+
const result = await clearQueuesMutation(data, api as unknown as API);
|
|
146
|
+
await mutateQueues();
|
|
147
|
+
await mutateStats();
|
|
148
|
+
return result as APIResponse;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const purgeFailedTasks = async (data: APIResponseRequest): Promise<APIResponse> => {
|
|
152
|
+
const result = await purgeFailedMutation(data, api as unknown as API);
|
|
153
|
+
await mutateStats();
|
|
154
|
+
await mutateQueues();
|
|
155
|
+
return result as APIResponse;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const queueAction = async (data: QueueActionRequest): Promise<QueueAction> => {
|
|
159
|
+
const result = await queueActionMutation(data, api as unknown as API);
|
|
160
|
+
await mutateQueues();
|
|
161
|
+
await mutateStats();
|
|
162
|
+
return result as QueueAction;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const workerAction = async (data: WorkerActionRequest): Promise<WorkerAction> => {
|
|
166
|
+
const result = await workerActionMutation(data, api as unknown as API);
|
|
167
|
+
await mutateWorkers();
|
|
168
|
+
await mutateStats();
|
|
169
|
+
return result as WorkerAction;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
173
|
+
// Refresh Functions
|
|
174
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
175
|
+
|
|
176
|
+
const refreshStats = () => mutateStats();
|
|
177
|
+
const refreshQueues = () => mutateQueues();
|
|
178
|
+
const refreshWorkers = () => mutateWorkers();
|
|
179
|
+
const refreshAll = () => {
|
|
180
|
+
mutateStats();
|
|
181
|
+
mutateQueues();
|
|
182
|
+
mutateWorkers();
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
186
|
+
// Context Value
|
|
187
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
const value: TasksContextValue = {
|
|
190
|
+
// Statistics
|
|
191
|
+
stats,
|
|
192
|
+
isLoadingStats,
|
|
193
|
+
statsError,
|
|
194
|
+
|
|
195
|
+
// Queues
|
|
196
|
+
queues,
|
|
197
|
+
isLoadingQueues,
|
|
198
|
+
queuesError,
|
|
199
|
+
|
|
200
|
+
// Workers
|
|
201
|
+
workers,
|
|
202
|
+
isLoadingWorkers,
|
|
203
|
+
workersError,
|
|
204
|
+
|
|
205
|
+
// Operations
|
|
206
|
+
clearTasks,
|
|
207
|
+
clearQueues,
|
|
208
|
+
purgeFailedTasks,
|
|
209
|
+
queueAction,
|
|
210
|
+
workerAction,
|
|
211
|
+
|
|
212
|
+
// Refresh
|
|
213
|
+
refreshStats,
|
|
214
|
+
refreshQueues,
|
|
215
|
+
refreshWorkers,
|
|
216
|
+
refreshAll,
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<TasksContext.Provider value={value}>
|
|
221
|
+
{children}
|
|
222
|
+
</TasksContext.Provider>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
227
|
+
// Hook
|
|
228
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
229
|
+
|
|
230
|
+
export function useTasks() {
|
|
231
|
+
const context = useContext(TasksContext);
|
|
232
|
+
if (context === undefined) {
|
|
233
|
+
throw new Error('useTasks must be used within a TasksProvider');
|
|
234
|
+
}
|
|
235
|
+
return context;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
239
|
+
// Exports
|
|
240
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
241
|
+
|
|
242
|
+
export type { TasksContextValue, TasksProviderProps };
|
|
@@ -46,3 +46,6 @@ export * from './payments';
|
|
|
46
46
|
// Knowbase (Chat, Documents, Sessions)
|
|
47
47
|
export * from './knowbase';
|
|
48
48
|
|
|
49
|
+
// Tasks (Dramatiq Task Management)
|
|
50
|
+
export { TasksProvider, useTasks } from './TasksContext';
|
|
51
|
+
export type { TasksContextValue, TasksProviderProps } from './TasksContext';
|
|
@@ -42,7 +42,7 @@ import type { API } from '../../index'
|
|
|
42
42
|
* @method POST
|
|
43
43
|
* @path /cfg/accounts/otp/request/
|
|
44
44
|
*/
|
|
45
|
-
export async function createAccountsOtpRequestCreate( data: OTPRequestRequest, client
|
|
45
|
+
export async function createAccountsOtpRequestCreate( data: OTPRequestRequest, client?: API
|
|
46
46
|
): Promise<OTPRequestResponse> {
|
|
47
47
|
const api = client || getAPIInstance()
|
|
48
48
|
const response = await api.cfg_accounts.otpRequestCreate(data)
|
|
@@ -56,7 +56,7 @@ export async function createAccountsOtpRequestCreate( data: OTPRequestRequest,
|
|
|
56
56
|
* @method POST
|
|
57
57
|
* @path /cfg/accounts/otp/verify/
|
|
58
58
|
*/
|
|
59
|
-
export async function createAccountsOtpVerifyCreate( data: OTPVerifyRequest, client
|
|
59
|
+
export async function createAccountsOtpVerifyCreate( data: OTPVerifyRequest, client?: API
|
|
60
60
|
): Promise<OTPVerifyResponse> {
|
|
61
61
|
const api = client || getAPIInstance()
|
|
62
62
|
const response = await api.cfg_accounts.otpVerifyCreate(data)
|
|
@@ -40,7 +40,7 @@ import type { API } from '../../index'
|
|
|
40
40
|
* @method POST
|
|
41
41
|
* @path /cfg/accounts/token/refresh/
|
|
42
42
|
*/
|
|
43
|
-
export async function createAccountsTokenRefreshCreate( data: TokenRefreshRequest, client
|
|
43
|
+
export async function createAccountsTokenRefreshCreate( data: TokenRefreshRequest, client?: API
|
|
44
44
|
): Promise<TokenRefresh> {
|
|
45
45
|
const api = client || getAPIInstance()
|
|
46
46
|
const response = await api.cfg_auth.accountsTokenRefreshCreate(data)
|
|
@@ -41,7 +41,7 @@ import type { API } from '../../index'
|
|
|
41
41
|
* @method GET
|
|
42
42
|
* @path /cfg/accounts/profile/
|
|
43
43
|
*/
|
|
44
|
-
export async function getAccountsProfileRetrieve( client
|
|
44
|
+
export async function getAccountsProfileRetrieve( client?: API
|
|
45
45
|
): Promise<User> {
|
|
46
46
|
const api = client || getAPIInstance()
|
|
47
47
|
const response = await api.cfg_user_profile.accountsProfileRetrieve()
|
|
@@ -55,7 +55,7 @@ export async function getAccountsProfileRetrieve( client?
|
|
|
55
55
|
* @method POST
|
|
56
56
|
* @path /cfg/accounts/profile/avatar/
|
|
57
57
|
*/
|
|
58
|
-
export async function createAccountsProfileAvatarCreate( data: any, client
|
|
58
|
+
export async function createAccountsProfileAvatarCreate( data: any, client?: API
|
|
59
59
|
): Promise<User> {
|
|
60
60
|
const api = client || getAPIInstance()
|
|
61
61
|
const response = await api.cfg_user_profile.accountsProfileAvatarCreate(data)
|
|
@@ -69,7 +69,7 @@ export async function createAccountsProfileAvatarCreate( data: any, client?
|
|
|
69
69
|
* @method PUT
|
|
70
70
|
* @path /cfg/accounts/profile/partial/
|
|
71
71
|
*/
|
|
72
|
-
export async function partialUpdateAccountsProfilePartialUpdate( data: UserProfileUpdateRequest, client
|
|
72
|
+
export async function partialUpdateAccountsProfilePartialUpdate( data: UserProfileUpdateRequest, client?: API
|
|
73
73
|
): Promise<User> {
|
|
74
74
|
const api = client || getAPIInstance()
|
|
75
75
|
const response = await api.cfg_user_profile.accountsProfilePartialUpdate(data)
|
|
@@ -83,7 +83,7 @@ export async function partialUpdateAccountsProfilePartialUpdate( data: UserProf
|
|
|
83
83
|
* @method PATCH
|
|
84
84
|
* @path /cfg/accounts/profile/partial/
|
|
85
85
|
*/
|
|
86
|
-
export async function partialUpdateAccountsProfilePartialPartialUpdate( data?: PatchedUserProfileUpdateRequest, client
|
|
86
|
+
export async function partialUpdateAccountsProfilePartialPartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: API
|
|
87
87
|
): Promise<User> {
|
|
88
88
|
const api = client || getAPIInstance()
|
|
89
89
|
const response = await api.cfg_user_profile.accountsProfilePartialPartialUpdate(data)
|
|
@@ -97,7 +97,7 @@ export async function partialUpdateAccountsProfilePartialPartialUpdate( data?:
|
|
|
97
97
|
* @method PUT
|
|
98
98
|
* @path /cfg/accounts/profile/update/
|
|
99
99
|
*/
|
|
100
|
-
export async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdateRequest, client
|
|
100
|
+
export async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdateRequest, client?: API
|
|
101
101
|
): Promise<User> {
|
|
102
102
|
const api = client || getAPIInstance()
|
|
103
103
|
const response = await api.cfg_user_profile.accountsProfileUpdateUpdate(data)
|
|
@@ -111,7 +111,7 @@ export async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdat
|
|
|
111
111
|
* @method PATCH
|
|
112
112
|
* @path /cfg/accounts/profile/update/
|
|
113
113
|
*/
|
|
114
|
-
export async function partialUpdateAccountsProfileUpdatePartialUpdate( data?: PatchedUserProfileUpdateRequest, client
|
|
114
|
+
export async function partialUpdateAccountsProfileUpdatePartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: API
|
|
115
115
|
): Promise<User> {
|
|
116
116
|
const api = client || getAPIInstance()
|
|
117
117
|
const response = await api.cfg_user_profile.accountsProfileUpdatePartialUpdate(data)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed fetchers for Centrifugo
|
|
3
|
+
*
|
|
4
|
+
* Universal functions that work in any environment:
|
|
5
|
+
* - Next.js (App Router / Pages Router / Server Components)
|
|
6
|
+
* - React Native
|
|
7
|
+
* - Node.js backend
|
|
8
|
+
*
|
|
9
|
+
* These fetchers use Zod schemas for runtime validation.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Configure API once (in your app entry point)
|
|
14
|
+
* import { configureAPI } from '../../api-instance'
|
|
15
|
+
* configureAPI({ baseUrl: 'https://api.example.com' })
|
|
16
|
+
*
|
|
17
|
+
* // Then use fetchers anywhere
|
|
18
|
+
* const users = await getUsers({ page: 1 })
|
|
19
|
+
*
|
|
20
|
+
* // With SWR
|
|
21
|
+
* const { data } = useSWR(['users', params], () => getUsers(params))
|
|
22
|
+
*
|
|
23
|
+
* // With React Query
|
|
24
|
+
* const { data } = useQuery(['users', params], () => getUsers(params))
|
|
25
|
+
*
|
|
26
|
+
* // In Server Component or SSR (pass custom client)
|
|
27
|
+
* import { API } from '../../index'
|
|
28
|
+
* const api = new API('https://api.example.com')
|
|
29
|
+
* const users = await getUsers({ page: 1 }, api)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { getAPIInstance } from '../../api-instance'
|
|
33
|
+
import type { API } from '../../index'
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* API operation
|
|
37
|
+
*
|
|
38
|
+
* @method GET
|
|
39
|
+
* @path /cfg/centrifugo/admin/api/monitor/channels/
|
|
40
|
+
*/
|
|
41
|
+
export async function getCentrifugoAdminApiMonitorChannelsRetrieve( client?: API
|
|
42
|
+
): Promise<any> {
|
|
43
|
+
const api = client || getAPIInstance()
|
|
44
|
+
const response = await api.cfg_centrifugo.adminApiMonitorChannelsRetrieve()
|
|
45
|
+
return response
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* API operation
|
|
51
|
+
*
|
|
52
|
+
* @method GET
|
|
53
|
+
* @path /cfg/centrifugo/monitor/channels/
|
|
54
|
+
*/
|
|
55
|
+
export async function getCentrifugoMonitorChannelsRetrieve( client?: API
|
|
56
|
+
): Promise<any> {
|
|
57
|
+
const api = client || getAPIInstance()
|
|
58
|
+
const response = await api.cfg_centrifugo.monitorChannelsRetrieve()
|
|
59
|
+
return response
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
@@ -47,7 +47,7 @@ import type { API } from '../../index'
|
|
|
47
47
|
* @method POST
|
|
48
48
|
* @path /cfg/centrifugo/admin/api/server/auth/token/
|
|
49
49
|
*/
|
|
50
|
-
export async function createCentrifugoAdminApiServerAuthTokenCreate( client
|
|
50
|
+
export async function createCentrifugoAdminApiServerAuthTokenCreate( client?: API
|
|
51
51
|
): Promise<any> {
|
|
52
52
|
const api = client || getAPIInstance()
|
|
53
53
|
const response = await api.cfg_centrifugo_admin_api.serverAuthTokenCreate()
|
|
@@ -61,7 +61,7 @@ export async function createCentrifugoAdminApiServerAuthTokenCreate( client?
|
|
|
61
61
|
* @method POST
|
|
62
62
|
* @path /cfg/centrifugo/admin/api/server/channels/
|
|
63
63
|
*/
|
|
64
|
-
export async function createCentrifugoAdminApiServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client
|
|
64
|
+
export async function createCentrifugoAdminApiServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client?: API
|
|
65
65
|
): Promise<CentrifugoChannelsResponse> {
|
|
66
66
|
const api = client || getAPIInstance()
|
|
67
67
|
const response = await api.cfg_centrifugo_admin_api.serverChannelsCreate(data)
|
|
@@ -75,7 +75,7 @@ export async function createCentrifugoAdminApiServerChannelsCreate( data: Centr
|
|
|
75
75
|
* @method POST
|
|
76
76
|
* @path /cfg/centrifugo/admin/api/server/history/
|
|
77
77
|
*/
|
|
78
|
-
export async function createCentrifugoAdminApiServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client
|
|
78
|
+
export async function createCentrifugoAdminApiServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client?: API
|
|
79
79
|
): Promise<CentrifugoHistoryResponse> {
|
|
80
80
|
const api = client || getAPIInstance()
|
|
81
81
|
const response = await api.cfg_centrifugo_admin_api.serverHistoryCreate(data)
|
|
@@ -89,7 +89,7 @@ export async function createCentrifugoAdminApiServerHistoryCreate( data: Centri
|
|
|
89
89
|
* @method POST
|
|
90
90
|
* @path /cfg/centrifugo/admin/api/server/info/
|
|
91
91
|
*/
|
|
92
|
-
export async function createCentrifugoAdminApiServerInfoCreate( client
|
|
92
|
+
export async function createCentrifugoAdminApiServerInfoCreate( client?: API
|
|
93
93
|
): Promise<CentrifugoInfoResponse> {
|
|
94
94
|
const api = client || getAPIInstance()
|
|
95
95
|
const response = await api.cfg_centrifugo_admin_api.serverInfoCreate()
|
|
@@ -103,7 +103,7 @@ export async function createCentrifugoAdminApiServerInfoCreate( client?
|
|
|
103
103
|
* @method POST
|
|
104
104
|
* @path /cfg/centrifugo/admin/api/server/presence/
|
|
105
105
|
*/
|
|
106
|
-
export async function createCentrifugoAdminApiServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client
|
|
106
|
+
export async function createCentrifugoAdminApiServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client?: API
|
|
107
107
|
): Promise<CentrifugoPresenceResponse> {
|
|
108
108
|
const api = client || getAPIInstance()
|
|
109
109
|
const response = await api.cfg_centrifugo_admin_api.serverPresenceCreate(data)
|
|
@@ -117,7 +117,7 @@ export async function createCentrifugoAdminApiServerPresenceCreate( data: Centr
|
|
|
117
117
|
* @method POST
|
|
118
118
|
* @path /cfg/centrifugo/admin/api/server/presence-stats/
|
|
119
119
|
*/
|
|
120
|
-
export async function createCentrifugoAdminApiServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client
|
|
120
|
+
export async function createCentrifugoAdminApiServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client?: API
|
|
121
121
|
): Promise<CentrifugoPresenceStatsResponse> {
|
|
122
122
|
const api = client || getAPIInstance()
|
|
123
123
|
const response = await api.cfg_centrifugo_admin_api.serverPresenceStatsCreate(data)
|
|
@@ -131,7 +131,7 @@ export async function createCentrifugoAdminApiServerPresenceStatsCreate( data:
|
|
|
131
131
|
* @method POST
|
|
132
132
|
* @path /cfg/centrifugo/server/auth/token/
|
|
133
133
|
*/
|
|
134
|
-
export async function createCentrifugoServerAuthTokenCreate( client
|
|
134
|
+
export async function createCentrifugoServerAuthTokenCreate( client?: API
|
|
135
135
|
): Promise<any> {
|
|
136
136
|
const api = client || getAPIInstance()
|
|
137
137
|
const response = await api.cfg_centrifugo_admin_api.centrifugoServerAuthTokenCreate()
|
|
@@ -145,7 +145,7 @@ export async function createCentrifugoServerAuthTokenCreate( client?
|
|
|
145
145
|
* @method POST
|
|
146
146
|
* @path /cfg/centrifugo/server/channels/
|
|
147
147
|
*/
|
|
148
|
-
export async function createCentrifugoServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client
|
|
148
|
+
export async function createCentrifugoServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client?: API
|
|
149
149
|
): Promise<CentrifugoChannelsResponse> {
|
|
150
150
|
const api = client || getAPIInstance()
|
|
151
151
|
const response = await api.cfg_centrifugo_admin_api.centrifugoServerChannelsCreate(data)
|
|
@@ -159,7 +159,7 @@ export async function createCentrifugoServerChannelsCreate( data: CentrifugoCha
|
|
|
159
159
|
* @method POST
|
|
160
160
|
* @path /cfg/centrifugo/server/history/
|
|
161
161
|
*/
|
|
162
|
-
export async function createCentrifugoServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client
|
|
162
|
+
export async function createCentrifugoServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client?: API
|
|
163
163
|
): Promise<CentrifugoHistoryResponse> {
|
|
164
164
|
const api = client || getAPIInstance()
|
|
165
165
|
const response = await api.cfg_centrifugo_admin_api.centrifugoServerHistoryCreate(data)
|
|
@@ -173,7 +173,7 @@ export async function createCentrifugoServerHistoryCreate( data: CentrifugoHist
|
|
|
173
173
|
* @method POST
|
|
174
174
|
* @path /cfg/centrifugo/server/info/
|
|
175
175
|
*/
|
|
176
|
-
export async function createCentrifugoServerInfoCreate( client
|
|
176
|
+
export async function createCentrifugoServerInfoCreate( client?: API
|
|
177
177
|
): Promise<CentrifugoInfoResponse> {
|
|
178
178
|
const api = client || getAPIInstance()
|
|
179
179
|
const response = await api.cfg_centrifugo_admin_api.centrifugoServerInfoCreate()
|
|
@@ -187,7 +187,7 @@ export async function createCentrifugoServerInfoCreate( client?
|
|
|
187
187
|
* @method POST
|
|
188
188
|
* @path /cfg/centrifugo/server/presence/
|
|
189
189
|
*/
|
|
190
|
-
export async function createCentrifugoServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client
|
|
190
|
+
export async function createCentrifugoServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client?: API
|
|
191
191
|
): Promise<CentrifugoPresenceResponse> {
|
|
192
192
|
const api = client || getAPIInstance()
|
|
193
193
|
const response = await api.cfg_centrifugo_admin_api.centrifugoServerPresenceCreate(data)
|
|
@@ -201,7 +201,7 @@ export async function createCentrifugoServerPresenceCreate( data: CentrifugoPre
|
|
|
201
201
|
* @method POST
|
|
202
202
|
* @path /cfg/centrifugo/server/presence-stats/
|
|
203
203
|
*/
|
|
204
|
-
export async function createCentrifugoServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client
|
|
204
|
+
export async function createCentrifugoServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client?: API
|
|
205
205
|
): Promise<CentrifugoPresenceStatsResponse> {
|
|
206
206
|
const api = client || getAPIInstance()
|
|
207
207
|
const response = await api.cfg_centrifugo_admin_api.centrifugoServerPresenceStatsCreate(data)
|
|
@@ -36,27 +36,13 @@ import { RecentPublishesSchema, type RecentPublishes } from '../schemas/RecentPu
|
|
|
36
36
|
import { getAPIInstance } from '../../api-instance'
|
|
37
37
|
import type { API } from '../../index'
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Get channel statistics
|
|
41
|
-
*
|
|
42
|
-
* @method GET
|
|
43
|
-
* @path /cfg/centrifugo/admin/api/monitor/channels/
|
|
44
|
-
*/
|
|
45
|
-
export async function getCentrifugoAdminApiMonitorChannelsRetrieve( params?: { hours?: number }, client?
|
|
46
|
-
): Promise<ChannelList> {
|
|
47
|
-
const api = client || getAPIInstance()
|
|
48
|
-
const response = await api.cfg_centrifugo_monitoring.centrifugoAdminApiMonitorChannelsRetrieve(params?.hours)
|
|
49
|
-
return ChannelListSchema.parse(response)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
39
|
/**
|
|
54
40
|
* Get Centrifugo health status
|
|
55
41
|
*
|
|
56
42
|
* @method GET
|
|
57
43
|
* @path /cfg/centrifugo/admin/api/monitor/health/
|
|
58
44
|
*/
|
|
59
|
-
export async function getCentrifugoAdminApiMonitorHealthRetrieve( client
|
|
45
|
+
export async function getCentrifugoAdminApiMonitorHealthRetrieve( client?: API
|
|
60
46
|
): Promise<HealthCheck> {
|
|
61
47
|
const api = client || getAPIInstance()
|
|
62
48
|
const response = await api.cfg_centrifugo_monitoring.centrifugoAdminApiMonitorHealthRetrieve()
|
|
@@ -70,7 +56,7 @@ export async function getCentrifugoAdminApiMonitorHealthRetrieve( client?
|
|
|
70
56
|
* @method GET
|
|
71
57
|
* @path /cfg/centrifugo/admin/api/monitor/overview/
|
|
72
58
|
*/
|
|
73
|
-
export async function getCentrifugoAdminApiMonitorOverviewRetrieve( params?: { hours?: number }, client
|
|
59
|
+
export async function getCentrifugoAdminApiMonitorOverviewRetrieve( params?: { hours?: number }, client?: API
|
|
74
60
|
): Promise<OverviewStats> {
|
|
75
61
|
const api = client || getAPIInstance()
|
|
76
62
|
const response = await api.cfg_centrifugo_monitoring.centrifugoAdminApiMonitorOverviewRetrieve(params?.hours)
|
|
@@ -84,10 +70,10 @@ export async function getCentrifugoAdminApiMonitorOverviewRetrieve( params?: {
|
|
|
84
70
|
* @method GET
|
|
85
71
|
* @path /cfg/centrifugo/admin/api/monitor/publishes/
|
|
86
72
|
*/
|
|
87
|
-
export async function getCentrifugoAdminApiMonitorPublishesRetrieve( params?: { channel?: string; count?: number }, client
|
|
73
|
+
export async function getCentrifugoAdminApiMonitorPublishesRetrieve( params?: { channel?: string; count?: number; offset?: number; status?: string }, client?: API
|
|
88
74
|
): Promise<RecentPublishes> {
|
|
89
75
|
const api = client || getAPIInstance()
|
|
90
|
-
const response = await api.cfg_centrifugo_monitoring.centrifugoAdminApiMonitorPublishesRetrieve(params?.channel, params?.count)
|
|
76
|
+
const response = await api.cfg_centrifugo_monitoring.centrifugoAdminApiMonitorPublishesRetrieve(params?.channel, params?.count, params?.offset, params?.status)
|
|
91
77
|
return RecentPublishesSchema.parse(response)
|
|
92
78
|
}
|
|
93
79
|
|
|
@@ -96,12 +82,12 @@ export async function getCentrifugoAdminApiMonitorPublishesRetrieve( params?: {
|
|
|
96
82
|
* Get channel statistics
|
|
97
83
|
*
|
|
98
84
|
* @method GET
|
|
99
|
-
* @path /cfg/centrifugo/monitor/
|
|
85
|
+
* @path /cfg/centrifugo/admin/api/monitor/timeline/
|
|
100
86
|
*/
|
|
101
|
-
export async function
|
|
87
|
+
export async function getCentrifugoAdminApiMonitorTimelineRetrieve( params?: { hours?: number; interval?: string }, client?: API
|
|
102
88
|
): Promise<ChannelList> {
|
|
103
89
|
const api = client || getAPIInstance()
|
|
104
|
-
const response = await api.cfg_centrifugo_monitoring.
|
|
90
|
+
const response = await api.cfg_centrifugo_monitoring.centrifugoAdminApiMonitorTimelineRetrieve(params?.hours, params?.interval)
|
|
105
91
|
return ChannelListSchema.parse(response)
|
|
106
92
|
}
|
|
107
93
|
|
|
@@ -112,7 +98,7 @@ export async function getCentrifugoMonitorChannelsRetrieve( params?: { hours?:
|
|
|
112
98
|
* @method GET
|
|
113
99
|
* @path /cfg/centrifugo/monitor/health/
|
|
114
100
|
*/
|
|
115
|
-
export async function getCentrifugoMonitorHealthRetrieve( client
|
|
101
|
+
export async function getCentrifugoMonitorHealthRetrieve( client?: API
|
|
116
102
|
): Promise<HealthCheck> {
|
|
117
103
|
const api = client || getAPIInstance()
|
|
118
104
|
const response = await api.cfg_centrifugo_monitoring.centrifugoMonitorHealthRetrieve()
|
|
@@ -126,7 +112,7 @@ export async function getCentrifugoMonitorHealthRetrieve( client?
|
|
|
126
112
|
* @method GET
|
|
127
113
|
* @path /cfg/centrifugo/monitor/overview/
|
|
128
114
|
*/
|
|
129
|
-
export async function getCentrifugoMonitorOverviewRetrieve( params?: { hours?: number }, client
|
|
115
|
+
export async function getCentrifugoMonitorOverviewRetrieve( params?: { hours?: number }, client?: API
|
|
130
116
|
): Promise<OverviewStats> {
|
|
131
117
|
const api = client || getAPIInstance()
|
|
132
118
|
const response = await api.cfg_centrifugo_monitoring.centrifugoMonitorOverviewRetrieve(params?.hours)
|
|
@@ -140,11 +126,25 @@ export async function getCentrifugoMonitorOverviewRetrieve( params?: { hours?:
|
|
|
140
126
|
* @method GET
|
|
141
127
|
* @path /cfg/centrifugo/monitor/publishes/
|
|
142
128
|
*/
|
|
143
|
-
export async function getCentrifugoMonitorPublishesRetrieve( params?: { channel?: string; count?: number }, client
|
|
129
|
+
export async function getCentrifugoMonitorPublishesRetrieve( params?: { channel?: string; count?: number; offset?: number; status?: string }, client?: API
|
|
144
130
|
): Promise<RecentPublishes> {
|
|
145
131
|
const api = client || getAPIInstance()
|
|
146
|
-
const response = await api.cfg_centrifugo_monitoring.centrifugoMonitorPublishesRetrieve(params?.channel, params?.count)
|
|
132
|
+
const response = await api.cfg_centrifugo_monitoring.centrifugoMonitorPublishesRetrieve(params?.channel, params?.count, params?.offset, params?.status)
|
|
147
133
|
return RecentPublishesSchema.parse(response)
|
|
148
134
|
}
|
|
149
135
|
|
|
150
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Get channel statistics
|
|
139
|
+
*
|
|
140
|
+
* @method GET
|
|
141
|
+
* @path /cfg/centrifugo/monitor/timeline/
|
|
142
|
+
*/
|
|
143
|
+
export async function getCentrifugoMonitorTimelineRetrieve( params?: { hours?: number; interval?: string }, client?: API
|
|
144
|
+
): Promise<ChannelList> {
|
|
145
|
+
const api = client || getAPIInstance()
|
|
146
|
+
const response = await api.cfg_centrifugo_monitoring.centrifugoMonitorTimelineRetrieve(params?.hours, params?.interval)
|
|
147
|
+
return ChannelListSchema.parse(response)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|