Ejemplo n.º 1
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.º 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 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.º 3
0
 public function getPlural()
 {
     return empty($this->plural) ? Inflector::pluralize($this->getLabel()) : $this->plural;
 }
Ejemplo n.º 4
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.º 5
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.º 6
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()];
 }