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
new UserService()
new UserService():
UserService
Returns
Methods
addUserAvatar()
static
addUserAvatar(data
,config
?):Promise
<SCAvatarType
>
Parameters
Parameter | Type |
---|---|
data | FormData |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCAvatarType
>
Source
changeUserMail()
static
changeUserMail(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 <any > |
Returns
Promise
<any
>
Source
changeUserPassword()
static
changeUserPassword(id
,password
,new_password
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
password | string |
new_password | string |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
checkUserConnections()
static
checkUserConnections(id
,config
?):Promise
<SCUserConnectionStatusType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserConnectionStatusType
>
Source
checkUserEmailToken()
static
checkUserEmailToken(id
,email_token
,config
?):Promise
<SCUserEmailTokenType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
email_token | any |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserEmailTokenType
>
Source
checkUserFollowed()
static
checkUserFollowed(id
,config
?):Promise
<SCUserFollowedStatusType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserFollowedStatusType
>
Source
checkUserFollower()
static
checkUserFollower(id
,config
?):Promise
<SCUserFollowerStatusType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserFollowerStatusType
>
Source
checkUserHidden()
static
checkUserHidden(id
,config
?):Promise
<SCUserHiddenStatusType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserHiddenStatusType
>
Source
checkUserHiddenBy()
static
checkUserHiddenBy(id
,config
?):Promise
<SCUserHiddenByStatusType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserHiddenByStatusType
>
Source
confirmChangeUserMail()
static
confirmChangeUserMail(id
,new_email
,validation_code
?,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
new_email | string |
validation_code ? | string |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
createProviderAssociation()
static
createProviderAssociation(data
,config
?):Promise
<SCUserProviderAssociationType
>
Parameters
Parameter | Type |
---|---|
data | SCUserProviderAssociationType |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserProviderAssociationType
>
Source
deleteProviderAssociation()
static
deleteProviderAssociation(data
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
data | DeleteProviderAssociation |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
followUser()
static
followUser(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
getAllUsers()
static
getAllUsers(params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
params ? | any |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getCurrentUser()
static
getCurrentUser(config
?):Promise
<SCUserType
>
Parameters
Parameter | Type |
---|---|
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserType
>
Source
getCurrentUserAvatar()
static
getCurrentUserAvatar(config
?):Promise
<SCUserAvatarType
>
Parameters
Parameter | Type |
---|---|
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserAvatarType
>
Source
getCurrentUserPermission()
static
getCurrentUserPermission(config
?):Promise
<SCUserPermissionType
>
Parameters
Parameter | Type |
---|---|
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserPermissionType
>
Source
getCurrentUserPlatform()
static
getCurrentUserPlatform(next
?,config
?):Promise
<SCPlatformType
>
Parameters
Parameter | Type |
---|---|
next ? | string |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPlatformType
>
Source
getHiddenUsers()
static
getHiddenUsers(params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
params ? | any |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getHiddenUsersId()
static
getHiddenUsersId(params
?,config
?):Promise
<number
[]>
Parameters
Parameter | Type |
---|---|
params ? | any |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<number
[]>
Source
getProviderAssociations()
static
getProviderAssociations(userId
,config
?):Promise
<SCUserProviderAssociationType
[]>
Parameters
Parameter | Type |
---|---|
userId | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserProviderAssociationType
[]>
Source
getSpecificUser()
static
getSpecificUser(id
,config
?):Promise
<SCUserType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserType
>
Source
getUserAvatars()
static
getUserAvatars(config
?):Promise
<SCPaginatedResponse
<SCAvatarType
>>
Parameters
Parameter | Type |
---|---|
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCAvatarType
>>
Source
getUserConnectionRequests()
static
getUserConnectionRequests(params
?,config
?):Promise
<SCPaginatedResponse
<SCUserConnectionRequestType
>>
Parameters
Parameter | Type |
---|---|
params ? | BaseGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserConnectionRequestType
>>
Source
getUserConnectionStatuses()
static
getUserConnectionStatuses(users
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
users | number [] |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
getUserConnections()
static
getUserConnections(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | UserGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getUserCounters()
static
getUserCounters(id
,config
?):Promise
<SCUserCounterType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserCounterType
>
Source
getUserFeed()
static
getUserFeed(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCFeedUnitType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | BaseGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCFeedUnitType
>>
Source
getUserFollowedCategories()
static
getUserFollowedCategories(id
,mutual
?,config
?):Promise
<SCCategoryType
[]>
Parameters
Parameter | Type |
---|---|
id | string | number |
mutual ? | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCCategoryType
[]>
Source
getUserFollowers()
static
getUserFollowers(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | UserGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getUserFollowings()
static
getUserFollowings(id
,params
?,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
id | string | number |
params ? | UserGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
getUserLoyaltyPoints()
static
getUserLoyaltyPoints(id
,config
?):Promise
<SCUserLoyaltyPointsType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserLoyaltyPointsType
>
Source
getUserRequestConnectionsSent()
static
getUserRequestConnectionsSent(params
?,config
?):Promise
<SCPaginatedResponse
<SCUserConnectionRequestType
>>
Parameters
Parameter | Type |
---|---|
params ? | BaseGetParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserConnectionRequestType
>>
Source
removeUserAvatar()
static
removeUserAvatar(avatar_id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
avatar_id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
setUserPrimaryAvatar()
static
setUserPrimaryAvatar(avatar_id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
avatar_id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
showHideUser()
static
showHideUser(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userAcceptRequestConnection()
static
userAcceptRequestConnection(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userAutocomplete()
static
userAutocomplete(params
,config
?):Promise
<SCPaginatedResponse
<SCUserAutocompleteType
>>
Parameters
Parameter | Type |
---|---|
params | UserAutocompleteParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserAutocompleteType
>>
Source
userCancelRejectConnectionRequest()
static
userCancelRejectConnectionRequest(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userCancelRequestConnection()
static
userCancelRequestConnection(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userDelete()
static
userDelete(id
,hard
?,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
hard ? | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userMarkSeenConnectionRequest()
static
userMarkSeenConnectionRequest(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userPatch()
static
userPatch(id
,data
?,config
?):Promise
<SCUserType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data ? | SCUserType |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserType
>
Source
userRejectConnectionRequest()
static
userRejectConnectionRequest(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userRemoveConnection()
static
userRemoveConnection(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userRequestConnection()
static
userRequestConnection(id
,config
?):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<any
>
Source
userSearch()
static
userSearch(params
,config
?):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
params | UserSearchParams |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
Source
userSettings()
static
userSettings(id
,config
?):Promise
<SCUserSettingsType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserSettingsType
>
Source
userSettingsPatch()
static
userSettingsPatch(id
,data
?,config
?):Promise
<SCUserSettingsType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data ? | SCUserSettingsType |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserSettingsType
>
Source
userTagToAddressContribution()
static
userTagToAddressContribution(config
?):Promise
<SCTagType
>
Parameters
Parameter | Type |
---|---|
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCTagType
>
Source
userUpdate()
static
userUpdate(id
,data
?,config
?):Promise
<SCUserType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
data ? | SCUserType |
config ? | AxiosRequestConfig <any > |
Returns
Promise
<SCUserType
>