Skip to content

Commit

Permalink
Added handling for opting out of asana_change logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rossgrambo-zz committed Aug 5, 2019
1 parent e65a9b3 commit b5ce790
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/Asana/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,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');
Expand Down Expand Up @@ -113,6 +114,10 @@ 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) {
Expand Down

0 comments on commit b5ce790

Please sign in to comment.