npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spoonity-sdk

v0.10.2

Published

Spoonity SDK for development.

Readme

Spoonity SDK v0.10.2

About

This is an SDK built to help developers integrate their apps with the Spoonity API.

Getting Started

JavaScript

Run npm install spoonity-sdk and import the dependency like import * as SpoonityService from './FILE_PATH/TO/node_modules/spoonity-sdk/sdk.js'; into your project and simply call functions like SpoonityService.spoonitySDK.FUNCTION_NAME(PARAMETER_DATA).

API Calls

USER

Registration

POST - User register

This call registers a user.

The call to the API will be done via sending an object with the user's data:

var user_data = {
    first_name: "Spoonity",
    last_name: "User",
    email_address: "[email protected]",
    password: "Password123",
    birthdate: 100000000,
    vendor: 123456,
    terms: 1,
    language: 1,
    phone_number : {
        code: "1",
        number: "5555555"
    }
}

// OPTIONAL: referral code if user was given one
user_data.referral_code = "Referral123";

SpoonityService.spoonitySDK.userRegister(user_data);

An example of returned JSON will be:

{
    id: 123,
    first_name: "Spoonity",
    last_name: "User",
    email_address: "[email protected]",
    birthdate: 100000000,
    date_created: 100000000,
    date_updated: 100000001,
    status: {
        id: 1
    }
}

POST - User authenticate

This call authenticates a user's login data.

The call to the API will be done via sending an object with the user's data:

var user_data = {
    email_address: "[email protected]",
    password: "Password123",
    vendor: 123456,
}

SpoonityService.spoonitySDK.userAuthenticate(user_data);

An example of returned JSON will be:

{
    first_login: true,
    online_order_token: 1234567,
    session_key: 'abc123',
    vendor_id: 1,
    user_id: 1,
    language: {
        code: 'en',
        id: 1,
        name: 'English'
    }
}

GET - User exists

This call simply checks if the user exists or not.

The call to the API will be done via sending an object with the email data:

var email_data = {
    email: "[email protected]"
}

SpoonityService.spoonitySDK.userExists(email_data);

An example of returned JSON will be:

{
    exists: true,
    vendor: {
        id: 12345,
        name: "Spoonity Inc."
    }
}

GET - User validate

This call validates a user's current session. If it's expired then the user should be signed out and must sign in again to get a new one.

The call to the API will be done via simply calling the function with a session key as a parameter:

var session_data {
    session_key: "123456"
}

SpoonityService.spoonitySDK.userValidate(session_data);

An example of returned JSON will be:

{
    is_validated: true,
    phone_number: "18556005074",
    methods: [
        "Email",
        "SMS"
    ],
    status: {
        no_verification: true,
        email: true,
        sms: true
    }
}

GET - User activate

This call is used to activate a user's account with the given token via email or SMS.

The call to the API will be done via sending an object with the token and session_key data:

var token_data = {
    token: "Token123"
    session_key: "123456" 
};

SpoonityService.spoonitySDK.userActivate(token_data);

This call does not return and JSON but will give an HTTP status of 200 if the account has been successfully activated.

GET - User send email activation

This call is used to send an activation email to the user's account.

The call to the API will be done via simply calling the function with a session key as a parameter:

var session_data = {
    session_key: "123456"
};

SpoonityService.spoonitySDK.userActivateEmail(session_data);

This call does not return and JSON but will give an HTTP status of 200 if the activation email has been successfully sent.

GET - User send SMS activation

This call is used to activate a user's account with the given token via email or SMS.

The call to the API will be done via sending an object with the phone number details:

var phone_data = {
    number: "8556005074",
    country: "ca"
    session_key: "123456" 
};

SpoonityService.spoonitySDK.userActivateSms(phone_data);

This call does not return and JSON but will give an HTTP status of 200 if the activation SMS has been successfully sent.

POST - User token request

This call is used to get a user's barcode token depending on which type the vendor is using.

The call to the API will be done via sending an object with the token_type and session_key details:

