Standardise plurality and comments for untyped endpoints

This commit is contained in:
Andrew Kingston 2024-11-27 16:21:05 +00:00
parent fd1998616e
commit aeb0af6c88
No known key found for this signature in database
7 changed files with 18 additions and 17 deletions

View File

@ -40,7 +40,7 @@ export interface AppEndpoints {
) => Promise<App>
addSampleData: (appId: string) => Promise<void>
// TODO
// Missing request or response types
publishAppChanges: (appId: string) => Promise<any>
revertAppChanges: (appId: string) => Promise<any>
updateAppClientVersion: (appId: string) => Promise<any>

View File

@ -6,7 +6,7 @@ import {
} from "@budibase/types"
import { BaseAPIClient } from "./types"
export interface AuditLogsEndpoints {
export interface AuditLogEndpoints {
searchAuditLogs: (
opts: SearchAuditLogsRequest
) => Promise<SearchAuditLogsResponse>
@ -49,9 +49,9 @@ const buildOpts = (opts: SearchAuditLogsRequest) => {
return parsedOpts
}
export const buildAuditLogsEndpoints = (
export const buildAuditLogEndpoints = (
API: BaseAPIClient
): AuditLogsEndpoints => ({
): AuditLogEndpoints => ({
searchAuditLogs: async opts => {
return await API.post({
url: `/api/global/auditlogs/search`,

View File

@ -13,7 +13,7 @@ export interface AuthEndpoints {
resetCode: string
) => Promise<{ message: string }>
// TODO
// Missing request or response types
setInitInfo: (info: any) => Promise<void>
getInitInfo: () => Promise<any>
}

View File

@ -1,7 +1,7 @@
import { PutResponse } from "@budibase/types"
import { BaseAPIClient } from "./types"
export interface BackupsEndpoints {
export interface BackupEndpoints {
createManualBackup: (
appId: string
) => Promise<{ backupId: string; message: string }>
@ -24,9 +24,7 @@ export interface BackupsEndpoints {
searchBackups: (opts: any) => Promise<any>
}
export const buildBackupsEndpoints = (
API: BaseAPIClient
): BackupsEndpoints => ({
export const buildBackupEndpoints = (API: BaseAPIClient): BackupEndpoints => ({
searchBackups: async ({ appId, trigger, type, page, startDate, endDate }) => {
const opts: any = {}
if (page) {

View File

@ -38,10 +38,10 @@ import { buildViewV2Endpoints } from "./viewsV2"
import { buildLicensingEndpoints } from "./licensing"
import { buildGroupsEndpoints } from "./groups"
import { buildPluginEndpoints } from "./plugins"
import { buildBackupsEndpoints } from "./backups"
import { buildBackupEndpoints } from "./backups"
import { buildEnvironmentVariableEndpoints } from "./environmentVariables"
import { buildEventEndpoints } from "./events"
import { buildAuditLogsEndpoints } from "./auditLogs"
import { buildAuditLogEndpoints } from "./auditLogs"
import { buildLogsEndpoints } from "./logs"
import { buildMigrationEndpoints } from "./migrations"
import { buildRowActionEndpoints } from "./rowActions"
@ -274,10 +274,10 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
...buildLicensingEndpoints(API),
...buildGroupsEndpoints(API),
...buildPluginEndpoints(API),
...buildBackupsEndpoints(API),
...buildBackupEndpoints(API),
...buildEnvironmentVariableEndpoints(API),
...buildEventEndpoints(API),
...buildAuditLogsEndpoints(API),
...buildAuditLogEndpoints(API),
...buildLogsEndpoints(API),
...buildMigrationEndpoints(API),
viewV2: buildViewV2Endpoints(API),

View File

@ -2,9 +2,10 @@ import { AIEndpoints } from "./ai"
import { AnalyticsEndpoints } from "./analytics"
import { AppEndpoints } from "./app"
import { AttachmentEndpoints } from "./attachments"
import { AuditLogsEndpoints } from "./auditLogs"
import { AuditLogEndpoints } from "./auditLogs"
import { AuthEndpoints } from "./auth"
import { AutomationEndpoints } from "./automations"
import { BackupEndpoints } from "./backups"
export enum HTTPMethod {
POST = "POST",
@ -52,6 +53,7 @@ export type APIClient = BaseAPIClient &
AnalyticsEndpoints &
AppEndpoints &
AttachmentEndpoints &
AuditLogsEndpoints &
AuditLogEndpoints &
AuthEndpoints &
AutomationEndpoints & { [key: string]: any }
AutomationEndpoints &
BackupEndpoints & { [key: string]: any }

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"paths": {
"@budibase/types": ["../types/src"],
"@budibase/shared-core": ["../shared-core/src"]
"@budibase/shared-core": ["../shared-core/src"],
"@budibase/bbui": ["../bbui/src"]
}
}
}