Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrienjoly/npm-openwhyd-api-client
A simple Node.js API client for Openwhyd.org.
https://github.com/adrienjoly/npm-openwhyd-api-client
api-client deprecated npm-package openwhyd whyd
Last synced: 3 days ago
JSON representation
A simple Node.js API client for Openwhyd.org.
- Host: GitHub
- URL: https://github.com/adrienjoly/npm-openwhyd-api-client
- Owner: adrienjoly
- Created: 2014-06-27T09:02:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-31T17:45:33.000Z (about 6 years ago)
- Last Synced: 2025-01-15T08:07:19.492Z (16 days ago)
- Topics: api-client, deprecated, npm-package, openwhyd, whyd
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/openwhyd-api-client
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Openwhyd API Client
A simple Node.js API client for [Openwhyd.org](https://openwhyd.org).
Your can use it to:
- initiate a cookie-based Openwhyd user session, given their email address and password;
- make authenticated calls to [Openwhyd's API endpoints](https://openwhyd.github.io/openwhyd/API);
- end the user session.## Usage
1. Install the npm dependency to your Node.js project:
```sh
$ npm install openwhyd-api-client
```2. Use it to make API calls:
```js
const OpenwhydAPI = require("openwhyd-api-client");const creds = {
email: "[email protected]", // email address or user handle of your openwhyd account
md5: "6af652b33ce6a86ecf025b0da8ca8d24" // md5 hash of your openwhyd password
};const openwhydAPI = new OpenwhydAPI();
openwhydAPI.login(creds.email, creds.md5, function (err, res) {
openwhydAPI.get("/api/user", {}, function (err, user) {
console.log("=> user name:", user.name);
openwhydAPI.logout();
});
});
```## Methods
The class exported from the package provides the following methods:
- `login (email, md5, callback)`
- `get (path, params, callback)`
- `logout (callback)`All `callback` functions are called with `(err, res)` as parameters.
Each instance of the class holds the cookie that identifies the user session initiated with that instance.