fetch_ml/cli/src/net/ws/utils.zig
Jeremie Fraeys 8e3fa94322
feat(cli): enhance Zig CLI with new commands and improved networking
- Add new commands: annotate, narrative, requeue
- Refactor WebSocket client into modular components (net/ws/)
- Add rsync embedded binary support
- Improve error handling and response packet processing
- Update build.zig and completions
2026-02-12 12:05:10 -05:00

25 lines
538 B
Zig

const std = @import("std");
pub fn jsonGetString(obj: std.json.ObjectMap, key: []const u8) ?[]const u8 {
const v_opt = obj.get(key);
if (v_opt == null) {
return null;
}
const v = v_opt.?;
if (v != .string) {
return null;
}
return v.string;
}
pub fn jsonGetInt(obj: std.json.ObjectMap, key: []const u8) ?i64 {
const v_opt = obj.get(key);
if (v_opt == null) {
return null;
}
const v = v_opt.?;
if (v != .integer) {
return null;
}
return v.integer;
}