export type GetApiApiV2OffersCollectionSlugTraitsArgs = {slug: string, mode?: ('STRING' | 'NUMERIC' | 'MULTI') | undefined, type?: string | undefined, value?: string | undefined, float_value?: number | undefined, int_value?: number | undefined, min_value?: number | undefined, max_value?: number | undefined, traits?: string | undefined, limit?: number | undefined, next?: string | undefined}; export type GetApiApiV2OffersCollectionSlugTraitsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get trait offers for a collection * * GET /api/v2/offers/collection/{slug}/traits */ export const getApiApiV2OffersCollectionSlugTraits = async (args: GetApiApiV2OffersCollectionSlugTraitsArgs, options?: GetApiApiV2OffersCollectionSlugTraitsOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.mode != null) query.append("mode", String(args.mode)) if (args.type != null) query.append("type", String(args.type)) if (args.value != null) query.append("value", String(args.value)) if (args.float_value != null) query.append("float_value", String(args.float_value)) if (args.int_value != null) query.append("int_value", String(args.int_value)) if (args.min_value != null) query.append("min_value", String(args.min_value)) if (args.max_value != null) query.append("max_value", String(args.max_value)) if (args.traits != null) query.append("traits", String(args.traits)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.next != null) query.append("next", String(args.next)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/offers/collection/${encodeURIComponent(String(args.slug))}/traits${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };