-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsdk.h
64 lines (54 loc) · 1.45 KB
/
sdk.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef SDK_H
#define SDK_H
#include <string>
#include <map>
#include <list>
#include "plugin.grpc.pb.h"
using std::string;
using std::list;
using proto::Job;
namespace gaia {
struct InputType {
enum class input_type {
textfield,
textarea,
boolean,
vault
};
};
inline const string ToString (InputType::input_type es) {
const std::map<InputType::input_type,const string> EnumStrings {
{ InputType::input_type::textfield, "textfield" },
{ InputType::input_type::textarea, "textarea" },
{ InputType::input_type::boolean, "boolean" },
{ InputType::input_type::vault, "vault" }
};
auto it = EnumStrings.find(es);
return it == EnumStrings.end() ? "Out of range" : it->second;
}
struct argument {
string description;
InputType::input_type type;
string key;
string value;
};
struct manual_interaction {
string description;
InputType::input_type type;
string value;
};
struct job {
void (*handler)(list<argument>) throw(string);
string title;
string description;
list<string> depends_on;
list<argument> args;
manual_interaction interaction;
};
struct job_wrapper {
void (*handler)(list<argument>) throw(string);
Job job;
};
void Serve(list<job>) throw(string);
}
#endif