Home Reference Source
import DSB from 'dsbapi/src/index.js'
public class | source

DSB

Main Library class

Static Method Summary

Static Public Methods
public static

[Experimental] Try to get just the important data from the data you get back from fetch()

Constructor Summary

Public Constructor
public

constructor(username: String | Number, password: String | Number, cookies: String, cache: String | Boolean, axios: Axios)

Method Summary

Public Methods
public

async fetch(progress: ProgressCallback): Promise<Object>

Fetch data

public

async fetchV1(progress: ProgressCallback): Promise<Object>

Fetch data from the original iphone api (Only news and timetables supported)

Static Public Methods

public static findMethodInData(method: String, data: Object): Object source

[Experimental] Try to get just the important data from the data you get back from fetch()

Params:

NameTypeAttributeDescription
method String

The method name to search for (z.B tiles or timetable)

data Object

Data returned by fetch()

Return:

Object

Public Constructors

public constructor(username: String | Number, password: String | Number, cookies: String, cache: String | Boolean, axios: Axios) source

Params:

NameTypeAttributeDescription
username String | Number
password String | Number
cookies String
  • optional
  • default: ""

If you already have session cookies, you can add them here.

cache String | Boolean
  • optional
  • default: false

In the browser just a boolean and in node a path string. If you don't want to use any cache just use undefined, null or false.

axios Axios
  • optional
  • default: require('axios')

Pass your custom axios instance if you want.

Public Methods

public async fetch(progress: ProgressCallback): Promise<Object> source

Fetch data

Params:

NameTypeAttributeDescription
progress ProgressCallback
  • optional

Return:

Promise<Object>

public async fetchV1(progress: ProgressCallback): Promise<Object> source

Fetch data from the original iphone api (Only news and timetables supported)

Params:

NameTypeAttributeDescription
progress ProgressCallback
  • optional

Return:

Promise<Object>