export type DeleteApiUsersUserIdPlayingItemsItemIdArgs = {userId: string, itemId: string, mediaSourceId?: (string | null) | undefined, nextMediaType?: (string | null) | undefined, positionTicks?: (number | null) | undefined, liveStreamId?: (string | null) | undefined, playSessionId?: (string | null) | undefined}; export type DeleteApiUsersUserIdPlayingItemsItemIdOptions = {baseUrl?: string | undefined, CustomAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reports that a user has stopped playing an item. * * DELETE /Users/{userId}/PlayingItems/{itemId} */ export const deleteApiUsersUserIdPlayingItemsItemId = async (args: DeleteApiUsersUserIdPlayingItemsItemIdArgs, options?: DeleteApiUsersUserIdPlayingItemsItemIdOptions) => { const {baseUrl = "http://localhost", fetch: fetchFn = fetch, CustomAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.mediaSourceId != null) query.append("mediaSourceId", String(args.mediaSourceId)) if (args.nextMediaType != null) query.append("nextMediaType", String(args.nextMediaType)) if (args.positionTicks != null) query.append("positionTicks", String(args.positionTicks)) if (args.liveStreamId != null) query.append("liveStreamId", String(args.liveStreamId)) if (args.playSessionId != null) query.append("playSessionId", String(args.playSessionId)) if (CustomAuthentication !== undefined) headers.set("X-Emby-Authorization", CustomAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/Users/${encodeURIComponent(String(args.userId))}/PlayingItems/${encodeURIComponent(String(args.itemId))}${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 };