var token_data = {
    token_type: 1,
    session_key: "123456" 
};

SpoonityService.spoonitySDK.userGetToken(token_data);

An example of returned JSON will be:

{
    barcode: "data:image/png;base64,abcdefghijklmnop",
    created: 1551121108,
    expiry: 2147483647,
    token: "123456789",
    updated: 1551121108
}

GET - User cedula exists

This call checks to see if a given cedula exists and if it's a valid cedula for use.

The call to the API will be done via sending an object with cedula data:

var cedula_data = {
    cedula: "123456"
};

SpoonityService.spoonitySDK.cedulaExists(cedula_data);

An example of returned JSON will be:

{
    exists: true,
    valid: true,
    vendor: {
        id: 1234567,
        name: "Spoonity Inc."
    }
}

GET - User mobile exists

This call checks to see if a given mobile number is available to be registered.

The call to the API will be done via sending a object with the mobile data:

var mobile_data = {
    number: "8556005074",
    country: "ca",
    vendor_id: 1234567
};

SpoonityService.spoonitySDK.mobileExists(mobile_data);

An example of returned JSON will be:

{
    available: true
}

Password

POST - User password reset - email

This call is used to send a password reset email to the user with the specified email address.

The call to the API will be done via sending the user's email_address and vendor as a string:

var user_data = {
    email_address: "[email protected]",
    vendor: 123456
}

SpoonityService.spoonitySDK.userPasswordResetEmail(user_email);

This call does not return and JSON but will give an HTTP status of 200 if the activation SMS has been successfully sent.

POST - User password reset - apply

This call is used to apply the password reset with the given token from the email.

The call to the API will be done via sending an object with the token and password details:

var password_data = {
    token: "token123",
    password: "password123"
};

SpoonityService.spoonitySDK.userPasswordResetApply(password_data);

This call does not return and JSON but will give an HTTP status of 200 if the activation SMS has been successfully sent.

User Data

GET - User get profile

This call is used to get the user's profile data.

The call to the API will be done via simply calling the function with a session key as a parameter:

var session_data = {
    session_key: "123456"
}

SpoonityService.spoonitySDK.userGetProfile(session_data);

An example of returned JSON will be:

{
    auto_reload: {
        billing_profile: null,
        reload_amount: 0
        reload_threshold: 0
    },
    contact_consent {
        sms: true,
        email: false
    },
    created: 1537193394,
    updated: 1537193394,
    id: "1234567",
    email_address: "[email protected]",
    first_name: "Example",
    last_name: "Spoonity",
    birthdate: 1537193394,
    is_verified: {
        status: true,
        methods: {
            email: true,
            sms: true
        }
    },
    language: null,
    metadata: {
        address: "123 Fake St.",
        city: "Springfield"
    },
    online_order_token: "fdsfasd2312321312",
    push_endpoints: {
        gcm: [],
        apns: []
    },
    referral_url: "exampleReferral123",
    status: {
        status_id: 1,
        name: "active"
    }
}

PUT - User update profile

This call authenticates a user's login while also storing a session key in their localStorage.

The call to the API will be done via sending an object with the user's data you want changed, all fields optional except for the session_key:

var user_data = {
    first_name: "New Spoonity",
    last_name: "New User",
    email: "[email protected]",
    password: "Password456",
    terms: 0,
    session_key: "123456"
}

SpoonityService.spoonitySDK.userUpdateProfile(user_data);

This call does not return and JSON but will give an HTTP status of 200 if the changes have been successfully saved.

GET - User get reward list

This call is used to get the user's reward list.

The call to the API will be done via simply calling the function with a session key as a parameter:

OPTIONAL: users may provide an object with properties starting page (default 0) and result limit (default 10):

var reward_data = {
    session_key: "123456"
}

SpoonityService.spoonitySDK.userGetRewards(reward_data);

An example of returned JSON will be:

