MCPcopy Index your code
hub / github.com/coder/coder / AddLicense

Method AddLicense

codersdk/licenses.go:99–112  ·  view source on GitHub ↗
(ctx context.Context, r AddLicenseRequest)

Source from the content-addressed store, hash-verified

97}
98
99func (c *Client) AddLicense(ctx context.Context, r AddLicenseRequest) (License, error) {
100 res, err := c.Request(ctx, http.MethodPost, "/api/v2/licenses", r)
101 if err != nil {
102 return License{}, err
103 }
104 defer res.Body.Close()
105 if res.StatusCode != http.StatusCreated {
106 return License{}, ReadBodyAsError(res)
107 }
108 var l License
109 d := json.NewDecoder(res.Body)
110 d.UseNumber()
111 return l, d.Decode(&l)
112}
113
114func (c *Client) Licenses(ctx context.Context) ([]License, error) {
115 res, err := c.Request(ctx, http.MethodGet, "/api/v2/licenses", nil)

Callers 3

TestPostLicenseFunction · 0.80
AddLicenseFunction · 0.80
licenseAddMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1

TestPostLicenseFunction · 0.64