aula

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

goaula-mcp

A Go client library for theaula.dk, plus an MCP server that exposes it to LLM clients.

Project structure

Path Purpose
module root (package aula) Client library: HTTP connector, models, MeeBook client, HTML writers, session ping loop
login Shared interactive login flow: browser automation (chromedp), MitID session capture, QR screenshots, secure-login step-up
cmd/goaula-mcp MCP server exposing the Aula API as Model Context Protocol tools over stdio
cmd/goaula-login Interactive login CLI that captures the Aula session via Chrome

Features

  • Pure net/http client — no headless browser required
  • Full feature coverage:
    • Daily overview
    • Message threads and messages (within a timeframe)
    • Posts (within a timeframe)
    • Attachments (images, files) on posts and messages
    • Lookup of parents, children, teachers, etc.
    • Contact groups and contact lists
    • Gallery albums
    • Calendar events
    • MeeBook integration
  • Child filtering: filter posts, messages, threads, calendar events, and gallery by specific children

Requirements

  • Go 1.25+ (the go toolchain auto-downloads when GOTOOLCHAIN=auto)

Building

go build ./...
go test ./...

Library usage

package main

import (
	"fmt"
	"log"

	aula "github.com/ripdajacker/goaula-mcp"
)

func main() {
	// Uses ~/.aula/session.txt for session persistence
	client := aula.NewClient(&aula.Config{
		Session: aula.NewFileSessionProvider(),
	})
	defer client.Close()

	if err := client.Login(); err != nil {
		log.Fatal(err)
	}

	// List all children
	for _, child := range client.MyChildren() {
		fmt.Printf("%s (ID: %d)\n", child.Name, child.ID)
	}

	// Latest 20 posts from the last 21 days
	posts, err := client.RecentPosts(21, 20, nil)
	if err != nil {
		log.Fatal(err)
	}
	for _, post := range posts {
		fmt.Println(post.Title)
	}
}

All methods return an error; handle it as shown above.

// All posts from the last 21 days (auto-paginates), for a specific child
allPosts, err := client.AllPosts(21, []int64{childID}, 20)

// First page of messages, 20 per page
page, err := client.FindMessages(nil, nil, nil, nil, 0, 20)

// A full thread with all pages of messages
thread, err := client.ThreadAllPages("thread id")

// Calendar events for next week
events, err := client.CalendarEvents(3, 7, nil, nil)
Session providers
  • aula.NewFileSessionProvider(): reads ~/.aula/session.txt. This is the default when Config.Session is nil.
  • aula.StaticSessionProvider{ID: os.Getenv("AULA_SESSION_ID")}: fixed session ID, e.g. from an environment variable.

Custom providers implement aula.SessionProvider:

type SessionProvider interface {
	SessionID() (string, error)
	SaveSessionID(id string) error
}
Login flow

The interactive login flow lives in the shared login package and is used by both the goaula-login CLI and the aula_login MCP tool — either can be used to (re)establish a session.

It opens a visible Chrome window and polls for the PHPSESSID cookie until you have completed the MitID login, then stores the session ID in ~/.aula/session.txt. Both MitID methods work — the flow is the same:

  • MitID app — scan the QR code in the browser window (or in the screenshot file written by --qr-out) with the app on your phone.
  • Physical MitID code reader — ignore the QR and log in with username, password and the reader; the tool just waits for you to finish.

The login page is reloaded every few minutes while you are still on it so the QR never goes stale — a reload is never triggered once you have navigated into the MitID flow.

Note: Some MitID logins yield a token that does not allow seeing sensitive content. In this case an extra MitID approval is required and the tool will redirect you to a 2-factor MitID login. Skip with --skip-stepup in the unlikely case you need to skip this.

go build -o goaula-login ./cmd/goaula-login
./goaula-login                        # headed Chrome
./goaula-login --headless             # no window; QR screenshot written to file
./goaula-login --force                # re-login even if the stored session is valid
./goaula-login --browser-path /usr/bin/chromium --timeout 5m
./goaula-login --ping            # after login, keep pinging until Ctrl-C

Useful flags: --headless, --browser-path, --session-file, --qr-out, --settle (default 10s), --timeout (default 10m), --force, --skip-stepup, --ping, --ping-interval (default 15m), --v.

With --ping, the tool stays in the foreground after login and pings the API periodically to keep the session token alive — handy for running it from a terminal or cron without an MCP client attached. After 3 consecutive ping failures the session is considered expired and the tool exits with an error.

MCP server

cmd/goaula-mcp is an MCP server that exposes Aula as read-only tools over stdio, so LLM clients (Claude Desktop, OpenCode, etc.) can query posts, messages, threads, calendar, gallery, presence, and people. It uses the official MCP Go SDK.

