Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
Go
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package tangled
// schema: sh.tangled.feed.getTimeline
import ( "context" "encoding/json" "fmt"
"github.com/bluesky-social/indigo/lex/util")
const ( FeedGetTimelineNSID = "sh.tangled.feed.getTimeline")
// FeedGetTimeline_FollowEvent is a "followEvent" in the sh.tangled.feed.getTimeline schema.//// A user followed another user.//// RECORDTYPE: FeedGetTimeline_FollowEventtype FeedGetTimeline_FollowEvent struct { LexiconTypeID string `json:"$type,const=sh.tangled.feed.getTimeline#followEvent" cborgen:"$type,const=sh.tangled.feed.getTimeline#followEvent"` Actor *ActorDefs_ProfileViewBasic `json:"actor" cborgen:"actor"` Cid string `json:"cid" cborgen:"cid"` Subject *ActorDefs_ProfileViewDetailed `json:"subject" cborgen:"subject"` Uri string `json:"uri" cborgen:"uri"`}
// FeedGetTimeline_Output is the output of a sh.tangled.feed.getTimeline call.type FeedGetTimeline_Output struct { Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` Feed []*FeedGetTimeline_TimelineItem `json:"feed" cborgen:"feed"`}
// FeedGetTimeline_RepoEvent is a "repoEvent" in the sh.tangled.feed.getTimeline schema.//// A repository was created (or forked). The actor is repo.owner.//// RECORDTYPE: FeedGetTimeline_RepoEventtype FeedGetTimeline_RepoEvent struct { LexiconTypeID string `json:"$type,const=sh.tangled.feed.getTimeline#repoEvent" cborgen:"$type,const=sh.tangled.feed.getTimeline#repoEvent"` Cid string `json:"cid" cborgen:"cid"` Repo *RepoDefs_RepoViewBasic `json:"repo" cborgen:"repo"` // source: Fork parent, present only if this repo is a fork. Source *RepoDefs_RepoViewBasic `json:"source,omitempty" cborgen:"source,omitempty"` Uri string `json:"uri" cborgen:"uri"`}
// FeedGetTimeline_StarEvent is a "starEvent" in the sh.tangled.feed.getTimeline schema.//// A repository was starred.//// RECORDTYPE: FeedGetTimeline_StarEventtype FeedGetTimeline_StarEvent struct { LexiconTypeID string `json:"$type,const=sh.tangled.feed.getTimeline#starEvent" cborgen:"$type,const=sh.tangled.feed.getTimeline#starEvent"` // actor: Who starred. Actor *ActorDefs_ProfileViewBasic `json:"actor" cborgen:"actor"` Cid string `json:"cid" cborgen:"cid"` // repo: The starred repo. Repo *RepoDefs_RepoViewBasic `json:"repo" cborgen:"repo"` Uri string `json:"uri" cborgen:"uri"`}
// FeedGetTimeline_TimelineItem is a "timelineItem" in the sh.tangled.feed.getTimeline schema.type FeedGetTimeline_TimelineItem struct { Event *FeedGetTimeline_TimelineItem_Event `json:"event" cborgen:"event"` EventAt string `json:"eventAt" cborgen:"eventAt"`}
type FeedGetTimeline_TimelineItem_Event struct { FeedGetTimeline_RepoEvent *FeedGetTimeline_RepoEvent FeedGetTimeline_StarEvent *FeedGetTimeline_StarEvent FeedGetTimeline_FollowEvent *FeedGetTimeline_FollowEvent}
func (t *FeedGetTimeline_TimelineItem_Event) MarshalJSON() ([]byte, error) { if t.FeedGetTimeline_RepoEvent != nil { t.FeedGetTimeline_RepoEvent.LexiconTypeID = "sh.tangled.feed.getTimeline#repoEvent" return json.Marshal(t.FeedGetTimeline_RepoEvent) } if t.FeedGetTimeline_StarEvent != nil { t.FeedGetTimeline_StarEvent.LexiconTypeID = "sh.tangled.feed.getTimeline#starEvent" return json.Marshal(t.FeedGetTimeline_StarEvent) } if t.FeedGetTimeline_FollowEvent != nil { t.FeedGetTimeline_FollowEvent.LexiconTypeID = "sh.tangled.feed.getTimeline#followEvent" return json.Marshal(t.FeedGetTimeline_FollowEvent) } return nil, fmt.Errorf("cannot marshal empty enum")}func (t *FeedGetTimeline_TimelineItem_Event) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err }
switch typ { case "sh.tangled.feed.getTimeline#repoEvent": t.FeedGetTimeline_RepoEvent = new(FeedGetTimeline_RepoEvent) return json.Unmarshal(b, t.FeedGetTimeline_RepoEvent) case "sh.tangled.feed.getTimeline#starEvent": t.FeedGetTimeline_StarEvent = new(FeedGetTimeline_StarEvent) return json.Unmarshal(b, t.FeedGetTimeline_StarEvent) case "sh.tangled.feed.getTimeline#followEvent": t.FeedGetTimeline_FollowEvent = new(FeedGetTimeline_FollowEvent) return json.Unmarshal(b, t.FeedGetTimeline_FollowEvent)
default: return nil }}
// FeedGetTimeline calls the XRPC method "sh.tangled.feed.getTimeline".//// viewer: TODO: deprecate this and use auth instead.func FeedGetTimeline(ctx context.Context, c util.LexClient, cursor string, followingOnly bool, limit int64, viewer string) (*FeedGetTimeline_Output, error) { var out FeedGetTimeline_Output
params := map[string]interface{}{} if cursor != "" { params["cursor"] = cursor } if followingOnly { params["followingOnly"] = followingOnly } if limit != 0 { params["limit"] = limit } if viewer != "" { params["viewer"] = viewer } if err := c.LexDo(ctx, util.Query, "", "sh.tangled.feed.getTimeline", params, nil, &out); err != nil { return nil, err }
return &out, nil}