Workspace
+ Inheritance diagram for Workspace:

Description

A workspace / organization.

Workspaces cannot be created or deleted through the API, but they can be updated.

See also
https://developers.asana.com/docs/asana-workspaces
https://developers.asana.com/docs/workspace

Public Properties

final const TYPE = 'workspace'
 
- Public Properties inherited from AbstractEntity
const TYPE = ''
 All entity classes must redeclare this to match their resource_type. More...
 

Protected Properties

final const DIR = 'workspaces'
 
- Protected Properties inherited from AbstractEntity
const DIR = ''
 All entity classes must redeclare this to match their REST directory. More...
 
const OPT_FIELDS = []
 
- Protected Properties inherited from Data
readonly Api Api $api
 
array array self[] AbstractEntity[] $data = []
 
array bool[] $diff = []
 
const MAP = []
 

Public Methods

OrganizationExport export ()
 Exports the organization. More...
 
CustomField[] findCustomFields (string $text=' *', int $limit=20)
 Finds custom fields via the typeahead endpoint. More...
 
Portfolio[] findPortfolios (string $text=' *', int $limit=20)
 Finds portfolios via the typeahead endpoint. More...
 
Project[] findProjects (string $text=' *', int $limit=20)
 Finds projects via the typeahead endpoint. More...
 
Tag[] findTags (string $text=' *', int $limit=20)
 Finds tags via the typeahead endpoint. More...
 
Task[] findTasks (string $text=' *', int $limit=20)
 Finds tasks via the typeahead endpoint. More...
 
CustomField[] getCustomFields ()
 The workspace's custom fields. More...
 
magic string[] getEmailDomains ()
 
magic string getName ()
 
Portfolio[] getPortfolios ()
 The API user's portfolios in this workspace. More...
 
Project[] getProjects (array $filter=Project::GET_ACTIVE)
 The workspace's projects. More...
 
Tag[] getTags ()
 The workspace's active tags. More...
 
Team[] getTeams ()
 The organization's teams. More...
 
null User getUserByEmail (string $email)
 Checks the pool before fetching. More...
 
ProjectWebhook[] TaskWebhook[] getWebhooks ()
 
bool isOrganization ()
 
CustomField newCustomField ()
 Factory. More...
 
Portfolio newPortfolio ()
 Factory. More...
 
Project newProject ()
 Factory. More...
 
Tag newTag ()
 Factory. More...
 
Task newTask ()
 Factory. More...
 
magic CustomField[] selectCustomFields (callable $filter)
 fn( CustomField $field ): bool More...
 
magic Portfolio[] selectPortfolios (callable $filter)
 fn( Portfolio $portfolio ): bool More...
 
magic Project[] selectProjects (callable $filter, array $apiFilter=Project::GET_ACTIVE)
 fn( Project $project ): bool More...
 
magic Tag[] selectTags (callable $filter)
 Active tags. More...
 
magic Team[] selectTeams (callable $filter)
 fn( Team $team ): bool More...
 
magic $this setName (string $name)
 
- Public Methods inherited from AbstractEntity
string __toString ()
 The entity's canonical REST path. More...
 
null string getGid ()
 
bool hasGid ()
 
$this reload ()
 Fully reloads the entity from Asana. More...
 
- Public Methods inherited from Data
mixed __call (string $method, array $args)
 Magic method handler. More...
 
 __construct (Api|self $caller, array $data=[])
 
array __serialize ()
 
void __unserialize (array $data)
 
bool isDiff ()
 Whether the instance has changes. More...
 
array jsonSerialize ()
 
bool offsetExists (mixed $offset)
 
mixed offsetGet (mixed $offset)
 
void offsetSet (mixed $offset, mixed $value)
 
void offsetUnset (mixed $offset)
 
array toArray (bool $diff=false)
 Dehydrated data. More...
 
- Public Methods inherited from ImmutableArrayTrait
void offsetSet (mixed $offset, mixed $value)
 Throws unless overridden. More...
 
- Public Methods inherited from UpdateTrait
$this update ()
 PUT the data diff to Asana, if there is one. More...
 
- Public Methods inherited from UsersTrait
User[] getUsers ()
 
magic User[] selectUsers (callable $filter)
 fn( User $user ): bool More...
 

Protected Methods

T[] _find (string $class, string $text=' *', int $limit=20)
 Finds entities via the typeahead endpoint. More...
 
- Protected Methods inherited from AbstractEntity
mixed _get (string $field)
 Lazy-loads missing fields. More...
 
void _reload (string $field)
 
void _setData (array $data)
 
- Protected Methods inherited from Data
bool _has (string $field)
 Magic method: hasField() More...
 
_hydrate (string $class, $item)
 Sub-data factory that draws from the entity pool. More...
 
bool _is (string $field)
 Magic method: isField() More...
 
bool _of (string $resourceSubtype)
 Magic method: ofResourceSubtypeValue() More...
 
