{"id":20566284,"url":"https://github.com/telkomdev/hunk","last_synced_at":"2025-10-10T06:18:42.556Z","repository":{"id":45528894,"uuid":"250758104","full_name":"telkomdev/Hunk","owner":"telkomdev","description":"Java 11 Http client with simple taste","archived":false,"fork":false,"pushed_at":"2025-06-07T00:46:26.000Z","size":34,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-07T12:05:01.864Z","etag":null,"topics":["http","httpclient","java","java11"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/telkomdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2020-03-28T09:38:36.000Z","updated_at":"2022-12-20T05:56:45.000Z","dependencies_parsed_at":"2025-06-07T12:05:02.765Z","dependency_job_id":"940ffba7-115b-4233-b796-13e9f4166a18","html_url":"https://github.com/telkomdev/Hunk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/telkomdev/Hunk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2FHunk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2FHunk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2FHunk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2FHunk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telkomdev","download_url":"https://codeload.github.com/telkomdev/Hunk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2FHunk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002970,"owners_count":26083488,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"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":["http","httpclient","java","java11"],"created_at":"2024-11-16T04:40:56.004Z","updated_at":"2025-10-10T06:18:42.529Z","avatar_url":"https://github.com/telkomdev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hunk\n\nJava 11 Http client with simple taste\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/5c760b0d5da52b887a73/maintainability)](https://codeclimate.com/github/telkomdev/Hunk/maintainability)\n\n### Usage\n\nThe Post `class`\n```java\npublic class Post {\n    private Integer id;\n    private Integer userId;\n    private String title;\n    private String body;\n\n\n    public Integer getId() {\n        return id;\n    }\n\n    public void setId(Integer id) {\n        this.id = id;\n    }\n\n    public Integer getUserId() {\n        return userId;\n    }\n\n    public void setUserId(Integer userId) {\n        this.userId = userId;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public void setTitle(String title) {\n        this.title = title;\n    }\n\n    public String getBody() {\n        return body;\n    }\n\n    public void setBody(String body) {\n        this.body = body;\n    }\n}\n```\n\nPOST\n```java\npublic class App {\n\n    public static void main(String[] args) throws InterruptedException, ExecutionException, IOException, URISyntaxException {\n\n        Map\u003cString, String\u003e headers = new HashMap\u003c\u003e();\n        headers.put(Hunk.CONTENT_TYPE, \"application/json\");\n\n        Post p = new Post(1, 1, \"Java 11\", \"The awesome of Java 11\");\n\n        Future\u003cHttpResponse\u003cbyte[]\u003e\u003e future = Hunk.doAsync(Hunk.HttpMethod.POST,\n                \"https://jsonplaceholder.typicode.com/posts\",\n                headers, Hunk.ofJsonObject(p), 2);\n\n        HttpResponse\u003cbyte[]\u003e response = future.get();\n        HttpHeaders respHeaders = response.headers();\n\n        respHeaders.map().forEach((key, values) -\u003e {\n            System.out.println(key);\n            System.out.println(values);\n        });\n\n        Post post = JsonUtil.jsonToData(Post.class, response.body());\n\n        System.out.println(post);\n\n\n    }\n}\n```\n\nGET\n```java\npublic class App {\n\n    public static void main(String[] args) throws InterruptedException, ExecutionException, IOException, URISyntaxException {\n\n        Map\u003cString, String\u003e headers = new HashMap\u003c\u003e();\n        headers.put(Hunk.CONTENT_TYPE, \"application/json\");\n        headers.put(Hunk.ACCEPT, \"application/json\");\n\n        Future\u003cHttpResponse\u003cbyte[]\u003e\u003e future = Hunk.doAsync(Hunk.HttpMethod.GET,\n                \"https://jsonplaceholder.typicode.com/posts/1\",\n                headers, null, 2);\n\n        HttpResponse\u003cbyte[]\u003e response = future.get();\n        HttpHeaders respHeaders = response.headers();\n\n        respHeaders.map().forEach((key, values) -\u003e {\n            System.out.println(key);\n            System.out.println(values);\n        });\n\n        Post post = JsonUtil.jsonToData(Post.class, response.body());\n\n        System.out.println(post);\n\n\n    }\n}\n```\n\nGET from string\n\n```java\npublic class App {\n\n    public static void main(String[] args) throws HunkMethodNotSupportedException,\n            URISyntaxException, IOException, ExecutionException, InterruptedException {\n        Map\u003cString, String\u003e headers = new HashMap\u003c\u003e();\n        headers.put(Hunk.CONTENT_TYPE, \"application/json\");\n        headers.put(Hunk.ACCEPT, \"application/json\");\n\n        Future\u003cHttpResponse\u003cbyte[]\u003e\u003e future = Hunk.doAsync(Hunk.HttpMethod.from(\"get\"),\n                \"https://jsonplaceholder.typicode.com/posts/1\",\n                headers, null, 2);\n\n        HttpResponse\u003cbyte[]\u003e response = future.get();\n        HttpHeaders respHeaders = response.headers();\n\n        respHeaders.map().forEach((key, values) -\u003e {\n            System.out.println(key);\n            System.out.println(values);\n        });\n\n        Post post = JsonUtil.jsonToData(Post.class, response.body());\n\n        System.out.println(post.getTitle());\n        System.out.println(post.getBody());\n\n\n    }\n}\n```\n\n#### Reactive feature with RxJava\n\n```java\npublic class Main {\n\n    public static void main(String[] args) throws HunkMethodNotSupportedException,\n            URISyntaxException, IOException, ExecutionException, InterruptedException {\n        Map\u003cString, String\u003e headers = new HashMap\u003c\u003e();\n        headers.put(Hunk.CONTENT_TYPE, \"application/json\");\n\n        Observable\u003cHttpResponse\u003cbyte[]\u003e\u003e resultObserver = Hunk.doAsyncReactive(Hunk.HttpMethod.from(\"get\"),\n                \"https://jsonplaceholder.typicode.com/posts\",\n                headers, null, 0);\n\n        resultObserver.subscribe(response -\u003e {\n            HttpHeaders respHeaders = response.headers();\n\n            respHeaders.map().forEach((key, values) -\u003e {\n                System.out.println(key);\n                System.out.println(values);\n            });\n\n            List\u003cPost\u003e posts = Arrays.asList(JsonUtil.jsonToData(Post[].class, response.body()));\n\n            System.out.println(response.statusCode());\n            for (Post post : posts) {\n                System.out.println(post.getTitle());\n            }\n        }, throwable -\u003e System.out.println(throwable.getMessage()));\n\n\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelkomdev%2Fhunk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelkomdev%2Fhunk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelkomdev%2Fhunk/lists"}