Api

Description

Protected Properties

string string $token
 
string $workspace = null
 

Public Methods

 __construct (string $token, Pool $pool=null)
 
null array call (string $method, string $path, array $curlOpts=[])
 cURL transport. More...
 
void delete (string $path)
 HTTP DELETE More...
 
factory (string $class,... $args)
 The central point of object creation. More...
 
null array get (string $path, array $query=[])
 HTTP GET for data within a single result. More...
 
null Attachment getAttachment (string $gid)
 Loads an Attachment. More...
 
null CustomField getCustomField (string $gid)
 Loads a CustomField. More...
 
Generator< array > getEach (string $path, array $query=[])
 HTTP GET for multiple results, with auto-pagination. More...
 
null Job getJob (string $gid)
 
null LoggerInterface getLog ()
 
User getMe ()
 
null OrganizationExport getOrganizationExport (string $gid)
 
Pool getPool ()
 
null Portfolio getPortfolio (string $gid)
 Loads a Portfolio. More...
 
null Project getProject (string $gid)
 Loads a Project. More...
 
null ProjectTemplate getProjectTemplate (string $gid)
 
null ProjectWebhook getProjectWebhook (string $gid)
 
null Section getSection (string $gid)
 Loads a Section. More...
 
null Story getStory (string $gid)
 Loads a Story. More...
 
null Tag getTag (string $gid)
 Loads a Tag. More...
 
null Task getTask (string $gid)
 Loads a Task. More...
 
null TaskList getTaskList (string $gid)
 Loads a TaskList. More...
 
null TaskWebhook getTaskWebhook (string $gid)
 
null Team getTeam (string $gid)
 Loads a Team. More...
 
null User getUser (string $gid)
 Loads a User. More...
 
null User getUserByEmail (string $email)
 Gets a user in the default workspace by email. More...
 
Event getWebhookEvent (array $data)
 Expands received webhook data as a full event object. More...
 
null Workspace getWorkspace (string $gid=null)
 Loads a Workspace. More...
 
null T load ($caller, string $class, string $path, array $query=[])
 Loads the entity found at the given path + query. More...
 
T[] loadAll ($caller, string $class, string $path, array $query=[])
 All results from loadEach(). More...
 
Generator< T > loadEach ($caller, string $class, string $path, array $query=[])
 Loads and yields each entity found at the given path + query. More...
 
null array post (string $path, array $data=[], array $options=[])
 HTTP POST More...
 
null array put (string $path, array $data=[], array $options=[])
 HTTP PUT More...
 
$this setLog (?LoggerInterface $log)
 
$this setWorkspace (?string $gid)
 

Constructor

◆ __construct()

__construct ( string  $token,
Pool  $pool = null 
)
Parameters
string$token
null | Pool$pool

Methods

◆ call()

null array call ( string  $method,
string  $path,
array  $curlOpts = [] 
)

cURL transport.

Parameters
string$method
string$path
array$curlOpts
Returns
null|array
Exceptions
AsanaError

◆ delete()

void delete ( string  $path)

HTTP DELETE

Parameters
string$path
Returns
void

◆ factory()

T factory ( string  $class,
  $args 
)

The central point of object creation.

This can be overridden to return custom extensions.

@template T

Parameters
class-string<T>$class
mixed...$args
Returns
T

◆ get()

null array get ( string  $path,
array  $query = [] 
)

HTTP GET for data within a single result.

Parameters
string$path
array$query
Returns
null|array

◆ getAttachment()

null Attachment getAttachment ( string  $gid)

Loads an Attachment.

Parameters
string$gid
Returns
null|Attachment

◆ getCustomField()

null CustomField getCustomField ( string  $gid)

Loads a CustomField.

Parameters
string$gid
Returns
null|CustomField

◆ getEach()

Generator<array> getEach ( string  $path,
array  $query = [] 
)

HTTP GET for multiple results, with auto-pagination.

Parameters
string$path
array$query
Returns
Generator<array>

◆ getJob()

null Job getJob ( string  $gid)
Parameters
string$gid
Returns
null|Job

◆ getLog()

null LoggerInterface getLog ( )
Returns
null|LoggerInterface

