PHP 클래스 Asana

Read Asana API documentation for fully use this class http://developer.asana.com/documentation/ Copyright 2012 Ajimix Licensed under the Apache License 2.0 Author: Ajimix [github.com/ajimix] Version: 1.0
파일 보기 프로젝트 열기: ajimix/asana-api-php-class 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$advDebug
$debug
$fastAPI
$responseCode
$timeout Use Asana fast API version, currently in open beta: https://asana.com/developers/feed/asana-fast-api-open-beta

공개 메소드들

메소드 설명
__construct ( array $options ) Class constructor.
addAttachmentToTask ( string $taskId, array $data = [] ) : string Add attachment to a task
addFollowersToTask ( string $taskId, array $followerIds ) : string Adds followers to a task
addProjectToTask ( string $taskId, string $projectId, array $opts = [] ) : string Adds a project to task. If successful, will return success and an empty data block.
addTagToTask ( string $taskId, string $tagId ) : string Adds a tag to a task. If successful, will return success and an empty data block.
commentOnProject ( string $projectId, string $text = '' ) : string Adds a comment to a project The comment will be authored by the authorized user, and timestamped when the server receives the request.
commentOnTask ( string $taskId, string $text = '' ) : string Adds a comment to a task.
createProject ( array $data ) : string Function to create a project.
createSubTask ( string $parentId, array $data, array $opts = [] ) : string Creates a subtask in the parent task ID
createTag ( string $name, array $data, array $opts = [] ) : string This method creates a new tag and returns its full record.
createTask ( array $data, array $opts = [] ) : string Creates a task.
createTeam ( string $organizationId, array $data ) : string Function to create a team in an Organization.
createWebhook ( string $resourceId, string $target ) : string Creates a webhook.
deleteProject ( string $projectId ) : string Deletes a project.
deleteTask ( string $taskId ) : string Deletes a task.
deleteWebhook ( string $webhookId ) : string This method permanently removes a webhook.
getAttachment ( string $attachmentId, array $opts = [] ) : string Returns single attachment information
getData ( ) : object, Decodes the response and returns as an object, array.
getMyTeams ( string $organizationId ) : string Returns all teams the logged in user is associated with
getProject ( string $projectId, array $opts = [] ) : string Returns the full record for a single project.
getProjectSections ( string $projectId, array $opts = [] ) : string Returns the list of sections associated with the project.
getProjectStories ( string $projectId, array $opts = [] ) : string Returns the list of stories associated with the project.
getProjectTasks ( string $projectId, array $opts = [] ) : string Returns all unarchived tasks of a given project
getProjects ( boolean $archived = false, string $opt_fields = '' ) Returns the projects in all workspaces containing archived ones or not.
getProjectsForTask ( string $taskId, array $opts = [] ) : string Returns the projects associated to the task.
getProjectsInTeam ( string $teamId, boolean $archived = false, array $opts = [] ) : string Returns the projects in provided workspace containing archived ones or not.
getProjectsInWorkspace ( string $workspaceId, boolean $archived = false, array $opts = [] ) : string Returns the projects in provided workspace containing archived ones or not.
getSingleStory ( string $storyId, array $opts = [] ) : string Returns the full record for a single story.
getSubTasks ( string $taskId, array $opts = [] ) : string Returns sub-task information
getTag ( string $tagId, array $opts = [] ) : string Returns the full record for a single tag.
getTags ( ) : string Returns the full record for all tags in all workspaces.
getTask ( string $taskId, array $opts = [] ) : string Returns task information
getTaskAttachments ( string $taskId, array $opts = [] ) : string Returns task attachments information
getTaskStories ( string $taskId, array $opts = [] ) : string Returns the list of stories associated with the object.
getTaskTags ( string $taskId, array $opts = [] ) : string Returns a compact list of tags associated with the object.
getTasksByFilter ( array $filter = ['assignee' => '', 'project' => '', 'workspace' => ''], array $opts = [] ) : string Returns task by a given filter.
getTasksWithTag ( string $tagId, array $opts = [] ) : string Returns the list of all tasks with this tag. Tasks can have more than one tag at a time.
getTeamsInOrganization ( string $organizationId ) : string Returns all teams in an Organization.
getUserInfo ( string $userId = null, array $opts = [] ) : string Returns the full user record for a single user.
getUsers ( array $opts = [] ) : string Returns the user records for all users in all workspaces you have access.
getWebhook ( string $webhookId ) : string Returns the full record for the given webhook.
getWebhooks ( string $workspaceId, string $resource = null, array $opts = [] ) : string Returns the compact representation of all webhooks your app has registered for the authenticated user in the given workspace.
getWorkspaceTags ( string $workspaceId ) : string Returns tags of all workspace.
getWorkspaceTasks ( string $workspaceId, string $assignee = 'me', array $opts = [] ) : string Returns tasks of all workspace assigned to someone.
getWorkspaceTypeahead ( string $workspaceId, string $type, string $query, string $count = 1, array $opts = [] ) : string Returns search for objects from a single workspace.
getWorkspaceUsers ( string $workspaceId ) : string Returns users of all workspace.
getWorkspaces ( array $opts = [] ) : string Returns all the workspaces.
hasError ( ) : boolean Checks for errors in the response.
moveTaskWithinProject ( string $projectId, string $taskToMove, string $taskReference, boolean $insertAfter = true ) : string Moves a task within a project relative to another task. This should let you take a task and move it below or above another task as long as they are within the same project.
removeFollowersFromTask ( string $taskId, array $followerIds ) : string Removes followers from a task
removeProjectToTask ( string $taskId, string $projectId ) : string Removes project from task. If successful, will return success and an empty data block.
removeTagFromTask ( string $taskId, string $tagId ) : string Removes a tag from a task. If successful, will return success and an empty data block.
setReturnType ( integer $type ) : Asana Set the return type.
updateProject ( string $projectId, array $data ) : string This method modifies the fields of a project provided in the request, then returns the full updated record.
updateTag ( string $tagId, array $data ) : string Modifies the fields of a tag provided in the request, then returns the full updated record.
updateTask ( string $taskId, array $data ) : string Updates a task
updateTaskParent ( string $taskId, string $parentId, array $opts = [] ) : string Updated the parent from a task.
updateWorkspace ( $workspaceId, array $data = ['name' => ''] ) : string Currently the only field that can be modified for a workspace is its name (as Asana API says).

