forked from zeroviscosity/veldt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.go
84 lines (78 loc) · 2.1 KB
/
generate.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
77
78
79
80
81
82
83
84
package veldt
// GenerateTile generates a tile for the provided pipeline ID and JSON request.
func GenerateTile(id string, args map[string]interface{}) error {
pipeline, err := GetPipeline(id)
if err != nil {
return err
}
req, err := pipeline.NewTileRequest(args)
if err != nil {
return err
}
return pipeline.Generate(req)
}
// GetTile retrieves a tile from the store for the provided pipeline ID
// and JSON request.
func GetTile(id string, args map[string]interface{}) ([]byte, error) {
pipeline, err := GetPipeline(id)
if err != nil {
return nil, err
}
req, err := pipeline.NewTileRequest(args)
if err != nil {
return nil, err
}
return pipeline.Get(req)
}
// GenerateAndGetTile generates and retrieves a tile from the store
// for the provided pipeline ID and JSON request.
func GenerateAndGetTile(id string, args map[string]interface{}) ([]byte, error) {
pipeline, err := GetPipeline(id)
if err != nil {
return nil, err
}
req, err := pipeline.NewTileRequest(args)
if err != nil {
return nil, err
}
return pipeline.GenerateAndGet(req)
}
// GenerateMeta generates meta data for the provided pipeline ID and JSON
// request.
func GenerateMeta(id string, args map[string]interface{}) error {
pipeline, err := GetPipeline(id)
if err != nil {
return err
}
req, err := pipeline.NewMetaRequest(args)
if err != nil {
return err
}
return pipeline.Generate(req)
}
// GetMeta retrieves metadata from the store for the provided pipeline
// ID and JSON request.
func GetMeta(id string, args map[string]interface{}) ([]byte, error) {
pipeline, err := GetPipeline(id)
if err != nil {
return nil, err
}
req, err := pipeline.NewMetaRequest(args)
if err != nil {
return nil, err
}
return pipeline.Get(req)
}
// GenerateAndGetMeta generates and retrieves a metadata from the store
// for the provided pipeline ID and JSON request.
func GenerateAndGetMeta(id string, args map[string]interface{}) ([]byte, error) {
pipeline, err := GetPipeline(id)
if err != nil {
return nil, err
}
req, err := pipeline.NewMetaRequest(args)
if err != nil {
return nil, err
}
return pipeline.GenerateAndGet(req)
}