List
Basic
This method interacts with the Basic List endpoint to retrieve a set of resources.
Usage
const response = await userService.list();
Parameters
Parameter | Type | Description |
---|---|---|
args | ListArgs (optional) | Optional arguments for controlling the list operation. |
options | ListOptions (optional) | Additional options for customizing the list request. |
axiosRequestConfig | AxiosRequestConfig (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
Prop | Type | Description |
---|---|---|
success | boolean | Indicates whether the request was successful. |
status | number | HTTP status code of the response. |
message | string | A message providing additional information about the response, especially in case of errors. |
totalCount | number | Total count of resources in the response. |
raw | array[object] | Raw data received from the server. |
data | array[Model] | Parsed data represented as an array of Model instances. |
headers | object[AxiosHeaders] | Axios headers associated with the response. |
- 200
- 401
- 403
{
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] {}
}
{
success: false,
status: 401,
message: 'Unauthorized',
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 403,
message: 'Forbidden',
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
Parameter | Type | Description |
---|---|---|
filter | FilterQuery | Query to filter the resources. |
args | ListAdvancedArgs (optional) | Advanced arguments for controlling the list operation. |
options | ListAdvancedOptions (optional) | Additional options for customizing the advanced list request. |
axiosRequestConfig | AxiosRequestConfig (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
Prop | Type | Description |
---|---|---|
success | boolean | Indicates whether the request was successful. |
status | number | HTTP status code of the response. |
message | string | A message providing additional information about the response, especially in case of errors. |
totalCount | number | Total count of resources in the response. |
raw | array[object] | Raw data received from the server. |
data | array[Model] | Parsed data represented as an array of Model instances. |
headers | object[AxiosHeaders] | Axios headers associated with the response. |
- 200
- 401
- 403
{
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] {}
}
{
success: false,
status: 401,
message: 'Unauthorized',
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 403,
message: 'Forbidden',
headers: Object [AxiosHeaders] {}
}