CategoryService
1. Import the service from our library:
import {CategoryService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getAllCategories` will return the paginated list of categories.
async getAllCategories() {
return await CategoryService.getAllCategories();
}
In case of required `params`, just add them inside the brackets.
async getSpecificCategory(categoryId) {
return await CategoryService.getSpecificCategory(categoryId);
}
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 CategoryService():
CategoryService
Returns
CategoryService
Methods
checkCategoryIsFollowed()
staticcheckCategoryIsFollowed(id,config?):Promise<SCCategoryFollowedStatusType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCCategoryFollowedStatusType>
createCategory()
staticcreateCategory(data,config?):Promise<SCCategoryType>
Parameters
| Parameter | Type |
|---|---|
data | SCCategoryType |
config? | AxiosRequestConfig |
Returns
Promise<SCCategoryType>
deleteASpecificCategory()
staticdeleteASpecificCategory(id,config?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<any>
followCategory()
staticfollowCategory(id,config?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<any>
getAllCategories()
staticgetAllCategories(params?,config?):Promise<SCPaginatedResponse<SCCategoryType>>
Parameters
| Parameter | Type |
|---|---|
params? | CategoryParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCCategoryType>>
getCategoryAudience()
staticgetCategoryAudience(id,config?):Promise<SCCategoryAudienceType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCCategoryAudienceType>
getCategoryFeed()
staticgetCategoryFeed(id,params?,config?):Promise<SCPaginatedResponse<SCFeedUnitType>>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCFeedUnitType>>
getCategoryFollowers()
staticgetCategoryFollowers(id,params?,config?):Promise<SCPaginatedResponse<SCUserType>>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCUserType>>
getCategoryTrendingFeed()
staticgetCategoryTrendingFeed(id,params?,config?):Promise<SCPaginatedResponse<SCFeedUnitType>>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCFeedUnitType>>
getCategoryTrendingFollowers()
staticgetCategoryTrendingFollowers(id,params?,config?):Promise<SCPaginatedResponse<SCUserType>>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCUserType>>
getFollowedCategories()
staticgetFollowedCategories(params?,config?):Promise<SCPaginatedResponse<SCCategoryType>>
Parameters
| Parameter | Type |
|---|---|
params? | CategoryParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCCategoryType>>
getPopularCategories()
staticgetPopularCategories(params?,config?):Promise<SCPaginatedResponse<SCCategoryType>>
Parameters
| Parameter | Type |
|---|---|
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCCategoryType>>
getSpecificCategory()
staticgetSpecificCategory(id,config?):Promise<SCCategoryType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCCategoryType>
patchASpecificCategory()
staticpatchASpecificCategory(id,data,config?):Promise<SCCategoryType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
data | SCCategoryType |
config? | AxiosRequestConfig |
Returns
Promise<SCCategoryType>
searchCategory()
staticsearchCategory(params?,config?):Promise<SCPaginatedResponse<SCCategoryType>>
Parameters
| Parameter | Type |
|---|---|
params? | CategoryParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCCategoryType>>
updateASpecificCategory()
staticupdateASpecificCategory(id,data,config?):Promise<SCCategoryType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
data | SCCategoryType |
config? | AxiosRequestConfig |
Returns
Promise<SCCategoryType>