aboutsummaryrefslogtreecommitdiff
path: root/src/api/sketch.zig
blob: 409606fee7e49e7383c5f35b08a3f237c3f7d611 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const std = @import("std");
const http = @import("http");

pub const Url = http.Url.Template(
    "/api/images/{id}/metadata/{name}",
    .{
        .guard = Auth(.admin),
    }
);

const Query = struct {
    condition: []const u8,
    start: usize,
    end: usize,
}

pub fn post(request: http.Request(Url)) !http.Response {
    const query = try request.body.json(Query, request.arena);

    return .string(request.params.id);
}

pub fn get(request: http.Request(Url)) !http.Response {
    return .file("./some/path.txt");
}

test {
    _ = std.testing.refAllDecls(@This());
}