/
modelSets.go
47 lines (36 loc) · 1.73 KB
/
modelSets.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
package lookergo
import "context"
const modelSetsBasePath = "4.0/model_sets"
type ModelSetsResource interface {
List(ctx context.Context) ([]ModelSet, *Response, error)
Get(ctx context.Context, modelSetId string) (*ModelSet, *Response, error)
Create(ctx context.Context, modelSet *ModelSet) (*ModelSet, *Response, error)
Update(ctx context.Context, modelSetId string, modelSet *ModelSet) (*ModelSet, *Response, error)
Delete(ctx context.Context, modelSetId string) (*Response, error)
}
type ModelSetsResourceOp struct {
client *Client
}
var _ ModelSetsResource = &ModelSetsResourceOp{}
type ModelSet struct {
BuiltIn bool `json:"built_in,omitempty"`
Id string `json:"id,omitempty"`
AllAccess bool `json:"all_access,omitempty"`
Models []string `json:"models,omitempty"`
Name string `json:"name,omitempty"`
}
func (s ModelSetsResourceOp) List(ctx context.Context) ([]ModelSet, *Response, error) {
return doList(ctx, s.client, modelSetsBasePath, nil, new([]ModelSet))
}
func (s ModelSetsResourceOp) Get(ctx context.Context, modelSetId string) (*ModelSet, *Response, error) {
return doGetById(ctx, s.client, modelSetsBasePath, modelSetId, new(ModelSet))
}
func (s ModelSetsResourceOp) Create(ctx context.Context, modelSet *ModelSet) (*ModelSet, *Response, error) {
return doCreate(ctx, s.client, modelSetsBasePath, modelSet, new(ModelSet))
}
func (s ModelSetsResourceOp) Update(ctx context.Context, modelSetId string, modelSet *ModelSet) (*ModelSet, *Response, error) {
return doUpdate(ctx, s.client, modelSetsBasePath, modelSetId, modelSet, new(ModelSet))
}
func (s ModelSetsResourceOp) Delete(ctx context.Context, modelSetId string) (*Response, error) {
return doDelete(ctx, s.client, modelSetsBasePath, modelSetId)
}