package conduit import ( "context" "fmt" "net/http" "net/url" "go.fifitido.net/twitch/api/endpoint" ) // Deletes a specified conduit. // Note that it may take some time for Eventsub subscriptions on a deleted conduit to show as disabled when calling Get Eventsub Subscriptions. // // Requires an app access token. func (c *Conduit) DeleteConduit(ctx context.Context, id string) error { v := url.Values{"id": {id}} req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.Make(c.baseUrl, "eventsub/conduits", v), nil) if err != nil { return err } res, err := c.client.Do(req) if err != nil { return err } defer res.Body.Close() statusOK := res.StatusCode >= 200 && res.StatusCode < 300 if !statusOK { return fmt.Errorf("failed to delete conduit (%d)", res.StatusCode) } return nil }