client

package
v0.0.0-...-858d9bb Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(requestUrl string, variable interface{}, headers map[string]string) error

Types

type Account

type Account struct {
	Id             string    `json:"id"`
	Username       string    `json:"username"`
	Acct           string    `json:"acct"`
	DisplayName    string    `json:"display_name"`
	Locked         bool      `json:"locked"`
	Bot            bool      `json:"bot"`
	Discoverable   bool      `json:"discoverable"`
	Group          bool      `json:"group"`
	CreatedAt      time.Time `json:"created_at"`
	Note           string    `json:"note"`
	URL            string    `json:"url"`
	URI            string    `json:"uri"`
	Avatar         string    `json:"avatar"`
	AvatarStatic   string    `json:"avatar_static"`
	Header         string    `json:"header"`
	HeaderStatic   string    `json:"header_static"`
	FollowersCount int       `json:"followers_count"`
	FollowingCount int       `json:"following_count"`
	StatusesCount  int       `json:"statuses_count"`
	LastStatusAt   string    `json:"last_status_at"`
}

func FetchAccount

func FetchAccount(baseURL string, handle string) (Account, error)

type Application

type Application struct {
	Name    string `json:"name"`
	Website string `json:"website"`
}

type Client

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

func New

func New(userURL string, filters PostsFilter, opts ClientOptions) (Client, error)

func (Client) Account

func (c Client) Account() Account

func (Client) Posts

func (c Client) Posts() []*Post

type ClientOptions

type ClientOptions struct {
	Visibility string
	Threaded   bool
}

type MediaAttachment

type MediaAttachment struct {
	Type        string `json:"type"`
	URL         string `json:"url"`
	Description string `json:"description"`
	Id          string `json:"id"`
	Path        string
}

type Post

type Post struct {
	CreatedAt          time.Time         `json:"created_at"`
	Id                 string            `json:"id"`
	Visibility         string            `json:"visibility"`
	InReplyToId        string            `json:"in_reply_to_id"`
	InReplyToAccountId string            `json:"in_reply_to_account_id"`
	Sensitive          bool              `json:"sensitive"`
	SpoilerText        string            `json:"spoiler_text"`
	Language           string            `json:"language"`
	URI                string            `json:"uri"`
	URL                string            `json:"url"`
	Application        Application       `json:"application"`
	Content            string            `json:"content"`
	MediaAttachments   []MediaAttachment `json:"media_attachments"`
	RepliesCount       int               `json:"replies_count"`
	ReblogsCount       int               `json:"reblogs_count"`
	FavoritesCount     int               `json:"favourites_count"`
	Pinned             bool              `json:"pinned"`
	Tags               []Tag             `json:"tags"`
	Favourited         bool              `json:"favourited"`
	Reblogged          bool              `json:"reblogged"`
	Muted              bool              `json:"muted"`
	Bookmarked         bool              `json:"bookmarked"`
	Account            Account           `json:"account"`
	// contains filtered or unexported fields
}

func FetchPosts

func FetchPosts(baseURL string, accountId string, filters PostsFilter) ([]Post, error)

func (Post) AllMedia

func (p Post) AllMedia() []MediaAttachment

func (Post) AllTags

func (p Post) AllTags() []Tag

func (Post) Descendants

func (p Post) Descendants() []*Post

func (Post) ShouldSkip

func (p Post) ShouldSkip(visibility string) bool

type PostsFilter

type PostsFilter struct {
	ExcludeReplies bool
	ExcludeReblogs bool
	Limit          int
	SinceId        string
	MinId          string
	MaxId          string
	OnlyMedia      bool
	Pinned         bool
	Tagged         string
}

type StatusContext

type StatusContext struct {
	Ancestors   []Post `json:"ancestors"`
	Descendants []Post `json:"descendants"`
}

func FetchStatusContext

func FetchStatusContext(baseURL, postId string) (StatusContext, error)

type Tag

type Tag struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

Jump to

Keyboard shortcuts

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