Skip to content

shorelle/dreamwidth-api-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Include the module:

var Dreamwidth = require('dreamwidth-api-js');

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published