bsky

package module
v0.0.0-...-1bd4e2e Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Unlicense Imports: 10 Imported by: 2

README

bsky

This library is particularly useful if you're trying to build simple Bluesky applications without having to deal with Bluesky's indigo library.

Contributing

Send patches/bug reports to ~jordanreger/public-inbox@lists.sr.ht

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FacetsToHTML

func FacetsToHTML(text string, facets []Facet) template.HTML

Types

type Actor

type Actor struct {
	DID            string        `json:"did"`
	Handle         string        `json:"handle"`
	DisplayName    string        `json:"displayName,omitempty"`
	Description    string        `json:"description,omitempty"`
	Avatar         string        `json:"avatar,omitempty"`
	Banner         string        `json:"banner,omitempty"`
	FollowsCount   int           `json:"followsCount,omitempty"`
	FollowersCount int           `json:"followersCount,omitempty"`
	PostsCount     int           `json:"postsCount,omitempty"`
	IndexedAt      *time.Time    `json:"indexedAt,omitempty"`
	Labels         []interface{} `json:"labels,omitempty"`
}

func GetActorProfile

func GetActorProfile(did string) Actor

func (Actor) DescriptionHTML

func (actor Actor) DescriptionHTML() template.HTML

func (Actor) Feed

func (actor Actor) Feed() Feed

type AspectRatio

type AspectRatio struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

type Embed

type Embed struct {
	Type     string         `json:"$type"`
	External *ExternalEmbed `json:"external,omitempty"`
	Images   []*Image       `json:"images,omitempty"`
	Media    *MediaEmbed    `json:"media,omitempty"`
	Record   *RecordEmbed   `json:"record,omitempty"`
}

type ExternalEmbed

type ExternalEmbed struct {
	Type        string `json:"$type"`
	URI         string `json:"uri"`
	Thumb       string `json:"thumb,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

type Facet

type Facet struct {
	Type     string         `json:"$type,omitempty"`
	Index    FacetIndex     `json:"index"`
	Features []FacetFeature `json:"features"`
}

func ParseFacets

func ParseFacets(text string) []Facet

func ParseMentions

func ParseMentions(raw string) []Facet

func ParseTags

func ParseTags(raw string) []Facet

func ParseURLs

func ParseURLs(raw string) []Facet

type FacetFeature

type FacetFeature struct {
	Tag  string `json:"tag,omitempty"`
	DID  string `json:"did,omitempty"`
	URI  string `json:"uri,omitempty"`
	Type string `json:"$type,omitempty"`
}

type FacetIndex

type FacetIndex struct {
	ByteEnd   int `json:"byteEnd"`
	ByteStart int `json:"byteStart"`
}

type Feed

type Feed = []FeedItem

func GetActorFeed

func GetActorFeed(actor Actor) Feed

func GetListFeed

func GetListFeed(at_uri string) Feed

Must use util.GetListURI() for this

type FeedItem

type FeedItem struct {
	Post *Post `json:"post,omitempty"`
}

type Image

type Image struct {
	Alt         string       `json:"alt,omitempty"`
	Image       *Image       `json:"image,omitempty"`
	Type        string       `json:"$type"`
	Ref         *Ref         `json:"ref,omitempty"`
	MimeType    string       `json:"mimeType,omitempty"`
	Size        int          `json:"size,omitempty"`
	Thumb       string       `json:"thumb,omitempty"`
	FullSize    string       `json:"fullsize,omitempty"`
	AspectRatio *AspectRatio `json:"aspectRatio,omitempty"`
}

type List

type List struct {
	URI               string    `json:"uri,omitempty"`
	CID               string    `json:"cid,omitempty"`
	Name              string    `json:"name,omitempty"`
	Purpose           string    `json:"purpose,omitempty"`
	IndexedAt         time.Time `json:"indexedAt,omitempty"`
	Labels            []string  `json:"labels,omitempty"`
	Creator           Actor     `json:"creator,omitempty"`
	Description       string    `json:"description,omitempty"`
	DescriptionFacets []Facet   `json:"descriptionFacets,omitempty"`
}

func GetList

func GetList(at_uri string) List

func (List) DescriptionHTML

func (list List) DescriptionHTML() template.HTML

func (List) Feed

func (list List) Feed() Feed

func (List) RKey

func (list List) RKey() string

type ListItem

type ListItem struct {
	URI     string `json:"uri,omitempty"`
	Subject Actor  `json:"subject,omitempty"`
}

type MediaEmbed

type MediaEmbed struct {
	Type   string   `json:"$type"`
	Images []*Image `json:"images"`
}

type Post

type Post struct {
	URI         string     `json:"uri"`
	CID         string     `json:"cid"`
	Author      *Actor     `json:"author"`
	Record      *Record    `json:"record,omitempty"`
	Embed       *Embed     `json:"embed,omitempty"`
	ReplyCount  int        `json:"replyCount"`
	RepostCount int        `json:"repostCount"`
	LikeCount   int        `json:"likeCount"`
	IndexedAt   *time.Time `json:"indexedAt,omitempty"`
	Labels      []string   `json:"labels,omitempty"`
}

func (Post) RKey

func (post Post) RKey() string

type Record

type Record struct {
	Text      string     `json:"text"`
	Type      string     `json:"$type"`
	Langs     []string   `json:"langs,omitempty"`
	Embed     *Embed     `json:"embed,omitempty"`
	Facets    []Facet    `json:"facets,omitempty"`
	Reply     *Reply     `json:"reply,omitempty"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
}

func (Record) HTML

func (record Record) HTML() template.HTML

type RecordEmbed

type RecordEmbed struct {
	RecordEmbedRecord `json:",omitempty"`
	Type              string             `json:"$type,omitempty"`
	Record            *RecordEmbedRecord `json:"record,omitempty"`
}

type RecordEmbedRecord

type RecordEmbedRecord struct {
	URI       string     `json:"uri,omitempty"`
	CID       string     `json:"cid,omitempty"`
	Author    *Actor     `json:"author,omitempty"`
	Value     *Record    `json:"value,omitempty"`
	Labels    []string   `json:"labels,omitempty"`
	IndexedAt *time.Time `json:"indexedAt,omitempty"`
	Embeds    []*Embed   `json:"embeds,omitempty"`
}

func (RecordEmbedRecord) RKey

func (record RecordEmbedRecord) RKey() string

type Ref

type Ref struct {
	Link string `json:"$link"`
}

type Reply

type Reply struct {
	Root   ReplyRoot   `json:"root"`
	Parent ReplyParent `json:"parent"`
}

type ReplyParent

type ReplyParent struct {
	CID string `json:"cid"`
	URI string `json:"uri"`
}

type ReplyRoot

type ReplyRoot struct {
	CID string `json:"cid"`
	URI string `json:"uri"`
}

type Thread

type Thread struct {
	Type    string    `json:"$type"`
	Post    *Post     `json:"post,omitempty"`
	Replies []*Thread `json:"replies,omitempty"`
}

func GetThread

func GetThread(at_uri string) Thread

Directories

Path Synopsis
api module
htmlsky module
util module

Jump to

Keyboard shortcuts

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