Skip to main content

Class: CategoryService

services/category.CategoryService

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

checkCategoryIsFollowed(id, config?): Promise<SCCategoryFollowedStatusType>

Parameters

NameType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryFollowedStatusType>

Defined in

services/category/index.ts:295


createCategory

createCategory(data, config?): Promise<SCCategoryType>

Parameters

NameType
dataSCCategoryType
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Defined in

services/category/index.ts:235


deleteASpecificCategory

deleteASpecificCategory(id, config?): Promise<any>

Parameters

NameType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<any>

Defined in

services/category/index.ts:251


followCategory

followCategory(id, config?): Promise<any>

Parameters

NameType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<any>

Defined in

services/category/index.ts:291


getAllCategories

getAllCategories(params?, config?): Promise<SCPaginatedResponse<SCCategoryType>>

Parameters

NameType
params?CategoryParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCCategoryType>>

Defined in

services/category/index.ts:227


getCategoryAudience

getCategoryAudience(id, config?): Promise<SCCategoryAudienceType>

Parameters

NameType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryAudienceType>

Defined in

services/category/index.ts:255


getCategoryFeed

getCategoryFeed(id, params?, config?): Promise<SCPaginatedResponse<SCFeedUnitType>>

Parameters

NameType
idstring | number
params?BaseGetParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCFeedUnitType>>

Defined in

services/category/index.ts:267


getCategoryFollowers

getCategoryFollowers(id, params?, config?): Promise<SCPaginatedResponse<SCUserType>>

Parameters

NameType
idstring | number
params?BaseGetParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCUserType>>

Defined in

services/category/index.ts:259


getCategoryTrendingFeed

getCategoryTrendingFeed(id, params?, config?): Promise<SCPaginatedResponse<SCFeedUnitType>>

Parameters

NameType
idstring | number
params?BaseGetParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCFeedUnitType>>

Defined in

services/category/index.ts:275


getCategoryTrendingFollowers

getCategoryTrendingFollowers(id, params?, config?): Promise<SCPaginatedResponse<SCUserType>>

Parameters

NameType
idstring | number
params?BaseGetParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCUserType>>

Defined in

services/category/index.ts:283


getFollowedCategories

getFollowedCategories(params?, config?): Promise<SCPaginatedResponse<SCCategoryType>>

Parameters

NameType
params?CategoryParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCCategoryType>>

Defined in

services/category/index.ts:299


getPopularCategories

getPopularCategories(params?, config?): Promise<SCPaginatedResponse<SCCategoryType>>

Parameters

NameType
params?BaseGetParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCCategoryType>>

Defined in

services/category/index.ts:303


getSpecificCategory

getSpecificCategory(id, config?): Promise<SCCategoryType>

Parameters

NameType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Defined in

services/category/index.ts:239


patchASpecificCategory

patchASpecificCategory(id, data, config?): Promise<SCCategoryType>

Parameters

NameType
idstring | number
dataSCCategoryType
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Defined in

services/category/index.ts:247


searchCategory

searchCategory(params?, config?): Promise<SCPaginatedResponse<SCCategoryType>>

Parameters

NameType
params?CategoryParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCCategoryType>>

Defined in

services/category/index.ts:231


updateASpecificCategory

updateASpecificCategory(id, data, config?): Promise<SCCategoryType>

Parameters

NameType
idstring | number
dataSCCategoryType
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Defined in

services/category/index.ts:243