export type ResourceId = string; export type DeleteApiV2SitesSiteIdChannelsChannelIdArgs = {site_id: ResourceId, channel_id: ResourceId}; export type DeleteApiV2SitesSiteIdChannelsChannelIdOptions = {baseUrl?: string | undefined, v2ApiSecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a live channel * * DELETE /v2/sites/{site_id}/channels/{channel_id}/ */ export const deleteApiV2SitesSiteIdChannelsChannelId = async (args: DeleteApiV2SitesSiteIdChannelsChannelIdArgs, options?: DeleteApiV2SitesSiteIdChannelsChannelIdOptions) => { const {baseUrl = "https://api.jwplayer.com", fetch: fetchFn = fetch, v2ApiSecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (v2ApiSecret !== undefined) headers.set("Authorization", v2ApiSecret) const url = `${baseUrl.replace(/\/+$/, '')}/v2/sites/${encodeURIComponent(String(args.site_id))}/channels/${encodeURIComponent(String(args.channel_id))}/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };