Documentation ¶
Overview ¶
Package goat is a simple Go implementation for posting to ATProto platform (e.g. BlueSky).
Index ¶
- Constants
- func DeletePost(server, handle, password, rkey string) error
- func ResolveHandle(server, handle string) string
- func Truncate(limit int, text, url string) string
- type Blob
- type BlobData
- type External
- type Facet
- type Feature
- type Image
- type Index
- type PostInfo
- func NewLinkCard(server, handle, password, text, title, description, url string, ...) (PostInfo, error)
- func NewPost(server, handle, password, text string, langs []string, blobs []BlobData) (PostInfo, error)
- func NewQuote(server, handle, password, text string, langs []string, quoted PostInfo) (PostInfo, error)
- type Prepost
- type Ref
- type Reply
- type Session
Constants ¶
const BSkyMaxPostLength = 300
Variables ¶
This section is empty.
Functions ¶
func DeletePost ¶
func ResolveHandle ¶
ResolveHandle tries to resolve the handle of a user mention (@handle) and returns the DID of the user. If err or not found, it returns "".
func Truncate ¶
Truncate truncates text to within post character limit and then appends the permalink url to the truncated text; limit is expected to be longer than url by some margin. url should be well formed; Truncate does not validate the url. Returns only the url, if it cannot truncate. Use Truncate before parsing the text for facet or embed.
Example output: "Truncated text ... https://codeberg.org/s877/goat"
Types ¶
type External ¶
type External struct { Type string `json:"$type"` External interface{} `json:"external"` // expecting Card or CardWithThumb }
type Facet ¶
func GetFacetLinks ¶
GetFacetLinks parses the post text for links / URLs. It uses strict mode, i.e. considers a URL as a Facet only if it starts with 'https://' or 'http://'.
func GetFacetMentions ¶
GetFacetMentions parses the post text for ATProto / BlueSky @mentions
type PostInfo ¶
func NewLinkCard ¶
func NewLinkCard(server, handle, password, text, title, description, url string, thumbnail BlobData) (PostInfo, error)
NewLinkCard uploads an external "website card / social card: rendered preview of a website link"; handle, password, and url are mandatory.
type Prepost ¶
type Prepost struct { Text string Languages []string ImageBlobs []BlobData // for image attachment LinkURL string // for link card LinkTitle string // for link card LinkDescription string // for link card LinkThumbnail BlobData // for link card Quote PostInfo // for reposting a quote Reply Reply // for posting a reply to an existing post }
Prepost stores the values to be converted into a post for creating new post (RKey must be empty "") or updating an existing post (RKey must be valid)
type Session ¶
func CreateSession ¶
CreateSession authenticates the user against the server. Server can be left as "" to authenticate against the default, i.e. https://bsky.social, or specified to an alternate server. This is a low level function for those who want to reuse it for their own alternative implementation.
func (*Session) CreateLinkCardEmbed ¶
func (*Session) UploadBlob ¶
UploadBlob uploads a blob (image) to the server to get the link id which is a required data to include if posting with image. This is a low level function for those who want to reuse it for their own alternative implementation.