Skip to main content

Class: InsightService

services/insight.InsightService

Insight service can be used in the following way:
1. Import the service from our library:

import {InsightService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getBestContributionInsight` will return the paginated list of contribution insights.

async getBestContributionInsight() {
return await InsightService.getBestContributionInsight();
}
In case of required `params`, just add them inside the brackets.

async getEmbedsInsightCounters(embedType, embedId) {
return await InsightService.getEmbedsInsightCounters(embedType, embedId);
}
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 InsightService(): InsightService

Returns

InsightService

Methods

getBestContributionInsight

getBestContributionInsight(params?, config?): Promise<SCPaginatedResponse<SCContributionInsightType>>

Parameters

NameType
params?InsightContributionParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCContributionInsightType>>

Defined in

services/insight/index.ts:133


getBestEmbedInsight

getBestEmbedInsight(params?, config?): Promise<SCPaginatedResponse<SCEmbedInsightType>>

Parameters

NameType
params?InsightEmbedParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCEmbedInsightType>>

Defined in

services/insight/index.ts:140


getBestUsersInsight

getBestUsersInsight(params?, config?): Promise<SCPaginatedResponse<SCUsersInsightType>>

Parameters

NameType
params?InsightUserParams
config?AxiosRequestConfig<any>

Returns

Promise<SCPaginatedResponse<SCUsersInsightType>>

Defined in

services/insight/index.ts:144


getContributionsInsightCounters

getContributionsInsightCounters(id, config?): Promise<SCContributionInsightCountersType>

Parameters

NameType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCContributionInsightCountersType>

Defined in

services/insight/index.ts:148


getEmbedsInsightCounters

getEmbedsInsightCounters(type, id, config?): Promise<SCEmbedInsightCountersType>

Parameters

NameType
typestring
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCEmbedInsightCountersType>

Defined in

services/insight/index.ts:152


getUsersInsightCounters

getUsersInsightCounters(id, config?): Promise<SCUsersInsightCountersType>

Parameters

NameType
idstring | number
config?AxiosRequestConfig<any>

Returns

Promise<SCUsersInsightCountersType>

Defined in

services/insight/index.ts:156