FeedObjectService
1. Import the service from our library:
import {FeedObjectService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getAllFeedObjects` will return the paginated list of feed objs.
async getAllFeedObjects(type) {
return await FeedObjectService.getAllFeedObjects(type);
}
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 FeedObjectService():
FeedObjectService
Returns
FeedObjectService
Methods
checkIfFollowingFeedObject()
static
checkIfFollowingFeedObject(type
,id
,config?
):Promise
<SCFeedObjectFollowingStatusType
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCFeedObjectFollowingStatusType
>
checkIfSuspendedFeedObject()
static
checkIfSuspendedFeedObject(type
,id
,config?
):Promise
<SCFeedObjectSuspendedStatusType
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCFeedObjectSuspendedStatusType
>
createFeedObject()
static
createFeedObject(type
,data
,config?
):Promise
<SCFeedObjectType
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
data | FeedObjCreateParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCFeedObjectType
>
deleteFeedObject()
static
deleteFeedObject(type
,id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
feedObjectContributorsList()
static
feedObjectContributorsList(type
,id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
feedObjectFlagList()
static
feedObjectFlagList(type
,id
,config?
):Promise
<SCPaginatedResponse
<SCFlagType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFlagType
>>
feedObjectFlagStatus()
static
feedObjectFlagStatus(type
,id
,config?
):Promise
<SCPaginatedResponse
<SCFlagType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFlagType
>>
feedObjectFollowingList()
static
feedObjectFollowingList(type
,params?
,config?
):Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
feedObjectHideStatus()
static
feedObjectHideStatus(type
,id
,config?
):Promise
<SCFeedObjectHideStatusType
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCFeedObjectHideStatusType
>
feedObjectPollVote()
static
feedObjectPollVote(type
,id
,choice
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
choice | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
feedObjectPollVotesList()
static
feedObjectPollVotesList(type
,id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCPollVoteType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
params? | FeedObjectPollVotesSearch |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCPollVoteType
>>
feedObjectSharesList()
static
feedObjectSharesList(type
,id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
feedObjectSuspendedList()
static
feedObjectSuspendedList(type
,params?
,config?
):Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
feedObjectUserSharesList()
static
feedObjectUserSharesList(type
,id
,params?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
params? | BaseGetParams |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
feedObjectVotes()
static
feedObjectVotes(type
,id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCVoteType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCVoteType
>>
flagFeedObject()
static
flagFeedObject(type
,id
,flag_type
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
flag_type | SCFlagTypeEnum |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
followFeedObject()
static
followFeedObject(type
,id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
getAllFeedObjects()
static
getAllFeedObjects(type
,params?
,config?
):Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
params? | FeedObjGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
getSpecificFeedObject()
static
getSpecificFeedObject(type
,id
,config?
):Promise
<SCFeedObjectType
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCFeedObjectType
>
getUncommentedFeedObjects()
static
getUncommentedFeedObjects(type
,params?
,config?
):Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
hideFeedObject()
static
hideFeedObject(type
,id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
relatedFeedObjects()
static
relatedFeedObjects(type
,id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
restoreFeedObject()
static
restoreFeedObject(type
,id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
searchFeedObject()
static
searchFeedObject(type
,params?
,config?
):Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
params? | BaseSearchParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCFeedObjectType
>>
suspendFeedObject()
static
suspendFeedObject(type
,id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
updateFeedObject()
static
updateFeedObject(type
,id
,data
,config?
):Promise
<SCFeedObjectType
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
data | FeedObjCreateParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCFeedObjectType
>
voteFeedObject()
static
voteFeedObject(type
,id
,reaction?
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
type | DISCUSSION | POST | STATUS |
id | string | number |
reaction? | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>