auth

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

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

Go to latest
Published: Feb 4, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Username string
	LoggedIn bool
	// contains filtered or unexported fields
}

Session manages HN authentication state.

func NewSession

func NewSession() *Session

NewSession creates a new auth session.

func (*Session) Edit

func (s *Session) Edit(itemID int, text string) error

Edit updates the text of an existing HN comment within the edit window.

func (*Session) GetClient

func (s *Session) GetClient() *http.Client

GetClient returns the underlying HTTP client (with cookies).

func (*Session) Load

func (s *Session) Load(path string) bool

Load restores a session from a file and validates it's still good. Returns true if the session was restored successfully.

func (*Session) Login

func (s *Session) Login(username, password string) error

Login authenticates with HN using username and password.

func (*Session) Reply

func (s *Session) Reply(parentID int, text string) error

Reply posts a reply to an HN item.

func (*Session) Save

func (s *Session) Save(path string) error

Save persists the session cookies to a file.

func (*Session) Submit

func (s *Session) Submit(title, storyURL, text string) error

Submit posts a new story to HN.

func (*Session) Vote

func (s *Session) Vote(itemID int) error

Vote upvotes an HN item.

Jump to

Keyboard shortcuts

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