{
    catalog: {
        id: 123,
        name: "$10 off"
    },
    type: {
        id: 123,
        name: "Point"
    },
    currency: {
        id: 123,
        name: "Spoonity Dollars"
    },
    id: 123,
    name: "$10 off",
    description: "Description",
    summary: "",
    cost: 100,
    available: 10,
    progress: 50,
    expiring: {
        data: [
            {
                amount: 100,
                date: 1552645396
            }
        ]
    }
}

GET - User get quick pay balance

This call is used to get the user's quick pay balance.

The call to the API will be done via simply calling the function with a session key as a parameter:

var session_data = {
    session_key: "123456"
}

SpoonityService.spoonitySDK.userGetQuickPayBalance(session_data);

An example of returned JSON will be:

{
    amount: 100,
    currency: {
        code: "CAD",
        id: 100,
        name: "Canadian Dollar",
        object: "currency"
    }
}

User Transactions

GET - User get transaction list

This call is used to get the user's transaction history.

The call to the API will be done via simply calling the function with a session key as a parameter:

var session_data = {
    session_key: "123456"
}

SpoonityService.spoonitySDK.userGetTransactions(session_data);

An example of returned JSON will be:

{
    [
        {
            rating: {
                comment: "",
                value: -1,
                window: 0
            },
            tip: {
                amount: 10,
                window: 0
            },
            id: 123,
            date: 1537193396,
            items: [
                {
                    type: "",
                    name: "",
                    quantity: 0,
                    price: 10,
                    id: 123
                }
            ],
            receipt_date: 1537193396,
            subtotal: 10,
            receipt_number: "Spoonity 123",
            cashier: "Example Spoonity",
            total: 10,
            address: "123 Fake St.",
            name: "Spoonity Inc.",
            quickpay: {
                used: 0,
                loaded: 0,
                balance: 0
            },
            loyalty: [
                {
                    currency: {
                        id: 123,
                        name: "Spoonity Dollars"
                    },
                    redeemed: 0,
                    earned: 280,
                    expired: 0
                }
            ],
            status: "Complete"
        }
    ]
}

POST - User send tip

This call sends a tip based on a transaction ID provided.

The call to the API will be done via sending an object with the transcation_id and tip amount:

var tip_data = {
    transaction: 123456789, //Transaction ID
    amount: 1, // Amount set in dollars
    session_key: "123456"
}

SpoonityService.spoonitySDK.userSendTip(tip_data);

This call does not return and JSON but will give an HTTP status of 200 if the changes have been successfully saved.

POST - User send rating

This call sends a rating based on a transaction ID provided.

The call to the API will be done via sending an object with the transaction_id, rating, and comment:

var rate_data = {
    transaction: 123456789, //Transaction ID
    rating: 100, // Percentage
    comment: "Service was great!", // Comment
    session_key: "123456"
}

SpoonityService.spoonitySDK.userSendRating(rate_data);

This call does not return and JSON but will give an HTTP status of 200 if the changes have been successfully saved.

User Card Data

GET - User get cards

This call gets a list of the user's cards associated with the vendor.

The call to the API will be done via simply calling the function as it takes the session key as a parameter.

OPTIONAL: a page number (default 0) may be sent in with a result limit (default 10):

var card_data = {
    page: 0, // OPTIONAL
    limit: 10, // OPTIONAL
    session_key: "123456"
};

SpoonityService.spoonitySDK.userGetCards(card_data);

An example of returned JSON will be:

{
    {
        spoonity: [
            {
                card: {
                    number: "9999999999999999",
                    pin: "999"
                },
                created: 100000000,
                updated: 100000001,
                id: 123,
                status: {
                    id: 123,
                    name: "Active"
                }
            }
        ],
    },
    {
        thirdParty: [
            {
                card: {
                    number: "9999999999999999"
                },
                created: 100000000,
                updated: 100000001,
                id: 1234,
                status: {
                    id: 1234,
                    name: "Active"
                }
            }
        ]
    }
}

GET - User get credit cards

This call gets a list of the user's credit cards associated with the vendor.

