-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstructs.go
76 lines (64 loc) · 1.67 KB
/
structs.go
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
65
66
67
68
69
70
71
72
73
74
75
76
package goidoit
// globals
var (
id int
debug, insecure bool = false, false
)
// API struct used for implementing the apiMethods interface
type API struct {
URL, APIkey, Username, Password, SessionID string
}
// Request implements i-doit api request structure
type Request struct {
Version string `json:"version"`
Method string `json:"method"`
Params interface{} `json:"params"`
ID int `json:"id"`
}
// Response implements i-doit api response structure
type Response struct {
Jsonrpc string `json:"jsonrpc"`
Result interface{} `json:"result"`
Error IdoitError `json:"error"`
}
// GenericResponse implements a generic i-doit api response structure
// the map is used to handle type assertions
type GenericResponse struct {
Jsonrpc string
Result []map[string]interface{}
Error IdoitError
}
// IdoitError implements i-doit api error structure
type IdoitError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
// APIkey used for requests
type APIkey struct {
APIkey string `json:"apikey"`
}
// F1 implements an object filter type int or []int
type F1 struct {
Data []int `json:"ids"`
}
// F2 implements an Object filter type string
type F2 struct {
Data string `json:"title"`
}
// OF1 implements a more complex object type filter
// for ids and type
type OF1 struct {
Title []int `json:"ids"`
Type string `json:"type"`
}
// OF2 implements a more complex object type filter
// for title and type
type OF2 struct {
Title string `json:"title"`
Type string `json:"type"`
}
// OSF1 implements object type only filter
type OSF1 struct {
Type string `json:"type"`
}