openvibe-sdk/deals

Generated at from openvibe-contracts v0.221.0 and openvibe-sdk v0.65.0.

From types/deals.d.ts (server only). Declarations are shown verbatim.

type FlagKind

export type FlagKind = 'expired' | 'price_wrong' | 'spam' | 'duplicate' | 'other';

type WatchKind

export type WatchKind = 'keyword' | 'product' | 'price_below' | 'search';

interface Observation

export interface Observation { price?: string | number | null; currency?: string | null; shipping?: string | number | null; shipping_note?: string | null; condition?: string | null; availability?: string | null; [k: string]: unknown }

interface DealsClient

export interface DealsClient {
    offers: {
        list(opts?: Opts & { sort?: 'hot' | 'new'; page?: number }): Promise<DealsJson>;
        get(id: string, opts?: Opts): Promise<DealsJson>;
        hotness(id: string, opts?: Opts): Promise<DealsJson>;
        submit(fields: Observation & { url: string; title: string; description?: string | null; category?: string | null; expires_at?: string | null; store_name?: string | null; product_slug?: string | null }, opts?: Opts): Promise<DealsJson>;
        update(id: string, patch: { title?: string; description?: string | null; category?: string | null; expires_at?: string | null; product?: unknown }, opts?: Opts): Promise<DealsJson>;
        observe(id: string, observation: Observation, opts?: Opts): Promise<DealsJson>;
        vote(id: string, value: 1 | -1, opts?: Opts): Promise<DealsJson>;
        unvote(id: string, opts?: Opts): Promise<DealsJson>;
        flag(id: string, req: { kind: FlagKind; reason?: string | null; duplicate_of?: string | null }, opts?: Opts): Promise<DealsJson>;
    };
    products: { get(slug: string, opts?: Opts): Promise<DealsJson> };
    stores: { get(domain: string, opts?: Opts): Promise<DealsJson> };
    watches: {
        list(opts?: Opts): Promise<DealsJson>;
        create(fields: { kind: WatchKind; query?: string | null; product?: string | null; max_price?: string | number | null; currency?: string | null; label?: string | null }, opts?: Opts): Promise<DealsJson>;
        remove(id: string, opts?: Opts): Promise<DealsJson>;
    };
}

export export function createDealsClient(client: { json(opts: Recor

export function createDealsClient(client: { json(opts: Record<string, unknown>): Promise<any> }, options?: { baseUrl?: string }): DealsClient;