The call to the API will be done via simply calling the function as it takes the session key as a parameter:

OPTIONAL: a page number (default 0) may be sent in with a result limit (default 10):

// OPTIONAL object
var card_data = {
    session_key: "123456"
}

SpoonityService.spoonitySDK.userGetCreditCards(card_data);

An example of returned JSON will be:

{
    [
        {
            card: "4242 xxxx xxxx 4242",
            created: 100000000,
            expiry: 100000001, 
            id: "123",
            is_default: true,
            name: "Visa Test Card",
            postal_code: "K1N1K2",
            type: "Visa"
        }
    ]
}

POST - User add card

This call adds a user's card (1st or 3rd party).

The call to the API will be done via sending an object with the card data:

var card_data = {
    number: "999900613507421",
    pin: "006",
    session_key: "123456"
}

SpoonityService.spoonitySDK.userAddCard(card_data);

An example of returned JSON will be:

{
    id: "123123",
    number: "9999999999999999",
    created: 100000000,
    updated: 100000001
}

POST - User add credit card

This call adds a user's credit card.

The call to the API will be done via sending an object with the credit card data:

var card_data = {
    name: "Spoonity User",
    number: "4242424242424242",
    expiry_month: "07",
    expiry_year: "2020",
    cvv: "123",
    description: "Visa Test Card",
    zip_code: "K1N1K2",
    session_key: "123456"
};

SpoonityService.spoonitySDK.userAddCreditCard(card_data);

An example of returned JSON will be:

{
    card: "4242 xxxx xxxx 4242",
    created: 100000000,
    expiry: 100000000,
    id: "123",
    name: "Visa Test Card",
    type: "Visa"
}

POST - User reload credit card

This call reloads the user's account via credit card payment.

The call to the API will be done via sending an object with the card and reload data:

var reload_data = {
    user_billingprofile: "123",
    amount: 10,
    session_key: "123456"
};

SpoonityService.spoonitySDK.userReloadCreditCard(reload_data);

An example of returned JSON will be:

{
    success: true
}

POST - User egift purchase

This call is used for the egift purchase transaction.

The call to the API will be done via sending an object with the card and egift data:

var egift_data = {
    amount: 10.00,
    buyer: {
        name: "Spoonity Buyer",
        email: "[email protected]"
    },
    recipient: {
        name: "Spoonity Receiver",
        email: "[email protected]"
    },
    message: "Happy Birthday!",
    billing: {
        id: 123
    },
    vendor: 123456,
    session_key: "123456"
};

SpoonityService.spoonitySDK.userReloadCreditCard(egift_data);

An example of returned JSON will be:

{
    success: true
}

PUT - User found card

This call sets the user's card as found.

The call to the API will be done via sending an object with the card data:

var card_data = {
    id: 1234,
    session_key: "123456"
};

SpoonityService.spoonitySDK.userFoundCard(card_data);

This call does not return and JSON but will give an HTTP status of 200 if it was successful.

PUT - User lost card

This call sets the user's card as lost.

The call to the API will be done via sending an object with the card data:

var card_data = {
    id: 1234,
    session_key: "123456"
};

SpoonityService.spoonitySDK.userLostCard(card_data);

This call does not return and JSON but will give an HTTP status of 200 if it was successful.

DELETE - User delete card

This call deletes a user's card.

The call to the API will be done via sending an object with the card data:

var card_data = {
    user_billingprofile: 1234, // Credit card ID
    session_key: "123456"
};

SpoonityService.spoonitySDK.userDeleteCard(card_data);

This call does not return and JSON but will give an HTTP status of 200 if it was successful.

DELETE - User delete credit card

This call deletes a user's credit card.

The call to the API will be done via sending an object with the credit card data:

var card_data = {
    id: 1234,
    session_key: "123456"
};

SpoonityService.spoonitySDK.userDeleteCreditCard(card_data);

This call does not return and JSON but will give an HTTP status of 200 if it was successful.