The server reads the session token from ~/.aula/session.txt, exactly like the client library. If the session has expired, the server still starts and every tool then returns an actionable error. The aula_login tool can then re-establish the session interactively (opening the shared login flow's browser) — no goaula-login binary required.

Build and run
go build -o goaula-mcp ./cmd/goaula-mcp
./goaula-mcp
Tools
Tool Description
aula_login Start interactive login: opens a Chrome window with the MitID flow and returns the QR screenshot
aula_check_auth Poll for completed login after aula_login (may return a refreshed QR)
aula_session_status Check whether the current session is valid
aula_whoami Current profile, children, institutions and active context (IDs)
aula_set_context Switch the current child/institution context
aula_search_people Find parents, children, teachers etc. by name and role
aula_posts Recent posts (optionally filtered by days and children)
aula_messages Search messages within the past N days
aula_threads List message threads (paged, or by activity window)
aula_thread A full message thread by ID
aula_calendar Calendar events in a date range, optionally by event type
aula_gallery Gallery albums with media URLs
aula_daily_overview Daily presence overview per child
aula_contact_groups Groups (classes, SFO) each child belongs to
aula_contacts Contact list of a group (guardians' visible email/phone)
Example MCP client configuration
{
  "mcpServers": {
    "aula": {
      "command": "/path/to/goaula-mcp"
    }
  }
}

Optional environment variable AULA_MCP_API_URL overrides the Aula API base URL (defaults to https://www.aula.dk/api/).

The server keeps the session token alive with a periodic ping (profiles.getProfilesByLogin, the cheapest authenticated call), like the TS aula-mcp-server. GOAULA_MCP_PING_INTERVAL sets the interval — a duration like 15m/1h or plain minutes like 15 (default 15m, 0/off disables). After 3 consecutive ping failures the session is marked expired and tools return the "refresh the session" error until the process is restarted with a fresh session file.

License

MIT

Documentation

Index

Constants

View Source
const (

	// WeeklyBookWidgetID is the widget ID for the weekly book.
	WeeklyBookWidgetID = "0003"
	// WeeklyPlanWidgetID is the widget ID for the weekly plan.
	WeeklyPlanWidgetID = "0004"
)
View Source
const (
	// DefaultAPIURL is the default base URL of the Aula API.
	DefaultAPIURL = "https://www.aula.dk/api/"
)
View Source
const MaxPingFailures = 3

MaxPingFailures is the number of consecutive failed pings before PingLoop reports the session as expired.

Variables

This section is empty.

Functions

func DefaultSessionFile

func DefaultSessionFile() string

DefaultSessionFile returns the default session file path: ~/.aula/session.txt.

func MarshalJSON

func MarshalJSON(v any) ([]byte, error)

MarshalJSON marshals v to compact JSON without HTML escaping (Jackson-compatible), so HTML content from Aula is not mangled into <p> etc.

func PingLoop added in v1.1.0

func PingLoop(ping func() error, interval time.Duration, stop <-chan struct{}) error

PingLoop calls ping on a ticker until stop is closed or the session expires (MaxPingFailures consecutive failures). It runs synchronously on the calling goroutine and returns nil when stop is closed, or an error when the session has expired. The goaula-mcp and goaula-login commands both use it to keep a session token alive.

Types

type APIError

type APIError struct {
	// Message is the human-readable error message.
	Message string
	// HTTPStatus is the HTTP status code, or 0 when not applicable.
	HTTPStatus int
	// AulaStatusCode is Aula's internal status code, when provided.
	AulaStatusCode *int
	// AulaSubCode is Aula's internal sub-code, when provided.
	AulaSubCode *int
	// AulaMessage is Aula's own error message, when provided.
	AulaMessage string
}

APIError is the base error for all Aula API errors.

func NewAPIError

func NewAPIError(message string) *APIError

NewAPIError creates a new APIError with just a message.

func (*APIError) Error

func (e *APIError) Error() string

type Address

type Address struct {
	ID             int64  `json:"id,omitempty"`
	Street         string `json:"street,omitempty"`
	PostalCode     int    `json:"postalCode,omitempty"`
	PostalDistrict string `json:"postalDistrict,omitempty"`
}

Address for profile addresses.

type AdministrativeAuthority

type AdministrativeAuthority struct {
	ID               int64    `json:"id,omitempty"`
	Name             string   `json:"name,omitempty"`
	InstitutionCodes []string `json:"institutionCodes,omitempty"`
}

AdministrativeAuthority holds municipality authority details.

type AlbumCreator

type AlbumCreator struct {
	ProfileID       int64           `json:"profileId,omitempty"`
	ID              int64           `json:"id,omitempty"`
	InstitutionCode string          `json:"institutionCode,omitempty"`
	InstitutionName string          `json:"institutionName,omitempty"`
	Role            string          `json:"role,omitempty"`
	Name            string          `json:"name,omitempty"`
	ProfilePicture  *ProfilePicture `json:"profilePicture,omitempty"`
	MainGroup       string          `json:"mainGroup,omitempty"`
	ShortName       string          `json:"shortName,omitempty"`
	InstitutionRole string          `json:"institutionRole,omitempty"`
	Metadata        string          `json:"metadata,omitempty"`
}

AlbumCreator is the creator of a gallery album.

type AlbumMedia

type AlbumMedia struct {
	Title                      string        `json:"title,omitempty"`
	Description                string        `json:"description,omitempty"`
	Tags                       []Tag         `json:"tags,omitempty"`
	MediaType                  string        `json:"mediaType,omitempty"`
	Album                      any           `json:"album,omitempty"`
	Duration                   int64         `json:"duration,omitempty"`
	CurrentUserCanReport       bool          `json:"currentUserCanReport,omitempty"`
	CurrentUserCanDelete       bool          `json:"currentUserCanDelete,omitempty"`
	CurrentUserCanEditMetaData bool          `json:"currentUserCanEditMetaData,omitempty"`
	IsUploadPending            bool          `json:"isUploadPending,omitempty"`
	CommentCount               int           `json:"commentCount,omitempty"`
	AllowsComments             bool          `json:"allowsComments,omitempty"`
	CanViewComments            bool          `json:"canViewComments,omitempty"`
	IsDeleted                  bool          `json:"isDeleted,omitempty"`
	CurrentUserCanEditTags     bool          `json:"currentUserCanEditTags,omitempty"`
	ConversionStatus           string        `json:"conversionStatus,omitempty"`
	ID                         int64         `json:"id,omitempty"`
	File                       *MediaFile    `json:"file,omitempty"`
	Creator                    *MediaCreator `json:"creator,omitempty"`
	ThumbnailURL               string        `json:"thumbnailUrl,omitempty"`
	LargeThumbnailURL          string        `json:"largeThumbnailUrl,omitempty"`
	MediumThumbnailURL         string        `json:"mediumThumbnailUrl,omitempty"`
	SmallThumbnailURL          string        `json:"smallThumbnailUrl,omitempty"`
	ExtraSmallThumbnailURL     string        `json:"extraSmallThumbnailUrl,omitempty"`
}

AlbumMedia is a media item in an album.

func (*AlbumMedia) FullSizeURL

func (m *AlbumMedia) FullSizeURL() string

FullSizeURL returns the URL of the full size image (largest available). The URL expires (S3 signed URL), so it must be used quickly.

func (*AlbumMedia) HasChildNameTag

func (m *AlbumMedia) HasChildNameTag(namePart string) bool

HasChildNameTag checks if the media has a tag with the name part and role child.

type AlbumMediaResponse

type AlbumMediaResponse struct {
	Album      *GalleryAlbum `json:"album,omitempty"`
	MediaCount int           `json:"mediaCount,omitempty"`
	Results    []AlbumMedia  `json:"results,omitempty"`
	TotalSize  int64         `json:"totalSize,omitempty"`
	Limit      int           `json:"limit,omitempty"`
	StartIndex int           `json:"startIndex,omitempty"`
}

AlbumMediaResponse is the wrapper for the gallery.getMedia response.

type Attachment

type Attachment struct {
	ID                   int64              `json:"id,omitempty"`
	Name                 string             `json:"name,omitempty"`
	Status               string             `json:"status,omitempty"`
	AttachmentType       string             `json:"attachmentType,omitempty"`
	Creator              *AttachmentCreator `json:"creator,omitempty"`
	File                 *AttachmentFile    `json:"file,omitempty"`
	Link                 any                `json:"link,omitempty"`
	Media                *AttachmentMedia   `json:"media,omitempty"`
	Document             any                `json:"document,omitempty"`
	CurrentUserCanReport bool               `json:"currentUserCanReport,omitempty"`
}

Attachment represents a post/message attachment.

func (*Attachment) FileName

func (a *Attachment) FileName() string

FileName returns the file name of a file attachment.

func (*Attachment) FileURL

func (a *Attachment) FileURL() string

FileURL returns the URL of the file on S3. The URL expires (S3 signed URL), so it must be used quickly.

func (*Attachment) FullSizeURL

func (a *Attachment) FullSizeURL() string

FullSizeURL returns the URL of the full size image (largest available). The URL expires (S3 signed URL), so it must be used quickly.

func (*Attachment) IsFile

func (a *Attachment) IsFile() bool

IsFile reports whether the attachment is a file.

func (*Attachment) IsImage

func (a *Attachment) IsImage() bool

IsImage reports whether the attachment is an image.

func (*Attachment) LargeThumbnailURL

func (a *Attachment) LargeThumbnailURL() string

LargeThumbnailURL returns the URL of the large thumbnail image. The URL expires (S3 signed URL), so it must be used quickly.

func (*Attachment) ThumbnailURL

func (a *Attachment) ThumbnailURL() string

ThumbnailURL returns the URL of the thumbnail image (smallest available). The URL expires (S3 signed URL), so it must be used quickly.

type AttachmentCreator

type AttachmentCreator struct {
	ProfileID       int64           `json:"profileId,omitempty"`
	ID              int64           `json:"id,omitempty"`
	InstitutionCode string          `json:"institutionCode,omitempty"`
	InstitutionName string          `json:"institutionName,omitempty"`
	Role            string          `json:"role,omitempty"`
	Name            string          `json:"name,omitempty"`
	ProfilePicture  *ProfilePicture `json:"profilePicture,omitempty"`
	MainGroup       string          `json:"mainGroup,omitempty"`
	ShortName       string          `json:"shortName,omitempty"`
	InstitutionRole string          `json:"institutionRole,omitempty"`
	Metadata        string          `json:"metadata,omitempty"`
}

AttachmentCreator is the creator of an attachment.

type AttachmentFile

type AttachmentFile struct {
	ID      int64  `json:"id,omitempty"`
	Bucket  string `json:"bucket,omitempty"`
	Key     string `json:"key,omitempty"`
	URL     string `json:"url,omitempty"`
	Created string `json:"created,omitempty"`
	Name    string `json:"name,omitempty"`
}

AttachmentFile is the file information of an attachment.

type AttachmentMedia

type AttachmentMedia struct {
	Title                      string             `json:"title,omitempty"`
	Description                string             `json:"description,omitempty"`
	Tags                       []Tag              `json:"tags,omitempty"`
	MediaType                  string             `json:"mediaType,omitempty"`
	Album                      any                `json:"album,omitempty"`
	Duration                   any                `json:"duration,omitempty"`
	CurrentUserCanReport       bool               `json:"currentUserCanReport,omitempty"`
	CurrentUserCanDelete       bool               `json:"currentUserCanDelete,omitempty"`
	CurrentUserCanEditMetaData bool               `json:"currentUserCanEditMetaData,omitempty"`
	IsUploadPending            bool               `json:"isUploadPending,omitempty"`
	CommentCount               int                `json:"commentCount,omitempty"`
	AllowsComments             bool               `json:"allowsComments,omitempty"`
	CanViewComments            bool               `json:"canViewComments,omitempty"`
	IsDeleted                  bool               `json:"isDeleted,omitempty"`
	CurrentUserCanEditTags     bool               `json:"currentUserCanEditTags,omitempty"`
	ConversionStatus           string             `json:"conversionStatus,omitempty"`
	ID                         int64              `json:"id,omitempty"`
	File                       *AttachmentFile    `json:"file,omitempty"`
	Creator                    *AttachmentCreator `json:"creator,omitempty"`
	ThumbnailURL               string             `json:"thumbnailUrl,omitempty"`
	LargeThumbnailURL          string             `json:"largeThumbnailUrl,omitempty"`
	MediumThumbnailURL         string             `json:"mediumThumbnailUrl,omitempty"`
	SmallThumbnailURL          string             `json:"smallThumbnailUrl,omitempty"`
	ExtraSmallThumbnailURL     string             `json:"extraSmallThumbnailUrl,omitempty"`
}

AttachmentMedia is the media information of an attachment.

type CalendarEvent

type CalendarEvent struct {
	CreatorInstProfileID         int64          `json:"creatorInstProfileId,omitempty"`
	CreatorProfileID             int64          `json:"creatorProfileId,omitempty"`
	CreatorName                  string         `json:"creatorName,omitempty"`
	InvitedGroups                []InvitedGroup `json:"invitedGroups,omitempty"`
	PrimaryResource              any            `json:"primaryResource,omitempty"`
	HasAttachments               bool           `json:"hasAttachments,omitempty"`
	CreatedDateTime              string         `json:"createdDateTime,omitempty"`
	Lesson                       *Lesson        `json:"lesson,omitempty"`
	TimeSlot                     *TimeSlot      `json:"timeSlot,omitempty"`
	VacationChildrenCountByDates any            `json:"vacationChildrenCountByDates,omitempty"`
	BelongsToProfiles            []int64        `json:"belongsToProfiles,omitempty"`
	BelongsToResources           []any          `json:"belongsToResources,omitempty"`
	RequiresNewAnswer            bool           `json:"requiresNewAnswer,omitempty"`
	DirectlyRelated              bool           `json:"directlyRelated,omitempty"`
	ResponseDeadline             string         `json:"responseDeadline,omitempty"`
	ResponseStatus               string         `json:"responseStatus,omitempty"`
	ID                           int64          `json:"id,omitempty"`
	Title                        string         `json:"title,omitempty"`
	AllDay                       bool           `json:"allDay,omitempty"`
	StartDateTime                string         `json:"startDateTime,omitempty"`
	EndDateTime                  string         `json:"endDateTime,omitempty"`
	OldEndDateTime               string         `json:"oldEndDateTime,omitempty"`
	OldStartDateTime             string         `json:"oldStartDateTime,omitempty"`
	OldAllDay                    bool           `json:"oldAllDay,omitempty"`
	ResponseRequired             bool           `json:"responseRequired,omitempty"`
	IsPrivate                    bool           `json:"isPrivate,omitempty"`
	Type                         string         `json:"type,omitempty"`
	PrimaryResourceText          string         `json:"primaryResourceText,omitempty"`
	AdditionalResources          []any          `json:"additionalResources,omitempty"`
	AdditionalResourceText       string         `json:"additionalResourceText,omitempty"`
	Repeating                    any            `json:"repeating,omitempty"`
	InstitutionCode              string         `json:"institutionCode,omitempty"`
	InstitutionName              string         `json:"institutionName,omitempty"`
	AddedToInstitutionCalendar   bool           `json:"addedToInstitutionCalendar,omitempty"`
}

CalendarEvent is a calendar event from Aula.

func (*CalendarEvent) EventType

func (e *CalendarEvent) EventType() CalendarEventType

EventType returns the event type as an enum ("" when unknown).

type CalendarEventType

type CalendarEventType string

CalendarEventType is the type of a calendar event.

const (
	EventTypeEvent              CalendarEventType = "event"
	EventTypeHoliday            CalendarEventType = "holiday"
	EventTypePresenceHoliday    CalendarEventType = "presence_holiday"
	EventTypeBirthday           CalendarEventType = "birthday"
	EventTypeExcursion          CalendarEventType = "excursion"
	EventTypeOther              CalendarEventType = "other"
	EventTypeSchoolHomeMeeting  CalendarEventType = "school_home_meeting"
	EventTypeParentalMeeting    CalendarEventType = "parental_meeting"
	EventTypePerformanceMeeting CalendarEventType = "performance_meeting"
	EventTypeLesson             CalendarEventType = "lesson"
)

func ParseCalendarEventType

func ParseCalendarEventType(value string) (CalendarEventType, bool)

ParseCalendarEventType converts a string to a CalendarEventType. The second return value reports whether the value is a known event type.

type Child

type Child struct {
	InstitutionProfile         *InstitutionProfile `json:"institutionProfile,omitempty"`
	ID                         int64               `json:"id,omitempty"`
	ProfileID                  int64               `json:"profileId,omitempty"`
	UserID                     string              `json:"userId,omitempty"`
	Name                       string              `json:"name,omitempty"`
	ProfilePicture             *ProfilePicture     `json:"profilePicture,omitempty"`
	ShortName                  string              `json:"shortName,omitempty"`
	InstitutionCode            string              `json:"institutionCode,omitempty"`
	HasCustodyOrExtendedAccess bool                `json:"hasCustodyOrExtendedAccess,omitempty"`
}

Child representing a child profile.

type ChildGroup

type ChildGroup struct {
	ID              int64  `json:"id,omitempty"`
	Name            string `json:"name,omitempty"`
	InstitutionCode string `json:"institutionCode,omitempty"`
	ShowAsDefault   bool   `json:"showAsDefault,omitempty"`
}

ChildGroup is a single group (class, SFO, etc.) on one of the user's children, as returned by groups.getGroupsByContext.

type ChildGroups

type ChildGroups struct {
	ProfileID   int64        `json:"profileId,omitempty"`
	DisplayName string       `json:"displayName,omitempty"`
	Groups      []ChildGroup `json:"groups,omitempty"`
}

ChildGroups is the result of groups.getGroupsByContext for one of the user's children: the child and the groups it belongs to.

func (*ChildGroups) SortedGroups

func (c *ChildGroups) SortedGroups() []ChildGroup

SortedGroups returns the groups sorted by name.

type Client

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

Client is the main client for communicating with the Aula API (Aula.dk).

Usage:

client := aula.NewClient(&aula.Config{Session: aula.NewFileSessionProvider()})
if err := client.Login(); err != nil { ... }
posts, err := client.RecentPosts(21, 20, nil)

The client is NOT safe for concurrent use; serialize access (e.g. with a mutex) when sharing it between goroutines.

func NewClient

func NewClient(config *Config) *Client

NewClient creates a new Aula API client with the given configuration.

func (*Client) ActiveAPIVersion

func (c *Client) ActiveAPIVersion() int

ActiveAPIVersion returns the negotiated Aula API version.

func (*Client) AllChildren

func (c *Client) AllChildren() []Child

AllChildren returns all children of the current profile.

func (*Client) AllInstitutions

func (c *Client) AllInstitutions() []InstitutionProfile

AllInstitutions returns all institution profiles of the current profile.

func (*Client) AllMessages

func (c *Client) AllMessages(retrievePastDays int, childIDs []int64, pageSize int) ([]FoundMessage, error)

AllMessages gets all messages within the past N days, automatically fetching all pages. pageSize defaults to 20 when <= 0.

func (*Client) AllPosts

func (c *Client) AllPosts(retrievePastDays int, childIDs []int64, pageSize int) ([]Post, error)

AllPosts gets all posts within the past N days by paginating backwards (increasing offset) until posts are older than the date range. Since the API returns posts newest-first, it stops as soon as it encounters a post that's too old.

func (*Client) AllProfiles

func (c *Client) AllProfiles() *Profiles

AllProfiles returns all profiles of the logged-in user.

func (*Client) AllThreads

func (c *Client) AllThreads(childIDs []int64, pageSize int) ([]Thread, error)

AllThreads lists all threads, automatically fetching all pages.

func (*Client) CalendarEvents

func (c *Client) CalendarEvents(daysInPast, daysInFuture int, childIDs []int64, eventType *CalendarEventType) ([]CalendarEvent, error)

CalendarEvents gets calendar events with optional child and event type filtering.

daysInPast:   number of days in the past (default 3)
daysInFuture: number of days in the future (default 7)
childIDs:     child IDs to filter by (nil or empty for all children/current context)
eventType:    optional event type filter

func (*Client) CalendarEventsExceptLessons

func (c *Client) CalendarEventsExceptLessons(daysInPast, daysInFuture int) ([]CalendarEvent, error)

CalendarEventsExceptLessons gets calendar events, except lessons.

func (*Client) CalendarEventsOnlyExcursions

func (c *Client) CalendarEventsOnlyExcursions(daysInPast, daysInFuture int) ([]CalendarEvent, error)

CalendarEventsOnlyExcursions gets calendar events for the current profile and current child, only excursions.

func (*Client) CalendarEventsOnlyLessons

func (c *Client) CalendarEventsOnlyLessons(daysInPast, daysInFuture int) ([]CalendarEvent, error)

CalendarEventsOnlyLessons gets calendar events, only lessons.

func (*Client) CalendarEventsSpecialEvents

func (c *Client) CalendarEventsSpecialEvents(daysInPast, daysInFuture int) ([]CalendarEvent, error)

CalendarEventsSpecialEvents gets calendar events: special events (holidays, birthdays, excursions, etc.).

func (*Client) Close

func (c *Client) Close() error

Close closes the client and releases resources.

func (*Client) ContactGroups

func (c *Client) ContactGroups(childIDs []int64) ([]ChildGroups, error)

ContactGroups lists the groups (classes, SFO, etc.) each of the user's children belongs to. These group IDs are what the contacts list (profiles.getContactlist) needs to look up class contact lists with visible phone numbers and emails. Empty childIDs means all children.

func (*Client) ContactList

func (c *Client) ContactList(groupID int64, filter string) ([]ContactEntry, error)

ContactList gets the contact list of a group: the children of the group and their relations (guardians), including email and phone numbers where the person has consented to show contact information. filter is e.g. "child" to list the children with their relations, or "parent" to list the guardians directly ("" means "child").

The list is paginated (20 entries per page, 1-based); this method transparently fetches all pages.

func (*Client) CurrentChild

func (c *Client) CurrentChild() *Child

CurrentChild returns the currently selected child.

func (*Client) CurrentInstitution

func (c *Client) CurrentInstitution() *InstitutionProfile

CurrentInstitution returns the currently selected institution.

func (*Client) CurrentProfile

func (c *Client) CurrentProfile() *Profile

CurrentProfile returns the currently selected profile.

func (*Client) DailyOverview

func (c *Client) DailyOverview(childID int64) ([]DailyOverview, error)

DailyOverview gets the daily overview for a child.

func (*Client) FindChildren

func (c *Client) FindChildren(namePart string) ([]Recipient, error)

FindChildren finds children by name.

func (*Client) FindEmployees

func (c *Client) FindEmployees(namePart string) ([]Recipient, error)

FindEmployees finds employees by name.

func (*Client) FindLeaders

func (c *Client) FindLeaders(namePart string) ([]Recipient, error)

FindLeaders finds leaders (SFO leader, principal, etc.) by name.

func (*Client) FindMessages

func (c *Client) FindMessages(fromDate, toDate *time.Time, participantIDs, childIDs []int64, page, pageSize int) (*PagedResult[FoundMessage], error)

FindMessages finds messages within a date range, with optional child filtering and pagination.

fromDate:       start date (nil = 3 days ago)
toDate:         end date (nil = now)
participantIDs: participant IDs to filter by (nil for all)
childIDs:       child IDs to filter by (nil or empty for all children)
page:           page index (0-based)
pageSize:       number of results per page

func (*Client) FindParents

func (c *Client) FindParents(namePart string) ([]Recipient, error)

FindParents finds parents by name.

func (*Client) FindPeople

func (c *Client) FindPeople(namePart string) ([]Recipient, error)

FindPeople finds people by name. Useful to get IDs, emails, names, etc.

func (*Client) FindPreschoolTeachers

func (c *Client) FindPreschoolTeachers(namePart string) ([]Recipient, error)

FindPreschoolTeachers finds preschool teachers (SFO) by name.

func (*Client) FindTeachers

func (c *Client) FindTeachers(namePart string) ([]Recipient, error)

FindTeachers finds teachers by name.

func (*Client) GalleryAlbumMedia

func (c *Client) GalleryAlbumMedia(albumLimit, mediaLimit int, mostRecentAlbums, retrievePastDays *int, childIDs []int64) ([]GalleryAlbum, error)

GalleryAlbumMedia gets gallery album media for the current profile, with optional child filtering.

albumLimit:       max number of albums (default 12)
mediaLimit:       max media per album (default 30)
mostRecentAlbums: if set, get the N most recent albums
retrievePastDays: if set, get albums from the past N days
childIDs:         child IDs to filter by (nil or empty for all children)

func (*Client) ListThreads

func (c *Client) ListThreads(page, pageSize int, childIDs []int64) (*PagedResult[Thread], error)

ListThreads lists threads directly using the messaging.getThreads endpoint, with page-based pagination. Threads are scoped to the current profile/child context. To filter by a specific child, call SetMyCurrentChild first.

Note: This endpoint uses "page" (not "index") for pagination, and does NOT accept institutionProfileIds[] — childIDs is ignored for this endpoint.

func (*Client) LoggedIn

func (c *Client) LoggedIn() bool

LoggedIn reports whether Login has completed successfully.

func (*Client) Login

func (c *Client) Login() error

Login logs the user in and sets up the session for further API calls.

func (*Client) MeeBookInformation

func (c *Client) MeeBookInformation() (*MeeBookConsolidatedInformation, error)

MeeBookInformation gets MeeBook weekly book and plan information.

func (*Client) Messages

func (c *Client) Messages(retrievePastDays int, childIDs []int64, resultsLimit int) ([]FoundMessage, error)

Messages gets messages within the past N days (first page only), optionally filtered by children.

func (*Client) MyChild

func (c *Client) MyChild(childNamePart string) *Child

MyChild gets a specific child by partial name. Returns nil when no child matches.

func (*Client) MyChildren

func (c *Client) MyChildren() []Child

MyChildren returns all children of the current profile.

func (*Client) MyInstitution

func (c *Client) MyInstitution(institutionNamePart string) *InstitutionProfile

MyInstitution gets the institution by partial name ("" matches the first).

func (*Client) MyProfile

func (c *Client) MyProfile(displayNamePart string) *Profile

MyProfile gets the profile using the user's display name (partial match). Returns nil when no profile matches.

func (*Client) PingAula

func (c *Client) PingAula() error

PingAula does the most lightweight thing to test the API is currently active.

func (*Client) Posts

func (c *Client) Posts(offset, limit int, childIDs []int64) (*PagedResult[Post], error)

Posts gets a page of posts using offset-based pagination (matches the Aula UI behavior). Posts are returned newest-first. To get the next page, increase the offset by the limit (e.g. offset=0, limit=10, then offset=10, limit=10, etc.).

Example API call: posts.getAllPosts&parent=profile&index=10&institutionProfileIds[]=...&limit=10

func (*Client) RecentPosts

func (c *Client) RecentPosts(retrievePastDays, postLimit int, childIDs []int64) ([]Post, error)

RecentPosts gets the latest N posts (from offset 0), optionally filtered by date and child. retrievePastDays filters results client-side; use 0 or negative for no filtering.

func (*Client) SetMyCurrentChild

func (c *Client) SetMyCurrentChild(childID int64) bool

SetMyCurrentChild sets the current child by ID. Returns false when no child with the ID exists.

func (*Client) SetMyCurrentInstitution

func (c *Client) SetMyCurrentInstitution(institutionID int64) bool

SetMyCurrentInstitution sets the current institution by ID. Returns false when no institution with the ID exists.

func (*Client) SetMyCurrentProfile

func (c *Client) SetMyCurrentProfile(profileID int64) bool

SetMyCurrentProfile sets the current profile by ID. Returns false when no profile with the ID exists.

func (*Client) Thread

func (c *Client) Thread(threadID string) (*MessagesForThread, error)

Thread gets a specific thread by ID (first page of messages only).

func (*Client) ThreadAllPages

func (c *Client) ThreadAllPages(threadID string) (*MessagesForThread, error)

ThreadAllPages gets a specific thread by ID, fetching all pages of messages.

func (*Client) ThreadPage

func (c *Client) ThreadPage(threadID string, page int) (*MessagesForThread, error)

ThreadPage gets a specific page of messages for a thread.

func (*Client) Threads

func (c *Client) Threads(retrievePastDays int, childIDs []int64) ([]MessagesForThread, error)

Threads gets all threads updated within the past N days, optionally filtered by children. Checks for messages within the last N days, and retrieves the full thread containing each message (including all pages of messages).

type Config

type Config struct {
	// APIURL is the URL of the Aula API, defaults to "https://www.aula.dk/api/".
	APIURL string
	// Session provides the session ID (PHPSESSID).
	Session SessionProvider
}

Config is the configuration for the Client.

type ContactEntry

type ContactEntry struct {
	ID                                          int64             `json:"id,omitempty"`
	ProfileID                                   int64             `json:"profileId,omitempty"`
	InstitutionCode                             string            `json:"institutionCode,omitempty"`
	InstitutionName                             string            `json:"institutionName,omitempty"`
	FirstName                                   string            `json:"firstName,omitempty"`
	LastName                                    string            `json:"lastName,omitempty"`
	FullName                                    string            `json:"fullName,omitempty"`
	Role                                        string            `json:"role,omitempty"`
	AulaEmail                                   string            `json:"aulaEmail,omitempty"`
	Email                                       string            `json:"email,omitempty"`
	HomePhoneNumber                             string            `json:"homePhoneNumber,omitempty"`
	MobilePhoneNumber                           string            `json:"mobilePhoneNumber,omitempty"`
	WorkPhoneNumber                             string            `json:"workPhoneNumber,omitempty"`
	ShortName                                   string            `json:"shortName,omitempty"`
	Metadata                                    string            `json:"metadata,omitempty"`
	CurrentUserCanViewContactInformation        bool              `json:"currentUserCanViewContactInformation,omitempty"`
	UserHasGivenConsentToShowContactInformation bool              `json:"userHasGivenConsentToShowContactInformation,omitempty"`
	CommunicationBlocked                        bool              `json:"communicationBlocked,omitempty"`
	Relations                                   []ContactRelation `json:"relations,omitempty"`
}

ContactEntry is one entry of the contact list (profiles.getContactlist): a person (typically a child) plus its relations (guardians, etc.). Contact details are only visible when the person has consented to show contact information.

func (*ContactEntry) VisibleGuardians

func (e *ContactEntry) VisibleGuardians() []ContactRelation

VisibleGuardians returns the relations (guardians) of this person's profile that have contact information visible.

type ContactRelation

type ContactRelation struct {
	ID        int64  `json:"id,omitempty"`
	ProfileID int64  `json:"profileId,omitempty"`
	FullName  string `json:"fullName,omitempty"`
	Role      string `json:"role,omitempty"`
	// Relation name in Danish, e.g. "Mor", "Far", "Bedsteforælder".
	Relation                                    string `json:"relation,omitempty"`
	AulaEmail                                   string `json:"aulaEmail,omitempty"`
	Email                                       string `json:"email,omitempty"`
	HomePhoneNumber                             string `json:"homePhoneNumber,omitempty"`
	MobilePhoneNumber                           string `json:"mobilePhoneNumber,omitempty"`
	WorkPhoneNumber                             string `json:"workPhoneNumber,omitempty"`
	ShortName                                   string `json:"shortName,omitempty"`
	Metadata                                    string `json:"metadata,omitempty"`
	CurrentUserCanViewContactInformation        bool   `json:"currentUserCanViewContactInformation,omitempty"`
	UserHasGivenConsentToShowContactInformation bool   `json:"userHasGivenConsentToShowContactInformation,omitempty"`
	CommunicationBlocked                        bool   `json:"communicationBlocked,omitempty"`
}

ContactRelation is a person related to a ContactEntry (guardian, grandparent, etc.) with its relation name and contact details. Contact details are masked server-side unless the person has consented to show them.

func (*ContactRelation) ContactInformationVisible

func (r *ContactRelation) ContactInformationVisible() bool

ContactInformationVisible reports whether the person has given consent to show contact information and it is visible to the current user.

type Creator

type Creator struct {
	MailBoxOwner       *MailBoxOwner `json:"mailBoxOwner,omitempty"`
	FullName           string        `json:"fullName,omitempty"`
	Metadata           string        `json:"metadata,omitempty"`
	AnswerDirectlyName string        `json:"answerDirectlyName,omitempty"`
}

Creator of a thread.

type DailyOverview

type DailyOverview struct {
	ID                                int64               `json:"id,omitempty"`
	InstitutionProfile                *InstitutionProfile `json:"institutionProfile,omitempty"`
	MainGroup                         *MainGroup          `json:"mainGroup,omitempty"`
	Status                            int                 `json:"status,omitempty"`
	Location                          string              `json:"location,omitempty"`
	SleepIntervals                    []any               `json:"sleepIntervals,omitempty"`
	CheckInTime                       string              `json:"checkInTime,omitempty"`
	CheckOutTime                      string              `json:"checkOutTime,omitempty"`
	EditablePresenceStates            []any               `json:"editablePresenceStates,omitempty"`
	IsDefaultEntryTime                bool                `json:"isDefaultEntryTime,omitempty"`
	IsDefaultExitTime                 bool                `json:"isDefaultExitTime,omitempty"`
	IsPlannedTimesOutsideOpeningHours bool                `json:"isPlannedTimesOutsideOpeningHours,omitempty"`
	ActivityType                      int                 `json:"activityType,omitempty"`
	EntryTime                         string              `json:"entryTime,omitempty"`
	ExitTime                          string              `json:"exitTime,omitempty"`
	ExitWith                          string              `json:"exitWith,omitempty"`
	Comment                           string              `json:"comment,omitempty"`
	SpareTimeActivity                 any                 `json:"spareTimeActivity,omitempty"`
	SelfDeciderStartTime              string              `json:"selfDeciderStartTime,omitempty"`
	SelfDeciderEndTime                string              `json:"selfDeciderEndTime,omitempty"`
}

DailyOverview represents a single daily overview entry.

type FileSessionProvider

type FileSessionProvider struct {
	// Path of the session file. Defaults to ~/.aula/session.txt.
	Path string
}

FileSessionProvider reads and writes the session ID from a file (by default ~/.aula/session.txt), with owner-only permissions.

func NewFileSessionProvider

func NewFileSessionProvider() *FileSessionProvider

NewFileSessionProvider creates a FileSessionProvider using ~/.aula/session.txt.

func (*FileSessionProvider) SaveSessionID

func (p *FileSessionProvider) SaveSessionID(id string) error

SaveSessionID writes the session ID to the session file with owner-only permissions.

func (*FileSessionProvider) SessionID

func (p *FileSessionProvider) SessionID() (string, error)

SessionID reads the session ID from the session file. Returns "" when the file does not exist or is empty.

type FindMessageRequest

type FindMessageRequest struct {
	ActiveChildrenInstitutionProfileIDs []int64              `json:"activeChildrenInstitutionProfileIds"`
	CommonInboxID                       *string              `json:"commonInboxId"`
	ExactTerm                           bool                 `json:"exactTerm"`
	FilterBy                            string               `json:"filterBy"`
	FromDate                            string               `json:"fromDate"`
	ToDate                              string               `json:"toDate"`
	HasAttachments                      *bool                `json:"hasAttachments"`
	InstitutionCodes                    []string             `json:"institutionCodes"`
	Limit                               int                  `json:"limit"`
	MessageContent                      *string              `json:"messageContent"`
	Offset                              int                  `json:"offset"`
	Participants                        []MailboxParticipant `json:"participants"`
	SortBy                              string               `json:"sortBy"`
	SortDirection                       string               `json:"sortDirection"`
	Text                                string               `json:"text"`
	ThreadCreators                      []MailBoxOwner       `json:"threadCreators"`
	ThreadSubject                       *string              `json:"threadSubject"`
}

FindMessageRequest is the request body for search.findMessage.

func NewFindMessageRequest

func NewFindMessageRequest(activeChildrenInstitutionProfileIDs []int64, institutionCodes []string) *FindMessageRequest

NewFindMessageRequest creates a FindMessageRequest with Aula's default values.

func (*FindMessageRequest) SetDateRange

func (r *FindMessageRequest) SetDateRange(fromDate, toDate time.Time)

SetDateRange sets the from/to dates on the request (as ISO instants).

type FindMessageResult

type FindMessageResult struct {
	SubscriptionID  int64              `json:"subscriptionId,omitempty"`
	InstitutionCode string             `json:"institutionCode,omitempty"`
	Deleted         bool               `json:"deleted,omitempty"`
	Marked          bool               `json:"marked,omitempty"`
	Muted           bool               `json:"muted,omitempty"`
	Thread          *FindMessageThread `json:"thread,omitempty"`
	SearchMessage   *FoundMessage      `json:"searchMessage,omitempty"`
}

FindMessageResult is the result of a message search.

type FindMessageThread

type FindMessageThread struct {
	ID               string `json:"id,omitempty"`
	Subject          string `json:"subject,omitempty"`
	SensitivityLevel int    `json:"sensitivityLevel,omitempty"`
	IsForwarded      bool   `json:"isForwarded,omitempty"`
	ThreadType       string `json:"threadType,omitempty"`
}

FindMessageThread is the thread info for a found message.

type FoundMessage

type FoundMessage struct {
	ID            string       `json:"id,omitempty"`
	Text          *MessageText `json:"text,omitempty"`
	SendDateTime  string       `json:"sendDateTime,omitempty"`
	ThreadID      string       `json:"threadId,omitempty"`
	ThreadSubject string       `json:"threadSubject,omitempty"`
	Attachments   []Attachment `json:"attachments,omitempty"`
}

FoundMessage is a message found via search.

func (*FoundMessage) FileAttachmentURLs

func (m *FoundMessage) FileAttachmentURLs() []string

FileAttachmentURLs returns the URLs of the file attachments.

func (*FoundMessage) FileAttachments

func (m *FoundMessage) FileAttachments() []Attachment

FileAttachments returns the file attachments of the message.

func (*FoundMessage) HasFileAttachments

func (m *FoundMessage) HasFileAttachments() bool

HasFileAttachments reports whether the message has file attachments.

func (*FoundMessage) HasImageAttachments

func (m *FoundMessage) HasImageAttachments() bool

HasImageAttachments reports whether the message has image attachments.

func (*FoundMessage) ImageAttachmentURLs

func (m *FoundMessage) ImageAttachmentURLs() []string

ImageAttachmentURLs returns the full-size URLs of the image attachments.

func (*FoundMessage) ImageAttachments

func (m *FoundMessage) ImageAttachments() []Attachment

ImageAttachments returns the image attachments of the message.

func (*FoundMessage) TextHTML

func (m *FoundMessage) TextHTML() string

TextHTML returns the message text as HTML string.

type GalleryAlbum

type GalleryAlbum struct {
	ID                            int64         `json:"id,omitempty"`
	Title                         string        `json:"title,omitempty"`
	Description                   string        `json:"description,omitempty"`
	Creator                       *AlbumCreator `json:"creator,omitempty"`
	CreationDate                  string        `json:"creationDate,omitempty"`
	SharedWithGroups              []Group       `json:"sharedWithGroups,omitempty"`
	ThumbnailsURLs                []string      `json:"thumbnailsUrls,omitempty"`
	RegardingInstitutionProfileID int64         `json:"regardingInstitutionProfileId,omitempty"`
	CurrentUserCanEdit            bool          `json:"currentUserCanEdit,omitempty"`
	CurrentUserCanDelete          bool          `json:"currentUserCanDelete,omitempty"`
	CurrentUserCanAddMedia        bool          `json:"currentUserCanAddMedia,omitempty"`

	// IsDefaultMyChildAlbum indicates whether this is the default "my child" album
	// (generated dynamically by Aula).
	IsDefaultMyChildAlbum bool `json:"isDefaultMyChildAlbum,omitempty"`

	// Media in this album (populated by the client).
	Media []AlbumMedia `json:"media,omitempty"`
}

GalleryAlbum is a gallery album.

func (*GalleryAlbum) HasImages

func (a *GalleryAlbum) HasImages() bool

HasImages reports whether the album has images.

func (*GalleryAlbum) ImageURLs

func (a *GalleryAlbum) ImageURLs() []string

ImageURLs returns the full-size URLs of all media in the album.

func (*GalleryAlbum) Images

func (a *GalleryAlbum) Images() []AlbumMedia

Images returns the media of the album.

type Group

type Group struct {
	PortalRoles           []string `json:"portalRoles,omitempty"`
	ID                    int64    `json:"id,omitempty"`
	Name                  string   `json:"name,omitempty"`
	ShortName             string   `json:"shortName,omitempty"`
	InstitutionCode       string   `json:"institutionCode,omitempty"`
	InstitutionName       string   `json:"institutionName,omitempty"`
	MainGroup             bool     `json:"mainGroup,omitempty"`
	IsDeactivated         bool     `json:"isDeactivated,omitempty"`
	AllowMembersToBeShown bool     `json:"allowMembersToBeShown,omitempty"`
}

Group that a post can be shared with.

type InstitutionInfo

type InstitutionInfo struct {
	InstitutionCode         string                   `json:"institutionCode,omitempty"`
	InstitutionName         string                   `json:"institutionName,omitempty"`
	MunicipalityCode        string                   `json:"municipalityCode,omitempty"`
	MunicipalityName        string                   `json:"municipalityName,omitempty"`
	Type                    string                   `json:"type,omitempty"`
	AdministrativeAuthority *AdministrativeAuthority `json:"administrativeAuthority,omitempty"`
}

InstitutionInfo holds institution details of an owner profile.

type InstitutionProfile

type InstitutionProfile struct {
	ID                                          int64           `json:"id,omitempty"`
	ProfileID                                   int64           `json:"profileId,omitempty"`
	InstitutionCode                             string          `json:"institutionCode,omitempty"`
	InstitutionName                             string          `json:"institutionName,omitempty"`
	MunicipalityCode                            string          `json:"municipalityCode,omitempty"`
	MunicipalityName                            string          `json:"municipalityName,omitempty"`
	FirstName                                   string          `json:"firstName,omitempty"`
	LastName                                    string          `json:"lastName,omitempty"`
	FullName                                    string          `json:"fullName,omitempty"`
	Gender                                      string          `json:"gender,omitempty"`
	Role                                        string          `json:"role,omitempty"`
	InstitutionRole                             string          `json:"institutionRole,omitempty"`
	InstitutionType                             string          `json:"institutionType,omitempty"`
	AulaEmail                                   string          `json:"aulaEmail,omitempty"`
	Address                                     *Address        `json:"address,omitempty"`
	Email                                       string          `json:"email,omitempty"`
	HomePhoneNumber                             string          `json:"homePhoneNumber,omitempty"`
	MobilePhoneNumber                           string          `json:"mobilePhoneNumber,omitempty"`
	WorkPhoneNumber                             string          `json:"workPhoneNumber,omitempty"`
	MainGroup                                   string          `json:"mainGroup,omitempty"`
	ShortName                                   string          `json:"shortName,omitempty"`
	ProfilePictureURL                           string          `json:"profilePictureUrl,omitempty"`
	ProfilePicture                              *ProfilePicture `json:"profilePicture,omitempty"`
	NewInstitutionProfile                       bool            `json:"newInstitutionProfile,omitempty"`
	CommunicationBlocked                        bool            `json:"communicationBlocked,omitempty"`
	IsPrimary                                   bool            `json:"isPrimary,omitempty"`
	Birthday                                    string          `json:"birthday,omitempty"`
	InstitutionProfileDescriptions              any             `json:"institutionProfileDescriptions,omitempty"`
	LastActivity                                string          `json:"lastActivity,omitempty"`
	HasCustody                                  bool            `json:"hasCustody,omitempty"`
	Alias                                       bool            `json:"alias,omitempty"`
	Groups                                      any             `json:"groups,omitempty"`
	Relation                                    any             `json:"relation,omitempty"`
	IsInternalProfilePicture                    bool            `json:"isInternalProfilePicture,omitempty"`
	AccessLevel                                 any             `json:"accessLevel,omitempty"`
	CurrentUserCanViewContactInformation        bool            `json:"currentUserCanViewContactInformation,omitempty"`
	UserHasGivenConsentToShowContactInformation bool            `json:"userHasGivenConsentToShowContactInformation,omitempty"`
	Deactivated                                 bool            `json:"deactivated,omitempty"`
	ProfileStatus                               string          `json:"profileStatus,omitempty"`
	CurrentUserCanSeeProfileDescription         bool            `json:"currentUserCanSeeProfileDescription,omitempty"`
	CurrentUserCanEditProfileDescription        bool            `json:"currentUserCanEditProfileDescription,omitempty"`
	CurrentUserCanEditContactInformation        bool            `json:"currentUserCanEditContactInformation,omitempty"`
	CurrentUserCanEditProfilePicture            bool            `json:"currentUserCanEditProfilePicture,omitempty"`
	CurrentUserCanDeleteProfilePicture          bool            `json:"currentUserCanDeleteProfilePicture,omitempty"`
	ShouldShowDeclineConsentTwoWarning          bool            `json:"shouldShowDeclineConsentTwoWarning,omitempty"`
	ContactType                                 string          `json:"contactType,omitempty"`
	HasBlockedCommunicationChannels             bool            `json:"hasBlockedCommunicationChannels,omitempty"`
	Metadata                                    string          `json:"metadata,omitempty"`
}

InstitutionProfile representing a profile at an institution.

type InstitutionRole

type InstitutionRole string

InstitutionRole is the role of a profile at an institution.

const (
	InstitutionRoleTeacher          InstitutionRole = "teacher"
	InstitutionRoleLeader           InstitutionRole = "leader"
	InstitutionRolePreschoolTeacher InstitutionRole = "preschool-teacher"
)

func ParseInstitutionRole

func ParseInstitutionRole(value string) InstitutionRole

ParseInstitutionRole converts a string to an InstitutionRole, or "" when unknown.

type InvalidSessionError

type InvalidSessionError struct {
	APIError
}

InvalidSessionError is returned when the session ID (PHPSESSID) is no longer valid.

This occurs when Aula returns HTTP 403 with an internal status code of 448 (or similar).

func NewInvalidSessionError

func NewInvalidSessionError(msg string) *InvalidSessionError

NewInvalidSessionError creates a new InvalidSessionError with the given message, or a default message when msg is empty.

type InvitedGroup

type InvitedGroup struct {
	ID                    int64  `json:"id,omitempty"`
	Name                  string `json:"name,omitempty"`
	ShortName             string `json:"shortName,omitempty"`
	InstitutionCode       string `json:"institutionCode,omitempty"`
	InstitutionName       string `json:"institutionName,omitempty"`
	MainGroup             bool   `json:"mainGroup,omitempty"`
	UniGroupType          string `json:"uniGroupType,omitempty"`
	IsDeactivated         bool   `json:"isDeactivated,omitempty"`
	AllowMembersToBeShown bool   `json:"allowMembersToBeShown,omitempty"`
}

InvitedGroup is an invited group for a calendar event.

type LatestMessage

type LatestMessage struct {
	ID           string       `json:"id,omitempty"`
	SendDateTime string       `json:"sendDateTime,omitempty"`
	Text         *MessageText `json:"text,omitempty"`
}

LatestMessage is the latest message in a thread.

type Lesson

type Lesson struct {
	LessonID        string              `json:"lessonId,omitempty"`
	LessonStatus    string              `json:"lessonStatus,omitempty"`
	Participants    []LessonParticipant `json:"participants,omitempty"`
	HasRelevantNote bool                `json:"hasRelevantNote,omitempty"`
}

Lesson is a lesson for a calendar event.

type LessonParticipant

type LessonParticipant struct {
	TeacherID       int64  `json:"teacherId,omitempty"`
	TeacherName     string `json:"teacherName,omitempty"`
	TeacherInitials string `json:"teacherInitials,omitempty"`
	ParticipantRole string `json:"participantRole,omitempty"`
}

LessonParticipant is a lesson participant.

type MailBoxOwner

type MailBoxOwner struct {
	ProfileID        int64  `json:"profileId,omitempty"`
	PortalRole       string `json:"portalRole,omitempty"`
	IsDeactivated    bool   `json:"isDeactivated,omitempty"`
	MailBoxOwnerType string `json:"mailBoxOwnerType,omitempty"`
	ID               int64  `json:"id,omitempty"`
	IsDeleted        bool   `json:"isDeleted,omitempty"`
}

MailBoxOwner is the mailbox owner of a message.

type MailboxParticipant

type MailboxParticipant struct {
	ID               int64  `json:"id,omitempty"`
	MailBoxOwnerType string `json:"mailBoxOwnerType,omitempty"`
}

MailboxParticipant is a mailbox participant for message search.

type MainGroup

type MainGroup struct {
	ID                    int64  `json:"id,omitempty"`
	Name                  string `json:"name,omitempty"`
	ShortName             string `json:"shortName,omitempty"`
	InstitutionCode       string `json:"institutionCode,omitempty"`
	InstitutionName       string `json:"institutionName,omitempty"`
	MainGroup             bool   `json:"mainGroup,omitempty"`
	UniGroupType          string `json:"uniGroupType,omitempty"`
	IsDeactivated         bool   `json:"isDeactivated,omitempty"`
	AllowMembersToBeShown bool   `json:"allowMembersToBeShown,omitempty"`
}

MainGroup interface.

type MediaCreator

type MediaCreator struct {
	ProfileID       int64           `json:"profileId,omitempty"`
	ID              int64           `json:"id,omitempty"`
	InstitutionCode string          `json:"institutionCode,omitempty"`
	InstitutionName string          `json:"institutionName,omitempty"`
	Role            string          `json:"role,omitempty"`
	Name            string          `json:"name,omitempty"`
	ProfilePicture  *ProfilePicture `json:"profilePicture,omitempty"`
	MainGroup       string          `json:"mainGroup,omitempty"`
	ShortName       string          `json:"shortName,omitempty"`
	InstitutionRole string          `json:"institutionRole,omitempty"`
	Metadata        string          `json:"metadata,omitempty"`
}

MediaCreator is the creator of media.

type MediaFile

type MediaFile struct {
	ID      int64  `json:"id,omitempty"`
	Bucket  string `json:"bucket,omitempty"`
	Key     string `json:"key,omitempty"`
	URL     string `json:"url,omitempty"`
	Created string `json:"created,omitempty"`
	Name    string `json:"name,omitempty"`
}

MediaFile is media file info.

type MeeBook

type MeeBook struct {
	ID       int64  `json:"id,omitempty"`
	Title    string `json:"title,omitempty"`
	Category string `json:"category,omitempty"`
}

MeeBook is a book in MeeBook.

type MeeBookClient

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

MeeBookClient is a client for the MeeBook API (separate from Aula). Used to get weekly book and plan information.

func NewMeeBookClient

func NewMeeBookClient(childFilterCodes, institutionFilterIDs []string, weeklyBookAuthorizationToken, weeklyPlanAuthorizationToken string) *MeeBookClient

NewMeeBookClient creates a MeeBook client. The authorization tokens are obtained via the Aula client's aulaToken.getAulaToken endpoint (see MeeBookInformation).

func (*MeeBookClient) BookListForWeeks

func (c *MeeBookClient) BookListForWeeks(numberOfAdditionalFutureWeeks int) []MeeWeeklyBooks

BookListForWeeks gets book lists for the current week plus additional future weeks.

func (*MeeBookClient) Close

func (c *MeeBookClient) Close()

Close closes the HTTP client.

func (*MeeBookClient) RelatedWeeklyBook

func (c *MeeBookClient) RelatedWeeklyBook(year, weekNumber int) *MeeWeeklyBooks

RelatedWeeklyBook gets a specific week's book list. Returns nil on error or when empty.

func (*MeeBookClient) RelatedWorkPlan

func (c *MeeBookClient) RelatedWorkPlan(year, weekNumber int) *WeekPlanOverview

RelatedWorkPlan gets a specific week's work plan. Returns nil on error or when empty.

func (*MeeBookClient) WorkPlanForWeeks

func (c *MeeBookClient) WorkPlanForWeeks(numberOfAdditionalFutureWeeks int) []WeekPlanOverview

WorkPlanForWeeks gets work plans for the current week plus additional future weeks.

type MeeBookConsolidatedInformation

type MeeBookConsolidatedInformation struct {
	WorkPlan []WeekPlanOverview `json:"workPlan,omitempty"`
	BookList []MeeWeeklyBooks   `json:"bookList,omitempty"`
}

MeeBookConsolidatedInformation is consolidated MeeBook information (work plans + book lists).

type MeeWeeklyBooks

type MeeWeeklyBooks struct {
	ID       int64     `json:"id,omitempty"`
	Name     string    `json:"name,omitempty"`
	Unilogin string    `json:"unilogin,omitempty"`
	Books    []MeeBook `json:"books,omitempty"`
}

MeeWeeklyBooks is the weekly books list from MeeBook.

type Message

type Message struct {
	ID                 string       `json:"id,omitempty"`
	SendDateTime       string       `json:"sendDateTime,omitempty"`
	DeletedAt          string       `json:"deletedAt,omitempty"`
	Text               *MessageText `json:"text,omitempty"`
	HasAttachments     bool         `json:"hasAttachments,omitempty"`
	PendingMedia       bool         `json:"pendingMedia,omitempty"`
	MessageType        string       `json:"messageType,omitempty"`
	LeaverNames        []string     `json:"leaverNames,omitempty"`
	InviterName        string       `json:"inviterName,omitempty"`
	Sender             *Sender      `json:"sender,omitempty"`
	NewRecipients      any          `json:"newRecipients,omitempty"`
	OriginalRecipients any          `json:"originalRecipients,omitempty"`
	Attachments        []Attachment `json:"attachments,omitempty"`
	CanReplyToMessage  bool         `json:"canReplyToMessage,omitempty"`

	// Thread context (added by the client, not from Aula)
	ThreadID              int64   `json:"threadId,omitempty"`
	ThreadSubject         string  `json:"threadSubject,omitempty"`
	ThreadCreator         *Sender `json:"threadCreator,omitempty"`
	ThreadStartedDateTime string  `json:"threadStartedDateTime,omitempty"`
}

Message is a message within a thread.

func (*Message) FileAttachmentURLs

func (m *Message) FileAttachmentURLs() []string

FileAttachmentURLs returns the URLs of the file attachments.

func (*Message) FileAttachments

func (m *Message) FileAttachments() []Attachment

FileAttachments returns the file attachments of the message.

func (*Message) HasFileAttachments

func (m *Message) HasFileAttachments() bool

HasFileAttachments reports whether the message has file attachments.

func (*Message) HasImageAttachments

func (m *Message) HasImageAttachments() bool

HasImageAttachments reports whether the message has image attachments.

func (*Message) ImageAttachmentURLs

func (m *Message) ImageAttachmentURLs() []string

ImageAttachmentURLs returns the full-size URLs of the image attachments.

func (*Message) ImageAttachments

func (m *Message) ImageAttachments() []Attachment

ImageAttachments returns the image attachments of the message.

func (*Message) TextHTML

func (m *Message) TextHTML() string

TextHTML returns the message text as HTML string.

type MessageText

type MessageText struct {
	HTML string `json:"html,omitempty"`
}

MessageText is the text content of a message.

type MessagesForThread

type MessagesForThread struct {
	Messages              []Message         `json:"messages,omitempty"`
	FirstMessage          *Message          `json:"firstMessage,omitempty"`
	ThreadCreator         *Sender           `json:"threadCreator,omitempty"`
	ThreadStartedDateTime string            `json:"threadStartedDateTime,omitempty"`
	IsThreadForwarded     bool              `json:"isThreadForwarded,omitempty"`
	MoreMessagesExist     bool              `json:"moreMessagesExist,omitempty"`
	HasSecureDocuments    bool              `json:"hasSecureDocuments,omitempty"`
	Page                  int               `json:"page,omitempty"`
	TotalMessageCount     int               `json:"totalMessageCount,omitempty"`
	ThreadEntityLinkDTO   *ThreadEntityLink `json:"threadEntityLinkDto,omitempty"`
	ID                    int64             `json:"id,omitempty"`
	Subject               string            `json:"subject,omitempty"`
	Recipients            []Sender          `json:"recipients,omitempty"`
	ExtraRecipientsCount  int               `json:"extraRecipientsCount,omitempty"`
	Muted                 bool              `json:"muted,omitempty"`
	Marked                bool              `json:"marked,omitempty"`
	Sensitive             bool              `json:"sensitive,omitempty"`
	LastReadMessageID     string            `json:"lastReadMessageId,omitempty"`
	IsArchived            bool              `json:"isArchived,omitempty"`
	MailBoxOwner          *MailBoxOwner     `json:"mailBoxOwner,omitempty"`
	InstitutionCode       string            `json:"institutionCode,omitempty"`
}

MessagesForThread is a thread with all its messages.

func (*MessagesForThread) AllFileAttachmentURLs

func (t *MessagesForThread) AllFileAttachmentURLs() []string

AllFileAttachmentURLs returns the URLs of all file attachments.

func (*MessagesForThread) AllFileAttachments

func (t *MessagesForThread) AllFileAttachments() []Attachment

AllFileAttachments returns all file attachments of all messages.

func (*MessagesForThread) AllImageAttachmentURLs

func (t *MessagesForThread) AllImageAttachmentURLs() []string

AllImageAttachmentURLs returns the full-size URLs of all image attachments.

func (*MessagesForThread) AllImageAttachments

func (t *MessagesForThread) AllImageAttachments() []Attachment

AllImageAttachments returns all image attachments of all messages.

func (*MessagesForThread) AnyMessageHasAttachments

func (t *MessagesForThread) AnyMessageHasAttachments() bool

AnyMessageHasAttachments reports whether any message has attachments.

func (*MessagesForThread) AnyMessageHasFileAttachments

func (t *MessagesForThread) AnyMessageHasFileAttachments() bool

AnyMessageHasFileAttachments reports whether any message has file attachments.

func (*MessagesForThread) AnyMessageHasImageAttachments

func (t *MessagesForThread) AnyMessageHasImageAttachments() bool

AnyMessageHasImageAttachments reports whether any message has image attachments.

func (*MessagesForThread) ChildRecipients

func (t *MessagesForThread) ChildRecipients() []Sender

ChildRecipients returns the recipients whose portal role is child.

func (*MessagesForThread) EmployeeRecipients

func (t *MessagesForThread) EmployeeRecipients() []Sender

EmployeeRecipients returns the recipients whose portal role is employee.

func (*MessagesForThread) ParentRecipients

func (t *MessagesForThread) ParentRecipients() []Sender

ParentRecipients returns the recipients whose portal role is parent (guardian).

func (*MessagesForThread) SentToFewPeople

func (t *MessagesForThread) SentToFewPeople() bool

SentToFewPeople reports whether this thread is sent to few people (less than 10). Normal threads might be hundreds of recipients; a thread with only a few people is more relevant (not a "broadcast").

func (*MessagesForThread) SentToFewerPeopleThan

func (t *MessagesForThread) SentToFewerPeopleThan(count int) bool

SentToFewerPeopleThan reports whether this thread has fewer than count recipients.

type OwnerProfile

type OwnerProfile struct {
	ID             int64            `json:"id,omitempty"`
	ProfileID      int64            `json:"profileId,omitempty"`
	UniPersonID    int64            `json:"uniPersonId,omitempty"`
	FirstName      string           `json:"firstName,omitempty"`
	LastName       string           `json:"lastName,omitempty"`
	FullName       string           `json:"fullName,omitempty"`
	ShortName      string           `json:"shortName,omitempty"`
	Role           string           `json:"role,omitempty"`
	MailBoxID      int64            `json:"mailBoxId,omitempty"`
	Institution    *InstitutionInfo `json:"institution,omitempty"`
	Gender         string           `json:"gender,omitempty"`
	ProfilePicture *ProfilePicture  `json:"profilePicture,omitempty"`
	MainGroupName  string           `json:"mainGroupName,omitempty"`
	Metadata       string           `json:"metadata,omitempty"`
}

OwnerProfile is the owner profile of a post.

type PagedResult

type PagedResult[T any] struct {
	// Items in this page.
	Items []T `json:"items"`
	// Page is the current page index (0-based).
	Page int `json:"page"`
	// PageSize is the number of items requested per page.
	PageSize int `json:"pageSize"`
	// TotalSize is the total number of items available, when known.
	TotalSize *int `json:"totalSize,omitempty"`
	// HasMore indicates whether more pages are available.
	HasMore bool `json:"hasMore"`
}

PagedResult wraps a page of paginated API results.

func NewPagedResult

func NewPagedResult[T any](items []T, page, pageSize int, totalSize *int, hasMore bool) *PagedResult[T]

NewPagedResult creates a PagedResult.

func (*PagedResult[T]) IsFirstPage

func (p *PagedResult[T]) IsFirstPage() bool

IsFirstPage reports whether this is the first page.

func (*PagedResult[T]) IsLastPage

func (p *PagedResult[T]) IsLastPage() bool

IsLastPage reports whether this is the last page.

func (*PagedResult[T]) NextPage

func (p *PagedResult[T]) NextPage() int

NextPage returns the next page index, or -1 when there are no more pages.

type PortalRole

type PortalRole string

PortalRole is the portal role of a profile.

const (
	PortalRoleParent   PortalRole = "guardian"
	PortalRoleChild    PortalRole = "child"
	PortalRoleEmployee PortalRole = "employee"
)

func ParsePortalRole

func ParsePortalRole(value string) PortalRole

ParsePortalRole converts a string to a PortalRole, or "" when unknown.

type Post

type Post struct {
	ID                    int64         `json:"id,omitempty"`
	Title                 string        `json:"title,omitempty"`
	Content               *PostContent  `json:"content,omitempty"`
	Timestamp             string        `json:"timestamp,omitempty"`
	OwnerProfile          *OwnerProfile `json:"ownerProfile,omitempty"`
	AllowComments         bool          `json:"allowComments,omitempty"`
	SharedWithGroups      []Group       `json:"sharedWithGroups,omitempty"`
	PublishAt             string        `json:"publishAt,omitempty"`
	IsPublished           bool          `json:"isPublished,omitempty"`
	ExpireAt              string        `json:"expireAt,omitempty"`
	IsExpired             bool          `json:"isExpired,omitempty"`
	IsImportant           bool          `json:"isImportant,omitempty"`
	ImportantFrom         string        `json:"importantFrom,omitempty"`
	ImportantTo           string        `json:"importantTo,omitempty"`
	RelatedProfiles       []Profile     `json:"relatedProfiles,omitempty"`
	Attachments           []Attachment  `json:"attachments,omitempty"`
	PendingMedia          bool          `json:"pendingMedia,omitempty"`
	CommentCount          int           `json:"commentCount,omitempty"`
	CanCurrentUserDelete  bool          `json:"canCurrentUserDelete,omitempty"`
	CanCurrentUserReport  bool          `json:"canCurrentUserReport,omitempty"`
	CanCurrentUserComment bool          `json:"canCurrentUserComment,omitempty"`
	EditedAt              string        `json:"editedAt,omitempty"`
}

Post is a post from Aula.

func (*Post) FileAttachmentURLs

func (p *Post) FileAttachmentURLs() []string

FileAttachmentURLs returns the URLs of the file attachments.

func (*Post) FileAttachments

func (p *Post) FileAttachments() []Attachment

FileAttachments returns the file attachments of the post.

func (*Post) HasFileAttachments

func (p *Post) HasFileAttachments() bool

HasFileAttachments reports whether the post has file attachments.

func (*Post) HasImageAttachments

func (p *Post) HasImageAttachments() bool

HasImageAttachments reports whether the post has image attachments.

func (*Post) ImageAttachmentURLs

func (p *Post) ImageAttachmentURLs() []string

ImageAttachmentURLs returns the full-size URLs of the image attachments.

func (*Post) ImageAttachments

func (p *Post) ImageAttachments() []Attachment

ImageAttachments returns the image attachments of the post.

type PostContent

type PostContent struct {
	HTML string `json:"html,omitempty"`
}

PostContent is the content (HTML) of a post.

type PostsResponse

type PostsResponse struct {
	Posts                   []Post `json:"posts,omitempty"`
	ProfileLastSeenPostDate string `json:"profileLastSeenPostDate,omitempty"`
	HasMorePosts            bool   `json:"hasMorePosts,omitempty"`
}

PostsResponse is the wrapper for the posts.getAllPosts response.

type Profile

type Profile struct {
	InstitutionProfiles        []InstitutionProfile `json:"institutionProfiles,omitempty"`
	Children                   []Child              `json:"children,omitempty"`
	Age18AndOlder              bool                 `json:"age18AndOlder,omitempty"`
	OverConsentAge             bool                 `json:"overConsentAge,omitempty"`
	ContactInfoEditable        bool                 `json:"contactInfoEditable,omitempty"`
	PortalRole                 string               `json:"portalRole,omitempty"`
	IsLatestDataPolicyAccepted bool                 `json:"isLatestDataPolicyAccepted,omitempty"`
	SupportRole                bool                 `json:"supportRole,omitempty"`
	ProfileID                  int64                `json:"profileId,omitempty"`
	DisplayName                string               `json:"displayName,omitempty"`
	FullName                   string               `json:"fullName,omitempty"`
}

Profile representing a user profile.

func (*Profile) ChildByName

func (p *Profile) ChildByName(childNamePart string) *Child

ChildByName finds a child by partial name.

func (*Profile) InstitutionByName

func (p *Profile) InstitutionByName(institutionNamePart string) *InstitutionProfile

InstitutionByName finds an institution by partial name.

type ProfilePicture

type ProfilePicture struct {
	ID                    int64  `json:"id,omitempty"`
	Key                   string `json:"key,omitempty"`
	Bucket                string `json:"bucket,omitempty"`
	IsImageScalingPending bool   `json:"isImageScalingPending,omitempty"`
	URL                   string `json:"url,omitempty"`
}

ProfilePicture model.

type Profiles

type Profiles struct {
	Profiles []Profile `json:"profiles,omitempty"`
}

Profiles is the top-level data structure for the profiles.getProfilesByLogin response.

func (*Profiles) FirstProfile

func (p *Profiles) FirstProfile() *Profile

FirstProfile returns the first profile, or nil when there are none.

func (*Profiles) ProfileByDisplayName

func (p *Profiles) ProfileByDisplayName(displayNamePart string) *Profile

ProfileByDisplayName finds a profile by partial display name.

type Recipient

type Recipient struct {
	ID               string           `json:"id,omitempty"`
	InstitutionName  string           `json:"institutionName,omitempty"`
	InstitutionCode  string           `json:"institutionCode,omitempty"`
	Name             string           `json:"name,omitempty"`
	Description      string           `json:"description,omitempty"`
	MunicipalityName string           `json:"municipalityName,omitempty"`
	MunicipalityCode string           `json:"municipalityCode,omitempty"`
	AulaEmail        string           `json:"aulaEmail,omitempty"`
	PortalRole       string           `json:"portalRole,omitempty"`
	ProfileID        string           `json:"profileId,omitempty"`
	InstitutionRole  string           `json:"institutionRole,omitempty"`
	ShortName        string           `json:"shortName,omitempty"`
	RelatedProfiles  []RelatedProfile `json:"relatedProfiles,omitempty"`
	IsGroupMember    bool             `json:"isGroupMember,omitempty"`
}

Recipient is a recipient found via search (person, group, etc.).

func (*Recipient) Children

func (r *Recipient) Children() []RelatedProfile

Children returns the related profiles that are children.

func (*Recipient) InstitutionRoleEnum

func (r *Recipient) InstitutionRoleEnum() InstitutionRole

InstitutionRoleEnum returns the institution role as an enum.

func (*Recipient) Parents

func (r *Recipient) Parents() []RelatedProfile

Parents returns the related profiles that are parents.

func (*Recipient) PortalRoleEnum

func (r *Recipient) PortalRoleEnum() PortalRole

PortalRoleEnum returns the portal role as an enum.

func (*Recipient) Teachers

func (r *Recipient) Teachers() []RelatedProfile

Teachers returns the related profiles that are teachers.

type RegardingChild

type RegardingChild struct {
	ProfilePicture *ProfilePicture `json:"profilePicture,omitempty"`
	ShortName      string          `json:"shortName,omitempty"`
	ProfileID      int64           `json:"profileId,omitempty"`
	DisplayName    string          `json:"displayName,omitempty"`
}

RegardingChild is a child that a thread is regarding.

type RelatedProfile

type RelatedProfile struct {
	FirstName    string       `json:"firstName,omitempty"`
	LastName     string       `json:"lastName,omitempty"`
	ProfileID    int64        `json:"profileId,omitempty"`
	ID           int64        `json:"id,omitempty"`
	RelationType RelationType `json:"relationType,omitempty"`
	AulaEmail    string       `json:"aulaEmail,omitempty"`
	MainGroup    *MainGroup   `json:"mainGroup,omitempty"`
	Metadata     string       `json:"metadata,omitempty"`
}

RelatedProfile is a related profile (e.g. a parent, child, or teacher related to a recipient).

type RelationType

type RelationType string

RelationType is the type of relation between profiles.

const (
	RelationTypeParent  RelationType = "guardian"
	RelationTypeTeacher RelationType = "teacher"
	RelationTypeChild   RelationType = "child"
)

func ParseRelationType

func ParseRelationType(value string) RelationType

ParseRelationType converts a string to a RelationType, or "" when unknown.

type Sender

type Sender struct {
	ShortName          string          `json:"shortName,omitempty"`
	ProfilePicture     *ProfilePicture `json:"profilePicture,omitempty"`
	InstitutionCode    string          `json:"institutionCode,omitempty"`
	MailBoxOwner       *MailBoxOwner   `json:"mailBoxOwner,omitempty"`
	FullName           string          `json:"fullName,omitempty"`
	Metadata           string          `json:"metadata,omitempty"`
	AnswerDirectlyName string          `json:"answerDirectlyName,omitempty"`
}

Sender of a message.

type SessionProvider

type SessionProvider interface {
	// SessionID returns the current Aula session ID, or "" when none is known.
	SessionID() (string, error)
	// SaveSessionID persists a new session ID (called when Aula rotates it).
	SaveSessionID(id string) error
}

SessionProvider provides the Aula session ID (PHPSESSID) and persists a new one when Aula rotates it.

type StaticSessionProvider

type StaticSessionProvider struct {
	// ID is the session ID to use.
	ID string
	// OnRotate is called (if set) when Aula rotates the session ID.
	OnRotate func(newID string)
}

StaticSessionProvider returns a fixed session ID, e.g. from an environment variable:

aula.StaticSessionProvider{ID: os.Getenv("AULA_SESSION_ID")}

func (StaticSessionProvider) SaveSessionID

func (p StaticSessionProvider) SaveSessionID(id string) error

SaveSessionID invokes OnRotate when set.

func (StaticSessionProvider) SessionID

func (p StaticSessionProvider) SessionID() (string, error)

SessionID returns the static session ID.

type Tag

type Tag struct {
	ProfileID       int64          `json:"profileId,omitempty"`
	ID              int64          `json:"id,omitempty"`
	InstitutionCode string         `json:"institutionCode,omitempty"`
	InstitutionName string         `json:"institutionName,omitempty"`
	Role            string         `json:"role,omitempty"`
	Name            string         `json:"name,omitempty"`
	ProfilePicture  ProfilePicture `json:"profilePicture,omitempty"`
	MainGroup       string         `json:"mainGroup,omitempty"`
	ShortName       string         `json:"shortName,omitempty"`
	InstitutionRole string         `json:"institutionRole,omitempty"`
	Metadata        string         `json:"metadata,omitempty"`
}

Tag on media.

type Thread

type Thread struct {
	LeaveTime                     string            `json:"leaveTime,omitempty"`
	LatestMessage                 *LatestMessage    `json:"latestMessage,omitempty"`
	RegardingChildren             []RegardingChild  `json:"regardingChildren,omitempty"`
	Creator                       *Creator          `json:"creator,omitempty"`
	StartedTime                   string            `json:"startedTime,omitempty"`
	Read                          bool              `json:"read,omitempty"`
	IsThreadOrSubscriptionDeleted bool              `json:"isThreadOrSubscriptionDeleted,omitempty"`
	SubscriptionID                int64             `json:"subscriptionId,omitempty"`
	SubscriptionType              string            `json:"subscriptionType,omitempty"`
	NumberOfBundleItems           int               `json:"numberOfBundleItems,omitempty"`
	PrimarySubscriptionID         int64             `json:"primarySubscriptionId,omitempty"`
	ThreadEntityLinkDTO           *ThreadEntityLink `json:"threadEntityLinkDto,omitempty"`
	ID                            int64             `json:"id,omitempty"`
	Subject                       string            `json:"subject,omitempty"`
	Recipients                    []ThreadRecipient `json:"recipients,omitempty"`
	ExtraRecipientsCount          int               `json:"extraRecipientsCount,omitempty"`
	Muted                         bool              `json:"muted,omitempty"`
	Marked                        bool              `json:"marked,omitempty"`
	Sensitive                     bool              `json:"sensitive,omitempty"`
	LastReadMessageID             string            `json:"lastReadMessageId,omitempty"`
	IsArchived                    bool              `json:"isArchived,omitempty"`
	MailBoxOwner                  *MailBoxOwner     `json:"mailBoxOwner,omitempty"`
	InstitutionCode               string            `json:"institutionCode,omitempty"`
	Messages                      []Message         `json:"messages,omitempty"`
}

Thread is a conversation.

type ThreadEntityLink struct {
	EntityID   string `json:"entityId,omitempty"`
	ThreadType string `json:"threadType,omitempty"`
}

ThreadEntityLink is a thread entity link DTO.

type ThreadRecipient

type ThreadRecipient struct {
	LastReadMessageID  string          `json:"lastReadMessageId,omitempty"`
	LastReadTimestamp  string          `json:"lastReadTimestamp,omitempty"`
	LeaveTime          string          `json:"leaveTime,omitempty"`
	DeletedAt          string          `json:"deletedAt,omitempty"`
	ShortName          string          `json:"shortName,omitempty"`
	ProfilePicture     *ProfilePicture `json:"profilePicture,omitempty"`
	MailBoxOwner       *MailBoxOwner   `json:"mailBoxOwner,omitempty"`
	FullName           string          `json:"fullName,omitempty"`
	Metadata           string          `json:"metadata,omitempty"`
	AnswerDirectlyName string          `json:"answerDirectlyName,omitempty"`
}

ThreadRecipient is a recipient of a thread.

type ThreadsResponse

type ThreadsResponse struct {
	MoreMessagesExist bool     `json:"moreMessagesExist,omitempty"`
	Page              int      `json:"page,omitempty"`
	Threads           []Thread `json:"threads,omitempty"`
}

ThreadsResponse is the wrapper for the messaging.getThreads response.

type TimeSlot

type TimeSlot struct {
	TimeSlots     []TimeSlotItem `json:"timeSlots,omitempty"`
	ChildRequired bool           `json:"childRequired,omitempty"`
}

TimeSlot is a time slot for a calendar event.

type TimeSlotAnswer

type TimeSlotAnswer struct {
	ID                    int64 `json:"id,omitempty"`
	InstProfileID         int64 `json:"instProfileId,omitempty"`
	ConcerningProfileID   int64 `json:"concerningProfileId,omitempty"`
	SelectedTimeSlotIndex int   `json:"selectedTimeSlotIndex,omitempty"`
}

TimeSlotAnswer is a time slot answer for a calendar event.

type TimeSlotIndex

type TimeSlotIndex struct {
	StartTime string `json:"startTime,omitempty"`
	EndTime   string `json:"endTime,omitempty"`
}

TimeSlotIndex is a time slot index.

type TimeSlotItem

type TimeSlotItem struct {
	ID                int64            `json:"id,omitempty"`
	StartDate         string           `json:"startDate,omitempty"`
	EndDate           string           `json:"endDate,omitempty"`
	Answers           []TimeSlotAnswer `json:"answers,omitempty"`
	TimeSlotIndexes   []TimeSlotIndex  `json:"timeSlotIndexes,omitempty"`
	BelongsToResource any              `json:"belongsToResource,omitempty"`
}

TimeSlotItem is a time slot item for a calendar event.

type WeekPlanDay

type WeekPlanDay struct {
	Date  string         `json:"date,omitempty"`
	Tasks []WeekPlanTask `json:"tasks,omitempty"`
}

WeekPlanDay is a day in a week plan. Date is a Danish date string like "tir 15. okt".

func (*WeekPlanDay) FullDate

func (d *WeekPlanDay) FullDate() time.Time

FullDate resolves the partial Danish date (e.g. "tir 15. okt") to a full date in the current year.

func (*WeekPlanDay) HasTasks

func (d *WeekPlanDay) HasTasks() bool

HasTasks reports whether the day has any tasks.

type WeekPlanOverview

type WeekPlanOverview struct {
	ID       int64         `json:"id,omitempty"`
	Name     string        `json:"name,omitempty"`
	Unilogin string        `json:"unilogin,omitempty"`
	WeekPlan []WeekPlanDay `json:"weekPlan,omitempty"`
}

WeekPlanOverview is a week plan overview.

func (*WeekPlanOverview) IsEmptyOfTasks

func (w *WeekPlanOverview) IsEmptyOfTasks() bool

IsEmptyOfTasks reports whether this week is completely empty of tasks.

func (*WeekPlanOverview) WeekEndDate

func (w *WeekPlanOverview) WeekEndDate() time.Time

WeekEndDate returns the date of the last day in the week plan.

func (*WeekPlanOverview) WeekStartDate

func (w *WeekPlanOverview) WeekStartDate() time.Time

WeekStartDate returns the date of the first day in the week plan.

type WeekPlanTask

type WeekPlanTask struct {
	ID      int64  `json:"id,omitempty"`
	Type    string `json:"type,omitempty"`
	Group   string `json:"group,omitempty"`
	Pill    string `json:"pill,omitempty"`
	Content string `json:"content,omitempty"`
}

WeekPlanTask is a task in a week plan.

func (*WeekPlanTask) ContentLines

func (t *WeekPlanTask) ContentLines() []string

ContentLines returns the trimmed, non-empty content lines (lines that only contain dashes are considered empty).

func (*WeekPlanTask) ContentStringFiltered

func (t *WeekPlanTask) ContentStringFiltered() string

ContentStringFiltered returns the content lines joined with newlines.

func (*WeekPlanTask) PillTags

func (t *WeekPlanTask) PillTags() []string

PillTags returns the pill split into tags.

func (*WeekPlanTask) RelatedToATrip

func (t *WeekPlanTask) RelatedToATrip() bool

RelatedToATrip reports whether any of the content explicitly mentions a "tur" (trip in Danish).

Directories

Path Synopsis
cmd
goaula-login command
Command goaula-login opens a visible Chrome window for interactive Aula login and stores the captured session ID (PHPSESSID) in ~/.aula/session.txt, so the client library and the goaula-mcp MCP server can use it.
Command goaula-login opens a visible Chrome window for interactive Aula login and stores the captured session ID (PHPSESSID) in ~/.aula/session.txt, so the client library and the goaula-mcp MCP server can use it.
goaula-mcp command
Command goaula-mcp is an MCP server exposing the Aula API (via the aula client library) as read-only tools over stdio.
Command goaula-mcp is an MCP server exposing the Aula API (via the aula client library) as read-only tools over stdio.
Package login implements the interactive browser-based Aula login via MitID: it opens a visible Chrome/Chromium window, polls for the PHPSESSID cookie, handles Aula's "secure login" step-up through the UNI-Login SAML broker, and delivers QR code screenshots while the user has not completed the login.
Package login implements the interactive browser-based Aula login via MitID: it opens a visible Chrome/Chromium window, polls for the PHPSESSID cookie, handles Aula's "secure login" step-up through the UNI-Login SAML broker, and delivers QR code screenshots while the user has not completed the login.

Jump to

Keyboard shortcuts

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