GroupService
1. Import the service from our library:
import {GroupService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `searchGroups` will return the groups matching the search query.
async searchGroups() {
return await GroupService.searchGroups();
}
In case of required `params`, just add them inside the brackets.
async getSpecificGroupInfo(groupId) {
return await GroupService.getSpecificGroupInfo(groupId);
}
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 GroupService():
GroupService
Returns
GroupService
Methods
changeGroupAvatarOrCover()
static
changeGroupAvatarOrCover(id
,data
,config?
):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | FormData |
config? | AxiosRequestConfig |
Returns
Promise
<SCGroupType
>
createGroup()
static
createGroup(data
,config?
):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
data | GroupCreateParams | FormData |
config? | AxiosRequestConfig |
Returns
Promise
<SCGroupType
>
deleteGroup()
static
deleteGroup(id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
getGroupFeed()
static
getGroupFeed(id
,params?
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
params? | GroupFeedParams |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
getGroupInvitedUsers()
static
getGroupInvitedUsers(id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
getGroupMembers()
static
getGroupMembers(id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
getGroupsSuggestedUsers()
static
getGroupsSuggestedUsers(search
,config?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
search | string |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
getGroupSubscriptionStatus()
static
getGroupSubscriptionStatus(id
,config?
):Promise
<SCPaginatedResponse
<any
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<any
>>
getGroupSuggestedUsers()
static
getGroupSuggestedUsers(id
,search
,config?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
search | string |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
getGroupWaitingApprovalSubscribers()
static
getGroupWaitingApprovalSubscribers(id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params? | BaseGetParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
getSpecificGroupInfo()
static
getSpecificGroupInfo(id
,config?
):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCGroupType
>
getUserGroups()
static
getUserGroups(params?
,config?
):Promise
<SCPaginatedResponse
<SCGroupType
>>
Parameters
Parameter | Type |
---|---|
params? | BaseSearchParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCGroupType
>>
getUserSubscribedGroups()
static
getUserSubscribedGroups(id
,params?
,config?
):Promise
<SCPaginatedResponse
<SCGroupType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params? | BaseSearchParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCGroupType
>>
inviteOrAcceptGroupRequest()
static
inviteOrAcceptGroupRequest(id
,data
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | { users : number []; } |
data.users | number [] |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
patchGroup()
static
patchGroup(id
,data
,config?
):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | SCGroupType |
config? | AxiosRequestConfig |
Returns
Promise
<SCGroupType
>
removeUserFromGroup()
static
removeUserFromGroup(id
,user
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
user | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
searchGroups()
static
searchGroups(params?
,config?
):Promise
<SCPaginatedResponse
<SCGroupType
>>
Parameters
Parameter | Type |
---|---|
params? | BaseSearchParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCGroupType
>>
subscribeToGroup()
static
subscribeToGroup(id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
unsubscribeFromGroup()
static
unsubscribeFromGroup(id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
updateGroup()
static
updateGroup(id
,data
,config?
):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | SCGroupType |
config? | AxiosRequestConfig |
Returns
Promise
<SCGroupType
>