nl.pvanassen:ns-api

Parent pom for projects by Paul van Assen

License

License

GroupId

GroupId

nl.pvanassen
ArtifactId

ArtifactId

ns-api
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Parent pom for projects by Paul van Assen
Source Code Management

Source Code Management

https://github.com/pvanassen/ns-api

Download ns-api

How to add to project

<!-- https://jarcasting.com/artifacts/nl.pvanassen/ns-api/ -->
<dependency>
    <groupId>nl.pvanassen</groupId>
    <artifactId>ns-api</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/nl.pvanassen/ns-api/
implementation 'nl.pvanassen:ns-api:1.1.1'
// https://jarcasting.com/artifacts/nl.pvanassen/ns-api/
implementation ("nl.pvanassen:ns-api:1.1.1")
'nl.pvanassen:ns-api:jar:1.1.1'
<dependency org="nl.pvanassen" name="ns-api" rev="1.1.1">
  <artifact name="ns-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='nl.pvanassen', module='ns-api', version='1.1.1')
)
libraryDependencies += "nl.pvanassen" % "ns-api" % "1.1.1"
[nl.pvanassen/ns-api "1.1.1"]

Dependencies

compile (3)

Group / Artifact Type Version
com.squareup.okhttp3 : okhttp jar 3.8.0
org.projectlombok : lombok jar 1.16.16
org.slf4j : slf4j-api jar 1.7.25

test (2)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.1.7
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Build Status Coverage Status

NS API

An API for talking to the NS (Dutch railways) API interface written in Java. The NS is using a mix between Dutch and English terms in their API. This reflects back to the Java implementation. The preferred language is English but some Dutch terms show up. Javadoc is English. When Dutch terms are used a translation is provided

Usage

To use the NS api you need to register an account with the NS. You can apply for an account at NS API.

You will receive a username and password. To use the Java api, you initialize the NsApi object:

NsApi nsApi = new NsApi(username, password);

Next step is to create a request, eg a 'actuele vertrektijden' request to get the current departures:

ApiRequest<ActueleVertrekTijden> request = RequestBuilder.getActueleVertrektijden(stationName)

To do the actual request, you call getApiResponse with your request:

ActueleVertrekTijden vertrekTijden = nsApi.getApiResponse(request); 

A new immutable object ActueleVertrekTijden is created containing the result of the API call.

All classes are immutable and thread safe.

Maven

Version 1.0 of this api is available in the central maven repository:

<dependency>
  <groupId>nl.pvanassen</groupId>
  <artifactId>ns-api</artifactId>
  <version>1.1.0</version>
</dependency>

Code borrowing

For parsing the XML I made use of the code found in this article: http://blog.another-d-mention.ro/programming/the-simplest-way-to-parse-xml-in-java/

License

The code is licensed under the Apache License.

Versions

Version
1.1.1
1.1.0
1.0