houmweke

package module
v0.0.0-...-c8a985c Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmailUnknown      = errors.New("houmweke: email unknown")
	ErrEmailRegistered   = errors.New("houmweke: email already registered")
	ErrPasswordIncorrect = errors.New("houmweke: password incorrect")
	ErrPasswordInvalid   = errors.New("houmweke: password does not follow requirements")
	ErrNotLoggedIn       = errors.New("houmweke: not logged in")
)

Functions

func GenerateAuthURL

func GenerateAuthURL(clientId, redirectURI string, scopes ...string) string

Types

type Chat

type Chat struct {
	Id   ChatId
	Name string

	CreatedAt time.Time `json:"created_at"`

	IsDirect      bool `json:"is_direct"`
	BroadcastOnly bool `json:"broadcast_only"`

	FilesAllowed         bool `json:"files_allowed"`
	EveryoneCanStartCall bool `json:"everybody_can_start_call"`

	UnreadMessages int `json:"unread_messages"`

	IsMuted  bool `json:"is_muted"`
	IsPinned bool `json:"is_pinned"`
	IsAdmin  bool `json:"is_admin"`

	CanWrite     bool `json:"can_write"`
	CanSendFiles bool `json:"can_send_files"`
	CanStartCall bool `json:"can_start_call"`
	CanEdit      bool `json:"can_edit"`

	LastMessage Message `json:"last_message"`
}

type ChatId

type ChatId uint

type Date

type Date struct {
	Time time.Time
}

func (Date) MarshalText

func (d Date) MarshalText() ([]byte, error)

func (Date) String

func (d Date) String() string

func (*Date) UnmarshalText

func (d *Date) UnmarshalText(b []byte) error

type Error

type Error struct {
	Name    string
	Message string
	Code    int
}

func (Error) Error

func (e Error) Error() string

type File

type File struct {
	Id uint

	Hash         string
	SHA1Checksum string `json:"sha1_checksum"`

	Name        string
	ContentType string `json:"content_type"`
	Size        uint

	IsPublic bool `json:"is_public"`

	UploadedAt time.Time `json:"uploaded"`

	URL string

	CanDelete bool `json:"can_delete"`

	Type      string
	TypeEmoji string `json:"type_emoji"`
}

type FileRelation

type FileRelation string
const (
	FileMessage FileRelation = "chat-message-file-new"
)

type FrameParseError

type FrameParseError struct {
	Path string
	HTML []*html.Node
}

func (FrameParseError) Error

func (e FrameParseError) Error() string

type Homework

type Homework struct {
	Id HomeworkId

	Text string

	Note      string
	NoteHTML  string `json:"note_formatted"`
	NoteBasic string `json:"note_basic"`

	PostedOn time.Time `json:"posted_on"`
	Until    time.Time `json:"until_datetime"`

	IsScheduled bool `json:"is_scheduled"`
	IsUpdated   bool `json:"is_updated"`

	Lesson Lesson

	IsChecked bool `json:"is_checked"`
	CanCheck  bool `json:"can_check"`

	IsSubmittable bool `json:"is_submissionable"`

	CanCorrect bool `json:"can_correct"`
}

type HomeworkId

type HomeworkId uint

type Homeworker

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

func (*Homeworker) Chat

func (h *Homeworker) Chat(id ChatId) (Chat, error)

func (*Homeworker) ChatMembers

func (h *Homeworker) ChatMembers(id ChatId) ([]User, error)

func (*Homeworker) ChatMessages

func (h *Homeworker) ChatMessages(id ChatId, before MessageId) ([]Message, error)

func (*Homeworker) Chats

func (h *Homeworker) Chats() ([]Chat, error)

func (*Homeworker) CheckHomework

func (h *Homeworker) CheckHomework(id HomeworkId) error

func (*Homeworker) Code

func (h *Homeworker) Code(clientId, clientSecret, code string) (string, error)

func (*Homeworker) CreateChat

func (h *Homeworker) CreateChat(name string, filesAllowed, everybodyCanStartCall, broadcastOnly bool) (Chat, error)

func (*Homeworker) DeleteFile

func (d *Homeworker) DeleteFile(hash string) error

func (*Homeworker) DeleteHomework

func (h *Homeworker) DeleteHomework(id HomeworkId) (Homework, error)

func (*Homeworker) DeleteMessage

func (h *Homeworker) DeleteMessage(chat ChatId, message MessageId) error

func (*Homeworker) EndPhaseSession

func (h *Homeworker) EndPhaseSession(id PhaseSessionId) (time.Time, error)

func (*Homeworker) Files

func (h *Homeworker) Files(relation FileRelation) ([]File, error)

func (*Homeworker) FormatText

func (h *Homeworker) FormatText(s string) (Text, error)

func (*Homeworker) Homework

func (h *Homeworker) Homework(id HomeworkId) (Homework, error)

func (*Homeworker) Homeworks

func (h *Homeworker) Homeworks() ([]Homework, error)

func (*Homeworker) LessonContents

func (h *Homeworker) LessonContents(from, to Date) ([]LessonContent, error)

func (*Homeworker) Lessons

func (h *Homeworker) Lessons() ([]Lesson, error)

func (*Homeworker) Login

func (h *Homeworker) Login(email, password string) error

func (*Homeworker) MarkMessageAsLastRead

func (h *Homeworker) MarkMessageAsLastRead(chat ChatId, message MessageId) (Message, error)

func (*Homeworker) Me

func (h *Homeworker) Me() (Me, error)

