1072 lines
47 KiB
PHP
1072 lines
47 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
$spec = [
|
|
'openapi' => '3.0.3',
|
|
|
|
'info' => [
|
|
'title' => 'Project Kiln API',
|
|
'version' => '1.0.0',
|
|
'description' => 'API documentation for Project Kiln.'
|
|
],
|
|
|
|
'servers' => [
|
|
[
|
|
'url' => '/api',
|
|
'description' => 'Local API'
|
|
]
|
|
],
|
|
|
|
'tags' => [
|
|
['name' => 'Auth'],
|
|
['name' => 'Projects'],
|
|
['name' => 'Versions'],
|
|
['name' => 'Tasks'],
|
|
['name' => 'Workflows'],
|
|
['name' => 'Admin Options']
|
|
],
|
|
|
|
'security' => [
|
|
['bearerAuth' => []]
|
|
],
|
|
|
|
'components' => [
|
|
'securitySchemes' => [
|
|
'bearerAuth' => [
|
|
'type' => 'http',
|
|
'scheme' => 'bearer',
|
|
'bearerFormat' => 'API Token'
|
|
]
|
|
],
|
|
|
|
'schemas' => [
|
|
'User' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'name' => ['type' => 'string', 'example' => 'Demo User'],
|
|
'email' => ['type' => 'string', 'example' => 'demo@example.com'],
|
|
'picture' => ['type' => 'string', 'nullable' => true],
|
|
'settings' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'theme' => [
|
|
'type' => 'string',
|
|
'enum' => ['white', 'dark', 'purple', 'green', 'beige'],
|
|
'example' => 'dark'
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
|
|
'AuthTokenResponse' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'success' => ['type' => 'boolean', 'example' => true],
|
|
'token_type' => ['type' => 'string', 'example' => 'Bearer'],
|
|
'access_token' => ['type' => 'string', 'example' => 'generated-api-token'],
|
|
'expires_in' => ['type' => 'integer', 'example' => 43200],
|
|
'user' => ['$ref' => '#/components/schemas/User']
|
|
]
|
|
],
|
|
|
|
'Project' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'string', 'example' => 'AUTH'],
|
|
'name' => ['type' => 'string', 'example' => 'Authentication System'],
|
|
'owner' => ['type' => 'integer', 'example' => 1],
|
|
'created_date' => ['type' => 'string', 'format' => 'date', 'example' => '2026-06-13']
|
|
]
|
|
],
|
|
|
|
'Version' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'name' => ['type' => 'string', 'example' => 'Version 1.0'],
|
|
'description' => ['type' => 'string', 'nullable' => true],
|
|
'created_date' => ['type' => 'string', 'format' => 'date'],
|
|
'due_date' => ['type' => 'string', 'format' => 'date', 'nullable' => true],
|
|
'released_date' => ['type' => 'string', 'format' => 'date', 'nullable' => true],
|
|
'project' => ['type' => 'string', 'example' => 'AUTH']
|
|
]
|
|
],
|
|
|
|
'Task' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'string', 'example' => 'AUTH-1'],
|
|
'title' => ['type' => 'string', 'example' => 'Build login system'],
|
|
'description' => ['type' => 'string', 'nullable' => true],
|
|
'project' => ['type' => 'string', 'example' => 'AUTH'],
|
|
'created_date' => ['type' => 'string', 'format' => 'date'],
|
|
'last_changed' => ['type' => 'string', 'format' => 'date'],
|
|
'reporter' => ['type' => 'integer'],
|
|
'assignee' => ['type' => 'integer', 'nullable' => true],
|
|
'fix_version' => ['type' => 'integer', 'nullable' => true],
|
|
'type' => ['type' => 'integer'],
|
|
'priority' => ['type' => 'integer'],
|
|
'status' => ['type' => 'integer', 'nullable' => true],
|
|
'status_state' => [
|
|
'nullable' => true,
|
|
'$ref' => '#/components/schemas/WorkflowState'
|
|
],
|
|
'status_transitions' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/WorkflowTransition']
|
|
],
|
|
'custom_fields' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/CustomTaskField']
|
|
]
|
|
]
|
|
],
|
|
|
|
'TaskListItem' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'string', 'example' => 'AUTH-1'],
|
|
'title' => ['type' => 'string', 'example' => 'Build login system'],
|
|
'type' => ['type' => 'integer', 'example' => 1],
|
|
'priority' => ['type' => 'integer', 'example' => 2],
|
|
'assignee' => ['type' => 'integer', 'nullable' => true],
|
|
'assignee_name' => ['type' => 'string', 'nullable' => true],
|
|
'assignee_picture' => ['type' => 'string', 'nullable' => true],
|
|
'status' => ['type' => 'integer', 'nullable' => true],
|
|
'status_state' => [
|
|
'nullable' => true,
|
|
'$ref' => '#/components/schemas/WorkflowState'
|
|
]
|
|
]
|
|
],
|
|
|
|
'TaskComment' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'response_to' => ['type' => 'integer', 'nullable' => true],
|
|
'task_id' => ['type' => 'string', 'example' => 'AUTH-1'],
|
|
'commenter' => ['type' => 'integer', 'example' => 1],
|
|
'comment' => ['type' => 'string', 'example' => 'Looks good to me.'],
|
|
'commenter_name' => ['type' => 'string', 'example' => 'Demo User'],
|
|
'commenter_email' => ['type' => 'string', 'example' => 'demo@example.com'],
|
|
'commenter_picture' => ['type' => 'string', 'nullable' => true]
|
|
]
|
|
],
|
|
|
|
'TaskOption' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'name' => ['type' => 'string', 'example' => 'Bug'],
|
|
'icon' => ['type' => 'string', 'nullable' => true]
|
|
]
|
|
],
|
|
|
|
'CustomTaskField' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'task_type' => ['type' => 'integer', 'example' => 1],
|
|
'name' => ['type' => 'string', 'example' => 'Story points'],
|
|
'type' => [
|
|
'type' => 'string',
|
|
'enum' => ['string', 'int', 'float', 'date', 'boolean', 'text', 'json'],
|
|
'example' => 'int'
|
|
],
|
|
'value' => ['nullable' => true],
|
|
'raw_value' => ['type' => 'string', 'example' => '3']
|
|
]
|
|
],
|
|
|
|
'Right' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'name' => ['type' => 'string', 'example' => 'Admin']
|
|
]
|
|
],
|
|
|
|
'UserRight' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'user_id' => ['type' => 'integer', 'example' => 1],
|
|
'right_id' => ['type' => 'integer', 'example' => 3]
|
|
]
|
|
],
|
|
|
|
'ProjectAccess' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'user_id' => ['type' => 'integer', 'example' => 1],
|
|
'project_id' => ['type' => 'string', 'example' => 'AUTH']
|
|
]
|
|
],
|
|
|
|
'WorkflowState' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'name' => ['type' => 'string', 'example' => 'Open'],
|
|
'color' => ['type' => 'string', 'example' => '#4ea1ff']
|
|
]
|
|
],
|
|
|
|
'WorkflowTransition' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'from_id' => ['type' => 'integer', 'example' => 1],
|
|
'to_id' => ['type' => 'integer', 'example' => 2],
|
|
'action_name' => ['type' => 'string', 'example' => 'Close task']
|
|
]
|
|
],
|
|
|
|
'WorkflowAssignment' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'integer', 'example' => 1],
|
|
'task_type' => ['type' => 'integer', 'example' => 1],
|
|
'state' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
],
|
|
|
|
'ErrorResponse' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'success' => ['type' => 'boolean', 'example' => false],
|
|
'error' => ['type' => 'string', 'example' => 'Invalid request.']
|
|
]
|
|
]
|
|
]
|
|
],
|
|
|
|
'paths' => [
|
|
'/auth.php' => [
|
|
'post' => [
|
|
'tags' => ['Auth'],
|
|
'summary' => 'Login, create token or logout',
|
|
'security' => [],
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['Login', 'CreateToken', 'Logout']
|
|
]
|
|
]
|
|
],
|
|
'requestBody' => [
|
|
'required' => false,
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'email' => ['type' => 'string', 'example' => 'demo@example.com'],
|
|
'password' => ['type' => 'string', 'example' => 'password123']
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => [
|
|
'description' => 'Successful auth response',
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => ['$ref' => '#/components/schemas/AuthTokenResponse']
|
|
]
|
|
]
|
|
],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'401' => ['description' => 'Invalid credentials or not logged in'],
|
|
'405' => ['description' => 'Invalid method']
|
|
]
|
|
],
|
|
|
|
'get' => [
|
|
'tags' => ['Auth'],
|
|
'summary' => 'Get current authenticated user',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['Me']
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Current user returned'],
|
|
'401' => ['description' => 'Not authenticated']
|
|
]
|
|
]
|
|
],
|
|
|
|
'/user.php' => [
|
|
'get' => [
|
|
'tags' => ['Auth'],
|
|
'summary' => 'List users or get one user',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['ListUsers', 'UserInfo']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'user_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => [
|
|
'description' => 'Successful response',
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'success' => ['type' => 'boolean'],
|
|
'users' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/User']
|
|
],
|
|
'user' => ['$ref' => '#/components/schemas/User']
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'404' => ['description' => 'User not found']
|
|
]
|
|
],
|
|
|
|
'post' => [
|
|
'tags' => ['Auth'],
|
|
'summary' => 'Edit current user',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['Edit']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'user_id',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
],
|
|
'requestBody' => [
|
|
'required' => true,
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'name' => ['type' => 'string', 'example' => 'Demo User'],
|
|
'email' => ['type' => 'string', 'example' => 'demo@example.com'],
|
|
'password' => ['type' => 'string', 'example' => 'new-password'],
|
|
'theme' => [
|
|
'type' => 'string',
|
|
'enum' => ['white', 'dark', 'purple', 'green', 'beige'],
|
|
'example' => 'dark'
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'multipart/form-data' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'name' => ['type' => 'string', 'example' => 'Demo User'],
|
|
'email' => ['type' => 'string', 'example' => 'demo@example.com'],
|
|
'password' => ['type' => 'string', 'example' => 'new-password'],
|
|
'theme' => [
|
|
'type' => 'string',
|
|
'enum' => ['white', 'dark', 'purple', 'green', 'beige'],
|
|
'example' => 'dark'
|
|
],
|
|
'picture' => [
|
|
'type' => 'string',
|
|
'format' => 'binary',
|
|
'description' => 'PNG, JPG, WEBP, or GIF up to 10 MB.'
|
|
],
|
|
'remove_picture' => [
|
|
'type' => 'string',
|
|
'example' => '1'
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'User edited'],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'403' => ['description' => 'Cannot edit another user']
|
|
]
|
|
]
|
|
],
|
|
|
|
'/project.php' => [
|
|
'get' => [
|
|
'tags' => ['Projects'],
|
|
'summary' => 'List projects or get project info',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['ListProjects', 'ProjectInfo']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'project_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'string', 'example' => 'AUTH']
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Successful response'],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'404' => ['description' => 'Project not found']
|
|
]
|
|
],
|
|
|
|
'post' => [
|
|
'tags' => ['Projects'],
|
|
'summary' => 'Create or edit project',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['Create', 'Edit']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'project_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'string', 'example' => 'AUTH']
|
|
]
|
|
],
|
|
'requestBody' => [
|
|
'required' => true,
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'id' => ['type' => 'string', 'example' => 'AUTH'],
|
|
'name' => ['type' => 'string', 'example' => 'Authentication System'],
|
|
'owner' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Project edited'],
|
|
'201' => ['description' => 'Project created'],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'409' => ['description' => 'Project id already exists']
|
|
]
|
|
]
|
|
],
|
|
|
|
'/version.php' => [
|
|
'get' => [
|
|
'tags' => ['Versions'],
|
|
'summary' => 'List versions or get version info',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['ListVersions', 'VersionInfo']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'project_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'string', 'example' => 'AUTH']
|
|
],
|
|
[
|
|
'name' => 'version_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Successful response'],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'404' => ['description' => 'Version not found']
|
|
]
|
|
],
|
|
|
|
'post' => [
|
|
'tags' => ['Versions'],
|
|
'summary' => 'Create or edit version',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['Create', 'Edit']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'version_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
],
|
|
'requestBody' => [
|
|
'required' => true,
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'project_id' => ['type' => 'string', 'example' => 'AUTH'],
|
|
'name' => ['type' => 'string', 'example' => 'Version 1.0'],
|
|
'description' => ['type' => 'string', 'nullable' => true],
|
|
'due_date' => ['type' => 'string', 'format' => 'date', 'nullable' => true],
|
|
'released_date' => ['type' => 'string', 'format' => 'date', 'nullable' => true]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Version edited'],
|
|
'201' => ['description' => 'Version created'],
|
|
'400' => ['description' => 'Invalid request']
|
|
]
|
|
]
|
|
],
|
|
|
|
'/workflow.php' => [
|
|
'get' => [
|
|
'tags' => ['Workflows'],
|
|
'summary' => 'Get workflow editor data',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['WorkflowData']
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Workflow data returned']
|
|
]
|
|
],
|
|
'post' => [
|
|
'tags' => ['Workflows'],
|
|
'summary' => 'Edit workflow states, transitions, and task type assignments',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => [
|
|
'CreateState',
|
|
'DeleteState',
|
|
'CreateTransition',
|
|
'DeleteTransition',
|
|
'AssignState',
|
|
'SetDefaultState',
|
|
'RemoveAssignedState'
|
|
]
|
|
]
|
|
],
|
|
[
|
|
'name' => 'state_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer']
|
|
],
|
|
[
|
|
'name' => 'transition_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer']
|
|
],
|
|
[
|
|
'name' => 'assignment_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer']
|
|
]
|
|
],
|
|
'requestBody' => [
|
|
'required' => false,
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'name' => ['type' => 'string', 'example' => 'Open'],
|
|
'color' => ['type' => 'string', 'example' => '#4ea1ff'],
|
|
'from_id' => ['type' => 'integer', 'example' => 1],
|
|
'to_id' => ['type' => 'integer', 'example' => 2],
|
|
'action_name' => ['type' => 'string', 'example' => 'Close task'],
|
|
'task_type' => ['type' => 'integer', 'example' => 1],
|
|
'state' => ['type' => 'integer', 'nullable' => true, 'example' => 1]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Workflow changed'],
|
|
'201' => ['description' => 'Workflow item created'],
|
|
'400' => ['description' => 'Invalid request']
|
|
]
|
|
]
|
|
],
|
|
|
|
'/admin_options.php' => [
|
|
'get' => [
|
|
'tags' => ['Admin Options'],
|
|
'summary' => 'Get editable task options and user rights',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['OptionsData']
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => [
|
|
'description' => 'Task options and user rights returned',
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'success' => ['type' => 'boolean'],
|
|
'options' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'types' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/TaskOption']
|
|
],
|
|
'priorities' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/TaskOption']
|
|
],
|
|
'custom_fields' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/CustomTaskField']
|
|
],
|
|
'users' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/User']
|
|
],
|
|
'rights' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/Right']
|
|
],
|
|
'user_rights' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/UserRight']
|
|
],
|
|
'projects' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/Project']
|
|
],
|
|
'user_access' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/ProjectAccess']
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'post' => [
|
|
'tags' => ['Admin Options'],
|
|
'summary' => 'Create, update, or delete task options and user rights',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => [
|
|
'CreateOption',
|
|
'UpdateOption',
|
|
'DeleteOption',
|
|
'CreateCustomField',
|
|
'UpdateCustomField',
|
|
'DeleteCustomField',
|
|
'SetUserRight',
|
|
'GrantProjectAccess',
|
|
'RevokeProjectAccess'
|
|
]
|
|
]
|
|
],
|
|
[
|
|
'name' => 'kind',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['type', 'priority']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer']
|
|
],
|
|
[
|
|
'name' => 'field_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer']
|
|
],
|
|
[
|
|
'name' => 'access_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer']
|
|
]
|
|
],
|
|
'requestBody' => [
|
|
'required' => false,
|
|
'content' => [
|
|
'multipart/form-data' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'kind' => [
|
|
'type' => 'string',
|
|
'enum' => ['type', 'priority']
|
|
],
|
|
'id' => ['type' => 'integer'],
|
|
'name' => ['type' => 'string', 'example' => 'Bug'],
|
|
'logo' => [
|
|
'type' => 'string',
|
|
'format' => 'binary'
|
|
],
|
|
'remove_logo' => ['type' => 'boolean'],
|
|
'task_type' => ['type' => 'integer', 'example' => 1],
|
|
'type' => [
|
|
'type' => 'string',
|
|
'enum' => ['string', 'int', 'float', 'date', 'boolean', 'text', 'json']
|
|
],
|
|
'value' => ['type' => 'string', 'example' => '3'],
|
|
'user_id' => ['type' => 'integer', 'example' => 1],
|
|
'right_id' => ['type' => 'integer', 'example' => 3],
|
|
'enabled' => ['type' => 'boolean', 'example' => true],
|
|
'project_id' => ['type' => 'string', 'example' => 'AUTH']
|
|
]
|
|
]
|
|
],
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'kind' => [
|
|
'type' => 'string',
|
|
'enum' => ['type', 'priority']
|
|
],
|
|
'id' => ['type' => 'integer'],
|
|
'name' => ['type' => 'string', 'example' => 'Bug'],
|
|
'remove_logo' => ['type' => 'boolean'],
|
|
'task_type' => ['type' => 'integer', 'example' => 1],
|
|
'type' => [
|
|
'type' => 'string',
|
|
'enum' => ['string', 'int', 'float', 'date', 'boolean', 'text', 'json']
|
|
],
|
|
'value' => ['type' => 'string', 'example' => '3'],
|
|
'user_id' => ['type' => 'integer', 'example' => 1],
|
|
'right_id' => ['type' => 'integer', 'example' => 3],
|
|
'enabled' => ['type' => 'boolean', 'example' => true],
|
|
'project_id' => ['type' => 'string', 'example' => 'AUTH']
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Admin option changed'],
|
|
'201' => ['description' => 'Task option created'],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'409' => ['description' => 'Task option is still in use']
|
|
]
|
|
]
|
|
],
|
|
|
|
'/task.php' => [
|
|
'get' => [
|
|
'tags' => ['Tasks'],
|
|
'summary' => 'List tasks or get task info',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => [
|
|
'TaskInfo',
|
|
'ListTasksByProject',
|
|
'ListTasksByVersion',
|
|
'ListComments',
|
|
'GetType',
|
|
'GetPriority',
|
|
'ListTypes',
|
|
'ListPriorities'
|
|
]
|
|
]
|
|
],
|
|
[
|
|
'name' => 'task_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'string', 'example' => 'AUTH-1']
|
|
],
|
|
[
|
|
'name' => 'project_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'string', 'example' => 'AUTH']
|
|
],
|
|
[
|
|
'name' => 'version_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
],
|
|
[
|
|
'name' => 'type_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
],
|
|
[
|
|
'name' => 'priority_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 2]
|
|
],
|
|
[
|
|
'name' => 'page',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
],
|
|
[
|
|
'name' => 'per_page',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'maximum' => 100, 'example' => 100]
|
|
],
|
|
[
|
|
'name' => 'sort',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['id', 'title', 'type', 'priority', 'assignee', 'status']
|
|
]
|
|
],
|
|
[
|
|
'name' => 'direction',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => ['asc', 'desc']
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => [
|
|
'description' => 'Successful response',
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'success' => ['type' => 'boolean'],
|
|
'task' => ['$ref' => '#/components/schemas/Task'],
|
|
'tasks' => [
|
|
'type' => 'array',
|
|
'items' => [
|
|
'oneOf' => [
|
|
['type' => 'string'],
|
|
['$ref' => '#/components/schemas/TaskListItem']
|
|
]
|
|
]
|
|
],
|
|
'comments' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/TaskComment']
|
|
],
|
|
'type' => ['$ref' => '#/components/schemas/TaskOption'],
|
|
'priority' => ['$ref' => '#/components/schemas/TaskOption'],
|
|
'types' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/TaskOption']
|
|
],
|
|
'priorities' => [
|
|
'type' => 'array',
|
|
'items' => ['$ref' => '#/components/schemas/TaskOption']
|
|
],
|
|
'pagination' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'page' => ['type' => 'integer'],
|
|
'per_page' => ['type' => 'integer'],
|
|
'total' => ['type' => 'integer'],
|
|
'total_pages' => ['type' => 'integer']
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'400' => ['description' => 'Invalid request'],
|
|
'404' => ['description' => 'Task not found']
|
|
]
|
|
],
|
|
|
|
'post' => [
|
|
'tags' => ['Tasks'],
|
|
'summary' => 'Create or edit task',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'api',
|
|
'in' => 'query',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'string',
|
|
'enum' => [
|
|
'Create',
|
|
'Edit',
|
|
'CreateComment',
|
|
'EditComment',
|
|
'DeleteComment',
|
|
'SetCustomFieldValue',
|
|
'TransitionStatus'
|
|
]
|
|
]
|
|
],
|
|
[
|
|
'name' => 'task_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'string', 'example' => 'AUTH-1']
|
|
],
|
|
[
|
|
'name' => 'comment_id',
|
|
'in' => 'query',
|
|
'required' => false,
|
|
'schema' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
],
|
|
'requestBody' => [
|
|
'required' => true,
|
|
'content' => [
|
|
'application/json' => [
|
|
'schema' => [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'project_id' => ['type' => 'string', 'example' => 'AUTH'],
|
|
'title' => ['type' => 'string', 'example' => 'Build login system'],
|
|
'description' => ['type' => 'string', 'nullable' => true],
|
|
'assignee' => ['type' => 'integer', 'nullable' => true],
|
|
'fix_version' => ['type' => 'integer', 'nullable' => true],
|
|
'type' => [
|
|
'type' => 'integer',
|
|
'example' => 1,
|
|
'description' => 'Must be one of ListTypes.'
|
|
],
|
|
'priority' => [
|
|
'type' => 'integer',
|
|
'example' => 2,
|
|
'description' => 'Must be one of ListPriorities.'
|
|
],
|
|
'comment' => ['type' => 'string', 'example' => 'Looks good to me.'],
|
|
'response_to' => ['type' => 'integer', 'nullable' => true],
|
|
'field_id' => ['type' => 'integer', 'example' => 1],
|
|
'value' => ['type' => 'string', 'nullable' => true],
|
|
'transition_id' => ['type' => 'integer', 'example' => 1]
|
|
]
|
|
]
|
|
]
|
|
]
|
|
],
|
|
'responses' => [
|
|
'200' => ['description' => 'Task edited'],
|
|
'201' => ['description' => 'Task created'],
|
|
'400' => ['description' => 'Invalid request']
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
|
|
echo json_encode(
|
|
$spec,
|
|
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
|
);
|