mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-20 08:00:05 +01:00
feat: sdk migration in progress
This commit is contained in:
40
ui/src/api/me.ts
Normal file
40
ui/src/api/me.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { withRefresh } from "@/api/with-refresh.ts"
|
||||
import type {
|
||||
HandlersCreateUserKeyRequest,
|
||||
HandlersMeResponse,
|
||||
HandlersUpdateMeRequest,
|
||||
HandlersUserAPIKeyOut,
|
||||
ModelsUser,
|
||||
} from "@/sdk"
|
||||
import { makeMeApi, makeMeKeysApi } from "@/sdkClient.ts"
|
||||
|
||||
const me = makeMeApi()
|
||||
const keys = makeMeKeysApi()
|
||||
|
||||
export const meApi = {
|
||||
getMe: () =>
|
||||
withRefresh(async (): Promise<HandlersMeResponse> => {
|
||||
return await me.getMe()
|
||||
}),
|
||||
|
||||
updateMe: (body: HandlersUpdateMeRequest) =>
|
||||
withRefresh(async (): Promise<ModelsUser> => {
|
||||
return await me.updateMe({ body })
|
||||
}),
|
||||
|
||||
listKeys: () =>
|
||||
withRefresh(async (): Promise<HandlersUserAPIKeyOut[]> => {
|
||||
return await keys.listUserAPIKeys()
|
||||
}),
|
||||
|
||||
createKey: (body: HandlersCreateUserKeyRequest) =>
|
||||
withRefresh(async (): Promise<HandlersUserAPIKeyOut> => {
|
||||
return await keys.createUserAPIKey({ body })
|
||||
}),
|
||||
|
||||
deleteKey: (id: string) =>
|
||||
withRefresh(async (): Promise<boolean> => {
|
||||
await keys.deleteUserAPIKey({ id })
|
||||
return true
|
||||
}),
|
||||
}
|
||||
Reference in New Issue
Block a user