This documentation is based on the RecordApiClient
class defined in src/data/client/record-api-client.ts
.
Fetches records for a specific folder.
- Request Parameters:
folderId
(Query String): The ID of the folder to fetch records for.
- Response:
- Success (
200 OK
):GetRecordsResponse
: An array ofRecordDTO
objects representing the records in the folder.
- Success (
async get(folder: FolderDTO): Promise<GetRecordsResponse> {
return this.request<GetRecordsResponse>('/api/record?folderId=' + folder?.id, 'GET', RecordDTOEncSettings) as Promise<GetRecordsResponse>;
}
Updates a record.
- Request Body:
PutRecordRequest
: ARecordDTO
object representing the record to be updated.
- Response:
- Success (
200 OK
):PutRecordResponseSuccess
: Contains a message, the updatedRecordDTO
object, and a status code.
- Error (
400 Bad Request
):PutRecordResponseError
: Contains an error message, status code, and optional issues.
- Success (
async put(record: PutRecordRequest): Promise<PutRecordResponse> {
return this.request<PutRecordResponse>('/api/record', 'PUT', RecordDTOEncSettings, record) as Promise<PutRecordResponse>;
}
Deletes a record.
- Request Parameters:
id
(Path): The ID of the record to be deleted.
- Response:
- Success (
200 OK
):DeleteRecordResponse
: Contains a message and a status code.
- Success (
async delete(record: RecordDTO): Promise<DeleteRecordResponse> {
return this.request<DeleteRecordResponse>('/api/record/' + record.id, 'DELETE', { ecnryptedFields: [] }) as Promise<DeleteRecordResponse>;
}
Represents a record in the system.
export interface RecordDTO {
id: number;
folderId: number;
title: string;
tags: string;
description: string;
type: string;
json: string;
text: string;
extra: string;
transcription: string;
createdAt: string;
updatedAt: string;
eventDate: string;
checksum: string;
checksumLastParsed: string;
attachments: string;
}
An array of RecordDTO
objects.
export type GetRecordsResponse = RecordDTO[];
A RecordDTO
object representing the record to be updated.
export type PutRecordRequest = RecordDTO;
Represents a successful response for updating a record.
export type PutRecordResponseSuccess = {
message: string;
data: RecordDTO;
status: 200;
};
Represents an error response for updating a record.
export type PutRecordResponseError = {
message: string;
status: 400;
issues?: any[];
};
A union type of PutRecordResponseSuccess
and PutRecordResponseError
.
export type PutRecordResponse = PutRecordResponseSuccess | PutRecordResponseError;
Represents the response for deleting a record.
export type DeleteRecordResponse = {
message: string;
status: 200;
};
For more details, see the source code.