비공개 메소드들

메소드 설명
askAsana ( string $url, string $data = null, integer $method = ASANA_METHOD_GET ) : string This function communicates with Asana REST API.

메소드 상세

__construct() 공개 메소드

Class constructor.
public __construct ( array $options )
$options array Array of options containing an apiKey OR a personalAccessToken OR an accessToken. Just one of them. Can be also an string if you want to use an apiKey.

addAttachmentToTask() 공개 메소드

Add attachment to a task
public addAttachmentToTask ( string $taskId, array $data = [] ) : string
$taskId string
$data array (src of file, mymetype, finalFilename) See, Uploading an attachment to a task function comments for proper parameter info.
리턴 string JSON or null

addFollowersToTask() 공개 메소드

Adds followers to a task
public addFollowersToTask ( string $taskId, array $followerIds ) : string
$taskId string
$followerIds array Array of follower ids
리턴 string JSON or null

addProjectToTask() 공개 메소드

Adds a project to task. If successful, will return success and an empty data block.
public addProjectToTask ( string $taskId, string $projectId, array $opts = [] ) : string
$taskId string
$projectId string
$opts array Array of options to pass (insert_after, insert_before, section) (@see https://asana.com/developers/api-reference/tasks#projects)
리턴 string JSON or null

addTagToTask() 공개 메소드

Adds a tag to a task. If successful, will return success and an empty data block.
public addTagToTask ( string $taskId, string $tagId ) : string
$taskId string
$tagId string
리턴 string JSON or null

commentOnProject() 공개 메소드

Adds a comment to a project The comment will be authored by the authorized user, and timestamped when the server receives the request.
public commentOnProject ( string $projectId, string $text = '' ) : string
$projectId string
$text string
리턴 string JSON or null

commentOnTask() 공개 메소드

The comment will be authored by the authorized user, and timestamped when the server receives the request.
public commentOnTask ( string $taskId, string $text = '' ) : string
$taskId string
$text string
리턴 string JSON or null

createProject() 공개 메소드

Function to create a project.
public createProject ( array $data ) : string
$data array Array of data for the project following the Asana API documentation. Example: array( "workspace" => "1768", "name" => "Foo Project!", "notes" => "This is a test project" )
리턴 string JSON or null

createSubTask() 공개 메소드

Creates a subtask in the parent task ID
public createSubTask ( string $parentId, array $data, array $opts = [] ) : string
$parentId string The id of the parent task.
$data array Array of data for the task following the Asana API documentation. Example: array( "name" => "Hello World!", "notes" => "This is a task for testing the Asana API :)", "assignee" => "176822166183", "followers" => array( "37136", "59083" ) )
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

createTag() 공개 메소드

This method creates a new tag and returns its full record.
public createTag ( string $name, array $data, array $opts = [] ) : string
$name string Tag name
$data array An array containing either workspace or organization and the id. Example: array("workspace" => "3242349871");
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

createTask() 공개 메소드

For assign or remove the task to a project, use the addProjectToTask and removeProjectToTask.
public createTask ( array $data, array $opts = [] ) : string
$data array Array of data for the task following the Asana API documentation. Example: array( "workspace" => "1768", "name" => "Hello World!", "notes" => "This is a task for testing the Asana API :)", "assignee" => "176822166183", "followers" => array( "37136", "59083" ) )
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

createTeam() 공개 메소드

Function to create a team in an Organization.
public createTeam ( string $organizationId, array $data ) : string
$organizationId string
$data array Array of data for the task following the Asana API documentation. Example: array("name" => "Team Name")
리턴 string JSON or null

createWebhook() 공개 메소드

Creates a webhook.
public createWebhook ( string $resourceId, string $target ) : string
$resourceId string A resource ID to subscribe to. The resource can be a task or project.
$target string The URL to receive the HTTP POST.
리턴 string JSON or null

deleteProject() 공개 메소드

Deletes a project.
public deleteProject ( string $projectId ) : string
$projectId string
리턴 string Empty if success

deleteTask() 공개 메소드

Deletes a task.
public deleteTask ( string $taskId ) : string
$taskId string
리턴 string Empty if success

deleteWebhook() 공개 메소드

This method permanently removes a webhook.
public deleteWebhook ( string $webhookId ) : string
$webhookId string The webhook to delete.
리턴 string JSON or null

getAttachment() 공개 메소드

Returns single attachment information
public getAttachment ( string $attachmentId, array $opts = [] ) : string
$attachmentId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getData() 공개 메소드

Decodes the response and returns as an object, array.
public getData ( ) : object,
리턴 object,

getMyTeams() 공개 메소드

Returns all teams the logged in user is associated with
public getMyTeams ( string $organizationId ) : string
$organizationId string
리턴 string JSON or null

getProject() 공개 메소드

Returns the full record for a single project.
public getProject ( string $projectId, array $opts = [] ) : string
$projectId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getProjectSections() 공개 메소드

Sections are tasks whose names end with a colon character : . For instance sections will be included in query results for tasks and be represented with the same fields. The memberships property of a task contains the project/section pairs a task belongs to when applicable.
public getProjectSections ( string $projectId, array $opts = [] ) : string
$projectId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getProjectStories() 공개 메소드

As usual with queries, stories are returned in compact form. However, the compact form for stories contains more information by default than just the ID. There is presently no way to get a filtered set of stories.
public getProjectStories ( string $projectId, array $opts = [] ) : string
$projectId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getProjectTasks() 공개 메소드

Returns all unarchived tasks of a given project
public getProjectTasks ( string $projectId, array $opts = [] ) : string
$projectId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getProjects() 공개 메소드

Returns the projects in all workspaces containing archived ones or not.
public getProjects ( boolean $archived = false, string $opt_fields = '' )
$archived boolean Return archived projects or not
$opt_fields string Return results with optional parameters

getProjectsForTask() 공개 메소드

Returns the projects associated to the task.
public getProjectsForTask ( string $taskId, array $opts = [] ) : string
$taskId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getProjectsInTeam() 공개 메소드

Returns the projects in provided workspace containing archived ones or not.
public getProjectsInTeam ( string $teamId, boolean $archived = false, array $opts = [] ) : string
$teamId string
$archived boolean Return archived projects or not
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getProjectsInWorkspace() 공개 메소드

Returns the projects in provided workspace containing archived ones or not.
public getProjectsInWorkspace ( string $workspaceId, boolean $archived = false, array $opts = [] ) : string
$workspaceId string
$archived boolean Return archived projects or not
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getSingleStory() 공개 메소드

Returns the full record for a single story.
public getSingleStory ( string $storyId, array $opts = [] ) : string
$storyId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getSubTasks() 공개 메소드

Returns sub-task information
public getSubTasks ( string $taskId, array $opts = [] ) : string
$taskId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTag() 공개 메소드

Returns the full record for a single tag.
public getTag ( string $tagId, array $opts = [] ) : string
$tagId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTags() 공개 메소드

Returns the full record for all tags in all workspaces.
public getTags ( ) : string
리턴 string JSON or null

getTask() 공개 메소드

Returns task information
public getTask ( string $taskId, array $opts = [] ) : string
$taskId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTaskAttachments() 공개 메소드

Returns task attachments information
public getTaskAttachments ( string $taskId, array $opts = [] ) : string
$taskId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTaskStories() 공개 메소드

As usual with queries, stories are returned in compact form. However, the compact form for stories contains more information by default than just the ID. There is presently no way to get a filtered set of stories.
public getTaskStories ( string $taskId, array $opts = [] ) : string
$taskId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTaskTags() 공개 메소드

Returns a compact list of tags associated with the object.
public getTaskTags ( string $taskId, array $opts = [] ) : string
$taskId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTasksByFilter() 공개 메소드

For now (limited by Asana API), you may limit your query either to a specific project or to an assignee and workspace NOTE: As Asana API says, if you filter by assignee, you MUST specify a workspaceId and viceversa.
public getTasksByFilter ( array $filter = ['assignee' => '', 'project' => '', 'workspace' => ''], array $opts = [] ) : string
$filter array The filter with optional values. array( "assignee" => "", "project" => 0, "workspace" => 0 )
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTasksWithTag() 공개 메소드

Returns the list of all tasks with this tag. Tasks can have more than one tag at a time.
public getTasksWithTag ( string $tagId, array $opts = [] ) : string
$tagId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getTeamsInOrganization() 공개 메소드

Returns all teams in an Organization.
public getTeamsInOrganization ( string $organizationId ) : string
$organizationId string
리턴 string JSON or null

getUserInfo() 공개 메소드

Call it without parameters to get the users info of the owner of the API key.
public getUserInfo ( string $userId = null, array $opts = [] ) : string
$userId string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getUsers() 공개 메소드

Returns the user records for all users in all workspaces you have access.
public getUsers ( array $opts = [] ) : string
$opts array Array of options to pass to the API (@see https://asana.com/developers/api-reference/users) Example: Returning additional fields with 'opt_fields' getUsers(['opt_fields' => 'name,email,photo,workspaces'])
리턴 string JSON or null

getWebhook() 공개 메소드

Returns the full record for the given webhook.
public getWebhook ( string $webhookId ) : string
$webhookId string The webhook to get.
리턴 string JSON or null

getWebhooks() 공개 메소드

Returns the compact representation of all webhooks your app has registered for the authenticated user in the given workspace.
public getWebhooks ( string $workspaceId, string $resource = null, array $opts = [] ) : string
$workspaceId string The workspace to query for webhooks in.
$resource string Optional: Only return webhooks for the given resource.
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getWorkspaceTags() 공개 메소드

Returns tags of all workspace.
public getWorkspaceTags ( string $workspaceId ) : string
$workspaceId string The id of the workspace
리턴 string JSON or null

getWorkspaceTasks() 공개 메소드

Note: As Asana API says, you must specify an assignee when querying for workspace tasks.
public getWorkspaceTasks ( string $workspaceId, string $assignee = 'me', array $opts = [] ) : string
$workspaceId string The id of the workspace
$assignee string Can be "me" or user ID
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getWorkspaceTypeahead() 공개 메소드

Returns search for objects from a single workspace.
public getWorkspaceTypeahead ( string $workspaceId, string $type, string $query, string $count = 1, array $opts = [] ) : string
$workspaceId string The id of the workspace
$type string The type of object to look up. You can choose from one of the following: project, user, task, and tag. Note that unlike other endpoints, the types listed here are in singular form. Using multiple types is not yet supported.
$query string The value to look up
$count string The number of results to return with a minimum of 1 and a maximum of 100. The default is 1 if this parameter is omitted. If there are fewer results found than requested, all will be returned
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

getWorkspaceUsers() 공개 메소드

Returns users of all workspace.
public getWorkspaceUsers ( string $workspaceId ) : string
$workspaceId string The id of the workspace
리턴 string JSON or null

getWorkspaces() 공개 메소드

Returns all the workspaces.
public getWorkspaces ( array $opts = [] ) : string
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

hasError() 공개 메소드

Checks for errors in the response.
public hasError ( ) : boolean
리턴 boolean

moveTaskWithinProject() 공개 메소드

Moves a task within a project relative to another task. This should let you take a task and move it below or above another task as long as they are within the same project.
public moveTaskWithinProject ( string $projectId, string $taskToMove, string $taskReference, boolean $insertAfter = true ) : string
$projectId string the project $taskReference is in and optionally $taskToMove is already in ($taskToMove will be added to the project if it's not already there)
$taskToMove string the task that will be moved (and possibly added to $projectId
$taskReference string the task that indicates a position for $taskToMove
$insertAfter boolean true to insert after $taskReference, false to insert before
리턴 string JSON or null

removeFollowersFromTask() 공개 메소드

Removes followers from a task
public removeFollowersFromTask ( string $taskId, array $followerIds ) : string
$taskId string
$followerIds array Array of follower ids
리턴 string JSON or null

removeProjectToTask() 공개 메소드

Removes project from task. If successful, will return success and an empty data block.
public removeProjectToTask ( string $taskId, string $projectId ) : string
$taskId string
$projectId string
리턴 string JSON or null

removeTagFromTask() 공개 메소드

Removes a tag from a task. If successful, will return success and an empty data block.
public removeTagFromTask ( string $taskId, string $tagId ) : string
$taskId string
$tagId string
리턴 string JSON or null

setReturnType() 공개 메소드

Set the return type.
public setReturnType ( integer $type ) : Asana
$type integer Return type defined in the constants.
리턴 Asana

updateProject() 공개 메소드

This method modifies the fields of a project provided in the request, then returns the full updated record.
public updateProject ( string $projectId, array $data ) : string
$projectId string
$data array An array containing fields to update, see Asana API if needed. Example: array("name" => "Test", "notes" => "It's a test project");
리턴 string JSON or null

updateTag() 공개 메소드

Modifies the fields of a tag provided in the request, then returns the full updated record.
public updateTag ( string $tagId, array $data ) : string
$tagId string
$data array An array containing fields to update, see Asana API if needed. Example: array("name" => "Test", "notes" => "It's a test tag");
리턴 string JSON or null

updateTask() 공개 메소드

Updates a task
public updateTask ( string $taskId, array $data ) : string
$taskId string
$data array See, createTask function comments for proper parameter info.
리턴 string JSON or null

updateTaskParent() 공개 메소드

Updated the parent from a task.
public updateTaskParent ( string $taskId, string $parentId, array $opts = [] ) : string
$taskId string The task to update
$parentId string The id of the new parent task.
$opts array Array of options to pass (@see https://asana.com/developers/documentation/getting-started/input-output-options)
리턴 string JSON or null

updateWorkspace() 공개 메소드

This method returns the complete updated workspace record.
public updateWorkspace ( $workspaceId, array $data = ['name' => ''] ) : string
$data array Example: array("name" => "Test");
리턴 string JSON or null

프로퍼티 상세

$advDebug 공개적으로 프로퍼티

public $advDebug

$debug 공개적으로 프로퍼티

public $debug

$fastAPI 공개적으로 프로퍼티

public $fastAPI

$responseCode 공개적으로 프로퍼티

public $responseCode

$timeout 공개적으로 프로퍼티

Use Asana fast API version, currently in open beta: https://asana.com/developers/feed/asana-fast-api-open-beta
public $timeout