diff --git a/packages/frontend-core/src/api/attachments.ts b/packages/frontend-core/src/api/attachments.ts index c7c24cfc11..31a8041cc1 100644 --- a/packages/frontend-core/src/api/attachments.ts +++ b/packages/frontend-core/src/api/attachments.ts @@ -1,5 +1,7 @@ import { DownloadAttachmentResponse, + GetSignedUploadUrlRequest, + GetSignedUploadUrlResponse, ProcessAttachmentResponse, } from "@budibase/types" import { BaseAPIClient } from "./types" @@ -10,13 +12,11 @@ export interface AttachmentEndpoints { rowId: string, columnName: string ) => Promise - - // Missing request or response types getSignedDatasourceURL: ( datasourceId: string, bucket: string, key: string - ) => Promise<{ signedUrl: string; publicUrl: string }> + ) => Promise uploadAttachment: ( tableId: string, data: any @@ -41,7 +41,10 @@ export const buildAttachmentEndpoints = ( * @param key the name of the file to upload to */ getSignedDatasourceURL: async (datasourceId, bucket, key) => { - return await API.post({ + return await API.post< + GetSignedUploadUrlRequest, + GetSignedUploadUrlResponse + >({ url: `/api/attachments/${datasourceId}/url`, body: { bucket, key }, }) diff --git a/packages/frontend-core/src/api/auth.ts b/packages/frontend-core/src/api/auth.ts index 09fbcdc416..8f5fa21b49 100644 --- a/packages/frontend-core/src/api/auth.ts +++ b/packages/frontend-core/src/api/auth.ts @@ -1,26 +1,29 @@ import { + GetInitInfoResponse, LoginRequest, + LogoutResponse, PasswordResetRequest, + PasswordResetResponse, PasswordResetUpdateRequest, + PasswordResetUpdateResponse, + SetInitInfoRequest, } from "@budibase/types" import { BaseAPIClient } from "./types" export interface AuthEndpoints { logIn: (tenantId: string, username: string, password: string) => Promise - - // Missing request or response types - logOut: () => Promise<{ message: string }> + logOut: () => Promise requestForgotPassword: ( tenantId: string, email: string - ) => Promise<{ message: string }> + ) => Promise resetPassword: ( tenantId: string, password: string, resetCode: string - ) => Promise<{ message: string }> - setInitInfo: (info: any) => Promise - getInitInfo: () => Promise + ) => Promise + setInitInfo: (info: SetInitInfoRequest) => Promise + getInitInfo: () => Promise } export const buildAuthEndpoints = (API: BaseAPIClient): AuthEndpoints => ({ @@ -75,7 +78,7 @@ export const buildAuthEndpoints = (API: BaseAPIClient): AuthEndpoints => ({ * @param email the email address of the user */ requestForgotPassword: async (tenantId, email) => { - return await API.post({ + return await API.post({ url: `/api/global/auth/${tenantId}/reset`, body: { email, @@ -90,7 +93,10 @@ export const buildAuthEndpoints = (API: BaseAPIClient): AuthEndpoints => ({ * @param resetCode the reset code to authenticate the request */ resetPassword: async (tenantId, password, resetCode) => { - return await API.post({ + return await API.post< + PasswordResetUpdateRequest, + PasswordResetUpdateResponse + >({ url: `/api/global/auth/${tenantId}/reset/update`, body: { password,