diff --git a/src/Client/KeenIOClient.php b/src/Client/KeenIOClient.php index 63ca26e..34f5aef 100755 --- a/src/Client/KeenIOClient.php +++ b/src/Client/KeenIOClient.php @@ -25,7 +25,8 @@ * @method array getSavedQueryResults(array $args = array()) {@command KeenIO getProperty} * @method array getEventSchemas(array $args = array()) {@command KeenIO getEventSchemas} * @method array deleteEvents(string $eventCollection, array $args = array()) {@command KeenIO deleteEvents} - * @method array deleteEventProperties(string $eventCollection, array $args = array())) {@command KeenIO deleteEventProperties} + * @method array deleteEventProperties(string $eventCollection, array $args = array())) + * {@command KeenIO deleteEventProperties} * @method array count(string $eventCollection, array $args = array())) {@command KeenIO count} * @method array countUnique(string $eventCollection, array $args = array()) {@command KeenIO countUnique} * @method array minimum(string $eventCollection, array $args = array()) {@command KeenIO minimum} @@ -53,8 +54,8 @@ public static function factory($config = array()) { $default = array( 'masterKey' => null, - 'writeKey' => null, - 'readKey' => null, + 'writeKey' => null, + 'readKey' => null, 'projectId' => null, 'organizationKey' => null, 'organizationId' => null, @@ -74,8 +75,7 @@ public static function factory($config = array()) new Client($config), new Description(include __DIR__ . "/Resources/{$file}"), null, - function($arg) - { + function ($arg) { return json_decode($arg->getBody(), true); }, null, @@ -90,7 +90,7 @@ function($arg) * from the normal argument array. * * @param string $method Name of the command object to instantiate - * @param array $args Arguments to pass to the command + * @param array $args Arguments to pass to the command * * @return mixed Returns the result of the command */ @@ -114,7 +114,7 @@ public function getCommand($name, array $params = []) * Proxy the addEvent command (to be used as a shortcut) * * @param string $collection Name of the collection to store events - * @param array $event Event data to store + * @param array $event Event data to store * @return mixed */ public function addEvent($collection, array $event = array()) @@ -294,8 +294,8 @@ public function getVersion() /** * Get a scoped key for an array of filters * - * @param array $filters What filters to encode into a scoped key - * @param array $allowedOperations What operations the generated scoped key will allow + * @param array $filters What filters to encode into a scoped key + * @param array $allowedOperations What operations the generated scoped key will allow * @return string * @throws RuntimeException If no master key is set */ @@ -325,7 +325,8 @@ public function createScopedKey($filters, $allowedOperations) if (strlen($masterKey) == 32) { $apiKey = $masterKey; - // Openssl's built-in PKCS7 padding won't use the 32 bytes block size, so apply it in userland and use OPENSSL zero padding (no-op as already padded) + // Openssl's built-in PKCS7 padding won't use the 32 bytes block size, so apply it in userland and use + // OPENSSL zero padding (no-op as already padded) $opensslOptions |= \OPENSSL_ZERO_PADDING; $optionsJson = $this->padString($optionsJson, 32); } @@ -337,7 +338,7 @@ public function createScopedKey($filters, $allowedOperations) $encrypted = openssl_encrypt($optionsJson, $cipher, $apiKey, $opensslOptions, $iv); - $ivHex = bin2hex($iv); + $ivHex = bin2hex($iv); $encryptedHex = bin2hex($encrypted); $scopedKey = $ivHex . $encryptedHex; @@ -349,14 +350,14 @@ public function createScopedKey($filters, $allowedOperations) * Implement PKCS7 padding * * @param string $string - * @param int $blockSize + * @param int $blockSize * * @return string */ protected function padString($string, $blockSize = 32) { $paddingSize = $blockSize - (strlen($string) % $blockSize); - $string .= str_repeat(chr($paddingSize), $paddingSize); + $string .= str_repeat(chr($paddingSize), $paddingSize); return $string; } @@ -382,7 +383,8 @@ public function decryptScopedKey($scopedKey) // Use the old hex string input if using a legacy master key if (strlen($masterKey) == 32) { $apiKey = $masterKey; - // Openssl's built-in PKCS7 padding won't use the 32 bytes block size, so apply it in userland and use OPENSSL zero padding (no-op as already padded) + // Openssl's built-in PKCS7 padding won't use the 32 bytes block size, so apply it in userland and use + // OPENSSL zero padding (no-op as already padded) $opensslOptions |= \OPENSSL_ZERO_PADDING; $paddedManually = true; } @@ -390,7 +392,7 @@ public function decryptScopedKey($scopedKey) $cipher = 'AES-256-CBC'; $ivLength = openssl_cipher_iv_length($cipher) * 2; - $ivHex = substr($scopedKey, 0, $ivLength); + $ivHex = substr($scopedKey, 0, $ivLength); $encryptedHex = substr($scopedKey, $ivLength); @@ -426,8 +428,8 @@ protected function unpadString($string) /** * Attempt to parse config and apply defaults * - * @param array $config - * @param array $default + * @param array $config + * @param array $default * * @return array Returns the updated config array */ @@ -458,7 +460,7 @@ private static function combineEventCollectionArgs(array $args) if (isset($args[0]) && is_string($args[0])) { $formattedArgs['event_collection'] = $args[0]; - if(isset($args[1]) && is_array($args[1])) { + if (isset($args[1]) && is_array($args[1])) { $formattedArgs = array_merge($formattedArgs, $args[1]); } } elseif (isset($args[0]) && is_array($args[0])) { diff --git a/src/Client/Resources/keen-io-3_0.php b/src/Client/Resources/keen-io-3_0.php index b19d2ab..eb08320 100755 --- a/src/Client/Resources/keen-io-3_0.php +++ b/src/Client/Resources/keen-io-3_0.php @@ -1,365 +1,388 @@ 'KeenIO', - 'baseUri' => 'https://api.keen.io/3.0/', - 'apiVersion' => '3.0', - 'operations' => array( + 'name' => 'KeenIO', + 'baseUri' => 'https://api.keen.io/3.0/', + 'apiVersion' => '3.0', + 'operations' => array( 'getResources' => array( - 'uri' => '/', - 'description' => 'Returns the available child resources. Currently, the only child resource is the Projects Resource.', - 'httpMethod' => 'GET', - 'parameters' => array( + 'uri' => '/', + 'description' => + 'Returns the available child resources. Currently, the only child resource is the Projects Resource.', + 'httpMethod' => 'GET', + 'parameters' => array( 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master Api Key', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), ), ), 'createProject' => array( - 'uri' => 'organizations/{organizationId}/projects', - 'description' => 'Creates a project for the specified organization and returns the project id for later usage.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'organizationId' => array( - 'location' => 'uri', - 'type' => 'string' + 'uri' => 'organizations/{organizationId}/projects', + 'description' => + 'Creates a project for the specified organization and returns the project id for later usage.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'organizationId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'organizationKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Organization Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'project_data' => array( 'location' => 'json', - 'type' => 'array', + 'type' => 'array', ), ), ), 'getProjects' => array( - 'uri' => 'projects', - 'description' => 'Returns the projects accessible to the API user, as well as links to project sub-resources for discovery.', - 'httpMethod' => 'GET', - 'parameters' => array( + 'uri' => 'projects', + 'description' => + 'Returns the projects accessible to the API user, as well as' . + ' links to project sub-resources for discovery.', + 'httpMethod' => 'GET', + 'parameters' => array( 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), ), ), 'getProject' => array( - 'uri' => 'projects/{projectId}', - 'description' => 'GET returns detailed information about the specific project, as well as links to related resources.', - 'httpMethod' => 'GET', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'uri' => 'projects/{projectId}', + 'description' => + 'GET returns detailed information about the specific project, as well as links to related resources.', + 'httpMethod' => 'GET', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), ), ), 'getSavedQueries' => array( - 'uri' => 'projects/{projectId}/queries/saved', + 'uri' => 'projects/{projectId}/queries/saved', 'description' => 'Returns the saved queries accessible to the API user on the specified project.', - 'httpMethod' => 'GET', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'httpMethod' => 'GET', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), ), ), 'getSavedQuery' => array( - 'uri' => 'projects/{projectId}/queries/saved/{query_name}', - 'description' => 'Returns the detailed information about the specified query, as well as links to retrieve results.', - 'httpMethod' => 'GET', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'uri' => 'projects/{projectId}/queries/saved/{query_name}', + 'description' => + 'Returns the detailed information about the specified query, as well as links to retrieve results.', + 'httpMethod' => 'GET', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'query_name' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The saved query.', - 'required' => true, + 'required' => true, ), ), ), 'createSavedQuery' => array( - 'uri' => 'projects/{projectId}/queries/saved/{query_name}', + 'uri' => 'projects/{projectId}/queries/saved/{query_name}', 'description' => 'Creates the described query.', - 'httpMethod' => 'PUT', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'httpMethod' => 'PUT', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'query_name' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The desired name of the query.', - 'filters' => array(["method" => '\KeenIO\Client\KeenIOClient::cleanQueryName', "args" => ["@value"]]), - 'required' => true, - ), - 'query' => array( + 'filters' => array( + [ + "method" => '\KeenIO\Client\KeenIOClient::cleanQueryName', + "args" => ["@value"] + ] + ), + 'required' => true, + ), + 'query' => array( 'location' => 'json', - 'type' => 'array', + 'type' => 'array', ), ), ), 'updateSavedQuery' => array( - 'uri' => 'projects/{projectId}/queries/saved/{query_name}', + 'uri' => 'projects/{projectId}/queries/saved/{query_name}', 'description' => 'Creates the described query.', - 'httpMethod' => 'PUT', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'httpMethod' => 'PUT', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'query_name' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The desired name of the query.', - 'filters' => array(["method" => '\KeenIO\Client\KeenIOClient::cleanQueryName', "args" => ["@value"]]), - 'required' => true, - ), - 'query' => array( + 'filters' => array( + [ + "method" => '\KeenIO\Client\KeenIOClient::cleanQueryName', + "args" => ["@value"] + ] + ), + 'required' => true, + ), + 'query' => array( 'location' => 'json', - 'type' => 'array', + 'type' => 'array', ), ), ), 'deleteSavedQuery' => array( - 'uri' => 'projects/{projectId}/queries/saved/{query_name}', + 'uri' => 'projects/{projectId}/queries/saved/{query_name}', 'description' => 'Deletes the specified query.', - 'httpMethod' => 'DELETE', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'query_name' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The saved query.', - 'required' => true, + 'required' => true, ), ), ), 'getSavedQueryResults' => array( - 'uri' => 'projects/{projectId}/queries/saved/{query_name}/result', + 'uri' => 'projects/{projectId}/queries/saved/{query_name}/result', 'description' => 'Returns the results of executing the specified query.', - 'httpMethod' => 'GET', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'httpMethod' => 'GET', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'query_name' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The saved query.', - 'required' => true, + 'required' => true, ), ), ), 'getCollections' => array( - 'uri' => 'projects/{projectId}/events', - 'description' => 'GET returns schema information for all the event collections in this project, including properties and their type. It also returns links to sub-resources.', - 'httpMethod' => 'GET', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'uri' => 'projects/{projectId}/events', + 'description' => + 'GET returns schema information for all the event collections in this project,' . + ' including properties and their type. It also returns links to sub-resources.', + 'httpMethod' => 'GET', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), ), ), 'getEventSchemas' => array( - 'extends' => 'getCollections' + 'extends' => 'getCollections' ), 'getCollection' => array( - 'uri' => 'projects/{projectId}/events/{event_collection}', - 'description' => 'GET returns available schema information for this event collection, including properties and their type. It also returns links to sub-resources.', - 'httpMethod' => 'GET', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'uri' => 'projects/{projectId}/events/{event_collection}', + 'description' => + 'GET returns available schema information for this event collection,' . + ' including properties and their type. It also returns links to sub-resources.', + 'httpMethod' => 'GET', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'event_collection' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The event collection.', - 'required' => true, + 'required' => true, ), ), ), 'getProperty' => array( - 'uri' => 'projects/{projectId}/events/{event_collection}/properties/{property_name}', + 'uri' => 'projects/{projectId}/events/{event_collection}/properties/{property_name}', 'description' => 'GET returns the property name, type, and a link to sub-resources.', - 'httpMethod' => 'GET', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' + 'httpMethod' => 'GET', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' ), 'masterKey' => array( - 'location' => 'header', + 'location' => 'header', 'description' => 'The Master API Key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'event_collection' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The event collection.', - 'required' => true, + 'required' => true, ), 'property_name' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The property name to inspect', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), ), ), 'addEvent' => array( - 'uri' => 'projects/{projectId}/events/{event_collection}', + 'uri' => 'projects/{projectId}/events/{event_collection}', 'description' => 'POST inserts an event into the specified collection.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'writeKey' => array( - 'location' => 'header', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'writeKey' => array( + 'location' => 'header', 'description' => 'The Write Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The event collection.', - 'required' => true, + 'required' => true, ), ), - 'additionalParameters' => array( + 'additionalParameters' => array( 'location' => 'json' ), ), 'addEvents' => array( - 'uri' => 'projects/{projectId}/events', - 'description' => 'POST inserts multiple events in one or more collections, in a single request. The API expects a JSON object whose keys are the names of each event collection you want to insert into. Each key should point to a list of events to insert for that event collection.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'writeKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/events', + 'description' => + 'POST inserts multiple events in one or more collections, in a single request.' . + ' The API expects a JSON object whose keys are the names of each event collection you want to' . + ' insert into. Each key should point to a list of events to insert for that event collection.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'writeKey' => array( + 'location' => 'header', 'description' => 'The Write Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), ), 'additionalParameters' => array( @@ -368,799 +391,937 @@ ), 'deleteEvents' => array( - 'uri' => 'projects/{projectId}/events/{event_collection}', - 'description' => 'DELETE one or multiple events from a collection. You can optionally add filters, timeframe or timezone. You can delete up to 50,000 events using one method call', - 'httpMethod' => 'DELETE', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'masterKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/events/{event_collection}', + 'description' => + 'DELETE one or multiple events from a collection. You can optionally add' . + ' filters, timeframe or timezone. You can delete up to 50,000 events using one method call', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'masterKey' => array( + 'location' => 'header', 'description' => 'The Master API key.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => true, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => true, ), 'event_collection' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The event collection.', - 'required' => true, - ), - 'filters' => array( - 'location' => 'query', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'query', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'timezone' => array( - 'location' => 'query', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, + 'required' => true, + ), + 'filters' => array( + 'location' => 'query', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'query', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'timezone' => array( + 'location' => 'query', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, ), ), ), 'deleteEventProperties' => array( - 'uri' => 'projects/{projectId}/events/{event_collection}/properties/{property_name}', - 'description' => 'DELETE one property for events. This only works for properties with less than 10,000 events.', - 'httpMethod' => 'DELETE', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'writeKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/events/{event_collection}/properties/{property_name}', + 'description' => + 'DELETE one property for events. This only works for properties with less than 10,000 events.', + 'httpMethod' => 'DELETE', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'writeKey' => array( + 'location' => 'header', 'description' => 'The Write Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'uri', + 'location' => 'uri', 'description' => 'The event collection.', - 'required' => true, + 'required' => true, ), - 'property_name' => array( - 'location' => 'uri', + 'property_name' => array( + 'location' => 'uri', 'description' => 'Name of the property to delete.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), ), ), 'count' => array( - 'uri' => 'projects/{projectId}/queries/count', - 'description' => 'GET returns the number of resources in the event collection matching the given criteria. The response will be a simple JSON object with one key: a numeric result.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/count', + 'description' => + 'GET returns the number of resources in the event collection matching the given criteria.' . + ' The response will be a simple JSON object with one key: a numeric result.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'countUnique' => array( - 'uri' => 'projects/{projectId}/queries/count_unique', - 'description' => 'GET returns the number of UNIQUE resources in the event collection matching the given criteria. The response will be a simple JSON object with one key: result, which maps to the numeric result described previously.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/count_unique', + 'description' => + 'GET returns the number of UNIQUE resources in the event collection matching the given criteria.' . + ' The response will be a simple JSON object with one key: result,' . + ' which maps to the numeric result described previously.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'minimum' => array( - 'uri' => 'projects/{projectId}/queries/minimum', - 'description' => 'GET returns the minimum numeric value for the target property in the event collection matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON object with one key: result, which maps to the numeric result described previously.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/minimum', + 'description' => + 'GET returns the minimum numeric value for the target property in the event collection matching' . + ' the given criteria. Non-numeric values are ignored. The response will be a simple JSON object' . + ' with one key: result, which maps to the numeric result described previously.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'maximum' => array( - 'uri' => 'projects/{projectId}/queries/maximum', - 'description' => 'GET returns the maximum numeric value for the target property in the event collection matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON object with one key: result, which maps to the numeric result described previously.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/maximum', + 'description' => + 'GET returns the maximum numeric value for the target property in the event collection matching' . + ' the given criteria. Non-numeric values are ignored. The response will be a simple JSON object' . + ' with one key: result, which maps to the numeric result described previously.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'average' => array( - 'uri' => 'projects/{projectId}/queries/average', - 'description' => 'GET returns the average across all numeric values for the target property in the event collection matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON object with one key: result, which maps to the numeric result described previously.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/average', + 'description' => + 'GET returns the average across all numeric values for the target property in the event collection' . + ' matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON ' . + 'object with one key: result, which maps to the numeric result described previously.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'sum' => array( - 'uri' => 'projects/{projectId}/queries/sum', - 'description' => 'GET returns the sum if all numeric values for the target property in the event collection matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON object with one key: result, which maps to the numeric result described previously.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/sum', + 'description' => + 'GET returns the sum if all numeric values for the target property in the event collection matching' . + ' the given criteria. Non-numeric values are ignored. The response will be a simple JSON object with' . + ' one key: result, which maps to the numeric result described previously.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'selectUnique' => array( - 'uri' => 'projects/{projectId}/queries/select_unique', - 'description' => 'GET returns a list of UNIQUE resources in the event collection matching the given criteria. The response will be a simple JSON object with one key: result, which maps to an array of unique property values.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/select_unique', + 'description' => + 'GET returns a list of UNIQUE resources in the event collection matching the given criteria.' . + ' The response will be a simple JSON object with one key: result, which maps to an array of' . + ' unique property values.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'funnel' => array( - 'uri' => 'projects/{projectId}/queries/funnel', + 'uri' => 'projects/{projectId}/queries/funnel', 'description' => 'Funnels count relevant events in succession.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), - 'steps' => array( - 'location' => 'json', + 'steps' => array( + 'location' => 'json', 'description' => 'A URL encoded JSON Array defining the Steps in the Funnel.', - 'type' => 'array', - 'required' => false, + 'type' => 'array', + 'required' => false, ), ), ), 'multiAnalysis' => array( - 'uri' => 'projects/{projectId}/queries/multi_analysis', - 'description' => 'Multi-analysis lets you run multiple types of analysis over the same data. Performing a multi-analysis call is very similar to a Metric or a Series.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/multi_analysis', + 'description' => + 'Multi-analysis lets you run multiple types of analysis over the same data.' . + ' Performing a multi-analysis call is very similar to a Metric or a Series.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'analyses' => array( - 'location' => 'json', - 'description' => 'A URL encoded JSON object that defines the multiple types of analyses to perform.', - 'type' => 'array', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => array('string', 'number'), - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'analyses' => array( + 'location' => 'json', + 'description' => + 'A URL encoded JSON object that defines the multiple types of analyses to perform.', + 'type' => 'array', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => array('string', 'number'), + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'extraction' => array( - 'uri' => 'projects/{projectId}/queries/extraction', - 'description' => 'GET creates an extraction request for full-form event data with all property values. If the query string parameter email is specified, then the extraction will be processed asynchronously and an e-mail will be sent to the specified address when it completes. The email will include a link to a downloadable CSV file. If email is omitted, then the extraction will be processed in-line and JSON results will be returned in the GET request.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/extraction', + 'description' => + 'GET creates an extraction request for full-form event data with all property values.' . + ' If the query string parameter email is specified, then the extraction will be processed' . + ' asynchronously and an e-mail will be sent to the specified address when it completes.' . + ' The email will include a link to a downloadable CSV file. If email is omitted, then the' . + ' extraction will be processed in-line and JSON results will be returned in the GET request.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'email' => array( - 'location' => 'json', + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'email' => array( + 'location' => 'json', 'description' => 'Email that will be notified when your extraction is ready for download.', - 'type' => 'string', - 'required' => false, + 'type' => 'string', + 'required' => false, ), - 'latest' => array( - 'location' => 'json', + 'latest' => array( + 'location' => 'json', 'description' => 'An integer containing the number of most recent events to extract.', - 'type' => 'number', - 'required' => false, + 'type' => 'number', + 'required' => false, ), - 'property_names' => array( - 'location' => 'json', - 'description' => 'A URL-encoded array of strings containing properties you wish to extract. If this parameter is omitted, all properties will be returned.', - 'type' => 'array', - 'required' => false, + 'property_names' => array( + 'location' => 'json', + 'description' => + 'A URL-encoded array of strings containing properties you wish to extract.' . + ' If this parameter is omitted, all properties will be returned.', + 'type' => 'array', + 'required' => false, ), ), ), 'median' => array( - 'uri' => 'projects/{projectId}/queries/median', - 'description' => 'GET returns the median across all numeric values for the target property in the event collection matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON object with one key: result, which maps to the numeric result described previously.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/median', + 'description' => + 'GET returns the median across all numeric values for the target property in the event collection' . + ' matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON' . + ' object with one key: result, which maps to the numeric result described previously.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => 'number', - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => 'number', + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, ), ), ), 'percentile' => array( - 'uri' => 'projects/{projectId}/queries/percentile', - 'description' => 'GET returns the Xth percentile value across all numeric values for the target property in the event collection matching the given criteria. Non-numeric values are ignored. The response will be a simple JSON object with one key: result, which maps to the numeric result described previously.', - 'httpMethod' => 'POST', - 'parameters' => array( - 'projectId' => array( - 'location' => 'uri', - 'type' => 'string' - ), - 'readKey' => array( - 'location' => 'header', + 'uri' => 'projects/{projectId}/queries/percentile', + 'description' => + 'GET returns the Xth percentile value across all numeric values for the target property in the event' . + ' collection matching the given criteria. Non-numeric values are ignored. The response will be a' . + ' simple JSON object with one key: result, which maps to the numeric result described previously.', + 'httpMethod' => 'POST', + 'parameters' => array( + 'projectId' => array( + 'location' => 'uri', + 'type' => 'string' + ), + 'readKey' => array( + 'location' => 'header', 'description' => 'The Read Key for the project.', - 'sentAs' => 'Authorization', - 'pattern' => '/^([[:alnum:]])+$/', - 'type' => 'string', - 'required' => false, + 'sentAs' => 'Authorization', + 'pattern' => '/^([[:alnum:]])+$/', + 'type' => 'string', + 'required' => false, ), 'event_collection' => array( - 'location' => 'json', + 'location' => 'json', 'description' => 'The name of the event collection you are analyzing.', - 'type' => 'string', - 'required' => true, + 'type' => 'string', + 'required' => true, ), - 'target_property' => array( - 'location' => 'json', + 'target_property' => array( + 'location' => 'json', 'description' => 'The name of the property you are analyzing.', - 'type' => 'string', - 'required' => true, - ), - 'filters' => array( - 'location' => 'json', - 'description' => 'Filters are used to narrow down the events used in an analysis request based on event property values.', - 'type' => 'array', - 'required' => false, - ), - 'timeframe' => array( - 'location' => 'json', - 'description' => 'A Timeframe specifies the events to use for analysis based on a window of time. If no timeframe is specified, all events will be counted.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'interval' => array( - 'location' => 'json', - 'description' => 'Intervals are used when creating a Series API call. The interval specifies the length of each sub-timeframe in a Series.', - 'type' => 'string', - 'required' => false, - ), - 'timezone' => array( - 'location' => 'json', - 'description' => 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', - 'type' => 'number', - 'required' => false, - ), - 'group_by' => array( - 'location' => 'json', - 'description' => 'The group_by parameter specifies the name of a property by which you would like to group the results.', - 'type' => array('string', 'array'), - 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), - 'required' => false, - ), - 'percentile' => array( - 'location' => 'json', + 'type' => 'string', + 'required' => true, + ), + 'filters' => array( + 'location' => 'json', + 'description' => + 'Filters are used to narrow down the events used in' . + ' an analysis request based on event property values.', + 'type' => 'array', + 'required' => false, + ), + 'timeframe' => array( + 'location' => 'json', + 'description' => + 'A Timeframe specifies the events to use for analysis based on a window of time.' . + ' If no timeframe is specified, all events will be counted.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'interval' => array( + 'location' => 'json', + 'description' => + 'Intervals are used when creating a Series API call.' . + ' The interval specifies the length of each sub-timeframe in a Series.', + 'type' => 'string', + 'required' => false, + ), + 'timezone' => array( + 'location' => 'json', + 'description' => + 'Modifies the timeframe filters for Relative Timeframes to match a specific timezone.', + 'type' => 'number', + 'required' => false, + ), + 'group_by' => array( + 'location' => 'json', + 'description' => + 'The group_by parameter specifies the name of a property' . + ' by which you would like to group the results.', + 'type' => array('string', 'array'), + 'filters' => array('KeenIO\Client\Filter\MultiTypeFiltering::encodeValue'), + 'required' => false, + ), + 'percentile' => array( + 'location' => 'json', 'description' => 'The desired Xth percentile you want to get in your analysis.', - 'type' => 'number', - 'required' => true, + 'type' => 'number', + 'required' => true, ), ), ), diff --git a/tests/Tests/Client/KeenIOClientTest.php b/tests/Tests/Client/KeenIOClientTest.php index 3728d4d..e9d1f0c 100755 --- a/tests/Tests/Client/KeenIOClientTest.php +++ b/tests/Tests/Client/KeenIOClientTest.php @@ -20,10 +20,10 @@ public function testFactoryReturnsClient() $config = array( 'projectId' => 'testProjectId', 'masterKey' => 'testMasterKey', - 'readKey' => 'testReadKey', - 'writeKey' => 'testWriteKey', - 'version' => '3.0' - ); + 'readKey' => 'testReadKey', + 'writeKey' => 'testWriteKey', + 'version' => '3.0' + ); $client = KeenIOClient::factory($config); @@ -49,10 +49,10 @@ public function testFactoryReturnsClientWhenVersionEmpty() $config = array( 'projectId' => 'testProjectId', 'masterKey' => 'testMasterKey', - 'readKey' => 'testReadKey', - 'writeKey' => 'testWriteKey', - 'version' => '' - ); + 'readKey' => 'testReadKey', + 'writeKey' => 'testWriteKey', + 'version' => '' + ); $client = KeenIOClient::factory($config); @@ -71,19 +71,20 @@ public function testFactoryReturnsClientWhenVersionEmpty() /** * Tests that the magic __call correctly merges in the event_collection parameter */ - public function testEventCollectionMerging() { + public function testEventCollectionMerging() + { $unmerged = array('collection', array('timeframe' => 'this_14_days')); $merged = array(array('event_collection' => 'collection', 'timeframe' => 'this_14_days')); $client = $this->getClient(); - $unmergedAfter = $this->invokeMethod($client, 'combineEventCollectionArgs', array($unmerged)); - $mergedAfter = $this->invokeMethod($client, 'combineEventCollectionArgs', array($merged)); + $unmergedAfter = $this->invokeMethod($client, 'combineEventCollectionArgs', array($unmerged)); + $mergedAfter = $this->invokeMethod($client, 'combineEventCollectionArgs', array($merged)); $this->assertEquals($unmergedAfter['event_collection'], 'collection'); - $this->assertEquals($unmergedAfter['timeframe'], 'this_14_days'); + $this->assertEquals($unmergedAfter['timeframe'], 'this_14_days'); $this->assertEquals($mergedAfter['event_collection'], 'collection'); - $this->assertEquals($mergedAfter['timeframe'], 'this_14_days'); + $this->assertEquals($mergedAfter['timeframe'], 'this_14_days'); } /** @@ -210,6 +211,7 @@ public function testDecryptLegacyScopedKey() $filters = array($filter); $allowed_operations = array('read'); + // @codingStandardsIgnoreLine - It is not possible to get this below 120 characters $result = $client->decryptScopedKey('696a2c05b060e6ed344f7e570c101e0909ff97c338dfe0f1e15c0e5c1ec0621dfcd5577f3ae58596558eed2a43c82d3a062fbf6455810f5c859695c766caddd283398e577b24db014fad896a6f0447a2aad9dad43cef5fa040e8f6d366085423804633ef3b21535b31d11eec24631f83c18e83703247f40136aeba779a840e80013e0969a8cf203295f47da1d70bfeb3'); $expected = array('filters' => $filters, 'allowed_operations' => $allowed_operations); @@ -250,6 +252,7 @@ public function testDecryptScopedKey() $filters = array($filter); $allowed_operations = array('read'); + // @codingStandardsIgnoreLine - It is not possible to get this below 120 characters $result = $client->decryptScopedKey('903441674b0d433ddab759bba82502ec469e00d25c373e35c4d685488bc7779a5abd7d90a03a4cb744ee6a82fa8935804348a5b2351f6527cd5fd6a0613cea5ec4e848f5093e41a53d570cf01066b1f3c3e9b03d4ce0929ff3e6a06e1850fb9e09b65415ac754bbefe9db4b1fcba7d71a9f5f9d9c05cbeffb2a33ef5f4bac131'); $expected = array('filters' => $filters, 'allowed_operations' => $allowed_operations); @@ -291,7 +294,7 @@ public function testServiceCommands($method, $params) //Check that the json body has all of the parameters $this->assertEquals(count($params), count($body)); - foreach($params as $param => $value) { + foreach ($params as $param => $value) { $this->assertEquals($value, $body[$param]); } @@ -306,12 +309,27 @@ public function providerServiceCommands() { return array( array('count', array('event_collection' => 'test', 'timeframe' => 'this_week')), - array('countUnique', array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week')), - array('minimum', array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week')), - array('maximum', array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week')), - array('average', array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week')), + array( + 'countUnique', + array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week') + ), + array( + 'minimum', + array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week') + ), + array( + 'maximum', + array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week') + ), + array( + 'average', + array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week') + ), array('sum', array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week')), - array('selectUnique', array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week')), + array( + 'selectUnique', + array('event_collection' => 'test', 'target_property' => 'foo', 'timeframe' => 'this_week') + ), array('extraction', array('event_collection' => 'test', 'timeframe' => 'this_week', 'latest' => 10)) ); } @@ -397,7 +415,7 @@ public function testSendEventsMethod() $request = $queue->getLastRequest(); $url = parse_url($request->getUri()); - $expectedResponse = array('test' => array(array('success' => true), array('success'=>true))); + $expectedResponse = array('test' => array(array('success' => true), array('success' => true))); //Make sure the projectId is set properly in the url $this->assertContains($client->getProjectId(), explode('/', $url['path'])); @@ -411,7 +429,7 @@ public function testSendEventsMethod() $this->assertJsonStringEqualsJsonString(json_encode($expectedResponse), json_encode($response)); //Checks that the event is properly encoded in the request body - $this->assertJsonStringEqualsJsonString(json_encode($events), (string) $request->getBody()); + $this->assertJsonStringEqualsJsonString(json_encode($events), (string)$request->getBody()); } protected function getClient($handler = null) @@ -419,28 +437,28 @@ protected function getClient($handler = null) return \KeenIO\Client\KeenIOClient::factory(array( 'projectId' => $_SERVER['PROJECT_ID'], 'masterKey' => $_SERVER['MASTER_KEY'], - 'writeKey' => $_SERVER['WRITE_KEY'], - 'readKey' => $_SERVER['READ_KEY'], - 'version' => $_SERVER['API_VERSION'], - 'handler' => $handler + 'writeKey' => $_SERVER['WRITE_KEY'], + 'readKey' => $_SERVER['READ_KEY'], + 'version' => $_SERVER['API_VERSION'], + 'handler' => $handler )); } - /** - * Call protected/private method of a class. - * - * @param object &$object Instantiated object that we will run method on. - * @param string $methodName Method name to call - * @param array $parameters Array of parameters to pass into method. - * - * @return mixed Method return. - */ - protected function invokeMethod(&$object, $methodName, array $parameters = array()) - { - $reflection = new \ReflectionClass(get_class($object)); - $method = $reflection->getMethod($methodName); - $method->setAccessible(true); - - return $method->invokeArgs($object, $parameters); - } + /** + * Call protected/private method of a class. + * + * @param object &$object Instantiated object that we will run method on. + * @param string $methodName Method name to call + * @param array $parameters Array of parameters to pass into method. + * + * @return mixed Method return. + */ + protected function invokeMethod(&$object, $methodName, array $parameters = array()) + { + $reflection = new \ReflectionClass(get_class($object)); + $method = $reflection->getMethod($methodName); + $method->setAccessible(true); + + return $method->invokeArgs($object, $parameters); + } } diff --git a/tests/Tests/Filter/MultiTypeFilteringTest.php b/tests/Tests/Filter/MultiTypeFilteringTest.php index 4c457f0..2a4602f 100755 --- a/tests/Tests/Filter/MultiTypeFilteringTest.php +++ b/tests/Tests/Filter/MultiTypeFilteringTest.php @@ -18,7 +18,6 @@ namespace KeenIO\Tests\Filter; - use KeenIO\Client\Filter\MultiTypeFiltering; class MultiTypeFilteringTest extends \PHPUnit_Framework_TestCase diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 581430b..1750f26 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,4 +6,3 @@ die("Dependencies must be installed using composer:\n\nphp composer.phar install\n\n" . "See http://getcomposer.org for help with installing composer\n"); } -