Class: PreferenceService
services/preference.PreferenceService
Preference service can be used in the following way:
1. Import the service from our library:
import {PreferenceService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getAllPreferences` will return the paginated list of preferences.
async getAllPreferences() {
return await PreferenceService.getAllPreferences();
}
In case of required `params`, just add them inside the brackets.
async getSpecificPreference(preferenceId) {
return await PreferenceService.getSpecificPreference(preferenceId);
}
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
1. Declare it(or declare them, it is possible to add multiple params)
const headers = headers: {Authorization: `Bearer ${yourToken}`}
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
Constructors
constructor
• new PreferenceService(): PreferenceService
Returns
Methods
getAllPreferences
▸ getAllPreferences(config?
): Promise
<SCPaginatedResponse
<SCPreferenceType
>>
Parameters
Name | Type |
---|---|
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCPreferenceType
>>
Defined in
services/preference/index.ts:102
getSpecificPreference
▸ getSpecificPreference(id
, config?
): Promise
<SCPreferenceType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPreferenceType
>
Defined in
services/preference/index.ts:116
searchPreferences
▸ searchPreferences(search?
, section?
, keys?
, ordering?
, config?
): Promise
<SCPaginatedResponse
<SCPreferenceType
>>
Parameters
Name | Type |
---|---|
search? | string |
section? | string |
keys? | string |
ordering? | string |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCPreferenceType
>>