Class: UserService
services/user.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
Methods
addUserAvatar
▸ addUserAvatar(data
, config?
): Promise
<SCAvatarType
>
Parameters
Name | Type |
---|---|
data | FormData |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCAvatarType
>
Defined in
changeUserMail
▸ changeUserMail(id
, new_email
, confirm?
, send_email?
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
id | string | number |
new_email | string |
confirm? | boolean |
send_email? | boolean |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Defined in
changeUserPassword
▸ changeUserPassword(id
, password
, new_password
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
id | string | number |
password | string |
new_password | string |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Defined in
checkUserConnections
▸ checkUserConnections(id
, config?
): Promise
<SCUserConnectionStatusType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserConnectionStatusType
>
Defined in
checkUserEmailToken
▸ checkUserEmailToken(id
, email_token
, config?
): Promise
<SCUserEmailTokenType
>
Parameters
Name | Type |
---|---|
id | string | number |
email_token | any |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserEmailTokenType
>
Defined in
checkUserFollowed
▸ checkUserFollowed(id
, config?
): Promise
<SCUserFollowedStatusType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserFollowedStatusType
>
Defined in
checkUserFollower
▸ checkUserFollower(id
, config?
): Promise
<SCUserFollowerStatusType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserFollowerStatusType
>
Defined in
checkUserHidden
▸ checkUserHidden(id
, config?
): Promise
<SCUserHiddenStatusType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserHiddenStatusType
>
Defined in
checkUserHiddenBy
▸ checkUserHiddenBy(id
, config?
): Promise
<SCUserHiddenByStatusType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserHiddenByStatusType
>
Defined in
confirmChangeUserMail
▸ confirmChangeUserMail(id
, new_email
, validation_code?
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
id | string | number |
new_email | string |
validation_code? | string |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Defined in
createProviderAssociation
▸ createProviderAssociation(data
, config?
): Promise
<SCUserProviderAssociationType
>
Parameters
Name | Type |
---|---|
data | SCUserProviderAssociationType |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserProviderAssociationType
>
Defined in
deleteProviderAssociation
▸ deleteProviderAssociation(data
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
data | DeleteProviderAssociation |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Defined in
followUser
▸ followUser(id
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Defined in
getAllUsers
▸ getAllUsers(params?
, config?
): Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Name | Type |
---|---|
params? | any |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Defined in
getCurrentUser
▸ getCurrentUser(config?
): Promise
<SCUserType
>
Parameters
Name | Type |
---|---|
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserType
>
Defined in
getCurrentUserAvatar
▸ getCurrentUserAvatar(config?
): Promise
<SCUserAvatarType
>
Parameters
Name | Type |
---|---|
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserAvatarType
>
Defined in
getCurrentUserPermission
▸ getCurrentUserPermission(config?
): Promise
<SCUserPermissionType
>
Parameters
Name | Type |
---|---|
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserPermissionType
>
Defined in
getCurrentUserPlatform
▸ getCurrentUserPlatform(next?
, config?
): Promise
<SCPlatformType
>
Parameters
Name | Type |
---|---|
next? | string |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPlatformType
>
Defined in
getHiddenUsers
▸ getHiddenUsers(params?
, config?
): Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Name | Type |
---|---|
params? | any |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Defined in
getHiddenUsersId
▸ getHiddenUsersId(params?
, config?
): Promise
<number
[]>
Parameters
Name | Type |
---|---|
params? | any |
config? | AxiosRequestConfig <any > |
Returns
Promise
<number
[]>
Defined in
getProviderAssociations
▸ getProviderAssociations(userId
, config?
): Promise
<SCUserProviderAssociationType
[]>
Parameters
Name | Type |
---|---|
userId | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserProviderAssociationType
[]>
Defined in
getSpecificUser
▸ getSpecificUser(id
, config?
): Promise
<SCUserType
>
Parameters
Name | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserType
>
Defined in
getUserAvatars
▸ getUserAvatars(config?
): Promise
<SCPaginatedResponse
<SCAvatarType
>>
Parameters
Name | Type |
---|---|
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCAvatarType
>>
Defined in
getUserConnectionRequests
▸ getUserConnectionRequests(params?
, config?
): Promise
<SCPaginatedResponse
<SCUserConnectionRequestType
>>
Parameters
Name | Type |
---|---|
params? | BaseGetParams |
config? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserConnectionRequestType
>>
Defined in
getUserConnectionStatuses
▸ getUserConnectionStatuses(users
, config?
): Promise
<any
>
Parameters
Name | Type |
---|---|
users | number [] |
config? | AxiosRequestConfig <any > |
Returns
Promise
<any
>