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

Node.JS library for communicating with Turistforeningen's API

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

DNT API Build Status

Node.JS library for communicating with Turistforeningen's API.

Table of Contents

  • Requirements
  • Installing
  • Usage

Requirements

Require Node.JS version >= 0.10.

Installing

npm install dnt-api --save

Usage

var DNT = require('dnt-api');

Class: DNT

var dnt = new DNT('My Application/1.0', 'myApiKey');

dnt.getMemberFor(object query, function cb)

The getMemberFor() method is used to get details for a given member from the membership register.

query parameter

The query parameter can at the moment have either one, or both, of the following properties:

  1. sherpa_id - which is the local user id for Sherpa 3.
  2. 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. object memberData - data returned from the API.
Example
dnt.getMemberFor({ sherpa_id: 1234 }, function(err, statusCode, memberData) {
  if (err) { throw err }
  if (statusCode === 200) {
    console.log('Member is ' + memberData.fornavn);
  } else {
    console.error('Request failed! HTTP status code returned is ' + statusCode);
    console.error(memberData.errors);
  }
});

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 either 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
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);
  }
});

MIT Licensed

Keywords

FAQs

Package last updated on 29 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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