array _select (string|iterable $subject, callable $filter,... $args)
 Magic method: selectField(callable $filter) More...
 
$this _set (string $field, $value)
 Magic method: setField(mixed $value) More...
 
void _setField (string $field, $value)
 Sets a value, hydrating if mapped, and clears the diff. More...
 

Methods

◆ _find()

T [] _find ( string  $class,
string  $text = '*',
int  $limit = 20 
)
protected

Finds entities via the typeahead endpoint.

This endpoint is fuzzy, so you should prefer using the selection methods for precision.

  • Case-insensitive
  • No special characters, except a single * for "any"

The typeahead endpoint isn't very good for finding users, so that method doesn't exist in this class.

See also
https://developers.asana.com/docs/get-objects-via-typeahead

@template T of AbstractEntity

Parameters
class-string<T>$class
string$text
int$limit1-100
Returns
T[]

◆ export()

◆ findCustomFields()

CustomField [] findCustomFields ( string  $text = '*',
int  $limit = 20 
)

Finds custom fields via the typeahead endpoint.

Parameters
string$text
int$limit1-100
Returns
CustomField[]

◆ findPortfolios()

Portfolio [] findPortfolios ( string  $text = '*',
int  $limit = 20 
)

Finds portfolios via the typeahead endpoint.

Parameters
string$text
int$limit1-100
Returns
Portfolio[]

◆ findProjects()

Project [] findProjects ( string  $text = '*',
int  $limit = 20 
)

Finds projects via the typeahead endpoint.

Parameters
string$text
int$limit1-100
Returns
Project[]

◆ findTags()

Tag [] findTags ( string  $text = '*',
int  $limit = 20 
)

Finds tags via the typeahead endpoint.

This will search against all tags, unlike getTags()

Parameters
string$text
int$limit1-100
Returns
Tag[]

◆ findTasks()

Task [] findTasks ( string  $text = '*',
int  $limit = 20 
)

Finds tasks via the typeahead endpoint.

Parameters
string$text
int$limit1-100
Returns
Task[]

◆ getCustomFields()

CustomField [] getCustomFields ( )

The workspace's custom fields.

See also
https://developers.asana.com/docs/get-a-workspaces-custom-fields
Returns
CustomField[]

◆ getEmailDomains()

magic string [] getEmailDomains ( )
Returns
string[]

◆ getName()

magic string getName ( )
Returns
string

◆ getPortfolios()

Portfolio [] getPortfolios ( )

The API user's portfolios in this workspace.

See also
https://developers.asana.com/docs/get-multiple-portfolios
Returns
Portfolio[]

◆ getProjects()

Project [] getProjects ( array  $filter = Project::GET_ACTIVE)

The workspace's projects.

See also
https://developers.asana.com/docs/get-multiple-projects
Parameters
array$filter
Returns
Project[]

◆ getTags()

Tag [] getTags ( )

The workspace's active tags.

To search for any tag, use findTags()

See also
https://developers.asana.com/docs/get-multiple-tags
Returns
Tag[]

◆ getTeams()

Team [] getTeams ( )

The organization's teams.

See also
https://developers.asana.com/docs/get-teams-in-an-organization
Returns
Team[]

◆ getUserByEmail()

null User getUserByEmail ( string  $email)

Checks the pool before fetching.

Parameters
string$email
Returns
null|User

◆ getWebhooks()

ProjectWebhook [] TaskWebhook [] getWebhooks ( )
Returns
ProjectWebhook[]|TaskWebhook[]

◆ isOrganization()

bool isOrganization ( )
final
Returns
bool

◆ newCustomField()

CustomField newCustomField ( )

Factory.

Returns
CustomField

◆ newPortfolio()

Portfolio newPortfolio ( )

Factory.

Returns
Portfolio

◆ newProject()

Project newProject ( )

Factory.

Returns
Project

◆ newTag()

Tag newTag ( )

Factory.

Returns
Tag

◆ newTask()

Task newTask ( )

Factory.

Returns
Task

◆ selectCustomFields()

magic CustomField [] selectCustomFields ( callable  $filter)

fn( CustomField $field ): bool

Returns
CustomField[]

◆ selectPortfolios()

magic Portfolio [] selectPortfolios ( callable  $filter)

fn( Portfolio $portfolio ): bool

Returns
Portfolio[]

◆ selectProjects()

magic Project [] selectProjects ( callable  $filter,
array  $apiFilter = Project::GET_ACTIVE 
)

fn( Project $project ): bool

Returns
Project[]

◆ selectTags()

magic Tag [] selectTags ( callable  $filter)

Active tags.

fn( Tag $tag ): bool

Returns
Tag[]

◆ selectTeams()

magic Team [] selectTeams ( callable  $filter)

fn( Team $team ): bool

Returns
Team[]

◆ setName()

magic $this setName ( string  $name)
Returns
$this