{"id":19188809,"url":"https://github.com/miquido/jebatch","last_synced_at":"2026-06-17T04:31:17.469Z","repository":{"id":94293817,"uuid":"112239430","full_name":"miquido/JeBatch","owner":"miquido","description":"The project was made by Miquido. https://www.miquido.com/","archived":false,"fork":false,"pushed_at":"2018-09-10T11:38:55.000Z","size":78,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T03:42:22.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miquido.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-11-27T19:32:25.000Z","updated_at":"2023-03-28T10:47:41.000Z","dependencies_parsed_at":"2023-04-09T14:32:57.499Z","dependency_job_id":null,"html_url":"https://github.com/miquido/JeBatch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/miquido/JeBatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FJeBatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FJeBatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FJeBatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FJeBatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miquido","download_url":"https://codeload.github.com/miquido/JeBatch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FJeBatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34434492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-09T11:26:06.267Z","updated_at":"2026-06-17T04:31:17.455Z","avatar_url":"https://github.com/miquido.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"JeBatch is a simple library for handling lightweight batch requests on serverside.\nIt allows handling collections of requests of mixed types with single call.\nDesigned for handling operations on collection of resources.\n\nFor use with Kotlin and Java.\n\n\n# Use cases and limitations\nJeBatch is designed for handling REST-compliant batch requests on collection of resources: getting collection or a single resource with GET, creating a resource with POST, replacing it with PUT, updating with PATCH or deleting with DELETE.\n\nSupported HTTP methods are GET, POST, PUT, PATCH and DELETE.\n\nOnly GET allows returning response body to the caller.\n\n# Usage\nCreating a JeBatch instance:\n```java\nval jeBatch = JeBatch.builder\u003cREQUEST_BODY_TYPE, RESPONSE_BODY_TYPE, ID_TYPE\u003e()\n        .forGet { getResourcesList() }\n        .and().forPost { requestBody -\u003e createResourceAndReturnId(requestBody) }\n        .and().forPut { requestBody, id -\u003e putResource(requestBody, id) }\n        .and().forPatch { requestBody, id -\u003e patchResource(requestBody, id) }\n        .and().forDelete { id -\u003e deleteResource(id) }\n        .and().build()\n```\nREQUEST_BODY_TYPE is the type that is expected to come as body in POST, PUT and PATCH requests. \n\nRESPONSE_BODY_TYPE is the type of items in collection returned by GET.\n\nID_TYPE is the type of identifiers of resources that are appended to path for PUT, PATCH and DELETE requests and returned in path in result of POST request.\n\nJeBatch can translate Exceptions thrown from your methods into HTTP response statuses. To define error translating add withError calls on builder after defining methods:\n```java\nval jeBatch = JeBatch.builder\u003cREQUEST_BODY_TYPE, RESPONSE_BODY_TYPE, ID_TYPE\u003e()\n        .forPatch { requestBody, id -\u003e patchResource(requestBody, id) }\n        .withError(NotFoundException::class.java, 404)\n        .withError(BadRequestException::class.java, 400)\n        .withError(ValidationException::class.java, 422)\n        .and()\n        .forPut { requestBody, id -\u003e putResource(requestBody, id) }\n        .withError(BadRequestException::class.java, 400)\n        .withError(ValidationException::class.java, 422)\n        .and()\n        .build()\n```\n\nMethods that are not defined in builder will cause a 405 response to be returned upon being called. Message of exceptions is returned in message of the response.\n\nJeBatch accepts request of type BatchRequest. These contain list of BatchRequestElements, each with defined HTTP method (operation), optional (depending on method) body and id.\n\nAnalogously, it returns BatchResponse containg a list of BatchResponseElements, each with status, resourcePath (except for GET), message (if there was an error) and body (if it was a GET).\n\nIdeally, your service should accept requests and respond in these formats. Then, usage of JeBatch is trivial:\n```java\nval response = batch.process(\"PATH_TO_RESOURCES_COLLECTION\", batchRequest)\n```\nSince base path is passed on each process() invocation you can use one instance of JeBatch for handling multiple paths, as long as request and response bodies and id remain the same type.\n\n# Further development\n* Support request params (usecase: limit and offset in GET on collection).\n* Support returning body from any method. Not very RESTy but useful.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiquido%2Fjebatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiquido%2Fjebatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiquido%2Fjebatch/lists"}