npm package: @plasma-platform/tm-service-users
Description: Users Service API
Author: Anton Nemtsev
Latest version: 2.0.10

# Product Service API

# Documentation

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [UsersService](#usersservice)
    -   [Parameters](#parameters)
    -   [messages](#messages)
    -   [getUserById](#getuserbyid)
        -   [Parameters](#parameters-1)
        -   [Examples](#examples)
    -   [requestAuthenticatedUserInformation](#requestauthenticateduserinformation)
        -   [Parameters](#parameters-2)
        -   [Examples](#examples-1)
    -   [getListOfUsersAuthClient](#getlistofusersauthclient)
        -   [Parameters](#parameters-3)
        -   [Examples](#examples-2)
    -   [linkAuthClientToUser](#linkauthclienttouser)
        -   [Parameters](#parameters-4)
        -   [Examples](#examples-3)
    -   [requestAuthClientInformation](#requestauthclientinformation)
        -   [Parameters](#parameters-5)
        -   [Examples](#examples-4)
    -   [unlinkAuthClientFromUser](#unlinkauthclientfromuser)
        -   [Parameters](#parameters-6)
        -   [Examples](#examples-5)
    -   [getCitiesByIpAddresses](#getcitiesbyipaddresses)
        -   [Parameters](#parameters-7)
        -   [Examples](#examples-6)
    -   [getCitiesByZipAndCountryCode](#getcitiesbyzipandcountrycode)
        -   [Parameters](#parameters-8)
        -   [Examples](#examples-7)
    -   [getCitiesByZipCodes](#getcitiesbyzipcodes)
        -   [Parameters](#parameters-9)
        -   [Examples](#examples-8)
    -   [getCityByIpAddress](#getcitybyipaddress)
        -   [Parameters](#parameters-10)
        -   [Examples](#examples-9)
    -   [getListOfCountries](#getlistofcountries)
        -   [Examples](#examples-10)
    -   [getListOfSegmentOptions](#getlistofsegmentoptions)
        -   [Examples](#examples-11)
    -   [getListOfSegments](#getlistofsegments)
        -   [Examples](#examples-12)
    -   [getListOfStateProvinces](#getlistofstateprovinces)
        -   [Examples](#examples-13)
    -   [addNewUser](#addnewuser)
        -   [Parameters](#parameters-11)
        -   [Examples](#examples-14)
    -   [confirmEmail](#confirmemail)
        -   [Parameters](#parameters-12)
        -   [Examples](#examples-15)
    -   [getLinkForAvatarUpload](#getlinkforavatarupload)
        -   [Parameters](#parameters-13)
        -   [Examples](#examples-16)
    -   [getListOfUsers](#getlistofusers)
        -   [Parameters](#parameters-14)
        -   [Examples](#examples-17)
    -   [getPaginationMetadata](#getpaginationmetadata)
        -   [Parameters](#parameters-15)
        -   [Examples](#examples-18)
    -   [getSegmentOptionForUserByToken](#getsegmentoptionforuserbytoken)
        -   [Parameters](#parameters-16)
        -   [Examples](#examples-19)
    -   [getSegmentOptionByUserId](#getsegmentoptionbyuserid)
        -   [Parameters](#parameters-17)
        -   [Examples](#examples-20)
    -   [refreshToken](#refreshtoken)
        -   [Parameters](#parameters-18)
        -   [Examples](#examples-21)
    -   [loginProfile](#loginprofile)
        -   [Parameters](#parameters-19)
        -   [Examples](#examples-22)
    -   [modifyAuthorizedUserInformation](#modifyauthorizeduserinformation)
        -   [Parameters](#parameters-20)
        -   [Examples](#examples-23)
    -   [modifyUserInformationByUserId](#modifyuserinformationbyuserid)
        -   [Parameters](#parameters-21)
        -   [Examples](#examples-24)
    -   [registerConfirmedUser](#registerconfirmeduser)
        -   [Parameters](#parameters-22)
        -   [Examples](#examples-25)
    -   [requestUserEmailExistInformation](#requestuseremailexistinformation)
        -   [Parameters](#parameters-23)
        -   [Examples](#examples-26)
    -   [requestUserInformationByUserId](#requestuserinformationbyuserid)
        -   [Parameters](#parameters-24)
        -   [Examples](#examples-27)
    -   [requestChangeEmail](#requestchangeemail)
        -   [Parameters](#parameters-25)
        -   [Examples](#examples-28)
    -   [requestChangePasswordEmail](#requestchangepasswordemail)
        -   [Parameters](#parameters-26)
        -   [Examples](#examples-29)
    -   [requestForPasswordResetEmail](#requestforpasswordresetemail)
        -   [Parameters](#parameters-27)
        -   [Examples](#examples-30)
    -   [requestForRegistrationEmail](#requestforregistrationemail)
        -   [Parameters](#parameters-28)
        -   [Examples](#examples-31)
    -   [requestPublicUsersInformation](#requestpublicusersinformation)
        -   [Parameters](#parameters-29)
        -   [Examples](#examples-32)
    -   [setNewEmailUsingEmailToken](#setnewemailusingemailtoken)
        -   [Parameters](#parameters-30)
        -   [Examples](#examples-33)
    -   [setNewPasswordToUserUsingChangePasswordToken](#setnewpasswordtouserusingchangepasswordtoken)
        -   [Parameters](#parameters-31)
        -   [Examples](#examples-34)
    -   [setNewPasswordByResetToken](#setnewpasswordbyresettoken)
        -   [Parameters](#parameters-32)
        -   [Examples](#examples-35)
    -   [setSegmentOptionByToken](#setsegmentoptionbytoken)
        -   [Parameters](#parameters-33)
        -   [Examples](#examples-36)
    -   [setSegmentOptionByUserId](#setsegmentoptionbyuserid)
        -   [Parameters](#parameters-34)
        -   [Examples](#examples-37)
    -   [signinSignupViaAuthClient](#signinsignupviaauthclient)
        -   [Parameters](#parameters-35)
        -   [Examples](#examples-38)
    -   [subscribeUserToNewsletters](#subscribeusertonewsletters)
        -   [Parameters](#parameters-36)
        -   [Examples](#examples-39)
    -   [requestUserTokenInformation](#requestusertokeninformation)
        -   [Parameters](#parameters-37)
        -   [Examples](#examples-40)
    -   [getPublicUsersCount](#getpublicuserscount)
        -   [Parameters](#parameters-38)
        -   [Examples](#examples-41)
-   [user](#user)
    -   [Properties](#properties)

## UsersService

-   **See: <http://service-users.templatemonster.com/doc/>**

Users Micro Service API

### Parameters

-   `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** service url
-   `token` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null)** user access tocken if available (optional, default `null`)

### messages

Object with class service messages

Type: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

### getUserById

User - Request public user information by user id

#### Parameters

-   `userId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** User ID

#### Examples

_Get user profile by Id_

```javascript
(async () => {
  const users = new UsersService('//api.templatemonsterdev.com/users/v1/');
  const profile = await users.getUserById(1);
})();
```

Returns **[user](#user)** User profile

### requestAuthenticatedUserInformation

Request authenticated user information

#### Parameters

-   `data` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** any expand

#### Examples

_Get current user profile_

```javascript
(async () => {
  const users = new UsersService('//api.templatemonsterdev.com/users/v1/');
  const profile = await users.getProfile(true);
})();
```

Returns **[user](#user)** Current user profile

### getListOfUsersAuthClient

AuthClient - Get list of users AuthClient

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.userId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of user
    -   `params.page` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Page number

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.getListOfUsersAuthClient({
    userId: 12940,
    page: 1,
  });
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;listOfUsers>** 

### linkAuthClientToUser

AuthClient - Link AuthClient to user

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.userId` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** users id in AuthClient.
    -   `params.client` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** AuthClient name(facebook, google etc.).

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.linkAuthClientToUser({
    userId: '12940',
    client: 'John',
  });
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### requestAuthClientInformation

AuthClient - Request AuthClient information

#### Parameters

-   `id` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** users id in AuthClient.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.requestAuthClientInformation(12940);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### unlinkAuthClientFromUser

AuthClient - Unlink AuthClient from user

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.id` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** users AuthClient unique ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.unlinkAuthClientFromUser(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### getCitiesByIpAddresses

Cities - Get cities by ip addresses

#### Parameters

-   `ips` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** IP addresses.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getCitiesByIpAddresses(["192.168.2.59"]);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;cityInfo>** 

### getCitiesByZipAndCountryCode

Cities - Get cities by zip and country code

#### Parameters

-   `zip` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Zip code.
-   `zip` **countryCode** Country code (2 chars, optional).

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getCitiesByZipAndCountryCode({zip:'02070'});
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;cityInfo>** 

### getCitiesByZipCodes

Cities - Get cities by zip codes

#### Parameters

-   `zips` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Zip codes.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getCitiesByZipCodes(["54000"]);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;cityInfo>** 

### getCityByIpAddress

Cities - Get city by ip address

#### Parameters

-   `ip` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** IP address.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getCityByIpAddress('192.168.2.59');
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;cityInfo>** 

### getListOfCountries

Countries - Get list of countries

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getListOfCountries();
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;countriesInfo>** 

### getListOfSegmentOptions

SegmentOptions - Get list of segment options

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getListOfSegmentOptions();
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;segmentOptionsInfo>** 

### getListOfSegments

Segments - Get list of segments

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getListOfSegments();
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;segmentOptionsInfo>** 

### getListOfStateProvinces

StateProvinces - Get list of state provinces

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getListOfStateProvinces();
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;segmentOptionsInfo>** 

### addNewUser

User - Add new user

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.login` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User login
    -   `params.password` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User password
    -   `params.subscription` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Subscribe user to newsletter
    -   `params.locale` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 2 char locale (if not specified default 'en' will be used)
    -   `params.country` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Country code (2 chars)
    -   `params.state` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** State code (2 chars)
    -   `params.segmentoptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Subscription segment option (if not specified default 4 will be used)

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.addNewUser({
    login: 'qweqwe@qwe.qwe',
    password: 'qweqwe',
    segmentoption_id: 4
  });
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### confirmEmail

User - Confirm email

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.token` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User confirm email token.
    -   `params.scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of oauth scopes divided by space (optional).

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.confirmEmail(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### getLinkForAvatarUpload

User - Get link for avatar upload

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.file` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Avatar file name.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.getLinkForAvatarUpload(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;imageLink>** 

### getListOfUsers

User - Get list of users

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.page` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Page number.
    -   `params.perPage` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of users in one page.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.getListOfUsers(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;imageLink>** 

### getPaginationMetadata

User - Get pagination metadata for Users {get} /users api call

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.id` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** users AuthClient unique ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getPaginationMetadata();
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;paginationData>** 

### getSegmentOptionForUserByToken

User - Get segment option for user identified by access token

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.segmentId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Segment ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.getSegmentOptionForUserByToken(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### getSegmentOptionByUserId

User - Get segment option for user identified by user id

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.userId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** User ID.
    -   `params.segmentId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Segment ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.getSegmentOptionByUserId(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### refreshToken

User - Issue access token using refresh token

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.refreshToken` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Refresh token.
    -   `params.scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Set of scopes divided by space symbol.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.refreshToken(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### loginProfile

User - Issue access token

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.login` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** user email
    -   `params.password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** user password
    -   `params.scope` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** user scopes

#### Examples

_Request Issue access token_

```javascript
(async () => {
  const users = new UsersService('//api.templatemonsterdev.com/users/v1/');
  const tokenInfo = await users.loginProfile({
   login: 'test@test.com',
   password: '123123',
   scope: 'memberships,services'
  });
})();
```

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** User token information

### modifyAuthorizedUserInformation

User - Modify authorized user information

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.password` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User password.
    -   `params.firstname` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User first name.
    -   `params.lastname` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User last name.
    -   `params.phone` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User phone.
    -   `params.avatar` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User avatar.
    -   `params.billingInfo` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Billing info array with following fields [firstname, lastname, city, email, postalcode, billingphone, country, state, contactphone, address]

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.modifyAuthorizedUserInformation(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### modifyUserInformationByUserId

User - Modify user information by user id

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.userId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** User unique ID.
    -   `params.firstname` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User first name.
    -   `params.lastname` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User last name.
    -   `params.phone` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User phone.
    -   `params.stateId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** User status ID: 1 - Waiting, 2 - Normal, 3 - Disabled, 4 - Without confirm, 5 - With confirm, 6 - Required confirm
    -   `params.billingInfo` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Billing info array with following fields [firstname, lastname, city, email, postalcode, billingphone, country, state, contactphone, address]

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.modifyUserInformationByUserId(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### registerConfirmedUser

User - Register confirmed user

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.login` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User login.
    -   `params.password` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User password.
    -   `params.country` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 2 symbol code of country
    -   `params.state` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 2 symbol code of state (XX if there are no states in this country)
    -   `params.firstname` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.lastname` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.birthday` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 
    -   `params.phone` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.website` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.company` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.avatar` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
    -   `params.sex` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 
    -   `params.expand` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of additional data to be returned, may contain following fields divided by comma - billingInfo, segmentOptions, token(this will create new access token), optional.
    -   `params.sendEmail` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Flag that indicates if registration email should be sent, optional.
    -   `params.segmentOptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Id of segment option, optional.
    -   `params.scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of oauth scopes divided by space.
    -   `params.billingInfo` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** User billing info, optional.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.registerConfirmedUser(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### requestUserEmailExistInformation

User - Request User email exist information

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.email` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User email. (required)
    -   `params.expand` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of additional data to be returned (e.g. authClients) (optional).

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.requestUserEmailExistInformation(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### requestUserInformationByUserId

User - Request User information by user id

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.userId` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User unique ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.requestUserInformationByUserId(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### requestChangeEmail

User - Request change email

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.email` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User email.
    -   `params.locale` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** email language. (optional, 'en' by default)

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.requestChangeEmail(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### requestChangePasswordEmail

User - Request change password email

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.email` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User email.
    -   `params.password` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** New password to set.
    -   `params.locale` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** email language. (optional, 'en' by default)

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.requestChangePasswordEmail(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### requestForPasswordResetEmail

User - Request for password reset email

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.email` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User email.
    -   `params.locale` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** email language. (optional, 'en' by default)

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.requestForPasswordResetEmail(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### requestForRegistrationEmail

User - Request for registration email

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.email` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User email.
    -   `params.locale` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** email language. (optional, 'en' by default)

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.requestForRegistrationEmail(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### requestPublicUsersInformation

User - Request public users information based on request params

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.ids` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** search by few id divided by comma (e.g. ?ids=124088,123456)
    -   `params.login` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** search by e-mail address

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.requestPublicUsersInformation(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### setNewEmailUsingEmailToken

User - Set new email to user using change email token

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.token` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User change email token.
    -   `params.scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of oauth scopes divided by space.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.setNewEmailUsingEmailToken(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### setNewPasswordToUserUsingChangePasswordToken

User - Set new password to user using change password token

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.token` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User change email token.
    -   `params.scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of oauth scopes divided by space.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.setNewPasswordToUserUsingChangePasswordToken(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### setNewPasswordByResetToken

User - Set new password to user using reset token

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.token` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** User change email token.
    -   `params.scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of oauth scopes divided by space.
    -   `params.password` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of oauth scopes divided by space.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.setNewPasswordByResetToken(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### setSegmentOptionByToken

User - Set segment option for user identified by access token

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.segmentOptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Segment option ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/, token');
  const request = await service.setSegmentOptionByToken(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### setSegmentOptionByUserId

User - Set segment option for user identified by user id

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.userId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** User ID.
    -   `params.segmentOptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Segment option ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/, token');
  const request = await service.setSegmentOptionByUserId(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### signinSignupViaAuthClient

User - Signin or signup via external auth client

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.clientName` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Name of external auth client - facebook, google, etc..
    -   `params.token` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** OAuth access token from external auth provider.
    -   `params.scope` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** List of oauth scopes divided by space.
    -   `params.segmentOptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Segment option id.
    -   `params.subscription` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Subscribe user to newsletter.
    -   `params.locale` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Subscription locale (if not specified default 'en' will be used).

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.signinSignupViaAuthClient(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;userInfo>** 

### subscribeUserToNewsletters

User - Subscribe user to newsletters

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.segmentOptionId` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Segment option ID.
    -   `params.locale` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Locale.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/, token');
  const request = await service.subscribeUserToNewsletters(params);
})();
```

Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### requestUserTokenInformation

UserToken - Request User Token information

#### Parameters

-   `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.token` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** User token string.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/', token);
  const request = await service.requestUserTokenInformation(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;listOfUsers>** 

### getPublicUsersCount

User - Get users total count {get} /users api call

#### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `params.id` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** users AuthClient unique ID.

#### Examples

```javascript
(async () => {
  const service = new Service('//api.templatemonsterdev.com/users/v1/');
  const request = await service.getPublicUsersCount();
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;usersCountData>** 

## user

user object

Type: [user](#user)

### Properties

-   `userName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** full name
-   `avatar` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** avatar url
-   `background` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** background color