export type WatchlistItemDto = {itemId: number, itemType: string, itemRank?: number | undefined, itemAddedReason?: string | undefined, itemAddedDate?: string | undefined, market?: ({id?: string | undefined, symbolName?: string | undefined, displayName?: string | undefined, assetTypeId?: number | undefined, assetTypeSubCategoryId?: (number | null) | undefined, exchangeId?: number | undefined, hasExpirationDate?: boolean | undefined, avatar?: ({small?: string | undefined, medium?: string | undefined, large?: string | undefined, svg?: ({url?: string | undefined, backgroundColor?: string | undefined, textColor?: string | undefined} | null) | undefined}) | undefined}) | undefined}; export type DeleteApiApiV1WatchlistsWatchlistIdItemsArgs = {'x-request-id': string, 'x-api-key': string, 'x-user-key': string, watchlistId: string, body: Array}; export type DeleteApiApiV1WatchlistsWatchlistIdItemsOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove items from watchlist * * DELETE /api/v1/watchlists/{watchlistId}/items * * Also accepts auth: oauth2, oauth2 */ export const deleteApiApiV1WatchlistsWatchlistIdItems = async (args: DeleteApiApiV1WatchlistsWatchlistIdItemsArgs, options?: DeleteApiApiV1WatchlistsWatchlistIdItemsOptions) => { const {baseUrl = "https://public-api.etoro.com", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-request-id'] != null) headers.set("x-request-id", String(args['x-request-id'])) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) if (args['x-user-key'] != null) headers.set("x-user-key", String(args['x-user-key'])) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/watchlists/${encodeURIComponent(String(args.watchlistId))}/items${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };