{"id":28282779,"url":"https://github.com/devilcove/httpclient","last_synced_at":"2025-07-31T09:39:32.866Z","repository":{"id":60569557,"uuid":"542242522","full_name":"devilcove/httpclient","owner":"devilcove","description":"simple client to facilitate calls to http endpoints","archived":false,"fork":false,"pushed_at":"2024-07-22T21:29:44.000Z","size":50,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T06:36:29.007Z","etag":null,"topics":["go","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Go","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/devilcove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/contributing.md","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}},"created_at":"2022-09-27T18:53:07.000Z","updated_at":"2024-07-22T21:29:40.000Z","dependencies_parsed_at":"2024-05-03T07:33:24.558Z","dependency_job_id":null,"html_url":"https://github.com/devilcove/httpclient","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":"0.10810810810810811","last_synced_commit":"2ee195c07537a60fe633dfbd5b1561a23a27703e"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/devilcove/httpclient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilcove%2Fhttpclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilcove%2Fhttpclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilcove%2Fhttpclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilcove%2Fhttpclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devilcove","download_url":"https://codeload.github.com/devilcove/httpclient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devilcove%2Fhttpclient/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268017357,"owners_count":24181669,"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-07-31T02:00:08.723Z","response_time":66,"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":["go","hacktoberfest"],"created_at":"2025-05-21T15:20:00.527Z","updated_at":"2025-07-31T09:39:32.858Z","avatar_url":"https://github.com/devilcove.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# httpclient \n* simple library to facilitate calls to http endpoints\n## two methods to call\n* function with parameters\n* method with structure\n## two options for results\n* raw response (*http.Response)\n* response body decoded to json \n# Examples\nsee examples directory\n## Full Response\nequivalent of \n\n`curl 'https://api.example.com' -H 'Authorization: Bearer API_TOKEN'`\n### function \n```\nfunc main() {\n    token := os.Getenv(\"API_TOKEN\")\n    response, err := httpclient.GetResponse(\"\", http.MethodGet, \"https://api.example.com\", token)\n    if err !=nil {\n        log.Fatal(err)\n    }\n    defer response.Body.Close()\n    bytes, err := io.ReadAll(response.Body)\n    log.Println(response.StatusCode, string(bytes))\n}\n```\n\n### method \n```\nfunc main() {\n    token := os.Getenv(\"API_TOKEN\")\n    endpoint := httpclient.Endpoint {\n        URL: \"https://api.clustercat.com\",\n\t    Method: http.MethodGet    \n\t    Authorization: token,\n    }\n    response, err := endpoint.GetResponse()\n    defer response.Body.Close()\n    bytes, err := io.ReadAll(response.Body)\n    log.Println(response.StatusCode, string(bytes))\n}\n```\n## JSON response\nequivalent of \n\n`curl 'https://api.example.com/login' -H 'Authorization: Bearer API_TOKEN' - H 'Content-Type: application/json' -d '{\"name\":\"admin\",\"pass\":\"password\"}'`\n### function \n```\nfunc main() {\n    token := os.Getenv(\"API_TOKEN\")\n    data := struct {\n        Name: \"admin\",\n        Pass: \"password\",\n    }\n    response := struct {\n        Language_Pref: \"EN\",\n        JWT: \"some string\",\n    }\n    response, err := httpclient.GetJSON(data, http.MethodPOST, \"https://api.example.com/api/login\", \"Bearer \" + token)\n    if err !=nil {\n        log.Fatal(err)\n    }\n    log.Println(response)\n}\n```\n### method\n```\nfunc main() {\n    token := os.Getenv(\"API_TOKEN\")\n    data := struct {\n        Name: \"admin\",\n        Pass: \"password\",\n    }\n    response := struct {\n        Language_Pref: \"EN\",\n        JWT: \"some string\",\n    }\n    endpoint := httpclient.Endpoint {\n        URL: \"https://api.example.com\",\n\t    Method: http.MethodPOST\n\t    Authorization: token,\n        Route: \"/api/login\",\n        Data: data,\n        Response: response,\n    }\n    jsonEndpoint := httpclient.JSONEndpoint[struct {Language_Pref string JWT string}] {\n        endpoint,\n        response,\n    }\n    answer, err := httpclient.JSON(response)\n    if err !=nil {\n        log.Fatal(err)\n    }\n    log.Println(response)\n    ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevilcove%2Fhttpclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevilcove%2Fhttpclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevilcove%2Fhttpclient/lists"}