Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "dnt-api", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Node.JS library for communicating with Turistforeningen's API", | ||
@@ -5,0 +5,0 @@ "main": "lib/dnt-api.js", |
@@ -6,7 +6,16 @@ DNT API![Build Status](https://drone.io/github.com/Turistforeningen/node-dnt-api/status.png) | ||
## Requires | ||
**Table of Contents** | ||
* [Requirements](#requirements) | ||
* [Installing](#installing) | ||
* [Usage](#usage) | ||
* [Class: DNT](#class-dnt) | ||
* [dnt.getMemberFor()](#dntgetmemberforobject-query-function-cb) | ||
* [dnt.getAssociationsFor()](#dntgetassociationsforobject-query-function-cb) | ||
## Requirements | ||
Require Node.JS version `>= 0.10`. | ||
## Install | ||
## Installing | ||
@@ -19,11 +28,13 @@ ``` | ||
### New API Client | ||
```javascript | ||
var DNT = require('dnt-api'); | ||
``` | ||
### Class: DNT | ||
```javascript | ||
var dnt = new DNT('My Application/1.0', 'myApiKey'); | ||
``` | ||
### getMemberFor(`object` query, `function` cb) | ||
### dnt.getMemberFor(`object` query, `function` cb) | ||
@@ -35,3 +46,4 @@ The `getMemberFor()` method is used to get details for a given member from the | ||
The `query` parameter can at the moment have eith one of two properties: | ||
The `query` parameter can at the moment have eith one, or both, of the following | ||
properties: | ||
@@ -63,2 +75,39 @@ 1. `sherpa_id` - which is the local user id for Sherpa 3. | ||
### dnt.getAssociationsFor(`object` query, `function` cb) | ||
The `getAssociationsFor()` method is used to get associations (NO foreninger) | ||
for a given member from the membership register. | ||
#### query parameter | ||
The `query` parameter can at the moment have eith one, or both, of the following | ||
properties: | ||
1. `bruker_sherpa_id` - which is the local user id for Sherpa 3. | ||
2. `bruker_medlemsnummer` which is the membership number for a given membership. | ||
#### cb parameter | ||
The callback function to this requests takes tree parameters: | ||
1. `Error` err - this is an error if the HTTP request itself failed. | ||
2. `number` statusCode - HTTP status code returned from the API. | ||
3. `Array` associations - data returned from the API. | ||
#### Example | ||
```javascript | ||
dnt.getAssociationsFor({ bruker_sherpa_id: 1234 }, function(err, statusCode, associations) { | ||
if (err) { throw err } | ||
if (statusCode === 200) { | ||
for (var i = 0; i < associations.length; i++) { | ||
console.log('Member is associated with ' + associations[i].navn); | ||
} | ||
} else { | ||
console.error('Request failed! HTTP status code returned is ' + statusCode); | ||
console.error(associations.errors); | ||
} | ||
}); | ||
``` | ||
## The MIT License (MIT) | ||
@@ -65,0 +114,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15117
129
1