Skip to main content

LoyaltyService

Loyalty service can be used in the following way:
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

LoyaltyService

Methods

createPrize()

static createPrize(data, config?): Promise<SCPrizeType>

Parameters

ParameterType
dataLoyaltyPrizeParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPrizeType>

Source

services/loyalty/index.ts:148


createPrizeRequest()

static createPrizeRequest(prize, config?): Promise<SCPrizeUserType>

Parameters

ParameterType
prizenumber
config?AxiosRequestConfig<any>

Returns

Promise<SCPrizeUserType>

Source

services/loyalty/index.ts:168


getAllPrizeRequests()

static getAllPrizeRequests(config?): Promise <SCPaginatedResponse<SCPrizeUserType>>

Parameters

ParameterType
config?AxiosRequestConfig<any>

Returns

Promise <SCPaginatedResponse<SCPrizeUserType>>

Source

services/loyalty/index.ts:164


getPrizes()

static getPrizes(params?, config?): Promise <SCPaginatedResponse<SCPrizeType>>

Parameters

ParameterType
params?LoyaltyGetPrizeParams
config?AxiosRequestConfig<any>

Returns

Promise <SCPaginatedResponse<SCPrizeType>>

Source

services/loyalty/index.ts:144


getSpecificPrize()

static getSpecificPrize(id, config?): Promise<SCPrizeType>

Parameters

ParameterType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCPrizeType>

Source

services/loyalty/index.ts:152


getSpecificPrizeRequest()

static getSpecificPrizeRequest(id, config?): Promise<SCPrizeUserType>

Parameters

ParameterType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCPrizeUserType>

Source

services/loyalty/index.ts:172


patchPrize()

static patchPrize(id, data?, config?): Promise<SCPrizeType>

Parameters

ParameterType
idstring | number
data?LoyaltyPrizeParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPrizeType>

Source

services/loyalty/index.ts:160


patchPrizeRequest()

static patchPrizeRequest(id, status?, config?): Promise<SCPrizeUserType>

Parameters

ParameterType
idstring | number
status?SCPrizeUserStatusType
config?AxiosRequestConfig<any>

Returns

Promise<SCPrizeUserType>

Source

services/loyalty/index.ts:175


updatePrize()

static updatePrize(id, data, config?): Promise<SCPrizeType>

Parameters

ParameterType
idstring | number
dataLoyaltyPrizeParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPrizeType>

Source

services/loyalty/index.ts:156