UserService
1. Import the service from our library:
import {UserService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getAllUsers` will return the paginated list of users.
async getAllUsers() {
return await UserService.getAllUsers();
}
In case of required `params`, just add them inside the brackets.
async getSpecificUser(userId) {
return await UserService.getSpecificUser(userId);
}
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
Ex: If the async function `userUpdate` is willing to update the avatar or the cover the 'Content-Type' request header must be set as 'multipart/form-data'.
async getSpecificUser(userId, data, config) {
const headers = {headers: {'Content-Type': 'multipart/form-data'}}
return await UserService.getSpecificUser(userId, {avatar: avatar}, headers);
}
Constructors
Constructor
new UserService():
UserService
Returns
UserService
Methods
addUserAvatar()
staticaddUserAvatar(data,config?):Promise<SCAvatarType>
Parameters
| Parameter | Type |
|---|---|
data | FormData |
config? | AxiosRequestConfig |
Returns
Promise<SCAvatarType>
changeUserMail()
staticchangeUserMail(id,new_email,confirm?,send_email?,config?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
new_email | string |
confirm? | boolean |
send_email? | boolean |
config? | AxiosRequestConfig |
Returns
Promise<any>
changeUserPassword()
staticchangeUserPassword(id,password,new_password,config?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
password | string |
new_password | string |
config? | AxiosRequestConfig |
Returns
Promise<any>
checkUserConnections()
staticcheckUserConnections(id,config?):Promise<SCUserConnectionStatusType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCUserConnectionStatusType>
checkUserEmailToken()
staticcheckUserEmailToken(id,email_token,config?):Promise<SCUserEmailTokenType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
email_token | any |
config? | AxiosRequestConfig |
Returns
Promise<SCUserEmailTokenType>
checkUserFollowed()
staticcheckUserFollowed(id,config?):Promise<SCUserFollowedStatusType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCUserFollowedStatusType>
checkUserFollower()
staticcheckUserFollower(id,config?):Promise<SCUserFollowerStatusType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCUserFollowerStatusType>
checkUserHidden()
staticcheckUserHidden(id,config?):Promise<SCUserHiddenStatusType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCUserHiddenStatusType>
checkUserHiddenBy()
staticcheckUserHiddenBy(id,config?):Promise<SCUserHiddenByStatusType>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<SCUserHiddenByStatusType>
confirmChangeUserMail()
staticconfirmChangeUserMail(id,new_email,validation_code?,config?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
new_email | string |
validation_code? | string |
config? | AxiosRequestConfig |
Returns
Promise<any>
createProviderAssociation()
staticcreateProviderAssociation(data,config?):Promise<SCUserProviderAssociationType>
Parameters
| Parameter | Type |
|---|---|
data | SCUserProviderAssociationType |
config? | AxiosRequestConfig |
Returns
Promise<SCUserProviderAssociationType>
deleteProviderAssociation()
staticdeleteProviderAssociation(data,config?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
data | DeleteProviderAssociation |
config? | AxiosRequestConfig |
Returns
Promise<any>
followUser()
staticfollowUser(id,config?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise<any>
getAllUsers()
staticgetAllUsers(params?,config?):Promise<SCPaginatedResponse<SCUserType>>
Parameters
| Parameter | Type |
|---|---|
params? | any |
config? | AxiosRequestConfig |
Returns
Promise<SCPaginatedResponse<SCUserType>>
getCurrentUser()
staticgetCurrentUser(config?):Promise<SCUserType>
Parameters
| Parameter | Type |
|---|---|
config? | AxiosRequestConfig |
Returns
Promise<SCUserType>
getCurrentUserAvatar()
staticgetCurrentUserAvatar(config?):Promise<SCUserAvatarType>