summaryrefslogtreecommitdiff
path: root/src/request.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/request.zig')
-rw-r--r--src/request.zig14
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 } },
},
},
},