api

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ScheduleDay = "0"

ScheduleDay means: show day view

View Source
const ScheduleWeek = "1"

ScheduleWeek means: show week view

View Source
const SkipNext = "N"

SkipNext means: skip to next day/week

View Source
const SkipNone = ""

SkipNone means: do not skip (default)

View Source
const SkipPrev = "P"

SkipPrev means: skip to previous day/week

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account represents a STiNE account.

func NewAccount

func NewAccount() Account

NewAccount creates a new Account.

func (*Account) DoFormRequest

func (acc *Account) DoFormRequest(data url.Values) (*http.Response, error)

DoFormRequest performs an HTTP POST request with form data.

func (*Account) DoRequest

func (acc *Account) DoRequest(req *http.Request) (*http.Response, error)

DoRequest performs an HTTP request.

func (*Account) ExamResults

func (acc *Account) ExamResults(semesterID string) ([][]string, error)

ExamResults returns an array of exam results, each with: ID, Name, Date, Grade, Grade text. semesterID can be empty (for the current semester), or and ID such as "099999904632582" (SoSe20), "999" (all)

func (*Account) Exams

func (acc *Account) Exams(semesterID string) ([][]string, error)

Exams returns an array of exams, each with: ID, Name, Type, Date. semesterID can be empty (for the current semester), or and ID such as "099999904632582" (SoSe20), "999" (all)

func (*Account) Login

func (acc *Account) Login(user, pass string) error

Login starts a new session.

func (*Account) Scheduler

func (acc *Account) Scheduler(date, skip, view string) ([]Schedule, error)

Scheduler returns an array of schedules. If given, date must be formatted as: DD.MM.YYYY; default is current date. Skip can be emtpy, "N" (next) or "P" (previous). View can be "0" (day) or "1" (week).

func (*Account) SchedulerExport

func (acc *Account) SchedulerExport(date string) (string, error)

SchedulerExport exports the schedule of a given month or week as an .ics file. Date examples: "Y2020M06" (month), "Y2020W25" (week). Dates must be in the present or future.

func (*Account) Session

func (acc *Account) Session() (string, string)

Session returns the current session ID and cookie.

func (*Account) SessionValid

func (acc *Account) SessionValid() error

SessionValid checks if the current session is valid.

func (*Account) SetClient

func (acc *Account) SetClient(client *http.Client)

SetClient sets the http client.

func (*Account) SetSession

func (acc *Account) SetSession(id, cnsc string)

SetSession allows you to reuse a session ID and cookie.

func (*Account) SetTimeout

func (acc *Account) SetTimeout(timeout time.Duration)

SetTimeout sets the time limit for requests.

func (*Account) SetTransport

func (acc *Account) SetTransport(trans *http.Transport)

SetTransport configures the transport options of the http client.

type Schedule

type Schedule struct {
	Date    string
	Entries [][]string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL