talk

package
v0.0.0-...-1f412bb Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Path       string
	Url        string
	Admin      string
	Api_key    string
	Sso_secret string
}

func (*Api) Add_to_group

func (api *Api) Add_to_group(group string, users ...*User) error

func (*Api) All_groups

func (api *Api) All_groups() map[string]int

Discourse groups as groups[name] == id

func (*Api) Encode_sso_rsp

func (api *Api) Encode_sso_rsp(q url.Values) (payload, sig string)

func (*Api) Get_user

func (api *Api) Get_user(id int) (*User, error)

func (*Api) Get_user_by_email

func (api *Api) Get_user_by_email(email string) (*User, error)

func (*Api) Get_user_by_external_id

func (api *Api) Get_user_by_external_id(external_id int) (*User, error)

func (*Api) Message_user

func (api *Api) Message_user(title, message string, users ...*User)

func (*Api) Parse_sso_req

func (api *Api) Parse_sso_req(q url.Values) (payload url.Values)

func (*Api) Sync

func (api *Api) Sync(external_id int, username, email, name string) (*User, error)

type Message

type Message struct {
	Url             string
	Title           string
	Read            bool
	Last_post       time.Time
	First_post      time.Time
	Reply_count     int
	Poster_avatars  map[string]string
	Last_poster     string
	Original_poster string
}

TODO: grab external_id from posters

type User

type User struct {
	External_id    int
	Id             int
	Username       string
	Admin          bool
	Avatar_tmpl    string
	Title          string
	Groups         map[string]int
	Bio            string
	Website_url    string
	Website_name   string
	Location       string
	Card_bg_url    string
	Profile_bg_url string
	*Api
}

func (*User) Add_to_group

func (t *User) Add_to_group(group string) error

func (*User) Get_messages

func (t *User) Get_messages(limit int) []*Message

func (*User) Logout

func (t *User) Logout()

func (*User) Remove_from_group

func (t *User) Remove_from_group(group string)

Jump to

Keyboard shortcuts

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