mastodon

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 7 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

mastodon-go

一个封装 Mastodon API 的 Golang 库(直接使用创建好的 Access Token 来调用 API,而不用麻烦地每次都走一遍认证流程)

目前只封装了个别接口,暂时够@MastodonArchiveBot项目使用了

Documentation

Index

Constants

View Source
const (
	HomeTimeLines = "/api/v1/timelines/home"
)

HomeTimeLines 获取首页列表 Statused 发送嘟文

Variables

This section is empty.

Functions

func Get

func Get(url string, token string) ([]byte, error)

Get 是封装的Get请求

func Post

func Post(url string, token string, params *StatusParams) ([]byte, error)

Post 是封装的Post请求

Types

type Account

type Account struct {
	UserName string `json:"username"`
	URL      string `json:"url"`
}

Account 账号

type Emoji

type Emoji struct {
}

Emoji 表情包

type HomeReq

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

HomeReq 首页列表请求体

type HomeResp

type HomeResp struct {
	Content string

	ID string

	Visibility Visibility
	// contains filtered or unexported fields
}

HomeResp 首页列表的返回体

type Mastodon

type Mastodon struct {
	Token  string
	Debug  bool
	Domain string
}

Mastodon 总入口结构体

func (*Mastodon) GetHomeTimeLines

func (mastodon *Mastodon) GetHomeTimeLines() ([]HomeResp, error)

GetHomeTimeLines 获取首页列表数据

func (*Mastodon) SendStatuses

func (mastodon *Mastodon) SendStatuses(params *StatusParams) (*StatusRes, error)

SendStatuses 发嘟

type Media

type Media struct {
}

Media 媒体文件

type Mention

type Mention struct {
}

Mention 提及

type Status

type Status struct {
	ID        string  `json:"id"`
	CreatedAt string  `json:"created_at"`
	Content   string  `json:"content"`
	Account   Account `json:"account"`
}

Status 嘟文类型 See https://docs.joinmastodon.org/entities/status/#example

type StatusParams

type StatusParams struct {
	Status      string `json:"status" validate:"required,max=500,min=1"`
	MediaIds    string `json:"media_ids"  validate:"required"`
	Poll        string `json:"poll"  validate:"required"`
	InReplyToID string `json:"in_reply_to_id,omitempty"`
	Visibility  string `json:"visibility,omitempty"`
	Sensitive   bool   `json:"sensitive"`
	SpoilerText string `json:"spoiler_text"`
}

StatusParams 是发嘟时的参数

type StatusRes

type StatusRes struct {
	ID      string  `json:"id"`
	Account Account `json:"account"`
}

StatusRes 发嘟完的响应体

type Tag

type Tag struct {
}

Tag 标签

type Visibility

type Visibility string

Visibility 可见行

Jump to

Keyboard shortcuts

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