pleroma

package module
v0.0.0-...-463c4a4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: MIT Imports: 15 Imported by: 0

README

chudromaAPI

Browse your instance's public timeline from the CLI, for some reason.

More functionality coming soon™.

Documentation

Index

Constants

View Source
const Path string = "/tmp/chudroma.db"

Variables

This section is empty.

Functions

func AddCredentials

func AddCredentials(clientID string, clientSecret string, authToken string, instance string, username string)

func CheckExists

func CheckExists(username string, instance string) bool

func GetToken

func GetToken(username string, instance string) (string, error)

func InitDb

func InitDb()

func Login

func Login(username string, instance string) (bool, string)

func RegisterToken

func RegisterToken(ctx context.Context, appConfig *PleromaApp) bool

func ViewTL

func ViewTL(url string, accessToken string)

Types

type AuthTable

type AuthTable struct {
	ID           uint `gorm:"primaryKey"`
	ClientID     string
	ClientSecret string
	AccessToken  string
	Instance     string
	Username     string
}

type Client

type Client struct {
	http.Client
	Config    *Config
	UserAgent string
}

func NewClient

func NewClient(config *Config) *Client

type Config

type Config struct {
	Instance     string
	ClientID     string
	ClientSecret string
	AccessToken  string
}

type PleromaApp

type PleromaApp struct {
	http.Client
	Server       string
	ClientName   string
	RedirectURIs string
	Scopes       string
	Website      string
}

type PublicTimeline

type PublicTimeline []struct {
	Account struct {
		Acct           string        `json:"acct"`
		Avatar         string        `json:"avatar"`
		AvatarStatic   string        `json:"avatar_static"`
		Bot            bool          `json:"bot"`
		CreatedAt      time.Time     `json:"created_at"`
		DisplayName    string        `json:"display_name"`
		Emojis         []interface{} `json:"emojis"`
		Fields         []interface{} `json:"fields"`
		FollowersCount int           `json:"followers_count"`
		FollowingCount int           `json:"following_count"`
		Header         string        `json:"header"`
		HeaderStatic   string        `json:"header_static"`
		ID             string        `json:"id"`
		IsLocked       bool          `json:"is_locked"`
		Note           string        `json:"note"`
		Pleroma        struct {
			BackgroundImage    interface{} `json:"background_image"`
			HideFavorites      bool        `json:"hide_favorites"`
			HideFollowers      bool        `json:"hide_followers"`
			HideFollowersCount bool        `json:"hide_followers_count"`
			HideFollows        bool        `json:"hide_follows"`
			HideFollowsCount   bool        `json:"hide_follows_count"`
			IsAdmin            bool        `json:"is_admin"`
			IsConfirmed        bool        `json:"is_confirmed"`
			IsModerator        bool        `json:"is_moderator"`
			Relationship       struct {
				BlockedBy           bool   `json:"blocked_by"`
				Blocking            bool   `json:"blocking"`
				DomainBlocking      bool   `json:"domain_blocking"`
				Endorsed            bool   `json:"endorsed"`
				FollowedBy          bool   `json:"followed_by"`
				Following           bool   `json:"following"`
				ID                  string `json:"id"`
				Muting              bool   `json:"muting"`
				MutingNotifications bool   `json:"muting_notifications"`
				Note                string `json:"note"`
				Notifying           bool   `json:"notifying"`
				Requested           bool   `json:"requested"`
				ShowingReblogs      bool   `json:"showing_reblogs"`
				Subscribing         bool   `json:"subscribing"`
			} `json:"relationship"`
			SkipThreadContainment bool          `json:"skip_thread_containment"`
			Tags                  []interface{} `json:"tags"`
		} `json:"pleroma"`
		Source struct {
			Fields  []interface{} `json:"fields"`
			Note    string        `json:"note"`
			Pleroma struct {
				ActorType    string `json:"actor_type"`
				Discoverable bool   `json:"discoverable"`
			} `json:"pleroma"`
			Sensitive bool `json:"sensitive"`
		} `json:"source"`
		StatusesCount int    `json:"statuses_count"`
		URL           string `json:"url"`
		Username      string `json:"username"`
	} `json:"account"`
	Application        interface{}   `json:"application"`
	Bookmarked         bool          `json:"bookmarked"`
	Card               interface{}   `json:"card"`
	Content            string        `json:"content"`
	CreatedAt          time.Time     `json:"created_at"`
	Emojis             []interface{} `json:"emojis"`
	Favourited         bool          `json:"favourited"`
	FavouritesCount    int           `json:"favourites_count"`
	ID                 string        `json:"id"`
	InReplyToAccountID interface{}   `json:"in_reply_to_account_id"`
	InReplyToID        interface{}   `json:"in_reply_to_id"`
	Language           interface{}   `json:"language"`
	MediaAttachments   []interface{} `json:"media_attachments"`
	Mentions           []interface{} `json:"mentions"`
	Muted              bool          `json:"muted"`
	Pinned             bool          `json:"pinned"`
	Pleroma            struct {
		Content struct {
			TextPlain string `json:"text/plain"`
		} `json:"content"`
		ConversationID       int           `json:"conversation_id"`
		DirectConversationID interface{}   `json:"direct_conversation_id"`
		EmojiReactions       []interface{} `json:"emoji_reactions"`
		ExpiresAt            interface{}   `json:"expires_at"`
		InReplyToAccountAcct interface{}   `json:"in_reply_to_account_acct"`
		Local                bool          `json:"local"`
		SpoilerText          struct {
			TextPlain string `json:"text/plain"`
		} `json:"spoiler_text"`
		ThreadMuted bool `json:"thread_muted"`
	} `json:"pleroma"`
	Poll         interface{}   `json:"poll"`
	Reblog       interface{}   `json:"reblog"`
	Reblogged    bool          `json:"reblogged"`
	ReblogsCount int           `json:"reblogs_count"`
	RepliesCount int           `json:"replies_count"`
	Sensitive    bool          `json:"sensitive"`
	SpoilerText  string        `json:"spoiler_text"`
	Tags         []interface{} `json:"tags"`
	URI          string        `json:"uri"`
	URL          string        `json:"url"`
	Visibility   string        `json:"visibility"`
}

Jump to

Keyboard shortcuts

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