Socket
Socket
Sign inDemoInstall

buffer-alpaca

Package Overview
Dependencies
47
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    buffer-alpaca

Buffer API library client for node.js


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

buffer-node

Buffer API library client for node.js

This library is generated by alpaca

Installation

Make sure you have npm installed.

$ npm install buffer-alpaca
Versions

Works with [ 0.8 / 0.9 / 0.10 / 0.11 ]

Usage

var buffer = require('buffer-alpaca');

// Then we instantiate a client (as shown below)

Build a client

Without any authentication
var client = buffer.client();

// If you need to send options
var client = buffer.client({}, options);
Oauth acess token
var client = buffer.client('1a2b3', options);
Oauth client secret
var client = buffer.client({
    client_id: '09a8b7',
    client_secret: '1a2b3'
}, options);

Response information

All the callbacks provided to an api call will recieve the response as shown below

client.klass('args').method('args', function (err, response) {
    if (err) console.log(err);

    response.body;
    // >>> 'Hello world!'

    response.code;
    // >>> 200

    response.headers;
    // >>> {'content-type': 'text/html'}
}
HTML response
response.body;
// >>> 'The username is pksunkara!'
JSON response
response.body;
// >>> {'user': 'pksunkara'}

Request body information

RAW request
body = 'username=pksunkara';
FORM request
body = {'user': 'pksunkara'};

Client Options

The following options are available while instantiating a client:

  • base: Base url for the api
  • api_version: Default version of the api (to be used in url)
  • user_agent: Default user-agent for all requests
  • headers: Default headers for all requests
  • request_type: Default format of the request body
  • response_type: Default format of the response (to be used in url suffix)

Method Options

The following options are available while calling a method of an api:

  • api_version: Version of the api (to be used in url)
  • headers: Headers for the request
  • query: Query parameters for the url
  • body: Body of the request
  • request_type: Format of the request body
  • response_type: Format of the response (to be used in url suffix)

Information api

Returns api instance to get auxilary information about Buffer useful when creating your app.

var info = client.info();
Services and configuration (GET /info/configuration)

Returns an object with the current configuration that Buffer is using, including supported services, their icons and the varying limits of character and schedules.

info.show(options, callback);

Authenticated user api

Returns authenticated user api instance.

var user = client.user();
User information (GET /user)

Returns information about the authenticated user.

user.show(options, callback);
List of user's social profiles (GET /profiles)

Returns an array of social media profiles connected to the authenticated users account.

user.profiles(options, callback);
Create a social update (POST /updates/create)

Create one or more new status updates.

The following arguments are required:

  • text: The status update text.
  • profile_ids: An array of profile id's that the status update should be sent to. Invalid profile_id's will be silently ignored.
user.createUpdate("This is an example update", [
  "4eb854340acb04e870000010",
  "4eb9276e0acb04bb81000067"
], options, callback);

Returns api instance to get information about links shared through Buffer.

var link = client.link();

Returns an object with a the numbers of shares a link has had using Buffer.

The following arguments are required:

  • url: URL of the page for which the number of shares is requested.
link.shares("http://bufferapp.com", options, callback);

Social profiles api

Returns a social media profile api instance.

The following arguments are required:

  • id: Identifier of a social media profile
var profile = client.profile("519fc3ca4d5e93901900002f");
Get this social profile (GET /profiles/:id)

Returns details of the single specified social media profile.

profile.show(options, callback);
List profile's pending updates (GET /profiles/:id/updates/pending)

Returns an array of updates that are currently in the buffer for an individual social media profile.

profile.pending(options, callback);
List profile's sent updates (GET /profiles/:id/updates/sent)

Returns an array of updates that have been sent from the buffer for an individual social media profile.

profile.sent(options, callback);
Edit profile's updates order (POST /profiles/:id/updates/reorder)

Edit the order at which statuses for the specified social media profile will be sent out of the buffer.

The following arguments are required:

  • order: An ordered array of status update id's. This can be a partial array in combination with the offset parameter or a full array of every update in the profiles Buffer.
profile.reorder([
  "4eb854340acb04e870000010",
  "4eb9276e0acb04bb81000067",
  "4eb2567e0ade04ba51000001"
], options, callback);
Shuffle profile's updates (POST /profiles/:id/updates/shuffle)

Randomize the order at which statuses for the specified social media profile will be sent out of the buffer.

profile.shuffle(options, callback);

Posting schedules api

Returns scheduling api instance for social media profile.

The following arguments are required:

  • id: Identifier of a social media profile
var schedule = client.schedule("519fc3ca4d5e93901900002f");
Get profile's posting schedules (GET /profiles/:id/schedules)

Returns details of the posting schedules associated with a social media profile.

schedule.list(options, callback);
Update profile's posting schedules (POST /profiles/:id/schedules/update)

Set the posting schedules for the specified social media profile.

The following arguments are required:

  • schedules: Each item in the array is an individual posting schedule which consists of days and times to match the format return by the above method.
schedule.update([
  {
    days: [
      "mon",
      "tue",
      "thu"
    ],
    times: [
      "12:45",
      "15:30",
      "17:43"
    ]
  }
], options, callback);

Social updates api

Returns a social media update api instance.

The following arguments are required:

  • id: Identifier of a social media update
var update = client.update("4eb8565e0acb04bb82000004");
Get this social update (GET /updates/:id)

Returns a single social media update.

update.show(options, callback);
List interactions of the update (GET /updates/:id/interactions)

Returns the detailed information on individual interactions with the social media update such as favorites, retweets and likes.

update.interactions(options, callback);
Edit this update (POST /updates/:id/update)

Edit an existing, individual status update.

The following arguments are required:

  • text: The status update text.
update.update("This is an edited update", options, callback);
Share this update (POST /updates/:id/share)

Immediately shares a single pending update and recalculates times for updates remaining in the queue.

update.share(options, callback);
Delete this update (POST /updates/:id/destroy)

Permanently delete an existing status update.

update.destroy(options, callback);
Move this update to top (POST /updates/:id/move_to_top)

Move an existing status update to the top of the queue and recalculate times for all updates in the queue. Returns the update with its new posting time.

update.top(options, callback);

Contributors

Here is a list of [Contributors]((https://github.com/alpaca-api/buffer-node/contributors)

TODO

License

MIT

Bug Reports

Report here.

Contact

Pavan Kumar Sunkara (pavan.sss1991@gmail.com)

Keywords

FAQs

Last updated on 01 Jan 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc