-
Notifications
You must be signed in to change notification settings - Fork 894
feat: add examples to api #5331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
300a763
da9fc00
a9f04f3
90e6a9d
7084ceb
50fb405
b00a3b9
85266d0
9f3108f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,3 +246,17 @@ type AgentStatsReportResponse struct { | |
// TxBytes is the number of transmitted bytes. | ||
TxBytes int64 `json:"tx_bytes"` | ||
} | ||
|
||
// TemplateExamples lists example templates embedded in coder. | ||
func (c *Client) TemplateExamples(ctx context.Context, organizationID uuid.UUID) ([]TemplateExample, error) { | ||
res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/organizations/%s/templates/examples", organizationID), nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are template examples org-scoped? Seems like you did it so it could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are admin only so I felt it was better to keep it all under that same auth schema. Do you think it really impacts anything until we have multi-org? |
||
if err != nil { | ||
return nil, err | ||
} | ||
defer res.Body.Close() | ||
if res.StatusCode != http.StatusOK { | ||
return nil, readBodyAsError(res) | ||
} | ||
var templateExamples []TemplateExample | ||
return templateExamples, json.NewDecoder(res.Body).Decode(&templateExamples) | ||
} |
Uh oh!
There was an error while loading. Please reload this page.