func (*Homeworker) MuteChat

func (h *Homeworker) MuteChat(id ChatId, mute bool) error

func (*Homeworker) News

func (h *Homeworker) News() ([]News, error)

func (*Homeworker) PinChat

func (h *Homeworker) PinChat(id ChatId, pin bool) error

func (*Homeworker) Poll

func (h *Homeworker) Poll(chat ChatId, poll PollId) (Poll, error)

func (*Homeworker) PollVote

func (h *Homeworker) PollVote(chat ChatId, poll PollId, option OptionId) (Poll, error)

func (*Homeworker) RefreshToken

func (h *Homeworker) RefreshToken(clientId, clientSecret, refreshToken string) error

func (*Homeworker) Register

func (h *Homeworker) Register(email, password string) error

func (*Homeworker) Representations

func (h *Homeworker) Representations() ([]Representation, error)

func (*Homeworker) SendMessage

func (h *Homeworker) SendMessage(id ChatId, text string, files bool) (Message, error)

func (*Homeworker) SendPollMessage

func (h *Homeworker) SendPollMessage(id ChatId, text string, anonymous, multipleChoice bool, options ...string) (Message, error)

func (*Homeworker) SetChat

func (h *Homeworker) SetChat(id ChatId, name string, filesAllowed, everybodyCanStartCall, broadcastOnly bool) (Chat, error)

func (*Homeworker) StartPhaseSession

func (h *Homeworker) StartPhaseSession(lessonId LessonId) (PhaseSessionId, error)

func (*Homeworker) UploadFile

func (h *Homeworker) UploadFile(relation FileRelation, name string, r io.Reader) (File, error)

func (*Homeworker) Websocket

func (h *Homeworker) Websocket(ctx context.Context, c chan<- interface{}) error

type Lesson

type Lesson struct {
	Id LessonId

	Name      string
	ShortName string `json:"short"`

	Teacher string
}

type LessonContent

type LessonContent struct {
	Id LessonContentId

	IsPublished bool `json:"is_published"`
	IsScheduled bool `json:"is_scheduled"`

	Text      string
	TextHTML  string `json:"text_formatted"`
	TextBasic string `json:"text_basic"`

	Date Date

	Lesson
}

type LessonContentId

type LessonContentId uint

type LessonId

type LessonId uint

type Me

type Me struct {
	User

	NameIsEditable bool `json:"name_is_editable"`

	IsPro     bool `json:"is_pro"`
	IsStudent bool `json:"is_student"`
	IsTeacher bool `json:"is_teacher"`

	Mail           string
	MailVerified   bool `json:"mail_verified"`
	MailIsEditable bool `json:"mail_is_editable"`

	Mobile           string
	MobileVerified   bool `json:"mobile_verified"`
	MobileIsEditable bool `json:"mobile_is_editable"`

	Birthday           Date
	BirthdayIsEditable bool `json:"birthday_is_editable"`

	RegisteredAt time.Time `json:"registered_at"`
	LastSeenAt   time.Time `json:"last_seen_at"`
}

type Message

type Message struct {
	Id     MessageId
	ChatId ChatId `json:"chat_id"`

	Text      string
	TextHTML  string `json:"text_formatted"`
	TextBasic string `json:"text_basic"`

	User User

	Type   MessageType `json:"meta_type"`
	SentAt time.Time   `json:"sent_at"`

	IsOwn bool `json:"is_own"`

	CanDelete bool `json:"can_delete"`

	Files []File
	Poll  Poll
}

type MessageDeletion

type MessageDeletion struct {
	Id MessageId
}

type MessageId

type MessageId uint

type MessageType

type MessageType string
const (
	ChatCreated MessageType = "chat.created"
)

type News

type News struct {
	Id    uint
	Title string

	Text      string
	TextHTML  string `json:"text_formatted"`
	TextBasic string `json:"text_basic"`

	PublishedAt    time.Time `json:"published_at"`
	PublishedUntil time.Time `json:"published_until"`

	Pinned bool
}

type OptionId

type OptionId uint

type PhaseSessionId

type PhaseSessionId uint

type Poll

type Poll struct {
	Id PollId

	IsAnonymous      bool `json:"is_anonymous"`
	IsMultipleChoice bool `json:"is_multiple_choice"`

	Options []PollOption

	TotalVotes int  `json:"total_votes"`
	IsClosed   bool `json:"is_closed"`
}

type PollId

type PollId uint

type PollOption

type PollOption struct {
	Id   OptionId
	Text string

	IsVoted    bool   `json:"is_voted"`
	UsersVoted []User `json:"users_voted"`
	Votes      int
}

type Representation

type Representation struct {
	From time.Time
	To   time.Time

	OldSubject, NewSubject string
	OldTeacher, NewTeacher string
	OldRoom, NewRoom       string
}

type Text

type Text struct {
	Text  string
	HTML  string
	Basic string
}

type User

type User struct {
	Id   UserId
	Name string

	Badges UserBadges

	Presence struct {
		IsOnline bool `json:"is_online"`
	}

	AvatarURL string `json:"avatar_url"`

	IsMe    bool `json:"is_me"`
	IsAdmin bool `json:"is_admin"`
}

type UserBadges

type UserBadges map[string]string

func (*UserBadges) UnmarshalJSON

func (u *UserBadges) UnmarshalJSON(b []byte) error

type UserId

type UserId uint

type WebsocketRaw

type WebsocketRaw struct {
	Type string
	Data json.RawMessage
}

Jump to

Keyboard shortcuts

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