fediglam/src/main/controllers/api/invites.zig

17 lines
435 B
Zig
Raw Normal View History

2022-10-10 02:31:15 +00:00
const api = @import("api");
2022-07-27 05:02:09 +00:00
2022-09-08 05:10:58 +00:00
pub const create = struct {
pub const method = .POST;
2022-11-27 01:52:30 +00:00
pub const path = "/invites";
2022-10-11 03:28:23 +00:00
2023-01-04 19:03:23 +00:00
pub const Body = api.invites.CreateOptions;
2022-07-27 05:02:09 +00:00
2022-10-11 03:28:23 +00:00
pub fn handler(req: anytype, res: anytype, srv: anytype) !void {
2022-10-10 02:31:15 +00:00
// No need to free because it will be freed when the api conn
// is closed
2022-10-11 03:28:23 +00:00
const invite = try srv.createInvite(req.body);
2022-07-27 05:02:09 +00:00
2022-10-11 03:28:23 +00:00
try res.json(.created, invite);
2022-09-08 05:10:58 +00:00
}
};