-
-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathclient.go
83 lines (73 loc) · 2.18 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
// Code generated by goa v3.15.2, DO NOT EDIT.
//
// tools client
//
// Command:
// $ goa gen github.com/arduino/arduino-create-agent/design
package tools
import (
"context"
goa "goa.design/goa/v3/pkg"
)
// Client is the "tools" service client.
type Client struct {
AvailableEndpoint goa.Endpoint
InstalledheadEndpoint goa.Endpoint
InstalledEndpoint goa.Endpoint
InstallEndpoint goa.Endpoint
RemoveEndpoint goa.Endpoint
}
// NewClient initializes a "tools" service client given the endpoints.
func NewClient(available, installedhead, installed, install, remove goa.Endpoint) *Client {
return &Client{
AvailableEndpoint: available,
InstalledheadEndpoint: installedhead,
InstalledEndpoint: installed,
InstallEndpoint: install,
RemoveEndpoint: remove,
}
}
// Available calls the "available" endpoint of the "tools" service.
func (c *Client) Available(ctx context.Context) (res ToolCollection, err error) {
var ires any
ires, err = c.AvailableEndpoint(ctx, nil)
if err != nil {
return
}
return ires.(ToolCollection), nil
}
// Installedhead calls the "installedhead" endpoint of the "tools" service.
func (c *Client) Installedhead(ctx context.Context) (err error) {
_, err = c.InstalledheadEndpoint(ctx, nil)
return
}
// Installed calls the "installed" endpoint of the "tools" service.
func (c *Client) Installed(ctx context.Context) (res ToolCollection, err error) {
var ires any
ires, err = c.InstalledEndpoint(ctx, nil)
if err != nil {
return
}
return ires.(ToolCollection), nil
}
// Install calls the "install" endpoint of the "tools" service.
// Install may return the following errors:
// - "not_found" (type *goa.ServiceError): tool not found
// - error: internal error
func (c *Client) Install(ctx context.Context, p *ToolPayload) (res *Operation, err error) {
var ires any
ires, err = c.InstallEndpoint(ctx, p)
if err != nil {
return
}
return ires.(*Operation), nil
}
// Remove calls the "remove" endpoint of the "tools" service.
func (c *Client) Remove(ctx context.Context, p *ToolPayload) (res *Operation, err error) {
var ires any
ires, err = c.RemoveEndpoint(ctx, p)
if err != nil {
return
}
return ires.(*Operation), nil
}