From f374d1328f8b70a8eb11ea225e233f62bf8aedfc Mon Sep 17 00:00:00 2001 From: germanrcuriel Date: Tue, 31 Mar 2015 11:02:02 +0200 Subject: [PATCH] Add documentation and fix github url repo in package.json --- CHANGELOG.md | 5 +++++ README.md | 3 +++ docs/api.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 ++-- 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 docs/api.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d7045a9..4e3319e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.0.2 (2015-03-31) + + - Fix github's repo url on package.json + - Added documentation for `api` resource + ## 0.0.1 (2015-03-30) First commit diff --git a/README.md b/README.md index b4dc3eb..a3aae9a 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,9 @@ $ npm install slack-api-client ## API and documentation + - API: + - [api.test - Checks API calling code](docs/api.md#apitest---checks-api-calling-code) + - Work in progress. Documentation will be available shortly. More information at [Slack API Documentation](https://api.slack.com/methods/) diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..15ffc7c --- /dev/null +++ b/docs/api.md @@ -0,0 +1,62 @@ +# API + +## api.test - Checks API calling code + +####Arguments: + +| Argument | Example | Required | Description | +| -------- | ---------- | -------- | -------------------------- | +| `error` | `my_error` | Optional | Error response to return | +| `foo` | `bar` | Optional | Example property to return | + +####Example: + +CoffeeScript + +```coffeescript +slack.api.api.test + person: 'John Doe' +, (err, res) -> + throw err if err + console.log res +``` + +JavaScript + +```javascript +slack.api.api.test({ + person: 'John Doe' +}, function (err, res) { + if (err) { throw err; } + console.log(res); +}); +``` + +####Response: + +```json +{ + "ok": true, + "args": { + "person": "John Doe" + } +} +``` + +If called with an `error` argument an error response is returned: + +```json +{ + "ok": false, + "error": "my_error", + "args": { + "error": "my_error" + } +} +``` + +###Errors: + +This method has no expected error responses. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing. Callers should always check the value of the ok params in the response. + +=== diff --git a/package.json b/package.json index a2ac066..631e62e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "slack-api-client", "description": "A Slack API Client", - "version": "0.0.1", + "version": "0.0.2", "author": "Germán Robledo ", "main": "./lib/slack.js", "dependencies": { @@ -30,6 +30,6 @@ "license": "MIT", "repository": { "type": "git", - "url": "git://github.com/germanrcuriel/slack-client.git" + "url": "git://github.com/germanrcuriel/slack-api-client.git" } }