Update typing of app and analytics endpoints
This commit is contained in:
parent
de97219dfe
commit
739cab0c90
|
@ -1,8 +1,8 @@
|
||||||
import { BaseAPIClient } from "./types"
|
import { BaseAPIClient } from "./types"
|
||||||
import { AnalyticsPingRequest } from "@budibase/types"
|
import { AnalyticsEnabledResponse, AnalyticsPingRequest } from "@budibase/types"
|
||||||
|
|
||||||
export interface AnalyticsEndpoints {
|
export interface AnalyticsEndpoints {
|
||||||
getAnalyticsStatus: () => Promise<{ enabled: boolean }>
|
getAnalyticsStatus: () => Promise<AnalyticsEnabledResponse>
|
||||||
analyticsPing: (
|
analyticsPing: (
|
||||||
payload: Omit<AnalyticsPingRequest, "timezone">
|
payload: Omit<AnalyticsPingRequest, "timezone">
|
||||||
) => Promise<void>
|
) => Promise<void>
|
||||||
|
|
|
@ -2,11 +2,25 @@ import { sdk } from "@budibase/shared-core"
|
||||||
import { BaseAPIClient } from "./types"
|
import { BaseAPIClient } from "./types"
|
||||||
import {
|
import {
|
||||||
App,
|
App,
|
||||||
|
ClearDevLockResponse,
|
||||||
CreateAppRequest,
|
CreateAppRequest,
|
||||||
|
CreateAppResponse,
|
||||||
|
DeleteAppResponse,
|
||||||
DuplicateAppRequest,
|
DuplicateAppRequest,
|
||||||
DuplicateAppResponse,
|
DuplicateAppResponse,
|
||||||
|
FetchAppDefinitionResponse,
|
||||||
FetchAppPackageResponse,
|
FetchAppPackageResponse,
|
||||||
|
FetchAppsResponse,
|
||||||
|
FetchDeploymentResponse,
|
||||||
GetDiagnosticsResponse,
|
GetDiagnosticsResponse,
|
||||||
|
ImportToUpdateAppRequest,
|
||||||
|
ImportToUpdateAppResponse,
|
||||||
|
PublishAppResponse,
|
||||||
|
RevertAppClientResponse,
|
||||||
|
RevertAppResponse,
|
||||||
|
SetRevertableAppVersionRequest,
|
||||||
|
SyncAppResponse,
|
||||||
|
UpdateAppClientResponse,
|
||||||
UpdateAppRequest,
|
UpdateAppRequest,
|
||||||
UpdateAppResponse,
|
UpdateAppResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
@ -18,36 +32,36 @@ export interface AppEndpoints {
|
||||||
metadata: UpdateAppRequest
|
metadata: UpdateAppRequest
|
||||||
) => Promise<UpdateAppResponse>
|
) => Promise<UpdateAppResponse>
|
||||||
unpublishApp: (appId: string) => Promise<void>
|
unpublishApp: (appId: string) => Promise<void>
|
||||||
createApp: (app: CreateAppRequest) => Promise<App>
|
publishAppChanges: (appId: string) => Promise<PublishAppResponse>
|
||||||
deleteApp: (appId: string) => Promise<void>
|
revertAppChanges: (appId: string) => Promise<RevertAppResponse>
|
||||||
|
updateAppClientVersion: (appId: string) => Promise<UpdateAppClientResponse>
|
||||||
|
revertAppClientVersion: (appId: string) => Promise<RevertAppClientResponse>
|
||||||
|
releaseAppLock: (appId: string) => Promise<ClearDevLockResponse>
|
||||||
|
getAppDeployments: () => Promise<FetchDeploymentResponse>
|
||||||
|
createApp: (app: CreateAppRequest) => Promise<CreateAppResponse>
|
||||||
|
deleteApp: (appId: string) => Promise<DeleteAppResponse>
|
||||||
duplicateApp: (
|
duplicateApp: (
|
||||||
appId: string,
|
appId: string,
|
||||||
app: DuplicateAppRequest
|
app: DuplicateAppRequest
|
||||||
) => Promise<DuplicateAppResponse>
|
) => Promise<DuplicateAppResponse>
|
||||||
updateAppFromExport: (
|
updateAppFromExport: (
|
||||||
appId: string,
|
appId: string,
|
||||||
body: any
|
body: ImportToUpdateAppRequest
|
||||||
) => Promise<{ message: string }>
|
) => Promise<ImportToUpdateAppResponse>
|
||||||
fetchSystemDebugInfo: () => Promise<GetDiagnosticsResponse>
|
fetchSystemDebugInfo: () => Promise<GetDiagnosticsResponse>
|
||||||
syncApp: (appId: string) => Promise<{ message: string }>
|
syncApp: (appId: string) => Promise<SyncAppResponse>
|
||||||
getApps: () => Promise<App[]>
|
getApps: () => Promise<FetchAppsResponse>
|
||||||
fetchComponentLibDefinitions: (
|
fetchComponentLibDefinitions: (
|
||||||
appId: string
|
appId: string
|
||||||
) => Promise<{ [key: string]: any }>
|
) => Promise<FetchAppDefinitionResponse>
|
||||||
setRevertableVersion: (
|
setRevertableVersion: (
|
||||||
appId: string,
|
appId: string,
|
||||||
revertableVersion: string
|
revertableVersion: string
|
||||||
) => Promise<App>
|
) => Promise<void>
|
||||||
addSampleData: (appId: string) => Promise<void>
|
addSampleData: (appId: string) => Promise<void>
|
||||||
|
|
||||||
// Missing request or response types
|
// Missing request or response types
|
||||||
publishAppChanges: (appId: string) => Promise<any>
|
|
||||||
revertAppChanges: (appId: string) => Promise<any>
|
|
||||||
updateAppClientVersion: (appId: string) => Promise<any>
|
|
||||||
revertAppClientVersion: (appId: string) => Promise<any>
|
|
||||||
importApps: (apps: any) => Promise<any>
|
importApps: (apps: any) => Promise<any>
|
||||||
releaseAppLock: (appId: string) => Promise<any>
|
|
||||||
getAppDeployments: () => Promise<any>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
||||||
|
@ -259,7 +273,7 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
||||||
* @param revertableVersion the version number
|
* @param revertableVersion the version number
|
||||||
*/
|
*/
|
||||||
setRevertableVersion: async (appId, revertableVersion) => {
|
setRevertableVersion: async (appId, revertableVersion) => {
|
||||||
return await API.post({
|
return await API.post<SetRevertableAppVersionRequest>({
|
||||||
url: `/api/applications/${appId}/setRevertableVersion`,
|
url: `/api/applications/${appId}/setRevertableVersion`,
|
||||||
body: {
|
body: {
|
||||||
revertableVersion,
|
revertableVersion,
|
||||||
|
|
Loading…
Reference in New Issue