Documentation ¶
Overview ¶
Package pknulms implements LMS client for Pukyong National University.
Index ¶
- type Client
- func (c *Client) GetNotificationContent(n *Notification) (string, error)
- func (c *Client) GetNotifications(start, count int) (result []*Notification, e error)
- func (c *Client) GetNotificationsByPage(page int) (result []*Notification, e error)
- func (c *Client) Login(id, pw string) (bool, error)
- func (c *Client) Logout() error
- func (c *Client) MustGetNotificationContent(n *Notification) string
- func (c *Client) MustGetNotifications(start, count int) []*Notification
- func (c *Client) MustGetNotificationsByPage(page int) []*Notification
- func (c *Client) MustLogin(id, pw string) bool
- func (c *Client) MustLogout()
- func (c *Client) MustSendNote(to, title, content string)
- func (c *Client) SendNote(to, title, content string) error
- type Lecture
- type Notification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper for a single http.Client instance.
func MustNewClient ¶
func MustNewClient() *Client
MustNewClient attempts to create a new client, panics when an error has occurred.
func (*Client) GetNotificationContent ¶
func (c *Client) GetNotificationContent(n *Notification) (string, error)
GetNotificationContent returns content of given notification. The result contains HTML codes, not plain text.
func (*Client) GetNotifications ¶
func (c *Client) GetNotifications(start, count int) (result []*Notification, e error)
GetNotifications returns a slice of notifications for given start offset and count. Note that start offset begins from 1 so the FIRST notification would be at offset 1, not 0. Weirdly, it seems that the count must be >= 8 because of some mysterious reasons.
func (*Client) GetNotificationsByPage ¶
func (c *Client) GetNotificationsByPage(page int) (result []*Notification, e error)
GetNotificationsByPage returns a slice of notifications for given page. The default page size(notifications per page) is 20. If you want to change the page size, you can use GetNotifications.
func (*Client) MustGetNotificationContent ¶
func (c *Client) MustGetNotificationContent(n *Notification) string
MustGetNotificationContent returns content of given notification. The result contains HTML codes, not plain text.
func (*Client) MustGetNotifications ¶
func (c *Client) MustGetNotifications(start, count int) []*Notification
MustGetNotifications returns a slice of notifications for given start offset and count, panics when an error has occurred. Note that start offset begins from 1 so the FIRST notification would be at offset 1, not 0.
func (*Client) MustGetNotificationsByPage ¶
func (c *Client) MustGetNotificationsByPage(page int) []*Notification
MustGetNotificationsByPage returns a slice of notifications for given page, panics when an error has occurred.
func (*Client) MustLogout ¶
func (c *Client) MustLogout()
MustLogout attempts to logout, panics when an error has occurred.
func (*Client) MustSendNote ¶
MustSendNote sends note to a person with given title and content, panics when an error has occurred.
type Notification ¶
type Notification struct { ID int Link string Type string Title string Datetime string Submitted bool Lecture *Lecture Professor string PreviewContent string }
Notification represents a single notification. Datetime field might hold different datetime format for different type of notifications. Submitted field holds a boolean value whether the assignment has assigned or not if the Type of notification is assignment(in string form, "과제") else always false.
func (*Notification) String ¶
func (n *Notification) String() string
String returns a string representation of a notification in form of {Type: Title}.