-
Notifications
You must be signed in to change notification settings - Fork 8
/
client.go
157 lines (142 loc) · 4.75 KB
/
client.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// Code generated by goa v3.4.3, DO NOT EDIT.
//
// collection client
//
// Command:
// $ goa-v3.4.3 gen github.com/artefactual-labs/enduro/internal/api/design -o
// internal/api
package collection
import (
"context"
goa "goa.design/goa/v3/pkg"
)
// Client is the "collection" service client.
type Client struct {
ListEndpoint goa.Endpoint
ShowEndpoint goa.Endpoint
DeleteEndpoint goa.Endpoint
CancelEndpoint goa.Endpoint
RetryEndpoint goa.Endpoint
WorkflowEndpoint goa.Endpoint
DownloadEndpoint goa.Endpoint
DecideEndpoint goa.Endpoint
BulkEndpoint goa.Endpoint
BulkStatusEndpoint goa.Endpoint
}
// NewClient initializes a "collection" service client given the endpoints.
func NewClient(list, show, delete_, cancel, retry, workflow, download, decide, bulk, bulkStatus goa.Endpoint) *Client {
return &Client{
ListEndpoint: list,
ShowEndpoint: show,
DeleteEndpoint: delete_,
CancelEndpoint: cancel,
RetryEndpoint: retry,
WorkflowEndpoint: workflow,
DownloadEndpoint: download,
DecideEndpoint: decide,
BulkEndpoint: bulk,
BulkStatusEndpoint: bulkStatus,
}
}
// List calls the "list" endpoint of the "collection" service.
func (c *Client) List(ctx context.Context, p *ListPayload) (res *ListResult, err error) {
var ires interface{}
ires, err = c.ListEndpoint(ctx, p)
if err != nil {
return
}
return ires.(*ListResult), nil
}
// Show calls the "show" endpoint of the "collection" service.
// Show may return the following errors:
// - "not_found" (type *NotFound): Collection not found
// - error: internal error
func (c *Client) Show(ctx context.Context, p *ShowPayload) (res *EnduroStoredCollection, err error) {
var ires interface{}
ires, err = c.ShowEndpoint(ctx, p)
if err != nil {
return
}
return ires.(*EnduroStoredCollection), nil
}
// Delete calls the "delete" endpoint of the "collection" service.
// Delete may return the following errors:
// - "not_found" (type *NotFound): Collection not found
// - error: internal error
func (c *Client) Delete(ctx context.Context, p *DeletePayload) (err error) {
_, err = c.DeleteEndpoint(ctx, p)
return
}
// Cancel calls the "cancel" endpoint of the "collection" service.
// Cancel may return the following errors:
// - "not_found" (type *NotFound): Collection not found
// - "not_running" (type *goa.ServiceError)
// - error: internal error
func (c *Client) Cancel(ctx context.Context, p *CancelPayload) (err error) {
_, err = c.CancelEndpoint(ctx, p)
return
}
// Retry calls the "retry" endpoint of the "collection" service.
// Retry may return the following errors:
// - "not_found" (type *NotFound): Collection not found
// - "not_running" (type *goa.ServiceError)
// - error: internal error
func (c *Client) Retry(ctx context.Context, p *RetryPayload) (err error) {
_, err = c.RetryEndpoint(ctx, p)
return
}
// Workflow calls the "workflow" endpoint of the "collection" service.
// Workflow may return the following errors:
// - "not_found" (type *NotFound): Collection not found
// - error: internal error
func (c *Client) Workflow(ctx context.Context, p *WorkflowPayload) (res *EnduroCollectionWorkflowStatus, err error) {
var ires interface{}
ires, err = c.WorkflowEndpoint(ctx, p)
if err != nil {
return
}
return ires.(*EnduroCollectionWorkflowStatus), nil
}
// Download calls the "download" endpoint of the "collection" service.
// Download may return the following errors:
// - "not_found" (type *NotFound): Collection not found
// - error: internal error
func (c *Client) Download(ctx context.Context, p *DownloadPayload) (res []byte, err error) {
var ires interface{}
ires, err = c.DownloadEndpoint(ctx, p)
if err != nil {
return
}
return ires.([]byte), nil
}
// Decide calls the "decide" endpoint of the "collection" service.
// Decide may return the following errors:
// - "not_found" (type *NotFound): Collection not found
// - "not_valid" (type *goa.ServiceError)
// - error: internal error
func (c *Client) Decide(ctx context.Context, p *DecidePayload) (err error) {
_, err = c.DecideEndpoint(ctx, p)
return
}
// Bulk calls the "bulk" endpoint of the "collection" service.
// Bulk may return the following errors:
// - "not_available" (type *goa.ServiceError)
// - "not_valid" (type *goa.ServiceError)
// - error: internal error
func (c *Client) Bulk(ctx context.Context, p *BulkPayload) (res *BulkResult, err error) {
var ires interface{}
ires, err = c.BulkEndpoint(ctx, p)
if err != nil {
return
}
return ires.(*BulkResult), nil
}
// BulkStatus calls the "bulk_status" endpoint of the "collection" service.
func (c *Client) BulkStatus(ctx context.Context) (res *BulkStatusResult, err error) {
var ires interface{}
ires, err = c.BulkStatusEndpoint(ctx, nil)
if err != nil {
return
}
return ires.(*BulkStatusResult), nil
}