package videos import ( "context" "encoding/json" "fmt" "net/http" "net/url" ) type DeleteVideosResponse struct { // The list of IDs of the videos that were deleted. Data []string `json:"data"` } // Deletes one or more videos. You may delete past broadcasts, highlights, or uploads. // // Requires a user access token that includes the channel:manage:videos scope. func (v *Videos) DeleteVideos(ctx context.Context, ids []string) (*DeleteVideosResponse, error) { endpoint := v.baseUrl.ResolveReference(&url.URL{Path: "videos", RawQuery: url.Values{"id": ids}.Encode()}) req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil) if err != nil { return nil, err } res, err := v.client.Do(req) if err != nil { return nil, err } defer res.Body.Close() statusOK := res.StatusCode >= 200 && res.StatusCode < 300 if !statusOK { return nil, fmt.Errorf("failed to delete videos (%d)", res.StatusCode) } var data DeleteVideosResponse if err := json.NewDecoder(res.Body).Decode(&data); err != nil { return nil, err } return &data, nil }