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

Method UpdateNotificationTemplateMethod

codersdk/notifications.go:78–95  ·  view source on GitHub ↗

UpdateNotificationTemplateMethod modifies a notification template to use a specific notification method, overriding the method set in the deployment configuration.

(ctx context.Context, notificationTemplateID uuid.UUID, method string)

Source from the content-addressed store, hash-verified

76// UpdateNotificationTemplateMethod modifies a notification template to use a specific notification method, overriding
77// the method set in the deployment configuration.
78func (c *Client) UpdateNotificationTemplateMethod(ctx context.Context, notificationTemplateID uuid.UUID, method string) error {
79 res, err := c.Request(ctx, http.MethodPut,
80 fmt.Sprintf("/api/v2/notifications/templates/%s/method", notificationTemplateID),
81 UpdateNotificationTemplateMethod{Method: method},
82 )
83 if err != nil {
84 return err
85 }
86 defer res.Body.Close()
87
88 if res.StatusCode == http.StatusNotModified {
89 return nil
90 }
91 if res.StatusCode != http.StatusOK {
92 return ReadBodyAsError(res)
93 }
94 return nil
95}
96
97// GetSystemNotificationTemplates retrieves all notification templates pertaining to internal system events.
98func (c *Client) GetSystemNotificationTemplates(ctx context.Context) ([]NotificationTemplate, error) {

Callers 1

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1