◆ getMe()

User getMe ( )
Returns
User

◆ getOrganizationExport()

null OrganizationExport getOrganizationExport ( string  $gid)
Parameters
string$gid
Returns
null|OrganizationExport

◆ getPool()

Pool getPool ( )
Returns
Pool

◆ getPortfolio()

null Portfolio getPortfolio ( string  $gid)

Loads a Portfolio.

Parameters
string$gid
Returns
null|Portfolio

◆ getProject()

null Project getProject ( string  $gid)

Loads a Project.

Parameters
string$gid
Returns
null|Project

◆ getProjectTemplate()

null ProjectTemplate getProjectTemplate ( string  $gid)
Parameters
string$gid
Returns
null|ProjectTemplate

◆ getProjectWebhook()

null ProjectWebhook getProjectWebhook ( string  $gid)
Parameters
string$gid
Returns
null|ProjectWebhook

◆ getSection()

null Section getSection ( string  $gid)

Loads a Section.

Parameters
string$gid
Returns
null|Section

◆ getStory()

null Story getStory ( string  $gid)

Loads a Story.

Parameters
string$gid
Returns
null|Story

◆ getTag()

null Tag getTag ( string  $gid)

Loads a Tag.

Parameters
string$gid
Returns
null|Tag

◆ getTask()

null Task getTask ( string  $gid)

Loads a Task.

Parameters
string$gid
Returns
null|Task

◆ getTaskList()

null TaskList getTaskList ( string  $gid)

Loads a TaskList.

Parameters
string$gid
Returns
null|TaskList

◆ getTaskWebhook()

null TaskWebhook getTaskWebhook ( string  $gid)
Parameters
string$gid
Returns
null|TaskWebhook

◆ getTeam()

null Team getTeam ( string  $gid)

Loads a Team.

Parameters
string$gid
Returns
null|Team

◆ getUser()

null User getUser ( string  $gid)

Loads a User.

Parameters
string$gid
Returns
null|User

◆ getUserByEmail()

null User getUserByEmail ( string  $email)

Gets a user in the default workspace by email.

See also
Workspace::getUserByEmail()
Parameters
string$email
Returns
null|User

◆ getWebhookEvent()

Event getWebhookEvent ( array  $data)

Expands received webhook data as a full event object.

See also
https://developers.asana.com/docs/event
Parameters
array$data
Returns
Event

◆ getWorkspace()

null Workspace getWorkspace ( string  $gid = null)

Loads a Workspace.

Parameters
null | string$gidDefaults to $workspace or the API user's first-known workspace.
Returns
null|Workspace

◆ load()

null T load (   $caller,
string  $class,
string  $path,
array  $query = [] 
)

Loads the entity found at the given path + query.

@template T of AbstractEntity

Parameters
Api | Data$caller
class-string<T>$class
string$path
array$query
Returns
null|T

◆ loadAll()

T [] loadAll (   $caller,
string  $class,
string  $path,
array  $query = [] 
)

All results from loadEach().

@template T of AbstractEntity

Parameters
Api | Data$caller
class-string<T>$class
string$path
array$query
Returns
T[]

◆ loadEach()

Generator<T> loadEach (   $caller,
string  $class,
string  $path,
array  $query = [] 
)

Loads and yields each entity found at the given path + query.

The result-set is not pooled, but individual entities are.

@template T of AbstractEntity

Parameters
Api | Data$caller
class-string<T>$class
string$path
array$querylimit can exceed 100 here.
Returns
Generator<T>

◆ post()

null array post ( string  $path,
array  $data = [],
array  $options = [] 
)

HTTP POST

Parameters
string$path
array$data
array$options
Returns
null|array

◆ put()

null array put ( string  $path,
array  $data = [],
array  $options = [] 
)

HTTP PUT

Parameters
string$path
array$data
array$options
Returns
null|array

◆ setLog()

$this setLog ( ?LoggerInterface  $log)
final
Parameters
null | LoggerInterface$log
Returns
$this

◆ setWorkspace()

$this setWorkspace ( ?string  $gid)
final
Parameters
null | string$gid
Returns
$this