Class: CategoryService
services/category.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
Methods
checkCategoryIsFollowed
▸ checkCategoryIsFollowed(id
, config?
): Promise
<SCCategoryFollowedStatusType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCCategoryFollowedStatusType
>
Defined in
services/category/index.ts:295
createCategory
▸ createCategory(data
, config?
): Promise
<SCCategoryType
>
Parameters
Name | Type |
---|---|
data | SCCategoryType |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCCategoryType
>
Defined in
services/category/index.ts:235
deleteASpecificCategory
▸ deleteASpecificCategory(id
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Defined in
services/category/index.ts:251
followCategory
▸ followCategory(id
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Defined in
services/category/index.ts:291
getAllCategories
▸ getAllCategories(params?
, config?
): Promise
<SCPaginatedResponse
<SCCategoryType
>>
Parameters
Name | Type |
---|---|
params? | CategoryParams |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCCategoryType
>>
Defined in
services/category/index.ts:227
getCategoryAudience
▸ getCategoryAudience(id
, config?
): Promise
<SCCategoryAudienceType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCCategoryAudienceType
>
Defined in
services/category/index.ts:255
getCategoryFeed
▸ getCategoryFeed(id
, params?
, config?
): Promise
<SCPaginatedResponse
<SCFeedUnitType
>>
Parameters
Name | Type |
---|---|
id | string | 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
Name | Type |
---|---|
id | string | 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
Name | Type |
---|---|
id | string | 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
Name | Type |
---|---|
id | string | 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
Name | Type |
---|---|
params? | CategoryParams |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCCategoryType
>>
Defined in
services/category/index.ts:299
getPopularCategories
▸ getPopularCategories(params?
, config?
): Promise
<SCPaginatedResponse
<SCCategoryType
>>
Parameters
Name | Type |
---|---|
params? | BaseGetParams |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCCategoryType
>>
Defined in
services/category/index.ts:303
getSpecificCategory
▸ getSpecificCategory(id
, config?
): Promise
<SCCategoryType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCCategoryType
>
Defined in
services/category/index.ts:239
patchASpecificCategory
▸ patchASpecificCategory(id
, data
, config?
): Promise
<SCCategoryType
>
Parameters
Name | Type |
---|---|
id | string | number |
data | SCCategoryType |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCCategoryType
>
Defined in
services/category/index.ts:247
searchCategory
▸ searchCategory(params?
, config?
): Promise
<SCPaginatedResponse
<SCCategoryType
>>
Parameters
Name | Type |
---|---|
params? | CategoryParams |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCCategoryType
>>
Defined in
services/category/index.ts:231
updateASpecificCategory
▸ updateASpecificCategory(id
, data
, config?
): Promise
<SCCategoryType
>
Parameters
Name | Type |
---|---|
id | string | number |
data | SCCategoryType |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCCategoryType
>