bsky

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	DID             string `json:"did"`
	DIDDoc          DIDDoc `json:"didDoc"`
	Handle          string `json:"handle"`
	Email           string `json:"email"`
	EmailConfirmed  bool   `json:"emailConfirmed"`
	EmailAuthFactor bool   `json:"emailAuthFactor"`
	AccessJwt       string `json:"accessJwt"`
	RefreshJwt      string `json:"refreshJwt"`
	Active          bool   `json:"active"`
}

type BlobRecord added in v0.4.0

type BlobRecord struct {
	LexiconTypeID string  `json:"$type"`
	Ref           BlobRef `json:"ref"`
	MimeType      string  `json:"mimeType"`
	Size          int     `json:"size"`
}

type BlobRef added in v0.4.0

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

type CommitEvent

type CommitEvent interface {
	Type() CommitEventType
	GetRepo() string
	GetOps() []RepoOperation
	GetBlocks() []byte
}

type CommitEventType

type CommitEventType string
const (
	CommitEventTypeRepoCommit CommitEventType = "repo_commit"
)

type CreateRecordParams

type CreateRecordParams struct {
	Resource string
	Text     string
	URI      string
	CID      string
}

type DIDDoc

type DIDDoc struct {
	Context            []string                `json:"@context"`
	ID                 string                  `json:"id"`
	AlsoKnownAs        []string                `json:"alsoKnownAs"`
	VerificationMethod []DIDVerificationMethod `json:"verificationMethod"`
	Service            []DIDService            `json:"service"`
}

type DIDService

type DIDService struct {
	ID              string `json:"id"`
	Type            string `json:"type"`
	ServiceEndpoint string `json:"serviceEndpoint"`
}

type DIDVerificationMethod

type DIDVerificationMethod struct {
	ID                 string `json:"id"`
	Type               string `json:"type"`
	Controller         string `json:"controller"`
	PublicKeyMultibase string `json:"publicKeyMultibase"`
}

type EmbedImageRecord added in v0.4.0

type EmbedImageRecord struct {
	LexiconTypeID string        `json:"$type"`
	Images        []ImageRecord `json:"images"`
}

type EmbedRecord added in v0.4.0

type EmbedRecord struct {
	LexiconTypeID string `json:"$type"`
	Record        Record `json:"record"`
}

type ImageAspectRatio added in v0.4.0

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

type ImageRecord added in v0.4.0

type ImageRecord struct {
	Alt         string           `json:"alt"`
	AspectRatio ImageAspectRatio `json:"aspectRatio"`
	Image       BlobRecord       `json:"image"`
}

type LikeRecord added in v0.4.0

type LikeRecord struct {
	LexiconTypeID string        `json:"$type"`
	Subject       RepoStrongRef `json:"subject"`
	CreatedAt     time.Time     `json:"createdAt"`
}

type Post

type Post struct {
	LexiconTypeID string     `json:"$type"`
	URI           string     `json:"uri"` // at-uri
	CID           any        `json:"cid"` // TODO: for now handle CID like the the firehose, but need improvement
	Author        PostAuthor `json:"author"`
	Record        PostRecord `json:"record"`
	Embed         any        `json:"embed"` // TODO: embed can be many types of objects, for now it will be any, need improvement
	ReplyCount    int        `json:"replyCount,omitempty"`
	RepostCount   int        `json:"repostCount,omitempty"`
	LikeCount     int        `json:"likeCount,omitempty"`
	QuoteCount    int        `json:"quoteCount,omitempty"`
	IndexedAt     time.Time  `json:"indexedAt"`
	Viewer        PostViewer `json:"viewer"`
}

Post

Represents the struct with data when requesting the get posts endpoint

type PostAuthor

type PostAuthor struct {
	DID         string    `json:"did"`
	Handle      string    `json:"handle"`
	DisplayName string    `json:"displayName"`
	Avatar      string    `json:"avatar"`
	CreatedAt   time.Time `json:"createdAt"`
}

PostAuthor

TODO: add remaining fields associated,viewer and labels

type PostRecord

type PostRecord struct {
	LexiconTypeID string           `json:"$type"`
	URI           string           `json:"uri"`
	CreatedAt     time.Time        `json:"createdAt"`
	Embed         any              `json:"embed"` // TODO: embed can be many types of objects, for now it will be any, need improvement
	Facets        []map[string]any `json:"facets,omitempty"`
	Langs         []string         `json:"langs"`
	Reply         *Reply           `json:"reply,omitempty"`
	Text          string           `json:"text"`
}

PostRecord

Represents the post record data.

type PostResponse added in v0.2.0

type PostResponse struct {
	Posts Posts `json:"posts"`
}

type PostViewer

type PostViewer struct {
	Repost            string `json:"repost"` // at-uri
	Like              string `json:"like"`   // at-uri
	ThreadMuted       bool   `json:"threadMuted"`
	ReplyDisabled     bool   `json:"replyDisabled"`
	EmbeddingDisabled bool   `json:"embeddingDisabled"`
	Pinned            bool   `json:"pinned"`
}

PostViewer

Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests.

type Posts

type Posts []Post

type Record added in v0.4.0

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

type Reply

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

type RepoCommitEvent

type RepoCommitEvent struct {
	Repo   string          `cbor:"repo"`
	Rev    string          `cbor:"rev"`
	Seq    int64           `cbor:"seq"`
	Since  string          `cbor:"since"`
	Time   string          `cbor:"time"`
	TooBig bool            `cbor:"tooBig"`
	Prev   any             `cbor:"prev"`
	Rebase bool            `cbor:"rebase"`
	Blocks []byte          `cbor:"blocks"`
	Ops    []RepoOperation `cbor:"ops"`
	Commit any             `json:"commit"` // Repo commit object CID
}

func (RepoCommitEvent) GetBlocks added in v0.2.0

func (e RepoCommitEvent) GetBlocks() []byte

func (RepoCommitEvent) GetOps added in v0.2.0

func (e RepoCommitEvent) GetOps() []RepoOperation

func (RepoCommitEvent) GetRepo added in v0.3.0

func (e RepoCommitEvent) GetRepo() string

func (RepoCommitEvent) Type

type RepoOperation

type RepoOperation struct {
	Action string `cbor:"action"`
	Path   string `cbor:"path"`
	Reply  *Reply `cbor:"reply,omitempty"`
	Text   []byte `cbor:"text"`
	CID    any    `cbor:"cid"`
}

type RepoStrongRef

type RepoStrongRef struct {
	LexiconTypeID string `json:"$type,omitempty"`
	CID           string `json:"cid"`
	URI           string `json:"uri"`
}

type RepostRecord added in v0.4.0

type RepostRecord struct {
	LexiconTypeID string        `json:"$type"`
	Subject       RepoStrongRef `json:"subject"`
	CreatedAt     time.Time     `json:"createdAt"`
}

type RequestLikesFromPost

type RequestLikesFromPost struct {
	URI string `json:"uri"`
}

type RequestRecord

type RequestRecord struct {
	Subject   RepoStrongRef `json:"subject"`
	Text      string        `json:"text,omitempty"`
	CreatedAt time.Time     `json:"createdAt"`
}

type RequestRecordBody

type RequestRecordBody struct {
	LexiconTypeID string        `json:"$type"`
	Collection    string        `json:"collection"`
	Repo          string        `json:"repo"`
	Record        RequestRecord `json:"record"`
}

type SessionRequest

type SessionRequest struct {
	Identifier string `json:"identifier"`
	Password   string `json:"password"`
}

Jump to

Keyboard shortcuts

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