SDK Reference

    @proveanything/smartlinks

    npm install @proveanything/smartlinks
    View on npm →

    Namespaces

    Other

    userAppData

    Functions for userAppData operations

    7 functions0 types

    getConfig

    Get user's config blob for an app. This is a single JSON object stored per user+app. typescript const config = await userAppData.getConfig('allergy-tracker'); // Returns: { allergies: ['peanuts'], notifications: true }

    public
    getConfig(appId: string) → Promise<any>

    setConfig

    Set user's config blob for an app. typescript await userAppData.setConfig('allergy-tracker', { allergies: ['peanuts', 'shellfish'], notifications: true });

    public
    setConfig(appId: string, config: any) → Promise<any>

    deleteConfig

    Delete user's config blob for an app. typescript await userAppData.deleteConfig('allergy-tracker');

    public
    deleteConfig(appId: string) → Promise<void>

    list

    List all user's data items for an app. Returns an array of objects, each with an id field. typescript const beds = await userAppData.list('garden-planner'); // Returns: [{ id: 'bed-1', name: 'Vegetables', ... }, { id: 'bed-2', ... }]

    public
    list(appId: string) → Promise<any[]>

    get

    Get a specific user data item by ID. typescript const bed = await userAppData.get('garden-planner', 'bed-1'); // Returns: { id: 'bed-1', name: 'Vegetable Bed', plants: [...] }

    public
    get(appId: string, itemId: string) → Promise<any>

    set

    Create or update a user data item. The item object must include an id field. typescript await userAppData.set('garden-planner', { id: 'bed-1', name: 'Vegetable Bed', plants: ['tomatoes', 'peppers'], location: { x: 10, y: 20 } });

    public
    set(appId: string, item: any) → Promise<any>

    remove

    Delete a user data item by ID. typescript await userAppData.remove('garden-planner', 'bed-1');

    public
    remove(appId: string, itemId: string) → Promise<void>