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

Method TemplateVersionByOrganizationAndName

codersdk/organizations.go:509–525  ·  view source on GitHub ↗
(ctx context.Context, organizationID uuid.UUID, templateName, versionName string)

Source from the content-addressed store, hash-verified

507}
508
509func (c *Client) TemplateVersionByOrganizationAndName(ctx context.Context, organizationID uuid.UUID, templateName, versionName string) (TemplateVersion, error) {
510 res, err := c.Request(ctx, http.MethodGet,
511 fmt.Sprintf("/api/v2/organizations/%s/templates/%s/versions/%s", organizationID.String(), templateName, versionName),
512 nil,
513 )
514 if err != nil {
515 return TemplateVersion{}, xerrors.Errorf("execute request: %w", err)
516 }
517 defer res.Body.Close()
518
519 if res.StatusCode != http.StatusOK {
520 return TemplateVersion{}, ReadBodyAsError(res)
521 }
522
523 var templateVersion TemplateVersion
524 return templateVersion, json.NewDecoder(res.Body).Decode(&templateVersion)
525}
526
527// CreateTemplate creates a new template inside an organization.
528func (c *Client) CreateTemplate(ctx context.Context, organizationID uuid.UUID, request CreateTemplateRequest) (Template, error) {

Calls 5

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45
ErrorfMethod · 0.45