3.0.4 • Published 9 years ago

@typhoslabs/shopify v3.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

shopify

A wrapper around shopify-node-api for specific handling of Shopify for TyphosLabs lambdas.

Usage

###Typical usage:

'use strict';

var ShopifyAPI = require('@typhoslabs/shopify')(optional_settings);

module.exports = Shopify.lambda((event, context, callback, shopify) => {
    // do a typical shopify-node-api. Getting the token, filling in the shop, and setting up
    // the shopify-node-api instance is done for you.
    shopify.get("/admin/shop.json", function(err, data, headers){
        // do stuff etc.
        
        // when done
        callback(null);
    });
});

Note: your lambda must use the shopify-auth custom authorizer.

###Install usage:

'use strict';

var Shopify = require('@typhoslabs/shopify')();

module.exports = Shopify.install((event, context, callback, shopify) => {
    // think normal lambda but this function is called when we've
    // requested the permissions, got the token and saved it to the database, and
    // need to add things to the theme files etc. Additional values to be saved
    // to the store record for this app may be returned using the callback
    
    // do async stuff
    
    // success
    return callback();
});

// Will return { session: "averylongsessiontoken", shop: "typhoslabs" } when already installed
// Will return { session: "averylongsessiontoken", shop: "typhoslabs", "installed": true } when newly installed
// Will return { redirect: "... a redirect url ..." } if a redirect is needed

Note: the lambda event must look similar to this:

{
    "query": {
        "shop": "typhoslabs.myshopify.com",
        "...": "my querystring values..."
    },
    "shopify": {
        "api_key": "MY_API_KEY",
        "api_secret": "MY_API_SECRET",
        "redirect_url": "https://api.typhoslabs.com/apps/my-app",
        "scopes": "read_orders,write_orders",
    }
}

Optional Settings

Include optional setting overrides to be passed to shopify-node-api.

3.0.4

9 years ago

3.0.3

9 years ago

3.0.2

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.0.0

9 years ago

1.4.0

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago