summaryrefslogtreecommitdiff
path: root/src/sources/HttpSource.ts
blob: f9391aaadd159c3d65b56e4ad78f685c8e5cafea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import * as request from 'request-promise-native';

import {ISource} from './ISource';

export class HttpSource implements ISource {
    private _base_uri = 'http://splus.ostfalia.de/semesterplan123.php';

    constructor(private _course: string) {
    }

    getData(weekOfYear: number): PromiseLike<string> {
        return request({
            method: 'POST',
            uri: this._base_uri,
            qs: {
                identifier: this._course,
            },
            formData: {
                weeks: weekOfYear.toString(),
            },
        });
    }
}