{"id":17384412,"url":"https://github.com/jakubriegel/watercollector","last_synced_at":"2026-04-14T03:32:57.539Z","repository":{"id":117762137,"uuid":"373260241","full_name":"jakubriegel/WaterCollector","owner":"jakubriegel","description":"REST API for calculating water remaining after rain on given slice of surface.","archived":false,"fork":false,"pushed_at":"2021-06-04T18:00:10.000Z","size":93,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T02:08:03.989Z","etag":null,"topics":["algorithm","dockerfile","github-actions","java","rest","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Groovy","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/jakubriegel.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":"2021-06-02T18:03:04.000Z","updated_at":"2021-06-05T11:32:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"7ae370f8-9750-4769-ae88-33acc6594381","html_url":"https://github.com/jakubriegel/WaterCollector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jakubriegel/WaterCollector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubriegel%2FWaterCollector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubriegel%2FWaterCollector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubriegel%2FWaterCollector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubriegel%2FWaterCollector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakubriegel","download_url":"https://codeload.github.com/jakubriegel/WaterCollector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubriegel%2FWaterCollector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31781292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["algorithm","dockerfile","github-actions","java","rest","spring-boot"],"created_at":"2024-10-16T07:45:24.905Z","updated_at":"2026-04-14T03:32:57.521Z","avatar_url":"https://github.com/jakubriegel.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Water Collector\n## About\nSimple application made for CRX Markets requirement process. \nIt exposes REST API for calculating water remaining after rain on given slice of surface.\n\n## API\n### Resources\nSample calls can be explored using Postman collection from root of the repository.\n#### Water volume\nThis resource represents volume of water left on given surface after the rain.\n* Method: `GET`\n* Path: `/water/volume`\n* Headers:\n    ```\n    Accept: application/json\n    ```\n* Parameters:\n    * `bars` - (required) - comma separated list of integers representing heights of consecutive parts of the surface\n* Response:\n    ```json5\n    {\n        \"surface\": [], // list of integers representing given surface\n        \"volume\": 1 // integer representing volume of water left after the rain\n    }\n    ```\n* Possible errors:\n    * `MISSING_PARAMETER` - when `bars` are not specified\n    * `INVALID_BAR_HEIGHT` - when one or more bars have negative value\n* Example:\n  ```\n    GET /water/volume?bars=1,2,4,1,2,4\n    Accept: application/json\n  \n    200 OK\n    Content-Type: application/json\n    {\n        \"surface\": [1, 2, 4, 1, 2, 4],\n        \"volume\": 5\n    }\n  ```\n\n#### Water volume details\nThis resource represents details of water's volume and surface state after the rain. \nIt can be used for example for generating visual representation of calculations result.\n\nThis endpoint uses different, more resource demanding algorithm than the basic endpoint.\n\n* Method: `GET`\n* Path: `/water/volume/details`\n* Headers:\n    ```\n    Accept: application/json\n    ```\n* Parameters:\n    * `bars` - (required) - comma separated list of integers representing heights of consecutive parts of the surface\n* Response:\n    ```json5\n    {\n        \"surface\": [], // list of integers representing given surface\n        \"volume\": 1, // integer representing volume of water left after the rain\n        \"barsVolume\": 1, // integer representing volume of bars in the slice\n        \"emptyVolume\": 1, // integer representing volume of empty space after the rain\n        \"width\": 1, // integer representing width of the surface\n        \"height\": 1, // integer representing height of highest bar in the slice\n        \"stripes\": [[\"EMPTY\", \"WATER\", \"BAR\"]] // list representing the surface view after the rain \n    }\n    ```\n* Possible errors:\n    * `MISSING_PARAMETER` - when `bars` are not specified\n    * `INVALID_BAR_HEIGHT`- when one or more bars have negative value\n* Example:\n  ```\n    GET /water/volume/details?bars=1,2,4,1,2,4\n    Accept: application/json\n  \n    200 OK\n    Content-Type: application/json\n    {\n      \"surface\": [1, 2, 4, 1, 2, 4],\n      \"volume\": 5,\n      \"barsVolume\": 14,\n      \"emptyVolume\": 5,\n      \"width\": 6,\n      \"height\": 4,\n      \"stripes\": [\n        [\"EMPTY\",\"EMPTY\",\"EMPTY\",\"BAR\"], [\"EMPTY\",\"EMPTY\",\"BAR\",\"BAR\"], [\"BAR\",\"BAR\",\"BAR\",\"BAR\"], [\"WATER\",\"WATER\",\"WATER\",\"BAR\"], [\"WATER\",\"WATER\",\"BAR\",\"BAR\"], [\"BAR\",\"BAR\",\"BAR\",\"BAR\"]\n      ]\n    }\n  ```\n\n### Errors\nThe API reports errors in common format:\n```json5\n{\n  \"code\": \"\", // code of the error\n  \"path\": \"\", // request path\n  \"message\": \"\", // user-friendly message\n  \"details\": {} // key-value pairs of error-specific data\n}\n```\n\n## Development\n### Testing\nApplication code is covered by unit \u0026 integration tests. Basic e2e tests are implemented in Postman collection.\n\n### CI\nContinuous integration of the project is implemented using GitHub Actions. \nEach push triggers tests runs as well as building of jar and Docker image. Only changes with all checks passed can be merged.\n\n## Deployment\nThis application can be run on every platform supporting JVM and TCP sockets. \nDocker is used as example. Provided Dockerfile shows steps necessary to create an executable for the project. \nIt features configurations for two separate environments. Application properties files are included after building the jar, which means configurations can be changed without a need for rebuilding the package.\n\nJar/image is built during CI process. In _real_ use case these actions would be extended with uploading them to local artifacts store.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakubriegel%2Fwatercollector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakubriegel%2Fwatercollector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakubriegel%2Fwatercollector/lists"}