EmbedService
1. Import the service from our library:
import {EmbedService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getAllEmbeds` will return the paginated list of embeds.
async getAllEmbeds() {
return await EmbedService.getAllEmbeds();
}
In case of required `params`, just add them inside the brackets.
async getSpecificEmbed(embedId) {
return await EmbedService.getSpecificEmbed(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 EmbedService():
EmbedService
Returns
EmbedService
Methods
createEmbed()
staticcreateEmbed(data,config?):Promise<SCEmbedType>
Parameters
| Parameter | Type |
|---|---|
data | SCEmbedType |
config? | AxiosRequestConfig |
Returns
Promise<SCEmbedType>
getAllEmbeds()
staticgetAllEmbeds(params?,config?):Promise<SCPaginatedResponse<SCEmbedType>>
Parameters
| Parameter | Type |
|---|---|
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCEmbedType>>
getEmbedFeed()
staticgetEmbedFeed(embed_type?,embed_id?,config?):Promise<SCPaginatedResponse<SCFeedUnitType>>
Parameters
| Parameter | Type |
|---|---|
embed_type? | string |
embed_id? | string |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCFeedUnitType>>
getSpecificEmbed()
staticgetSpecificEmbed(id,config?):Promise<SCEmbedType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCEmbedType>
getSpecificEmbedFeed()
staticgetSpecificEmbedFeed(id,config?):Promise<SCPaginatedResponse<SCFeedUnitType>>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCFeedUnitType>>
patchASpecificEmbed()
staticpatchASpecificEmbed(id,data?,config?):Promise<SCEmbedType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
data? | EmbedUpdateParams |
config? | AxiosRequestConfig |
Returns
Promise<SCEmbedType>
searchEmbed()
staticsearchEmbed(params?,config?):Promise<SCPaginatedResponse<SCEmbedType>>
Parameters
| Parameter | Type |
|---|---|
params? | EmbedSearchParams |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCEmbedType>>
updateASpecificEmbed()
staticupdateASpecificEmbed(id,data?,config?):Promise<SCEmbedType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
data? | EmbedUpdateParams |
config? | AxiosRequestConfig |
Returns
Promise<SCEmbedType>