Commit e83a94b38a005a909037eeb6ba11fc233313aa7e

Authored by Alex Savenko
1 parent 3ff40ec8

docs + ap

app/library/App/Collections/ExportCollection.php
... ... @@ -10,16 +10,11 @@ class ExportCollection extends ApiCollection
10 10 {
11 11 protected function initialize()
12 12 {
13   -// $this
14   -// ->name('Export')
15   -// ->handler(ExportController::class)
16   -//
17   -// ->endpoint(ApiEndpoint::get('/documentation.json', 'documentation'))
18   -// ->endpoint(ApiEndpoint::get('/postman.json', 'postman'));
19 13  
20 14 $this->name('Export');
21 15 $this->handler(ExportController::class);
22 16 $this->endpoint(ApiEndpoint::get('/documentation.json', 'documentation'));
23 17 $this->endpoint(ApiEndpoint::get('/postman.json', 'postman'));
  18 +
24 19 }
25 20 }
... ...
app/library/App/Controllers/AllPositionController.php
... ... @@ -41,6 +41,16 @@ class AllPositionController extends CrudResourceController
41 41  
42 42 }
43 43  
  44 + public function projectsGroupAction() {
  45 +
  46 + $APObj = new Client(self::API_KEY);
  47 +
  48 + $projects_group = $APObj->getProjectsGroup();
  49 +
  50 + return $projects_group;
  51 +
  52 + }
  53 +
44 54 public function queriesAction() {
45 55  
46 56 /** user params **/
... ... @@ -54,6 +64,19 @@ class AllPositionController extends CrudResourceController
54 64  
55 65 }
56 66  
  67 + public function queriesGroupAction() {
  68 +
  69 + /** user params **/
  70 + $project = $this->request->get('project') ?? 418068;
  71 +
  72 + $APObj = new Client(self::API_KEY);
  73 +
  74 + $queries_group = $APObj->getQueriesGroup($project);
  75 +
  76 + return $queries_group;
  77 +
  78 + }
  79 +
57 80 public function reportAction() {
58 81  
59 82 /** user params **/
... ...
app/library/App/Resources/AllPositionResource.php
... ... @@ -11,6 +11,8 @@ namespace App\Resources;
11 11  
12 12 use App\Constants\AclRoles;
13 13 use App\Controllers\AllPositionController;
  14 +use Phalcon\Acl;
  15 +use PhalconApi\Constants\HttpMethods;
14 16 use PhalconRest\Api\ApiEndpoint;
15 17 use PhalconRest\Api\ApiResource;
16 18  
... ... @@ -28,29 +30,53 @@ class AllPositionResource extends ApiResource
28 30 ->deny(AclRoles::UNAUTHORIZED)
29 31 ->handler(AllPositionController::class)
30 32  
31   - ->endpoint(ApiEndpoint::get('/project', 'projectAction')
32   - ->allow(AclRoles::USER)
  33 + ->endpoint(
  34 + ApiEndpoint::factory('/project', HttpMethods::GET, 'projectAction')
  35 + ->name('project')
33 36 ->description('Данные о проекте')
  37 + ->allow(AclRoles::USER)
34 38 )
35 39  
36   - ->endpoint(ApiEndpoint::get('/projects', 'projectsAction')
37   - ->allow(AclRoles::USER)
  40 + ->endpoint(
  41 + ApiEndpoint::factory('/projects', HttpMethods::GET, 'projectsAction')
  42 + ->name('projects')
38 43 ->description('Список проектов пользователя')
  44 + ->allow(AclRoles::UNAUTHORIZED)
39 45 )
40 46  
41   - ->endpoint(ApiEndpoint::get('/queries', 'queriesAction')
  47 + ->endpoint(
  48 + ApiEndpoint::factory('/projects_group', HttpMethods::GET, 'projectsGroupAction')
  49 + ->name('projects group')
  50 + ->description('Список групп проектов')
42 51 ->allow(AclRoles::USER)
43   - ->description('Список запросов, по которым определяется позиция сайта')
44 52 )
45 53  
46   - ->endpoint(ApiEndpoint::get('/report', 'reportAction')
  54 + ->endpoint(
  55 + ApiEndpoint::factory('/queries', HttpMethods::GET, 'queriesAction')
  56 + ->name('queries')
  57 + ->description('Список запросов, по которым определяется позиция сайта')
47 58 ->allow(AclRoles::USER)
48   - ->description('Отчет по позициям сайта')
49 59 )
50 60  
51   - ->endpoint(ApiEndpoint::get('/visibility', 'visibilityAction')
  61 + ->endpoint(
  62 + ApiEndpoint::factory('/queries_group', HttpMethods::GET, 'queriesGroupAction')
  63 + ->name('queries group')
  64 + ->description('Список групп запросов')
  65 + ->allow(AclRoles::USER)
  66 + )
  67 +
  68 + ->endpoint(
  69 + ApiEndpoint::factory('/report', HttpMethods::GET, 'reportAction')
  70 + ->name('report')
  71 + ->description('Отчет по позициям сайта')
52 72 ->allow(AclRoles::USER)
  73 + )
  74 +
  75 + ->endpoint(
  76 + ApiEndpoint::factory('/visibility', HttpMethods::GET, 'visibilityAction')
  77 + ->name('visibility')
53 78 ->description('Данные о видимости сайта за указанный период')
  79 + ->allow(AclRoles::USER)
54 80 )
55 81 ;
56 82  
... ...