User

User

Source:
All accounts registered with Contentstack are known as Users. A stack can have many users with varying permissions and roles. Read Users to learn more.

Methods

(static) update() → {Promise.<User.User>}

Source:
The Update User API Request updates the details of an existing user account.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).getUser()
.then((user) => {
 user.first_name = 'FirstName'
 user.last_name = 'LastName'
 user.company = 'Role description'
 return user.update()
})
.then((user) => console.log(user))
Returns:
Promise for User instance
Type
Promise.<User.User>

(static) delete() → {Object}

Source:
The Delete user call deletes the current authenticated user permanently from your Contentstack account.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).getUser()
.then((user) => {
 return user.delete()
})
.then((response) => console.log(response.notice))
Returns:
Response Object.
Type
Object

(static) requestPassword() → {Object}

Source:
The Request for a password call sends a request for a temporary password to log in to an account in case a user has forgotten the login password.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).getUser()
.then((user) => {
 return user.requestPassword()
})
.then((response) => console.log(response.notice))
Returns:
Response Object.
Type
Object

(static) resetPassword() → {Object}

Source:
The Reset password call sends a request for resetting the password of your Contentstack account.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).getUser()
.then((user) => {
 return user.resetPassword({ 'resetToken', 'new_password', 'new_password' })
})
.then((response) => console.log(response.notice))
Returns:
Response Object.
Type
Object

(static) getTasks(query, sort, limit, skip) → {Object}

Source:
The Get all Tasks request retrieves a list of all tasks assigned to you.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).getUser()
.then((user) => {
 return user.getTasks()
})
.then((response) => console.log(response.assignments))
Parameters:
Name Type Description
query Object Enter the actual query that will be executed to retrieve the tasks. This query should be in JSON format.
sort Object Enter the field UID on the basis of which you want to sort your tasks.
limit Int Enter the maximum number of tasks that you want to retrieve in the response.
skip Int Enter the number of tasks to be skipped.
Returns:
Response Object.
Type
Object