diff options
author | Christian Segundo | 2023-06-17 02:54:34 +0200 |
---|---|---|
committer | Christian Segundo | 2023-06-17 02:54:34 +0200 |
commit | c7412022c3c607c809f774db2459f9259ba95038 (patch) | |
tree | 72b7c416c02f5aa189388bcf7851050ce75f3325 /src/request.zig | |
parent | 831740fcacfe67b8124436460afa77af15493f93 (diff) | |
download | zmission-c7412022c3c607c809f774db2459f9259ba95038.tar.gz |
one step closer
Diffstat (limited to 'src/request.zig')
-rw-r--r-- | src/request.zig | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/request.zig b/src/request.zig index 478999b..214f997 100644 --- a/src/request.zig +++ b/src/request.zig @@ -1,7 +1,9 @@ const std = @import("std"); const util = @import("util.zig"); -const Method = enum { +pub const Request = @This(); + +pub const Method = enum { // Torrent requests: Torrent action // https://github.com/transmission/transmission/blob/main/docs/rpc-spec.md#31-torrent-action-requests torrent_start, @@ -53,8 +55,8 @@ const Method = enum { }; pub const TorrentIDs = union(enum) { - single: usize, - many: []const usize, + single: i32, + many: []const i32, recently_active, pub fn jsonStringify(self: TorrentIDs, options: std.json.StringifyOptions, out_stream: anytype) !void { @@ -309,7 +311,7 @@ pub const SessionSet = struct { } }; -pub const Request = struct { +pub const Object = struct { method: Method, arguments: union(Method) { torrent_start: TorrentStart, @@ -358,7 +360,7 @@ test "json request encoding" { const test_case = struct { name: []const u8, expected: []const u8, - request: Request, + request: Object, fn run(self: @This()) !void { var req = std.ArrayList(u8).init(std.testing.allocator); @@ -429,7 +431,7 @@ test "json request encoding" { .method = .torrent_reannounce, .arguments = .{ .torrent_reannounce = .{ - .ids = .{ .many = &[_]usize{ 1, 2 } }, + .ids = .{ .many = &[_]i32{ 1, 2 } }, }, }, }, |