diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 0000000..dee7cd5 --- /dev/null +++ b/.swagger-codegen-ignore @@ -0,0 +1,4 @@ +# Swagger Codegen Ignore + +src/Asana/test/Api/* +src/Asana/Client.php diff --git a/.travis.yml b/.travis.yml index 79b2370..2b10545 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: php +dist: trusty php: - - 5.4 - - 5.5 - - 5.6 + - 7.3 + - 7.4 install: composer install -script: phpunit --configuration tests/phpunit.xml +script: vendor/phpunit/phpunit/phpunit --configuration tests/phpunit.xml diff --git a/README.md b/README.md index 2afadb2..92f7c69 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ If you use [Composer](https://getcomposer.org/) to manage dependencies you can i ```json { "require": { - "asana/asana": "^0.8.0" + "asana/asana": "^0.10.0" } } ``` @@ -108,12 +108,12 @@ The client's methods are divided into several resources: `attachments`, `events` Methods that return a single object return that object directly: ```php users->me(); +$me = $client->users->getUser("me"); echo "Hello " . $me->name; -$workspaceId = $me->workspaces[0]->id; -$project = $client->projects->createInWorkspace($workspaceId, array('name' => 'new project')); -echo "Created project with id: " . $project->id; +$workspaceGid = $me->workspaces[0]->gid; +$project = $client->projects->createProjectForWorkspace($workspaceGid, array('name' => 'new project')); +echo "Created project with gid: " . $project->gid; ``` Methods that return multiple items (e.x. `findAll`) return an items iterator by default. See the "Collections" section @@ -152,6 +152,29 @@ Events: * `poll_interval` (default: 5): polling interval for getting new events via `events->getNext` and `events->getIterator` * `sync`: sync token returned by previous calls to `events->get` (in `response->sync`) +## Asana Change Warnings +You will receive warning logs if performing requests that may be affected by a deprecation. The warning contains a link that explains the deprecation. + +If you receive one of these warnings, you should: + +Read about the deprecation. +Resolve sections of your code that would be affected by the deprecation. +Add the deprecation flag to your "asana-enable" header. +You can place it on the client for all requests, or place it on a single request. + + $client = Asana\Client::accessToken('ASANA_PERSONAL_ACCESS_TOKEN', + array('headers' => array('asana-disable' => 'string_ids'))) + +or + + $client = Asana\Client::accessToken('ASANA_PERSONAL_ACCESS_TOKEN', + array('headers' => array('asana-enable' => 'string_ids,new_sections'))) + +If you would rather suppress these warnings, you can set + + $client = Asana\Client::accessToken('ASANA_PERSONAL_ACCESS_TOKEN', + array('log_asana_change_warnings' => false)) + ## Collections ### Items Iterator @@ -159,7 +182,7 @@ Events: By default, methods that return a collection of objects return an item iterator: ```php workspaces->findAll(); +$workspaces = $client->workspaces->getWorkspaces(); foreach ($workspaces as $workspace) { var_dump($workspace); } @@ -174,7 +197,7 @@ You can also use the raw API to fetch a page at a time: workspaces->findAll(null, array('offset' => $offset, 'iterator_type' => null, 'page_size' => 2)); + $page = $client->workspaces->getWorkspaces(null, array('offset' => $offset, 'iterator_type' => null, 'page_size' => 2)); var_dump($page); if (isset($page->next_page)) { $offset = $page->next_page->offset; @@ -196,8 +219,8 @@ To develop: ### Code generation -The specific Asana resource classes (`Tag`, `Workspace`, `Task`, etc) are -generated code, hence they shouldn't be modified by hand. See the [asana-api-meta](https://github.com/Asana/asana-api-meta) repo for details. +The specific Asana resource classes in the Gen folder (`Tag`, `Workspace`, `Task`, etc) are +generated code, hence they shouldn't be modified by hand. ### Deployment @@ -217,3 +240,5 @@ The rest is automatically done by Composer / Packagist. Visit [the asana package [packagist-url]: https://packagist.org/packages/asana/asana [packagist-image]: https://img.shields.io/packagist/v/asana/asana.svg?style=flat-square + +[asana-docs]: https://developers.asana.com/docs diff --git a/VERSION b/VERSION index a3df0a6..5712157 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.0 +0.10.1 diff --git a/composer.json b/composer.json index 15fc103..a62d86f 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,8 @@ "adoy/oauth2": "^1.2.0" }, "require-dev": { - "phpunit/PHPUnit": "4.5.*", - "instaclick/php-code-sniffer": "dev-master" + "instaclick/php-code-sniffer": "dev-master", + "phpunit/phpunit": "^9" }, "autoload": { "psr-0": { diff --git a/composer.lock b/composer.lock index e3b5180..8b5bc4f 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "9a16b5d67bd631b27f415467cf62b927", - "content-hash": "4826f1dc5c09500ec94ad0b8fcd9ed43", + "content-hash": "7b1af075a643f2ad0f3a149ec65865e9", "packages": [ { "name": "adoy/oauth2", @@ -45,7 +44,7 @@ } ], "description": "Light PHP wrapper for the OAuth 2.0 protocol (based on OAuth 2.0 Authorization Protocol draft-ietf-oauth-v2-15)", - "time": "2015-08-03 19:57:06" + "time": "2015-08-03T19:57:06+00:00" }, { "name": "nategood/httpful", @@ -95,38 +94,40 @@ "rest", "restful" ], - "time": "2015-03-08 15:22:23" + "time": "2015-03-08T15:22:23+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1 || ^8.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -146,12 +147,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2020-05-29T17:27:14+00:00" }, { "name": "instaclick/php-code-sniffer", @@ -218,43 +219,290 @@ "phpcs", "standards" ], - "time": "2013-01-04 16:10:29" + "time": "2013-01-04T16:10:29+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.10.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2020-06-29T13:22:24+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2020-02-22T12:28:44+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] + "psr-4": { + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -264,42 +512,46 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-02-03 12:10:50" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-06-27T10:12:23+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.5.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" + "doctrine/instantiator": "^1.2", + "php": "^7.2", + "phpdocumentor/reflection-docblock": "^5.0", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -327,43 +579,45 @@ "spy", "stub" ], - "time": "2015-08-13 10:07:40" + "time": "2020-07-08T12:44:21+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.2.2", + "version": "8.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.3", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-token-stream": "^4.0", + "sebastian/code-unit-reverse-lookup": "^2.0", + "sebastian/environment": "^5.0", + "sebastian/version": "^3.0", + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "phpunit/phpunit": "^9.0" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "8.0-dev" } }, "autoload": { @@ -378,7 +632,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -389,42 +643,47 @@ "testing", "xunit" ], - "time": "2015-08-04 03:42:39" + "time": "2020-05-23T08:02:54+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/25fefc5b19835ca653877fe081644a3f8c1d915e", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -434,26 +693,87 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2020-07-11T05:18:21+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f6eedfed1085dd1f4c599629459a0277d25f9a66", + "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "time": "2020-06-26T11:53:53+00:00" }, { "name": "phpunit/php-text-template", - "version": "1.2.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -475,26 +795,34 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2020-06-26T11:55:37+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/cc49734779cbb302bf51a44297dab8c4bbf941e7", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -507,7 +835,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -516,33 +844,33 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2020-06-26T11:58:13+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.6", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" + "reference": "5672711b6b07b14d5ab694e700c62eeb82fcf374" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5672711b6b07b14d5ab694e700c62eeb82fcf374", + "reference": "5672711b6b07b14d5ab694e700c62eeb82fcf374", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -565,45 +893,58 @@ "keywords": [ "tokenizer" ], - "time": "2015-08-16 08:51:00" + "time": "2020-06-27T06:36:25+00:00" }, { "name": "phpunit/phpunit", - "version": "4.5.1", + "version": "9.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4" + "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4", - "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c6a9e4312e209e659f1fce3ce88dd197c2448f6", + "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "~1.3,>=1.3.1", - "phpunit/php-code-coverage": "~2.0,>=2.0.11", - "phpunit/php-file-iterator": "~1.3.2", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.2", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.5", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.3", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^8.0.2", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-invoker": "^3.0.2", + "phpunit/php-text-template": "^2.0.2", + "phpunit/php-timer": "^5.0.1", + "sebastian/code-unit": "^1.0.5", + "sebastian/comparator": "^4.0.3", + "sebastian/diff": "^4.0.1", + "sebastian/environment": "^5.1.2", + "sebastian/exporter": "^4.0.2", + "sebastian/global-state": "^4.0", + "sebastian/object-enumerator": "^4.0.2", + "sebastian/resource-operations": "^3.0.2", + "sebastian/type": "^2.1.1", + "sebastian/version": "^3.0.1" + }, + "require-dev": { + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0" }, "suggest": { - "phpunit/php-invoker": "~1.1" + "ext-soap": "*", + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -611,12 +952,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5.x-dev" + "dev-master": "9.2-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -637,38 +981,32 @@ "testing", "xunit" ], - "time": "2015-03-29 09:24:05" + "time": "2020-07-13T17:55:55+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.7", + "name": "sebastian/code-unit", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a" + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/c1e2df332c905079980b119c4db103117e5e5c90", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -683,44 +1021,38 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-08-19 09:14:08" + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "time": "2020-06-26T12:50:45+00:00" }, { - "name": "sebastian/comparator", - "version": "1.2.0", + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ee51f9bb0c6d8a43337055db3120829fa14da819", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -734,55 +1066,103 @@ ], "authors": [ { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2020-06-26T12:04:00+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" }, { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2020-06-26T12:05:46+00:00" }, { "name": "sebastian/diff", - "version": "1.3.0", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -795,46 +1175,52 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2015-02-22 15:13:53" + "time": "2020-06-30T04:46:02+00:00" }, { "name": "sebastian/environment", - "version": "1.3.2", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -859,33 +1245,34 @@ "environment", "hhvm" ], - "time": "2015-08-03 06:14:51" + "time": "2020-06-26T12:07:24+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "571d721db4aec847a0e59690b954af33ebf9f023" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/571d721db4aec847a0e59690b954af33ebf9f023", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": "^7.3 || ^8.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "ext-mbstring": "*", + "phpunit/phpunit": "^9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -898,6 +1285,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -906,17 +1297,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -925,27 +1312,30 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2020-06-26T12:08:55+00:00" }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-dom": "*", + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-uopz": "*" @@ -953,7 +1343,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -976,32 +1366,124 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2020-02-07T06:11:37+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2020-06-26T12:11:32+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "127a46f6b057441b201253526f81d5406d6c7840" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/127a46f6b057441b201253526f81d5406d6c7840", + "reference": "127a46f6b057441b201253526f81d5406d6c7840", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2020-06-26T12:12:55+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.1", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1014,14 +1496,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1029,23 +1511,122 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21 08:04:50" + "time": "2020-06-26T12:14:17+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0653718a5a629b065e91f774595267f8dc32e213" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0653718a5a629b065e91f774595267f8dc32e213", + "reference": "0653718a5a629b065e91f774595267f8dc32e213", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2020-06-26T12:16:22+00:00" + }, + { + "name": "sebastian/type", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2020-07-05T08:31:53+00:00" }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/626586115d0ed31cb71483be55beb759b5af5a3c", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c", "shasum": "" }, + "require": { + "php": "^7.3 || ^8.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1064,38 +1645,45 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2020-06-26T12:18:43+00:00" }, { - "name": "symfony/yaml", - "version": "v2.7.3", + "name": "symfony/polyfill-ctype", + "version": "v1.18.0", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.3.3" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "suggest": { + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" - } + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1103,17 +1691,112 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", - "time": "2015-07-28 14:07:07" + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2020-07-12T23:59:07+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], diff --git a/examples/example-create-task-and-upload.php b/examples/example-create-task-and-upload.php index 8a0ed2f..c85f258 100644 --- a/examples/example-create-task-and-upload.php +++ b/examples/example-create-task-and-upload.php @@ -20,11 +20,11 @@ $me = $client->users->me(); echo "me="; var_dump($client->users->me()); -// find your "Personal Projects" project +// find your "Personal Projects" workspace $personalProjectsArray = array_filter($me->workspaces, function($item) { return $item->name === 'Personal Projects'; }); $personalProjects = array_pop($personalProjectsArray); var_dump($personalProjects); -$projects = $client->projects->findByWorkspace($personalProjects->id, null, array('iterator_type' => false, 'page_size' => null))->data; +$projects = $client->projects->findByWorkspace($personalProjects->gid, null, array('iterator_type' => false, 'page_size' => null))->data; echo "personal projects="; var_dump($projects); // create a "demo project" if it doesn't exist @@ -32,22 +32,22 @@ $project = array_pop($projectArray); if ($project === null) { echo "creating 'demo project'\n"; - $project = $client->projects->createInWorkspace($personalProjects->id, array('name' => 'demo project')); + $project = $client->projects->createInWorkspace($personalProjects->gid, array('name' => 'demo project')); } echo "project="; var_dump($project); // create a task in the project -$demoTask = $client->tasks->createInWorkspace($personalProjects->id, array( +$demoTask = $client->tasks->createInWorkspace($personalProjects->gid, array( "name" => "demo task created at " . date('m/d/Y h:i:s a'), - "projects" => array($project->id) + "projects" => array($project->gid) )); -echo "Task " . $demoTask->id . " created.\n"; +echo "Task " . $demoTask->gid . " created.\n"; // add an attachment to the task $demoAttachment = $client->attachments->createOnTask( - $demoTask->id, + $demoTask->gid, "hello world", "upload.txt", "text/plain" ); -echo "Attachment " . $demoAttachment->id . " created.\n"; +echo "Attachment " . $demoAttachment->gid . " created.\n"; diff --git a/samples/AttachmentsSample.yaml b/samples/AttachmentsSample.yaml new file mode 100644 index 0000000..bf0aa17 --- /dev/null +++ b/samples/AttachmentsSample.yaml @@ -0,0 +1,41 @@ +attachments: + createAttachmentForTask: >- + attachments->createAttachmentForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteAttachment: >- + attachments->deleteAttachment($attachment_gid, array('opt_pretty' => 'true')) + getAttachment: >- + attachments->getAttachment($attachment_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getAttachmentsForTask: >- + attachments->getAttachmentsForTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/BatchAPISample.yaml b/samples/BatchAPISample.yaml new file mode 100644 index 0000000..fafb5c8 --- /dev/null +++ b/samples/BatchAPISample.yaml @@ -0,0 +1,11 @@ +batchapi: + createBatchRequest: >- + batchapi->createBatchRequest(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/CustomFieldSettingsSample.yaml b/samples/CustomFieldSettingsSample.yaml new file mode 100644 index 0000000..3151557 --- /dev/null +++ b/samples/CustomFieldSettingsSample.yaml @@ -0,0 +1,21 @@ +customfieldsettings: + getCustomFieldSettingsForPortfolio: >- + customfieldsettings->getCustomFieldSettingsForPortfolio($portfolio_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getCustomFieldSettingsForProject: >- + customfieldsettings->getCustomFieldSettingsForProject($project_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/CustomFieldsSample.yaml b/samples/CustomFieldsSample.yaml new file mode 100644 index 0000000..e9fe763 --- /dev/null +++ b/samples/CustomFieldsSample.yaml @@ -0,0 +1,81 @@ +customfields: + createCustomField: >- + customfields->createCustomField(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createEnumOptionForCustomField: >- + customfields->createEnumOptionForCustomField($custom_field_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteCustomField: >- + customfields->deleteCustomField($custom_field_gid, array('opt_pretty' => 'true')) + getCustomField: >- + customfields->getCustomField($custom_field_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getCustomFieldsForWorkspace: >- + customfields->getCustomFieldsForWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + insertEnumOptionForCustomField: >- + customfields->insertEnumOptionForCustomField($custom_field_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + updateCustomField: >- + customfields->updateCustomField($custom_field_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + updateEnumOption: >- + customfields->updateEnumOption($enum_option_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/EventsSample.yaml b/samples/EventsSample.yaml new file mode 100644 index 0000000..5bcb15c --- /dev/null +++ b/samples/EventsSample.yaml @@ -0,0 +1,11 @@ +events: + getEvents: >- + events->getEvents(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/JobsSample.yaml b/samples/JobsSample.yaml new file mode 100644 index 0000000..c76c957 --- /dev/null +++ b/samples/JobsSample.yaml @@ -0,0 +1,11 @@ +jobs: + getJob: >- + jobs->getJob($job_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/OrganizationExportsSample.yaml b/samples/OrganizationExportsSample.yaml new file mode 100644 index 0000000..6399736 --- /dev/null +++ b/samples/OrganizationExportsSample.yaml @@ -0,0 +1,21 @@ +organizationexports: + createOrganizationExport: >- + organizationexports->createOrganizationExport(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + getOrganizationExport: >- + organizationexports->getOrganizationExport($organization_export_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/PortfolioMembershipsSample.yaml b/samples/PortfolioMembershipsSample.yaml new file mode 100644 index 0000000..789f357 --- /dev/null +++ b/samples/PortfolioMembershipsSample.yaml @@ -0,0 +1,31 @@ +portfoliomemberships: + getPortfolioMembership: >- + portfoliomemberships->getPortfolioMembership($portfolio_membership_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getPortfolioMemberships: >- + portfoliomemberships->getPortfolioMemberships(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getPortfolioMembershipsForPortfolio: >- + portfoliomemberships->getPortfolioMembershipsForPortfolio($portfolio_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/PortfoliosSample.yaml b/samples/PortfoliosSample.yaml new file mode 100644 index 0000000..e5cfe0c --- /dev/null +++ b/samples/PortfoliosSample.yaml @@ -0,0 +1,121 @@ +portfolios: + addCustomFieldSettingForPortfolio: >- + portfolios->addCustomFieldSettingForPortfolio($portfolio_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addItemForPortfolio: >- + portfolios->addItemForPortfolio($portfolio_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addMembersForPortfolio: >- + portfolios->addMembersForPortfolio($portfolio_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createPortfolio: >- + portfolios->createPortfolio(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deletePortfolio: >- + portfolios->deletePortfolio($portfolio_gid, array('opt_pretty' => 'true')) + getItemsForPortfolio: >- + portfolios->getItemsForPortfolio($portfolio_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getPortfolio: >- + portfolios->getPortfolio($portfolio_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getPortfolios: >- + portfolios->getPortfolios(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + removeCustomFieldSettingForPortfolio: >- + portfolios->removeCustomFieldSettingForPortfolio($portfolio_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeItemForPortfolio: >- + portfolios->removeItemForPortfolio($portfolio_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeMembersForPortfolio: >- + portfolios->removeMembersForPortfolio($portfolio_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + updatePortfolio: >- + portfolios->updatePortfolio($portfolio_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/ProjectMembershipsSample.yaml b/samples/ProjectMembershipsSample.yaml new file mode 100644 index 0000000..e11157c --- /dev/null +++ b/samples/ProjectMembershipsSample.yaml @@ -0,0 +1,21 @@ +projectmemberships: + getProjectMembership: >- + projectmemberships->getProjectMembership($project_membership_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getProjectMembershipsForProject: >- + projectmemberships->getProjectMembershipsForProject($project_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/ProjectStatusesSample.yaml b/samples/ProjectStatusesSample.yaml new file mode 100644 index 0000000..a971d55 --- /dev/null +++ b/samples/ProjectStatusesSample.yaml @@ -0,0 +1,41 @@ +projectstatuses: + createProjectStatusForProject: >- + projectstatuses->createProjectStatusForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteProjectStatus: >- + projectstatuses->deleteProjectStatus($project_status_gid, array('opt_pretty' => 'true')) + getProjectStatus: >- + projectstatuses->getProjectStatus($project_status_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getProjectStatusesForProject: >- + projectstatuses->getProjectStatusesForProject($project_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/ProjectsSample.yaml b/samples/ProjectsSample.yaml new file mode 100644 index 0000000..a3d10ce --- /dev/null +++ b/samples/ProjectsSample.yaml @@ -0,0 +1,181 @@ +projects: + addCustomFieldSettingForProject: >- + projects->addCustomFieldSettingForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addFollowersForProject: >- + projects->addFollowersForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addMembersForProject: >- + projects->addMembersForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createProject: >- + projects->createProject(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createProjectForTeam: >- + projects->createProjectForTeam($team_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createProjectForWorkspace: >- + projects->createProjectForWorkspace($workspace_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteProject: >- + projects->deleteProject($project_gid, array('opt_pretty' => 'true')) + duplicateProject: >- + projects->duplicateProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + getProject: >- + projects->getProject($project_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getProjects: >- + projects->getProjects(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getProjectsForTask: >- + projects->getProjectsForTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getProjectsForTeam: >- + projects->getProjectsForTeam($team_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getProjectsForWorkspace: >- + projects->getProjectsForWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTaskCountsForProject: >- + projects->getTaskCountsForProject($project_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + removeCustomFieldSettingForProject: >- + projects->removeCustomFieldSettingForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeFollowersForProject: >- + projects->removeFollowersForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeMembersForProject: >- + projects->removeMembersForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + updateProject: >- + projects->updateProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/SectionsSample.yaml b/samples/SectionsSample.yaml new file mode 100644 index 0000000..3182c38 --- /dev/null +++ b/samples/SectionsSample.yaml @@ -0,0 +1,71 @@ +sections: + addTaskForSection: >- + sections->addTaskForSection($section_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createSectionForProject: >- + sections->createSectionForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteSection: >- + sections->deleteSection($section_gid, array('opt_pretty' => 'true')) + getSection: >- + sections->getSection($section_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getSectionsForProject: >- + sections->getSectionsForProject($project_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + insertSectionForProject: >- + sections->insertSectionForProject($project_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + updateSection: >- + sections->updateSection($section_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/StoriesSample.yaml b/samples/StoriesSample.yaml new file mode 100644 index 0000000..e06d5a9 --- /dev/null +++ b/samples/StoriesSample.yaml @@ -0,0 +1,51 @@ +stories: + createStoryForTask: >- + stories->createStoryForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteStory: >- + stories->deleteStory($story_gid, array('opt_pretty' => 'true')) + getStoriesForTask: >- + stories->getStoriesForTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getStory: >- + stories->getStory($story_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + updateStory: >- + stories->updateStory($story_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/TagsSample.yaml b/samples/TagsSample.yaml new file mode 100644 index 0000000..6f3de2e --- /dev/null +++ b/samples/TagsSample.yaml @@ -0,0 +1,71 @@ +tags: + createTag: >- + tags->createTag(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createTagForWorkspace: >- + tags->createTagForWorkspace($workspace_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + getTag: >- + tags->getTag($tag_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTags: >- + tags->getTags(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTagsForTask: >- + tags->getTagsForTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTagsForWorkspace: >- + tags->getTagsForWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + updateTag: >- + tags->updateTag($tag_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/TasksSample.yaml b/samples/TasksSample.yaml new file mode 100644 index 0000000..8c975c8 --- /dev/null +++ b/samples/TasksSample.yaml @@ -0,0 +1,261 @@ +tasks: + addDependenciesForTask: >- + tasks->addDependenciesForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addDependentsForTask: >- + tasks->addDependentsForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addFollowersForTask: >- + tasks->addFollowersForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addProjectForTask: >- + tasks->addProjectForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + addTagForTask: >- + tasks->addTagForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createSubtaskForTask: >- + tasks->createSubtaskForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + createTask: >- + tasks->createTask(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteTask: >- + tasks->deleteTask($task_gid, array('opt_pretty' => 'true')) + duplicateTask: >- + tasks->duplicateTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + getDependenciesForTask: >- + tasks->getDependenciesForTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getDependentsForTask: >- + tasks->getDependentsForTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getSubtasksForTask: >- + tasks->getSubtasksForTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTask: >- + tasks->getTask($task_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTasks: >- + tasks->getTasks(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTasksForProject: >- + tasks->getTasksForProject($project_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTasksForSection: >- + tasks->getTasksForSection($section_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTasksForTag: >- + tasks->getTasksForTag($tag_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTasksForUserTaskList: >- + tasks->getTasksForUserTaskList($user_task_list_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + removeDependenciesForTask: >- + tasks->removeDependenciesForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeDependentsForTask: >- + tasks->removeDependentsForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeFollowerForTask: >- + tasks->removeFollowerForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeProjectForTask: >- + tasks->removeProjectForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + removeTagForTask: >- + tasks->removeTagForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + searchTasksForWorkspace: >- + tasks->searchTasksForWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + setParentForTask: >- + tasks->setParentForTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + updateTask: >- + tasks->updateTask($task_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/TeamMembershipsSample.yaml b/samples/TeamMembershipsSample.yaml new file mode 100644 index 0000000..eef6e5d --- /dev/null +++ b/samples/TeamMembershipsSample.yaml @@ -0,0 +1,41 @@ +teammemberships: + getTeamMembership: >- + teammemberships->getTeamMembership($team_membership_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTeamMemberships: >- + teammemberships->getTeamMemberships(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTeamMembershipsForTeam: >- + teammemberships->getTeamMembershipsForTeam($team_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTeamMembershipsForUser: >- + teammemberships->getTeamMembershipsForUser($user_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/TeamsSample.yaml b/samples/TeamsSample.yaml new file mode 100644 index 0000000..19b955b --- /dev/null +++ b/samples/TeamsSample.yaml @@ -0,0 +1,51 @@ +teams: + addUserForTeam: >- + teams->addUserForTeam($team_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + getTeam: >- + teams->getTeam($team_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTeamsForOrganization: >- + teams->getTeamsForOrganization($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getTeamsForUser: >- + teams->getTeamsForUser($user_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + removeUserForTeam: >- + teams->removeUserForTeam($team_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/TypeaheadSample.yaml b/samples/TypeaheadSample.yaml new file mode 100644 index 0000000..312b4cc --- /dev/null +++ b/samples/TypeaheadSample.yaml @@ -0,0 +1,11 @@ +typeahead: + typeaheadForWorkspace: >- + typeahead->typeaheadForWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/UserTaskListsSample.yaml b/samples/UserTaskListsSample.yaml new file mode 100644 index 0000000..0566916 --- /dev/null +++ b/samples/UserTaskListsSample.yaml @@ -0,0 +1,21 @@ +usertasklists: + getUserTaskList: >- + usertasklists->getUserTaskList($user_task_list_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getUserTaskListForUser: >- + usertasklists->getUserTaskListForUser($user_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/UsersSample.yaml b/samples/UsersSample.yaml new file mode 100644 index 0000000..5fbd0ee --- /dev/null +++ b/samples/UsersSample.yaml @@ -0,0 +1,51 @@ +users: + getFavoritesForUser: >- + users->getFavoritesForUser($user_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getUser: >- + users->getUser($user_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getUsers: >- + users->getUsers(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getUsersForTeam: >- + users->getUsersForTeam($team_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getUsersForWorkspace: >- + users->getUsersForWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/WebhooksSample.yaml b/samples/WebhooksSample.yaml new file mode 100644 index 0000000..4562716 --- /dev/null +++ b/samples/WebhooksSample.yaml @@ -0,0 +1,41 @@ +webhooks: + createWebhook: >- + webhooks->createWebhook(array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + deleteWebhook: >- + webhooks->deleteWebhook($webhook_gid, array('opt_pretty' => 'true')) + getWebhook: >- + webhooks->getWebhook($webhook_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getWebhooks: >- + webhooks->getWebhooks(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/WorkspaceMembershipsSample.yaml b/samples/WorkspaceMembershipsSample.yaml new file mode 100644 index 0000000..fa77756 --- /dev/null +++ b/samples/WorkspaceMembershipsSample.yaml @@ -0,0 +1,31 @@ +workspacememberships: + getWorkspaceMembership: >- + workspacememberships->getWorkspaceMembership($workspace_membership_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getWorkspaceMembershipsForUser: >- + workspacememberships->getWorkspaceMembershipsForUser($user_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getWorkspaceMembershipsForWorkspace: >- + workspacememberships->getWorkspaceMembershipsForWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) diff --git a/samples/WorkspacesSample.yaml b/samples/WorkspacesSample.yaml new file mode 100644 index 0000000..1532638 --- /dev/null +++ b/samples/WorkspacesSample.yaml @@ -0,0 +1,51 @@ +workspaces: + addUserForWorkspace: >- + workspaces->addUserForWorkspace($workspace_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + getWorkspace: >- + workspaces->getWorkspace($workspace_gid, array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + getWorkspaces: >- + workspaces->getWorkspaces(array('param' => 'value', 'param' => 'value'), array('opt_pretty' => 'true')) + removeUserForWorkspace: >- + workspaces->removeUserForWorkspace($workspace_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) + updateWorkspace: >- + workspaces->updateWorkspace($workspace_gid, array('field' => 'value', 'field' => 'value'), array('opt_pretty' => 'true')) diff --git a/src/Asana/Client.php b/src/Asana/Client.php index b02c57e..ae418f2 100644 --- a/src/Asana/Client.php +++ b/src/Asana/Client.php @@ -10,6 +10,11 @@ use Asana\Errors\RateLimitEnforcedError; use Asana\Iterator\CollectionPageIterator; +use Asana\Resources\Events; +use Asana\Resources\Portfolios; +use Asana\Resources\ProjectMemberships; +use Asana\Resources\Projects; +use Asana\Resources\Users; class Client { @@ -23,7 +28,8 @@ class Client 'poll_interval' => 5, 'max_retries' => 5, 'full_payload' => null, - 'iterator_type' => 'items' + 'iterator_type' => 'items', + 'log_asana_change_warnings' => true ); private static $QUERY_OPTIONS = array('limit', 'offset' , 'sync'); @@ -44,7 +50,10 @@ public function __construct($dispatcher, $options = array()) $this->custom_fields = new Resources\CustomFields($this); $this->custom_field_settings = new Resources\CustomFieldSettings($this); $this->events = new Resources\Events($this); + $this->jobs = new Resources\Jobs($this); $this->organization_exports = new Resources\OrganizationExports($this); + $this->portfolios = new Resources\Portfolios($this); + $this->portfolio_memberships = new Resources\PortfolioMemberships($this); $this->projects = new Resources\Projects($this); $this->project_memberships = new Resources\ProjectMemberships($this); $this->project_statuses = new Resources\ProjectStatuses($this); @@ -54,6 +63,7 @@ public function __construct($dispatcher, $options = array()) $this->tasks = new Resources\Tasks($this); $this->teams = new Resources\Teams($this); $this->users = new Resources\Users($this); + $this->user_task_lists = new Resources\UserTaskLists($this); $this->workspaces = new Resources\Workspaces($this); $this->webhooks = new Resources\Webhooks($this); } @@ -70,14 +80,21 @@ public static function oauth($credentials = array(), $options = array()) public function request($method, $path, $options) { - $options = array_merge($this->options, $options); + $options = Client::array_merge_recursive_distinct($this->options, $options); + $requestOptions = $this->parseRequestOptions($options); $uri = $options['base_url'] . $path; $retryCount = 0; + while (true) { try { $response = $this->dispatcher->request($method, $uri, $requestOptions); + if (!array_key_exists('headers', $options)) { + $options['headers'] = array(); + } + $this->logAsanaChangeHeaders($options['headers'], $response->headers->toArray()); + Errors\AsanaError::handleErrorResponse($response); if ($options['full_payload']) { @@ -96,6 +113,77 @@ public function request($method, $path, $options) } } + private function logAsanaChangeHeaders($reqHeaders, $resHeaders) + { + if (!$this->options['log_asana_change_warnings']) { + return; + } + + $changeHeaderKey = null; + + foreach ((array) $resHeaders as $key => $value) { + if (strtolower($key) == 'asana-change') { + $changeHeaderKey = $key; + } + } + + if ($changeHeaderKey != null) { + $flagsAccountedFor = array(); + + foreach ((array) $reqHeaders as $reqHeader => $reqHeaderValue) { + $lowerReqHeader = strtolower($reqHeader); + if ($lowerReqHeader == "asana-enable" || $lowerReqHeader == "asana-disable") { + + $flagsAccountedFor = array_merge($flagsAccountedFor, preg_split("/,/", $reqHeaderValue)); + } + } + + $changesArray = preg_split("/,/", $resHeaders[$changeHeaderKey]); + if ($changesArray == null) { + return; + } + + foreach ($changesArray as $change) { + $changeParams = preg_split("/;/", $change); + + $name = ""; + $info = ""; + $affected = ""; + + foreach ((array) $changeParams as $changeParam) { + $paramKeyValue = preg_split("/=/", $changeParam); + + $paramKeyValue[0] = trim($paramKeyValue[0]); + $paramKeyValue[1] = trim($paramKeyValue[1]); + switch ($paramKeyValue[0]) { + case "name": + $name = $paramKeyValue[1]; + break; + case "info": + $info = $paramKeyValue[1]; + break; + case "affected": + $affected = $paramKeyValue[1]; + break; + } + } + + if ($affected != "true") { + continue; + } + + if (!in_array($name, $flagsAccountedFor)) { + $message = "This request is affected by the \"" . $name . "\" deprecation. " . + "Please visit this url for more info: " . $info . "\n" . + "Adding \"" . $name . "\" to your \"Asana-Enable\" or \"Asana-Disable\" header " . + "will opt in/out to this deprecation and suppress this warning."; + + trigger_error($message, E_USER_WARNING); + } + } + } + } + private function handleRetryableError($e, $retryCount) { if ($e instanceof Errors\RateLimitEnforcedError) { @@ -141,10 +229,15 @@ public function getCollection($path, $query, $options = array()) public function post($path, $data, $options = array()) { $parameterOptions = $this->parseParameterOptions($options); + + $post_headers = array('content-type' => 'application/json'); + if (array_key_exists("headers", $options)) { + $post_headers = array_merge($post_headers, $options["headers"]); + } $options = array_merge( $options, array( - 'headers' => array('content-type' => 'application/json'), + 'headers' => $post_headers, 'data' => array( 'data' => array_merge($parameterOptions, $data), # values in the data body takes precendence 'options' => $this->parseApiOptions($options) @@ -157,10 +250,15 @@ public function post($path, $data, $options = array()) public function put($path, $data, $options = array()) { $parameterOptions = $this->parseParameterOptions($options); + + $put_headers = array('content-type' => 'application/json'); + if (array_key_exists("headers", $options)) { + $put_headers = array_merge($put_headers, $options["headers"]); + } $options = array_merge( $options, array( - 'headers' => array('content-type' => 'application/json'), + 'headers' => $put_headers, 'data' => array( 'data' => array_merge($parameterOptions, $data), # values in the data body takes precendence 'options' => $this->parseApiOptions($options) @@ -252,4 +350,21 @@ private static function bootstrap() ); } } + + private static function array_merge_recursive_distinct(array &$array1, array &$array2) + { + $merged = $array1; + foreach ($array2 as $key => &$value) + { + if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) + { + $merged[$key] = Client::array_merge_recursive_distinct($merged[$key], $value); + } + else + { + $merged[$key] = $value; + } + } + return $merged; + } } diff --git a/src/Asana/Iterator/CollectionPageIterator.php b/src/Asana/Iterator/CollectionPageIterator.php index 33b2d0b..807d815 100644 --- a/src/Asana/Iterator/CollectionPageIterator.php +++ b/src/Asana/Iterator/CollectionPageIterator.php @@ -6,6 +6,8 @@ class CollectionPageIterator extends PageIterator { + public $sync = null; + protected function getInitial() { return $this->client->get($this->path, $this->query, $this->options); @@ -19,6 +21,10 @@ protected function getNext() protected function getContinuation($result) { + if (!empty($result->sync)) { + $this->sync = $result->sync; + } + return isset($result->next_page) ? $result->next_page : null; } } diff --git a/src/Asana/Resources/Attachments.php b/src/Asana/Resources/Attachments.php index 665c7fe..4241db9 100644 --- a/src/Asana/Resources/Attachments.php +++ b/src/Asana/Resources/Attachments.php @@ -12,4 +12,32 @@ public function createOnTask($task, $content, $filename, $contentType, $options $options['files'] = array('file' => array($content, $filename, $contentType)); return $this->client->request('POST', $path, $options); } + + /** + * Returns the full record for a single attachment. + * + * @deprecated replace with getAttachment + * + * @param attachment Globally unique identifier for the attachment. + * @return response + */ + public function findById($attachment, $params = array(), $options = array()) + { + $path = sprintf("/attachments/%s", $attachment); + return $this->client->get($path, $params, $options); + } + + /** + * Returns the compact records for all attachments on the task. + * + * @deprecated replace with getAttachmentsForTask + * + * @param task Globally unique identifier for the task. + * @return response + */ + public function findByTask($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/attachments", $task); + return $this->client->getCollection($path, $params, $options); + } } diff --git a/src/Asana/Resources/BatchAPI.php b/src/Asana/Resources/BatchAPI.php new file mode 100644 index 0000000..2e02cb0 --- /dev/null +++ b/src/Asana/Resources/BatchAPI.php @@ -0,0 +1,9 @@ +client->getCollection($path, $params, $options); + } + + /** + * Returns a list of all of the custom fields settings on a portfolio. + * + * @deprecated replace with getCustomFieldSettingsForPortfolio + * + * @param portfolio The ID of the portfolio for which to list custom field settings + * @return response + */ + public function findByPortfolio($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/custom_field_settings", $portfolio); + return $this->client->getCollection($path, $params, $options); + } } diff --git a/src/Asana/Resources/CustomFields.php b/src/Asana/Resources/CustomFields.php index 2b6ee1f..37981bd 100644 --- a/src/Asana/Resources/CustomFields.php +++ b/src/Asana/Resources/CustomFields.php @@ -6,4 +6,131 @@ class CustomFields extends CustomFieldsBase { + public function addEnumOption($customField, $params = array(), $options = array()) + { + return $this->createEnumOption($customField, $params, $options); + } + + public function reorderEnumOption($customField, $params = array(), $options = array()) + { + return $this->insertEnumOption($customField, $params, $options); + } + + /** + * Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. + * + * A custom field's `name` must be unique within a workspace and not conflict with names of existing task properties such as 'Due Date' or 'Assignee'. A custom field's `type` must be one of 'text', 'enum', or 'number'. + * + * Returns the full record of the newly created custom field. + * + * @deprecated replace with createCustomField + * + * @return response + */ + public function create($params = array(), $options = array()) + { + return $this->client->post("/custom_fields", $params, $options); + } + + /** + * Returns the complete definition of a custom field's metadata. + * + * @deprecated replace with getCustomField + * + * @param custom_field Globally unique identifier for the custom field. + * @return response + */ + public function findById($customField, $params = array(), $options = array()) + { + $path = sprintf("/custom_fields/%s", $customField); + return $this->client->get($path, $params, $options); + } + + /** + * Returns a list of the compact representation of all of the custom fields in a workspace. + * + * @deprecated replace with getCustomFieldsForWorkspace + * + * @param workspace The workspace or organization to find custom field definitions in. + * @return response + */ + public function findByWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/custom_fields", $workspace); + return $this->client->getCollection($path, $params, $options); + } + + /** + * A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged + * + * When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field. + * + * An enum custom field's `enum_options` cannot be updated with this endpoint. Instead see "Work With Enum Options" for information on how to update `enum_options`. + * + * Locked custom fields can only be updated by the user who locked the field. + * + * Returns the complete updated custom field record. + * + * @deprecated replace with updateCustomField + * + * @param custom_field Globally unique identifier for the custom field. + * @return response + */ + public function update($customField, $params = array(), $options = array()) + { + $path = sprintf("/custom_fields/%s", $customField); + return $this->client->put($path, $params, $options); + } + + /** + * A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. + * + * Locked custom fields can only be deleted by the user who locked the field. + * + * Returns an empty data record. + * + * @deprecated replace with deleteCustomField + * + * @param custom_field Globally unique identifier for the custom field. + * @return response + */ + public function delete($customField, $params = array(), $options = array()) + { + $path = sprintf("/custom_fields/%s", $customField); + return $this->client->delete($path, $params, $options); + } + + /** + * Creates an enum option and adds it to this custom field's list of enum options. A custom field can have at most 50 enum options (including disabled options). By default new enum options are inserted at the end of a custom field's list. + * + * Locked custom fields can only have enum options added by the user who locked the field. + * + * Returns the full record of the newly created enum option. + * + * @deprecated replace with createEnumOptionForCustomField + * + * @param custom_field Globally unique identifier for the custom field. + * @return response + */ + public function createEnumOption($customField, $params = array(), $options = array()) + { + $path = sprintf("/custom_fields/%s/enum_options", $customField); + return $this->client->post($path, $params, $options); + } + + /** + * Moves a particular enum option to be either before or after another specified enum option in the custom field. + * + * Locked custom fields can only be reordered by the user who locked the field. + * + * @deprecated replace with insertEnumOptionForCustomField + * + * @param custom_field Globally unique identifier for the custom field. + * @return response + */ + public function insertEnumOption($customField, $params = array(), $options = array()) + { + $path = sprintf("/custom_fields/%s/enum_options/insert", $customField); + return $this->client->post($path, $params, $options); + } } diff --git a/src/Asana/Resources/Events.php b/src/Asana/Resources/Events.php index 2aa27ff..ad310c5 100644 --- a/src/Asana/Resources/Events.php +++ b/src/Asana/Resources/Events.php @@ -7,6 +7,9 @@ class Events extends EventsBase { + /** + * @deprecated replace with getEvents and include {"full_payload" = true} as an option + */ public function get($query = array(), $options = array()) { $options['full_payload'] = true; diff --git a/src/Asana/Resources/Gen/AttachmentsBase.php b/src/Asana/Resources/Gen/AttachmentsBase.php index df33e2a..f2770b3 100644 --- a/src/Asana/Resources/Gen/AttachmentsBase.php +++ b/src/Asana/Resources/Gen/AttachmentsBase.php @@ -2,13 +2,8 @@ namespace Asana\Resources\Gen; -/** - * An _attachment_ object represents any file attached to a task in Asana, - * whether it's an uploaded file or one associated via a third-party service - * such as Dropbox or Google Drive. -*/ -class AttachmentsBase -{ +class AttachmentsBase { + /** * @param Asana/Client client The client instance */ @@ -17,27 +12,42 @@ public function __construct($client) $this->client = $client; } - /** - * Returns the full record for a single attachment. + /** Delete an attachment * - * @param attachment Globally unique identifier for the attachment. + * @param string $attachment_gid (required) Globally unique identifier for the attachment. + * @param array $params + * @param array $options * @return response */ - public function findById($attachment, $params = array(), $options = array()) - { - $path = sprintf("/attachments/%s", $attachment); + public function deleteAttachment($attachment_gid, $params = array(), $options = array()) { + $path = "/attachments/{attachment_gid}"; + $path = str_replace("{attachment_gid}", $attachment_gid, $path); + return $this->client->delete($path, $params, $options); + } + + /** Get an attachment + * + * @param string $attachment_gid (required) Globally unique identifier for the attachment. + * @param array $params + * @param array $options + * @return response + */ + public function getAttachment($attachment_gid, $params = array(), $options = array()) { + $path = "/attachments/{attachment_gid}"; + $path = str_replace("{attachment_gid}", $attachment_gid, $path); return $this->client->get($path, $params, $options); } - /** - * Returns the compact records for all attachments on the task. + /** Get attachments for a task * - * @param task Globally unique identifier for the task. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findByTask($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/attachments", $task); + public function getAttachmentsForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/attachments"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->getCollection($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/BatchAPIBase.php b/src/Asana/Resources/Gen/BatchAPIBase.php new file mode 100644 index 0000000..77af5dd --- /dev/null +++ b/src/Asana/Resources/Gen/BatchAPIBase.php @@ -0,0 +1,25 @@ +client = $client; + } + + /** Submit parallel requests + * + * @param array $params + * @param array $options + * @return response + */ + public function createBatchRequest($params = array(), $options = array()) { + $path = "/batch"; + return $this->client->post($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/CustomFieldSettingsBase.php b/src/Asana/Resources/Gen/CustomFieldSettingsBase.php index ec23eff..4c1c415 100644 --- a/src/Asana/Resources/Gen/CustomFieldSettingsBase.php +++ b/src/Asana/Resources/Gen/CustomFieldSettingsBase.php @@ -2,15 +2,8 @@ namespace Asana\Resources\Gen; -/** - * Custom fields are attached to a particular project with the Custom - * Field Settings resource. This resource both represents the many-to-many join - * of the Custom Field and Project as well as stores information that is relevant to that - * particular pairing; for instance, the `is_important` property determines - * some possible application-specific handling of that custom field (see below) -*/ -class CustomFieldSettingsBase -{ +class CustomFieldSettingsBase { + /** * @param Asana/Client client The client instance */ @@ -19,19 +12,29 @@ public function __construct($client) $this->client = $client; } - /** - * Returns a list of all of the custom fields settings on a project, in compact form. - * Note that, as in all queries to collections which return compact representation, - * `opt_fields` and `opt_expand` can be used to include more data than is returned in the compact representation. - * See the getting started guide on - * [input/output options](/developers/documentation/getting-started/input-output-options) for more information. + /** Get a portfolio's custom fields * - * @param project The ID of the project for which to list custom field settings + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options * @return response */ - public function findByProject($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/custom_field_settings", $project); + public function getCustomFieldSettingsForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/custom_field_settings"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->getCollection($path, $params, $options); + } + + /** Get a project's custom fields + * + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options + * @return response + */ + public function getCustomFieldSettingsForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/custom_field_settings"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->getCollection($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/CustomFieldsBase.php b/src/Asana/Resources/Gen/CustomFieldsBase.php index 155beba..b079675 100644 --- a/src/Asana/Resources/Gen/CustomFieldsBase.php +++ b/src/Asana/Resources/Gen/CustomFieldsBase.php @@ -2,15 +2,8 @@ namespace Asana\Resources\Gen; -/** - * Custom Fields store the metadata that is used in order to add user-specified - * information to tasks in Asana. Be sure to reference the [Custom - * Fields](/developers/documentation/getting-started/custom-fields) developer - * documentation for more information about how custom fields relate to various - * resources in Asana. -*/ -class CustomFieldsBase -{ +class CustomFieldsBase { + /** * @param Asana/Client client The client instance */ @@ -19,125 +12,105 @@ public function __construct($client) $this->client = $client; } - /** - * Creates a new custom field in a workspace. Every custom field is required to be - * created in a specific workspace, and this workspace cannot be changed once set. - * - * A custom field's `name` must be unique within a workspace and not conflict - * with names of existing task properties such as 'Due Date' or 'Assignee'. - * A custom field's `type` must be one of 'text', 'enum', or 'number'. - * - * Returns the full record of the newly created custom field. + /** Create a custom field * + * @param array $params + * @param array $options * @return response */ - public function create($params = array(), $options = array()) - { - return $this->client->post("/custom_fields", $params, $options); + public function createCustomField($params = array(), $options = array()) { + $path = "/custom_fields"; + return $this->client->post($path, $params, $options); } - /** - * Returns the complete definition of a custom field's metadata. + /** Create an enum option * - * @param custom_field Globally unique identifier for the custom field. + * @param string $custom_field_gid (required) Globally unique identifier for the custom field. + * @param array $params + * @param array $options * @return response */ - public function findById($customField, $params = array(), $options = array()) - { - $path = sprintf("/custom_fields/%s", $customField); - return $this->client->get($path, $params, $options); + public function createEnumOptionForCustomField($custom_field_gid, $params = array(), $options = array()) { + $path = "/custom_fields/{custom_field_gid}/enum_options"; + $path = str_replace("{custom_field_gid}", $custom_field_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Returns a list of the compact representation of all of the custom fields in a workspace. + /** Delete a custom field * - * @param workspace The workspace or organization to find custom field definitions in. + * @param string $custom_field_gid (required) Globally unique identifier for the custom field. + * @param array $params + * @param array $options * @return response */ - public function findByWorkspace($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/custom_fields", $workspace); - return $this->client->getCollection($path, $params, $options); + public function deleteCustomField($custom_field_gid, $params = array(), $options = array()) { + $path = "/custom_fields/{custom_field_gid}"; + $path = str_replace("{custom_field_gid}", $custom_field_gid, $path); + return $this->client->delete($path, $params, $options); } - /** - * A specific, existing custom field can be updated by making a PUT request on the URL - * for that custom field. Only the fields provided in the `data` block will be updated; - * any unspecified fields will remain unchanged - * - * When using this method, it is best to specify only those fields you wish to change, - * or else you may overwrite changes made by another user since you last retrieved the - * custom field. - * - * A custom field's `type` cannot be updated. - * - * An enum custom field's `enum_options` cannot be updated with this endpoint. - * Instead see "Work With Enum Options" for information on how to update `enum_options`. - * - * Returns the complete updated custom field record. + /** Get a custom field * - * @param custom_field Globally unique identifier for the custom field. + * @param string $custom_field_gid (required) Globally unique identifier for the custom field. + * @param array $params + * @param array $options * @return response */ - public function update($customField, $params = array(), $options = array()) - { - $path = sprintf("/custom_fields/%s", $customField); - return $this->client->put($path, $params, $options); + public function getCustomField($custom_field_gid, $params = array(), $options = array()) { + $path = "/custom_fields/{custom_field_gid}"; + $path = str_replace("{custom_field_gid}", $custom_field_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. - * - * Returns an empty data record. + /** Get a workspace's custom fields * - * @param custom_field Globally unique identifier for the custom field. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function delete($customField, $params = array(), $options = array()) - { - $path = sprintf("/custom_fields/%s", $customField); - return $this->client->delete($path, $params, $options); + public function getCustomFieldsForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/custom_fields"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Creates an enum option and adds it to this custom field's list of enum options. - * A custom field can have at most 50 enum options (including disabled options). - * By default new enum options are inserted at the end of a custom field's list. - * - * Returns the full record of the newly created enum option. + /** Reorder a custom field's enum * - * @param custom_field Globally unique identifier for the custom field. + * @param string $custom_field_gid (required) Globally unique identifier for the custom field. + * @param array $params + * @param array $options * @return response */ - public function addEnumOption($customField, $params = array(), $options = array()) - { - $path = sprintf("/custom_fields/%s/enum_options", $customField); + public function insertEnumOptionForCustomField($custom_field_gid, $params = array(), $options = array()) { + $path = "/custom_fields/{custom_field_gid}/enum_options/insert"; + $path = str_replace("{custom_field_gid}", $custom_field_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Updates an existing enum option. Enum custom fields require at least one enabled enum option. - * - * Returns the full record of the updated enum option. + /** Update a custom field * - * @param enum_option Globally unique identifier for the enum option. + * @param string $custom_field_gid (required) Globally unique identifier for the custom field. + * @param array $params + * @param array $options * @return response */ - public function updateEnumOption($enumOption, $params = array(), $options = array()) - { - $path = sprintf("/enum_options/%s", $enumOption); + public function updateCustomField($custom_field_gid, $params = array(), $options = array()) { + $path = "/custom_fields/{custom_field_gid}"; + $path = str_replace("{custom_field_gid}", $custom_field_gid, $path); return $this->client->put($path, $params, $options); } - /** - * Moves a particular enum option to be either before or after another specified enum option in the custom field. + /** Update an enum option * - * @param custom_field Globally unique identifier for the custom field. + * @param string $enum_option_gid (required) Globally unique identifier for the enum option. + * @param array $params + * @param array $options * @return response */ - public function reorderEnumOption($customField, $params = array(), $options = array()) - { - $path = sprintf("/custom_fields/%s/enum_options/insert", $customField); - return $this->client->post($path, $params, $options); + public function updateEnumOption($enum_option_gid, $params = array(), $options = array()) { + $path = "/enum_options/{enum_option_gid}"; + $path = str_replace("{enum_option_gid}", $enum_option_gid, $path); + return $this->client->put($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/EventsBase.php b/src/Asana/Resources/Gen/EventsBase.php index 54d4398..935e719 100644 --- a/src/Asana/Resources/Gen/EventsBase.php +++ b/src/Asana/Resources/Gen/EventsBase.php @@ -2,35 +2,8 @@ namespace Asana\Resources\Gen; -/** - * An _event_ is an object representing a change to a resource that was observed - * by an event subscription. - * - * In general, requesting events on a resource is faster and subject to higher - * rate limits than requesting the resource itself. Additionally, change events - * bubble up - listening to events on a project would include when stories are - * added to tasks in the project, even on subtasks. - * - * Establish an initial sync token by making a request with no sync token. - * The response will be a `412` error - the same as if the sync token had - * expired. - * - * Subsequent requests should always provide the sync token from the immediately - * preceding call. - * - * Sync tokens may not be valid if you attempt to go 'backward' in the history - * by requesting previous tokens, though re-requesting the current sync token - * is generally safe, and will always return the same results. - * - * When you receive a `412 Precondition Failed` error, it means that the - * sync token is either invalid or expired. If you are attempting to keep a set - * of data in sync, this signals you may need to re-crawl the data. - * - * Sync tokens always expire after 24 hours, but may expire sooner, depending on - * load on the service. -*/ -class EventsBase -{ +class EventsBase { + /** * @param Asana/Client client The client instance */ @@ -38,4 +11,15 @@ public function __construct($client) { $this->client = $client; } + + /** Get events on a resource + * + * @param array $params + * @param array $options + * @return response + */ + public function getEvents($params = array(), $options = array()) { + $path = "/events"; + return $this->client->getCollection($path, $params, $options); + } } diff --git a/src/Asana/Resources/Gen/JobsBase.php b/src/Asana/Resources/Gen/JobsBase.php new file mode 100644 index 0000000..d628e4f --- /dev/null +++ b/src/Asana/Resources/Gen/JobsBase.php @@ -0,0 +1,27 @@ +client = $client; + } + + /** Get a job by id + * + * @param string $job_gid (required) Globally unique identifier for the job. + * @param array $params + * @param array $options + * @return response + */ + public function getJob($job_gid, $params = array(), $options = array()) { + $path = "/jobs/{job_gid}"; + $path = str_replace("{job_gid}", $job_gid, $path); + return $this->client->get($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/OrganizationExportsBase.php b/src/Asana/Resources/Gen/OrganizationExportsBase.php index 97d1227..12cf488 100644 --- a/src/Asana/Resources/Gen/OrganizationExportsBase.php +++ b/src/Asana/Resources/Gen/OrganizationExportsBase.php @@ -2,23 +2,8 @@ namespace Asana\Resources\Gen; -/** - * An _organization_export_ object represents a request to export the complete data of an Organization - * in JSON format. - * - * To export an Organization using this API: - * - * * Create an `organization_export` [request](#create) and store the id that is returned.\ - * * Request the `organization_export` every few minutes, until the `state` field contains 'finished'.\ - * * Download the file located at the URL in the `download_url` field. - * - * Exports can take a long time, from several minutes to a few hours for large Organizations. - * - * **Note:** These endpoints are only available to [Service Accounts](/guide/help/premium/service-accounts) - * of an [Enterprise](/enterprise) Organization. -*/ -class OrganizationExportsBase -{ +class OrganizationExportsBase { + /** * @param Asana/Client client The client instance */ @@ -27,26 +12,27 @@ public function __construct($client) $this->client = $client; } - /** - * Returns details of a previously-requested Organization export. + /** Create an organization export request * - * @param organization_export Globally unique identifier for the Organization export. + * @param array $params + * @param array $options * @return response */ - public function findById($organizationExport, $params = array(), $options = array()) - { - $path = sprintf("/organization_exports/%s", $organizationExport); - return $this->client->get($path, $params, $options); + public function createOrganizationExport($params = array(), $options = array()) { + $path = "/organization_exports"; + return $this->client->post($path, $params, $options); } - /** - * This method creates a request to export an Organization. Asana will complete the export at some - * point after you create the request. + /** Get details on an org export request * + * @param string $organization_export_gid (required) Globally unique identifier for the organization export. + * @param array $params + * @param array $options * @return response */ - public function create($params = array(), $options = array()) - { - return $this->client->post("/organization_exports", $params, $options); + public function getOrganizationExport($organization_export_gid, $params = array(), $options = array()) { + $path = "/organization_exports/{organization_export_gid}"; + $path = str_replace("{organization_export_gid}", $organization_export_gid, $path); + return $this->client->get($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/PortfolioMembershipsBase.php b/src/Asana/Resources/Gen/PortfolioMembershipsBase.php new file mode 100644 index 0000000..16929a9 --- /dev/null +++ b/src/Asana/Resources/Gen/PortfolioMembershipsBase.php @@ -0,0 +1,51 @@ +client = $client; + } + + /** Get a portfolio membership + * + * @param string $portfolio_membership_gid (required) + * @param array $params + * @param array $options + * @return response + */ + public function getPortfolioMembership($portfolio_membership_gid, $params = array(), $options = array()) { + $path = "/portfolio_memberships/{portfolio_membership_gid}"; + $path = str_replace("{portfolio_membership_gid}", $portfolio_membership_gid, $path); + return $this->client->get($path, $params, $options); + } + + /** Get multiple portfolio memberships + * + * @param array $params + * @param array $options + * @return response + */ + public function getPortfolioMemberships($params = array(), $options = array()) { + $path = "/portfolio_memberships"; + return $this->client->getCollection($path, $params, $options); + } + + /** Get memberships from a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function getPortfolioMembershipsForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/portfolio_memberships"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->getCollection($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/PortfoliosBase.php b/src/Asana/Resources/Gen/PortfoliosBase.php new file mode 100644 index 0000000..089c8dd --- /dev/null +++ b/src/Asana/Resources/Gen/PortfoliosBase.php @@ -0,0 +1,166 @@ +client = $client; + } + + /** Add a custom field to a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function addCustomFieldSettingForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/addCustomFieldSetting"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->post($path, $params, $options); + } + + /** Add a portfolio item + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function addItemForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/addItem"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->post($path, $params, $options); + } + + /** Add users to a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function addMembersForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/addMembers"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->post($path, $params, $options); + } + + /** Create a portfolio + * + * @param array $params + * @param array $options + * @return response + */ + public function createPortfolio($params = array(), $options = array()) { + $path = "/portfolios"; + return $this->client->post($path, $params, $options); + } + + /** Delete a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function deletePortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->delete($path, $params, $options); + } + + /** Get portfolio items + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function getItemsForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/items"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->getCollection($path, $params, $options); + } + + /** Get a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function getPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->get($path, $params, $options); + } + + /** Get multiple portfolios + * + * @param array $params + * @param array $options + * @return response + */ + public function getPortfolios($params = array(), $options = array()) { + $path = "/portfolios"; + return $this->client->getCollection($path, $params, $options); + } + + /** Remove a custom field from a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function removeCustomFieldSettingForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/removeCustomFieldSetting"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->post($path, $params, $options); + } + + /** Remove a portfolio item + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function removeItemForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/removeItem"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->post($path, $params, $options); + } + + /** Remove users from a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function removeMembersForPortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}/removeMembers"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->post($path, $params, $options); + } + + /** Update a portfolio + * + * @param string $portfolio_gid (required) Globally unique identifier for the portfolio. + * @param array $params + * @param array $options + * @return response + */ + public function updatePortfolio($portfolio_gid, $params = array(), $options = array()) { + $path = "/portfolios/{portfolio_gid}"; + $path = str_replace("{portfolio_gid}", $portfolio_gid, $path); + return $this->client->put($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/ProjectMembershipsBase.php b/src/Asana/Resources/Gen/ProjectMembershipsBase.php index 55923cf..dacbb88 100644 --- a/src/Asana/Resources/Gen/ProjectMembershipsBase.php +++ b/src/Asana/Resources/Gen/ProjectMembershipsBase.php @@ -2,14 +2,8 @@ namespace Asana\Resources\Gen; -/** - * With the introduction of "comment-only" projects in Asana, a user's membership - * in a project comes with associated permissions. These permissions (whether a - * user has full access to the project or comment-only access) are accessible - * through the project memberships endpoints described here. -*/ -class ProjectMembershipsBase -{ +class ProjectMembershipsBase { + /** * @param Asana/Client client The client instance */ @@ -18,27 +12,29 @@ public function __construct($client) $this->client = $client; } - /** - * Returns the compact project membership records for the project. + /** Get a project membership * - * @param project The project for which to fetch memberships. + * @param string $project_membership_gid (required) + * @param array $params + * @param array $options * @return response */ - public function findByProject($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/project_memberships", $project); - return $this->client->getCollection($path, $params, $options); + public function getProjectMembership($project_membership_gid, $params = array(), $options = array()) { + $path = "/project_memberships/{project_membership_gid}"; + $path = str_replace("{project_membership_gid}", $project_membership_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * Returns the project membership record. + /** Get memberships from a project * - * @param project_membership Globally unique identifier for the project membership. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function findById($projectMembership, $params = array(), $options = array()) - { - $path = sprintf("/project_memberships/%s", $projectMembership); - return $this->client->get($path, $params, $options); + public function getProjectMembershipsForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/project_memberships"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->getCollection($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/ProjectStatusesBase.php b/src/Asana/Resources/Gen/ProjectStatusesBase.php index b50f212..06ba856 100644 --- a/src/Asana/Resources/Gen/ProjectStatusesBase.php +++ b/src/Asana/Resources/Gen/ProjectStatusesBase.php @@ -2,16 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _project status_ is an update on the progress of a particular project, and is sent out to all project - * followers when created. These updates include both text describing the update and a color code intended to - * represent the overall state of the project: "green" for projects that are on track, "yellow" for projects - * at risk, and "red" for projects that are behind. - * - * Project statuses can be created and deleted, but not modified. -*/ -class ProjectStatusesBase -{ +class ProjectStatusesBase { + /** * @param Asana/Client client The client instance */ @@ -20,55 +12,55 @@ public function __construct($client) $this->client = $client; } - /** - * Creates a new status update on the project. - * - * Returns the full record of the newly created project status update. + /** Create a project status * - * @param project The project on which to create a status update. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function create($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/project_statuses", $project); + public function createProjectStatusForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/project_statuses"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns the compact project status update records for all updates on the project. + /** Delete a project status * - * @param project The project to find status updates for. + * @param string $project_status_gid (required) The project status update to get. + * @param array $params + * @param array $options * @return response */ - public function findByProject($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/project_statuses", $project); - return $this->client->getCollection($path, $params, $options); + public function deleteProjectStatus($project_status_gid, $params = array(), $options = array()) { + $path = "/project_statuses/{project_status_gid}"; + $path = str_replace("{project_status_gid}", $project_status_gid, $path); + return $this->client->delete($path, $params, $options); } - /** - * Returns the complete record for a single status update. + /** Get a project status * - * @param project-status The project status update to get. + * @param string $project_status_gid (required) The project status update to get. + * @param array $params + * @param array $options * @return response */ - public function findById($projectStatus, $params = array(), $options = array()) - { - $path = sprintf("/project_statuses/%s", $projectStatus); + public function getProjectStatus($project_status_gid, $params = array(), $options = array()) { + $path = "/project_statuses/{project_status_gid}"; + $path = str_replace("{project_status_gid}", $project_status_gid, $path); return $this->client->get($path, $params, $options); } - /** - * Deletes a specific, existing project status update. - * - * Returns an empty data record. + /** Get statuses from a project * - * @param project-status The project status update to delete. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function delete($projectStatus, $params = array(), $options = array()) - { - $path = sprintf("/project_statuses/%s", $projectStatus); - return $this->client->delete($path, $params, $options); + public function getProjectStatusesForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/project_statuses"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->getCollection($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/ProjectsBase.php b/src/Asana/Resources/Gen/ProjectsBase.php index 7537259..2b5063c 100644 --- a/src/Asana/Resources/Gen/ProjectsBase.php +++ b/src/Asana/Resources/Gen/ProjectsBase.php @@ -2,19 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _project_ represents a prioritized list of tasks in Asana or a board with - * columns of tasks represented as cards. It exists in a single workspace or - * organization and is accessible to a subset of users in that workspace or - * organization, depending on its permissions. - * - * Projects in organizations are shared with a single team. You cannot currently - * change the team of a project via the API. Non-organization workspaces do not - * have teams and so you should not specify the team of project in a regular - * workspace. -*/ -class ProjectsBase -{ +class ProjectsBase { + /** * @param Asana/Client client The client instance */ @@ -23,222 +12,233 @@ public function __construct($client) $this->client = $client; } - /** - * Creates a new project in a workspace or team. - * - * Every project is required to be created in a specific workspace or - * organization, and this cannot be changed once set. Note that you can use - * the `workspace` parameter regardless of whether or not it is an - * organization. - * - * If the workspace for your project _is_ an organization, you must also - * supply a `team` to share the project with. - * - * Returns the full record of the newly created project. + /** Add a custom field to a project * + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function create($params = array(), $options = array()) - { - return $this->client->post("/projects", $params, $options); + public function addCustomFieldSettingForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/addCustomFieldSetting"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * If the workspace for your project _is_ an organization, you must also - * supply a `team` to share the project with. - * - * Returns the full record of the newly created project. + /** Add followers to a project * - * @param workspace The workspace or organization to create the project in. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function createInWorkspace($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/projects", $workspace); + public function addFollowersForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/addFollowers"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Creates a project shared with the given team. - * - * Returns the full record of the newly created project. + /** Add users to a project * - * @param team The team to create the project in. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function createInTeam($team, $params = array(), $options = array()) - { - $path = sprintf("/teams/%s/projects", $team); + public function addMembersForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/addMembers"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns the complete project record for a single project. + /** Create a project * - * @param project The project to get. + * @param array $params + * @param array $options * @return response */ - public function findById($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s", $project); - return $this->client->get($path, $params, $options); + public function createProject($params = array(), $options = array()) { + $path = "/projects"; + return $this->client->post($path, $params, $options); } - /** - * A specific, existing project can be updated by making a PUT request on the - * URL for that project. Only the fields provided in the `data` block will be - * updated; any unspecified fields will remain unchanged. - * - * When using this method, it is best to specify only those fields you wish - * to change, or else you may overwrite changes made by another user since - * you last retrieved the task. - * - * Returns the complete updated project record. + /** Create a project in a team * - * @param project The project to update. + * @param string $team_gid (required) Globally unique identifier for the team. + * @param array $params + * @param array $options * @return response */ - public function update($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s", $project); - return $this->client->put($path, $params, $options); + public function createProjectForTeam($team_gid, $params = array(), $options = array()) { + $path = "/teams/{team_gid}/projects"; + $path = str_replace("{team_gid}", $team_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * A specific, existing project can be deleted by making a DELETE request - * on the URL for that project. - * - * Returns an empty data record. + /** Create a project in a workspace * - * @param project The project to delete. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function delete($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s", $project); + public function createProjectForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/projects"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->post($path, $params, $options); + } + + /** Delete a project + * + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options + * @return response + */ + public function deleteProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->delete($path, $params, $options); } - /** - * Returns the compact project records for some filtered set of projects. - * Use one or more of the parameters provided to filter the projects returned. + /** Duplicate a project * + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function findAll($params = array(), $options = array()) - { - return $this->client->getCollection("/projects", $params, $options); + public function duplicateProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/duplicate"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Returns the compact project records for all projects in the workspace. + /** Get a project * - * @param workspace The workspace or organization to find projects in. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function findByWorkspace($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/projects", $workspace); + public function getProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->get($path, $params, $options); + } + + /** Get multiple projects + * + * @param array $params + * @param array $options + * @return response + */ + public function getProjects($params = array(), $options = array()) { + $path = "/projects"; return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact project records for all projects in the team. + /** Get projects a task is in * - * @param team The team to find projects in. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findByTeam($team, $params = array(), $options = array()) - { - $path = sprintf("/teams/%s/projects", $team); + public function getProjectsForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/projects"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact task records for all tasks within the given project, - * ordered by their priority within the project. Tasks can exist in more than one project at a time. + /** Get a team's projects * - * @param project The project in which to search for tasks. + * @param string $team_gid (required) Globally unique identifier for the team. + * @param array $params + * @param array $options * @return response */ - public function tasks($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/tasks", $project); + public function getProjectsForTeam($team_gid, $params = array(), $options = array()) { + $path = "/teams/{team_gid}/projects"; + $path = str_replace("{team_gid}", $team_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * Adds the specified list of users as followers to the project. Followers are a subset of members, therefore if - * the users are not already members of the project they will also become members as a result of this operation. - * Returns the updated project record. + /** Get all projects in a workspace * - * @param project The project to add followers to. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function addFollowers($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/addFollowers", $project); - return $this->client->post($path, $params, $options); + public function getProjectsForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/projects"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Removes the specified list of users from following the project, this will not affect project membership status. - * Returns the updated project record. + /** Get task count of a project * - * @param project The project to remove followers from. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function removeFollowers($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/removeFollowers", $project); - return $this->client->post($path, $params, $options); + public function getTaskCountsForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/task_counts"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * Adds the specified list of users as members of the project. Returns the updated project record. + /** Remove a custom field from a project * - * @param project The project to add members to. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function addMembers($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/addMembers", $project); + public function removeCustomFieldSettingForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/removeCustomFieldSetting"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Removes the specified list of members from the project. Returns the updated project record. + /** Remove followers from a project * - * @param project The project to remove members from. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function removeMembers($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/removeMembers", $project); + public function removeFollowersForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/removeFollowers"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Create a new custom field setting on the project. + /** Remove users from a project * - * @param project The project to associate the custom field with + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function addCustomFieldSetting($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/addCustomFieldSetting", $project); + public function removeMembersForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/removeMembers"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Remove a custom field setting on the project. + /** Update a project * - * @param project The project to associate the custom field with + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function removeCustomFieldSetting($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/removeCustomFieldSetting", $project); - return $this->client->post($path, $params, $options); + public function updateProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->put($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/SectionsBase.php b/src/Asana/Resources/Gen/SectionsBase.php index c6a927e..146dfc0 100644 --- a/src/Asana/Resources/Gen/SectionsBase.php +++ b/src/Asana/Resources/Gen/SectionsBase.php @@ -2,13 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _section_ is a subdivision of a project that groups tasks together. It can - * either be a header above a list of tasks in a list view or a column in a - * board view of a project. -*/ -class SectionsBase -{ +class SectionsBase { + /** * @param Asana/Client client The client instance */ @@ -17,100 +12,94 @@ public function __construct($client) $this->client = $client; } - /** - * Creates a new section in a project. - * - * Returns the full record of the newly created section. + /** Add task to section * - * @param project The project to create the section in + * @param string $section_gid (required) The globally unique identifier for the section. + * @param array $params + * @param array $options * @return response */ - public function createInProject($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/sections", $project); + public function addTaskForSection($section_gid, $params = array(), $options = array()) { + $path = "/sections/{section_gid}/addTask"; + $path = str_replace("{section_gid}", $section_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns the compact records for all sections in the specified project. + /** Create a section in a project * - * @param project The project to get sections from. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function findByProject($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/sections", $project); - return $this->client->get($path, $params, $options); + public function createSectionForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/sections"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Returns the complete record for a single section. + /** Delete a section * - * @param section The section to get. + * @param string $section_gid (required) The globally unique identifier for the section. + * @param array $params + * @param array $options * @return response */ - public function findById($section, $params = array(), $options = array()) - { - $path = sprintf("/sections/%s", $section); - return $this->client->get($path, $params, $options); + public function deleteSection($section_gid, $params = array(), $options = array()) { + $path = "/sections/{section_gid}"; + $path = str_replace("{section_gid}", $section_gid, $path); + return $this->client->delete($path, $params, $options); } - /** - * A specific, existing section can be updated by making a PUT request on - * the URL for that project. Only the fields provided in the `data` block - * will be updated; any unspecified fields will remain unchanged. (note that - * at this time, the only field that can be updated is the `name` field.) - * - * When using this method, it is best to specify only those fields you wish - * to change, or else you may overwrite changes made by another user since - * you last retrieved the task. - * - * Returns the complete updated section record. + /** Get a section * - * @param section The section to update. + * @param string $section_gid (required) The globally unique identifier for the section. + * @param array $params + * @param array $options * @return response */ - public function update($section, $params = array(), $options = array()) - { - $path = sprintf("/sections/%s", $section); - return $this->client->put($path, $params, $options); + public function getSection($section_gid, $params = array(), $options = array()) { + $path = "/sections/{section_gid}"; + $path = str_replace("{section_gid}", $section_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * A specific, existing section can be deleted by making a DELETE request - * on the URL for that section. - * - * Note that sections must be empty to be deleted. - * - * The last remaining section in a board view cannot be deleted. - * - * Returns an empty data block. + /** Get sections in a project * - * @param section The section to delete. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function delete($section, $params = array(), $options = array()) - { - $path = sprintf("/sections/%s", $section); - return $this->client->delete($path, $params, $options); + public function getSectionsForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/sections"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Move sections relative to each other in a board view. One of - * `before_section` or `after_section` is required. - * - * Sections cannot be moved between projects. - * - * At this point in time, moving sections is not supported in list views, only board views. - * - * Returns an empty data block. + /** Move or Insert sections * - * @param project The project in which to reorder the given section + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function insertInProject($project, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/sections/insert", $project); + public function insertSectionForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/sections/insert"; + $path = str_replace("{project_gid}", $project_gid, $path); return $this->client->post($path, $params, $options); } + + /** Update a section + * + * @param string $section_gid (required) The globally unique identifier for the section. + * @param array $params + * @param array $options + * @return response + */ + public function updateSection($section_gid, $params = array(), $options = array()) { + $path = "/sections/{section_gid}"; + $path = str_replace("{section_gid}", $section_gid, $path); + return $this->client->put($path, $params, $options); + } } diff --git a/src/Asana/Resources/Gen/StoriesBase.php b/src/Asana/Resources/Gen/StoriesBase.php index 18bf33c..5b2c0bb 100644 --- a/src/Asana/Resources/Gen/StoriesBase.php +++ b/src/Asana/Resources/Gen/StoriesBase.php @@ -2,17 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _story_ represents an activity associated with an object in the Asana - * system. Stories are generated by the system whenever users take actions such - * as creating or assigning tasks, or moving tasks between projects. _Comments_ - * are also a form of user-generated story. - * - * Stories are a form of history in the system, and as such they are read-only. - * Once generated, it is not possible to modify a story. -*/ -class StoriesBase -{ +class StoriesBase { + /** * @param Asana/Client client The client instance */ @@ -21,69 +12,68 @@ public function __construct($client) $this->client = $client; } - /** - * Returns the compact records for all stories on the task. + /** Create a story on a task * - * @param task Globally unique identifier for the task. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findByTask($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/stories", $task); - return $this->client->getCollection($path, $params, $options); + public function createStoryForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/stories"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Returns the full record for a single story. + /** Delete a story * - * @param story Globally unique identifier for the story. + * @param string $story_gid (required) Globally unique identifier for the story. + * @param array $params + * @param array $options * @return response */ - public function findById($story, $params = array(), $options = array()) - { - $path = sprintf("/stories/%s", $story); - return $this->client->get($path, $params, $options); + public function deleteStory($story_gid, $params = array(), $options = array()) { + $path = "/stories/{story_gid}"; + $path = str_replace("{story_gid}", $story_gid, $path); + return $this->client->delete($path, $params, $options); } - /** - * Adds a comment to a task. The comment will be authored by the - * currently authenticated user, and timestamped when the server receives - * the request. - * - * Returns the full record for the new story added to the task. + /** Get stories from a task * - * @param task Globally unique identifier for the task. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function createOnTask($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/stories", $task); - return $this->client->post($path, $params, $options); + public function getStoriesForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/stories"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Updates the story and returns the full record for the updated story. - * Only comment stories can have their text updated, and only comment stories and - * attachment stories can be pinned. Only one of `text` and `html_text` can be specified. + /** Get a story * - * @param story Globally unique identifier for the story. + * @param string $story_gid (required) Globally unique identifier for the story. + * @param array $params + * @param array $options * @return response */ - public function update($story, $params = array(), $options = array()) - { - $path = sprintf("/stories/%s", $story); - return $this->client->put($path, $params, $options); + public function getStory($story_gid, $params = array(), $options = array()) { + $path = "/stories/{story_gid}"; + $path = str_replace("{story_gid}", $story_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * Deletes a story. A user can only delete stories they have created. Returns an empty data record. + /** Update a story * - * @param story Globally unique identifier for the story. + * @param string $story_gid (required) Globally unique identifier for the story. + * @param array $params + * @param array $options * @return response */ - public function delete($story, $params = array(), $options = array()) - { - $path = sprintf("/stories/%s", $story); - return $this->client->delete($path, $params, $options); + public function updateStory($story_gid, $params = array(), $options = array()) { + $path = "/stories/{story_gid}"; + $path = str_replace("{story_gid}", $story_gid, $path); + return $this->client->put($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/TagsBase.php b/src/Asana/Resources/Gen/TagsBase.php index 5ae5996..2c0cff6 100644 --- a/src/Asana/Resources/Gen/TagsBase.php +++ b/src/Asana/Resources/Gen/TagsBase.php @@ -2,17 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _tag_ is a label that can be attached to any task in Asana. It exists in a - * single workspace or organization. - * - * Tags have some metadata associated with them, but it is possible that we will - * simplify them in the future so it is not encouraged to rely too heavily on it. - * Unlike projects, tags do not provide any ordering on the tasks they - * are associated with. -*/ -class TagsBase -{ +class TagsBase { + /** * @param Asana/Client client The client instance */ @@ -21,121 +12,90 @@ public function __construct($client) $this->client = $client; } - /** - * Creates a new tag in a workspace or organization. - * - * Every tag is required to be created in a specific workspace or - * organization, and this cannot be changed once set. Note that you can use - * the `workspace` parameter regardless of whether or not it is an - * organization. - * - * Returns the full record of the newly created tag. + /** Create a tag * + * @param array $params + * @param array $options * @return response */ - public function create($params = array(), $options = array()) - { - return $this->client->post("/tags", $params, $options); + public function createTag($params = array(), $options = array()) { + $path = "/tags"; + return $this->client->post($path, $params, $options); } - /** - * Creates a new tag in a workspace or organization. - * - * Every tag is required to be created in a specific workspace or - * organization, and this cannot be changed once set. Note that you can use - * the `workspace` parameter regardless of whether or not it is an - * organization. - * - * Returns the full record of the newly created tag. + /** Create a tag in a workspace * - * @param workspace The workspace or organization to create the tag in. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function createInWorkspace($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/tags", $workspace); + public function createTagForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/tags"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns the complete tag record for a single tag. + /** Get a tag * - * @param tag The tag to get. + * @param string $tag_gid (required) Globally unique identifier for the tag. + * @param array $params + * @param array $options * @return response */ - public function findById($tag, $params = array(), $options = array()) - { - $path = sprintf("/tags/%s", $tag); + public function getTag($tag_gid, $params = array(), $options = array()) { + $path = "/tags/{tag_gid}"; + $path = str_replace("{tag_gid}", $tag_gid, $path); return $this->client->get($path, $params, $options); } - /** - * Updates the properties of a tag. Only the fields provided in the `data` - * block will be updated; any unspecified fields will remain unchanged. - * - * When using this method, it is best to specify only those fields you wish - * to change, or else you may overwrite changes made by another user since - * you last retrieved the task. - * - * Returns the complete updated tag record. - * - * @param tag The tag to update. - * @return response - */ - public function update($tag, $params = array(), $options = array()) - { - $path = sprintf("/tags/%s", $tag); - return $this->client->put($path, $params, $options); - } - - /** - * A specific, existing tag can be deleted by making a DELETE request - * on the URL for that tag. - * - * Returns an empty data record. + /** Get multiple tags * - * @param tag The tag to delete. + * @param array $params + * @param array $options * @return response */ - public function delete($tag, $params = array(), $options = array()) - { - $path = sprintf("/tags/%s", $tag); - return $this->client->delete($path, $params, $options); + public function getTags($params = array(), $options = array()) { + $path = "/tags"; + return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact tag records for some filtered set of tags. - * Use one or more of the parameters provided to filter the tags returned. + /** Get a task's tags * + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findAll($params = array(), $options = array()) - { - return $this->client->getCollection("/tags", $params, $options); + public function getTagsForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/tags"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact tag records for all tags in the workspace. + /** Get tags in a workspace * - * @param workspace The workspace or organization to find tags in. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function findByWorkspace($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/tags", $workspace); + public function getTagsForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/tags"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact task records for all tasks with the given tag. - * Tasks can have more than one tag at a time. + /** Update a tag * - * @param tag The tag to fetch tasks from. + * @param string $tag_gid (required) Globally unique identifier for the tag. + * @param array $params + * @param array $options * @return response */ - public function getTasksWithTag($tag, $params = array(), $options = array()) - { - $path = sprintf("/tags/%s/tasks", $tag); - return $this->client->getCollection($path, $params, $options); + public function updateTag($tag_gid, $params = array(), $options = array()) { + $path = "/tags/{tag_gid}"; + $path = str_replace("{tag_gid}", $tag_gid, $path); + return $this->client->put($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/TasksBase.php b/src/Asana/Resources/Gen/TasksBase.php index ae52d8f..3c6a823 100644 --- a/src/Asana/Resources/Gen/TasksBase.php +++ b/src/Asana/Resources/Gen/TasksBase.php @@ -2,14 +2,8 @@ namespace Asana\Resources\Gen; -/** - * The _task_ is the basic object around which many operations in Asana are - * centered. In the Asana application, multiple tasks populate the middle pane - * according to some view parameters, and the set of selected tasks determines - * the more detailed information presented in the details pane. -*/ -class TasksBase -{ +class TasksBase { + /** * @param Asana/Client client The client instance */ @@ -18,393 +12,337 @@ public function __construct($client) $this->client = $client; } - /** - * Creating a new task is as easy as POSTing to the `/tasks` endpoint - * with a data block containing the fields you'd like to set on the task. - * Any unspecified fields will take on default values. - * - * Every task is required to be created in a specific workspace, and this - * workspace cannot be changed once set. The workspace need not be set - * explicitly if you specify `projects` or a `parent` task instead. - * - * `projects` can be a comma separated list of projects, or just a single - * project the task should belong to. + /** Set dependencies for a task * + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function create($params = array(), $options = array()) - { - return $this->client->post("/tasks", $params, $options); + public function addDependenciesForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/addDependencies"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Creating a new task is as easy as POSTing to the `/tasks` endpoint - * with a data block containing the fields you'd like to set on the task. - * Any unspecified fields will take on default values. - * - * Every task is required to be created in a specific workspace, and this - * workspace cannot be changed once set. The workspace need not be set - * explicitly if you specify a `project` or a `parent` task instead. + /** Set dependents for a task * - * @param workspace The workspace to create a task in. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function createInWorkspace($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/tasks", $workspace); + public function addDependentsForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/addDependents"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns the complete task record for a single task. + /** Add followers to a task * - * @param task The task to get. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findById($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s", $task); - return $this->client->get($path, $params, $options); + public function addFollowersForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/addFollowers"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * A specific, existing task can be updated by making a PUT request on the - * URL for that task. Only the fields provided in the `data` block will be - * updated; any unspecified fields will remain unchanged. - * - * When using this method, it is best to specify only those fields you wish - * to change, or else you may overwrite changes made by another user since - * you last retrieved the task. - * - * Returns the complete updated task record. + /** Add a project to a task * - * @param task The task to update. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function update($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s", $task); - return $this->client->put($path, $params, $options); + public function addProjectForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/addProject"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * A specific, existing task can be deleted by making a DELETE request on the - * URL for that task. Deleted tasks go into the "trash" of the user making - * the delete request. Tasks can be recovered from the trash within a period - * of 30 days; afterward they are completely removed from the system. - * - * Returns an empty data record. + /** Add a tag to a task * - * @param task The task to delete. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function delete($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s", $task); - return $this->client->delete($path, $params, $options); + public function addTagForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/addTag"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Returns the compact task records for all tasks within the given project, - * ordered by their priority within the project. + /** Create a subtask * - * @param projectId The project in which to search for tasks. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findByProject($projectId, $params = array(), $options = array()) - { - $path = sprintf("/projects/%s/tasks", $projectId); - return $this->client->getCollection($path, $params, $options); + public function createSubtaskForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/subtasks"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Returns the compact task records for all tasks with the given tag. + /** Create a task * - * @param tag The tag in which to search for tasks. + * @param array $params + * @param array $options * @return response */ - public function findByTag($tag, $params = array(), $options = array()) - { - $path = sprintf("/tags/%s/tasks", $tag); - return $this->client->getCollection($path, $params, $options); + public function createTask($params = array(), $options = array()) { + $path = "/tasks"; + return $this->client->post($path, $params, $options); } - /** - * Board view only: Returns the compact section records for all tasks within the given section. + /** Delete a task * - * @param section The section in which to search for tasks. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findBySection($section, $params = array(), $options = array()) - { - $path = sprintf("/sections/%s/tasks", $section); - return $this->client->getCollection($path, $params, $options); + public function deleteTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->delete($path, $params, $options); } - /** - * Returns the compact task records for some filtered set of tasks. Use one - * or more of the parameters provided to filter the tasks returned. You must - * specify a `project` or `tag` if you do not specify `assignee` and `workspace`. + /** Duplicate a task * + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function findAll($params = array(), $options = array()) - { - return $this->client->getCollection("/tasks", $params, $options); + public function duplicateTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/duplicate"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * The search endpoint allows you to build complex queries to find and fetch exactly the data you need from Asana. - * For a more comprehensive description of all the query parameters and limitations of this endpoint, - * see our [long-form documentation](/developers/documentation/getting-started/search-api) for this feature. + /** Get dependencies from a task * - * @param workspace The workspace or organization in which to search for tasks. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function search($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/tasks/search", $workspace); + public function getDependenciesForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/dependencies"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact representations of all of the dependencies of a task. + /** Get dependents from a task * - * @param task The task to get dependencies on. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function dependencies($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/dependencies", $task); - return $this->client->get($path, $params, $options); + public function getDependentsForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/dependents"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact representations of all of the dependents of a task. + /** Get subtasks from a task * - * @param task The task to get dependents on. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function dependents($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/dependents", $task); - return $this->client->get($path, $params, $options); + public function getSubtasksForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/subtasks"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Marks a set of tasks as dependencies of this task, if they are not - * already dependencies. *A task can have at most 15 dependencies.* + /** Get a task * - * @param task The task to add dependencies to. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function addDependencies($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/addDependencies", $task); - return $this->client->post($path, $params, $options); - } - - /** - * Marks a set of tasks as dependents of this task, if they are not already - * dependents. *A task can have at most 30 dependents.* - * - * @param task The task to add dependents to. - * @return response - */ - public function addDependents($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/addDependents", $task); - return $this->client->post($path, $params, $options); + public function getTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * Unlinks a set of dependencies from this task. + /** Get multiple tasks * - * @param task The task to remove dependencies from. + * @param array $params + * @param array $options * @return response */ - public function removeDependencies($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/removeDependencies", $task); - return $this->client->post($path, $params, $options); + public function getTasks($params = array(), $options = array()) { + $path = "/tasks"; + return $this->client->getCollection($path, $params, $options); } - /** - * Unlinks a set of dependents from this task. + /** Get tasks from a project * - * @param task The task to remove dependents from. + * @param string $project_gid (required) Globally unique identifier for the project. + * @param array $params + * @param array $options * @return response */ - public function removeDependents($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/removeDependents", $task); - return $this->client->post($path, $params, $options); + public function getTasksForProject($project_gid, $params = array(), $options = array()) { + $path = "/projects/{project_gid}/tasks"; + $path = str_replace("{project_gid}", $project_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Adds each of the specified followers to the task, if they are not already - * following. Returns the complete, updated record for the affected task. + /** Get tasks from a section * - * @param task The task to add followers to. + * @param string $section_gid (required) The globally unique identifier for the section. + * @param array $params + * @param array $options * @return response */ - public function addFollowers($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/addFollowers", $task); - return $this->client->post($path, $params, $options); + public function getTasksForSection($section_gid, $params = array(), $options = array()) { + $path = "/sections/{section_gid}/tasks"; + $path = str_replace("{section_gid}", $section_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Removes each of the specified followers from the task if they are - * following. Returns the complete, updated record for the affected task. + /** Get tasks from a tag * - * @param task The task to remove followers from. + * @param string $tag_gid (required) Globally unique identifier for the tag. + * @param array $params + * @param array $options * @return response */ - public function removeFollowers($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/removeFollowers", $task); - return $this->client->post($path, $params, $options); + public function getTasksForTag($tag_gid, $params = array(), $options = array()) { + $path = "/tags/{tag_gid}/tasks"; + $path = str_replace("{tag_gid}", $tag_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Returns a compact representation of all of the projects the task is in. + /** Get tasks from a user task list * - * @param task The task to get projects on. + * @param string $user_task_list_gid (required) Globally unique identifier for the user task list. + * @param array $params + * @param array $options * @return response */ - public function projects($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/projects", $task); + public function getTasksForUserTaskList($user_task_list_gid, $params = array(), $options = array()) { + $path = "/user_task_lists/{user_task_list_gid}/tasks"; + $path = str_replace("{user_task_list_gid}", $user_task_list_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * Adds the task to the specified project, in the optional location - * specified. If no location arguments are given, the task will be added to - * the end of the project. - * - * `addProject` can also be used to reorder a task within a project or section that - * already contains it. - * - * At most one of `insert_before`, `insert_after`, or `section` should be - * specified. Inserting into a section in an non-order-dependent way can be - * done by specifying `section`, otherwise, to insert within a section in a - * particular place, specify `insert_before` or `insert_after` and a task - * within the section to anchor the position of this task. - * - * Returns an empty data block. + /** Unlink dependencies from a task * - * @param task The task to add to a project. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function addProject($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/addProject", $task); + public function removeDependenciesForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/removeDependencies"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Removes the task from the specified project. The task will still exist - * in the system, but it will not be in the project anymore. - * - * Returns an empty data block. + /** Unlink dependents from a task * - * @param task The task to remove from a project. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function removeProject($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/removeProject", $task); + public function removeDependentsForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/removeDependents"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns a compact representation of all of the tags the task has. + /** Remove followers from a task * - * @param task The task to get tags on. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function tags($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/tags", $task); - return $this->client->getCollection($path, $params, $options); + public function removeFollowerForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/removeFollowers"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Adds a tag to a task. Returns an empty data block. + /** Remove a project from a task * - * @param task The task to add a tag to. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function addTag($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/addTag", $task); + public function removeProjectForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/removeProject"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Removes a tag from the task. Returns an empty data block. + /** Remove a tag from a task * - * @param task The task to remove a tag from. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function removeTag($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/removeTag", $task); + public function removeTagForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/removeTag"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns a compact representation of all of the subtasks of a task. + /** Search tasks in a workspace * - * @param task The task to get the subtasks of. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function subtasks($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/subtasks", $task); + public function searchTasksForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/tasks/search"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * Creates a new subtask and adds it to the parent task. Returns the full record - * for the newly created subtask. + /** Set the parent of a task * - * @param task The task to add a subtask to. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function addSubtask($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/subtasks", $task); + public function setParentForTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}/setParent"; + $path = str_replace("{task_gid}", $task_gid, $path); return $this->client->post($path, $params, $options); } - /** - * Returns a compact representation of all of the stories on the task. - * - * @param task The task containing the stories to get. - * @return response - */ - public function stories($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/stories", $task); - return $this->client->getCollection($path, $params, $options); - } - - /** - * Adds a comment to a task. The comment will be authored by the - * currently authenticated user, and timestamped when the server receives - * the request. - * - * Returns the full record for the new story added to the task. + /** Update a task * - * @param task Globally unique identifier for the task. + * @param string $task_gid (required) The task to operate on. + * @param array $params + * @param array $options * @return response */ - public function addComment($task, $params = array(), $options = array()) - { - $path = sprintf("/tasks/%s/stories", $task); - return $this->client->post($path, $params, $options); + public function updateTask($task_gid, $params = array(), $options = array()) { + $path = "/tasks/{task_gid}"; + $path = str_replace("{task_gid}", $task_gid, $path); + return $this->client->put($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/TeamMembershipsBase.php b/src/Asana/Resources/Gen/TeamMembershipsBase.php new file mode 100644 index 0000000..b1e60df --- /dev/null +++ b/src/Asana/Resources/Gen/TeamMembershipsBase.php @@ -0,0 +1,64 @@ +client = $client; + } + + /** Get a team membership + * + * @param string $team_membership_gid (required) + * @param array $params + * @param array $options + * @return response + */ + public function getTeamMembership($team_membership_gid, $params = array(), $options = array()) { + $path = "/team_memberships/{team_membership_gid}"; + $path = str_replace("{team_membership_gid}", $team_membership_gid, $path); + return $this->client->get($path, $params, $options); + } + + /** Get team memberships + * + * @param array $params + * @param array $options + * @return response + */ + public function getTeamMemberships($params = array(), $options = array()) { + $path = "/team_memberships"; + return $this->client->getCollection($path, $params, $options); + } + + /** Get memberships from a team + * + * @param string $team_gid (required) Globally unique identifier for the team. + * @param array $params + * @param array $options + * @return response + */ + public function getTeamMembershipsForTeam($team_gid, $params = array(), $options = array()) { + $path = "/teams/{team_gid}/team_memberships"; + $path = str_replace("{team_gid}", $team_gid, $path); + return $this->client->getCollection($path, $params, $options); + } + + /** Get memberships from a user + * + * @param string $user_gid (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + * @param array $params + * @param array $options + * @return response + */ + public function getTeamMembershipsForUser($user_gid, $params = array(), $options = array()) { + $path = "/users/{user_gid}/team_memberships"; + $path = str_replace("{user_gid}", $user_gid, $path); + return $this->client->getCollection($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/TeamsBase.php b/src/Asana/Resources/Gen/TeamsBase.php index 2775a67..8f2ad20 100644 --- a/src/Asana/Resources/Gen/TeamsBase.php +++ b/src/Asana/Resources/Gen/TeamsBase.php @@ -2,12 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _team_ is used to group related projects and people together within an - * organization. Each project in an organization is associated with a team. -*/ -class TeamsBase -{ +class TeamsBase { + /** * @param Asana/Client client The client instance */ @@ -16,82 +12,68 @@ public function __construct($client) $this->client = $client; } - /** - * Returns the full record for a single team. + /** Add a user to a team * - * @param team Globally unique identifier for the team. + * @param string $team_gid (required) Globally unique identifier for the team. + * @param array $params + * @param array $options * @return response */ - public function findById($team, $params = array(), $options = array()) - { - $path = sprintf("/teams/%s", $team); - return $this->client->get($path, $params, $options); + public function addUserForTeam($team_gid, $params = array(), $options = array()) { + $path = "/teams/{team_gid}/addUser"; + $path = str_replace("{team_gid}", $team_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * Returns the compact records for all teams in the organization visible to - * the authorized user. + /** Get a team * - * @param organization Globally unique identifier for the workspace or organization. + * @param string $team_gid (required) Globally unique identifier for the team. + * @param array $params + * @param array $options * @return response */ - public function findByOrganization($organization, $params = array(), $options = array()) - { - $path = sprintf("/organizations/%s/teams", $organization); - return $this->client->getCollection($path, $params, $options); + public function getTeam($team_gid, $params = array(), $options = array()) { + $path = "/teams/{team_gid}"; + $path = str_replace("{team_gid}", $team_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * Returns the compact records for all teams to which user is assigned. + /** Get teams in an organization * - * @param user An identifier for the user. Can be one of an email address, - * the globally unique identifier for the user, or the keyword `me` - * to indicate the current user making the request. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function findByUser($user, $params = array(), $options = array()) - { - $path = sprintf("/users/%s/teams", $user); + public function getTeamsForOrganization($workspace_gid, $params = array(), $options = array()) { + $path = "/organizations/{workspace_gid}/teams"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * Returns the compact records for all users that are members of the team. + /** Get teams for a user * - * @param team Globally unique identifier for the team. + * @param string $user_gid (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + * @param array $params + * @param array $options * @return response */ - public function users($team, $params = array(), $options = array()) - { - $path = sprintf("/teams/%s/users", $team); + public function getTeamsForUser($user_gid, $params = array(), $options = array()) { + $path = "/users/{user_gid}/teams"; + $path = str_replace("{user_gid}", $user_gid, $path); return $this->client->getCollection($path, $params, $options); } - /** - * The user making this call must be a member of the team in order to add others. - * The user to add must exist in the same organization as the team in order to be added. - * The user to add can be referenced by their globally unique user ID or their email address. - * Returns the full user record for the added user. + /** Remove a user from a team * - * @param team Globally unique identifier for the team. + * @param string $team_gid (required) Globally unique identifier for the team. + * @param array $params + * @param array $options * @return response */ - public function addUser($team, $params = array(), $options = array()) - { - $path = sprintf("/teams/%s/addUser", $team); - return $this->client->post($path, $params, $options); - } - - /** - * The user to remove can be referenced by their globally unique user ID or their email address. - * Removes the user from the specified team. Returns an empty data record. - * - * @param team Globally unique identifier for the team. - * @return response - */ - public function removeUser($team, $params = array(), $options = array()) - { - $path = sprintf("/teams/%s/removeUser", $team); + public function removeUserForTeam($team_gid, $params = array(), $options = array()) { + $path = "/teams/{team_gid}/removeUser"; + $path = str_replace("{team_gid}", $team_gid, $path); return $this->client->post($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/TypeaheadBase.php b/src/Asana/Resources/Gen/TypeaheadBase.php new file mode 100644 index 0000000..804e4da --- /dev/null +++ b/src/Asana/Resources/Gen/TypeaheadBase.php @@ -0,0 +1,27 @@ +client = $client; + } + + /** Get objects via typeahead + * + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options + * @return response + */ + public function typeaheadForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/typeahead"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->getCollection($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/UserTaskListsBase.php b/src/Asana/Resources/Gen/UserTaskListsBase.php new file mode 100644 index 0000000..f8ec7c0 --- /dev/null +++ b/src/Asana/Resources/Gen/UserTaskListsBase.php @@ -0,0 +1,40 @@ +client = $client; + } + + /** Get a user task list + * + * @param string $user_task_list_gid (required) Globally unique identifier for the user task list. + * @param array $params + * @param array $options + * @return response + */ + public function getUserTaskList($user_task_list_gid, $params = array(), $options = array()) { + $path = "/user_task_lists/{user_task_list_gid}"; + $path = str_replace("{user_task_list_gid}", $user_task_list_gid, $path); + return $this->client->get($path, $params, $options); + } + + /** Get a user's task list + * + * @param string $user_gid (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + * @param array $params + * @param array $options + * @return response + */ + public function getUserTaskListForUser($user_gid, $params = array(), $options = array()) { + $path = "/users/{user_gid}/user_task_list"; + $path = str_replace("{user_gid}", $user_gid, $path); + return $this->client->get($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/UsersBase.php b/src/Asana/Resources/Gen/UsersBase.php index 1690813..63a873b 100644 --- a/src/Asana/Resources/Gen/UsersBase.php +++ b/src/Asana/Resources/Gen/UsersBase.php @@ -2,16 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _user_ object represents an account in Asana that can be given access to - * various workspaces, projects, and tasks. - * - * Like other objects in the system, users are referred to by numerical IDs. - * However, the special string identifier `me` can be used anywhere - * a user ID is accepted, to refer to the current authenticated user. -*/ -class UsersBase -{ +class UsersBase { + /** * @param Asana/Client client The client instance */ @@ -20,52 +12,66 @@ public function __construct($client) $this->client = $client; } - /** - * Returns the full user record for the currently authenticated user. + /** Get a user's favorites * + * @param string $user_gid (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + * @param array $params + * @param array $options * @return response */ - public function me($params = array(), $options = array()) - { - return $this->client->get("/users/me", $params, $options); + public function getFavoritesForUser($user_gid, $params = array(), $options = array()) { + $path = "/users/{user_gid}/favorites"; + $path = str_replace("{user_gid}", $user_gid, $path); + return $this->client->getCollection($path, $params, $options); } - /** - * Returns the full user record for the single user with the provided ID. + /** Get a user * - * @param user An identifier for the user. Can be one of an email address, - * the globally unique identifier for the user, or the keyword `me` - * to indicate the current user making the request. + * @param string $user_gid (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + * @param array $params + * @param array $options * @return response */ - public function findById($user, $params = array(), $options = array()) - { - $path = sprintf("/users/%s", $user); + public function getUser($user_gid, $params = array(), $options = array()) { + $path = "/users/{user_gid}"; + $path = str_replace("{user_gid}", $user_gid, $path); return $this->client->get($path, $params, $options); } - /** - * Returns the user records for all users in the specified workspace or - * organization. + /** Get multiple users * - * @param workspace The workspace in which to get users. + * @param array $params + * @param array $options * @return response */ - public function findByWorkspace($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/users", $workspace); + public function getUsers($params = array(), $options = array()) { + $path = "/users"; return $this->client->getCollection($path, $params, $options); } - /** - * Returns the user records for all users in all workspaces and organizations - * accessible to the authenticated user. Accepts an optional workspace ID - * parameter. + /** Get users in a team * + * @param string $team_gid (required) Globally unique identifier for the team. + * @param array $params + * @param array $options * @return response */ - public function findAll($params = array(), $options = array()) - { - return $this->client->getCollection("/users", $params, $options); + public function getUsersForTeam($team_gid, $params = array(), $options = array()) { + $path = "/teams/{team_gid}/users"; + $path = str_replace("{team_gid}", $team_gid, $path); + return $this->client->getCollection($path, $params, $options); + } + + /** Get users in a workspace or organization + * + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options + * @return response + */ + public function getUsersForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/users"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->getCollection($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/WebhooksBase.php b/src/Asana/Resources/Gen/WebhooksBase.php index 07669dc..2f3eedb 100644 --- a/src/Asana/Resources/Gen/WebhooksBase.php +++ b/src/Asana/Resources/Gen/WebhooksBase.php @@ -2,54 +2,8 @@ namespace Asana\Resources\Gen; -/** - * Webhooks allow an application to be notified of changes. This is in addition - * to the ability to fetch those changes directly as - * [Events](/developers/api-reference/events) - in fact, Webhooks are just a way - * to receive Events via HTTP POST at the time they occur instead of polling for - * them. For services accessible via HTTP this is often vastly more convenient, - * and if events are not too frequent can be significantly more efficient. - * - * In both cases, however, changes are represented as Event objects - refer to - * the [Events documentation](/developers/api-reference/events) for more - * information on what data these events contain. - * - * **NOTE:** While Webhooks send arrays of Event objects to their target, the - * Event objects themselves contain *only IDs*, rather than the actual resource - * they are referencing. So while a normal event you receive via GET /events - * would look like this: - * - * {\ - * "resource": {\ - * "id": 1337,\ - * "name": "My Task"\ - * },\ - * "parent": null,\ - * "created_at": "2013-08-21T18:20:37.972Z",\ - * "user": {\ - * "id": 1123,\ - * "name": "Tom Bizarro"\ - * },\ - * "action": "changed",\ - * "type": "task"\ - * } - * - * In a Webhook payload you would instead receive this: - * - * {\ - * "resource": 1337,\ - * "parent": null,\ - * "created_at": "2013-08-21T18:20:37.972Z",\ - * "user": 1123,\ - * "action": "changed",\ - * "type": "task"\ - * } - * - * Webhooks themselves contain only the information necessary to deliver the - * events to the desired target as they are generated. -*/ -class WebhooksBase -{ +class WebhooksBase { + /** * @param Asana/Client client The client instance */ @@ -58,64 +12,51 @@ public function __construct($client) $this->client = $client; } - /** - * Establishing a webhook is a two-part process. First, a simple HTTP POST - * similar to any other resource creation. Since you could have multiple - * webhooks we recommend specifying a unique local id for each target. - * - * Next comes the confirmation handshake. When a webhook is created, we will - * send a test POST to the `target` with an `X-Hook-Secret` header as - * described in the - * [Resthooks Security documentation](http://resthooks.org/docs/security/). - * The target must respond with a `200 OK` and a matching `X-Hook-Secret` - * header to confirm that this webhook subscription is indeed expected. - * - * If you do not acknowledge the webhook's confirmation handshake it will - * fail to setup, and you will receive an error in response to your attempt - * to create it. This means you need to be able to receive and complete the - * webhook *while* the POST request is in-flight. + /** Establish a webhook * + * @param array $params + * @param array $options * @return response */ - public function create($params = array(), $options = array()) - { - return $this->client->post("/webhooks", $params, $options); + public function createWebhook($params = array(), $options = array()) { + $path = "/webhooks"; + return $this->client->post($path, $params, $options); } - /** - * Returns the compact representation of all webhooks your app has - * registered for the authenticated user in the given workspace. + /** Delete a webhook * + * @param string $webhook_gid (required) Globally unique identifier for the webhook. + * @param array $params + * @param array $options * @return response */ - public function getAll($params = array(), $options = array()) - { - return $this->client->getCollection("/webhooks", $params, $options); + public function deleteWebhook($webhook_gid, $params = array(), $options = array()) { + $path = "/webhooks/{webhook_gid}"; + $path = str_replace("{webhook_gid}", $webhook_gid, $path); + return $this->client->delete($path, $params, $options); } - /** - * Returns the full record for the given webhook. + /** Get a webhook * - * @param webhook The webhook to get. + * @param string $webhook_gid (required) Globally unique identifier for the webhook. + * @param array $params + * @param array $options * @return response */ - public function getById($webhook, $params = array(), $options = array()) - { - $path = sprintf("/webhooks/%s", $webhook); + public function getWebhook($webhook_gid, $params = array(), $options = array()) { + $path = "/webhooks/{webhook_gid}"; + $path = str_replace("{webhook_gid}", $webhook_gid, $path); return $this->client->get($path, $params, $options); } - /** - * This method permanently removes a webhook. Note that it may be possible - * to receive a request that was already in flight after deleting the - * webhook, but no further requests will be issued. + /** Get multiple webhooks * - * @param webhook The webhook to delete. + * @param array $params + * @param array $options * @return response */ - public function deleteById($webhook, $params = array(), $options = array()) - { - $path = sprintf("/webhooks/%s", $webhook); - return $this->client->delete($path, $params, $options); + public function getWebhooks($params = array(), $options = array()) { + $path = "/webhooks"; + return $this->client->getCollection($path, $params, $options); } } diff --git a/src/Asana/Resources/Gen/WorkspaceMembershipsBase.php b/src/Asana/Resources/Gen/WorkspaceMembershipsBase.php new file mode 100644 index 0000000..c0e11f9 --- /dev/null +++ b/src/Asana/Resources/Gen/WorkspaceMembershipsBase.php @@ -0,0 +1,53 @@ +client = $client; + } + + /** Get a workspace membership + * + * @param string $workspace_membership_gid (required) + * @param array $params + * @param array $options + * @return response + */ + public function getWorkspaceMembership($workspace_membership_gid, $params = array(), $options = array()) { + $path = "/workspace_memberships/{workspace_membership_gid}"; + $path = str_replace("{workspace_membership_gid}", $workspace_membership_gid, $path); + return $this->client->get($path, $params, $options); + } + + /** Get workspace memberships for a user + * + * @param string $user_gid (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + * @param array $params + * @param array $options + * @return response + */ + public function getWorkspaceMembershipsForUser($user_gid, $params = array(), $options = array()) { + $path = "/users/{user_gid}/workspace_memberships"; + $path = str_replace("{user_gid}", $user_gid, $path); + return $this->client->getCollection($path, $params, $options); + } + + /** Get the workspace memberships for a workspace + * + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options + * @return response + */ + public function getWorkspaceMembershipsForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/workspace_memberships"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->getCollection($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Gen/WorkspacesBase.php b/src/Asana/Resources/Gen/WorkspacesBase.php index bbd9628..2572eaf 100644 --- a/src/Asana/Resources/Gen/WorkspacesBase.php +++ b/src/Asana/Resources/Gen/WorkspacesBase.php @@ -2,24 +2,8 @@ namespace Asana\Resources\Gen; -/** - * A _workspace_ is the highest-level organizational unit in Asana. All projects - * and tasks have an associated workspace. - * - * An _organization_ is a special kind of workspace that represents a company. - * In an organization, you can group your projects into teams. You can read - * more about how organizations work on the Asana Guide. - * To tell if your workspace is an organization or not, check its - * `is_organization` property. - * - * Over time, we intend to migrate most workspaces into organizations and to - * release more organization-specific functionality. We may eventually deprecate - * using workspace-based APIs for organizations. Currently, and until after - * some reasonable grace period following any further announcements, you can - * still reference organizations in any `workspace` parameter. -*/ -class WorkspacesBase -{ +class WorkspacesBase { + /** * @param Asana/Client client The client instance */ @@ -28,85 +12,66 @@ public function __construct($client) $this->client = $client; } - /** - * Returns the full workspace record for a single workspace. - * - * @param workspace Globally unique identifier for the workspace or organization. - * @return response - */ - public function findById($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s", $workspace); - return $this->client->get($path, $params, $options); - } - - /** - * Returns the compact records for all workspaces visible to the authorized user. + /** Add a user to a workspace or organization * + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function findAll($params = array(), $options = array()) - { - return $this->client->getCollection("/workspaces", $params, $options); + public function addUserForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/addUser"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->post($path, $params, $options); } - /** - * A specific, existing workspace can be updated by making a PUT request on - * the URL for that workspace. Only the fields provided in the data block - * will be updated; any unspecified fields will remain unchanged. - * - * Currently the only field that can be modified for a workspace is its `name`. - * - * Returns the complete, updated workspace record. + /** Get a workspace * - * @param workspace The workspace to update. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function update($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s", $workspace); - return $this->client->put($path, $params, $options); + public function getWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->get($path, $params, $options); } - /** - * Retrieves objects in the workspace based on an auto-completion/typeahead - * search algorithm. This feature is meant to provide results quickly, so do - * not rely on this API to provide extremely accurate search results. The - * result set is limited to a single page of results with a maximum size, - * so you won't be able to fetch large numbers of results. + /** Get multiple workspaces * - * @param workspace The workspace to fetch objects from. + * @param array $params + * @param array $options * @return response */ - public function typeahead($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/typeahead", $workspace); + public function getWorkspaces($params = array(), $options = array()) { + $path = "/workspaces"; return $this->client->getCollection($path, $params, $options); } - /** - * The user can be referenced by their globally unique user ID or their email address. - * Returns the full user record for the invited user. + /** Remove a user from a workspace or organization * - * @param workspace The workspace or organization to invite the user to. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function addUser($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/addUser", $workspace); + public function removeUserForWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}/removeUser"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); return $this->client->post($path, $params, $options); } - /** - * The user making this call must be an admin in the workspace. - * Returns an empty data record. + /** Update a workspace * - * @param workspace The workspace or organization to invite the user to. + * @param string $workspace_gid (required) Globally unique identifier for the workspace or organization. + * @param array $params + * @param array $options * @return response */ - public function removeUser($workspace, $params = array(), $options = array()) - { - $path = sprintf("/workspaces/%s/removeUser", $workspace); - return $this->client->post($path, $params, $options); + public function updateWorkspace($workspace_gid, $params = array(), $options = array()) { + $path = "/workspaces/{workspace_gid}"; + $path = str_replace("{workspace_gid}", $workspace_gid, $path); + return $this->client->put($path, $params, $options); } } diff --git a/src/Asana/Resources/Jobs.php b/src/Asana/Resources/Jobs.php new file mode 100644 index 0000000..16f7b0a --- /dev/null +++ b/src/Asana/Resources/Jobs.php @@ -0,0 +1,22 @@ +client->get($path, $params, $options); + } +} diff --git a/src/Asana/Resources/OrganizationExports.php b/src/Asana/Resources/OrganizationExports.php index 50a9151..e79ec3e 100644 --- a/src/Asana/Resources/OrganizationExports.php +++ b/src/Asana/Resources/OrganizationExports.php @@ -6,4 +6,30 @@ class OrganizationExports extends OrganizationExportsBase { + /** + * Returns details of a previously-requested Organization export. + * + * @deprecated replace with getOrganizationExport + * + * @param organization_export Globally unique identifier for the Organization export. + * @return response + */ + public function findById($organizationExport, $params = array(), $options = array()) + { + $path = sprintf("/organization_exports/%s", $organizationExport); + return $this->client->get($path, $params, $options); + } + + /** + * This method creates a request to export an Organization. Asana will complete the export at some + * point after you create the request. + * + * @deprecated replace with createOrganizationExport + * + * @return response + */ + public function create($params = array(), $options = array()) + { + return $this->client->post("/organization_exports", $params, $options); + } } diff --git a/src/Asana/Resources/PortfolioMemberships.php b/src/Asana/Resources/PortfolioMemberships.php new file mode 100644 index 0000000..3c1bc89 --- /dev/null +++ b/src/Asana/Resources/PortfolioMemberships.php @@ -0,0 +1,49 @@ +client->getCollection("/portfolio_memberships", $params, $options); + } + + /** + * Returns the compact portfolio membership records for the portfolio. + * + * @deprecated replace with getPortfolioMembershipsForPortfolio + * + * @param portfolio The portfolio for which to fetch memberships. + * @return response + */ + public function findByPortfolio($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/portfolio_memberships", $portfolio); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the portfolio membership record. + * + * @deprecated replace with getPortfolioMembership + * + * @param portfolio_membership Globally unique identifier for the portfolio membership. + * @return response + */ + public function findById($portfolioMembership, $params = array(), $options = array()) + { + $path = sprintf("/portfolio_memberships/%s", $portfolioMembership); + return $this->client->get($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Portfolios.php b/src/Asana/Resources/Portfolios.php new file mode 100644 index 0000000..9b0a2ce --- /dev/null +++ b/src/Asana/Resources/Portfolios.php @@ -0,0 +1,206 @@ +client->post("/portfolios", $params, $options); + } + + /** + * Returns the complete record for a single portfolio. + * + * @deprecated replace with getPortfolio + * + * @param portfolio The portfolio to get. + * @return response + */ + public function findById($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s", $portfolio); + return $this->client->get($path, $params, $options); + } + + /** + * An existing portfolio can be updated by making a PUT request on the + * URL for that portfolio. Only the fields provided in the `data` block will be + * updated; any unspecified fields will remain unchanged. + * + * Returns the complete updated portfolio record. + * + * @deprecated replace with updatePortfolio + * + * @param portfolio The portfolio to update. + * @return response + */ + public function update($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s", $portfolio); + return $this->client->put($path, $params, $options); + } + + /** + * An existing portfolio can be deleted by making a DELETE request + * on the URL for that portfolio. + * + * Returns an empty data record. + * + * @deprecated replace with deletePortfolio + * + * @param portfolio The portfolio to delete. + * @return response + */ + public function delete($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s", $portfolio); + return $this->client->delete($path, $params, $options); + } + + /** + * Returns a list of the portfolios in compact representation that are owned + * by the current API user. + * + * @deprecated replace with getPortfolios + * + * @return response + */ + public function findAll($params = array(), $options = array()) + { + return $this->client->getCollection("/portfolios", $params, $options); + } + + /** + * Get a list of the items in compact form in a portfolio. + * + * @deprecated replace with getItemsForPortfolio + * + * @param portfolio The portfolio from which to get the list of items. + * @return response + */ + public function getItems($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/items", $portfolio); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Add an item to a portfolio. + * + * Returns an empty data block. + * + * @deprecated replace with addItemForPortfolio + * + * @param portfolio The portfolio to which to add an item. + * @return response + */ + public function addItem($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/addItem", $portfolio); + return $this->client->post($path, $params, $options); + } + + /** + * Remove an item to a portfolio. + * + * Returns an empty data block. + * + * @deprecated replace with removeItemForPortfolio + * + * @param portfolio The portfolio from which to remove the item. + * @return response + */ + public function removeItem($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/removeItem", $portfolio); + return $this->client->post($path, $params, $options); + } + + /** + * Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. + * + * @deprecated replace with addMembersForPortfolio + * + * @param portfolio The portfolio to add members to. + * @return response + */ + public function addMembers($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/addMembers", $portfolio); + return $this->client->post($path, $params, $options); + } + + /** + * Removes the specified list of members from the portfolio. Returns the updated portfolio record. + * + * @deprecated replace with removeMembersForPortfolio + * + * @param portfolio The portfolio to remove members from. + * @return response + */ + public function removeMembers($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/removeMembers", $portfolio); + return $this->client->post($path, $params, $options); + } + + /** + * Get the custom field settings on a portfolio. + * + * @deprecated replace with CustomFields.getCustomFieldSettingsForPortfolio + * + * @param portfolio The portfolio from which to get the custom field settings. + * @return response + */ + public function customFieldSettings($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/custom_field_settings", $portfolio); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Create a new custom field setting on the portfolio. Returns the full + * record for the new custom field setting. + * + * @deprecated replace with addCustomFieldSettingForPortfolio + * + * @param portfolio The portfolio onto which to add the custom field. + * @return response + */ + public function addCustomFieldSetting($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/addCustomFieldSetting", $portfolio); + return $this->client->post($path, $params, $options); + } + + /** + * Remove a custom field setting on the portfolio. Returns an empty data + * block. + * + * @deprecated replace with removeCustomFieldSettingForPortfolio + * + * @param portfolio The portfolio from which to remove the custom field. + * @return response + */ + public function removeCustomFieldSetting($portfolio, $params = array(), $options = array()) + { + $path = sprintf("/portfolios/%s/removeCustomFieldSetting", $portfolio); + return $this->client->post($path, $params, $options); + } +} diff --git a/src/Asana/Resources/ProjectMemberships.php b/src/Asana/Resources/ProjectMemberships.php index 19d9671..0c69c8b 100644 --- a/src/Asana/Resources/ProjectMemberships.php +++ b/src/Asana/Resources/ProjectMemberships.php @@ -6,4 +6,39 @@ class ProjectMemberships extends ProjectMembershipsBase { + /** + * @param Asana/Client client The client instance + */ + public function __construct($client) + { + $this->client = $client; + } + + /** + * Returns the compact project membership records for the project. + * + * @deprecated replace with getProjectMembershipsForProject + * + * @param project The project for which to fetch memberships. + * @return response + */ + public function findByProject($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/project_memberships", $project); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the project membership record. + * + * @deprecated replace with getProjectMembership + * + * @param project_membership Globally unique identifier for the project membership. + * @return response + */ + public function findById($projectMembership, $params = array(), $options = array()) + { + $path = sprintf("/project_memberships/%s", $projectMembership); + return $this->client->get($path, $params, $options); + } } diff --git a/src/Asana/Resources/ProjectStatuses.php b/src/Asana/Resources/ProjectStatuses.php index 362f171..92a55ff 100644 --- a/src/Asana/Resources/ProjectStatuses.php +++ b/src/Asana/Resources/ProjectStatuses.php @@ -6,4 +6,76 @@ class ProjectStatuses extends ProjectStatusesBase { + public function create($project, $params = array(), $options = array()) + { + return $this->createInProject($project, $params, $options); + } + + /** + * @param Asana/Client client The client instance + */ + public function __construct($client) + { + $this->client = $client; + } + + /** + * Creates a new status update on the project. + * + * Returns the full record of the newly created project status update. + * + * @deprecated replace with createProjectStatusForProject + * + * @param project The project on which to create a status update. + * @return response + */ + public function createInProject($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/project_statuses", $project); + return $this->client->post($path, $params, $options); + } + + /** + * Returns the compact project status update records for all updates on the project. + * + * @deprecated replace with getProjectStatusesForProject + * + * @param project The project to find status updates for. + * @return response + */ + public function findByProject($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/project_statuses", $project); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the complete record for a single status update. + * + * @deprecated replace with getProjectStatus + * + * @param project-status The project status update to get. + * @return response + */ + public function findById($projectStatus, $params = array(), $options = array()) + { + $path = sprintf("/project_statuses/%s", $projectStatus); + return $this->client->get($path, $params, $options); + } + + /** + * Deletes a specific, existing project status update. + * + * Returns an empty data record. + * + * @deprecated replace with deleteProjectStatus + * + * @param project-status The project status update to delete. + * @return response + */ + public function delete($projectStatus, $params = array(), $options = array()) + { + $path = sprintf("/project_statuses/%s", $projectStatus); + return $this->client->delete($path, $params, $options); + } } diff --git a/src/Asana/Resources/Projects.php b/src/Asana/Resources/Projects.php index 0d7d4dc..0a7bb36 100644 --- a/src/Asana/Resources/Projects.php +++ b/src/Asana/Resources/Projects.php @@ -6,4 +6,254 @@ class Projects extends ProjectsBase { + /** + * Creates a new project in a workspace or team. + * + * Every project is required to be created in a specific workspace or + * organization, and this cannot be changed once set. Note that you can use + * the `workspace` parameter regardless of whether or not it is an + * organization. + * + * If the workspace for your project _is_ an organization, you must also + * supply a `team` to share the project with. + * + * Returns the full record of the newly created project. + * + * @deprecated replace with createProject + * + * @return response + */ + public function create($params = array(), $options = array()) + { + return $this->client->post("/projects", $params, $options); + } + + /** + * If the workspace for your project _is_ an organization, you must also + * supply a `team` to share the project with. + * + * Returns the full record of the newly created project. + * + * @deprecated replace with createProjectForWorkspace + * + * @param workspace The workspace or organization to create the project in. + * @return response + */ + public function createInWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/projects", $workspace); + return $this->client->post($path, $params, $options); + } + + /** + * Creates a project shared with the given team. + * + * Returns the full record of the newly created project. + * + * @deprecated replace with createProjectForTeam + * + * @param team The team to create the project in. + * @return response + */ + public function createInTeam($team, $params = array(), $options = array()) + { + $path = sprintf("/teams/%s/projects", $team); + return $this->client->post($path, $params, $options); + } + + /** + * Returns the complete project record for a single project. + * + * @deprecated replace with getProject + * + * @param project The project to get. + * @return response + */ + public function findById($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s", $project); + return $this->client->get($path, $params, $options); + } + + /** + * A specific, existing project can be updated by making a PUT request on the + * URL for that project. Only the fields provided in the `data` block will be + * updated; any unspecified fields will remain unchanged. + * + * When using this method, it is best to specify only those fields you wish + * to change, or else you may overwrite changes made by another user since + * you last retrieved the task. + * + * Returns the complete updated project record. + * + * @deprecated replace with updateProject + * + * @param project The project to update. + * @return response + */ + public function update($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s", $project); + return $this->client->put($path, $params, $options); + } + + /** + * A specific, existing project can be deleted by making a DELETE request + * on the URL for that project. + * + * Returns an empty data record. + * + * @deprecated replace with deleteProject + * + * @param project The project to delete. + * @return response + */ + public function delete($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s", $project); + return $this->client->delete($path, $params, $options); + } + + /** + * Returns the compact project records for some filtered set of projects. + * Use one or more of the parameters provided to filter the projects returned. + * + * @deprecated replace with getProjects + * + * @return response + */ + public function findAll($params = array(), $options = array()) + { + return $this->client->getCollection("/projects", $params, $options); + } + + /** + * Returns the compact project records for all projects in the workspace. + * + * @deprecated replace with getProjectsForWorkspace + * + * @param workspace The workspace or organization to find projects in. + * @return response + */ + public function findByWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/projects", $workspace); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact project records for all projects in the team. + * + * @deprecated replace with getProjectsForTeam + * + * @param team The team to find projects in. + * @return response + */ + public function findByTeam($team, $params = array(), $options = array()) + { + $path = sprintf("/teams/%s/projects", $team); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact task records for all tasks within the given project, + * ordered by their priority within the project. Tasks can exist in more than one project at a time. + * + * @deprecated replace with Tasks.getTasksForProject + * + * @param project The project in which to search for tasks. + * @return response + */ + public function tasks($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/tasks", $project); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Adds the specified list of users as followers to the project. Followers are a subset of members, therefore if + * the users are not already members of the project they will also become members as a result of this operation. + * Returns the updated project record. + * + * @deprecated replace with addFollowersForProject + * + * @param project The project to add followers to. + * @return response + */ + public function addFollowers($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/addFollowers", $project); + return $this->client->post($path, $params, $options); + } + + /** + * Removes the specified list of users from following the project, this will not affect project membership status. + * Returns the updated project record. + * + * @deprecated replace with removeFollowersForProject + * + * @param project The project to remove followers from. + * @return response + */ + public function removeFollowers($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/removeFollowers", $project); + return $this->client->post($path, $params, $options); + } + + /** + * Adds the specified list of users as members of the project. Returns the updated project record. + * + * @deprecated replace with addMembersForProject + * + * @param project The project to add members to. + * @return response + */ + public function addMembers($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/addMembers", $project); + return $this->client->post($path, $params, $options); + } + + /** + * Removes the specified list of members from the project. Returns the updated project record. + * + * @deprecated replace with removeMembersForProject + * + * @param project The project to remove members from. + * @return response + */ + public function removeMembers($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/removeMembers", $project); + return $this->client->post($path, $params, $options); + } + + /** + * Create a new custom field setting on the project. + * + * @deprecated replace with addCustomFieldSettingForProject + * + * @param project The project to associate the custom field with + * @return response + */ + public function addCustomFieldSetting($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/addCustomFieldSetting", $project); + return $this->client->post($path, $params, $options); + } + + /** + * Remove a custom field setting on the project. + * + * @deprecated replace with removeCustomFieldSettingForProject + * + * @param project The project to associate the custom field with + * @return response + */ + public function removeCustomFieldSetting($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/removeCustomFieldSetting", $project); + return $this->client->post($path, $params, $options); + } } diff --git a/src/Asana/Resources/Sections.php b/src/Asana/Resources/Sections.php index 269d610..a7d03bb 100644 --- a/src/Asana/Resources/Sections.php +++ b/src/Asana/Resources/Sections.php @@ -6,4 +6,130 @@ class Sections extends SectionsBase { + /** + * Creates a new section in a project. + * + * Returns the full record of the newly created section. + * + * @deprecated replace with createSectionForProject + * + * @param project The project to create the section in + * @return response + */ + public function createInProject($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/sections", $project); + return $this->client->post($path, $params, $options); + } + + /** + * Returns the compact records for all sections in the specified project. + * + * @deprecated replace with getSectionsForProject + * + * @param project The project to get sections from. + * @return response + */ + public function findByProject($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/sections", $project); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the complete record for a single section. + * + * @deprecated replace with getSection + * + * @param section The section to get. + * @return response + */ + public function findById($section, $params = array(), $options = array()) + { + $path = sprintf("/sections/%s", $section); + return $this->client->get($path, $params, $options); + } + + /** + * A specific, existing section can be updated by making a PUT request on + * the URL for that project. Only the fields provided in the `data` block + * will be updated; any unspecified fields will remain unchanged. (note that + * at this time, the only field that can be updated is the `name` field.) + * + * When using this method, it is best to specify only those fields you wish + * to change, or else you may overwrite changes made by another user since + * you last retrieved the task. + * + * Returns the complete updated section record. + * + * @deprecated replace with updateSection + * + * @param section The section to update. + * @return response + */ + public function update($section, $params = array(), $options = array()) + { + $path = sprintf("/sections/%s", $section); + return $this->client->put($path, $params, $options); + } + + /** + * A specific, existing section can be deleted by making a DELETE request + * on the URL for that section. + * + * Note that sections must be empty to be deleted. + * + * The last remaining section in a board view cannot be deleted. + * + * Returns an empty data block. + * + * @deprecated replace with deleteSection + * + * @param section The section to delete. + * @return response + */ + public function delete($section, $params = array(), $options = array()) + { + $path = sprintf("/sections/%s", $section); + return $this->client->delete($path, $params, $options); + } + + /** + * Add a task to a specific, existing section. This will remove the task from other sections of the project. + * + * The task will be inserted at the top of a section unless an `insert_before` or `insert_after` parameter is declared. + * + * This does not work for separators (tasks with the `resource_subtype` of section). + * + * @deprecated replace with addTaskForSection + * + * @param task The task to add to this section + * @return response + */ + public function addTask($task, $params = array(), $options = array()) + { + $path = sprintf("/sections/%s/addTask", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Move sections relative to each other in a board view. One of + * `before_section` or `after_section` is required. + * + * Sections cannot be moved between projects. + * + * At this point in time, moving sections is not supported in list views, only board views. + * + * Returns an empty data block. + * + * @deprecated replace with insertSectionForProject + * + * @param project The project in which to reorder the given section + * @return response + */ + public function insertInProject($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/sections/insert", $project); + return $this->client->post($path, $params, $options); + } } diff --git a/src/Asana/Resources/Stories.php b/src/Asana/Resources/Stories.php index 61bb32b..b542bb3 100644 --- a/src/Asana/Resources/Stories.php +++ b/src/Asana/Resources/Stories.php @@ -6,4 +6,79 @@ class Stories extends StoriesBase { + /** + * Returns the compact records for all stories on the task. + * + * @deprecated replace with getStoriesForTask + * + * @param task Globally unique identifier for the task. + * @return response + */ + public function findByTask($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/stories", $task); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the full record for a single story. + * + * @deprecated replace with getStory + * + * @param story Globally unique identifier for the story. + * @return response + */ + public function findById($story, $params = array(), $options = array()) + { + $path = sprintf("/stories/%s", $story); + return $this->client->get($path, $params, $options); + } + + /** + * Adds a comment to a task. The comment will be authored by the + * currently authenticated user, and timestamped when the server receives + * the request. + * + * Returns the full record for the new story added to the task. + * + * @deprecated replace with createStoryForTask + * + * @param task Globally unique identifier for the task. + * @return response + */ + public function createOnTask($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/stories", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Updates the story and returns the full record for the updated story. + * Only comment stories can have their text updated, and only comment stories and + * attachment stories can be pinned. Only one of `text` and `html_text` can be specified. + * + * @deprecated replace with updateStory + * + * @param story Globally unique identifier for the story. + * @return response + */ + public function update($story, $params = array(), $options = array()) + { + $path = sprintf("/stories/%s", $story); + return $this->client->put($path, $params, $options); + } + + /** + * Deletes a story. A user can only delete stories they have created. Returns an empty data record. + * + * @deprecated replace with deleteStory + * + * @param story Globally unique identifier for the story. + * @return response + */ + public function delete($story, $params = array(), $options = array()) + { + $path = sprintf("/stories/%s", $story); + return $this->client->delete($path, $params, $options); + } } diff --git a/src/Asana/Resources/Tags.php b/src/Asana/Resources/Tags.php index 83b91d9..9f15b57 100644 --- a/src/Asana/Resources/Tags.php +++ b/src/Asana/Resources/Tags.php @@ -6,4 +6,137 @@ class Tags extends TagsBase { + /** + * Returns the compact task records for all tasks with the given tag. + * Tasks can have more than one tag at a time. + * + * @deprecated replace with Tasks.getTasksForTag + * + * @param tag The tag to fetch tasks from. + * @return response + */ + public function getTasksWithTag($tag, $params = array(), $options = array()) + { + $path = sprintf("/tags/%s/tasks", $tag); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Creates a new tag in a workspace or organization. + * + * Every tag is required to be created in a specific workspace or + * organization, and this cannot be changed once set. Note that you can use + * the `workspace` parameter regardless of whether or not it is an + * organization. + * + * Returns the full record of the newly created tag. + * + * @deprecated replace with createTag + * + * @return response + */ + public function create($params = array(), $options = array()) + { + return $this->client->post("/tags", $params, $options); + } + + /** + * Creates a new tag in a workspace or organization. + * + * Every tag is required to be created in a specific workspace or + * organization, and this cannot be changed once set. Note that you can use + * the `workspace` parameter regardless of whether or not it is an + * organization. + * + * Returns the full record of the newly created tag. + * + * @deprecated replace with createTagForWorkspace + * + * @param workspace The workspace or organization to create the tag in. + * @return response + */ + public function createInWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/tags", $workspace); + return $this->client->post($path, $params, $options); + } + + /** + * Returns the complete tag record for a single tag. + * + * @deprecated replace with getTag + * + * @param tag The tag to get. + * @return response + */ + public function findById($tag, $params = array(), $options = array()) + { + $path = sprintf("/tags/%s", $tag); + return $this->client->get($path, $params, $options); + } + + /** + * Updates the properties of a tag. Only the fields provided in the `data` + * block will be updated; any unspecified fields will remain unchanged. + * + * When using this method, it is best to specify only those fields you wish + * to change, or else you may overwrite changes made by another user since + * you last retrieved the task. + * + * Returns the complete updated tag record. + * + * @deprecated replace with updateTag + * + * @param tag The tag to update. + * @return response + */ + public function update($tag, $params = array(), $options = array()) + { + $path = sprintf("/tags/%s", $tag); + return $this->client->put($path, $params, $options); + } + + /** + * A specific, existing tag can be deleted by making a DELETE request + * on the URL for that tag. + * + * Returns an empty data record. + * + * @deprecated replace with deleteTag + * + * @param tag The tag to delete. + * @return response + */ + public function delete($tag, $params = array(), $options = array()) + { + $path = sprintf("/tags/%s", $tag); + return $this->client->delete($path, $params, $options); + } + + /** + * Returns the compact tag records for some filtered set of tags. + * Use one or more of the parameters provided to filter the tags returned. + * + * @deprecated replace with getTags + * + * @return response + */ + public function findAll($params = array(), $options = array()) + { + return $this->client->getCollection("/tags", $params, $options); + } + + /** + * Returns the compact tag records for all tags in the workspace. + * + * @deprecated replace with getTagsForWorkspace + * + * @param workspace The workspace or organization to find tags in. + * @return response + */ + public function findByWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/tags", $workspace); + return $this->client->getCollection($path, $params, $options); + } } diff --git a/src/Asana/Resources/Tasks.php b/src/Asana/Resources/Tasks.php index 9431781..6bc5b89 100644 --- a/src/Asana/Resources/Tasks.php +++ b/src/Asana/Resources/Tasks.php @@ -6,4 +6,501 @@ class Tasks extends TasksBase { + public function search($workspace, $params = array(), $options = array()) + { + return $this->searchInWorkspace($workspace, $params, $options); + } + + /** + * Creating a new task is as easy as POSTing to the `/tasks` endpoint + * with a data block containing the fields you'd like to set on the task. + * Any unspecified fields will take on default values. + * + * Every task is required to be created in a specific workspace, and this + * workspace cannot be changed once set. The workspace need not be set + * explicitly if you specify `projects` or a `parent` task instead. + * + * `projects` can be a comma separated list of projects, or just a single + * project the task should belong to. + * + * @deprecated replace with createTask + * + * @return response + */ + public function create($params = array(), $options = array()) + { + return $this->client->post("/tasks", $params, $options); + } + + /** + * Creating a new task is as easy as POSTing to the `/tasks` endpoint + * with a data block containing the fields you'd like to set on the task. + * Any unspecified fields will take on default values. + * + * Every task is required to be created in a specific workspace, and this + * workspace cannot be changed once set. The workspace need not be set + * explicitly if you specify a `project` or a `parent` task instead. + * + * @deprecated replace with createTaskForWorkspace + * + * @param workspace The workspace to create a task in. + * @return response + */ + public function createInWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/tasks", $workspace); + return $this->client->post($path, $params, $options); + } + + /** + * Returns the complete task record for a single task. + * + * @deprecated replace with getTask + * + * @param task The task to get. + * @return response + */ + public function findById($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s", $task); + return $this->client->get($path, $params, $options); + } + + /** + * A specific, existing task can be updated by making a PUT request on the + * URL for that task. Only the fields provided in the `data` block will be + * updated; any unspecified fields will remain unchanged. + * + * When using this method, it is best to specify only those fields you wish + * to change, or else you may overwrite changes made by another user since + * you last retrieved the task. + * + * Returns the complete updated task record. + * + * @deprecated replace with updateTask + * + * @param task The task to update. + * @return response + */ + public function update($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s", $task); + return $this->client->put($path, $params, $options); + } + + /** + * A specific, existing task can be deleted by making a DELETE request on the + * URL for that task. Deleted tasks go into the "trash" of the user making + * the delete request. Tasks can be recovered from the trash within a period + * of 30 days; afterward they are completely removed from the system. + * + * Returns an empty data record. + * + * @deprecated replace with deleteTask + * + * @param task The task to delete. + * @return response + */ + public function delete($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s", $task); + return $this->client->delete($path, $params, $options); + } + + /** + * Returns the compact task records for all tasks within the given project, + * ordered by their priority within the project. + * + * @deprecated replace with getTasksForProject + * + * @param project The project in which to search for tasks. + * @return response + */ + public function findByProject($project, $params = array(), $options = array()) + { + $path = sprintf("/projects/%s/tasks", $project); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact task records for all tasks with the given tag. + * + * @deprecated replace with getTasksForTag + * + * @param tag The tag in which to search for tasks. + * @return response + */ + public function findByTag($tag, $params = array(), $options = array()) + { + $path = sprintf("/tags/%s/tasks", $tag); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Board view only: Returns the compact section records for all tasks within the given section. + * + * @deprecated replace with getTasksForSection + * + * @param section The section in which to search for tasks. + * @return response + */ + public function findBySection($section, $params = array(), $options = array()) + { + $path = sprintf("/sections/%s/tasks", $section); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact list of tasks in a user's My Tasks list. The returned + * tasks will be in order within each assignee status group of `Inbox`, + * `Today`, and `Upcoming`. + * + * **Note:** tasks in `Later` have a different ordering in the Asana web app + * than the other assignee status groups; this endpoint will still return + * them in list order in `Later` (differently than they show up in Asana, + * but the same order as in Asana's mobile apps). + * + * **Note:** Access control is enforced for this endpoint as with all Asana + * API endpoints, meaning a user's private tasks will be filtered out if the + * API-authenticated user does not have access to them. + * + * **Note:** Both complete and incomplete tasks are returned by default + * unless they are filtered out (for example, setting `completed_since=now` + * will return only incomplete tasks, which is the default view for "My + * Tasks" in Asana.) + * + * @deprecated replace with getTasksForUserTaskList + * + * @param user_task_list The user task list in which to search for tasks. + * @return response + */ + public function findByUserTaskList($userTaskList, $params = array(), $options = array()) + { + $path = sprintf("/user_task_lists/%s/tasks", $userTaskList); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact task records for some filtered set of tasks. Use one + * or more of the parameters provided to filter the tasks returned. You must + * specify a `project`, `section`, `tag`, or `user_task_list` if you do not + * specify `assignee` and `workspace`. + * + * @deprecated replace with getTasks + * + * @return response + */ + public function findAll($params = array(), $options = array()) + { + return $this->client->getCollection("/tasks", $params, $options); + } + + /** + * The search endpoint allows you to build complex queries to find and fetch exactly the data you need from Asana. For a more comprehensive description of all the query parameters and limitations of this endpoint, see our [long-form documentation](/developers/documentation/getting-started/search-api) for this feature. + * + * @deprecated replace with searchTasksForWorkspace + * + * @param workspace The workspace or organization in which to search for tasks. + * @return response + */ + public function searchInWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/tasks/search", $workspace); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact representations of all of the dependencies of a task. + * + * @deprecated replace with getDependenciesForTask + * + * @param task The task to get dependencies on. + * @return response + */ + public function dependencies($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/dependencies", $task); + return $this->client->get($path, $params, $options); + } + + /** + * Returns the compact representations of all of the dependents of a task. + * + * @deprecated replace with getDependentsForTask + * + * @param task The task to get dependents on. + * @return response + */ + public function dependents($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/dependents", $task); + return $this->client->get($path, $params, $options); + } + + /** + * Marks a set of tasks as dependencies of this task, if they are not + * already dependencies. *A task can have at most 15 dependencies.* + * + * @deprecated replace with addDependenciesForTask + * + * @param task The task to add dependencies to. + * @return response + */ + public function addDependencies($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/addDependencies", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Marks a set of tasks as dependents of this task, if they are not already + * dependents. *A task can have at most 30 dependents.* + * + * @deprecated replace with addDependentsForTask + * + * @param task The task to add dependents to. + * @return response + */ + public function addDependents($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/addDependents", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Unlinks a set of dependencies from this task. + * + * @deprecated replace with removeDependenciesForTask + * + * @param task The task to remove dependencies from. + * @return response + */ + public function removeDependencies($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/removeDependencies", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Unlinks a set of dependents from this task. + * + * @deprecated replace with removeDependentsForTask + * + * @param task The task to remove dependents from. + * @return response + */ + public function removeDependents($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/removeDependents", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Adds each of the specified followers to the task, if they are not already + * following. Returns the complete, updated record for the affected task. + * + * @deprecated replace with addFollowersForTask + * + * @param task The task to add followers to. + * @return response + */ + public function addFollowers($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/addFollowers", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Removes each of the specified followers from the task if they are + * following. Returns the complete, updated record for the affected task. + * + * @deprecated replace with removeFollowersForTask + * + * @param task The task to remove followers from. + * @return response + */ + public function removeFollowers($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/removeFollowers", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Returns a compact representation of all of the projects the task is in. + * + * @deprecated replace with Tasks.getProjectsForTask + * + * @param task The task to get projects on. + * @return response + */ + public function projects($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/projects", $task); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Adds the task to the specified project, in the optional location + * specified. If no location arguments are given, the task will be added to + * the end of the project. + * + * `addProject` can also be used to reorder a task within a project or section that + * already contains it. + * + * At most one of `insert_before`, `insert_after`, or `section` should be + * specified. Inserting into a section in an non-order-dependent way can be + * done by specifying `section`, otherwise, to insert within a section in a + * particular place, specify `insert_before` or `insert_after` and a task + * within the section to anchor the position of this task. + * + * Returns an empty data block. + * + * @deprecated replace with addProjectForTask + * + * @param task The task to add to a project. + * @return response + */ + public function addProject($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/addProject", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Removes the task from the specified project. The task will still exist + * in the system, but it will not be in the project anymore. + * + * Returns an empty data block. + * + * @deprecated replace with removeProjectForTask + * + * @param task The task to remove from a project. + * @return response + */ + public function removeProject($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/removeProject", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Returns a compact representation of all of the tags the task has. + * + * @deprecated replace with Tags.getTagsForTask + * + * @param task The task to get tags on. + * @return response + */ + public function tags($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/tags", $task); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Adds a tag to a task. Returns an empty data block. + * + * @deprecated replace with addTagForTask + * + * @param task The task to add a tag to. + * @return response + */ + public function addTag($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/addTag", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Removes a tag from the task. Returns an empty data block. + * + * @deprecated replace with removeTagForTask + * + * @param task The task to remove a tag from. + * @return response + */ + public function removeTag($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/removeTag", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Returns a compact representation of all of the subtasks of a task. + * + * @deprecated replace with getSubtasksForTask + * + * @param task The task to get the subtasks of. + * @return response + */ + public function subtasks($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/subtasks", $task); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Creates a new subtask and adds it to the parent task. Returns the full record + * for the newly created subtask. + * + * @deprecated replace with createSubtaskForTask + * + * @param task The task to add a subtask to. + * @return response + */ + public function addSubtask($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/subtasks", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Returns a compact representation of all of the stories on the task. + * + * @deprecated replace with Stories.createStoryForTask + * + * @param task The task containing the stories to get. + * @return response + */ + public function stories($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/stories", $task); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Adds a comment to a task. The comment will be authored by the + * currently authenticated user, and timestamped when the server receives + * the request. + * + * Returns the full record for the new story added to the task. + * + * @deprecated replace with Stories.createStoryForTask + * + * @param task Globally unique identifier for the task. + * @return response + */ + public function addComment($task, $params = array(), $options = array()) + { + $path = sprintf("/tasks/%s/stories", $task); + return $this->client->post($path, $params, $options); + } + + /** + * Insert or reorder tasks in a user's My Tasks list. If the task was not + * assigned to the owner of the user task list it will be reassigned when + * this endpoint is called. If neither `insert_before` nor `insert_after` + * are provided the task will be inserted at the top of the assignee's + * inbox. + * + * Returns an empty data block. + * + * @param user_task_list Globally unique identifier for the user task list. + * @return response + */ + public function insertInUserTaskList($userTaskList, $params = array(), $options = array()) + { + $path = sprintf("/user_task_lists/%s/tasks/insert", $userTaskList); + return $this->client->post($path, $params, $options); + } } diff --git a/src/Asana/Resources/TeamMemberships.php b/src/Asana/Resources/TeamMemberships.php new file mode 100644 index 0000000..35ddbaa --- /dev/null +++ b/src/Asana/Resources/TeamMemberships.php @@ -0,0 +1,9 @@ +client->get($path, $params, $options); + } + + /** + * Returns the compact records for all teams in the organization visible to + * the authorized user. + * + * @deprecated replace with getTeamsForOrganization + * + * @param organization Globally unique identifier for the workspace or organization. + * @return response + */ + public function findByOrganization($organization, $params = array(), $options = array()) + { + $path = sprintf("/organizations/%s/teams", $organization); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact records for all teams to which user is assigned. + * + * @deprecated replace with getTeamsForUser + * + * @param user An identifier for the user. Can be one of an email address, + * the globally unique identifier for the user, or the keyword `me` + * to indicate the current user making the request. + * @return response + */ + public function findByUser($user, $params = array(), $options = array()) + { + $path = sprintf("/users/%s/teams", $user); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the compact records for all users that are members of the team. + * + * @deprecated replace with Users.getUsersForTeam + * + * @param team Globally unique identifier for the team. + * @return response + */ + public function users($team, $params = array(), $options = array()) + { + $path = sprintf("/teams/%s/users", $team); + return $this->client->getCollection($path, $params, $options); + } + + /** + * The user making this call must be a member of the team in order to add others. + * The user to add must exist in the same organization as the team in order to be added. + * The user to add can be referenced by their globally unique user ID or their email address. + * Returns the full user record for the added user. + * + * @deprecated replace with addUserForTeam + * + * @param team Globally unique identifier for the team. + * @return response + */ + public function addUser($team, $params = array(), $options = array()) + { + $path = sprintf("/teams/%s/addUser", $team); + return $this->client->post($path, $params, $options); + } + + /** + * The user to remove can be referenced by their globally unique user ID or their email address. + * Removes the user from the specified team. Returns an empty data record. + * + * @deprecated replace with removeUserForTeam + * + * @param team Globally unique identifier for the team. + * @return response + */ + public function removeUser($team, $params = array(), $options = array()) + { + $path = sprintf("/teams/%s/removeUser", $team); + return $this->client->post($path, $params, $options); + } } diff --git a/src/Asana/Resources/Typeahead.php b/src/Asana/Resources/Typeahead.php new file mode 100644 index 0000000..f7f8e9c --- /dev/null +++ b/src/Asana/Resources/Typeahead.php @@ -0,0 +1,9 @@ +client->get($path, $params, $options); + } + + /** + * Returns the full record for a user task list. + * + * @deprecated replace with getUserTaskList + * + * @param user_task_list Globally unique identifier for the user task list. + * @return response + */ + public function findById($userTaskList, $params = array(), $options = array()) + { + $path = sprintf("/user_task_lists/%s", $userTaskList); + return $this->client->get($path, $params, $options); + } + + /** + * Returns the compact list of tasks in a user's My Tasks list. The returned + * tasks will be in order within each assignee status group of `Inbox`, + * `Today`, and `Upcoming`. + * + * **Note:** tasks in `Later` have a different ordering in the Asana web app + * than the other assignee status groups; this endpoint will still return + * them in list order in `Later` (differently than they show up in Asana, + * but the same order as in Asana's mobile apps). + * + * **Note:** Access control is enforced for this endpoint as with all Asana + * API endpoints, meaning a user's private tasks will be filtered out if the + * API-authenticated user does not have access to them. + * + * **Note:** Both complete and incomplete tasks are returned by default + * unless they are filtered out (for example, setting `completed_since=now` + * will return only incomplete tasks, which is the default view for "My + * Tasks" in Asana.) + * + * @deprecated replace with Tasks.getTasksForUserTaskList + * + * @param user_task_list The user task list in which to search for tasks. + * @return response + */ + public function tasks($userTaskList, $params = array(), $options = array()) + { + $path = sprintf("/user_task_lists/%s/tasks", $userTaskList); + return $this->client->getCollection($path, $params, $options); + } +} diff --git a/src/Asana/Resources/Users.php b/src/Asana/Resources/Users.php index 539f35f..52b6c8d 100644 --- a/src/Asana/Resources/Users.php +++ b/src/Asana/Resources/Users.php @@ -6,4 +6,75 @@ class Users extends UsersBase { + /** + * Returns the full user record for the currently authenticated user. + * + * @return response + */ + public function me($params = array(), $options = array()) + { + return $this->client->get("/users/me", $params, $options); + } + + /** + * Returns the full user record for the single user with the provided ID. + * + * @deprecated replace with getUser + * + * @param user An identifier for the user. Can be one of an email address, + * the globally unique identifier for the user, or the keyword `me` + * to indicate the current user making the request. + * @return response + */ + public function findById($user, $params = array(), $options = array()) + { + $path = sprintf("/users/%s", $user); + return $this->client->get($path, $params, $options); + } + + /** + * Returns all of a user's favorites in the given workspace, of the given type. + * Results are given in order (The same order as Asana's sidebar). + * + * @deprecated replace with getFavoritesForUser + * + * @param user An identifier for the user. Can be one of an email address, + * the globally unique identifier for the user, or the keyword `me` + * to indicate the current user making the request. + * @return response + */ + public function getUserFavorites($user, $params = array(), $options = array()) + { + $path = sprintf("/users/%s/favorites", $user); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the user records for all users in the specified workspace or + * organization. + * + * @deprecated replace with getUsersForWorkspace + * + * @param workspace The workspace in which to get users. + * @return response + */ + public function findByWorkspace($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/users", $workspace); + return $this->client->getCollection($path, $params, $options); + } + + /** + * Returns the user records for all users in all workspaces and organizations + * accessible to the authenticated user. Accepts an optional workspace ID + * parameter. + * + * @deprecated replace with getUsers + * + * @return response + */ + public function findAll($params = array(), $options = array()) + { + return $this->client->getCollection("/users", $params, $options); + } } diff --git a/src/Asana/Resources/Webhooks.php b/src/Asana/Resources/Webhooks.php index b94c4b0..4f47d8a 100644 --- a/src/Asana/Resources/Webhooks.php +++ b/src/Asana/Resources/Webhooks.php @@ -6,4 +6,72 @@ class Webhooks extends WebhooksBase { + /** + * Establishing a webhook is a two-part process. First, a simple HTTP POST + * similar to any other resource creation. Since you could have multiple + * webhooks we recommend specifying a unique local id for each target. + * + * Next comes the confirmation handshake. When a webhook is created, we will + * send a test POST to the `target` with an `X-Hook-Secret` header as + * described in the + * [Resthooks Security documentation](http://resthooks.org/docs/security/). + * The target must respond with a `200 OK` and a matching `X-Hook-Secret` + * header to confirm that this webhook subscription is indeed expected. + * + * If you do not acknowledge the webhook's confirmation handshake it will + * fail to setup, and you will receive an error in response to your attempt + * to create it. This means you need to be able to receive and complete the + * webhook *while* the POST request is in-flight. + * + * @deprecated replace with createWebhook + * + * @return response + */ + public function create($params = array(), $options = array()) + { + return $this->client->post("/webhooks", $params, $options); + } + + /** + * Returns the compact representation of all webhooks your app has + * registered for the authenticated user in the given workspace. + * + * @deprecated replace with getWebhooks + * + * @return response + */ + public function getAll($params = array(), $options = array()) + { + return $this->client->getCollection("/webhooks", $params, $options); + } + + /** + * Returns the full record for the given webhook. + * + * @deprecated replace with getWebhook + * + * @param webhook The webhook to get. + * @return response + */ + public function getById($webhook, $params = array(), $options = array()) + { + $path = sprintf("/webhooks/%s", $webhook); + return $this->client->get($path, $params, $options); + } + + /** + * This method permanently removes a webhook. Note that it may be possible + * to receive a request that was already in flight after deleting the + * webhook, but no further requests will be issued. + * + * @deprecated replace with deleteWebhook + * + * @param webhook The webhook to delete. + * @return response + */ + public function deleteById($webhook, $params = array(), $options = array()) + { + $path = sprintf("/webhooks/%s", $webhook); + return $this->client->delete($path, $params, $options); + } } diff --git a/src/Asana/Resources/WorkspaceMemberships.php b/src/Asana/Resources/WorkspaceMemberships.php new file mode 100644 index 0000000..14b4715 --- /dev/null +++ b/src/Asana/Resources/WorkspaceMemberships.php @@ -0,0 +1,9 @@ +client->get($path, $params, $options); + } + + /** + * Returns the compact records for all workspaces visible to the authorized user. + * + * @deprecated replace with getWorkspaces + * + * @return response + */ + public function findAll($params = array(), $options = array()) + { + return $this->client->getCollection("/workspaces", $params, $options); + } + + /** + * A specific, existing workspace can be updated by making a PUT request on + * the URL for that workspace. Only the fields provided in the data block + * will be updated; any unspecified fields will remain unchanged. + * + * Currently the only field that can be modified for a workspace is its `name`. + * + * Returns the complete, updated workspace record. + * + * @deprecated replace with updateWorkspace + * + * @param workspace The workspace to update. + * @return response + */ + public function update($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s", $workspace); + return $this->client->put($path, $params, $options); + } + + /** + * Retrieves objects in the workspace based on an auto-completion/typeahead + * search algorithm. This feature is meant to provide results quickly, so do + * not rely on this API to provide extremely accurate search results. The + * result set is limited to a single page of results with a maximum size, + * so you won't be able to fetch large numbers of results. + * + * @deprecated replace with Typeahead.typeahead + * + * @param workspace The workspace to fetch objects from. + * @return response + */ + public function typeahead($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/typeahead", $workspace); + return $this->client->getCollection($path, $params, $options); + } + + /** + * The user can be referenced by their globally unique user ID or their email address. + * Returns the full user record for the invited user. + * + * @deprecated replace with addUserForWorkspace + * + * @param workspace The workspace or organization to invite the user to. + * @return response + */ + public function addUser($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/addUser", $workspace); + return $this->client->post($path, $params, $options); + } + + /** + * The user making this call must be an admin in the workspace. + * Returns an empty data record. + * + * @deprecated replace with removeUserForWorkspace + * + * @param workspace The workspace or organization to invite the user to. + * @return response + */ + public function removeUser($workspace, $params = array(), $options = array()) + { + $path = sprintf("/workspaces/%s/removeUser", $workspace); + return $this->client->post($path, $params, $options); + } } diff --git a/src/Asana/Test/AsanaTest.php b/src/Asana/Test/AsanaTest.php index f0129f7..8fe93ae 100644 --- a/src/Asana/Test/AsanaTest.php +++ b/src/Asana/Test/AsanaTest.php @@ -5,11 +5,11 @@ use Asana\Client; use Asana\Test\MockDispatcher; - class AsanaTest extends \PHPUnit_Framework_TestCase + class AsanaTest extends \PHPUnit\Framework\TestCase { protected $client; - protected function setUp() + protected function setUp(): void { global $sleepCalls; diff --git a/swagger_templates/api.mustache b/swagger_templates/api.mustache new file mode 100644 index 0000000..1354287 --- /dev/null +++ b/swagger_templates/api.mustache @@ -0,0 +1,37 @@ +client = $client; + } +{{#operation}}{{^formParams}} +{{#contents}} + + /** {{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} + * + {{#pathParams}} + * @param {{dataType}} ${{paramName}} {{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}{{#description}} {{{description}}}{{/description}} + {{/pathParams}} + * @param array $params + * @param array $options + * @return response + */ + public function {{operationId}}({{#pathParams}}${{paramName}}, {{/pathParams}}$params = array(), $options = array()) { + $path = "{{path}}"; + {{#pathParams}} + $path = str_replace("{ {{~baseName~}} }", ${{paramName}}, $path); + {{/pathParams}} + return $this->client->{{#neq "GET" httpMethod}}{{toLowerCase httpMethod}}{{/neq}}{{#eq "GET" httpMethod}}{{returnContainer}}{{/eq}}($path, $params, $options); + } +{{/contents}} +{{/formParams}}{{/operation}} +{{/operations}} +} diff --git a/swagger_templates/api_doc.mustache b/swagger_templates/api_doc.mustache new file mode 100644 index 0000000..f0d013f --- /dev/null +++ b/swagger_templates/api_doc.mustache @@ -0,0 +1,12 @@ +{{#operations}}{{toLowerCase classname}}:{{#operation}}{{#contents}} + {{operationId}}: >- + {{toLowerCase baseName}}->{{operationId}}({{#pathParams}}${{paramName}}, {{/pathParams}}{{#eq "GET" httpMethod}}array('param' => 'value', 'param' => 'value'), {{/eq}}{{#neq "GET" httpMethod}}{{#neq "DELETE" httpMethod}}array('field' => 'value', 'field' => 'value'), {{/neq}}{{/neq}}array('opt_pretty' => 'true')){{/contents}}{{/operation}} +{{/operations}} diff --git a/swagger_templates/php-config.json b/swagger_templates/php-config.json new file mode 100644 index 0000000..15ffbd3 --- /dev/null +++ b/swagger_templates/php-config.json @@ -0,0 +1,7 @@ +{ + "packageName" : "asana", + "templateDir": "swagger_templates", + "packagePath": "Asana", + "srcBasePath": "Resources", + "hideGenerationTimestamp": true +} diff --git a/tests/Asana/ClientTest.php b/tests/Asana/ClientTest.php index bf23d05..63ab71e 100644 --- a/tests/Asana/ClientTest.php +++ b/tests/Asana/ClientTest.php @@ -5,9 +5,12 @@ use Asana\Test\AsanaTest; use Asana\Errors\Error; use Asana\Errors\ServerError; +use PHPUnit\Framework\Error\Warning; class ClientTest extends Test\AsanaTest { + var $errors = array(); + public function testClientGet() { $this->dispatcher->registerResponse('/users/me', 200, null, '{ "data": "foo" }'); @@ -16,54 +19,48 @@ public function testClientGet() $this->assertEquals($result, 'foo'); } - /** - * @expectedException Asana\Errors\NoAuthorizationError - */ public function testNotAuthorized() { + $this->expectException(Errors\NoAuthorizationError::class); + $this->dispatcher->registerResponse('/users/me', 401, null, '{ "errors": [{ "message": "Not Authorized" }]}'); $this->client->users->me(); } - /** - * @expectedException Asana\Errors\InvalidRequestError - */ public function testInvalidRequest() { - $res = '{ "errors": [{ "message": "Missing input" }] }'; - $this->dispatcher->registerResponse('/tasks?limit=50', 400, null, $res); + $this->expectException(Errors\InvalidRequestError::class); + + $this->dispatcher->registerResponse('/tasks?limit=50', 400, null, '{ "errors": [{ "message": "Missing input" }] }'); $this->client->tasks->findAll(null, array('iterator_type' => false)); } - /** - * @expectedException Asana\Errors\ServerError - */ public function testServerError() { + $this->expectException(Errors\ServerError::class); + $res = '{ "errors": [ { "message": "Server Error", "phrase": "6 sad squid snuggle softly" } ] }'; $this->dispatcher->registerResponse('/users/me', 500, null, $res); $this->client->users->me(); } - /** - * @expectedException Asana\Errors\NotFoundError - */ public function testNotFound() { + $this->expectException(Errors\NotFoundError::class); + $res = '{ "errors": [ { "message": "user: Unknown object: 1234" } ] }'; $this->dispatcher->registerResponse('/users/1234', 404, null, $res); $this->client->users->findById(1234); } - /** - * @expectedException Asana\Errors\ForbiddenError - */ public function testForbidden() { + $this->expectException(Errors\ForbiddenError::class); + $res = '{ "errors": [ { "message": "user: Forbidden" } ] }'; $this->dispatcher->registerResponse('/users/1234', 403, null, $res); @@ -336,4 +333,100 @@ public function testPutNamedParameters() $this->assertEquals($result, 'foo'); $this->assertEquals(json_decode($this->dispatcher->calls[0]['request']->payload), json_decode($req)); } + + public function testAsanaChangeHeaderNone() + { + $this->errors = array(); + set_error_handler(array($this,'handleError')); + + $this->dispatcher->registerResponse('/tasks/1001', + 200, + null, + '{ "data": "foo" }'); + + $this->client->tasks->update( + 1001, + array('assignee' => 1235, 'followers' => array(5678), 'name' => "Hello, world.") + ); + + $this->assertEquals(0, count($this->errors)); + } + + public function testAsanaChangeHeaderEnable() + { + $this->errors = array(); + set_error_handler(array($this,'handleError')); + + $this->dispatcher->registerResponse('/tasks/1001', + 200, + array('asana-change' => 'name=string_ids;info=something;affected=true'), + '{ "data": "foo" }'); + + $this->client->tasks->update( + 1001, + array('assignee' => 1235, 'followers' => array(5678), 'name' => "Hello, world."), + array('headers' => array('asana-enable' => 'string_ids')) + ); + + $this->assertEquals(0, count($this->errors)); + } + + public function testAsanaChangeHeaderDisable() + { + $this->errors = array(); + set_error_handler(array($this,'handleError')); + + $this->dispatcher->registerResponse('/tasks/1001', + 200, + array('asana-change' => 'name=string_ids;info=something;affected=true'), + '{ "data": "foo" }'); + + $this->client->tasks->update( + 1001, + array('assignee' => 1235, 'followers' => array(5678), 'name' => "Hello, world."), + array('headers' => array('asana-disable' => 'string_ids')) + ); + + $this->assertEquals(0, count($this->errors)); + } + + public function testAsanaChangeHeaderSingle() + { + $this->errors = array(); + set_error_handler(array($this,'handleError')); + + $this->dispatcher->registerResponse('/tasks/1001', + 200, + array('asana-change' => 'name=string_ids;info=something;affected=true'), + '{ "data": "foo" }'); + + $this->client->tasks->update( + 1001, + array('assignee' => 1235, 'followers' => array(5678), 'name' => "Hello, world.") + ); + + $this->assertEquals(1, count($this->errors)); + } + + public function testAsanaChangeHeaderMultiple() + { + $this->errors = array(); + set_error_handler(array($this,'handleError')); + + $this->dispatcher->registerResponse('/tasks/1001', + 200, + array('asana-change' => 'name=string_ids;info=something;affected=true,name=new_sections;info=something;affected=true'), + '{ "data": "foo" }'); + + $this->client->tasks->update( + 1001, + array('assignee' => 1235, 'followers' => array(5678), 'name' => "Hello, world.") + ); + + $this->assertEquals(2, count($this->errors)); + } + + public function handleError($n, $m, $f, $l) { + array_push($this->errors, array($n, $m, $f, $l)); + } } diff --git a/tests/Asana/OAuthDispatcherTest.php b/tests/Asana/OAuthDispatcherTest.php index 68a2841..dcbb710 100644 --- a/tests/Asana/OAuthDispatcherTest.php +++ b/tests/Asana/OAuthDispatcherTest.php @@ -16,9 +16,9 @@ public function authenticate($request) } } -class OAuthDispatcherTest extends \PHPUnit_Framework_TestCase +class OAuthDispatcherTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { $this->dispatcher = new FakeOAuthDispatcher( array( @@ -27,12 +27,11 @@ protected function setUp() ); } - /** - * @expectedException Exception - * @expectedExceptionMessageRegExp #access token not set# - */ public function testAuthenticateNoToken() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('access token not set'); + $request = new MockRequest($this->dispatcher); $this->dispatcher->authenticate($request); } diff --git a/tests/Asana/Resources/EventsTest.php b/tests/Asana/Resources/EventsTest.php index ed4e06f..f0744de 100644 --- a/tests/Asana/Resources/EventsTest.php +++ b/tests/Asana/Resources/EventsTest.php @@ -2,6 +2,7 @@ namespace Asana; +use Asana\Errors; use Asana\Test\AsanaTest; class EventsTest extends Test\AsanaTest @@ -15,11 +16,10 @@ public function testEventsGet() $this->assertEquals($result, json_decode($res)); } - /** - * @expectedException Asana\Errors\InvalidTokenError - */ public function testEventsGetInvalidToken() { + $this->expectException(Errors\InvalidTokenError::class); + $res = '{ "message": "Sync token invalid or too old", "sync": "b" }'; $this->dispatcher->registerResponse('/events?resource=14321&sync=a', 412, null, $res); @@ -38,21 +38,19 @@ public function testEventsGetNext() $this->assertEquals(count($this->client->events->getNext(array('resource' => '1'))), 2); } - /** - * @expectedException Asana\Errors\InvalidRequestError - */ public function testEventsGetNextUnknownObject() { + $this->expectException(Errors\InvalidRequestError::class); + $this->dispatcher->registerResponse('/events?limit=50&resource=1', 400, null, '{ "sync": "1" }'); $this->client->events->getNext(array('resource' => '1')); } - /** - * @expectedException Asana\Errors\InvalidTokenError - */ public function testEventsGetNextInvalidToken() { + $this->expectException(Errors\InvalidTokenError::class); + $this->dispatcher->registerResponse('/events?limit=50&sync=invalid&resource=1', 412, null, '{ "sync": "1" }'); $this->client->events->getNext(array('resource' => '1', 'sync' => 'invalid')); @@ -82,21 +80,19 @@ public function testEventsGetIterator() // $this->assertEquals($iterator->current(), 'c'); } - /** - * @expectedException Asana\Errors\InvalidRequestError - */ public function testEventsGetIteratorUnknownObject() { + $this->expectException(Errors\InvalidRequestError::class); + $this->dispatcher->registerResponse('/events?limit=50&resource=1', 400, null, '{ "sync": "1" }'); $this->client->events->getIterator(array('resource' => '1'))->rewind(); } - /** - * @expectedException Asana\Errors\InvalidTokenError - */ public function testEventsGetIteratorInvalidToken() { + $this->expectException(Errors\InvalidTokenError::class); + $this->dispatcher->registerResponse('/events?limit=50&sync=invalid&resource=1', 412, null, '{ "sync": "1" }'); $this->client->events->getIterator(array('resource' => '1', 'sync' => 'invalid'))->rewind();