github.com/profzone/eden-framework@v1.0.10/internal/project/repo/client.go (about) 1 package repo 2 3 import ( 4 "github.com/profzone/eden-framework/pkg/courier/client" 5 "net/http" 6 "time" 7 ) 8 9 type Client struct { 10 tagUri string 11 *client.Client 12 } 13 14 func NewClient(mode, host string, port int16) *Client { 15 cli := &Client{ 16 tagUri: "/repos/profzone/eden-framework/tags", 17 Client: &client.Client{ 18 Host: host, 19 Mode: mode, 20 Port: port, 21 Timeout: time.Minute, 22 }, 23 } 24 cli.MarshalDefaults(cli.Client) 25 return cli 26 } 27 28 func (c *Client) GetTags() (TagsResponse, error) { 29 var resp TagsResponse 30 request := c.Request("", http.MethodGet, c.tagUri, nil) 31 err := request.Do().Into(&resp) 32 if err != nil { 33 return nil, err 34 } 35 return resp, nil 36 }