{"id":13740938,"url":"https://github.com/haze/zelda","last_synced_at":"2025-05-08T20:32:55.576Z","repository":{"id":40463410,"uuid":"372384812","full_name":"haze/zelda","owner":"haze","description":"A simple HTTP client library for Zig","archived":true,"fork":false,"pushed_at":"2023-01-06T04:00:37.000Z","size":7233,"stargazers_count":79,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-15T10:43:54.403Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-31T04:47:58.000Z","updated_at":"2024-10-25T07:04:04.000Z","dependencies_parsed_at":"2023-02-05T06:46:27.015Z","dependency_job_id":null,"html_url":"https://github.com/haze/zelda","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzelda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzelda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzelda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haze%2Fzelda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haze","download_url":"https://codeload.github.com/haze/zelda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253145117,"owners_count":21861189,"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-08-03T04:00:53.768Z","updated_at":"2025-05-08T20:32:53.437Z","avatar_url":"https://github.com/haze.png","language":"Zig","funding_links":[],"categories":["Applications"],"sub_categories":[],"readme":"\u003cimg height=\"32\" src=\"https://upload.wikimedia.org/wikipedia/commons/8/86/Triforce.svg\"\u003e\u003c/img\u003e\n\nzelda [![License](https://img.shields.io/badge/license-MIT-8FBD08.svg)](https://shields.io/) [![Zig](https://img.shields.io/badge/Made_with-Zig-F7A41D.svg)](https://shields.io/)\n====\nA short and sweet package for native [Zig](https://ziglang.org) HTTP(s) requests.\n\nZelda uses [hzzp](https://github.com/truemedian/hzzp) and [zig-libressl](https://github.com/haze/zig-libressl) to provide a simple interface for HTTP 1.1 interactions. There is a lot that goes into retrieving data from a remote server, but sometimes you don't want to spend hours mulling over the details, especially for projects where the transport is only a portion of the story of the larger program.\n\n### Capabilities\n- [x] HTTP/1.1\n- [x] TLS 1.1, TLS 1.2, TLS 1.3\n- [x] Simple One-Shot interface for raw bytes \u0026 JSON encoded data\n\n### Linking\n\n```zig\nconst zelda = @import(\"path/to/zelda/build.zig\");\n\npub fn build(b: *std.build.Builder) !void {\n    const exe = ...\n    try zelda.link(b, exe, target, mode, use_system_libressl);\n}\n```\n\n### Example\n```zig\n/// Extracted from `examples/whats_my_ip/src/main.zig`\nconst std = @import(\"std\");\nconst zelda = @import(\"zelda\");\n\nconst IPResponse = struct {\n    ip: []const u8,\n};\n\npub fn main() anyerror!void {\n    var arena = std.heap.ArenaAllocator.init(std.heap.c_allocator);\n    defer arena.deinit();\n\n    try printIPFromRaw(arena.allocator());\n    try printIPFromJson(arena.allocator());\n}\n\npub fn printIPFromJson(allocator: std.mem.Allocator) !void {\n    const response = try zelda.getAndParseResponse(IPResponse, .{ .allocator = allocator }, allocator, \"https://api64.ipify.org/?format=json\");\n    defer std.json.parseFree(IPResponse, response, .{ .allocator = allocator });\n\n    var stdout = std.io.getStdOut().writer();\n\n    try stdout.print(\"My ip is {s}\\n\", .{response.ip});\n}\n\npub fn printIPFromRaw(allocator: std.mem.Allocator) !void {\n    var response = try zelda.get(allocator, \"http://api64.ipify.org/\");\n    defer response.deinit();\n\n    var stdout = std.io.getStdOut().writer();\n\n    if (response.body) |body|\n        try stdout.print(\"My ip is {s}\\n\", .{response.body})\n    else\n        try stdout.writeAll(\"Failed to receive body from ipify\\n\");\n}\n```\n\nOf course, if this library is missing anything, feel free to open a Pull Request or issue 😊\n\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\n\u003cbr/\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this package by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaze%2Fzelda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaze%2Fzelda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaze%2Fzelda/lists"}