@selfcommunity/api-services
Version:
Client api for SelfCommunity.
98 lines (91 loc) • 5 kB
TypeScript
import { BaseGetParams, SCPaginatedResponse } from '../../types';
import { SCCategoryType, SCCourseType, SCEventType, SCFeedObjectType, SCIncubatorType, SCSuggestionType, SCUserType } from '@selfcommunity/types';
import { AxiosRequestConfig } from 'axios';
export interface SuggestionApiClientInterface {
getCategorySuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCategoryType>>;
getCourseSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseType>>;
getIncubatorSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCIncubatorType>>;
getPollSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
getUserSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
getEventSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCEventType>>;
getSearchSuggestion(search: string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCSuggestionType>>;
}
/**
* Contains all the endpoints needed to manage suggestions.
*/
export declare class SuggestionApiClient {
/**
* This endpoint retrieves a list of categories suggested to the current user.
* @param params
* @param config
*/
static getCategorySuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCategoryType>>;
/**
* This endpoint retrieves a list of courses suggested to the current user.
* @param params
* @param config
*/
static getCourseSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseType>>;
/**
* This endpoint retrieves a list of suggested incubators.
* @param params
* @param config
*/
static getIncubatorSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCIncubatorType>>;
/**
* This endpoint retrieves a list of contributes(discussions, posts, statuses) with a related poll.
* @param params
* @param config
*/
static getPollSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
/**
* This endpoint retrieves a list of users suggested to the current user.
* @param params
* @param config
*/
static getUserSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
/**
* This endpoint retrieves a list of events suggested to the current user.
* @param params
* @param config
*/
static getEventSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCEventType>>;
/**
* This endpoint retrieves a list of users suggested to the current user.
* @param search
* @param params
* @param config
*/
static getSearchSuggestion(search: string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCSuggestionType>>;
}
/**
*
:::tip Suggestion service can be used in the following way:
```jsx
1. Import the service from our library:
import {SuggestionService} from "@selfcommunity/api-services";
```
```jsx
2. Create a function and put the service inside it!
The async function `getCategorySuggestion` will return the paginated list of categories.
async getCategorySuggestion() {
return await SuggestionService.getCategorySuggestion();
}
```
```jsx
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!
```
:::
*/
export default class SuggestionService {
static getCategorySuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCategoryType>>;
static getCourseSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseType>>;
static getIncubatorSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCIncubatorType>>;
static getPollSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
static getUserSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
static getEventSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCEventType>>;
static getSearchSuggestion(search: string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCSuggestionType>>;
}