InsightService
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()
staticgetBestContributionInsight(params?,config?):Promise<SCPaginatedResponse<SCContributionInsightType>>
Parameters
| Parameter | Type |
|---|---|
params? | InsightContributionParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCContributionInsightType>>
getBestEmbedInsight()
staticgetBestEmbedInsight(params?,config?):Promise<SCPaginatedResponse<SCEmbedInsightType>>
Parameters
| Parameter | Type |
|---|---|
params? | InsightEmbedParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCEmbedInsightType>>
getBestUsersInsight()
staticgetBestUsersInsight(params?,config?):Promise<SCPaginatedResponse<SCUsersInsightType>>
Parameters
| Parameter | Type |
|---|---|
params? | InsightUserParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCUsersInsightType>>
getContributionsInsightCounters()
staticgetContributionsInsightCounters(id,config?):Promise<SCContributionInsightCountersType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCContributionInsightCountersType>
getEmbedsInsightCounters()
staticgetEmbedsInsightCounters(type,id,config?):Promise<SCEmbedInsightCountersType>
Parameters
| Parameter | Type |
|---|---|
type | string |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCEmbedInsightCountersType>
getUsersInsightCounters()
staticgetUsersInsightCounters(id,config?):Promise<SCUsersInsightCountersType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCUsersInsightCountersType>