{"id":22382928,"url":"https://github.com/fey/digital-spectr-academy","last_synced_at":"2025-03-26T19:44:23.499Z","repository":{"id":117282068,"uuid":"597237709","full_name":"fey/digital-spectr-academy","owner":"fey","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-28T09:20:26.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T01:51:41.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-03T23:58:31.000Z","updated_at":"2023-09-26T16:12:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea31eb18-e59f-4e04-b4d0-096a98b876a5","html_url":"https://github.com/fey/digital-spectr-academy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fdigital-spectr-academy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fdigital-spectr-academy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fdigital-spectr-academy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fdigital-spectr-academy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fey","download_url":"https://codeload.github.com/fey/digital-spectr-academy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245727639,"owners_count":20662553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T00:42:22.699Z","updated_at":"2025-03-26T19:44:23.459Z","avatar_url":"https://github.com/fey.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#\n\n[![PHP CI](https://github.com/fey/digital-spectr-academy/actions/workflows/main.yml/badge.svg)](https://github.com/fey/digital-spectr-academy/actions/workflows/main.yml)\n\n## Commands\n\n```bash\nmake install # install deps\n\nmake test # run tests\n\nmake lint # run linter\n\nmake start # start server for Shapes api\n```\n\n## Shapes api\n\nInstall and start server (see commands above)\n\nEndpoint `POST localhost:8000/shapes/calculate`\n\nparams:\n\n* shape - `triangle`, `circle`, `square`\n* method: - `perimeter`, `area`\n* params (depends on shape type):\n  * Square: `side`\n  * Triangle: `sideA`, `sideB`, `sideC`\n  * Circle: `radius`\n\nExamples:\n\nCalculate Triangle perimeter:\n\n```bash\ncurl  -X POST \\\n  'localhost:8000/shapes/calculate' \\\n  --header 'Accept: */*' \\\n  --header 'Content-Type: application/json' \\\n  --data-raw '{\n  \"shape\": \"triangle\",\n  \"method\": \"perimeter\",\n  \"params\": {\n    \"sideA\": 3,\n    \"sideB\": 5,\n    \"sideC\": 7\n  }\n}'\n```\n\nResponse:\n\n```json\n{\n  \"data\": {\n    \"method\": \"perimeter\",\n    \"shape\": \"triangle\",\n    \"result\": 15\n  }\n}\n```\n\n\nSquare area:\n\n```bash\ncurl  -X POST \\\n  'localhost:8000/shapes/calculate' \\\n  --header 'Accept: */*' \\\n  --header 'Content-Type: application/json' \\\n  --data-raw '{\n  \"shape\": \"square\",\n  \"method\": \"area\",\n  \"params\": {\n    \"side\": 5\n  }\n}'\n```\n\nResponse:\n\n```json\n{\n  \"data\": {\n    \"method\": \"area\",\n    \"shape\": \"square\",\n    \"result\": 25\n  }\n}\n```\n\nCircle area:\n\n```bash\ncurl  -X POST \\\n  'localhost:8000/shapes/calculate' \\\n  --header 'Accept: */*' \\\n  --header 'Content-Type: application/json' \\\n  --data-raw '{\n  \"shape\": \"circle\",\n  \"method\": \"area\",\n  \"params\": {\n    \"radius\": 5\n  }\n}'\n```\n\nResponse:\n\n```json\n{\n  \"data\": {\n    \"method\": \"area\",\n    \"shape\": \"circle\",\n    \"result\": 78.53981633974483\n  }\n}\n```\n\n### Validation\n\nWorks with float values\n\n```bash\ncurl  -X POST \\\n  'localhost:8000/shapes/calculate' \\\n  --header 'Accept: */*' \\\n  --header 'Content-Type: application/json' \\\n  --data-raw '{\n  \"shape\": \"square\",\n  \"method\": \"area\",\n  \"params\": {\n    \"side\": 5.0\n  }\n}'\n```\n\nResponse:\n\n```json\n{\n  \"data\": {\n    \"method\": \"area\",\n    \"shape\": \"square\",\n    \"result\": 25\n  }\n}\n```\n\nValidation errors:\n\n```json\n{\n  \"message\": \"side should be integer or float\"\n}\n```\n\n```json\n{\n  \"message\": \"side is required\"\n}\n```\n\n```json\n{\n  \"message\": \"round is invalid method, valid methods: perimeter, area\"\n}\n```\n\n```json\n{\n  \"message\": \"round is invalid shape type, valid types: triangle, circle, square\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffey%2Fdigital-spectr-academy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffey%2Fdigital-spectr-academy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffey%2Fdigital-spectr-academy/lists"}