client

package
v0.0.0-...-72e0805 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forum

type Forum struct {
	Title string
	ID    int
}

Forum represents a S1 Forum.

type Post

type Post struct {
	Author   string
	PostTime time.Time
	Content  string
	Thread   Thread
}

Post represents a post in a thread.

type S1Client

type S1Client struct {
	HttpClient *http.Client
	Cookies    []*http.Cookie
}

S1Client helps us interact with s1 backend with a presistant cookie.

func NewS1Client

func NewS1Client() *S1Client

NewS1Client creates a new S1 client.

func (*S1Client) GetForums

func (s *S1Client) GetForums() (forums []Forum, err error)

GetForums returns forums that are visiable to this user.

func (*S1Client) GetPosts

func (s *S1Client) GetPosts(thread Thread, page int) (posts []*Post, err error)

GetPosts returns posts of some thread at some page.

func (*S1Client) GetThreads

func (s *S1Client) GetThreads(forum Forum, page int) (threads []Thread, err error)

GetThreads returns threads in some forum at some page.

func (*S1Client) Login

func (s *S1Client) Login(username string, password string) (err error)

Login retrieve S1 Cookie by simulate user's login. S1Client will use the same cookie for following requests.

type Thread

type Thread struct {
	Title string
	ID    int
	Reply int
	Forum Forum
}

Thread represents a discussion thread in a forum.

Jump to

Keyboard shortcuts

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