icas

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OnlineCourseRoom is the room number used to mark an online course.
	OnlineCourseRoom = "99"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool string

Bool is a mapping type to represent the ICAS bool values.

const (
	// True represents the value for "true" used by the ICAS system.
	True Bool = "1"

	// False represents the value for "false" used by the ICAS system.
	False Bool = "0"
)

type Center

type Center struct {
	CenterID string `json:"center_id"`

	Contact
}

type Client

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

Client is used to operate with the ICAS system.

func NewClient

func NewClient(url string, creds LoginCredentials) (*Client, error)

NewClient creates a new ICAS client. The ICAS client is needed to operate with ICAS.

func (Client) FetchAllContactAttributes

func (c Client) FetchAllContactAttributes(contactID string) ([]ContactAttribute, error)

func (Client) FetchAllCourseSubjects

func (c Client) FetchAllCourseSubjects() ([]CourseSubject, error)

func (Client) FetchAllDebitors

func (c Client) FetchAllDebitors() ([]FullContact, error)

func (Client) FetchAllEmployees

func (c Client) FetchAllEmployees() ([]FullContact, error)

func (Client) FetchAllPupils

func (c Client) FetchAllPupils() ([]FullContact, error)

func (Client) FetchAllTeachers

func (c Client) FetchAllTeachers() ([]FullContact, error)

func (Client) FetchCenters

func (c Client) FetchCenters() ([]Center, error)

func (Client) FetchCourses

func (c Client) FetchCourses(date string) ([]Course, error)

func (Client) FetchFullContact

func (c Client) FetchFullContact(id string) (*FullContact, error)

func (Client) FetchMeetings

func (c Client) FetchMeetings(courseID string) ([]Meeting, error)

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) SwitchToCenter

func (c *Client) SwitchToCenter(id string) error

SwitchToCenter switches to the specified center by the given id.

type Contact

type Contact struct {
	ContactID string `json:"contact_id"`
	// Center         string `json:"center"`
	// Alpha          string `json:"alpha"`
	// Group          string `json:"group"`
	LastName  string `json:"name"`
	FirstName string `json:"firstname"`
	// Title          string `json:"title"`
	// Birthdate      string `json:"birthdate"`
	// Gender         string `json:"gender"`
	// Company        string `json:"company"`
	// Salutation     string `json:"salutation"`
	DisplayName string `json:"display_name"`
}

type ContactAttribute

type ContactAttribute struct {
	ContactAttributeID string `json:"contact_attribute_id"`
	// ContactID          string `json:"contact_id"`
	Key   ContactAttributeKey `json:"key"`
	Value string              `json:"value"`
}

type ContactAttributeKey

type ContactAttributeKey string

ContactAttributeKey represents attribute keys of a contact.

const (
	// ZoomPMI represents the contact attribute key of the zoom pmi.
	ZoomPMI ContactAttributeKey = "zoompmi"
)

type Course

type Course struct {
	CourseID           string `json:"course_id"`
	CenterID           string `json:"center_id"`
	TeacherID          string `json:"teacher_id"`
	TeacherDisplayName string `json:"teacher_display_name"`
	// Day                         string         `json:"day"`
	Room string `json:"room"`
	// StatsOn                     string         `json:"starts_on"`
	// EndsOn                      string         `json:"ends_on"`
	StartsAt string `json:"starts_at"`
	EndsAt   string `json:"ends_at"`
	// Duration                    string         `json:"duration"`
	// MaxMembers                  string         `json:"max_members"`
	// Vacation                    Bool           `json:"vacation"`
	SubjectShort string `json:"subject_short"`
	Draft        Bool   `json:"draft"`
	// FixedFee                    string         `json:"fixed_fee"`
	// CreatedAt                   string         `json:"created_at"`
	// ModifiedAt                  string         `json:"modified_at"`
	// SubtituteID                 string `json:"substitute_id"`
	SubtituteTeacherID          string `json:"substitute_teacher_id"`
	SubtituteTeacherDisplayName string `json:"substitute_teacher_display_name"`
	Dropped                     Bool   `json:"dropped"`
	// BG                          string         `json:"bg"`
	TeacherAttendanceID string `json:"teacher_attendance_id"`
	// NeedsDocumentation          Bool           `json:"needs_documentation"`
	CourseMembers []CourseMember `json:"course_member"`
	// Quarter                     int            `json:"quarter"`
	CourseMembersTotal   int `json:"course_members_total"`
	CourseMembersExcused int `json:"course_members_excused"`
}

Course is a list containing ICAS courses.

type CourseMember

type CourseMember struct {
	// CourseMemberID      string `json:"course_member_id"`
	PupilID string `json:"pupil_id"`
	// CourseID            string `json:"course_id"`
	SubjectShort string `json:"subject_short"`
	// Day                 string `json:"day"`
	// StartsOn            string `json:"starts_on"`
	// EndsOn              string `json:"ends_on"`
	// Postponed           Bool   `json:"postponed"`
	Draft    Bool `json:"draft"`
	External Bool `json:"external"`
	// CreatedAt           string `json:"created_at"`
	// ModifiedAt          string `json:"modified_at"`
	// PupilAttendanceID   string `json:"pupil_attendance_id"`
	AttendanceType string `json:"attendance_type"`
}

CourseMember holds any information about a course' member.

type CourseSubject

type CourseSubject struct {
	// SubjectID  string `json:"subject_id"`
	Short   string `json:"short"`
	Subject string `json:"subject"`
}

type Email

type Email struct {
	// EmailID    string `json:"email_id"`
	// ContactID  string `json:"contact_id"`
	Email string `json:"email"`
}

type ErrorResponseData

type ErrorResponseData struct {
	Type   string `json:"type"`
	Title  string `json:"title"`
	Status uint16 `json:"status"`
	Detail string `json:"detail"`
}

ErrorResponseData contains the error information when a request failed somehow.

type FullContact

type FullContact struct {
	Contact Contact          `json:"contact"`
	Phones  map[string]Phone `json:"phone"`
	Emails  map[string]Email `json:"email"`
}

type LoginCredentials

type LoginCredentials struct {
	Email    string
	Password string
}

LoginCredentials struct stores the login credentials needed to login to ICAS.

type Meeting

type Meeting struct {
	// MeetingID           string `json:"meeting_id"`
	// CourseID            string `json:"course_id"`
	// MeetingNumber       string `json:"meeting_number"`
	// JoinURL             string `json:"join_url"`
	// PasswordPlain       string `json:"password_plain"`
	// CreatedAt           string `json:"created_at"`
	// CourseTeacherID     string `json:"course_teacher_id"`
	TeacherZoomPMI string `json:"teacher_zoompmi"`
	TeacherPMURL   string `json:"teacher_pm_url"`
}

type Phone

type Phone struct {
	// PhoneID      string `json:"phone_id"`
	// ContactID    string `json:"contact_id"`
	Phone string `json:"phone"`
}

Jump to

Keyboard shortcuts

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