(ctx context.Context, id string)
| 188 | } |
| 189 | |
| 190 | func (c *eventClient) DeleteSubscription(ctx context.Context, id string) error { |
| 191 | if !SupportedHost(c.host) { |
| 192 | return ErrUnsupportedHost |
| 193 | } |
| 194 | |
| 195 | path, err := safeurl.JoinPath("event-subscriptions", id) |
| 196 | if err != nil { |
| 197 | return err |
| 198 | } |
| 199 | |
| 200 | if err := c.api.REST(c.host, http.MethodDelete, path.String(), nil, nil); err != nil { |
| 201 | if httpErr, ok := errors.AsType[api.HTTPError](err); ok { |
| 202 | switch { |
| 203 | case httpErr.StatusCode == http.StatusNotFound: |
| 204 | return fmt.Errorf("%w: %w", ErrSubscriptionNotFound, err) |
| 205 | case httpErr.StatusCode == http.StatusForbidden: |
| 206 | return forbiddenError(httpErr, err) |
| 207 | } |
| 208 | } |
| 209 | return err |
| 210 | } |
| 211 | return nil |
| 212 | } |
| 213 | |
| 214 | func (c *eventClient) OpenStream(ctx context.Context, id string) (io.ReadCloser, error) { |
| 215 | if !SupportedHost(c.host) { |
nothing calls this directly
no test coverage detected