export type CreateApiRepostsPlaylistsPlaylistUrnArgs = {playlist_urn: string}; export type CreateApiRepostsPlaylistsPlaylistUrnOptions = {baseUrl?: string | undefined, AuthHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reposts a playlist as the authenticated user * * POST /reposts/playlists/{playlist_urn} * * Also accepts auth: oAuth2_1 */ export const createApiRepostsPlaylistsPlaylistUrn = async (args: CreateApiRepostsPlaylistsPlaylistUrnArgs, options?: CreateApiRepostsPlaylistsPlaylistUrnOptions) => { const {baseUrl = "https://api.soundcloud.com", fetch: fetchFn = fetch, AuthHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (AuthHeader !== undefined) headers.set("Authorization", AuthHeader) const url = `${baseUrl.replace(/\/+$/, '')}/reposts/playlists/${encodeURIComponent(String(args.playlist_urn))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };