dreamwidth-api-js

0.0.1 • Public • Published

dreamwidth-api-js

Build Status Coverage Status

A simple Javascript client for Dreamwidth's XML-RPC API.

  • Uses native Promises (transpiled for ES5)
  • Additional helper functions to be added

Usage

Install on npm:

npm install dreamwidth-api-js

Or download the library and include:

var Dreamwidth = require('./lib/dreamwidth');

Login

Login to your Dreamwidth account (note: you are required to login to access the API)

var myDreamwidth = Dreamwidth.login('username', 'password');

Methods

Use the general .method(value, options) function to access API methods. See wiki documentation for a list of available methods and their options, in conjunction with the original Livejournal docs (note that both are a bit outdated)

Example: use 'getevents' method to get the latest posts from your journal.

// Set relevant options for the method
var options = {
    selecttype: 'lastn',
    howmany: 10
}
 
myDreamwidth.method('getevents', options)
    .then( function(data) {
        // ... Do the things
    }).catch( function(data) {
        // ... Handle errors
    });

Response:

{ events: 
   [ { eventtime: '2017-02-13 16:53:00',
       event: 'The post body content',
       anum: 456,
       itemid: 1,
       logtime: '2017-03-13 05:53:13',
       props: [Object],
       subject: 'The post subject',
       url: 'https://your_name.dreamwidth.org/123.html' },
       // More entries...
    ]
}

To-Do

Helper functions for common methods, documentation.

Readme

Keywords

Package Sidebar

Install

npm i dreamwidth-api-js

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • shorelle