Class

Teams

Teams(client)

Class corresponding to Aworks Teams Endpoints
Constructor

# new Teams(client)

Endpoint constructor
Parameters:
Name Type Description
client Client
See:
  • [Teams in Awork API Docs](https://openapi.awork.com/#/Teams)

View Source endpoints/Teams.js, line 9

Classes

Teams

Methods

# async addProjects(teamId, projectIds) → {Promise.<Array.<ProjectTeamPair>>}

Add projects to a team. Returns the created project in team entities. Throws BadRequestException if project ids are null or empty. Throws IllegalOperationException if projects fetched from ids failed or returned no projects. Thrwos IllegalOperationException if projects are already connected to the team. Only creates the project in team entities for projects the user has 'write' permissions of feature 'project-master-data' for or is the owner.
Parameters:
Name Type Description
teamId String The team id.
projectIds Array.<String> The project Ids to add.

View Source endpoints/Teams.js, line 133

Promise.<Array.<ProjectTeamPair>>

# async addUsers(teamId, userIds) → {Promise.<Array.<UserTeamPair>>}

Add users to a team. Returns the created user in team entities. Throws BadRequestException if user ids are null or empty. Throws IllegalOperationException if users fetched from ids failed, returned no users or misses a user from the userIds.
Parameters:
Name Type Description
teamId String The team id.
userIds Array.<String> the ids of the users to add.

View Source endpoints/Teams.js, line 106

Promise.<Array.<UserTeamPair>>

# async create(team) → {Promise.<Team>}

Creates a new team. No validations are done for color and icon property, can be any string. Throws IllegalOperationException if team with the same name already exists.
Parameters:
Name Type Description
team TeamCreateModel The model to create a team.

View Source endpoints/Teams.js, line 63

Promise.<Team>

# async delete(teamId) → {Promise.<void>}

Deletes the team with the specified id. Deletes all related UserInTeamEntities and ProjectInTeamEntities as well.
Parameters:
Name Type Description
teamId String The id of the team.

View Source endpoints/Teams.js, line 90

Promise.<void>

# async get(teamId, optionsopt) → {Promise.<Team>}

Returns the team with the specified id. Returns NotFound if the team doesn't exist.
Parameters:
Name Type Attributes Description
teamId String The id of the team.
options TeamOptions <optional>
Options on how to display the team.

View Source endpoints/Teams.js, line 34

Promise.<Team>

# async list(optionsopt) → {Promise.<Array.<Team>>}

Returns all teams for an admin. For everyone else just returns teams they are in. If the include query params aren't set or false, the specified collection property is null in the response. If the include param is true, but there are no entities in the collection, an empty collection is returned.
Parameters:
Name Type Attributes Description
options ListOptions <optional>
Pagination and filtering options

View Source endpoints/Teams.js, line 45

Promise.<Array.<Team>>

# async removeProjects(teamId, projectIds) → {Promise.<void>}

Removes projects from a team. Throws BadRequestException if project ids are null or empty. Throws BadRequestException if no project in teams could be found for supplied project ids. Validates the project ids by checking if entries exists for that project in the database.
Parameters:
Name Type Description
teamId String The team id.
projectIds Array.<String> The project Ids to remove.

View Source endpoints/Teams.js, line 144

Promise.<void>

# async removeUsers(teamId, userIds) → {Promise.<void>}

Removes users from a team.
Parameters:
Name Type Description
teamId String The team id.
userIds Array.<String> the ids of the users to remove.

View Source endpoints/Teams.js, line 117

Promise.<void>

# async update(teamId, team) → {Promise.<Team>}

Updates the team with the specified id. Only updates properties which are not null or whitespace.
Parameters:
Name Type Description
teamId String The id of the team.
team TeamUpdateModel The model to update the team.

View Source endpoints/Teams.js, line 79

Promise.<Team>