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

Method DeleteSubscription

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

Source from the content-addressed store, hash-verified

199}
200
201func (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
225func (c *eventClient) OpenStream(ctx context.Context, id string) (io.ReadCloser, error) {
226 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