Update self endpoints

This commit is contained in:
Andrew Kingston 2024-12-10 13:00:51 +00:00
parent cee53540a4
commit 610133551e
No known key found for this signature in database
2 changed files with 9 additions and 12 deletions

View File

@ -5,7 +5,6 @@ import {
import { BaseAPIClient } from "./types"
export interface RouteEndpoints {
// Missing request or response types
fetchClientAppRoutes: () => Promise<FetchClientScreenRoutingResponse>
fetchAppRoutes: () => Promise<FetchScreenRoutingResponse>
}

View File

@ -1,21 +1,19 @@
import {
ContextUser,
AppSelfResponse,
FetchAPIKeyResponse,
GenerateAPIKeyResponse,
GetGlobalSelfResponse,
UpdateSelfRequest,
UpdateSelfResponse,
User,
} from "@budibase/types"
import { BaseAPIClient } from "./types"
export interface SelfEndpoints {
updateSelf: (user: UpdateSelfRequest) => Promise<UpdateSelfResponse>
// Missing request or response types
generateAPIKey: () => Promise<any>
fetchDeveloperInfo: () => Promise<any>
// There are flags and session attributes mixed in to the user
fetchBuilderSelf: () => Promise<User & { [key: string]: any }>
fetchSelf: () => Promise<(ContextUser | {}) & { [key: string]: any }>
generateAPIKey: () => Promise<string | undefined>
fetchDeveloperInfo: () => Promise<FetchAPIKeyResponse>
fetchBuilderSelf: () => Promise<GetGlobalSelfResponse>
fetchSelf: () => Promise<AppSelfResponse>
}
export const buildSelfEndpoints = (API: BaseAPIClient): SelfEndpoints => ({
@ -24,7 +22,7 @@ export const buildSelfEndpoints = (API: BaseAPIClient): SelfEndpoints => ({
* assuming the user is a builder.
*/
generateAPIKey: async () => {
const response = await API.post<null, any>({
const response = await API.post<null, GenerateAPIKeyResponse>({
url: "/api/global/self/api_key",
})
return response?.apiKey