User Message Data

GET - User messages

This call gets a list of the user's in-app messages.

The call to the API will be done via calling the function with a session_key as a parameter:

var session_data = {
    session_key: "123456"
}

SpoonityService.spoonitySDK.userGetMessages(session_data);

An example of returned JSON will be:

[
    {
        user_message_id: 1234,
        user_id: 12345,
        message: {
            "message_id": 123,
            "title": "Test Title 1",
            "subtitle": "Test Subtitle 1",
            "banner": "https://cdn.spnty.co/messages/images/1608.jpg",
            "publish_date": 1524839395,
            "expiry_date": null
        },
        read: true
    },
    {
        user_message_id: 1235,
        user_id: 12345,
        message: {
            "message_id": 124,
            "title": "Test Title 2",
            "subtitle": "Test Subtitle 2",
            "banner": "https://cdn.spnty.co/messages/images/1608.jpg",
            "publish_date": 1524839395,
            "expiry_date": null
        },
        read: false
    }
]

GET - User message

This call gets a list of the user's in-app messages.

The call to the API will be done via calling the function with a message id included:

var message_data = {
    id:1234,
    session_key: "123456"
};

SpoonityService.spoonitySDK.userGetMessage(message_data);

An example of returned JSON will be:

{
    user_message_id: 1234,
    user_id: 12345,
    message: {
        "message_id": 123,
        "title": "Test Title",
        "subtitle": "Test Subtitle",
        "banner": "https://cdn.spnty.co/messages/images/1608.jpg",
        "publish_date": 1524839395,
        "expiry_date": null
    },
    read: true
}

PUT - User update message status

This call gets a list of the user's in-app messages.

The call to the API will be done via calling the function with a message ID supplied as user_message included:

var message_data = {
    user_message: 1234,
    status_id: 1,
    session_key: "123456"
};

SpoonityService.spoonitySDK.userUpdateMessageStatus(message_data);

An example of returned JSON will be:

{
    user_message_id: 1234,
    user_id: 12345,
    message: {
        "message_id": 123,
        "title": "Test Title",
        "subtitle": "Test Subtitle",
        "banner": "https://cdn.spnty.co/messages/images/1608.jpg",
        "publish_date": 1524839395,
        "expiry_date": null
    },
    read: false
}

VENDOR

Stores

GET - Vendor store list

This call is used to get a list of all available stores for the vendor.

The call to the API will be done via simply calling the function with a vendor_id as a parameter:

var vendor_data = {
    vendor_id: "1234567"
}

SpoonityService.spoonitySDK.vendorGetStoreList(vendor_data);

An example of returned JSON will be:

{
    count: 1,
    data: [
        {
            address_line_1: "267 Richmond Rd.",
            city: "Ottawa",
            country: {
                country_id: 39,
                code: "CA",
                name: "Canada"
            },
            distance: 10,
            email_address: "[email protected]",
            hours_of_operation: [
                {
                    object: "vendor_hoursofoperation",
                    day_of_week: 15,
                    start_date: null,
                    end_date: null,
                    start_time: 39600,
                    end_time: 0,
                    comment: null
                }
            ],
            is_open: true,
            latitude: "49.838383",
            longitude: "-100.308383",
            name: "Spoonity 1",
            parent: {
                id: 12345678,
                type: {
                    name: "HQ"
                }
            },
            phone_number: "1234567890",
            postal_code: "K1Z 6X3",
            region: null,
            timezone: "Canada/Eastern",
            vendor_attribute: [],
            favourite: true,
            id: 1234567
        }
    ]
}

POST - Vendor store check-in

This call checks a user in a store.

The call to the API will be done via sending an object with the vendor_id, table_number, and payment_method:

var checkin_data = {
  vendor_id: 1234567,
  table_number: 1,
  payment_method: null,
  session_key: "123456"
}

SpoonityService.spoonitySDK.vendorCheckinStore(checkin_data);

This call does not return and JSON but will give an HTTP status of 200 if it was successful.

