Skip to main content

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

new CategoryService()

new CategoryService(): CategoryService

Returns

CategoryService

Methods

checkCategoryIsFollowed()

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

Parameters

ParameterType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryFollowedStatusType>

Source

services/category/index.ts:292


createCategory()

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

Parameters

ParameterType
dataSCCategoryType
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Source

services/category/index.ts:232


deleteASpecificCategory()

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

Parameters

ParameterType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<any>

Source

services/category/index.ts:248


followCategory()

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

Parameters

ParameterType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<any>

Source

services/category/index.ts:288


getAllCategories()

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

Parameters

ParameterType
params?CategoryParams
config?AxiosRequestConfig<any>

Returns

Promise <SCPaginatedResponse<SCCategoryType>>

Source

services/category/index.ts:224


getCategoryAudience()

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

Parameters

ParameterType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryAudienceType>

Source

services/category/index.ts:252


getCategoryFeed()

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

Parameters

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

Returns

Promise <SCPaginatedResponse<SCFeedUnitType>>

Source

services/category/index.ts:264


getCategoryFollowers()

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

Parameters

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

Returns

Promise <SCPaginatedResponse<SCUserType>>

Source

services/category/index.ts:256


getCategoryTrendingFeed()

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

Parameters

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

Returns

Promise <SCPaginatedResponse<SCFeedUnitType>>

Source

services/category/index.ts:272


getCategoryTrendingFollowers()

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

Parameters

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

Returns

Promise <SCPaginatedResponse<SCUserType>>

Source

services/category/index.ts:280


getFollowedCategories()

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

Parameters

ParameterType
params?CategoryParams
config?AxiosRequestConfig<any>

Returns

Promise <SCPaginatedResponse<SCCategoryType>>

Source

services/category/index.ts:296


getPopularCategories()

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

Parameters

ParameterType
params?BaseGetParams
config?AxiosRequestConfig<any>

Returns

Promise <SCPaginatedResponse<SCCategoryType>>

Source

services/category/index.ts:300


getSpecificCategory()

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

Parameters

ParameterType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Source

services/category/index.ts:236


patchASpecificCategory()

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

Parameters

ParameterType
idstring | number
dataSCCategoryType
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Source

services/category/index.ts:244


searchCategory()

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

Parameters

ParameterType
params?CategoryParams
config?AxiosRequestConfig<any>

Returns

Promise <SCPaginatedResponse<SCCategoryType>>

Source

services/category/index.ts:228


updateASpecificCategory()

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

Parameters

ParameterType
idstring | number
dataSCCategoryType
config?AxiosRequestConfig<any>

Returns

Promise<SCCategoryType>

Source

services/category/index.ts:240