gettr

package
v0.0.0-...-98542ce Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    string `json:"code"`
	Message string `json:"emsg"`
}

APIError is a result object when the API call fails

func (APIError) Error

func (e APIError) Error() string

type Client

type Client struct {
	User *UserService
	// contains filtered or unexported fields
}

Client is a Gettr Client

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new client

func (*Client) SetAuthToken

func (c *Client) SetAuthToken(username, userID, token string)

SetAuthToken sets the authentication username, userId and token for the actions that require permissions

type User

type User struct {
	Description string `json:"dsc"`
	Nickname    string `json:"nickname"`
	Username    string `json:"username"`
	Following   int    `json:"flw"`
	Followers   int    `json:"flg"`
	Language    string `json:"lang"`
	UpdateDate  uint64 `json:"udate"`
	CreateDate  uint64 `json:"cdate"`
	ID          string `json:"_id"`
}

User is an Gettr user details with description, followers/followings count, etc.

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService is an API for interacting with Users details

func (*UserService) Followers

func (s *UserService) Followers(id string) (*UsersCursor, error)

Followers returns a Cursor to the list of followers for the user id provided

func (*UserService) Following

func (s *UserService) Following(id string) (*UsersCursor, error)

Following returns a Cursor to the list of Users being followed for the user id provided

func (*UserService) Follows

func (s *UserService) Follows(username string) error

Follows the provided username, credentials must be set with Client.SetAuthToken

func (*UserService) Info

func (s *UserService) Info(username string) (*User, error)

Info retrieves an user detail bu username (not ID)

func (*UserService) Login

func (s *UserService) Login(email, sms, pwd string) error

func (*UserService) Unfollows

func (s *UserService) Unfollows(username string) error

Unfollows the provided username, credentials must be set with Client.SetAuthToken

type UsersCursor

type UsersCursor struct {
	UserID string
	Users  []User
	// contains filtered or unexported fields
}

UsersCursor is an iterable Cursor of Users

func (*UsersCursor) HasNext

func (uc *UsersCursor) HasNext() bool

HasNext returns if there is any other page left in this result-set

func (*UsersCursor) Iter

func (uc *UsersCursor) Iter(limit int) <-chan User

Iter allows a Cursor to be iterated in a for loop line any collection, abstracting out the API calls

func (*UsersCursor) Next

func (uc *UsersCursor) Next() (*UsersCursor, error)

Next returns the next Cursor in a paginated resul-set

Jump to

Keyboard shortcuts

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