{"id":20541568,"url":"https://github.com/s32x/httpclient","last_synced_at":"2025-04-14T09:04:41.985Z","repository":{"id":57489962,"uuid":"130425366","full_name":"s32x/httpclient","owner":"s32x","description":":beginner: The clean and easy way to build powerful http client libraries","archived":false,"fork":false,"pushed_at":"2022-02-17T18:43:50.000Z","size":209,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-29T09:18:10.719Z","etag":null,"topics":["api","golang","http-client","json","simple"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s32x.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}},"created_at":"2018-04-21T00:20:32.000Z","updated_at":"2022-12-27T15:09:34.000Z","dependencies_parsed_at":"2022-09-07T13:11:33.405Z","dependency_job_id":null,"html_url":"https://github.com/s32x/httpclient","commit_stats":null,"previous_names":["sdwolfe32/httpclient","entrik/httpclient"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s32x%2Fhttpclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s32x%2Fhttpclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s32x%2Fhttpclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s32x%2Fhttpclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s32x","download_url":"https://codeload.github.com/s32x/httpclient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224865240,"owners_count":17382659,"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":["api","golang","http-client","json","simple"],"created_at":"2024-11-16T01:24:41.873Z","updated_at":"2024-11-16T01:24:42.339Z","avatar_url":"https://github.com/s32x.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"logo.png\" width=\"350\" height=\"101\" border=\"0\" alt=\"httpclient\"\u003e\n\u003cbr\u003e\n\u003ca href=\"https://circleci.com/gh/s32x/httpclient/tree/master\"\u003e\u003cimg src=\"https://circleci.com/gh/s32x/httpclient/tree/master.svg?style=svg\" alt=\"CircleCI\"\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/s32x/httpclient\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/s32x/httpclient\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\n\u003ca href=\"https://godoc.org/github.com/s32x/httpclient\"\u003e\u003cimg src=\"https://godoc.org/github.com/s32x/httpclient?status.svg\" alt=\"GoDoc\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nhttpclient is a simple convenience package for performing http/api requests in Go. It wraps the standard libraries net/http package to avoid the repetitive http logic you're likely so familiar with. It helps to remove a good amount of the boilerplate involved with writing an http client library. Using the lib is very simple - Below is a very basic example.\n\n### Usage\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/s32x/httpclient\"\n)\n\nvar user = \"s32x\"\n\nfunc main() {\n\tc := httpclient.New().WithBaseURL(\"https://api.github.com\")\n\n\tvar ghSuccess interface{} // A generic success response\n\tvar ghError struct {\n\t\tMessage       string `json:\"message\"`\n\t\tDocumentation string `json:\"documentation\"`\n\t}\n\n\texpected, err := c.\n\t\tGetf(\"/users/%s/repos\", user).\n\t\tWithExpectedStatus(http.StatusOK).\n\t\tWithRetry(5).\n\t\tJSONWithError(\u0026ghSuccess, \u0026ghError)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif !expected {\n\t\tlog.Println(\"Error :\", ghError)\n\t} else {\n\t\tlog.Println(\"Success :\", ghSuccess)\n\t}\n}\n```\n\nThe BSD 3-clause License\n========================\n\nCopyright (c) 2022, s32x. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n - Redistributions of source code must retain the above copyright notice,\n   this list of conditions and the following disclaimer.\n\n - Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\n - Neither the name of httpclient nor the names of its contributors may\n   be used to endorse or promote products derived from this software without\n   specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs32x%2Fhttpclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs32x%2Fhttpclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs32x%2Fhttpclient/lists"}