Skip to content

Commit

Permalink
Revamp readme and add all available mehods
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbundy committed Apr 12, 2014
1 parent 8d39155 commit 26804ab
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,55 @@ A Node.js library for seamless integration with [Algolia's kickass Hacker News A

## Installation

Impossible. Don't even try it.
```sh
npm install hacker-news-api
```

## Usage
## Examples

Some methods only require a callback.

```js
api.getLastPolls(function (error, data) {
if (error)
throw error;
var hn = require('hacker-news-api');

hn.getLastPolls(function (error, data) {
if (error) throw error;
console.log(data);
});
```

Some methods require a string and a callback.

```js
api.getUserStories('pg', function (error, data) {
if (error)
throw error;
var hn = require('hacker-news-api');

hn.getUserStories('pg', function (error, data) {
if (error) throw error;
console.log(data);
});
```

The `api.search(obj, cb)` method requires an object and a callback.
The `api.search` method requires an object and a callback.
```js
api.search({
var hn = require('hacker-news-api');

hn.search({
query: 'javascript',
tags: 'poll'
}, function (error, data) {
if (error)
throw error;
if (error) throw error;
console.log(data);
});
```

## Methods

* `getItem(id, cb)`
* `getUser(username, cb)`
* `getLastStories(cb)`
* `getLastPolls(cb)`
* `getLastPosts(cb)`
* `getUserStories(username, cb)`
* `searchStories(search, cb)`
* `searchPolls(search, cb)`
* `search(obj, cb)`

0 comments on commit 26804ab

Please sign in to comment.