diff options
| author | Guillermo Serrahima <dev@vylion.com> | 2026-03-12 17:18:37 +0100 |
|---|---|---|
| committer | Guillermo Serrahima <dev@vylion.com> | 2026-03-12 17:18:37 +0100 |
| commit | 5c5028eff2681946fe1c3b330a89c65de6f134b5 (patch) | |
| tree | e661aeaa2e3c35682506113f74e274434ab3a166 /backend/notes/app.bsky.feed.post.go | |
| parent | e757316366f9308718566feda5f9570a3b4a7f5f (diff) | |
| download | llostre-5c5028eff2681946fe1c3b330a89c65de6f134b5.tar.xz llostre-5c5028eff2681946fe1c3b330a89c65de6f134b5.zip | |
Note struct refactor
Diffstat (limited to 'backend/notes/app.bsky.feed.post.go')
| -rw-r--r-- | backend/notes/app.bsky.feed.post.go | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/backend/notes/app.bsky.feed.post.go b/backend/notes/app.bsky.feed.post.go index 17ff5ee..1c11733 100644 --- a/backend/notes/app.bsky.feed.post.go +++ b/backend/notes/app.bsky.feed.post.go @@ -7,25 +7,6 @@ import ( "time" ) -type AppBskyFeedPostNote struct { - URI string `json:"uri"` - AuthorDID string `json:"authorDid"` - AuthorHandle string `json:"authorHandle"` - AuthorName string `json:"authorName"` - AvatarURL string `json:"avatarURL"` - Text string `json:"text"` - CreatedAt time.Time `json:"createdAt"` - ReplyTo *string `json:"replyTo,omitempty"` - Facets []Facet `json:"facets,omitempty"` -} - -type Facet struct { - ByteStart int `json:"byteStart"` - ByteEnd int `json:"byteEnd"` - Type string `json:"type"` - Value string `json:"value"` // the link destination, whether url, profile or tag -} - type AppBskyFeedPostRecord struct { URI string `json:"uri"` Value struct { @@ -51,27 +32,7 @@ type AppBskyFeedPostRecord struct { } `json:"value"` } -func (bp *AppBskyFeedPostNote) GetID() string { - return bp.URI -} - -func (bp *AppBskyFeedPostNote) GetAuthorDID() string { - return bp.AuthorDID -} - -func (bp *AppBskyFeedPostNote) GetAuthorHandle() string { - return bp.AuthorHandle -} - -func (bp *AppBskyFeedPostNote) GetTimestamp() time.Time { - return bp.CreatedAt -} - -func (bp *AppBskyFeedPostNote) GetReplyTo() *string { - return bp.ReplyTo -} - -func AppBskyFeedPostFromRecord(record AppBskyFeedPostRecord, profile *general.Profile) (*AppBskyFeedPostNote, error) { +func AppBskyFeedPostFromRecord(record AppBskyFeedPostRecord, profile *general.Profile) (*Note, error) { if record.URI == "" { return nil, fmt.Errorf("missing required field: uri") } @@ -129,7 +90,7 @@ func AppBskyFeedPostFromRecord(record AppBskyFeedPostRecord, profile *general.Pr avatarURL = "" } - return &AppBskyFeedPostNote{ + return &Note{ URI: record.URI, AuthorDID: did, AuthorHandle: handle, |
