mastoclient

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 6 Imported by: 0

README

Go Reference

mastoclient

Mastoclient is a wrapper for github.com/mattn/go-mastodon providing async get/post requests and a simple interface for the Mastodon API.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterApp

func RegisterApp(input *RegisterAppInput) (*mastodon.Application, error)

Types

type AsyncFollowers

type AsyncFollowers struct {
	Followers  []*mastodon.Account
	Pagination *mastodon.Pagination
	Err        error
}

AsyncAccount is a struct for returning ollowers asynchronously

type AsyncFollowing

type AsyncFollowing struct {
	Following  []*mastodon.Account
	Pagination *mastodon.Pagination
	Err        error
}

AsyncAccount is a struct for returning followings asynchronously

type AsyncGetAccountStatusesInput

type AsyncGetAccountStatusesInput struct {
	ID      string
	SinceID *string
	Ch      chan AsyncStatuses
}

AsyncGetAccountStatusesInput is a struct for getting statuses asynchronously

type AsyncGetFollowersInput

type AsyncGetFollowersInput struct {
	ID      string
	SinceID *string
	Ch      chan AsyncFollowers
}

AsyncGetFollowersInput is a struct for getting followers asynchronously

type AsyncGetFollowingInput

type AsyncGetFollowingInput struct {
	ID      string
	SinceID *string
	Ch      chan AsyncFollowing
}

AsyncGetFollowingInput is a struct for getting followings asynchronously

type AsyncGetNotificationsInput

type AsyncGetNotificationsInput struct {
	MaxID   *string
	SinceID *string
	MinID   *string
	Ch      chan AsyncNotices
}

AsyncGetNotificationsInput is a struct for getting notifications asynchronously

type AsyncNotices

type AsyncNotices struct {
	Notices []*mastodon.Notification
	Err     error
}

AsyncAccount is a struct for returning notices asynchronously

type AsyncStatuses

type AsyncStatuses struct {
	Statuses []*mastodon.Status
	Err      error
}

AsyncStatuses is a struct for returning statuses asynchronously

type Config

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

Config for the weather query

func New

func New(opts ...Option) (*Config, error)

NewConfig creates a new Config

func (*Config) AsyncGetAccountStatuses

func (c *Config) AsyncGetAccountStatuses(input *AsyncGetAccountStatusesInput)

AsyncGetAccountStatuses gets account statuses asynchronously

func (*Config) AsyncGetFollowers

func (c *Config) AsyncGetFollowers(input *AsyncGetFollowersInput)

AsyncGetFollowers gets followers asynchronously

func (*Config) AsyncGetFollowing

func (c *Config) AsyncGetFollowing(input *AsyncGetFollowingInput)

AsyncGetFollowing gets following asynchronously

func (*Config) AsyncGetNotifications

func (c *Config) AsyncGetNotifications(input *AsyncGetNotificationsInput)

AsyncGetNotifications gets notifications asynchronously

func (*Config) GetAuthTokenFromCode added in v1.0.1

func (c *Config) GetAuthTokenFromCode(authCode *string, redirectURI *string) (*string, error)

func (*Config) GetUserByID

func (c *Config) GetUserByID(id string) (*mastodon.Account, error)

GetUserByID gets a user by ID

func (*Config) Me

func (c *Config) Me() (*mastodon.Account, error)

Me gets the current user

func (*Config) Post

func (c *Config) Post(toot *mastodon.Toot) (*mastodon.ID, error)

Post a toot

func (*Config) SetAccessToken added in v1.0.2

func (c *Config) SetAccessToken(accessToken string)

SetAccessToken sets the access token

func (*Config) SetClientKey added in v1.0.2

func (c *Config) SetClientKey(clientKey string)

SetClientKey sets the client key

func (*Config) SetClientSecret added in v1.0.2

func (c *Config) SetClientSecret(clientSecret string)

SetClientSecret sets the client secret

func (*Config) SetInstance added in v1.0.2

func (c *Config) SetInstance(instance string)

SetInstance sets the instance

func (*Config) SetLogger added in v1.0.2

func (c *Config) SetLogger(log *zerolog.Logger)

SetLogger sets the logger

type NoAccessTokenError

type NoAccessTokenError struct {
	Err error
	Msg string
}

NoAccessTokenError error

func (*NoAccessTokenError) Error

func (e *NoAccessTokenError) Error() string

Error returns the error message

type NoClientKeyError

type NoClientKeyError struct {
	Err error
	Msg string
}

NoClientKeyError error

func (*NoClientKeyError) Error

func (e *NoClientKeyError) Error() string

Error returns the error message

type NoClientSecretError

type NoClientSecretError struct {
	Err error
	Msg string
}

NoClientSecretError error

func (*NoClientSecretError) Error

func (e *NoClientSecretError) Error() string

Error returns the error message

type NoInstanceError

type NoInstanceError struct {
	Err error
	Msg string
}

NoInstanceError error

func (*NoInstanceError) Error

func (e *NoInstanceError) Error() string

Error returns the error message

type Option

type Option func(c *Config)

Options for the weather query

func WithAccessToken

func WithAccessToken(accessToken string) Option

WithToken sets the token to use

func WithClientSecret

func WithClientSecret(clientSecret string) Option

WithClientSecret sets the client secret to use

func WithClientkey

func WithClientkey(clientKey string) Option

WithClientID sets the client ID to use

func WithInstance

func WithInstance(instance string) Option

WithInstance sets the instance to use

func WithLogger

func WithLogger(log *zerolog.Logger) Option

WithLogger sets the logger to use

type PostFailedError

type PostFailedError struct {
	Err error
	Msg string
}

PostFailedError error

func (*PostFailedError) Error

func (e *PostFailedError) Error() string

Error returns the error message

type RegisterAppInput

type RegisterAppInput struct {
	ClientName  string
	InstanceURL string
	RedirectURI string
	Scopes      []string
	Website     string
}

Jump to

Keyboard shortcuts

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