MCPcopy Create free account
hub / github.com/cli/cli / DeleteSubscription

Method DeleteSubscription

pkg/cmd/event/client/client.go:190–212  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

188}
189
190func (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
214func (c *eventClient) OpenStream(ctx context.Context, id string) (io.ReadCloser, error) {
215 if !SupportedHost(c.host) {

Callers

nothing calls this directly

Calls 6

JoinPathFunction · 0.92
SupportedHostFunction · 0.85
forbiddenErrorFunction · 0.85
RESTMethod · 0.65
StringMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected