SDK Reference

    @proveanything/smartlinks

    npm install @proveanything/smartlinks
    View on npm →

    Namespaces

    Other

    loyalty

    Loyalty programmes: schemes, earning rules tied to interactions, member balances, transaction ledger, and manual adjustments.

    20 functions12 types

    createEarningRule

    public
    createEarningRule(collectionId: string,
        schemeId: string,
        body: ) → Promise<>

    updateEarningRule

    public
    updateEarningRule(collectionId: string,
        schemeId: string,
        ruleId: string,
        body: ) → Promise<>

    removeEarningRule

    public
    removeEarningRule(collectionId: string,
        schemeId: string,
        ruleId: string) → Promise<>

    listMembers

    public
    listMembers(collectionId: string,
        schemeId: string,
        params:  = {}) → Promise<LoyaltyPaginatedResult<>>

    getMember

    public
    getMember(collectionId: string,
        schemeId: string,
        contactId: string) → Promise<>

    recordTransaction

    Manually award or deduct points for a contact. - points must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 INSUFFICIENT_BALANCE - Supply idempotencyKey to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.

    public
    recordTransaction(collectionId: string,
        schemeId: string,
        contactId: string,
        body: ) → Promise<>

    getMemberHistory

    Manually award or deduct points for a contact. - points must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 INSUFFICIENT_BALANCE - Supply idempotencyKey to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.

    public
    getMemberHistory(collectionId: string,
        schemeId: string,
        contactId: string,
        params:  = {}) → Promise<LoyaltyPaginatedResult<>>

    publicList

    List active schemes for a collection. No authentication required.

    public
    publicList(collectionId: string) → Promise<[]>

    publicGet

    Get a single active scheme. No authentication required.

    public
    publicGet(collectionId: string,
        schemeId: string) → Promise<>

    publicListEarningRules

    List active earning rules for a scheme — useful for showing "how to earn" in a loyalty UI. No authentication required.

    public
    publicListEarningRules(collectionId: string,
        schemeId: string) → Promise<[]>

    publicGetMe

    Get all active schemes with the caller's membership embedded in each. This is the primary entry point for a loyalty widget — one call gives you everything needed to render a user's loyalty status across all programs in a collection. - Authenticated: member is populated with balance + lifetimePoints (or null if not yet enrolled in that scheme) - Unauthenticated: member is null on all schemes

    public
    publicGetMe(collectionId: string) → Promise<LoyaltySchemeWithMembership[]>

    publicGetMine

    Get the authenticated caller's membership (balance + lifetimePoints) on a specific scheme. Requires authentication.

    public
    publicGetMine(collectionId: string,
        schemeId: string) → Promise<>

    publicGetMineHistory

    Get the authenticated caller's transaction history on a specific scheme. Ordered newest first. Requires authentication.

    public
    publicGetMineHistory(collectionId: string,
        schemeId: string,
        params:  = {}) → Promise<LoyaltyPaginatedResult<>>

    list

    public
    list(collectionId: string,
        params: { includeDeleted?: boolean } = {}) → Promise<[]>

    get

    public
    get(collectionId: string,
        schemeId: string) → Promise<>

    create

    public
    create(collectionId: string,
        body: ) → Promise<>

    update

    public
    update(collectionId: string,
        schemeId: string,
        body: ) → Promise<>

    remove

    public
    remove(collectionId: string,
        schemeId: string) → Promise<>

    listEarningRules

    public
    listEarningRules(collectionId: string,
        schemeId: string) → Promise<[]>

    getEarningRule

    public
    getEarningRule(collectionId: string,
        schemeId: string,
        ruleId: string) → Promise<>