LoyaltyService
1. Import the service from our library:
import {LoyaltyService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getPrizes` will return the paginated list of available prizes.
async getPrizes() {
return await LoyaltyService.getPrizes();
}
In case of required `params`, just add them inside the brackets.
async getSpecificPrize(prizeId) {
return await LoyaltyService.getSpecificPrize(prizeId);
}
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
new LoyaltyService()
new LoyaltyService():
LoyaltyService
Returns
Methods
createPrize()
static
createPrize(data
,config
?):Promise
<SCPrizeType
>
Parameters
Parameter | Type |
---|---|
data | LoyaltyPrizeParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPrizeType
>
Source
createPrizeRequest()
static
createPrizeRequest(prize
,config
?):Promise
<SCPrizeUserType
>
Parameters
Parameter | Type |
---|---|
prize | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPrizeUserType
>
Source
getAllPrizeRequests()
static
getAllPrizeRequests(config
?):Promise
<SCPaginatedResponse
<SCPrizeUserType
>>
Parameters
Parameter | Type |
---|---|
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCPrizeUserType
>>
Source
getPrizes()
static
getPrizes(params
?,config
?):Promise
<SCPaginatedResponse
<SCPrizeType
>>
Parameters
Parameter | Type |
---|---|
params ? | LoyaltyGetPrizeParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCPrizeType
>>
Source
getSpecificPrize()
static
getSpecificPrize(id
,config
?):Promise
<SCPrizeType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPrizeType
>
Source
getSpecificPrizeRequest()
static
getSpecificPrizeRequest(id
,config
?):Promise
<SCPrizeUserType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPrizeUserType
>
Source
patchPrize()
static
patchPrize(id
,data
?,config
?):Promise
<SCPrizeType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data ? | LoyaltyPrizeParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPrizeType
>
Source
patchPrizeRequest()
static
patchPrizeRequest(id
,status
?,config
?):Promise
<SCPrizeUserType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
status ? | SCPrizeUserStatusType |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPrizeUserType
>
Source
updatePrize()
static
updatePrize(id
,data
,config
?):Promise
<SCPrizeType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | LoyaltyPrizeParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPrizeType
>