Skip to content

Commit

Permalink
Getting delta notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
davicente committed May 18, 2017
1 parent 4fa4c66 commit d8297c0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Adapter/OneDriveNotificationsAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,20 @@ public function createSubscription($notificationUrl, $expirationDate, $clientSta
}


/**
* @param string $deltaToken
*
* @return \Psr\Http\Message\ResponseInterface
*
* @throws OneDriveClientException
*
* @link https://dev.onedrive.com/items/view_delta.htm
*/
public function delta($deltaToken=null) {
$response = $this->client->delta($deltaToken);
$responseContent = json_decode((string) $response->getBody());
return $responseContent;
}


}
21 changes: 21 additions & 0 deletions src/Client/OneDriveClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,27 @@ public function subscribe($notificationUrl, $expirationDate, $clientState=null,
}


/**
* @param string $deltaToken
*
* @return \Psr\Http\Message\ResponseInterface
*
* @throws OneDriveClientException
*
* @link https://dev.onedrive.com/items/view_delta.htm
*/
public function delta($deltaToken=null)
{
$url = self::BASE_URI.self::ROOT_PATH.'/view.delta';

if(isset($deltaToken)) {
$url .= '?token='.$deltaToken;
}

return $this->getResponse('GET', $url);
}


/**
* @param string $path
* @param string $content
Expand Down

0 comments on commit d8297c0

Please sign in to comment.