aboutsummaryrefslogtreecommitdiff
path: root/src/commands.h
blob: d04affcf6bb3dfd980b38094f672bba41b25cf3a (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
30
31
32
33
#ifndef BOKF_COMMANDS_H
#define BOKF_COMMANDS_H

#include <stddef.h>

#include "protocol.h"

enum cmd_perm {
    PERM_PUBLIC = 0,
    PERM_READ,
    PERM_WRITE,
    PERM_OWNER,
    PERM_ADMIN
};

struct command {
    const char *name;
    const char *summary;
    enum cmd_perm perm;
    int need_org;
    int mutating;
    int dry_run;
    yyjson_mut_val *(*fn)(struct req *r);
};

extern const struct command g_commands[];
extern const size_t g_commands_count;

const struct command *command_find(const char *name);
const char *perm_name(enum cmd_perm p);
const char *perm_scope(enum cmd_perm p);

#endif