{"id":22274148,"url":"https://github.com/ethern-myth/efetch","last_synced_at":"2026-04-12T23:44:29.607Z","repository":{"id":227653519,"uuid":"771500083","full_name":"Ethern-Myth/efetch","owner":"Ethern-Myth","description":"efetch is a lightweight C# library for making HTTP requests with ease. It provides a simple interface for performing common HTTP operations such as GET, POST, PUT, PATCH, and DELETE. It also supports custom logging for requests, responses, and errors.","archived":false,"fork":false,"pushed_at":"2024-03-14T12:38:08.000Z","size":191,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T20:46:57.925Z","etag":null,"topics":["csharp","dotnet","httpclient","netcore","restapi","sdk","singleton"],"latest_commit_sha":null,"homepage":"","language":"C#","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/Ethern-Myth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["ethern-myth"]}},"created_at":"2024-03-13T12:13:43.000Z","updated_at":"2024-03-14T14:19:10.000Z","dependencies_parsed_at":"2024-03-14T13:46:57.709Z","dependency_job_id":"071d7f55-41be-46be-bb7f-b25b2b7cbfbc","html_url":"https://github.com/Ethern-Myth/efetch","commit_stats":null,"previous_names":["ethern-myth/efetch"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethern-Myth%2Fefetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethern-Myth%2Fefetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethern-Myth%2Fefetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethern-Myth%2Fefetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ethern-Myth","download_url":"https://codeload.github.com/Ethern-Myth/efetch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245502701,"owners_count":20626020,"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":["csharp","dotnet","httpclient","netcore","restapi","sdk","singleton"],"created_at":"2024-12-03T13:18:11.587Z","updated_at":"2025-10-18T00:28:20.352Z","avatar_url":"https://github.com/Ethern-Myth.png","language":"C#","readme":"# efetch\n\n**efetch** is a lightweight C# library for performing resilient HTTP requests with minimal boilerplate. It supports GET, POST, PUT, PATCH, DELETE operations, built-in retry policies via Polly, customizable headers, and optional structured logging.\n\n![NuGet Version](https://img.shields.io/nuget/v/efetch)\n![NuGet Downloads](https://img.shields.io/nuget/dt/efetch)\n\n---\n\n## 🚀 Installation\n\nInstall via NuGet Package Manager:\n\n```bash\nInstall-Package efetch\n```\n\nOr via .NET CLI:\n\n```bash\ndotnet add package efetch\n```\n\n---\n\n## ✨ Features\n\n- ✅ Clean abstraction with `IEfetch` interface\n- 🔁 Retry support using Polly\n- 📦 JSON deserialization with support for primitives, objects, and arrays\n- 📡 Simple query parameter handling\n- 📓 Optional request/response logging\n- 🧩 Built-in support for dependency injection\n\n---\n\n## 🧩 Configuration\n\nAdd to your app's `appsettings.json`:\n\n```json\n\"Efetch\": {\n  \"BaseUrl\": \"https://api.example.com\",\n  \"DefaultHeaders\": {\n    \"Authorization\": \"Bearer YOUR_TOKEN\",\n    \"Accept\": \"application/json\"\n  },\n  \"RetryCount\": 3\n}\n```\n\nRegister `Efetch` in your DI container (`Program.cs`):\n\n```csharp\nbuilder.Services.AddEfetch(builder.Configuration);\n```\n\n---\n\n## 🧪 Usage\n\n### Inject `IEfetch`:\n\n```csharp\npublic class VaultController : ControllerBase\n{\n    private readonly IEfetch _efetch;\n\n    public VaultController(IEfetch efetch)\n    {\n        _efetch = efetch;\n    }\n\n    [HttpGet]\n    public async Task\u003cIActionResult\u003e Get([FromQuery] string key)\n    {\n        var result = await _efetch.GetAsync\u003cobject\u003e(\"vault\", null, new() { { \"key\", key } });\n        return Ok(result);\n    }\n}\n```\n\n---\n\n## 📦 Example\n\n```csharp\npublic class MyService\n{\n    private readonly IEfetch _efetch;\n\n    public MyService(IEfetch efetch)\n    {\n        _efetch = efetch;\n    }\n\n    public async Task RunAsync()\n    {\n        // GET example\n        var result = await _efetch.GetAsync\u003cMyResponse\u003e(\"/data\");\n\n        // POST example\n        var body = new MyRequest { Name = \"John\" };\n        var response = await _efetch.PostAsync\u003cMyResponse, MyRequest\u003e(\"/create\", body);\n\n        // String response example\n        var plainText = await _efetch.GetAsync\u003cstring\u003e(\"/version\");\n    }\n}\n```\n\n---\n\n## 🛠 API\n\n### `IEfetch`\n\n- `GetAsync\u003cT\u003e(...)`\n- `PostAsync\u003cT, TBody\u003e(...)`\n- `PutAsync\u003cT, TBody\u003e(...)`\n- `PatchAsync\u003cT, TBody\u003e(...)`\n- `DeleteAsync\u003cT\u003e(...)`\n\nAll methods support:\n- Optional headers\n- Optional query parameters\n- Optional ID for REST-style routes\n- Built-in retry policy\n\n### `ILoggingProvider`\n\nOptionally implement your own logger or use the built-in `ConsoleLoggingProvider`.\n\n---\n\n## 🔧 Advanced: Manual Configuration\n\n```csharp\nbuilder.Services.AddSingleton(new EfetchConfig\n{\n    BaseUrl = \"https://api.example.com\",\n    DefaultHeaders = new()\n    {\n        { \"Authorization\", \"Bearer abc123\" },\n        { \"Accept\", \"application/json\" }\n    }\n});\n\nbuilder.Services.AddTransient\u003cIEfetch, Efetch\u003e();\n```\n\n---\n\n## 👤 Author\n\n**efetch** is created by [Ethern Myth](https://github.com/Ethern-Myth).\n\n---\n\n## 📄 License\n\nLicensed under the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":["https://github.com/sponsors/ethern-myth"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethern-myth%2Fefetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethern-myth%2Fefetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethern-myth%2Fefetch/lists"}