Skip to main content

List

Basic

This method interacts with the Basic List endpoint to retrieve a set of resources.

Usage

const response = await userService.list();

Parameters

ParameterTypeDescription
argsListArgs (optional)Optional arguments for controlling the list operation.
optionsListOptions (optional)Additional options for customizing the list request.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.
interface ListArgs {
skip?: number; // Number of items to skip in the list.
limit?: number; // Maximum number of items to include in the list.
page?: number; // Current page number for paginated results.
pageSize?: number; // Number of items per page for paginated results.
}

interface ListOptions {
skim?: boolean; // Enable skim mode.
includePermissions?: boolean; // Include permissions in the response.
includeCount?: boolean; // Include the count of resources in the response.
includeExtraHeaders?: boolean; // Include extra headers in the response.
ignoreCache?: boolean; // Ignore cache and fetch fresh data.
sq?: sqOptions; // Options related to Sub-Query.
}

Response

PropTypeDescription
successbooleanIndicates whether the request was successful.
statusnumberHTTP status code of the response.
messagestringA message providing additional information about the response, especially in case of errors.
totalCountnumberTotal count of resources in the response.
rawarray[object]Raw data received from the server.
dataarray[Model]Parsed data represented as an array of Model instances.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 200,
totalCount: 2,
raw: [
{
_id: '656cd57be338c0057899a597',
name: 'John',
role: 'user',
public: true,
_permissions: {}
},
{
_id: '656cd57be338c0057899a599',
name: 'Ella',
role: 'user',
public: true,
_permissions: {}
}
],
data: [
Model {
_id: [Getter/Setter],
name: [Getter/Setter],
role: [Getter/Setter],
public: [Getter/Setter],
_permissions: [Getter/Setter]
},
Model {
_id: [Getter/Setter],
name: [Getter/Setter],
role: [Getter/Setter],
public: [Getter/Setter],
_permissions: [Getter/Setter]
}
],
headers: Object [AxiosHeaders] {}
}

Advanced

This method interacts with the Advanced List endpoint to retrieve a set of resources with advanced options.

Usage

const response = await userService.listAdvanced({ name: 'John' }, { select: ['name'] });

Parameters

ParameterTypeDescription
filterFilterQueryQuery to filter the resources.
argsListAdvancedArgs (optional)Advanced arguments for controlling the list operation.
optionsListAdvancedOptions (optional)Additional options for customizing the advanced list request.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.
interface ListAdvancedArgs {
select?: Projection; // Projection for selecting specific fields.
populate?: Populate[] | Populate | string; // Data to populate in the response.
include?: Include | Include[]; // Additional resources to include in the response.
sort?: Sort; // Sorting options for the list.
skip?: string | number; // Number of items to skip in the list.
limit?: string | number; // Maximum number of items to include in the list.
page?: string | number; // Current page number for paginated results.
pageSize?: string | number; // Number of items per page for paginated results.
}

interface ListAdvancedOptions {
skim?: boolean; // Enable skim mode.
includePermissions?: boolean; // Include permissions in the response.
includeCount?: boolean; // Include the count of resources in the response.
includeExtraHeaders?: boolean; // Include extra headers in the response.
ignoreCache?: boolean; // Ignore cache and fetch fresh data.
populateAccess?: PopulateAccess; // Options for populating access-related data.
sq?: sqOptions; // Options related to Sub-Query.
}

Response

PropTypeDescription
successbooleanIndicates whether the request was successful.
statusnumberHTTP status code of the response.
messagestringA message providing additional information about the response, especially in case of errors.
totalCountnumberTotal count of resources in the response.
rawarray[object]Raw data received from the server.
dataarray[Model]Parsed data represented as an array of Model instances.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 200,
totalCount: 2,
raw: [
{
_id: '656cd57be338c0057899a597',
name: 'John',
_permissions: {}
}
],
data: [
Model {
_id: [Getter/Setter],
name: [Getter/Setter],
_permissions: [Getter/Setter]
}
],
headers: Object [AxiosHeaders] {}
}