├── .DS_Store ├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── docs ├── _config.yml ├── index.md ├── rest.jpg ├── route.md └── schema.md ├── generator ├── __init__.py ├── doc.py ├── helper.py ├── helper_test.py ├── io.py ├── model.py ├── model_test.py ├── route.py ├── route_template.py └── template │ ├── __init__.py │ └── php │ ├── __init__.py │ └── template.py ├── go ├── rest │ └── .keep └── skeleton │ └── .keep ├── php ├── Dockerfile ├── README.md ├── artisan ├── composer.json ├── config │ ├── api │ │ └── user.json │ ├── cache.php │ └── database.php ├── phpunit.xml ├── public │ ├── .DS_Store │ ├── docs │ │ ├── .DS_Store │ │ ├── css │ │ │ ├── print.css │ │ │ ├── reset.css │ │ │ ├── screen.css │ │ │ ├── style.css │ │ │ └── typography.css │ │ ├── fonts │ │ │ ├── DroidSans-Bold.ttf │ │ │ └── DroidSans.ttf │ │ ├── images │ │ │ ├── collapse.gif │ │ │ ├── expand.gif │ │ │ ├── explorer_icons.png │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── favicon.ico │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ │ ├── index.html │ │ ├── lang │ │ │ ├── ca.js │ │ │ ├── el.js │ │ │ ├── en.js │ │ │ ├── es.js │ │ │ ├── fr.js │ │ │ ├── geo.js │ │ │ ├── it.js │ │ │ ├── ja.js │ │ │ ├── ko-kr.js │ │ │ ├── pl.js │ │ │ ├── pt.js │ │ │ ├── ru.js │ │ │ ├── tr.js │ │ │ ├── translator.js │ │ │ └── zh-cn.js │ │ ├── lib │ │ │ ├── backbone-min.js │ │ │ ├── es5-shim.js │ │ │ ├── handlebars-4.0.5.js │ │ │ ├── highlight.9.1.0.pack.js │ │ │ ├── highlight.9.1.0.pack_extended.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── js-yaml.min.js │ │ │ ├── jsoneditor.min.js │ │ │ ├── lodash.min.js │ │ │ ├── marked.js │ │ │ ├── object-assign-pollyfill.js │ │ │ ├── sanitize-html.min.js │ │ │ └── swagger-oauth.js │ │ ├── o2c.html │ │ └── swagger-ui.js │ └── index.php ├── reset ├── rest.json ├── route.php └── src │ ├── Bootstrap.php │ ├── Dependencies.php │ ├── Routes.php │ └── Shared │ ├── Exception │ └── UserNotFoundException.php │ └── Migration │ └── 2018_06_22_001_UserSchema.php ├── pypi ├── rest ├── rest_test.py ├── setup.py └── test /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # git rm --cached `git ls-files -i --exclude-from=.gitignore` 2 | .idea 3 | build 4 | dist 5 | rest_cli* 6 | *.pyc 7 | __pycache__ 8 | .pytest_cache 9 | /user -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: php 3 | os: 4 | - linux 5 | python: 6 | - 2.7 7 | php: 8 | - 7.2 9 | cache: 10 | directories: 11 | - $HOME/.composer 12 | services: 13 | - mysql 14 | before_script: 15 | - mysql -e 'create database `database`;' 16 | - echo "USE mysql;\nUPDATE user SET password=PASSWORD('password') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root 17 | install: 18 | - make && sudo make install 19 | script: 20 | - make test 21 | - cd user 22 | - rest route 23 | - rest test 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Loi Nguyen 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgement in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all test 2 | 3 | all: 4 | python setup.py build 5 | 6 | install: 7 | python setup.py install 8 | 9 | test: 10 | pytest -vx 11 | 12 | clean: 13 | rm -rf rest_cli.egg-info 14 | rm -rf build 15 | rm -rf dist 16 | rm -rf .pytest_cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rest CLI [![Build Status](https://travis-ci.org/loint/rest-cli.svg?branch=master)](https://travis-ci.org/loint/rest-cli) [![PyPI version](https://badge.fury.io/py/rest-cli.svg)](https://badge.fury.io/py/rest-cli) [![Documentation](https://img.shields.io/badge/documentation-rest-ff69b4.svg)](https://loint.github.io/rest-cli/index.md) 2 | 3 | 4 | 5 | If you love ? 6 | - Beautiful restful web service with **standard architecture** 7 | - The **fastest way** to get things done with less human coding 8 | - **Synchronize changes** from component to documentation 9 | - **Explicit request & response** with proved performance via Protobuf 10 | - Backend by an **industrial framework** with your favorite language (PHP or Go) 11 | 12 | Then this powerful tool is the right choice for you. 13 | 14 | Currently rest-cli supports for Go and PHP with MySQL database. 15 | 16 | ### Prerequisite 17 | Rest CLI 18 | - Docker 19 | - Python 2.7 with pip 20 | - Protobuf compiler 21 | ``` 22 | First installation will require you pick your languages. 23 | then creator will guide you the prerequisite for each language. 24 | ``` 25 | 26 | ### Installation 27 | ``` 28 | $ pip install rest-cli 29 | ``` 30 | 31 | ### Road map 32 | - [x] Create web service base on a lightweight skeleton 33 | - [x] Database schema migration 34 | - [x] Reverse schema to model - repository - service and dependency injectors 35 | - [x] Support built-in query annotations 36 | - [x] Compile api routes and generate controller with integration tests 37 | - [x] Serve and test application 38 | - [x] Generate swagger documentation base on api routes 39 | - [ ] Abstraction parser for independent with programming language 40 | - [ ] Integrate Request/Response with protocol buffers 41 | - [ ] Support Service - Repository symbolic link to comply top down architecture 42 | - [ ] Export service interfaces for inter-communication 43 | - [ ] Support RPC exception via response verification 44 | 45 | ### Usages 46 | 1. Create web service application 47 | - --language : Available supported language are PHP and Golang 48 | - --quite : Quite mode without asking anything about configuration 49 | - --force : Force creating application without complaining about existing project 50 | - --mysql : Start a mysql container with default information 51 | ``` 52 | $ rest create 53 | ``` 54 | 2. Change directory to service and write some migrations at `src/Shared/Migration` 55 | ``` 56 | $ rest migrate 57 | ``` 58 | 3. Synchronize model - repository - service - controller - test cases 59 | - To create some awesome apis, update your routes at `config/api/*.json` 60 | ``` 61 | $ rest sync 62 | ``` 63 | 4. View route list 64 | - To see which routes are configured and manage apis 65 | ``` 66 | $ rest route 67 | ``` 68 | 5. Serve your application to test in browser 69 | ``` 70 | $ rest serve 71 | ``` 72 | 6. Test your application with PHPUnit 73 | ``` 74 | $ rest test 75 | ``` 76 | 7. Check current version 77 | ``` 78 | $ rest version 79 | ``` 80 | 8. Update new version of rest-cli ? 81 | ``` 82 | $ rest upgrade 83 | ``` 84 | 9. Need more help ? 85 | ``` 86 | $ rest --help 87 | ``` 88 | ### API Documentation 89 | After `rest sync` you can serve your service with `rest serve` 90 | 91 | Swagger Documentation should be ready at [http://localhost:8000/docs](http://localhost:8000/docs) 92 | 93 | ### License 94 | Rest CLI and related projects are licensed under the [MIT](LICENSE) 95 | 96 | Thanks for the sponsor from [GO1 Company](http://go1.com) 97 | 98 | ~ Happy Coding ~ -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Rest Documentation -------------------------------------------------------------------------------- /docs/rest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/docs/rest.jpg -------------------------------------------------------------------------------- /docs/route.md: -------------------------------------------------------------------------------- 1 | ### Coming soon -------------------------------------------------------------------------------- /docs/schema.md: -------------------------------------------------------------------------------- 1 | ### Coming soon -------------------------------------------------------------------------------- /generator/__init__.py: -------------------------------------------------------------------------------- 1 | from helper import * 2 | from generator.template.php.template import * 3 | from model import * 4 | from route import * 5 | -------------------------------------------------------------------------------- /generator/doc.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/generator/doc.py -------------------------------------------------------------------------------- /generator/helper.py: -------------------------------------------------------------------------------- 1 | import re 2 | import json 3 | import os.path 4 | import mysql.connector 5 | 6 | __author__ = "Loi Nguyen " 7 | 8 | 9 | class Helper: 10 | def __init__(self): 11 | pass 12 | 13 | @staticmethod 14 | def get_absolute_path(local_path): 15 | """ 16 | Resolve absolute path 17 | :param local_path: 18 | :return: 19 | """ 20 | real_path = os.path.abspath(local_path) 21 | return real_path 22 | 23 | @staticmethod 24 | def convert_camel_to_description(camel_name): 25 | """ 26 | Convert camel name to description 27 | For example: UserRepository => User Repository 28 | :param camel_name: 29 | :return: 30 | """ 31 | name_components = Helper.split_camel_case(camel_name) 32 | description_with_space = '' 33 | for name_component in name_components: 34 | description_with_space += name_component + ' ' 35 | return description_with_space.strip() 36 | 37 | @staticmethod 38 | def camel_case_to_snake_case(name): 39 | """ 40 | Convert camel case to snake case 41 | 42 | :param name: string 43 | :return: string 44 | """ 45 | string = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) 46 | string = re.sub('(.)([0-9]+)', r'\1_\2', string) 47 | result = re.sub('([a-z0-9])([A-Z])', r'\1_\2', string).lower() 48 | return result 49 | 50 | @staticmethod 51 | def snake_case_to_camel_case(name): 52 | """ 53 | Convert snake case to camel case 54 | 55 | :param name: string 56 | :return: string 57 | """ 58 | name_components = name.split('_') 59 | camel_case_name = '' 60 | for name_component in name_components: 61 | camel_case_name += name_component[0].upper() + name_component[1:] 62 | return camel_case_name 63 | 64 | @staticmethod 65 | def split_camel_case(camel_case_name): 66 | """ 67 | Split camel case word to single words 68 | For example: UserRepository will be split to ["User", "Repository"] 69 | :param camel_case_name: 70 | :return: 71 | """ 72 | return re.sub('(?!^)([A-Z][a-z]+)', r' \1', camel_case_name).split() 73 | 74 | @staticmethod 75 | def get_absolute_path_from_local_path(local_path): 76 | """ 77 | Resolve absolute path from local path 78 | :param local_path: 79 | :return: 80 | """ 81 | absolute_path = Helper.get_absolute_path(os.getcwd() + "/" + local_path) 82 | return absolute_path 83 | 84 | @staticmethod 85 | def read_configuration(config_file): 86 | """ 87 | Read configuration from .env file 88 | 89 | :param config_file: string 90 | :return: dict 91 | """ 92 | config_file = Helper.get_absolute_path_from_local_path(config_file) 93 | if not os.path.isfile(config_file): 94 | print("Rest configuration does not exist !") 95 | exit(1) 96 | config = {} 97 | with open(config_file, 'r') as f: 98 | config = json.load(f) 99 | return config 100 | 101 | @staticmethod 102 | def connect_database(): 103 | """ 104 | Establish new connection to mysql 105 | :return: config, connection, cursor 106 | """ 107 | config = Helper.read_configuration("./rest.json") 108 | db_host = '' 109 | db_name = '' 110 | db_username = '' 111 | db_password = '' 112 | if config['mysql']['host']: 113 | db_host = config['mysql']['host'] 114 | if config['mysql']['database']: 115 | db_name = config['mysql']['database'] 116 | if config['mysql']['username']: 117 | db_username = config['mysql']['username'] 118 | if config['mysql']['database']: 119 | db_password = config['mysql']['password'] 120 | connection = mysql.connector.connect( 121 | user=db_username, 122 | password=db_password, 123 | host=db_host, 124 | database=db_name, 125 | raise_on_warnings=True 126 | ) 127 | cursor = connection.cursor() 128 | cursor.execute("USE `" + db_name + "`") 129 | return config, connection, cursor 130 | 131 | @staticmethod 132 | def execute_with_cursor(cursor, query): 133 | cursor.execute(query) 134 | return cursor.fetchall() 135 | 136 | @staticmethod 137 | def bind(template, params): 138 | """ 139 | Bind params in to template 140 | 141 | :param template: 142 | :param params: 143 | :return: string 144 | """ 145 | for variable in params: 146 | template = template.replace('{' + variable + '}', str(params[variable])) 147 | return template.strip() -------------------------------------------------------------------------------- /generator/helper_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | __author__ = "Loi Nguyen " 4 | 5 | 6 | class TestHelper: 7 | 8 | def test_abc(self): 9 | assert 0 == 0 10 | -------------------------------------------------------------------------------- /generator/io.py: -------------------------------------------------------------------------------- 1 | 2 | class IO: 3 | pass -------------------------------------------------------------------------------- /generator/model.py: -------------------------------------------------------------------------------- 1 | import os 2 | from helper import Helper 3 | from generator.template.php.template import MODEL_TEMPLATE, MODEL_CONSTRUCTOR_TEMPLATE, SETTER_GETTER_TEMPLATE 4 | from generator.template.php.template import REPOSITORY_IMPLEMENTATION_TEMPLATE 5 | from generator.template.php.template import SERVICE_IMPLEMENTATION_TEMPLATE 6 | from generator.template.php.template import REPOSITORY_IMPLEMENTATION_BUILTIN_TEMPLATE 7 | from generator.template.php.template import REPOSITORY_IMPLEMENTATION_FILTER_TEMPLATE 8 | from generator.template.php.template import REPOSITORY_INTERFACE_TEMPLATE 9 | from generator.template.php.template import SERVICE_INTERFACE_TEMPLATE 10 | from generator.template.php.template import REPOSITORY_INTERFACE_BUILTIN_TEMPLATE 11 | from generator.template.php.template import REPOSITORY_INTERFACE_FILTER_TEMPLATE 12 | 13 | __author__ = "Loi Nguyen " 14 | 15 | 16 | class SchemaUtil: 17 | """ 18 | Provide a set of functionality manipulate with database schema 19 | Support data type conversion between PHP and MySQL 20 | """ 21 | def __init__(self): 22 | pass 23 | 24 | @staticmethod 25 | def mysql_to_php_type(mysql_table_name, mysql_column_name, mysql_column_type): 26 | """ 27 | Convert data type in mysql to php data type 28 | This is an interceptor allow us to customize when migration 29 | has new data types 30 | 31 | :param mysql_table_name: string 32 | :param mysql_column_name: string 33 | :param mysql_column_type: string 34 | :return: string 35 | """ 36 | if mysql_column_type.startswith('tinyint'): 37 | return 'boolean' 38 | if mysql_column_type.startswith('smallint'): 39 | return 'int' 40 | if mysql_column_type.startswith('int'): 41 | return 'int' 42 | if mysql_column_type.startswith('mediumint'): 43 | return 'int' 44 | if mysql_column_type.startswith('bigint'): 45 | return 'int' 46 | if mysql_column_type.startswith('decimal'): 47 | return 'float' 48 | if mysql_column_type.startswith('char'): 49 | return 'string' 50 | if mysql_column_type.startswith('varchar') or mysql_column_type.startswith('text'): 51 | return 'string' 52 | if mysql_column_type.startswith('time'): 53 | return '\DateTime' 54 | if mysql_column_type.startswith('date'): 55 | return '\DateTime' 56 | if mysql_column_type.startswith('datetime'): 57 | return '\DateTime' 58 | if mysql_column_type.startswith('timestamp'): 59 | return '\DateTime' 60 | return 'undefined' 61 | 62 | @staticmethod 63 | def mysql_default_value(mysql_column_type): 64 | """ 65 | MySQL Default value for not nullable fields 66 | 67 | :param mysql_column_type: string 68 | :return: mixed 69 | """ 70 | if mysql_column_type.startswith('tinyint'): 71 | return 0 72 | if mysql_column_type.startswith('smallint'): 73 | return 0 74 | if mysql_column_type.startswith('int'): 75 | return 0 76 | if mysql_column_type.startswith('mediumint'): 77 | return 0 78 | if mysql_column_type.startswith('bigint'): 79 | return 0 80 | if mysql_column_type.startswith('decimal'): 81 | return 0 82 | if mysql_column_type.startswith('char'): 83 | return '' 84 | if mysql_column_type.startswith('varchar') or mysql_column_type.startswith('text'): 85 | return '' 86 | if mysql_column_type.startswith('time'): 87 | return "\Illuminate\Support\Facades\DB::raw('CURRENT_TIMESTAMP')" 88 | if mysql_column_type.startswith('date'): 89 | return "\Illuminate\Support\Facades\DB::raw('CURRENT_TIMESTAMP')" 90 | if mysql_column_type.startswith('datetime'): 91 | return "\Illuminate\Support\Facades\DB::raw('CURRENT_TIMESTAMP')" 92 | if mysql_column_type.startswith('timestamp'): 93 | return 0 94 | return '' 95 | 96 | @staticmethod 97 | def convert_table_to_camel_name(table_name): 98 | """ 99 | Convert table name to camel case 100 | This is an interceptor allow us to standardize when the 101 | table names do not have same rules 102 | 103 | :param table_name: string 104 | :return: string 105 | """ 106 | return Helper.snake_case_to_camel_case(table_name) 107 | 108 | @staticmethod 109 | def convert_column_to_camel_name(column_name): 110 | """ 111 | Convert column name to camel case 112 | This is an interceptor allow us to standardize when the 113 | column names are lower or do not have same rules 114 | 115 | :param column_name: string 116 | :return: string 117 | """ 118 | return Helper.snake_case_to_camel_case(column_name) 119 | 120 | @staticmethod 121 | def intercept_filter_set( 122 | php_model_name, 123 | php_property_name, 124 | php_property_type, 125 | mysql_table_name, 126 | mysql_column_name, 127 | mysql_column_type): 128 | """ 129 | Set filter interceptor 130 | This is an interceptor allow us to intercept to setter base 131 | on php types and mysql types 132 | 133 | :param php_model_name: string 134 | :param php_property_name: string 135 | :param php_property_type: string 136 | :param mysql_table_name: string 137 | :param mysql_column_name: string 138 | :param mysql_column_type: string 139 | :return: string 140 | """ 141 | if mysql_column_type == 'datetime': 142 | return '''if (null === ${camel_variable_name}) { 143 | $this->attributes[self::{constant_field_name}] = null; 144 | } else { 145 | $this->attributes[self::{constant_field_name}] = ${camel_variable_name}->format(\'Y-m-d H:i:s\'); 146 | }''' 147 | if mysql_column_type == 'date': 148 | return '''if (null === ${camel_variable_name}) { 149 | $this->attributes[self::{constant_field_name}] = null; 150 | } else { 151 | $this->attributes[self::{constant_field_name}] = ${camel_variable_name}->format(\'Y-m-d\'); 152 | }''' 153 | if php_property_type == 'float': 154 | return '''if (null === ${camel_variable_name}) { 155 | $this->attributes[self::{constant_field_name}] = null; 156 | } else { 157 | $this->attributes[self::{constant_field_name}] = (float) ${camel_variable_name}; 158 | }''' 159 | if php_property_type == 'int': 160 | return '''if (null === ${camel_variable_name}) { 161 | $this->attributes[self::{constant_field_name}] = null; 162 | } else { 163 | $this->attributes[self::{constant_field_name}] = (int) ${camel_variable_name}; 164 | }''' 165 | return '$this->attributes[self::{constant_field_name}] = ${camel_variable_name};' 166 | 167 | @staticmethod 168 | def intercept_filter_get( 169 | php_model_name, 170 | php_property_name, 171 | php_property_type, 172 | mysql_table_name, 173 | mysql_column_name, 174 | mysql_column_type): 175 | """ 176 | Get filter interceptor 177 | This is an interceptor allow us to intercept to getter base 178 | on php types and mysql types 179 | 180 | :param php_model_name: string 181 | :param php_property_name: string 182 | :param php_property_type: string 183 | :param mysql_table_name: string 184 | :param mysql_column_name: string 185 | :param mysql_column_type: string 186 | :return: string 187 | """ 188 | if mysql_column_type == 'datetime': 189 | return '''$dateTimeStringValue = $this->attributes[self::{constant_field_name}]; 190 | if (empty($dateTimeStringValue)) { 191 | return null; 192 | } 193 | $dateTimeObject = \DateTime::createFromFormat(\'Y-m-d H:i:s\', $dateTimeStringValue); 194 | return $dateTimeObject;''' 195 | if mysql_column_type == 'date': 196 | return '''$dateTimeStringValue = $this->attributes[self::{constant_field_name}]; 197 | if (empty($dateTimeStringValue)) { 198 | return null; 199 | } 200 | $dateTimeObject = \DateTime::createFromFormat(\'Y-m-d\', $dateTimeStringValue); 201 | return $dateTimeObject;''' 202 | if php_property_type == 'float': 203 | return """$floatValue = $this->attributes[self::{constant_field_name}]; 204 | if (null === $floatValue) { 205 | return null; 206 | } 207 | return (float) $this->attributes[self::{constant_field_name}];""" 208 | if php_property_type == 'int': 209 | return """$intValue = $this->attributes[self::{constant_field_name}]; 210 | if (null === $intValue) { 211 | return null; 212 | } 213 | return (int) $this->attributes[self::{constant_field_name}];""" 214 | return 'return $this->attributes[self::{constant_field_name}];' 215 | 216 | 217 | class ModelGenerator: 218 | """ 219 | Model generator 220 | This generator will collect information from model and 221 | database then generate setters, getters and constants 222 | automatically for models 223 | """ 224 | _model_path = '' 225 | _repository_path = '' 226 | _service_path = '' 227 | _controller_path = '' 228 | _bind_path = '' 229 | _config_path = '' 230 | _identifier = '' 231 | _models = {} 232 | _tables = {} 233 | _config = {} 234 | _generated_model = '' 235 | 236 | def __init__(self): 237 | pass 238 | 239 | def set_identifier(self, identifier): 240 | """ 241 | Set identifier use to separate generated and modified source code 242 | 243 | :param identifier: 244 | :return: 245 | """ 246 | self._identifier = identifier 247 | 248 | def config_paths(self): 249 | require_folders = [ 250 | "src/Model", 251 | "src/Repository", 252 | "src/Service", 253 | "src/Controller" 254 | ] 255 | for require_folder in require_folders: 256 | if not os.path.isdir(require_folder): 257 | os.makedirs(require_folder) 258 | self._model_path = Helper.get_absolute_path_from_local_path("src/Model") 259 | self._repository_path = Helper.get_absolute_path_from_local_path("src/Repository") 260 | self._service_path = Helper.get_absolute_path_from_local_path("src/Service") 261 | self._controller_path = Helper.get_absolute_path_from_local_path("src/Controller") 262 | self._bind_path = Helper.get_absolute_path_from_local_path("src/Dependencies.php") 263 | 264 | def get_tables(self): 265 | return self._tables 266 | 267 | def get_models(self): 268 | return self._models 269 | 270 | def scan_models(self): 271 | """ 272 | Scan all models and collect existing code 273 | """ 274 | if len(self._model_path) == 0: 275 | print('Please set_model_path !') 276 | exit(1) 277 | if len(self._identifier) == 0: 278 | print('Please set_identifier !') 279 | exit(1) 280 | if len(self._generated_model) > 0: 281 | self.scan_by_model_file_name(self._generated_model + '.php') 282 | else: 283 | for model_file_name in os.listdir(self._model_path): 284 | if model_file_name.endswith('.php'): 285 | self.scan_by_model_file_name(model_file_name) 286 | 287 | @staticmethod 288 | def find_annotations_by_content(model_content): 289 | """ 290 | Find all annotations by model content 291 | 292 | :return: dict 293 | """ 294 | selects = [] 295 | updates = [] 296 | deletes = [] 297 | counts = [] 298 | lines = model_content.split('\n') 299 | for line in lines: 300 | line = line.strip() 301 | filter_components = line.split(' ') 302 | if len(filter_components) > 2: 303 | if line.startswith('* @select'): 304 | selects.append(filter_components[2:]) 305 | if line.startswith('* @update'): 306 | updates.append(filter_components[2:]) 307 | if line.startswith('* @delete'): 308 | deletes.append(filter_components[2:]) 309 | if line.startswith('* @count'): 310 | counts.append(filter_components[2:]) 311 | annotations = { 312 | '@selects': selects, 313 | '@updates': updates, 314 | '@deletes': deletes, 315 | '@counts': counts 316 | } 317 | return annotations 318 | 319 | def scan_by_model_file_name(self, model_file_name): 320 | """ 321 | Scan by model file name 322 | :param model_file_name: 323 | :return: 324 | """ 325 | # Model name is not include extension ".php" so 326 | # we need to subtract 4 characters from the end 327 | model_name = model_file_name[:-4] 328 | model_file_path = Helper.get_absolute_path(self._model_path + '/' + model_file_name) 329 | with open(model_file_path, 'r') as stream: 330 | lines = stream.read().strip() 331 | model_components = lines.split(self._identifier) 332 | if len(model_components) != 2: 333 | print('Identifier not found in model : ', model_name) 334 | exit(1) 335 | else: 336 | model_content = model_components[0] 337 | annotations = self.find_annotations_by_content(model_content) 338 | self._models[model_name] = { 339 | 'content': model_content, 340 | 'filters': annotations, 341 | 'file_path': model_file_path 342 | } 343 | 344 | def scan_database(self): 345 | """ 346 | Scan database schemas and collect information 347 | """ 348 | _, _, cursor = Helper.connect_database() 349 | tables = Helper.execute_with_cursor(cursor, 'SHOW TABLES;') 350 | for table_name in tables: 351 | table_name = table_name[0] 352 | if table_name.startswith('view'): 353 | continue 354 | columns = Helper.execute_with_cursor(cursor, 'SHOW COLUMNS FROM ' + table_name + ';') 355 | if table_name == '_migrations': 356 | continue 357 | self._tables[table_name] = [] 358 | for column in columns: 359 | column_name = column[0] 360 | column_type = column[1] 361 | column_default = column[4] 362 | column_null = True 363 | if column[2] == "NO": 364 | column_null = False 365 | table = { 366 | 'php_model_name': SchemaUtil.convert_table_to_camel_name(table_name), 367 | 'php_property_name': SchemaUtil.convert_column_to_camel_name(column_name), 368 | 'php_property_type': SchemaUtil.mysql_to_php_type(table_name, column_name, column_type), 369 | 'mysql_table_name': table_name, 370 | 'mysql_column_name': column_name, 371 | 'mysql_column_type': column_type, 372 | 'mysql_allow_null': column_null, 373 | 'mysql_column_default': column_default 374 | } 375 | self._tables[table_name].append(table) 376 | 377 | @staticmethod 378 | def __generate_constructor(model_name, columns): 379 | """ 380 | Generate default constructor and default constructor for model 381 | 382 | :param model_name: 383 | :param columns: 384 | """ 385 | default_setters = '' 386 | for field in columns: 387 | constant_name = Helper.camel_case_to_snake_case(field['php_property_name']).upper() 388 | default_value = 'null' 389 | if not field['mysql_allow_null']: 390 | default_value = SchemaUtil.mysql_default_value(field['mysql_column_type']) 391 | if field['mysql_column_default'] is not None: 392 | default_value = field['mysql_column_default'] 393 | if len(str(default_value)) == 0: 394 | default_value = '""' 395 | if default_value == '{}': 396 | default_value = '"{}"' 397 | if constant_name.upper() is 'id': 398 | default_value = 'null' 399 | default_setters += ' $this->attributes[self::' + constant_name + '] = ' + str(default_value) + ';\n' 400 | 401 | constructor = Helper.bind(MODEL_CONSTRUCTOR_TEMPLATE, { 402 | 'default_setters': default_setters, 403 | 'model_name': model_name 404 | }) 405 | return constructor 406 | 407 | @staticmethod 408 | def __generate_setter_getter(model_name, fields): 409 | """ 410 | Generate setter and getter for models 411 | 412 | :param: model_name string 413 | :param: fields array 414 | :return: string 415 | """ 416 | set_get_content = '' 417 | for field in fields: 418 | camel_field_name = field['php_property_name'] 419 | snake_field_name = Helper.camel_case_to_snake_case(camel_field_name) 420 | field_set_get_content = SETTER_GETTER_TEMPLATE 421 | setter_name = camel_field_name 422 | getter_name = camel_field_name 423 | if setter_name.startswith('Is'): 424 | setter_name = 'set' + setter_name[2:] 425 | getter_name = camel_field_name[0].lower() + camel_field_name[1:] 426 | else: 427 | setter_name = 'set' + setter_name 428 | getter_name = 'get' + getter_name 429 | # Bind template variables 430 | field_set_get_content = field_set_get_content.replace( 431 | '{intercept_filter_set}', 432 | SchemaUtil.intercept_filter_set( 433 | php_model_name=model_name, 434 | php_property_name=field['php_property_name'], 435 | php_property_type=field['php_property_type'], 436 | mysql_table_name=field['mysql_table_name'], 437 | mysql_column_name=field['mysql_column_name'], 438 | mysql_column_type=field['mysql_column_type'] 439 | ) 440 | ) 441 | field_set_get_content = field_set_get_content.replace( 442 | '{intercept_filter_get}', 443 | SchemaUtil.intercept_filter_get( 444 | php_model_name=model_name, 445 | php_property_name=field['php_property_name'], 446 | php_property_type=field['php_property_type'], 447 | mysql_table_name=field['mysql_table_name'], 448 | mysql_column_name=field['mysql_column_name'], 449 | mysql_column_type=field['mysql_column_type'] 450 | ) 451 | ) 452 | field_set_get_content = Helper.bind(field_set_get_content, { 453 | 'table_name': model_name, 454 | 'field_name': field['mysql_column_name'], 455 | 'field_type': field['php_property_type'], 456 | 'camel_field_name': camel_field_name, 457 | 'camel_variable_name': camel_field_name[0].lower() + camel_field_name[1:], 458 | 'constant_field_name': snake_field_name.upper(), 459 | 'method_name': snake_field_name.replace('_', ' '), 460 | 'setter_name': setter_name, 461 | 'getter_name': getter_name 462 | }) 463 | set_get_content += field_set_get_content + "\n\n " 464 | return set_get_content 465 | 466 | def create_model(self, table_name): 467 | """ 468 | Create model for table if does not exist 469 | :param table_name: 470 | """ 471 | if table_name == '_migrations': 472 | return 473 | model_name = SchemaUtil.convert_table_to_camel_name(table_name) 474 | model_name_with_space = ' '.join(Helper.split_camel_case(model_name)) 475 | if model_name not in self._models: 476 | print('Detect new table ', table_name) 477 | model_content = Helper.bind(MODEL_TEMPLATE, { 478 | 'model_name': model_name, 479 | 'table_name': table_name, 480 | 'model_name_with_space': model_name_with_space 481 | }) 482 | model_file_path = self._model_path + '/' + model_name + '.php' 483 | model = open(model_file_path, 'w') 484 | model.write(model_content) 485 | model.close() 486 | print('Created new model ', model_name) 487 | 488 | def generate_models(self): 489 | """ 490 | Generate models 491 | If table in database does not have model then 492 | we need to create model for developer to use 493 | If created model does not exist in database 494 | we need to inform for developer to check the migrations 495 | """ 496 | for table in self._tables: 497 | if table not in self._models: 498 | self.create_model(table) 499 | for model in self._models: 500 | table_name = Helper.camel_case_to_snake_case(model) 501 | if table_name not in self._tables: 502 | print('Table ', table_name, ' in database does not exist !') 503 | exit(1) 504 | content = self._models[model]['content'] 505 | content += self._identifier + '\n ' 506 | content += self.__generate_constructor(model, self._tables[table_name]) 507 | content += self.__generate_setter_getter(model, self._tables[table_name]) 508 | content += '\n}\n' 509 | model_file = open(self._models[model]['file_path'], "w") 510 | model_file.write(content) 511 | model_file.close() 512 | print('Generated model: ', model) 513 | 514 | def scan_model_annotation(self): 515 | for model in self._models: 516 | table_name = Helper.camel_case_to_snake_case(model) 517 | columns = self._tables[table_name] 518 | filters = self._models[model]['filters'] 519 | filter_fields = {} 520 | # Filter fields represents set of unique field name in all filters inside one model 521 | for filter in filters: 522 | for type in filters[filter]: 523 | for field_name in type: 524 | filter_fields[field_name] = 1 525 | # Check field name consistent with database schema 526 | for filter_field in filter_fields: 527 | consistent = False 528 | for column in columns: 529 | if filter_field == column['php_property_name']: 530 | consistent = True 531 | break 532 | if not consistent: 533 | print('Sorry, can not filter by column "' + model + '.' + filter_field \ 534 | + '" because it does not exist in database !') 535 | exit(1) 536 | 537 | @staticmethod 538 | def create_service_files(service_folder_path, service_name, model_name): 539 | """ 540 | Create service files includes: interface and implementation 541 | 542 | :param service_folder_path: 543 | :param service_name: 544 | :param model_name: 545 | """ 546 | service_interface_file_path = Helper.get_absolute_path( 547 | service_folder_path + '/' + service_name + '.php' 548 | ) 549 | repository_implementation_file_path = Helper.get_absolute_path( 550 | service_folder_path + '/' + service_name + 'Impl.php' 551 | ) 552 | service_name_with_space = Helper.convert_camel_to_description( 553 | service_name 554 | ) 555 | service_interface_content = Helper.bind( 556 | SERVICE_INTERFACE_TEMPLATE, { 557 | 'model_name': model_name, 558 | 'service_name': service_name, 559 | 'service_name_with_space': service_name_with_space 560 | } 561 | ) 562 | service_implementation_content = Helper.bind( 563 | SERVICE_IMPLEMENTATION_TEMPLATE, { 564 | 'model_name': model_name, 565 | 'model_name_variable': model_name[0].lower() + model_name[1:], 566 | 'service_name': service_name, 567 | 'service_name_with_space': service_name_with_space 568 | } 569 | ) 570 | # Write interface file 571 | service_interface_file = open(service_interface_file_path, "w") 572 | service_interface_file.write(service_interface_content) 573 | service_interface_file.close() 574 | # Write implementation file 575 | service_implementation_file = open(repository_implementation_file_path, "w") 576 | service_implementation_file.write(service_implementation_content) 577 | service_implementation_file.close() 578 | 579 | @staticmethod 580 | def create_repository_files(repository_folder_path, repository_name, model_name): 581 | """ 582 | Create repository files includes: interface and implementation 583 | 584 | :param repository_folder_path: 585 | :param repository_name: 586 | :param model_name: 587 | """ 588 | repository_interface_file_path = Helper.get_absolute_path( 589 | repository_folder_path + '/' + repository_name + '.php' 590 | ) 591 | repository_implementation_file_path = Helper.get_absolute_path( 592 | repository_folder_path + '/' + repository_name + 'Impl.php' 593 | ) 594 | repository_name_with_space = Helper.convert_camel_to_description( 595 | repository_name 596 | ) 597 | repository_interface_content = Helper.bind( 598 | REPOSITORY_INTERFACE_TEMPLATE, { 599 | 'model_name': model_name, 600 | 'repository_name': repository_name, 601 | 'repository_name_with_space': repository_name_with_space 602 | } 603 | ) 604 | repository_implementation_content = Helper.bind( 605 | REPOSITORY_IMPLEMENTATION_TEMPLATE, { 606 | 'model_name': model_name, 607 | 'repository_name': repository_name, 608 | 'repository_name_with_space': repository_name_with_space 609 | } 610 | ) 611 | # Write interface file 612 | repository_interface_file = open(repository_interface_file_path, "w") 613 | repository_interface_file.write(repository_interface_content) 614 | repository_interface_file.close() 615 | # Write implementation file 616 | repository_implementation_file = open(repository_implementation_file_path, "w") 617 | repository_implementation_file.write(repository_implementation_content) 618 | repository_implementation_file.close() 619 | 620 | @staticmethod 621 | def get_repository_builtin_content(template, repository_name, model_name): 622 | repository_name_with_space = Helper.convert_camel_to_description(repository_name) 623 | model_name_plural = model_name + 's' 624 | if model_name[-1:] == 'y': 625 | model_name_plural = model_name[:-1] + 'ies' 626 | repository_implementation_content = Helper.bind(template, { 627 | 'model_name': model_name, 628 | 'model_name_plural': model_name_plural, 629 | 'repository_name': repository_name, 630 | 'repository_name_with_space': repository_name_with_space 631 | }) 632 | return repository_implementation_content 633 | 634 | def get_repository_filter_content(self, template, repository_name, model_name): 635 | """ 636 | Get repository filter content 637 | This method will base on model information about filters 638 | then generate corresponding methods for them 639 | 640 | :param template: 641 | :param repository_name: 642 | :param model_name: 643 | :return: 644 | """ 645 | filters = self._models[model_name]['filters'] 646 | repository_implementation_content = '' 647 | for annotation_name in filters: 648 | if len(filters[annotation_name]) == 0: 649 | continue 650 | table_name = Helper.camel_case_to_snake_case(model_name) 651 | table = self._tables[table_name] 652 | # Get column type mapping 653 | type_mapping = {} 654 | for field in table: 655 | type_mapping[field['php_property_name']] = field['php_property_type'] 656 | repository_name_with_space = Helper.convert_camel_to_description(repository_name) 657 | model_name_plural = model_name + 's' 658 | if model_name[-1:] == 'y': 659 | model_name_plural = model_name[:-1] + 'ies' 660 | for fields in filters[annotation_name]: 661 | if len(fields) == 0: 662 | continue 663 | query_type = annotation_name[1:-1] 664 | returned_type = '\Illuminate\Support\Collection' 665 | if query_type == 'select': 666 | query_type = 'get' 667 | if query_type == 'count': 668 | returned_type = 'int' 669 | if query_type == 'update' or query_type == 'delete': 670 | returned_type = 'bool|null' 671 | description_conditions = ' '.join(fields) 672 | camel_conditions = ''.join(fields) 673 | unique_conditions = '_'.join(fields) 674 | unique_values = '""' 675 | condition_params = '' 676 | variable_names = [] 677 | if query_type == 'update': 678 | fields = ['data'] + fields 679 | type_mapping['data'] = 'array' 680 | constants_with_values = [] 681 | for field_name in fields: 682 | variable_name = '$' + field_name[0].lower() + field_name[1:] 683 | variable_type = type_mapping[field_name] 684 | variable_names.append(variable_name) 685 | unique_values += ' . "_". ' + variable_name 686 | constant_name = Helper.camel_case_to_snake_case(field_name).upper() 687 | condition_params += ' * @param ' + variable_type + ' ' + variable_name + '\n' 688 | if not (query_type == 'update' and field_name == 'data'): 689 | constants_with_values.append( 690 | ' ' + model_name + '::' + constant_name + ' => ' + variable_name) 691 | filter_arguments = '' 692 | if query_type == 'update': 693 | filter_arguments = '$data' 694 | condition_params += ' *' 695 | condition_arguments = ', '.join(variable_names) 696 | constants_with_values_array = ',\n'.join(constants_with_values) 697 | repository_implementation_content += Helper.bind(template, { 698 | 'returned_type': returned_type, 699 | 'filter_name': query_type, 700 | 'filter_name_label': query_type[0].upper() + query_type[1:], 701 | 'description_conditions': description_conditions, 702 | 'unique_conditions': unique_conditions, 703 | 'unique_values': unique_values, 704 | 'camel_conditions': camel_conditions, 705 | 'condition_params': condition_params, 706 | 'filter_arguments': filter_arguments, 707 | 'condition_arguments': condition_arguments, 708 | 'constants_with_values': constants_with_values_array, 709 | 'model_name': model_name, 710 | 'model_name_plural': model_name_plural, 711 | 'repository_name': repository_name, 712 | 'repository_name_with_space': repository_name_with_space 713 | }) + '\n\n ' 714 | return repository_implementation_content 715 | 716 | def generate_repository( 717 | self, 718 | template_builtin, 719 | template_filter, 720 | repository_folder_path, 721 | repository_name, 722 | model_name): 723 | """ 724 | Generate repository builtin method for implementation and interface 725 | 726 | :param template_builtin: 727 | :param template_filter: 728 | :param repository_folder_path: 729 | :param repository_name: 730 | :param model_name: 731 | :return: 732 | """ 733 | repository_file_path = Helper.get_absolute_path(repository_folder_path + '/' + repository_name + '.php') 734 | with open(repository_file_path, 'r') as stream: 735 | lines = stream.read().strip() 736 | repository_components = lines.split(self._identifier) 737 | if len(repository_components) != 2: 738 | print('Identifier not found in repository implementation : ', repository_name) 739 | exit(1) 740 | else: 741 | # Concat existing repository source code with builtin methods 742 | repository_content = repository_components[0] 743 | repository_builtin = self.get_repository_builtin_content( 744 | template_builtin, 745 | repository_name, 746 | model_name 747 | ) 748 | repository_filter = self.get_repository_filter_content( 749 | template_filter, 750 | repository_name, 751 | model_name 752 | ) 753 | repository_content += self._identifier + "\n " 754 | repository_content += repository_filter 755 | repository_content += repository_builtin + "\n}\n" 756 | # Save new content to repository 757 | repository_file = open(repository_file_path, 'w') 758 | repository_file.write(repository_content) 759 | repository_file.close() 760 | print('Generated repository:', repository_name) 761 | 762 | def update_dependencies_to_bind(self, dependencies): 763 | with open(self._bind_path, 'r') as stream: 764 | lines = stream.read().strip() 765 | bind_components = lines.split(self._identifier) 766 | if len(bind_components) != 2: 767 | print('Identifier not found in dependency list') 768 | exit(1) 769 | else: 770 | dependency_classes = '' 771 | for repository_class in dependencies: 772 | dependency_classes += ' ' + repository_class + ',\n' 773 | bind_content = bind_components[0] 774 | bind_content += self._identifier + '\n' + dependency_classes + '\n];' 775 | bind = open(self._bind_path, 'w') 776 | bind.write(bind_content) 777 | bind.close() 778 | 779 | def generate_repositories(self): 780 | """ 781 | Generate repositories 782 | To make flexible repository in controller level without break the architecture 783 | This method will generate same method in service layer as an alias 784 | to implement 3 layer Controller -> Service -> Repository 785 | if controller needs repository then they already had built-in service 786 | """ 787 | repositories = [] 788 | services = [] 789 | for model in self._models: 790 | table_name = Helper.camel_case_to_snake_case(model) 791 | if table_name not in self._tables: 792 | print('Table ', table_name, ' in database does not exist !') 793 | exit(1) 794 | else: 795 | repository_folder_path = self._repository_path 796 | service_folder_path = self._service_path 797 | repository_name = model + 'Repository' 798 | service_name = model + 'Service' 799 | repositories.append('\App\Repository\\' + repository_name + '\\' + repository_name + '::class') 800 | services.append('\App\Service\\' + service_name + '\\' + service_name + '::class') 801 | repository_folder_path_each_model = Helper.get_absolute_path( 802 | repository_folder_path + '/' + repository_name) 803 | service_folder_path_each_model = Helper.get_absolute_path( 804 | service_folder_path + '/' + service_name) 805 | if not os.path.exists(repository_folder_path_each_model): 806 | os.mkdir(repository_folder_path_each_model) 807 | if not os.path.exists(service_folder_path_each_model): 808 | os.mkdir(service_folder_path_each_model) 809 | repository_file_path = Helper.get_absolute_path( 810 | repository_folder_path_each_model + '/' + repository_name + '.php') 811 | service_file_path = Helper.get_absolute_path( 812 | service_folder_path_each_model + '/' + service_name + '.php') 813 | if not os.path.exists(repository_file_path): 814 | self.create_repository_files(repository_folder_path_each_model, repository_name, model_name=model) 815 | print('Generated repository: ', repository_name) 816 | if not os.path.exists(service_file_path): 817 | self.create_service_files(service_folder_path_each_model, service_name, model_name=model) 818 | print('Generated service: ', service_name) 819 | # Generate repository interfaces 820 | self.generate_repository( 821 | REPOSITORY_INTERFACE_BUILTIN_TEMPLATE, 822 | REPOSITORY_INTERFACE_FILTER_TEMPLATE, 823 | repository_folder_path_each_model, 824 | repository_name, 825 | model_name=model 826 | ) 827 | # Generate repository implementations 828 | self.generate_repository( 829 | REPOSITORY_IMPLEMENTATION_BUILTIN_TEMPLATE, 830 | REPOSITORY_IMPLEMENTATION_FILTER_TEMPLATE, 831 | repository_folder_path_each_model, 832 | repository_name + 'Impl', 833 | model_name=model 834 | ) 835 | 836 | # alias_methods = self.scan_repository_interface(repository_file_path) # 837 | # 838 | # # Generate repository interfaces 839 | # self.generate_service( 840 | # SERVICE_INTERFACE_BUILTIN_TEMPLATE, 841 | # repository_folder_path_each_model, 842 | # repository_name, 843 | # model_name=model 844 | # ) 845 | # # Generate repository implementations 846 | # self.generate_service( 847 | # REPOSITORY_IMPLEMENTATION_BUILTIN_TEMPLATE, 848 | # REPOSITORY_IMPLEMENTATION_FILTER_TEMPLATE, 849 | # repository_folder_path_each_model, 850 | # repository_name + 'Impl', 851 | # model_name=model 852 | # ) 853 | self.update_dependencies_to_bind(repositories + services) 854 | -------------------------------------------------------------------------------- /generator/model_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | __author__ = "Loi Nguyen " 4 | 5 | 6 | class TestSchemaUtil: 7 | 8 | def test_schema(self): 9 | assert 4 == 4 10 | -------------------------------------------------------------------------------- /generator/route.py: -------------------------------------------------------------------------------- 1 | # Will be rewrite from PHP version 2 | class RouteGenerator: 3 | def __init__(self): 4 | pass -------------------------------------------------------------------------------- /generator/route_template.py: -------------------------------------------------------------------------------- 1 | ROUTE_TEMPLATE = """ 2 | Route::group(['middleware' => 'auth:api,throttle'], function () { 3 | {routes} 4 | }); 5 | """ 6 | 7 | CONTROLLER_TEMPLATE = """ 8 | errorResponse($throwable); 68 | } 69 | return $this->successResponse(Response::HTTP_OK, $output); 70 | } 71 | """ 72 | 73 | ACTION_TEST_TEMPLATE = """ 74 | /** 75 | * Test {description} 76 | * 77 | * @given Send {method} request to {route} 78 | * @expect Response is success 79 | */ 80 | public function test{actionName}() 81 | { 82 | $this->withoutMiddleware(); 83 | {inputDeclaration} 84 | $response = $this->{methodLowerCase}($this->bind('api{route}', [{parameters}]){inputVariable}); 85 | $response->assertStatus(Response::HTTP_OK); 86 | 87 | $responseJson = $response->decodeResponseJson(); 88 | $this->assertNotNull($responseJson['data']); 89 | 90 | /** @var {outputClassName} $output */ 91 | $output = JsonHelper::cast($responseJson['data'], {outputClassName}::class); 92 | $this->assertNotNull($output); 93 | } 94 | """ -------------------------------------------------------------------------------- /generator/template/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/generator/template/__init__.py -------------------------------------------------------------------------------- /generator/template/php/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/generator/template/php/__init__.py -------------------------------------------------------------------------------- /generator/template/php/template.py: -------------------------------------------------------------------------------- 1 | 2 | __author__ = "Loi Nguyen " 3 | 4 | REST_TEMPLATE = """{ 5 | "rest": "{app_name}", 6 | "name": "app", 7 | "config" : "api", 8 | "document": "public/docs/api.json", 9 | "source": "src", 10 | "test": "test", 11 | "interface": "../interface/src", 12 | "mysql": { 13 | "host": "{host}", 14 | "username": "{username}", 15 | "password": "{password}", 16 | "database": "{database}" 17 | } 18 | } 19 | """ 20 | 21 | DATABASE_TEMPLATE = """ 'mysql', 24 | 'migrations' => '_migrations', 25 | 'connections' => [ 26 | 'mysql' => [ 27 | 'read' => [ 28 | 'host' => ['{host}'], 29 | ], 30 | 'write' => [ 31 | 'host' => ['{host}'], 32 | ], 33 | 'sticky' => true, 34 | 'driver' => 'mysql', 35 | 'database' => '{database}', 36 | 'username' => '{username}', 37 | 'password' => '{password}', 38 | 'charset' => 'utf8mb4', 39 | 'collation' => 'utf8mb4_unicode_ci', 40 | 'prefix' => '', 41 | ], 42 | ] 43 | ]; 44 | """ 45 | 46 | MODEL_TEMPLATE = """ 47 | {model_name}(); 98 | // Default values for model instance 99 | {default_setters} 100 | } 101 | """ 102 | 103 | REPOSITORY_INTERFACE_TEMPLATE = """ 104 | get(); 310 | } 311 | 312 | /** 313 | * Save one record. 314 | * 315 | * @param {model_name} $record 316 | * 317 | * @return int | bool 318 | */ 319 | public function save{model_name}($record) 320 | { 321 | $status = $record->save(); 322 | if (false === $status) { 323 | return false; 324 | } 325 | return $record->getId(); 326 | } 327 | 328 | /** 329 | * Insert multiple records. 330 | * 331 | * @param array $records 332 | * 333 | * @return bool 334 | */ 335 | public function bulkInsert{model_name_plural}($records) 336 | { 337 | $data = []; 338 | /** @var \Illuminate\Database\Eloquent\Model $record */ 339 | foreach ($records as $record) { 340 | $data[] = $record->getAttributes(); 341 | } 342 | 343 | return {model_name}::insert($data); 344 | } 345 | 346 | /** 347 | * Update records by id. 348 | * 349 | * @param int $id 350 | * @param array $data 351 | * 352 | * @return bool 353 | */ 354 | public function update{model_name}ById($id, $data) 355 | { 356 | $condition = [ 357 | {model_name}::ID => $id, 358 | ]; 359 | return {model_name}::where($condition)->update($data); 360 | } 361 | 362 | /** 363 | * Update records by conditions. 364 | * 365 | * @param array $conditions 366 | * @param array $data 367 | * 368 | * @return bool 369 | */ 370 | public function update{model_name_plural}ByConditions($conditions, $data) 371 | { 372 | return {model_name}::where($conditions)->update($data); 373 | } 374 | 375 | /** 376 | * Delete record by id. 377 | * 378 | * @param $id 379 | * 380 | * @throws \Exception 381 | * 382 | * @return bool 383 | */ 384 | public function delete{model_name}ById($id) 385 | { 386 | $object = $this->get{model_name}ById($id); 387 | if (null === $object) { 388 | // Can not delete undefined object 389 | return false; 390 | } 391 | 392 | return $object->delete(); 393 | } 394 | 395 | /** 396 | * Force delete record by id. 397 | * 398 | * @param $id 399 | * 400 | * @throws \Exception 401 | * 402 | * @return bool 403 | */ 404 | public function forceDelete{model_name}ById($id) 405 | { 406 | $object = $this->get{model_name}ById($id); 407 | if (null === $object) { 408 | // Can not delete undefined object 409 | return false; 410 | } 411 | 412 | return $object->forceDelete(); 413 | } 414 | 415 | /** 416 | * Delete records by conditions. 417 | * 418 | * @param array $conditions 419 | * 420 | * @return bool 421 | */ 422 | public function delete{model_name_plural}ByConditions($conditions) 423 | { 424 | return {model_name}::where($conditions)->delete(); 425 | } 426 | 427 | /** 428 | * Delete all records. 429 | * 430 | * @return void 431 | */ 432 | public function deleteAll{model_name_plural}() 433 | { 434 | return {model_name}::truncate(); 435 | } 436 | 437 | /** 438 | * Count number of records. 439 | * 440 | * @return int 441 | */ 442 | public function count{model_name}() 443 | { 444 | return {model_name}::count(); 445 | } 446 | """ 447 | 448 | REPOSITORY_INTERFACE_FILTER_TEMPLATE = """ 449 | /** 450 | * {filter_name_label} records by {description_conditions}. 451 | * 452 | {condition_params} 453 | * 454 | * @return {returned_type} 455 | * 456 | * @throws \Exception 457 | */ 458 | public function {filter_name}{model_name_plural}By{camel_conditions}({condition_arguments});""" 459 | 460 | REPOSITORY_IMPLEMENTATION_FILTER_TEMPLATE = """ 461 | /** 462 | * {filter_name_label} records by {description_conditions} 463 | * 464 | {condition_params} 465 | * 466 | * @return {returned_type} 467 | * 468 | * @throws \Exception 469 | */ 470 | public function {filter_name}{model_name_plural}By{camel_conditions}({condition_arguments}) 471 | { 472 | $condition = [ 473 | {constants_with_values}, 474 | ]; 475 | $queryBuilder = {model_name}::where($condition); 476 | 477 | return $queryBuilder->{filter_name}({filter_arguments}); 478 | }""" 479 | 480 | 481 | SERVICE_INTERFACE_TEMPLATE = """ 482 | {model_name_variable}Repository = ${model_name_variable}Repository; 527 | } 528 | 529 | // TODO - Your implementations here 530 | 531 | // AUTO GENERATED - DO NOT MODIFY FROM HERE 532 | } 533 | """ 534 | 535 | SETTER_GETTER_TEMPLATE = """ 536 | /** 537 | * Constant for field `{field_name}`. 538 | */ 539 | const {constant_field_name} = '{field_name}'; 540 | 541 | /** 542 | * Set {method_name} 543 | * This setter will set value for field `{field_name}`. 544 | * 545 | * @param {field_type} ${camel_variable_name} 546 | * 547 | * @return \App\Model\{table_name} 548 | */ 549 | public function {setter_name}(${camel_variable_name}) 550 | { 551 | {intercept_filter_set} 552 | 553 | return $this; 554 | } 555 | 556 | /** 557 | * Get {method_name} 558 | * This getter will get value from field `{field_name}`. 559 | * 560 | * @return {field_type} || null 561 | */ 562 | public function {getter_name}() 563 | { 564 | {intercept_filter_get} 565 | } 566 | """ -------------------------------------------------------------------------------- /go/rest/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/go/rest/.keep -------------------------------------------------------------------------------- /go/skeleton/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/go/skeleton/.keep -------------------------------------------------------------------------------- /php/Dockerfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/Dockerfile -------------------------------------------------------------------------------- /php/README.md: -------------------------------------------------------------------------------- 1 | # Skeleton Application 2 | This skeleton is a lightweight unit to make efficient service. 3 | 4 | -------------------------------------------------------------------------------- /php/artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make( 32 | 'Illuminate\Contracts\Console\Kernel' 33 | ); 34 | 35 | exit($kernel->handle(new ArgvInput, new ConsoleOutput)); -------------------------------------------------------------------------------- /php/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "description": "Skeleton Service", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Author", 9 | "email": "author@email.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "App\\": "src/", 15 | "Test\\": "test/" 16 | } 17 | }, 18 | "require": { 19 | "loint/rest": "dev-master" 20 | }, 21 | "repositories": [ 22 | { 23 | "type": "vcs", 24 | "url": "https://github.com/loint/rest-core.git", 25 | "no-api" : true 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /php/config/api/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "route": "/user", 3 | "method": { 4 | "POST": { 5 | "description": "Create a user", 6 | "author": "Loi Nguyen ", 7 | "input": { 8 | "email": "string", 9 | "username": "string", 10 | "password": "string", 11 | "firstName": "string", 12 | "lastName": "string" 13 | }, 14 | "output": { 15 | "id": "int" 16 | } 17 | }, 18 | "GET": { 19 | "description": "Get all users", 20 | "author": "Loi Nguyen ", 21 | "output": [ 22 | { 23 | "id": "int", 24 | "username": "string", 25 | "email": "string", 26 | "firstName": "string", 27 | "lastName": "string" 28 | } 29 | ] 30 | } 31 | }, 32 | "child": [ 33 | { 34 | "route": "/{id}", 35 | "method": { 36 | "GET": { 37 | "description": "Get user detail", 38 | "author": "Loi Nguyen ", 39 | "output": { 40 | "id": "int", 41 | "username": "string", 42 | "email": "string", 43 | "firstName": "string", 44 | "lastName": "string", 45 | "birthday": "string" 46 | } 47 | }, 48 | "PUT": { 49 | "description": "Update user detail", 50 | "author": "Loi Nguyen env('CACHE_DRIVER', 'file'), 4 | 'stores' => [ 5 | 'file' => [ 6 | 'driver' => 'file', 7 | 'path' => storage_path('framework/cache'), 8 | ], 9 | ], 10 | 'prefix' => env('CACHE_PREFIX', 'cache'), 11 | ]; -------------------------------------------------------------------------------- /php/config/database.php: -------------------------------------------------------------------------------- 1 | 'mysql', 4 | 'migrations' => '_migrations', 5 | 'connections' => [ 6 | 'mysql' => [ 7 | 'read' => [ 8 | 'host' => ['127.0.0.1'], 9 | ], 10 | 'write' => [ 11 | 'host' => ['127.0.0.1'], 12 | ], 13 | 'sticky' => true, 14 | 'driver' => 'mysql', 15 | 'database' => 'database', 16 | 'username' => 'root', 17 | 'password' => 'password', 18 | 'charset' => 'utf8mb4', 19 | 'collation' => 'utf8mb4_unicode_ci', 20 | 'prefix' => '', 21 | ], 22 | ] 23 | ]; 24 | -------------------------------------------------------------------------------- /php/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | ./test/ 16 | 17 | 18 | 19 | 20 | ./src 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /php/public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/.DS_Store -------------------------------------------------------------------------------- /php/public/docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/.DS_Store -------------------------------------------------------------------------------- /php/public/docs/css/reset.css: -------------------------------------------------------------------------------- 1 | a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0} -------------------------------------------------------------------------------- /php/public/docs/css/style.css: -------------------------------------------------------------------------------- 1 | .swagger-section #header a#logo{font-size:1.5em;font-weight:700;text-decoration:none;padding:20px 0 20px 40px}#text-head{font-size:80px;font-family:Roboto,sans-serif;color:#fff;float:right;margin-right:20%}.navbar-fixed-top .navbar-brand,.navbar-fixed-top .navbar-nav,.navbar-header{height:auto}.navbar-inverse{background-color:#000;border-color:#000}#navbar-brand{margin-left:20%}.navtext{font-size:10px}.h1,h1{font-size:60px}.navbar-default .navbar-header .navbar-brand{color:#a2dfee}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#393939;font-family:Arvo,serif;font-size:1.5em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#525252;padding-left:0;display:block;clear:none;float:left;font-family:Arvo,serif;font-weight:700}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#0a0a0a}.container1{width:1500px;margin:auto;margin-top:0;background-repeat:no-repeat;background-position:-40px -20px;margin-bottom:210px}.container-inner{width:1200px;margin:auto;background-color:hsla(192,8%,88%,.75);padding-bottom:40px;padding-top:40px;border-radius:15px}.header-content{padding:0;width:1000px}.title1{font-size:80px;font-family:Vollkorn,serif;color:#404040;text-align:center;padding-top:40px;padding-bottom:100px}#icon{margin-top:-18px}.subtext{font-size:25px;font-style:italic;color:#08b;text-align:right;padding-right:250px}.bg-primary{background-color:#00468b}.navbar-default .nav>li>a,.navbar-default .nav>li>a:focus,.navbar-default .nav>li>a:focus:hover,.navbar-default .nav>li>a:hover{color:#08b}.text-faded{font-size:25px;font-family:Vollkorn,serif}.section-heading{font-family:Vollkorn,serif;font-size:45px;padding-bottom:10px}hr{border-color:#00468b;padding-bottom:10px}.description{margin-top:20px;padding-bottom:200px}.description li{font-family:Vollkorn,serif;font-size:25px;color:#525252;margin-left:28%;padding-top:5px}.gap{margin-top:200px}.troubleshootingtext{color:hsla(0,0%,100%,.7);padding-left:30%}.troubleshootingtext li{list-style-type:circle;font-size:25px;padding-bottom:5px}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.block.response_body.json:hover{cursor:pointer}.backdrop{color:blue}#myModal{height:100%}.modal-backdrop{bottom:0;position:fixed}.curl{padding:10px;font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em;max-height:400px;margin-top:5px;overflow-y:auto;background-color:#fcf6db;border:1px solid #e5e0c6;border-radius:4px}.curl_title{font-size:1.1em;margin:0;padding:15px 0 5px;font-family:Open Sans,Helvetica Neue,Arial,sans-serif;font-weight:500;line-height:1.1}.footer{display:none}.swagger-section .swagger-ui-wrap h2{padding:0}h2{margin:0;margin-bottom:5px}.markdown p,.swagger-section .swagger-ui-wrap .code{font-size:15px;font-family:Arvo,serif}.swagger-section .swagger-ui-wrap b{font-family:Arvo,serif}#signin:hover{cursor:pointer}.dropdown-menu{padding:15px}.navbar-right .dropdown-menu{left:0;right:auto}#signinbutton{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b}.navbar-default .nav>li .details{color:#000;text-transform:none;font-size:15px;font-weight:400;font-family:Open Sans,sans-serif;font-style:italic;line-height:20px;top:-2px}.navbar-default .nav>li .details:hover{color:#000}#signout{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b} -------------------------------------------------------------------------------- /php/public/docs/css/typography.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/css/typography.css -------------------------------------------------------------------------------- /php/public/docs/fonts/DroidSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/fonts/DroidSans-Bold.ttf -------------------------------------------------------------------------------- /php/public/docs/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /php/public/docs/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/collapse.gif -------------------------------------------------------------------------------- /php/public/docs/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/expand.gif -------------------------------------------------------------------------------- /php/public/docs/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/explorer_icons.png -------------------------------------------------------------------------------- /php/public/docs/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/favicon-16x16.png -------------------------------------------------------------------------------- /php/public/docs/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/favicon-32x32.png -------------------------------------------------------------------------------- /php/public/docs/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/favicon.ico -------------------------------------------------------------------------------- /php/public/docs/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/logo_small.png -------------------------------------------------------------------------------- /php/public/docs/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/pet_store_api.png -------------------------------------------------------------------------------- /php/public/docs/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/throbber.gif -------------------------------------------------------------------------------- /php/public/docs/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loint/rest-cli/dcad975569ec8cc66228daec9b37ee6838206536/php/public/docs/images/wordnik_api.png -------------------------------------------------------------------------------- /php/public/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 92 | 93 | 94 | 95 | 96 |
 
97 |
98 | 99 | 100 | -------------------------------------------------------------------------------- /php/public/docs/lang/ca.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertència: Obsolet", 6 | "Implementation Notes":"Notes d'implementació", 7 | "Response Class":"Classe de la Resposta", 8 | "Status":"Estatus", 9 | "Parameters":"Paràmetres", 10 | "Parameter":"Paràmetre", 11 | "Value":"Valor", 12 | "Description":"Descripció", 13 | "Parameter Type":"Tipus del Paràmetre", 14 | "Data Type":"Tipus de la Dada", 15 | "Response Messages":"Missatges de la Resposta", 16 | "HTTP Status Code":"Codi d'Estatus HTTP", 17 | "Reason":"Raó", 18 | "Response Model":"Model de la Resposta", 19 | "Request URL":"URL de la Sol·licitud", 20 | "Response Body":"Cos de la Resposta", 21 | "Response Code":"Codi de la Resposta", 22 | "Response Headers":"Capçaleres de la Resposta", 23 | "Hide Response":"Amagar Resposta", 24 | "Try it out!":"Prova-ho!", 25 | "Show/Hide":"Mostrar/Amagar", 26 | "List Operations":"Llista Operacions", 27 | "Expand Operations":"Expandir Operacions", 28 | "Raw":"Cru", 29 | "can't parse JSON. Raw result":"no puc analitzar el JSON. Resultat cru", 30 | "Example Value":"Valor d'Exemple", 31 | "Model Schema":"Esquema del Model", 32 | "Model":"Model", 33 | "apply":"aplicar", 34 | "Username":"Nom d'usuari", 35 | "Password":"Contrasenya", 36 | "Terms of service":"Termes del servei", 37 | "Created by":"Creat per", 38 | "See more at":"Veure més en", 39 | "Contact the developer":"Contactar amb el desenvolupador", 40 | "api version":"versió de la api", 41 | "Response Content Type":"Tipus de Contingut de la Resposta", 42 | "fetching resource":"recollint recurs", 43 | "fetching resource list":"recollins llista de recursos", 44 | "Explore":"Explorant", 45 | "Show Swagger Petstore Example Apis":"Mostrar API d'Exemple Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No es pot llegir del servidor. Potser no teniu la configuració de control d'accés apropiada.", 47 | "Please specify the protocol for":"Si us plau, especifiqueu el protocol per a", 48 | "Can't read swagger JSON from":"No es pot llegir el JSON de swagger des de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalitzada la càrrega del recurs informatiu. Renderitzant Swagger UI", 50 | "Unable to read api":"No es pot llegir l'api", 51 | "from path":"des de la ruta", 52 | "server returned":"el servidor ha retornat" 53 | }); 54 | -------------------------------------------------------------------------------- /php/public/docs/lang/el.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Προειδοποίηση: Έχει αποσυρθεί", 6 | "Implementation Notes":"Σημειώσεις Υλοποίησης", 7 | "Response Class":"Απόκριση", 8 | "Status":"Κατάσταση", 9 | "Parameters":"Παράμετροι", 10 | "Parameter":"Παράμετρος", 11 | "Value":"Τιμή", 12 | "Description":"Περιγραφή", 13 | "Parameter Type":"Τύπος Παραμέτρου", 14 | "Data Type":"Τύπος Δεδομένων", 15 | "Response Messages":"Μηνύματα Απόκρισης", 16 | "HTTP Status Code":"Κωδικός Κατάστασης HTTP", 17 | "Reason":"Αιτιολογία", 18 | "Response Model":"Μοντέλο Απόκρισης", 19 | "Request URL":"URL Αιτήματος", 20 | "Response Body":"Σώμα Απόκρισης", 21 | "Response Code":"Κωδικός Απόκρισης", 22 | "Response Headers":"Επικεφαλίδες Απόκρισης", 23 | "Hide Response":"Απόκρυψη Απόκρισης", 24 | "Headers":"Επικεφαλίδες", 25 | "Try it out!":"Δοκιμάστε το!", 26 | "Show/Hide":"Εμφάνιση/Απόκρυψη", 27 | "List Operations":"Λίστα Λειτουργιών", 28 | "Expand Operations":"Ανάπτυξη Λειτουργιών", 29 | "Raw":"Ακατέργαστο", 30 | "can't parse JSON. Raw result":"αδυναμία ανάλυσης JSON. Ακατέργαστο αποτέλεσμα", 31 | "Example Value":"Παράδειγμα Τιμής", 32 | "Model Schema":"Σχήμα Μοντέλου", 33 | "Model":"Μοντέλο", 34 | "Click to set as parameter value":"Πατήστε για να θέσετε τιμή παραμέτρου", 35 | "apply":"εφαρμογή", 36 | "Username":"Όνομα χρήση", 37 | "Password":"Κωδικός πρόσβασης", 38 | "Terms of service":"Όροι χρήσης", 39 | "Created by":"Δημιουργήθηκε από", 40 | "See more at":"Δείτε περισσότερα στο", 41 | "Contact the developer":"Επικοινωνήστε με τον προγραμματιστή", 42 | "api version":"έκδοση api", 43 | "Response Content Type":"Τύπος Περιεχομένου Απόκρισης", 44 | "Parameter content type:":"Τύπος περιεχομένου παραμέτρου:", 45 | "fetching resource":"παραλαβή πόρου", 46 | "fetching resource list":"παραλαβή λίστας πόρων", 47 | "Explore":"Εξερεύνηση", 48 | "Show Swagger Petstore Example Apis":"Εμφάνιση Api Δειγμάτων Petstore του Swagger", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Αδυναμία ανάγνωσης από τον εξυπηρετητή. Μπορεί να μην έχει κατάλληλες ρυθμίσεις για access-control-origin.", 50 | "Please specify the protocol for":"Παρακαλώ προσδιορίστε το πρωτόκολλο για", 51 | "Can't read swagger JSON from":"Αδυναμία ανάγνωσης swagger JSON από", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Ολοκλήρωση Φόρτωσης Πληροφορικών Πόρου. Παρουσίαση Swagger UI", 53 | "Unable to read api":"Αδυναμία ανάγνωσης api", 54 | "from path":"από το μονοπάτι", 55 | "server returned":"ο εξυπηρετηρής επέστρεψε" 56 | }); 57 | -------------------------------------------------------------------------------- /php/public/docs/lang/en.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Warning: Deprecated", 6 | "Implementation Notes":"Implementation Notes", 7 | "Response Class":"Response Class", 8 | "Status":"Status", 9 | "Parameters":"Parameters", 10 | "Parameter":"Parameter", 11 | "Value":"Value", 12 | "Description":"Description", 13 | "Parameter Type":"Parameter Type", 14 | "Data Type":"Data Type", 15 | "Response Messages":"Response Messages", 16 | "HTTP Status Code":"HTTP Status Code", 17 | "Reason":"Reason", 18 | "Response Model":"Response Model", 19 | "Request URL":"Request URL", 20 | "Response Body":"Response Body", 21 | "Response Code":"Response Code", 22 | "Response Headers":"Response Headers", 23 | "Hide Response":"Hide Response", 24 | "Headers":"Headers", 25 | "Try it out!":"Try it out!", 26 | "Show/Hide":"Show/Hide", 27 | "List Operations":"List Operations", 28 | "Expand Operations":"Expand Operations", 29 | "Raw":"Raw", 30 | "can't parse JSON. Raw result":"can't parse JSON. Raw result", 31 | "Example Value":"Example Value", 32 | "Model Schema":"Model Schema", 33 | "Model":"Model", 34 | "Click to set as parameter value":"Click to set as parameter value", 35 | "apply":"apply", 36 | "Username":"Username", 37 | "Password":"Password", 38 | "Terms of service":"Terms of service", 39 | "Created by":"Created by", 40 | "See more at":"See more at", 41 | "Contact the developer":"Contact the developer", 42 | "api version":"api version", 43 | "Response Content Type":"Response Content Type", 44 | "Parameter content type:":"Parameter content type:", 45 | "fetching resource":"fetching resource", 46 | "fetching resource list":"fetching resource list", 47 | "Explore":"Explore", 48 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", 50 | "Please specify the protocol for":"Please specify the protocol for", 51 | "Can't read swagger JSON from":"Can't read swagger JSON from", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", 53 | "Unable to read api":"Unable to read api", 54 | "from path":"from path", 55 | "server returned":"server returned" 56 | }); 57 | -------------------------------------------------------------------------------- /php/public/docs/lang/es.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Advertencia: Obsoleto", 6 | "Implementation Notes":"Notas de implementación", 7 | "Response Class":"Clase de la Respuesta", 8 | "Status":"Status", 9 | "Parameters":"Parámetros", 10 | "Parameter":"Parámetro", 11 | "Value":"Valor", 12 | "Description":"Descripción", 13 | "Parameter Type":"Tipo del Parámetro", 14 | "Data Type":"Tipo del Dato", 15 | "Response Messages":"Mensajes de la Respuesta", 16 | "HTTP Status Code":"Código de Status HTTP", 17 | "Reason":"Razón", 18 | "Response Model":"Modelo de la Respuesta", 19 | "Request URL":"URL de la Solicitud", 20 | "Response Body":"Cuerpo de la Respuesta", 21 | "Response Code":"Código de la Respuesta", 22 | "Response Headers":"Encabezados de la Respuesta", 23 | "Hide Response":"Ocultar Respuesta", 24 | "Try it out!":"Pruébalo!", 25 | "Show/Hide":"Mostrar/Ocultar", 26 | "List Operations":"Listar Operaciones", 27 | "Expand Operations":"Expandir Operaciones", 28 | "Raw":"Crudo", 29 | "can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo", 30 | "Example Value":"Valor de Ejemplo", 31 | "Model Schema":"Esquema del Modelo", 32 | "Model":"Modelo", 33 | "apply":"aplicar", 34 | "Username":"Nombre de usuario", 35 | "Password":"Contraseña", 36 | "Terms of service":"Términos de Servicio", 37 | "Created by":"Creado por", 38 | "See more at":"Ver más en", 39 | "Contact the developer":"Contactar al desarrollador", 40 | "api version":"versión de la api", 41 | "Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta", 42 | "fetching resource":"buscando recurso", 43 | "fetching resource list":"buscando lista del recurso", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.", 47 | "Please specify the protocol for":"Por favor, especificar el protocola para", 48 | "Can't read swagger JSON from":"No se puede leer el JSON de swagger desde", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI", 50 | "Unable to read api":"No se puede leer la api", 51 | "from path":"desde ruta", 52 | "server returned":"el servidor retornó" 53 | }); 54 | -------------------------------------------------------------------------------- /php/public/docs/lang/fr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Avertissement : Obsolète", 6 | "Implementation Notes":"Notes d'implémentation", 7 | "Response Class":"Classe de la réponse", 8 | "Status":"Statut", 9 | "Parameters":"Paramètres", 10 | "Parameter":"Paramètre", 11 | "Value":"Valeur", 12 | "Description":"Description", 13 | "Parameter Type":"Type du paramètre", 14 | "Data Type":"Type de données", 15 | "Response Messages":"Messages de la réponse", 16 | "HTTP Status Code":"Code de statut HTTP", 17 | "Reason":"Raison", 18 | "Response Model":"Modèle de réponse", 19 | "Request URL":"URL appelée", 20 | "Response Body":"Corps de la réponse", 21 | "Response Code":"Code de la réponse", 22 | "Response Headers":"En-têtes de la réponse", 23 | "Hide Response":"Cacher la réponse", 24 | "Headers":"En-têtes", 25 | "Try it out!":"Testez !", 26 | "Show/Hide":"Afficher/Masquer", 27 | "List Operations":"Liste des opérations", 28 | "Expand Operations":"Développer les opérations", 29 | "Raw":"Brut", 30 | "can't parse JSON. Raw result":"impossible de décoder le JSON. Résultat brut", 31 | "Example Value":"Exemple la valeur", 32 | "Model Schema":"Définition du modèle", 33 | "Model":"Modèle", 34 | "apply":"appliquer", 35 | "Username":"Nom d'utilisateur", 36 | "Password":"Mot de passe", 37 | "Terms of service":"Conditions de service", 38 | "Created by":"Créé par", 39 | "See more at":"Voir plus sur", 40 | "Contact the developer":"Contacter le développeur", 41 | "api version":"version de l'api", 42 | "Response Content Type":"Content Type de la réponse", 43 | "fetching resource":"récupération de la ressource", 44 | "fetching resource list":"récupération de la liste de ressources", 45 | "Explore":"Explorer", 46 | "Show Swagger Petstore Example Apis":"Montrer les Apis de l'exemple Petstore de Swagger", 47 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Impossible de lire à partir du serveur. Il se peut que les réglages access-control-origin ne soient pas appropriés.", 48 | "Please specify the protocol for":"Veuillez spécifier un protocole pour", 49 | "Can't read swagger JSON from":"Impossible de lire le JSON swagger à partir de", 50 | "Finished Loading Resource Information. Rendering Swagger UI":"Chargement des informations terminé. Affichage de Swagger UI", 51 | "Unable to read api":"Impossible de lire l'api", 52 | "from path":"à partir du chemin", 53 | "server returned":"réponse du serveur" 54 | }); 55 | -------------------------------------------------------------------------------- /php/public/docs/lang/geo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"ყურადღება: აღარ გამოიყენება", 6 | "Implementation Notes":"იმპლემენტაციის აღწერა", 7 | "Response Class":"რესპონს კლასი", 8 | "Status":"სტატუსი", 9 | "Parameters":"პარამეტრები", 10 | "Parameter":"პარამეტრი", 11 | "Value":"მნიშვნელობა", 12 | "Description":"აღწერა", 13 | "Parameter Type":"პარამეტრის ტიპი", 14 | "Data Type":"მონაცემის ტიპი", 15 | "Response Messages":"პასუხი", 16 | "HTTP Status Code":"HTTP სტატუსი", 17 | "Reason":"მიზეზი", 18 | "Response Model":"რესპონს მოდელი", 19 | "Request URL":"მოთხოვნის URL", 20 | "Response Body":"პასუხის სხეული", 21 | "Response Code":"პასუხის კოდი", 22 | "Response Headers":"პასუხის ჰედერები", 23 | "Hide Response":"დამალე პასუხი", 24 | "Headers":"ჰედერები", 25 | "Try it out!":"ცადე !", 26 | "Show/Hide":"გამოჩენა/დამალვა", 27 | "List Operations":"ოპერაციების სია", 28 | "Expand Operations":"ოპერაციები ვრცლად", 29 | "Raw":"ნედლი", 30 | "can't parse JSON. Raw result":"JSON-ის დამუშავება ვერ მოხერხდა. ნედლი პასუხი", 31 | "Example Value":"მაგალითი", 32 | "Model Schema":"მოდელის სტრუქტურა", 33 | "Model":"მოდელი", 34 | "Click to set as parameter value":"პარამეტრისთვის მნიშვნელობის მისანიჭებლად, დააკლიკე", 35 | "apply":"გამოყენება", 36 | "Username":"მოხმარებელი", 37 | "Password":"პაროლი", 38 | "Terms of service":"მომსახურების პირობები", 39 | "Created by":"შექმნა", 40 | "See more at":"ნახე ვრცლად", 41 | "Contact the developer":"დაუკავშირდი დეველოპერს", 42 | "api version":"api ვერსია", 43 | "Response Content Type":"პასუხის კონტენტის ტიპი", 44 | "Parameter content type:":"პარამეტრის კონტენტის ტიპი:", 45 | "fetching resource":"რესურსების მიღება", 46 | "fetching resource list":"რესურსების სიის მიღება", 47 | "Explore":"ნახვა", 48 | "Show Swagger Petstore Example Apis":"ნახე Swagger Petstore სამაგალითო Api", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"სერვერთან დაკავშირება ვერ ხერხდება. შეამოწმეთ access-control-origin.", 50 | "Please specify the protocol for":"მიუთითეთ პროტოკოლი", 51 | "Can't read swagger JSON from":"swagger JSON წაკითხვა ვერ მოხერხდა", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"რესურსების ჩატვირთვა სრულდება. Swagger UI რენდერდება", 53 | "Unable to read api":"api წაკითხვა ვერ მოხერხდა", 54 | "from path":"მისამართიდან", 55 | "server returned":"სერვერმა დააბრუნა" 56 | }); 57 | -------------------------------------------------------------------------------- /php/public/docs/lang/it.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Attenzione: Deprecato", 6 | "Implementation Notes":"Note di implementazione", 7 | "Response Class":"Classe della risposta", 8 | "Status":"Stato", 9 | "Parameters":"Parametri", 10 | "Parameter":"Parametro", 11 | "Value":"Valore", 12 | "Description":"Descrizione", 13 | "Parameter Type":"Tipo di parametro", 14 | "Data Type":"Tipo di dato", 15 | "Response Messages":"Messaggi della risposta", 16 | "HTTP Status Code":"Codice stato HTTP", 17 | "Reason":"Motivo", 18 | "Response Model":"Modello di risposta", 19 | "Request URL":"URL della richiesta", 20 | "Response Body":"Corpo della risposta", 21 | "Response Code":"Oggetto della risposta", 22 | "Response Headers":"Intestazioni della risposta", 23 | "Hide Response":"Nascondi risposta", 24 | "Try it out!":"Provalo!", 25 | "Show/Hide":"Mostra/Nascondi", 26 | "List Operations":"Mostra operazioni", 27 | "Expand Operations":"Espandi operazioni", 28 | "Raw":"Grezzo (raw)", 29 | "can't parse JSON. Raw result":"non è possibile parsare il JSON. Risultato grezzo (raw).", 30 | "Model Schema":"Schema del modello", 31 | "Model":"Modello", 32 | "apply":"applica", 33 | "Username":"Nome utente", 34 | "Password":"Password", 35 | "Terms of service":"Condizioni del servizio", 36 | "Created by":"Creato da", 37 | "See more at":"Informazioni aggiuntive:", 38 | "Contact the developer":"Contatta lo sviluppatore", 39 | "api version":"versione api", 40 | "Response Content Type":"Tipo di contenuto (content type) della risposta", 41 | "fetching resource":"recuperando la risorsa", 42 | "fetching resource list":"recuperando lista risorse", 43 | "Explore":"Esplora", 44 | "Show Swagger Petstore Example Apis":"Mostra le api di esempio di Swagger Petstore", 45 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Non è possibile leggere dal server. Potrebbe non avere le impostazioni di controllo accesso origine (access-control-origin) appropriate.", 46 | "Please specify the protocol for":"Si prega di specificare il protocollo per", 47 | "Can't read swagger JSON from":"Impossibile leggere JSON swagger da:", 48 | "Finished Loading Resource Information. Rendering Swagger UI":"Lettura informazioni risorse termianta. Swagger UI viene mostrata", 49 | "Unable to read api":"Impossibile leggere la api", 50 | "from path":"da cartella", 51 | "server returned":"il server ha restituito" 52 | }); 53 | -------------------------------------------------------------------------------- /php/public/docs/lang/ja.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告: 廃止予定", 6 | "Implementation Notes":"実装メモ", 7 | "Response Class":"レスポンスクラス", 8 | "Status":"ステータス", 9 | "Parameters":"パラメータ群", 10 | "Parameter":"パラメータ", 11 | "Value":"値", 12 | "Description":"説明", 13 | "Parameter Type":"パラメータタイプ", 14 | "Data Type":"データタイプ", 15 | "Response Messages":"レスポンスメッセージ", 16 | "HTTP Status Code":"HTTPステータスコード", 17 | "Reason":"理由", 18 | "Response Model":"レスポンスモデル", 19 | "Request URL":"リクエストURL", 20 | "Response Body":"レスポンスボディ", 21 | "Response Code":"レスポンスコード", 22 | "Response Headers":"レスポンスヘッダ", 23 | "Hide Response":"レスポンスを隠す", 24 | "Headers":"ヘッダ", 25 | "Try it out!":"実際に実行!", 26 | "Show/Hide":"表示/非表示", 27 | "List Operations":"操作一覧", 28 | "Expand Operations":"操作の展開", 29 | "Raw":"未加工", 30 | "can't parse JSON. Raw result":"JSONへ解釈できません. 未加工の結果", 31 | "Example Value":"値の例", 32 | "Model Schema":"モデルスキーマ", 33 | "Model":"モデル", 34 | "Click to set as parameter value":"パラメータ値と設定するにはクリック", 35 | "apply":"実行", 36 | "Username":"ユーザ名", 37 | "Password":"パスワード", 38 | "Terms of service":"サービス利用規約", 39 | "Created by":"Created by", 40 | "See more at":"詳細を見る", 41 | "Contact the developer":"開発者に連絡", 42 | "api version":"APIバージョン", 43 | "Response Content Type":"レスポンス コンテンツタイプ", 44 | "Parameter content type:":"パラメータコンテンツタイプ:", 45 | "fetching resource":"リソースの取得", 46 | "fetching resource list":"リソース一覧の取得", 47 | "Explore":"調査", 48 | "Show Swagger Petstore Example Apis":"SwaggerペットストアAPIの表示", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"サーバから読み込めません. 適切なaccess-control-origin設定を持っていない可能性があります.", 50 | "Please specify the protocol for":"プロトコルを指定してください", 51 | "Can't read swagger JSON from":"次からswagger JSONを読み込めません", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"リソース情報の読み込みが完了しました. Swagger UIを描画しています", 53 | "Unable to read api":"APIを読み込めません", 54 | "from path":"次のパスから", 55 | "server returned":"サーバからの返答" 56 | }); 57 | -------------------------------------------------------------------------------- /php/public/docs/lang/ko-kr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"경고:폐기예정됨", 6 | "Implementation Notes":"구현 노트", 7 | "Response Class":"응답 클래스", 8 | "Status":"상태", 9 | "Parameters":"매개변수들", 10 | "Parameter":"매개변수", 11 | "Value":"값", 12 | "Description":"설명", 13 | "Parameter Type":"매개변수 타입", 14 | "Data Type":"데이터 타입", 15 | "Response Messages":"응답 메세지", 16 | "HTTP Status Code":"HTTP 상태 코드", 17 | "Reason":"원인", 18 | "Response Model":"응답 모델", 19 | "Request URL":"요청 URL", 20 | "Response Body":"응답 본문", 21 | "Response Code":"응답 코드", 22 | "Response Headers":"응답 헤더", 23 | "Hide Response":"응답 숨기기", 24 | "Headers":"헤더", 25 | "Try it out!":"써보기!", 26 | "Show/Hide":"보이기/숨기기", 27 | "List Operations":"목록 작업", 28 | "Expand Operations":"전개 작업", 29 | "Raw":"원본", 30 | "can't parse JSON. Raw result":"JSON을 파싱할수 없음. 원본결과:", 31 | "Model Schema":"모델 스키마", 32 | "Model":"모델", 33 | "apply":"적용", 34 | "Username":"사용자 이름", 35 | "Password":"암호", 36 | "Terms of service":"이용약관", 37 | "Created by":"작성자", 38 | "See more at":"추가정보:", 39 | "Contact the developer":"개발자에게 문의", 40 | "api version":"api버전", 41 | "Response Content Type":"응답Content Type", 42 | "fetching resource":"리소스 가져오기", 43 | "fetching resource list":"리소스 목록 가져오기", 44 | "Explore":"탐색", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore 예제 보기", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"서버로부터 읽어들일수 없습니다. access-control-origin 설정이 올바르지 않을수 있습니다.", 47 | "Please specify the protocol for":"다음을 위한 프로토콜을 정하세요", 48 | "Can't read swagger JSON from":"swagger JSON 을 다음으로 부터 읽을수 없습니다", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"리소스 정보 불러오기 완료. Swagger UI 랜더링", 50 | "Unable to read api":"api를 읽을 수 없습니다.", 51 | "from path":"다음 경로로 부터", 52 | "server returned":"서버 응답함." 53 | }); 54 | -------------------------------------------------------------------------------- /php/public/docs/lang/pl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uwaga: Wycofane", 6 | "Implementation Notes":"Uwagi Implementacji", 7 | "Response Class":"Klasa Odpowiedzi", 8 | "Status":"Status", 9 | "Parameters":"Parametry", 10 | "Parameter":"Parametr", 11 | "Value":"Wartość", 12 | "Description":"Opis", 13 | "Parameter Type":"Typ Parametru", 14 | "Data Type":"Typ Danych", 15 | "Response Messages":"Wiadomości Odpowiedzi", 16 | "HTTP Status Code":"Kod Statusu HTTP", 17 | "Reason":"Przyczyna", 18 | "Response Model":"Model Odpowiedzi", 19 | "Request URL":"URL Wywołania", 20 | "Response Body":"Treść Odpowiedzi", 21 | "Response Code":"Kod Odpowiedzi", 22 | "Response Headers":"Nagłówki Odpowiedzi", 23 | "Hide Response":"Ukryj Odpowiedź", 24 | "Headers":"Nagłówki", 25 | "Try it out!":"Wypróbuj!", 26 | "Show/Hide":"Pokaż/Ukryj", 27 | "List Operations":"Lista Operacji", 28 | "Expand Operations":"Rozwiń Operacje", 29 | "Raw":"Nieprzetworzone", 30 | "can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane", 31 | "Model Schema":"Schemat Modelu", 32 | "Model":"Model", 33 | "apply":"użyj", 34 | "Username":"Nazwa użytkownika", 35 | "Password":"Hasło", 36 | "Terms of service":"Warunki używania", 37 | "Created by":"Utworzone przez", 38 | "See more at":"Zobacz więcej na", 39 | "Contact the developer":"Kontakt z deweloperem", 40 | "api version":"wersja api", 41 | "Response Content Type":"Typ Zasobu Odpowiedzi", 42 | "fetching resource":"ładowanie zasobu", 43 | "fetching resource list":"ładowanie listy zasobów", 44 | "Explore":"Eksploruj", 45 | "Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.", 47 | "Please specify the protocol for":"Proszę podać protokół dla", 48 | "Can't read swagger JSON from":"Nie można odczytać swagger JSON z", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Ukończono Ładowanie Informacji o Zasobie. Renderowanie Swagger UI", 50 | "Unable to read api":"Nie można odczytać api", 51 | "from path":"ze ścieżki", 52 | "server returned":"serwer zwrócił" 53 | }); 54 | -------------------------------------------------------------------------------- /php/public/docs/lang/pt.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Aviso: Depreciado", 6 | "Implementation Notes":"Notas de Implementação", 7 | "Response Class":"Classe de resposta", 8 | "Status":"Status", 9 | "Parameters":"Parâmetros", 10 | "Parameter":"Parâmetro", 11 | "Value":"Valor", 12 | "Description":"Descrição", 13 | "Parameter Type":"Tipo de parâmetro", 14 | "Data Type":"Tipo de dados", 15 | "Response Messages":"Mensagens de resposta", 16 | "HTTP Status Code":"Código de status HTTP", 17 | "Reason":"Razão", 18 | "Response Model":"Modelo resposta", 19 | "Request URL":"URL requisição", 20 | "Response Body":"Corpo da resposta", 21 | "Response Code":"Código da resposta", 22 | "Response Headers":"Cabeçalho da resposta", 23 | "Headers":"Cabeçalhos", 24 | "Hide Response":"Esconder resposta", 25 | "Try it out!":"Tente agora!", 26 | "Show/Hide":"Mostrar/Esconder", 27 | "List Operations":"Listar operações", 28 | "Expand Operations":"Expandir operações", 29 | "Raw":"Cru", 30 | "can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru", 31 | "Model Schema":"Modelo esquema", 32 | "Model":"Modelo", 33 | "apply":"Aplicar", 34 | "Username":"Usuário", 35 | "Password":"Senha", 36 | "Terms of service":"Termos do serviço", 37 | "Created by":"Criado por", 38 | "See more at":"Veja mais em", 39 | "Contact the developer":"Contate o desenvolvedor", 40 | "api version":"Versão api", 41 | "Response Content Type":"Tipo de conteúdo da resposta", 42 | "fetching resource":"busca recurso", 43 | "fetching resource list":"buscando lista de recursos", 44 | "Explore":"Explorar", 45 | "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Pode não ter as apropriadas configurações access-control-origin", 47 | "Please specify the protocol for":"Por favor especifique o protocolo", 48 | "Can't read swagger JSON from":"Não é possível ler o JSON Swagger de", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Carregar informação de recurso finalizada. Renderizando Swagger UI", 50 | "Unable to read api":"Não foi possível ler api", 51 | "from path":"do caminho", 52 | "server returned":"servidor retornou" 53 | }); 54 | -------------------------------------------------------------------------------- /php/public/docs/lang/ru.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Предупреждение: Устарело", 6 | "Implementation Notes":"Заметки", 7 | "Response Class":"Пример ответа", 8 | "Status":"Статус", 9 | "Parameters":"Параметры", 10 | "Parameter":"Параметр", 11 | "Value":"Значение", 12 | "Description":"Описание", 13 | "Parameter Type":"Тип параметра", 14 | "Data Type":"Тип данных", 15 | "HTTP Status Code":"HTTP код", 16 | "Reason":"Причина", 17 | "Response Model":"Структура ответа", 18 | "Request URL":"URL запроса", 19 | "Response Body":"Тело ответа", 20 | "Response Code":"HTTP код ответа", 21 | "Response Headers":"Заголовки ответа", 22 | "Hide Response":"Спрятать ответ", 23 | "Headers":"Заголовки", 24 | "Response Messages":"Что может прийти в ответ", 25 | "Try it out!":"Попробовать!", 26 | "Show/Hide":"Показать/Скрыть", 27 | "List Operations":"Операции кратко", 28 | "Expand Operations":"Операции подробно", 29 | "Raw":"В сыром виде", 30 | "can't parse JSON. Raw result":"Не удается распарсить ответ:", 31 | "Example Value":"Пример", 32 | "Model Schema":"Структура", 33 | "Model":"Описание", 34 | "Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра", 35 | "apply":"применить", 36 | "Username":"Имя пользователя", 37 | "Password":"Пароль", 38 | "Terms of service":"Условия использования", 39 | "Created by":"Разработано", 40 | "See more at":"Еще тут", 41 | "Contact the developer":"Связаться с разработчиком", 42 | "api version":"Версия API", 43 | "Response Content Type":"Content Type ответа", 44 | "Parameter content type:":"Content Type параметра:", 45 | "fetching resource":"Получение ресурса", 46 | "fetching resource list":"Получение ресурсов", 47 | "Explore":"Показать", 48 | "Show Swagger Petstore Example Apis":"Показать примеры АПИ", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа", 50 | "Please specify the protocol for":"Пожалуйста, укажите протокол для", 51 | "Can't read swagger JSON from":"Не получается прочитать swagger json из", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", 53 | "Unable to read api":"Не удалось прочитать api", 54 | "from path":"по адресу", 55 | "server returned":"сервер сказал" 56 | }); 57 | -------------------------------------------------------------------------------- /php/public/docs/lang/tr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"Uyarı: Deprecated", 6 | "Implementation Notes":"Gerçekleştirim Notları", 7 | "Response Class":"Dönen Sınıf", 8 | "Status":"Statü", 9 | "Parameters":"Parametreler", 10 | "Parameter":"Parametre", 11 | "Value":"Değer", 12 | "Description":"Açıklama", 13 | "Parameter Type":"Parametre Tipi", 14 | "Data Type":"Veri Tipi", 15 | "Response Messages":"Dönüş Mesajı", 16 | "HTTP Status Code":"HTTP Statü Kodu", 17 | "Reason":"Gerekçe", 18 | "Response Model":"Dönüş Modeli", 19 | "Request URL":"İstek URL", 20 | "Response Body":"Dönüş İçeriği", 21 | "Response Code":"Dönüş Kodu", 22 | "Response Headers":"Dönüş Üst Bilgileri", 23 | "Hide Response":"Dönüşü Gizle", 24 | "Headers":"Üst Bilgiler", 25 | "Try it out!":"Dene!", 26 | "Show/Hide":"Göster/Gizle", 27 | "List Operations":"Operasyonları Listele", 28 | "Expand Operations":"Operasyonları Aç", 29 | "Raw":"Ham", 30 | "can't parse JSON. Raw result":"JSON çözümlenemiyor. Ham sonuç", 31 | "Model Schema":"Model Şema", 32 | "Model":"Model", 33 | "apply":"uygula", 34 | "Username":"Kullanıcı Adı", 35 | "Password":"Parola", 36 | "Terms of service":"Servis şartları", 37 | "Created by":"Oluşturan", 38 | "See more at":"Daha fazlası için", 39 | "Contact the developer":"Geliştirici ile İletişime Geçin", 40 | "api version":"api versiyon", 41 | "Response Content Type":"Dönüş İçerik Tipi", 42 | "fetching resource":"kaynak getiriliyor", 43 | "fetching resource list":"kaynak listesi getiriliyor", 44 | "Explore":"Keşfet", 45 | "Show Swagger Petstore Example Apis":"Swagger Petstore Örnek Api'yi Gör", 46 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"Sunucudan okuma yapılamıyor. Sunucu access-control-origin ayarlarınızı kontrol edin.", 47 | "Please specify the protocol for":"Lütfen istenen adres için protokol belirtiniz", 48 | "Can't read swagger JSON from":"Swagger JSON bu kaynaktan okunamıyor", 49 | "Finished Loading Resource Information. Rendering Swagger UI":"Kaynak baglantısı tamamlandı. Swagger UI gösterime hazırlanıyor", 50 | "Unable to read api":"api okunamadı", 51 | "from path":"yoldan", 52 | "server returned":"sunucuya dönüldü" 53 | }); 54 | -------------------------------------------------------------------------------- /php/public/docs/lang/translator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Translator for documentation pages. 5 | * 6 | * To enable translation you should include one of language-files in your index.html 7 | * after . 8 | * For example - 9 | * 10 | * If you wish to translate some new texts you should do two things: 11 | * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. 12 | * 2. Mark that text it templates this way New Phrase or . 13 | * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. 14 | * 15 | */ 16 | window.SwaggerTranslator = { 17 | 18 | _words:[], 19 | 20 | translate: function(sel) { 21 | var $this = this; 22 | sel = sel || '[data-sw-translate]'; 23 | 24 | $(sel).each(function() { 25 | $(this).html($this._tryTranslate($(this).html())); 26 | 27 | $(this).val($this._tryTranslate($(this).val())); 28 | $(this).attr('title', $this._tryTranslate($(this).attr('title'))); 29 | }); 30 | }, 31 | 32 | _tryTranslate: function(word) { 33 | return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; 34 | }, 35 | 36 | learn: function(wordsMap) { 37 | this._words = wordsMap; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /php/public/docs/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* jshint quotmark: double */ 4 | window.SwaggerTranslator.learn({ 5 | "Warning: Deprecated":"警告:已过时", 6 | "Implementation Notes":"实现备注", 7 | "Response Class":"响应类", 8 | "Status":"状态", 9 | "Parameters":"参数", 10 | "Parameter":"参数", 11 | "Value":"值", 12 | "Description":"描述", 13 | "Parameter Type":"参数类型", 14 | "Data Type":"数据类型", 15 | "Response Messages":"响应消息", 16 | "HTTP Status Code":"HTTP状态码", 17 | "Reason":"原因", 18 | "Response Model":"响应模型", 19 | "Request URL":"请求URL", 20 | "Response Body":"响应体", 21 | "Response Code":"响应码", 22 | "Response Headers":"响应头", 23 | "Hide Response":"隐藏响应", 24 | "Headers":"头", 25 | "Try it out!":"试一下!", 26 | "Show/Hide":"显示/隐藏", 27 | "List Operations":"显示操作", 28 | "Expand Operations":"展开操作", 29 | "Raw":"原始", 30 | "can't parse JSON. Raw result":"无法解析JSON. 原始结果", 31 | "Example Value":"示例", 32 | "Click to set as parameter value":"点击设置参数", 33 | "Model Schema":"模型架构", 34 | "Model":"模型", 35 | "apply":"应用", 36 | "Username":"用户名", 37 | "Password":"密码", 38 | "Terms of service":"服务条款", 39 | "Created by":"创建者", 40 | "See more at":"查看更多:", 41 | "Contact the developer":"联系开发者", 42 | "api version":"api版本", 43 | "Response Content Type":"响应Content Type", 44 | "Parameter content type:":"参数类型:", 45 | "fetching resource":"正在获取资源", 46 | "fetching resource list":"正在获取资源列表", 47 | "Explore":"浏览", 48 | "Show Swagger Petstore Example Apis":"显示 Swagger Petstore 示例 Apis", 49 | "Can't read from server. It may not have the appropriate access-control-origin settings.":"无法从服务器读取。可能没有正确设置access-control-origin。", 50 | "Please specify the protocol for":"请指定协议:", 51 | "Can't read swagger JSON from":"无法读取swagger JSON于", 52 | "Finished Loading Resource Information. Rendering Swagger UI":"已加载资源信息。正在渲染Swagger UI", 53 | "Unable to read api":"无法读取api", 54 | "from path":"从路径", 55 | "server returned":"服务器返回" 56 | }); 57 | -------------------------------------------------------------------------------- /php/public/docs/lib/backbone-min.js: -------------------------------------------------------------------------------- 1 | !function(t,e){if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(i,n,s){t.Backbone=e(t,s,i,n)});else if("undefined"!=typeof exports){var i=require("underscore");e(t,exports,i)}else t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}(this,function(t,e,i,n){var s=t.Backbone,r=[],a=(r.push,r.slice);r.splice;e.VERSION="1.1.2",e.$=n,e.noConflict=function(){return t.Backbone=s,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var n=this._events[t]||(this._events[t]=[]);return n.push({callback:e,context:i,ctx:i||this}),this},once:function(t,e,n){if(!c(this,"once",t,[e,n])||!e)return this;var s=this,r=i.once(function(){s.off(t,r),e.apply(this,arguments)});return r._callback=e,this.on(t,r,n)},off:function(t,e,n){var s,r,a,o,h,u,l,d;if(!this._events||!c(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(o=t?[t]:i.keys(this._events),h=0,u=o.length;h").attr(t);this.setElement(n,!1)}}}),e.sync=function(t,n,s){var r=E[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:r,dataType:"json"};if(s.url||(a.url=i.result(n,"url")||j()),null!=s.data||!n||"create"!==t&&"update"!==t&&"patch"!==t||(a.contentType="application/json",a.data=JSON.stringify(s.attrs||n.toJSON(s))),s.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),s.emulateHTTP&&("PUT"===r||"DELETE"===r||"PATCH"===r)){a.type="POST",s.emulateJSON&&(a.data._method=r);var o=s.beforeSend;s.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",r),o)return o.apply(this,arguments)}}"GET"===a.type||s.emulateJSON||(a.processData=!1),"PATCH"===a.type&&x&&(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var h=s.xhr=e.ajax(i.extend(a,s));return n.trigger("request",n,h,s),h};var x=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),E={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var k=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},T=/\((.*?)\)/g,$=/(\(\?)?:\w+/g,S=/\*\w+/g,H=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(k.prototype,o,{initialize:function(){},route:function(t,n,s){i.isRegExp(t)||(t=this._routeToRegExp(t)),i.isFunction(n)&&(s=n,n=""),s||(s=this[n]);var r=this;return e.history.route(t,function(i){var a=r._extractParameters(t,i);r.execute(s,a),r.trigger.apply(r,["route:"+n].concat(a)),r.trigger("route",n,a),e.history.trigger("route",r,n,a)}),this},execute:function(t,e){t&&t.apply(this,e)},navigate:function(t,i){return e.history.navigate(t,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var t,e=i.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(H,"\\$&").replace(T,"(?:$1)?").replace($,function(t,e){return e?t:"([^/?]+)"}).replace(S,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var n=t.exec(e).slice(1);return i.map(n,function(t,e){return e===n.length-1?t||null:t?decodeURIComponent(t):null})}});var A=e.History=function(){this.handlers=[],i.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},I=/^[#\/]|\s+$/g,N=/^\/+|\/+$/g,R=/msie [\w.]+/,O=/\/$/,P=/#.*$/;A.started=!1,i.extend(A.prototype,o,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(null==t)if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(O,"");t.indexOf(i)||(t=t.slice(i.length))}else t=this.getHash();return t.replace(I,"")},start:function(t){if(A.started)throw new Error("Backbone.history has already been started");A.started=!0,this.options=i.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var n=this.getFragment(),s=document.documentMode,r=R.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);if(this.root=("/"+this.root+"/").replace(N,"/"),r&&this._wantsHashChange){var a=e.$('