@Summary Get template examples by organization @ID get-template-examples-by-organization @Security CoderSessionToken @Produce json @Tags Templates @Param organization path string true "Organization ID" format(uuid) @Success 200 {array} codersdk.TemplateExample @Router /api/v2/organizations/{organiza
(rw http.ResponseWriter, r *http.Request)
| 917 | // @Router /api/v2/organizations/{organization}/templates/examples [get] |
| 918 | // @Deprecated Use /templates/examples instead |
| 919 | func (api *API) templateExamplesByOrganization(rw http.ResponseWriter, r *http.Request) { |
| 920 | var ( |
| 921 | ctx = r.Context() |
| 922 | organization = httpmw.OrganizationParam(r) |
| 923 | ) |
| 924 | |
| 925 | if !api.Authorize(r, policy.ActionRead, rbac.ResourceTemplate.InOrg(organization.ID)) { |
| 926 | httpapi.ResourceNotFound(rw) |
| 927 | return |
| 928 | } |
| 929 | |
| 930 | ex, err := examples.List() |
| 931 | if err != nil { |
| 932 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 933 | Message: "Internal error fetching examples.", |
| 934 | Detail: err.Error(), |
| 935 | }) |
| 936 | return |
| 937 | } |
| 938 | |
| 939 | httpapi.Write(ctx, rw, http.StatusOK, ex) |
| 940 | } |
| 941 | |
| 942 | // @Summary Get template examples |
| 943 | // @ID get-template-examples |
nothing calls this directly
no test coverage detected