auth

package
v0.0.0-...-0c2c550 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURL = "https://news.ycombinator.com"

Variables

This section is empty.

Functions

func Login

func Login(username, password string) (*http.Client, error)

Login returns a *http.Client populated with the `user` cookie set upon successful login.

func Token

func Token(token string) (*http.Client, error)

Token returns a *http.Client with a manually-set `user` cookie.

Types

type User

type User struct {
	Username string
	Password string
	Token    string
}

func (User) NewClient

func (u User) NewClient() (*http.Client, error)

NewClient returns a *http.Client authenticated with the given user.

func (User) NewRequest

func (u User) NewRequest(saveType, itemType string, page int) (*url.URL, error)

NewRequest returns a request URL with query parameters set to the given values.

Jump to

Keyboard shortcuts

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