Ejemplo n.º 1
0
 public function getApiDocInfo()
 {
     $base = parent::getApiDocInfo();
     $name = Inflector::camelize($this->name);
     $lower = Inflector::camelize($this->name, null, false, true);
     $commonProperties = ['id' => ['type' => 'integer', 'format' => 'int32', 'description' => 'Identifier of this ' . $lower . '.'], 'name' => ['type' => 'string', 'description' => 'Displayable name of this ' . $lower . '.'], 'description' => ['type' => 'string', 'description' => 'Description of this ' . $lower . '.'], 'to' => ['type' => 'array', 'description' => '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' => ['type' => 'EmailAddress', 'description' => 'Required sender name and email.'], 'reply_to' => ['type' => 'EmailAddress', 'description' => 'Optional reply to name and email.'], 'defaults' => ['type' => 'array', 'description' => 'Array of default name value pairs for template replacement.', 'items' => ['type' => 'string']]];
     $stampProperties = ['created_date' => ['type' => 'string', 'description' => 'Date this record was created.', 'readOnly' => true], 'last_modified_date' => ['type' => 'string', 'description' => 'Date this record was last modified.', 'readOnly' => true]];
     $models = [$name . 'Request' => ['id' => $name . 'Request', 'properties' => $commonProperties], $name . 'Response' => ['id' => $name . 'Response', 'properties' => array_merge($commonProperties, $stampProperties)], '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;
 }
Ejemplo n.º 2
0
 public function getApiDocInfo()
 {
     $path = '/' . $this->getServiceName() . '/' . $this->getFullPathName();
     $eventPath = $this->getServiceName() . '.' . $this->getFullPathName('.');
     $name = Inflector::camelize($this->name);
     $plural = Inflector::pluralize($name);
     $words = str_replace('_', ' ', $this->name);
     $pluralWords = Inflector::pluralize($words);
     $wrapper = ResourcesWrapper::getWrapper();
     $apis = [['path' => $path, 'description' => "Operations for {$words} administration.", 'operations' => [['method' => 'GET', 'summary' => 'get' . $plural . '() - Retrieve one or more ' . $pluralWords . '.', 'nickname' => 'get' . $plural, 'type' => $plural . 'Response', 'event_name' => [$eventPath . '.list'], 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [ApiOptions::documentOption(ApiOptions::FIELDS)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'List Active Directory ' . strtolower($pluralWords)]]], ['path' => $path . '/{' . strtolower($name) . '_name}', 'operations' => [['method' => 'GET', 'summary' => 'get' . $name . '() - Retrieve one ' . $words . '.', 'nickname' => 'get' . $name, 'type' => $name . 'Response', 'event_name' => $eventPath . '.read', 'parameters' => [['name' => strtolower($name) . '_name', 'description' => 'Identifier of the record to retrieve.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ApiOptions::documentOption(ApiOptions::FIELDS)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Use the \'fields\' parameter to limit properties that are returned. By default, all fields are returned.']], 'description' => "Operations for individual {$words} administration."]];
     $models = [$plural . 'Response' => ['id' => $plural . 'Response', 'properties' => [$wrapper => ['type' => 'array', 'description' => 'Array of records.', 'items' => ['$ref' => $name . 'Response']]]], $name . 'Response' => ['id' => $name . 'Response', 'properties' => ['objectclass' => ['type' => 'array', 'description' => 'This property identifies the class of which the object is an instance, as well as all structural or abstract superclasses from which that class is derived.'], 'cn' => ['type' => 'string', 'description' => 'Common name of the object'], 'dn' => ['type' => 'string', 'description' => 'Distinguished name of the object'], 'distinguishedname' => ['type' => 'string', 'description' => 'Distinguished name of the object'], 'whencreated' => ['type' => 'string', 'description' => 'Date/Time when object was created'], 'whenchanged' => ['type' => 'string', 'description' => 'Date/Time when object was changed'], 'objectcategory' => ['type' => 'string', 'description' => 'Shows objectCagetory attribute.']]]];
     return ['apis' => $apis, 'models' => $models];
 }
Ejemplo n.º 3
0
 public function getApiDocInfo()
 {
     $path = '/' . $this->getServiceName() . '/' . $this->getFullPathName();
     $eventPath = $this->getServiceName() . '.' . $this->getFullPathName('.');
     $name = Inflector::camelize($this->name);
     $plural = Inflector::pluralize($name);
     $words = str_replace('_', ' ', $this->name);
     $pluralWords = Inflector::pluralize($words);
     $wrapper = ResourcesWrapper::getWrapper();
     $apis = [['path' => $path, 'description' => "Operations for retrieving system environment.", 'operations' => [['method' => 'GET', 'summary' => 'getEnvironment() - Retrieve system environment.', 'nickname' => 'getEnvironment', 'type' => 'EnvironmentResponse', 'event_name' => $eventPath . '.list', 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [], 'responseMessages' => [], 'notes' => 'Minimum environment information given without a valid user session.' . ' More information given based on user privileges.']]]];
     $models = ['EnvironmentResponse' => ['id' => 'EnvironmentResponse', 'properties' => ['platform' => ['type' => 'array', 'description' => 'Array of system records.', 'items' => ['$ref' => $name . 'Response']], 'authentication' => ['type' => 'Metadata', 'description' => 'Array of metadata returned for GET requests.'], 'app_group' => ['type' => 'array', 'description' => 'Array of system records.', 'items' => ['$ref' => $name . 'Response']], 'no_app_group' => ['type' => 'array', 'description' => 'Array of system records.', 'items' => ['$ref' => $name . 'Response']], 'config' => ['type' => 'Metadata', 'description' => 'Array of metadata returned for GET requests.'], 'server' => ['type' => 'Metadata', 'description' => 'Array of metadata returned for GET requests.']]]];
     return ['apis' => $apis, 'models' => $models];
 }
Ejemplo n.º 4
0
 /**
  * @return array
  */
 public function getApiDocInfo()
 {
     $path = '/' . $this->getServiceName() . '/' . $this->getFullPathName();
     $eventPath = $this->getServiceName() . '.' . $this->getFullPathName('.');
     $name = Inflector::camelize($this->name);
     // use the cached copy, don't try to create it here, infinite loop!
     $results = \Cache::get(static::EVENT_CACHE_KEY, []);
     $allEvents = [];
     foreach ($results as $services) {
         foreach ($services as $apis) {
             foreach ($apis as $operations) {
                 foreach ($operations['verb'] as $events) {
                     foreach ($events as $event) {
                         $allEvents[] = $event;
                     }
                 }
             }
         }
     }
     $apis = [['path' => $path, 'operations' => [['method' => 'GET', 'summary' => 'getEventList() - Retrieve list of events.', 'nickname' => 'getEventList', 'notes' => 'A list of event names are returned.<br>' . 'The list can be limited by service and/or by type.', 'type' => 'ResourceList', 'event_name' => $eventPath . '.list', 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [ApiOptions::documentOption(ApiOptions::AS_LIST, true, true), ['name' => 'service', 'description' => 'Get the events for only this service.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'query', 'required' => false], ['name' => 'type', 'description' => 'Get the events for only this type - process or broadcast.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'query', 'required' => false, 'enum' => ['process', 'broadcast']], ['name' => 'only_scripted', 'description' => 'Get only the events that have associated scripts.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'default' => false]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'GET', 'summary' => 'getEventMap() - Retrieve full map of events.', 'nickname' => 'getEventMap', 'notes' => 'This returns a service to verb to event mapping.<br>' . 'The list can be limited by service and/or by type.', 'type' => 'EventMap', 'event_name' => $eventPath . '.list', 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [['name' => 'service', 'description' => 'Get the events for only this service.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'query', 'required' => false], ['name' => 'type', 'description' => 'Get the events for only this type - process or broadcast.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'query', 'required' => false, 'enum' => ['process', 'broadcast']], ['name' => 'only_scripted', 'description' => 'Get only the events that have associated scripts.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'default' => false]], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]], 'description' => 'Operations for retrieving events.'], ['path' => $path . '/{event_name}', 'operations' => [['method' => 'GET', 'summary' => 'getEventScript() - Retrieve the script for an event.', 'nickname' => 'getEventScript', 'notes' => 'Use the \'fields\' and \'related\' parameters to limit properties returned for each record. ' . 'By default, all fields and no relations are returned for each record.', 'type' => 'EventScriptResponse', 'event_name' => $eventPath . '.{event_name}.read', 'parameters' => [['name' => 'event_name', 'description' => 'Identifier of the event to retrieve.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true, 'enum' => $allEvents], ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED), ApiOptions::documentOption(ApiOptions::INCLUDE_SCHEMA), ApiOptions::documentOption(ApiOptions::FILE)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'POST', 'summary' => 'createEventScript() - Create a script for an event.', 'nickname' => 'createEventScript', 'notes' => 'Post data should be a single record containing required fields for a script. ' . 'By default, only the event name of the record affected is returned on success, ' . 'use \'fields\' and \'related\' to return more info.', 'type' => 'EventScriptResponse', 'event_name' => $eventPath . '.{event_name}.create', 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [['name' => 'event_name', 'description' => 'Identifier of the event to retrieve.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true, 'enum' => $allEvents], ['name' => 'body', 'description' => 'Data containing name-value pairs of records to create.', 'allowMultiple' => false, 'type' => 'EventScriptRequest', 'paramType' => 'body', 'required' => true], ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'DELETE', 'summary' => 'delete' . $name . 'EventScript() - Delete an event scripts.', 'nickname' => 'delete' . $name . 'EventScript', 'notes' => 'By default, only the event name of the record deleted is returned on success. ' . 'Use \'fields\' and \'related\' to return more properties of the deleted record.', 'type' => 'EventScriptResponse', 'event_name' => $eventPath . '.{event_name}.delete', 'parameters' => [['name' => 'event_name', 'description' => 'Identifier of the event to retrieve.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true, 'enum' => $allEvents], ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]], 'description' => 'Operations for scripts on individual events.']];
     $models = [];
     $model = new EventScript();
     $temp = $model->toApiDocsModel('EventScript');
     if ($temp) {
         $models = array_merge($models, $temp);
     }
     return ['apis' => $apis, 'models' => $models];
 }
Ejemplo n.º 5
0
 public function getLabel()
 {
     return empty($this->label) ? Inflector::camelize($this->getName(true), '_', true) : $this->label;
 }
Ejemplo n.º 6
0
 public function getApiDocInfo()
 {
     $path = '/' . $this->name;
     $eventPath = $this->name;
     $name = Inflector::camelize($this->name);
     $plural = Inflector::pluralize($name);
     return ['resourcePath' => $path, 'produces' => ['application/json', 'application/xml'], 'consumes' => ['application/json', 'application/xml'], 'apis' => [['path' => $path, 'description' => "Operations available for the {$this->label} 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' => [$eventPath . '.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', 'notes' => 'List the resources available on this service. ', 'type' => $plural . 'Response', 'event_name' => [$eventPath . '.list'], 'parameters' => [ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::REFRESH)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]]], 'models' => $this->getApiDocModels()];
 }
Ejemplo n.º 7
0
 public function getLabel()
 {
     $name = str_replace('.', ' ', $this->getName(true));
     return empty($this->label) ? Inflector::camelize($name, '_', true) : $this->label;
 }
Ejemplo n.º 8
0
 public function getApiDocInfo()
 {
     $path = '/' . $this->getServiceName() . '/' . $this->getFullPathName();
     $eventPath = $this->getServiceName() . '.' . $this->getFullPathName('.');
     $name = Inflector::camelize($this->name);
     $plural = Inflector::pluralize($name);
     $words = str_replace('_', ' ', $this->name);
     $pluralWords = Inflector::pluralize($words);
     $wrapper = ResourcesWrapper::getWrapper();
     $apis = [['path' => $path, 'description' => "Operations for {$words} administration.", 'operations' => [['method' => 'GET', 'summary' => 'get' . $plural . '() - Retrieve one or more ' . $pluralWords . '.', 'nickname' => 'get' . $plural, 'type' => $plural . 'Response', 'event_name' => [$eventPath . '.list'], 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [ApiOptions::documentOption(ApiOptions::IDS), ApiOptions::documentOption(ApiOptions::FILTER), ApiOptions::documentOption(ApiOptions::LIMIT), ApiOptions::documentOption(ApiOptions::ORDER), ApiOptions::documentOption(ApiOptions::GROUP), ApiOptions::documentOption(ApiOptions::OFFSET), ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED), ApiOptions::documentOption(ApiOptions::INCLUDE_COUNT), ApiOptions::documentOption(ApiOptions::INCLUDE_SCHEMA), ApiOptions::documentOption(ApiOptions::FILE)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Use the \'ids\' or \'filter\' parameter to limit records that are returned. ' . 'By default, all records up to the maximum are returned. <br>' . 'Use the \'fields\' and \'related\' parameters to limit properties returned for each record. ' . 'By default, all fields and no relations are returned for each record. <br>' . 'Alternatively, to retrieve by record, a large list of ids, or a complicated filter, ' . 'use the POST request with X-HTTP-METHOD = GET header and post records or ids.'], ['method' => 'POST', 'summary' => 'create' . $plural . '() - Create one or more ' . $pluralWords . '.', 'nickname' => 'create' . $plural, 'type' => $plural . 'Response', 'event_name' => $eventPath . '.create', 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [['name' => 'body', 'description' => 'Data containing name-value pairs of records to create.', 'allowMultiple' => false, 'type' => $plural . 'Request', 'paramType' => 'body', 'required' => true], ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED), ['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' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be a single record or an array of records (shown). ' . 'By default, only the id property of the record affected is returned on success, ' . 'use \'fields\' and \'related\' to return more info.'], ['method' => 'PATCH', 'summary' => 'update' . $plural . '() - Update one or more ' . $pluralWords . '.', 'nickname' => 'update' . $plural, 'type' => $plural . 'Response', 'event_name' => $eventPath . '.update', 'consumes' => ['application/json', 'application/xml', 'text/csv'], 'produces' => ['application/json', 'application/xml', 'text/csv'], 'parameters' => [['name' => 'body', 'description' => 'Data containing name-value pairs of records to update.', 'allowMultiple' => false, 'type' => $plural . 'Request', 'paramType' => 'body', 'required' => true], ApiOptions::documentOption(ApiOptions::IDS), ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be a single record or an array of records (shown). ' . 'By default, only the id property of the record is returned on success, ' . 'use \'fields\' and \'related\' to return more info.'], ['method' => 'DELETE', 'summary' => 'delete' . $plural . '() - Delete one or more ' . $pluralWords . '.', 'nickname' => 'delete' . $plural, 'type' => $plural . 'Response', 'event_name' => $eventPath . '.delete', 'parameters' => [['name' => 'force', 'description' => 'Set force to true to delete all records in this table, otherwise \'ids\' parameter is required.', 'allowMultiple' => false, 'type' => 'boolean', 'paramType' => 'query', 'required' => false, 'default' => false], ApiOptions::documentOption(ApiOptions::IDS), ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'By default, only the id property of the record deleted is returned on success. ' . 'Use \'fields\' and \'related\' to return more properties of the deleted records. <br>' . 'Alternatively, to delete by record or a large list of ids, ' . 'use the POST request with X-HTTP-METHOD = DELETE header and post records or ids.']]], ['path' => $path . '/{id}', 'operations' => [['method' => 'GET', 'summary' => 'get' . $name . '() - Retrieve one ' . $words . '.', 'nickname' => 'get' . $name, 'type' => $name . 'Response', 'event_name' => $eventPath . '.read', 'parameters' => [['name' => 'id', 'description' => 'Identifier of the record to retrieve.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Use the \'fields\' and/or \'related\' parameter to limit properties that are returned. By default, all fields and no relations are returned.'], ['method' => 'PATCH', 'summary' => 'update' . $name . '() - Update one ' . $words . '.', 'nickname' => 'update' . $name, 'type' => $name . 'Response', 'event_name' => $eventPath . '.update', 'parameters' => [['name' => 'id', 'description' => 'Identifier of the record to update.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ['name' => 'body', 'description' => 'Data containing name-value pairs of fields to update.', 'allowMultiple' => false, 'type' => $name . 'Request', 'paramType' => 'body', 'required' => true], ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'Post data should be an array of fields to update for a single record. <br>' . 'By default, only the id is returned. Use the \'fields\' and/or \'related\' parameter to return more properties.'], ['method' => 'DELETE', 'summary' => 'delete' . $name . '() - Delete one ' . $words . '.', 'nickname' => 'delete' . $name, 'type' => $name . 'Response', 'event_name' => $eventPath . '.delete', 'parameters' => [['name' => 'id', 'description' => 'Identifier of the record to delete.', 'allowMultiple' => false, 'type' => 'string', 'paramType' => 'path', 'required' => true], ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::RELATED)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500]), 'notes' => 'By default, only the id is returned. Use the \'fields\' and/or \'related\' parameter to return deleted properties.']], 'description' => "Operations for individual {$words} administration."]];
     $models = [$plural . 'Request' => ['id' => $plural . 'Request', 'properties' => [$wrapper => ['type' => 'array', 'description' => 'Array of system records.', 'items' => ['$ref' => $name . 'Request']], ApiOptions::IDS => ['type' => 'array', 'description' => 'Array of system record identifiers, used for batch GET, PUT, PATCH, and DELETE.', 'items' => ['type' => 'integer', 'format' => 'int32']]]], $plural . 'Response' => ['id' => $plural . 'Response', 'properties' => [$wrapper => ['type' => 'array', 'description' => 'Array of system records.', 'items' => ['$ref' => $name . 'Response']], 'meta' => ['type' => 'Metadata', 'description' => 'Array of metadata returned for GET requests.']]], 'Metadata' => ['id' => 'Metadata', 'properties' => ['schema' => ['type' => 'array', 'description' => 'Array of table schema.', 'items' => ['type' => 'string']], 'count' => ['type' => 'integer', 'format' => 'int32', 'description' => 'Record count returned for GET requests.']]]];
     $model = $this->getModel();
     if ($model) {
         $temp = $model->toApiDocsModel($name);
         if ($temp) {
             $models = array_merge($models, $temp);
         }
     }
     return ['apis' => $apis, 'models' => $models];
 }
Ejemplo n.º 9
0
 /**
  * @param array $appInfo
  *
  * @return array
  * @throws \DreamFactory\Core\Exceptions\ForbiddenException
  * @throws \DreamFactory\Core\Exceptions\InternalServerErrorException
  * @throws \DreamFactory\Core\Exceptions\NotFoundException
  */
 private function storeApplicationFiles($appInfo)
 {
     if (ArrayUtils::get($appInfo, 'type', AppTypes::NONE) === AppTypes::STORAGE_SERVICE) {
         $appName = Inflector::camelize(ArrayUtils::get($appInfo, 'name'));
         $storageServiceId = ArrayUtils::get($appInfo, 'storage_service_id', $this->getDefaultStorageServiceId());
         $storageFolder = ArrayUtils::get($appInfo, 'storage_container', $appName);
         /** @var $service BaseFileService */
         $service = ServiceHandler::getServiceById($storageServiceId);
         if (empty($service)) {
             throw new InternalServerErrorException("App record created, but failed to import files due to unknown storage service with id '{$storageServiceId}'.");
         }
         $info = $service->extractZipFile($storageFolder, '', $this->zip);
         return $info;
     } else {
         return [];
     }
 }
Ejemplo n.º 10
0
 public function getApiDocInfo()
 {
     $path = '/' . $this->getServiceName() . '/' . $this->getFullPathName();
     $eventPath = $this->getServiceName() . '.' . $this->getFullPathName('.');
     $name = Inflector::camelize($this->name);
     $plural = Inflector::pluralize($name);
     $words = str_replace('_', ' ', $this->name);
     $pluralWords = Inflector::pluralize($words);
     return ['apis' => [['path' => $path, 'description' => "Operations for {$words} administration.", 'operations' => [['method' => 'GET', 'summary' => 'get' . $plural . 'List() - List all ' . $pluralWords . ' identifiers.', 'nickname' => 'get' . $plural . 'List', 'notes' => 'Return only a list of the resource identifiers.', 'type' => $plural . 'List', 'event_name' => [$eventPath . '.list'], 'parameters' => [ApiOptions::documentOption(ApiOptions::AS_LIST, true, true), ApiOptions::documentOption(ApiOptions::ID_FIELD), ApiOptions::documentOption(ApiOptions::ID_TYPE), ApiOptions::documentOption(ApiOptions::REFRESH)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])], ['method' => 'GET', 'summary' => 'get' . $plural . '() - List all ' . $pluralWords . '.', 'nickname' => 'get' . $plural, 'notes' => 'List the resources available on this service. ', 'type' => $plural . 'Response', 'event_name' => [$eventPath . '.list'], 'parameters' => [ApiOptions::documentOption(ApiOptions::FIELDS), ApiOptions::documentOption(ApiOptions::REFRESH)], 'responseMessages' => ApiDocUtilities::getCommonResponses([400, 401, 500])]]]], 'models' => $this->getApiDocModels()];
 }