Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function getApiDocInfo()
 {
     $base = parent::getApiDocInfo();
     $apis = [];
     $models = [];
     foreach ($this->getResources(true) as $resourceInfo) {
         $className = ArrayUtils::get($resourceInfo, 'class_name');
         if (!class_exists($className)) {
             throw new InternalServerErrorException('Service configuration class name lookup failed for resource ' . $this->resourcePath);
         }
         /** @var BaseRestResource $resource */
         $resource = $this->instantiateResource($className, $resourceInfo);
         $name = ArrayUtils::get($resourceInfo, 'name', '') . '/';
         $access = $this->getPermissions($name);
         if (!empty($access)) {
             $results = $resource->getApiDocInfo();
             if (isset($results, $results['apis'])) {
                 $apis = array_merge($apis, $results['apis']);
             }
             if (isset($results, $results['models'])) {
                 $models = array_merge($models, $results['models']);
             }
         }
     }
     $base['apis'] = array_merge($base['apis'], $apis);
     $base['models'] = array_merge($base['models'], $models);
     return $base;
 }
 /**
  * @param array $settings
  */
 public function __construct($settings = [])
 {
     $verbAliases = [Verbs::PUT => Verbs::POST, Verbs::MERGE => Verbs::PATCH];
     ArrayUtils::set($settings, "verbAliases", $verbAliases);
     parent::__construct($settings);
     $config = ArrayUtils::get($settings, 'config');
     $this->defaultRole = ArrayUtils::get($config, 'default_role');
     $this->setDriver($config);
 }
Exemple #3
0
 /**
  * Create a new Script Service
  *
  * @param array $settings
  *
  * @throws \InvalidArgumentException
  * @throws \Exception
  */
 public function __construct($settings = [])
 {
     parent::__construct($settings);
     $config = ArrayUtils::clean(ArrayUtils::get($settings, 'config'));
     Session::replaceLookups($config, true);
     if (null === ($this->content = ArrayUtils::get($config, 'content', null, true))) {
         throw new \InvalidArgumentException('Script content can not be empty.');
     }
     if (null === ($this->engineConfig = ArrayUtils::get($config, 'engine', null, true))) {
         throw new \InvalidArgumentException('Script engine configuration can not be empty.');
     }
     $this->scriptConfig = ArrayUtils::clean(ArrayUtils::get($config, 'config', [], true));
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  */
 protected function getPayloadData($key = null, $default = null)
 {
     $payload = parent::getPayloadData();
     if (null !== $key && !empty($payload[$key])) {
         return $payload[$key];
     }
     //        $alwaysWrap = \Config::get('df.always_wrap_resources', false);
     $wrapper = ResourcesWrapper::getWrapper();
     if (!empty($this->resource) && !empty($payload)) {
         // single records passed in which don't use the record wrapper, so wrap it
         $payload = [$wrapper => [$payload]];
     } elseif (ArrayUtils::isArrayNumeric($payload)) {
         // import from csv, etc doesn't include a wrapper, so wrap it
         $payload = [$wrapper => $payload];
     }
     if (empty($key)) {
         $key = $wrapper;
     }
     return ArrayUtils::get($payload, $key);
 }
Exemple #5
0
 /**
  * {@inheritdoc}
  */
 public function getApiDocInfo()
 {
     $base = parent::getApiDocInfo();
     $apis = [['path' => '/{api_name}', 'description' => 'Operations available for push notification services.', 'operations' => [['method' => 'POST', 'summary' => 'simplePublish() - Send a simple message to a topic or endpoint.', 'nickname' => 'simplePublish', 'notes' => 'Post data should be an array of topic publish properties.', 'type' => 'PublishResponse', 'event_name' => ['{api_name}.publish'], 'parameters' => [['name' => 'body', 'description' => 'Array of topic publish parameters.', 'allowMultiple' => false, 'type' => 'SimplePublishRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'publish() - Send a message to a topic or endpoint.', 'nickname' => 'publish', 'notes' => 'Post data should be an array of topic publish properties.', 'type' => 'PublishResponse', 'event_name' => ['{api_name}.publish'], 'parameters' => [['name' => 'body', 'description' => 'Array of topic message parameters.', 'allowMultiple' => false, 'type' => 'PublishRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]], ['path' => '/{api_name}/topic', 'description' => 'Operations for push topics.', 'operations' => [['method' => 'GET', 'summary' => 'getTopics() - Retrieve all topics available for the push service.', 'nickname' => 'getTopics', 'notes' => 'This returns the topics as resources.', 'event_name' => ['{api_name}.topic.list'], 'type' => 'GetTopicsResponse', 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'GET', 'summary' => 'listTopics() - List topics available for the push service.', 'nickname' => 'listTopics', 'notes' => 'Returns only the names of the topics in an array.', 'type' => 'ComponentList', 'event_name' => ['{api_name}.topic.list'], 'parameters' => [['name' => 'names_only', 'description' => 'Return only the names of the topics in an array.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => true, 'default' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'createTopic() - Create a topic.', 'nickname' => 'createTopic', 'notes' => 'Post data should be an array of topic attributes including \'Name\'.', 'type' => 'TopicIdentifier', 'event_name' => ['{api_name}.topic.create'], 'parameters' => [['name' => 'body', 'description' => 'Array of topic attributes.', 'allowMultiple' => false, 'type' => 'TopicRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]], ['path' => '/{api_name}/topic/{topic_name}', 'description' => 'Operations for a specific push topic.', 'operations' => [['method' => 'GET', 'summary' => 'getTopicAttributes() - Retrieve topic definition for the given topic.', 'nickname' => 'getTopicAttributes', 'notes' => 'This retrieves the topic, detailing its available properties.', 'event_name' => ['{api_name}.topic.{topic_name}.retrieve', '{api_name}.topic_retrieved'], 'type' => 'TopicAttributesResponse', 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'simplePublishTopic() - Send a message to the given topic.', 'nickname' => 'simplePublishTopic', 'notes' => 'Post data should be an array of topic publish properties.', 'type' => 'PublishResponse', 'event_name' => ['{api_name}.topic.{topic_name}.publish', '{api_name}.topic_published'], 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of topic publish parameters.', 'allowMultiple' => false, 'type' => 'SimplePublishTopicRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'publishTopic() - Send a message to the given topic.', 'nickname' => 'publishTopic', 'notes' => 'Post data should be an array of topic publish properties.', 'type' => 'PublishResponse', 'event_name' => ['{api_name}.topic.{topic_name}.publish', '{api_name}.topic_published'], 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of topic message parameters.', 'allowMultiple' => false, 'type' => 'PublishTopicRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'PUT', 'summary' => 'setTopicAttributes() - Update a given topic\'s attributes.', 'nickname' => 'setTopicAttributes', 'type' => 'Success', 'event_name' => ['{api_name}.topic.{topic_name}.update', '{api_name}.topic_updated'], 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of topic attributes.', 'allowMultiple' => false, 'type' => 'TopicAttributesRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of topic attributes including \'Name\'.'], ['method' => 'DELETE', 'summary' => 'deleteTopic() - Delete a given topic.', 'nickname' => 'deleteTopic', 'notes' => '', 'type' => 'Success', 'event_name' => ['{api_name}.topic.{topic_name}.delete', '{api_name}.topic_deleted'], 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]], ['path' => '/{api_name}/topic/{topic_name}/subscription', 'description' => 'Operations for push subscriptions.', 'operations' => [['method' => 'GET', 'summary' => 'getSubscriptionsByTopic() - Retrieve subscriptions for the given topic.', 'nickname' => 'getSubscriptionsByTopic', 'notes' => 'This return the subscriptions as resources.', 'event_name' => ['{api_name}.topic.{topic_name}.subscription.list'], 'type' => 'GetSubscriptionsResponse', 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'GET', 'summary' => 'listSubscriptionsByTopic() - List subscriptions available for the given topic.', 'nickname' => 'listSubscriptionsByTopic', 'notes' => 'Return only the names of the subscriptions in an array.', 'type' => 'ComponentList', 'event_name' => ['{api_name}.topic.{topic_name}.subscription.list'], 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'names_only', 'description' => 'Return only the names of the subscriptions in an array.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => true, 'default' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'subscribeTopic() - Create a subscription for the given topic.', 'nickname' => 'subscribeTopic', 'type' => 'SubscriptionIdentifier', 'event_name' => ['{api_name}.topic.{topic_name}.subscription.create'], 'parameters' => [['name' => 'topic_name', 'description' => 'Full ARN or simplified name of the topic to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of subscription attributes.', 'allowMultiple' => false, 'type' => 'SubscriptionTopicRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of subscription attributes including \'Name\'.']]], ['path' => '/{api_name}/subscription', 'description' => 'Operations for push subscriptions.', 'operations' => [['method' => 'GET', 'summary' => 'getSubscriptions() - Retrieve all subscriptions as resources.', 'nickname' => 'getSubscriptions', 'notes' => 'This describes the topic, detailing its available properties.', 'event_name' => ['{api_name}.subscription.list'], 'type' => 'GetSubscriptionsResponse', 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'GET', 'summary' => 'listSubscriptions() - List subscriptions available for the push service.', 'nickname' => 'listSubscriptions', 'notes' => 'See listed operations for each subscription available.', 'type' => 'ComponentList', 'event_name' => ['{api_name}.subscription.list'], 'parameters' => [['name' => 'names_only', 'description' => 'Return only the names of the subscriptions in an array.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => true, 'default' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'subscribe() - Create a subscription.', 'nickname' => 'subscribe', 'type' => 'SubscriptionIdentifier', 'event_name' => ['{api_name}.subscription.create'], 'parameters' => [['name' => 'body', 'description' => 'Array of subscription attributes.', 'allowMultiple' => false, 'type' => 'SubscriptionRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of subscription attributes including \'Name\'.']]], ['path' => '/{api_name}/subscription/{sub_name}', 'description' => 'Operations for a specific push subscription.', 'operations' => [['method' => 'GET', 'summary' => 'getSubscriptionAttributes() - Retrieve attributes for the given subscription.', 'nickname' => 'getSubscriptionAttributes', 'event_name' => ['{api_name}.subscription.{subscription_name}.retrieve', '{api_name}.subscription_retrieved'], 'type' => 'SubscriptionAttributesResponse', 'parameters' => [['name' => 'sub_name', 'description' => 'Full ARN or simplified name of the subscription to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'This retrieves the subscription, detailing its available properties.'], ['method' => 'PUT', 'summary' => 'setSubscriptionAttributes() - Update a given subscription.', 'nickname' => 'setSubscriptionAttributes', 'type' => 'Success', 'event_name' => ['{api_name}.subscription.{subscription_name}.update', '{api_name}.subscription_updated'], 'parameters' => [['name' => 'sub_name', 'description' => 'Full ARN or simplified name of the subscription to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of subscription attributes.', 'allowMultiple' => false, 'type' => 'SubscriptionAttributesRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of subscription attributes including \'Name\'.'], ['method' => 'DELETE', 'summary' => 'unsubscribe() - Delete a given subscription.', 'nickname' => 'unsubscribe', 'notes' => '', 'type' => 'Success', 'event_name' => ['{api_name}.subscription.{subscription_name}.delete', '{api_name}.subscription_deleted'], 'parameters' => [['name' => 'sub_name', 'description' => 'Full ARN or simplified name of the subscription to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]], ['path' => '/{api_name}/app', 'description' => 'Operations for push platform applications.', 'operations' => [['method' => 'GET', 'summary' => 'getApps() - Retrieve app definition for the given app.', 'nickname' => 'getApps', 'event_name' => ['{api_name}.app.list'], 'type' => 'GetAppsResponse', 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'This describes the app, detailing its available properties.'], ['method' => 'GET', 'summary' => 'listApps() - List apps available for the push service.', 'nickname' => 'listApps', 'notes' => 'See listed operations for each app available.', 'type' => 'ComponentList', 'event_name' => ['{api_name}.app.list'], 'parameters' => [['name' => 'names_only', 'description' => 'Return only the names of the apps in an array.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => true, 'default' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'createApp() - Create a given app.', 'nickname' => 'createApp', 'type' => 'AppIdentifier', 'event_name' => ['{api_name}.app.create'], 'parameters' => [['name' => 'body', 'description' => 'Array of app attributes.', 'allowMultiple' => false, 'type' => 'AppRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of app attributes including \'Name\'.']]], ['path' => '/{api_name}/app/{app_name}', 'description' => 'Operations for a specific push platform application.', 'operations' => [['method' => 'GET', 'summary' => 'getAppAttributes() - Retrieve app definition for the given app.', 'nickname' => 'getAppAttributes', 'event_name' => ['{api_name}.app.{app_name}.retrieve', '{api_name}.app_retrieved'], 'type' => 'AppAttributesResponse', 'parameters' => [['name' => 'app_name', 'description' => 'Full ARN or simplified name of the app to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'This retrieves the app, detailing its available properties.'], ['method' => 'PUT', 'summary' => 'setAppAttributes() - Update a given app.', 'nickname' => 'setAppAttributes', 'type' => 'Success', 'event_name' => ['{api_name}.app.{app_name}.update', '{api_name}.app_updated'], 'parameters' => [['name' => 'app_name', 'description' => 'Full ARN or simplified name of the app to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of app attributes.', 'allowMultiple' => false, 'type' => 'AppAttributesRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of app attributes including \'Name\'.'], ['method' => 'DELETE', 'summary' => 'deleteApp() - Delete a given app.', 'nickname' => 'deleteApp', 'notes' => '', 'type' => 'Success', 'event_name' => ['{api_name}.app.{app_name}.delete', '{api_name}.app_deleted'], 'parameters' => [['name' => 'app_name', 'description' => 'Full ARN or simplified name of the app to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]], ['path' => '/{api_name}/app/{app_name}/endpoint', 'description' => 'Operations for push application endpoints.', 'operations' => [['method' => 'GET', 'summary' => 'getEndpointsByApp() - Retrieve endpoints for the given application.', 'nickname' => 'getEndpointsByApp', 'event_name' => ['{api_name}.endpoint.list'], 'type' => 'GetEndpointsResponse', 'parameters' => [['name' => 'app_name', 'description' => 'Name of the application to get endpoints on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'This describes the endpoints, detailing its available properties.'], ['method' => 'GET', 'summary' => 'listEndpointsByApp() - List endpoints available for the push service.', 'nickname' => 'listEndpointsByApp', 'notes' => 'See listed operations for each endpoint available.', 'type' => 'ComponentList', 'event_name' => ['{api_name}.endpoint.list'], 'parameters' => [['name' => 'app_name', 'description' => 'Name of the application to get endpoints on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'names_only', 'description' => 'Return only the names of the endpoints in an array.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => true, 'default' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'createAppEndpoint() - Create a endpoint for a given application.', 'nickname' => 'createAppEndpoint', 'type' => 'EndpointIdentifier', 'event_name' => ['{api_name}.endpoint.create'], 'parameters' => [['name' => 'app_name', 'description' => 'Name of the application to create endpoints on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of endpoint attributes.', 'allowMultiple' => false, 'type' => 'AppEndpointRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of endpoint attributes including \'Name\'.']]], ['path' => '/{api_name}/endpoint', 'description' => 'Operations for push application endpoints.', 'operations' => [['method' => 'GET', 'summary' => 'getEndpoints() - Retrieve endpoint definition for the given endpoint.', 'nickname' => 'getEndpoints', 'notes' => 'This describes the endpoint, detailing its available properties.', 'event_name' => ['{api_name}.endpoint.list'], 'type' => 'GetEndpointsResponse', 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'GET', 'summary' => 'listEndpoints() - List endpoints available for the push service.', 'nickname' => 'listEndpoints', 'notes' => 'See listed operations for each endpoint available.', 'type' => 'ComponentList', 'event_name' => ['{api_name}.endpoint.list'], 'parameters' => [['name' => 'names_only', 'description' => 'Return only the names of the endpoints in an array.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => true, 'default' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'createEndpoint() - Create a given endpoint.', 'nickname' => 'createEndpoint', 'type' => 'EndpointIdentifier', 'event_name' => ['{api_name}.endpoint.create'], 'parameters' => [['name' => 'body', 'description' => 'Array of endpoint attributes.', 'allowMultiple' => false, 'type' => 'EndpointRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of endpoint attributes including \'Name\'.']]], ['path' => '/{api_name}/endpoint/{endpoint_name}', 'description' => 'Operations for a specific push application endpoint.', 'operations' => [['method' => 'GET', 'summary' => 'getEndpointAttributes() - Retrieve endpoint definition for the given endpoint.', 'nickname' => 'getEndpointAttributes', 'event_name' => ['{api_name}.endpoint.{endpoint_name}.retrieve', '{api_name}.endpoint_retrieved'], 'type' => 'EndpointAttributesResponse', 'parameters' => [['name' => 'endpoint_name', 'description' => 'Full ARN or simplified name of the endpoint to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'This retrieves the endpoint, detailing its available properties.'], ['method' => 'POST', 'summary' => 'simplePublishEndpoint() - Send a message to the given endpoint.', 'nickname' => 'simplePublishEndpoint', 'notes' => 'Post data should be an array of endpoint publish properties.', 'type' => 'PublishResponse', 'event_name' => ['{api_name}.topic.{topic_name}.publish', '{api_name}.topic_published'], 'parameters' => [['name' => 'endpoint_name', 'description' => 'Full ARN or simplified name of the endpoint to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of topic publish parameters.', 'allowMultiple' => false, 'type' => 'SimplePublishEndpointRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'publishEndpoint() - Send a message to the given endpoint.', 'nickname' => 'publishEndpoint', 'notes' => 'Post data should be an array of endpoint publish properties.', 'type' => 'PublishResponse', 'event_name' => ['{api_name}.topic.{endpoint_name}.publish', '{api_name}.endpoint_published'], 'parameters' => [['name' => 'endpoint_name', 'description' => 'Full ARN or simplified name of the endpoint to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of topic message parameters.', 'allowMultiple' => false, 'type' => 'PublishEndpointRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'PUT', 'summary' => 'setEndpointAttributes() - Update a given endpoint.', 'nickname' => 'setEndpointAttributes', 'type' => 'Success', 'event_name' => ['{api_name}.endpoint.{endpoint_name}.update', '{api_name}.endpoint_updated'], 'parameters' => [['name' => 'endpoint_name', 'description' => 'Full ARN or simplified name of the endpoint to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of endpoint attributes.', 'allowMultiple' => false, 'type' => 'EndpointAttributesRequest', 'paramType' => 'body', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of endpoint attributes including \'Name\'.'], ['method' => 'DELETE', 'summary' => 'deleteEndpoint() - Delete a given endpoint.', 'nickname' => 'deleteEndpoint', 'notes' => '', 'type' => 'Success', 'event_name' => ['{api_name}.endpoint.{endpoint_name}.delete', '{api_name}.endpoint_deleted'], 'parameters' => [['name' => 'endpoint_name', 'description' => 'Full ARN or simplified name of the endpoint to perform operations on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]]];
     $commonAppAttributes = ['PlatformCredential' => ['type' => 'string', 'description' => 'The credential received from the notification service.'], 'PlatformPrincipal' => ['type' => 'string', 'description' => 'The principal received from the notification service.'], 'EventEndpointCreated' => ['type' => 'string', 'description' => 'Topic ARN to which EndpointCreated event notifications should be sent.'], 'EventEndpointUpdated' => ['type' => 'string', 'description' => 'Topic ARN to which EndpointUpdated event notifications should be sent.'], 'EventEndpointDeleted' => ['type' => 'string', 'description' => 'Topic ARN to which EndpointDeleted event notifications should be sent.'], 'EventDeliveryFailure' => ['type' => 'string', 'description' => 'Topic ARN to which DeliveryFailure event notifications should be sent upon Direct Publish delivery failure (permanent) to one of the application\'s endpoints.']];
     $commonEndpointAttributes = ['CustomUserData' => ['type' => 'string', 'description' => 'Arbitrary user data to associate with the endpoint.'], 'Enabled' => ['type' => 'boolean', 'description' => 'The flag that enables/disables delivery to the endpoint.'], 'Token' => ['type' => 'string', 'description' => 'The device token, also referred to as a registration id, for an app and mobile device.']];
     $models = ['GetTopicsResponse' => ['id' => 'GetTopicsResponse', 'properties' => ['resource' => ['type' => 'Array', 'description' => 'An array of identifying attributes for a topic, use either in requests.', 'items' => ['$ref' => 'TopicIdentifier']]]], 'TopicRequest' => ['id' => 'TopicRequest', 'properties' => ['Name' => ['type' => 'string', 'description' => 'The name of the topic you want to create.', 'required' => true]]], 'TopicIdentifier' => ['id' => 'TopicIdentifier', 'properties' => ['Topic' => ['type' => 'string', 'description' => 'The topic\'s simplified name.'], 'TopicArn' => ['type' => 'string', 'description' => 'The topic\'s Amazon Resource Name.']]], 'TopicAttributesResponse' => ['id' => 'TopicAttributesResponse', 'properties' => ['Topic' => ['type' => 'string', 'description' => 'The topic\'s simplified name.'], 'TopicArn' => ['type' => 'string', 'description' => 'The topic\'s Amazon Resource Name.'], 'Owner' => ['type' => 'string', 'description' => 'The AWS account ID of the topic\'s owner.'], 'Policy' => ['type' => 'string', 'description' => 'The JSON serialization of the topic\'s access control policy.'], 'DisplayName' => ['type' => 'string', 'description' => 'The human-readable name used in the "From" field for notifications to email and email-json endpoints.'], 'SubscriptionsPending' => ['type' => 'string', 'description' => 'The number of subscriptions pending confirmation on this topic.'], 'SubscriptionsConfirmed' => ['type' => 'string', 'description' => 'The number of confirmed subscriptions on this topic.'], 'SubscriptionsDeleted' => ['type' => 'string', 'description' => 'The number of deleted subscriptions on this topic.'], 'DeliveryPolicy' => ['type' => 'string', 'description' => 'The JSON serialization of the topic\'s delivery policy.'], 'EffectiveDeliveryPolicy' => ['type' => 'string', 'description' => 'The JSON serialization of the effective delivery policy that takes into account system defaults.']]], 'TopicAttributesRequest' => ['id' => 'TopicAttributesRequest', 'properties' => ['AttributeName' => ['type' => 'string', 'description' => 'The name of the attribute you want to set.', 'enum' => ['Policy', 'DisplayName', 'DeliveryPolicy'], 'default' => 'DisplayName', 'required' => true], 'AttributeValue' => ['type' => 'string', 'description' => 'The value of the attribute you want to set.']]], 'GetSubscriptionsResponse' => ['id' => 'GetSubscriptionsResponse', 'properties' => ['resource' => ['type' => 'Array', 'description' => 'An array of identifying attributes for a subscription, use either in requests.', 'items' => ['$ref' => 'SubscriptionIdentifier']]]], 'SubscriptionRequest' => ['id' => 'SubscriptionRequest', 'properties' => ['Topic' => ['type' => 'string', 'description' => 'The topic\'s simplified name or Amazon Resource Name.', 'required' => true], 'Protocol' => ['type' => 'string', 'description' => 'The protocol you want to use.', 'enum' => ['http', 'https', 'email', 'email-json', 'sms', 'sqs', 'application'], 'required' => true], 'Endpoint' => ['type' => 'string', 'description' => 'The endpoint that you want to receive notifications, formats vary by protocol.']]], 'SubscriptionTopicRequest' => ['id' => 'SubscriptionTopicRequest', 'properties' => ['Protocol' => ['type' => 'string', 'description' => 'The protocol you want to use.', 'enum' => ['http', 'https', 'email', 'email-json', 'sms', 'sqs', 'application'], 'required' => true], 'Endpoint' => ['type' => 'string', 'description' => 'The endpoint that you want to receive notifications, formats vary by protocol.']]], 'SubscriptionIdentifier' => ['id' => 'SubscriptionIdentifier', 'properties' => ['Subscription' => ['type' => 'string', 'description' => 'The subscription\'s simplified name.'], 'SubscriptionArn' => ['type' => 'string', 'description' => 'The subscription\'s Amazon Resource Name.']]], 'SubscriptionAttributesResponse' => ['id' => 'SubscriptionAttributesResponse', 'properties' => ['Subscription' => ['type' => 'string', 'description' => 'The subscription\'s simplified name.'], 'SubscriptionArn' => ['type' => 'string', 'description' => 'The subscription\'s Amazon Resource Name.'], 'TopicArn' => ['type' => 'string', 'description' => 'The topic\'s Amazon Resource Name.'], 'Owner' => ['type' => 'string', 'description' => 'The AWS account ID of the topic\'s owner.'], 'ConfirmationWasAuthenticated' => ['type' => 'boolean', 'description' => 'True if the subscription confirmation request was authenticated.'], 'DeliveryPolicy' => ['type' => 'string', 'description' => 'The JSON serialization of the topic\'s delivery policy.'], 'EffectiveDeliveryPolicy' => ['type' => 'string', 'description' => 'The JSON serialization of the effective delivery policy that takes into account system defaults.']]], 'SubscriptionAttributesRequest' => ['id' => 'SubscriptionAttributesRequest', 'properties' => ['AttributeName' => ['type' => 'string', 'description' => 'The name of the attribute you want to set.', 'enum' => ['DeliveryPolicy', 'RawMessageDelivery'], 'default' => 'DeliveryPolicy', 'required' => true], 'AttributeValue' => ['type' => 'string', 'description' => 'The value of the attribute you want to set.']]], 'GetAppResponse' => ['id' => 'GetAppResponse', 'properties' => ['resource' => ['type' => 'Array', 'description' => 'An array of identifying attributes for a app, use either in requests.', 'items' => ['$ref' => 'AppIdentifier']]]], 'AppAttributes' => ['id' => 'AppAttributes', 'properties' => $commonAppAttributes], 'AppRequest' => ['id' => 'AppRequest', 'properties' => ['Name' => ['type' => 'string', 'description' => 'Desired platform application name.', 'required' => true], 'Platform' => ['type' => 'string', 'description' => 'One of the following supported platforms.', 'enum' => ['ADM', 'APNS', 'APNS_SANDBOX', 'GCM'], 'required' => true], 'Attributes' => ['type' => 'AppAttributes', 'description' => 'An array of key-value pairs containing platform-specified application attributes.']]], 'AppIdentifier' => ['id' => 'AppIdentifier', 'properties' => ['Application' => ['type' => 'string', 'description' => 'The app\'s simplified name.'], 'PlatformApplicationArn' => ['type' => 'string', 'description' => 'The app\'s Amazon Resource Name.']]], 'AppAttributesResponse' => ['id' => 'AppAttributesResponse', 'properties' => ['Application' => ['type' => 'string', 'description' => 'The app\'s simplified name.'], 'PlatformApplicationArn' => ['type' => 'string', 'description' => 'The app\'s Amazon Resource Name.'], 'EventEndpointCreated' => ['type' => 'string', 'description' => 'Topic ARN to which EndpointCreated event notifications should be sent.'], 'EventEndpointUpdated' => ['type' => 'string', 'description' => 'Topic ARN to which EndpointUpdated event notifications should be sent.'], 'EventEndpointDeleted' => ['type' => 'string', 'description' => 'Topic ARN to which EndpointDeleted event notifications should be sent.'], 'EventDeliveryFailure' => ['type' => 'string', 'description' => 'Topic ARN to which DeliveryFailure event notifications should be sent upon Direct Publish delivery failure (permanent) to one of the application\'s endpoints.']]], 'AppAttributesRequest' => ['id' => 'AppAttributesRequest', 'properties' => ['Attributes' => ['type' => 'AppAttributes', 'description' => 'Mutable attributes on the endpoint.', 'required' => true]]], 'GetEndpointsResponse' => ['id' => 'GetEndpointsResponse', 'properties' => ['resource' => ['type' => 'Array', 'description' => 'An array of identifying attributes for a topic, use either in requests.', 'items' => ['$ref' => 'EndpointIdentifier']]]], 'AppEndpointRequest' => ['id' => 'AppEndpointRequest', 'properties' => ['Token' => ['type' => 'string', 'description' => 'Unique identifier created by the notification service for an app on a device.', 'required' => true], 'CustomUserData' => ['type' => 'string', 'description' => 'Arbitrary user data to associate with the endpoint.'], 'Attributes' => ['type' => 'Array', 'description' => 'An array of key-value pairs containing endpoint attributes.', 'items' => ['$ref' => 'MessageAttribute']]]], 'EndpointRequest' => ['id' => 'EndpointRequest', 'properties' => ['Application' => ['type' => 'string', 'description' => 'The application\'s simplified name or Amazon Resource Name.', "required" => true], 'Token' => ['type' => 'string', 'description' => 'Unique identifier created by the notification service for an app on a device.', 'required' => true], 'CustomUserData' => ['type' => 'string', 'description' => 'Arbitrary user data to associate with the endpoint.'], 'Attributes' => ['type' => 'Array', 'description' => 'An array of key-value pairs containing endpoint attributes.', 'items' => ['$ref' => 'MessageAttribute']]]], 'EndpointIdentifier' => ['id' => 'EndpointIdentifier', 'properties' => ['Endpoint' => ['type' => 'string', 'description' => 'The endpoint\'s simplified name.'], 'EndpointArn' => ['type' => 'string', 'description' => 'The endpoint\'s Amazon Resource Name.']]], 'EndpointAttributesResponse' => ['id' => 'EndpointAttributesResponse', 'properties' => ['Endpoint' => ['type' => 'string', 'description' => 'The endpoint\'s simplified name.'], 'EndpointArn' => ['type' => 'string', 'description' => 'The endpoint\'s Amazon Resource Name.'], 'CustomUserData' => ['type' => 'string', 'description' => 'Arbitrary user data to associate with the endpoint.'], 'Enabled' => ['type' => 'boolean', 'description' => 'The flag that enables/disables delivery to the endpoint.'], 'Token' => ['type' => 'string', 'description' => 'The device token, also referred to as a registration id, for an app and mobile device.']]], 'EndpointAttributes' => ['id' => 'EndpointAttributes', 'properties' => $commonEndpointAttributes], 'EndpointAttributesRequest' => ['id' => 'EndpointAttributesRequest', 'properties' => ['Attributes' => ['type' => 'EndpointAttributes', 'description' => 'Mutable attributes on the endpoint.', 'required' => true]]], 'TopicMessage' => ['id' => 'TopicMessage', 'properties' => ['default' => ['type' => 'string', 'description' => 'This is sent when the message type is not specified below.', 'required' => true], 'email' => ['type' => 'string', 'description' => 'Message sent to all email or email-json subscriptions.'], 'sqs' => ['type' => 'string', 'description' => 'Message sent to all AWS SQS subscriptions.'], 'http' => ['type' => 'string', 'description' => 'Message sent to all HTTP subscriptions.'], 'https' => ['type' => 'string', 'description' => 'Message sent to all HTTPS subscriptions.'], 'sms' => ['type' => 'string', 'description' => 'Message sent to all SMS subscriptions.'], 'APNS' => ['type' => 'string', 'description' => '{\\"aps\\":{\\"alert\\": \\"ENTER YOUR MESSAGE\\",\\"sound\\":\\"default\\"} }'], 'GCM' => ['type' => 'string', 'description' => '{ \\"data\\": { \\"message\\": \\"ENTER YOUR MESSAGE\\" } }'], 'ADM' => ['type' => 'string', 'description' => '{ \\"data\\": { \\"message\\": \\"ENTER YOUR MESSAGE\\" } }'], 'BAIDU' => ['type' => 'string', 'description' => '{\\"title\\":\\"ENTER YOUR TITLE\\",\\"description\\":\\"ENTER YOUR DESCRIPTION\\"}'], 'MPNS' => ['type' => 'string', 'description' => '<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?><wp:Notification xmlns:wp=\\"WPNotification\\"><wp:Tile><wp:Count>ENTER COUNT</wp:Count><wp:Title>ENTER YOUR MESSAGE</wp:Title></wp:Tile></wp:Notification>'], 'WNS' => ['type' => 'string', 'description' => '<badge version=\\"1\\" value=\\"23\\"/>']]], 'MessageAttributeData' => ['id' => 'MessageAttributeData', 'properties' => ['DataType' => ['type' => 'string', 'description' => 'Amazon SNS supports the following logical data types: String, Number, and Binary.', 'required' => true], 'StringValue' => ['type' => 'string', 'description' => 'Strings are Unicode with UTF8 binary encoding.'], 'BinaryValue' => ['type' => 'string', 'description' => 'Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.']]], 'MessageAttribute' => ['id' => 'MessageAttribute', 'properties' => ['_user_defined_name_' => ['type' => 'MessageAttributeData', 'description' => 'The name of the message attribute as defined by the user or specified platform.']]], 'SimplePublishRequest' => ['id' => 'SimplePublishRequest', 'properties' => ['Topic' => ['type' => 'string', 'description' => 'The simple name or ARN of the topic you want to publish to. Required if endpoint not given.'], 'Endpoint' => ['type' => 'string', 'description' => 'The simple name or ARN of the endpoint you want to publish to. Required if topic not given.'], 'Message' => ['type' => 'string', 'description' => 'The message you want to send to the topic, sends the same message to all transport protocols. '], 'Subject' => ['type' => 'string', 'description' => 'Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.'], 'MessageAttributes' => ['type' => 'MessageAttribute', 'description' => 'An associative array of string-data pairs containing user-specified message attributes.']]], 'PublishRequest' => ['id' => 'PublishRequest', 'properties' => ['Topic' => ['type' => 'string', 'description' => 'The simple name or ARN of the topic you want to publish to. Required if endpoint not given.'], 'Endpoint' => ['type' => 'string', 'description' => 'The simple name or ARN of the endpoint you want to publish to. Required if topic not given.'], 'Message' => ['type' => 'TopicMessage', 'description' => 'The message you want to send to the topic. The \'default\' field is required.', 'required' => true], 'Subject' => ['type' => 'string', 'description' => 'Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.'], 'MessageStructure' => ['type' => 'string', 'description' => 'Set MessageStructure to "json".', 'default' => 'json'], 'MessageAttributes' => ['type' => 'MessageAttribute', 'description' => 'An associative array of string-data pairs containing user-specified message attributes.']]], 'SimplePublishTopicRequest' => ['id' => 'SimplePublishTopicRequest', 'properties' => ['Message' => ['type' => 'string', 'description' => 'The message you want to send to the topic, sends the same message to all transport protocols.'], 'Subject' => ['type' => 'string', 'description' => 'Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.'], 'MessageAttributes' => ['type' => 'MessageAttribute', 'description' => 'An associative array of string-data pairs containing user-specified message attributes.']]], 'PublishTopicRequest' => ['id' => 'PublishTopicRequest', 'properties' => ['Message' => ['type' => 'TopicMessage', 'description' => 'The message you want to send to the topic. The \'default\' field is required.', 'required' => true], 'Subject' => ['type' => 'string', 'description' => 'Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.'], 'MessageStructure' => ['type' => 'string', 'description' => 'Set MessageStructure to "json".', 'default' => 'json'], 'MessageAttributes' => ['type' => 'MessageAttribute', 'description' => 'An associative array of string-data pairs containing user-specified message attributes.']]], 'SimplePublishEndpointRequest' => ['id' => 'SimplePublishEndpointRequest', 'properties' => ['Message' => ['type' => 'string', 'description' => 'The message you want to send to the topic, sends the same message to all transport protocols.'], 'Subject' => ['type' => 'string', 'description' => 'Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.'], 'MessageAttributes' => ['type' => 'MessageAttribute', 'description' => 'An associative array of string-data pairs containing user-specified message attributes.']]], 'PublishEndpointRequest' => ['id' => 'PublishEndpointRequest', 'properties' => ['Message' => ['type' => 'TopicMessage', 'description' => 'The message you want to send to the topic. The \'default\' field is required.', 'required' => true], 'Subject' => ['type' => 'string', 'description' => 'Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.'], 'MessageStructure' => ['type' => 'string', 'description' => 'Set MessageStructure to "json".', 'default' => 'json'], 'MessageAttributes' => ['type' => 'MessageAttribute', 'description' => 'An associative array of string-data pairs containing user-specified message attributes.']]], 'PublishResponse' => ['id' => 'PublishResponse', 'properties' => ['MessageId' => ['type' => 'string', 'description' => 'Unique identifier assigned to the published message.']]]];
     $base['apis'] = array_merge($base['apis'], $apis);
     $base['models'] = array_merge($base['models'], $models);
     return $base;
 }
Exemple #6
0
 public function getApiDocInfo()
 {
     $base = parent::getApiDocInfo();
     $base['apis'] = [['path' => '/' . $this->name, 'operations' => [['method' => 'POST', 'summary' => 'sendEmail() - Send an email created from posted data and/or a template.', 'nickname' => 'sendEmail', 'type' => 'EmailResponse', 'event_name' => 'email.sent', 'parameters' => [['name' => 'template', 'description' => 'Optional template name to base email on.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'query', 'required' => false], ['name' => 'template_id', 'description' => 'Optional template id to base email on.', 'allowMultiple' => false, 'type' => 'integer', 'format' => 'int32', 'paramType' => 'query', 'required' => false], ['name' => 'data', 'description' => 'Data containing name-value pairs used for provisioning emails.', 'allowMultiple' => false, 'type' => 'EmailRequest', 'paramType' => 'body', 'required' => false]], 'responseMessages' => ApiDocUtilities::getCommonResponses(), 'notes' => 'If a template is not used with all required fields, then they must be included in the request. ' . 'If the \'from\' address is not provisioned in the service, then it must be included in the request.']], 'description' => 'Operations on a email service.']];
     $models = ['EmailResponse' => ['id' => 'EmailResponse', 'properties' => ['count' => ['type' => 'integer', 'format' => 'int32', 'description' => 'Number of emails successfully sent.']]], 'EmailRequest' => ['id' => 'EmailRequest', 'properties' => ['template' => ['type' => 'string', 'description' => 'Email Template name to base email on.'], 'template_id' => ['type' => 'integer', 'format' => 'int32', 'description' => 'Email Template id to base email on.'], 'to' => ['type' => 'Array', 'description' => 'Required single or multiple receiver addresses.', 'items' => ['$ref' => 'EmailAddress']], 'cc' => ['type' => 'Array', 'description' => 'Optional CC receiver addresses.', 'items' => ['$ref' => 'EmailAddress']], 'bcc' => ['type' => 'Array', 'description' => 'Optional BCC receiver addresses.', 'items' => ['$ref' => 'EmailAddress']], 'subject' => ['type' => 'string', 'description' => 'Text only subject line.'], 'body_text' => ['type' => 'string', 'description' => 'Text only version of the body.'], 'body_html' => ['type' => 'string', 'description' => 'Escaped HTML version of the body.'], 'from_name' => ['type' => 'string', 'description' => 'Required sender name.'], 'from_email' => ['type' => 'string', 'description' => 'Required sender email.'], 'reply_to_name' => ['type' => 'string', 'description' => 'Optional reply to name.'], 'reply_to_email' => ['type' => 'string', 'description' => 'Optional reply to email.']]], 'EmailAddress' => ['id' => 'EmailAddress', 'properties' => ['name' => ['type' => 'string', 'description' => 'Optional name displayed along with the email address.'], 'email' => ['type' => 'string', 'description' => 'Required email address.']]]];
     $base['models'] = array_merge($base['models'], $models);
     return $base;
 }
Exemple #7
0
 public function getApiDocInfo()
 {
     $path = '/' . $this->name;
     $eventPath = $this->name;
     $commonResponses = ApiDocUtilities::getCommonResponses();
     $base = parent::getApiDocInfo();
     $base['apis'] = [['path' => $path, 'description' => 'Operations available for File Storage Service.', 'operations' => [['method' => 'GET', 'summary' => 'getResourceList() - List all resource names.', 'nickname' => 'getResourceList', 'notes' => 'Return only a list of the resource identifiers.', 'type' => 'ResourceList', 'event_name' => [$this->name . '.list'], 'parameters' => [ApiOptions::documentOption(ApiOptions::AS_LIST, true, true), ApiOptions::documentOption(ApiOptions::AS_ACCESS_LIST), ApiOptions::documentOption(ApiOptions::ID_FIELD), ApiOptions::documentOption(ApiOptions::ID_TYPE), ApiOptions::documentOption(ApiOptions::REFRESH)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'GET', 'summary' => 'getResources() - List all resources.', 'nickname' => 'getResources', 'type' => 'ResourceList', 'event_name' => [$eventPath . '.list'], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'List the resources (folders and files) available in this storage. ', 'parameters' => [['name' => 'include_folders', 'description' => 'Include folders in the returned listing.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => true], ['name' => 'include_files', 'description' => 'Include files in the returned listing.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => true], ['name' => 'full_tree', 'description' => 'List the contents of all sub-folders as well.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false], ['name' => 'zip', 'description' => 'Return the content of the path as a zip file.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false]]]]], ['path' => $path . '/{folder_path}/', 'operations' => [['method' => 'GET', 'summary' => 'getFolder() - List the folder\'s content, including properties.', 'nickname' => 'getFolder', 'type' => 'FolderResponse', 'event_name' => [$eventPath . '.{folder_path}.describe'], 'parameters' => [['name' => 'folder_path', 'description' => 'The path of the folder you want to retrieve. This can be a sub-folder, with each level separated by a \'/\'', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'include_properties', 'description' => 'Return any properties of the folder in the response.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false], ['name' => 'include_folders', 'description' => 'Include folders in the returned listing.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => true], ['name' => 'include_files', 'description' => 'Include files in the returned listing.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => true], ['name' => 'full_tree', 'description' => 'List the contents of all sub-folders as well.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false], ['name' => 'zip', 'description' => 'Return the content of the folder as a zip file.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Use \'include_properties\' to get properties of the folder. ' . 'Use the \'include_folders\' and/or \'include_files\' to modify the listing.'], ['method' => 'GET', 'summary' => 'getFolderProperties() - List the folder\'s properties.', 'nickname' => 'getFolderProperties', 'type' => 'Folder', 'event_name' => [$eventPath . '.{folder_path}.describe'], 'parameters' => [['name' => 'folder_path', 'description' => 'The path of the folder you want to retrieve. This can be a sub-folder, with each level separated by a \'/\'', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'include_properties', 'description' => 'Return any properties of the folder in the response.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => true, 'defaultValue' => true]], 'responseMessages' => $commonResponses, 'notes' => 'Use \'include_properties\' to get properties of the folder.'], ['method' => 'POST', 'summary' => 'createFolder() - Create a folder and/or add content.', 'nickname' => 'createFolder', 'type' => 'FolderResponse', 'event_name' => [$eventPath . '.{folder_path}.create', $eventPath . '.folder_created'], 'parameters' => [['name' => 'folder_path', 'description' => 'The path of the folder where you want to put the contents. This can be a sub-folder, with each level separated by a \'/\'', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of folders and/or files.', 'allowMultiple' => false, 'type' => 'FolderRequest', 'paramType' => 'body', 'required' => false], ['name' => 'url', 'description' => 'The full URL of the file to upload.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'query', 'required' => false], ['name' => 'extract', 'description' => 'Extract an uploaded zip file into the folder.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false], ['name' => 'clean', 'description' => 'Option when \'extract\' is true, clean the current folder before extracting files and folders.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false], ['name' => 'check_exist', 'description' => 'If true, the request fails when the file or folder to create already exists.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false], ['name' => 'X-HTTP-METHOD', 'description' => 'Override request using POST to tunnel other http request, such as DELETE.', 'enum' => ['GET', 'PUT', 'PATCH', 'DELETE'], 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'header', 'required' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Post data as an array of folders and/or files. Folders are created if they do not exist'], ['method' => 'PATCH', 'summary' => 'updateFolderProperties() - Update folder properties.', 'nickname' => 'updateFolderProperties', 'type' => 'Folder', 'event_name' => [$eventPath . '.{folder_path}.update', $eventPath . '.folder_updated'], 'parameters' => [['name' => 'folder_path', 'description' => 'The path of the folder you want to update. This can be a sub-folder, with each level separated by a \'/\'', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Array of folder properties.', 'allowMultiple' => false, 'type' => 'Folder', 'paramType' => 'body', 'required' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Post body as an array of folder properties.'], ['method' => 'DELETE', 'summary' => 'deleteFolder() - Delete one folder and/or its contents.', 'nickname' => 'deleteFolder', 'type' => 'FolderResponse', 'event_name' => [$eventPath . '.{folder_path}.delete', $eventPath . '.folder_deleted'], 'parameters' => [['name' => 'folder_path', 'description' => 'The path of the folder where you want to delete contents. This can be a sub-folder, with each level separated by a \'/\'', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'force', 'description' => 'Set to true to force delete on a non-empty folder.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false], ['name' => 'content_only', 'description' => 'Set to true to only delete the content of the folder.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Set \'content_only\' to true to delete the sub-folders and files contained, but not the folder. ' . 'Set \'force\' to true to delete a non-empty folder. ' . 'Alternatively, to delete by a listing of sub-folders and files, ' . 'use the POST request with X-HTTP-METHOD = DELETE header and post listing.']], 'description' => 'Operations on folders.'], ['path' => $path . '/{file_path}', 'operations' => [['method' => 'GET', 'summary' => 'getFile() - Download the file contents and/or its properties.', 'nickname' => 'getFile', 'type' => 'FileResponse', 'event_name' => [$eventPath . '.{file_path}.download', $eventPath . '.file_downloaded'], 'parameters' => [['name' => 'file_path', 'description' => 'Path and name of the file to retrieve.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'download', 'description' => 'Prompt the user to download the file from the browser.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false]], 'responseMessages' => $commonResponses, 'notes' => 'By default, the file is streamed to the browser. ' . 'Use the \'download\' parameter to prompt for download.'], ['method' => 'GET', 'summary' => 'getFileProperties() - Download the file properties.', 'nickname' => 'getFileProperties', 'type' => 'File', 'event_name' => [$eventPath . '.{file_path}.describe', $eventPath . '.file_described'], 'parameters' => [['name' => 'file_path', 'description' => 'Path and name of the file to retrieve.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'include_properties', 'description' => 'Return properties of the file.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false], ['name' => 'content', 'description' => 'Return the content as base64 of the file, only applies when \'include_properties\' is true.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'defaultValue' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Use the \'include_properties\' parameter (optionally add \'content\' to include base64 content) to list properties of the file.'], ['method' => 'POST', 'summary' => 'createFile() - Create a new file.', 'nickname' => 'createFile', 'type' => 'FileResponse', 'event_name' => [$eventPath . '.{file_path}.create', $eventPath . '.file_created'], 'parameters' => [['name' => 'file_path', 'description' => 'Path and name of the file to create.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'check_exist', 'description' => 'If true, the request fails when the file to create already exists.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false], ['name' => 'body', 'description' => 'Content and/or properties of the file.', 'allowMultiple' => false, 'type' => 'FileRequest', 'paramType' => 'body', 'required' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Post body should be the contents of the file or an object with file properties.'], ['method' => 'PUT', 'summary' => 'replaceFile() - Update content of the file.', 'nickname' => 'replaceFile', 'type' => 'FileResponse', 'event_name' => [$eventPath . '.{file_path}.update', $eventPath . '.file_updated'], 'parameters' => [['name' => 'file_path', 'description' => 'Path and name of the file to update.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'The content of the file.', 'allowMultiple' => false, 'type' => 'FileRequest', 'paramType' => 'body', 'required' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Post body should be the contents of the file.'], ['method' => 'PATCH', 'summary' => 'updateFileProperties() - Update properties of the file.', 'nickname' => 'updateFileProperties', 'type' => 'File', 'event_name' => [$eventPath . '.{file_path}.update', $eventPath . '.file_updated'], 'parameters' => [['name' => 'file_path', 'description' => 'Path and name of the file to update.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Properties of the file.', 'allowMultiple' => false, 'type' => 'File', 'paramType' => 'body', 'required' => false]], 'responseMessages' => $commonResponses, 'notes' => 'Post body should be an array of file properties.'], ['method' => 'DELETE', 'summary' => 'deleteFile() - Delete one file.', 'nickname' => 'deleteFile', 'type' => 'FileResponse', 'event_name' => [$eventPath . '.{file_path}.delete', $eventPath . '.file_deleted'], 'parameters' => [['name' => 'file_path', 'description' => 'Path and name of the file to delete.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true]], 'responseMessages' => $commonResponses, 'notes' => 'Careful, this removes the given file from the storage.']], 'description' => 'Operations on individual files.']];
     $commonFolder = ['name' => ['type' => 'string', 'description' => 'Identifier/Name for the folder, localized to requested resource.'], 'path' => ['type' => 'string', 'description' => 'Full path of the folder, from the service root.'], 'metadata' => ['type' => 'array', 'description' => 'An array of name-value pairs.', 'items' => ['type' => 'string']]];
     $commonFile = ['name' => ['type' => 'string', 'description' => 'Identifier/Name for the file, localized to requested resource.'], 'path' => ['type' => 'string', 'description' => 'Full path of the file, from the service root.'], 'content_type' => ['type' => 'string', 'description' => 'The media type of the content of the file.'], 'metadata' => ['type' => 'array', 'description' => 'An array of name-value pairs.', 'items' => ['type' => 'string']]];
     $models = ['FileRequest' => ['id' => 'FileRequest', 'properties' => $commonFile], 'FileResponse' => ['id' => 'FileResponse', 'properties' => array_merge($commonFile, ['content_length' => ['type' => 'string', 'description' => 'Size of the file in bytes.'], 'last_modified' => ['type' => 'string', 'description' => 'A GMT date timestamp of when the file was last modified.']])], 'FolderRequest' => ['id' => 'FolderRequest', 'properties' => array_merge($commonFolder, ['resource' => ['type' => 'array', 'description' => 'An array of resources to operate on.', 'items' => ['$ref' => 'ResourceRequest']]])], 'FolderResponse' => ['id' => 'FolderResponse', 'properties' => array_merge($commonFolder, ['last_modified' => ['type' => 'string', 'description' => 'A GMT date timestamp of when the file was last modified.'], 'resources' => ['type' => 'array', 'description' => 'An array of contained resources.', 'items' => ['$ref' => 'FolderResponse']]])], 'File' => ['id' => 'File', 'properties' => $commonFile], 'Folder' => ['id' => 'Folder', 'properties' => $commonFolder]];
     $base['models'] = array_merge($base['models'], $models);
     return $base;
 }
Exemple #8
0
 /**
  * A chance to pre-process the data.
  *
  * @return mixed|void
  */
 protected function preProcess()
 {
     parent::preProcess();
     $this->checkPermission($this->getRequestedAction(), $this->name);
     //  set outbound parameters
     $this->buildParameterString($this->parameters, $this->action, $this->query, $this->cacheQuery, $this->request->getParameters());
     //	set outbound headers
     $this->addHeaders($this->headers, $this->action, $this->curlOptions);
 }