Users

DELETE - Vendor user email

This call checks a user in a store.

The call to the API will be done via sending an object with the user id:

var customer_data = {
    id: 1234,
    session_key: "123456"
}

SpoonityService.spoonitySDK.vendorDeleteUserEmail(customer_data);

This call does not return and JSON but will give an HTTP status of 200 if it was successful.

DELETE - Vendor user

This call checks a user in a store.

The call to the API will be done via sending an object with the user id:

var customer_data = {
    code: "code123",
    id: 1234
}

SpoonityService.spoonitySDK.vendorDeleteUserApply(customer_data);

This call does not return and JSON but will give an HTTP status of 200 if it was successful.

WALLET PASSES

Apple Wallet Pass

GET - Vendor download Apple Wallet Pass

This call sends a request to download a .pkpass file for iPhones.

The call to the API will be done via sending an object with the card type:

var apple_wallet_pass_data = {
  type: "card",
  vendor_id: "123456",
  session_id: "123456",
  user_id: "123"
}

SpoonityService.spoonitySDK.appleWalletPassGet(apple_wallet_pass_data);

This call does not return and JSON but will start a .pkpass download on the device.

Google Pay Pass

GET - Vendor get Google Pay Pass list

This call sends a request to receive a Google Pay Pass link for all devices.

The call to the API will be done via sending an object with thevendor_id, session_id:

var google_pay_pass_data = {
  vendor_id: "123456",
  session_id: "123456"
}

SpoonityService.spoonitySDK.googlePayPassesList(google_pay_pass_data);

An example of returned JSON will be:

[
    {
        "googlepay_pass_id": 123,
        "vendor": {
            "vendor_id": 123123,
            "name": "Spoonity"
        },
        "identifier": "3214514504191081979.card.123123",
        "template": "storeCard",
        "background_color": "ffffff",
        "fields": {
            "primary": [
                {
                    "label": "Balance",
                    "balance": "{{quickpay_balance}}",
                    "enabled": true
                }
            ],
            "secondary": [
                {
                    "label": "Tier",
                    "balance": "{{tier_amount}}",
                    "enabled": true
                }
            ],
            "info": [],
            "link": []
        },
        "google_pay_class": {
            "accountIdLabel": null,
            "accountNameLabel": null,
            "allowMultipleUsersPerObject": null,
            "countryCode": null,
            "enableSmartTap": null,
            "heroImage": {
                "kind": "walletobjects#image",
                "sourceUri": {
                    "uri": "http://api.staging.spoonity.com/vendor/123123/googlepaypass/123/images/strip"
                }
            },
            "hexBackgroundColor": "#ffffff",
            "id": "3214514504191081979.card.123123",
            "infoModuleData": null,
            "issuerName": "Spoonity",
            "kind": "walletobjects#loyaltyClass",
            "linksModuleData": null,
            "multipleDevicesAndHoldersAllowedStatus": null,
            "programLogo": {
                "kind": "walletobjects#image",
                "sourceUri": {
                    "uri": "http://api.staging.spoonity.com/vendor/123123/googlepaypass/123/images/logo"
                }
            },
            "programName": "Spoonity Points",
            "redemptionIssuers": null,
            "reviewStatus": "approved",
            "rewardsTier": null,
            "rewardsTierLabel": null,
            "secondaryRewardsTier": null,
            "secondaryRewardsTierLabel": null,
            "version": "1"
        }
    }
]

GET - Vendor get link Google Pay Pass

This call sends a request to receive a Google Pay Pass link for all devices.

The call to the API will be done via sending an object with the card pass_id, vendor_id, session_id, user_id:

var google_pay_pass_data = {
  pass_id: "123",
  vendor_id: "123456",
  session_id: "123456",
  user_id: "123"
}

SpoonityService.spoonitySDK.googlePayPassGet(google_pay_pass_data);

An example of returned JSON will be:

{
    google_pay_pass_url: "https://www.spoonity.com/"
}