zpa

package
v3.36.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package zpa is a minimal read-only client for HM's ZPA (Prüfungsamt) REST API, used to enrich a course roster with student details (name, group, gender). It is deliberately small — glabs only needs to look a student up — and keeps the HTTP details confined here, mirroring plexams.go's zpa package.

glabs identifies students by email, but ZPA's get_student_info search is primarily used with a Matrikelnummer in plexams. StudentByEmail therefore looks up defensively (by full email, then the email's local part) and returns nil when ZPA has no unambiguous match — so the students page degrades to just the email rather than showing wrong data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client talks to the ZPA REST API with a fixed token.

func New

func New(cfg Config) *Client

New builds a ZPA client. baseURL and token are required by the caller; an empty config means ZPA is disabled (bootstrap passes nil then).

func (*Client) StudentByEmail

func (c *Client) StudentByEmail(ctx context.Context, email string) (*Student, error)

StudentByEmail looks a student up defensively: first by the full email, then by the email's local part. It returns (nil, nil) when ZPA has no unambiguous match, so callers can show just the email rather than guessing.

type Config

type Config struct {
	BaseURL string
	Token   string
}

Config is the ZPA connection, read from the server config in bootstrap.

type Student

type Student struct {
	Mtknr     string `json:"mtknr"`
	Greeting  string `json:"greeting"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
	Gender    string `json:"gender"`
	Group     string `json:"group"`
}

Student is one ZPA student record.

Jump to

Keyboard shortcuts

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