2.0.2 • Published 10 years ago

sam-node v2.0.2

Weekly downloads
43
License
-
Repository
github
Last release
10 years ago

SAM Node Build Status

Overview

This repo contains a node middleware to simplify the usage of the SAM API.

Installation

npm install sam-node

Documentation

Up to date API Documentation can be found here.

API Overview

Every resource is accessed via your sam instance:

var sam = require('sam-node')({ api_key: '{API_KEY}' });
// sam.{ RESOURCE_NAME }.{ METHOD_NAME }

Every resource method accepts an optional callback as the last argument:

sam.stories.fetch(
    storyId,
    function(err, story) {
        //handle response
    }
);

Additionally, every resource method returns a promise, so you don't have to use the regular callback:

sam.stories.fetch(
    storyId
).then(function(story) {
    // handle successful response
}, function(err) {
    // handle error
});

Available resources & methods

Where you see params it is a plain JavaScript object, e.g. { email: 'foo@example.com' }

  • account
  • fetch()
  • users()
  • assets
  • create(storyId, params)
  • fetch(storyId, assetId[, params])
  • list(storyId[, params])
  • stories
  • create(params)
  • fetch(storyId[, params])
  • delete(storyId)
  • list([params])
  • fetchAsset(storyId, assetId[, params])
  • listAssets(storyId[, params])
  • upload
  • upload(params)
  • start(params)
  • append(mediaId, params)
  • complete(mediaId)
  • user
  • fetch()

Configuration

  • sam.setAuth({ api_key: '{API_KEY}' });
  • sam.setTimeout(20000); // in ms (default is node's default: 120000ms)

Author

Officially maintained by SAM.

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.0.0

11 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago