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
new GroupService()
new GroupService():
GroupService
Returns
Methods
changeGroupAvatarOrCover()
static
changeGroupAvatarOrCover(id
,data
,config
?):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | FormData |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCGroupType
>
Source
createGroup()
static
createGroup(data
,config
?):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
data | GroupCreateParams | FormData |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCGroupType
>
Source
getGroupFeed()
static
getGroupFeed(id
,params
?,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | GroupFeedParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
getGroupInvitedUsers()
static
getGroupInvitedUsers(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | BaseGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getGroupMembers()
static
getGroupMembers(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | BaseGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getGroupSubscriptionStatus()
static
getGroupSubscriptionStatus(id
,config
?):Promise
<SCPaginatedResponse
<any
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<any
>>
Source
getGroupSuggestedUsers()
static
getGroupSuggestedUsers(id
,search
,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
search | string |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getGroupWaitingApprovalSubscribers()
static
getGroupWaitingApprovalSubscribers(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | BaseGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getGroupsSuggestedUsers()
static
getGroupsSuggestedUsers(search
,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
search | string |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getSpecificGroupInfo()
static
getSpecificGroupInfo(id
,config
?):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCGroupType
>
Source
getUserGroups()
static
getUserGroups(params
?,config
?):Promise
<SCPaginatedResponse
<SCGroupType
>>
Parameters
Parameter | Type |
---|---|
params ? | BaseSearchParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCGroupType
>>
Source
getUserSubscribedGroups()
static
getUserSubscribedGroups(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCGroupType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | BaseSearchParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCGroupType
>>
Source
inviteOrAcceptGroupRequest()
static
inviteOrAcceptGroupRequest(id
,data
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | object |
data.users | number [] |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
patchGroup()
static
patchGroup(id
,data
,config
?):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | SCGroupType |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCGroupType
>
Source
removeUserFromGroup()
static
removeUserFromGroup(id
,user
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
user | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
searchGroups()
static
searchGroups(params
?,config
?):Promise
<SCPaginatedResponse
<SCGroupType
>>
Parameters
Parameter | Type |
---|---|
params ? | BaseSearchParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCGroupType
>>
Source
subscribeToGroup()
static
subscribeToGroup(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
unsubscribeFromGroup()
static
unsubscribeFromGroup(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
updateGroup()
static
updateGroup(id
,data
,config
?):Promise
<SCGroupType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data | SCGroupType |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCGroupType
>