(ctx context.Context, id string)
| 199 | } |
| 200 | |
| 201 | func (c *eventClient) DeleteSubscription(ctx context.Context, id string) error { |
| 202 | if !SupportedHost(c.host) { |
| 203 | return ErrUnsupportedHost |
| 204 | } |
| 205 | |
| 206 | path, err := safeurl.JoinPath("event-subscriptions", id) |
| 207 | if err != nil { |
| 208 | return err |
| 209 | } |
| 210 | |
| 211 | if err := c.api.REST(c.host, http.MethodDelete, path.String(), nil, nil); err != nil { |
| 212 | if httpErr, ok := errors.AsType[api.HTTPError](err); ok { |
| 213 | switch { |
| 214 | case httpErr.StatusCode == http.StatusNotFound: |
| 215 | return fmt.Errorf("%w: %w", ErrSubscriptionNotFound, err) |
| 216 | case httpErr.StatusCode == http.StatusForbidden: |
| 217 | return forbiddenError(httpErr, err) |
| 218 | } |
| 219 | } |
| 220 | return err |
| 221 | } |
| 222 | return nil |
| 223 | } |
| 224 | |
| 225 | func (c *eventClient) OpenStream(ctx context.Context, id string) (io.ReadCloser, error) { |
| 226 | if !SupportedHost(c.host) { |
nothing calls this directly
no test coverage detected