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