This documentation is based on the FolderApiClient
class defined in src/data/client/folder-api-client.ts
.
Fetches all folders.
- Request Parameters: None
- Response:
- Success (
200 OK
):GetFoldersResponse
: An array ofFolderDTO
objects representing the folders.
- Success (
async get(): Promise<GetFoldersResponse> {
return this.request<GetFoldersResponse>('/api/folder', 'GET', FolderDTOEncSettings) as Promise<GetFoldersResponse>;
}
Updates a folder.
- Request Body:
PutFolderRequest
: AFolderDTO
object representing the folder to be updated.
- Response:
- Success (
200 OK
):PutFolderResponseSuccess
: Contains a message, the updatedFolderDTO
object, and a status code.
- Error (
400 Bad Request
):PutFolderResponseError
: Contains an error message, status code, and optional issues.
- Success (
async put(folder: PutFolderRequest): Promise<PutFolderResponse> {
return this.request<PutFolderResponse>('/api/folder', 'PUT', FolderDTOEncSettings, folder) as Promise<PutFolderResponse>;
}
Deletes a folder.
- Request Parameters:
id
(Path): The ID of the folder to be deleted.
- Response:
- Success (
200 OK
):DeleteFolderResponse
: Contains a message and a status code.
- Success (
async delete(folder: FolderDTO): Promise<DeleteFolderResponse> {
return this.request<DeleteFolderResponse>('/api/folder/' + folder.id, 'DELETE', { ecnryptedFields: [] }) as Promise<DeleteFolderResponse>;
}
Represents a folder in the system.
export interface FolderDTO {
id: number;
name: string;
description?: string;
createdAt: string;
updatedAt: string;
}
An array of FolderDTO
objects.
export type GetFoldersResponse = FolderDTO[];
A FolderDTO
object representing the folder to be updated.
export type PutFolderRequest = FolderDTO;
Represents a successful response for updating a folder.
export type PutFolderResponseSuccess = {
message: string;
data: FolderDTO;
status: 200;
};
Represents an error response for updating a folder.
export type PutFolderResponseError = {
message: string;
status: 400;
issues?: any[];
};
A union type of PutFolderResponseSuccess
and PutFolderResponseError
.
export type PutFolderResponse = PutFolderResponseSuccess | PutFolderResponseError;
Represents the response for deleting a folder.
export type DeleteFolderResponse = {
message: string;
status: 200;
};
For more details, see the source code.