http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Api/Models/User.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Api/Models/User.php b/sdks/php5/apache-usergrid/src/Api/Models/User.php deleted file mode 100644 index 8bec6d3..0000000 --- a/sdks/php5/apache-usergrid/src/Api/Models/User.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Api\Models; - - -use Guzzle\Service\Command\ResponseClassInterface; - -/** - * Class User - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * @link http://baas-platform.com - */ -class User extends BaseCollection implements ResponseClassInterface -{ - - use GuzzleCommandTrait; - - public function deviceAttribute() - { - return $this->getApiClient()->application()->GetRelationship([ - 'collection' => 'users', - 'entity_id' => $this->entities->fetch('uuid')->first(), - 'relationship' => 'devices' - ])->toArray(); - } - - public function notificationAttribute() - { - - } - - public function groupsAttribute() - { - return $this->getApiClient()->application()->GetRelationship([ - 'collection' => 'users', - 'entity_id' => $this->entities->fetch('uuid')->first(), - 'relationship' => 'groups' - ])->toArray(); - } - - public function rolesAttribute() - { - return $this->getApiClient()->application()->GetRelationship([ - 'collection' => 'users', - 'entity_id' => $this->entities->fetch('uuid')->first(), - 'relationship' => 'roles' - ])->toArray(); - } - - public function connectionsAttribute() - { - return $this->getApiClient()->application()->GetRelationship([ - 'collection' => 'users', - 'entity_id' => $this->entities->fetch('uuid')->first(), - 'relationship' => 'connections' - ])->toArray(); - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Api/QueryAggregator.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Api/QueryAggregator.php b/sdks/php5/apache-usergrid/src/Api/QueryAggregator.php deleted file mode 100644 index eacfcd5..0000000 --- a/sdks/php5/apache-usergrid/src/Api/QueryAggregator.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Api; - - -use Guzzle\Http\QueryAggregator\QueryAggregatorInterface; -use Guzzle\Http\QueryString; - -/** - * Class QueryAggregator - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * @link http://baas-platform.com - */ -class QueryAggregator implements QueryAggregatorInterface -{ - - /** - * {@inheritDoc} - */ - public function aggregate($key, $value, QueryString $query) - { - $response = []; - - foreach ($value as $k => $v) { - if (is_int($k)) { - return [ - $query->encodeValue("{$key}[]") => $value - ]; - } - - $k = "{$key}[{$k}]"; - - if (is_array($v)) { - $response = array_merge($response, self::aggregate($k, $v, $query)); - } else { - $response[$query->encodeValue($k)] = $query->encodeValue($v); - } - } - - return $response; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Api/ResourceIterator.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Api/ResourceIterator.php b/sdks/php5/apache-usergrid/src/Api/ResourceIterator.php deleted file mode 100644 index 7df0dd7..0000000 --- a/sdks/php5/apache-usergrid/src/Api/ResourceIterator.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - - -namespace Apache\Usergrid\Api; - -use Guzzle\Service\Command\CommandInterface; -use Guzzle\Service\Resource\ResourceIterator as BaseIterator; - -/** - * Class ResourceIterator - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * @link http://baas-platform.com - */ -class ResourceIterator extends BaseIterator -{ - /** - * {@inheritDoc} - */ - public function __construct(CommandInterface $command, array $data = []) - { - parent::__construct($command, $data); - - $this->pageSize = 20; - } - - /** - * Send a request to retrieve the next page of results. Hook for subclasses to implement. - * - * @return array Returns the newly loaded resources - */ - protected function sendRequest() - { - $this->command->set('limit', $this->pageSize); - - if ($this->nextToken) { - $this->command->set('cursor', $this->nextToken); - } - - $result = $this->command->execute(); - - $data = $result['entities']; - - if ($result->has('cursor')) { - $this->nextToken = $result['cursor'] ? $result['cursor'] : false; - } - - return $data; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Api/Usergrid.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Api/Usergrid.php b/sdks/php5/apache-usergrid/src/Api/Usergrid.php deleted file mode 100644 index 279f2b2..0000000 --- a/sdks/php5/apache-usergrid/src/Api/Usergrid.php +++ /dev/null @@ -1,452 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Api; - - -use Apache\Usergrid\Guzzle\Plugin\Oauth2\Oauth2Plugin; -use Guzzle\Common\Event; -use Guzzle\Plugin\ErrorResponse\ErrorResponsePlugin; -use Guzzle\Service\Description\ServiceDescription; -use InvalidArgumentException; - -/** - * Class Usergrid - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * @link http://baas-platform.com - */ -class Usergrid -{ - - /** - * Header Bearer Token - * @var - */ - protected $token; - - - /** - * @var \Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType\GrantTypeInterface - */ - protected $grantType; - /** - * The Usergrid API version. - * - * @var string - */ - protected $version = '1.0.1'; - /** - * The manifests path. - * - * @var string - */ - protected $manifestPath; - /** - * The Base URL. - * - * @var string - */ - protected $baseUrl; - /** - * Oauth2 Guzzle Plugin. - * - * @var \Apache\Usergrid\Guzzle\Plugin\Oauth2\Oauth2Plugin - */ - protected $oauth2_plugin; - /** - * The cached manifests data. - * - * @var array - */ - protected $manifests = []; - /** - * The user agent. - * - * @var string - */ - protected $userAgent = 'BaaS-Usergrid/1.0.0'; - /** - * The headers to be sent to the Guzzle client. - * - * @var array - */ - protected $headers = []; - private $org_name; - private $app_name; - - /** - * @param null $orgName - * @param null $appName - * @param $manifestPath - * @param $version - * @param $baseUrl - * @param Oauth2Plugin $oauth2_plugin - */ - function __construct( - $orgName = null, - $appName = null, - $manifestPath, - $version, - $baseUrl, - Oauth2Plugin $oauth2_plugin = null - ) { - //Set Version so its added to header - $this->setVersion($version ?: $this->version); - - $this->baseUrl = $baseUrl; - - $this->org_name = $orgName; - $this->app_name = $appName; - - //check if OAuth2 plugin is enabled - if ($oauth2_plugin != null) { - $this->oauth2_plugin = $oauth2_plugin; - $this->grantType = $this->oauth2_plugin->getGrantType(); - } - - // Set the manifest path - $this->setManifestPath($manifestPath ?: dirname(dirname(__FILE__)) . '/Manifests'); - } - - /** - * @return mixed - */ - public function getToken() - { - return $this->token; - } - - /** - * @param mixed $token - * @return $this - */ - public function setToken($token) - { - $this->token = $token; - - $this->setHeaders([ - 'Authorization' => (string)'Bearer ' . $token, - ]); - - return $this; - } - - /** - * Dynamically handle missing methods. - * - * @param string $method - * @param array $arguments - * @return mixed - */ - public function __call($method, array $arguments = []) - { - if (substr($method, -8) === 'Iterator') { - return $this->handleIteratorRequest($method, $arguments); - } elseif ($this->isSingleRequest($method)) { - return $this->handleSingleRequest($method, $arguments); - } - - return $this->handleRequest($method); - } - - /** - * Handles an iterator request. - * - * @param string $method - * @param array $arguments - * @return \Apache\Usergrid\Api\ResourceIterator - * @throws \InvalidArgumentException - */ - protected function handleIteratorRequest($method, array $arguments = []) - { - $client = $this->handleRequest(substr($method, 0, -8)); - - $command = $client->getCommand('all', array_get($arguments, 0, [])); - - return new ResourceIterator($command, array_get($arguments, 1, [])); - } - - /** - * Handles the current request. - * - * @param string $method - * @throws InvalidArgumentException - * @return \Guzzle\Service\Client - */ - protected function handleRequest($method) - { - if (!$this->manifestExists($method)) { - throw new InvalidArgumentException("Undefined method [{$method}] called."); - } - - // Initialize the Guzzle client - $client = new GuzzleClient('', - ['command.params' => ['app_name_or_uuid' => $this->app_name, 'org_name_or_uuid' => $this->org_name]]); - - // Set our own usergrid api client for internal - // usage within our api models. - $client->setApiClient($this); - - // Set the client user agent - $client->setUserAgent($this->getUserAgent(), true); - - - // Set the headers - $client->setDefaultOption('headers', $this->getHeaders()); - - // Get the Guzzle event dispatcher - $dispatcher = $client->getEventDispatcher(); - - // Register the error response plugin for our custom exceptions - $dispatcher->addSubscriber(new ErrorResponsePlugin); - - // Listen to the "command.after_prepare" event fired by Guzzle - $dispatcher->addListener('command.after_prepare', function (Event $event) { - $request = $event['command']->getRequest(); - - $request->getQuery()->setAggregator(new QueryAggregator()); - }); - - //check if Oauth 2 plugin is a instance of Oauth2Plugin - if ($this->oauth2_plugin instanceof Oauth2Plugin) { - $dispatcher->addSubscriber($this->oauth2_plugin); - } - - - // Set the manifest payload into the Guzzle client - $client->setDescription(ServiceDescription::factory( - $this->buildPayload($method) - )); - - // Return the Guzzle client - return $client; - } - - /** - * Checks if the manifest file for the current request exists. - * - * @param string $file - * @return bool - */ - protected function manifestExists($file) - { - return file_exists($this->getManifestFilePath($file)); - } - - /** - * Returns the given request manifest file path. - * - * @param string $file - * @return string - */ - protected function getManifestFilePath($file) - { - return $this->getFullManifestPath() . '/' . ucwords($file) . '.php'; - } - - /** - * Returns the full versioned manifests path. - * - * @return string - */ - protected function getFullManifestPath() - { - return $this->getManifestPath() . '/' . $this->getVersion(); - } - - /** - * @return string - */ - public function getManifestPath() - { - return $this->manifestPath; - } - - /** - * @param string $manifestPath - * @return $this - */ - public function setManifestPath($manifestPath) - { - $this->manifestPath = $manifestPath; - return $this; - } - - /** - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * @param string $version - * @return $this - */ - public function setVersion($version) - { - $this->version = $version; - - $this->setHeaders([ - 'Usergrid-Version' => (string)$version, - ]); - return $this; - } - - /** - * @return string - */ - public function getUserAgent() - { - return $this->userAgent; - } - - /** - * @param string $userAgent - * @return $this - */ - public function setUserAgent($userAgent) - { - $this->userAgent = $userAgent; - - return $this; - } - - /** - * Returns the Guzzle client headers. - * - * @return array - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Sets the Guzzle client headers. - * - * @param array $headers - * @return $this - */ - public function setHeaders(array $headers = []) - { - $this->headers = array_merge($this->headers, $headers); - - return $this; - } - - /** - * Returns the current request payload. - * - * @param string $method - * @return array - */ - protected function buildPayload($method) - { - $operations = $this->getRequestManifestPayload($method); - - $manifest = $this->getRequestManifestPayload('manifest', false); - - return array_merge($manifest, compact('operations')); - } - - /** - * Returns the given file manifest data. - * - * @param string $file - * @param bool $includeErrors - * @return array - */ - protected function getRequestManifestPayload($file, $includeErrors = true) - { - $file = ucwords($file); - - /** @noinspection PhpUnusedLocalVariableInspection */ - $baseURL = $this->baseUrl; - - if (!$manifest = array_get($this->manifests, $file)) { - if ($includeErrors) { - /** @noinspection PhpUnusedLocalVariableInspection */ - $errors = $this->getRequestManifestPayload('errors', false); - } - - /** @noinspection PhpIncludeInspection */ - $manifest = require_once $this->getManifestFilePath($file); - - array_set($this->manifests, $file, $manifest); - } - - return $manifest; - } - - /** - * Determines if the request is a single request. - * - * @param $method - * @return bool - */ - protected function isSingleRequest($method) - { - return (str_singular($method) === $method && $this->manifestExists(str_plural($method))); - } - - /** - * Handles a single request. - * - * @param string $method - * @param array $arguments - * @return \Guzzle\Service\Client - * @throws \InvalidArgumentException - */ - protected function handleSingleRequest($method, array $arguments = []) - { - // Check if we have any arguments - if (empty($arguments)) { - throw new InvalidArgumentException('Not enough arguments provided!'); - } - - // Pluralize the method name - $pluralMethod = str_plural($method); - - // Get the request manifest payload data - $manifest = $this->getRequestManifestPayload($pluralMethod); - - if (!$parameters = array_get($manifest, 'find')) { - throw new InvalidArgumentException("Undefined method [{$method}] called.");; - } - - // Get the required parameters for the request - $required = array_where(array_get($parameters, 'parameters'), function ($key, $value) { - return $value['required'] === true; - }); - - // Prepare the arguments for the request - $arguments = array_combine( - array_keys($required), - count($required) === 1 ? (array)$arguments[0] : $arguments - ); - - // Execute the request - return $this->handleRequest($pluralMethod)->find($arguments); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/AuthorizationCode.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/AuthorizationCode.php b/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/AuthorizationCode.php deleted file mode 100755 index b03d4a7..0000000 --- a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/AuthorizationCode.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType; - -use Guzzle\Common\Collection; -use Guzzle\Http\ClientInterface; - -/** - * Authorization code grant type. - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * - * @link http://tools.ietf.org/html/rfc6749#section-4.1 - */ -class AuthorizationCode implements GrantTypeInterface -{ - /** @var ClientInterface The token endpoint client */ - protected $client; - - /** @var Collection Configuration settings */ - protected $config; - - public function __construct(ClientInterface $client, $config) - { - $this->client = $client; - $this->config = Collection::fromConfig($config, array( - 'client_secret' => '', - 'scope' => '', - 'redirect_uri' => '', - ), array( - 'client_id', - 'code', - )); - } - - /** - * {@inheritdoc} - */ - public function getTokenData() - { - $postBody = array( - 'grant_type' => 'authorization_code', - 'code' => $this->config['code'], - ); - if ($this->config['scope']) { - $postBody['scope'] = $this->config['scope']; - } - if ($this->config['redirect_uri']) { - $postBody['redirect_uri'] = $this->config['redirect_uri']; - } - $request = $this->client->post(null, array(), $postBody); - $request->setAuth($this->config['client_id'], $this->config['client_secret']); - $response = $request->send(); - $data = $response->json(); - - $requiredData = array_flip(array('access_token', 'expires_in', 'refresh_token')); - return array_intersect_key($data, $requiredData); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/ClientCredentials.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/ClientCredentials.php b/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/ClientCredentials.php deleted file mode 100755 index 729f6a5..0000000 --- a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/ClientCredentials.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType; - -use Guzzle\Common\Collection; -use Guzzle\Http\ClientInterface; - -/** - * Client credentials grant type. - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * - * @link http://tools.ietf.org/html/rfc6749#section-4.4 - */ -class ClientCredentials implements GrantTypeInterface -{ - /** @var ClientInterface The token endpoint client */ - protected $client; - - /** @var Collection Configuration settings */ - protected $config; - - public function __construct(ClientInterface $client, $config) - { - $this->client = $client; - $this->config = Collection::fromConfig($config, array( - 'client_secret' => '', - 'scope' => '', - ), array( - 'client_id', - )); - } - - /** - * {@inheritdoc} - */ - public function getTokenData() - { - $postBody = array( - 'grant_type' => 'client_credentials', - 'client_id' => $this->config['client_id'], - 'client_secret' => $this->config['client_secret'] - ); - if ($this->config['scope']) { - $postBody['scope'] = $this->config['scope']; - } - $request = $this->client->post(null, array(), $postBody); -// $request->setAuth($this->config['client_id'], $this->config['client_secret']); - $response = $request->send(); - $data = $response->json(); - - $requiredData = array_flip(array('access_token', 'expires_in', 'refresh_token')); - return array_intersect_key($data, $requiredData); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/GrantTypeInterface.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/GrantTypeInterface.php b/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/GrantTypeInterface.php deleted file mode 100755 index 99096c0..0000000 --- a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/GrantTypeInterface.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType; - - -/** - * Interface GrantTypeInterface - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * @link http://baas-platform.com - */ -interface GrantTypeInterface -{ - /** - * Get the token data returned by the OAuth2 server. - * - * @return array An array with the following keys: - * - access_token: The access token. - * - expires_in: The access token lifetime, in seconds. - * - refresh_token: The refresh token, if present. - */ - public function getTokenData(); -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/HWIOAuthBundleRefreshToken.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/HWIOAuthBundleRefreshToken.php b/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/HWIOAuthBundleRefreshToken.php deleted file mode 100755 index f30d593..0000000 --- a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/HWIOAuthBundleRefreshToken.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType; - -use HWI\Bundle\OAuthBundle\Security\Http\ResourceOwnerMap; -use Symfony\Component\Security\Core\SecurityContextInterface; - -/** - * HWIOAuthBundle Aware Refresh token grant type. - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * - * @link http://tools.ietf.org/html/rfc6749#section-6 - */ -class HWIOAuthBundleRefreshToken implements GrantTypeInterface -{ - /** @var SecurityContextInterface Symfony2 security component */ - protected $securityContext; - - /** @var ResourceOwnerMap HWIOAuthBundle OAuth2 ResourceOwnerMap */ - protected $resourceOwnerMap; - - public function __construct(ResourceOwnerMap $resourceOwnerMap, SecurityContextInterface $securityContext) - { - $this->securityContext = $securityContext; - $this->resourceOwnerMap = $resourceOwnerMap; - } - - /** - * {@inheritdoc} - */ - public function getTokenData($refreshToken = null) - { - $token = $this->securityContext->getToken(); - $resourceName = $token->getResourceOwnerName(); - $resourceOwner = $this->resourceOwnerMap->getResourceOwnerByName($resourceName); - - $data = $resourceOwner->refreshAccessToken($refreshToken); - $token->setRawToken($data); - $requiredData = array_flip(array('access_token', 'expires_in', 'refresh_token')); - - return array_intersect_key($data, $requiredData); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/PasswordCredentials.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/PasswordCredentials.php b/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/PasswordCredentials.php deleted file mode 100755 index 6afc482..0000000 --- a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/PasswordCredentials.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -namespace Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType; - -use Guzzle\Common\Collection; -use Guzzle\Http\ClientInterface; - -/** - * Resource owner password credentials grant type. - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * - * @link http://tools.ietf.org/html/rfc6749#section-4.3 - */ -class PasswordCredentials implements GrantTypeInterface -{ - /** @var ClientInterface The token endpoint client */ - protected $client; - - /** @var Collection Configuration settings */ - protected $config; - - public function __construct(ClientInterface $client, $config) - { - $this->client = $client; - $this->config = Collection::fromConfig($config, array( - 'client_secret' => '', - 'scope' => '', - ), array( - 'client_id', - 'username', - 'password' - )); - } - - /** - * {@inheritdoc} - */ - public function getTokenData() - { - $postBody = array( - 'grant_type' => 'password', - 'username' => $this->config['username'], - 'password' => $this->config['password'], - ); - if ($this->config['scope']) { - $postBody['scope'] = $this->config['scope']; - } - $request = $this->client->post(null, array(), $postBody); - //Note: Usergrid it not using Oauth2 to spec so it dose not need a Auth type set no need to client id + secret when using password -// $request->setAuth($this->config['client_id'], $this->config['client_secret']); - $response = $request->send(); - $data = $response->json(); - - $requiredData = array_flip(array('access_token', 'expires_in', 'refresh_token')); - return array_intersect_key($data, $requiredData); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/RefreshToken.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/RefreshToken.php b/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/RefreshToken.php deleted file mode 100755 index 149d570..0000000 --- a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/GrantType/RefreshToken.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -namespace Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType; - -use Guzzle\Common\Collection; -use Guzzle\Http\ClientInterface; - -/** - * Refresh token grant type. - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * - * @link http://tools.ietf.org/html/rfc6749#section-6 - */ -class RefreshToken implements GrantTypeInterface -{ - /** @var ClientInterface The token endpoint client */ - protected $client; - - /** @var Collection Configuration settings */ - protected $config; - - public function __construct(ClientInterface $client, $config) - { - $this->client = $client; - $this->config = Collection::fromConfig($config, array( - 'client_secret' => '', - 'refresh_token' => '', - 'scope' => '', - ), array( - 'client_id', - )); - } - - /** - * {@inheritdoc} - */ - public function getTokenData($refreshToken = null) - { - $postBody = array( - 'grant_type' => 'refresh_token', - // If no refresh token was provided to the method, use the one - // provided to the constructor. - 'refresh_token' => $refreshToken ?: $this->config['refresh_token'], - ); - if ($this->config['scope']) { - $postBody['scope'] = $this->config['scope']; - } - $request = $this->client->post(null, array(), $postBody); - $request->setAuth($this->config['client_id'], $this->config['client_secret']); - $response = $request->send(); - $data = $response->json(); - - $requiredData = array_flip(array('access_token', 'expires_in', 'refresh_token')); - return array_intersect_key($data, $requiredData); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/Oauth2Plugin.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/Oauth2Plugin.php b/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/Oauth2Plugin.php deleted file mode 100755 index 8454309..0000000 --- a/sdks/php5/apache-usergrid/src/Guzzle/Plugin/Oauth2/Oauth2Plugin.php +++ /dev/null @@ -1,212 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -namespace Apache\Usergrid\Guzzle\Plugin\Oauth2; - -use Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType\GrantTypeInterface; -use Guzzle\Common\Event; -use Guzzle\Http\Exception\BadResponseException; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * OAuth2 plugin - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * - * @link http://tools.ietf.org/html/rfc6749 - */ -class Oauth2Plugin implements EventSubscriberInterface -{ - - /** @var GrantTypeInterface The grant type implementation used to acquire access tokens */ - protected $grantType; - - /** @var GrantTypeInterface The grant type implementation used to refresh access tokens */ - protected $refreshTokenGrantType; - - /** @var array An array with the "access_token" and "expires" keys */ - protected $accessToken; - - /** @var string The refresh token string. * */ - protected $refreshToken; - - /** - * Create a new Oauth2 plugin - * @param GrantTypeInterface $grantType - * @param GrantTypeInterface $refreshTokenGrantType - */ - public function __construct(GrantTypeInterface $grantType = null, GrantTypeInterface $refreshTokenGrantType = null) - { - $this->grantType = $grantType; - $this->refreshTokenGrantType = $refreshTokenGrantType; - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array( - 'request.before_send' => 'onRequestBeforeSend', - 'request.error' => 'onRequestError', - ); - } - - /** - * Request before-send event handler. - * - * Adds the Authorization header if an access token was found. - * - * @param Event $event Event received - */ - public function onRequestBeforeSend(Event $event) - { - $accessToken = $this->getAccessToken(); - if ($accessToken) { - $event['request']->setHeader('Authorization', 'Bearer ' . $accessToken['access_token']); - } - } - - /** - * Get the access token. - * - * Handles token expiration for tokens with an "expires" timestamp. - * In case no valid token was found, tries to acquire a new one. - * - * @return array|null - */ - public function getAccessToken() - { - if (isset($this->accessToken['expires']) && $this->accessToken['expires'] < time()) { - // The access token has expired. - $this->accessToken = null; - } - if (!$this->accessToken) { - // Try to acquire a new access token from the server. - $this->acquireAccessToken(); - } - - return $this->accessToken; - } - - /** - * Set the access token. - * - * @param array|string $accessToken The access token - */ - public function setAccessToken(array $accessToken) - { - $this->accessToken = $accessToken; - } - - /** - * Acquire a new access token from the server. - * - * @return array|null - */ - protected function acquireAccessToken() - { - if ($this->refreshTokenGrantType && $this->refreshToken) { - try { - // Get an access token using the stored refresh token. - $tokenData = $this->refreshTokenGrantType->getTokenData($this->refreshToken); - } catch (BadResponseException $e) { - // The refresh token has probably expired. - $this->refreshToken = null; - } - } - if ($this->grantType && !isset($tokenData)) { - // Get a new access token. - $tokenData = $this->grantType->getTokenData(); - } - - $this->accessToken = null; - if (isset($tokenData)) { - // Process the returned data. Both expired_in and refresh_token - // are optional parameters. - $this->accessToken = array( - 'access_token' => $tokenData['access_token'], - ); - if (isset($tokenData['expires_in'])) { - $this->accessToken['expires'] = time() + $tokenData['expires_in']; - } - if (isset($tokenData['refresh_token'])) { - $this->refreshToken = $tokenData['refresh_token']; - } - } - - return $this->accessToken; - } - - /** - * Request error event handler. - * - * Handles unauthorized errors by acquiring a new access token and - * retrying the request. - * - * @param Event $event Event received - */ - public function onRequestError(Event $event) - { - if ($event['response']->getStatusCode() == 401) { - if ($event['request']->getHeader('X-Guzzle-Retry')) { - // We already retried once, give up. - return; - } - - // Acquire a new access token, and retry the request. - $newAccessToken = $this->acquireAccessToken(); - if ($newAccessToken) { - $newRequest = clone $event['request']; - $newRequest->setHeader('Authorization', 'Bearer ' . $newAccessToken['access_token']); - $newRequest->setHeader('X-Guzzle-Retry', '1'); - $event['response'] = $newRequest->send(); - $event->stopPropagation(); - } - } - } - - /** - * Get the refresh token. - * - * @return string - */ - public function getRefreshToken() - { - return $this->refreshToken; - } - - /** - * Set the refresh token. - * - * @param string $refreshToken The refresh token - */ - public function setRefreshToken($refreshToken) - { - $this->refreshToken = $refreshToken; - } - - /** - * @return GrantTypeInterface - */ - public function getGrantType() - { - return $this->grantType; - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Laravel/ApacheUsergridServiceProvider.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Laravel/ApacheUsergridServiceProvider.php b/sdks/php5/apache-usergrid/src/Laravel/ApacheUsergridServiceProvider.php deleted file mode 100644 index 57807ad..0000000 --- a/sdks/php5/apache-usergrid/src/Laravel/ApacheUsergridServiceProvider.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -namespace Apache\Usergrid\Laravel; - - -use Apache\Usergrid\Api\Usergrid; -use Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType\ClientCredentials; -use Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType\PasswordCredentials; -use Apache\Usergrid\Guzzle\Plugin\Oauth2\GrantType\RefreshToken; -use Apache\Usergrid\Guzzle\Plugin\Oauth2\Oauth2Plugin; -use Guzzle\Http\Client; -use Illuminate\Support\ServiceProvider; - -/** - * Class ApacheUsergridServiceProvider - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * @link http://baas-platform.com - */ -class ApacheUsergridServiceProvider extends ServiceProvider -{ - - protected $oauth2Plugin = null; - - /** - * - */ - public function boot() - { - $this->package('apache/usergrid', 'apache/usergrid', __DIR__ . '/..'); - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - // register Usergrid - $this->registerUsergrid(); - - } - - protected function registerUsergrid() - { - - $this->app['usergrid'] = $this->app->share(function ($app) { - - /** Note: I had to move this to here from the register function as the below config values would not get set and would be null - * unless I has this with the package namespace missing but doing that would mean that it would not find the enable_oauth2_plugin - * value .. This has been driving me crazy as I tried to read the config values from a rout and they would not show up - * then I did . Also this would not find the config values if the boot function did not have the package method called with - * all 3 args - * $enable_oauth2_plugin = $this->app['config']->get('usergrid.enable_oauth2_plugin'); - * - * //check if user managed oauth auth flow - * if($enable_oauth2_plugin){ - * // Create the Oauth2 Guzzle Plugin. - * $this->createGuzzleOauth2Plugin(); - * } - */ - $enable_oauth2_plugin = $app['config']->get('apache/usergrid::usergrid.enable_oauth2_plugin'); - - //check if user managed oauth auth flow - if ($enable_oauth2_plugin) { - // Create the Oauth2 Guzzle Plugin. - $this->createGuzzleOauth2Plugin(); - } - - $baseUrl = $app['config']->get('apache/usergrid::usergrid.url'); - - $orgName = $app['config']->get('apache/usergrid::usergrid.orgName'); - - $appName = $app['config']->get('apache/usergrid::usergrid.appName'); - - $manifestPath = $app['config']->get('apache/usergrid::usergrid.manifestPath'); - - $version = $app['config']->get('apache/usergrid::usergrid.version'); - - return new Usergrid($orgName, $appName, $manifestPath, $version, $baseUrl, $this->oauth2Plugin); - }); - - $this->app->alias('usergrid', 'Apache\Usergrid\Api\Usergrid'); - } - - - protected function createGuzzleOauth2Plugin() - { - - $base_url = $this->app['config']->get('apache/usergrid::usergrid.url'); - - $org_name = $this->app['config']->get('apache/usergrid::usergrid.orgName'); - - $app_name = $this->app['config']->get('apache/usergrid::usergrid.appName'); - - $grant_type = $this->app['config']->get('apache/usergrid::usergrid.grant_type'); - - $client_id = $this->app['config']->get('apache/usergrid::usergrid.clientId'); - - $client_secret = $this->app['config']->get('apache/usergrid::usergrid.clientSecret'); - - $username = $this->app['config']->get('apache/usergrid::usergrid.username'); - - $password = $this->app['config']->get('apache/usergrid::usergrid.password'); - - - if ($this->app['config']->get('apache/usergrid::usergrid.auth_type') == 'organization') { - - $url = $base_url . '/management/token'; - - } elseif ($this->app['config']->get('apache/usergrid::usergrid.auth_type') == 'application') { - $url = $base_url . '/' . $org_name . '/' . $app_name . '/token'; - } - - $oauth2Client = new Client($url); - - if ($grant_type == 'client_credentials') { - $config = [ - 'client_id' => $client_id, - 'client_secret' => $client_secret, - - ]; - $grantType = new ClientCredentials($oauth2Client, $config); - $refreshTokenGrantType = new RefreshToken($oauth2Client, $config); - $this->oauth2Plugin = new Oauth2Plugin($grantType, $refreshTokenGrantType); - - } elseif ($grant_type == 'password') { - $config = [ - 'username' => $username, - 'password' => $password, - 'client_id' => $client_id, - 'client_secret' => $client_secret - ]; - $grantType = new PasswordCredentials($oauth2Client, $config); - $refreshTokenGrantType = new RefreshToken($oauth2Client, $config); - $this->oauth2Plugin = new Oauth2Plugin($grantType, $refreshTokenGrantType); - } - - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Laravel/Facades/Usergrid.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Laravel/Facades/Usergrid.php b/sdks/php5/apache-usergrid/src/Laravel/Facades/Usergrid.php deleted file mode 100644 index 1ea29f2..0000000 --- a/sdks/php5/apache-usergrid/src/Laravel/Facades/Usergrid.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -namespace Apache\Usergrid\Laravel\Facades; - - -use Illuminate\Support\Facades\Facade; - -/** - * Class Usergrid - * - * @package Apache/Usergrid - * @version 1.0.0 - * @author Jason Kristian <[email protected]> - * @license Apache License, Version 2.0 - * @copyright (c) 2008-2014, Baas Platform Pty. Ltd - * @link http://baas-platform.com - */ -class Usergrid extends Facade -{ - /** - * @return string - */ - protected static function getFacadeAccessor() - { - return "usergrid"; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/867060fa/sdks/php5/apache-usergrid/src/Manifests/1.0.0/Application.php ---------------------------------------------------------------------- diff --git a/sdks/php5/apache-usergrid/src/Manifests/1.0.0/Application.php b/sdks/php5/apache-usergrid/src/Manifests/1.0.0/Application.php deleted file mode 100644 index 0054a8c..0000000 --- a/sdks/php5/apache-usergrid/src/Manifests/1.0.0/Application.php +++ /dev/null @@ -1,979 +0,0 @@ -<?php -/** - * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -return [ - - 'AuthPasswordGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/token', - 'notes' => 'Get the app access token. See the OAuth2 specification for details.', - 'summary' => 'Get app access token', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'grant_type' => [ - 'description' => 'Grant type.', - 'location' => 'query', - 'type' => 'string', - 'defaultValue' => 'password', - 'required' => true, - ], - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'username' => [ - 'description' => 'Username (for grant_type=password).', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'password' => [ - 'description' => 'Password (for grant_type=password).', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'client_id' => [ - 'description' => 'Client ID (for grant_type=client_credentials).', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'client_secret' => [ - 'description' => 'Client Secret (for grant_type=client_credentials).', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'AuthPasswordPost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/token', - 'notes' => 'Get the app access token. See the OAuth2 specification for details.', - 'summary' => 'Get app access token', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'grant_type' => [ - 'description' => 'Grant type.', - 'location' => 'postField', - 'type' => 'string', - 'defaultValue' => 'password', - 'required' => true, - ], - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'username' => [ - 'description' => 'Username (for grant_type=password).', - 'location' => 'postField', - 'type' => 'string', - 'required' => false, - ], - 'password' => [ - 'description' => 'Password (for grant_type=password).', - 'location' => 'postField', - 'type' => 'string', - 'required' => false, - ], - 'client_id' => [ - 'description' => 'Client ID (for grant_type=client_credentials).', - 'location' => 'postField', - 'type' => 'string', - 'required' => false, - ], - 'client_secret' => [ - 'description' => 'Client Secret (for grant_type=client_credentials).', - 'location' => 'postField', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'AuthorizeGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/authorize', - 'notes' => 'Authorize the app client. See the OAuth2 specification.', - 'summary' => 'Authorize app client', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => false, - ], - 'response_type' => [ - 'description' => 'Response type', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - 'default' => 'token' - ], - 'redirect_uri' => [ - 'description' => 'Redirect URI', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'client_id' => [ - 'description' => 'Client ID', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'scope' => [ - 'description' => 'Access Token Scope.', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'state' => [ - 'description' => 'Client State.', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'AuthorizePost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/authorize', - 'notes' => 'Authorize the app client. See the OAuth2 specification.', - 'summary' => 'Authorize app client', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => false, - ], - 'response_type' => [ - 'description' => 'Response type', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - 'default' => 'token' - ], - 'redirect_uri' => [ - 'description' => 'Redirect URI', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'client_id' => [ - 'description' => 'Client ID', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'scope' => [ - 'description' => 'Access Token Scope.', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'state' => [ - 'description' => 'Client State.', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'CredentialsGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/credentials', - 'notes' => 'Get the app client credentials.', - 'summary' => 'Get app client credentials', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => false, - ], - 'access_token' => [ - 'location' => 'query', - 'type' => 'string', - 'required' => true, - 'description' => 'The OAuth2 access token' - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'CredentialsPost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/credentials', - 'notes' => 'Generate new app client credentials', - 'summary' => 'Generate app client credentials', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => false, - ], - 'access_token' => [ - 'location' => 'query', - 'type' => 'string', - 'required' => true, - 'description' => 'The OAuth2 access token' - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserJsonPost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users', - 'notes' => 'Create new app user', - 'summary' => 'Create new app user. See Usergrid documentation for JSON format of body.', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => false, - ], - 'username' => [ - 'location' => 'json', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Username' - ], - 'name' => [ - 'location' => 'json', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Name' - ], - 'email' => [ - 'location' => 'json', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Email' - ], - 'password' => [ - 'location' => 'json', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Password' - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserFormPost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users', - 'notes' => 'Create new app user', - 'summary' => 'Create new app user using form post parameters.', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => false, - ], - 'username' => [ - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Username' - ], - 'name' => [ - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Name' - ], - 'email' => [ - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Email' - ], - 'password' => [ - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - 'description' => 'Admin Password' - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserPasswordRestGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/resetpw', - 'notes' => 'Initiate a user password reset. Returns browser-viewable HTML page.', - 'summary' => 'Initiate a user password reset', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserPasswordFormPost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/resetpw', - 'notes' => 'Complete a user password reset. Handles form POST response.', - 'summary' => 'Complete a user password reset', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'email' => [ - 'description' => 'User Email', - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - ], - 'recaptcha_challenge_field' => [ - 'description' => 'Recaptcha Challenge Field', - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - ], - 'recaptcha_response_field' => [ - 'description' => 'Recaptcha Response Field', - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}', - 'notes' => 'Returns the app user details.', - 'summary' => 'Returns the app user details', - 'responseClass' => 'Apache\Usergrid\Api\Models\User', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserJsonPut' => [ - 'httpMethod' => 'PUT', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}', - 'notes' => 'Updates the app user details.', - 'summary' => 'Updates the app user details', - 'responseClass' => 'Apache\Usergrid\Api\Models\User', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ], - 'additionalParameters' => [ - 'location' => 'json' - ] - ], - 'UserActivateGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}/activate', - 'notes' => 'Activates the app user from link provided in email notification.', - 'summary' => 'Activates the app user', - 'responseClass' => 'Apache\Usergrid\Api\Models\User', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'token' => [ - 'description' => 'Activation Token (supplied via email)', - 'location' => 'query', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'confirm' => [ - 'description' => 'Send confirmation email', - 'location' => 'query', - 'type' => 'boolean', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserReactivateGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}/reactivate', - 'notes' => 'Request app user reactivation.', - 'summary' => 'Reactivates the app user', - 'responseClass' => 'Apache\Usergrid\Api\Models\User', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserFeedGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}/feed', - 'notes' => 'Get app user activity feed.', - 'summary' => 'Get app user activity feed', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserPasswordJsonPut' => [ - 'httpMethod' => 'PUT', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}/password', - 'notes' => 'Set app user password. See Usergrid documentation for JSON format of body.', - 'summary' => 'Set app user password', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ], - 'additionalParameters' => [ - "description" => "Old and new password", - 'location' => 'json' - ] - ], - 'UserResetPasswordGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}/resetpw', - 'notes' => 'Initiate a user password reset. Returns browser-viewable HTML page.', - 'summary' => 'Initiate a user password reset', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'UserResetPasswordFormPost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_username_email_or_uuid}/resetpw', - 'notes' => 'Complete a user password reset. Handles form POST response.', - 'summary' => 'Complete a user password reset', - 'responseClass' => '', - 'responseType' => 'object', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'user_username_email_or_uuid' => [ - 'description' => 'User username, email or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'recaptcha_challenge_field' => [ - 'description' => 'Recaptcha Challenge Field', - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - ], - 'recaptcha_response_field' => [ - 'description' => 'Recaptcha Response Field', - 'location' => 'postField', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'EntityGet' => [ - 'httpMethod' => 'GET', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/{collection}', - 'notes' => 'Query an app collection.', - 'summary' => 'Query an app collection', - 'responseClass' => 'Apache\Usergrid\Api\Models\Collection', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ], - 'collection' => [ - 'description' => 'collection name (entity type)', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'ql' => [ - 'description' => 'a query in the query language', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'reversed' => [ - 'description' => 'return results in reverse order', - 'location' => 'query', - 'type' => 'boolean', - 'required' => false, - ], - 'start' => [ - 'description' => 'the first entity UUID to return', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'cursor' => [ - 'description' => 'an encoded representation of the query position for paging', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'limit' => [ - 'description' => 'an encoded representation of the query position for paging', - 'location' => 'query', - 'type' => 'integer', - 'required' => false, - ], - 'filter' => [ - 'description' => 'a condition to filter on', - 'location' => 'query', - 'type' => 'integer', - 'required' => false, - ] - ], - 'additionalParameters' => [ - "description" => "Other parameters", - 'location' => 'query' - ] - ], - 'EntityJsonPost' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/{collection}', - 'notes' => 'Create new app entity. See Usergrid documentation for JSON format of body.', - 'summary' => 'Create new app entity', - 'responseClass' => 'Apache\Usergrid\Api\Models\Entity', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'collection' => [ - 'description' => 'collection name (entity type)', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ], - 'additionalParameters' => [ - "description" => "Entity data", - 'location' => 'json' - ] - ], - 'EntityPut' => [ - 'httpMethod' => 'PUT', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/{collection}/{entity_name_or_uuid}', - 'notes' => 'Update an app entity in a collection.', - 'summary' => 'Update an app entity', - 'responseClass' => 'Apache\Usergrid\Api\Models\Entity', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'entity_name_or_uuid' => [ - 'description' => 'entity name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'collection' => [ - 'description' => 'collection name (entity type)', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ], - 'additionalParameters' => [ - "description" => "Entity data", - 'location' => 'json' - ] - ], - 'EntityDelete' => [ - 'httpMethod' => 'DELETE', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/{collection}/{entity_name_or_uuid}', - 'notes' => 'Delete an app entity.', - 'summary' => 'Delete an app entity', - 'responseClass' => 'Apache\Usergrid\Api\Models\Entity', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'entity_name_or_uuid' => [ - 'description' => 'entity name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'collection' => [ - 'description' => 'collection name (entity type)', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ] - ], - 'PostEvents' => [ - 'httpMethod' => 'POST', - 'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/{collection}', - 'notes' => 'Create new app entity. See Usergrid documentation for JSON format of body.', - 'summary' => 'Create new app entity', - 'responseClass' => 'Apache\Usergrid\Api\Models\Event', - 'responseType' => 'class', - 'errorResponses' => $errors, - 'parameters' => [ - 'app_name_or_uuid' => [ - 'description' => 'app name or uuid', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'collection' => [ - 'description' => 'collection name (entity type)', - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - ], - 'access_token' => [ - 'description' => 'The OAuth2 access token', - 'location' => 'query', - 'type' => 'string', - 'required' => false, - ], - 'org_name_or_uuid' => [ - 'location' => 'uri', - 'type' => 'string', - 'required' => true, - 'description' => 'Organization name or uuid' - ] - ], - 'additionalParameters' => [ - "description" => "Entity data", - 'location' => 'json' - ] - ], - - -]; \ No newline at end of file
