gondole

package module
v0.0.0-...-ad35a32 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2017 License: MIT Imports: 11 Imported by: 0

README

gondole

Go version of the Mastodon API

godoc license build Go Report Card

gondole is a Go library to access the Mastondon REST API.

Work in progress, still incomplete

Installation

Like many Go-based tools, installation is very easy

go get github.com/keltia/gondole

or

git clone https://github.com/keltia/gondole
go install ./cmd/...

The library is fetched, compiled and installed in whichever directory is specified by $GOPATH. The gondole-cli binary will also be installed.

Configuration

The configuration is stored in the standard place: $HOME/.config/gondole. You can find a global configuration file named config.tomland a file for each instance you have connected with, named <instance>.toml.

When you connect gondole to a given instance you have never connected before, it will register the application, get the token and save it.

Name

Trying to define a name close to Mastodon, one could come up with godon and in French, gondole (the small boats in Venice) is easy to take.

References

Documentation

Index

Constants

View Source
const (
	APIVersion = "0.0"

	APIEndpoint = "https://mastodon.social/api/v1"

	NoRedirect = "urn:ietf:wg:oauth:2.0:oob"
)
View Source
const (
	DefaultName = "config.toml"
)

Variables

View Source
var (
	ErrAlreadyRegistered = errors.New("App already registered")
)

Functions

func GetInstanceList

func GetInstanceList() (list []string)

Types

type Account

type Account struct {
	ID          int64
	Username    string
	Acct        string
	DisplayName string
	Note        string
	URL         string
	Avatar      string
	Header      string
	Locked      bool
	Followers   int
	Followings  int
	Statuses    int
}

type Application

type Application struct {
	Name    string
	Website string
}

type Attachement

type Attachement struct {
	ID         int64
	Type       string
	URL        string
	RemoteURL  string
	PreviewURL string
	TextURL    string
}

type Card

type Card struct {
	URL         string
	Title       string
	Description string
	Image       string
}

type Client

type Client struct {
	BaseURL     string
	BearerToken string
}

type Config

type Config struct {
	Default string
}

func (*Config) Write

func (c *Config) Write() (err error)

type Context

type Context struct {
	Ancestors   []Status
	Descendents []Status
}

type Error

type Error struct {
	Text string
}

type Gondole

type Gondole struct {
	Name   string
	ID     int64
	Secret string
}

func NewApp

func NewApp(name string, scopes []string, redirectURI string) (g *Gondole, err error)

NewApp registers a new instance

type Instance

type Instance struct {
	URI         string
	Title       string
	Description string
	Email       string
}

type Mention

type Mention struct {
	ID       int64
	URL      string
	Username string
	Acct     string
}

type Notification

type Notification struct {
	ID        int64
	Type      string
	CreatedAt time.Time
	Account   *Account
	Status    *Status
}

type Relationship

type Relationship struct {
	Following  bool
	FollowedBy bool
	Blocking   bool
	Muting     bool
	Requested  bool
}

type Report

type Report struct {
	ID          int64
	ActionTaken string
}

type Result

type Result struct {
	Accounts []Account
	Statutes []Status
	Hashtags []Tag
}

type Server

type Server struct {
	ID          int64
	Name        string
	BearerToken string
}

Config holds our parameters

func LoadConfig

func LoadConfig(name string) (s *Server, err error)

LoadConfig reads a file as a TOML document and return the structure

func (*Server) WriteToken

func (s *Server) WriteToken(instance string) (err error)

type Status

type Status struct {
	ID                 int64
	URI                string
	URL                string
	Account            *Account
	InReplyToId        int64
	InReplyToAccountID int64
	Reblog             *Status
	Content            string
	CreatedAT          time.Time
	Reblogs            int
	Favourites         int
	Reblogged          bool
	Favourited         bool
	Sensitive          bool
	SpoilerText        string
	Visibility         string
	MediaAttachments   []Attachement
	Mentions           []Mention
	Tags               []Tag
	App                Application
}

type Tag

type Tag struct {
	Name string
	URL  string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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