{"id":17119000,"url":"https://github.com/chyroc/requests","last_synced_at":"2025-03-24T02:19:03.082Z","repository":{"id":210236540,"uuid":"725983306","full_name":"chyroc/requests","owner":"chyroc","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-19T07:58:29.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T08:23:15.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/chyroc.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}},"created_at":"2023-12-01T09:33:25.000Z","updated_at":"2023-12-01T17:28:28.000Z","dependencies_parsed_at":"2023-12-06T13:38:23.786Z","dependency_job_id":"41a4c3bd-6f32-4b3c-b395-5caf4aef80f9","html_url":"https://github.com/chyroc/requests","commit_stats":null,"previous_names":["chyroc/requests"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Frequests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Frequests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Frequests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Frequests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chyroc","download_url":"https://codeload.github.com/chyroc/requests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245195962,"owners_count":20575938,"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":[],"created_at":"2024-10-14T17:55:58.239Z","updated_at":"2025-03-24T02:19:03.062Z","avatar_url":"https://github.com/chyroc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# requests\n\n## Install\n\n```shell\ngo get github.com/chyroc/requests\n```\n\n## Usage\n\nsample usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/chyroc/requests\"\n)\n\nfunc Example_Method() {\n\tr := requests.Get(\"https://httpbin.org/get\")\n\n\tr = requests.Post(\"https://httpbin.org/post\")\n\n\tr = requests.Delete(\"https://httpbin.org/delete\")\n\n\tr = requests.New(http.MethodPut, \"https://httpbin.org/put\")\n\n\tfmt.Println(r.Text().Unpack())\n}\n\nfunc Example_unmarshal() {\n\tr := requests.Post(\"https://httpbin.org/post\")\n\n\ttype Response struct {\n\t\t// ...\n\t}\n\n\tresp := requests.JSON[Response](r)\n\n\tfmt.Println(resp.Unpack())\n}\n\nfunc Example_factory() {\n\t// I hope to set fixed parameters every time I initiate a request\n\t// Then, every request created by this factory will not log\n\topt := requests.Options(\n\t\trequests.WithLogger(requests.DiscardLogger()),\n\t\trequests.WithTimeout(time.Second*10),\n\t\trequests.WithQuery(\"query\", \"value\"),\n\t\trequests.WithHeader(\"Auth\", \"hey\"),\n\t)\n\n\t// Send sample request\n\tr := requests.Get(\"https://httpbin.org/get\", opt...)\n\n\tr = requests.Post(\"https://httpbin.org/get\").\n\t\tWithLogger(requests.DiscardLogger()).\n\t\tWithTimeout(time.Second * 10)\n\tfmt.Println(r.Text().Unpack())\n}\n\nfunc Example_newSession() {\n\tsession := requests.NewSession(\"/tmp/requests-session.txt\")\n\tr := session.Get(\"https://jsonplaceholder.typicode.com/todos/1\").\n\t\tWithTimeout(time.Second * 10)\n\tfmt.Println(r.Text().Unpack())\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchyroc%2Frequests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchyroc%2Frequests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchyroc%2Frequests/lists"}