diff options
| author | andromeda <andromeda@lenovo> | 2026-05-10 22:03:14 +0200 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-05-10 22:03:14 +0200 |
| commit | 2253eb52841f30c51c88c51f65a2ecc77518f14e (patch) | |
| tree | 8ef0225183c647097d41ffd30bd76ab7bcbc1838 /main.c3 | |
| parent | 735f0ff00859d9dda5e93be401c609653e1467a8 (diff) | |
Diffstat (limited to 'main.c3')
| -rw-r--r-- | main.c3 | 28 |
1 files changed, 13 insertions, 15 deletions
@@ -21,6 +21,8 @@ module radgen; import std::io; import std::encoding::json; import std::collections::object; +import std::collections::pair; +import std::math::random; import curl; import radapi; @@ -30,22 +32,18 @@ fn int main(String[] args) { Client* c = radapi::new_client(url); - c.request(Request.REPO_ROOT, "?show=all&perPage=16384&page=0"); - - Object* j = json::tparse(c.response())!!; - - int i = 0; - while (i < j.array.len()) + Node n = c.request(Request.NODE, "", {}).node; + io::printn(n.id); + Rid[] rds = c.request(Request.NODES_INVENTORY, "?perPage=100000000&show=all", {.nid = n.id}).nodes_inventory; + while (true) { - io::print(j.get_at(i).get_string("rid"))!!; - io::print(" "); - io::printn(j.get_at(i).get("payloads").get("xyz.radicle.project").get("data").get_string("name"))!!; - i++; + int j = rand(rds.len); + io::printn(rds[j]); + Commit[] cs = c.request(Request.HISTORY, "", {.rid = rds[j]}).history; + int i = rand(cs.len); + io::printn(cs[i].id); + CommitFull cf = c.request(Request.COMMIT, "", {.rid = rds[j], .sha = cs[i].id}).commit; + io::printn(cf); } - - c.request(Request.REPO, "", j.get_at(0).get_string("rid"))!!; - - io::printn((String)c.buffer.[..c.buffer_index]); - return 0; } |
