mastodon

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VisibilityUnknown = iota
	VisibilityPublic
	VisibilityUnlisted
	VisibilityFollowersOnly
	VisibilityDirectMessage
)

Variables

This section is empty.

Functions

func VisibilityList

func VisibilityList() []string

VisibilityList function returns list of Visibility strings.

Types

type Mastodon

type Mastodon struct {
	Server       string `json:"server"`
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	AccessToken  string `json:"access_token"`
	// contains filtered or unexported fields
}

Mastodon is configuration for Mastodon

func New

func New(path string, logger *log.ZapEventLogger) (*Mastodon, error)

func Register

func Register(ctx context.Context, server, userId, password string, logger *log.ZapEventLogger) (*Mastodon, error)

Register functions registers application to mastodon server.

func (*Mastodon) AppName

func (cfg *Mastodon) AppName() string

AppName method returns application name.

func (*Mastodon) Export

func (cfg *Mastodon) Export(path string) error

Export methods exports configuration to config file.

func (*Mastodon) Logger

func (cfg *Mastodon) Logger() *zap.Logger

Logger method returns zap.Logger instance.

func (*Mastodon) PostMessage

func (cfg *Mastodon) PostMessage(ctx context.Context, msg *Message) (string, error)

PostMessage method posts message and image files to Mastodon.

func (*Mastodon) Profile

func (cfg *Mastodon) Profile(ctx context.Context) (*mstdn.Account, error)

Profile method retuns account information of Mastodon user.

func (*Mastodon) Registory

func (cfg *Mastodon) Registory() string

Registory method returns registory URL of application.

func (*Mastodon) Scopes

func (cfg *Mastodon) Scopes() string

Scopes method returns scopes of application.

func (*Mastodon) Servername

func (cfg *Mastodon) Servername() string

func (*Mastodon) ShowProfile

func (cfg *Mastodon) ShowProfile(ctx context.Context, jsonFlag bool, w io.Writer) error

ShowProfile method outputs account information of Mastodon user to io.Writer.

type Message

type Message struct {
	Msg         string
	SpoilerText string
	Visibility  string
	ImageFiles  []string
}

Message is information of post message.

type Visibility

type Visibility int

func DefaultVisibility

func DefaultVisibility() Visibility

DefaultVisibility returns default Visibility.

func GetVisibilityFrom

func GetVisibilityFrom(s string) Visibility

GetVisibilityFrom function returns Visibility from string.

func (Visibility) String

func (v Visibility) String() string

Jump to

Keyboard shortcuts

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