Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dnt-api

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnt-api - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc