diff --git a/Makefile b/Makefile index 914c94c2..212305ab 100644 --- a/Makefile +++ b/Makefile @@ -384,7 +384,7 @@ lexicons: # glex is the standalone Go lexicon codegen tool (github.com/streamplace/glex). # It generates Go types that serialize as canonical DAG-CBOR via go-dasl, -# using the glex runtime (here: the pkg/lex shim) for the data model. +# using the glex runtime (github.com/streamplace/glex/runtime) for the data model. GO_LEXICON_GEN := github.com/streamplace/glex/cmd/glex .PHONY: go-lexicons @@ -398,23 +398,17 @@ go-lexicons: && GOTOOLCHAIN=auto go run $(GO_LEXICON_GEN) build \ --lexicons-dir .build/golexmerge \ --output-dir .build/goout \ - --runtime-import stream.place/streamplace/pkg/lex \ - --runtime-alias lex \ - --legacy-mode \ - --pkg-name-override placestream=streamplace \ - --pkg-name-override gamesgamesgamesgamesgames=gamesgamesgamesgames \ - --extra-import 'gamesgamesgamesgamesgames=gamesgamesgamesgamesgames "stream.place/streamplace/pkg/gamesgamesgamesgames"' \ - --extra-import 'placestream=placestream "stream.place/streamplace/pkg/streamplace"' \ - --external-type-mapping 'com.atproto.=comatproto "github.com/bluesky-social/indigo/api/atproto"' \ - --external-type-mapping 'app.bsky.=appbsky "github.com/bluesky-social/indigo/api/bsky"' \ - --external-type-mapping 'tools.ozone.=toolsozone "github.com/bluesky-social/indigo/api/ozone"' \ - --external-type-mapping 'chat.bsky.=chatbsky "github.com/bluesky-social/indigo/api/chat"' \ + --module-path stream.place/streamplace/pkg \ .build/golexmerge/place/stream \ .build/golexmerge/games \ - && rm -rf ./pkg/streamplace ./pkg/gamesgamesgamesgames \ - && mkdir -p ./pkg/streamplace ./pkg/gamesgamesgamesgames \ - && cp .build/goout/streamplace/*.go ./pkg/streamplace/ \ - && cp .build/goout/gamesgamesgamesgames/*.go ./pkg/gamesgamesgamesgames/ \ + .build/golexmerge/com/atproto \ + .build/golexmerge/app/bsky \ + && rm -rf ./pkg/placestream ./pkg/gamesgamesgamesgamesgames ./pkg/comatproto ./pkg/appbsky \ + && mkdir -p ./pkg/placestream ./pkg/gamesgamesgamesgamesgames ./pkg/comatproto ./pkg/appbsky \ + && cp .build/goout/placestream/*.go ./pkg/placestream/ \ + && cp .build/goout/gamesgamesgamesgamesgames/*.go ./pkg/gamesgamesgamesgamesgames/ \ + && cp .build/goout/comatproto/*.go ./pkg/comatproto/ \ + && cp .build/goout/appbsky/*.go ./pkg/appbsky/ \ && rm -rf .build/golexmerge .build/goout .PHONY: js-lexicons diff --git a/cmd/libstreamplace/streamplace.go b/cmd/libstreamplace/streamplace.go index c1c07b4d..6365a5b3 100644 --- a/cmd/libstreamplace/streamplace.go +++ b/cmd/libstreamplace/streamplace.go @@ -10,7 +10,7 @@ import ( "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/cmd" - _ "stream.place/streamplace/pkg/streamplacedeps" + _ "stream.place/streamplace/pkg/placestreamdeps" // _ "github.com/go-gst/go-glib/glib" // _ "github.com/go-gst/go-gst/gst" ) diff --git a/go.mod b/go.mod index df3d561a..feb686a2 100644 --- a/go.mod +++ b/go.mod @@ -67,7 +67,7 @@ require ( github.com/starttoaster/prometheus-exporter-scraper v0.0.1 github.com/streamplace/atmoq-go v0.0.2 github.com/streamplace/atproto-oauth-golang v0.0.0-20260413212710-98956064d06c - github.com/streamplace/glex v0.0.0-20260709192106-b16a1b201ee4 + github.com/streamplace/glex v0.0.0-20260709212339-df843c76e0fa github.com/streamplace/muxl/go v0.3.4 github.com/streamplace/oatproxy v0.0.0-20260710202406-60d97b9d780b github.com/stretchr/testify v1.11.1 diff --git a/go.sum b/go.sum index 8944065e..261391da 100644 --- a/go.sum +++ b/go.sum @@ -1376,6 +1376,10 @@ github.com/streamplace/atproto-oauth-golang v0.0.0-20250619231223-a9c04fb888ac h github.com/streamplace/atproto-oauth-golang v0.0.0-20250619231223-a9c04fb888ac/go.mod h1:9LlKkqciiO5lRfbX0n4Wn5KNY9nvFb4R3by8FdW2TWc= github.com/streamplace/glex v0.0.0-20260709192106-b16a1b201ee4 h1:6SVXLgRwRX3nFQi+h8cyud8s98GeRoJ8jBVtm3Sxucc= github.com/streamplace/glex v0.0.0-20260709192106-b16a1b201ee4/go.mod h1:33czt2ilG9oouO8fq1GzfwMr4QE278Of3ptNx6/28mw= +github.com/streamplace/glex v0.0.0-20260709212141-f72cc880edd8 h1:4WqGNFWzf2VaX2AAh7GelDUh+7Ww/sZtYRMufh815xs= +github.com/streamplace/glex v0.0.0-20260709212141-f72cc880edd8/go.mod h1:33czt2ilG9oouO8fq1GzfwMr4QE278Of3ptNx6/28mw= +github.com/streamplace/glex v0.0.0-20260709212339-df843c76e0fa h1:10l5UzKkQJdyjBRPGvgny2VbBxWkAC+tu/Gx13iCOJ8= +github.com/streamplace/glex v0.0.0-20260709212339-df843c76e0fa/go.mod h1:33czt2ilG9oouO8fq1GzfwMr4QE278Of3ptNx6/28mw= github.com/streamplace/go-dpop v0.0.0-20250510031900-c897158a8ad4 h1:L1fS4HJSaAyNnkwfuZubgfeZy8rkWmA0cMtH5Z0HqNc= github.com/streamplace/go-dpop v0.0.0-20250510031900-c897158a8ad4/go.mod h1:bGUXY9Wd4mnd+XUrOYZr358J2f6z9QO/dLhL1SsiD+0= github.com/streamplace/indigo v0.0.0-20260218231908-939cdaf0c507 h1:e8M3qPLr37NxEjlr18TaAwGP+OVyherVjgUG5VVmgWI= diff --git a/pkg/api/api.go b/pkg/api/api.go index bd43ab1c..31ca610d 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -45,7 +45,7 @@ import ( "stream.place/streamplace/pkg/notifications" "stream.place/streamplace/pkg/spxrpc" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/upload" "stream.place/streamplace/pkg/viewlog" diff --git a/pkg/api/vod_transfer.go b/pkg/api/vod_transfer.go index 649e4fc4..6dde2bb4 100644 --- a/pkg/api/vod_transfer.go +++ b/pkg/api/vod_transfer.go @@ -14,7 +14,7 @@ import ( "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/errors" "stream.place/streamplace/pkg/log" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/vod" ) diff --git a/pkg/api/websocket.go b/pkg/api/websocket.go index 1b1c3b23..0583c616 100644 --- a/pkg/api/websocket.go +++ b/pkg/api/websocket.go @@ -18,7 +18,7 @@ import ( "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/renditions" "stream.place/streamplace/pkg/spmetrics" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // todo: does this mean a whole message has to fit within the buffer? diff --git a/pkg/appbsky/actordefs.go b/pkg/appbsky/actordefs.go new file mode 100644 index 00000000..24689a79 --- /dev/null +++ b/pkg/appbsky/actordefs.go @@ -0,0 +1,1175 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.defs + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +// ActorDefs_AdultContentPref is a "adultContentPref" in the app.bsky.actor.defs schema. +type ActorDefs_AdultContentPref struct { + LexiconTypeID string `json:"$type"` + Enabled bool `json:"enabled"` +} + +func (t *ActorDefs_AdultContentPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_AdultContentPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_BskyAppProgressGuide is a "bskyAppProgressGuide" in the app.bsky.actor.defs schema. +// +// If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. +type ActorDefs_BskyAppProgressGuide struct { + LexiconTypeID string `json:"$type"` + Guide string `json:"guide"` +} + +func (t *ActorDefs_BskyAppProgressGuide) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_BskyAppProgressGuide) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_BskyAppStatePref is a "bskyAppStatePref" in the app.bsky.actor.defs schema. +// +// A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. +type ActorDefs_BskyAppStatePref struct { + LexiconTypeID string `json:"$type"` + ActiveProgressGuide *ActorDefs_BskyAppProgressGuide `json:"activeProgressGuide,omitempty"` + // nuxs: Storage for NUXs the user has encountered. + Nuxs []ActorDefs_Nux `json:"nuxs,omitempty"` + // queuedNudges: An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. + QueuedNudges []string `json:"queuedNudges,omitempty"` +} + +func (t *ActorDefs_BskyAppStatePref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_BskyAppStatePref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_ContentLabelPref is a "contentLabelPref" in the app.bsky.actor.defs schema. +type ActorDefs_ContentLabelPref struct { + LexiconTypeID string `json:"$type"` + Label string `json:"label"` + // labelerDid: Which labeler does this preference apply to? If undefined, applies globally. + LabelerDid *string `json:"labelerDid,omitempty"` + Visibility string `json:"visibility"` +} + +func (t *ActorDefs_ContentLabelPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ContentLabelPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_FeedViewPref is a "feedViewPref" in the app.bsky.actor.defs schema. +type ActorDefs_FeedViewPref struct { + LexiconTypeID string `json:"$type"` + // feed: The URI of the feed, or an identifier which describes the feed. + Feed string `json:"feed"` + // hideQuotePosts: Hide quote posts in the feed. + HideQuotePosts *bool `json:"hideQuotePosts,omitempty"` + // hideReplies: Hide replies in the feed. + HideReplies *bool `json:"hideReplies,omitempty"` + // hideRepliesByLikeCount: Hide replies in the feed if they do not have this number of likes. + HideRepliesByLikeCount *int64 `json:"hideRepliesByLikeCount,omitempty"` + // hideRepliesByUnfollowed: Hide replies in the feed if they are not by followed users. + HideRepliesByUnfollowed *bool `json:"hideRepliesByUnfollowed,omitempty"` + // hideReposts: Hide reposts in the feed. + HideReposts *bool `json:"hideReposts,omitempty"` +} + +func (t *ActorDefs_FeedViewPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_FeedViewPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_HiddenPostsPref is a "hiddenPostsPref" in the app.bsky.actor.defs schema. +type ActorDefs_HiddenPostsPref struct { + LexiconTypeID string `json:"$type"` + // items: A list of URIs of posts the account owner has hidden. + Items []string `json:"items"` +} + +func (t *ActorDefs_HiddenPostsPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_HiddenPostsPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_InterestsPref is a "interestsPref" in the app.bsky.actor.defs schema. +type ActorDefs_InterestsPref struct { + LexiconTypeID string `json:"$type"` + // tags: A list of tags which describe the account owner's interests gathered during onboarding. + Tags []string `json:"tags"` +} + +func (t *ActorDefs_InterestsPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_InterestsPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_KnownFollowers is a "knownFollowers" in the app.bsky.actor.defs schema. +// +// The subject's followers whom you also follow +type ActorDefs_KnownFollowers struct { + LexiconTypeID string `json:"$type"` + Count int64 `json:"count"` + Followers []ActorDefs_ProfileViewBasic `json:"followers"` +} + +func (t *ActorDefs_KnownFollowers) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_KnownFollowers) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_LabelerPrefItem is a "labelerPrefItem" in the app.bsky.actor.defs schema. +type ActorDefs_LabelerPrefItem struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` +} + +func (t *ActorDefs_LabelerPrefItem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_LabelerPrefItem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_LabelersPref is a "labelersPref" in the app.bsky.actor.defs schema. +type ActorDefs_LabelersPref struct { + LexiconTypeID string `json:"$type"` + Labelers []ActorDefs_LabelerPrefItem `json:"labelers"` +} + +func (t *ActorDefs_LabelersPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_LabelersPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_MutedWord is a "mutedWord" in the app.bsky.actor.defs schema. +// +// A word that the account owner has muted. +type ActorDefs_MutedWord struct { + LexiconTypeID string `json:"$type"` + // actorTarget: Groups of users to apply the muted word to. If undefined, applies to all users. + ActorTarget *string `json:"actorTarget,omitempty"` + // expiresAt: The date and time at which the muted word will expire and no longer be applied. + ExpiresAt *string `json:"expiresAt,omitempty"` + Id *string `json:"id,omitempty"` + // targets: The intended targets of the muted word. + Targets []string `json:"targets"` + // value: The muted word itself. + Value string `json:"value"` +} + +func (t *ActorDefs_MutedWord) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_MutedWord) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_MutedWordsPref is a "mutedWordsPref" in the app.bsky.actor.defs schema. +type ActorDefs_MutedWordsPref struct { + LexiconTypeID string `json:"$type"` + // items: A list of words the account owner has muted. + Items []ActorDefs_MutedWord `json:"items"` +} + +func (t *ActorDefs_MutedWordsPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_MutedWordsPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_Nux is a "nux" in the app.bsky.actor.defs schema. +// +// A new user experiences (NUX) storage object +type ActorDefs_Nux struct { + LexiconTypeID string `json:"$type"` + Completed bool `json:"completed"` + // data: Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. + Data *string `json:"data,omitempty"` + // expiresAt: The date and time at which the NUX will expire and should be considered completed. + ExpiresAt *string `json:"expiresAt,omitempty"` + Id string `json:"id"` +} + +func (t *ActorDefs_Nux) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_Nux) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_PersonalDetailsPref is a "personalDetailsPref" in the app.bsky.actor.defs schema. +type ActorDefs_PersonalDetailsPref struct { + LexiconTypeID string `json:"$type"` + // birthDate: The birth date of account owner. + BirthDate *string `json:"birthDate,omitempty"` +} + +func (t *ActorDefs_PersonalDetailsPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_PersonalDetailsPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_PostInteractionSettingsPref is a "postInteractionSettingsPref" in the app.bsky.actor.defs schema. +// +// Default post interaction settings for the account. These values should be applied as default values when creating new posts. These refs should mirror the threadgate and postgate records exactly. +type ActorDefs_PostInteractionSettingsPref struct { + LexiconTypeID string `json:"$type"` + // postgateEmbeddingRules: Matches postgate record. List of rules defining who can embed this users posts. If value is an empty array or is undefined, no particular rules apply and anyone can embed. + PostgateEmbeddingRules []ActorDefs_PostInteractionSettingsPref_PostgateEmbeddingRules_Elem `json:"postgateEmbeddingRules,omitempty"` + // threadgateAllowRules: Matches threadgate record. List of rules defining who can reply to this users posts. If value is an empty array, no one can reply. If value is undefined, anyone can reply. + ThreadgateAllowRules []ActorDefs_PostInteractionSettingsPref_ThreadgateAllowRules_Elem `json:"threadgateAllowRules,omitempty"` +} + +func (t *ActorDefs_PostInteractionSettingsPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_PostInteractionSettingsPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ActorDefs_PostInteractionSettingsPref_PostgateEmbeddingRules_Elem struct { + FeedPostgate_DisableRule *FeedPostgate_DisableRule +} + +func (t *ActorDefs_PostInteractionSettingsPref_PostgateEmbeddingRules_Elem) MarshalJSON() ([]byte, error) { + if t.FeedPostgate_DisableRule != nil { + t.FeedPostgate_DisableRule.LexiconTypeID = "app.bsky.feed.postgate#disableRule" + return json.Marshal(t.FeedPostgate_DisableRule) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ActorDefs_PostInteractionSettingsPref_PostgateEmbeddingRules_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.postgate#disableRule": + t.FeedPostgate_DisableRule = new(FeedPostgate_DisableRule) + return json.Unmarshal(b, t.FeedPostgate_DisableRule) + default: + return nil + } +} + +func (t *ActorDefs_PostInteractionSettingsPref_PostgateEmbeddingRules_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedPostgate_DisableRule != nil { + return t.FeedPostgate_DisableRule.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ActorDefs_PostInteractionSettingsPref_PostgateEmbeddingRules_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.postgate#disableRule": + t.FeedPostgate_DisableRule = new(FeedPostgate_DisableRule) + return t.FeedPostgate_DisableRule.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +type ActorDefs_PostInteractionSettingsPref_ThreadgateAllowRules_Elem struct { + FeedThreadgate_FollowerRule *FeedThreadgate_FollowerRule + FeedThreadgate_FollowingRule *FeedThreadgate_FollowingRule + FeedThreadgate_ListRule *FeedThreadgate_ListRule + FeedThreadgate_MentionRule *FeedThreadgate_MentionRule +} + +func (t *ActorDefs_PostInteractionSettingsPref_ThreadgateAllowRules_Elem) MarshalJSON() ([]byte, error) { + if t.FeedThreadgate_FollowerRule != nil { + t.FeedThreadgate_FollowerRule.LexiconTypeID = "app.bsky.feed.threadgate#followerRule" + return json.Marshal(t.FeedThreadgate_FollowerRule) + } + if t.FeedThreadgate_FollowingRule != nil { + t.FeedThreadgate_FollowingRule.LexiconTypeID = "app.bsky.feed.threadgate#followingRule" + return json.Marshal(t.FeedThreadgate_FollowingRule) + } + if t.FeedThreadgate_ListRule != nil { + t.FeedThreadgate_ListRule.LexiconTypeID = "app.bsky.feed.threadgate#listRule" + return json.Marshal(t.FeedThreadgate_ListRule) + } + if t.FeedThreadgate_MentionRule != nil { + t.FeedThreadgate_MentionRule.LexiconTypeID = "app.bsky.feed.threadgate#mentionRule" + return json.Marshal(t.FeedThreadgate_MentionRule) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ActorDefs_PostInteractionSettingsPref_ThreadgateAllowRules_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.threadgate#followerRule": + t.FeedThreadgate_FollowerRule = new(FeedThreadgate_FollowerRule) + return json.Unmarshal(b, t.FeedThreadgate_FollowerRule) + case "app.bsky.feed.threadgate#followingRule": + t.FeedThreadgate_FollowingRule = new(FeedThreadgate_FollowingRule) + return json.Unmarshal(b, t.FeedThreadgate_FollowingRule) + case "app.bsky.feed.threadgate#listRule": + t.FeedThreadgate_ListRule = new(FeedThreadgate_ListRule) + return json.Unmarshal(b, t.FeedThreadgate_ListRule) + case "app.bsky.feed.threadgate#mentionRule": + t.FeedThreadgate_MentionRule = new(FeedThreadgate_MentionRule) + return json.Unmarshal(b, t.FeedThreadgate_MentionRule) + default: + return nil + } +} + +func (t *ActorDefs_PostInteractionSettingsPref_ThreadgateAllowRules_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedThreadgate_FollowerRule != nil { + return t.FeedThreadgate_FollowerRule.MarshalCBOR(w) + } + if t.FeedThreadgate_FollowingRule != nil { + return t.FeedThreadgate_FollowingRule.MarshalCBOR(w) + } + if t.FeedThreadgate_ListRule != nil { + return t.FeedThreadgate_ListRule.MarshalCBOR(w) + } + if t.FeedThreadgate_MentionRule != nil { + return t.FeedThreadgate_MentionRule.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ActorDefs_PostInteractionSettingsPref_ThreadgateAllowRules_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.threadgate#followerRule": + t.FeedThreadgate_FollowerRule = new(FeedThreadgate_FollowerRule) + return t.FeedThreadgate_FollowerRule.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.threadgate#followingRule": + t.FeedThreadgate_FollowingRule = new(FeedThreadgate_FollowingRule) + return t.FeedThreadgate_FollowingRule.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.threadgate#listRule": + t.FeedThreadgate_ListRule = new(FeedThreadgate_ListRule) + return t.FeedThreadgate_ListRule.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.threadgate#mentionRule": + t.FeedThreadgate_MentionRule = new(FeedThreadgate_MentionRule) + return t.FeedThreadgate_MentionRule.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +type ActorDefs_Preferences struct { + ActorDefs_AdultContentPref *ActorDefs_AdultContentPref + ActorDefs_BskyAppStatePref *ActorDefs_BskyAppStatePref + ActorDefs_ContentLabelPref *ActorDefs_ContentLabelPref + ActorDefs_FeedViewPref *ActorDefs_FeedViewPref + ActorDefs_HiddenPostsPref *ActorDefs_HiddenPostsPref + ActorDefs_InterestsPref *ActorDefs_InterestsPref + ActorDefs_LabelersPref *ActorDefs_LabelersPref + ActorDefs_MutedWordsPref *ActorDefs_MutedWordsPref + ActorDefs_PersonalDetailsPref *ActorDefs_PersonalDetailsPref + ActorDefs_PostInteractionSettingsPref *ActorDefs_PostInteractionSettingsPref + ActorDefs_SavedFeedsPref *ActorDefs_SavedFeedsPref + ActorDefs_SavedFeedsPrefV2 *ActorDefs_SavedFeedsPrefV2 + ActorDefs_ThreadViewPref *ActorDefs_ThreadViewPref + ActorDefs_VerificationPrefs *ActorDefs_VerificationPrefs +} + +func (t *ActorDefs_Preferences) MarshalJSON() ([]byte, error) { + if t.ActorDefs_AdultContentPref != nil { + t.ActorDefs_AdultContentPref.LexiconTypeID = "app.bsky.actor.defs#adultContentPref" + return json.Marshal(t.ActorDefs_AdultContentPref) + } + if t.ActorDefs_BskyAppStatePref != nil { + t.ActorDefs_BskyAppStatePref.LexiconTypeID = "app.bsky.actor.defs#bskyAppStatePref" + return json.Marshal(t.ActorDefs_BskyAppStatePref) + } + if t.ActorDefs_ContentLabelPref != nil { + t.ActorDefs_ContentLabelPref.LexiconTypeID = "app.bsky.actor.defs#contentLabelPref" + return json.Marshal(t.ActorDefs_ContentLabelPref) + } + if t.ActorDefs_FeedViewPref != nil { + t.ActorDefs_FeedViewPref.LexiconTypeID = "app.bsky.actor.defs#feedViewPref" + return json.Marshal(t.ActorDefs_FeedViewPref) + } + if t.ActorDefs_HiddenPostsPref != nil { + t.ActorDefs_HiddenPostsPref.LexiconTypeID = "app.bsky.actor.defs#hiddenPostsPref" + return json.Marshal(t.ActorDefs_HiddenPostsPref) + } + if t.ActorDefs_InterestsPref != nil { + t.ActorDefs_InterestsPref.LexiconTypeID = "app.bsky.actor.defs#interestsPref" + return json.Marshal(t.ActorDefs_InterestsPref) + } + if t.ActorDefs_LabelersPref != nil { + t.ActorDefs_LabelersPref.LexiconTypeID = "app.bsky.actor.defs#labelersPref" + return json.Marshal(t.ActorDefs_LabelersPref) + } + if t.ActorDefs_MutedWordsPref != nil { + t.ActorDefs_MutedWordsPref.LexiconTypeID = "app.bsky.actor.defs#mutedWordsPref" + return json.Marshal(t.ActorDefs_MutedWordsPref) + } + if t.ActorDefs_PersonalDetailsPref != nil { + t.ActorDefs_PersonalDetailsPref.LexiconTypeID = "app.bsky.actor.defs#personalDetailsPref" + return json.Marshal(t.ActorDefs_PersonalDetailsPref) + } + if t.ActorDefs_PostInteractionSettingsPref != nil { + t.ActorDefs_PostInteractionSettingsPref.LexiconTypeID = "app.bsky.actor.defs#postInteractionSettingsPref" + return json.Marshal(t.ActorDefs_PostInteractionSettingsPref) + } + if t.ActorDefs_SavedFeedsPref != nil { + t.ActorDefs_SavedFeedsPref.LexiconTypeID = "app.bsky.actor.defs#savedFeedsPref" + return json.Marshal(t.ActorDefs_SavedFeedsPref) + } + if t.ActorDefs_SavedFeedsPrefV2 != nil { + t.ActorDefs_SavedFeedsPrefV2.LexiconTypeID = "app.bsky.actor.defs#savedFeedsPrefV2" + return json.Marshal(t.ActorDefs_SavedFeedsPrefV2) + } + if t.ActorDefs_ThreadViewPref != nil { + t.ActorDefs_ThreadViewPref.LexiconTypeID = "app.bsky.actor.defs#threadViewPref" + return json.Marshal(t.ActorDefs_ThreadViewPref) + } + if t.ActorDefs_VerificationPrefs != nil { + t.ActorDefs_VerificationPrefs.LexiconTypeID = "app.bsky.actor.defs#verificationPrefs" + return json.Marshal(t.ActorDefs_VerificationPrefs) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ActorDefs_Preferences) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.actor.defs#adultContentPref": + t.ActorDefs_AdultContentPref = new(ActorDefs_AdultContentPref) + return json.Unmarshal(b, t.ActorDefs_AdultContentPref) + case "app.bsky.actor.defs#bskyAppStatePref": + t.ActorDefs_BskyAppStatePref = new(ActorDefs_BskyAppStatePref) + return json.Unmarshal(b, t.ActorDefs_BskyAppStatePref) + case "app.bsky.actor.defs#contentLabelPref": + t.ActorDefs_ContentLabelPref = new(ActorDefs_ContentLabelPref) + return json.Unmarshal(b, t.ActorDefs_ContentLabelPref) + case "app.bsky.actor.defs#feedViewPref": + t.ActorDefs_FeedViewPref = new(ActorDefs_FeedViewPref) + return json.Unmarshal(b, t.ActorDefs_FeedViewPref) + case "app.bsky.actor.defs#hiddenPostsPref": + t.ActorDefs_HiddenPostsPref = new(ActorDefs_HiddenPostsPref) + return json.Unmarshal(b, t.ActorDefs_HiddenPostsPref) + case "app.bsky.actor.defs#interestsPref": + t.ActorDefs_InterestsPref = new(ActorDefs_InterestsPref) + return json.Unmarshal(b, t.ActorDefs_InterestsPref) + case "app.bsky.actor.defs#labelersPref": + t.ActorDefs_LabelersPref = new(ActorDefs_LabelersPref) + return json.Unmarshal(b, t.ActorDefs_LabelersPref) + case "app.bsky.actor.defs#mutedWordsPref": + t.ActorDefs_MutedWordsPref = new(ActorDefs_MutedWordsPref) + return json.Unmarshal(b, t.ActorDefs_MutedWordsPref) + case "app.bsky.actor.defs#personalDetailsPref": + t.ActorDefs_PersonalDetailsPref = new(ActorDefs_PersonalDetailsPref) + return json.Unmarshal(b, t.ActorDefs_PersonalDetailsPref) + case "app.bsky.actor.defs#postInteractionSettingsPref": + t.ActorDefs_PostInteractionSettingsPref = new(ActorDefs_PostInteractionSettingsPref) + return json.Unmarshal(b, t.ActorDefs_PostInteractionSettingsPref) + case "app.bsky.actor.defs#savedFeedsPref": + t.ActorDefs_SavedFeedsPref = new(ActorDefs_SavedFeedsPref) + return json.Unmarshal(b, t.ActorDefs_SavedFeedsPref) + case "app.bsky.actor.defs#savedFeedsPrefV2": + t.ActorDefs_SavedFeedsPrefV2 = new(ActorDefs_SavedFeedsPrefV2) + return json.Unmarshal(b, t.ActorDefs_SavedFeedsPrefV2) + case "app.bsky.actor.defs#threadViewPref": + t.ActorDefs_ThreadViewPref = new(ActorDefs_ThreadViewPref) + return json.Unmarshal(b, t.ActorDefs_ThreadViewPref) + case "app.bsky.actor.defs#verificationPrefs": + t.ActorDefs_VerificationPrefs = new(ActorDefs_VerificationPrefs) + return json.Unmarshal(b, t.ActorDefs_VerificationPrefs) + default: + return nil + } +} + +func (t *ActorDefs_Preferences) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.ActorDefs_AdultContentPref != nil { + return t.ActorDefs_AdultContentPref.MarshalCBOR(w) + } + if t.ActorDefs_BskyAppStatePref != nil { + return t.ActorDefs_BskyAppStatePref.MarshalCBOR(w) + } + if t.ActorDefs_ContentLabelPref != nil { + return t.ActorDefs_ContentLabelPref.MarshalCBOR(w) + } + if t.ActorDefs_FeedViewPref != nil { + return t.ActorDefs_FeedViewPref.MarshalCBOR(w) + } + if t.ActorDefs_HiddenPostsPref != nil { + return t.ActorDefs_HiddenPostsPref.MarshalCBOR(w) + } + if t.ActorDefs_InterestsPref != nil { + return t.ActorDefs_InterestsPref.MarshalCBOR(w) + } + if t.ActorDefs_LabelersPref != nil { + return t.ActorDefs_LabelersPref.MarshalCBOR(w) + } + if t.ActorDefs_MutedWordsPref != nil { + return t.ActorDefs_MutedWordsPref.MarshalCBOR(w) + } + if t.ActorDefs_PersonalDetailsPref != nil { + return t.ActorDefs_PersonalDetailsPref.MarshalCBOR(w) + } + if t.ActorDefs_PostInteractionSettingsPref != nil { + return t.ActorDefs_PostInteractionSettingsPref.MarshalCBOR(w) + } + if t.ActorDefs_SavedFeedsPref != nil { + return t.ActorDefs_SavedFeedsPref.MarshalCBOR(w) + } + if t.ActorDefs_SavedFeedsPrefV2 != nil { + return t.ActorDefs_SavedFeedsPrefV2.MarshalCBOR(w) + } + if t.ActorDefs_ThreadViewPref != nil { + return t.ActorDefs_ThreadViewPref.MarshalCBOR(w) + } + if t.ActorDefs_VerificationPrefs != nil { + return t.ActorDefs_VerificationPrefs.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ActorDefs_Preferences) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.actor.defs#adultContentPref": + t.ActorDefs_AdultContentPref = new(ActorDefs_AdultContentPref) + return t.ActorDefs_AdultContentPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#bskyAppStatePref": + t.ActorDefs_BskyAppStatePref = new(ActorDefs_BskyAppStatePref) + return t.ActorDefs_BskyAppStatePref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#contentLabelPref": + t.ActorDefs_ContentLabelPref = new(ActorDefs_ContentLabelPref) + return t.ActorDefs_ContentLabelPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#feedViewPref": + t.ActorDefs_FeedViewPref = new(ActorDefs_FeedViewPref) + return t.ActorDefs_FeedViewPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#hiddenPostsPref": + t.ActorDefs_HiddenPostsPref = new(ActorDefs_HiddenPostsPref) + return t.ActorDefs_HiddenPostsPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#interestsPref": + t.ActorDefs_InterestsPref = new(ActorDefs_InterestsPref) + return t.ActorDefs_InterestsPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#labelersPref": + t.ActorDefs_LabelersPref = new(ActorDefs_LabelersPref) + return t.ActorDefs_LabelersPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#mutedWordsPref": + t.ActorDefs_MutedWordsPref = new(ActorDefs_MutedWordsPref) + return t.ActorDefs_MutedWordsPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#personalDetailsPref": + t.ActorDefs_PersonalDetailsPref = new(ActorDefs_PersonalDetailsPref) + return t.ActorDefs_PersonalDetailsPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#postInteractionSettingsPref": + t.ActorDefs_PostInteractionSettingsPref = new(ActorDefs_PostInteractionSettingsPref) + return t.ActorDefs_PostInteractionSettingsPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#savedFeedsPref": + t.ActorDefs_SavedFeedsPref = new(ActorDefs_SavedFeedsPref) + return t.ActorDefs_SavedFeedsPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#savedFeedsPrefV2": + t.ActorDefs_SavedFeedsPrefV2 = new(ActorDefs_SavedFeedsPrefV2) + return t.ActorDefs_SavedFeedsPrefV2.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#threadViewPref": + t.ActorDefs_ThreadViewPref = new(ActorDefs_ThreadViewPref) + return t.ActorDefs_ThreadViewPref.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.actor.defs#verificationPrefs": + t.ActorDefs_VerificationPrefs = new(ActorDefs_VerificationPrefs) + return t.ActorDefs_VerificationPrefs.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// ActorDefs_ProfileAssociated is a "profileAssociated" in the app.bsky.actor.defs schema. +type ActorDefs_ProfileAssociated struct { + LexiconTypeID string `json:"$type"` + ActivitySubscription *ActorDefs_ProfileAssociatedActivitySubscription `json:"activitySubscription,omitempty"` + Chat *ActorDefs_ProfileAssociatedChat `json:"chat,omitempty"` + Feedgens *int64 `json:"feedgens,omitempty"` + Labeler *bool `json:"labeler,omitempty"` + Lists *int64 `json:"lists,omitempty"` + StarterPacks *int64 `json:"starterPacks,omitempty"` +} + +func (t *ActorDefs_ProfileAssociated) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ProfileAssociated) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_ProfileAssociatedActivitySubscription is a "profileAssociatedActivitySubscription" in the app.bsky.actor.defs schema. +type ActorDefs_ProfileAssociatedActivitySubscription struct { + LexiconTypeID string `json:"$type"` + AllowSubscriptions string `json:"allowSubscriptions"` +} + +func (t *ActorDefs_ProfileAssociatedActivitySubscription) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ProfileAssociatedActivitySubscription) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_ProfileAssociatedChat is a "profileAssociatedChat" in the app.bsky.actor.defs schema. +type ActorDefs_ProfileAssociatedChat struct { + LexiconTypeID string `json:"$type"` + AllowIncoming string `json:"allowIncoming"` +} + +func (t *ActorDefs_ProfileAssociatedChat) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ProfileAssociatedChat) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_ProfileView is a "profileView" in the app.bsky.actor.defs schema. +type ActorDefs_ProfileView struct { + LexiconTypeID string `json:"$type"` + Associated *ActorDefs_ProfileAssociated `json:"associated,omitempty"` + Avatar *string `json:"avatar,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + // debug: Debug information for internal development + Debug *glexrt.LexiconTypeDecoder `json:"debug,omitempty"` + Description *string `json:"description,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + Handle string `json:"handle"` + IndexedAt *string `json:"indexedAt,omitempty"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + Pronouns *string `json:"pronouns,omitempty"` + Status *ActorDefs_StatusView `json:"status,omitempty"` + Verification *ActorDefs_VerificationState `json:"verification,omitempty"` + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty"` +} + +func (t *ActorDefs_ProfileView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ProfileView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_ProfileViewBasic is a "profileViewBasic" in the app.bsky.actor.defs schema. +type ActorDefs_ProfileViewBasic struct { + LexiconTypeID string `json:"$type"` + Associated *ActorDefs_ProfileAssociated `json:"associated,omitempty"` + Avatar *string `json:"avatar,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + // debug: Debug information for internal development + Debug *glexrt.LexiconTypeDecoder `json:"debug,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + Handle string `json:"handle"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + Pronouns *string `json:"pronouns,omitempty"` + Status *ActorDefs_StatusView `json:"status,omitempty"` + Verification *ActorDefs_VerificationState `json:"verification,omitempty"` + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty"` +} + +func (t *ActorDefs_ProfileViewBasic) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ProfileViewBasic) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_ProfileViewDetailed is a "profileViewDetailed" in the app.bsky.actor.defs schema. +type ActorDefs_ProfileViewDetailed struct { + LexiconTypeID string `json:"$type"` + Associated *ActorDefs_ProfileAssociated `json:"associated,omitempty"` + Avatar *string `json:"avatar,omitempty"` + Banner *string `json:"banner,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + // debug: Debug information for internal development + Debug *glexrt.LexiconTypeDecoder `json:"debug,omitempty"` + Description *string `json:"description,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + FollowersCount *int64 `json:"followersCount,omitempty"` + FollowsCount *int64 `json:"followsCount,omitempty"` + Handle string `json:"handle"` + IndexedAt *string `json:"indexedAt,omitempty"` + JoinedViaStarterPack *GraphDefs_StarterPackViewBasic `json:"joinedViaStarterPack,omitempty"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + PinnedPost *comatproto.RepoStrongRef `json:"pinnedPost,omitempty"` + PostsCount *int64 `json:"postsCount,omitempty"` + Pronouns *string `json:"pronouns,omitempty"` + Status *ActorDefs_StatusView `json:"status,omitempty"` + Verification *ActorDefs_VerificationState `json:"verification,omitempty"` + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty"` + Website *string `json:"website,omitempty"` +} + +func (t *ActorDefs_ProfileViewDetailed) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ProfileViewDetailed) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_SavedFeed is a "savedFeed" in the app.bsky.actor.defs schema. +type ActorDefs_SavedFeed struct { + LexiconTypeID string `json:"$type"` + Id string `json:"id"` + Pinned bool `json:"pinned"` + Type string `json:"type"` + Value string `json:"value"` +} + +func (t *ActorDefs_SavedFeed) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_SavedFeed) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_SavedFeedsPref is a "savedFeedsPref" in the app.bsky.actor.defs schema. +type ActorDefs_SavedFeedsPref struct { + LexiconTypeID string `json:"$type"` + Pinned []string `json:"pinned"` + Saved []string `json:"saved"` + TimelineIndex *int64 `json:"timelineIndex,omitempty"` +} + +func (t *ActorDefs_SavedFeedsPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_SavedFeedsPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_SavedFeedsPrefV2 is a "savedFeedsPrefV2" in the app.bsky.actor.defs schema. +type ActorDefs_SavedFeedsPrefV2 struct { + LexiconTypeID string `json:"$type"` + Items []ActorDefs_SavedFeed `json:"items"` +} + +func (t *ActorDefs_SavedFeedsPrefV2) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_SavedFeedsPrefV2) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_StatusView is a "statusView" in the app.bsky.actor.defs schema. +type ActorDefs_StatusView struct { + LexiconTypeID string `json:"$type"` + // embed: An optional embed associated with the status. + Embed *ActorDefs_StatusView_Embed `json:"embed,omitempty"` + // expiresAt: The date when this status will expire. The application might choose to no longer return the status after expiration. + ExpiresAt *string `json:"expiresAt,omitempty"` + // isActive: True if the status is not expired, false if it is expired. Only present if expiration was set. + IsActive *bool `json:"isActive,omitempty"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + // status: The status for the account. + Status string `json:"status"` +} + +func (t *ActorDefs_StatusView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_StatusView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// An optional embed associated with the status. +type ActorDefs_StatusView_Embed struct { + EmbedExternal_View *EmbedExternal_View +} + +func (t *ActorDefs_StatusView_Embed) MarshalJSON() ([]byte, error) { + if t.EmbedExternal_View != nil { + t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" + return json.Marshal(t.EmbedExternal_View) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ActorDefs_StatusView_Embed) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return json.Unmarshal(b, t.EmbedExternal_View) + default: + return nil + } +} + +func (t *ActorDefs_StatusView_Embed) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedExternal_View != nil { + return t.EmbedExternal_View.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ActorDefs_StatusView_Embed) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return t.EmbedExternal_View.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// ActorDefs_ThreadViewPref is a "threadViewPref" in the app.bsky.actor.defs schema. +type ActorDefs_ThreadViewPref struct { + LexiconTypeID string `json:"$type"` + // sort: Sorting mode for threads. + Sort *string `json:"sort,omitempty"` +} + +func (t *ActorDefs_ThreadViewPref) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ThreadViewPref) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_VerificationPrefs is a "verificationPrefs" in the app.bsky.actor.defs schema. +// +// Preferences for how verified accounts appear in the app. +type ActorDefs_VerificationPrefs struct { + LexiconTypeID string `json:"$type"` + // hideBadges: Hide the blue check badges for verified accounts and trusted verifiers. + HideBadges *bool `json:"hideBadges,omitempty"` +} + +func (t *ActorDefs_VerificationPrefs) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_VerificationPrefs) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_VerificationState is a "verificationState" in the app.bsky.actor.defs schema. +// +// Represents the verification information about the user this object is attached to. +type ActorDefs_VerificationState struct { + LexiconTypeID string `json:"$type"` + // trustedVerifierStatus: The user's status as a trusted verifier. + TrustedVerifierStatus string `json:"trustedVerifierStatus"` + // verifications: All verifications issued by trusted verifiers on behalf of this user. Verifications by untrusted verifiers are not included. + Verifications []ActorDefs_VerificationView `json:"verifications"` + // verifiedStatus: The user's status as a verified account. + VerifiedStatus string `json:"verifiedStatus"` +} + +func (t *ActorDefs_VerificationState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_VerificationState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_VerificationView is a "verificationView" in the app.bsky.actor.defs schema. +// +// An individual verification for an associated subject. +type ActorDefs_VerificationView struct { + LexiconTypeID string `json:"$type"` + // createdAt: Timestamp when the verification was created. + CreatedAt string `json:"createdAt"` + // isValid: True if the verification passes validation, otherwise false. + IsValid bool `json:"isValid"` + // issuer: The user who issued this verification. + Issuer string `json:"issuer"` + // uri: The AT-URI of the verification record. + Uri string `json:"uri"` +} + +func (t *ActorDefs_VerificationView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_VerificationView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorDefs_ViewerState is a "viewerState" in the app.bsky.actor.defs schema. +// +// Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. +type ActorDefs_ViewerState struct { + LexiconTypeID string `json:"$type"` + // activitySubscription: This property is present only in selected cases, as an optimization. + ActivitySubscription *NotificationDefs_ActivitySubscription `json:"activitySubscription,omitempty"` + BlockedBy *bool `json:"blockedBy,omitempty"` + Blocking *string `json:"blocking,omitempty"` + BlockingByList *GraphDefs_ListViewBasic `json:"blockingByList,omitempty"` + FollowedBy *string `json:"followedBy,omitempty"` + Following *string `json:"following,omitempty"` + // knownFollowers: This property is present only in selected cases, as an optimization. + KnownFollowers *ActorDefs_KnownFollowers `json:"knownFollowers,omitempty"` + Muted *bool `json:"muted,omitempty"` + MutedByList *GraphDefs_ListViewBasic `json:"mutedByList,omitempty"` +} + +func (t *ActorDefs_ViewerState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorDefs_ViewerState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/actorgetpreferences.go b/pkg/appbsky/actorgetpreferences.go new file mode 100644 index 00000000..1dc18eda --- /dev/null +++ b/pkg/appbsky/actorgetpreferences.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.getPreferences + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ActorGetPreferences_Output struct { + LexiconTypeID string `json:"$type"` + Preferences ActorDefs_Preferences `json:"preferences"` +} + +func (t *ActorGetPreferences_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.getPreferences#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorGetPreferences_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorGetPreferences calls the XRPC method "app.bsky.actor.getPreferences". +// +// Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth. +func ActorGetPreferences(ctx context.Context, c glexrt.LexClient) (*ActorGetPreferences_Output, error) { + var out ActorGetPreferences_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.actor.getPreferences", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/actorgetprofile.go b/pkg/appbsky/actorgetprofile.go new file mode 100644 index 00000000..2d48759e --- /dev/null +++ b/pkg/appbsky/actorgetprofile.go @@ -0,0 +1,28 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.getProfile + +package appbsky + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// ActorGetProfile calls the XRPC method "app.bsky.actor.getProfile". +// +// Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. +// +// actor: Handle or DID of account to fetch profile of. +func ActorGetProfile(ctx context.Context, c glexrt.LexClient, actor string) (*ActorDefs_ProfileViewDetailed, error) { + var out ActorDefs_ProfileViewDetailed + + params := map[string]interface{}{} + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.actor.getProfile", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/actorgetprofiles.go b/pkg/appbsky/actorgetprofiles.go new file mode 100644 index 00000000..a7c4f460 --- /dev/null +++ b/pkg/appbsky/actorgetprofiles.go @@ -0,0 +1,46 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.getProfiles + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ActorGetProfiles_Output struct { + LexiconTypeID string `json:"$type"` + Profiles []ActorDefs_ProfileViewDetailed `json:"profiles"` +} + +func (t *ActorGetProfiles_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.getProfiles#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorGetProfiles_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorGetProfiles calls the XRPC method "app.bsky.actor.getProfiles". +// +// Get detailed profile views of multiple actors. +func ActorGetProfiles(ctx context.Context, c glexrt.LexClient, actors []string) (*ActorGetProfiles_Output, error) { + var out ActorGetProfiles_Output + + params := map[string]interface{}{} + params["actors"] = actors + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.actor.getProfiles", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/actorgetsuggestions.go b/pkg/appbsky/actorgetsuggestions.go new file mode 100644 index 00000000..114e4ae2 --- /dev/null +++ b/pkg/appbsky/actorgetsuggestions.go @@ -0,0 +1,54 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.getSuggestions + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ActorGetSuggestions_Output struct { + LexiconTypeID string `json:"$type"` + Actors []ActorDefs_ProfileView `json:"actors"` + Cursor *string `json:"cursor,omitempty"` + // recId: Snowflake for this recommendation, use when submitting recommendation events. + RecId *int64 `json:"recId,omitempty"` +} + +func (t *ActorGetSuggestions_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.getSuggestions#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorGetSuggestions_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorGetSuggestions calls the XRPC method "app.bsky.actor.getSuggestions". +// +// Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding. +func ActorGetSuggestions(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*ActorGetSuggestions_Output, error) { + var out ActorGetSuggestions_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.actor.getSuggestions", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/actorprofile.go b/pkg/appbsky/actorprofile.go new file mode 100644 index 00000000..c4313662 --- /dev/null +++ b/pkg/appbsky/actorprofile.go @@ -0,0 +1,108 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.profile + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.actor.profile", &ActorProfile{}) +} + +// A declaration of a Bluesky account profile. +type ActorProfile struct { + LexiconTypeID string `json:"$type"` + // avatar: Small image to be displayed next to posts from account. AKA, 'profile picture' + Avatar *glexrt.Blob `json:"avatar,omitempty"` + // banner: Larger horizontal image to display behind profile view. + Banner *glexrt.Blob `json:"banner,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + // description: Free-form profile description text. + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + JoinedViaStarterPack *comatproto.RepoStrongRef `json:"joinedViaStarterPack,omitempty"` + // labels: Self-label values, specific to the Bluesky application, on the overall account. + Labels *ActorProfile_Labels `json:"labels,omitempty"` + PinnedPost *comatproto.RepoStrongRef `json:"pinnedPost,omitempty"` + // pronouns: Free-form pronouns text. + Pronouns *string `json:"pronouns,omitempty"` + Website *string `json:"website,omitempty"` +} + +func (t *ActorProfile) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.profile" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorProfile) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Self-label values, specific to the Bluesky application, on the overall account. +type ActorProfile_Labels struct { + LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels +} + +func (t *ActorProfile_Labels) MarshalJSON() ([]byte, error) { + if t.LabelDefs_SelfLabels != nil { + t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels" + return json.Marshal(t.LabelDefs_SelfLabels) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ActorProfile_Labels) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return json.Unmarshal(b, t.LabelDefs_SelfLabels) + default: + return nil + } +} + +func (t *ActorProfile_Labels) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelDefs_SelfLabels != nil { + return t.LabelDefs_SelfLabels.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ActorProfile_Labels) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/actorputpreferences.go b/pkg/appbsky/actorputpreferences.go new file mode 100644 index 00000000..b63848e1 --- /dev/null +++ b/pkg/appbsky/actorputpreferences.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.putPreferences + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ActorPutPreferences_Input struct { + LexiconTypeID string `json:"$type"` + Preferences ActorDefs_Preferences `json:"preferences"` +} + +func (t *ActorPutPreferences_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.putPreferences#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorPutPreferences_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorPutPreferences calls the XRPC method "app.bsky.actor.putPreferences". +// +// Set the private preferences attached to the account. +func ActorPutPreferences(ctx context.Context, c glexrt.LexClient, input *ActorPutPreferences_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.actor.putPreferences", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/actorsearchactors.go b/pkg/appbsky/actorsearchactors.go new file mode 100644 index 00000000..654dab41 --- /dev/null +++ b/pkg/appbsky/actorsearchactors.go @@ -0,0 +1,61 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.searchActors + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ActorSearchActors_Output struct { + LexiconTypeID string `json:"$type"` + Actors []ActorDefs_ProfileView `json:"actors"` + Cursor *string `json:"cursor,omitempty"` +} + +func (t *ActorSearchActors_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.searchActors#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorSearchActors_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorSearchActors calls the XRPC method "app.bsky.actor.searchActors". +// +// Find actors (profiles) matching search criteria. Does not require auth. +// +// q: Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. +// term: DEPRECATED: use 'q' instead. +func ActorSearchActors(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, q string, term string) (*ActorSearchActors_Output, error) { + var out ActorSearchActors_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if q != "" { + params["q"] = q + } + if term != "" { + params["term"] = term + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.actor.searchActors", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/actorsearchactorstypeahead.go b/pkg/appbsky/actorsearchactorstypeahead.go new file mode 100644 index 00000000..93660ee3 --- /dev/null +++ b/pkg/appbsky/actorsearchactorstypeahead.go @@ -0,0 +1,57 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.searchActorsTypeahead + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ActorSearchActorsTypeahead_Output struct { + LexiconTypeID string `json:"$type"` + Actors []ActorDefs_ProfileViewBasic `json:"actors"` +} + +func (t *ActorSearchActorsTypeahead_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.searchActorsTypeahead#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorSearchActorsTypeahead_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ActorSearchActorsTypeahead calls the XRPC method "app.bsky.actor.searchActorsTypeahead". +// +// Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. +// +// q: Search query prefix; not a full query string. +// term: DEPRECATED: use 'q' instead. +func ActorSearchActorsTypeahead(ctx context.Context, c glexrt.LexClient, limit *int64, q string, term string) (*ActorSearchActorsTypeahead_Output, error) { + var out ActorSearchActorsTypeahead_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + if q != "" { + params["q"] = q + } + if term != "" { + params["term"] = term + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.actor.searchActorsTypeahead", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/actorstatus.go b/pkg/appbsky/actorstatus.go new file mode 100644 index 00000000..541b239e --- /dev/null +++ b/pkg/appbsky/actorstatus.go @@ -0,0 +1,99 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.actor.status + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.actor.status", &ActorStatus{}) +} + +// A declaration of a Bluesky account status. +type ActorStatus struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + // durationMinutes: The duration of the status in minutes. Applications can choose to impose minimum and maximum limits. + DurationMinutes *int64 `json:"durationMinutes,omitempty"` + // embed: An optional embed associated with the status. + Embed *ActorStatus_Embed `json:"embed,omitempty"` + // status: The status for the account. + Status string `json:"status"` +} + +func (t *ActorStatus) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.actor.status" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ActorStatus) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// An optional embed associated with the status. +type ActorStatus_Embed struct { + EmbedExternal *EmbedExternal +} + +func (t *ActorStatus_Embed) MarshalJSON() ([]byte, error) { + if t.EmbedExternal != nil { + t.EmbedExternal.LexiconTypeID = "app.bsky.embed.external" + return json.Marshal(t.EmbedExternal) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ActorStatus_Embed) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external": + t.EmbedExternal = new(EmbedExternal) + return json.Unmarshal(b, t.EmbedExternal) + default: + return nil + } +} + +func (t *ActorStatus_Embed) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedExternal != nil { + return t.EmbedExternal.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ActorStatus_Embed) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external": + t.EmbedExternal = new(EmbedExternal) + return t.EmbedExternal.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/ageassurancebegin.go b/pkg/appbsky/ageassurancebegin.go new file mode 100644 index 00000000..67d99569 --- /dev/null +++ b/pkg/appbsky/ageassurancebegin.go @@ -0,0 +1,50 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.begin + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AgeassuranceBegin_Input struct { + LexiconTypeID string `json:"$type"` + // countryCode: An ISO 3166-1 alpha-2 code of the user's location. + CountryCode string `json:"countryCode"` + // email: The user's email address to receive Age Assurance instructions. + Email string `json:"email"` + // language: The user's preferred language for communication during the Age Assurance process. + Language string `json:"language"` + // regionCode: An optional ISO 3166-2 code of the user's region or state within the country. + RegionCode *string `json:"regionCode,omitempty"` +} + +func (t *AgeassuranceBegin_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.begin#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceBegin_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceBegin calls the XRPC method "app.bsky.ageassurance.begin". +// +// Initiate Age Assurance for an account. +func AgeassuranceBegin(ctx context.Context, c glexrt.LexClient, input *AgeassuranceBegin_Input) (*AgeassuranceDefs_State, error) { + var out AgeassuranceDefs_State + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.ageassurance.begin", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/ageassurancedefs.go b/pkg/appbsky/ageassurancedefs.go new file mode 100644 index 00000000..b3715bb4 --- /dev/null +++ b/pkg/appbsky/ageassurancedefs.go @@ -0,0 +1,446 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.defs + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// AgeassuranceDefs_Config is a "config" in the app.bsky.ageassurance.defs schema. +type AgeassuranceDefs_Config struct { + LexiconTypeID string `json:"$type"` + // regions: The per-region Age Assurance configuration. + Regions []AgeassuranceDefs_ConfigRegion `json:"regions"` +} + +func (t *AgeassuranceDefs_Config) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_Config) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_ConfigRegion is a "configRegion" in the app.bsky.ageassurance.defs schema. +// +// The Age Assurance configuration for a specific region. +type AgeassuranceDefs_ConfigRegion struct { + LexiconTypeID string `json:"$type"` + // countryCode: The ISO 3166-1 alpha-2 country code this configuration applies to. + CountryCode string `json:"countryCode"` + // regionCode: The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country. + RegionCode *string `json:"regionCode,omitempty"` + // rules: The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item. + Rules []AgeassuranceDefs_ConfigRegion_Rules_Elem `json:"rules"` +} + +func (t *AgeassuranceDefs_ConfigRegion) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegion) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type AgeassuranceDefs_ConfigRegion_Rules_Elem struct { + AgeassuranceDefs_ConfigRegionRuleDefault *AgeassuranceDefs_ConfigRegionRuleDefault + AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan *AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan + AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan *AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan + AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge *AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge + AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge *AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge + AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge *AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge + AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge *AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge +} + +func (t *AgeassuranceDefs_ConfigRegion_Rules_Elem) MarshalJSON() ([]byte, error) { + if t.AgeassuranceDefs_ConfigRegionRuleDefault != nil { + t.AgeassuranceDefs_ConfigRegionRuleDefault.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleDefault" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleDefault) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *AgeassuranceDefs_ConfigRegion_Rules_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.ageassurance.defs#configRegionRuleDefault": + t.AgeassuranceDefs_ConfigRegionRuleDefault = new(AgeassuranceDefs_ConfigRegionRuleDefault) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleDefault) + case "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan": + t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan = new(AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) + case "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan": + t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan = new(AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) + case "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge": + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge = new(AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) + case "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge": + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge = new(AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) + case "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge": + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge = new(AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) + case "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge": + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge = new(AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) + default: + return nil + } +} + +func (t *AgeassuranceDefs_ConfigRegion_Rules_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.AgeassuranceDefs_ConfigRegionRuleDefault != nil { + return t.AgeassuranceDefs_ConfigRegionRuleDefault.MarshalCBOR(w) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan != nil { + return t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan.MarshalCBOR(w) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan != nil { + return t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan.MarshalCBOR(w) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge != nil { + return t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge.MarshalCBOR(w) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge != nil { + return t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge.MarshalCBOR(w) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge != nil { + return t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge.MarshalCBOR(w) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge != nil { + return t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *AgeassuranceDefs_ConfigRegion_Rules_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.ageassurance.defs#configRegionRuleDefault": + t.AgeassuranceDefs_ConfigRegionRuleDefault = new(AgeassuranceDefs_ConfigRegionRuleDefault) + return t.AgeassuranceDefs_ConfigRegionRuleDefault.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan": + t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan = new(AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) + return t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan": + t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan = new(AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) + return t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge": + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge = new(AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) + return t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge": + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge = new(AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) + return t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge": + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge = new(AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) + return t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge": + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge = new(AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) + return t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// AgeassuranceDefs_ConfigRegionRuleDefault is a "configRegionRuleDefault" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies by default. +type AgeassuranceDefs_ConfigRegionRuleDefault struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` +} + +func (t *AgeassuranceDefs_ConfigRegionRuleDefault) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegionRuleDefault) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan is a "configRegionRuleIfAccountNewerThan" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the account is equal-to or newer than a certain date. +type AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` + // date: The date threshold as a datetime string. + Date string `json:"date"` +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan is a "configRegionRuleIfAccountOlderThan" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the account is older than a certain date. +type AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` + // date: The date threshold as a datetime string. + Date string `json:"date"` +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge is a "configRegionRuleIfAssuredOverAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age"` +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge is a "configRegionRuleIfAssuredUnderAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has been assured to be under a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age"` +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge is a "configRegionRuleIfDeclaredOverAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age"` +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge is a "configRegionRuleIfDeclaredUnderAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has declared themselves under a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age"` +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_Event is a "event" in the app.bsky.ageassurance.defs schema. +// +// Object used to store Age Assurance data in stash. +type AgeassuranceDefs_Event struct { + LexiconTypeID string `json:"$type"` + // access: The access level granted based on Age Assurance data we've processed. + Access string `json:"access"` + // attemptId: The unique identifier for this instance of the Age Assurance flow, in UUID format. + AttemptId string `json:"attemptId"` + // completeIp: The IP address used when completing the Age Assurance flow. + CompleteIp *string `json:"completeIp,omitempty"` + // completeUa: The user agent used when completing the Age Assurance flow. + CompleteUa *string `json:"completeUa,omitempty"` + // countryCode: The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow. + CountryCode string `json:"countryCode"` + // createdAt: The date and time of this write operation. + CreatedAt string `json:"createdAt"` + // email: The email used for Age Assurance. + Email *string `json:"email,omitempty"` + // initIp: The IP address used when initiating the Age Assurance flow. + InitIp *string `json:"initIp,omitempty"` + // initUa: The user agent used when initiating the Age Assurance flow. + InitUa *string `json:"initUa,omitempty"` + // regionCode: The ISO 3166-2 region code provided when beginning the Age Assurance flow. + RegionCode *string `json:"regionCode,omitempty"` + // status: The status of the Age Assurance process. + Status string `json:"status"` +} + +func (t *AgeassuranceDefs_Event) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_Event) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_State is a "state" in the app.bsky.ageassurance.defs schema. +// +// The user's computed Age Assurance state. +type AgeassuranceDefs_State struct { + LexiconTypeID string `json:"$type"` + Access string `json:"access"` + // lastInitiatedAt: The timestamp when this state was last updated. + LastInitiatedAt *string `json:"lastInitiatedAt,omitempty"` + Status string `json:"status"` +} + +func (t *AgeassuranceDefs_State) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_State) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceDefs_StateMetadata is a "stateMetadata" in the app.bsky.ageassurance.defs schema. +// +// Additional metadata needed to compute Age Assurance state client-side. +type AgeassuranceDefs_StateMetadata struct { + LexiconTypeID string `json:"$type"` + // accountCreatedAt: The account creation timestamp. + AccountCreatedAt *string `json:"accountCreatedAt,omitempty"` +} + +func (t *AgeassuranceDefs_StateMetadata) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceDefs_StateMetadata) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/ageassurancegetconfig.go b/pkg/appbsky/ageassurancegetconfig.go new file mode 100644 index 00000000..05da9af7 --- /dev/null +++ b/pkg/appbsky/ageassurancegetconfig.go @@ -0,0 +1,23 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.getConfig + +package appbsky + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// AgeassuranceGetConfig calls the XRPC method "app.bsky.ageassurance.getConfig". +// +// Returns Age Assurance configuration for use on the client. +func AgeassuranceGetConfig(ctx context.Context, c glexrt.LexClient) (*AgeassuranceDefs_Config, error) { + var out AgeassuranceDefs_Config + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.ageassurance.getConfig", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/ageassurancegetstate.go b/pkg/appbsky/ageassurancegetstate.go new file mode 100644 index 00000000..af974089 --- /dev/null +++ b/pkg/appbsky/ageassurancegetstate.go @@ -0,0 +1,50 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.getState + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AgeassuranceGetState_Output struct { + LexiconTypeID string `json:"$type"` + Metadata AgeassuranceDefs_StateMetadata `json:"metadata"` + State AgeassuranceDefs_State `json:"state"` +} + +func (t *AgeassuranceGetState_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.ageassurance.getState#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AgeassuranceGetState_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AgeassuranceGetState calls the XRPC method "app.bsky.ageassurance.getState". +// +// Returns server-computed Age Assurance state, if available, and any additional metadata needed to compute Age Assurance state client-side. +func AgeassuranceGetState(ctx context.Context, c glexrt.LexClient, countryCode string, regionCode string) (*AgeassuranceGetState_Output, error) { + var out AgeassuranceGetState_Output + + params := map[string]interface{}{} + if regionCode != "" { + params["regionCode"] = regionCode + } + params["countryCode"] = countryCode + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.ageassurance.getState", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/bookmarkcreatebookmark.go b/pkg/appbsky/bookmarkcreatebookmark.go new file mode 100644 index 00000000..2053a6c3 --- /dev/null +++ b/pkg/appbsky/bookmarkcreatebookmark.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.bookmark.createBookmark + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type BookmarkCreateBookmark_Input struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Uri string `json:"uri"` +} + +func (t *BookmarkCreateBookmark_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.bookmark.createBookmark#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *BookmarkCreateBookmark_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// BookmarkCreateBookmark calls the XRPC method "app.bsky.bookmark.createBookmark". +// +// Creates a private bookmark for the specified record. Currently, only `app.bsky.feed.post` records are supported. Requires authentication. +func BookmarkCreateBookmark(ctx context.Context, c glexrt.LexClient, input *BookmarkCreateBookmark_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.bookmark.createBookmark", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/bookmarkdefs.go b/pkg/appbsky/bookmarkdefs.go new file mode 100644 index 00000000..5d17a51c --- /dev/null +++ b/pkg/appbsky/bookmarkdefs.go @@ -0,0 +1,142 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.bookmark.defs + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +// BookmarkDefs_Bookmark is a "bookmark" in the app.bsky.bookmark.defs schema. +// +// Object used to store bookmark data in stash. +type BookmarkDefs_Bookmark struct { + LexiconTypeID string `json:"$type"` + // subject: A strong ref to the record to be bookmarked. Currently, only `app.bsky.feed.post` records are supported. + Subject comatproto.RepoStrongRef `json:"subject"` +} + +func (t *BookmarkDefs_Bookmark) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.bookmark.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *BookmarkDefs_Bookmark) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// BookmarkDefs_BookmarkView is a "bookmarkView" in the app.bsky.bookmark.defs schema. +type BookmarkDefs_BookmarkView struct { + LexiconTypeID string `json:"$type"` + CreatedAt *string `json:"createdAt,omitempty"` + Item BookmarkDefs_BookmarkView_Item `json:"item"` + // subject: A strong ref to the bookmarked record. + Subject comatproto.RepoStrongRef `json:"subject"` +} + +func (t *BookmarkDefs_BookmarkView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.bookmark.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *BookmarkDefs_BookmarkView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type BookmarkDefs_BookmarkView_Item struct { + FeedDefs_BlockedPost *FeedDefs_BlockedPost + FeedDefs_NotFoundPost *FeedDefs_NotFoundPost + FeedDefs_PostView *FeedDefs_PostView +} + +func (t *BookmarkDefs_BookmarkView_Item) MarshalJSON() ([]byte, error) { + if t.FeedDefs_BlockedPost != nil { + t.FeedDefs_BlockedPost.LexiconTypeID = "app.bsky.feed.defs#blockedPost" + return json.Marshal(t.FeedDefs_BlockedPost) + } + if t.FeedDefs_NotFoundPost != nil { + t.FeedDefs_NotFoundPost.LexiconTypeID = "app.bsky.feed.defs#notFoundPost" + return json.Marshal(t.FeedDefs_NotFoundPost) + } + if t.FeedDefs_PostView != nil { + t.FeedDefs_PostView.LexiconTypeID = "app.bsky.feed.defs#postView" + return json.Marshal(t.FeedDefs_PostView) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *BookmarkDefs_BookmarkView_Item) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return json.Unmarshal(b, t.FeedDefs_BlockedPost) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return json.Unmarshal(b, t.FeedDefs_NotFoundPost) + case "app.bsky.feed.defs#postView": + t.FeedDefs_PostView = new(FeedDefs_PostView) + return json.Unmarshal(b, t.FeedDefs_PostView) + default: + return nil + } +} + +func (t *BookmarkDefs_BookmarkView_Item) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_BlockedPost != nil { + return t.FeedDefs_BlockedPost.MarshalCBOR(w) + } + if t.FeedDefs_NotFoundPost != nil { + return t.FeedDefs_NotFoundPost.MarshalCBOR(w) + } + if t.FeedDefs_PostView != nil { + return t.FeedDefs_PostView.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *BookmarkDefs_BookmarkView_Item) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return t.FeedDefs_BlockedPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return t.FeedDefs_NotFoundPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#postView": + t.FeedDefs_PostView = new(FeedDefs_PostView) + return t.FeedDefs_PostView.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/bookmarkdeletebookmark.go b/pkg/appbsky/bookmarkdeletebookmark.go new file mode 100644 index 00000000..1576cbe1 --- /dev/null +++ b/pkg/appbsky/bookmarkdeletebookmark.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.bookmark.deleteBookmark + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type BookmarkDeleteBookmark_Input struct { + LexiconTypeID string `json:"$type"` + Uri string `json:"uri"` +} + +func (t *BookmarkDeleteBookmark_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.bookmark.deleteBookmark#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *BookmarkDeleteBookmark_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// BookmarkDeleteBookmark calls the XRPC method "app.bsky.bookmark.deleteBookmark". +// +// Deletes a private bookmark for the specified record. Currently, only `app.bsky.feed.post` records are supported. Requires authentication. +func BookmarkDeleteBookmark(ctx context.Context, c glexrt.LexClient, input *BookmarkDeleteBookmark_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.bookmark.deleteBookmark", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/bookmarkgetbookmarks.go b/pkg/appbsky/bookmarkgetbookmarks.go new file mode 100644 index 00000000..fd851646 --- /dev/null +++ b/pkg/appbsky/bookmarkgetbookmarks.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.bookmark.getBookmarks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type BookmarkGetBookmarks_Output struct { + LexiconTypeID string `json:"$type"` + Bookmarks []BookmarkDefs_BookmarkView `json:"bookmarks"` + Cursor *string `json:"cursor,omitempty"` +} + +func (t *BookmarkGetBookmarks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.bookmark.getBookmarks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *BookmarkGetBookmarks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// BookmarkGetBookmarks calls the XRPC method "app.bsky.bookmark.getBookmarks". +// +// Gets views of records bookmarked by the authenticated user. Requires authentication. +func BookmarkGetBookmarks(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*BookmarkGetBookmarks_Output, error) { + var out BookmarkGetBookmarks_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.bookmark.getBookmarks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/embeddefs.go b/pkg/appbsky/embeddefs.go new file mode 100644 index 00000000..4b74991a --- /dev/null +++ b/pkg/appbsky/embeddefs.go @@ -0,0 +1,34 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.embed.defs + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// EmbedDefs_AspectRatio is a "aspectRatio" in the app.bsky.embed.defs schema. +// +// width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. +type EmbedDefs_AspectRatio struct { + LexiconTypeID string `json:"$type"` + Height int64 `json:"height"` + Width int64 `json:"width"` +} + +func (t *EmbedDefs_AspectRatio) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedDefs_AspectRatio) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/embedexternal.go b/pkg/appbsky/embedexternal.go new file mode 100644 index 00000000..b6b1bfc6 --- /dev/null +++ b/pkg/appbsky/embedexternal.go @@ -0,0 +1,98 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.embed.external + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.embed.external#main", &EmbedExternal{}) +} + +// A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). +type EmbedExternal struct { + LexiconTypeID string `json:"$type"` + External EmbedExternal_External `json:"external"` +} + +func (t *EmbedExternal) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.external" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedExternal) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedExternal_External is a "external" in the app.bsky.embed.external schema. +type EmbedExternal_External struct { + LexiconTypeID string `json:"$type"` + Description string `json:"description"` + Thumb *glexrt.Blob `json:"thumb,omitempty"` + Title string `json:"title"` + Uri string `json:"uri"` +} + +func (t *EmbedExternal_External) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.external" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedExternal_External) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedExternal_View is a "view" in the app.bsky.embed.external schema. +type EmbedExternal_View struct { + LexiconTypeID string `json:"$type"` + External EmbedExternal_ViewExternal `json:"external"` +} + +func (t *EmbedExternal_View) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.external" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedExternal_View) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedExternal_ViewExternal is a "viewExternal" in the app.bsky.embed.external schema. +type EmbedExternal_ViewExternal struct { + LexiconTypeID string `json:"$type"` + Description string `json:"description"` + Thumb *string `json:"thumb,omitempty"` + Title string `json:"title"` + Uri string `json:"uri"` +} + +func (t *EmbedExternal_ViewExternal) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.external" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedExternal_ViewExternal) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/embedimages.go b/pkg/appbsky/embedimages.go new file mode 100644 index 00000000..f6dbd9ac --- /dev/null +++ b/pkg/appbsky/embedimages.go @@ -0,0 +1,100 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.embed.images + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.embed.images#main", &EmbedImages{}) +} + +type EmbedImages struct { + LexiconTypeID string `json:"$type"` + Images []EmbedImages_Image `json:"images"` +} + +func (t *EmbedImages) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.images" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedImages) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedImages_Image is a "image" in the app.bsky.embed.images schema. +type EmbedImages_Image struct { + LexiconTypeID string `json:"$type"` + // alt: Alt text description of the image, for accessibility. + Alt string `json:"alt"` + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty"` + Image glexrt.Blob `json:"image"` +} + +func (t *EmbedImages_Image) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.images" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedImages_Image) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedImages_View is a "view" in the app.bsky.embed.images schema. +type EmbedImages_View struct { + LexiconTypeID string `json:"$type"` + Images []EmbedImages_ViewImage `json:"images"` +} + +func (t *EmbedImages_View) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.images" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedImages_View) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedImages_ViewImage is a "viewImage" in the app.bsky.embed.images schema. +type EmbedImages_ViewImage struct { + LexiconTypeID string `json:"$type"` + // alt: Alt text description of the image, for accessibility. + Alt string `json:"alt"` + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty"` + // fullsize: Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. + Fullsize string `json:"fullsize"` + // thumb: Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. + Thumb string `json:"thumb"` +} + +func (t *EmbedImages_ViewImage) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.images" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedImages_ViewImage) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/embedrecord.go b/pkg/appbsky/embedrecord.go new file mode 100644 index 00000000..7dfd8bba --- /dev/null +++ b/pkg/appbsky/embedrecord.go @@ -0,0 +1,410 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.embed.record + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.embed.record#main", &EmbedRecord{}) +} + +type EmbedRecord struct { + LexiconTypeID string `json:"$type"` + Record comatproto.RepoStrongRef `json:"record"` +} + +func (t *EmbedRecord) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.record" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecord) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedRecord_View is a "view" in the app.bsky.embed.record schema. +type EmbedRecord_View struct { + LexiconTypeID string `json:"$type"` + Record EmbedRecord_View_Record `json:"record"` +} + +func (t *EmbedRecord_View) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.record" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecord_View) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type EmbedRecord_View_Record struct { + EmbedRecord_ViewBlocked *EmbedRecord_ViewBlocked + EmbedRecord_ViewDetached *EmbedRecord_ViewDetached + EmbedRecord_ViewNotFound *EmbedRecord_ViewNotFound + EmbedRecord_ViewRecord *EmbedRecord_ViewRecord + FeedDefs_GeneratorView *FeedDefs_GeneratorView + GraphDefs_ListView *GraphDefs_ListView + GraphDefs_StarterPackViewBasic *GraphDefs_StarterPackViewBasic + LabelerDefs_LabelerView *LabelerDefs_LabelerView +} + +func (t *EmbedRecord_View_Record) MarshalJSON() ([]byte, error) { + if t.EmbedRecord_ViewBlocked != nil { + t.EmbedRecord_ViewBlocked.LexiconTypeID = "app.bsky.embed.record#viewBlocked" + return json.Marshal(t.EmbedRecord_ViewBlocked) + } + if t.EmbedRecord_ViewDetached != nil { + t.EmbedRecord_ViewDetached.LexiconTypeID = "app.bsky.embed.record#viewDetached" + return json.Marshal(t.EmbedRecord_ViewDetached) + } + if t.EmbedRecord_ViewNotFound != nil { + t.EmbedRecord_ViewNotFound.LexiconTypeID = "app.bsky.embed.record#viewNotFound" + return json.Marshal(t.EmbedRecord_ViewNotFound) + } + if t.EmbedRecord_ViewRecord != nil { + t.EmbedRecord_ViewRecord.LexiconTypeID = "app.bsky.embed.record#viewRecord" + return json.Marshal(t.EmbedRecord_ViewRecord) + } + if t.FeedDefs_GeneratorView != nil { + t.FeedDefs_GeneratorView.LexiconTypeID = "app.bsky.feed.defs#generatorView" + return json.Marshal(t.FeedDefs_GeneratorView) + } + if t.GraphDefs_ListView != nil { + t.GraphDefs_ListView.LexiconTypeID = "app.bsky.graph.defs#listView" + return json.Marshal(t.GraphDefs_ListView) + } + if t.GraphDefs_StarterPackViewBasic != nil { + t.GraphDefs_StarterPackViewBasic.LexiconTypeID = "app.bsky.graph.defs#starterPackViewBasic" + return json.Marshal(t.GraphDefs_StarterPackViewBasic) + } + if t.LabelerDefs_LabelerView != nil { + t.LabelerDefs_LabelerView.LexiconTypeID = "app.bsky.labeler.defs#labelerView" + return json.Marshal(t.LabelerDefs_LabelerView) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *EmbedRecord_View_Record) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.record#viewBlocked": + t.EmbedRecord_ViewBlocked = new(EmbedRecord_ViewBlocked) + return json.Unmarshal(b, t.EmbedRecord_ViewBlocked) + case "app.bsky.embed.record#viewDetached": + t.EmbedRecord_ViewDetached = new(EmbedRecord_ViewDetached) + return json.Unmarshal(b, t.EmbedRecord_ViewDetached) + case "app.bsky.embed.record#viewNotFound": + t.EmbedRecord_ViewNotFound = new(EmbedRecord_ViewNotFound) + return json.Unmarshal(b, t.EmbedRecord_ViewNotFound) + case "app.bsky.embed.record#viewRecord": + t.EmbedRecord_ViewRecord = new(EmbedRecord_ViewRecord) + return json.Unmarshal(b, t.EmbedRecord_ViewRecord) + case "app.bsky.feed.defs#generatorView": + t.FeedDefs_GeneratorView = new(FeedDefs_GeneratorView) + return json.Unmarshal(b, t.FeedDefs_GeneratorView) + case "app.bsky.graph.defs#listView": + t.GraphDefs_ListView = new(GraphDefs_ListView) + return json.Unmarshal(b, t.GraphDefs_ListView) + case "app.bsky.graph.defs#starterPackViewBasic": + t.GraphDefs_StarterPackViewBasic = new(GraphDefs_StarterPackViewBasic) + return json.Unmarshal(b, t.GraphDefs_StarterPackViewBasic) + case "app.bsky.labeler.defs#labelerView": + t.LabelerDefs_LabelerView = new(LabelerDefs_LabelerView) + return json.Unmarshal(b, t.LabelerDefs_LabelerView) + default: + return nil + } +} + +func (t *EmbedRecord_View_Record) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedRecord_ViewBlocked != nil { + return t.EmbedRecord_ViewBlocked.MarshalCBOR(w) + } + if t.EmbedRecord_ViewDetached != nil { + return t.EmbedRecord_ViewDetached.MarshalCBOR(w) + } + if t.EmbedRecord_ViewNotFound != nil { + return t.EmbedRecord_ViewNotFound.MarshalCBOR(w) + } + if t.EmbedRecord_ViewRecord != nil { + return t.EmbedRecord_ViewRecord.MarshalCBOR(w) + } + if t.FeedDefs_GeneratorView != nil { + return t.FeedDefs_GeneratorView.MarshalCBOR(w) + } + if t.GraphDefs_ListView != nil { + return t.GraphDefs_ListView.MarshalCBOR(w) + } + if t.GraphDefs_StarterPackViewBasic != nil { + return t.GraphDefs_StarterPackViewBasic.MarshalCBOR(w) + } + if t.LabelerDefs_LabelerView != nil { + return t.LabelerDefs_LabelerView.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *EmbedRecord_View_Record) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.record#viewBlocked": + t.EmbedRecord_ViewBlocked = new(EmbedRecord_ViewBlocked) + return t.EmbedRecord_ViewBlocked.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.record#viewDetached": + t.EmbedRecord_ViewDetached = new(EmbedRecord_ViewDetached) + return t.EmbedRecord_ViewDetached.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.record#viewNotFound": + t.EmbedRecord_ViewNotFound = new(EmbedRecord_ViewNotFound) + return t.EmbedRecord_ViewNotFound.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.record#viewRecord": + t.EmbedRecord_ViewRecord = new(EmbedRecord_ViewRecord) + return t.EmbedRecord_ViewRecord.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#generatorView": + t.FeedDefs_GeneratorView = new(FeedDefs_GeneratorView) + return t.FeedDefs_GeneratorView.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.graph.defs#listView": + t.GraphDefs_ListView = new(GraphDefs_ListView) + return t.GraphDefs_ListView.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.graph.defs#starterPackViewBasic": + t.GraphDefs_StarterPackViewBasic = new(GraphDefs_StarterPackViewBasic) + return t.GraphDefs_StarterPackViewBasic.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.labeler.defs#labelerView": + t.LabelerDefs_LabelerView = new(LabelerDefs_LabelerView) + return t.LabelerDefs_LabelerView.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// EmbedRecord_ViewBlocked is a "viewBlocked" in the app.bsky.embed.record schema. +type EmbedRecord_ViewBlocked struct { + LexiconTypeID string `json:"$type"` + Author FeedDefs_BlockedAuthor `json:"author"` + Blocked bool `json:"blocked"` + Uri string `json:"uri"` +} + +func (t *EmbedRecord_ViewBlocked) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.record" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecord_ViewBlocked) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedRecord_ViewDetached is a "viewDetached" in the app.bsky.embed.record schema. +type EmbedRecord_ViewDetached struct { + LexiconTypeID string `json:"$type"` + Detached bool `json:"detached"` + Uri string `json:"uri"` +} + +func (t *EmbedRecord_ViewDetached) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.record" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecord_ViewDetached) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedRecord_ViewNotFound is a "viewNotFound" in the app.bsky.embed.record schema. +type EmbedRecord_ViewNotFound struct { + LexiconTypeID string `json:"$type"` + NotFound bool `json:"notFound"` + Uri string `json:"uri"` +} + +func (t *EmbedRecord_ViewNotFound) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.record" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecord_ViewNotFound) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedRecord_ViewRecord is a "viewRecord" in the app.bsky.embed.record schema. +type EmbedRecord_ViewRecord struct { + LexiconTypeID string `json:"$type"` + Author ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` + Embeds []EmbedRecord_ViewRecord_Embeds_Elem `json:"embeds,omitempty"` + IndexedAt string `json:"indexedAt"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + LikeCount *int64 `json:"likeCount,omitempty"` + QuoteCount *int64 `json:"quoteCount,omitempty"` + ReplyCount *int64 `json:"replyCount,omitempty"` + RepostCount *int64 `json:"repostCount,omitempty"` + Uri string `json:"uri"` + // value: The record data itself. + Value *glexrt.LexiconTypeDecoder `json:"value"` +} + +func (t *EmbedRecord_ViewRecord) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.record" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecord_ViewRecord) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type EmbedRecord_ViewRecord_Embeds_Elem struct { + EmbedExternal_View *EmbedExternal_View + EmbedImages_View *EmbedImages_View + EmbedRecordWithMedia_View *EmbedRecordWithMedia_View + EmbedRecord_View *EmbedRecord_View + EmbedVideo_View *EmbedVideo_View +} + +func (t *EmbedRecord_ViewRecord_Embeds_Elem) MarshalJSON() ([]byte, error) { + if t.EmbedExternal_View != nil { + t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" + return json.Marshal(t.EmbedExternal_View) + } + if t.EmbedImages_View != nil { + t.EmbedImages_View.LexiconTypeID = "app.bsky.embed.images#view" + return json.Marshal(t.EmbedImages_View) + } + if t.EmbedRecordWithMedia_View != nil { + t.EmbedRecordWithMedia_View.LexiconTypeID = "app.bsky.embed.recordWithMedia#view" + return json.Marshal(t.EmbedRecordWithMedia_View) + } + if t.EmbedRecord_View != nil { + t.EmbedRecord_View.LexiconTypeID = "app.bsky.embed.record#view" + return json.Marshal(t.EmbedRecord_View) + } + if t.EmbedVideo_View != nil { + t.EmbedVideo_View.LexiconTypeID = "app.bsky.embed.video#view" + return json.Marshal(t.EmbedVideo_View) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *EmbedRecord_ViewRecord_Embeds_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return json.Unmarshal(b, t.EmbedExternal_View) + case "app.bsky.embed.images#view": + t.EmbedImages_View = new(EmbedImages_View) + return json.Unmarshal(b, t.EmbedImages_View) + case "app.bsky.embed.recordWithMedia#view": + t.EmbedRecordWithMedia_View = new(EmbedRecordWithMedia_View) + return json.Unmarshal(b, t.EmbedRecordWithMedia_View) + case "app.bsky.embed.record#view": + t.EmbedRecord_View = new(EmbedRecord_View) + return json.Unmarshal(b, t.EmbedRecord_View) + case "app.bsky.embed.video#view": + t.EmbedVideo_View = new(EmbedVideo_View) + return json.Unmarshal(b, t.EmbedVideo_View) + default: + return nil + } +} + +func (t *EmbedRecord_ViewRecord_Embeds_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedExternal_View != nil { + return t.EmbedExternal_View.MarshalCBOR(w) + } + if t.EmbedImages_View != nil { + return t.EmbedImages_View.MarshalCBOR(w) + } + if t.EmbedRecordWithMedia_View != nil { + return t.EmbedRecordWithMedia_View.MarshalCBOR(w) + } + if t.EmbedRecord_View != nil { + return t.EmbedRecord_View.MarshalCBOR(w) + } + if t.EmbedVideo_View != nil { + return t.EmbedVideo_View.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *EmbedRecord_ViewRecord_Embeds_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return t.EmbedExternal_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.images#view": + t.EmbedImages_View = new(EmbedImages_View) + return t.EmbedImages_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.recordWithMedia#view": + t.EmbedRecordWithMedia_View = new(EmbedRecordWithMedia_View) + return t.EmbedRecordWithMedia_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.record#view": + t.EmbedRecord_View = new(EmbedRecord_View) + return t.EmbedRecord_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.video#view": + t.EmbedVideo_View = new(EmbedVideo_View) + return t.EmbedVideo_View.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/embedrecordwithmedia.go b/pkg/appbsky/embedrecordwithmedia.go new file mode 100644 index 00000000..24ccfb3c --- /dev/null +++ b/pkg/appbsky/embedrecordwithmedia.go @@ -0,0 +1,222 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.embed.recordWithMedia + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.embed.recordWithMedia#main", &EmbedRecordWithMedia{}) +} + +type EmbedRecordWithMedia struct { + LexiconTypeID string `json:"$type"` + Media EmbedRecordWithMedia_Media `json:"media"` + Record EmbedRecord `json:"record"` +} + +func (t *EmbedRecordWithMedia) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.recordWithMedia" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecordWithMedia) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type EmbedRecordWithMedia_Media struct { + EmbedExternal *EmbedExternal + EmbedImages *EmbedImages + EmbedVideo *EmbedVideo +} + +func (t *EmbedRecordWithMedia_Media) MarshalJSON() ([]byte, error) { + if t.EmbedExternal != nil { + t.EmbedExternal.LexiconTypeID = "app.bsky.embed.external" + return json.Marshal(t.EmbedExternal) + } + if t.EmbedImages != nil { + t.EmbedImages.LexiconTypeID = "app.bsky.embed.images" + return json.Marshal(t.EmbedImages) + } + if t.EmbedVideo != nil { + t.EmbedVideo.LexiconTypeID = "app.bsky.embed.video" + return json.Marshal(t.EmbedVideo) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *EmbedRecordWithMedia_Media) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external": + t.EmbedExternal = new(EmbedExternal) + return json.Unmarshal(b, t.EmbedExternal) + case "app.bsky.embed.images": + t.EmbedImages = new(EmbedImages) + return json.Unmarshal(b, t.EmbedImages) + case "app.bsky.embed.video": + t.EmbedVideo = new(EmbedVideo) + return json.Unmarshal(b, t.EmbedVideo) + default: + return nil + } +} + +func (t *EmbedRecordWithMedia_Media) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedExternal != nil { + return t.EmbedExternal.MarshalCBOR(w) + } + if t.EmbedImages != nil { + return t.EmbedImages.MarshalCBOR(w) + } + if t.EmbedVideo != nil { + return t.EmbedVideo.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *EmbedRecordWithMedia_Media) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external": + t.EmbedExternal = new(EmbedExternal) + return t.EmbedExternal.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.images": + t.EmbedImages = new(EmbedImages) + return t.EmbedImages.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.video": + t.EmbedVideo = new(EmbedVideo) + return t.EmbedVideo.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// EmbedRecordWithMedia_View is a "view" in the app.bsky.embed.recordWithMedia schema. +type EmbedRecordWithMedia_View struct { + LexiconTypeID string `json:"$type"` + Media EmbedRecordWithMedia_View_Media `json:"media"` + Record EmbedRecord_View `json:"record"` +} + +func (t *EmbedRecordWithMedia_View) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.recordWithMedia" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedRecordWithMedia_View) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type EmbedRecordWithMedia_View_Media struct { + EmbedExternal_View *EmbedExternal_View + EmbedImages_View *EmbedImages_View + EmbedVideo_View *EmbedVideo_View +} + +func (t *EmbedRecordWithMedia_View_Media) MarshalJSON() ([]byte, error) { + if t.EmbedExternal_View != nil { + t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" + return json.Marshal(t.EmbedExternal_View) + } + if t.EmbedImages_View != nil { + t.EmbedImages_View.LexiconTypeID = "app.bsky.embed.images#view" + return json.Marshal(t.EmbedImages_View) + } + if t.EmbedVideo_View != nil { + t.EmbedVideo_View.LexiconTypeID = "app.bsky.embed.video#view" + return json.Marshal(t.EmbedVideo_View) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *EmbedRecordWithMedia_View_Media) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return json.Unmarshal(b, t.EmbedExternal_View) + case "app.bsky.embed.images#view": + t.EmbedImages_View = new(EmbedImages_View) + return json.Unmarshal(b, t.EmbedImages_View) + case "app.bsky.embed.video#view": + t.EmbedVideo_View = new(EmbedVideo_View) + return json.Unmarshal(b, t.EmbedVideo_View) + default: + return nil + } +} + +func (t *EmbedRecordWithMedia_View_Media) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedExternal_View != nil { + return t.EmbedExternal_View.MarshalCBOR(w) + } + if t.EmbedImages_View != nil { + return t.EmbedImages_View.MarshalCBOR(w) + } + if t.EmbedVideo_View != nil { + return t.EmbedVideo_View.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *EmbedRecordWithMedia_View_Media) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return t.EmbedExternal_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.images#view": + t.EmbedImages_View = new(EmbedImages_View) + return t.EmbedImages_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.video#view": + t.EmbedVideo_View = new(EmbedVideo_View) + return t.EmbedVideo_View.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/embedvideo.go b/pkg/appbsky/embedvideo.go new file mode 100644 index 00000000..684fa3eb --- /dev/null +++ b/pkg/appbsky/embedvideo.go @@ -0,0 +1,82 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.embed.video + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.embed.video#main", &EmbedVideo{}) +} + +type EmbedVideo struct { + LexiconTypeID string `json:"$type"` + // alt: Alt text description of the video, for accessibility. + Alt *string `json:"alt,omitempty"` + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty"` + Captions []EmbedVideo_Caption `json:"captions,omitempty"` + // video: The mp4 video file. May be up to 100mb, formerly limited to 50mb. + Video glexrt.Blob `json:"video"` +} + +func (t *EmbedVideo) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.video" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedVideo) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedVideo_Caption is a "caption" in the app.bsky.embed.video schema. +type EmbedVideo_Caption struct { + LexiconTypeID string `json:"$type"` + File glexrt.Blob `json:"file"` + Lang string `json:"lang"` +} + +func (t *EmbedVideo_Caption) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.video" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedVideo_Caption) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// EmbedVideo_View is a "view" in the app.bsky.embed.video schema. +type EmbedVideo_View struct { + LexiconTypeID string `json:"$type"` + Alt *string `json:"alt,omitempty"` + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty"` + Cid string `json:"cid"` + Playlist string `json:"playlist"` + Thumbnail *string `json:"thumbnail,omitempty"` +} + +func (t *EmbedVideo_View) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.embed.video" + return glexrt.MarshalCBOR(w, t) +} + +func (t *EmbedVideo_View) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feeddefs.go b/pkg/appbsky/feeddefs.go new file mode 100644 index 00000000..91bdac52 --- /dev/null +++ b/pkg/appbsky/feeddefs.go @@ -0,0 +1,998 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.defs + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +// FeedDefs_BlockedAuthor is a "blockedAuthor" in the app.bsky.feed.defs schema. +type FeedDefs_BlockedAuthor struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty"` +} + +func (t *FeedDefs_BlockedAuthor) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_BlockedAuthor) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_BlockedPost is a "blockedPost" in the app.bsky.feed.defs schema. +type FeedDefs_BlockedPost struct { + LexiconTypeID string `json:"$type"` + Author FeedDefs_BlockedAuthor `json:"author"` + Blocked bool `json:"blocked"` + Uri string `json:"uri"` +} + +func (t *FeedDefs_BlockedPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_BlockedPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_FeedViewPost is a "feedViewPost" in the app.bsky.feed.defs schema. +type FeedDefs_FeedViewPost struct { + LexiconTypeID string `json:"$type"` + // feedContext: Context provided by feed generator that may be passed back alongside interactions. + FeedContext *string `json:"feedContext,omitempty"` + Post FeedDefs_PostView `json:"post"` + Reason *FeedDefs_FeedViewPost_Reason `json:"reason,omitempty"` + Reply *FeedDefs_ReplyRef `json:"reply,omitempty"` + // reqId: Unique identifier per request that may be passed back alongside interactions. + ReqId *string `json:"reqId,omitempty"` +} + +func (t *FeedDefs_FeedViewPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_FeedViewPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedDefs_FeedViewPost_Reason struct { + FeedDefs_ReasonPin *FeedDefs_ReasonPin + FeedDefs_ReasonRepost *FeedDefs_ReasonRepost +} + +func (t *FeedDefs_FeedViewPost_Reason) MarshalJSON() ([]byte, error) { + if t.FeedDefs_ReasonPin != nil { + t.FeedDefs_ReasonPin.LexiconTypeID = "app.bsky.feed.defs#reasonPin" + return json.Marshal(t.FeedDefs_ReasonPin) + } + if t.FeedDefs_ReasonRepost != nil { + t.FeedDefs_ReasonRepost.LexiconTypeID = "app.bsky.feed.defs#reasonRepost" + return json.Marshal(t.FeedDefs_ReasonRepost) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedDefs_FeedViewPost_Reason) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#reasonPin": + t.FeedDefs_ReasonPin = new(FeedDefs_ReasonPin) + return json.Unmarshal(b, t.FeedDefs_ReasonPin) + case "app.bsky.feed.defs#reasonRepost": + t.FeedDefs_ReasonRepost = new(FeedDefs_ReasonRepost) + return json.Unmarshal(b, t.FeedDefs_ReasonRepost) + default: + return nil + } +} + +func (t *FeedDefs_FeedViewPost_Reason) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_ReasonPin != nil { + return t.FeedDefs_ReasonPin.MarshalCBOR(w) + } + if t.FeedDefs_ReasonRepost != nil { + return t.FeedDefs_ReasonRepost.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedDefs_FeedViewPost_Reason) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#reasonPin": + t.FeedDefs_ReasonPin = new(FeedDefs_ReasonPin) + return t.FeedDefs_ReasonPin.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#reasonRepost": + t.FeedDefs_ReasonRepost = new(FeedDefs_ReasonRepost) + return t.FeedDefs_ReasonRepost.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedDefs_GeneratorView is a "generatorView" in the app.bsky.feed.defs schema. +type FeedDefs_GeneratorView struct { + LexiconTypeID string `json:"$type"` + AcceptsInteractions *bool `json:"acceptsInteractions,omitempty"` + Avatar *string `json:"avatar,omitempty"` + Cid string `json:"cid"` + ContentMode *string `json:"contentMode,omitempty"` + Creator ActorDefs_ProfileView `json:"creator"` + Description *string `json:"description,omitempty"` + DescriptionFacets []RichtextFacet `json:"descriptionFacets,omitempty"` + Did string `json:"did"` + DisplayName string `json:"displayName"` + IndexedAt string `json:"indexedAt"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + LikeCount *int64 `json:"likeCount,omitempty"` + Uri string `json:"uri"` + Viewer *FeedDefs_GeneratorViewerState `json:"viewer,omitempty"` +} + +func (t *FeedDefs_GeneratorView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_GeneratorView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_GeneratorViewerState is a "generatorViewerState" in the app.bsky.feed.defs schema. +type FeedDefs_GeneratorViewerState struct { + LexiconTypeID string `json:"$type"` + Like *string `json:"like,omitempty"` +} + +func (t *FeedDefs_GeneratorViewerState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_GeneratorViewerState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_Interaction is a "interaction" in the app.bsky.feed.defs schema. +type FeedDefs_Interaction struct { + LexiconTypeID string `json:"$type"` + Event *string `json:"event,omitempty"` + // feedContext: Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. + FeedContext *string `json:"feedContext,omitempty"` + Item *string `json:"item,omitempty"` + // reqId: Unique identifier per request that may be passed back alongside interactions. + ReqId *string `json:"reqId,omitempty"` +} + +func (t *FeedDefs_Interaction) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_Interaction) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_NotFoundPost is a "notFoundPost" in the app.bsky.feed.defs schema. +type FeedDefs_NotFoundPost struct { + LexiconTypeID string `json:"$type"` + NotFound bool `json:"notFound"` + Uri string `json:"uri"` +} + +func (t *FeedDefs_NotFoundPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_NotFoundPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_PostView is a "postView" in the app.bsky.feed.defs schema. +type FeedDefs_PostView struct { + LexiconTypeID string `json:"$type"` + Author ActorDefs_ProfileViewBasic `json:"author"` + BookmarkCount *int64 `json:"bookmarkCount,omitempty"` + Cid string `json:"cid"` + // debug: Debug information for internal development + Debug *glexrt.LexiconTypeDecoder `json:"debug,omitempty"` + Embed *FeedDefs_PostView_Embed `json:"embed,omitempty"` + IndexedAt string `json:"indexedAt"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + LikeCount *int64 `json:"likeCount,omitempty"` + QuoteCount *int64 `json:"quoteCount,omitempty"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + ReplyCount *int64 `json:"replyCount,omitempty"` + RepostCount *int64 `json:"repostCount,omitempty"` + Threadgate *FeedDefs_ThreadgateView `json:"threadgate,omitempty"` + Uri string `json:"uri"` + Viewer *FeedDefs_ViewerState `json:"viewer,omitempty"` +} + +func (t *FeedDefs_PostView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_PostView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedDefs_PostView_Embed struct { + EmbedExternal_View *EmbedExternal_View + EmbedImages_View *EmbedImages_View + EmbedRecordWithMedia_View *EmbedRecordWithMedia_View + EmbedRecord_View *EmbedRecord_View + EmbedVideo_View *EmbedVideo_View +} + +func (t *FeedDefs_PostView_Embed) MarshalJSON() ([]byte, error) { + if t.EmbedExternal_View != nil { + t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" + return json.Marshal(t.EmbedExternal_View) + } + if t.EmbedImages_View != nil { + t.EmbedImages_View.LexiconTypeID = "app.bsky.embed.images#view" + return json.Marshal(t.EmbedImages_View) + } + if t.EmbedRecordWithMedia_View != nil { + t.EmbedRecordWithMedia_View.LexiconTypeID = "app.bsky.embed.recordWithMedia#view" + return json.Marshal(t.EmbedRecordWithMedia_View) + } + if t.EmbedRecord_View != nil { + t.EmbedRecord_View.LexiconTypeID = "app.bsky.embed.record#view" + return json.Marshal(t.EmbedRecord_View) + } + if t.EmbedVideo_View != nil { + t.EmbedVideo_View.LexiconTypeID = "app.bsky.embed.video#view" + return json.Marshal(t.EmbedVideo_View) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedDefs_PostView_Embed) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return json.Unmarshal(b, t.EmbedExternal_View) + case "app.bsky.embed.images#view": + t.EmbedImages_View = new(EmbedImages_View) + return json.Unmarshal(b, t.EmbedImages_View) + case "app.bsky.embed.recordWithMedia#view": + t.EmbedRecordWithMedia_View = new(EmbedRecordWithMedia_View) + return json.Unmarshal(b, t.EmbedRecordWithMedia_View) + case "app.bsky.embed.record#view": + t.EmbedRecord_View = new(EmbedRecord_View) + return json.Unmarshal(b, t.EmbedRecord_View) + case "app.bsky.embed.video#view": + t.EmbedVideo_View = new(EmbedVideo_View) + return json.Unmarshal(b, t.EmbedVideo_View) + default: + return nil + } +} + +func (t *FeedDefs_PostView_Embed) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedExternal_View != nil { + return t.EmbedExternal_View.MarshalCBOR(w) + } + if t.EmbedImages_View != nil { + return t.EmbedImages_View.MarshalCBOR(w) + } + if t.EmbedRecordWithMedia_View != nil { + return t.EmbedRecordWithMedia_View.MarshalCBOR(w) + } + if t.EmbedRecord_View != nil { + return t.EmbedRecord_View.MarshalCBOR(w) + } + if t.EmbedVideo_View != nil { + return t.EmbedVideo_View.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedDefs_PostView_Embed) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external#view": + t.EmbedExternal_View = new(EmbedExternal_View) + return t.EmbedExternal_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.images#view": + t.EmbedImages_View = new(EmbedImages_View) + return t.EmbedImages_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.recordWithMedia#view": + t.EmbedRecordWithMedia_View = new(EmbedRecordWithMedia_View) + return t.EmbedRecordWithMedia_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.record#view": + t.EmbedRecord_View = new(EmbedRecord_View) + return t.EmbedRecord_View.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.video#view": + t.EmbedVideo_View = new(EmbedVideo_View) + return t.EmbedVideo_View.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedDefs_ReasonPin is a "reasonPin" in the app.bsky.feed.defs schema. +type FeedDefs_ReasonPin struct { + LexiconTypeID string `json:"$type"` +} + +func (t *FeedDefs_ReasonPin) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_ReasonPin) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_ReasonRepost is a "reasonRepost" in the app.bsky.feed.defs schema. +type FeedDefs_ReasonRepost struct { + LexiconTypeID string `json:"$type"` + By ActorDefs_ProfileViewBasic `json:"by"` + Cid *string `json:"cid,omitempty"` + IndexedAt string `json:"indexedAt"` + Uri *string `json:"uri,omitempty"` +} + +func (t *FeedDefs_ReasonRepost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_ReasonRepost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_ReplyRef is a "replyRef" in the app.bsky.feed.defs schema. +type FeedDefs_ReplyRef struct { + LexiconTypeID string `json:"$type"` + // grandparentAuthor: When parent is a reply to another post, this is the author of that post. + GrandparentAuthor *ActorDefs_ProfileViewBasic `json:"grandparentAuthor,omitempty"` + Parent FeedDefs_ReplyRef_Parent `json:"parent"` + Root FeedDefs_ReplyRef_Root `json:"root"` +} + +func (t *FeedDefs_ReplyRef) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_ReplyRef) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedDefs_ReplyRef_Parent struct { + FeedDefs_BlockedPost *FeedDefs_BlockedPost + FeedDefs_NotFoundPost *FeedDefs_NotFoundPost + FeedDefs_PostView *FeedDefs_PostView +} + +func (t *FeedDefs_ReplyRef_Parent) MarshalJSON() ([]byte, error) { + if t.FeedDefs_BlockedPost != nil { + t.FeedDefs_BlockedPost.LexiconTypeID = "app.bsky.feed.defs#blockedPost" + return json.Marshal(t.FeedDefs_BlockedPost) + } + if t.FeedDefs_NotFoundPost != nil { + t.FeedDefs_NotFoundPost.LexiconTypeID = "app.bsky.feed.defs#notFoundPost" + return json.Marshal(t.FeedDefs_NotFoundPost) + } + if t.FeedDefs_PostView != nil { + t.FeedDefs_PostView.LexiconTypeID = "app.bsky.feed.defs#postView" + return json.Marshal(t.FeedDefs_PostView) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedDefs_ReplyRef_Parent) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return json.Unmarshal(b, t.FeedDefs_BlockedPost) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return json.Unmarshal(b, t.FeedDefs_NotFoundPost) + case "app.bsky.feed.defs#postView": + t.FeedDefs_PostView = new(FeedDefs_PostView) + return json.Unmarshal(b, t.FeedDefs_PostView) + default: + return nil + } +} + +func (t *FeedDefs_ReplyRef_Parent) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_BlockedPost != nil { + return t.FeedDefs_BlockedPost.MarshalCBOR(w) + } + if t.FeedDefs_NotFoundPost != nil { + return t.FeedDefs_NotFoundPost.MarshalCBOR(w) + } + if t.FeedDefs_PostView != nil { + return t.FeedDefs_PostView.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedDefs_ReplyRef_Parent) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return t.FeedDefs_BlockedPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return t.FeedDefs_NotFoundPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#postView": + t.FeedDefs_PostView = new(FeedDefs_PostView) + return t.FeedDefs_PostView.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +type FeedDefs_ReplyRef_Root struct { + FeedDefs_BlockedPost *FeedDefs_BlockedPost + FeedDefs_NotFoundPost *FeedDefs_NotFoundPost + FeedDefs_PostView *FeedDefs_PostView +} + +func (t *FeedDefs_ReplyRef_Root) MarshalJSON() ([]byte, error) { + if t.FeedDefs_BlockedPost != nil { + t.FeedDefs_BlockedPost.LexiconTypeID = "app.bsky.feed.defs#blockedPost" + return json.Marshal(t.FeedDefs_BlockedPost) + } + if t.FeedDefs_NotFoundPost != nil { + t.FeedDefs_NotFoundPost.LexiconTypeID = "app.bsky.feed.defs#notFoundPost" + return json.Marshal(t.FeedDefs_NotFoundPost) + } + if t.FeedDefs_PostView != nil { + t.FeedDefs_PostView.LexiconTypeID = "app.bsky.feed.defs#postView" + return json.Marshal(t.FeedDefs_PostView) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedDefs_ReplyRef_Root) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return json.Unmarshal(b, t.FeedDefs_BlockedPost) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return json.Unmarshal(b, t.FeedDefs_NotFoundPost) + case "app.bsky.feed.defs#postView": + t.FeedDefs_PostView = new(FeedDefs_PostView) + return json.Unmarshal(b, t.FeedDefs_PostView) + default: + return nil + } +} + +func (t *FeedDefs_ReplyRef_Root) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_BlockedPost != nil { + return t.FeedDefs_BlockedPost.MarshalCBOR(w) + } + if t.FeedDefs_NotFoundPost != nil { + return t.FeedDefs_NotFoundPost.MarshalCBOR(w) + } + if t.FeedDefs_PostView != nil { + return t.FeedDefs_PostView.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedDefs_ReplyRef_Root) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return t.FeedDefs_BlockedPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return t.FeedDefs_NotFoundPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#postView": + t.FeedDefs_PostView = new(FeedDefs_PostView) + return t.FeedDefs_PostView.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedDefs_SkeletonFeedPost is a "skeletonFeedPost" in the app.bsky.feed.defs schema. +type FeedDefs_SkeletonFeedPost struct { + LexiconTypeID string `json:"$type"` + // feedContext: Context that will be passed through to client and may be passed to feed generator back alongside interactions. + FeedContext *string `json:"feedContext,omitempty"` + Post string `json:"post"` + Reason *FeedDefs_SkeletonFeedPost_Reason `json:"reason,omitempty"` +} + +func (t *FeedDefs_SkeletonFeedPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_SkeletonFeedPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedDefs_SkeletonFeedPost_Reason struct { + FeedDefs_SkeletonReasonPin *FeedDefs_SkeletonReasonPin + FeedDefs_SkeletonReasonRepost *FeedDefs_SkeletonReasonRepost +} + +func (t *FeedDefs_SkeletonFeedPost_Reason) MarshalJSON() ([]byte, error) { + if t.FeedDefs_SkeletonReasonPin != nil { + t.FeedDefs_SkeletonReasonPin.LexiconTypeID = "app.bsky.feed.defs#skeletonReasonPin" + return json.Marshal(t.FeedDefs_SkeletonReasonPin) + } + if t.FeedDefs_SkeletonReasonRepost != nil { + t.FeedDefs_SkeletonReasonRepost.LexiconTypeID = "app.bsky.feed.defs#skeletonReasonRepost" + return json.Marshal(t.FeedDefs_SkeletonReasonRepost) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedDefs_SkeletonFeedPost_Reason) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#skeletonReasonPin": + t.FeedDefs_SkeletonReasonPin = new(FeedDefs_SkeletonReasonPin) + return json.Unmarshal(b, t.FeedDefs_SkeletonReasonPin) + case "app.bsky.feed.defs#skeletonReasonRepost": + t.FeedDefs_SkeletonReasonRepost = new(FeedDefs_SkeletonReasonRepost) + return json.Unmarshal(b, t.FeedDefs_SkeletonReasonRepost) + default: + return nil + } +} + +func (t *FeedDefs_SkeletonFeedPost_Reason) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_SkeletonReasonPin != nil { + return t.FeedDefs_SkeletonReasonPin.MarshalCBOR(w) + } + if t.FeedDefs_SkeletonReasonRepost != nil { + return t.FeedDefs_SkeletonReasonRepost.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedDefs_SkeletonFeedPost_Reason) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#skeletonReasonPin": + t.FeedDefs_SkeletonReasonPin = new(FeedDefs_SkeletonReasonPin) + return t.FeedDefs_SkeletonReasonPin.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#skeletonReasonRepost": + t.FeedDefs_SkeletonReasonRepost = new(FeedDefs_SkeletonReasonRepost) + return t.FeedDefs_SkeletonReasonRepost.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedDefs_SkeletonReasonPin is a "skeletonReasonPin" in the app.bsky.feed.defs schema. +type FeedDefs_SkeletonReasonPin struct { + LexiconTypeID string `json:"$type"` +} + +func (t *FeedDefs_SkeletonReasonPin) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_SkeletonReasonPin) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_SkeletonReasonRepost is a "skeletonReasonRepost" in the app.bsky.feed.defs schema. +type FeedDefs_SkeletonReasonRepost struct { + LexiconTypeID string `json:"$type"` + Repost string `json:"repost"` +} + +func (t *FeedDefs_SkeletonReasonRepost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_SkeletonReasonRepost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_ThreadContext is a "threadContext" in the app.bsky.feed.defs schema. +// +// Metadata about this post within the context of the thread it is in. +type FeedDefs_ThreadContext struct { + LexiconTypeID string `json:"$type"` + RootAuthorLike *string `json:"rootAuthorLike,omitempty"` +} + +func (t *FeedDefs_ThreadContext) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_ThreadContext) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_ThreadViewPost is a "threadViewPost" in the app.bsky.feed.defs schema. +type FeedDefs_ThreadViewPost struct { + LexiconTypeID string `json:"$type"` + Parent *FeedDefs_ThreadViewPost_Parent `json:"parent,omitempty"` + Post FeedDefs_PostView `json:"post"` + Replies []FeedDefs_ThreadViewPost_Replies_Elem `json:"replies,omitempty"` + ThreadContext *FeedDefs_ThreadContext `json:"threadContext,omitempty"` +} + +func (t *FeedDefs_ThreadViewPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_ThreadViewPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedDefs_ThreadViewPost_Parent struct { + FeedDefs_BlockedPost *FeedDefs_BlockedPost + FeedDefs_NotFoundPost *FeedDefs_NotFoundPost + FeedDefs_ThreadViewPost *FeedDefs_ThreadViewPost +} + +func (t *FeedDefs_ThreadViewPost_Parent) MarshalJSON() ([]byte, error) { + if t.FeedDefs_BlockedPost != nil { + t.FeedDefs_BlockedPost.LexiconTypeID = "app.bsky.feed.defs#blockedPost" + return json.Marshal(t.FeedDefs_BlockedPost) + } + if t.FeedDefs_NotFoundPost != nil { + t.FeedDefs_NotFoundPost.LexiconTypeID = "app.bsky.feed.defs#notFoundPost" + return json.Marshal(t.FeedDefs_NotFoundPost) + } + if t.FeedDefs_ThreadViewPost != nil { + t.FeedDefs_ThreadViewPost.LexiconTypeID = "app.bsky.feed.defs#threadViewPost" + return json.Marshal(t.FeedDefs_ThreadViewPost) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedDefs_ThreadViewPost_Parent) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return json.Unmarshal(b, t.FeedDefs_BlockedPost) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return json.Unmarshal(b, t.FeedDefs_NotFoundPost) + case "app.bsky.feed.defs#threadViewPost": + t.FeedDefs_ThreadViewPost = new(FeedDefs_ThreadViewPost) + return json.Unmarshal(b, t.FeedDefs_ThreadViewPost) + default: + return nil + } +} + +func (t *FeedDefs_ThreadViewPost_Parent) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_BlockedPost != nil { + return t.FeedDefs_BlockedPost.MarshalCBOR(w) + } + if t.FeedDefs_NotFoundPost != nil { + return t.FeedDefs_NotFoundPost.MarshalCBOR(w) + } + if t.FeedDefs_ThreadViewPost != nil { + return t.FeedDefs_ThreadViewPost.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedDefs_ThreadViewPost_Parent) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return t.FeedDefs_BlockedPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return t.FeedDefs_NotFoundPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#threadViewPost": + t.FeedDefs_ThreadViewPost = new(FeedDefs_ThreadViewPost) + return t.FeedDefs_ThreadViewPost.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +type FeedDefs_ThreadViewPost_Replies_Elem struct { + FeedDefs_BlockedPost *FeedDefs_BlockedPost + FeedDefs_NotFoundPost *FeedDefs_NotFoundPost + FeedDefs_ThreadViewPost *FeedDefs_ThreadViewPost +} + +func (t *FeedDefs_ThreadViewPost_Replies_Elem) MarshalJSON() ([]byte, error) { + if t.FeedDefs_BlockedPost != nil { + t.FeedDefs_BlockedPost.LexiconTypeID = "app.bsky.feed.defs#blockedPost" + return json.Marshal(t.FeedDefs_BlockedPost) + } + if t.FeedDefs_NotFoundPost != nil { + t.FeedDefs_NotFoundPost.LexiconTypeID = "app.bsky.feed.defs#notFoundPost" + return json.Marshal(t.FeedDefs_NotFoundPost) + } + if t.FeedDefs_ThreadViewPost != nil { + t.FeedDefs_ThreadViewPost.LexiconTypeID = "app.bsky.feed.defs#threadViewPost" + return json.Marshal(t.FeedDefs_ThreadViewPost) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedDefs_ThreadViewPost_Replies_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return json.Unmarshal(b, t.FeedDefs_BlockedPost) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return json.Unmarshal(b, t.FeedDefs_NotFoundPost) + case "app.bsky.feed.defs#threadViewPost": + t.FeedDefs_ThreadViewPost = new(FeedDefs_ThreadViewPost) + return json.Unmarshal(b, t.FeedDefs_ThreadViewPost) + default: + return nil + } +} + +func (t *FeedDefs_ThreadViewPost_Replies_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_BlockedPost != nil { + return t.FeedDefs_BlockedPost.MarshalCBOR(w) + } + if t.FeedDefs_NotFoundPost != nil { + return t.FeedDefs_NotFoundPost.MarshalCBOR(w) + } + if t.FeedDefs_ThreadViewPost != nil { + return t.FeedDefs_ThreadViewPost.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedDefs_ThreadViewPost_Replies_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return t.FeedDefs_BlockedPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return t.FeedDefs_NotFoundPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#threadViewPost": + t.FeedDefs_ThreadViewPost = new(FeedDefs_ThreadViewPost) + return t.FeedDefs_ThreadViewPost.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedDefs_ThreadgateView is a "threadgateView" in the app.bsky.feed.defs schema. +type FeedDefs_ThreadgateView struct { + LexiconTypeID string `json:"$type"` + Cid *string `json:"cid,omitempty"` + Lists []GraphDefs_ListViewBasic `json:"lists,omitempty"` + Record *glexrt.LexiconTypeDecoder `json:"record,omitempty"` + Uri *string `json:"uri,omitempty"` +} + +func (t *FeedDefs_ThreadgateView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_ThreadgateView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDefs_ViewerState is a "viewerState" in the app.bsky.feed.defs schema. +// +// Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. +type FeedDefs_ViewerState struct { + LexiconTypeID string `json:"$type"` + Bookmarked *bool `json:"bookmarked,omitempty"` + EmbeddingDisabled *bool `json:"embeddingDisabled,omitempty"` + Like *string `json:"like,omitempty"` + Pinned *bool `json:"pinned,omitempty"` + ReplyDisabled *bool `json:"replyDisabled,omitempty"` + Repost *string `json:"repost,omitempty"` + ThreadMuted *bool `json:"threadMuted,omitempty"` +} + +func (t *FeedDefs_ViewerState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDefs_ViewerState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feeddescribefeedgenerator.go b/pkg/appbsky/feeddescribefeedgenerator.go new file mode 100644 index 00000000..6e215a53 --- /dev/null +++ b/pkg/appbsky/feeddescribefeedgenerator.go @@ -0,0 +1,84 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.describeFeedGenerator + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedDescribeFeedGenerator_Output struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + Feeds []FeedDescribeFeedGenerator_Feed `json:"feeds"` + Links *FeedDescribeFeedGenerator_Links `json:"links,omitempty"` +} + +func (t *FeedDescribeFeedGenerator_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.describeFeedGenerator#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDescribeFeedGenerator_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDescribeFeedGenerator calls the XRPC method "app.bsky.feed.describeFeedGenerator". +// +// Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View). +func FeedDescribeFeedGenerator(ctx context.Context, c glexrt.LexClient) (*FeedDescribeFeedGenerator_Output, error) { + var out FeedDescribeFeedGenerator_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.describeFeedGenerator", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// FeedDescribeFeedGenerator_Feed is a "feed" in the app.bsky.feed.describeFeedGenerator schema. +type FeedDescribeFeedGenerator_Feed struct { + LexiconTypeID string `json:"$type"` + Uri string `json:"uri"` +} + +func (t *FeedDescribeFeedGenerator_Feed) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.describeFeedGenerator" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDescribeFeedGenerator_Feed) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedDescribeFeedGenerator_Links is a "links" in the app.bsky.feed.describeFeedGenerator schema. +type FeedDescribeFeedGenerator_Links struct { + LexiconTypeID string `json:"$type"` + PrivacyPolicy *string `json:"privacyPolicy,omitempty"` + TermsOfService *string `json:"termsOfService,omitempty"` +} + +func (t *FeedDescribeFeedGenerator_Links) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.describeFeedGenerator" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedDescribeFeedGenerator_Links) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feedgenerator.go b/pkg/appbsky/feedgenerator.go new file mode 100644 index 00000000..b83721b1 --- /dev/null +++ b/pkg/appbsky/feedgenerator.go @@ -0,0 +1,104 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.generator + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.feed.generator", &FeedGenerator{}) +} + +// Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository. +type FeedGenerator struct { + LexiconTypeID string `json:"$type"` + // acceptsInteractions: Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions + AcceptsInteractions *bool `json:"acceptsInteractions,omitempty"` + Avatar *glexrt.Blob `json:"avatar,omitempty"` + ContentMode *string `json:"contentMode,omitempty"` + CreatedAt string `json:"createdAt"` + Description *string `json:"description,omitempty"` + DescriptionFacets []RichtextFacet `json:"descriptionFacets,omitempty"` + Did string `json:"did"` + DisplayName string `json:"displayName"` + // labels: Self-label values + Labels *FeedGenerator_Labels `json:"labels,omitempty"` +} + +func (t *FeedGenerator) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.generator" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGenerator) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Self-label values +type FeedGenerator_Labels struct { + LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels +} + +func (t *FeedGenerator_Labels) MarshalJSON() ([]byte, error) { + if t.LabelDefs_SelfLabels != nil { + t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels" + return json.Marshal(t.LabelDefs_SelfLabels) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedGenerator_Labels) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return json.Unmarshal(b, t.LabelDefs_SelfLabels) + default: + return nil + } +} + +func (t *FeedGenerator_Labels) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelDefs_SelfLabels != nil { + return t.LabelDefs_SelfLabels.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedGenerator_Labels) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/feedgetactorfeeds.go b/pkg/appbsky/feedgetactorfeeds.go new file mode 100644 index 00000000..e2a89853 --- /dev/null +++ b/pkg/appbsky/feedgetactorfeeds.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getActorFeeds + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetActorFeeds_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feeds []FeedDefs_GeneratorView `json:"feeds"` +} + +func (t *FeedGetActorFeeds_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getActorFeeds#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetActorFeeds_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetActorFeeds calls the XRPC method "app.bsky.feed.getActorFeeds". +// +// Get a list of feeds (feed generator records) created by the actor (in the actor's repo). +func FeedGetActorFeeds(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64) (*FeedGetActorFeeds_Output, error) { + var out FeedGetActorFeeds_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getActorFeeds", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetactorlikes.go b/pkg/appbsky/feedgetactorlikes.go new file mode 100644 index 00000000..04f08eb5 --- /dev/null +++ b/pkg/appbsky/feedgetactorlikes.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getActorLikes + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetActorLikes_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feed []FeedDefs_FeedViewPost `json:"feed"` +} + +func (t *FeedGetActorLikes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getActorLikes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetActorLikes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetActorLikes calls the XRPC method "app.bsky.feed.getActorLikes". +// +// Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. +func FeedGetActorLikes(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64) (*FeedGetActorLikes_Output, error) { + var out FeedGetActorLikes_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getActorLikes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetauthorfeed.go b/pkg/appbsky/feedgetauthorfeed.go new file mode 100644 index 00000000..7236446e --- /dev/null +++ b/pkg/appbsky/feedgetauthorfeed.go @@ -0,0 +1,61 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getAuthorFeed + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetAuthorFeed_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feed []FeedDefs_FeedViewPost `json:"feed"` +} + +func (t *FeedGetAuthorFeed_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getAuthorFeed#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetAuthorFeed_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetAuthorFeed calls the XRPC method "app.bsky.feed.getAuthorFeed". +// +// Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. +// +// filter: Combinations of post/repost types to include in response. +func FeedGetAuthorFeed(ctx context.Context, c glexrt.LexClient, actor string, cursor string, filter string, includePins *bool, limit *int64) (*FeedGetAuthorFeed_Output, error) { + var out FeedGetAuthorFeed_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if filter != "" { + params["filter"] = filter + } + if includePins != nil { + params["includePins"] = *includePins + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getAuthorFeed", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetfeed.go b/pkg/appbsky/feedgetfeed.go new file mode 100644 index 00000000..8f0443fd --- /dev/null +++ b/pkg/appbsky/feedgetfeed.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getFeed + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetFeed_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feed []FeedDefs_FeedViewPost `json:"feed"` +} + +func (t *FeedGetFeed_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getFeed#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetFeed_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetFeed calls the XRPC method "app.bsky.feed.getFeed". +// +// Get a hydrated feed from an actor's selected feed generator. Implemented by App View. +func FeedGetFeed(ctx context.Context, c glexrt.LexClient, cursor string, feed string, limit *int64) (*FeedGetFeed_Output, error) { + var out FeedGetFeed_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["feed"] = feed + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getFeed", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetfeedgenerator.go b/pkg/appbsky/feedgetfeedgenerator.go new file mode 100644 index 00000000..e97edd0c --- /dev/null +++ b/pkg/appbsky/feedgetfeedgenerator.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getFeedGenerator + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetFeedGenerator_Output struct { + LexiconTypeID string `json:"$type"` + // isOnline: Indicates whether the feed generator service has been online recently, or else seems to be inactive. + IsOnline bool `json:"isOnline"` + // isValid: Indicates whether the feed generator service is compatible with the record declaration. + IsValid bool `json:"isValid"` + View FeedDefs_GeneratorView `json:"view"` +} + +func (t *FeedGetFeedGenerator_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getFeedGenerator#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetFeedGenerator_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetFeedGenerator calls the XRPC method "app.bsky.feed.getFeedGenerator". +// +// Get information about a feed generator. Implemented by AppView. +// +// feed: AT-URI of the feed generator record. +func FeedGetFeedGenerator(ctx context.Context, c glexrt.LexClient, feed string) (*FeedGetFeedGenerator_Output, error) { + var out FeedGetFeedGenerator_Output + + params := map[string]interface{}{} + params["feed"] = feed + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getFeedGenerator", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetfeedgenerators.go b/pkg/appbsky/feedgetfeedgenerators.go new file mode 100644 index 00000000..f751dac6 --- /dev/null +++ b/pkg/appbsky/feedgetfeedgenerators.go @@ -0,0 +1,46 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getFeedGenerators + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetFeedGenerators_Output struct { + LexiconTypeID string `json:"$type"` + Feeds []FeedDefs_GeneratorView `json:"feeds"` +} + +func (t *FeedGetFeedGenerators_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getFeedGenerators#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetFeedGenerators_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetFeedGenerators calls the XRPC method "app.bsky.feed.getFeedGenerators". +// +// Get information about a list of feed generators. +func FeedGetFeedGenerators(ctx context.Context, c glexrt.LexClient, feeds []string) (*FeedGetFeedGenerators_Output, error) { + var out FeedGetFeedGenerators_Output + + params := map[string]interface{}{} + params["feeds"] = feeds + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getFeedGenerators", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetfeedskeleton.go b/pkg/appbsky/feedgetfeedskeleton.go new file mode 100644 index 00000000..2a6a1aee --- /dev/null +++ b/pkg/appbsky/feedgetfeedskeleton.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getFeedSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetFeedSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feed []FeedDefs_SkeletonFeedPost `json:"feed"` +} + +func (t *FeedGetFeedSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getFeedSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetFeedSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetFeedSkeleton calls the XRPC method "app.bsky.feed.getFeedSkeleton". +// +// Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. +// +// feed: Reference to feed generator record describing the specific feed being requested. +func FeedGetFeedSkeleton(ctx context.Context, c glexrt.LexClient, cursor string, feed string, limit *int64) (*FeedGetFeedSkeleton_Output, error) { + var out FeedGetFeedSkeleton_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["feed"] = feed + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getFeedSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetlikes.go b/pkg/appbsky/feedgetlikes.go new file mode 100644 index 00000000..e7f0a711 --- /dev/null +++ b/pkg/appbsky/feedgetlikes.go @@ -0,0 +1,82 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getLikes + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetLikes_Output struct { + LexiconTypeID string `json:"$type"` + Cid *string `json:"cid,omitempty"` + Cursor *string `json:"cursor,omitempty"` + Likes []FeedGetLikes_Like `json:"likes"` + Uri string `json:"uri"` +} + +func (t *FeedGetLikes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getLikes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetLikes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetLikes calls the XRPC method "app.bsky.feed.getLikes". +// +// Get like records which reference a subject (by AT-URI and CID). +// +// cid: CID of the subject record (aka, specific version of record), to filter likes. +// uri: AT-URI of the subject (eg, a post record). +func FeedGetLikes(ctx context.Context, c glexrt.LexClient, cid string, cursor string, limit *int64, uri string) (*FeedGetLikes_Output, error) { + var out FeedGetLikes_Output + + params := map[string]interface{}{} + if cid != "" { + params["cid"] = cid + } + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["uri"] = uri + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getLikes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// FeedGetLikes_Like is a "like" in the app.bsky.feed.getLikes schema. +type FeedGetLikes_Like struct { + LexiconTypeID string `json:"$type"` + Actor ActorDefs_ProfileView `json:"actor"` + CreatedAt string `json:"createdAt"` + IndexedAt string `json:"indexedAt"` +} + +func (t *FeedGetLikes_Like) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getLikes" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetLikes_Like) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feedgetlistfeed.go b/pkg/appbsky/feedgetlistfeed.go new file mode 100644 index 00000000..b079d56c --- /dev/null +++ b/pkg/appbsky/feedgetlistfeed.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getListFeed + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetListFeed_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feed []FeedDefs_FeedViewPost `json:"feed"` +} + +func (t *FeedGetListFeed_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getListFeed#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetListFeed_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetListFeed calls the XRPC method "app.bsky.feed.getListFeed". +// +// Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. +// +// list: Reference (AT-URI) to the list record. +func FeedGetListFeed(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, list string) (*FeedGetListFeed_Output, error) { + var out FeedGetListFeed_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["list"] = list + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getListFeed", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetposts.go b/pkg/appbsky/feedgetposts.go new file mode 100644 index 00000000..a7a616b2 --- /dev/null +++ b/pkg/appbsky/feedgetposts.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getPosts + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetPosts_Output struct { + LexiconTypeID string `json:"$type"` + Posts []FeedDefs_PostView `json:"posts"` +} + +func (t *FeedGetPosts_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getPosts#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetPosts_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetPosts calls the XRPC method "app.bsky.feed.getPosts". +// +// Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. +// +// uris[]: List of post AT-URIs to return hydrated views for. +func FeedGetPosts(ctx context.Context, c glexrt.LexClient, uris []string) (*FeedGetPosts_Output, error) { + var out FeedGetPosts_Output + + params := map[string]interface{}{} + params["uris"] = uris + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getPosts", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetpostthread.go b/pkg/appbsky/feedgetpostthread.go new file mode 100644 index 00000000..3752ab06 --- /dev/null +++ b/pkg/appbsky/feedgetpostthread.go @@ -0,0 +1,142 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getPostThread + +package appbsky + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetPostThread_Output struct { + LexiconTypeID string `json:"$type"` + Thread FeedGetPostThread_Output_Thread `json:"thread"` + Threadgate *FeedDefs_ThreadgateView `json:"threadgate,omitempty"` +} + +func (t *FeedGetPostThread_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getPostThread#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetPostThread_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedGetPostThread_Output_Thread struct { + FeedDefs_BlockedPost *FeedDefs_BlockedPost + FeedDefs_NotFoundPost *FeedDefs_NotFoundPost + FeedDefs_ThreadViewPost *FeedDefs_ThreadViewPost +} + +func (t *FeedGetPostThread_Output_Thread) MarshalJSON() ([]byte, error) { + if t.FeedDefs_BlockedPost != nil { + t.FeedDefs_BlockedPost.LexiconTypeID = "app.bsky.feed.defs#blockedPost" + return json.Marshal(t.FeedDefs_BlockedPost) + } + if t.FeedDefs_NotFoundPost != nil { + t.FeedDefs_NotFoundPost.LexiconTypeID = "app.bsky.feed.defs#notFoundPost" + return json.Marshal(t.FeedDefs_NotFoundPost) + } + if t.FeedDefs_ThreadViewPost != nil { + t.FeedDefs_ThreadViewPost.LexiconTypeID = "app.bsky.feed.defs#threadViewPost" + return json.Marshal(t.FeedDefs_ThreadViewPost) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedGetPostThread_Output_Thread) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return json.Unmarshal(b, t.FeedDefs_BlockedPost) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return json.Unmarshal(b, t.FeedDefs_NotFoundPost) + case "app.bsky.feed.defs#threadViewPost": + t.FeedDefs_ThreadViewPost = new(FeedDefs_ThreadViewPost) + return json.Unmarshal(b, t.FeedDefs_ThreadViewPost) + default: + return nil + } +} + +func (t *FeedGetPostThread_Output_Thread) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedDefs_BlockedPost != nil { + return t.FeedDefs_BlockedPost.MarshalCBOR(w) + } + if t.FeedDefs_NotFoundPost != nil { + return t.FeedDefs_NotFoundPost.MarshalCBOR(w) + } + if t.FeedDefs_ThreadViewPost != nil { + return t.FeedDefs_ThreadViewPost.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedGetPostThread_Output_Thread) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.defs#blockedPost": + t.FeedDefs_BlockedPost = new(FeedDefs_BlockedPost) + return t.FeedDefs_BlockedPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#notFoundPost": + t.FeedDefs_NotFoundPost = new(FeedDefs_NotFoundPost) + return t.FeedDefs_NotFoundPost.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.defs#threadViewPost": + t.FeedDefs_ThreadViewPost = new(FeedDefs_ThreadViewPost) + return t.FeedDefs_ThreadViewPost.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedGetPostThread calls the XRPC method "app.bsky.feed.getPostThread". +// +// Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. +// +// depth: How many levels of reply depth should be included in response. +// parentHeight: How many levels of parent (and grandparent, etc) post to include. +// uri: Reference (AT-URI) to post record. +func FeedGetPostThread(ctx context.Context, c glexrt.LexClient, depth *int64, parentHeight *int64, uri string) (*FeedGetPostThread_Output, error) { + var out FeedGetPostThread_Output + + params := map[string]interface{}{} + if depth != nil { + params["depth"] = *depth + } + if parentHeight != nil { + params["parentHeight"] = *parentHeight + } + params["uri"] = uri + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getPostThread", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetquotes.go b/pkg/appbsky/feedgetquotes.go new file mode 100644 index 00000000..7d839fbd --- /dev/null +++ b/pkg/appbsky/feedgetquotes.go @@ -0,0 +1,61 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getQuotes + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetQuotes_Output struct { + LexiconTypeID string `json:"$type"` + Cid *string `json:"cid,omitempty"` + Cursor *string `json:"cursor,omitempty"` + Posts []FeedDefs_PostView `json:"posts"` + Uri string `json:"uri"` +} + +func (t *FeedGetQuotes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getQuotes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetQuotes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetQuotes calls the XRPC method "app.bsky.feed.getQuotes". +// +// Get a list of quotes for a given post. +// +// cid: If supplied, filters to quotes of specific version (by CID) of the post record. +// uri: Reference (AT-URI) of post record +func FeedGetQuotes(ctx context.Context, c glexrt.LexClient, cid string, cursor string, limit *int64, uri string) (*FeedGetQuotes_Output, error) { + var out FeedGetQuotes_Output + + params := map[string]interface{}{} + if cid != "" { + params["cid"] = cid + } + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["uri"] = uri + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getQuotes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetrepostedby.go b/pkg/appbsky/feedgetrepostedby.go new file mode 100644 index 00000000..4fba231d --- /dev/null +++ b/pkg/appbsky/feedgetrepostedby.go @@ -0,0 +1,61 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getRepostedBy + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetRepostedBy_Output struct { + LexiconTypeID string `json:"$type"` + Cid *string `json:"cid,omitempty"` + Cursor *string `json:"cursor,omitempty"` + RepostedBy []ActorDefs_ProfileView `json:"repostedBy"` + Uri string `json:"uri"` +} + +func (t *FeedGetRepostedBy_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getRepostedBy#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetRepostedBy_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetRepostedBy calls the XRPC method "app.bsky.feed.getRepostedBy". +// +// Get a list of reposts for a given post. +// +// cid: If supplied, filters to reposts of specific version (by CID) of the post record. +// uri: Reference (AT-URI) of post record +func FeedGetRepostedBy(ctx context.Context, c glexrt.LexClient, cid string, cursor string, limit *int64, uri string) (*FeedGetRepostedBy_Output, error) { + var out FeedGetRepostedBy_Output + + params := map[string]interface{}{} + if cid != "" { + params["cid"] = cid + } + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["uri"] = uri + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getRepostedBy", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgetsuggestedfeeds.go b/pkg/appbsky/feedgetsuggestedfeeds.go new file mode 100644 index 00000000..53ca99e3 --- /dev/null +++ b/pkg/appbsky/feedgetsuggestedfeeds.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getSuggestedFeeds + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetSuggestedFeeds_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feeds []FeedDefs_GeneratorView `json:"feeds"` +} + +func (t *FeedGetSuggestedFeeds_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getSuggestedFeeds#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetSuggestedFeeds_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetSuggestedFeeds calls the XRPC method "app.bsky.feed.getSuggestedFeeds". +// +// Get a list of suggested feeds (feed generators) for the requesting account. +func FeedGetSuggestedFeeds(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*FeedGetSuggestedFeeds_Output, error) { + var out FeedGetSuggestedFeeds_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getSuggestedFeeds", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedgettimeline.go b/pkg/appbsky/feedgettimeline.go new file mode 100644 index 00000000..7fe17ab3 --- /dev/null +++ b/pkg/appbsky/feedgettimeline.go @@ -0,0 +1,57 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.getTimeline + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedGetTimeline_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feed []FeedDefs_FeedViewPost `json:"feed"` +} + +func (t *FeedGetTimeline_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.getTimeline#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedGetTimeline_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedGetTimeline calls the XRPC method "app.bsky.feed.getTimeline". +// +// Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. +// +// algorithm: Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. +func FeedGetTimeline(ctx context.Context, c glexrt.LexClient, algorithm string, cursor string, limit *int64) (*FeedGetTimeline_Output, error) { + var out FeedGetTimeline_Output + + params := map[string]interface{}{} + if algorithm != "" { + params["algorithm"] = algorithm + } + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.getTimeline", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedlike.go b/pkg/appbsky/feedlike.go new file mode 100644 index 00000000..d23590bd --- /dev/null +++ b/pkg/appbsky/feedlike.go @@ -0,0 +1,38 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.like + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.feed.like", &FeedLike{}) +} + +// Record declaring a 'like' of a piece of subject content. +type FeedLike struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Subject comatproto.RepoStrongRef `json:"subject"` + Via *comatproto.RepoStrongRef `json:"via,omitempty"` +} + +func (t *FeedLike) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.like" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedLike) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feedpost.go b/pkg/appbsky/feedpost.go new file mode 100644 index 00000000..a732057f --- /dev/null +++ b/pkg/appbsky/feedpost.go @@ -0,0 +1,285 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.post + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.feed.post", &FeedPost{}) +} + +// Record containing a Bluesky post. +type FeedPost struct { + LexiconTypeID string `json:"$type"` + // createdAt: Client-declared timestamp when this post was originally created. + CreatedAt string `json:"createdAt"` + Embed *FeedPost_Embed `json:"embed,omitempty"` + // entities: DEPRECATED: replaced by app.bsky.richtext.facet. + Entities []FeedPost_Entity `json:"entities,omitempty"` + // facets: Annotations of text (mentions, URLs, hashtags, etc) + Facets []RichtextFacet `json:"facets,omitempty"` + // labels: Self-label values for this post. Effectively content warnings. + Labels *FeedPost_Labels `json:"labels,omitempty"` + // langs: Indicates human language of post primary text content. + Langs []string `json:"langs,omitempty"` + Reply *FeedPost_ReplyRef `json:"reply,omitempty"` + // tags: Additional hashtags, in addition to any included in post text and facets. + Tags []string `json:"tags,omitempty"` + // text: The primary post content. May be an empty string, if there are embeds. + Text string `json:"text"` +} + +func (t *FeedPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.post" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedPost_Embed struct { + EmbedExternal *EmbedExternal + EmbedImages *EmbedImages + EmbedRecord *EmbedRecord + EmbedRecordWithMedia *EmbedRecordWithMedia + EmbedVideo *EmbedVideo +} + +func (t *FeedPost_Embed) MarshalJSON() ([]byte, error) { + if t.EmbedExternal != nil { + t.EmbedExternal.LexiconTypeID = "app.bsky.embed.external" + return json.Marshal(t.EmbedExternal) + } + if t.EmbedImages != nil { + t.EmbedImages.LexiconTypeID = "app.bsky.embed.images" + return json.Marshal(t.EmbedImages) + } + if t.EmbedRecord != nil { + t.EmbedRecord.LexiconTypeID = "app.bsky.embed.record" + return json.Marshal(t.EmbedRecord) + } + if t.EmbedRecordWithMedia != nil { + t.EmbedRecordWithMedia.LexiconTypeID = "app.bsky.embed.recordWithMedia" + return json.Marshal(t.EmbedRecordWithMedia) + } + if t.EmbedVideo != nil { + t.EmbedVideo.LexiconTypeID = "app.bsky.embed.video" + return json.Marshal(t.EmbedVideo) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedPost_Embed) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external": + t.EmbedExternal = new(EmbedExternal) + return json.Unmarshal(b, t.EmbedExternal) + case "app.bsky.embed.images": + t.EmbedImages = new(EmbedImages) + return json.Unmarshal(b, t.EmbedImages) + case "app.bsky.embed.record": + t.EmbedRecord = new(EmbedRecord) + return json.Unmarshal(b, t.EmbedRecord) + case "app.bsky.embed.recordWithMedia": + t.EmbedRecordWithMedia = new(EmbedRecordWithMedia) + return json.Unmarshal(b, t.EmbedRecordWithMedia) + case "app.bsky.embed.video": + t.EmbedVideo = new(EmbedVideo) + return json.Unmarshal(b, t.EmbedVideo) + default: + return nil + } +} + +func (t *FeedPost_Embed) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.EmbedExternal != nil { + return t.EmbedExternal.MarshalCBOR(w) + } + if t.EmbedImages != nil { + return t.EmbedImages.MarshalCBOR(w) + } + if t.EmbedRecord != nil { + return t.EmbedRecord.MarshalCBOR(w) + } + if t.EmbedRecordWithMedia != nil { + return t.EmbedRecordWithMedia.MarshalCBOR(w) + } + if t.EmbedVideo != nil { + return t.EmbedVideo.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedPost_Embed) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.embed.external": + t.EmbedExternal = new(EmbedExternal) + return t.EmbedExternal.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.images": + t.EmbedImages = new(EmbedImages) + return t.EmbedImages.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.record": + t.EmbedRecord = new(EmbedRecord) + return t.EmbedRecord.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.recordWithMedia": + t.EmbedRecordWithMedia = new(EmbedRecordWithMedia) + return t.EmbedRecordWithMedia.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.embed.video": + t.EmbedVideo = new(EmbedVideo) + return t.EmbedVideo.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// Self-label values for this post. Effectively content warnings. +type FeedPost_Labels struct { + LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels +} + +func (t *FeedPost_Labels) MarshalJSON() ([]byte, error) { + if t.LabelDefs_SelfLabels != nil { + t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels" + return json.Marshal(t.LabelDefs_SelfLabels) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedPost_Labels) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return json.Unmarshal(b, t.LabelDefs_SelfLabels) + default: + return nil + } +} + +func (t *FeedPost_Labels) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelDefs_SelfLabels != nil { + return t.LabelDefs_SelfLabels.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedPost_Labels) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedPost_Entity is a "entity" in the app.bsky.feed.post schema. +// +// Deprecated: use facets instead. +type FeedPost_Entity struct { + LexiconTypeID string `json:"$type"` + Index FeedPost_TextSlice `json:"index"` + // type: Expected values are 'mention' and 'link'. + Type string `json:"type"` + Value string `json:"value"` +} + +func (t *FeedPost_Entity) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.post" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedPost_Entity) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedPost_ReplyRef is a "replyRef" in the app.bsky.feed.post schema. +type FeedPost_ReplyRef struct { + LexiconTypeID string `json:"$type"` + Parent comatproto.RepoStrongRef `json:"parent"` + Root comatproto.RepoStrongRef `json:"root"` +} + +func (t *FeedPost_ReplyRef) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.post" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedPost_ReplyRef) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedPost_TextSlice is a "textSlice" in the app.bsky.feed.post schema. +// +// Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. +type FeedPost_TextSlice struct { + LexiconTypeID string `json:"$type"` + End int64 `json:"end"` + Start int64 `json:"start"` +} + +func (t *FeedPost_TextSlice) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.post" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedPost_TextSlice) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feedpostgate.go b/pkg/appbsky/feedpostgate.go new file mode 100644 index 00000000..f5c13ed7 --- /dev/null +++ b/pkg/appbsky/feedpostgate.go @@ -0,0 +1,118 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.postgate + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.feed.postgate", &FeedPostgate{}) +} + +// Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository. +type FeedPostgate struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + // detachedEmbeddingUris: List of AT-URIs embedding this post that the author has detached from. + DetachedEmbeddingUris []string `json:"detachedEmbeddingUris,omitempty"` + // embeddingRules: List of rules defining who can embed this post. If value is an empty array or is undefined, no particular rules apply and anyone can embed. + EmbeddingRules []FeedPostgate_EmbeddingRules_Elem `json:"embeddingRules,omitempty"` + // post: Reference (AT-URI) to the post record. + Post string `json:"post"` +} + +func (t *FeedPostgate) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.postgate" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedPostgate) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedPostgate_EmbeddingRules_Elem struct { + FeedPostgate_DisableRule *FeedPostgate_DisableRule +} + +func (t *FeedPostgate_EmbeddingRules_Elem) MarshalJSON() ([]byte, error) { + if t.FeedPostgate_DisableRule != nil { + t.FeedPostgate_DisableRule.LexiconTypeID = "app.bsky.feed.postgate#disableRule" + return json.Marshal(t.FeedPostgate_DisableRule) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedPostgate_EmbeddingRules_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.postgate#disableRule": + t.FeedPostgate_DisableRule = new(FeedPostgate_DisableRule) + return json.Unmarshal(b, t.FeedPostgate_DisableRule) + default: + return nil + } +} + +func (t *FeedPostgate_EmbeddingRules_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedPostgate_DisableRule != nil { + return t.FeedPostgate_DisableRule.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedPostgate_EmbeddingRules_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.postgate#disableRule": + t.FeedPostgate_DisableRule = new(FeedPostgate_DisableRule) + return t.FeedPostgate_DisableRule.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedPostgate_DisableRule is a "disableRule" in the app.bsky.feed.postgate schema. +// +// Disables embedding of this post. +type FeedPostgate_DisableRule struct { + LexiconTypeID string `json:"$type"` +} + +func (t *FeedPostgate_DisableRule) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.postgate" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedPostgate_DisableRule) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feedrepost.go b/pkg/appbsky/feedrepost.go new file mode 100644 index 00000000..8fa346d0 --- /dev/null +++ b/pkg/appbsky/feedrepost.go @@ -0,0 +1,38 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.repost + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.feed.repost", &FeedRepost{}) +} + +// Record representing a 'repost' of an existing Bluesky post. +type FeedRepost struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Subject comatproto.RepoStrongRef `json:"subject"` + Via *comatproto.RepoStrongRef `json:"via,omitempty"` +} + +func (t *FeedRepost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.repost" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedRepost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/feedsearchposts.go b/pkg/appbsky/feedsearchposts.go new file mode 100644 index 00000000..40696f6c --- /dev/null +++ b/pkg/appbsky/feedsearchposts.go @@ -0,0 +1,94 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.searchPosts + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedSearchPosts_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + // hitsTotal: Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. + HitsTotal *int64 `json:"hitsTotal,omitempty"` + Posts []FeedDefs_PostView `json:"posts"` +} + +func (t *FeedSearchPosts_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.searchPosts#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedSearchPosts_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedSearchPosts calls the XRPC method "app.bsky.feed.searchPosts". +// +// Find posts matching search criteria, returning views of those posts. Note that this API endpoint may require authentication (eg, not public) for some service providers and implementations. +// +// author: Filter to posts by the given account. Handles are resolved to DID before query-time. +// cursor: Optional pagination mechanism; may not necessarily allow scrolling through entire result set. +// domain: Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. +// lang: Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. +// mentions: Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. +// q: Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. +// since: Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). +// sort: Specifies the ranking order of results. +// tag[]: Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. +// until: Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). +// url: Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. +func FeedSearchPosts(ctx context.Context, c glexrt.LexClient, author string, cursor string, domain string, lang string, limit *int64, mentions string, q string, since string, sort string, tag []string, until string, url string) (*FeedSearchPosts_Output, error) { + var out FeedSearchPosts_Output + + params := map[string]interface{}{} + if author != "" { + params["author"] = author + } + if cursor != "" { + params["cursor"] = cursor + } + if domain != "" { + params["domain"] = domain + } + if lang != "" { + params["lang"] = lang + } + if limit != nil { + params["limit"] = *limit + } + if mentions != "" { + params["mentions"] = mentions + } + if since != "" { + params["since"] = since + } + if sort != "" { + params["sort"] = sort + } + if len(tag) != 0 { + params["tag"] = tag + } + if until != "" { + params["until"] = until + } + if url != "" { + params["url"] = url + } + params["q"] = q + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.feed.searchPosts", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedsendinteractions.go b/pkg/appbsky/feedsendinteractions.go new file mode 100644 index 00000000..f09fc561 --- /dev/null +++ b/pkg/appbsky/feedsendinteractions.go @@ -0,0 +1,60 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.sendInteractions + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type FeedSendInteractions_Input struct { + LexiconTypeID string `json:"$type"` + Interactions []FeedDefs_Interaction `json:"interactions"` +} + +func (t *FeedSendInteractions_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.sendInteractions#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedSendInteractions_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedSendInteractions_Output struct { + LexiconTypeID string `json:"$type"` +} + +func (t *FeedSendInteractions_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.sendInteractions#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedSendInteractions_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedSendInteractions calls the XRPC method "app.bsky.feed.sendInteractions". +// +// Send information about interactions with feed items back to the feed generator that served them. +func FeedSendInteractions(ctx context.Context, c glexrt.LexClient, input *FeedSendInteractions_Input) (*FeedSendInteractions_Output, error) { + var out FeedSendInteractions_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.feed.sendInteractions", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/feedthreadgate.go b/pkg/appbsky/feedthreadgate.go new file mode 100644 index 00000000..a1fe014d --- /dev/null +++ b/pkg/appbsky/feedthreadgate.go @@ -0,0 +1,221 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.feed.threadgate + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.feed.threadgate", &FeedThreadgate{}) +} + +// Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository. +type FeedThreadgate struct { + LexiconTypeID string `json:"$type"` + // allow: List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply. + Allow []FeedThreadgate_Allow_Elem `json:"allow,omitempty"` + CreatedAt string `json:"createdAt"` + // hiddenReplies: List of hidden reply URIs. + HiddenReplies []string `json:"hiddenReplies,omitempty"` + // post: Reference (AT-URI) to the post record. + Post string `json:"post"` +} + +func (t *FeedThreadgate) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.threadgate" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedThreadgate) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type FeedThreadgate_Allow_Elem struct { + FeedThreadgate_FollowerRule *FeedThreadgate_FollowerRule + FeedThreadgate_FollowingRule *FeedThreadgate_FollowingRule + FeedThreadgate_ListRule *FeedThreadgate_ListRule + FeedThreadgate_MentionRule *FeedThreadgate_MentionRule +} + +func (t *FeedThreadgate_Allow_Elem) MarshalJSON() ([]byte, error) { + if t.FeedThreadgate_FollowerRule != nil { + t.FeedThreadgate_FollowerRule.LexiconTypeID = "app.bsky.feed.threadgate#followerRule" + return json.Marshal(t.FeedThreadgate_FollowerRule) + } + if t.FeedThreadgate_FollowingRule != nil { + t.FeedThreadgate_FollowingRule.LexiconTypeID = "app.bsky.feed.threadgate#followingRule" + return json.Marshal(t.FeedThreadgate_FollowingRule) + } + if t.FeedThreadgate_ListRule != nil { + t.FeedThreadgate_ListRule.LexiconTypeID = "app.bsky.feed.threadgate#listRule" + return json.Marshal(t.FeedThreadgate_ListRule) + } + if t.FeedThreadgate_MentionRule != nil { + t.FeedThreadgate_MentionRule.LexiconTypeID = "app.bsky.feed.threadgate#mentionRule" + return json.Marshal(t.FeedThreadgate_MentionRule) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *FeedThreadgate_Allow_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.threadgate#followerRule": + t.FeedThreadgate_FollowerRule = new(FeedThreadgate_FollowerRule) + return json.Unmarshal(b, t.FeedThreadgate_FollowerRule) + case "app.bsky.feed.threadgate#followingRule": + t.FeedThreadgate_FollowingRule = new(FeedThreadgate_FollowingRule) + return json.Unmarshal(b, t.FeedThreadgate_FollowingRule) + case "app.bsky.feed.threadgate#listRule": + t.FeedThreadgate_ListRule = new(FeedThreadgate_ListRule) + return json.Unmarshal(b, t.FeedThreadgate_ListRule) + case "app.bsky.feed.threadgate#mentionRule": + t.FeedThreadgate_MentionRule = new(FeedThreadgate_MentionRule) + return json.Unmarshal(b, t.FeedThreadgate_MentionRule) + default: + return nil + } +} + +func (t *FeedThreadgate_Allow_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.FeedThreadgate_FollowerRule != nil { + return t.FeedThreadgate_FollowerRule.MarshalCBOR(w) + } + if t.FeedThreadgate_FollowingRule != nil { + return t.FeedThreadgate_FollowingRule.MarshalCBOR(w) + } + if t.FeedThreadgate_ListRule != nil { + return t.FeedThreadgate_ListRule.MarshalCBOR(w) + } + if t.FeedThreadgate_MentionRule != nil { + return t.FeedThreadgate_MentionRule.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *FeedThreadgate_Allow_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.feed.threadgate#followerRule": + t.FeedThreadgate_FollowerRule = new(FeedThreadgate_FollowerRule) + return t.FeedThreadgate_FollowerRule.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.threadgate#followingRule": + t.FeedThreadgate_FollowingRule = new(FeedThreadgate_FollowingRule) + return t.FeedThreadgate_FollowingRule.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.threadgate#listRule": + t.FeedThreadgate_ListRule = new(FeedThreadgate_ListRule) + return t.FeedThreadgate_ListRule.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.feed.threadgate#mentionRule": + t.FeedThreadgate_MentionRule = new(FeedThreadgate_MentionRule) + return t.FeedThreadgate_MentionRule.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// FeedThreadgate_FollowerRule is a "followerRule" in the app.bsky.feed.threadgate schema. +// +// Allow replies from actors who follow you. +type FeedThreadgate_FollowerRule struct { + LexiconTypeID string `json:"$type"` +} + +func (t *FeedThreadgate_FollowerRule) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.threadgate" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedThreadgate_FollowerRule) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedThreadgate_FollowingRule is a "followingRule" in the app.bsky.feed.threadgate schema. +// +// Allow replies from actors you follow. +type FeedThreadgate_FollowingRule struct { + LexiconTypeID string `json:"$type"` +} + +func (t *FeedThreadgate_FollowingRule) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.threadgate" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedThreadgate_FollowingRule) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedThreadgate_ListRule is a "listRule" in the app.bsky.feed.threadgate schema. +// +// Allow replies from actors on a list. +type FeedThreadgate_ListRule struct { + LexiconTypeID string `json:"$type"` + List string `json:"list"` +} + +func (t *FeedThreadgate_ListRule) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.threadgate" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedThreadgate_ListRule) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// FeedThreadgate_MentionRule is a "mentionRule" in the app.bsky.feed.threadgate schema. +// +// Allow replies from actors mentioned in your post. +type FeedThreadgate_MentionRule struct { + LexiconTypeID string `json:"$type"` +} + +func (t *FeedThreadgate_MentionRule) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.feed.threadgate" + return glexrt.MarshalCBOR(w, t) +} + +func (t *FeedThreadgate_MentionRule) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphblock.go b/pkg/appbsky/graphblock.go new file mode 100644 index 00000000..6b1867a4 --- /dev/null +++ b/pkg/appbsky/graphblock.go @@ -0,0 +1,37 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.block + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.graph.block", &GraphBlock{}) +} + +// Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details. +type GraphBlock struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + // subject: DID of the account to be blocked. + Subject string `json:"subject"` +} + +func (t *GraphBlock) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.block" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphBlock) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphdefs.go b/pkg/appbsky/graphdefs.go new file mode 100644 index 00000000..8e659650 --- /dev/null +++ b/pkg/appbsky/graphdefs.go @@ -0,0 +1,221 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.defs + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +// GraphDefs_ListItemView is a "listItemView" in the app.bsky.graph.defs schema. +type GraphDefs_ListItemView struct { + LexiconTypeID string `json:"$type"` + Subject ActorDefs_ProfileView `json:"subject"` + Uri string `json:"uri"` +} + +func (t *GraphDefs_ListItemView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_ListItemView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphDefs_ListView is a "listView" in the app.bsky.graph.defs schema. +type GraphDefs_ListView struct { + LexiconTypeID string `json:"$type"` + Avatar *string `json:"avatar,omitempty"` + Cid string `json:"cid"` + Creator ActorDefs_ProfileView `json:"creator"` + Description *string `json:"description,omitempty"` + DescriptionFacets []RichtextFacet `json:"descriptionFacets,omitempty"` + IndexedAt string `json:"indexedAt"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + ListItemCount *int64 `json:"listItemCount,omitempty"` + Name string `json:"name"` + Purpose string `json:"purpose"` + Uri string `json:"uri"` + Viewer *GraphDefs_ListViewerState `json:"viewer,omitempty"` +} + +func (t *GraphDefs_ListView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_ListView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphDefs_ListViewBasic is a "listViewBasic" in the app.bsky.graph.defs schema. +type GraphDefs_ListViewBasic struct { + LexiconTypeID string `json:"$type"` + Avatar *string `json:"avatar,omitempty"` + Cid string `json:"cid"` + IndexedAt *string `json:"indexedAt,omitempty"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + ListItemCount *int64 `json:"listItemCount,omitempty"` + Name string `json:"name"` + Purpose string `json:"purpose"` + Uri string `json:"uri"` + Viewer *GraphDefs_ListViewerState `json:"viewer,omitempty"` +} + +func (t *GraphDefs_ListViewBasic) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_ListViewBasic) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphDefs_ListViewerState is a "listViewerState" in the app.bsky.graph.defs schema. +type GraphDefs_ListViewerState struct { + LexiconTypeID string `json:"$type"` + Blocked *string `json:"blocked,omitempty"` + Muted *bool `json:"muted,omitempty"` +} + +func (t *GraphDefs_ListViewerState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_ListViewerState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphDefs_NotFoundActor is a "notFoundActor" in the app.bsky.graph.defs schema. +// +// indicates that a handle or DID could not be resolved +type GraphDefs_NotFoundActor struct { + LexiconTypeID string `json:"$type"` + Actor string `json:"actor"` + NotFound bool `json:"notFound"` +} + +func (t *GraphDefs_NotFoundActor) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_NotFoundActor) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphDefs_Relationship is a "relationship" in the app.bsky.graph.defs schema. +// +// lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) +type GraphDefs_Relationship struct { + LexiconTypeID string `json:"$type"` + // blockedBy: if the actor is blocked by this DID, contains the AT-URI of the block record + BlockedBy *string `json:"blockedBy,omitempty"` + // blockedByList: if the actor is blocked by this DID via a block list, contains the AT-URI of the listblock record + BlockedByList *string `json:"blockedByList,omitempty"` + // blocking: if the actor blocks this DID, this is the AT-URI of the block record + Blocking *string `json:"blocking,omitempty"` + // blockingByList: if the actor blocks this DID via a block list, this is the AT-URI of the listblock record + BlockingByList *string `json:"blockingByList,omitempty"` + Did string `json:"did"` + // followedBy: if the actor is followed by this DID, contains the AT-URI of the follow record + FollowedBy *string `json:"followedBy,omitempty"` + // following: if the actor follows this DID, this is the AT-URI of the follow record + Following *string `json:"following,omitempty"` +} + +func (t *GraphDefs_Relationship) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_Relationship) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphDefs_StarterPackView is a "starterPackView" in the app.bsky.graph.defs schema. +type GraphDefs_StarterPackView struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Creator ActorDefs_ProfileViewBasic `json:"creator"` + Feeds []FeedDefs_GeneratorView `json:"feeds,omitempty"` + IndexedAt string `json:"indexedAt"` + JoinedAllTimeCount *int64 `json:"joinedAllTimeCount,omitempty"` + JoinedWeekCount *int64 `json:"joinedWeekCount,omitempty"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + List *GraphDefs_ListViewBasic `json:"list,omitempty"` + ListItemsSample []GraphDefs_ListItemView `json:"listItemsSample,omitempty"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` +} + +func (t *GraphDefs_StarterPackView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_StarterPackView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphDefs_StarterPackViewBasic is a "starterPackViewBasic" in the app.bsky.graph.defs schema. +type GraphDefs_StarterPackViewBasic struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Creator ActorDefs_ProfileViewBasic `json:"creator"` + IndexedAt string `json:"indexedAt"` + JoinedAllTimeCount *int64 `json:"joinedAllTimeCount,omitempty"` + JoinedWeekCount *int64 `json:"joinedWeekCount,omitempty"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + ListItemCount *int64 `json:"listItemCount,omitempty"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` +} + +func (t *GraphDefs_StarterPackViewBasic) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphDefs_StarterPackViewBasic) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphfollow.go b/pkg/appbsky/graphfollow.go new file mode 100644 index 00000000..4391415a --- /dev/null +++ b/pkg/appbsky/graphfollow.go @@ -0,0 +1,38 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.follow + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.graph.follow", &GraphFollow{}) +} + +// Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView. +type GraphFollow struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Subject string `json:"subject"` + Via *comatproto.RepoStrongRef `json:"via,omitempty"` +} + +func (t *GraphFollow) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.follow" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphFollow) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphgetactorstarterpacks.go b/pkg/appbsky/graphgetactorstarterpacks.go new file mode 100644 index 00000000..032ef4db --- /dev/null +++ b/pkg/appbsky/graphgetactorstarterpacks.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getActorStarterPacks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetActorStarterPacks_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + StarterPacks []GraphDefs_StarterPackViewBasic `json:"starterPacks"` +} + +func (t *GraphGetActorStarterPacks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getActorStarterPacks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetActorStarterPacks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetActorStarterPacks calls the XRPC method "app.bsky.graph.getActorStarterPacks". +// +// Get a list of starter packs created by the actor. +func GraphGetActorStarterPacks(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64) (*GraphGetActorStarterPacks_Output, error) { + var out GraphGetActorStarterPacks_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getActorStarterPacks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetblocks.go b/pkg/appbsky/graphgetblocks.go new file mode 100644 index 00000000..e1abf0fe --- /dev/null +++ b/pkg/appbsky/graphgetblocks.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getBlocks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetBlocks_Output struct { + LexiconTypeID string `json:"$type"` + Blocks []ActorDefs_ProfileView `json:"blocks"` + Cursor *string `json:"cursor,omitempty"` +} + +func (t *GraphGetBlocks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getBlocks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetBlocks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetBlocks calls the XRPC method "app.bsky.graph.getBlocks". +// +// Enumerates which accounts the requesting account is currently blocking. Requires auth. +func GraphGetBlocks(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*GraphGetBlocks_Output, error) { + var out GraphGetBlocks_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getBlocks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetfollowers.go b/pkg/appbsky/graphgetfollowers.go new file mode 100644 index 00000000..335197e7 --- /dev/null +++ b/pkg/appbsky/graphgetfollowers.go @@ -0,0 +1,54 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getFollowers + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetFollowers_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Followers []ActorDefs_ProfileView `json:"followers"` + Subject ActorDefs_ProfileView `json:"subject"` +} + +func (t *GraphGetFollowers_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getFollowers#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetFollowers_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetFollowers calls the XRPC method "app.bsky.graph.getFollowers". +// +// Enumerates accounts which follow a specified account (actor). +func GraphGetFollowers(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64) (*GraphGetFollowers_Output, error) { + var out GraphGetFollowers_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getFollowers", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetfollows.go b/pkg/appbsky/graphgetfollows.go new file mode 100644 index 00000000..91dd587d --- /dev/null +++ b/pkg/appbsky/graphgetfollows.go @@ -0,0 +1,54 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getFollows + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetFollows_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Follows []ActorDefs_ProfileView `json:"follows"` + Subject ActorDefs_ProfileView `json:"subject"` +} + +func (t *GraphGetFollows_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getFollows#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetFollows_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetFollows calls the XRPC method "app.bsky.graph.getFollows". +// +// Enumerates accounts which a specified account (actor) follows. +func GraphGetFollows(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64) (*GraphGetFollows_Output, error) { + var out GraphGetFollows_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getFollows", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetknownfollowers.go b/pkg/appbsky/graphgetknownfollowers.go new file mode 100644 index 00000000..364bf344 --- /dev/null +++ b/pkg/appbsky/graphgetknownfollowers.go @@ -0,0 +1,54 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getKnownFollowers + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetKnownFollowers_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Followers []ActorDefs_ProfileView `json:"followers"` + Subject ActorDefs_ProfileView `json:"subject"` +} + +func (t *GraphGetKnownFollowers_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getKnownFollowers#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetKnownFollowers_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetKnownFollowers calls the XRPC method "app.bsky.graph.getKnownFollowers". +// +// Enumerates accounts which follow a specified account (actor) and are followed by the viewer. +func GraphGetKnownFollowers(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64) (*GraphGetKnownFollowers_Output, error) { + var out GraphGetKnownFollowers_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getKnownFollowers", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetlist.go b/pkg/appbsky/graphgetlist.go new file mode 100644 index 00000000..d8033fd0 --- /dev/null +++ b/pkg/appbsky/graphgetlist.go @@ -0,0 +1,56 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getList + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetList_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Items []GraphDefs_ListItemView `json:"items"` + List GraphDefs_ListView `json:"list"` +} + +func (t *GraphGetList_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getList#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetList_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetList calls the XRPC method "app.bsky.graph.getList". +// +// Gets a 'view' (with additional context) of a specified list. +// +// list: Reference (AT-URI) of the list record to hydrate. +func GraphGetList(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, list string) (*GraphGetList_Output, error) { + var out GraphGetList_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["list"] = list + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getList", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetlistblocks.go b/pkg/appbsky/graphgetlistblocks.go new file mode 100644 index 00000000..bc2f0f1c --- /dev/null +++ b/pkg/appbsky/graphgetlistblocks.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getListBlocks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetListBlocks_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Lists []GraphDefs_ListView `json:"lists"` +} + +func (t *GraphGetListBlocks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getListBlocks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetListBlocks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetListBlocks calls the XRPC method "app.bsky.graph.getListBlocks". +// +// Get mod lists that the requesting account (actor) is blocking. Requires auth. +func GraphGetListBlocks(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*GraphGetListBlocks_Output, error) { + var out GraphGetListBlocks_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getListBlocks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetlistmutes.go b/pkg/appbsky/graphgetlistmutes.go new file mode 100644 index 00000000..faa0c278 --- /dev/null +++ b/pkg/appbsky/graphgetlistmutes.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getListMutes + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetListMutes_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Lists []GraphDefs_ListView `json:"lists"` +} + +func (t *GraphGetListMutes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getListMutes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetListMutes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetListMutes calls the XRPC method "app.bsky.graph.getListMutes". +// +// Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth. +func GraphGetListMutes(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*GraphGetListMutes_Output, error) { + var out GraphGetListMutes_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getListMutes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetlists.go b/pkg/appbsky/graphgetlists.go new file mode 100644 index 00000000..9d8637f2 --- /dev/null +++ b/pkg/appbsky/graphgetlists.go @@ -0,0 +1,59 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getLists + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetLists_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Lists []GraphDefs_ListView `json:"lists"` +} + +func (t *GraphGetLists_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getLists#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetLists_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetLists calls the XRPC method "app.bsky.graph.getLists". +// +// Enumerates the lists created by a specified account (actor). +// +// actor: The account (actor) to enumerate lists from. +// purposes[]: Optional filter by list purpose. If not specified, all supported types are returned. +func GraphGetLists(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64, purposes []string) (*GraphGetLists_Output, error) { + var out GraphGetLists_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if len(purposes) != 0 { + params["purposes"] = purposes + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getLists", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetlistswithmembership.go b/pkg/appbsky/graphgetlistswithmembership.go new file mode 100644 index 00000000..8ed9f9b9 --- /dev/null +++ b/pkg/appbsky/graphgetlistswithmembership.go @@ -0,0 +1,81 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getListsWithMembership + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetListsWithMembership_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + ListsWithMembership []GraphGetListsWithMembership_ListWithMembership `json:"listsWithMembership"` +} + +func (t *GraphGetListsWithMembership_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getListsWithMembership#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetListsWithMembership_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetListsWithMembership calls the XRPC method "app.bsky.graph.getListsWithMembership". +// +// Enumerates the lists created by the session user, and includes membership information about `actor` in those lists. Only supports curation and moderation lists (no reference lists, used in starter packs). Requires auth. +// +// actor: The account (actor) to check for membership. +// purposes[]: Optional filter by list purpose. If not specified, all supported types are returned. +func GraphGetListsWithMembership(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64, purposes []string) (*GraphGetListsWithMembership_Output, error) { + var out GraphGetListsWithMembership_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if len(purposes) != 0 { + params["purposes"] = purposes + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getListsWithMembership", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// GraphGetListsWithMembership_ListWithMembership is a "listWithMembership" in the app.bsky.graph.getListsWithMembership schema. +// +// A list and an optional list item indicating membership of a target user to that list. +type GraphGetListsWithMembership_ListWithMembership struct { + LexiconTypeID string `json:"$type"` + List GraphDefs_ListView `json:"list"` + ListItem *GraphDefs_ListItemView `json:"listItem,omitempty"` +} + +func (t *GraphGetListsWithMembership_ListWithMembership) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getListsWithMembership" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetListsWithMembership_ListWithMembership) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphgetmutes.go b/pkg/appbsky/graphgetmutes.go new file mode 100644 index 00000000..41d2bd78 --- /dev/null +++ b/pkg/appbsky/graphgetmutes.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getMutes + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetMutes_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Mutes []ActorDefs_ProfileView `json:"mutes"` +} + +func (t *GraphGetMutes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getMutes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetMutes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetMutes calls the XRPC method "app.bsky.graph.getMutes". +// +// Enumerates accounts that the requesting account (actor) currently has muted. Requires auth. +func GraphGetMutes(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*GraphGetMutes_Output, error) { + var out GraphGetMutes_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getMutes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetrelationships.go b/pkg/appbsky/graphgetrelationships.go new file mode 100644 index 00000000..820f9c24 --- /dev/null +++ b/pkg/appbsky/graphgetrelationships.go @@ -0,0 +1,124 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getRelationships + +package appbsky + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetRelationships_Output struct { + LexiconTypeID string `json:"$type"` + Actor *string `json:"actor,omitempty"` + Relationships []GraphGetRelationships_Output_Relationships_Elem `json:"relationships"` +} + +func (t *GraphGetRelationships_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getRelationships#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetRelationships_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type GraphGetRelationships_Output_Relationships_Elem struct { + GraphDefs_NotFoundActor *GraphDefs_NotFoundActor + GraphDefs_Relationship *GraphDefs_Relationship +} + +func (t *GraphGetRelationships_Output_Relationships_Elem) MarshalJSON() ([]byte, error) { + if t.GraphDefs_NotFoundActor != nil { + t.GraphDefs_NotFoundActor.LexiconTypeID = "app.bsky.graph.defs#notFoundActor" + return json.Marshal(t.GraphDefs_NotFoundActor) + } + if t.GraphDefs_Relationship != nil { + t.GraphDefs_Relationship.LexiconTypeID = "app.bsky.graph.defs#relationship" + return json.Marshal(t.GraphDefs_Relationship) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *GraphGetRelationships_Output_Relationships_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.graph.defs#notFoundActor": + t.GraphDefs_NotFoundActor = new(GraphDefs_NotFoundActor) + return json.Unmarshal(b, t.GraphDefs_NotFoundActor) + case "app.bsky.graph.defs#relationship": + t.GraphDefs_Relationship = new(GraphDefs_Relationship) + return json.Unmarshal(b, t.GraphDefs_Relationship) + default: + return nil + } +} + +func (t *GraphGetRelationships_Output_Relationships_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.GraphDefs_NotFoundActor != nil { + return t.GraphDefs_NotFoundActor.MarshalCBOR(w) + } + if t.GraphDefs_Relationship != nil { + return t.GraphDefs_Relationship.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *GraphGetRelationships_Output_Relationships_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.graph.defs#notFoundActor": + t.GraphDefs_NotFoundActor = new(GraphDefs_NotFoundActor) + return t.GraphDefs_NotFoundActor.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.graph.defs#relationship": + t.GraphDefs_Relationship = new(GraphDefs_Relationship) + return t.GraphDefs_Relationship.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// GraphGetRelationships calls the XRPC method "app.bsky.graph.getRelationships". +// +// Enumerates public relationships between one account, and a list of other accounts. Does not require auth. +// +// actor: Primary account requesting relationships for. +// others[]: List of 'other' accounts to be related back to the primary. +func GraphGetRelationships(ctx context.Context, c glexrt.LexClient, actor string, others []string) (*GraphGetRelationships_Output, error) { + var out GraphGetRelationships_Output + + params := map[string]interface{}{} + if len(others) != 0 { + params["others"] = others + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getRelationships", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetstarterpack.go b/pkg/appbsky/graphgetstarterpack.go new file mode 100644 index 00000000..fb1c8723 --- /dev/null +++ b/pkg/appbsky/graphgetstarterpack.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getStarterPack + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetStarterPack_Output struct { + LexiconTypeID string `json:"$type"` + StarterPack GraphDefs_StarterPackView `json:"starterPack"` +} + +func (t *GraphGetStarterPack_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getStarterPack#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetStarterPack_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetStarterPack calls the XRPC method "app.bsky.graph.getStarterPack". +// +// Gets a view of a starter pack. +// +// starterPack: Reference (AT-URI) of the starter pack record. +func GraphGetStarterPack(ctx context.Context, c glexrt.LexClient, starterPack string) (*GraphGetStarterPack_Output, error) { + var out GraphGetStarterPack_Output + + params := map[string]interface{}{} + params["starterPack"] = starterPack + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getStarterPack", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetstarterpacks.go b/pkg/appbsky/graphgetstarterpacks.go new file mode 100644 index 00000000..0f496219 --- /dev/null +++ b/pkg/appbsky/graphgetstarterpacks.go @@ -0,0 +1,46 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getStarterPacks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetStarterPacks_Output struct { + LexiconTypeID string `json:"$type"` + StarterPacks []GraphDefs_StarterPackViewBasic `json:"starterPacks"` +} + +func (t *GraphGetStarterPacks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getStarterPacks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetStarterPacks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetStarterPacks calls the XRPC method "app.bsky.graph.getStarterPacks". +// +// Get views for a list of starter packs. +func GraphGetStarterPacks(ctx context.Context, c glexrt.LexClient, uris []string) (*GraphGetStarterPacks_Output, error) { + var out GraphGetStarterPacks_Output + + params := map[string]interface{}{} + params["uris"] = uris + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getStarterPacks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphgetstarterpackswithmembership.go b/pkg/appbsky/graphgetstarterpackswithmembership.go new file mode 100644 index 00000000..a700a3ae --- /dev/null +++ b/pkg/appbsky/graphgetstarterpackswithmembership.go @@ -0,0 +1,77 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getStarterPacksWithMembership + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetStarterPacksWithMembership_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + StarterPacksWithMembership []GraphGetStarterPacksWithMembership_StarterPackWithMembership `json:"starterPacksWithMembership"` +} + +func (t *GraphGetStarterPacksWithMembership_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getStarterPacksWithMembership#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetStarterPacksWithMembership_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetStarterPacksWithMembership calls the XRPC method "app.bsky.graph.getStarterPacksWithMembership". +// +// Enumerates the starter packs created by the session user, and includes membership information about `actor` in those starter packs. Requires auth. +// +// actor: The account (actor) to check for membership. +func GraphGetStarterPacksWithMembership(ctx context.Context, c glexrt.LexClient, actor string, cursor string, limit *int64) (*GraphGetStarterPacksWithMembership_Output, error) { + var out GraphGetStarterPacksWithMembership_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getStarterPacksWithMembership", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// GraphGetStarterPacksWithMembership_StarterPackWithMembership is a "starterPackWithMembership" in the app.bsky.graph.getStarterPacksWithMembership schema. +// +// A starter pack and an optional list item indicating membership of a target user to that starter pack. +type GraphGetStarterPacksWithMembership_StarterPackWithMembership struct { + LexiconTypeID string `json:"$type"` + ListItem *GraphDefs_ListItemView `json:"listItem,omitempty"` + StarterPack GraphDefs_StarterPackView `json:"starterPack"` +} + +func (t *GraphGetStarterPacksWithMembership_StarterPackWithMembership) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getStarterPacksWithMembership" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetStarterPacksWithMembership_StarterPackWithMembership) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphgetsuggestedfollowsbyactor.go b/pkg/appbsky/graphgetsuggestedfollowsbyactor.go new file mode 100644 index 00000000..02562107 --- /dev/null +++ b/pkg/appbsky/graphgetsuggestedfollowsbyactor.go @@ -0,0 +1,50 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.getSuggestedFollowsByActor + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphGetSuggestedFollowsByActor_Output struct { + LexiconTypeID string `json:"$type"` + // isFallback: If true, response has fallen-back to generic results, and is not scoped using relativeToDid + IsFallback *bool `json:"isFallback,omitempty"` + // recId: Snowflake for this recommendation, use when submitting recommendation events. + RecId *int64 `json:"recId,omitempty"` + Suggestions []ActorDefs_ProfileView `json:"suggestions"` +} + +func (t *GraphGetSuggestedFollowsByActor_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.getSuggestedFollowsByActor#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphGetSuggestedFollowsByActor_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphGetSuggestedFollowsByActor calls the XRPC method "app.bsky.graph.getSuggestedFollowsByActor". +// +// Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account. +func GraphGetSuggestedFollowsByActor(ctx context.Context, c glexrt.LexClient, actor string) (*GraphGetSuggestedFollowsByActor_Output, error) { + var out GraphGetSuggestedFollowsByActor_Output + + params := map[string]interface{}{} + params["actor"] = actor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.getSuggestedFollowsByActor", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphlist.go b/pkg/appbsky/graphlist.go new file mode 100644 index 00000000..370c05bf --- /dev/null +++ b/pkg/appbsky/graphlist.go @@ -0,0 +1,101 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.list + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.graph.list", &GraphList{}) +} + +// Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists. +type GraphList struct { + LexiconTypeID string `json:"$type"` + Avatar *glexrt.Blob `json:"avatar,omitempty"` + CreatedAt string `json:"createdAt"` + Description *string `json:"description,omitempty"` + DescriptionFacets []RichtextFacet `json:"descriptionFacets,omitempty"` + Labels *GraphList_Labels `json:"labels,omitempty"` + // name: Display name for list; can not be empty. + Name string `json:"name"` + // purpose: Defines the purpose of the list (aka, moderation-oriented or curration-oriented) + Purpose string `json:"purpose"` +} + +func (t *GraphList) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.list" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphList) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type GraphList_Labels struct { + LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels +} + +func (t *GraphList_Labels) MarshalJSON() ([]byte, error) { + if t.LabelDefs_SelfLabels != nil { + t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels" + return json.Marshal(t.LabelDefs_SelfLabels) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *GraphList_Labels) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return json.Unmarshal(b, t.LabelDefs_SelfLabels) + default: + return nil + } +} + +func (t *GraphList_Labels) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelDefs_SelfLabels != nil { + return t.LabelDefs_SelfLabels.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *GraphList_Labels) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/graphlistblock.go b/pkg/appbsky/graphlistblock.go new file mode 100644 index 00000000..b5ca0f98 --- /dev/null +++ b/pkg/appbsky/graphlistblock.go @@ -0,0 +1,37 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.listblock + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.graph.listblock", &GraphListblock{}) +} + +// Record representing a block relationship against an entire an entire list of accounts (actors). +type GraphListblock struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + // subject: Reference (AT-URI) to the mod list record. + Subject string `json:"subject"` +} + +func (t *GraphListblock) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.listblock" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphListblock) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphlistitem.go b/pkg/appbsky/graphlistitem.go new file mode 100644 index 00000000..a0d352c0 --- /dev/null +++ b/pkg/appbsky/graphlistitem.go @@ -0,0 +1,39 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.listitem + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.graph.listitem", &GraphListitem{}) +} + +// Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records. +type GraphListitem struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + // list: Reference (AT-URI) to the list record (app.bsky.graph.list). + List string `json:"list"` + // subject: The account which is included on the list. + Subject string `json:"subject"` +} + +func (t *GraphListitem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.listitem" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphListitem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphmuteactor.go b/pkg/appbsky/graphmuteactor.go new file mode 100644 index 00000000..b954d2c6 --- /dev/null +++ b/pkg/appbsky/graphmuteactor.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.muteActor + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphMuteActor_Input struct { + LexiconTypeID string `json:"$type"` + Actor string `json:"actor"` +} + +func (t *GraphMuteActor_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.muteActor#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphMuteActor_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphMuteActor calls the XRPC method "app.bsky.graph.muteActor". +// +// Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth. +func GraphMuteActor(ctx context.Context, c glexrt.LexClient, input *GraphMuteActor_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.graph.muteActor", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/graphmuteactorlist.go b/pkg/appbsky/graphmuteactorlist.go new file mode 100644 index 00000000..e1c7e7a6 --- /dev/null +++ b/pkg/appbsky/graphmuteactorlist.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.muteActorList + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphMuteActorList_Input struct { + LexiconTypeID string `json:"$type"` + List string `json:"list"` +} + +func (t *GraphMuteActorList_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.muteActorList#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphMuteActorList_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphMuteActorList calls the XRPC method "app.bsky.graph.muteActorList". +// +// Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth. +func GraphMuteActorList(ctx context.Context, c glexrt.LexClient, input *GraphMuteActorList_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.graph.muteActorList", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/graphmutethread.go b/pkg/appbsky/graphmutethread.go new file mode 100644 index 00000000..ac6f7259 --- /dev/null +++ b/pkg/appbsky/graphmutethread.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.muteThread + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphMuteThread_Input struct { + LexiconTypeID string `json:"$type"` + Root string `json:"root"` +} + +func (t *GraphMuteThread_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.muteThread#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphMuteThread_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphMuteThread calls the XRPC method "app.bsky.graph.muteThread". +// +// Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth. +func GraphMuteThread(ctx context.Context, c glexrt.LexClient, input *GraphMuteThread_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.graph.muteThread", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/graphsearchstarterpacks.go b/pkg/appbsky/graphsearchstarterpacks.go new file mode 100644 index 00000000..730882ce --- /dev/null +++ b/pkg/appbsky/graphsearchstarterpacks.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.searchStarterPacks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphSearchStarterPacks_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + StarterPacks []GraphDefs_StarterPackViewBasic `json:"starterPacks"` +} + +func (t *GraphSearchStarterPacks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.searchStarterPacks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphSearchStarterPacks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphSearchStarterPacks calls the XRPC method "app.bsky.graph.searchStarterPacks". +// +// Find starter packs matching search criteria. Does not require auth. +// +// q: Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. +func GraphSearchStarterPacks(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, q string) (*GraphSearchStarterPacks_Output, error) { + var out GraphSearchStarterPacks_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["q"] = q + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.graph.searchStarterPacks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/graphstarterpack.go b/pkg/appbsky/graphstarterpack.go new file mode 100644 index 00000000..4aa12bc4 --- /dev/null +++ b/pkg/appbsky/graphstarterpack.go @@ -0,0 +1,61 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.starterpack + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.graph.starterpack", &GraphStarterpack{}) +} + +// Record defining a starter pack of actors and feeds for new users. +type GraphStarterpack struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Description *string `json:"description,omitempty"` + DescriptionFacets []RichtextFacet `json:"descriptionFacets,omitempty"` + Feeds []GraphStarterpack_FeedItem `json:"feeds,omitempty"` + // list: Reference (AT-URI) to the list record. + List string `json:"list"` + // name: Display name for starter pack; can not be empty. + Name string `json:"name"` +} + +func (t *GraphStarterpack) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.starterpack" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphStarterpack) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphStarterpack_FeedItem is a "feedItem" in the app.bsky.graph.starterpack schema. +type GraphStarterpack_FeedItem struct { + LexiconTypeID string `json:"$type"` + Uri string `json:"uri"` +} + +func (t *GraphStarterpack_FeedItem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.starterpack" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphStarterpack_FeedItem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/graphunmuteactor.go b/pkg/appbsky/graphunmuteactor.go new file mode 100644 index 00000000..194587cd --- /dev/null +++ b/pkg/appbsky/graphunmuteactor.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.unmuteActor + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphUnmuteActor_Input struct { + LexiconTypeID string `json:"$type"` + Actor string `json:"actor"` +} + +func (t *GraphUnmuteActor_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.unmuteActor#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphUnmuteActor_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphUnmuteActor calls the XRPC method "app.bsky.graph.unmuteActor". +// +// Unmutes the specified account. Requires auth. +func GraphUnmuteActor(ctx context.Context, c glexrt.LexClient, input *GraphUnmuteActor_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.graph.unmuteActor", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/graphunmuteactorlist.go b/pkg/appbsky/graphunmuteactorlist.go new file mode 100644 index 00000000..3dd9429c --- /dev/null +++ b/pkg/appbsky/graphunmuteactorlist.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.unmuteActorList + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphUnmuteActorList_Input struct { + LexiconTypeID string `json:"$type"` + List string `json:"list"` +} + +func (t *GraphUnmuteActorList_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.unmuteActorList#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphUnmuteActorList_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphUnmuteActorList calls the XRPC method "app.bsky.graph.unmuteActorList". +// +// Unmutes the specified list of accounts. Requires auth. +func GraphUnmuteActorList(ctx context.Context, c glexrt.LexClient, input *GraphUnmuteActorList_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.graph.unmuteActorList", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/graphunmutethread.go b/pkg/appbsky/graphunmutethread.go new file mode 100644 index 00000000..5e1767ae --- /dev/null +++ b/pkg/appbsky/graphunmutethread.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.unmuteThread + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GraphUnmuteThread_Input struct { + LexiconTypeID string `json:"$type"` + Root string `json:"root"` +} + +func (t *GraphUnmuteThread_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.unmuteThread#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphUnmuteThread_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GraphUnmuteThread calls the XRPC method "app.bsky.graph.unmuteThread". +// +// Unmutes the specified thread. Requires auth. +func GraphUnmuteThread(ctx context.Context, c glexrt.LexClient, input *GraphUnmuteThread_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.graph.unmuteThread", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/graphverification.go b/pkg/appbsky/graphverification.go new file mode 100644 index 00000000..9c819018 --- /dev/null +++ b/pkg/appbsky/graphverification.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.graph.verification + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.graph.verification", &GraphVerification{}) +} + +// Record declaring a verification relationship between two accounts. Verifications are only considered valid by an app if issued by an account the app considers trusted. +type GraphVerification struct { + LexiconTypeID string `json:"$type"` + // createdAt: Date of when the verification was created. + CreatedAt string `json:"createdAt"` + // displayName: Display name of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current displayName matches the one at the time of verifying. + DisplayName string `json:"displayName"` + // handle: Handle of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current handle matches the one at the time of verifying. + Handle string `json:"handle"` + // subject: DID of the subject the verification applies to. + Subject string `json:"subject"` +} + +func (t *GraphVerification) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.graph.verification" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GraphVerification) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/labelerdefs.go b/pkg/appbsky/labelerdefs.go new file mode 100644 index 00000000..ccbdc926 --- /dev/null +++ b/pkg/appbsky/labelerdefs.go @@ -0,0 +1,111 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.labeler.defs + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +// LabelerDefs_LabelerPolicies is a "labelerPolicies" in the app.bsky.labeler.defs schema. +type LabelerDefs_LabelerPolicies struct { + LexiconTypeID string `json:"$type"` + // labelValueDefinitions: Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. + LabelValueDefinitions []comatproto.LabelDefs_LabelValueDefinition `json:"labelValueDefinitions,omitempty"` + // labelValues: The label values which this labeler publishes. May include global or custom labels. + LabelValues []string `json:"labelValues"` +} + +func (t *LabelerDefs_LabelerPolicies) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.labeler.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelerDefs_LabelerPolicies) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelerDefs_LabelerView is a "labelerView" in the app.bsky.labeler.defs schema. +type LabelerDefs_LabelerView struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Creator ActorDefs_ProfileView `json:"creator"` + IndexedAt string `json:"indexedAt"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + LikeCount *int64 `json:"likeCount,omitempty"` + Uri string `json:"uri"` + Viewer *LabelerDefs_LabelerViewerState `json:"viewer,omitempty"` +} + +func (t *LabelerDefs_LabelerView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.labeler.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelerDefs_LabelerView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelerDefs_LabelerViewDetailed is a "labelerViewDetailed" in the app.bsky.labeler.defs schema. +type LabelerDefs_LabelerViewDetailed struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Creator ActorDefs_ProfileView `json:"creator"` + IndexedAt string `json:"indexedAt"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + LikeCount *int64 `json:"likeCount,omitempty"` + Policies LabelerDefs_LabelerPolicies `json:"policies"` + // reasonTypes: The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed. + ReasonTypes []string `json:"reasonTypes,omitempty"` + // subjectCollections: Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type. + SubjectCollections []string `json:"subjectCollections,omitempty"` + // subjectTypes: The set of subject types (account, record, etc) this service accepts reports on. + SubjectTypes []string `json:"subjectTypes,omitempty"` + Uri string `json:"uri"` + Viewer *LabelerDefs_LabelerViewerState `json:"viewer,omitempty"` +} + +func (t *LabelerDefs_LabelerViewDetailed) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.labeler.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelerDefs_LabelerViewDetailed) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelerDefs_LabelerViewerState is a "labelerViewerState" in the app.bsky.labeler.defs schema. +type LabelerDefs_LabelerViewerState struct { + LexiconTypeID string `json:"$type"` + Like *string `json:"like,omitempty"` +} + +func (t *LabelerDefs_LabelerViewerState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.labeler.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelerDefs_LabelerViewerState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/labelergetservices.go b/pkg/appbsky/labelergetservices.go new file mode 100644 index 00000000..2f7fe54e --- /dev/null +++ b/pkg/appbsky/labelergetservices.go @@ -0,0 +1,120 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.labeler.getServices + +package appbsky + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type LabelerGetServices_Output struct { + LexiconTypeID string `json:"$type"` + Views []LabelerGetServices_Output_Views_Elem `json:"views"` +} + +func (t *LabelerGetServices_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.labeler.getServices#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelerGetServices_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type LabelerGetServices_Output_Views_Elem struct { + LabelerDefs_LabelerView *LabelerDefs_LabelerView + LabelerDefs_LabelerViewDetailed *LabelerDefs_LabelerViewDetailed +} + +func (t *LabelerGetServices_Output_Views_Elem) MarshalJSON() ([]byte, error) { + if t.LabelerDefs_LabelerView != nil { + t.LabelerDefs_LabelerView.LexiconTypeID = "app.bsky.labeler.defs#labelerView" + return json.Marshal(t.LabelerDefs_LabelerView) + } + if t.LabelerDefs_LabelerViewDetailed != nil { + t.LabelerDefs_LabelerViewDetailed.LexiconTypeID = "app.bsky.labeler.defs#labelerViewDetailed" + return json.Marshal(t.LabelerDefs_LabelerViewDetailed) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *LabelerGetServices_Output_Views_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.labeler.defs#labelerView": + t.LabelerDefs_LabelerView = new(LabelerDefs_LabelerView) + return json.Unmarshal(b, t.LabelerDefs_LabelerView) + case "app.bsky.labeler.defs#labelerViewDetailed": + t.LabelerDefs_LabelerViewDetailed = new(LabelerDefs_LabelerViewDetailed) + return json.Unmarshal(b, t.LabelerDefs_LabelerViewDetailed) + default: + return nil + } +} + +func (t *LabelerGetServices_Output_Views_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelerDefs_LabelerView != nil { + return t.LabelerDefs_LabelerView.MarshalCBOR(w) + } + if t.LabelerDefs_LabelerViewDetailed != nil { + return t.LabelerDefs_LabelerViewDetailed.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *LabelerGetServices_Output_Views_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.labeler.defs#labelerView": + t.LabelerDefs_LabelerView = new(LabelerDefs_LabelerView) + return t.LabelerDefs_LabelerView.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.labeler.defs#labelerViewDetailed": + t.LabelerDefs_LabelerViewDetailed = new(LabelerDefs_LabelerViewDetailed) + return t.LabelerDefs_LabelerViewDetailed.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// LabelerGetServices calls the XRPC method "app.bsky.labeler.getServices". +// +// Get information about a list of labeler services. +func LabelerGetServices(ctx context.Context, c glexrt.LexClient, detailed *bool, dids []string) (*LabelerGetServices_Output, error) { + var out LabelerGetServices_Output + + params := map[string]interface{}{} + if detailed != nil { + params["detailed"] = *detailed + } + params["dids"] = dids + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.labeler.getServices", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/labelerservice.go b/pkg/appbsky/labelerservice.go new file mode 100644 index 00000000..dcfb02e9 --- /dev/null +++ b/pkg/appbsky/labelerservice.go @@ -0,0 +1,101 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.labeler.service + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("app.bsky.labeler.service", &LabelerService{}) +} + +// A declaration of the existence of labeler service. +type LabelerService struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Labels *LabelerService_Labels `json:"labels,omitempty"` + Policies LabelerDefs_LabelerPolicies `json:"policies"` + // reasonTypes: The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed. + ReasonTypes []string `json:"reasonTypes,omitempty"` + // subjectCollections: Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type. + SubjectCollections []string `json:"subjectCollections,omitempty"` + // subjectTypes: The set of subject types (account, record, etc) this service accepts reports on. + SubjectTypes []string `json:"subjectTypes,omitempty"` +} + +func (t *LabelerService) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.labeler.service" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelerService) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type LabelerService_Labels struct { + LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels +} + +func (t *LabelerService_Labels) MarshalJSON() ([]byte, error) { + if t.LabelDefs_SelfLabels != nil { + t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels" + return json.Marshal(t.LabelDefs_SelfLabels) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *LabelerService_Labels) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return json.Unmarshal(b, t.LabelDefs_SelfLabels) + default: + return nil + } +} + +func (t *LabelerService_Labels) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelDefs_SelfLabels != nil { + return t.LabelDefs_SelfLabels.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *LabelerService_Labels) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/notificationdeclaration.go b/pkg/appbsky/notificationdeclaration.go new file mode 100644 index 00000000..804c1f4f --- /dev/null +++ b/pkg/appbsky/notificationdeclaration.go @@ -0,0 +1,36 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.declaration + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.notification.declaration", &NotificationDeclaration{}) +} + +// A declaration of the user's choices related to notifications that can be produced by them. +type NotificationDeclaration struct { + LexiconTypeID string `json:"$type"` + // allowSubscriptions: A declaration of the user's preference for allowing activity subscriptions from other users. Absence of a record implies 'followers'. + AllowSubscriptions string `json:"allowSubscriptions"` +} + +func (t *NotificationDeclaration) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.declaration" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDeclaration) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/notificationdefs.go b/pkg/appbsky/notificationdefs.go new file mode 100644 index 00000000..100b96e9 --- /dev/null +++ b/pkg/appbsky/notificationdefs.go @@ -0,0 +1,164 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.defs + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// NotificationDefs_ActivitySubscription is a "activitySubscription" in the app.bsky.notification.defs schema. +type NotificationDefs_ActivitySubscription struct { + LexiconTypeID string `json:"$type"` + Post bool `json:"post"` + Reply bool `json:"reply"` +} + +func (t *NotificationDefs_ActivitySubscription) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDefs_ActivitySubscription) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationDefs_ChatPreference is a "chatPreference" in the app.bsky.notification.defs schema. +type NotificationDefs_ChatPreference struct { + LexiconTypeID string `json:"$type"` + Include string `json:"include"` + Push bool `json:"push"` +} + +func (t *NotificationDefs_ChatPreference) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDefs_ChatPreference) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationDefs_FilterablePreference is a "filterablePreference" in the app.bsky.notification.defs schema. +type NotificationDefs_FilterablePreference struct { + LexiconTypeID string `json:"$type"` + Include string `json:"include"` + List bool `json:"list"` + Push bool `json:"push"` +} + +func (t *NotificationDefs_FilterablePreference) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDefs_FilterablePreference) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationDefs_Preference is a "preference" in the app.bsky.notification.defs schema. +type NotificationDefs_Preference struct { + LexiconTypeID string `json:"$type"` + List bool `json:"list"` + Push bool `json:"push"` +} + +func (t *NotificationDefs_Preference) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDefs_Preference) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationDefs_Preferences is a "preferences" in the app.bsky.notification.defs schema. +type NotificationDefs_Preferences struct { + LexiconTypeID string `json:"$type"` + Chat NotificationDefs_ChatPreference `json:"chat"` + Follow NotificationDefs_FilterablePreference `json:"follow"` + Like NotificationDefs_FilterablePreference `json:"like"` + LikeViaRepost NotificationDefs_FilterablePreference `json:"likeViaRepost"` + Mention NotificationDefs_FilterablePreference `json:"mention"` + Quote NotificationDefs_FilterablePreference `json:"quote"` + Reply NotificationDefs_FilterablePreference `json:"reply"` + Repost NotificationDefs_FilterablePreference `json:"repost"` + RepostViaRepost NotificationDefs_FilterablePreference `json:"repostViaRepost"` + StarterpackJoined NotificationDefs_Preference `json:"starterpackJoined"` + SubscribedPost NotificationDefs_Preference `json:"subscribedPost"` + Unverified NotificationDefs_Preference `json:"unverified"` + Verified NotificationDefs_Preference `json:"verified"` +} + +func (t *NotificationDefs_Preferences) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDefs_Preferences) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationDefs_RecordDeleted is a "recordDeleted" in the app.bsky.notification.defs schema. +type NotificationDefs_RecordDeleted struct { + LexiconTypeID string `json:"$type"` +} + +func (t *NotificationDefs_RecordDeleted) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDefs_RecordDeleted) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationDefs_SubjectActivitySubscription is a "subjectActivitySubscription" in the app.bsky.notification.defs schema. +// +// Object used to store activity subscription data in stash. +type NotificationDefs_SubjectActivitySubscription struct { + LexiconTypeID string `json:"$type"` + ActivitySubscription NotificationDefs_ActivitySubscription `json:"activitySubscription"` + Subject string `json:"subject"` +} + +func (t *NotificationDefs_SubjectActivitySubscription) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationDefs_SubjectActivitySubscription) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/notificationgetpreferences.go b/pkg/appbsky/notificationgetpreferences.go new file mode 100644 index 00000000..faff682e --- /dev/null +++ b/pkg/appbsky/notificationgetpreferences.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.getPreferences + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationGetPreferences_Output struct { + LexiconTypeID string `json:"$type"` + Preferences NotificationDefs_Preferences `json:"preferences"` +} + +func (t *NotificationGetPreferences_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.getPreferences#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationGetPreferences_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationGetPreferences calls the XRPC method "app.bsky.notification.getPreferences". +// +// Get notification-related preferences for an account. Requires auth. +func NotificationGetPreferences(ctx context.Context, c glexrt.LexClient) (*NotificationGetPreferences_Output, error) { + var out NotificationGetPreferences_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.notification.getPreferences", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/notificationgetunreadcount.go b/pkg/appbsky/notificationgetunreadcount.go new file mode 100644 index 00000000..e196e583 --- /dev/null +++ b/pkg/appbsky/notificationgetunreadcount.go @@ -0,0 +1,51 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.getUnreadCount + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationGetUnreadCount_Output struct { + LexiconTypeID string `json:"$type"` + Count int64 `json:"count"` +} + +func (t *NotificationGetUnreadCount_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.getUnreadCount#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationGetUnreadCount_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationGetUnreadCount calls the XRPC method "app.bsky.notification.getUnreadCount". +// +// Count the number of unread notifications for the requesting account. Requires auth. +func NotificationGetUnreadCount(ctx context.Context, c glexrt.LexClient, priority *bool, seenAt string) (*NotificationGetUnreadCount_Output, error) { + var out NotificationGetUnreadCount_Output + + params := map[string]interface{}{} + if priority != nil { + params["priority"] = *priority + } + if seenAt != "" { + params["seenAt"] = seenAt + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.notification.getUnreadCount", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/notificationlistactivitysubscriptions.go b/pkg/appbsky/notificationlistactivitysubscriptions.go new file mode 100644 index 00000000..c5b9ba14 --- /dev/null +++ b/pkg/appbsky/notificationlistactivitysubscriptions.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.listActivitySubscriptions + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationListActivitySubscriptions_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Subscriptions []ActorDefs_ProfileView `json:"subscriptions"` +} + +func (t *NotificationListActivitySubscriptions_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.listActivitySubscriptions#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationListActivitySubscriptions_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationListActivitySubscriptions calls the XRPC method "app.bsky.notification.listActivitySubscriptions". +// +// Enumerate all accounts to which the requesting account is subscribed to receive notifications for. Requires auth. +func NotificationListActivitySubscriptions(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*NotificationListActivitySubscriptions_Output, error) { + var out NotificationListActivitySubscriptions_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.notification.listActivitySubscriptions", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/notificationlistnotifications.go b/pkg/appbsky/notificationlistnotifications.go new file mode 100644 index 00000000..436f485d --- /dev/null +++ b/pkg/appbsky/notificationlistnotifications.go @@ -0,0 +1,94 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.listNotifications + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +type NotificationListNotifications_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Notifications []NotificationListNotifications_Notification `json:"notifications"` + Priority *bool `json:"priority,omitempty"` + SeenAt *string `json:"seenAt,omitempty"` +} + +func (t *NotificationListNotifications_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.listNotifications#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationListNotifications_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationListNotifications calls the XRPC method "app.bsky.notification.listNotifications". +// +// Enumerate notifications for the requesting account. Requires auth. +// +// reasons[]: Notification reasons to include in response. +func NotificationListNotifications(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, priority *bool, reasons []string, seenAt string) (*NotificationListNotifications_Output, error) { + var out NotificationListNotifications_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if priority != nil { + params["priority"] = *priority + } + if len(reasons) != 0 { + params["reasons"] = reasons + } + if seenAt != "" { + params["seenAt"] = seenAt + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.notification.listNotifications", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// NotificationListNotifications_Notification is a "notification" in the app.bsky.notification.listNotifications schema. +type NotificationListNotifications_Notification struct { + LexiconTypeID string `json:"$type"` + Author ActorDefs_ProfileView `json:"author"` + Cid string `json:"cid"` + IndexedAt string `json:"indexedAt"` + IsRead bool `json:"isRead"` + Labels []comatproto.LabelDefs_Label `json:"labels,omitempty"` + // reason: The reason why this notification was delivered - e.g. your post was liked, or you received a new follower. + Reason string `json:"reason"` + ReasonSubject *string `json:"reasonSubject,omitempty"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` +} + +func (t *NotificationListNotifications_Notification) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.listNotifications" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationListNotifications_Notification) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/notificationputactivitysubscription.go b/pkg/appbsky/notificationputactivitysubscription.go new file mode 100644 index 00000000..2df49db4 --- /dev/null +++ b/pkg/appbsky/notificationputactivitysubscription.go @@ -0,0 +1,63 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.putActivitySubscription + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationPutActivitySubscription_Input struct { + LexiconTypeID string `json:"$type"` + ActivitySubscription NotificationDefs_ActivitySubscription `json:"activitySubscription"` + Subject string `json:"subject"` +} + +func (t *NotificationPutActivitySubscription_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.putActivitySubscription#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationPutActivitySubscription_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type NotificationPutActivitySubscription_Output struct { + LexiconTypeID string `json:"$type"` + ActivitySubscription *NotificationDefs_ActivitySubscription `json:"activitySubscription,omitempty"` + Subject string `json:"subject"` +} + +func (t *NotificationPutActivitySubscription_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.putActivitySubscription#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationPutActivitySubscription_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationPutActivitySubscription calls the XRPC method "app.bsky.notification.putActivitySubscription". +// +// Puts an activity subscription entry. The key should be omitted for creation and provided for updates. Requires auth. +func NotificationPutActivitySubscription(ctx context.Context, c glexrt.LexClient, input *NotificationPutActivitySubscription_Input) (*NotificationPutActivitySubscription_Output, error) { + var out NotificationPutActivitySubscription_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.notification.putActivitySubscription", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/notificationputpreferences.go b/pkg/appbsky/notificationputpreferences.go new file mode 100644 index 00000000..818c209c --- /dev/null +++ b/pkg/appbsky/notificationputpreferences.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.putPreferences + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationPutPreferences_Input struct { + LexiconTypeID string `json:"$type"` + Priority bool `json:"priority"` +} + +func (t *NotificationPutPreferences_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.putPreferences#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationPutPreferences_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationPutPreferences calls the XRPC method "app.bsky.notification.putPreferences". +// +// Set notification-related preferences for an account. Requires auth. +func NotificationPutPreferences(ctx context.Context, c glexrt.LexClient, input *NotificationPutPreferences_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.notification.putPreferences", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/notificationputpreferencesv2.go b/pkg/appbsky/notificationputpreferencesv2.go new file mode 100644 index 00000000..ef2002bd --- /dev/null +++ b/pkg/appbsky/notificationputpreferencesv2.go @@ -0,0 +1,73 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.putPreferencesV2 + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationPutPreferencesV2_Input struct { + LexiconTypeID string `json:"$type"` + Chat *NotificationDefs_ChatPreference `json:"chat,omitempty"` + Follow *NotificationDefs_FilterablePreference `json:"follow,omitempty"` + Like *NotificationDefs_FilterablePreference `json:"like,omitempty"` + LikeViaRepost *NotificationDefs_FilterablePreference `json:"likeViaRepost,omitempty"` + Mention *NotificationDefs_FilterablePreference `json:"mention,omitempty"` + Quote *NotificationDefs_FilterablePreference `json:"quote,omitempty"` + Reply *NotificationDefs_FilterablePreference `json:"reply,omitempty"` + Repost *NotificationDefs_FilterablePreference `json:"repost,omitempty"` + RepostViaRepost *NotificationDefs_FilterablePreference `json:"repostViaRepost,omitempty"` + StarterpackJoined *NotificationDefs_Preference `json:"starterpackJoined,omitempty"` + SubscribedPost *NotificationDefs_Preference `json:"subscribedPost,omitempty"` + Unverified *NotificationDefs_Preference `json:"unverified,omitempty"` + Verified *NotificationDefs_Preference `json:"verified,omitempty"` +} + +func (t *NotificationPutPreferencesV2_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.putPreferencesV2#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationPutPreferencesV2_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type NotificationPutPreferencesV2_Output struct { + LexiconTypeID string `json:"$type"` + Preferences NotificationDefs_Preferences `json:"preferences"` +} + +func (t *NotificationPutPreferencesV2_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.putPreferencesV2#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationPutPreferencesV2_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationPutPreferencesV2 calls the XRPC method "app.bsky.notification.putPreferencesV2". +// +// Set notification-related preferences for an account. Requires auth. +func NotificationPutPreferencesV2(ctx context.Context, c glexrt.LexClient, input *NotificationPutPreferencesV2_Input) (*NotificationPutPreferencesV2_Output, error) { + var out NotificationPutPreferencesV2_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.notification.putPreferencesV2", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/notificationregisterpush.go b/pkg/appbsky/notificationregisterpush.go new file mode 100644 index 00000000..3dcb57e8 --- /dev/null +++ b/pkg/appbsky/notificationregisterpush.go @@ -0,0 +1,47 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.registerPush + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationRegisterPush_Input struct { + LexiconTypeID string `json:"$type"` + // ageRestricted: Set to true when the actor is age restricted + AgeRestricted *bool `json:"ageRestricted,omitempty"` + AppId string `json:"appId"` + Platform string `json:"platform"` + ServiceDid string `json:"serviceDid"` + Token string `json:"token"` +} + +func (t *NotificationRegisterPush_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.registerPush#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationRegisterPush_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationRegisterPush calls the XRPC method "app.bsky.notification.registerPush". +// +// Register to receive push notifications, via a specified service, for the requesting account. Requires auth. +func NotificationRegisterPush(ctx context.Context, c glexrt.LexClient, input *NotificationRegisterPush_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.notification.registerPush", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/notificationunregisterpush.go b/pkg/appbsky/notificationunregisterpush.go new file mode 100644 index 00000000..339cda82 --- /dev/null +++ b/pkg/appbsky/notificationunregisterpush.go @@ -0,0 +1,45 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.unregisterPush + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationUnregisterPush_Input struct { + LexiconTypeID string `json:"$type"` + AppId string `json:"appId"` + Platform string `json:"platform"` + ServiceDid string `json:"serviceDid"` + Token string `json:"token"` +} + +func (t *NotificationUnregisterPush_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.unregisterPush#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationUnregisterPush_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationUnregisterPush calls the XRPC method "app.bsky.notification.unregisterPush". +// +// The inverse of registerPush - inform a specified service that push notifications should no longer be sent to the given token for the requesting account. Requires auth. +func NotificationUnregisterPush(ctx context.Context, c glexrt.LexClient, input *NotificationUnregisterPush_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.notification.unregisterPush", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/notificationupdateseen.go b/pkg/appbsky/notificationupdateseen.go new file mode 100644 index 00000000..f05eb84f --- /dev/null +++ b/pkg/appbsky/notificationupdateseen.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.notification.updateSeen + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type NotificationUpdateSeen_Input struct { + LexiconTypeID string `json:"$type"` + SeenAt string `json:"seenAt"` +} + +func (t *NotificationUpdateSeen_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.notification.updateSeen#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *NotificationUpdateSeen_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// NotificationUpdateSeen calls the XRPC method "app.bsky.notification.updateSeen". +// +// Notify server that the requesting account has seen notifications. Requires auth. +func NotificationUpdateSeen(ctx context.Context, c glexrt.LexClient, input *NotificationUpdateSeen_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.notification.updateSeen", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/appbsky/richtextfacet.go b/pkg/appbsky/richtextfacet.go new file mode 100644 index 00000000..0ed55337 --- /dev/null +++ b/pkg/appbsky/richtextfacet.go @@ -0,0 +1,206 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.richtext.facet + +package appbsky + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("app.bsky.richtext.facet#main", &RichtextFacet{}) +} + +// Annotation of a sub-string within rich text. +type RichtextFacet struct { + LexiconTypeID string `json:"$type"` + Features []RichtextFacet_Features_Elem `json:"features"` + Index RichtextFacet_ByteSlice `json:"index"` +} + +func (t *RichtextFacet) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.richtext.facet" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RichtextFacet) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type RichtextFacet_Features_Elem struct { + RichtextFacet_Link *RichtextFacet_Link + RichtextFacet_Mention *RichtextFacet_Mention + RichtextFacet_Tag *RichtextFacet_Tag +} + +func (t *RichtextFacet_Features_Elem) MarshalJSON() ([]byte, error) { + if t.RichtextFacet_Link != nil { + t.RichtextFacet_Link.LexiconTypeID = "app.bsky.richtext.facet#link" + return json.Marshal(t.RichtextFacet_Link) + } + if t.RichtextFacet_Mention != nil { + t.RichtextFacet_Mention.LexiconTypeID = "app.bsky.richtext.facet#mention" + return json.Marshal(t.RichtextFacet_Mention) + } + if t.RichtextFacet_Tag != nil { + t.RichtextFacet_Tag.LexiconTypeID = "app.bsky.richtext.facet#tag" + return json.Marshal(t.RichtextFacet_Tag) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *RichtextFacet_Features_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.richtext.facet#link": + t.RichtextFacet_Link = new(RichtextFacet_Link) + return json.Unmarshal(b, t.RichtextFacet_Link) + case "app.bsky.richtext.facet#mention": + t.RichtextFacet_Mention = new(RichtextFacet_Mention) + return json.Unmarshal(b, t.RichtextFacet_Mention) + case "app.bsky.richtext.facet#tag": + t.RichtextFacet_Tag = new(RichtextFacet_Tag) + return json.Unmarshal(b, t.RichtextFacet_Tag) + default: + return nil + } +} + +func (t *RichtextFacet_Features_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.RichtextFacet_Link != nil { + return t.RichtextFacet_Link.MarshalCBOR(w) + } + if t.RichtextFacet_Mention != nil { + return t.RichtextFacet_Mention.MarshalCBOR(w) + } + if t.RichtextFacet_Tag != nil { + return t.RichtextFacet_Tag.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *RichtextFacet_Features_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.richtext.facet#link": + t.RichtextFacet_Link = new(RichtextFacet_Link) + return t.RichtextFacet_Link.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.richtext.facet#mention": + t.RichtextFacet_Mention = new(RichtextFacet_Mention) + return t.RichtextFacet_Mention.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.richtext.facet#tag": + t.RichtextFacet_Tag = new(RichtextFacet_Tag) + return t.RichtextFacet_Tag.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// RichtextFacet_ByteSlice is a "byteSlice" in the app.bsky.richtext.facet schema. +// +// Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. +type RichtextFacet_ByteSlice struct { + LexiconTypeID string `json:"$type"` + ByteEnd int64 `json:"byteEnd"` + ByteStart int64 `json:"byteStart"` +} + +func (t *RichtextFacet_ByteSlice) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.richtext.facet" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RichtextFacet_ByteSlice) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RichtextFacet_Link is a "link" in the app.bsky.richtext.facet schema. +// +// Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. +type RichtextFacet_Link struct { + LexiconTypeID string `json:"$type"` + Uri string `json:"uri"` +} + +func (t *RichtextFacet_Link) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.richtext.facet" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RichtextFacet_Link) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RichtextFacet_Mention is a "mention" in the app.bsky.richtext.facet schema. +// +// Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID. +type RichtextFacet_Mention struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` +} + +func (t *RichtextFacet_Mention) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.richtext.facet" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RichtextFacet_Mention) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RichtextFacet_Tag is a "tag" in the app.bsky.richtext.facet schema. +// +// Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). +type RichtextFacet_Tag struct { + LexiconTypeID string `json:"$type"` + Tag string `json:"tag"` +} + +func (t *RichtextFacet_Tag) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.richtext.facet" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RichtextFacet_Tag) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/unspecceddefs.go b/pkg/appbsky/unspecceddefs.go new file mode 100644 index 00000000..1f8c40bb --- /dev/null +++ b/pkg/appbsky/unspecceddefs.go @@ -0,0 +1,287 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.defs + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// UnspeccedDefs_AgeAssuranceEvent is a "ageAssuranceEvent" in the app.bsky.unspecced.defs schema. +// +// Object used to store age assurance data in stash. +type UnspeccedDefs_AgeAssuranceEvent struct { + LexiconTypeID string `json:"$type"` + // attemptId: The unique identifier for this instance of the age assurance flow, in UUID format. + AttemptId string `json:"attemptId"` + // completeIp: The IP address used when completing the AA flow. + CompleteIp *string `json:"completeIp,omitempty"` + // completeUa: The user agent used when completing the AA flow. + CompleteUa *string `json:"completeUa,omitempty"` + // createdAt: The date and time of this write operation. + CreatedAt string `json:"createdAt"` + // email: The email used for AA. + Email *string `json:"email,omitempty"` + // initIp: The IP address used when initiating the AA flow. + InitIp *string `json:"initIp,omitempty"` + // initUa: The user agent used when initiating the AA flow. + InitUa *string `json:"initUa,omitempty"` + // status: The status of the age assurance process. + Status string `json:"status"` +} + +func (t *UnspeccedDefs_AgeAssuranceEvent) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_AgeAssuranceEvent) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_AgeAssuranceState is a "ageAssuranceState" in the app.bsky.unspecced.defs schema. +// +// The computed state of the age assurance process, returned to the user in question on certain authenticated requests. +type UnspeccedDefs_AgeAssuranceState struct { + LexiconTypeID string `json:"$type"` + // lastInitiatedAt: The timestamp when this state was last updated. + LastInitiatedAt *string `json:"lastInitiatedAt,omitempty"` + // status: The status of the age assurance process. + Status string `json:"status"` +} + +func (t *UnspeccedDefs_AgeAssuranceState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_AgeAssuranceState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_SkeletonSearchActor is a "skeletonSearchActor" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_SkeletonSearchActor struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` +} + +func (t *UnspeccedDefs_SkeletonSearchActor) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_SkeletonSearchActor) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_SkeletonSearchPost is a "skeletonSearchPost" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_SkeletonSearchPost struct { + LexiconTypeID string `json:"$type"` + Uri string `json:"uri"` +} + +func (t *UnspeccedDefs_SkeletonSearchPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_SkeletonSearchPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_SkeletonSearchStarterPack is a "skeletonSearchStarterPack" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_SkeletonSearchStarterPack struct { + LexiconTypeID string `json:"$type"` + Uri string `json:"uri"` +} + +func (t *UnspeccedDefs_SkeletonSearchStarterPack) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_SkeletonSearchStarterPack) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_SkeletonTrend is a "skeletonTrend" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_SkeletonTrend struct { + LexiconTypeID string `json:"$type"` + Category *string `json:"category,omitempty"` + Dids []string `json:"dids"` + DisplayName string `json:"displayName"` + Link string `json:"link"` + PostCount int64 `json:"postCount"` + StartedAt string `json:"startedAt"` + Status *string `json:"status,omitempty"` + Topic string `json:"topic"` +} + +func (t *UnspeccedDefs_SkeletonTrend) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_SkeletonTrend) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_ThreadItemBlocked is a "threadItemBlocked" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_ThreadItemBlocked struct { + LexiconTypeID string `json:"$type"` + Author FeedDefs_BlockedAuthor `json:"author"` +} + +func (t *UnspeccedDefs_ThreadItemBlocked) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_ThreadItemBlocked) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_ThreadItemNoUnauthenticated is a "threadItemNoUnauthenticated" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_ThreadItemNoUnauthenticated struct { + LexiconTypeID string `json:"$type"` +} + +func (t *UnspeccedDefs_ThreadItemNoUnauthenticated) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_ThreadItemNoUnauthenticated) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_ThreadItemNotFound is a "threadItemNotFound" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_ThreadItemNotFound struct { + LexiconTypeID string `json:"$type"` +} + +func (t *UnspeccedDefs_ThreadItemNotFound) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_ThreadItemNotFound) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_ThreadItemPost is a "threadItemPost" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_ThreadItemPost struct { + LexiconTypeID string `json:"$type"` + // hiddenByThreadgate: The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread. + HiddenByThreadgate bool `json:"hiddenByThreadgate"` + // moreParents: This post has more parents that were not present in the response. This is just a boolean, without the number of parents. + MoreParents bool `json:"moreParents"` + // moreReplies: This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate. + MoreReplies int64 `json:"moreReplies"` + // mutedByViewer: This is by an account muted by the viewer requesting it. + MutedByViewer bool `json:"mutedByViewer"` + // opThread: This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread. + OpThread bool `json:"opThread"` + Post FeedDefs_PostView `json:"post"` +} + +func (t *UnspeccedDefs_ThreadItemPost) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_ThreadItemPost) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_TrendView is a "trendView" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_TrendView struct { + LexiconTypeID string `json:"$type"` + Actors []ActorDefs_ProfileViewBasic `json:"actors"` + Category *string `json:"category,omitempty"` + DisplayName string `json:"displayName"` + Link string `json:"link"` + PostCount int64 `json:"postCount"` + StartedAt string `json:"startedAt"` + Status *string `json:"status,omitempty"` + Topic string `json:"topic"` +} + +func (t *UnspeccedDefs_TrendView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_TrendView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedDefs_TrendingTopic is a "trendingTopic" in the app.bsky.unspecced.defs schema. +type UnspeccedDefs_TrendingTopic struct { + LexiconTypeID string `json:"$type"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Link string `json:"link"` + Topic string `json:"topic"` +} + +func (t *UnspeccedDefs_TrendingTopic) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedDefs_TrendingTopic) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/unspeccedgetageassurancestate.go b/pkg/appbsky/unspeccedgetageassurancestate.go new file mode 100644 index 00000000..5d12f989 --- /dev/null +++ b/pkg/appbsky/unspeccedgetageassurancestate.go @@ -0,0 +1,23 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getAgeAssuranceState + +package appbsky + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// UnspeccedGetAgeAssuranceState calls the XRPC method "app.bsky.unspecced.getAgeAssuranceState". +// +// Returns the current state of the age assurance process for an account. This is used to check if the user has completed age assurance or if further action is required. +func UnspeccedGetAgeAssuranceState(ctx context.Context, c glexrt.LexClient) (*UnspeccedDefs_AgeAssuranceState, error) { + var out UnspeccedDefs_AgeAssuranceState + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getAgeAssuranceState", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetconfig.go b/pkg/appbsky/unspeccedgetconfig.go new file mode 100644 index 00000000..93f9e6a9 --- /dev/null +++ b/pkg/appbsky/unspeccedgetconfig.go @@ -0,0 +1,64 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getConfig + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetConfig_Output struct { + LexiconTypeID string `json:"$type"` + CheckEmailConfirmed *bool `json:"checkEmailConfirmed,omitempty"` + LiveNow []UnspeccedGetConfig_LiveNowConfig `json:"liveNow,omitempty"` +} + +func (t *UnspeccedGetConfig_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getConfig#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetConfig_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetConfig calls the XRPC method "app.bsky.unspecced.getConfig". +// +// Get miscellaneous runtime configuration. +func UnspeccedGetConfig(ctx context.Context, c glexrt.LexClient) (*UnspeccedGetConfig_Output, error) { + var out UnspeccedGetConfig_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getConfig", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// UnspeccedGetConfig_LiveNowConfig is a "liveNowConfig" in the app.bsky.unspecced.getConfig schema. +type UnspeccedGetConfig_LiveNowConfig struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + Domains []string `json:"domains"` +} + +func (t *UnspeccedGetConfig_LiveNowConfig) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getConfig" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetConfig_LiveNowConfig) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/unspeccedgetonboardingsuggestedstarterpacks.go b/pkg/appbsky/unspeccedgetonboardingsuggestedstarterpacks.go new file mode 100644 index 00000000..a5a004b7 --- /dev/null +++ b/pkg/appbsky/unspeccedgetonboardingsuggestedstarterpacks.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getOnboardingSuggestedStarterPacks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetOnboardingSuggestedStarterPacks_Output struct { + LexiconTypeID string `json:"$type"` + StarterPacks []GraphDefs_StarterPackView `json:"starterPacks"` +} + +func (t *UnspeccedGetOnboardingSuggestedStarterPacks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getOnboardingSuggestedStarterPacks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetOnboardingSuggestedStarterPacks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetOnboardingSuggestedStarterPacks calls the XRPC method "app.bsky.unspecced.getOnboardingSuggestedStarterPacks". +// +// Get a list of suggested starterpacks for onboarding +func UnspeccedGetOnboardingSuggestedStarterPacks(ctx context.Context, c glexrt.LexClient, limit *int64) (*UnspeccedGetOnboardingSuggestedStarterPacks_Output, error) { + var out UnspeccedGetOnboardingSuggestedStarterPacks_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getOnboardingSuggestedStarterPacks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetonboardingsuggestedstarterpacksskeleton.go b/pkg/appbsky/unspeccedgetonboardingsuggestedstarterpacksskeleton.go new file mode 100644 index 00000000..8a41d61e --- /dev/null +++ b/pkg/appbsky/unspeccedgetonboardingsuggestedstarterpacksskeleton.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getOnboardingSuggestedStarterPacksSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetOnboardingSuggestedStarterPacksSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + StarterPacks []string `json:"starterPacks"` +} + +func (t *UnspeccedGetOnboardingSuggestedStarterPacksSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getOnboardingSuggestedStarterPacksSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetOnboardingSuggestedStarterPacksSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetOnboardingSuggestedStarterPacksSkeleton calls the XRPC method "app.bsky.unspecced.getOnboardingSuggestedStarterPacksSkeleton". +// +// Get a skeleton of suggested starterpacks for onboarding. Intended to be called and hydrated by app.bsky.unspecced.getOnboardingSuggestedStarterPacks +// +// viewer: DID of the account making the request (not included for public/unauthenticated queries). +func UnspeccedGetOnboardingSuggestedStarterPacksSkeleton(ctx context.Context, c glexrt.LexClient, limit *int64, viewer string) (*UnspeccedGetOnboardingSuggestedStarterPacksSkeleton_Output, error) { + var out UnspeccedGetOnboardingSuggestedStarterPacksSkeleton_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + if viewer != "" { + params["viewer"] = viewer + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getOnboardingSuggestedStarterPacksSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetpopularfeedgenerators.go b/pkg/appbsky/unspeccedgetpopularfeedgenerators.go new file mode 100644 index 00000000..a9184b38 --- /dev/null +++ b/pkg/appbsky/unspeccedgetpopularfeedgenerators.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getPopularFeedGenerators + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetPopularFeedGenerators_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Feeds []FeedDefs_GeneratorView `json:"feeds"` +} + +func (t *UnspeccedGetPopularFeedGenerators_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getPopularFeedGenerators#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetPopularFeedGenerators_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetPopularFeedGenerators calls the XRPC method "app.bsky.unspecced.getPopularFeedGenerators". +// +// An unspecced view of globally popular feed generators. +func UnspeccedGetPopularFeedGenerators(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, query string) (*UnspeccedGetPopularFeedGenerators_Output, error) { + var out UnspeccedGetPopularFeedGenerators_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if query != "" { + params["query"] = query + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getPopularFeedGenerators", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetpostthreadotherv2.go b/pkg/appbsky/unspeccedgetpostthreadotherv2.go new file mode 100644 index 00000000..3ea41265 --- /dev/null +++ b/pkg/appbsky/unspeccedgetpostthreadotherv2.go @@ -0,0 +1,128 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getPostThreadOtherV2 + +package appbsky + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetPostThreadOtherV2_Output struct { + LexiconTypeID string `json:"$type"` + // thread: A flat list of other thread items. The depth of each item is indicated by the depth property inside the item. + Thread []UnspeccedGetPostThreadOtherV2_ThreadItem `json:"thread"` +} + +func (t *UnspeccedGetPostThreadOtherV2_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getPostThreadOtherV2#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetPostThreadOtherV2_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetPostThreadOtherV2 calls the XRPC method "app.bsky.unspecced.getPostThreadOtherV2". +// +// (NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get additional posts under a thread e.g. replies hidden by threadgate. Based on an anchor post at any depth of the tree, returns top-level replies below that anchor. It does not include ancestors nor the anchor itself. This should be called after exhausting `app.bsky.unspecced.getPostThreadV2`. Does not require auth, but additional metadata and filtering will be applied for authed requests. +// +// anchor: Reference (AT-URI) to post record. This is the anchor post. +func UnspeccedGetPostThreadOtherV2(ctx context.Context, c glexrt.LexClient, anchor string) (*UnspeccedGetPostThreadOtherV2_Output, error) { + var out UnspeccedGetPostThreadOtherV2_Output + + params := map[string]interface{}{} + params["anchor"] = anchor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getPostThreadOtherV2", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// UnspeccedGetPostThreadOtherV2_ThreadItem is a "threadItem" in the app.bsky.unspecced.getPostThreadOtherV2 schema. +type UnspeccedGetPostThreadOtherV2_ThreadItem struct { + LexiconTypeID string `json:"$type"` + // depth: The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths. + Depth int64 `json:"depth"` + Uri string `json:"uri"` + Value UnspeccedGetPostThreadOtherV2_ThreadItem_Value `json:"value"` +} + +func (t *UnspeccedGetPostThreadOtherV2_ThreadItem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getPostThreadOtherV2" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetPostThreadOtherV2_ThreadItem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type UnspeccedGetPostThreadOtherV2_ThreadItem_Value struct { + UnspeccedDefs_ThreadItemPost *UnspeccedDefs_ThreadItemPost +} + +func (t *UnspeccedGetPostThreadOtherV2_ThreadItem_Value) MarshalJSON() ([]byte, error) { + if t.UnspeccedDefs_ThreadItemPost != nil { + t.UnspeccedDefs_ThreadItemPost.LexiconTypeID = "app.bsky.unspecced.defs#threadItemPost" + return json.Marshal(t.UnspeccedDefs_ThreadItemPost) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *UnspeccedGetPostThreadOtherV2_ThreadItem_Value) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.unspecced.defs#threadItemPost": + t.UnspeccedDefs_ThreadItemPost = new(UnspeccedDefs_ThreadItemPost) + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemPost) + default: + return nil + } +} + +func (t *UnspeccedGetPostThreadOtherV2_ThreadItem_Value) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.UnspeccedDefs_ThreadItemPost != nil { + return t.UnspeccedDefs_ThreadItemPost.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *UnspeccedGetPostThreadOtherV2_ThreadItem_Value) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.unspecced.defs#threadItemPost": + t.UnspeccedDefs_ThreadItemPost = new(UnspeccedDefs_ThreadItemPost) + return t.UnspeccedDefs_ThreadItemPost.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/unspeccedgetpostthreadv2.go b/pkg/appbsky/unspeccedgetpostthreadv2.go new file mode 100644 index 00000000..5fe0aaff --- /dev/null +++ b/pkg/appbsky/unspeccedgetpostthreadv2.go @@ -0,0 +1,189 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getPostThreadV2 + +package appbsky + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetPostThreadV2_Output struct { + LexiconTypeID string `json:"$type"` + // hasOtherReplies: Whether this thread has additional replies. If true, a call can be made to the `getPostThreadOtherV2` endpoint to retrieve them. + HasOtherReplies bool `json:"hasOtherReplies"` + // thread: A flat list of thread items. The depth of each item is indicated by the depth property inside the item. + Thread []UnspeccedGetPostThreadV2_ThreadItem `json:"thread"` + Threadgate *FeedDefs_ThreadgateView `json:"threadgate,omitempty"` +} + +func (t *UnspeccedGetPostThreadV2_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getPostThreadV2#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetPostThreadV2_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetPostThreadV2 calls the XRPC method "app.bsky.unspecced.getPostThreadV2". +// +// (NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get posts in a thread. It is based in an anchor post at any depth of the tree, and returns posts above it (recursively resolving the parent, without further branching to their replies) and below it (recursive replies, with branching to their replies). Does not require auth, but additional metadata and filtering will be applied for authed requests. +// +// above: Whether to include parents above the anchor. +// anchor: Reference (AT-URI) to post record. This is the anchor post, and the thread will be built around it. It can be any post in the tree, not necessarily a root post. +// below: How many levels of replies to include below the anchor. +// branchingFactor: Maximum of replies to include at each level of the thread, except for the direct replies to the anchor, which are (NOTE: currently, during unspecced phase) all returned (NOTE: later they might be paginated). +// sort: Sorting for the thread replies. +func UnspeccedGetPostThreadV2(ctx context.Context, c glexrt.LexClient, above *bool, anchor string, below *int64, branchingFactor *int64, sort string) (*UnspeccedGetPostThreadV2_Output, error) { + var out UnspeccedGetPostThreadV2_Output + + params := map[string]interface{}{} + if above != nil { + params["above"] = *above + } + if below != nil { + params["below"] = *below + } + if branchingFactor != nil { + params["branchingFactor"] = *branchingFactor + } + if sort != "" { + params["sort"] = sort + } + params["anchor"] = anchor + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getPostThreadV2", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// UnspeccedGetPostThreadV2_ThreadItem is a "threadItem" in the app.bsky.unspecced.getPostThreadV2 schema. +type UnspeccedGetPostThreadV2_ThreadItem struct { + LexiconTypeID string `json:"$type"` + // depth: The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths. + Depth int64 `json:"depth"` + Uri string `json:"uri"` + Value UnspeccedGetPostThreadV2_ThreadItem_Value `json:"value"` +} + +func (t *UnspeccedGetPostThreadV2_ThreadItem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getPostThreadV2" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetPostThreadV2_ThreadItem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type UnspeccedGetPostThreadV2_ThreadItem_Value struct { + UnspeccedDefs_ThreadItemBlocked *UnspeccedDefs_ThreadItemBlocked + UnspeccedDefs_ThreadItemNoUnauthenticated *UnspeccedDefs_ThreadItemNoUnauthenticated + UnspeccedDefs_ThreadItemNotFound *UnspeccedDefs_ThreadItemNotFound + UnspeccedDefs_ThreadItemPost *UnspeccedDefs_ThreadItemPost +} + +func (t *UnspeccedGetPostThreadV2_ThreadItem_Value) MarshalJSON() ([]byte, error) { + if t.UnspeccedDefs_ThreadItemBlocked != nil { + t.UnspeccedDefs_ThreadItemBlocked.LexiconTypeID = "app.bsky.unspecced.defs#threadItemBlocked" + return json.Marshal(t.UnspeccedDefs_ThreadItemBlocked) + } + if t.UnspeccedDefs_ThreadItemNoUnauthenticated != nil { + t.UnspeccedDefs_ThreadItemNoUnauthenticated.LexiconTypeID = "app.bsky.unspecced.defs#threadItemNoUnauthenticated" + return json.Marshal(t.UnspeccedDefs_ThreadItemNoUnauthenticated) + } + if t.UnspeccedDefs_ThreadItemNotFound != nil { + t.UnspeccedDefs_ThreadItemNotFound.LexiconTypeID = "app.bsky.unspecced.defs#threadItemNotFound" + return json.Marshal(t.UnspeccedDefs_ThreadItemNotFound) + } + if t.UnspeccedDefs_ThreadItemPost != nil { + t.UnspeccedDefs_ThreadItemPost.LexiconTypeID = "app.bsky.unspecced.defs#threadItemPost" + return json.Marshal(t.UnspeccedDefs_ThreadItemPost) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *UnspeccedGetPostThreadV2_ThreadItem_Value) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.unspecced.defs#threadItemBlocked": + t.UnspeccedDefs_ThreadItemBlocked = new(UnspeccedDefs_ThreadItemBlocked) + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemBlocked) + case "app.bsky.unspecced.defs#threadItemNoUnauthenticated": + t.UnspeccedDefs_ThreadItemNoUnauthenticated = new(UnspeccedDefs_ThreadItemNoUnauthenticated) + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemNoUnauthenticated) + case "app.bsky.unspecced.defs#threadItemNotFound": + t.UnspeccedDefs_ThreadItemNotFound = new(UnspeccedDefs_ThreadItemNotFound) + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemNotFound) + case "app.bsky.unspecced.defs#threadItemPost": + t.UnspeccedDefs_ThreadItemPost = new(UnspeccedDefs_ThreadItemPost) + return json.Unmarshal(b, t.UnspeccedDefs_ThreadItemPost) + default: + return nil + } +} + +func (t *UnspeccedGetPostThreadV2_ThreadItem_Value) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.UnspeccedDefs_ThreadItemBlocked != nil { + return t.UnspeccedDefs_ThreadItemBlocked.MarshalCBOR(w) + } + if t.UnspeccedDefs_ThreadItemNoUnauthenticated != nil { + return t.UnspeccedDefs_ThreadItemNoUnauthenticated.MarshalCBOR(w) + } + if t.UnspeccedDefs_ThreadItemNotFound != nil { + return t.UnspeccedDefs_ThreadItemNotFound.MarshalCBOR(w) + } + if t.UnspeccedDefs_ThreadItemPost != nil { + return t.UnspeccedDefs_ThreadItemPost.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *UnspeccedGetPostThreadV2_ThreadItem_Value) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "app.bsky.unspecced.defs#threadItemBlocked": + t.UnspeccedDefs_ThreadItemBlocked = new(UnspeccedDefs_ThreadItemBlocked) + return t.UnspeccedDefs_ThreadItemBlocked.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.unspecced.defs#threadItemNoUnauthenticated": + t.UnspeccedDefs_ThreadItemNoUnauthenticated = new(UnspeccedDefs_ThreadItemNoUnauthenticated) + return t.UnspeccedDefs_ThreadItemNoUnauthenticated.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.unspecced.defs#threadItemNotFound": + t.UnspeccedDefs_ThreadItemNotFound = new(UnspeccedDefs_ThreadItemNotFound) + return t.UnspeccedDefs_ThreadItemNotFound.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.unspecced.defs#threadItemPost": + t.UnspeccedDefs_ThreadItemPost = new(UnspeccedDefs_ThreadItemPost) + return t.UnspeccedDefs_ThreadItemPost.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/pkg/appbsky/unspeccedgetsuggestedfeeds.go b/pkg/appbsky/unspeccedgetsuggestedfeeds.go new file mode 100644 index 00000000..e8700049 --- /dev/null +++ b/pkg/appbsky/unspeccedgetsuggestedfeeds.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getSuggestedFeeds + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetSuggestedFeeds_Output struct { + LexiconTypeID string `json:"$type"` + Feeds []FeedDefs_GeneratorView `json:"feeds"` +} + +func (t *UnspeccedGetSuggestedFeeds_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getSuggestedFeeds#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetSuggestedFeeds_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetSuggestedFeeds calls the XRPC method "app.bsky.unspecced.getSuggestedFeeds". +// +// Get a list of suggested feeds +func UnspeccedGetSuggestedFeeds(ctx context.Context, c glexrt.LexClient, limit *int64) (*UnspeccedGetSuggestedFeeds_Output, error) { + var out UnspeccedGetSuggestedFeeds_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getSuggestedFeeds", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetsuggestedfeedsskeleton.go b/pkg/appbsky/unspeccedgetsuggestedfeedsskeleton.go new file mode 100644 index 00000000..a017804d --- /dev/null +++ b/pkg/appbsky/unspeccedgetsuggestedfeedsskeleton.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getSuggestedFeedsSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetSuggestedFeedsSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Feeds []string `json:"feeds"` +} + +func (t *UnspeccedGetSuggestedFeedsSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getSuggestedFeedsSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetSuggestedFeedsSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetSuggestedFeedsSkeleton calls the XRPC method "app.bsky.unspecced.getSuggestedFeedsSkeleton". +// +// Get a skeleton of suggested feeds. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedFeeds +// +// viewer: DID of the account making the request (not included for public/unauthenticated queries). +func UnspeccedGetSuggestedFeedsSkeleton(ctx context.Context, c glexrt.LexClient, limit *int64, viewer string) (*UnspeccedGetSuggestedFeedsSkeleton_Output, error) { + var out UnspeccedGetSuggestedFeedsSkeleton_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + if viewer != "" { + params["viewer"] = viewer + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getSuggestedFeedsSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetsuggestedstarterpacks.go b/pkg/appbsky/unspeccedgetsuggestedstarterpacks.go new file mode 100644 index 00000000..4911d346 --- /dev/null +++ b/pkg/appbsky/unspeccedgetsuggestedstarterpacks.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getSuggestedStarterPacks + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetSuggestedStarterPacks_Output struct { + LexiconTypeID string `json:"$type"` + StarterPacks []GraphDefs_StarterPackView `json:"starterPacks"` +} + +func (t *UnspeccedGetSuggestedStarterPacks_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getSuggestedStarterPacks#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetSuggestedStarterPacks_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetSuggestedStarterPacks calls the XRPC method "app.bsky.unspecced.getSuggestedStarterPacks". +// +// Get a list of suggested starterpacks +func UnspeccedGetSuggestedStarterPacks(ctx context.Context, c glexrt.LexClient, limit *int64) (*UnspeccedGetSuggestedStarterPacks_Output, error) { + var out UnspeccedGetSuggestedStarterPacks_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getSuggestedStarterPacks", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetsuggestedstarterpacksskeleton.go b/pkg/appbsky/unspeccedgetsuggestedstarterpacksskeleton.go new file mode 100644 index 00000000..5bc6016f --- /dev/null +++ b/pkg/appbsky/unspeccedgetsuggestedstarterpacksskeleton.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getSuggestedStarterPacksSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetSuggestedStarterPacksSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + StarterPacks []string `json:"starterPacks"` +} + +func (t *UnspeccedGetSuggestedStarterPacksSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getSuggestedStarterPacksSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetSuggestedStarterPacksSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetSuggestedStarterPacksSkeleton calls the XRPC method "app.bsky.unspecced.getSuggestedStarterPacksSkeleton". +// +// Get a skeleton of suggested starterpacks. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedStarterpacks +// +// viewer: DID of the account making the request (not included for public/unauthenticated queries). +func UnspeccedGetSuggestedStarterPacksSkeleton(ctx context.Context, c glexrt.LexClient, limit *int64, viewer string) (*UnspeccedGetSuggestedStarterPacksSkeleton_Output, error) { + var out UnspeccedGetSuggestedStarterPacksSkeleton_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + if viewer != "" { + params["viewer"] = viewer + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getSuggestedStarterPacksSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetsuggestedusers.go b/pkg/appbsky/unspeccedgetsuggestedusers.go new file mode 100644 index 00000000..119a766b --- /dev/null +++ b/pkg/appbsky/unspeccedgetsuggestedusers.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getSuggestedUsers + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetSuggestedUsers_Output struct { + LexiconTypeID string `json:"$type"` + Actors []ActorDefs_ProfileView `json:"actors"` +} + +func (t *UnspeccedGetSuggestedUsers_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getSuggestedUsers#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetSuggestedUsers_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetSuggestedUsers calls the XRPC method "app.bsky.unspecced.getSuggestedUsers". +// +// # Get a list of suggested users +// +// category: Category of users to get suggestions for. +func UnspeccedGetSuggestedUsers(ctx context.Context, c glexrt.LexClient, category string, limit *int64) (*UnspeccedGetSuggestedUsers_Output, error) { + var out UnspeccedGetSuggestedUsers_Output + + params := map[string]interface{}{} + if category != "" { + params["category"] = category + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getSuggestedUsers", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetsuggestedusersskeleton.go b/pkg/appbsky/unspeccedgetsuggestedusersskeleton.go new file mode 100644 index 00000000..b4708b52 --- /dev/null +++ b/pkg/appbsky/unspeccedgetsuggestedusersskeleton.go @@ -0,0 +1,57 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getSuggestedUsersSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetSuggestedUsersSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Dids []string `json:"dids"` +} + +func (t *UnspeccedGetSuggestedUsersSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getSuggestedUsersSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetSuggestedUsersSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetSuggestedUsersSkeleton calls the XRPC method "app.bsky.unspecced.getSuggestedUsersSkeleton". +// +// Get a skeleton of suggested users. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedUsers +// +// category: Category of users to get suggestions for. +// viewer: DID of the account making the request (not included for public/unauthenticated queries). +func UnspeccedGetSuggestedUsersSkeleton(ctx context.Context, c glexrt.LexClient, category string, limit *int64, viewer string) (*UnspeccedGetSuggestedUsersSkeleton_Output, error) { + var out UnspeccedGetSuggestedUsersSkeleton_Output + + params := map[string]interface{}{} + if category != "" { + params["category"] = category + } + if limit != nil { + params["limit"] = *limit + } + if viewer != "" { + params["viewer"] = viewer + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getSuggestedUsersSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgetsuggestionsskeleton.go b/pkg/appbsky/unspeccedgetsuggestionsskeleton.go new file mode 100644 index 00000000..6232c263 --- /dev/null +++ b/pkg/appbsky/unspeccedgetsuggestionsskeleton.go @@ -0,0 +1,65 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getSuggestionsSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetSuggestionsSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Actors []UnspeccedDefs_SkeletonSearchActor `json:"actors"` + Cursor *string `json:"cursor,omitempty"` + // recId: Snowflake for this recommendation, use when submitting recommendation events. + RecId *int64 `json:"recId,omitempty"` + // relativeToDid: DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. + RelativeToDid *string `json:"relativeToDid,omitempty"` +} + +func (t *UnspeccedGetSuggestionsSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getSuggestionsSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetSuggestionsSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetSuggestionsSkeleton calls the XRPC method "app.bsky.unspecced.getSuggestionsSkeleton". +// +// Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions +// +// relativeToDid: DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. +// viewer: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. +func UnspeccedGetSuggestionsSkeleton(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, relativeToDid string, viewer string) (*UnspeccedGetSuggestionsSkeleton_Output, error) { + var out UnspeccedGetSuggestionsSkeleton_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if relativeToDid != "" { + params["relativeToDid"] = relativeToDid + } + if viewer != "" { + params["viewer"] = viewer + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getSuggestionsSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgettaggedsuggestions.go b/pkg/appbsky/unspeccedgettaggedsuggestions.go new file mode 100644 index 00000000..48139408 --- /dev/null +++ b/pkg/appbsky/unspeccedgettaggedsuggestions.go @@ -0,0 +1,64 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getTaggedSuggestions + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetTaggedSuggestions_Output struct { + LexiconTypeID string `json:"$type"` + Suggestions []UnspeccedGetTaggedSuggestions_Suggestion `json:"suggestions"` +} + +func (t *UnspeccedGetTaggedSuggestions_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getTaggedSuggestions#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetTaggedSuggestions_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetTaggedSuggestions calls the XRPC method "app.bsky.unspecced.getTaggedSuggestions". +// +// Get a list of suggestions (feeds and users) tagged with categories +func UnspeccedGetTaggedSuggestions(ctx context.Context, c glexrt.LexClient) (*UnspeccedGetTaggedSuggestions_Output, error) { + var out UnspeccedGetTaggedSuggestions_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getTaggedSuggestions", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// UnspeccedGetTaggedSuggestions_Suggestion is a "suggestion" in the app.bsky.unspecced.getTaggedSuggestions schema. +type UnspeccedGetTaggedSuggestions_Suggestion struct { + LexiconTypeID string `json:"$type"` + Subject string `json:"subject"` + SubjectType string `json:"subjectType"` + Tag string `json:"tag"` +} + +func (t *UnspeccedGetTaggedSuggestions_Suggestion) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getTaggedSuggestions" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetTaggedSuggestions_Suggestion) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/unspeccedgettrendingtopics.go b/pkg/appbsky/unspeccedgettrendingtopics.go new file mode 100644 index 00000000..9f515d15 --- /dev/null +++ b/pkg/appbsky/unspeccedgettrendingtopics.go @@ -0,0 +1,54 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getTrendingTopics + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetTrendingTopics_Output struct { + LexiconTypeID string `json:"$type"` + Suggested []UnspeccedDefs_TrendingTopic `json:"suggested"` + Topics []UnspeccedDefs_TrendingTopic `json:"topics"` +} + +func (t *UnspeccedGetTrendingTopics_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getTrendingTopics#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetTrendingTopics_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetTrendingTopics calls the XRPC method "app.bsky.unspecced.getTrendingTopics". +// +// # Get a list of trending topics +// +// viewer: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. +func UnspeccedGetTrendingTopics(ctx context.Context, c glexrt.LexClient, limit *int64, viewer string) (*UnspeccedGetTrendingTopics_Output, error) { + var out UnspeccedGetTrendingTopics_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + if viewer != "" { + params["viewer"] = viewer + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getTrendingTopics", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgettrends.go b/pkg/appbsky/unspeccedgettrends.go new file mode 100644 index 00000000..93052e0c --- /dev/null +++ b/pkg/appbsky/unspeccedgettrends.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getTrends + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetTrends_Output struct { + LexiconTypeID string `json:"$type"` + Trends []UnspeccedDefs_TrendView `json:"trends"` +} + +func (t *UnspeccedGetTrends_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getTrends#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetTrends_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetTrends calls the XRPC method "app.bsky.unspecced.getTrends". +// +// Get the current trends on the network +func UnspeccedGetTrends(ctx context.Context, c glexrt.LexClient, limit *int64) (*UnspeccedGetTrends_Output, error) { + var out UnspeccedGetTrends_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getTrends", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedgettrendsskeleton.go b/pkg/appbsky/unspeccedgettrendsskeleton.go new file mode 100644 index 00000000..e6ad23af --- /dev/null +++ b/pkg/appbsky/unspeccedgettrendsskeleton.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.getTrendsSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedGetTrendsSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Trends []UnspeccedDefs_SkeletonTrend `json:"trends"` +} + +func (t *UnspeccedGetTrendsSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.getTrendsSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedGetTrendsSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedGetTrendsSkeleton calls the XRPC method "app.bsky.unspecced.getTrendsSkeleton". +// +// Get the skeleton of trends on the network. Intended to be called and then hydrated through app.bsky.unspecced.getTrends +// +// viewer: DID of the account making the request (not included for public/unauthenticated queries). +func UnspeccedGetTrendsSkeleton(ctx context.Context, c glexrt.LexClient, limit *int64, viewer string) (*UnspeccedGetTrendsSkeleton_Output, error) { + var out UnspeccedGetTrendsSkeleton_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + if viewer != "" { + params["viewer"] = viewer + } + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.getTrendsSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedinitageassurance.go b/pkg/appbsky/unspeccedinitageassurance.go new file mode 100644 index 00000000..ac2cd4f7 --- /dev/null +++ b/pkg/appbsky/unspeccedinitageassurance.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.initAgeAssurance + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedInitAgeAssurance_Input struct { + LexiconTypeID string `json:"$type"` + // countryCode: An ISO 3166-1 alpha-2 code of the user's location. + CountryCode string `json:"countryCode"` + // email: The user's email address to receive assurance instructions. + Email string `json:"email"` + // language: The user's preferred language for communication during the assurance process. + Language string `json:"language"` +} + +func (t *UnspeccedInitAgeAssurance_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.initAgeAssurance#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedInitAgeAssurance_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedInitAgeAssurance calls the XRPC method "app.bsky.unspecced.initAgeAssurance". +// +// Initiate age assurance for an account. This is a one-time action that will start the process of verifying the user's age. +func UnspeccedInitAgeAssurance(ctx context.Context, c glexrt.LexClient, input *UnspeccedInitAgeAssurance_Input) (*UnspeccedDefs_AgeAssuranceState, error) { + var out UnspeccedDefs_AgeAssuranceState + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "app.bsky.unspecced.initAgeAssurance", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedsearchactorsskeleton.go b/pkg/appbsky/unspeccedsearchactorsskeleton.go new file mode 100644 index 00000000..d547790e --- /dev/null +++ b/pkg/appbsky/unspeccedsearchactorsskeleton.go @@ -0,0 +1,66 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.searchActorsSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedSearchActorsSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Actors []UnspeccedDefs_SkeletonSearchActor `json:"actors"` + Cursor *string `json:"cursor,omitempty"` + // hitsTotal: Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. + HitsTotal *int64 `json:"hitsTotal,omitempty"` +} + +func (t *UnspeccedSearchActorsSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.searchActorsSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedSearchActorsSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedSearchActorsSkeleton calls the XRPC method "app.bsky.unspecced.searchActorsSkeleton". +// +// Backend Actors (profile) search, returns only skeleton. +// +// cursor: Optional pagination mechanism; may not necessarily allow scrolling through entire result set. +// q: Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. +// typeahead: If true, acts as fast/simple 'typeahead' query. +// viewer: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. +func UnspeccedSearchActorsSkeleton(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, q string, typeahead *bool, viewer string) (*UnspeccedSearchActorsSkeleton_Output, error) { + var out UnspeccedSearchActorsSkeleton_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if typeahead != nil { + params["typeahead"] = *typeahead + } + if viewer != "" { + params["viewer"] = viewer + } + params["q"] = q + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.searchActorsSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedsearchpostsskeleton.go b/pkg/appbsky/unspeccedsearchpostsskeleton.go new file mode 100644 index 00000000..7faaafda --- /dev/null +++ b/pkg/appbsky/unspeccedsearchpostsskeleton.go @@ -0,0 +1,98 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.searchPostsSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedSearchPostsSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + // hitsTotal: Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. + HitsTotal *int64 `json:"hitsTotal,omitempty"` + Posts []UnspeccedDefs_SkeletonSearchPost `json:"posts"` +} + +func (t *UnspeccedSearchPostsSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.searchPostsSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedSearchPostsSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedSearchPostsSkeleton calls the XRPC method "app.bsky.unspecced.searchPostsSkeleton". +// +// # Backend Posts search, returns only skeleton +// +// author: Filter to posts by the given account. Handles are resolved to DID before query-time. +// cursor: Optional pagination mechanism; may not necessarily allow scrolling through entire result set. +// domain: Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization. +// lang: Filter to posts in the given language. Expected to be based on post language field, though server may override language detection. +// mentions: Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions. +// q: Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. +// since: Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD). +// sort: Specifies the ranking order of results. +// tag[]: Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching. +// until: Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD). +// url: Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching. +// viewer: DID of the account making the request (not included for public/unauthenticated queries). Used for 'from:me' queries. +func UnspeccedSearchPostsSkeleton(ctx context.Context, c glexrt.LexClient, author string, cursor string, domain string, lang string, limit *int64, mentions string, q string, since string, sort string, tag []string, until string, url string, viewer string) (*UnspeccedSearchPostsSkeleton_Output, error) { + var out UnspeccedSearchPostsSkeleton_Output + + params := map[string]interface{}{} + if author != "" { + params["author"] = author + } + if cursor != "" { + params["cursor"] = cursor + } + if domain != "" { + params["domain"] = domain + } + if lang != "" { + params["lang"] = lang + } + if limit != nil { + params["limit"] = *limit + } + if mentions != "" { + params["mentions"] = mentions + } + if since != "" { + params["since"] = since + } + if sort != "" { + params["sort"] = sort + } + if len(tag) != 0 { + params["tag"] = tag + } + if until != "" { + params["until"] = until + } + if url != "" { + params["url"] = url + } + if viewer != "" { + params["viewer"] = viewer + } + params["q"] = q + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.searchPostsSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/unspeccedsearchstarterpacksskeleton.go b/pkg/appbsky/unspeccedsearchstarterpacksskeleton.go new file mode 100644 index 00000000..fb83e829 --- /dev/null +++ b/pkg/appbsky/unspeccedsearchstarterpacksskeleton.go @@ -0,0 +1,62 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.unspecced.searchStarterPacksSkeleton + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type UnspeccedSearchStarterPacksSkeleton_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + // hitsTotal: Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. + HitsTotal *int64 `json:"hitsTotal,omitempty"` + StarterPacks []UnspeccedDefs_SkeletonSearchStarterPack `json:"starterPacks"` +} + +func (t *UnspeccedSearchStarterPacksSkeleton_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.unspecced.searchStarterPacksSkeleton#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *UnspeccedSearchStarterPacksSkeleton_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// UnspeccedSearchStarterPacksSkeleton calls the XRPC method "app.bsky.unspecced.searchStarterPacksSkeleton". +// +// Backend Starter Pack search, returns only skeleton. +// +// cursor: Optional pagination mechanism; may not necessarily allow scrolling through entire result set. +// q: Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. +// viewer: DID of the account making the request (not included for public/unauthenticated queries). +func UnspeccedSearchStarterPacksSkeleton(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, q string, viewer string) (*UnspeccedSearchStarterPacksSkeleton_Output, error) { + var out UnspeccedSearchStarterPacksSkeleton_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if viewer != "" { + params["viewer"] = viewer + } + params["q"] = q + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.unspecced.searchStarterPacksSkeleton", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/videodefs.go b/pkg/appbsky/videodefs.go new file mode 100644 index 00000000..86627c43 --- /dev/null +++ b/pkg/appbsky/videodefs.go @@ -0,0 +1,39 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.video.defs + +package appbsky + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// VideoDefs_JobStatus is a "jobStatus" in the app.bsky.video.defs schema. +type VideoDefs_JobStatus struct { + LexiconTypeID string `json:"$type"` + Blob *glexrt.Blob `json:"blob,omitempty"` + Did string `json:"did"` + Error *string `json:"error,omitempty"` + JobId string `json:"jobId"` + Message *string `json:"message,omitempty"` + // progress: Progress within the current processing state. + Progress *int64 `json:"progress,omitempty"` + // state: The state of the video processing job. All values not listed as a known value indicate that the job is in process. + State string `json:"state"` +} + +func (t *VideoDefs_JobStatus) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.video.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VideoDefs_JobStatus) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/appbsky/videogetjobstatus.go b/pkg/appbsky/videogetjobstatus.go new file mode 100644 index 00000000..c67cc15d --- /dev/null +++ b/pkg/appbsky/videogetjobstatus.go @@ -0,0 +1,46 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.video.getJobStatus + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type VideoGetJobStatus_Output struct { + LexiconTypeID string `json:"$type"` + JobStatus VideoDefs_JobStatus `json:"jobStatus"` +} + +func (t *VideoGetJobStatus_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.video.getJobStatus#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VideoGetJobStatus_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// VideoGetJobStatus calls the XRPC method "app.bsky.video.getJobStatus". +// +// Get status details for a video processing job. +func VideoGetJobStatus(ctx context.Context, c glexrt.LexClient, jobId string) (*VideoGetJobStatus_Output, error) { + var out VideoGetJobStatus_Output + + params := map[string]interface{}{} + params["jobId"] = jobId + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.video.getJobStatus", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/videogetuploadlimits.go b/pkg/appbsky/videogetuploadlimits.go new file mode 100644 index 00000000..460cd601 --- /dev/null +++ b/pkg/appbsky/videogetuploadlimits.go @@ -0,0 +1,47 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.video.getUploadLimits + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type VideoGetUploadLimits_Output struct { + LexiconTypeID string `json:"$type"` + CanUpload bool `json:"canUpload"` + Error *string `json:"error,omitempty"` + Message *string `json:"message,omitempty"` + RemainingDailyBytes *int64 `json:"remainingDailyBytes,omitempty"` + RemainingDailyVideos *int64 `json:"remainingDailyVideos,omitempty"` +} + +func (t *VideoGetUploadLimits_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.video.getUploadLimits#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VideoGetUploadLimits_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// VideoGetUploadLimits calls the XRPC method "app.bsky.video.getUploadLimits". +// +// Get video upload limits for the authenticated user. +func VideoGetUploadLimits(ctx context.Context, c glexrt.LexClient) (*VideoGetUploadLimits_Output, error) { + var out VideoGetUploadLimits_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "app.bsky.video.getUploadLimits", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/appbsky/videouploadvideo.go b/pkg/appbsky/videouploadvideo.go new file mode 100644 index 00000000..8e3d8e37 --- /dev/null +++ b/pkg/appbsky/videouploadvideo.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: app.bsky.video.uploadVideo + +package appbsky + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type VideoUploadVideo_Output struct { + LexiconTypeID string `json:"$type"` + JobStatus VideoDefs_JobStatus `json:"jobStatus"` +} + +func (t *VideoUploadVideo_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "app.bsky.video.uploadVideo#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VideoUploadVideo_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// VideoUploadVideo calls the XRPC method "app.bsky.video.uploadVideo". +// +// Upload a video to be processed then stored on the PDS. +func VideoUploadVideo(ctx context.Context, c glexrt.LexClient, input io.Reader) (*VideoUploadVideo_Output, error) { + var out VideoUploadVideo_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "video/mp4", "app.bsky.video.uploadVideo", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/atproto/badges.go b/pkg/atproto/badges.go index eafb57aa..7fc132d2 100644 --- a/pkg/atproto/badges.go +++ b/pkg/atproto/badges.go @@ -6,7 +6,7 @@ import ( "stream.place/streamplace/pkg/badges" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // AddModBadgeIfApplicable checks if a message author has mod permissions for the streamer diff --git a/pkg/atproto/badges_test.go b/pkg/atproto/badges_test.go index 0102f49e..e4d5604f 100644 --- a/pkg/atproto/badges_test.go +++ b/pkg/atproto/badges_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestAddModBadge(t *testing.T) { diff --git a/pkg/atproto/chat_message_test.go b/pkg/atproto/chat_message_test.go index 7042e784..3bf5b93d 100644 --- a/pkg/atproto/chat_message_test.go +++ b/pkg/atproto/chat_message_test.go @@ -18,7 +18,7 @@ import ( "stream.place/streamplace/pkg/devenv" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestChatMessage(t *testing.T) { diff --git a/pkg/atproto/firehose_multirelay_test.go b/pkg/atproto/firehose_multirelay_test.go index 5a28e995..e3097b82 100644 --- a/pkg/atproto/firehose_multirelay_test.go +++ b/pkg/atproto/firehose_multirelay_test.go @@ -17,7 +17,7 @@ import ( "stream.place/streamplace/pkg/devenv" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // TestMultiRelayDedup subscribes to the same dev PDS firehose twice (via two diff --git a/pkg/atproto/handle_test.go b/pkg/atproto/handle_test.go index 01ca7439..4839c6e5 100644 --- a/pkg/atproto/handle_test.go +++ b/pkg/atproto/handle_test.go @@ -17,7 +17,7 @@ import ( "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestHandleChange(t *testing.T) { diff --git a/pkg/atproto/moderation_test.go b/pkg/atproto/moderation_test.go index b039ccac..66b4fbf6 100644 --- a/pkg/atproto/moderation_test.go +++ b/pkg/atproto/moderation_test.go @@ -19,7 +19,7 @@ import ( "stream.place/streamplace/pkg/devenv" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestDelegatedModeration(t *testing.T) { diff --git a/pkg/atproto/server_repo_test.go b/pkg/atproto/server_repo_test.go index 25f7d24f..87146425 100644 --- a/pkg/atproto/server_repo_test.go +++ b/pkg/atproto/server_repo_test.go @@ -10,7 +10,7 @@ import ( "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestServerRepo(t *testing.T) { diff --git a/pkg/atproto/sync.go b/pkg/atproto/sync.go index 3afdb511..abb7743b 100644 --- a/pkg/atproto/sync.go +++ b/pkg/atproto/sync.go @@ -19,7 +19,7 @@ import ( "stream.place/streamplace/pkg/model" notificationpkg "stream.place/streamplace/pkg/notifications" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" lexutil "github.com/bluesky-social/indigo/lex/util" ) diff --git a/pkg/badges/badges.go b/pkg/badges/badges.go index f8d9e363..05cacfb6 100644 --- a/pkg/badges/badges.go +++ b/pkg/badges/badges.go @@ -7,7 +7,7 @@ import ( "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // GetValidBadges returns valid badges for a user in the context of a streamer's chat. diff --git a/pkg/badges/badges_test.go b/pkg/badges/badges_test.go index 5e9138b6..75ea12a6 100644 --- a/pkg/badges/badges_test.go +++ b/pkg/badges/badges_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestGetValidBadges(t *testing.T) { diff --git a/pkg/comatproto/admindefs.go b/pkg/comatproto/admindefs.go new file mode 100644 index 00000000..2c9383e0 --- /dev/null +++ b/pkg/comatproto/admindefs.go @@ -0,0 +1,122 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.defs + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// AdminDefs_AccountView is a "accountView" in the com.atproto.admin.defs schema. +type AdminDefs_AccountView struct { + LexiconTypeID string `json:"$type"` + DeactivatedAt *string `json:"deactivatedAt,omitempty"` + Did string `json:"did"` + Email *string `json:"email,omitempty"` + EmailConfirmedAt *string `json:"emailConfirmedAt,omitempty"` + Handle string `json:"handle"` + IndexedAt string `json:"indexedAt"` + InviteNote *string `json:"inviteNote,omitempty"` + InvitedBy *ServerDefs_InviteCode `json:"invitedBy,omitempty"` + Invites []ServerDefs_InviteCode `json:"invites,omitempty"` + InvitesDisabled *bool `json:"invitesDisabled,omitempty"` + RelatedRecords []*glexrt.LexiconTypeDecoder `json:"relatedRecords,omitempty"` + ThreatSignatures []AdminDefs_ThreatSignature `json:"threatSignatures,omitempty"` +} + +func (t *AdminDefs_AccountView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDefs_AccountView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminDefs_RepoBlobRef is a "repoBlobRef" in the com.atproto.admin.defs schema. +type AdminDefs_RepoBlobRef struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Did string `json:"did"` + RecordUri *string `json:"recordUri,omitempty"` +} + +func (t *AdminDefs_RepoBlobRef) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDefs_RepoBlobRef) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminDefs_RepoRef is a "repoRef" in the com.atproto.admin.defs schema. +type AdminDefs_RepoRef struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` +} + +func (t *AdminDefs_RepoRef) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDefs_RepoRef) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminDefs_StatusAttr is a "statusAttr" in the com.atproto.admin.defs schema. +type AdminDefs_StatusAttr struct { + LexiconTypeID string `json:"$type"` + Applied bool `json:"applied"` + Ref *string `json:"ref,omitempty"` +} + +func (t *AdminDefs_StatusAttr) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDefs_StatusAttr) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminDefs_ThreatSignature is a "threatSignature" in the com.atproto.admin.defs schema. +type AdminDefs_ThreatSignature struct { + LexiconTypeID string `json:"$type"` + Property string `json:"property"` + Value string `json:"value"` +} + +func (t *AdminDefs_ThreatSignature) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDefs_ThreatSignature) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/admindeleteaccount.go b/pkg/comatproto/admindeleteaccount.go new file mode 100644 index 00000000..8e90bfa3 --- /dev/null +++ b/pkg/comatproto/admindeleteaccount.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.deleteAccount + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminDeleteAccount_Input struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` +} + +func (t *AdminDeleteAccount_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.deleteAccount#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDeleteAccount_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminDeleteAccount calls the XRPC method "com.atproto.admin.deleteAccount". +// +// Delete a user account as an administrator. +func AdminDeleteAccount(ctx context.Context, c glexrt.LexClient, input *AdminDeleteAccount_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.deleteAccount", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/admindisableaccountinvites.go b/pkg/comatproto/admindisableaccountinvites.go new file mode 100644 index 00000000..de8ca3b9 --- /dev/null +++ b/pkg/comatproto/admindisableaccountinvites.go @@ -0,0 +1,44 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.disableAccountInvites + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminDisableAccountInvites_Input struct { + LexiconTypeID string `json:"$type"` + Account string `json:"account"` + // note: Optional reason for disabled invites. + Note *string `json:"note,omitempty"` +} + +func (t *AdminDisableAccountInvites_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.disableAccountInvites#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDisableAccountInvites_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminDisableAccountInvites calls the XRPC method "com.atproto.admin.disableAccountInvites". +// +// Disable an account from receiving new invite codes, but does not invalidate existing codes. +func AdminDisableAccountInvites(ctx context.Context, c glexrt.LexClient, input *AdminDisableAccountInvites_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.disableAccountInvites", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/admindisableinvitecodes.go b/pkg/comatproto/admindisableinvitecodes.go new file mode 100644 index 00000000..e7035a41 --- /dev/null +++ b/pkg/comatproto/admindisableinvitecodes.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.disableInviteCodes + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminDisableInviteCodes_Input struct { + LexiconTypeID string `json:"$type"` + Accounts []string `json:"accounts,omitempty"` + Codes []string `json:"codes,omitempty"` +} + +func (t *AdminDisableInviteCodes_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.disableInviteCodes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminDisableInviteCodes_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminDisableInviteCodes calls the XRPC method "com.atproto.admin.disableInviteCodes". +// +// Disable some set of codes and/or all codes associated with a set of users. +func AdminDisableInviteCodes(ctx context.Context, c glexrt.LexClient, input *AdminDisableInviteCodes_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.disableInviteCodes", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/adminenableaccountinvites.go b/pkg/comatproto/adminenableaccountinvites.go new file mode 100644 index 00000000..cb16d9ef --- /dev/null +++ b/pkg/comatproto/adminenableaccountinvites.go @@ -0,0 +1,44 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.enableAccountInvites + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminEnableAccountInvites_Input struct { + LexiconTypeID string `json:"$type"` + Account string `json:"account"` + // note: Optional reason for enabled invites. + Note *string `json:"note,omitempty"` +} + +func (t *AdminEnableAccountInvites_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.enableAccountInvites#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminEnableAccountInvites_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminEnableAccountInvites calls the XRPC method "com.atproto.admin.enableAccountInvites". +// +// Re-enable an account's ability to receive invite codes. +func AdminEnableAccountInvites(ctx context.Context, c glexrt.LexClient, input *AdminEnableAccountInvites_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.enableAccountInvites", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/admingetaccountinfo.go b/pkg/comatproto/admingetaccountinfo.go new file mode 100644 index 00000000..b7699877 --- /dev/null +++ b/pkg/comatproto/admingetaccountinfo.go @@ -0,0 +1,26 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.getAccountInfo + +package comatproto + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// AdminGetAccountInfo calls the XRPC method "com.atproto.admin.getAccountInfo". +// +// Get details about an account. +func AdminGetAccountInfo(ctx context.Context, c glexrt.LexClient, did string) (*AdminDefs_AccountView, error) { + var out AdminDefs_AccountView + + params := map[string]interface{}{} + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.admin.getAccountInfo", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/admingetaccountinfos.go b/pkg/comatproto/admingetaccountinfos.go new file mode 100644 index 00000000..95556014 --- /dev/null +++ b/pkg/comatproto/admingetaccountinfos.go @@ -0,0 +1,46 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.getAccountInfos + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminGetAccountInfos_Output struct { + LexiconTypeID string `json:"$type"` + Infos []AdminDefs_AccountView `json:"infos"` +} + +func (t *AdminGetAccountInfos_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.getAccountInfos#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminGetAccountInfos_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminGetAccountInfos calls the XRPC method "com.atproto.admin.getAccountInfos". +// +// Get details about some accounts. +func AdminGetAccountInfos(ctx context.Context, c glexrt.LexClient, dids []string) (*AdminGetAccountInfos_Output, error) { + var out AdminGetAccountInfos_Output + + params := map[string]interface{}{} + params["dids"] = dids + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.admin.getAccountInfos", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/admingetinvitecodes.go b/pkg/comatproto/admingetinvitecodes.go new file mode 100644 index 00000000..2cbc9de6 --- /dev/null +++ b/pkg/comatproto/admingetinvitecodes.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.getInviteCodes + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminGetInviteCodes_Output struct { + LexiconTypeID string `json:"$type"` + Codes []ServerDefs_InviteCode `json:"codes"` + Cursor *string `json:"cursor,omitempty"` +} + +func (t *AdminGetInviteCodes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.getInviteCodes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminGetInviteCodes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminGetInviteCodes calls the XRPC method "com.atproto.admin.getInviteCodes". +// +// Get an admin view of invite codes. +func AdminGetInviteCodes(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, sort string) (*AdminGetInviteCodes_Output, error) { + var out AdminGetInviteCodes_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if sort != "" { + params["sort"] = sort + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.admin.getInviteCodes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/admingetsubjectstatus.go b/pkg/comatproto/admingetsubjectstatus.go new file mode 100644 index 00000000..5759d8c7 --- /dev/null +++ b/pkg/comatproto/admingetsubjectstatus.go @@ -0,0 +1,141 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.getSubjectStatus + +package comatproto + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminGetSubjectStatus_Output struct { + LexiconTypeID string `json:"$type"` + Deactivated *AdminDefs_StatusAttr `json:"deactivated,omitempty"` + Subject AdminGetSubjectStatus_Output_Subject `json:"subject"` + Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty"` +} + +func (t *AdminGetSubjectStatus_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.getSubjectStatus#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminGetSubjectStatus_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type AdminGetSubjectStatus_Output_Subject struct { + AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef +} + +func (t *AdminGetSubjectStatus_Output_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoBlobRef != nil { + t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef" + return json.Marshal(t.AdminDefs_RepoBlobRef) + } + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *AdminGetSubjectStatus_Output_Subject) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return json.Unmarshal(b, t.AdminDefs_RepoBlobRef) + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + default: + return nil + } +} + +func (t *AdminGetSubjectStatus_Output_Subject) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.AdminDefs_RepoBlobRef != nil { + return t.AdminDefs_RepoBlobRef.MarshalCBOR(w) + } + if t.AdminDefs_RepoRef != nil { + return t.AdminDefs_RepoRef.MarshalCBOR(w) + } + if t.RepoStrongRef != nil { + return t.RepoStrongRef.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *AdminGetSubjectStatus_Output_Subject) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return t.AdminDefs_RepoBlobRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return t.AdminDefs_RepoRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return t.RepoStrongRef.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// AdminGetSubjectStatus calls the XRPC method "com.atproto.admin.getSubjectStatus". +// +// Get the service-specific admin status of a subject (account, record, or blob). +func AdminGetSubjectStatus(ctx context.Context, c glexrt.LexClient, blob string, did string, uri string) (*AdminGetSubjectStatus_Output, error) { + var out AdminGetSubjectStatus_Output + + params := map[string]interface{}{} + if blob != "" { + params["blob"] = blob + } + if did != "" { + params["did"] = did + } + if uri != "" { + params["uri"] = uri + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.admin.getSubjectStatus", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/adminsearchaccounts.go b/pkg/comatproto/adminsearchaccounts.go new file mode 100644 index 00000000..36f5116e --- /dev/null +++ b/pkg/comatproto/adminsearchaccounts.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.searchAccounts + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminSearchAccounts_Output struct { + LexiconTypeID string `json:"$type"` + Accounts []AdminDefs_AccountView `json:"accounts"` + Cursor *string `json:"cursor,omitempty"` +} + +func (t *AdminSearchAccounts_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.searchAccounts#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminSearchAccounts_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminSearchAccounts calls the XRPC method "com.atproto.admin.searchAccounts". +// +// Get list of accounts that matches your search query. +func AdminSearchAccounts(ctx context.Context, c glexrt.LexClient, cursor string, email string, limit *int64) (*AdminSearchAccounts_Output, error) { + var out AdminSearchAccounts_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if email != "" { + params["email"] = email + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.admin.searchAccounts", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/adminsendemail.go b/pkg/comatproto/adminsendemail.go new file mode 100644 index 00000000..81597c51 --- /dev/null +++ b/pkg/comatproto/adminsendemail.go @@ -0,0 +1,66 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.sendEmail + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminSendEmail_Input struct { + LexiconTypeID string `json:"$type"` + // comment: Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers + Comment *string `json:"comment,omitempty"` + Content string `json:"content"` + RecipientDid string `json:"recipientDid"` + SenderDid string `json:"senderDid"` + Subject *string `json:"subject,omitempty"` +} + +func (t *AdminSendEmail_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.sendEmail#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminSendEmail_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type AdminSendEmail_Output struct { + LexiconTypeID string `json:"$type"` + Sent bool `json:"sent"` +} + +func (t *AdminSendEmail_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.sendEmail#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminSendEmail_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminSendEmail calls the XRPC method "com.atproto.admin.sendEmail". +// +// Send email to a user's account email address. +func AdminSendEmail(ctx context.Context, c glexrt.LexClient, input *AdminSendEmail_Input) (*AdminSendEmail_Output, error) { + var out AdminSendEmail_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.sendEmail", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/adminupdateaccountemail.go b/pkg/comatproto/adminupdateaccountemail.go new file mode 100644 index 00000000..f81e9bd5 --- /dev/null +++ b/pkg/comatproto/adminupdateaccountemail.go @@ -0,0 +1,44 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.updateAccountEmail + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminUpdateAccountEmail_Input struct { + LexiconTypeID string `json:"$type"` + // account: The handle or DID of the repo. + Account string `json:"account"` + Email string `json:"email"` +} + +func (t *AdminUpdateAccountEmail_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.updateAccountEmail#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminUpdateAccountEmail_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminUpdateAccountEmail calls the XRPC method "com.atproto.admin.updateAccountEmail". +// +// Administrative action to update an account's email. +func AdminUpdateAccountEmail(ctx context.Context, c glexrt.LexClient, input *AdminUpdateAccountEmail_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.updateAccountEmail", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/adminupdateaccounthandle.go b/pkg/comatproto/adminupdateaccounthandle.go new file mode 100644 index 00000000..e99e32e4 --- /dev/null +++ b/pkg/comatproto/adminupdateaccounthandle.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.updateAccountHandle + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminUpdateAccountHandle_Input struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + Handle string `json:"handle"` +} + +func (t *AdminUpdateAccountHandle_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.updateAccountHandle#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminUpdateAccountHandle_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminUpdateAccountHandle calls the XRPC method "com.atproto.admin.updateAccountHandle". +// +// Administrative action to update an account's handle. +func AdminUpdateAccountHandle(ctx context.Context, c glexrt.LexClient, input *AdminUpdateAccountHandle_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.updateAccountHandle", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/adminupdateaccountpassword.go b/pkg/comatproto/adminupdateaccountpassword.go new file mode 100644 index 00000000..073a4613 --- /dev/null +++ b/pkg/comatproto/adminupdateaccountpassword.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.updateAccountPassword + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminUpdateAccountPassword_Input struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + Password string `json:"password"` +} + +func (t *AdminUpdateAccountPassword_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.updateAccountPassword#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminUpdateAccountPassword_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminUpdateAccountPassword calls the XRPC method "com.atproto.admin.updateAccountPassword". +// +// Update the password for a user account as an administrator. +func AdminUpdateAccountPassword(ctx context.Context, c glexrt.LexClient, input *AdminUpdateAccountPassword_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.updateAccountPassword", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/adminupdateaccountsigningkey.go b/pkg/comatproto/adminupdateaccountsigningkey.go new file mode 100644 index 00000000..e7af8d29 --- /dev/null +++ b/pkg/comatproto/adminupdateaccountsigningkey.go @@ -0,0 +1,44 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.updateAccountSigningKey + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminUpdateAccountSigningKey_Input struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + // signingKey: Did-key formatted public key + SigningKey string `json:"signingKey"` +} + +func (t *AdminUpdateAccountSigningKey_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.updateAccountSigningKey#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminUpdateAccountSigningKey_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// AdminUpdateAccountSigningKey calls the XRPC method "com.atproto.admin.updateAccountSigningKey". +// +// Administrative action to update an account's signing key in their Did document. +func AdminUpdateAccountSigningKey(ctx context.Context, c glexrt.LexClient, input *AdminUpdateAccountSigningKey_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.updateAccountSigningKey", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/adminupdatesubjectstatus.go b/pkg/comatproto/adminupdatesubjectstatus.go new file mode 100644 index 00000000..e40e555d --- /dev/null +++ b/pkg/comatproto/adminupdatesubjectstatus.go @@ -0,0 +1,231 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.admin.updateSubjectStatus + +package comatproto + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type AdminUpdateSubjectStatus_Input struct { + LexiconTypeID string `json:"$type"` + Deactivated *AdminDefs_StatusAttr `json:"deactivated,omitempty"` + Subject AdminUpdateSubjectStatus_Input_Subject `json:"subject"` + Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty"` +} + +func (t *AdminUpdateSubjectStatus_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.updateSubjectStatus#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminUpdateSubjectStatus_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type AdminUpdateSubjectStatus_Input_Subject struct { + AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef +} + +func (t *AdminUpdateSubjectStatus_Input_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoBlobRef != nil { + t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef" + return json.Marshal(t.AdminDefs_RepoBlobRef) + } + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *AdminUpdateSubjectStatus_Input_Subject) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return json.Unmarshal(b, t.AdminDefs_RepoBlobRef) + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + default: + return nil + } +} + +func (t *AdminUpdateSubjectStatus_Input_Subject) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.AdminDefs_RepoBlobRef != nil { + return t.AdminDefs_RepoBlobRef.MarshalCBOR(w) + } + if t.AdminDefs_RepoRef != nil { + return t.AdminDefs_RepoRef.MarshalCBOR(w) + } + if t.RepoStrongRef != nil { + return t.RepoStrongRef.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *AdminUpdateSubjectStatus_Input_Subject) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return t.AdminDefs_RepoBlobRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return t.AdminDefs_RepoRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return t.RepoStrongRef.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +type AdminUpdateSubjectStatus_Output struct { + LexiconTypeID string `json:"$type"` + Subject AdminUpdateSubjectStatus_Output_Subject `json:"subject"` + Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty"` +} + +func (t *AdminUpdateSubjectStatus_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.admin.updateSubjectStatus#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *AdminUpdateSubjectStatus_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type AdminUpdateSubjectStatus_Output_Subject struct { + AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef +} + +func (t *AdminUpdateSubjectStatus_Output_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoBlobRef != nil { + t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef" + return json.Marshal(t.AdminDefs_RepoBlobRef) + } + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *AdminUpdateSubjectStatus_Output_Subject) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return json.Unmarshal(b, t.AdminDefs_RepoBlobRef) + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + default: + return nil + } +} + +func (t *AdminUpdateSubjectStatus_Output_Subject) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.AdminDefs_RepoBlobRef != nil { + return t.AdminDefs_RepoBlobRef.MarshalCBOR(w) + } + if t.AdminDefs_RepoRef != nil { + return t.AdminDefs_RepoRef.MarshalCBOR(w) + } + if t.RepoStrongRef != nil { + return t.RepoStrongRef.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *AdminUpdateSubjectStatus_Output_Subject) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return t.AdminDefs_RepoBlobRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return t.AdminDefs_RepoRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return t.RepoStrongRef.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// AdminUpdateSubjectStatus calls the XRPC method "com.atproto.admin.updateSubjectStatus". +// +// Update the service-specific admin status of a subject (account, record, or blob). +func AdminUpdateSubjectStatus(ctx context.Context, c glexrt.LexClient, input *AdminUpdateSubjectStatus_Input) (*AdminUpdateSubjectStatus_Output, error) { + var out AdminUpdateSubjectStatus_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.admin.updateSubjectStatus", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/identitydefs.go b/pkg/comatproto/identitydefs.go new file mode 100644 index 00000000..6da047c4 --- /dev/null +++ b/pkg/comatproto/identitydefs.go @@ -0,0 +1,35 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.defs + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// IdentityDefs_IdentityInfo is a "identityInfo" in the com.atproto.identity.defs schema. +type IdentityDefs_IdentityInfo struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + // didDoc: The complete DID document for the identity. + DidDoc *glexrt.LexiconTypeDecoder `json:"didDoc"` + // handle: The validated handle of the account; or 'handle.invalid' if the handle did not bi-directionally match the DID document. + Handle string `json:"handle"` +} + +func (t *IdentityDefs_IdentityInfo) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentityDefs_IdentityInfo) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/identitygetrecommendeddidcredentials.go b/pkg/comatproto/identitygetrecommendeddidcredentials.go new file mode 100644 index 00000000..6b8401e9 --- /dev/null +++ b/pkg/comatproto/identitygetrecommendeddidcredentials.go @@ -0,0 +1,47 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.getRecommendedDidCredentials + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type IdentityGetRecommendedDidCredentials_Output struct { + LexiconTypeID string `json:"$type"` + AlsoKnownAs []string `json:"alsoKnownAs,omitempty"` + // rotationKeys: Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. + RotationKeys []string `json:"rotationKeys,omitempty"` + Services *glexrt.LexiconTypeDecoder `json:"services,omitempty"` + VerificationMethods *glexrt.LexiconTypeDecoder `json:"verificationMethods,omitempty"` +} + +func (t *IdentityGetRecommendedDidCredentials_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.getRecommendedDidCredentials#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentityGetRecommendedDidCredentials_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// IdentityGetRecommendedDidCredentials calls the XRPC method "com.atproto.identity.getRecommendedDidCredentials". +// +// Describe the credentials that should be included in the DID doc of an account that is migrating to this service. +func IdentityGetRecommendedDidCredentials(ctx context.Context, c glexrt.LexClient) (*IdentityGetRecommendedDidCredentials_Output, error) { + var out IdentityGetRecommendedDidCredentials_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.identity.getRecommendedDidCredentials", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/identityrefreshidentity.go b/pkg/comatproto/identityrefreshidentity.go new file mode 100644 index 00000000..5c9b5061 --- /dev/null +++ b/pkg/comatproto/identityrefreshidentity.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.refreshIdentity + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type IdentityRefreshIdentity_Input struct { + LexiconTypeID string `json:"$type"` + Identifier string `json:"identifier"` +} + +func (t *IdentityRefreshIdentity_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.refreshIdentity#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentityRefreshIdentity_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// IdentityRefreshIdentity calls the XRPC method "com.atproto.identity.refreshIdentity". +// +// Request that the server re-resolve an identity (DID and handle). The server may ignore this request, or require authentication, depending on the role, implementation, and policy of the server. +func IdentityRefreshIdentity(ctx context.Context, c glexrt.LexClient, input *IdentityRefreshIdentity_Input) (*IdentityDefs_IdentityInfo, error) { + var out IdentityDefs_IdentityInfo + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.identity.refreshIdentity", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/identityrequestplcoperationsignature.go b/pkg/comatproto/identityrequestplcoperationsignature.go new file mode 100644 index 00000000..67b080ce --- /dev/null +++ b/pkg/comatproto/identityrequestplcoperationsignature.go @@ -0,0 +1,22 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.requestPlcOperationSignature + +package comatproto + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// IdentityRequestPlcOperationSignature calls the XRPC method "com.atproto.identity.requestPlcOperationSignature". +// +// Request an email with a code to in order to request a signed PLC operation. Requires Auth. +func IdentityRequestPlcOperationSignature(ctx context.Context, c glexrt.LexClient) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "", "com.atproto.identity.requestPlcOperationSignature", nil, nil, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/identityresolvedid.go b/pkg/comatproto/identityresolvedid.go new file mode 100644 index 00000000..ed78fe5d --- /dev/null +++ b/pkg/comatproto/identityresolvedid.go @@ -0,0 +1,49 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.resolveDid + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type IdentityResolveDid_Output struct { + LexiconTypeID string `json:"$type"` + // didDoc: The complete DID document for the identity. + DidDoc *glexrt.LexiconTypeDecoder `json:"didDoc"` +} + +func (t *IdentityResolveDid_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.resolveDid#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentityResolveDid_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// IdentityResolveDid calls the XRPC method "com.atproto.identity.resolveDid". +// +// Resolves DID to DID document. Does not bi-directionally verify handle. +// +// did: DID to resolve. +func IdentityResolveDid(ctx context.Context, c glexrt.LexClient, did string) (*IdentityResolveDid_Output, error) { + var out IdentityResolveDid_Output + + params := map[string]interface{}{} + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.identity.resolveDid", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/identityresolvehandle.go b/pkg/comatproto/identityresolvehandle.go new file mode 100644 index 00000000..834c071a --- /dev/null +++ b/pkg/comatproto/identityresolvehandle.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.resolveHandle + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type IdentityResolveHandle_Output struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` +} + +func (t *IdentityResolveHandle_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.resolveHandle#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentityResolveHandle_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// IdentityResolveHandle calls the XRPC method "com.atproto.identity.resolveHandle". +// +// Resolves an atproto handle (hostname) to a DID. Does not necessarily bi-directionally verify against the the DID document. +// +// handle: The handle to resolve. +func IdentityResolveHandle(ctx context.Context, c glexrt.LexClient, handle string) (*IdentityResolveHandle_Output, error) { + var out IdentityResolveHandle_Output + + params := map[string]interface{}{} + params["handle"] = handle + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.identity.resolveHandle", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/identityresolveidentity.go b/pkg/comatproto/identityresolveidentity.go new file mode 100644 index 00000000..309a565e --- /dev/null +++ b/pkg/comatproto/identityresolveidentity.go @@ -0,0 +1,28 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.resolveIdentity + +package comatproto + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// IdentityResolveIdentity calls the XRPC method "com.atproto.identity.resolveIdentity". +// +// Resolves an identity (DID or Handle) to a full identity (DID document and verified handle). +// +// identifier: Handle or DID to resolve. +func IdentityResolveIdentity(ctx context.Context, c glexrt.LexClient, identifier string) (*IdentityDefs_IdentityInfo, error) { + var out IdentityDefs_IdentityInfo + + params := map[string]interface{}{} + params["identifier"] = identifier + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.identity.resolveIdentity", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/identitysignplcoperation.go b/pkg/comatproto/identitysignplcoperation.go new file mode 100644 index 00000000..f7a5f7ba --- /dev/null +++ b/pkg/comatproto/identitysignplcoperation.go @@ -0,0 +1,67 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.signPlcOperation + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type IdentitySignPlcOperation_Input struct { + LexiconTypeID string `json:"$type"` + AlsoKnownAs []string `json:"alsoKnownAs,omitempty"` + RotationKeys []string `json:"rotationKeys,omitempty"` + Services *glexrt.LexiconTypeDecoder `json:"services,omitempty"` + // token: A token received through com.atproto.identity.requestPlcOperationSignature + Token *string `json:"token,omitempty"` + VerificationMethods *glexrt.LexiconTypeDecoder `json:"verificationMethods,omitempty"` +} + +func (t *IdentitySignPlcOperation_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.signPlcOperation#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentitySignPlcOperation_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type IdentitySignPlcOperation_Output struct { + LexiconTypeID string `json:"$type"` + // operation: A signed DID PLC operation. + Operation *glexrt.LexiconTypeDecoder `json:"operation"` +} + +func (t *IdentitySignPlcOperation_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.signPlcOperation#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentitySignPlcOperation_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// IdentitySignPlcOperation calls the XRPC method "com.atproto.identity.signPlcOperation". +// +// Signs a PLC operation to update some value(s) in the requesting DID's document. +func IdentitySignPlcOperation(ctx context.Context, c glexrt.LexClient, input *IdentitySignPlcOperation_Input) (*IdentitySignPlcOperation_Output, error) { + var out IdentitySignPlcOperation_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.identity.signPlcOperation", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/identitysubmitplcoperation.go b/pkg/comatproto/identitysubmitplcoperation.go new file mode 100644 index 00000000..5400aa2e --- /dev/null +++ b/pkg/comatproto/identitysubmitplcoperation.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.submitPlcOperation + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type IdentitySubmitPlcOperation_Input struct { + LexiconTypeID string `json:"$type"` + Operation *glexrt.LexiconTypeDecoder `json:"operation"` +} + +func (t *IdentitySubmitPlcOperation_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.submitPlcOperation#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentitySubmitPlcOperation_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// IdentitySubmitPlcOperation calls the XRPC method "com.atproto.identity.submitPlcOperation". +// +// Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry +func IdentitySubmitPlcOperation(ctx context.Context, c glexrt.LexClient, input *IdentitySubmitPlcOperation_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.identity.submitPlcOperation", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/identityupdatehandle.go b/pkg/comatproto/identityupdatehandle.go new file mode 100644 index 00000000..0e3cd535 --- /dev/null +++ b/pkg/comatproto/identityupdatehandle.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.identity.updateHandle + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type IdentityUpdateHandle_Input struct { + LexiconTypeID string `json:"$type"` + // handle: The new handle. + Handle string `json:"handle"` +} + +func (t *IdentityUpdateHandle_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.identity.updateHandle#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *IdentityUpdateHandle_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// IdentityUpdateHandle calls the XRPC method "com.atproto.identity.updateHandle". +// +// Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. +func IdentityUpdateHandle(ctx context.Context, c glexrt.LexClient, input *IdentityUpdateHandle_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.identity.updateHandle", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/labeldefs.go b/pkg/comatproto/labeldefs.go new file mode 100644 index 00000000..b1fe1bb9 --- /dev/null +++ b/pkg/comatproto/labeldefs.go @@ -0,0 +1,150 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.label.defs + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// LabelDefs_Label is a "label" in the com.atproto.label.defs schema. +// +// Metadata tag on an atproto resource (eg, repo or record). +type LabelDefs_Label struct { + LexiconTypeID string `json:"$type"` + // cid: Optionally, CID specifying the specific version of 'uri' resource this label applies to. + Cid *string `json:"cid,omitempty"` + // cts: Timestamp when this label was created. + Cts string `json:"cts"` + // exp: Timestamp at which this label expires (no longer applies). + Exp *string `json:"exp,omitempty"` + // neg: If true, this is a negation label, overwriting a previous label. + Neg *bool `json:"neg,omitempty"` + // sig: Signature of dag-cbor encoded label. + Sig glexrt.Bytes `json:"sig,omitempty"` + // src: DID of the actor who created this label. + Src string `json:"src"` + // uri: AT URI of the record, repository (account), or other resource that this label applies to. + Uri string `json:"uri"` + // val: The short string name of the value or type of this label. + Val string `json:"val"` + // ver: The AT Protocol version of the label object. + Ver *int64 `json:"ver,omitempty"` +} + +func (t *LabelDefs_Label) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelDefs_Label) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelDefs_LabelValueDefinition is a "labelValueDefinition" in the com.atproto.label.defs schema. +// +// Declares a label value and its expected interpretations and behaviors. +type LabelDefs_LabelValueDefinition struct { + LexiconTypeID string `json:"$type"` + // adultOnly: Does the user need to have adult content enabled in order to configure this label? + AdultOnly *bool `json:"adultOnly,omitempty"` + // blurs: What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. + Blurs string `json:"blurs"` + // defaultSetting: The default setting for this label. + DefaultSetting *string `json:"defaultSetting,omitempty"` + // identifier: The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). + Identifier string `json:"identifier"` + Locales []LabelDefs_LabelValueDefinitionStrings `json:"locales"` + // severity: How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. + Severity string `json:"severity"` +} + +func (t *LabelDefs_LabelValueDefinition) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelDefs_LabelValueDefinition) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelDefs_LabelValueDefinitionStrings is a "labelValueDefinitionStrings" in the com.atproto.label.defs schema. +// +// Strings which describe the label in the UI, localized into a specific language. +type LabelDefs_LabelValueDefinitionStrings struct { + LexiconTypeID string `json:"$type"` + // description: A longer description of what the label means and why it might be applied. + Description string `json:"description"` + // lang: The code of the language these strings are written in. + Lang string `json:"lang"` + // name: A short human-readable name for the label. + Name string `json:"name"` +} + +func (t *LabelDefs_LabelValueDefinitionStrings) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelDefs_LabelValueDefinitionStrings) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelDefs_SelfLabel is a "selfLabel" in the com.atproto.label.defs schema. +// +// Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. +type LabelDefs_SelfLabel struct { + LexiconTypeID string `json:"$type"` + // val: The short string name of the value or type of this label. + Val string `json:"val"` +} + +func (t *LabelDefs_SelfLabel) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelDefs_SelfLabel) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelDefs_SelfLabels is a "selfLabels" in the com.atproto.label.defs schema. +// +// Metadata tags on an atproto record, published by the author within the record. +type LabelDefs_SelfLabels struct { + LexiconTypeID string `json:"$type"` + Values []LabelDefs_SelfLabel `json:"values"` +} + +func (t *LabelDefs_SelfLabels) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelDefs_SelfLabels) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/labelquerylabels.go b/pkg/comatproto/labelquerylabels.go new file mode 100644 index 00000000..cd8b675d --- /dev/null +++ b/pkg/comatproto/labelquerylabels.go @@ -0,0 +1,59 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.label.queryLabels + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type LabelQueryLabels_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Labels []LabelDefs_Label `json:"labels"` +} + +func (t *LabelQueryLabels_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.queryLabels#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelQueryLabels_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelQueryLabels calls the XRPC method "com.atproto.label.queryLabels". +// +// Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. +// +// sources[]: Optional list of label sources (DIDs) to filter on. +// uriPatterns[]: List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending with '*'; will match inclusive of the string leading to '*'), or a full URI. +func LabelQueryLabels(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, sources []string, uriPatterns []string) (*LabelQueryLabels_Output, error) { + var out LabelQueryLabels_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if len(sources) != 0 { + params["sources"] = sources + } + params["uriPatterns"] = uriPatterns + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.label.queryLabels", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/labelsubscribelabels.go b/pkg/comatproto/labelsubscribelabels.go new file mode 100644 index 00000000..a35981fb --- /dev/null +++ b/pkg/comatproto/labelsubscribelabels.go @@ -0,0 +1,52 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.label.subscribeLabels + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// LabelSubscribeLabels_Info is a "info" in the com.atproto.label.subscribeLabels schema. +type LabelSubscribeLabels_Info struct { + LexiconTypeID string `json:"$type"` + Message *string `json:"message,omitempty"` + Name string `json:"name"` +} + +func (t *LabelSubscribeLabels_Info) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.subscribeLabels" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelSubscribeLabels_Info) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LabelSubscribeLabels_Labels is a "labels" in the com.atproto.label.subscribeLabels schema. +type LabelSubscribeLabels_Labels struct { + LexiconTypeID string `json:"$type"` + Labels []LabelDefs_Label `json:"labels"` + Seq int64 `json:"seq"` +} + +func (t *LabelSubscribeLabels_Labels) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.label.subscribeLabels" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LabelSubscribeLabels_Labels) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/lexiconschema.go b/pkg/comatproto/lexiconschema.go new file mode 100644 index 00000000..414543ac --- /dev/null +++ b/pkg/comatproto/lexiconschema.go @@ -0,0 +1,36 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.lexicon.schema + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("com.atproto.lexicon.schema", &LexiconSchema{}) +} + +// Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). +type LexiconSchema struct { + LexiconTypeID string `json:"$type"` + // lexicon: Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system. + Lexicon int64 `json:"lexicon"` +} + +func (t *LexiconSchema) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.lexicon.schema" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LexiconSchema) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/moderationcreatereport.go b/pkg/comatproto/moderationcreatereport.go new file mode 100644 index 00000000..f1804ac4 --- /dev/null +++ b/pkg/comatproto/moderationcreatereport.go @@ -0,0 +1,234 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.moderation.createReport + +package comatproto + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ModerationCreateReport_Input struct { + LexiconTypeID string `json:"$type"` + ModTool *ModerationCreateReport_ModTool `json:"modTool,omitempty"` + // reason: Additional context about the content and violation. + Reason *string `json:"reason,omitempty"` + // reasonType: Indicates the broad category of violation the report is for. + ReasonType string `json:"reasonType"` + Subject ModerationCreateReport_Input_Subject `json:"subject"` +} + +func (t *ModerationCreateReport_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.moderation.createReport#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ModerationCreateReport_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ModerationCreateReport_Input_Subject struct { + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef +} + +func (t *ModerationCreateReport_Input_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ModerationCreateReport_Input_Subject) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + default: + return nil + } +} + +func (t *ModerationCreateReport_Input_Subject) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.AdminDefs_RepoRef != nil { + return t.AdminDefs_RepoRef.MarshalCBOR(w) + } + if t.RepoStrongRef != nil { + return t.RepoStrongRef.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ModerationCreateReport_Input_Subject) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return t.AdminDefs_RepoRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return t.RepoStrongRef.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +type ModerationCreateReport_Output struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Id int64 `json:"id"` + Reason *string `json:"reason,omitempty"` + ReasonType string `json:"reasonType"` + ReportedBy string `json:"reportedBy"` + Subject ModerationCreateReport_Output_Subject `json:"subject"` +} + +func (t *ModerationCreateReport_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.moderation.createReport#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ModerationCreateReport_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ModerationCreateReport_Output_Subject struct { + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef +} + +func (t *ModerationCreateReport_Output_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ModerationCreateReport_Output_Subject) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + default: + return nil + } +} + +func (t *ModerationCreateReport_Output_Subject) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.AdminDefs_RepoRef != nil { + return t.AdminDefs_RepoRef.MarshalCBOR(w) + } + if t.RepoStrongRef != nil { + return t.RepoStrongRef.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ModerationCreateReport_Output_Subject) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return t.AdminDefs_RepoRef.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return t.RepoStrongRef.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// ModerationCreateReport calls the XRPC method "com.atproto.moderation.createReport". +// +// Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. +func ModerationCreateReport(ctx context.Context, c glexrt.LexClient, input *ModerationCreateReport_Input) (*ModerationCreateReport_Output, error) { + var out ModerationCreateReport_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.moderation.createReport", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} + +// ModerationCreateReport_ModTool is a "modTool" in the com.atproto.moderation.createReport schema. +// +// Moderation tool information for tracing the source of the action +type ModerationCreateReport_ModTool struct { + LexiconTypeID string `json:"$type"` + // meta: Additional arbitrary metadata about the source + Meta *glexrt.LexiconTypeDecoder `json:"meta,omitempty"` + // name: Name/identifier of the source (e.g., 'bsky-app/android', 'bsky-web/chrome') + Name string `json:"name"` +} + +func (t *ModerationCreateReport_ModTool) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.moderation.createReport" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ModerationCreateReport_ModTool) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/moderationdefs.go b/pkg/comatproto/moderationdefs.go new file mode 100644 index 00000000..d1dbe069 --- /dev/null +++ b/pkg/comatproto/moderationdefs.go @@ -0,0 +1,5 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.moderation.defs + +package comatproto diff --git a/pkg/comatproto/repoapplywrites.go b/pkg/comatproto/repoapplywrites.go new file mode 100644 index 00000000..2809e513 --- /dev/null +++ b/pkg/comatproto/repoapplywrites.go @@ -0,0 +1,364 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.applyWrites + +package comatproto + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoApplyWrites_Input struct { + LexiconTypeID string `json:"$type"` + // repo: The handle or DID of the repo (aka, current account). + Repo string `json:"repo"` + // swapCommit: If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. + SwapCommit *string `json:"swapCommit,omitempty"` + // validate: Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. + Validate *bool `json:"validate,omitempty"` + Writes []RepoApplyWrites_Input_Writes_Elem `json:"writes"` +} + +func (t *RepoApplyWrites_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type RepoApplyWrites_Input_Writes_Elem struct { + RepoApplyWrites_Create *RepoApplyWrites_Create + RepoApplyWrites_Delete *RepoApplyWrites_Delete + RepoApplyWrites_Update *RepoApplyWrites_Update +} + +func (t *RepoApplyWrites_Input_Writes_Elem) MarshalJSON() ([]byte, error) { + if t.RepoApplyWrites_Create != nil { + t.RepoApplyWrites_Create.LexiconTypeID = "com.atproto.repo.applyWrites#create" + return json.Marshal(t.RepoApplyWrites_Create) + } + if t.RepoApplyWrites_Delete != nil { + t.RepoApplyWrites_Delete.LexiconTypeID = "com.atproto.repo.applyWrites#delete" + return json.Marshal(t.RepoApplyWrites_Delete) + } + if t.RepoApplyWrites_Update != nil { + t.RepoApplyWrites_Update.LexiconTypeID = "com.atproto.repo.applyWrites#update" + return json.Marshal(t.RepoApplyWrites_Update) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *RepoApplyWrites_Input_Writes_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.repo.applyWrites#create": + t.RepoApplyWrites_Create = new(RepoApplyWrites_Create) + return json.Unmarshal(b, t.RepoApplyWrites_Create) + case "com.atproto.repo.applyWrites#delete": + t.RepoApplyWrites_Delete = new(RepoApplyWrites_Delete) + return json.Unmarshal(b, t.RepoApplyWrites_Delete) + case "com.atproto.repo.applyWrites#update": + t.RepoApplyWrites_Update = new(RepoApplyWrites_Update) + return json.Unmarshal(b, t.RepoApplyWrites_Update) + default: + return fmt.Errorf("closed unions must match a listed schema") + } +} + +func (t *RepoApplyWrites_Input_Writes_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.RepoApplyWrites_Create != nil { + return t.RepoApplyWrites_Create.MarshalCBOR(w) + } + if t.RepoApplyWrites_Delete != nil { + return t.RepoApplyWrites_Delete.MarshalCBOR(w) + } + if t.RepoApplyWrites_Update != nil { + return t.RepoApplyWrites_Update.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *RepoApplyWrites_Input_Writes_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.repo.applyWrites#create": + t.RepoApplyWrites_Create = new(RepoApplyWrites_Create) + return t.RepoApplyWrites_Create.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.applyWrites#delete": + t.RepoApplyWrites_Delete = new(RepoApplyWrites_Delete) + return t.RepoApplyWrites_Delete.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.applyWrites#update": + t.RepoApplyWrites_Update = new(RepoApplyWrites_Update) + return t.RepoApplyWrites_Update.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +type RepoApplyWrites_Output struct { + LexiconTypeID string `json:"$type"` + Commit *RepoDefs_CommitMeta `json:"commit,omitempty"` + Results []RepoApplyWrites_Output_Results_Elem `json:"results,omitempty"` +} + +func (t *RepoApplyWrites_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type RepoApplyWrites_Output_Results_Elem struct { + RepoApplyWrites_CreateResult *RepoApplyWrites_CreateResult + RepoApplyWrites_DeleteResult *RepoApplyWrites_DeleteResult + RepoApplyWrites_UpdateResult *RepoApplyWrites_UpdateResult +} + +func (t *RepoApplyWrites_Output_Results_Elem) MarshalJSON() ([]byte, error) { + if t.RepoApplyWrites_CreateResult != nil { + t.RepoApplyWrites_CreateResult.LexiconTypeID = "com.atproto.repo.applyWrites#createResult" + return json.Marshal(t.RepoApplyWrites_CreateResult) + } + if t.RepoApplyWrites_DeleteResult != nil { + t.RepoApplyWrites_DeleteResult.LexiconTypeID = "com.atproto.repo.applyWrites#deleteResult" + return json.Marshal(t.RepoApplyWrites_DeleteResult) + } + if t.RepoApplyWrites_UpdateResult != nil { + t.RepoApplyWrites_UpdateResult.LexiconTypeID = "com.atproto.repo.applyWrites#updateResult" + return json.Marshal(t.RepoApplyWrites_UpdateResult) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *RepoApplyWrites_Output_Results_Elem) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.repo.applyWrites#createResult": + t.RepoApplyWrites_CreateResult = new(RepoApplyWrites_CreateResult) + return json.Unmarshal(b, t.RepoApplyWrites_CreateResult) + case "com.atproto.repo.applyWrites#deleteResult": + t.RepoApplyWrites_DeleteResult = new(RepoApplyWrites_DeleteResult) + return json.Unmarshal(b, t.RepoApplyWrites_DeleteResult) + case "com.atproto.repo.applyWrites#updateResult": + t.RepoApplyWrites_UpdateResult = new(RepoApplyWrites_UpdateResult) + return json.Unmarshal(b, t.RepoApplyWrites_UpdateResult) + default: + return fmt.Errorf("closed unions must match a listed schema") + } +} + +func (t *RepoApplyWrites_Output_Results_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.RepoApplyWrites_CreateResult != nil { + return t.RepoApplyWrites_CreateResult.MarshalCBOR(w) + } + if t.RepoApplyWrites_DeleteResult != nil { + return t.RepoApplyWrites_DeleteResult.MarshalCBOR(w) + } + if t.RepoApplyWrites_UpdateResult != nil { + return t.RepoApplyWrites_UpdateResult.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *RepoApplyWrites_Output_Results_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.repo.applyWrites#createResult": + t.RepoApplyWrites_CreateResult = new(RepoApplyWrites_CreateResult) + return t.RepoApplyWrites_CreateResult.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.applyWrites#deleteResult": + t.RepoApplyWrites_DeleteResult = new(RepoApplyWrites_DeleteResult) + return t.RepoApplyWrites_DeleteResult.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.repo.applyWrites#updateResult": + t.RepoApplyWrites_UpdateResult = new(RepoApplyWrites_UpdateResult) + return t.RepoApplyWrites_UpdateResult.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// RepoApplyWrites calls the XRPC method "com.atproto.repo.applyWrites". +// +// Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. +func RepoApplyWrites(ctx context.Context, c glexrt.LexClient, input *RepoApplyWrites_Input) (*RepoApplyWrites_Output, error) { + var out RepoApplyWrites_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.repo.applyWrites", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} + +// RepoApplyWrites_Create is a "create" in the com.atproto.repo.applyWrites schema. +// +// Operation which creates a new record. +type RepoApplyWrites_Create struct { + LexiconTypeID string `json:"$type"` + Collection string `json:"collection"` + // rkey: NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility. + Rkey *string `json:"rkey,omitempty"` + Value *glexrt.LexiconTypeDecoder `json:"value"` +} + +func (t *RepoApplyWrites_Create) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_Create) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoApplyWrites_CreateResult is a "createResult" in the com.atproto.repo.applyWrites schema. +type RepoApplyWrites_CreateResult struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Uri string `json:"uri"` + ValidationStatus *string `json:"validationStatus,omitempty"` +} + +func (t *RepoApplyWrites_CreateResult) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_CreateResult) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoApplyWrites_Delete is a "delete" in the com.atproto.repo.applyWrites schema. +// +// Operation which deletes an existing record. +type RepoApplyWrites_Delete struct { + LexiconTypeID string `json:"$type"` + Collection string `json:"collection"` + Rkey string `json:"rkey"` +} + +func (t *RepoApplyWrites_Delete) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_Delete) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoApplyWrites_DeleteResult is a "deleteResult" in the com.atproto.repo.applyWrites schema. +type RepoApplyWrites_DeleteResult struct { + LexiconTypeID string `json:"$type"` +} + +func (t *RepoApplyWrites_DeleteResult) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_DeleteResult) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoApplyWrites_Update is a "update" in the com.atproto.repo.applyWrites schema. +// +// Operation which updates an existing record. +type RepoApplyWrites_Update struct { + LexiconTypeID string `json:"$type"` + Collection string `json:"collection"` + Rkey string `json:"rkey"` + Value *glexrt.LexiconTypeDecoder `json:"value"` +} + +func (t *RepoApplyWrites_Update) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_Update) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoApplyWrites_UpdateResult is a "updateResult" in the com.atproto.repo.applyWrites schema. +type RepoApplyWrites_UpdateResult struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Uri string `json:"uri"` + ValidationStatus *string `json:"validationStatus,omitempty"` +} + +func (t *RepoApplyWrites_UpdateResult) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.applyWrites" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoApplyWrites_UpdateResult) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/repocreaterecord.go b/pkg/comatproto/repocreaterecord.go new file mode 100644 index 00000000..7a9f63cb --- /dev/null +++ b/pkg/comatproto/repocreaterecord.go @@ -0,0 +1,75 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.createRecord + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoCreateRecord_Input struct { + LexiconTypeID string `json:"$type"` + // collection: The NSID of the record collection. + Collection string `json:"collection"` + // record: The record itself. Must contain a $type field. + Record *glexrt.LexiconTypeDecoder `json:"record"` + // repo: The handle or DID of the repo (aka, current account). + Repo string `json:"repo"` + // rkey: The Record Key. + Rkey *string `json:"rkey,omitempty"` + // swapCommit: Compare and swap with the previous commit by CID. + SwapCommit *string `json:"swapCommit,omitempty"` + // validate: Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. + Validate *bool `json:"validate,omitempty"` +} + +func (t *RepoCreateRecord_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.createRecord#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoCreateRecord_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type RepoCreateRecord_Output struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Commit *RepoDefs_CommitMeta `json:"commit,omitempty"` + Uri string `json:"uri"` + ValidationStatus *string `json:"validationStatus,omitempty"` +} + +func (t *RepoCreateRecord_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.createRecord#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoCreateRecord_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoCreateRecord calls the XRPC method "com.atproto.repo.createRecord". +// +// Create a single new repository record. Requires auth, implemented by PDS. +func RepoCreateRecord(ctx context.Context, c glexrt.LexClient, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) { + var out RepoCreateRecord_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/repodefs.go b/pkg/comatproto/repodefs.go new file mode 100644 index 00000000..a6439f8a --- /dev/null +++ b/pkg/comatproto/repodefs.go @@ -0,0 +1,32 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.defs + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// RepoDefs_CommitMeta is a "commitMeta" in the com.atproto.repo.defs schema. +type RepoDefs_CommitMeta struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Rev string `json:"rev"` +} + +func (t *RepoDefs_CommitMeta) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoDefs_CommitMeta) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/repodeleterecord.go b/pkg/comatproto/repodeleterecord.go new file mode 100644 index 00000000..84762be5 --- /dev/null +++ b/pkg/comatproto/repodeleterecord.go @@ -0,0 +1,70 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.deleteRecord + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoDeleteRecord_Input struct { + LexiconTypeID string `json:"$type"` + // collection: The NSID of the record collection. + Collection string `json:"collection"` + // repo: The handle or DID of the repo (aka, current account). + Repo string `json:"repo"` + // rkey: The Record Key. + Rkey string `json:"rkey"` + // swapCommit: Compare and swap with the previous commit by CID. + SwapCommit *string `json:"swapCommit,omitempty"` + // swapRecord: Compare and swap with the previous record by CID. + SwapRecord *string `json:"swapRecord,omitempty"` +} + +func (t *RepoDeleteRecord_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.deleteRecord#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoDeleteRecord_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type RepoDeleteRecord_Output struct { + LexiconTypeID string `json:"$type"` + Commit *RepoDefs_CommitMeta `json:"commit,omitempty"` +} + +func (t *RepoDeleteRecord_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.deleteRecord#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoDeleteRecord_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoDeleteRecord calls the XRPC method "com.atproto.repo.deleteRecord". +// +// Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS. +func RepoDeleteRecord(ctx context.Context, c glexrt.LexClient, input *RepoDeleteRecord_Input) (*RepoDeleteRecord_Output, error) { + var out RepoDeleteRecord_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.repo.deleteRecord", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/repodescriberepo.go b/pkg/comatproto/repodescriberepo.go new file mode 100644 index 00000000..091ecc29 --- /dev/null +++ b/pkg/comatproto/repodescriberepo.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.describeRepo + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoDescribeRepo_Output struct { + LexiconTypeID string `json:"$type"` + // collections: List of all the collections (NSIDs) for which this repo contains at least one record. + Collections []string `json:"collections"` + Did string `json:"did"` + // didDoc: The complete DID document for this account. + DidDoc *glexrt.LexiconTypeDecoder `json:"didDoc"` + Handle string `json:"handle"` + // handleIsCorrect: Indicates if handle is currently valid (resolves bi-directionally) + HandleIsCorrect bool `json:"handleIsCorrect"` +} + +func (t *RepoDescribeRepo_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.describeRepo#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoDescribeRepo_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoDescribeRepo calls the XRPC method "com.atproto.repo.describeRepo". +// +// Get information about an account and repository, including the list of collections. Does not require auth. +// +// repo: The handle or DID of the repo. +func RepoDescribeRepo(ctx context.Context, c glexrt.LexClient, repo string) (*RepoDescribeRepo_Output, error) { + var out RepoDescribeRepo_Output + + params := map[string]interface{}{} + params["repo"] = repo + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.repo.describeRepo", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/repogetrecord.go b/pkg/comatproto/repogetrecord.go new file mode 100644 index 00000000..d5ae21ec --- /dev/null +++ b/pkg/comatproto/repogetrecord.go @@ -0,0 +1,58 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.getRecord + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoGetRecord_Output struct { + LexiconTypeID string `json:"$type"` + Cid *string `json:"cid,omitempty"` + Uri string `json:"uri"` + Value *glexrt.LexiconTypeDecoder `json:"value"` +} + +func (t *RepoGetRecord_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.getRecord#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoGetRecord_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoGetRecord calls the XRPC method "com.atproto.repo.getRecord". +// +// Get a single record from a repository. Does not require auth. +// +// cid: The CID of the version of the record. If not specified, then return the most recent version. +// collection: The NSID of the record collection. +// repo: The handle or DID of the repo. +// rkey: The Record Key. +func RepoGetRecord(ctx context.Context, c glexrt.LexClient, cid string, collection string, repo string, rkey string) (*RepoGetRecord_Output, error) { + var out RepoGetRecord_Output + + params := map[string]interface{}{} + if cid != "" { + params["cid"] = cid + } + params["collection"] = collection + params["repo"] = repo + params["rkey"] = rkey + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.repo.getRecord", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/repoimportrepo.go b/pkg/comatproto/repoimportrepo.go new file mode 100644 index 00000000..a17400a5 --- /dev/null +++ b/pkg/comatproto/repoimportrepo.go @@ -0,0 +1,23 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.importRepo + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" +) + +// RepoImportRepo calls the XRPC method "com.atproto.repo.importRepo". +// +// Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set. +func RepoImportRepo(ctx context.Context, c glexrt.LexClient, input io.Reader) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/vnd.ipld.car", "com.atproto.repo.importRepo", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/repolistmissingblobs.go b/pkg/comatproto/repolistmissingblobs.go new file mode 100644 index 00000000..ea5f7265 --- /dev/null +++ b/pkg/comatproto/repolistmissingblobs.go @@ -0,0 +1,72 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.listMissingBlobs + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoListMissingBlobs_Output struct { + LexiconTypeID string `json:"$type"` + Blobs []RepoListMissingBlobs_RecordBlob `json:"blobs"` + Cursor *string `json:"cursor,omitempty"` +} + +func (t *RepoListMissingBlobs_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.listMissingBlobs#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoListMissingBlobs_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoListMissingBlobs calls the XRPC method "com.atproto.repo.listMissingBlobs". +// +// Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow. +func RepoListMissingBlobs(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*RepoListMissingBlobs_Output, error) { + var out RepoListMissingBlobs_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.repo.listMissingBlobs", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// RepoListMissingBlobs_RecordBlob is a "recordBlob" in the com.atproto.repo.listMissingBlobs schema. +type RepoListMissingBlobs_RecordBlob struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + RecordUri string `json:"recordUri"` +} + +func (t *RepoListMissingBlobs_RecordBlob) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.listMissingBlobs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoListMissingBlobs_RecordBlob) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/repolistrecords.go b/pkg/comatproto/repolistrecords.go new file mode 100644 index 00000000..81caec69 --- /dev/null +++ b/pkg/comatproto/repolistrecords.go @@ -0,0 +1,83 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.listRecords + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoListRecords_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Records []RepoListRecords_Record `json:"records"` +} + +func (t *RepoListRecords_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.listRecords#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoListRecords_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoListRecords calls the XRPC method "com.atproto.repo.listRecords". +// +// List a range of records in a repository, matching a specific collection. Does not require auth. +// +// collection: The NSID of the record type. +// limit: The number of records to return. +// repo: The handle or DID of the repo. +// reverse: Flag to reverse the order of the returned records. +func RepoListRecords(ctx context.Context, c glexrt.LexClient, collection string, cursor string, limit *int64, repo string, reverse *bool) (*RepoListRecords_Output, error) { + var out RepoListRecords_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if reverse != nil { + params["reverse"] = *reverse + } + params["collection"] = collection + params["repo"] = repo + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.repo.listRecords", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// RepoListRecords_Record is a "record" in the com.atproto.repo.listRecords schema. +type RepoListRecords_Record struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Uri string `json:"uri"` + Value *glexrt.LexiconTypeDecoder `json:"value"` +} + +func (t *RepoListRecords_Record) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.listRecords" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoListRecords_Record) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/repoputrecord.go b/pkg/comatproto/repoputrecord.go new file mode 100644 index 00000000..ac873240 --- /dev/null +++ b/pkg/comatproto/repoputrecord.go @@ -0,0 +1,77 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.putRecord + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoPutRecord_Input struct { + LexiconTypeID string `json:"$type"` + // collection: The NSID of the record collection. + Collection string `json:"collection"` + // record: The record to write. + Record *glexrt.LexiconTypeDecoder `json:"record"` + // repo: The handle or DID of the repo (aka, current account). + Repo string `json:"repo"` + // rkey: The Record Key. + Rkey string `json:"rkey"` + // swapCommit: Compare and swap with the previous commit by CID. + SwapCommit *string `json:"swapCommit,omitempty"` + // swapRecord: Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation + SwapRecord *string `json:"swapRecord,omitempty"` + // validate: Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. + Validate *bool `json:"validate,omitempty"` +} + +func (t *RepoPutRecord_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.putRecord#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoPutRecord_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type RepoPutRecord_Output struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Commit *RepoDefs_CommitMeta `json:"commit,omitempty"` + Uri string `json:"uri"` + ValidationStatus *string `json:"validationStatus,omitempty"` +} + +func (t *RepoPutRecord_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.putRecord#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoPutRecord_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoPutRecord calls the XRPC method "com.atproto.repo.putRecord". +// +// Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS. +func RepoPutRecord(ctx context.Context, c glexrt.LexClient, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) { + var out RepoPutRecord_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/repostrongref.go b/pkg/comatproto/repostrongref.go new file mode 100644 index 00000000..60b53732 --- /dev/null +++ b/pkg/comatproto/repostrongref.go @@ -0,0 +1,35 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.strongRef + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("com.atproto.repo.strongRef#main", &RepoStrongRef{}) +} + +type RepoStrongRef struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Uri string `json:"uri"` +} + +func (t *RepoStrongRef) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.strongRef" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoStrongRef) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/repouploadblob.go b/pkg/comatproto/repouploadblob.go new file mode 100644 index 00000000..82f0e6d0 --- /dev/null +++ b/pkg/comatproto/repouploadblob.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.repo.uploadBlob + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type RepoUploadBlob_Output struct { + LexiconTypeID string `json:"$type"` + Blob glexrt.Blob `json:"blob"` +} + +func (t *RepoUploadBlob_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.repo.uploadBlob#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *RepoUploadBlob_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// RepoUploadBlob calls the XRPC method "com.atproto.repo.uploadBlob". +// +// Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS. +func RepoUploadBlob(ctx context.Context, c glexrt.LexClient, input io.Reader) (*RepoUploadBlob_Output, error) { + var out RepoUploadBlob_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "*/*", "com.atproto.repo.uploadBlob", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/serveractivateaccount.go b/pkg/comatproto/serveractivateaccount.go new file mode 100644 index 00000000..c3c26a5e --- /dev/null +++ b/pkg/comatproto/serveractivateaccount.go @@ -0,0 +1,22 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.activateAccount + +package comatproto + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// ServerActivateAccount calls the XRPC method "com.atproto.server.activateAccount". +// +// Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup. +func ServerActivateAccount(ctx context.Context, c glexrt.LexClient) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "", "com.atproto.server.activateAccount", nil, nil, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/servercheckaccountstatus.go b/pkg/comatproto/servercheckaccountstatus.go new file mode 100644 index 00000000..96a08293 --- /dev/null +++ b/pkg/comatproto/servercheckaccountstatus.go @@ -0,0 +1,51 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.checkAccountStatus + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerCheckAccountStatus_Output struct { + LexiconTypeID string `json:"$type"` + Activated bool `json:"activated"` + ExpectedBlobs int64 `json:"expectedBlobs"` + ImportedBlobs int64 `json:"importedBlobs"` + IndexedRecords int64 `json:"indexedRecords"` + PrivateStateValues int64 `json:"privateStateValues"` + RepoBlocks int64 `json:"repoBlocks"` + RepoCommit string `json:"repoCommit"` + RepoRev string `json:"repoRev"` + ValidDid bool `json:"validDid"` +} + +func (t *ServerCheckAccountStatus_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.checkAccountStatus#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCheckAccountStatus_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerCheckAccountStatus calls the XRPC method "com.atproto.server.checkAccountStatus". +// +// Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself. +func ServerCheckAccountStatus(ctx context.Context, c glexrt.LexClient) (*ServerCheckAccountStatus_Output, error) { + var out ServerCheckAccountStatus_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.server.checkAccountStatus", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/serverconfirmemail.go b/pkg/comatproto/serverconfirmemail.go new file mode 100644 index 00000000..eb9abd95 --- /dev/null +++ b/pkg/comatproto/serverconfirmemail.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.confirmEmail + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerConfirmEmail_Input struct { + LexiconTypeID string `json:"$type"` + Email string `json:"email"` + Token string `json:"token"` +} + +func (t *ServerConfirmEmail_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.confirmEmail#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerConfirmEmail_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerConfirmEmail calls the XRPC method "com.atproto.server.confirmEmail". +// +// Confirm an email using a token from com.atproto.server.requestEmailConfirmation. +func ServerConfirmEmail(ctx context.Context, c glexrt.LexClient, input *ServerConfirmEmail_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.confirmEmail", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/servercreateaccount.go b/pkg/comatproto/servercreateaccount.go new file mode 100644 index 00000000..006d6288 --- /dev/null +++ b/pkg/comatproto/servercreateaccount.go @@ -0,0 +1,81 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.createAccount + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerCreateAccount_Input struct { + LexiconTypeID string `json:"$type"` + // did: Pre-existing atproto DID, being imported to a new account. + Did *string `json:"did,omitempty"` + Email *string `json:"email,omitempty"` + // handle: Requested handle for the account. + Handle string `json:"handle"` + InviteCode *string `json:"inviteCode,omitempty"` + // password: Initial account password. May need to meet instance-specific password strength requirements. + Password *string `json:"password,omitempty"` + // plcOp: A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. + PlcOp *glexrt.LexiconTypeDecoder `json:"plcOp,omitempty"` + // recoveryKey: DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. + RecoveryKey *string `json:"recoveryKey,omitempty"` + VerificationCode *string `json:"verificationCode,omitempty"` + VerificationPhone *string `json:"verificationPhone,omitempty"` +} + +func (t *ServerCreateAccount_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createAccount#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateAccount_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Account login session returned on successful account creation. +type ServerCreateAccount_Output struct { + LexiconTypeID string `json:"$type"` + AccessJwt string `json:"accessJwt"` + // did: The DID of the new account. + Did string `json:"did"` + // didDoc: Complete DID document. + DidDoc *glexrt.LexiconTypeDecoder `json:"didDoc,omitempty"` + Handle string `json:"handle"` + RefreshJwt string `json:"refreshJwt"` +} + +func (t *ServerCreateAccount_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createAccount#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateAccount_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerCreateAccount calls the XRPC method "com.atproto.server.createAccount". +// +// Create an account. Implemented by PDS. +func ServerCreateAccount(ctx context.Context, c glexrt.LexClient, input *ServerCreateAccount_Input) (*ServerCreateAccount_Output, error) { + var out ServerCreateAccount_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.createAccount", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/servercreateapppassword.go b/pkg/comatproto/servercreateapppassword.go new file mode 100644 index 00000000..39b92228 --- /dev/null +++ b/pkg/comatproto/servercreateapppassword.go @@ -0,0 +1,68 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.createAppPassword + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerCreateAppPassword_Input struct { + LexiconTypeID string `json:"$type"` + // name: A short name for the App Password, to help distinguish them. + Name string `json:"name"` + // privileged: If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. + Privileged *bool `json:"privileged,omitempty"` +} + +func (t *ServerCreateAppPassword_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createAppPassword#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateAppPassword_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerCreateAppPassword calls the XRPC method "com.atproto.server.createAppPassword". +// +// Create an App Password. +func ServerCreateAppPassword(ctx context.Context, c glexrt.LexClient, input *ServerCreateAppPassword_Input) (*ServerCreateAppPassword_AppPassword, error) { + var out ServerCreateAppPassword_AppPassword + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.createAppPassword", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} + +// ServerCreateAppPassword_AppPassword is a "appPassword" in the com.atproto.server.createAppPassword schema. +type ServerCreateAppPassword_AppPassword struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Name string `json:"name"` + Password string `json:"password"` + Privileged *bool `json:"privileged,omitempty"` +} + +func (t *ServerCreateAppPassword_AppPassword) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createAppPassword" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateAppPassword_AppPassword) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/servercreateinvitecode.go b/pkg/comatproto/servercreateinvitecode.go new file mode 100644 index 00000000..82391b10 --- /dev/null +++ b/pkg/comatproto/servercreateinvitecode.go @@ -0,0 +1,62 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.createInviteCode + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerCreateInviteCode_Input struct { + LexiconTypeID string `json:"$type"` + ForAccount *string `json:"forAccount,omitempty"` + UseCount int64 `json:"useCount"` +} + +func (t *ServerCreateInviteCode_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createInviteCode#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateInviteCode_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ServerCreateInviteCode_Output struct { + LexiconTypeID string `json:"$type"` + Code string `json:"code"` +} + +func (t *ServerCreateInviteCode_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createInviteCode#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateInviteCode_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerCreateInviteCode calls the XRPC method "com.atproto.server.createInviteCode". +// +// Create an invite code. +func ServerCreateInviteCode(ctx context.Context, c glexrt.LexClient, input *ServerCreateInviteCode_Input) (*ServerCreateInviteCode_Output, error) { + var out ServerCreateInviteCode_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.createInviteCode", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/servercreateinvitecodes.go b/pkg/comatproto/servercreateinvitecodes.go new file mode 100644 index 00000000..3fb8255e --- /dev/null +++ b/pkg/comatproto/servercreateinvitecodes.go @@ -0,0 +1,83 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.createInviteCodes + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerCreateInviteCodes_Input struct { + LexiconTypeID string `json:"$type"` + CodeCount int64 `json:"codeCount"` + ForAccounts []string `json:"forAccounts,omitempty"` + UseCount int64 `json:"useCount"` +} + +func (t *ServerCreateInviteCodes_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createInviteCodes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateInviteCodes_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ServerCreateInviteCodes_Output struct { + LexiconTypeID string `json:"$type"` + Codes []ServerCreateInviteCodes_AccountCodes `json:"codes"` +} + +func (t *ServerCreateInviteCodes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createInviteCodes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateInviteCodes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerCreateInviteCodes calls the XRPC method "com.atproto.server.createInviteCodes". +// +// Create invite codes. +func ServerCreateInviteCodes(ctx context.Context, c glexrt.LexClient, input *ServerCreateInviteCodes_Input) (*ServerCreateInviteCodes_Output, error) { + var out ServerCreateInviteCodes_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.createInviteCodes", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} + +// ServerCreateInviteCodes_AccountCodes is a "accountCodes" in the com.atproto.server.createInviteCodes schema. +type ServerCreateInviteCodes_AccountCodes struct { + LexiconTypeID string `json:"$type"` + Account string `json:"account"` + Codes []string `json:"codes"` +} + +func (t *ServerCreateInviteCodes_AccountCodes) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createInviteCodes" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateInviteCodes_AccountCodes) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/servercreatesession.go b/pkg/comatproto/servercreatesession.go new file mode 100644 index 00000000..0464bbc0 --- /dev/null +++ b/pkg/comatproto/servercreatesession.go @@ -0,0 +1,76 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.createSession + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerCreateSession_Input struct { + LexiconTypeID string `json:"$type"` + // allowTakendown: When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned + AllowTakendown *bool `json:"allowTakendown,omitempty"` + AuthFactorToken *string `json:"authFactorToken,omitempty"` + // identifier: Handle or other identifier supported by the server for the authenticating user. + Identifier string `json:"identifier"` + Password string `json:"password"` +} + +func (t *ServerCreateSession_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createSession#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateSession_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ServerCreateSession_Output struct { + LexiconTypeID string `json:"$type"` + AccessJwt string `json:"accessJwt"` + Active *bool `json:"active,omitempty"` + Did string `json:"did"` + DidDoc *glexrt.LexiconTypeDecoder `json:"didDoc,omitempty"` + Email *string `json:"email,omitempty"` + EmailAuthFactor *bool `json:"emailAuthFactor,omitempty"` + EmailConfirmed *bool `json:"emailConfirmed,omitempty"` + Handle string `json:"handle"` + RefreshJwt string `json:"refreshJwt"` + // status: If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. + Status *string `json:"status,omitempty"` +} + +func (t *ServerCreateSession_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.createSession#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerCreateSession_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerCreateSession calls the XRPC method "com.atproto.server.createSession". +// +// Create an authentication session. +func ServerCreateSession(ctx context.Context, c glexrt.LexClient, input *ServerCreateSession_Input) (*ServerCreateSession_Output, error) { + var out ServerCreateSession_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.createSession", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/serverdeactivateaccount.go b/pkg/comatproto/serverdeactivateaccount.go new file mode 100644 index 00000000..2745250a --- /dev/null +++ b/pkg/comatproto/serverdeactivateaccount.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.deactivateAccount + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerDeactivateAccount_Input struct { + LexiconTypeID string `json:"$type"` + // deleteAfter: A recommendation to server as to how long they should hold onto the deactivated account before deleting. + DeleteAfter *string `json:"deleteAfter,omitempty"` +} + +func (t *ServerDeactivateAccount_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.deactivateAccount#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerDeactivateAccount_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerDeactivateAccount calls the XRPC method "com.atproto.server.deactivateAccount". +// +// Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. +func ServerDeactivateAccount(ctx context.Context, c glexrt.LexClient, input *ServerDeactivateAccount_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.deactivateAccount", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverdefs.go b/pkg/comatproto/serverdefs.go new file mode 100644 index 00000000..7189f934 --- /dev/null +++ b/pkg/comatproto/serverdefs.go @@ -0,0 +1,57 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.defs + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// ServerDefs_InviteCode is a "inviteCode" in the com.atproto.server.defs schema. +type ServerDefs_InviteCode struct { + LexiconTypeID string `json:"$type"` + Available int64 `json:"available"` + Code string `json:"code"` + CreatedAt string `json:"createdAt"` + CreatedBy string `json:"createdBy"` + Disabled bool `json:"disabled"` + ForAccount string `json:"forAccount"` + Uses []ServerDefs_InviteCodeUse `json:"uses"` +} + +func (t *ServerDefs_InviteCode) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerDefs_InviteCode) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerDefs_InviteCodeUse is a "inviteCodeUse" in the com.atproto.server.defs schema. +type ServerDefs_InviteCodeUse struct { + LexiconTypeID string `json:"$type"` + UsedAt string `json:"usedAt"` + UsedBy string `json:"usedBy"` +} + +func (t *ServerDefs_InviteCodeUse) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerDefs_InviteCodeUse) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/serverdeleteaccount.go b/pkg/comatproto/serverdeleteaccount.go new file mode 100644 index 00000000..dbbb0b78 --- /dev/null +++ b/pkg/comatproto/serverdeleteaccount.go @@ -0,0 +1,44 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.deleteAccount + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerDeleteAccount_Input struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + Password string `json:"password"` + Token string `json:"token"` +} + +func (t *ServerDeleteAccount_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.deleteAccount#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerDeleteAccount_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerDeleteAccount calls the XRPC method "com.atproto.server.deleteAccount". +// +// Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth. +func ServerDeleteAccount(ctx context.Context, c glexrt.LexClient, input *ServerDeleteAccount_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.deleteAccount", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverdeletesession.go b/pkg/comatproto/serverdeletesession.go new file mode 100644 index 00000000..5d3aeafe --- /dev/null +++ b/pkg/comatproto/serverdeletesession.go @@ -0,0 +1,22 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.deleteSession + +package comatproto + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// ServerDeleteSession calls the XRPC method "com.atproto.server.deleteSession". +// +// Delete the current session. Requires auth. +func ServerDeleteSession(ctx context.Context, c glexrt.LexClient) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "", "com.atproto.server.deleteSession", nil, nil, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverdescribeserver.go b/pkg/comatproto/serverdescribeserver.go new file mode 100644 index 00000000..376a1c1b --- /dev/null +++ b/pkg/comatproto/serverdescribeserver.go @@ -0,0 +1,92 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.describeServer + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerDescribeServer_Output struct { + LexiconTypeID string `json:"$type"` + // availableUserDomains: List of domain suffixes that can be used in account handles. + AvailableUserDomains []string `json:"availableUserDomains"` + // contact: Contact information + Contact *ServerDescribeServer_Contact `json:"contact,omitempty"` + Did string `json:"did"` + // inviteCodeRequired: If true, an invite code must be supplied to create an account on this instance. + InviteCodeRequired *bool `json:"inviteCodeRequired,omitempty"` + // links: URLs of service policy documents. + Links *ServerDescribeServer_Links `json:"links,omitempty"` + // phoneVerificationRequired: If true, a phone verification token must be supplied to create an account on this instance. + PhoneVerificationRequired *bool `json:"phoneVerificationRequired,omitempty"` +} + +func (t *ServerDescribeServer_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.describeServer#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerDescribeServer_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerDescribeServer calls the XRPC method "com.atproto.server.describeServer". +// +// Describes the server's account creation requirements and capabilities. Implemented by PDS. +func ServerDescribeServer(ctx context.Context, c glexrt.LexClient) (*ServerDescribeServer_Output, error) { + var out ServerDescribeServer_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.server.describeServer", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// ServerDescribeServer_Contact is a "contact" in the com.atproto.server.describeServer schema. +type ServerDescribeServer_Contact struct { + LexiconTypeID string `json:"$type"` + Email *string `json:"email,omitempty"` +} + +func (t *ServerDescribeServer_Contact) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.describeServer" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerDescribeServer_Contact) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerDescribeServer_Links is a "links" in the com.atproto.server.describeServer schema. +type ServerDescribeServer_Links struct { + LexiconTypeID string `json:"$type"` + PrivacyPolicy *string `json:"privacyPolicy,omitempty"` + TermsOfService *string `json:"termsOfService,omitempty"` +} + +func (t *ServerDescribeServer_Links) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.describeServer" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerDescribeServer_Links) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/servergetaccountinvitecodes.go b/pkg/comatproto/servergetaccountinvitecodes.go new file mode 100644 index 00000000..3e42dac6 --- /dev/null +++ b/pkg/comatproto/servergetaccountinvitecodes.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.getAccountInviteCodes + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerGetAccountInviteCodes_Output struct { + LexiconTypeID string `json:"$type"` + Codes []ServerDefs_InviteCode `json:"codes"` +} + +func (t *ServerGetAccountInviteCodes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.getAccountInviteCodes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerGetAccountInviteCodes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerGetAccountInviteCodes calls the XRPC method "com.atproto.server.getAccountInviteCodes". +// +// Get all invite codes for the current account. Requires auth. +// +// createAvailable: Controls whether any new 'earned' but not 'created' invites should be created. +func ServerGetAccountInviteCodes(ctx context.Context, c glexrt.LexClient, createAvailable *bool, includeUsed *bool) (*ServerGetAccountInviteCodes_Output, error) { + var out ServerGetAccountInviteCodes_Output + + params := map[string]interface{}{} + if createAvailable != nil { + params["createAvailable"] = *createAvailable + } + if includeUsed != nil { + params["includeUsed"] = *includeUsed + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.server.getAccountInviteCodes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/servergetserviceauth.go b/pkg/comatproto/servergetserviceauth.go new file mode 100644 index 00000000..31488f4d --- /dev/null +++ b/pkg/comatproto/servergetserviceauth.go @@ -0,0 +1,56 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.getServiceAuth + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerGetServiceAuth_Output struct { + LexiconTypeID string `json:"$type"` + Token string `json:"token"` +} + +func (t *ServerGetServiceAuth_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.getServiceAuth#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerGetServiceAuth_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerGetServiceAuth calls the XRPC method "com.atproto.server.getServiceAuth". +// +// Get a signed token on behalf of the requesting DID for the requested service. +// +// aud: The DID of the service that the token will be used to authenticate with +// exp: The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. +// lxm: Lexicon (XRPC) method to bind the requested token to +func ServerGetServiceAuth(ctx context.Context, c glexrt.LexClient, aud string, exp *int64, lxm string) (*ServerGetServiceAuth_Output, error) { + var out ServerGetServiceAuth_Output + + params := map[string]interface{}{} + if exp != nil { + params["exp"] = *exp + } + if lxm != "" { + params["lxm"] = lxm + } + params["aud"] = aud + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.server.getServiceAuth", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/servergetsession.go b/pkg/comatproto/servergetsession.go new file mode 100644 index 00000000..fcbc4e1f --- /dev/null +++ b/pkg/comatproto/servergetsession.go @@ -0,0 +1,51 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.getSession + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerGetSession_Output struct { + LexiconTypeID string `json:"$type"` + Active *bool `json:"active,omitempty"` + Did string `json:"did"` + DidDoc *glexrt.LexiconTypeDecoder `json:"didDoc,omitempty"` + Email *string `json:"email,omitempty"` + EmailAuthFactor *bool `json:"emailAuthFactor,omitempty"` + EmailConfirmed *bool `json:"emailConfirmed,omitempty"` + Handle string `json:"handle"` + // status: If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. + Status *string `json:"status,omitempty"` +} + +func (t *ServerGetSession_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.getSession#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerGetSession_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerGetSession calls the XRPC method "com.atproto.server.getSession". +// +// Get information about the current auth session. Requires auth. +func ServerGetSession(ctx context.Context, c glexrt.LexClient) (*ServerGetSession_Output, error) { + var out ServerGetSession_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.server.getSession", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/serverlistapppasswords.go b/pkg/comatproto/serverlistapppasswords.go new file mode 100644 index 00000000..9373c2ab --- /dev/null +++ b/pkg/comatproto/serverlistapppasswords.go @@ -0,0 +1,64 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.listAppPasswords + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerListAppPasswords_Output struct { + LexiconTypeID string `json:"$type"` + Passwords []ServerListAppPasswords_AppPassword `json:"passwords"` +} + +func (t *ServerListAppPasswords_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.listAppPasswords#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerListAppPasswords_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerListAppPasswords calls the XRPC method "com.atproto.server.listAppPasswords". +// +// List all App Passwords. +func ServerListAppPasswords(ctx context.Context, c glexrt.LexClient) (*ServerListAppPasswords_Output, error) { + var out ServerListAppPasswords_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.server.listAppPasswords", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// ServerListAppPasswords_AppPassword is a "appPassword" in the com.atproto.server.listAppPasswords schema. +type ServerListAppPasswords_AppPassword struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Name string `json:"name"` + Privileged *bool `json:"privileged,omitempty"` +} + +func (t *ServerListAppPasswords_AppPassword) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.listAppPasswords" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerListAppPasswords_AppPassword) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/serverrefreshsession.go b/pkg/comatproto/serverrefreshsession.go new file mode 100644 index 00000000..9b43257c --- /dev/null +++ b/pkg/comatproto/serverrefreshsession.go @@ -0,0 +1,50 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.refreshSession + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerRefreshSession_Output struct { + LexiconTypeID string `json:"$type"` + AccessJwt string `json:"accessJwt"` + Active *bool `json:"active,omitempty"` + Did string `json:"did"` + DidDoc *glexrt.LexiconTypeDecoder `json:"didDoc,omitempty"` + Handle string `json:"handle"` + RefreshJwt string `json:"refreshJwt"` + // status: Hosting status of the account. If not specified, then assume 'active'. + Status *string `json:"status,omitempty"` +} + +func (t *ServerRefreshSession_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.refreshSession#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerRefreshSession_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerRefreshSession calls the XRPC method "com.atproto.server.refreshSession". +// +// Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). +func ServerRefreshSession(ctx context.Context, c glexrt.LexClient) (*ServerRefreshSession_Output, error) { + var out ServerRefreshSession_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "", "com.atproto.server.refreshSession", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/serverrequestaccountdelete.go b/pkg/comatproto/serverrequestaccountdelete.go new file mode 100644 index 00000000..5b5203eb --- /dev/null +++ b/pkg/comatproto/serverrequestaccountdelete.go @@ -0,0 +1,22 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.requestAccountDelete + +package comatproto + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// ServerRequestAccountDelete calls the XRPC method "com.atproto.server.requestAccountDelete". +// +// Initiate a user account deletion via email. +func ServerRequestAccountDelete(ctx context.Context, c glexrt.LexClient) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "", "com.atproto.server.requestAccountDelete", nil, nil, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverrequestemailconfirmation.go b/pkg/comatproto/serverrequestemailconfirmation.go new file mode 100644 index 00000000..3cbe6fbe --- /dev/null +++ b/pkg/comatproto/serverrequestemailconfirmation.go @@ -0,0 +1,22 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.requestEmailConfirmation + +package comatproto + +import ( + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// ServerRequestEmailConfirmation calls the XRPC method "com.atproto.server.requestEmailConfirmation". +// +// Request an email with a code to confirm ownership of email. +func ServerRequestEmailConfirmation(ctx context.Context, c glexrt.LexClient) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "", "com.atproto.server.requestEmailConfirmation", nil, nil, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverrequestemailupdate.go b/pkg/comatproto/serverrequestemailupdate.go new file mode 100644 index 00000000..dedf613d --- /dev/null +++ b/pkg/comatproto/serverrequestemailupdate.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.requestEmailUpdate + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerRequestEmailUpdate_Output struct { + LexiconTypeID string `json:"$type"` + TokenRequired bool `json:"tokenRequired"` +} + +func (t *ServerRequestEmailUpdate_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.requestEmailUpdate#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerRequestEmailUpdate_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerRequestEmailUpdate calls the XRPC method "com.atproto.server.requestEmailUpdate". +// +// Request a token in order to update email. +func ServerRequestEmailUpdate(ctx context.Context, c glexrt.LexClient) (*ServerRequestEmailUpdate_Output, error) { + var out ServerRequestEmailUpdate_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "", "com.atproto.server.requestEmailUpdate", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/serverrequestpasswordreset.go b/pkg/comatproto/serverrequestpasswordreset.go new file mode 100644 index 00000000..aa3b10ac --- /dev/null +++ b/pkg/comatproto/serverrequestpasswordreset.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.requestPasswordReset + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerRequestPasswordReset_Input struct { + LexiconTypeID string `json:"$type"` + Email string `json:"email"` +} + +func (t *ServerRequestPasswordReset_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.requestPasswordReset#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerRequestPasswordReset_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerRequestPasswordReset calls the XRPC method "com.atproto.server.requestPasswordReset". +// +// Initiate a user account password reset via email. +func ServerRequestPasswordReset(ctx context.Context, c glexrt.LexClient, input *ServerRequestPasswordReset_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.requestPasswordReset", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverreservesigningkey.go b/pkg/comatproto/serverreservesigningkey.go new file mode 100644 index 00000000..a61f49dc --- /dev/null +++ b/pkg/comatproto/serverreservesigningkey.go @@ -0,0 +1,63 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.reserveSigningKey + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerReserveSigningKey_Input struct { + LexiconTypeID string `json:"$type"` + // did: The DID to reserve a key for. + Did *string `json:"did,omitempty"` +} + +func (t *ServerReserveSigningKey_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.reserveSigningKey#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerReserveSigningKey_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ServerReserveSigningKey_Output struct { + LexiconTypeID string `json:"$type"` + // signingKey: The public key for the reserved signing key, in did:key serialization. + SigningKey string `json:"signingKey"` +} + +func (t *ServerReserveSigningKey_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.reserveSigningKey#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerReserveSigningKey_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerReserveSigningKey calls the XRPC method "com.atproto.server.reserveSigningKey". +// +// Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. +func ServerReserveSigningKey(ctx context.Context, c glexrt.LexClient, input *ServerReserveSigningKey_Input) (*ServerReserveSigningKey_Output, error) { + var out ServerReserveSigningKey_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.reserveSigningKey", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/serverresetpassword.go b/pkg/comatproto/serverresetpassword.go new file mode 100644 index 00000000..68c36a37 --- /dev/null +++ b/pkg/comatproto/serverresetpassword.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.resetPassword + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerResetPassword_Input struct { + LexiconTypeID string `json:"$type"` + Password string `json:"password"` + Token string `json:"token"` +} + +func (t *ServerResetPassword_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.resetPassword#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerResetPassword_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerResetPassword calls the XRPC method "com.atproto.server.resetPassword". +// +// Reset a user account password using a token. +func ServerResetPassword(ctx context.Context, c glexrt.LexClient, input *ServerResetPassword_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.resetPassword", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverrevokeapppassword.go b/pkg/comatproto/serverrevokeapppassword.go new file mode 100644 index 00000000..e6cc49da --- /dev/null +++ b/pkg/comatproto/serverrevokeapppassword.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.revokeAppPassword + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerRevokeAppPassword_Input struct { + LexiconTypeID string `json:"$type"` + Name string `json:"name"` +} + +func (t *ServerRevokeAppPassword_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.revokeAppPassword#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerRevokeAppPassword_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerRevokeAppPassword calls the XRPC method "com.atproto.server.revokeAppPassword". +// +// Revoke an App Password by name. +func ServerRevokeAppPassword(ctx context.Context, c glexrt.LexClient, input *ServerRevokeAppPassword_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.revokeAppPassword", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/serverupdateemail.go b/pkg/comatproto/serverupdateemail.go new file mode 100644 index 00000000..a1a549be --- /dev/null +++ b/pkg/comatproto/serverupdateemail.go @@ -0,0 +1,45 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.server.updateEmail + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerUpdateEmail_Input struct { + LexiconTypeID string `json:"$type"` + Email string `json:"email"` + EmailAuthFactor *bool `json:"emailAuthFactor,omitempty"` + // token: Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. + Token *string `json:"token,omitempty"` +} + +func (t *ServerUpdateEmail_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.server.updateEmail#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerUpdateEmail_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerUpdateEmail calls the XRPC method "com.atproto.server.updateEmail". +// +// Update an account's email. +func ServerUpdateEmail(ctx context.Context, c glexrt.LexClient, input *ServerUpdateEmail_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.server.updateEmail", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/syncdefs.go b/pkg/comatproto/syncdefs.go new file mode 100644 index 00000000..74989665 --- /dev/null +++ b/pkg/comatproto/syncdefs.go @@ -0,0 +1,5 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.defs + +package comatproto diff --git a/pkg/comatproto/syncgetblob.go b/pkg/comatproto/syncgetblob.go new file mode 100644 index 00000000..d48ea8cd --- /dev/null +++ b/pkg/comatproto/syncgetblob.go @@ -0,0 +1,31 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getBlob + +package comatproto + +import ( + "bytes" + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// SyncGetBlob calls the XRPC method "com.atproto.sync.getBlob". +// +// Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. +// +// cid: The CID of the blob to fetch +// did: The DID of the account. +func SyncGetBlob(ctx context.Context, c glexrt.LexClient, cid string, did string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + params["cid"] = cid + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getBlob", params, nil, buf); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/pkg/comatproto/syncgetblocks.go b/pkg/comatproto/syncgetblocks.go new file mode 100644 index 00000000..e10f8e1c --- /dev/null +++ b/pkg/comatproto/syncgetblocks.go @@ -0,0 +1,30 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getBlocks + +package comatproto + +import ( + "bytes" + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// SyncGetBlocks calls the XRPC method "com.atproto.sync.getBlocks". +// +// Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. +// +// did: The DID of the repo. +func SyncGetBlocks(ctx context.Context, c glexrt.LexClient, cids []string, did string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + params["cids"] = cids + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getBlocks", params, nil, buf); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/pkg/comatproto/syncgetcheckout.go b/pkg/comatproto/syncgetcheckout.go new file mode 100644 index 00000000..c55b9ddc --- /dev/null +++ b/pkg/comatproto/syncgetcheckout.go @@ -0,0 +1,29 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getCheckout + +package comatproto + +import ( + "bytes" + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// SyncGetCheckout calls the XRPC method "com.atproto.sync.getCheckout". +// +// # DEPRECATED - please use com.atproto.sync.getRepo instead +// +// did: The DID of the repo. +func SyncGetCheckout(ctx context.Context, c glexrt.LexClient, did string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getCheckout", params, nil, buf); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/pkg/comatproto/syncgethead.go b/pkg/comatproto/syncgethead.go new file mode 100644 index 00000000..1520ffc5 --- /dev/null +++ b/pkg/comatproto/syncgethead.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getHead + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncGetHead_Output struct { + LexiconTypeID string `json:"$type"` + Root string `json:"root"` +} + +func (t *SyncGetHead_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.getHead#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncGetHead_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncGetHead calls the XRPC method "com.atproto.sync.getHead". +// +// # DEPRECATED - please use com.atproto.sync.getLatestCommit instead +// +// did: The DID of the repo. +func SyncGetHead(ctx context.Context, c glexrt.LexClient, did string) (*SyncGetHead_Output, error) { + var out SyncGetHead_Output + + params := map[string]interface{}{} + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getHead", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/syncgethoststatus.go b/pkg/comatproto/syncgethoststatus.go new file mode 100644 index 00000000..fb48d23f --- /dev/null +++ b/pkg/comatproto/syncgethoststatus.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getHostStatus + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncGetHostStatus_Output struct { + LexiconTypeID string `json:"$type"` + // accountCount: Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts. + AccountCount *int64 `json:"accountCount,omitempty"` + Hostname string `json:"hostname"` + // seq: Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). + Seq *int64 `json:"seq,omitempty"` + Status *string `json:"status,omitempty"` +} + +func (t *SyncGetHostStatus_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.getHostStatus#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncGetHostStatus_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncGetHostStatus calls the XRPC method "com.atproto.sync.getHostStatus". +// +// Returns information about a specified upstream host, as consumed by the server. Implemented by relays. +// +// hostname: Hostname of the host (eg, PDS or relay) being queried. +func SyncGetHostStatus(ctx context.Context, c glexrt.LexClient, hostname string) (*SyncGetHostStatus_Output, error) { + var out SyncGetHostStatus_Output + + params := map[string]interface{}{} + params["hostname"] = hostname + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getHostStatus", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/syncgetlatestcommit.go b/pkg/comatproto/syncgetlatestcommit.go new file mode 100644 index 00000000..1170a0a2 --- /dev/null +++ b/pkg/comatproto/syncgetlatestcommit.go @@ -0,0 +1,49 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getLatestCommit + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncGetLatestCommit_Output struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Rev string `json:"rev"` +} + +func (t *SyncGetLatestCommit_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.getLatestCommit#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncGetLatestCommit_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncGetLatestCommit calls the XRPC method "com.atproto.sync.getLatestCommit". +// +// Get the current commit CID & revision of the specified repo. Does not require auth. +// +// did: The DID of the repo. +func SyncGetLatestCommit(ctx context.Context, c glexrt.LexClient, did string) (*SyncGetLatestCommit_Output, error) { + var out SyncGetLatestCommit_Output + + params := map[string]interface{}{} + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getLatestCommit", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/syncgetrecord.go b/pkg/comatproto/syncgetrecord.go new file mode 100644 index 00000000..a30a7de0 --- /dev/null +++ b/pkg/comatproto/syncgetrecord.go @@ -0,0 +1,32 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getRecord + +package comatproto + +import ( + "bytes" + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// SyncGetRecord calls the XRPC method "com.atproto.sync.getRecord". +// +// Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. +// +// did: The DID of the repo. +// rkey: Record Key +func SyncGetRecord(ctx context.Context, c glexrt.LexClient, collection string, did string, rkey string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + params["collection"] = collection + params["did"] = did + params["rkey"] = rkey + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getRecord", params, nil, buf); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/pkg/comatproto/syncgetrepo.go b/pkg/comatproto/syncgetrepo.go new file mode 100644 index 00000000..763746c5 --- /dev/null +++ b/pkg/comatproto/syncgetrepo.go @@ -0,0 +1,33 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getRepo + +package comatproto + +import ( + "bytes" + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// SyncGetRepo calls the XRPC method "com.atproto.sync.getRepo". +// +// Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS. +// +// did: The DID of the repo. +// since: The revision ('rev') of the repo to create a diff from. +func SyncGetRepo(ctx context.Context, c glexrt.LexClient, did string, since string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + if since != "" { + params["since"] = since + } + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getRepo", params, nil, buf); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/pkg/comatproto/syncgetrepostatus.go b/pkg/comatproto/syncgetrepostatus.go new file mode 100644 index 00000000..3f778ae1 --- /dev/null +++ b/pkg/comatproto/syncgetrepostatus.go @@ -0,0 +1,53 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.getRepoStatus + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncGetRepoStatus_Output struct { + LexiconTypeID string `json:"$type"` + Active bool `json:"active"` + Did string `json:"did"` + // rev: Optional field, the current rev of the repo, if active=true + Rev *string `json:"rev,omitempty"` + // status: If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. + Status *string `json:"status,omitempty"` +} + +func (t *SyncGetRepoStatus_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.getRepoStatus#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncGetRepoStatus_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncGetRepoStatus calls the XRPC method "com.atproto.sync.getRepoStatus". +// +// Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. +// +// did: The DID of the repo. +func SyncGetRepoStatus(ctx context.Context, c glexrt.LexClient, did string) (*SyncGetRepoStatus_Output, error) { + var out SyncGetRepoStatus_Output + + params := map[string]interface{}{} + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.getRepoStatus", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/synclistblobs.go b/pkg/comatproto/synclistblobs.go new file mode 100644 index 00000000..05065360 --- /dev/null +++ b/pkg/comatproto/synclistblobs.go @@ -0,0 +1,59 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.listBlobs + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncListBlobs_Output struct { + LexiconTypeID string `json:"$type"` + Cids []string `json:"cids"` + Cursor *string `json:"cursor,omitempty"` +} + +func (t *SyncListBlobs_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.listBlobs#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncListBlobs_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncListBlobs calls the XRPC method "com.atproto.sync.listBlobs". +// +// List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. +// +// did: The DID of the repo. +// since: Optional revision of the repo to list blobs since. +func SyncListBlobs(ctx context.Context, c glexrt.LexClient, cursor string, did string, limit *int64, since string) (*SyncListBlobs_Output, error) { + var out SyncListBlobs_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + if since != "" { + params["since"] = since + } + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.listBlobs", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/synclisthosts.go b/pkg/comatproto/synclisthosts.go new file mode 100644 index 00000000..502a5f45 --- /dev/null +++ b/pkg/comatproto/synclisthosts.go @@ -0,0 +1,77 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.listHosts + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncListHosts_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + // hosts: Sort order is not formally specified. Recommended order is by time host was first seen by the server, with oldest first. + Hosts []SyncListHosts_Host `json:"hosts"` +} + +func (t *SyncListHosts_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.listHosts#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncListHosts_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncListHosts calls the XRPC method "com.atproto.sync.listHosts". +// +// Enumerates upstream hosts (eg, PDS or relay instances) that this service consumes from. Implemented by relays. +func SyncListHosts(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*SyncListHosts_Output, error) { + var out SyncListHosts_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.listHosts", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// SyncListHosts_Host is a "host" in the com.atproto.sync.listHosts schema. +type SyncListHosts_Host struct { + LexiconTypeID string `json:"$type"` + AccountCount *int64 `json:"accountCount,omitempty"` + // hostname: hostname of server; not a URL (no scheme) + Hostname string `json:"hostname"` + // seq: Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). + Seq *int64 `json:"seq,omitempty"` + Status *string `json:"status,omitempty"` +} + +func (t *SyncListHosts_Host) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.listHosts" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncListHosts_Host) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/synclistrepos.go b/pkg/comatproto/synclistrepos.go new file mode 100644 index 00000000..828faa56 --- /dev/null +++ b/pkg/comatproto/synclistrepos.go @@ -0,0 +1,77 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.listRepos + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncListRepos_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Repos []SyncListRepos_Repo `json:"repos"` +} + +func (t *SyncListRepos_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.listRepos#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncListRepos_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncListRepos calls the XRPC method "com.atproto.sync.listRepos". +// +// Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay. +func SyncListRepos(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*SyncListRepos_Output, error) { + var out SyncListRepos_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.listRepos", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// SyncListRepos_Repo is a "repo" in the com.atproto.sync.listRepos schema. +type SyncListRepos_Repo struct { + LexiconTypeID string `json:"$type"` + Active *bool `json:"active,omitempty"` + Did string `json:"did"` + // head: Current repo commit CID + Head string `json:"head"` + Rev string `json:"rev"` + // status: If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. + Status *string `json:"status,omitempty"` +} + +func (t *SyncListRepos_Repo) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.listRepos" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncListRepos_Repo) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/synclistreposbycollection.go b/pkg/comatproto/synclistreposbycollection.go new file mode 100644 index 00000000..7e0deb52 --- /dev/null +++ b/pkg/comatproto/synclistreposbycollection.go @@ -0,0 +1,74 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.listReposByCollection + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncListReposByCollection_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Repos []SyncListReposByCollection_Repo `json:"repos"` +} + +func (t *SyncListReposByCollection_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.listReposByCollection#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncListReposByCollection_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncListReposByCollection calls the XRPC method "com.atproto.sync.listReposByCollection". +// +// Enumerates all the DIDs which have records with the given collection NSID. +// +// limit: Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. +func SyncListReposByCollection(ctx context.Context, c glexrt.LexClient, collection string, cursor string, limit *int64) (*SyncListReposByCollection_Output, error) { + var out SyncListReposByCollection_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["collection"] = collection + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.sync.listReposByCollection", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// SyncListReposByCollection_Repo is a "repo" in the com.atproto.sync.listReposByCollection schema. +type SyncListReposByCollection_Repo struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` +} + +func (t *SyncListReposByCollection_Repo) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.listReposByCollection" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncListReposByCollection_Repo) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/syncnotifyofupdate.go b/pkg/comatproto/syncnotifyofupdate.go new file mode 100644 index 00000000..0d685f6d --- /dev/null +++ b/pkg/comatproto/syncnotifyofupdate.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.notifyOfUpdate + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncNotifyOfUpdate_Input struct { + LexiconTypeID string `json:"$type"` + // hostname: Hostname of the current service (usually a PDS) that is notifying of update. + Hostname string `json:"hostname"` +} + +func (t *SyncNotifyOfUpdate_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.notifyOfUpdate#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncNotifyOfUpdate_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncNotifyOfUpdate calls the XRPC method "com.atproto.sync.notifyOfUpdate". +// +// Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. DEPRECATED: just use com.atproto.sync.requestCrawl +func SyncNotifyOfUpdate(ctx context.Context, c glexrt.LexClient, input *SyncNotifyOfUpdate_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.sync.notifyOfUpdate", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/syncrequestcrawl.go b/pkg/comatproto/syncrequestcrawl.go new file mode 100644 index 00000000..904b200d --- /dev/null +++ b/pkg/comatproto/syncrequestcrawl.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.requestCrawl + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type SyncRequestCrawl_Input struct { + LexiconTypeID string `json:"$type"` + // hostname: Hostname of the current service (eg, PDS) that is requesting to be crawled. + Hostname string `json:"hostname"` +} + +func (t *SyncRequestCrawl_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.requestCrawl#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncRequestCrawl_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncRequestCrawl calls the XRPC method "com.atproto.sync.requestCrawl". +// +// Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. +func SyncRequestCrawl(ctx context.Context, c glexrt.LexClient, input *SyncRequestCrawl_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.sync.requestCrawl", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/syncsubscriberepos.go b/pkg/comatproto/syncsubscriberepos.go new file mode 100644 index 00000000..bd0648d3 --- /dev/null +++ b/pkg/comatproto/syncsubscriberepos.go @@ -0,0 +1,182 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.sync.subscribeRepos + +package comatproto + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// SyncSubscribeRepos_Account is a "account" in the com.atproto.sync.subscribeRepos schema. +// +// Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. +type SyncSubscribeRepos_Account struct { + LexiconTypeID string `json:"$type"` + // active: Indicates that the account has a repository which can be fetched from the host that emitted this event. + Active bool `json:"active"` + Did string `json:"did"` + Seq int64 `json:"seq"` + // status: If active=false, this optional field indicates a reason for why the account is not active. + Status *string `json:"status,omitempty"` + Time string `json:"time"` +} + +func (t *SyncSubscribeRepos_Account) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.subscribeRepos" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncSubscribeRepos_Account) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncSubscribeRepos_Commit is a "commit" in the com.atproto.sync.subscribeRepos schema. +// +// Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. +type SyncSubscribeRepos_Commit struct { + LexiconTypeID string `json:"$type"` + Blobs []glexrt.Link `json:"blobs"` + // blocks: CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list. + Blocks glexrt.Bytes `json:"blocks"` + // commit: Repo commit object CID. + Commit glexrt.Link `json:"commit"` + Ops []SyncSubscribeRepos_RepoOp `json:"ops"` + // prevData: The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose. + PrevData *glexrt.Link `json:"prevData,omitempty"` + // rebase: DEPRECATED -- unused + Rebase bool `json:"rebase"` + // repo: The repo this event comes from. Note that all other message types name this field 'did'. + Repo string `json:"repo"` + // rev: The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event. + Rev string `json:"rev"` + // seq: The stream sequence number of this message. + Seq int64 `json:"seq"` + // since: The rev of the last emitted commit from this repo (if any). + Since string `json:"since"` + // time: Timestamp of when this message was originally broadcast. + Time string `json:"time"` + // tooBig: DEPRECATED -- replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data. + TooBig bool `json:"tooBig"` +} + +func (t *SyncSubscribeRepos_Commit) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.subscribeRepos" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncSubscribeRepos_Commit) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncSubscribeRepos_Identity is a "identity" in the com.atproto.sync.subscribeRepos schema. +// +// Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. +type SyncSubscribeRepos_Identity struct { + LexiconTypeID string `json:"$type"` + Did string `json:"did"` + // handle: The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. + Handle *string `json:"handle,omitempty"` + Seq int64 `json:"seq"` + Time string `json:"time"` +} + +func (t *SyncSubscribeRepos_Identity) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.subscribeRepos" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncSubscribeRepos_Identity) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncSubscribeRepos_Info is a "info" in the com.atproto.sync.subscribeRepos schema. +type SyncSubscribeRepos_Info struct { + LexiconTypeID string `json:"$type"` + Message *string `json:"message,omitempty"` + Name string `json:"name"` +} + +func (t *SyncSubscribeRepos_Info) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.subscribeRepos" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncSubscribeRepos_Info) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncSubscribeRepos_RepoOp is a "repoOp" in the com.atproto.sync.subscribeRepos schema. +// +// A repo operation, ie a mutation of a single record. +type SyncSubscribeRepos_RepoOp struct { + LexiconTypeID string `json:"$type"` + Action string `json:"action"` + // cid: For creates and updates, the new record CID. For deletions, null. + Cid glexrt.Link `json:"cid"` + Path string `json:"path"` + // prev: For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined. + Prev *glexrt.Link `json:"prev,omitempty"` +} + +func (t *SyncSubscribeRepos_RepoOp) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.subscribeRepos" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncSubscribeRepos_RepoOp) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// SyncSubscribeRepos_Sync is a "sync" in the com.atproto.sync.subscribeRepos schema. +// +// Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. +type SyncSubscribeRepos_Sync struct { + LexiconTypeID string `json:"$type"` + // blocks: CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'. + Blocks glexrt.Bytes `json:"blocks"` + // did: The account this repo event corresponds to. Must match that in the commit object. + Did string `json:"did"` + // rev: The rev of the commit. This value must match that in the commit object. + Rev string `json:"rev"` + // seq: The stream sequence number of this message. + Seq int64 `json:"seq"` + // time: Timestamp of when this message was originally broadcast. + Time string `json:"time"` +} + +func (t *SyncSubscribeRepos_Sync) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.sync.subscribeRepos" + return glexrt.MarshalCBOR(w, t) +} + +func (t *SyncSubscribeRepos_Sync) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/tempaddreservedhandle.go b/pkg/comatproto/tempaddreservedhandle.go new file mode 100644 index 00000000..1e15755a --- /dev/null +++ b/pkg/comatproto/tempaddreservedhandle.go @@ -0,0 +1,60 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.temp.addReservedHandle + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type TempAddReservedHandle_Input struct { + LexiconTypeID string `json:"$type"` + Handle string `json:"handle"` +} + +func (t *TempAddReservedHandle_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.addReservedHandle#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempAddReservedHandle_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type TempAddReservedHandle_Output struct { + LexiconTypeID string `json:"$type"` +} + +func (t *TempAddReservedHandle_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.addReservedHandle#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempAddReservedHandle_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempAddReservedHandle calls the XRPC method "com.atproto.temp.addReservedHandle". +// +// Add a handle to the set of reserved handles. +func TempAddReservedHandle(ctx context.Context, c glexrt.LexClient, input *TempAddReservedHandle_Input) (*TempAddReservedHandle_Output, error) { + var out TempAddReservedHandle_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.temp.addReservedHandle", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/tempcheckhandleavailability.go b/pkg/comatproto/tempcheckhandleavailability.go new file mode 100644 index 00000000..b9bc302a --- /dev/null +++ b/pkg/comatproto/tempcheckhandleavailability.go @@ -0,0 +1,192 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.temp.checkHandleAvailability + +package comatproto + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type TempCheckHandleAvailability_Output struct { + LexiconTypeID string `json:"$type"` + // handle: Echo of the input handle. + Handle string `json:"handle"` + Result TempCheckHandleAvailability_Output_Result `json:"result"` +} + +func (t *TempCheckHandleAvailability_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.checkHandleAvailability#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempCheckHandleAvailability_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type TempCheckHandleAvailability_Output_Result struct { + TempCheckHandleAvailability_ResultAvailable *TempCheckHandleAvailability_ResultAvailable + TempCheckHandleAvailability_ResultUnavailable *TempCheckHandleAvailability_ResultUnavailable +} + +func (t *TempCheckHandleAvailability_Output_Result) MarshalJSON() ([]byte, error) { + if t.TempCheckHandleAvailability_ResultAvailable != nil { + t.TempCheckHandleAvailability_ResultAvailable.LexiconTypeID = "com.atproto.temp.checkHandleAvailability#resultAvailable" + return json.Marshal(t.TempCheckHandleAvailability_ResultAvailable) + } + if t.TempCheckHandleAvailability_ResultUnavailable != nil { + t.TempCheckHandleAvailability_ResultUnavailable.LexiconTypeID = "com.atproto.temp.checkHandleAvailability#resultUnavailable" + return json.Marshal(t.TempCheckHandleAvailability_ResultUnavailable) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *TempCheckHandleAvailability_Output_Result) UnmarshalJSON(b []byte) error { + typ, err := glexrt.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.temp.checkHandleAvailability#resultAvailable": + t.TempCheckHandleAvailability_ResultAvailable = new(TempCheckHandleAvailability_ResultAvailable) + return json.Unmarshal(b, t.TempCheckHandleAvailability_ResultAvailable) + case "com.atproto.temp.checkHandleAvailability#resultUnavailable": + t.TempCheckHandleAvailability_ResultUnavailable = new(TempCheckHandleAvailability_ResultUnavailable) + return json.Unmarshal(b, t.TempCheckHandleAvailability_ResultUnavailable) + default: + return nil + } +} + +func (t *TempCheckHandleAvailability_Output_Result) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.TempCheckHandleAvailability_ResultAvailable != nil { + return t.TempCheckHandleAvailability_ResultAvailable.MarshalCBOR(w) + } + if t.TempCheckHandleAvailability_ResultUnavailable != nil { + return t.TempCheckHandleAvailability_ResultUnavailable.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *TempCheckHandleAvailability_Output_Result) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.temp.checkHandleAvailability#resultAvailable": + t.TempCheckHandleAvailability_ResultAvailable = new(TempCheckHandleAvailability_ResultAvailable) + return t.TempCheckHandleAvailability_ResultAvailable.UnmarshalCBOR(bytes.NewReader(b)) + case "com.atproto.temp.checkHandleAvailability#resultUnavailable": + t.TempCheckHandleAvailability_ResultUnavailable = new(TempCheckHandleAvailability_ResultUnavailable) + return t.TempCheckHandleAvailability_ResultUnavailable.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// TempCheckHandleAvailability calls the XRPC method "com.atproto.temp.checkHandleAvailability". +// +// Checks whether the provided handle is available. If the handle is not available, available suggestions will be returned. Optional inputs will be used to generate suggestions. +// +// birthDate: User-provided birth date. Might be used to build handle suggestions. +// email: User-provided email. Might be used to build handle suggestions. +// handle: Tentative handle. Will be checked for availability or used to build handle suggestions. +func TempCheckHandleAvailability(ctx context.Context, c glexrt.LexClient, birthDate string, email string, handle string) (*TempCheckHandleAvailability_Output, error) { + var out TempCheckHandleAvailability_Output + + params := map[string]interface{}{} + if birthDate != "" { + params["birthDate"] = birthDate + } + if email != "" { + params["email"] = email + } + params["handle"] = handle + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.temp.checkHandleAvailability", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// TempCheckHandleAvailability_ResultAvailable is a "resultAvailable" in the com.atproto.temp.checkHandleAvailability schema. +// +// Indicates the provided handle is available. +type TempCheckHandleAvailability_ResultAvailable struct { + LexiconTypeID string `json:"$type"` +} + +func (t *TempCheckHandleAvailability_ResultAvailable) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.checkHandleAvailability" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempCheckHandleAvailability_ResultAvailable) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempCheckHandleAvailability_ResultUnavailable is a "resultUnavailable" in the com.atproto.temp.checkHandleAvailability schema. +// +// Indicates the provided handle is unavailable and gives suggestions of available handles. +type TempCheckHandleAvailability_ResultUnavailable struct { + LexiconTypeID string `json:"$type"` + // suggestions: List of suggested handles based on the provided inputs. + Suggestions []TempCheckHandleAvailability_Suggestion `json:"suggestions"` +} + +func (t *TempCheckHandleAvailability_ResultUnavailable) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.checkHandleAvailability" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempCheckHandleAvailability_ResultUnavailable) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempCheckHandleAvailability_Suggestion is a "suggestion" in the com.atproto.temp.checkHandleAvailability schema. +type TempCheckHandleAvailability_Suggestion struct { + LexiconTypeID string `json:"$type"` + Handle string `json:"handle"` + // method: Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics. + Method string `json:"method"` +} + +func (t *TempCheckHandleAvailability_Suggestion) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.checkHandleAvailability" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempCheckHandleAvailability_Suggestion) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/comatproto/tempchecksignupqueue.go b/pkg/comatproto/tempchecksignupqueue.go new file mode 100644 index 00000000..f1f77d5b --- /dev/null +++ b/pkg/comatproto/tempchecksignupqueue.go @@ -0,0 +1,45 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.temp.checkSignupQueue + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type TempCheckSignupQueue_Output struct { + LexiconTypeID string `json:"$type"` + Activated bool `json:"activated"` + EstimatedTimeMs *int64 `json:"estimatedTimeMs,omitempty"` + PlaceInQueue *int64 `json:"placeInQueue,omitempty"` +} + +func (t *TempCheckSignupQueue_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.checkSignupQueue#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempCheckSignupQueue_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempCheckSignupQueue calls the XRPC method "com.atproto.temp.checkSignupQueue". +// +// Check accounts location in signup queue. +func TempCheckSignupQueue(ctx context.Context, c glexrt.LexClient) (*TempCheckSignupQueue_Output, error) { + var out TempCheckSignupQueue_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.temp.checkSignupQueue", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/tempdereferencescope.go b/pkg/comatproto/tempdereferencescope.go new file mode 100644 index 00000000..ae417e7b --- /dev/null +++ b/pkg/comatproto/tempdereferencescope.go @@ -0,0 +1,49 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.temp.dereferenceScope + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type TempDereferenceScope_Output struct { + LexiconTypeID string `json:"$type"` + // scope: The full oauth permission scope + Scope string `json:"scope"` +} + +func (t *TempDereferenceScope_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.dereferenceScope#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempDereferenceScope_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempDereferenceScope calls the XRPC method "com.atproto.temp.dereferenceScope". +// +// # Allows finding the oauth permission scope from a reference +// +// scope: The scope reference (starts with 'ref:') +func TempDereferenceScope(ctx context.Context, c glexrt.LexClient, scope string) (*TempDereferenceScope_Output, error) { + var out TempDereferenceScope_Output + + params := map[string]interface{}{} + params["scope"] = scope + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.temp.dereferenceScope", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/tempfetchlabels.go b/pkg/comatproto/tempfetchlabels.go new file mode 100644 index 00000000..6e4635db --- /dev/null +++ b/pkg/comatproto/tempfetchlabels.go @@ -0,0 +1,51 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.temp.fetchLabels + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type TempFetchLabels_Output struct { + LexiconTypeID string `json:"$type"` + Labels []LabelDefs_Label `json:"labels"` +} + +func (t *TempFetchLabels_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.fetchLabels#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempFetchLabels_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempFetchLabels calls the XRPC method "com.atproto.temp.fetchLabels". +// +// DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date. +func TempFetchLabels(ctx context.Context, c glexrt.LexClient, limit *int64, since *int64) (*TempFetchLabels_Output, error) { + var out TempFetchLabels_Output + + params := map[string]interface{}{} + if limit != nil { + params["limit"] = *limit + } + if since != nil { + params["since"] = *since + } + + if err := c.LexDo(ctx, glexrt.Query, "", "com.atproto.temp.fetchLabels", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/comatproto/temprequestphoneverification.go b/pkg/comatproto/temprequestphoneverification.go new file mode 100644 index 00000000..c358a8ed --- /dev/null +++ b/pkg/comatproto/temprequestphoneverification.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.temp.requestPhoneVerification + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type TempRequestPhoneVerification_Input struct { + LexiconTypeID string `json:"$type"` + PhoneNumber string `json:"phoneNumber"` +} + +func (t *TempRequestPhoneVerification_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.requestPhoneVerification#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempRequestPhoneVerification_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempRequestPhoneVerification calls the XRPC method "com.atproto.temp.requestPhoneVerification". +// +// Request a verification code to be sent to the supplied phone number +func TempRequestPhoneVerification(ctx context.Context, c glexrt.LexClient, input *TempRequestPhoneVerification_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.temp.requestPhoneVerification", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/comatproto/temprevokeaccountcredentials.go b/pkg/comatproto/temprevokeaccountcredentials.go new file mode 100644 index 00000000..f26cdd2d --- /dev/null +++ b/pkg/comatproto/temprevokeaccountcredentials.go @@ -0,0 +1,42 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: com.atproto.temp.revokeAccountCredentials + +package comatproto + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type TempRevokeAccountCredentials_Input struct { + LexiconTypeID string `json:"$type"` + Account string `json:"account"` +} + +func (t *TempRevokeAccountCredentials_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "com.atproto.temp.revokeAccountCredentials#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *TempRevokeAccountCredentials_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// TempRevokeAccountCredentials calls the XRPC method "com.atproto.temp.revokeAccountCredentials". +// +// Revoke sessions, password, and app passwords associated with account. May be resolved by a password reset. +func TempRevokeAccountCredentials(ctx context.Context, c glexrt.LexClient, input *TempRevokeAccountCredentials_Input) error { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "com.atproto.temp.revokeAccountCredentials", nil, input, nil); err != nil { + return err + } + return nil +} diff --git a/pkg/config/config.go b/pkg/config/config.go index 75a34beb..ff65e128 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -33,7 +33,7 @@ import ( "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/moderation" "stream.place/streamplace/pkg/s3" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) const SPDataDir = "$SP_DATA_DIR" diff --git a/pkg/director/stream_session.go b/pkg/director/stream_session.go index 52dc10dc..cab2a0fc 100644 --- a/pkg/director/stream_session.go +++ b/pkg/director/stream_session.go @@ -35,7 +35,7 @@ import ( "stream.place/streamplace/pkg/s3" "stream.place/streamplace/pkg/spmetrics" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/thumbnail" ) diff --git a/pkg/gamesgamesgamesgames/defs.go b/pkg/gamesgamesgamesgames/defs.go deleted file mode 100644 index 3794a125..00000000 --- a/pkg/gamesgamesgamesgames/defs.go +++ /dev/null @@ -1,829 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: games.gamesgamesgamesgames.defs - -package gamesgamesgamesgames - -import ( - "io" - - appbsky "github.com/bluesky-social/indigo/api/bsky" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -// Defs_ActorCreditView is a "actorCreditView" in the games.gamesgamesgamesgames.defs schema. -type Defs_ActorCreditView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - ActorUri *string `json:"actorUri,omitempty" cborgen:"actorUri,omitempty"` - Credits []*Defs_CreditEntry `json:"credits" cborgen:"credits"` - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_ActorCreditView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ActorCreditView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ActorProfileDetailView is a "actorProfileDetailView" in the games.gamesgamesgamesgames.defs schema. -type Defs_ActorProfileDetailView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Avatar *lex.Blob `json:"avatar,omitempty" cborgen:"avatar,omitempty"` - CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` - DescriptionFacets []*appbsky.RichtextFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"` - Did string `json:"did" cborgen:"did"` - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` - Pronouns *string `json:"pronouns,omitempty" cborgen:"pronouns,omitempty"` - Uri string `json:"uri" cborgen:"uri"` - Websites []*Defs_Website `json:"websites,omitempty" cborgen:"websites,omitempty"` -} - -func (t *Defs_ActorProfileDetailView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ActorProfileDetailView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ActorProfileSummaryView is a "actorProfileSummaryView" in the games.gamesgamesgamesgames.defs schema. -type Defs_ActorProfileSummaryView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Avatar *lex.Blob `json:"avatar,omitempty" cborgen:"avatar,omitempty"` - Did string `json:"did" cborgen:"did"` - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_ActorProfileSummaryView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ActorProfileSummaryView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_AgeRating is a "ageRating" in the games.gamesgamesgamesgames.defs schema. -type Defs_AgeRating struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - ContentDescriptors []string `json:"contentDescriptors,omitempty" cborgen:"contentDescriptors,omitempty"` - Organization string `json:"organization" cborgen:"organization"` - Rating string `json:"rating" cborgen:"rating"` -} - -func (t *Defs_AgeRating) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_AgeRating) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_AlternativeName is a "alternativeName" in the games.gamesgamesgamesgames.defs schema. -type Defs_AlternativeName struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - Locale *string `json:"locale,omitempty" cborgen:"locale,omitempty"` - Name string `json:"name" cborgen:"name"` -} - -func (t *Defs_AlternativeName) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_AlternativeName) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_CollectionSummaryView is a "collectionSummaryView" in the games.gamesgamesgamesgames.defs schema. -type Defs_CollectionSummaryView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Name string `json:"name" cborgen:"name"` - Slug *string `json:"slug,omitempty" cborgen:"slug,omitempty"` - Type *string `json:"type,omitempty" cborgen:"type,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_CollectionSummaryView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_CollectionSummaryView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_CreditEntry is a "creditEntry" in the games.gamesgamesgamesgames.defs schema. -type Defs_CreditEntry struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Department *string `json:"department,omitempty" cborgen:"department,omitempty"` - Role *string `json:"role" cborgen:"role"` -} - -func (t *Defs_CreditEntry) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_CreditEntry) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_EngineSummaryView is a "engineSummaryView" in the games.gamesgamesgamesgames.defs schema. -type Defs_EngineSummaryView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Name string `json:"name" cborgen:"name"` - Slug *string `json:"slug,omitempty" cborgen:"slug,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_EngineSummaryView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_EngineSummaryView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ExternalIds is a "externalIds" in the games.gamesgamesgamesgames.defs schema. -type Defs_ExternalIds struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - AppleAppStore *string `json:"appleAppStore,omitempty" cborgen:"appleAppStore,omitempty"` - EpicGames *string `json:"epicGames,omitempty" cborgen:"epicGames,omitempty"` - Gog *string `json:"gog,omitempty" cborgen:"gog,omitempty"` - GooglePlay *string `json:"googlePlay,omitempty" cborgen:"googlePlay,omitempty"` - HumbleBundle *string `json:"humbleBundle,omitempty" cborgen:"humbleBundle,omitempty"` - Igdb *string `json:"igdb,omitempty" cborgen:"igdb,omitempty"` - ItchIo *Defs_ItchIoId `json:"itchIo,omitempty" cborgen:"itchIo,omitempty"` - NintendoEshop *string `json:"nintendoEshop,omitempty" cborgen:"nintendoEshop,omitempty"` - PlayStation *string `json:"playStation,omitempty" cborgen:"playStation,omitempty"` - Steam *string `json:"steam,omitempty" cborgen:"steam,omitempty"` - Twitch *string `json:"twitch,omitempty" cborgen:"twitch,omitempty"` - Xbox *string `json:"xbox,omitempty" cborgen:"xbox,omitempty"` -} - -func (t *Defs_ExternalIds) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ExternalIds) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ExternalVideo is a "externalVideo" in the games.gamesgamesgamesgames.defs schema. -type Defs_ExternalVideo struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Platform string `json:"platform" cborgen:"platform"` - Title *string `json:"title,omitempty" cborgen:"title,omitempty"` - VideoId string `json:"videoId" cborgen:"videoId"` -} - -func (t *Defs_ExternalVideo) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ExternalVideo) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_GameDetailView is a "gameDetailView" in the games.gamesgamesgamesgames.defs schema. -type Defs_GameDetailView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - ActorCredits []*Defs_ActorCreditView `json:"actorCredits,omitempty" cborgen:"actorCredits,omitempty"` - AgeRatings []*Defs_AgeRating `json:"ageRatings,omitempty" cborgen:"ageRatings,omitempty"` - AlternativeNames []*Defs_AlternativeName `json:"alternativeNames,omitempty" cborgen:"alternativeNames,omitempty"` - ApplicationType *string `json:"applicationType,omitempty" cborgen:"applicationType,omitempty"` - Collections []string `json:"collections,omitempty" cborgen:"collections,omitempty"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Engines []string `json:"engines,omitempty" cborgen:"engines,omitempty"` - ExternalIds *Defs_ExternalIds `json:"externalIds,omitempty" cborgen:"externalIds,omitempty"` - Genres []*string `json:"genres,omitempty" cborgen:"genres,omitempty"` - Keywords []string `json:"keywords,omitempty" cborgen:"keywords,omitempty"` - LanguageSupports []*Defs_LanguageSupport `json:"languageSupports,omitempty" cborgen:"languageSupports,omitempty"` - Media []*Defs_MediaItem `json:"media,omitempty" cborgen:"media,omitempty"` - Modes []*string `json:"modes,omitempty" cborgen:"modes,omitempty"` - MultiplayerModes []*Defs_MultiplayerMode `json:"multiplayerModes,omitempty" cborgen:"multiplayerModes,omitempty"` - Name string `json:"name" cborgen:"name"` - OrgCredits []*Defs_OrgCreditView `json:"orgCredits,omitempty" cborgen:"orgCredits,omitempty"` - Parent *string `json:"parent,omitempty" cborgen:"parent,omitempty"` - PlayerPerspectives []*string `json:"playerPerspectives,omitempty" cborgen:"playerPerspectives,omitempty"` - PublishedAt *string `json:"publishedAt,omitempty" cborgen:"publishedAt,omitempty"` - Releases []*Defs_Release `json:"releases,omitempty" cborgen:"releases,omitempty"` - Slug *string `json:"slug,omitempty" cborgen:"slug,omitempty"` - Storyline *string `json:"storyline,omitempty" cborgen:"storyline,omitempty"` - Summary *string `json:"summary,omitempty" cborgen:"summary,omitempty"` - Themes []*string `json:"themes,omitempty" cborgen:"themes,omitempty"` - TimeToBeat *Defs_TimeToBeat `json:"timeToBeat,omitempty" cborgen:"timeToBeat,omitempty"` - Uri string `json:"uri" cborgen:"uri"` - Videos []*Defs_ExternalVideo `json:"videos,omitempty" cborgen:"videos,omitempty"` - Websites []*Defs_Website `json:"websites,omitempty" cborgen:"websites,omitempty"` -} - -func (t *Defs_GameDetailView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_GameDetailView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_GameFeedViewItem is a "gameFeedViewItem" in the games.gamesgamesgamesgames.defs schema. -type Defs_GameFeedViewItem struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - FeedContext *string `json:"feedContext,omitempty" cborgen:"feedContext,omitempty"` - Game *Defs_GameView `json:"game" cborgen:"game"` -} - -func (t *Defs_GameFeedViewItem) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_GameFeedViewItem) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_GameSummaryView is a "gameSummaryView" in the games.gamesgamesgamesgames.defs schema. -type Defs_GameSummaryView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - ApplicationType *string `json:"applicationType,omitempty" cborgen:"applicationType,omitempty"` - // firstReleaseDate: Earliest release date as YYYYMMDD integer. - FirstReleaseDate *int64 `json:"firstReleaseDate,omitempty" cborgen:"firstReleaseDate,omitempty"` - Genres []*string `json:"genres,omitempty" cborgen:"genres,omitempty"` - Media []*Defs_MediaItem `json:"media,omitempty" cborgen:"media,omitempty"` - Name string `json:"name" cborgen:"name"` - Slug *string `json:"slug,omitempty" cborgen:"slug,omitempty"` - Summary *string `json:"summary,omitempty" cborgen:"summary,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_GameSummaryView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_GameSummaryView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_GameView is a "gameView" in the games.gamesgamesgamesgames.defs schema. -type Defs_GameView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - ApplicationType *string `json:"applicationType" cborgen:"applicationType"` - Genres []*string `json:"genres,omitempty" cborgen:"genres,omitempty"` - LikeCount *int64 `json:"likeCount,omitempty" cborgen:"likeCount,omitempty"` - Media []*Defs_MediaItem `json:"media,omitempty" cborgen:"media,omitempty"` - Name string `json:"name" cborgen:"name"` - Releases []*Defs_Release `json:"releases,omitempty" cborgen:"releases,omitempty"` - Slug *string `json:"slug,omitempty" cborgen:"slug,omitempty"` - Summary *string `json:"summary,omitempty" cborgen:"summary,omitempty"` - Themes []*string `json:"themes,omitempty" cborgen:"themes,omitempty"` - Uri string `json:"uri" cborgen:"uri"` - Viewer *Defs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` -} - -func (t *Defs_GameView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_GameView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ItchIoId is a "itchIoId" in the games.gamesgamesgamesgames.defs schema. -type Defs_ItchIoId struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Developer string `json:"developer" cborgen:"developer"` - Game string `json:"game" cborgen:"game"` -} - -func (t *Defs_ItchIoId) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ItchIoId) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_LanguageSupport is a "languageSupport" in the games.gamesgamesgamesgames.defs schema. -type Defs_LanguageSupport struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Audio *bool `json:"audio,omitempty" cborgen:"audio,omitempty"` - Interface *bool `json:"interface,omitempty" cborgen:"interface,omitempty"` - Language string `json:"language" cborgen:"language"` - Subtitles *bool `json:"subtitles,omitempty" cborgen:"subtitles,omitempty"` -} - -func (t *Defs_LanguageSupport) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_LanguageSupport) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_MediaItem is a "mediaItem" in the games.gamesgamesgamesgames.defs schema. -type Defs_MediaItem struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Blob *lex.Blob `json:"blob,omitempty" cborgen:"blob,omitempty"` - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` - Height *int64 `json:"height,omitempty" cborgen:"height,omitempty"` - Locale *string `json:"locale,omitempty" cborgen:"locale,omitempty"` - MediaType *string `json:"mediaType,omitempty" cborgen:"mediaType,omitempty"` - Title *string `json:"title,omitempty" cborgen:"title,omitempty"` - Width *int64 `json:"width,omitempty" cborgen:"width,omitempty"` -} - -func (t *Defs_MediaItem) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_MediaItem) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_MultiplayerMode is a "multiplayerMode" in the games.gamesgamesgamesgames.defs schema. -type Defs_MultiplayerMode struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - HasCampaignCoop *bool `json:"hasCampaignCoop,omitempty" cborgen:"hasCampaignCoop,omitempty"` - HasDropIn *bool `json:"hasDropIn,omitempty" cborgen:"hasDropIn,omitempty"` - HasLanCoop *bool `json:"hasLanCoop,omitempty" cborgen:"hasLanCoop,omitempty"` - HasSplitscreen *bool `json:"hasSplitscreen,omitempty" cborgen:"hasSplitscreen,omitempty"` - HasSplitscreenOnline *bool `json:"hasSplitscreenOnline,omitempty" cborgen:"hasSplitscreenOnline,omitempty"` - OfflineCoopMax *int64 `json:"offlineCoopMax,omitempty" cborgen:"offlineCoopMax,omitempty"` - OfflineMax *int64 `json:"offlineMax,omitempty" cborgen:"offlineMax,omitempty"` - OnlineCoopMax *int64 `json:"onlineCoopMax,omitempty" cborgen:"onlineCoopMax,omitempty"` - OnlineMax *int64 `json:"onlineMax,omitempty" cborgen:"onlineMax,omitempty"` - Platform *string `json:"platform,omitempty" cborgen:"platform,omitempty"` -} - -func (t *Defs_MultiplayerMode) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_MultiplayerMode) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_OrgCreditView is a "orgCreditView" in the games.gamesgamesgamesgames.defs schema. -type Defs_OrgCreditView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` - OrgUri *string `json:"orgUri,omitempty" cborgen:"orgUri,omitempty"` - Roles []*string `json:"roles" cborgen:"roles"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_OrgCreditView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_OrgCreditView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_OrgProfileDetailView is a "orgProfileDetailView" in the games.gamesgamesgamesgames.defs schema. -type Defs_OrgProfileDetailView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Avatar *lex.Blob `json:"avatar,omitempty" cborgen:"avatar,omitempty"` - Country *string `json:"country,omitempty" cborgen:"country,omitempty"` - CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` - DescriptionFacets []*appbsky.RichtextFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"` - Did string `json:"did" cborgen:"did"` - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` - FoundedAt *string `json:"foundedAt,omitempty" cborgen:"foundedAt,omitempty"` - Media []*Defs_MediaItem `json:"media,omitempty" cborgen:"media,omitempty"` - Parent *string `json:"parent,omitempty" cborgen:"parent,omitempty"` - Status *string `json:"status,omitempty" cborgen:"status,omitempty"` - Uri string `json:"uri" cborgen:"uri"` - Websites []*Defs_Website `json:"websites,omitempty" cborgen:"websites,omitempty"` -} - -func (t *Defs_OrgProfileDetailView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_OrgProfileDetailView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_OrgProfileSummaryView is a "orgProfileSummaryView" in the games.gamesgamesgamesgames.defs schema. -type Defs_OrgProfileSummaryView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Avatar *lex.Blob `json:"avatar,omitempty" cborgen:"avatar,omitempty"` - Did string `json:"did" cborgen:"did"` - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_OrgProfileSummaryView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_OrgProfileSummaryView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_PlatformFeatures is a "platformFeatures" in the games.gamesgamesgamesgames.defs schema. -// -// Features supported by a game on a specific storefront/platform. -type Defs_PlatformFeatures struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Features []string `json:"features" cborgen:"features"` - Platform string `json:"platform" cborgen:"platform"` -} - -func (t *Defs_PlatformFeatures) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_PlatformFeatures) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_PlatformSummaryView is a "platformSummaryView" in the games.gamesgamesgamesgames.defs schema. -type Defs_PlatformSummaryView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Abbreviation *string `json:"abbreviation,omitempty" cborgen:"abbreviation,omitempty"` - Category *string `json:"category,omitempty" cborgen:"category,omitempty"` - Name string `json:"name" cborgen:"name"` - Slug *string `json:"slug,omitempty" cborgen:"slug,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_PlatformSummaryView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_PlatformSummaryView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_PlatformVersion is a "platformVersion" in the games.gamesgamesgamesgames.defs schema. -type Defs_PlatformVersion struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Connectivity *string `json:"connectivity,omitempty" cborgen:"connectivity,omitempty"` - Cpu *string `json:"cpu,omitempty" cborgen:"cpu,omitempty"` - Gpu *string `json:"gpu,omitempty" cborgen:"gpu,omitempty"` - MaxResolution *string `json:"maxResolution,omitempty" cborgen:"maxResolution,omitempty"` - Media []*Defs_MediaItem `json:"media,omitempty" cborgen:"media,omitempty"` - Memory *string `json:"memory,omitempty" cborgen:"memory,omitempty"` - Name string `json:"name" cborgen:"name"` - Os *string `json:"os,omitempty" cborgen:"os,omitempty"` - Output *string `json:"output,omitempty" cborgen:"output,omitempty"` - Storage *string `json:"storage,omitempty" cborgen:"storage,omitempty"` - Summary *string `json:"summary,omitempty" cborgen:"summary,omitempty"` -} - -func (t *Defs_PlatformVersion) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_PlatformVersion) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ProfileSummaryView is a "profileSummaryView" in the games.gamesgamesgamesgames.defs schema. -type Defs_ProfileSummaryView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Avatar *lex.Blob `json:"avatar,omitempty" cborgen:"avatar,omitempty"` - Did string `json:"did" cborgen:"did"` - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` - ProfileType string `json:"profileType" cborgen:"profileType"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *Defs_ProfileSummaryView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ProfileSummaryView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_Release is a "release" in the games.gamesgamesgamesgames.defs schema. -type Defs_Release struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - // platform: Free-text platform name, used when no platform record exists. - Platform *string `json:"platform,omitempty" cborgen:"platform,omitempty"` - // platformUri: AT URI of a platform record. - PlatformUri *string `json:"platformUri,omitempty" cborgen:"platformUri,omitempty"` - ReleaseDates []*Defs_ReleaseDate `json:"releaseDates,omitempty" cborgen:"releaseDates,omitempty"` -} - -func (t *Defs_Release) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_Release) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ReleaseDate is a "releaseDate" in the games.gamesgamesgamesgames.defs schema. -type Defs_ReleaseDate struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Region *string `json:"region,omitempty" cborgen:"region,omitempty"` - ReleasedAt *string `json:"releasedAt,omitempty" cborgen:"releasedAt,omitempty"` - ReleasedAtFormat *string `json:"releasedAtFormat,omitempty" cborgen:"releasedAtFormat,omitempty"` - Status *string `json:"status,omitempty" cborgen:"status,omitempty"` -} - -func (t *Defs_ReleaseDate) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ReleaseDate) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_Signature is a "signature" in the games.gamesgamesgamesgames.defs schema. -// -// An inline attestation signature. -type Defs_Signature struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - // key: DID key reference (e.g., did:web:example.com#signing1). - Key string `json:"key" cborgen:"key"` - // signature: The signature bytes. - Signature lex.Bytes `json:"signature" cborgen:"signature"` -} - -func (t *Defs_Signature) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_Signature) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_SkeletonGameFeedItem is a "skeletonGameFeedItem" in the games.gamesgamesgamesgames.defs schema. -type Defs_SkeletonGameFeedItem struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - FeedContext *string `json:"feedContext,omitempty" cborgen:"feedContext,omitempty"` - Game string `json:"game" cborgen:"game"` -} - -func (t *Defs_SkeletonGameFeedItem) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_SkeletonGameFeedItem) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_SystemRequirements is a "systemRequirements" in the games.gamesgamesgamesgames.defs schema. -// -// System requirements for a game on a specific platform. -type Defs_SystemRequirements struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Minimum *Defs_SystemSpec `json:"minimum,omitempty" cborgen:"minimum,omitempty"` - Platform string `json:"platform" cborgen:"platform"` - Recommended *Defs_SystemSpec `json:"recommended,omitempty" cborgen:"recommended,omitempty"` -} - -func (t *Defs_SystemRequirements) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_SystemRequirements) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_SystemSpec is a "systemSpec" in the games.gamesgamesgamesgames.defs schema. -// -// Hardware/software specification for a platform. -type Defs_SystemSpec struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - AdditionalNotes *string `json:"additionalNotes,omitempty" cborgen:"additionalNotes,omitempty"` - Directx *string `json:"directx,omitempty" cborgen:"directx,omitempty"` - Graphics *string `json:"graphics,omitempty" cborgen:"graphics,omitempty"` - Memory *string `json:"memory,omitempty" cborgen:"memory,omitempty"` - Os *string `json:"os,omitempty" cborgen:"os,omitempty"` - Processor *string `json:"processor,omitempty" cborgen:"processor,omitempty"` - SoundCard *string `json:"soundCard,omitempty" cborgen:"soundCard,omitempty"` - Storage *string `json:"storage,omitempty" cborgen:"storage,omitempty"` -} - -func (t *Defs_SystemSpec) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_SystemSpec) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_TimeToBeat is a "timeToBeat" in the games.gamesgamesgamesgames.defs schema. -type Defs_TimeToBeat struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Completely *int64 `json:"completely,omitempty" cborgen:"completely,omitempty"` - Hastily *int64 `json:"hastily,omitempty" cborgen:"hastily,omitempty"` - Normally *int64 `json:"normally,omitempty" cborgen:"normally,omitempty"` -} - -func (t *Defs_TimeToBeat) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_TimeToBeat) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_ViewerState is a "viewerState" in the games.gamesgamesgamesgames.defs schema. -type Defs_ViewerState struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Like *string `json:"like,omitempty" cborgen:"like,omitempty"` -} - -func (t *Defs_ViewerState) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_ViewerState) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Defs_Website is a "website" in the games.gamesgamesgamesgames.defs schema. -type Defs_Website struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.defs"` - Type *string `json:"type,omitempty" cborgen:"type,omitempty"` - Url string `json:"url" cborgen:"url"` -} - -func (t *Defs_Website) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "games.gamesgamesgamesgames.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *Defs_Website) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/gamesgamesgamesgamesgames/defs.go b/pkg/gamesgamesgamesgamesgames/defs.go new file mode 100644 index 00000000..cf1b1dcf --- /dev/null +++ b/pkg/gamesgamesgamesgamesgames/defs.go @@ -0,0 +1,829 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: games.gamesgamesgamesgames.defs + +package gamesgamesgamesgamesgames + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + appbsky "stream.place/streamplace/pkg/appbsky" +) + +// Defs_ActorCreditView is a "actorCreditView" in the games.gamesgamesgamesgames.defs schema. +type Defs_ActorCreditView struct { + LexiconTypeID string `json:"$type"` + ActorUri *string `json:"actorUri,omitempty"` + Credits []Defs_CreditEntry `json:"credits"` + DisplayName *string `json:"displayName,omitempty"` + Uri string `json:"uri"` +} + +func (t *Defs_ActorCreditView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ActorCreditView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ActorProfileDetailView is a "actorProfileDetailView" in the games.gamesgamesgamesgames.defs schema. +type Defs_ActorProfileDetailView struct { + LexiconTypeID string `json:"$type"` + Avatar *glexrt.Blob `json:"avatar,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + Description *string `json:"description,omitempty"` + DescriptionFacets []appbsky.RichtextFacet `json:"descriptionFacets,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + Pronouns *string `json:"pronouns,omitempty"` + Uri string `json:"uri"` + Websites []Defs_Website `json:"websites,omitempty"` +} + +func (t *Defs_ActorProfileDetailView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ActorProfileDetailView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ActorProfileSummaryView is a "actorProfileSummaryView" in the games.gamesgamesgamesgames.defs schema. +type Defs_ActorProfileSummaryView struct { + LexiconTypeID string `json:"$type"` + Avatar *glexrt.Blob `json:"avatar,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + Uri string `json:"uri"` +} + +func (t *Defs_ActorProfileSummaryView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ActorProfileSummaryView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_AgeRating is a "ageRating" in the games.gamesgamesgamesgames.defs schema. +type Defs_AgeRating struct { + LexiconTypeID string `json:"$type"` + ContentDescriptors []string `json:"contentDescriptors,omitempty"` + Organization string `json:"organization"` + Rating string `json:"rating"` +} + +func (t *Defs_AgeRating) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_AgeRating) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_AlternativeName is a "alternativeName" in the games.gamesgamesgamesgames.defs schema. +type Defs_AlternativeName struct { + LexiconTypeID string `json:"$type"` + Comment *string `json:"comment,omitempty"` + Locale *string `json:"locale,omitempty"` + Name string `json:"name"` +} + +func (t *Defs_AlternativeName) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_AlternativeName) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_CollectionSummaryView is a "collectionSummaryView" in the games.gamesgamesgamesgames.defs schema. +type Defs_CollectionSummaryView struct { + LexiconTypeID string `json:"$type"` + Name string `json:"name"` + Slug *string `json:"slug,omitempty"` + Type *string `json:"type,omitempty"` + Uri string `json:"uri"` +} + +func (t *Defs_CollectionSummaryView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_CollectionSummaryView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_CreditEntry is a "creditEntry" in the games.gamesgamesgamesgames.defs schema. +type Defs_CreditEntry struct { + LexiconTypeID string `json:"$type"` + Department *string `json:"department,omitempty"` + Role string `json:"role"` +} + +func (t *Defs_CreditEntry) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_CreditEntry) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_EngineSummaryView is a "engineSummaryView" in the games.gamesgamesgamesgames.defs schema. +type Defs_EngineSummaryView struct { + LexiconTypeID string `json:"$type"` + Name string `json:"name"` + Slug *string `json:"slug,omitempty"` + Uri string `json:"uri"` +} + +func (t *Defs_EngineSummaryView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_EngineSummaryView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ExternalIds is a "externalIds" in the games.gamesgamesgamesgames.defs schema. +type Defs_ExternalIds struct { + LexiconTypeID string `json:"$type"` + AppleAppStore *string `json:"appleAppStore,omitempty"` + EpicGames *string `json:"epicGames,omitempty"` + Gog *string `json:"gog,omitempty"` + GooglePlay *string `json:"googlePlay,omitempty"` + HumbleBundle *string `json:"humbleBundle,omitempty"` + Igdb *string `json:"igdb,omitempty"` + ItchIo *Defs_ItchIoId `json:"itchIo,omitempty"` + NintendoEshop *string `json:"nintendoEshop,omitempty"` + PlayStation *string `json:"playStation,omitempty"` + Steam *string `json:"steam,omitempty"` + Twitch *string `json:"twitch,omitempty"` + Xbox *string `json:"xbox,omitempty"` +} + +func (t *Defs_ExternalIds) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ExternalIds) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ExternalVideo is a "externalVideo" in the games.gamesgamesgamesgames.defs schema. +type Defs_ExternalVideo struct { + LexiconTypeID string `json:"$type"` + Platform string `json:"platform"` + Title *string `json:"title,omitempty"` + VideoId string `json:"videoId"` +} + +func (t *Defs_ExternalVideo) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ExternalVideo) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_GameDetailView is a "gameDetailView" in the games.gamesgamesgamesgames.defs schema. +type Defs_GameDetailView struct { + LexiconTypeID string `json:"$type"` + ActorCredits []Defs_ActorCreditView `json:"actorCredits,omitempty"` + AgeRatings []Defs_AgeRating `json:"ageRatings,omitempty"` + AlternativeNames []Defs_AlternativeName `json:"alternativeNames,omitempty"` + ApplicationType *string `json:"applicationType,omitempty"` + Collections []string `json:"collections,omitempty"` + CreatedAt string `json:"createdAt"` + Engines []string `json:"engines,omitempty"` + ExternalIds *Defs_ExternalIds `json:"externalIds,omitempty"` + Genres []string `json:"genres,omitempty"` + Keywords []string `json:"keywords,omitempty"` + LanguageSupports []Defs_LanguageSupport `json:"languageSupports,omitempty"` + Media []Defs_MediaItem `json:"media,omitempty"` + Modes []string `json:"modes,omitempty"` + MultiplayerModes []Defs_MultiplayerMode `json:"multiplayerModes,omitempty"` + Name string `json:"name"` + OrgCredits []Defs_OrgCreditView `json:"orgCredits,omitempty"` + Parent *string `json:"parent,omitempty"` + PlayerPerspectives []string `json:"playerPerspectives,omitempty"` + PublishedAt *string `json:"publishedAt,omitempty"` + Releases []Defs_Release `json:"releases,omitempty"` + Slug *string `json:"slug,omitempty"` + Storyline *string `json:"storyline,omitempty"` + Summary *string `json:"summary,omitempty"` + Themes []string `json:"themes,omitempty"` + TimeToBeat *Defs_TimeToBeat `json:"timeToBeat,omitempty"` + Uri string `json:"uri"` + Videos []Defs_ExternalVideo `json:"videos,omitempty"` + Websites []Defs_Website `json:"websites,omitempty"` +} + +func (t *Defs_GameDetailView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_GameDetailView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_GameFeedViewItem is a "gameFeedViewItem" in the games.gamesgamesgamesgames.defs schema. +type Defs_GameFeedViewItem struct { + LexiconTypeID string `json:"$type"` + FeedContext *string `json:"feedContext,omitempty"` + Game Defs_GameView `json:"game"` +} + +func (t *Defs_GameFeedViewItem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_GameFeedViewItem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_GameSummaryView is a "gameSummaryView" in the games.gamesgamesgamesgames.defs schema. +type Defs_GameSummaryView struct { + LexiconTypeID string `json:"$type"` + ApplicationType *string `json:"applicationType,omitempty"` + // firstReleaseDate: Earliest release date as YYYYMMDD integer. + FirstReleaseDate *int64 `json:"firstReleaseDate,omitempty"` + Genres []string `json:"genres,omitempty"` + Media []Defs_MediaItem `json:"media,omitempty"` + Name string `json:"name"` + Slug *string `json:"slug,omitempty"` + Summary *string `json:"summary,omitempty"` + Uri string `json:"uri"` +} + +func (t *Defs_GameSummaryView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_GameSummaryView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_GameView is a "gameView" in the games.gamesgamesgamesgames.defs schema. +type Defs_GameView struct { + LexiconTypeID string `json:"$type"` + ApplicationType string `json:"applicationType"` + Genres []string `json:"genres,omitempty"` + LikeCount *int64 `json:"likeCount,omitempty"` + Media []Defs_MediaItem `json:"media,omitempty"` + Name string `json:"name"` + Releases []Defs_Release `json:"releases,omitempty"` + Slug *string `json:"slug,omitempty"` + Summary *string `json:"summary,omitempty"` + Themes []string `json:"themes,omitempty"` + Uri string `json:"uri"` + Viewer *Defs_ViewerState `json:"viewer,omitempty"` +} + +func (t *Defs_GameView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_GameView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ItchIoId is a "itchIoId" in the games.gamesgamesgamesgames.defs schema. +type Defs_ItchIoId struct { + LexiconTypeID string `json:"$type"` + Developer string `json:"developer"` + Game string `json:"game"` +} + +func (t *Defs_ItchIoId) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ItchIoId) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_LanguageSupport is a "languageSupport" in the games.gamesgamesgamesgames.defs schema. +type Defs_LanguageSupport struct { + LexiconTypeID string `json:"$type"` + Audio *bool `json:"audio,omitempty"` + Interface *bool `json:"interface,omitempty"` + Language string `json:"language"` + Subtitles *bool `json:"subtitles,omitempty"` +} + +func (t *Defs_LanguageSupport) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_LanguageSupport) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_MediaItem is a "mediaItem" in the games.gamesgamesgamesgames.defs schema. +type Defs_MediaItem struct { + LexiconTypeID string `json:"$type"` + Blob *glexrt.Blob `json:"blob,omitempty"` + Description *string `json:"description,omitempty"` + Height *int64 `json:"height,omitempty"` + Locale *string `json:"locale,omitempty"` + MediaType *string `json:"mediaType,omitempty"` + Title *string `json:"title,omitempty"` + Width *int64 `json:"width,omitempty"` +} + +func (t *Defs_MediaItem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_MediaItem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_MultiplayerMode is a "multiplayerMode" in the games.gamesgamesgamesgames.defs schema. +type Defs_MultiplayerMode struct { + LexiconTypeID string `json:"$type"` + HasCampaignCoop *bool `json:"hasCampaignCoop,omitempty"` + HasDropIn *bool `json:"hasDropIn,omitempty"` + HasLanCoop *bool `json:"hasLanCoop,omitempty"` + HasSplitscreen *bool `json:"hasSplitscreen,omitempty"` + HasSplitscreenOnline *bool `json:"hasSplitscreenOnline,omitempty"` + OfflineCoopMax *int64 `json:"offlineCoopMax,omitempty"` + OfflineMax *int64 `json:"offlineMax,omitempty"` + OnlineCoopMax *int64 `json:"onlineCoopMax,omitempty"` + OnlineMax *int64 `json:"onlineMax,omitempty"` + Platform *string `json:"platform,omitempty"` +} + +func (t *Defs_MultiplayerMode) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_MultiplayerMode) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_OrgCreditView is a "orgCreditView" in the games.gamesgamesgamesgames.defs schema. +type Defs_OrgCreditView struct { + LexiconTypeID string `json:"$type"` + DisplayName *string `json:"displayName,omitempty"` + OrgUri *string `json:"orgUri,omitempty"` + Roles []string `json:"roles"` + Uri string `json:"uri"` +} + +func (t *Defs_OrgCreditView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_OrgCreditView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_OrgProfileDetailView is a "orgProfileDetailView" in the games.gamesgamesgamesgames.defs schema. +type Defs_OrgProfileDetailView struct { + LexiconTypeID string `json:"$type"` + Avatar *glexrt.Blob `json:"avatar,omitempty"` + Country *string `json:"country,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + Description *string `json:"description,omitempty"` + DescriptionFacets []appbsky.RichtextFacet `json:"descriptionFacets,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + FoundedAt *string `json:"foundedAt,omitempty"` + Media []Defs_MediaItem `json:"media,omitempty"` + Parent *string `json:"parent,omitempty"` + Status *string `json:"status,omitempty"` + Uri string `json:"uri"` + Websites []Defs_Website `json:"websites,omitempty"` +} + +func (t *Defs_OrgProfileDetailView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_OrgProfileDetailView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_OrgProfileSummaryView is a "orgProfileSummaryView" in the games.gamesgamesgamesgames.defs schema. +type Defs_OrgProfileSummaryView struct { + LexiconTypeID string `json:"$type"` + Avatar *glexrt.Blob `json:"avatar,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + Uri string `json:"uri"` +} + +func (t *Defs_OrgProfileSummaryView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_OrgProfileSummaryView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_PlatformFeatures is a "platformFeatures" in the games.gamesgamesgamesgames.defs schema. +// +// Features supported by a game on a specific storefront/platform. +type Defs_PlatformFeatures struct { + LexiconTypeID string `json:"$type"` + Features []string `json:"features"` + Platform string `json:"platform"` +} + +func (t *Defs_PlatformFeatures) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_PlatformFeatures) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_PlatformSummaryView is a "platformSummaryView" in the games.gamesgamesgamesgames.defs schema. +type Defs_PlatformSummaryView struct { + LexiconTypeID string `json:"$type"` + Abbreviation *string `json:"abbreviation,omitempty"` + Category *string `json:"category,omitempty"` + Name string `json:"name"` + Slug *string `json:"slug,omitempty"` + Uri string `json:"uri"` +} + +func (t *Defs_PlatformSummaryView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_PlatformSummaryView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_PlatformVersion is a "platformVersion" in the games.gamesgamesgamesgames.defs schema. +type Defs_PlatformVersion struct { + LexiconTypeID string `json:"$type"` + Connectivity *string `json:"connectivity,omitempty"` + Cpu *string `json:"cpu,omitempty"` + Gpu *string `json:"gpu,omitempty"` + MaxResolution *string `json:"maxResolution,omitempty"` + Media []Defs_MediaItem `json:"media,omitempty"` + Memory *string `json:"memory,omitempty"` + Name string `json:"name"` + Os *string `json:"os,omitempty"` + Output *string `json:"output,omitempty"` + Storage *string `json:"storage,omitempty"` + Summary *string `json:"summary,omitempty"` +} + +func (t *Defs_PlatformVersion) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_PlatformVersion) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ProfileSummaryView is a "profileSummaryView" in the games.gamesgamesgamesgames.defs schema. +type Defs_ProfileSummaryView struct { + LexiconTypeID string `json:"$type"` + Avatar *glexrt.Blob `json:"avatar,omitempty"` + Did string `json:"did"` + DisplayName *string `json:"displayName,omitempty"` + ProfileType string `json:"profileType"` + Uri string `json:"uri"` +} + +func (t *Defs_ProfileSummaryView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ProfileSummaryView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_Release is a "release" in the games.gamesgamesgamesgames.defs schema. +type Defs_Release struct { + LexiconTypeID string `json:"$type"` + // platform: Free-text platform name, used when no platform record exists. + Platform *string `json:"platform,omitempty"` + // platformUri: AT URI of a platform record. + PlatformUri *string `json:"platformUri,omitempty"` + ReleaseDates []Defs_ReleaseDate `json:"releaseDates,omitempty"` +} + +func (t *Defs_Release) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_Release) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ReleaseDate is a "releaseDate" in the games.gamesgamesgamesgames.defs schema. +type Defs_ReleaseDate struct { + LexiconTypeID string `json:"$type"` + Region *string `json:"region,omitempty"` + ReleasedAt *string `json:"releasedAt,omitempty"` + ReleasedAtFormat *string `json:"releasedAtFormat,omitempty"` + Status *string `json:"status,omitempty"` +} + +func (t *Defs_ReleaseDate) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ReleaseDate) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_Signature is a "signature" in the games.gamesgamesgamesgames.defs schema. +// +// An inline attestation signature. +type Defs_Signature struct { + LexiconTypeID string `json:"$type"` + // key: DID key reference (e.g., did:web:example.com#signing1). + Key string `json:"key"` + // signature: The signature bytes. + Signature glexrt.Bytes `json:"signature"` +} + +func (t *Defs_Signature) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_Signature) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_SkeletonGameFeedItem is a "skeletonGameFeedItem" in the games.gamesgamesgamesgames.defs schema. +type Defs_SkeletonGameFeedItem struct { + LexiconTypeID string `json:"$type"` + FeedContext *string `json:"feedContext,omitempty"` + Game string `json:"game"` +} + +func (t *Defs_SkeletonGameFeedItem) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_SkeletonGameFeedItem) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_SystemRequirements is a "systemRequirements" in the games.gamesgamesgamesgames.defs schema. +// +// System requirements for a game on a specific platform. +type Defs_SystemRequirements struct { + LexiconTypeID string `json:"$type"` + Minimum *Defs_SystemSpec `json:"minimum,omitempty"` + Platform string `json:"platform"` + Recommended *Defs_SystemSpec `json:"recommended,omitempty"` +} + +func (t *Defs_SystemRequirements) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_SystemRequirements) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_SystemSpec is a "systemSpec" in the games.gamesgamesgamesgames.defs schema. +// +// Hardware/software specification for a platform. +type Defs_SystemSpec struct { + LexiconTypeID string `json:"$type"` + AdditionalNotes *string `json:"additionalNotes,omitempty"` + Directx *string `json:"directx,omitempty"` + Graphics *string `json:"graphics,omitempty"` + Memory *string `json:"memory,omitempty"` + Os *string `json:"os,omitempty"` + Processor *string `json:"processor,omitempty"` + SoundCard *string `json:"soundCard,omitempty"` + Storage *string `json:"storage,omitempty"` +} + +func (t *Defs_SystemSpec) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_SystemSpec) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_TimeToBeat is a "timeToBeat" in the games.gamesgamesgamesgames.defs schema. +type Defs_TimeToBeat struct { + LexiconTypeID string `json:"$type"` + Completely *int64 `json:"completely,omitempty"` + Hastily *int64 `json:"hastily,omitempty"` + Normally *int64 `json:"normally,omitempty"` +} + +func (t *Defs_TimeToBeat) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_TimeToBeat) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_ViewerState is a "viewerState" in the games.gamesgamesgamesgames.defs schema. +type Defs_ViewerState struct { + LexiconTypeID string `json:"$type"` + Like *string `json:"like,omitempty"` +} + +func (t *Defs_ViewerState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_ViewerState) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Defs_Website is a "website" in the games.gamesgamesgamesgames.defs schema. +type Defs_Website struct { + LexiconTypeID string `json:"$type"` + Type *string `json:"type,omitempty"` + Url string `json:"url"` +} + +func (t *Defs_Website) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "games.gamesgamesgamesgames.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Defs_Website) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/gamesgamesgamesgames/search.go b/pkg/gamesgamesgamesgamesgames/search.go similarity index 53% rename from pkg/gamesgamesgamesgames/search.go rename to pkg/gamesgamesgamesgamesgames/search.go index be121f6f..0356dfcc 100644 --- a/pkg/gamesgamesgamesgames/search.go +++ b/pkg/gamesgamesgamesgamesgames/search.go @@ -1,26 +1,26 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: games.gamesgamesgamesgames.search -package gamesgamesgamesgames +package gamesgamesgamesgamesgames import ( + "bytes" "context" "encoding/json" "fmt" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type Search_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=games.gamesgamesgamesgames.search#main"` - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Results []*Search_Output_Results_Elem `json:"results" cborgen:"results"` + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Results []Search_Output_Results_Elem `json:"results"` // totalResults: Total number of results matching the query above the relevance threshold. - TotalResults *int64 `json:"totalResults,omitempty" cborgen:"totalResults,omitempty"` + TotalResults *int64 `json:"totalResults,omitempty"` } func (t *Search_Output) MarshalCBOR(w io.Writer) error { @@ -29,67 +29,118 @@ func (t *Search_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "games.gamesgamesgamesgames.search#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Search_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type Search_Output_Results_Elem struct { - Defs_GameSummaryView *Defs_GameSummaryView - Defs_ProfileSummaryView *Defs_ProfileSummaryView - Defs_PlatformSummaryView *Defs_PlatformSummaryView Defs_CollectionSummaryView *Defs_CollectionSummaryView Defs_EngineSummaryView *Defs_EngineSummaryView + Defs_GameSummaryView *Defs_GameSummaryView + Defs_PlatformSummaryView *Defs_PlatformSummaryView + Defs_ProfileSummaryView *Defs_ProfileSummaryView } func (t *Search_Output_Results_Elem) MarshalJSON() ([]byte, error) { + if t.Defs_CollectionSummaryView != nil { + t.Defs_CollectionSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#collectionSummaryView" + return json.Marshal(t.Defs_CollectionSummaryView) + } + if t.Defs_EngineSummaryView != nil { + t.Defs_EngineSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#engineSummaryView" + return json.Marshal(t.Defs_EngineSummaryView) + } if t.Defs_GameSummaryView != nil { t.Defs_GameSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#gameSummaryView" return json.Marshal(t.Defs_GameSummaryView) } - if t.Defs_ProfileSummaryView != nil { - t.Defs_ProfileSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#profileSummaryView" - return json.Marshal(t.Defs_ProfileSummaryView) - } if t.Defs_PlatformSummaryView != nil { t.Defs_PlatformSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#platformSummaryView" return json.Marshal(t.Defs_PlatformSummaryView) } - if t.Defs_CollectionSummaryView != nil { - t.Defs_CollectionSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#collectionSummaryView" - return json.Marshal(t.Defs_CollectionSummaryView) - } - if t.Defs_EngineSummaryView != nil { - t.Defs_EngineSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#engineSummaryView" - return json.Marshal(t.Defs_EngineSummaryView) + if t.Defs_ProfileSummaryView != nil { + t.Defs_ProfileSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#profileSummaryView" + return json.Marshal(t.Defs_ProfileSummaryView) } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *Search_Output_Results_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } switch typ { + case "games.gamesgamesgamesgames.defs#collectionSummaryView": + t.Defs_CollectionSummaryView = new(Defs_CollectionSummaryView) + return json.Unmarshal(b, t.Defs_CollectionSummaryView) + case "games.gamesgamesgamesgames.defs#engineSummaryView": + t.Defs_EngineSummaryView = new(Defs_EngineSummaryView) + return json.Unmarshal(b, t.Defs_EngineSummaryView) case "games.gamesgamesgamesgames.defs#gameSummaryView": t.Defs_GameSummaryView = new(Defs_GameSummaryView) return json.Unmarshal(b, t.Defs_GameSummaryView) - case "games.gamesgamesgamesgames.defs#profileSummaryView": - t.Defs_ProfileSummaryView = new(Defs_ProfileSummaryView) - return json.Unmarshal(b, t.Defs_ProfileSummaryView) case "games.gamesgamesgamesgames.defs#platformSummaryView": t.Defs_PlatformSummaryView = new(Defs_PlatformSummaryView) return json.Unmarshal(b, t.Defs_PlatformSummaryView) + case "games.gamesgamesgamesgames.defs#profileSummaryView": + t.Defs_ProfileSummaryView = new(Defs_ProfileSummaryView) + return json.Unmarshal(b, t.Defs_ProfileSummaryView) + default: + return nil + } +} + +func (t *Search_Output_Results_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.Defs_CollectionSummaryView != nil { + return t.Defs_CollectionSummaryView.MarshalCBOR(w) + } + if t.Defs_EngineSummaryView != nil { + return t.Defs_EngineSummaryView.MarshalCBOR(w) + } + if t.Defs_GameSummaryView != nil { + return t.Defs_GameSummaryView.MarshalCBOR(w) + } + if t.Defs_PlatformSummaryView != nil { + return t.Defs_PlatformSummaryView.MarshalCBOR(w) + } + if t.Defs_ProfileSummaryView != nil { + return t.Defs_ProfileSummaryView.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *Search_Output_Results_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { case "games.gamesgamesgamesgames.defs#collectionSummaryView": t.Defs_CollectionSummaryView = new(Defs_CollectionSummaryView) - return json.Unmarshal(b, t.Defs_CollectionSummaryView) + return t.Defs_CollectionSummaryView.UnmarshalCBOR(bytes.NewReader(b)) case "games.gamesgamesgamesgames.defs#engineSummaryView": t.Defs_EngineSummaryView = new(Defs_EngineSummaryView) - return json.Unmarshal(b, t.Defs_EngineSummaryView) + return t.Defs_EngineSummaryView.UnmarshalCBOR(bytes.NewReader(b)) + case "games.gamesgamesgamesgames.defs#gameSummaryView": + t.Defs_GameSummaryView = new(Defs_GameSummaryView) + return t.Defs_GameSummaryView.UnmarshalCBOR(bytes.NewReader(b)) + case "games.gamesgamesgamesgames.defs#platformSummaryView": + t.Defs_PlatformSummaryView = new(Defs_PlatformSummaryView) + return t.Defs_PlatformSummaryView.UnmarshalCBOR(bytes.NewReader(b)) + case "games.gamesgamesgamesgames.defs#profileSummaryView": + t.Defs_ProfileSummaryView = new(Defs_ProfileSummaryView) + return t.Defs_ProfileSummaryView.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } @@ -97,10 +148,12 @@ func (t *Search_Output_Results_Elem) UnmarshalJSON(b []byte) error { // Search calls the XRPC method "games.gamesgamesgamesgames.search". // -// ageRatings: Filter game results by age rating in 'organization:rating' format (e.g. esrb:M, pegi:Eighteen). -// applicationTypes: Filter game results by application type (e.g. game, dlc, bundle). Only applies when types includes game. +// Search across all entity types (games, profiles, platforms, collections, engines). +// +// ageRatings[]: Filter game results by age rating in 'organization:rating' format (e.g. esrb:M, pegi:Eighteen). +// applicationTypes[]: Filter game results by application type (e.g. game, dlc, bundle). Only applies when types includes game. // includeUnrated: When age rating filters are active, also include games with no age ratings. -func Search(ctx context.Context, c lexutil.LexClient, ageRatings []string, applicationTypes []string, cursor string, genres []string, includeCancelled bool, includeUnrated bool, limit int64, modes []string, playerPerspectives []string, q string, sort string, themes []string, types []string) (*Search_Output, error) { +func Search(ctx context.Context, c glexrt.LexClient, ageRatings []string, applicationTypes []string, cursor string, genres []string, includeCancelled *bool, includeUnrated *bool, limit *int64, modes []string, playerPerspectives []string, q string, sort string, themes []string, types []string) (*Search_Output, error) { var out Search_Output params := map[string]interface{}{} @@ -116,14 +169,14 @@ func Search(ctx context.Context, c lexutil.LexClient, ageRatings []string, appli if len(genres) != 0 { params["genres"] = genres } - if includeCancelled { - params["includeCancelled"] = includeCancelled + if includeCancelled != nil { + params["includeCancelled"] = *includeCancelled } - if includeUnrated { - params["includeUnrated"] = includeUnrated + if includeUnrated != nil { + params["includeUnrated"] = *includeUnrated } - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } if len(modes) != 0 { params["modes"] = modes @@ -141,9 +194,9 @@ func Search(ctx context.Context, c lexutil.LexClient, ageRatings []string, appli params["types"] = types } params["q"] = q - if err := c.LexDo(ctx, lexutil.Query, "", "games.gamesgamesgamesgames.search", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "games.gamesgamesgamesgames.search", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/integrations/discord/send-chat.go b/pkg/integrations/discord/send-chat.go index 93e9f5a1..57e99a80 100644 --- a/pkg/integrations/discord/send-chat.go +++ b/pkg/integrations/discord/send-chat.go @@ -12,7 +12,7 @@ import ( "stream.place/streamplace/pkg/aqhttp" "stream.place/streamplace/pkg/integrations/discord/discordtypes" "stream.place/streamplace/pkg/log" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func SendChat(ctx context.Context, w *discordtypes.Webhook, did string, scm *streamplace.ChatDefs_MessageView) error { diff --git a/pkg/integrations/discord/send-livestream.go b/pkg/integrations/discord/send-livestream.go index d9ea822e..fc6133dd 100644 --- a/pkg/integrations/discord/send-livestream.go +++ b/pkg/integrations/discord/send-livestream.go @@ -16,7 +16,7 @@ import ( "stream.place/streamplace/pkg/integrations/discord/discordtypes" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func SendLivestream(ctx context.Context, w *discordtypes.Webhook, pdsURL string, lsv *streamplace.Livestream_LivestreamView, postView *bsky.FeedDefs_PostView, spcp *streamplace.ChatProfile) error { diff --git a/pkg/integrations/webhook/manager.go b/pkg/integrations/webhook/manager.go index 281cb566..a0e24e5b 100644 --- a/pkg/integrations/webhook/manager.go +++ b/pkg/integrations/webhook/manager.go @@ -8,7 +8,7 @@ import ( "github.com/bluesky-social/indigo/api/bsky" "stream.place/streamplace/pkg/integrations/discord" "stream.place/streamplace/pkg/integrations/discord/discordtypes" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // SendChatWebhook sends chat message to a specific webhook diff --git a/pkg/iroh/iroh_streamplace.go b/pkg/iroh/iroh_streamplace.go index f5c7cc1a..0c57c3ad 100644 --- a/pkg/iroh/iroh_streamplace.go +++ b/pkg/iroh/iroh_streamplace.go @@ -2,7 +2,7 @@ package iroh_streamplace import ( _ "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" - _ "stream.place/streamplace/pkg/streamplacedeps" + _ "stream.place/streamplace/pkg/placestreamdeps" ) // #cgo darwin LDFLAGS: -framework Security -framework SystemConfiguration diff --git a/pkg/iroh/iroh_test/main.go b/pkg/iroh/iroh_test/main.go index 623cdb86..b36b837e 100644 --- a/pkg/iroh/iroh_test/main.go +++ b/pkg/iroh/iroh_test/main.go @@ -7,7 +7,7 @@ import ( "time" iroh "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" - _ "stream.place/streamplace/pkg/streamplacedeps" + _ "stream.place/streamplace/pkg/placestreamdeps" ) func panicIfErr(err error) { diff --git a/pkg/lexroundtrip/roundtrip_test.go b/pkg/lexroundtrip/roundtrip_test.go index 857e513c..f9812807 100644 --- a/pkg/lexroundtrip/roundtrip_test.go +++ b/pkg/lexroundtrip/roundtrip_test.go @@ -4,10 +4,10 @@ import ( "bytes" "testing" - lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/ipfs/go-cid" + glexrt "github.com/streamplace/glex/runtime" "stream.place/streamplace/pkg/lex" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // TestAdapterRegistryRoundtrip exercises the full go-dasl path: marshal a @@ -16,13 +16,13 @@ import ( // type + fields survive. func TestAdapterRegistryRoundtrip(t *testing.T) { c := cid.MustParse("bafkreib2rxk3rybk3aobmv5cjuql3bm2twh4jo5uxyjfxzvjcamdmc76jm") - orig := &streamplace.Livestream{ + orig := &placestream.Livestream{ CreatedAt: "2026-07-07T00:00:00Z", Title: "hello world", Tags: []string{"lang:en"}, Thumb: &lex.Blob{Ref: lex.Link(c), MimeType: "image/jpeg", Size: 4096}, - Activity: &streamplace.Livestream_Activity{ - Defs_ActivityGame: &streamplace.Defs_ActivityGame{Uri: "at://did:plc:x/games.gamesgamesgamesgames.game/abc"}, + Activity: &placestream.Livestream_Activity{ + Defs_ActivityGame: &placestream.Defs_ActivityGame{Uri: "at://did:plc:x/games.gamesgamesgamesgames.game/abc"}, }, } @@ -37,14 +37,14 @@ func TestAdapterRegistryRoundtrip(t *testing.T) { t.Errorf("adapter did not stamp $type, got %q", orig.LexiconTypeID) } - // Decode via the lexutil registry, exactly like pkg/atproto/sync.go. - decoded, err := lexutil.CborDecodeValue(enc) + // Decode via the glex runtime registry, exactly like the firehose does. + decoded, err := glexrt.CborDecodeValue(enc) if err != nil { t.Fatalf("CborDecodeValue: %v", err) } - ls, ok := decoded.(*streamplace.Livestream) + ls, ok := decoded.(*placestream.Livestream) if !ok { - t.Fatalf("decoded to %T, want *streamplace.Livestream", decoded) + t.Fatalf("decoded to %T, want *placestream.Livestream", decoded) } if ls.Title != orig.Title || ls.CreatedAt != orig.CreatedAt { t.Errorf("scalar mismatch: got title=%q created=%q", ls.Title, ls.CreatedAt) diff --git a/pkg/linking/linking.go b/pkg/linking/linking.go index aafda0cb..a027fc16 100644 --- a/pkg/linking/linking.go +++ b/pkg/linking/linking.go @@ -12,7 +12,7 @@ import ( "golang.org/x/net/html" "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type Linker struct { diff --git a/pkg/linking/linking_test.go b/pkg/linking/linking_test.go index 3fcd7187..5bf1787d 100644 --- a/pkg/linking/linking_test.go +++ b/pkg/linking/linking_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" "stream.place/streamplace/js/app" "stream.place/streamplace/pkg/lex" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func IndexHTML(t *testing.T) []byte { diff --git a/pkg/livepeer/livepeer.go b/pkg/livepeer/livepeer.go index 91caf1a4..e333481c 100644 --- a/pkg/livepeer/livepeer.go +++ b/pkg/livepeer/livepeer.go @@ -20,7 +20,7 @@ import ( "stream.place/streamplace/pkg/media" "stream.place/streamplace/pkg/renditions" "stream.place/streamplace/pkg/spmetrics" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) const SegmentsInFlight = 2 diff --git a/pkg/localdb/segment.go b/pkg/localdb/segment.go index d8d8b667..06c7af8b 100644 --- a/pkg/localdb/segment.go +++ b/pkg/localdb/segment.go @@ -11,7 +11,7 @@ import ( "gorm.io/gorm" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/log" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type SegmentMediadataVideo struct { diff --git a/pkg/media/manifest_builder.go b/pkg/media/manifest_builder.go index 3c32fc46..89a3860d 100644 --- a/pkg/media/manifest_builder.go +++ b/pkg/media/manifest_builder.go @@ -10,7 +10,7 @@ import ( "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // ManifestBuilder is responsible for creating C2PA (Content Credentials) manifests diff --git a/pkg/media/media.go b/pkg/media/media.go index 10c73843..ba5f1b76 100644 --- a/pkg/media/media.go +++ b/pkg/media/media.go @@ -23,7 +23,7 @@ import ( "stream.place/streamplace/pkg/livehls" "stream.place/streamplace/pkg/localdb" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/log" @@ -31,7 +31,7 @@ import ( irohStreamplace "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" - _ "stream.place/streamplace/pkg/streamplacedeps" + _ "stream.place/streamplace/pkg/placestreamdeps" ) const CertFile = "cert.pem" diff --git a/pkg/media/rtmp_push.go b/pkg/media/rtmp_push.go index d49f66bf..884af81b 100644 --- a/pkg/media/rtmp_push.go +++ b/pkg/media/rtmp_push.go @@ -16,7 +16,7 @@ import ( "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/muxl" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // RTMPPush is the in-process multistream egress: it assembles the streamer's diff --git a/pkg/media/rtmp_push_worker.go b/pkg/media/rtmp_push_worker.go index 89e33ecc..6903f7bb 100644 --- a/pkg/media/rtmp_push_worker.go +++ b/pkg/media/rtmp_push_worker.go @@ -14,7 +14,7 @@ import ( "stream.place/streamplace/pkg/gstinit" "stream.place/streamplace/pkg/ingestframe" "stream.place/streamplace/pkg/log" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // RTMPPushWorkerConfig is the startup handshake main hands an rtmp-push worker diff --git a/pkg/media/rtmp_push_worker_test.go b/pkg/media/rtmp_push_worker_test.go index 58144af6..9daa6383 100644 --- a/pkg/media/rtmp_push_worker_test.go +++ b/pkg/media/rtmp_push_worker_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "stream.place/streamplace/pkg/bus" "stream.place/streamplace/pkg/ingestframe" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // runRTMPPushWorkerHelper is what the test binary becomes when re-exec'd with diff --git a/pkg/model/beta_invite.go b/pkg/model/beta_invite.go index 329cfc09..a525526d 100644 --- a/pkg/model/beta_invite.go +++ b/pkg/model/beta_invite.go @@ -9,7 +9,7 @@ import ( "github.com/bluesky-social/indigo/atproto/syntax" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // BetaInvite is the indexed view of a place.stream.beta.invite diff --git a/pkg/model/beta_request.go b/pkg/model/beta_request.go index eb04a5db..b46af822 100644 --- a/pkg/model/beta_request.go +++ b/pkg/model/beta_request.go @@ -9,7 +9,7 @@ import ( "github.com/bluesky-social/indigo/atproto/syntax" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // BetaRequest is the indexed view of a place.stream.beta.request diff --git a/pkg/model/block.go b/pkg/model/block.go index 91236bf6..85ba3b5a 100644 --- a/pkg/model/block.go +++ b/pkg/model/block.go @@ -9,7 +9,7 @@ import ( "github.com/bluesky-social/indigo/api/bsky" lexutil "github.com/bluesky-social/indigo/lex/util" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type Block struct { diff --git a/pkg/model/broadcast_origin.go b/pkg/model/broadcast_origin.go index 5bc58890..fd5828c6 100644 --- a/pkg/model/broadcast_origin.go +++ b/pkg/model/broadcast_origin.go @@ -11,7 +11,7 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type BroadcastOrigin struct { diff --git a/pkg/model/chat_message.go b/pkg/model/chat_message.go index e885b81d..b9f27888 100644 --- a/pkg/model/chat_message.go +++ b/pkg/model/chat_message.go @@ -12,7 +12,7 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/rivo/uniseg" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type ChatMessage struct { diff --git a/pkg/model/chat_message_default_colors.go b/pkg/model/chat_message_default_colors.go index 8401cd0f..883508a6 100644 --- a/pkg/model/chat_message_default_colors.go +++ b/pkg/model/chat_message_default_colors.go @@ -1,6 +1,6 @@ package model -import "stream.place/streamplace/pkg/streamplace" +import "stream.place/streamplace/pkg/placestream" var DefaultColors = []*streamplace.ChatProfile_Color{ {Red: 244, Green: 67, Blue: 54}, diff --git a/pkg/model/chat_profile.go b/pkg/model/chat_profile.go index 889c1771..7e6e8d65 100644 --- a/pkg/model/chat_profile.go +++ b/pkg/model/chat_profile.go @@ -7,7 +7,7 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type ChatProfile struct { diff --git a/pkg/model/default_metadata.go b/pkg/model/default_metadata.go index 0341027f..4cdd6833 100644 --- a/pkg/model/default_metadata.go +++ b/pkg/model/default_metadata.go @@ -7,7 +7,7 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type MetadataConfiguration struct { diff --git a/pkg/model/gate.go b/pkg/model/gate.go index 261e9768..e71726e2 100644 --- a/pkg/model/gate.go +++ b/pkg/model/gate.go @@ -6,7 +6,7 @@ import ( "time" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type Gate struct { diff --git a/pkg/model/like.go b/pkg/model/like.go index ba8ae266..7a48acf0 100644 --- a/pkg/model/like.go +++ b/pkg/model/like.go @@ -9,7 +9,7 @@ import ( "github.com/bluesky-social/indigo/api/bsky" lexutil "github.com/bluesky-social/indigo/lex/util" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type Like struct { diff --git a/pkg/model/livestream.go b/pkg/model/livestream.go index 2bfa3ccf..5ddc3b90 100644 --- a/pkg/model/livestream.go +++ b/pkg/model/livestream.go @@ -11,7 +11,7 @@ import ( "gorm.io/gorm" "gorm.io/gorm/clause" "stream.place/streamplace/pkg/moderation" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type Livestream struct { diff --git a/pkg/model/media_origin.go b/pkg/model/media_origin.go index 410811eb..f39e6256 100644 --- a/pkg/model/media_origin.go +++ b/pkg/model/media_origin.go @@ -12,7 +12,7 @@ import ( "gorm.io/gorm" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // MediaOrigin is the indexed view of a place.stream.media.origin diff --git a/pkg/model/media_track.go b/pkg/model/media_track.go index 0f7596d8..63b03626 100644 --- a/pkg/model/media_track.go +++ b/pkg/model/media_track.go @@ -12,7 +12,7 @@ import ( "gorm.io/gorm" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // MediaTrack is the indexed view of a place.stream.media.track diff --git a/pkg/model/media_view_count.go b/pkg/model/media_view_count.go index 47b4f064..6bcb946c 100644 --- a/pkg/model/media_view_count.go +++ b/pkg/model/media_view_count.go @@ -12,7 +12,7 @@ import ( "gorm.io/gorm" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // MediaViewCount is the indexed view of a place.stream.media.viewCount diff --git a/pkg/model/media_view_count_test.go b/pkg/model/media_view_count_test.go index 0174ff6d..f67add1b 100644 --- a/pkg/model/media_view_count_test.go +++ b/pkg/model/media_view_count_test.go @@ -8,7 +8,7 @@ import ( "github.com/bluesky-social/indigo/atproto/syntax" "github.com/stretchr/testify/require" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func parseURI(t *testing.T, s string) syntax.ATURI { diff --git a/pkg/model/model.go b/pkg/model/model.go index 91f80686..490e9b37 100644 --- a/pkg/model/model.go +++ b/pkg/model/model.go @@ -15,7 +15,7 @@ import ( "gorm.io/plugin/prometheus" "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/log" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type DBModel struct { diff --git a/pkg/model/moderation_delegation.go b/pkg/model/moderation_delegation.go index b0eb2fa5..664f17e6 100644 --- a/pkg/model/moderation_delegation.go +++ b/pkg/model/moderation_delegation.go @@ -13,7 +13,7 @@ import ( "gorm.io/gorm" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type ModerationDelegation struct { diff --git a/pkg/model/pinned_record.go b/pkg/model/pinned_record.go index c047ee88..4d8ef862 100644 --- a/pkg/model/pinned_record.go +++ b/pkg/model/pinned_record.go @@ -7,7 +7,7 @@ import ( "github.com/bluesky-social/indigo/util" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type PinnedRecord struct { diff --git a/pkg/model/server_settings.go b/pkg/model/server_settings.go index 154fae4e..f930b52d 100644 --- a/pkg/model/server_settings.go +++ b/pkg/model/server_settings.go @@ -8,7 +8,7 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // ServerSettings represents a user's settings for a particular Streamplace node diff --git a/pkg/model/video.go b/pkg/model/video.go index fe8f9185..335bfab0 100644 --- a/pkg/model/video.go +++ b/pkg/model/video.go @@ -13,7 +13,7 @@ import ( "gorm.io/gorm" "stream.place/streamplace/pkg/aqtime" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // Video is the indexed view of a place.stream.video record. Every diff --git a/pkg/model/video_list.go b/pkg/model/video_list.go index 1a51906f..4bb4dca1 100644 --- a/pkg/model/video_list.go +++ b/pkg/model/video_list.go @@ -8,7 +8,7 @@ import ( comatproto "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/api/bsky" lexutil "github.com/bluesky-social/indigo/lex/util" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // videoListMaxScan bounds how many indexed rows GetVideoList will examine diff --git a/pkg/model/video_list_test.go b/pkg/model/video_list_test.go index a8c78538..f26c7a01 100644 --- a/pkg/model/video_list_test.go +++ b/pkg/model/video_list_test.go @@ -8,7 +8,7 @@ import ( comatproto "github.com/bluesky-social/indigo/api/atproto" "github.com/stretchr/testify/require" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // putLike writes a place.stream.like by `liker` whose subject is the given URI. diff --git a/pkg/model/vod_comment.go b/pkg/model/vod_comment.go index 4cd4955e..5e524481 100644 --- a/pkg/model/vod_comment.go +++ b/pkg/model/vod_comment.go @@ -11,7 +11,7 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/rivo/uniseg" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type VodComment struct { diff --git a/pkg/model/vod_gate.go b/pkg/model/vod_gate.go index 286da354..47c68a6b 100644 --- a/pkg/model/vod_gate.go +++ b/pkg/model/vod_gate.go @@ -6,7 +6,7 @@ import ( "time" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type VodGate struct { diff --git a/pkg/moderation/permissions.go b/pkg/moderation/permissions.go index 47d83efa..4b6e7a2d 100644 --- a/pkg/moderation/permissions.go +++ b/pkg/moderation/permissions.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type delegationGetter interface { diff --git a/pkg/moderation/permissions_test.go b/pkg/moderation/permissions_test.go index 5c68d51a..6ec2647c 100644 --- a/pkg/moderation/permissions_test.go +++ b/pkg/moderation/permissions_test.go @@ -9,7 +9,7 @@ import ( "github.com/bluesky-social/indigo/api/bsky" lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/stretchr/testify/require" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestPermissionChecker_CheckPermission_StreamerSelfModeration(t *testing.T) { diff --git a/pkg/multitest/multitest_test.go b/pkg/multitest/multitest_test.go index 01accca9..9c6c336c 100644 --- a/pkg/multitest/multitest_test.go +++ b/pkg/multitest/multitest_test.go @@ -24,7 +24,7 @@ import ( "stream.place/streamplace/pkg/devenv" "stream.place/streamplace/pkg/gstinit" "stream.place/streamplace/pkg/log" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/test/remote" ) diff --git a/pkg/placestream/badgedef.go b/pkg/placestream/badgedef.go new file mode 100644 index 00000000..6911c6fd --- /dev/null +++ b/pkg/placestream/badgedef.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.badge.def + +package placestream + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("place.stream.badge.def", &BadgeDef{}) +} + +// Defines a badge's visual appearance and type. Created by the issuer and referenced by issuance records. +type BadgeDef struct { + LexiconTypeID string `json:"$type"` + // badgeType: The category of this badge, used for scope and display rules. + BadgeType string `json:"badgeType"` + CreatedAt string `json:"createdAt"` + // description: Optional description of the badge. + Description *string `json:"description,omitempty"` + // image: Badge icon image. + Image *glexrt.Blob `json:"image,omitempty"` + // name: Display name for this badge. + Name string `json:"name"` +} + +func (t *BadgeDef) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.badge.def" + return glexrt.MarshalCBOR(w, t) +} + +func (t *BadgeDef) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/streamplace/badgedefs.go b/pkg/placestream/badgedefs.go similarity index 59% rename from pkg/streamplace/badgedefs.go rename to pkg/placestream/badgedefs.go index 0856d2ef..818de051 100644 --- a/pkg/streamplace/badgedefs.go +++ b/pkg/placestream/badgedefs.go @@ -1,36 +1,36 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.badge.defs -package streamplace +package placestream import ( "io" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) // BadgeDefs_BadgeIssuanceView is a "badgeIssuanceView" in the place.stream.badge.defs schema. // // A resolved view of a badge issuance, including def fields for display. type BadgeDefs_BadgeIssuanceView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.badge.defs"` - BadgeType string `json:"badgeType" cborgen:"badgeType"` + LexiconTypeID string `json:"$type"` + BadgeType string `json:"badgeType"` // description: Description from the badge definition. - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Description *string `json:"description,omitempty"` // imageUrl: Resolved image URL for the badge icon. - ImageUrl *string `json:"imageUrl,omitempty" cborgen:"imageUrl,omitempty"` + ImageUrl *string `json:"imageUrl,omitempty"` // issuanceCid: CID of the place.stream.badge.issuance record. - IssuanceCid *string `json:"issuanceCid,omitempty" cborgen:"issuanceCid,omitempty"` + IssuanceCid *string `json:"issuanceCid,omitempty"` // issuanceUri: AT URI of the place.stream.badge.issuance record. - IssuanceUri string `json:"issuanceUri" cborgen:"issuanceUri"` + IssuanceUri string `json:"issuanceUri"` // issuer: DID of the badge issuer. - Issuer string `json:"issuer" cborgen:"issuer"` + Issuer string `json:"issuer"` // name: Display name from the badge definition. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` + Name *string `json:"name,omitempty"` // selected: Whether this badge is currently in the user's chat profile selection. - Selected *bool `json:"selected,omitempty" cborgen:"selected,omitempty"` + Selected *bool `json:"selected,omitempty"` } func (t *BadgeDefs_BadgeIssuanceView) MarshalCBOR(w io.Writer) error { @@ -39,22 +39,22 @@ func (t *BadgeDefs_BadgeIssuanceView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.badge.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BadgeDefs_BadgeIssuanceView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BadgeDefs_BadgeSlot is a "badgeSlot" in the place.stream.badge.defs schema. // // A display slot containing available issuance-based badges and which one (if any) is currently selected. type BadgeDefs_BadgeSlot struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.badge.defs"` + LexiconTypeID string `json:"$type"` // available: All badges available for this slot. - Available []*BadgeDefs_BadgeIssuanceView `json:"available" cborgen:"available"` + Available []BadgeDefs_BadgeIssuanceView `json:"available"` // selected: The currently selected badge in this slot, if any. - Selected *BadgeDefs_BadgeIssuanceView `json:"selected,omitempty" cborgen:"selected,omitempty"` + Selected *BadgeDefs_BadgeIssuanceView `json:"selected,omitempty"` } func (t *BadgeDefs_BadgeSlot) MarshalCBOR(w io.Writer) error { @@ -63,31 +63,31 @@ func (t *BadgeDefs_BadgeSlot) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.badge.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BadgeDefs_BadgeSlot) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BadgeDefs_BadgeView is a "badgeView" in the place.stream.badge.defs schema. // // View of a badge record, with fields resolved for display. If the DID in issuer is not the current streamplace node, the signature field shall be required. type BadgeDefs_BadgeView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.badge.defs"` - BadgeType string `json:"badgeType" cborgen:"badgeType"` + LexiconTypeID string `json:"$type"` + BadgeType string `json:"badgeType"` // description: Description from the badge definition. - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Description *string `json:"description,omitempty"` // imageUrl: Resolved image URL for the badge icon. - ImageUrl *string `json:"imageUrl,omitempty" cborgen:"imageUrl,omitempty"` + ImageUrl *string `json:"imageUrl,omitempty"` // issuer: DID of the badge issuer. - Issuer string `json:"issuer" cborgen:"issuer"` + Issuer string `json:"issuer"` // name: Display name from the badge definition. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` + Name *string `json:"name,omitempty"` // recipient: DID of the badge recipient. - Recipient string `json:"recipient" cborgen:"recipient"` + Recipient string `json:"recipient"` // signature: TODO: Cryptographic signature of the badge (of a place.stream.key). - Signature *string `json:"signature,omitempty" cborgen:"signature,omitempty"` + Signature *string `json:"signature,omitempty"` } func (t *BadgeDefs_BadgeView) MarshalCBOR(w io.Writer) error { @@ -96,9 +96,9 @@ func (t *BadgeDefs_BadgeView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.badge.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BadgeDefs_BadgeView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/badgegetIssuedBadges.go b/pkg/placestream/badgegetissuedbadges.go similarity index 57% rename from pkg/streamplace/badgegetIssuedBadges.go rename to pkg/placestream/badgegetissuedbadges.go index 32a653f9..98749046 100644 --- a/pkg/streamplace/badgegetIssuedBadges.go +++ b/pkg/placestream/badgegetissuedbadges.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.badge.getIssuedBadges -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type BadgeGetIssuedBadges_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.badge.getIssuedBadges#main"` + LexiconTypeID string `json:"$type"` // server: Computed server badge (streamer, mod, or bot) for the given streamer context. Absent if the user has no server role. - Server *BadgeDefs_BadgeView `json:"server,omitempty" cborgen:"server,omitempty"` + Server *BadgeDefs_BadgeView `json:"server,omitempty"` // streamer: Streamer-issued badges (e.g. VIP) available to the user. - Streamer *BadgeDefs_BadgeSlot `json:"streamer" cborgen:"streamer"` + Streamer BadgeDefs_BadgeSlot `json:"streamer"` // user: Globally-issued cosmetic badges (e.g. event) available to the user. - User *BadgeDefs_BadgeSlot `json:"user" cborgen:"user"` + User BadgeDefs_BadgeSlot `json:"user"` } func (t *BadgeGetIssuedBadges_Output) MarshalCBOR(w io.Writer) error { @@ -29,26 +28,28 @@ func (t *BadgeGetIssuedBadges_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.badge.getIssuedBadges#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BadgeGetIssuedBadges_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BadgeGetIssuedBadges calls the XRPC method "place.stream.badge.getIssuedBadges". // +// Returns badges issued to the authenticated user, organized by display slot. Also indicates which badges are currently selected in the user's chat profile. +// // streamer: DID of the streamer channel to compute the server badge against. -func BadgeGetIssuedBadges(ctx context.Context, c lexutil.LexClient, streamer string) (*BadgeGetIssuedBadges_Output, error) { +func BadgeGetIssuedBadges(ctx context.Context, c glexrt.LexClient, streamer string) (*BadgeGetIssuedBadges_Output, error) { var out BadgeGetIssuedBadges_Output params := map[string]interface{}{} if streamer != "" { params["streamer"] = streamer } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.badge.getIssuedBadges", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.badge.getIssuedBadges", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/badgegetValidBadges.go b/pkg/placestream/badgegetvalidbadges.go similarity index 54% rename from pkg/streamplace/badgegetValidBadges.go rename to pkg/placestream/badgegetvalidbadges.go index 38644ac0..c26318e4 100644 --- a/pkg/streamplace/badgegetValidBadges.go +++ b/pkg/placestream/badgegetvalidbadges.go @@ -1,21 +1,20 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.badge.getValidBadges -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type BadgeGetValidBadges_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.badge.getValidBadges#main"` - Badges []*BadgeDefs_BadgeView `json:"badges" cborgen:"badges"` + LexiconTypeID string `json:"$type"` + Badges []BadgeDefs_BadgeView `json:"badges"` } func (t *BadgeGetValidBadges_Output) MarshalCBOR(w io.Writer) error { @@ -24,26 +23,28 @@ func (t *BadgeGetValidBadges_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.badge.getValidBadges#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BadgeGetValidBadges_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BadgeGetValidBadges calls the XRPC method "place.stream.badge.getValidBadges". // +// # Get valid badges for the authenticated user, optionally in the context of a specific streamer's chat +// // streamer: Optional DID of the streamer for context-specific badges (mod, vip, etc) -func BadgeGetValidBadges(ctx context.Context, c lexutil.LexClient, streamer string) (*BadgeGetValidBadges_Output, error) { +func BadgeGetValidBadges(ctx context.Context, c glexrt.LexClient, streamer string) (*BadgeGetValidBadges_Output, error) { var out BadgeGetValidBadges_Output params := map[string]interface{}{} if streamer != "" { params["streamer"] = streamer } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.badge.getValidBadges", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.badge.getValidBadges", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/badgeissuance.go b/pkg/placestream/badgeissuance.go similarity index 55% rename from pkg/streamplace/badgeissuance.go rename to pkg/placestream/badgeissuance.go index eed6b702..ba677c03 100644 --- a/pkg/streamplace/badgeissuance.go +++ b/pkg/placestream/badgeissuance.go @@ -1,31 +1,30 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.badge.issuance -package streamplace +package placestream import ( "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { - lexutil.RegisterType("place.stream.badge.issuance", &BadgeIssuance{}) + glexrt.RegisterType("place.stream.badge.issuance", &BadgeIssuance{}) } // Grants a specific badge to a recipient. The badge only appears in chat after the recipient adds this record to their place.stream.chat.profile selection array. type BadgeIssuance struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.badge.issuance"` + LexiconTypeID string `json:"$type"` // badge: Strong reference to the place.stream.badge.def record being granted. - Badge *comatproto.RepoStrongRef `json:"badge" cborgen:"badge"` + Badge comatproto.RepoStrongRef `json:"badge"` // createdAt: Client-declared timestamp when this issuance was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // did: The DID of the user being granted the badge. - Did string `json:"did" cborgen:"did"` + Did string `json:"did"` } func (t *BadgeIssuance) MarshalCBOR(w io.Writer) error { @@ -34,9 +33,9 @@ func (t *BadgeIssuance) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.badge.issuance" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BadgeIssuance) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/betagetStatus.go b/pkg/placestream/betagetstatus.go similarity index 56% rename from pkg/streamplace/betagetStatus.go rename to pkg/placestream/betagetstatus.go index 0cf3828b..28990a96 100644 --- a/pkg/streamplace/betagetStatus.go +++ b/pkg/placestream/betagetstatus.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.beta.getStatus -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type BetaGetStatus_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.beta.getStatus#main"` + LexiconTypeID string `json:"$type"` // did: The account this status applies to. - Did string `json:"did" cborgen:"did"` + Did string `json:"did"` // feature: The feature this status applies to (echoes the request). - Feature string `json:"feature" cborgen:"feature"` + Feature string `json:"feature"` // status: granted: the account may use the feature. requested: no grant yet, but an access request is on file. none: no grant and no request. - Status string `json:"status" cborgen:"status"` + Status string `json:"status"` } func (t *BetaGetStatus_Output) MarshalCBOR(w io.Writer) error { @@ -29,18 +28,20 @@ func (t *BetaGetStatus_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.beta.getStatus#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BetaGetStatus_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BetaGetStatus calls the XRPC method "place.stream.beta.getStatus". // +// Report an account's access status for a named beta feature: whether it has been granted (via a trusted place.stream.beta.invite, or because this node isn't beta-gating the feature), has an outstanding place.stream.beta.request, or neither. Defaults to the authenticated caller when `did` is omitted. +// // did: Account to check. Defaults to the authenticated caller's DID when omitted. // feature: Identifier of the beta feature to check (e.g. "vod"). -func BetaGetStatus(ctx context.Context, c lexutil.LexClient, did string, feature string) (*BetaGetStatus_Output, error) { +func BetaGetStatus(ctx context.Context, c glexrt.LexClient, did string, feature string) (*BetaGetStatus_Output, error) { var out BetaGetStatus_Output params := map[string]interface{}{} @@ -48,9 +49,9 @@ func BetaGetStatus(ctx context.Context, c lexutil.LexClient, did string, feature params["did"] = did } params["feature"] = feature - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.beta.getStatus", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.beta.getStatus", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/betainvite.go b/pkg/placestream/betainvite.go similarity index 64% rename from pkg/streamplace/betainvite.go rename to pkg/placestream/betainvite.go index 71823fa8..6f830690 100644 --- a/pkg/streamplace/betainvite.go +++ b/pkg/placestream/betainvite.go @@ -1,30 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.beta.invite -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.beta.invite", &BetaInvite{}) + glexrt.RegisterType("place.stream.beta.invite", &BetaInvite{}) } // Grants a single account access to a named beta feature on this network. Records live in a project-operated repo (the streamplace node's `--beta-invite-did`); operators trust invites only from that one account, by configuration. Each (did, feature) pair gets its own record so individual features can be revoked independently by deleting the corresponding record. type BetaInvite struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.beta.invite"` + LexiconTypeID string `json:"$type"` // createdAt: Client-declared timestamp when this invite was issued. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // did: Account being granted access to the named beta feature. - Did string `json:"did" cborgen:"did"` + Did string `json:"did"` // feature: Identifier of the beta feature being granted (e.g. "vod"). - Feature string `json:"feature" cborgen:"feature"` + Feature string `json:"feature"` } func (t *BetaInvite) MarshalCBOR(w io.Writer) error { @@ -33,9 +32,9 @@ func (t *BetaInvite) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.beta.invite" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BetaInvite) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/betarequest.go b/pkg/placestream/betarequest.go similarity index 66% rename from pkg/streamplace/betarequest.go rename to pkg/placestream/betarequest.go index 8e8f3c8e..6f832497 100644 --- a/pkg/streamplace/betarequest.go +++ b/pkg/placestream/betarequest.go @@ -1,28 +1,27 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.beta.request -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.beta.request", &BetaRequest{}) + glexrt.RegisterType("place.stream.beta.request", &BetaRequest{}) } // Requests access to a named beta feature on this network. Published in the requester's own repo, so the requesting account is the record's authority — there is no separate subject field. Operators index these to surface who is waiting for access; granting access is a separate place.stream.beta.invite record issued by the operator-trusted issuer. Each (requester, feature) pair gets its own record. type BetaRequest struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.beta.request"` + LexiconTypeID string `json:"$type"` // createdAt: Client-declared timestamp when this request was made. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // feature: Identifier of the beta feature being requested (e.g. "vod"). Mirrors the `feature` field on place.stream.beta.invite. - Feature string `json:"feature" cborgen:"feature"` + Feature string `json:"feature"` } func (t *BetaRequest) MarshalCBOR(w io.Writer) error { @@ -31,9 +30,9 @@ func (t *BetaRequest) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.beta.request" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BetaRequest) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/brandingdeleteBlob.go b/pkg/placestream/brandingdeleteblob.go similarity index 53% rename from pkg/streamplace/brandingdeleteBlob.go rename to pkg/placestream/brandingdeleteblob.go index 9eb4dff9..91011b40 100644 --- a/pkg/streamplace/brandingdeleteBlob.go +++ b/pkg/placestream/brandingdeleteblob.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.branding.deleteBlob -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type BrandingDeleteBlob_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.branding.deleteBlob#main"` + LexiconTypeID string `json:"$type"` // broadcaster: DID of the broadcaster. If not provided, uses the server's default broadcaster. - Broadcaster *string `json:"broadcaster,omitempty" cborgen:"broadcaster,omitempty"` + Broadcaster *string `json:"broadcaster,omitempty"` // key: Branding asset key (mainLogo, favicon, siteTitle, etc.) - Key string `json:"key" cborgen:"key"` + Key string `json:"key"` } func (t *BrandingDeleteBlob_Input) MarshalCBOR(w io.Writer) error { @@ -27,16 +26,16 @@ func (t *BrandingDeleteBlob_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.branding.deleteBlob#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BrandingDeleteBlob_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type BrandingDeleteBlob_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.branding.deleteBlob#main"` - Success bool `json:"success" cborgen:"success"` + LexiconTypeID string `json:"$type"` + Success bool `json:"success"` } func (t *BrandingDeleteBlob_Output) MarshalCBOR(w io.Writer) error { @@ -45,19 +44,21 @@ func (t *BrandingDeleteBlob_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.branding.deleteBlob#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BrandingDeleteBlob_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BrandingDeleteBlob calls the XRPC method "place.stream.branding.deleteBlob". -func BrandingDeleteBlob(ctx context.Context, c lexutil.LexClient, input *BrandingDeleteBlob_Input) (*BrandingDeleteBlob_Output, error) { +// +// Delete a branding asset blob. Requires admin authorization. +func BrandingDeleteBlob(ctx context.Context, c glexrt.LexClient, input *BrandingDeleteBlob_Input) (*BrandingDeleteBlob_Output, error) { var out BrandingDeleteBlob_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.branding.deleteBlob", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.branding.deleteBlob", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/brandinggetBlob.go b/pkg/placestream/brandinggetblob.go similarity index 58% rename from pkg/streamplace/brandinggetBlob.go rename to pkg/placestream/brandinggetblob.go index 8c54223b..a2d3bb93 100644 --- a/pkg/streamplace/brandinggetBlob.go +++ b/pkg/placestream/brandinggetblob.go @@ -1,21 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.branding.getBlob -package streamplace +package placestream import ( "bytes" "context" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" ) // BrandingGetBlob calls the XRPC method "place.stream.branding.getBlob". // +// Get a specific branding asset blob by key. +// // broadcaster: DID of the broadcaster. If not provided, uses the server's default broadcaster. // key: Branding asset key (mainLogo, favicon, siteTitle, etc.) -func BrandingGetBlob(ctx context.Context, c lexutil.LexClient, broadcaster string, key string) ([]byte, error) { +func BrandingGetBlob(ctx context.Context, c glexrt.LexClient, broadcaster string, key string) ([]byte, error) { buf := new(bytes.Buffer) params := map[string]interface{}{} @@ -23,9 +25,9 @@ func BrandingGetBlob(ctx context.Context, c lexutil.LexClient, broadcaster strin params["broadcaster"] = broadcaster } params["key"] = key - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.branding.getBlob", params, nil, buf); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.branding.getBlob", params, nil, buf); err != nil { return nil, err } - return buf.Bytes(), nil } diff --git a/pkg/streamplace/brandinggetBranding.go b/pkg/placestream/brandinggetbranding.go similarity index 57% rename from pkg/streamplace/brandinggetBranding.go rename to pkg/placestream/brandinggetbranding.go index 62406a86..b41c017e 100644 --- a/pkg/streamplace/brandinggetBranding.go +++ b/pkg/placestream/brandinggetbranding.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.branding.getBranding -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type BrandingGetBranding_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.branding.getBranding#main"` + LexiconTypeID string `json:"$type"` // assets: List of available branding assets - Assets []*BrandingGetBranding_BrandingAsset `json:"assets" cborgen:"assets"` + Assets []BrandingGetBranding_BrandingAsset `json:"assets"` } func (t *BrandingGetBranding_Output) MarshalCBOR(w io.Writer) error { @@ -25,45 +24,47 @@ func (t *BrandingGetBranding_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.branding.getBranding#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BrandingGetBranding_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BrandingGetBranding calls the XRPC method "place.stream.branding.getBranding". // +// Get all branding configuration for the broadcaster. +// // broadcaster: DID of the broadcaster. If not provided, uses the server's default broadcaster. -func BrandingGetBranding(ctx context.Context, c lexutil.LexClient, broadcaster string) (*BrandingGetBranding_Output, error) { +func BrandingGetBranding(ctx context.Context, c glexrt.LexClient, broadcaster string) (*BrandingGetBranding_Output, error) { var out BrandingGetBranding_Output params := map[string]interface{}{} if broadcaster != "" { params["broadcaster"] = broadcaster } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.branding.getBranding", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.branding.getBranding", params, nil, &out); err != nil { return nil, err } - return &out, nil } // BrandingGetBranding_BrandingAsset is a "brandingAsset" in the place.stream.branding.getBranding schema. type BrandingGetBranding_BrandingAsset struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.branding.getBranding"` + LexiconTypeID string `json:"$type"` // data: Inline data for text assets - Data *string `json:"data,omitempty" cborgen:"data,omitempty"` + Data *string `json:"data,omitempty"` // height: Image height in pixels (optional, for images only) - Height *int64 `json:"height,omitempty" cborgen:"height,omitempty"` + Height *int64 `json:"height,omitempty"` // key: Asset key identifier - Key string `json:"key" cborgen:"key"` + Key string `json:"key"` // mimeType: MIME type of the asset - MimeType string `json:"mimeType" cborgen:"mimeType"` + MimeType string `json:"mimeType"` // url: URL to fetch the asset blob (for images) - Url *string `json:"url,omitempty" cborgen:"url,omitempty"` + Url *string `json:"url,omitempty"` // width: Image width in pixels (optional, for images only) - Width *int64 `json:"width,omitempty" cborgen:"width,omitempty"` + Width *int64 `json:"width,omitempty"` } func (t *BrandingGetBranding_BrandingAsset) MarshalCBOR(w io.Writer) error { @@ -72,9 +73,9 @@ func (t *BrandingGetBranding_BrandingAsset) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.branding.getBranding" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BrandingGetBranding_BrandingAsset) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/brandingupdateBlob.go b/pkg/placestream/brandingupdateblob.go similarity index 52% rename from pkg/streamplace/brandingupdateBlob.go rename to pkg/placestream/brandingupdateblob.go index ed17b159..66ce2f15 100644 --- a/pkg/streamplace/brandingupdateBlob.go +++ b/pkg/placestream/brandingupdateblob.go @@ -1,32 +1,31 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.branding.updateBlob -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type BrandingUpdateBlob_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.branding.updateBlob#main"` + LexiconTypeID string `json:"$type"` // broadcaster: DID of the broadcaster. If not provided, uses the server's default broadcaster. - Broadcaster *string `json:"broadcaster,omitempty" cborgen:"broadcaster,omitempty"` + Broadcaster *string `json:"broadcaster,omitempty"` // data: Base64-encoded blob data - Data string `json:"data" cborgen:"data"` + Data string `json:"data"` // height: Image height in pixels (optional, for images only) - Height *int64 `json:"height,omitempty" cborgen:"height,omitempty"` + Height *int64 `json:"height,omitempty"` // key: Branding asset key (mainLogo, favicon, siteTitle, etc.) - Key string `json:"key" cborgen:"key"` + Key string `json:"key"` // mimeType: MIME type of the blob (e.g., image/png, text/plain) - MimeType string `json:"mimeType" cborgen:"mimeType"` + MimeType string `json:"mimeType"` // width: Image width in pixels (optional, for images only) - Width *int64 `json:"width,omitempty" cborgen:"width,omitempty"` + Width *int64 `json:"width,omitempty"` } func (t *BrandingUpdateBlob_Input) MarshalCBOR(w io.Writer) error { @@ -35,16 +34,16 @@ func (t *BrandingUpdateBlob_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.branding.updateBlob#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BrandingUpdateBlob_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type BrandingUpdateBlob_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.branding.updateBlob#main"` - Success bool `json:"success" cborgen:"success"` + LexiconTypeID string `json:"$type"` + Success bool `json:"success"` } func (t *BrandingUpdateBlob_Output) MarshalCBOR(w io.Writer) error { @@ -53,19 +52,21 @@ func (t *BrandingUpdateBlob_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.branding.updateBlob#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BrandingUpdateBlob_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BrandingUpdateBlob calls the XRPC method "place.stream.branding.updateBlob". -func BrandingUpdateBlob(ctx context.Context, c lexutil.LexClient, input *BrandingUpdateBlob_Input) (*BrandingUpdateBlob_Output, error) { +// +// Update or create a branding asset blob. Requires admin authorization. +func BrandingUpdateBlob(ctx context.Context, c glexrt.LexClient, input *BrandingUpdateBlob_Input) (*BrandingUpdateBlob_Output, error) { var out BrandingUpdateBlob_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.branding.updateBlob", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.branding.updateBlob", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/placestream/broadcastdefs.go b/pkg/placestream/broadcastdefs.go new file mode 100644 index 00000000..bf94f302 --- /dev/null +++ b/pkg/placestream/broadcastdefs.go @@ -0,0 +1,35 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.broadcast.defs + +package placestream + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + appbsky "stream.place/streamplace/pkg/appbsky" +) + +// BroadcastDefs_BroadcastOriginView is a "broadcastOriginView" in the place.stream.broadcast.defs schema. +type BroadcastDefs_BroadcastOriginView struct { + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` +} + +func (t *BroadcastDefs_BroadcastOriginView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.broadcast.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *BroadcastDefs_BroadcastOriginView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/streamplace/broadcastgetBroadcaster.go b/pkg/placestream/broadcastgetbroadcaster.go similarity index 51% rename from pkg/streamplace/broadcastgetBroadcaster.go rename to pkg/placestream/broadcastgetbroadcaster.go index eb7dca38..1b8db581 100644 --- a/pkg/streamplace/broadcastgetBroadcaster.go +++ b/pkg/placestream/broadcastgetbroadcaster.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.broadcast.getBroadcaster -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type BroadcastGetBroadcaster_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.broadcast.getBroadcaster#main"` + LexiconTypeID string `json:"$type"` // admins: Array of DIDs authorized as admins - Admins []string `json:"admins,omitempty" cborgen:"admins,omitempty"` + Admins []string `json:"admins,omitempty"` // broadcaster: DID of the Streamplace broadcaster to which this server belongs - Broadcaster string `json:"broadcaster" cborgen:"broadcaster"` + Broadcaster string `json:"broadcaster"` // server: DID of this particular Streamplace server - Server *string `json:"server,omitempty" cborgen:"server,omitempty"` + Server *string `json:"server,omitempty"` } func (t *BroadcastGetBroadcaster_Output) MarshalCBOR(w io.Writer) error { @@ -29,19 +28,21 @@ func (t *BroadcastGetBroadcaster_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.broadcast.getBroadcaster#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BroadcastGetBroadcaster_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // BroadcastGetBroadcaster calls the XRPC method "place.stream.broadcast.getBroadcaster". -func BroadcastGetBroadcaster(ctx context.Context, c lexutil.LexClient) (*BroadcastGetBroadcaster_Output, error) { +// +// Get information about a Streamplace broadcaster. +func BroadcastGetBroadcaster(ctx context.Context, c glexrt.LexClient) (*BroadcastGetBroadcaster_Output, error) { var out BroadcastGetBroadcaster_Output - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.broadcast.getBroadcaster", nil, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.broadcast.getBroadcaster", nil, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/broadcastorigin.go b/pkg/placestream/broadcastorigin.go similarity index 56% rename from pkg/streamplace/broadcastorigin.go rename to pkg/placestream/broadcastorigin.go index 09d79e1b..ac891b41 100644 --- a/pkg/streamplace/broadcastorigin.go +++ b/pkg/placestream/broadcastorigin.go @@ -1,36 +1,35 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.broadcast.origin -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.broadcast.origin", &BroadcastOrigin{}) + glexrt.RegisterType("place.stream.broadcast.origin", &BroadcastOrigin{}) } // Record indicating a livestream is published and available for replication at a given address. By convention, the record key is streamer::server type BroadcastOrigin struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.broadcast.origin"` + LexiconTypeID string `json:"$type"` // broadcaster: did of the broadcaster that operates the server syndicating the livestream - Broadcaster *string `json:"broadcaster,omitempty" cborgen:"broadcaster,omitempty"` + Broadcaster *string `json:"broadcaster,omitempty"` // irohTicket: Iroh ticket that can be used to access the livestream from the server - IrohTicket *string `json:"irohTicket,omitempty" cborgen:"irohTicket,omitempty"` + IrohTicket *string `json:"irohTicket,omitempty"` // server: did of the server that's currently rebroadcasting the livestream - Server string `json:"server" cborgen:"server"` + Server string `json:"server"` // streamer: DID of the streamer whose livestream is being published - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` // updatedAt: Periodically updated timestamp when this origin last saw a livestream - UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"` + UpdatedAt string `json:"updatedAt"` // websocketURL: URL of the websocket endpoint for the livestream - WebsocketURL *string `json:"websocketURL,omitempty" cborgen:"websocketURL,omitempty"` + WebsocketURL *string `json:"websocketURL,omitempty"` } func (t *BroadcastOrigin) MarshalCBOR(w io.Writer) error { @@ -39,9 +38,9 @@ func (t *BroadcastOrigin) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.broadcast.origin" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BroadcastOrigin) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/broadcastsyndication.go b/pkg/placestream/broadcastsyndication.go similarity index 57% rename from pkg/streamplace/broadcastsyndication.go rename to pkg/placestream/broadcastsyndication.go index 949c0415..601dedcc 100644 --- a/pkg/streamplace/broadcastsyndication.go +++ b/pkg/placestream/broadcastsyndication.go @@ -1,30 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.broadcast.syndication -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.broadcast.syndication", &BroadcastSyndication{}) + glexrt.RegisterType("place.stream.broadcast.syndication", &BroadcastSyndication{}) } // Record created by a Streamplace broadcaster to indicate that they will be replicating a livestream. NYI type BroadcastSyndication struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.broadcast.syndication"` + LexiconTypeID string `json:"$type"` // broadcaster: DID of the Streamplace broadcaster that will be replicating the livestream - Broadcaster string `json:"broadcaster" cborgen:"broadcaster"` + Broadcaster string `json:"broadcaster"` // createdAt: Client-declared timestamp when this syndication was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // streamer: DID of the streamer whose livestream is being replicated - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *BroadcastSyndication) MarshalCBOR(w io.Writer) error { @@ -33,9 +32,9 @@ func (t *BroadcastSyndication) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.broadcast.syndication" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *BroadcastSyndication) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/chatdefs.go b/pkg/placestream/chatdefs.go similarity index 52% rename from pkg/streamplace/chatdefs.go rename to pkg/placestream/chatdefs.go index 06fefd8d..7e150781 100644 --- a/pkg/streamplace/chatdefs.go +++ b/pkg/placestream/chatdefs.go @@ -1,34 +1,34 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.chat.defs -package streamplace +package placestream import ( + "bytes" "encoding/json" "fmt" "io" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" ) // ChatDefs_MessageView is a "messageView" in the place.stream.chat.defs schema. type ChatDefs_MessageView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.defs"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` // badges: Up to 3 badge tokens to display with the message. First badge is server-controlled, remaining badges are user-settable. Tokens are looked up in badges.json for display info. - Badges []*BadgeDefs_BadgeView `json:"badges,omitempty" cborgen:"badges,omitempty"` - ChatProfile *ChatProfile `json:"chatProfile,omitempty" cborgen:"chatProfile,omitempty"` - Cid string `json:"cid" cborgen:"cid"` + Badges []BadgeDefs_BadgeView `json:"badges,omitempty"` + ChatProfile *ChatProfile `json:"chatProfile,omitempty"` + Cid string `json:"cid"` // deleted: If true, this message has been deleted or labeled and should be cleared from the cache - Deleted *bool `json:"deleted,omitempty" cborgen:"deleted,omitempty"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - ReplyTo *ChatDefs_MessageView_ReplyTo `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"` - Uri string `json:"uri" cborgen:"uri"` + Deleted *bool `json:"deleted,omitempty"` + IndexedAt string `json:"indexedAt"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + ReplyTo *ChatDefs_MessageView_ReplyTo `json:"replyTo,omitempty"` + Uri string `json:"uri"` } func (t *ChatDefs_MessageView) MarshalCBOR(w io.Writer) error { @@ -37,11 +37,11 @@ func (t *ChatDefs_MessageView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatDefs_MessageView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ChatDefs_MessageView_ReplyTo struct { @@ -57,7 +57,7 @@ func (t *ChatDefs_MessageView_ReplyTo) MarshalJSON() ([]byte, error) { } func (t *ChatDefs_MessageView_ReplyTo) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -71,17 +71,44 @@ func (t *ChatDefs_MessageView_ReplyTo) UnmarshalJSON(b []byte) error { } } +func (t *ChatDefs_MessageView_ReplyTo) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.ChatDefs_MessageView != nil { + return t.ChatDefs_MessageView.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ChatDefs_MessageView_ReplyTo) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "place.stream.chat.defs#messageView": + t.ChatDefs_MessageView = new(ChatDefs_MessageView) + return t.ChatDefs_MessageView.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + // ChatDefs_PinnedRecordView is a "pinnedRecordView" in the place.stream.chat.defs schema. // // View of a pinned chat record with hydrated message data. type ChatDefs_PinnedRecordView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.defs"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - Message *ChatDefs_MessageView `json:"message,omitempty" cborgen:"message,omitempty"` - PinnedBy *ChatProfile `json:"pinnedBy,omitempty" cborgen:"pinnedBy,omitempty"` - Record *ChatPinnedRecord `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + IndexedAt string `json:"indexedAt"` + Message *ChatDefs_MessageView `json:"message,omitempty"` + PinnedBy *ChatProfile `json:"pinnedBy,omitempty"` + Record ChatPinnedRecord `json:"record"` + Uri string `json:"uri"` } func (t *ChatDefs_PinnedRecordView) MarshalCBOR(w io.Writer) error { @@ -90,9 +117,9 @@ func (t *ChatDefs_PinnedRecordView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatDefs_PinnedRecordView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/chatgate.go b/pkg/placestream/chatgate.go similarity index 51% rename from pkg/streamplace/chatgate.go rename to pkg/placestream/chatgate.go index 9a8412ae..11ac96f6 100644 --- a/pkg/streamplace/chatgate.go +++ b/pkg/placestream/chatgate.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.chat.gate -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.chat.gate", &ChatGate{}) + glexrt.RegisterType("place.stream.chat.gate", &ChatGate{}) } // Record defining a single gated chat message. type ChatGate struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.gate"` + LexiconTypeID string `json:"$type"` // hiddenMessage: URI of the hidden chat message. - HiddenMessage string `json:"hiddenMessage" cborgen:"hiddenMessage"` + HiddenMessage string `json:"hiddenMessage"` } func (t *ChatGate) MarshalCBOR(w io.Writer) error { @@ -29,9 +28,9 @@ func (t *ChatGate) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.gate" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatGate) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/chatmessage.go b/pkg/placestream/chatmessage.go similarity index 50% rename from pkg/streamplace/chatmessage.go rename to pkg/placestream/chatmessage.go index 5a68d5c9..a147f251 100644 --- a/pkg/streamplace/chatmessage.go +++ b/pkg/placestream/chatmessage.go @@ -1,34 +1,33 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.chat.message -package streamplace +package placestream import ( "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { - lexutil.RegisterType("place.stream.chat.message", &ChatMessage{}) + glexrt.RegisterType("place.stream.chat.message", &ChatMessage{}) } // Record containing a Streamplace chat message. type ChatMessage struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.message"` + LexiconTypeID string `json:"$type"` // createdAt: Client-declared timestamp when this message was originally created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // facets: Annotations of text (mentions, URLs, etc) - Facets []*RichtextFacet `json:"facets,omitempty" cborgen:"facets,omitempty"` - Reply *ChatMessage_ReplyRef `json:"reply,omitempty" cborgen:"reply,omitempty"` + Facets []RichtextFacet `json:"facets,omitempty"` + Reply *ChatMessage_ReplyRef `json:"reply,omitempty"` // streamer: The DID of the streamer whose chat this is. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` // text: The primary message content. May be an empty string, if there are embeds. - Text string `json:"text" cborgen:"text"` + Text string `json:"text"` } func (t *ChatMessage) MarshalCBOR(w io.Writer) error { @@ -37,18 +36,18 @@ func (t *ChatMessage) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.message" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatMessage) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ChatMessage_ReplyRef is a "replyRef" in the place.stream.chat.message schema. type ChatMessage_ReplyRef struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.message"` - Parent *comatproto.RepoStrongRef `json:"parent" cborgen:"parent"` - Root *comatproto.RepoStrongRef `json:"root" cborgen:"root"` + LexiconTypeID string `json:"$type"` + Parent comatproto.RepoStrongRef `json:"parent"` + Root comatproto.RepoStrongRef `json:"root"` } func (t *ChatMessage_ReplyRef) MarshalCBOR(w io.Writer) error { @@ -57,9 +56,9 @@ func (t *ChatMessage_ReplyRef) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.message" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatMessage_ReplyRef) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/chatpinnedRecord.go b/pkg/placestream/chatpinnedrecord.go similarity index 51% rename from pkg/streamplace/chatpinnedRecord.go rename to pkg/placestream/chatpinnedrecord.go index 35003005..68f9ac8a 100644 --- a/pkg/streamplace/chatpinnedRecord.go +++ b/pkg/placestream/chatpinnedrecord.go @@ -1,32 +1,31 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.chat.pinnedRecord -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.chat.pinnedRecord", &ChatPinnedRecord{}) + glexrt.RegisterType("place.stream.chat.pinnedRecord", &ChatPinnedRecord{}) } // Record pinning a chat message for prominent display. type ChatPinnedRecord struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.pinnedRecord"` + LexiconTypeID string `json:"$type"` // createdAt: When this pin was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // expiresAt: Optional expiration time. If set, the pin is considered inactive after this time. - ExpiresAt *string `json:"expiresAt,omitempty" cborgen:"expiresAt,omitempty"` + ExpiresAt *string `json:"expiresAt,omitempty"` // pinnedBy: DID of the user who pinned the message. - PinnedBy *string `json:"pinnedBy,omitempty" cborgen:"pinnedBy,omitempty"` + PinnedBy *string `json:"pinnedBy,omitempty"` // pinnedMessage: AT-URI of the pinned chat message. - PinnedMessage string `json:"pinnedMessage" cborgen:"pinnedMessage"` + PinnedMessage string `json:"pinnedMessage"` } func (t *ChatPinnedRecord) MarshalCBOR(w io.Writer) error { @@ -35,9 +34,9 @@ func (t *ChatPinnedRecord) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.pinnedRecord" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatPinnedRecord) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/chatprofile.go b/pkg/placestream/chatprofile.go similarity index 58% rename from pkg/streamplace/chatprofile.go rename to pkg/placestream/chatprofile.go index e958c992..0193f7cd 100644 --- a/pkg/streamplace/chatprofile.go +++ b/pkg/placestream/chatprofile.go @@ -1,30 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.chat.profile -package streamplace +package placestream import ( "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { - lexutil.RegisterType("place.stream.chat.profile", &ChatProfile{}) + glexrt.RegisterType("place.stream.chat.profile", &ChatProfile{}) } // Record containing customizations for a user's chat profile. type ChatProfile struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.profile"` + LexiconTypeID string `json:"$type"` // badges: Badge selections for display in chat. - Badges *ChatProfile_BadgeSelections `json:"badges,omitempty" cborgen:"badges,omitempty"` - Color *ChatProfile_Color `json:"color,omitempty" cborgen:"color,omitempty"` + Badges *ChatProfile_BadgeSelections `json:"badges,omitempty"` + Color *ChatProfile_Color `json:"color,omitempty"` // selfLabels: Self-applied labels for this profile, e.g. 'bot'. - SelfLabels []*string `json:"selfLabels,omitempty" cborgen:"selfLabels,omitempty"` + SelfLabels []string `json:"selfLabels,omitempty"` } func (t *ChatProfile) MarshalCBOR(w io.Writer) error { @@ -33,22 +32,22 @@ func (t *ChatProfile) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.profile" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatProfile) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ChatProfile_BadgeSelections is a "badgeSelections" in the place.stream.chat.profile schema. // // Selected badges for display in chat, organized by slot. type ChatProfile_BadgeSelections struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.profile"` + LexiconTypeID string `json:"$type"` // global: Selected globally-issued badge (e.g. event badge). - Global *comatproto.RepoStrongRef `json:"global,omitempty" cborgen:"global,omitempty"` + Global *comatproto.RepoStrongRef `json:"global,omitempty"` // streamer: Selected streamer-issued badges, one per streamer channel. - Streamer []*ChatProfile_StreamerBadgeSelection `json:"streamer,omitempty" cborgen:"streamer,omitempty"` + Streamer []ChatProfile_StreamerBadgeSelection `json:"streamer,omitempty"` } func (t *ChatProfile_BadgeSelections) MarshalCBOR(w io.Writer) error { @@ -57,21 +56,21 @@ func (t *ChatProfile_BadgeSelections) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.profile" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatProfile_BadgeSelections) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ChatProfile_Color is a "color" in the place.stream.chat.profile schema. // // Customizations for the color of a user's name in chat type ChatProfile_Color struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.profile"` - Blue int64 `json:"blue" cborgen:"blue"` - Green int64 `json:"green" cborgen:"green"` - Red int64 `json:"red" cborgen:"red"` + LexiconTypeID string `json:"$type"` + Blue int64 `json:"blue"` + Green int64 `json:"green"` + Red int64 `json:"red"` } func (t *ChatProfile_Color) MarshalCBOR(w io.Writer) error { @@ -80,22 +79,22 @@ func (t *ChatProfile_Color) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.profile" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatProfile_Color) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ChatProfile_StreamerBadgeSelection is a "streamerBadgeSelection" in the place.stream.chat.profile schema. // // A selected badge for a specific streamer's channel. type ChatProfile_StreamerBadgeSelection struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.chat.profile"` + LexiconTypeID string `json:"$type"` // badge: Strong reference to the selected place.stream.badge.issuance record. - Badge *comatproto.RepoStrongRef `json:"badge" cborgen:"badge"` + Badge comatproto.RepoStrongRef `json:"badge"` // streamer: DID of the streamer whose channel this selection applies to. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ChatProfile_StreamerBadgeSelection) MarshalCBOR(w io.Writer) error { @@ -104,9 +103,9 @@ func (t *ChatProfile_StreamerBadgeSelection) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.chat.profile" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ChatProfile_StreamerBadgeSelection) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/placestream/configgetenv.go b/pkg/placestream/configgetenv.go new file mode 100644 index 00000000..fd6aa0ee --- /dev/null +++ b/pkg/placestream/configgetenv.go @@ -0,0 +1,46 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.config.getEnv + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ConfigGetEnv_Output struct { + LexiconTypeID string `json:"$type"` + // gamesEnabled: Whether the games API is configured and available + GamesEnabled *bool `json:"gamesEnabled,omitempty"` + // playbackWorkerUrl: URL of the Cloudflare playback router worker + PlaybackWorkerUrl *string `json:"playbackWorkerUrl,omitempty"` +} + +func (t *ConfigGetEnv_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.config.getEnv#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ConfigGetEnv_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ConfigGetEnv calls the XRPC method "place.stream.config.getEnv". +// +// Get client-facing environment configuration from the server. +func ConfigGetEnv(ctx context.Context, c glexrt.LexClient) (*ConfigGetEnv_Output, error) { + var out ConfigGetEnv_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.config.getEnv", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/streamplace/defs.go b/pkg/placestream/defs.go similarity index 54% rename from pkg/streamplace/defs.go rename to pkg/placestream/defs.go index d55e825d..b91f2e49 100644 --- a/pkg/streamplace/defs.go +++ b/pkg/placestream/defs.go @@ -1,25 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.defs -package streamplace +package placestream import ( "io" - appbsky "github.com/bluesky-social/indigo/api/bsky" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" ) // Defs_ActivityGame is a "activityGame" in the place.stream.defs schema. // // A game from the gamesgamesgamesgames catalog, identified by its AT URI. type Defs_ActivityGame struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.defs"` + LexiconTypeID string `json:"$type"` // name: Cached display name of the game. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` - Uri string `json:"uri" cborgen:"uri"` + Name *string `json:"name,omitempty"` + Uri string `json:"uri"` } func (t *Defs_ActivityGame) MarshalCBOR(w io.Writer) error { @@ -28,19 +28,19 @@ func (t *Defs_ActivityGame) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Defs_ActivityGame) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Defs_ActivityLabel is a "activityLabel" in the place.stream.defs schema. // // A non-game activity with a well-known label. type Defs_ActivityLabel struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.defs"` - Label string `json:"label" cborgen:"label"` + LexiconTypeID string `json:"$type"` + Label string `json:"label"` } func (t *Defs_ActivityLabel) MarshalCBOR(w io.Writer) error { @@ -49,21 +49,21 @@ func (t *Defs_ActivityLabel) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Defs_ActivityLabel) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Defs_BlockView is a "blockView" in the place.stream.defs schema. type Defs_BlockView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.defs"` - Blocker *appbsky.ActorDefs_ProfileViewBasic `json:"blocker" cborgen:"blocker"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - Record *appbsky.GraphBlock `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` + LexiconTypeID string `json:"$type"` + Blocker appbsky.ActorDefs_ProfileViewBasic `json:"blocker"` + Cid string `json:"cid"` + IndexedAt string `json:"indexedAt"` + Record appbsky.GraphBlock `json:"record"` + Uri string `json:"uri"` } func (t *Defs_BlockView) MarshalCBOR(w io.Writer) error { @@ -72,17 +72,17 @@ func (t *Defs_BlockView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Defs_BlockView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Defs_Rendition is a "rendition" in the place.stream.defs schema. type Defs_Rendition struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.defs"` - Name string `json:"name" cborgen:"name"` + LexiconTypeID string `json:"$type"` + Name string `json:"name"` } func (t *Defs_Rendition) MarshalCBOR(w io.Writer) error { @@ -91,17 +91,17 @@ func (t *Defs_Rendition) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Defs_Rendition) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Defs_Renditions is a "renditions" in the place.stream.defs schema. type Defs_Renditions struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.defs"` - Renditions []*Defs_Rendition `json:"renditions" cborgen:"renditions"` + LexiconTypeID string `json:"$type"` + Renditions []Defs_Rendition `json:"renditions"` } func (t *Defs_Renditions) MarshalCBOR(w io.Writer) error { @@ -110,9 +110,9 @@ func (t *Defs_Renditions) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Defs_Renditions) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/placestream/gamegetgame.go b/pkg/placestream/gamegetgame.go new file mode 100644 index 00000000..88455c8e --- /dev/null +++ b/pkg/placestream/gamegetgame.go @@ -0,0 +1,48 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.game.getGame + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type GameGetGame_Output struct { + LexiconTypeID string `json:"$type"` + CoverUrl *string `json:"coverUrl,omitempty"` + Genres []string `json:"genres,omitempty"` + Name string `json:"name"` + Summary *string `json:"summary,omitempty"` + Uri string `json:"uri"` +} + +func (t *GameGetGame_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.game.getGame#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GameGetGame_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GameGetGame calls the XRPC method "place.stream.game.getGame". +func GameGetGame(ctx context.Context, c glexrt.LexClient, uri string) (*GameGetGame_Output, error) { + var out GameGetGame_Output + + params := map[string]interface{}{} + params["uri"] = uri + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.game.getGame", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/streamplace/gamesearch.go b/pkg/placestream/gamesearch.go similarity index 54% rename from pkg/streamplace/gamesearch.go rename to pkg/placestream/gamesearch.go index 320108c4..65f73ca5 100644 --- a/pkg/streamplace/gamesearch.go +++ b/pkg/placestream/gamesearch.go @@ -1,26 +1,26 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.game.search -package streamplace +package placestream import ( + "bytes" "context" "encoding/json" "fmt" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - gamesgamesgamesgamesgames "stream.place/streamplace/pkg/gamesgamesgamesgames" - lex "stream.place/streamplace/pkg/lex" + gamesgamesgamesgamesgames "stream.place/streamplace/pkg/gamesgamesgamesgamesgames" ) type GameSearch_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.game.search#main"` - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Results []*GameSearch_Output_Results_Elem `json:"results" cborgen:"results"` - TotalResults *int64 `json:"totalResults,omitempty" cborgen:"totalResults,omitempty"` + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Results []GameSearch_Output_Results_Elem `json:"results"` + TotalResults *int64 `json:"totalResults,omitempty"` } func (t *GameSearch_Output) MarshalCBOR(w io.Writer) error { @@ -29,87 +29,140 @@ func (t *GameSearch_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.game.search#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *GameSearch_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type GameSearch_Output_Results_Elem struct { - Defs_GameSummaryView *gamesgamesgamesgamesgames.Defs_GameSummaryView - Defs_ProfileSummaryView *gamesgamesgamesgamesgames.Defs_ProfileSummaryView - Defs_PlatformSummaryView *gamesgamesgamesgamesgames.Defs_PlatformSummaryView Defs_CollectionSummaryView *gamesgamesgamesgamesgames.Defs_CollectionSummaryView Defs_EngineSummaryView *gamesgamesgamesgamesgames.Defs_EngineSummaryView + Defs_GameSummaryView *gamesgamesgamesgamesgames.Defs_GameSummaryView + Defs_PlatformSummaryView *gamesgamesgamesgamesgames.Defs_PlatformSummaryView + Defs_ProfileSummaryView *gamesgamesgamesgamesgames.Defs_ProfileSummaryView } func (t *GameSearch_Output_Results_Elem) MarshalJSON() ([]byte, error) { + if t.Defs_CollectionSummaryView != nil { + t.Defs_CollectionSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#collectionSummaryView" + return json.Marshal(t.Defs_CollectionSummaryView) + } + if t.Defs_EngineSummaryView != nil { + t.Defs_EngineSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#engineSummaryView" + return json.Marshal(t.Defs_EngineSummaryView) + } if t.Defs_GameSummaryView != nil { t.Defs_GameSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#gameSummaryView" return json.Marshal(t.Defs_GameSummaryView) } - if t.Defs_ProfileSummaryView != nil { - t.Defs_ProfileSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#profileSummaryView" - return json.Marshal(t.Defs_ProfileSummaryView) - } if t.Defs_PlatformSummaryView != nil { t.Defs_PlatformSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#platformSummaryView" return json.Marshal(t.Defs_PlatformSummaryView) } - if t.Defs_CollectionSummaryView != nil { - t.Defs_CollectionSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#collectionSummaryView" - return json.Marshal(t.Defs_CollectionSummaryView) - } - if t.Defs_EngineSummaryView != nil { - t.Defs_EngineSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#engineSummaryView" - return json.Marshal(t.Defs_EngineSummaryView) + if t.Defs_ProfileSummaryView != nil { + t.Defs_ProfileSummaryView.LexiconTypeID = "games.gamesgamesgamesgames.defs#profileSummaryView" + return json.Marshal(t.Defs_ProfileSummaryView) } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *GameSearch_Output_Results_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } switch typ { + case "games.gamesgamesgamesgames.defs#collectionSummaryView": + t.Defs_CollectionSummaryView = new(gamesgamesgamesgamesgames.Defs_CollectionSummaryView) + return json.Unmarshal(b, t.Defs_CollectionSummaryView) + case "games.gamesgamesgamesgames.defs#engineSummaryView": + t.Defs_EngineSummaryView = new(gamesgamesgamesgamesgames.Defs_EngineSummaryView) + return json.Unmarshal(b, t.Defs_EngineSummaryView) case "games.gamesgamesgamesgames.defs#gameSummaryView": t.Defs_GameSummaryView = new(gamesgamesgamesgamesgames.Defs_GameSummaryView) return json.Unmarshal(b, t.Defs_GameSummaryView) - case "games.gamesgamesgamesgames.defs#profileSummaryView": - t.Defs_ProfileSummaryView = new(gamesgamesgamesgamesgames.Defs_ProfileSummaryView) - return json.Unmarshal(b, t.Defs_ProfileSummaryView) case "games.gamesgamesgamesgames.defs#platformSummaryView": t.Defs_PlatformSummaryView = new(gamesgamesgamesgamesgames.Defs_PlatformSummaryView) return json.Unmarshal(b, t.Defs_PlatformSummaryView) + case "games.gamesgamesgamesgames.defs#profileSummaryView": + t.Defs_ProfileSummaryView = new(gamesgamesgamesgamesgames.Defs_ProfileSummaryView) + return json.Unmarshal(b, t.Defs_ProfileSummaryView) + default: + return nil + } +} + +func (t *GameSearch_Output_Results_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.Defs_CollectionSummaryView != nil { + return t.Defs_CollectionSummaryView.MarshalCBOR(w) + } + if t.Defs_EngineSummaryView != nil { + return t.Defs_EngineSummaryView.MarshalCBOR(w) + } + if t.Defs_GameSummaryView != nil { + return t.Defs_GameSummaryView.MarshalCBOR(w) + } + if t.Defs_PlatformSummaryView != nil { + return t.Defs_PlatformSummaryView.MarshalCBOR(w) + } + if t.Defs_ProfileSummaryView != nil { + return t.Defs_ProfileSummaryView.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *GameSearch_Output_Results_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { case "games.gamesgamesgamesgames.defs#collectionSummaryView": t.Defs_CollectionSummaryView = new(gamesgamesgamesgamesgames.Defs_CollectionSummaryView) - return json.Unmarshal(b, t.Defs_CollectionSummaryView) + return t.Defs_CollectionSummaryView.UnmarshalCBOR(bytes.NewReader(b)) case "games.gamesgamesgamesgames.defs#engineSummaryView": t.Defs_EngineSummaryView = new(gamesgamesgamesgamesgames.Defs_EngineSummaryView) - return json.Unmarshal(b, t.Defs_EngineSummaryView) + return t.Defs_EngineSummaryView.UnmarshalCBOR(bytes.NewReader(b)) + case "games.gamesgamesgamesgames.defs#gameSummaryView": + t.Defs_GameSummaryView = new(gamesgamesgamesgamesgames.Defs_GameSummaryView) + return t.Defs_GameSummaryView.UnmarshalCBOR(bytes.NewReader(b)) + case "games.gamesgamesgamesgames.defs#platformSummaryView": + t.Defs_PlatformSummaryView = new(gamesgamesgamesgamesgames.Defs_PlatformSummaryView) + return t.Defs_PlatformSummaryView.UnmarshalCBOR(bytes.NewReader(b)) + case "games.gamesgamesgamesgames.defs#profileSummaryView": + t.Defs_ProfileSummaryView = new(gamesgamesgamesgamesgames.Defs_ProfileSummaryView) + return t.Defs_ProfileSummaryView.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } } // GameSearch calls the XRPC method "place.stream.game.search". -func GameSearch(ctx context.Context, c lexutil.LexClient, cursor string, limit int64, q string) (*GameSearch_Output, error) { +// +// Search for games and other entities via the games.gamesgamesgamesgames catalog. Proxied from the configured games API. +func GameSearch(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, q string) (*GameSearch_Output, error) { var out GameSearch_Output params := map[string]interface{}{} if cursor != "" { params["cursor"] = cursor } - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } params["q"] = q - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.game.search", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.game.search", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/placestream/getlikes.go b/pkg/placestream/getlikes.go new file mode 100644 index 00000000..800fb75e --- /dev/null +++ b/pkg/placestream/getlikes.go @@ -0,0 +1,84 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.getLikes + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + appbsky "stream.place/streamplace/pkg/appbsky" +) + +type GetLikes_Output struct { + LexiconTypeID string `json:"$type"` + // count: Total number of likes for this subject. + Count int64 `json:"count"` + Cursor *string `json:"cursor,omitempty"` + Likes []GetLikes_LikeView `json:"likes,omitempty"` + Subject string `json:"subject"` +} + +func (t *GetLikes_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.getLikes#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GetLikes_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// GetLikes calls the XRPC method "place.stream.getLikes". +// +// Get likes for a subject (video or comment). +// +// cursor: Optional pagination cursor. +// limit: Maximum number of likes to return. +// subject: AT-URI of the subject (video or comment). +func GetLikes(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, subject string) (*GetLikes_Output, error) { + var out GetLikes_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + params["subject"] = subject + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.getLikes", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// GetLikes_LikeView is a "likeView" in the place.stream.getLikes schema. +type GetLikes_LikeView struct { + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` + IndexedAt string `json:"indexedAt"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` +} + +func (t *GetLikes_LikeView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.getLikes" + return glexrt.MarshalCBOR(w, t) +} + +func (t *GetLikes_LikeView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/streamplace/graphgetFollowingUser.go b/pkg/placestream/graphgetfollowinguser.go similarity index 56% rename from pkg/streamplace/graphgetFollowingUser.go rename to pkg/placestream/graphgetfollowinguser.go index 659d068c..74a8227c 100644 --- a/pkg/streamplace/graphgetFollowingUser.go +++ b/pkg/placestream/graphgetfollowinguser.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.graph.getFollowingUser -package streamplace +package placestream import ( "context" "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + comatproto "stream.place/streamplace/pkg/comatproto" ) type GraphGetFollowingUser_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.graph.getFollowingUser#main"` - Follow *comatproto.RepoStrongRef `json:"follow,omitempty" cborgen:"follow,omitempty"` + LexiconTypeID string `json:"$type"` + Follow *comatproto.RepoStrongRef `json:"follow,omitempty"` } func (t *GraphGetFollowingUser_Output) MarshalCBOR(w io.Writer) error { @@ -25,26 +24,28 @@ func (t *GraphGetFollowingUser_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.graph.getFollowingUser#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *GraphGetFollowingUser_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // GraphGetFollowingUser calls the XRPC method "place.stream.graph.getFollowingUser". // +// Get whether or not user A is following user B. +// // subjectDID: The DID of the user potentially being followed // userDID: The DID of the potentially-following user -func GraphGetFollowingUser(ctx context.Context, c lexutil.LexClient, subjectDID string, userDID string) (*GraphGetFollowingUser_Output, error) { +func GraphGetFollowingUser(ctx context.Context, c glexrt.LexClient, subjectDID string, userDID string) (*GraphGetFollowingUser_Output, error) { var out GraphGetFollowingUser_Output params := map[string]interface{}{} params["subjectDID"] = subjectDID params["userDID"] = userDID - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.graph.getFollowingUser", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.graph.getFollowingUser", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/ingestdefs.go b/pkg/placestream/ingestdefs.go similarity index 64% rename from pkg/streamplace/ingestdefs.go rename to pkg/placestream/ingestdefs.go index 4cab0175..ab5a4add 100644 --- a/pkg/streamplace/ingestdefs.go +++ b/pkg/placestream/ingestdefs.go @@ -1,25 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.ingest.defs -package streamplace +package placestream import ( "io" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) // IngestDefs_Ingest is a "ingest" in the place.stream.ingest.defs schema. // // An ingest URL for a Streamplace station. type IngestDefs_Ingest struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.ingest.defs"` + LexiconTypeID string `json:"$type"` // type: The type of ingest endpoint, currently 'rtmp' and 'whip' are supported. - Type string `json:"type" cborgen:"type"` + Type string `json:"type"` // url: The URL of the ingest endpoint. - Url string `json:"url" cborgen:"url"` + Url string `json:"url"` } func (t *IngestDefs_Ingest) MarshalCBOR(w io.Writer) error { @@ -28,9 +28,9 @@ func (t *IngestDefs_Ingest) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.ingest.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *IngestDefs_Ingest) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/ingestgetIngestUrls.go b/pkg/placestream/ingestgetingesturls.go similarity index 50% rename from pkg/streamplace/ingestgetIngestUrls.go rename to pkg/placestream/ingestgetingesturls.go index e030963b..0eb6ccf8 100644 --- a/pkg/streamplace/ingestgetIngestUrls.go +++ b/pkg/placestream/ingestgetingesturls.go @@ -1,23 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.ingest.getIngestUrls -package streamplace +package placestream import ( + "bytes" "context" "encoding/json" "fmt" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type IngestGetIngestUrls_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.ingest.getIngestUrls#main"` - Ingests []*IngestGetIngestUrls_Output_Ingests_Elem `json:"ingests" cborgen:"ingests"` + LexiconTypeID string `json:"$type"` + Ingests []IngestGetIngestUrls_Output_Ingests_Elem `json:"ingests"` } func (t *IngestGetIngestUrls_Output) MarshalCBOR(w io.Writer) error { @@ -26,11 +26,11 @@ func (t *IngestGetIngestUrls_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.ingest.getIngestUrls#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *IngestGetIngestUrls_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type IngestGetIngestUrls_Output_Ingests_Elem struct { @@ -46,7 +46,7 @@ func (t *IngestGetIngestUrls_Output_Ingests_Elem) MarshalJSON() ([]byte, error) } func (t *IngestGetIngestUrls_Output_Ingests_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -60,12 +60,41 @@ func (t *IngestGetIngestUrls_Output_Ingests_Elem) UnmarshalJSON(b []byte) error } } +func (t *IngestGetIngestUrls_Output_Ingests_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.IngestDefs_Ingest != nil { + return t.IngestDefs_Ingest.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *IngestGetIngestUrls_Output_Ingests_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "place.stream.ingest.defs#ingest": + t.IngestDefs_Ingest = new(IngestDefs_Ingest) + return t.IngestDefs_Ingest.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + // IngestGetIngestUrls calls the XRPC method "place.stream.ingest.getIngestUrls". -func IngestGetIngestUrls(ctx context.Context, c lexutil.LexClient) (*IngestGetIngestUrls_Output, error) { +// +// Get ingest URLs for a Streamplace station. +func IngestGetIngestUrls(ctx context.Context, c glexrt.LexClient) (*IngestGetIngestUrls_Output, error) { var out IngestGetIngestUrls_Output - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.ingest.getIngestUrls", nil, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.ingest.getIngestUrls", nil, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/key.go b/pkg/placestream/key.go similarity index 51% rename from pkg/streamplace/key.go rename to pkg/placestream/key.go index 55a3a6b9..b590779a 100644 --- a/pkg/streamplace/key.go +++ b/pkg/placestream/key.go @@ -1,30 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.key -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.key", &Key{}) + glexrt.RegisterType("place.stream.key", &Key{}) } // Record linking an atproto identity with a stream signing key type Key struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.key"` + LexiconTypeID string `json:"$type"` // createdAt: Client-declared timestamp when this key was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // createdBy: The name of the client that created this key. - CreatedBy *string `json:"createdBy,omitempty" cborgen:"createdBy,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` // signingKey: The did:key signing key for the stream. - SigningKey string `json:"signingKey" cborgen:"signingKey"` + SigningKey string `json:"signingKey"` } func (t *Key) MarshalCBOR(w io.Writer) error { @@ -33,9 +32,9 @@ func (t *Key) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.key" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Key) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/like.go b/pkg/placestream/like.go similarity index 56% rename from pkg/streamplace/like.go rename to pkg/placestream/like.go index 66b3dd9d..e8eed498 100644 --- a/pkg/streamplace/like.go +++ b/pkg/placestream/like.go @@ -1,28 +1,27 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.like -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.like", &Like{}) + glexrt.RegisterType("place.stream.like", &Like{}) } // Record indicating a like on some other record (e.g. a video or a comment). type Like struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.like"` + LexiconTypeID string `json:"$type"` // createdAt: Client-declared timestamp when this like was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // subject: AT-URI of the record being liked (e.g. a place.stream.video or place.stream.vod.comment). - Subject string `json:"subject" cborgen:"subject"` + Subject string `json:"subject"` } func (t *Like) MarshalCBOR(w io.Writer) error { @@ -31,9 +30,9 @@ func (t *Like) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.like" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Like) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/livedenyTeleport.go b/pkg/placestream/livedenyteleport.go similarity index 54% rename from pkg/streamplace/livedenyTeleport.go rename to pkg/placestream/livedenyteleport.go index c5df7c3d..17cb73ba 100644 --- a/pkg/streamplace/livedenyTeleport.go +++ b/pkg/placestream/livedenyteleport.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.denyTeleport -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type LiveDenyTeleport_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.denyTeleport#main"` + LexiconTypeID string `json:"$type"` // uri: The URI of the teleport record to deny. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *LiveDenyTeleport_Input) MarshalCBOR(w io.Writer) error { @@ -25,17 +24,17 @@ func (t *LiveDenyTeleport_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.denyTeleport#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveDenyTeleport_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type LiveDenyTeleport_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.denyTeleport#main"` + LexiconTypeID string `json:"$type"` // success: Whether the teleport was successfully denied. - Success bool `json:"success" cborgen:"success"` + Success bool `json:"success"` } func (t *LiveDenyTeleport_Output) MarshalCBOR(w io.Writer) error { @@ -44,19 +43,21 @@ func (t *LiveDenyTeleport_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.denyTeleport#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveDenyTeleport_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // LiveDenyTeleport calls the XRPC method "place.stream.live.denyTeleport". -func LiveDenyTeleport(ctx context.Context, c lexutil.LexClient, input *LiveDenyTeleport_Input) (*LiveDenyTeleport_Output, error) { +// +// Deny an incoming teleport request. +func LiveDenyTeleport(ctx context.Context, c glexrt.LexClient, input *LiveDenyTeleport_Input) (*LiveDenyTeleport_Output, error) { var out LiveDenyTeleport_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.live.denyTeleport", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.live.denyTeleport", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/placestream/livegetliveusers.go b/pkg/placestream/livegetliveusers.go new file mode 100644 index 00000000..93e84c27 --- /dev/null +++ b/pkg/placestream/livegetliveusers.go @@ -0,0 +1,51 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.live.getLiveUsers + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type LiveGetLiveUsers_Output struct { + LexiconTypeID string `json:"$type"` + Streams []Livestream_LivestreamView `json:"streams,omitempty"` +} + +func (t *LiveGetLiveUsers_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.live.getLiveUsers#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *LiveGetLiveUsers_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// LiveGetLiveUsers calls the XRPC method "place.stream.live.getLiveUsers". +// +// Get a list of livestream segments for a user +func LiveGetLiveUsers(ctx context.Context, c glexrt.LexClient, before string, limit *int64) (*LiveGetLiveUsers_Output, error) { + var out LiveGetLiveUsers_Output + + params := map[string]interface{}{} + if before != "" { + params["before"] = before + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.live.getLiveUsers", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/placestream/livegetprofilecard.go b/pkg/placestream/livegetprofilecard.go new file mode 100644 index 00000000..fb0f05c5 --- /dev/null +++ b/pkg/placestream/livegetprofilecard.go @@ -0,0 +1,29 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.live.getProfileCard + +package placestream + +import ( + "bytes" + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// LiveGetProfileCard calls the XRPC method "place.stream.live.getProfileCard". +// +// Get an OG image associated with a given account. +// +// id: The DID or handle of the account. +func LiveGetProfileCard(ctx context.Context, c glexrt.LexClient, id string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + params["id"] = id + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.live.getProfileCard", params, nil, buf); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/pkg/streamplace/livegetRecommendations.go b/pkg/placestream/livegetrecommendations.go similarity index 59% rename from pkg/streamplace/livegetRecommendations.go rename to pkg/placestream/livegetrecommendations.go index 48bbb41b..15026b29 100644 --- a/pkg/streamplace/livegetRecommendations.go +++ b/pkg/placestream/livegetrecommendations.go @@ -1,26 +1,26 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.getRecommendations -package streamplace +package placestream import ( + "bytes" "context" "encoding/json" "fmt" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type LiveGetRecommendations_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.getRecommendations#main"` + LexiconTypeID string `json:"$type"` // recommendations: Ordered list of recommendations - Recommendations []*LiveGetRecommendations_Output_Recommendations_Elem `json:"recommendations" cborgen:"recommendations"` + Recommendations []LiveGetRecommendations_Output_Recommendations_Elem `json:"recommendations"` // userDID: The user DID this recommendation is for - UserDID *string `json:"userDID,omitempty" cborgen:"userDID,omitempty"` + UserDID *string `json:"userDID,omitempty"` } func (t *LiveGetRecommendations_Output) MarshalCBOR(w io.Writer) error { @@ -29,11 +29,11 @@ func (t *LiveGetRecommendations_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.getRecommendations#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveGetRecommendations_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type LiveGetRecommendations_Output_Recommendations_Elem struct { @@ -49,7 +49,7 @@ func (t *LiveGetRecommendations_Output_Recommendations_Elem) MarshalJSON() ([]by } func (t *LiveGetRecommendations_Output_Recommendations_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -63,28 +63,57 @@ func (t *LiveGetRecommendations_Output_Recommendations_Elem) UnmarshalJSON(b []b } } +func (t *LiveGetRecommendations_Output_Recommendations_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LiveGetRecommendations_LivestreamRecommendation != nil { + return t.LiveGetRecommendations_LivestreamRecommendation.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *LiveGetRecommendations_Output_Recommendations_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "place.stream.live.getRecommendations#livestreamRecommendation": + t.LiveGetRecommendations_LivestreamRecommendation = new(LiveGetRecommendations_LivestreamRecommendation) + return t.LiveGetRecommendations_LivestreamRecommendation.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + // LiveGetRecommendations calls the XRPC method "place.stream.live.getRecommendations". // +// # Get the list of streamers recommended by a user +// // userDID: The DID of the user whose recommendations to fetch -func LiveGetRecommendations(ctx context.Context, c lexutil.LexClient, userDID string) (*LiveGetRecommendations_Output, error) { +func LiveGetRecommendations(ctx context.Context, c glexrt.LexClient, userDID string) (*LiveGetRecommendations_Output, error) { var out LiveGetRecommendations_Output params := map[string]interface{}{} params["userDID"] = userDID - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.live.getRecommendations", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.live.getRecommendations", params, nil, &out); err != nil { return nil, err } - return &out, nil } // LiveGetRecommendations_LivestreamRecommendation is a "livestreamRecommendation" in the place.stream.live.getRecommendations schema. type LiveGetRecommendations_LivestreamRecommendation struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.getRecommendations"` + LexiconTypeID string `json:"$type"` // did: The DID of the recommended streamer - Did string `json:"did" cborgen:"did"` + Did string `json:"did"` // source: Source of the recommendation - Source string `json:"source" cborgen:"source"` + Source string `json:"source"` } func (t *LiveGetRecommendations_LivestreamRecommendation) MarshalCBOR(w io.Writer) error { @@ -93,9 +122,9 @@ func (t *LiveGetRecommendations_LivestreamRecommendation) MarshalCBOR(w io.Write return err } t.LexiconTypeID = "place.stream.live.getRecommendations" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveGetRecommendations_LivestreamRecommendation) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/livegetSegments.go b/pkg/placestream/livegetsegments.go similarity index 51% rename from pkg/streamplace/livegetSegments.go rename to pkg/placestream/livegetsegments.go index ef2d8ec8..6e0ae1bc 100644 --- a/pkg/streamplace/livegetSegments.go +++ b/pkg/placestream/livegetsegments.go @@ -1,21 +1,20 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.getSegments -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type LiveGetSegments_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.getSegments#main"` - Segments []*Segment_SegmentView `json:"segments,omitempty" cborgen:"segments,omitempty"` + LexiconTypeID string `json:"$type"` + Segments []Segment_SegmentView `json:"segments,omitempty"` } func (t *LiveGetSegments_Output) MarshalCBOR(w io.Writer) error { @@ -24,30 +23,32 @@ func (t *LiveGetSegments_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.getSegments#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveGetSegments_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // LiveGetSegments calls the XRPC method "place.stream.live.getSegments". // +// # Get a list of livestream segments for a user +// // userDID: The DID of the potentially-following user -func LiveGetSegments(ctx context.Context, c lexutil.LexClient, before string, limit int64, userDID string) (*LiveGetSegments_Output, error) { +func LiveGetSegments(ctx context.Context, c glexrt.LexClient, before string, limit *int64, userDID string) (*LiveGetSegments_Output, error) { var out LiveGetSegments_Output params := map[string]interface{}{} if before != "" { params["before"] = before } - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } params["userDID"] = userDID - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.live.getSegments", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.live.getSegments", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/liverecommendations.go b/pkg/placestream/liverecommendations.go similarity index 53% rename from pkg/streamplace/liverecommendations.go rename to pkg/placestream/liverecommendations.go index caf336c0..00a7f86b 100644 --- a/pkg/streamplace/liverecommendations.go +++ b/pkg/placestream/liverecommendations.go @@ -1,28 +1,27 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.recommendations -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.live.recommendations", &LiveRecommendations{}) + glexrt.RegisterType("place.stream.live.recommendations", &LiveRecommendations{}) } // A list of recommended streamers, in order of preference type LiveRecommendations struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.recommendations"` + LexiconTypeID string `json:"$type"` // createdAt: Client-declared timestamp when this list was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // streamers: Ordered list of recommended streamer DIDs - Streamers []string `json:"streamers" cborgen:"streamers"` + Streamers []string `json:"streamers"` } func (t *LiveRecommendations) MarshalCBOR(w io.Writer) error { @@ -31,9 +30,9 @@ func (t *LiveRecommendations) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.recommendations" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveRecommendations) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/livesearchActorsTypeahead.go b/pkg/placestream/livesearchactorstypeahead.go similarity index 56% rename from pkg/streamplace/livesearchActorsTypeahead.go rename to pkg/placestream/livesearchactorstypeahead.go index 5c05e1a5..d9abe635 100644 --- a/pkg/streamplace/livesearchActorsTypeahead.go +++ b/pkg/placestream/livesearchactorstypeahead.go @@ -1,21 +1,20 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.searchActorsTypeahead -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type LiveSearchActorsTypeahead_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.searchActorsTypeahead#main"` - Actors []*LiveSearchActorsTypeahead_Actor `json:"actors" cborgen:"actors"` + LexiconTypeID string `json:"$type"` + Actors []LiveSearchActorsTypeahead_Actor `json:"actors"` } func (t *LiveSearchActorsTypeahead_Output) MarshalCBOR(w io.Writer) error { @@ -24,40 +23,42 @@ func (t *LiveSearchActorsTypeahead_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.searchActorsTypeahead#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveSearchActorsTypeahead_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // LiveSearchActorsTypeahead calls the XRPC method "place.stream.live.searchActorsTypeahead". // +// Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. +// // q: Search query prefix; not a full query string. -func LiveSearchActorsTypeahead(ctx context.Context, c lexutil.LexClient, limit int64, q string) (*LiveSearchActorsTypeahead_Output, error) { +func LiveSearchActorsTypeahead(ctx context.Context, c glexrt.LexClient, limit *int64, q string) (*LiveSearchActorsTypeahead_Output, error) { var out LiveSearchActorsTypeahead_Output params := map[string]interface{}{} - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } if q != "" { params["q"] = q } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.live.searchActorsTypeahead", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.live.searchActorsTypeahead", params, nil, &out); err != nil { return nil, err } - return &out, nil } // LiveSearchActorsTypeahead_Actor is a "actor" in the place.stream.live.searchActorsTypeahead schema. type LiveSearchActorsTypeahead_Actor struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.searchActorsTypeahead"` + LexiconTypeID string `json:"$type"` // did: The actor's DID - Did string `json:"did" cborgen:"did"` + Did string `json:"did"` // handle: The actor's handle - Handle string `json:"handle" cborgen:"handle"` + Handle string `json:"handle"` } func (t *LiveSearchActorsTypeahead_Actor) MarshalCBOR(w io.Writer) error { @@ -66,9 +67,9 @@ func (t *LiveSearchActorsTypeahead_Actor) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.searchActorsTypeahead" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveSearchActorsTypeahead_Actor) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/livestartLivestream.go b/pkg/placestream/livestartlivestream.go similarity index 51% rename from pkg/streamplace/livestartLivestream.go rename to pkg/placestream/livestartlivestream.go index ed5afef3..7d5e8764 100644 --- a/pkg/streamplace/livestartLivestream.go +++ b/pkg/placestream/livestartlivestream.go @@ -1,25 +1,24 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.startLivestream -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type LiveStartLivestream_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.startLivestream#main"` + LexiconTypeID string `json:"$type"` // createBlueskyPost: Whether to create a Bluesky post announcing the livestream. - CreateBlueskyPost *bool `json:"createBlueskyPost,omitempty" cborgen:"createBlueskyPost,omitempty"` - Livestream *Livestream `json:"livestream" cborgen:"livestream"` + CreateBlueskyPost *bool `json:"createBlueskyPost,omitempty"` + Livestream Livestream `json:"livestream"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *LiveStartLivestream_Input) MarshalCBOR(w io.Writer) error { @@ -28,19 +27,19 @@ func (t *LiveStartLivestream_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.startLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveStartLivestream_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type LiveStartLivestream_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.startLivestream#main"` + LexiconTypeID string `json:"$type"` // cid: The CID of the livestream record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: The URI of the livestream record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *LiveStartLivestream_Output) MarshalCBOR(w io.Writer) error { @@ -49,19 +48,21 @@ func (t *LiveStartLivestream_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.startLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveStartLivestream_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // LiveStartLivestream calls the XRPC method "place.stream.live.startLivestream". -func LiveStartLivestream(ctx context.Context, c lexutil.LexClient, input *LiveStartLivestream_Input) (*LiveStartLivestream_Output, error) { +// +// Create a new place.stream.livestream record, automatically populating a thumbnail and creating a Bluesky post and whatnot. You can do this manually by creating a record but this method can work better for mobile livestreaming and such. +func LiveStartLivestream(ctx context.Context, c glexrt.LexClient, input *LiveStartLivestream_Input) (*LiveStartLivestream_Output, error) { var out LiveStartLivestream_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.live.startLivestream", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.live.startLivestream", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/livestopLivestream.go b/pkg/placestream/livestoplivestream.go similarity index 54% rename from pkg/streamplace/livestopLivestream.go rename to pkg/placestream/livestoplivestream.go index 1db2638b..cac497c3 100644 --- a/pkg/streamplace/livestopLivestream.go +++ b/pkg/placestream/livestoplivestream.go @@ -1,20 +1,19 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.stopLivestream -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type LiveStopLivestream_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.stopLivestream#main"` + LexiconTypeID string `json:"$type"` } func (t *LiveStopLivestream_Input) MarshalCBOR(w io.Writer) error { @@ -23,19 +22,19 @@ func (t *LiveStopLivestream_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.stopLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveStopLivestream_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type LiveStopLivestream_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.stopLivestream#main"` + LexiconTypeID string `json:"$type"` // cid: The new CID of the stopped livestream record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: The URI of the stopped livestream record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *LiveStopLivestream_Output) MarshalCBOR(w io.Writer) error { @@ -44,19 +43,21 @@ func (t *LiveStopLivestream_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.stopLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveStopLivestream_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // LiveStopLivestream calls the XRPC method "place.stream.live.stopLivestream". -func LiveStopLivestream(ctx context.Context, c lexutil.LexClient, input *LiveStopLivestream_Input) (*LiveStopLivestream_Output, error) { +// +// Stop your current livestream, updating your current place.stream.livestream record and ceasing the flow of video. +func LiveStopLivestream(ctx context.Context, c glexrt.LexClient, input *LiveStopLivestream_Input) (*LiveStopLivestream_Output, error) { var out LiveStopLivestream_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.live.stopLivestream", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.live.stopLivestream", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/livestream.go b/pkg/placestream/livestream.go similarity index 78% rename from pkg/streamplace/livestream.go rename to pkg/placestream/livestream.go index 83b13bfe..07b3ec0c 100644 --- a/pkg/streamplace/livestream.go +++ b/pkg/placestream/livestream.go @@ -1,8 +1,8 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.livestream -package streamplace +package placestream import ( "bytes" @@ -10,44 +10,43 @@ import ( "fmt" "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" + comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { - lexutil.RegisterType("place.stream.livestream", &Livestream{}) + glexrt.RegisterType("place.stream.livestream", &Livestream{}) } // Record announcing a livestream is happening type Livestream struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.livestream"` + LexiconTypeID string `json:"$type"` // activity: The game or activity being streamed. - Activity *Livestream_Activity `json:"activity,omitempty" cborgen:"activity,omitempty"` + Activity *Livestream_Activity `json:"activity,omitempty"` // agent: The source of the livestream, if available, in a User Agent format: ` / ` e.g. Streamplace/0.7.5 iOS - Agent *string `json:"agent,omitempty" cborgen:"agent,omitempty"` + Agent *string `json:"agent,omitempty"` // canonicalUrl: The primary URL where this livestream can be viewed, if available. - CanonicalUrl *string `json:"canonicalUrl,omitempty" cborgen:"canonicalUrl,omitempty"` + CanonicalUrl *string `json:"canonicalUrl,omitempty"` // createdAt: Client-declared timestamp when this livestream started. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // endedAt: Client-declared timestamp when this livestream ended. Ended livestreams are not supposed to start up again. - EndedAt *string `json:"endedAt,omitempty" cborgen:"endedAt,omitempty"` + EndedAt *string `json:"endedAt,omitempty"` // idleTimeoutSeconds: Time in seconds after which this livestream should be automatically ended if idle. Zero means no timeout. - IdleTimeoutSeconds *int64 `json:"idleTimeoutSeconds,omitempty" cborgen:"idleTimeoutSeconds,omitempty"` + IdleTimeoutSeconds *int64 `json:"idleTimeoutSeconds,omitempty"` // lastSeenAt: Client-declared timestamp when this livestream was last seen by the Streamplace station. - LastSeenAt *string `json:"lastSeenAt,omitempty" cborgen:"lastSeenAt,omitempty"` - NotificationSettings *Livestream_NotificationSettings `json:"notificationSettings,omitempty" cborgen:"notificationSettings,omitempty"` + LastSeenAt *string `json:"lastSeenAt,omitempty"` + NotificationSettings *Livestream_NotificationSettings `json:"notificationSettings,omitempty"` // post: The post that announced this livestream. - Post *comatproto.RepoStrongRef `json:"post,omitempty" cborgen:"post,omitempty"` + Post *comatproto.RepoStrongRef `json:"post,omitempty"` // tags: Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language). - Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` - Thumb *lex.Blob `json:"thumb,omitempty" cborgen:"thumb,omitempty"` + Tags []string `json:"tags,omitempty"` + Thumb *glexrt.Blob `json:"thumb,omitempty"` // title: The title of the livestream, as it will be announced to followers. - Title string `json:"title" cborgen:"title"` + Title string `json:"title"` // url: The URL where this stream can be found. This is primarily a hint for other Streamplace nodes to locate and replicate the stream. - Url *string `json:"url,omitempty" cborgen:"url,omitempty"` + Url *string `json:"url,omitempty"` } func (t *Livestream) MarshalCBOR(w io.Writer) error { @@ -56,11 +55,11 @@ func (t *Livestream) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.livestream" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Livestream) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // The game or activity being streamed. @@ -82,7 +81,7 @@ func (t *Livestream_Activity) MarshalJSON() ([]byte, error) { } func (t *Livestream_Activity) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -115,7 +114,7 @@ func (t *Livestream_Activity) MarshalCBOR(w io.Writer) error { } func (t *Livestream_Activity) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } @@ -134,14 +133,14 @@ func (t *Livestream_Activity) UnmarshalCBOR(r io.Reader) error { // Livestream_LivestreamView is a "livestreamView" in the place.stream.livestream schema. type Livestream_LivestreamView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.livestream"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` + IndexedAt string `json:"indexedAt"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` // viewerCount: The number of viewers watching this livestream. Use when you can't reasonably use #viewerCount directly. - ViewerCount *Livestream_ViewerCount `json:"viewerCount,omitempty" cborgen:"viewerCount,omitempty"` + ViewerCount *Livestream_ViewerCount `json:"viewerCount,omitempty"` } func (t *Livestream_LivestreamView) MarshalCBOR(w io.Writer) error { @@ -150,18 +149,18 @@ func (t *Livestream_LivestreamView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.livestream" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Livestream_LivestreamView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Livestream_NotificationSettings is a "notificationSettings" in the place.stream.livestream schema. type Livestream_NotificationSettings struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.livestream"` + LexiconTypeID string `json:"$type"` // pushNotification: Whether this livestream should trigger a push notification to followers. - PushNotification *bool `json:"pushNotification,omitempty" cborgen:"pushNotification,omitempty"` + PushNotification *bool `json:"pushNotification,omitempty"` } func (t *Livestream_NotificationSettings) MarshalCBOR(w io.Writer) error { @@ -170,17 +169,17 @@ func (t *Livestream_NotificationSettings) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.livestream" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Livestream_NotificationSettings) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Livestream_StreamplaceAnything is a "streamplaceAnything" in the place.stream.livestream schema. type Livestream_StreamplaceAnything struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.livestream"` - Livestream *Livestream_StreamplaceAnything_Livestream `json:"livestream" cborgen:"livestream"` + LexiconTypeID string `json:"$type"` + Livestream Livestream_StreamplaceAnything_Livestream `json:"livestream"` } func (t *Livestream_StreamplaceAnything) MarshalCBOR(w io.Writer) error { @@ -189,99 +188,99 @@ func (t *Livestream_StreamplaceAnything) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.livestream" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Livestream_StreamplaceAnything) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type Livestream_StreamplaceAnything_Livestream struct { + ChatDefs_MessageView *ChatDefs_MessageView + ChatDefs_PinnedRecordView *ChatDefs_PinnedRecordView + Defs_BlockView *Defs_BlockView + Defs_Rendition *Defs_Rendition + Defs_Renditions *Defs_Renditions Livestream_LivestreamView *Livestream_LivestreamView - Livestream_ViewerCount *Livestream_ViewerCount Livestream_TeleportArrival *Livestream_TeleportArrival Livestream_TeleportCanceled *Livestream_TeleportCanceled - Defs_BlockView *Defs_BlockView - Defs_Renditions *Defs_Renditions - Defs_Rendition *Defs_Rendition - ChatDefs_MessageView *ChatDefs_MessageView - ChatDefs_PinnedRecordView *ChatDefs_PinnedRecordView + Livestream_ViewerCount *Livestream_ViewerCount } func (t *Livestream_StreamplaceAnything_Livestream) MarshalJSON() ([]byte, error) { - if t.Livestream_LivestreamView != nil { - t.Livestream_LivestreamView.LexiconTypeID = "place.stream.livestream#livestreamView" - return json.Marshal(t.Livestream_LivestreamView) - } - if t.Livestream_ViewerCount != nil { - t.Livestream_ViewerCount.LexiconTypeID = "place.stream.livestream#viewerCount" - return json.Marshal(t.Livestream_ViewerCount) - } - if t.Livestream_TeleportArrival != nil { - t.Livestream_TeleportArrival.LexiconTypeID = "place.stream.livestream#teleportArrival" - return json.Marshal(t.Livestream_TeleportArrival) + if t.ChatDefs_MessageView != nil { + t.ChatDefs_MessageView.LexiconTypeID = "place.stream.chat.defs#messageView" + return json.Marshal(t.ChatDefs_MessageView) } - if t.Livestream_TeleportCanceled != nil { - t.Livestream_TeleportCanceled.LexiconTypeID = "place.stream.livestream#teleportCanceled" - return json.Marshal(t.Livestream_TeleportCanceled) + if t.ChatDefs_PinnedRecordView != nil { + t.ChatDefs_PinnedRecordView.LexiconTypeID = "place.stream.chat.defs#pinnedRecordView" + return json.Marshal(t.ChatDefs_PinnedRecordView) } if t.Defs_BlockView != nil { t.Defs_BlockView.LexiconTypeID = "place.stream.defs#blockView" return json.Marshal(t.Defs_BlockView) } + if t.Defs_Rendition != nil { + t.Defs_Rendition.LexiconTypeID = "place.stream.defs#rendition" + return json.Marshal(t.Defs_Rendition) + } if t.Defs_Renditions != nil { t.Defs_Renditions.LexiconTypeID = "place.stream.defs#renditions" return json.Marshal(t.Defs_Renditions) } - if t.Defs_Rendition != nil { - t.Defs_Rendition.LexiconTypeID = "place.stream.defs#rendition" - return json.Marshal(t.Defs_Rendition) + if t.Livestream_LivestreamView != nil { + t.Livestream_LivestreamView.LexiconTypeID = "place.stream.livestream#livestreamView" + return json.Marshal(t.Livestream_LivestreamView) } - if t.ChatDefs_MessageView != nil { - t.ChatDefs_MessageView.LexiconTypeID = "place.stream.chat.defs#messageView" - return json.Marshal(t.ChatDefs_MessageView) + if t.Livestream_TeleportArrival != nil { + t.Livestream_TeleportArrival.LexiconTypeID = "place.stream.livestream#teleportArrival" + return json.Marshal(t.Livestream_TeleportArrival) } - if t.ChatDefs_PinnedRecordView != nil { - t.ChatDefs_PinnedRecordView.LexiconTypeID = "place.stream.chat.defs#pinnedRecordView" - return json.Marshal(t.ChatDefs_PinnedRecordView) + if t.Livestream_TeleportCanceled != nil { + t.Livestream_TeleportCanceled.LexiconTypeID = "place.stream.livestream#teleportCanceled" + return json.Marshal(t.Livestream_TeleportCanceled) + } + if t.Livestream_ViewerCount != nil { + t.Livestream_ViewerCount.LexiconTypeID = "place.stream.livestream#viewerCount" + return json.Marshal(t.Livestream_ViewerCount) } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *Livestream_StreamplaceAnything_Livestream) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } switch typ { + case "place.stream.chat.defs#messageView": + t.ChatDefs_MessageView = new(ChatDefs_MessageView) + return json.Unmarshal(b, t.ChatDefs_MessageView) + case "place.stream.chat.defs#pinnedRecordView": + t.ChatDefs_PinnedRecordView = new(ChatDefs_PinnedRecordView) + return json.Unmarshal(b, t.ChatDefs_PinnedRecordView) + case "place.stream.defs#blockView": + t.Defs_BlockView = new(Defs_BlockView) + return json.Unmarshal(b, t.Defs_BlockView) + case "place.stream.defs#rendition": + t.Defs_Rendition = new(Defs_Rendition) + return json.Unmarshal(b, t.Defs_Rendition) + case "place.stream.defs#renditions": + t.Defs_Renditions = new(Defs_Renditions) + return json.Unmarshal(b, t.Defs_Renditions) case "place.stream.livestream#livestreamView": t.Livestream_LivestreamView = new(Livestream_LivestreamView) return json.Unmarshal(b, t.Livestream_LivestreamView) - case "place.stream.livestream#viewerCount": - t.Livestream_ViewerCount = new(Livestream_ViewerCount) - return json.Unmarshal(b, t.Livestream_ViewerCount) case "place.stream.livestream#teleportArrival": t.Livestream_TeleportArrival = new(Livestream_TeleportArrival) return json.Unmarshal(b, t.Livestream_TeleportArrival) case "place.stream.livestream#teleportCanceled": t.Livestream_TeleportCanceled = new(Livestream_TeleportCanceled) return json.Unmarshal(b, t.Livestream_TeleportCanceled) - case "place.stream.defs#blockView": - t.Defs_BlockView = new(Defs_BlockView) - return json.Unmarshal(b, t.Defs_BlockView) - case "place.stream.defs#renditions": - t.Defs_Renditions = new(Defs_Renditions) - return json.Unmarshal(b, t.Defs_Renditions) - case "place.stream.defs#rendition": - t.Defs_Rendition = new(Defs_Rendition) - return json.Unmarshal(b, t.Defs_Rendition) - case "place.stream.chat.defs#messageView": - t.ChatDefs_MessageView = new(ChatDefs_MessageView) - return json.Unmarshal(b, t.ChatDefs_MessageView) - case "place.stream.chat.defs#pinnedRecordView": - t.ChatDefs_PinnedRecordView = new(ChatDefs_PinnedRecordView) - return json.Unmarshal(b, t.ChatDefs_PinnedRecordView) + case "place.stream.livestream#viewerCount": + t.Livestream_ViewerCount = new(Livestream_ViewerCount) + return json.Unmarshal(b, t.Livestream_ViewerCount) default: return nil } @@ -293,70 +292,70 @@ func (t *Livestream_StreamplaceAnything_Livestream) MarshalCBOR(w io.Writer) err _, err := w.Write(cbg.CborNull) return err } - if t.Livestream_LivestreamView != nil { - return t.Livestream_LivestreamView.MarshalCBOR(w) - } - if t.Livestream_ViewerCount != nil { - return t.Livestream_ViewerCount.MarshalCBOR(w) - } - if t.Livestream_TeleportArrival != nil { - return t.Livestream_TeleportArrival.MarshalCBOR(w) + if t.ChatDefs_MessageView != nil { + return t.ChatDefs_MessageView.MarshalCBOR(w) } - if t.Livestream_TeleportCanceled != nil { - return t.Livestream_TeleportCanceled.MarshalCBOR(w) + if t.ChatDefs_PinnedRecordView != nil { + return t.ChatDefs_PinnedRecordView.MarshalCBOR(w) } if t.Defs_BlockView != nil { return t.Defs_BlockView.MarshalCBOR(w) } + if t.Defs_Rendition != nil { + return t.Defs_Rendition.MarshalCBOR(w) + } if t.Defs_Renditions != nil { return t.Defs_Renditions.MarshalCBOR(w) } - if t.Defs_Rendition != nil { - return t.Defs_Rendition.MarshalCBOR(w) + if t.Livestream_LivestreamView != nil { + return t.Livestream_LivestreamView.MarshalCBOR(w) } - if t.ChatDefs_MessageView != nil { - return t.ChatDefs_MessageView.MarshalCBOR(w) + if t.Livestream_TeleportArrival != nil { + return t.Livestream_TeleportArrival.MarshalCBOR(w) } - if t.ChatDefs_PinnedRecordView != nil { - return t.ChatDefs_PinnedRecordView.MarshalCBOR(w) + if t.Livestream_TeleportCanceled != nil { + return t.Livestream_TeleportCanceled.MarshalCBOR(w) + } + if t.Livestream_ViewerCount != nil { + return t.Livestream_ViewerCount.MarshalCBOR(w) } return fmt.Errorf("can not marshal empty union as CBOR") } func (t *Livestream_StreamplaceAnything_Livestream) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } switch typ { + case "place.stream.chat.defs#messageView": + t.ChatDefs_MessageView = new(ChatDefs_MessageView) + return t.ChatDefs_MessageView.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.chat.defs#pinnedRecordView": + t.ChatDefs_PinnedRecordView = new(ChatDefs_PinnedRecordView) + return t.ChatDefs_PinnedRecordView.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.defs#blockView": + t.Defs_BlockView = new(Defs_BlockView) + return t.Defs_BlockView.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.defs#rendition": + t.Defs_Rendition = new(Defs_Rendition) + return t.Defs_Rendition.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.defs#renditions": + t.Defs_Renditions = new(Defs_Renditions) + return t.Defs_Renditions.UnmarshalCBOR(bytes.NewReader(b)) case "place.stream.livestream#livestreamView": t.Livestream_LivestreamView = new(Livestream_LivestreamView) return t.Livestream_LivestreamView.UnmarshalCBOR(bytes.NewReader(b)) - case "place.stream.livestream#viewerCount": - t.Livestream_ViewerCount = new(Livestream_ViewerCount) - return t.Livestream_ViewerCount.UnmarshalCBOR(bytes.NewReader(b)) case "place.stream.livestream#teleportArrival": t.Livestream_TeleportArrival = new(Livestream_TeleportArrival) return t.Livestream_TeleportArrival.UnmarshalCBOR(bytes.NewReader(b)) case "place.stream.livestream#teleportCanceled": t.Livestream_TeleportCanceled = new(Livestream_TeleportCanceled) return t.Livestream_TeleportCanceled.UnmarshalCBOR(bytes.NewReader(b)) - case "place.stream.defs#blockView": - t.Defs_BlockView = new(Defs_BlockView) - return t.Defs_BlockView.UnmarshalCBOR(bytes.NewReader(b)) - case "place.stream.defs#renditions": - t.Defs_Renditions = new(Defs_Renditions) - return t.Defs_Renditions.UnmarshalCBOR(bytes.NewReader(b)) - case "place.stream.defs#rendition": - t.Defs_Rendition = new(Defs_Rendition) - return t.Defs_Rendition.UnmarshalCBOR(bytes.NewReader(b)) - case "place.stream.chat.defs#messageView": - t.ChatDefs_MessageView = new(ChatDefs_MessageView) - return t.ChatDefs_MessageView.UnmarshalCBOR(bytes.NewReader(b)) - case "place.stream.chat.defs#pinnedRecordView": - t.ChatDefs_PinnedRecordView = new(ChatDefs_PinnedRecordView) - return t.ChatDefs_PinnedRecordView.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.livestream#viewerCount": + t.Livestream_ViewerCount = new(Livestream_ViewerCount) + return t.Livestream_ViewerCount.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } @@ -364,17 +363,17 @@ func (t *Livestream_StreamplaceAnything_Livestream) UnmarshalCBOR(r io.Reader) e // Livestream_TeleportArrival is a "teleportArrival" in the place.stream.livestream schema. type Livestream_TeleportArrival struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.livestream"` + LexiconTypeID string `json:"$type"` // chatProfile: The chat profile of the source streamer - ChatProfile *ChatProfile `json:"chatProfile,omitempty" cborgen:"chatProfile,omitempty"` + ChatProfile *ChatProfile `json:"chatProfile,omitempty"` // source: The streamer who is teleporting their viewers here - Source *appbsky.ActorDefs_ProfileViewBasic `json:"source" cborgen:"source"` + Source appbsky.ActorDefs_ProfileViewBasic `json:"source"` // startsAt: When this teleport started - StartsAt string `json:"startsAt" cborgen:"startsAt"` + StartsAt string `json:"startsAt"` // teleportUri: The URI of the teleport record - TeleportUri string `json:"teleportUri" cborgen:"teleportUri"` + TeleportUri string `json:"teleportUri"` // viewerCount: How many viewers are arriving from this teleport - ViewerCount int64 `json:"viewerCount" cborgen:"viewerCount"` + ViewerCount int64 `json:"viewerCount"` } func (t *Livestream_TeleportArrival) MarshalCBOR(w io.Writer) error { @@ -383,20 +382,20 @@ func (t *Livestream_TeleportArrival) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.livestream" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Livestream_TeleportArrival) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Livestream_TeleportCanceled is a "teleportCanceled" in the place.stream.livestream schema. type Livestream_TeleportCanceled struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.livestream"` + LexiconTypeID string `json:"$type"` // reason: Why this teleport was canceled - Reason string `json:"reason" cborgen:"reason"` + Reason string `json:"reason"` // teleportUri: The URI of the teleport record that was canceled - TeleportUri string `json:"teleportUri" cborgen:"teleportUri"` + TeleportUri string `json:"teleportUri"` } func (t *Livestream_TeleportCanceled) MarshalCBOR(w io.Writer) error { @@ -405,17 +404,17 @@ func (t *Livestream_TeleportCanceled) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.livestream" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Livestream_TeleportCanceled) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // Livestream_ViewerCount is a "viewerCount" in the place.stream.livestream schema. type Livestream_ViewerCount struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.livestream"` - Count int64 `json:"count" cborgen:"count"` + LexiconTypeID string `json:"$type"` + Count int64 `json:"count"` } func (t *Livestream_ViewerCount) MarshalCBOR(w io.Writer) error { @@ -424,9 +423,9 @@ func (t *Livestream_ViewerCount) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.livestream" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Livestream_ViewerCount) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/placestream/livesubscribesegments.go b/pkg/placestream/livesubscribesegments.go new file mode 100644 index 00000000..a34d9390 --- /dev/null +++ b/pkg/placestream/livesubscribesegments.go @@ -0,0 +1,5 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.live.subscribeSegments + +package placestream diff --git a/pkg/streamplace/liveteleport.go b/pkg/placestream/liveteleport.go similarity index 55% rename from pkg/streamplace/liveteleport.go rename to pkg/placestream/liveteleport.go index 80871e6e..035bcb10 100644 --- a/pkg/streamplace/liveteleport.go +++ b/pkg/placestream/liveteleport.go @@ -1,30 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.teleport -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.live.teleport", &LiveTeleport{}) + glexrt.RegisterType("place.stream.live.teleport", &LiveTeleport{}) } // Record defining a 'teleport', that is active during a certain time. type LiveTeleport struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.teleport"` + LexiconTypeID string `json:"$type"` // durationSeconds: The time limit in seconds for the teleport. If not set, the teleport is permanent. Must be at least 60 seconds, and no more than 32,400 seconds (9 hours). - DurationSeconds *int64 `json:"durationSeconds,omitempty" cborgen:"durationSeconds,omitempty"` + DurationSeconds *int64 `json:"durationSeconds,omitempty"` // startsAt: The time the teleport becomes active. - StartsAt string `json:"startsAt" cborgen:"startsAt"` + StartsAt string `json:"startsAt"` // streamer: The DID of the streamer to teleport to. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *LiveTeleport) MarshalCBOR(w io.Writer) error { @@ -33,9 +32,9 @@ func (t *LiveTeleport) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.teleport" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveTeleport) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/liveviewerCount.go b/pkg/placestream/liveviewercount.go similarity index 54% rename from pkg/streamplace/liveviewerCount.go rename to pkg/placestream/liveviewercount.go index 110819db..8635981d 100644 --- a/pkg/streamplace/liveviewerCount.go +++ b/pkg/placestream/liveviewercount.go @@ -1,32 +1,31 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.live.viewerCount -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.live.viewerCount", &LiveViewerCount{}) + glexrt.RegisterType("place.stream.live.viewerCount", &LiveViewerCount{}) } // Current viewer count for a livestream on a particular server. Record keys are streamer_did::server_did by convention. type LiveViewerCount struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.viewerCount"` + LexiconTypeID string `json:"$type"` // count: The current view count for the livestream. - Count int64 `json:"count" cborgen:"count"` + Count int64 `json:"count"` // server: The DID of the server to get the view count for. - Server string `json:"server" cborgen:"server"` + Server string `json:"server"` // streamer: The DID of the streamer to teleport to. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` // updatedAt: The time the view count was last updated. - UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` } func (t *LiveViewerCount) MarshalCBOR(w io.Writer) error { @@ -35,9 +34,9 @@ func (t *LiveViewerCount) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.live.viewerCount" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *LiveViewerCount) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/mediacreateUpload.go b/pkg/placestream/mediacreateupload.go similarity index 57% rename from pkg/streamplace/mediacreateUpload.go rename to pkg/placestream/mediacreateupload.go index fe8560fb..d71a2861 100644 --- a/pkg/streamplace/mediacreateUpload.go +++ b/pkg/placestream/mediacreateupload.go @@ -1,28 +1,27 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.createUpload -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type MediaCreateUpload_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.createUpload#main"` + LexiconTypeID string `json:"$type"` // draftUri: Optional ats:// URI of a draft VOD created via place.stream.vod.createDraft. When supplied, the upload's processing fills that draft (rather than creating a new one), so the user can edit metadata while the upload runs and re-upload if it fails. The draft's origin_upload_id is set to this upload. - DraftUri *string `json:"draftUri,omitempty" cborgen:"draftUri,omitempty"` + DraftUri *string `json:"draftUri,omitempty"` // filename: Optional filename hint to attach as upload metadata. - Filename *string `json:"filename,omitempty" cborgen:"filename,omitempty"` + Filename *string `json:"filename,omitempty"` // mimeType: MIME type of the content being uploaded (e.g. video/mp4). - MimeType string `json:"mimeType" cborgen:"mimeType"` + MimeType string `json:"mimeType"` // size: Total size of the upload in bytes. - Size int64 `json:"size" cborgen:"size"` + Size int64 `json:"size"` } func (t *MediaCreateUpload_Input) MarshalCBOR(w io.Writer) error { @@ -31,23 +30,23 @@ func (t *MediaCreateUpload_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.createUpload#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaCreateUpload_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type MediaCreateUpload_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.createUpload#main"` + LexiconTypeID string `json:"$type"` // expiresAt: When the upload token expires. - ExpiresAt string `json:"expiresAt" cborgen:"expiresAt"` + ExpiresAt string `json:"expiresAt"` // uploadId: Server-side identifier for this upload. - UploadId string `json:"uploadId" cborgen:"uploadId"` + UploadId string `json:"uploadId"` // uploadToken: Short-lived bearer token bound to this upload. Send as 'Authorization: Bearer ' on TUS requests. - UploadToken string `json:"uploadToken" cborgen:"uploadToken"` + UploadToken string `json:"uploadToken"` // uploadUrl: Absolute URL to PATCH/HEAD per the TUS protocol. - UploadUrl string `json:"uploadUrl" cborgen:"uploadUrl"` + UploadUrl string `json:"uploadUrl"` } func (t *MediaCreateUpload_Output) MarshalCBOR(w io.Writer) error { @@ -56,19 +55,21 @@ func (t *MediaCreateUpload_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.createUpload#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaCreateUpload_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaCreateUpload calls the XRPC method "place.stream.media.createUpload". -func MediaCreateUpload(ctx context.Context, c lexutil.LexClient, input *MediaCreateUpload_Input) (*MediaCreateUpload_Output, error) { +// +// Start a resumable upload of arbitrary media content. Returns a TUS upload URL and a short-lived bearer token used to authenticate subsequent chunk requests (no DPoP required on chunks). The DID of the authenticated user is recorded against the upload; on completion a VOD processing task is enqueued. +func MediaCreateUpload(ctx context.Context, c glexrt.LexClient, input *MediaCreateUpload_Input) (*MediaCreateUpload_Output, error) { var out MediaCreateUpload_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.media.createUpload", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.media.createUpload", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/mediadefs.go b/pkg/placestream/mediadefs.go similarity index 64% rename from pkg/streamplace/mediadefs.go rename to pkg/placestream/mediadefs.go index ac592170..0d2eddde 100644 --- a/pkg/streamplace/mediadefs.go +++ b/pkg/placestream/mediadefs.go @@ -1,34 +1,34 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.defs -package streamplace +package placestream import ( "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + comatproto "stream.place/streamplace/pkg/comatproto" ) // MediaDefs_MuxlTrack is a "muxlTrack" in the place.stream.media.defs schema. // // A track backed by a MUXL container type MediaDefs_MuxlTrack struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.defs"` + LexiconTypeID string `json:"$type"` // blob: BLAKE-3 content hash (BDASL CID) of the source video segment. - Blob string `json:"blob" cborgen:"blob"` + Blob string `json:"blob"` // language: Language of the track, if applicable. - Language *string `json:"language,omitempty" cborgen:"language,omitempty"` + Language *string `json:"language,omitempty"` // mediaType: Type of the track: video, audio, or text. - MediaType string `json:"mediaType" cborgen:"mediaType"` + MediaType string `json:"mediaType"` // signingKey: did:key of the ephemeral key that C2PA-signed this track's segments. The private key is discarded once the track is produced, so it can only ever have signed this content. - SigningKey *string `json:"signingKey,omitempty" cborgen:"signingKey,omitempty"` + SigningKey *string `json:"signingKey,omitempty"` // size: Size in bytes of the source video segment. - Size *int64 `json:"size,omitempty" cborgen:"size,omitempty"` + Size *int64 `json:"size,omitempty"` // trackId: ID of the track within the MUXL container. 1-indexed for MP4 reasons. - TrackId string `json:"trackId" cborgen:"trackId"` + TrackId string `json:"trackId"` } func (t *MediaDefs_MuxlTrack) MarshalCBOR(w io.Writer) error { @@ -37,24 +37,24 @@ func (t *MediaDefs_MuxlTrack) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaDefs_MuxlTrack) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaDefs_SourceClip is a "sourceClip" in the place.stream.media.defs schema. // // An object representing that this video's source is a clip from another video. type MediaDefs_SourceClip struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.defs"` + LexiconTypeID string `json:"$type"` // end: End time of the clip in milliseconds. - End int64 `json:"end" cborgen:"end"` + End int64 `json:"end"` // start: Start time of the clip in milliseconds. - Start int64 `json:"start" cborgen:"start"` + Start int64 `json:"start"` // video: AT URI of the video we're clipping. - Video string `json:"video" cborgen:"video"` + Video string `json:"video"` } func (t *MediaDefs_SourceClip) MarshalCBOR(w io.Writer) error { @@ -63,20 +63,20 @@ func (t *MediaDefs_SourceClip) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaDefs_SourceClip) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaDefs_SourceTracks is a "sourceTracks" in the place.stream.media.defs schema. // // A collection of tracks representing the canonical source of a video. type MediaDefs_SourceTracks struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.defs"` + LexiconTypeID string `json:"$type"` // tracks: The canonical list of tracks specifying the source of a video. - Tracks []*comatproto.RepoStrongRef `json:"tracks" cborgen:"tracks"` + Tracks []comatproto.RepoStrongRef `json:"tracks"` } func (t *MediaDefs_SourceTracks) MarshalCBOR(w io.Writer) error { @@ -85,9 +85,9 @@ func (t *MediaDefs_SourceTracks) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaDefs_SourceTracks) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/mediafinalizeLivestream.go b/pkg/placestream/mediafinalizelivestream.go similarity index 54% rename from pkg/streamplace/mediafinalizeLivestream.go rename to pkg/placestream/mediafinalizelivestream.go index 24c6c021..aeaa228e 100644 --- a/pkg/streamplace/mediafinalizeLivestream.go +++ b/pkg/placestream/mediafinalizelivestream.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.finalizeLivestream -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type MediaFinalizeLivestream_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.finalizeLivestream#main"` + LexiconTypeID string `json:"$type"` // livestream: AT-URI of the place.stream.livestream record to finalize into a VOD. Must belong to the authenticated user. - Livestream string `json:"livestream" cborgen:"livestream"` + Livestream string `json:"livestream"` } func (t *MediaFinalizeLivestream_Input) MarshalCBOR(w io.Writer) error { @@ -25,19 +24,19 @@ func (t *MediaFinalizeLivestream_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.finalizeLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaFinalizeLivestream_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type MediaFinalizeLivestream_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.finalizeLivestream#main"` + LexiconTypeID string `json:"$type"` // draftUri: The ats:// URI of the draft VOD created for this finalize. The draft reaches status 'ready' when processing completes; the user publishes it from the Drafts tab via place.stream.vod.publishDraft. - DraftUri string `json:"draftUri" cborgen:"draftUri"` + DraftUri string `json:"draftUri"` // uploadId: Identifier for the finalize job. Retained for backwards compatibility; the draft flow no longer requires the client to poll getUploadStatus. - UploadId string `json:"uploadId" cborgen:"uploadId"` + UploadId string `json:"uploadId"` } func (t *MediaFinalizeLivestream_Output) MarshalCBOR(w io.Writer) error { @@ -46,19 +45,21 @@ func (t *MediaFinalizeLivestream_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.finalizeLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaFinalizeLivestream_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaFinalizeLivestream calls the XRPC method "place.stream.media.finalizeLivestream". -func MediaFinalizeLivestream(ctx context.Context, c lexutil.LexClient, input *MediaFinalizeLivestream_Input) (*MediaFinalizeLivestream_Output, error) { +// +// Turn a finished livestream into a VOD. The server concatenates the MUXL segments it recorded for the livestream into a single content blob, derives the playback sidecars, and publishes the place.stream.media.track records. Processing completes server-side and creates a draft VOD; the client does not need to poll or publish — the user publishes the draft later via place.stream.vod.publishDraft. Returns the draft's ats:// URI so the client can navigate to it, alongside an uploadId for backwards compatibility. +func MediaFinalizeLivestream(ctx context.Context, c glexrt.LexClient, input *MediaFinalizeLivestream_Input) (*MediaFinalizeLivestream_Output, error) { var out MediaFinalizeLivestream_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.media.finalizeLivestream", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.media.finalizeLivestream", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/mediagetUploadStatus.go b/pkg/placestream/mediagetuploadstatus.go similarity index 56% rename from pkg/streamplace/mediagetUploadStatus.go rename to pkg/placestream/mediagetuploadstatus.go index a3451473..8eea5d72 100644 --- a/pkg/streamplace/mediagetUploadStatus.go +++ b/pkg/placestream/mediagetuploadstatus.go @@ -1,30 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.getUploadStatus -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type MediaGetUploadStatus_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.getUploadStatus#main"` + LexiconTypeID string `json:"$type"` // durationMs: Duration of the processed video in milliseconds. Present when status is 'done'. - DurationMs *int64 `json:"durationMs,omitempty" cborgen:"durationMs,omitempty"` + DurationMs *int64 `json:"durationMs,omitempty"` // error: Error message. Present when status is 'error'. - Error *string `json:"error,omitempty" cborgen:"error,omitempty"` + Error *string `json:"error,omitempty"` // progress: Processing progress percentage (0-100). Only meaningful when status is 'processing'. - Progress *int64 `json:"progress,omitempty" cborgen:"progress,omitempty"` + Progress *int64 `json:"progress,omitempty"` // status: Current processing status of the upload. - Status string `json:"status" cborgen:"status"` + Status string `json:"status"` // tracks: Published track records. Present when status is 'done'. - Tracks []*MediaGetUploadStatus_TrackRef `json:"tracks,omitempty" cborgen:"tracks,omitempty"` + Tracks []MediaGetUploadStatus_TrackRef `json:"tracks,omitempty"` } func (t *MediaGetUploadStatus_Output) MarshalCBOR(w io.Writer) error { @@ -33,33 +32,35 @@ func (t *MediaGetUploadStatus_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.getUploadStatus#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaGetUploadStatus_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaGetUploadStatus calls the XRPC method "place.stream.media.getUploadStatus". // +// Get the processing status of a previously created upload. Only accessible by the DID that created the upload. +// // uploadId: The upload ID returned by place.stream.media.createUpload. -func MediaGetUploadStatus(ctx context.Context, c lexutil.LexClient, uploadId string) (*MediaGetUploadStatus_Output, error) { +func MediaGetUploadStatus(ctx context.Context, c glexrt.LexClient, uploadId string) (*MediaGetUploadStatus_Output, error) { var out MediaGetUploadStatus_Output params := map[string]interface{}{} params["uploadId"] = uploadId - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.media.getUploadStatus", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.media.getUploadStatus", params, nil, &out); err != nil { return nil, err } - return &out, nil } // MediaGetUploadStatus_TrackRef is a "trackRef" in the place.stream.media.getUploadStatus schema. type MediaGetUploadStatus_TrackRef struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.getUploadStatus"` - Cid string `json:"cid" cborgen:"cid"` - Uri string `json:"uri" cborgen:"uri"` + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Uri string `json:"uri"` } func (t *MediaGetUploadStatus_TrackRef) MarshalCBOR(w io.Writer) error { @@ -68,9 +69,9 @@ func (t *MediaGetUploadStatus_TrackRef) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.getUploadStatus" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaGetUploadStatus_TrackRef) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/mediagetVideo.go b/pkg/placestream/mediagetvideo.go similarity index 58% rename from pkg/streamplace/mediagetVideo.go rename to pkg/placestream/mediagetvideo.go index 3c91b4b7..8348e5c8 100644 --- a/pkg/streamplace/mediagetVideo.go +++ b/pkg/placestream/mediagetvideo.go @@ -1,46 +1,47 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.getVideo -package streamplace +package placestream import ( "context" "io" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" ) // MediaGetVideo calls the XRPC method "place.stream.media.getVideo". // +// Get a hydrated view of a place.stream.video record — the record itself plus author info plus aggregated view counts summed across every reporting node we've indexed. View counts come from place.stream.media.viewCount records; consumers see one number per metric, with the underlying multi-reporter detail collapsed away. +// // uri: AT-URI of the place.stream.video record. -func MediaGetVideo(ctx context.Context, c lexutil.LexClient, uri string) (*MediaGetVideo_VideoView, error) { +func MediaGetVideo(ctx context.Context, c glexrt.LexClient, uri string) (*MediaGetVideo_VideoView, error) { var out MediaGetVideo_VideoView params := map[string]interface{}{} params["uri"] = uri - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.media.getVideo", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.media.getVideo", params, nil, &out); err != nil { return nil, err } - return &out, nil } // MediaGetVideo_VideoView is a "videoView" in the place.stream.media.getVideo schema. type MediaGetVideo_VideoView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.getVideo"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` - Cid string `json:"cid" cborgen:"cid"` + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` // likeCount: Total number of place.stream.like records whose subject is this video. Always present; zero when none, so consumers can render a count unconditionally. - LikeCount int64 `json:"likeCount" cborgen:"likeCount"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - Tracks []*MediaTrack_TrackView `json:"tracks,omitempty" cborgen:"tracks,omitempty"` - Uri string `json:"uri" cborgen:"uri"` + LikeCount int64 `json:"likeCount"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Tracks []MediaTrack_TrackView `json:"tracks,omitempty"` + Uri string `json:"uri"` // viewCounts: Aggregated view counts across every indexed reporter. Always present; zero-valued (count=0, reporters=0) when no place.stream.media.viewCount records have been observed yet, so consumers can render a count unconditionally. - ViewCounts *MediaGetVideo_ViewCountSummary `json:"viewCounts" cborgen:"viewCounts"` + ViewCounts MediaGetVideo_ViewCountSummary `json:"viewCounts"` } func (t *MediaGetVideo_VideoView) MarshalCBOR(w io.Writer) error { @@ -49,26 +50,26 @@ func (t *MediaGetVideo_VideoView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.getVideo" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaGetVideo_VideoView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaGetVideo_ViewCountSummary is a "viewCountSummary" in the place.stream.media.getVideo schema. // // Sums across every place.stream.media.viewCount record indexed for this video, regardless of reporter or window. The underlying records are window-bounded; the consumer sees a running total. type MediaGetVideo_ViewCountSummary struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.getVideo"` + LexiconTypeID string `json:"$type"` // bytes: Sum of bytes transferred across every track row in every indexed report. - Bytes int64 `json:"bytes" cborgen:"bytes"` + Bytes int64 `json:"bytes"` // count: Sum of `count` across every indexed report. - Count int64 `json:"count" cborgen:"count"` + Count int64 `json:"count"` // durationMs: Sum of playback duration (ms) across every track row in every indexed report. - DurationMs int64 `json:"durationMs" cborgen:"durationMs"` + DurationMs int64 `json:"durationMs"` // reporters: Number of distinct streamplace nodes that have contributed at least one viewCount record for this video. - Reporters int64 `json:"reporters" cborgen:"reporters"` + Reporters int64 `json:"reporters"` } func (t *MediaGetVideo_ViewCountSummary) MarshalCBOR(w io.Writer) error { @@ -77,9 +78,9 @@ func (t *MediaGetVideo_ViewCountSummary) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.getVideo" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaGetVideo_ViewCountSummary) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/mediagetVideoList.go b/pkg/placestream/mediagetvideolist.go similarity index 55% rename from pkg/streamplace/mediagetVideoList.go rename to pkg/placestream/mediagetvideolist.go index be295d9f..25bb976a 100644 --- a/pkg/streamplace/mediagetVideoList.go +++ b/pkg/placestream/mediagetvideolist.go @@ -1,23 +1,22 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.getVideoList -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type MediaGetVideoList_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.getVideoList#main"` + LexiconTypeID string `json:"$type"` // cursor: Pagination cursor for the next page, if any. - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Videos []*MediaGetVideo_VideoView `json:"videos" cborgen:"videos"` + Cursor *string `json:"cursor,omitempty"` + Videos []MediaGetVideo_VideoView `json:"videos"` } func (t *MediaGetVideoList_Output) MarshalCBOR(w io.Writer) error { @@ -26,34 +25,36 @@ func (t *MediaGetVideoList_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.getVideoList#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaGetVideoList_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaGetVideoList calls the XRPC method "place.stream.media.getVideoList". // +// List videos newest first. Scoped to a single repo when `repo` is supplied; otherwise lists videos across every indexed repo. Returns hydrated video views with author info and view counts. +// // cursor: Pagination cursor from a previous response. // limit: Maximum number of videos to return. // repo: DID or handle of the repo whose videos to list. Omit to list videos globally across all repos. -func MediaGetVideoList(ctx context.Context, c lexutil.LexClient, cursor string, limit int64, repo string) (*MediaGetVideoList_Output, error) { +func MediaGetVideoList(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, repo string) (*MediaGetVideoList_Output, error) { var out MediaGetVideoList_Output params := map[string]interface{}{} if cursor != "" { params["cursor"] = cursor } - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } if repo != "" { params["repo"] = repo } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.media.getVideoList", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.media.getVideoList", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/mediaorigin.go b/pkg/placestream/mediaorigin.go similarity index 64% rename from pkg/streamplace/mediaorigin.go rename to pkg/placestream/mediaorigin.go index c46ba1da..3eaa2e1f 100644 --- a/pkg/streamplace/mediaorigin.go +++ b/pkg/placestream/mediaorigin.go @@ -1,30 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.origin -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.media.origin", &MediaOrigin{}) + glexrt.RegisterType("place.stream.media.origin", &MediaOrigin{}) } // An attestation that a MUXL blob is available for download from the publishing node, retrievable via XRPC (com.atproto.repo.getBlob and similar). Published by the Streamplace node that hosts the blob, not by the user who owns the underlying video. The rkey is conventionally the blob's BDASL CID — atproto lexicon doesn't yet have a literal-rkey syntax so we settle for `key: any` and rely on the convention. type MediaOrigin struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.origin"` + LexiconTypeID string `json:"$type"` // blob: BLAKE-3 content hash (BDASL CID) of the blob. - Blob string `json:"blob" cborgen:"blob"` + Blob string `json:"blob"` // mimeType: MIME type of the blob (e.g. video/mp4). - MimeType string `json:"mimeType" cborgen:"mimeType"` + MimeType string `json:"mimeType"` // size: Size of the blob in bytes. - Size int64 `json:"size" cborgen:"size"` + Size int64 `json:"size"` } func (t *MediaOrigin) MarshalCBOR(w io.Writer) error { @@ -33,9 +32,9 @@ func (t *MediaOrigin) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.origin" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaOrigin) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/mediapublishVideo.go b/pkg/placestream/mediapublishvideo.go similarity index 54% rename from pkg/streamplace/mediapublishVideo.go rename to pkg/placestream/mediapublishvideo.go index ecbd7583..ceede93b 100644 --- a/pkg/streamplace/mediapublishVideo.go +++ b/pkg/placestream/mediapublishvideo.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.publishVideo -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type MediaPublishVideo_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.publishVideo#main"` + LexiconTypeID string `json:"$type"` // record: A place.stream.video record. The server overrides `source` and `durationMs` from the processed upload, and fills in `thumb` with a generated thumbnail when the supplied record has none. - Record *Video `json:"record" cborgen:"record"` + Record Video `json:"record"` // uploadId: The upload ID returned by place.stream.media.createUpload. Its processing must be complete (status 'done'). - UploadId string `json:"uploadId" cborgen:"uploadId"` + UploadId string `json:"uploadId"` } func (t *MediaPublishVideo_Input) MarshalCBOR(w io.Writer) error { @@ -27,19 +26,19 @@ func (t *MediaPublishVideo_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.publishVideo#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaPublishVideo_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type MediaPublishVideo_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.publishVideo#main"` + LexiconTypeID string `json:"$type"` // cid: CID of the created place.stream.video record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: AT-URI of the created place.stream.video record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *MediaPublishVideo_Output) MarshalCBOR(w io.Writer) error { @@ -48,19 +47,21 @@ func (t *MediaPublishVideo_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.publishVideo#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaPublishVideo_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaPublishVideo calls the XRPC method "place.stream.media.publishVideo". -func MediaPublishVideo(ctx context.Context, c lexutil.LexClient, input *MediaPublishVideo_Input) (*MediaPublishVideo_Output, error) { +// +// Publish a place.stream.video record for a finished upload, server-side. The caller supplies the record it would otherwise putRecord itself; the server overrides the fields it is authoritative about (source tracks and durationMs, taken from the processed upload) and, if the record carries no thumb, generates one from the video and attaches it. The record is written to the authenticated user's repo. +func MediaPublishVideo(ctx context.Context, c glexrt.LexClient, input *MediaPublishVideo_Input) (*MediaPublishVideo_Output, error) { var out MediaPublishVideo_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.media.publishVideo", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.media.publishVideo", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/mediatrack.go b/pkg/placestream/mediatrack.go similarity index 69% rename from pkg/streamplace/mediatrack.go rename to pkg/placestream/mediatrack.go index e256c19b..aacd5385 100644 --- a/pkg/streamplace/mediatrack.go +++ b/pkg/placestream/mediatrack.go @@ -1,8 +1,8 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.track -package streamplace +package placestream import ( "bytes" @@ -10,26 +10,25 @@ import ( "fmt" "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" + comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { - lexutil.RegisterType("place.stream.media.track", &MediaTrack{}) + glexrt.RegisterType("place.stream.media.track", &MediaTrack{}) } // A track for a video stream, either part of the source or a custom additional track. One of: video, audio, subtitles. type MediaTrack struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.track"` - Metadata *MediaTrack_Metadata `json:"metadata,omitempty" cborgen:"metadata,omitempty"` + LexiconTypeID string `json:"$type"` + Metadata *MediaTrack_Metadata `json:"metadata,omitempty"` // parentTrack: If this is a derived track like a transcode or a transcript, what was the parent track? - ParentTrack *comatproto.RepoStrongRef `json:"parentTrack,omitempty" cborgen:"parentTrack,omitempty"` - Track *MediaTrack_Track `json:"track" cborgen:"track"` + ParentTrack *comatproto.RepoStrongRef `json:"parentTrack,omitempty"` + Track MediaTrack_Track `json:"track"` // video: If this is a derived track like a transcode or a transcript, what was the source place.stream.video? - Video *string `json:"video,omitempty" cborgen:"video,omitempty"` + Video *string `json:"video,omitempty"` } func (t *MediaTrack) MarshalCBOR(w io.Writer) error { @@ -38,11 +37,11 @@ func (t *MediaTrack) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.track" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaTrack) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type MediaTrack_Metadata struct { @@ -58,7 +57,7 @@ func (t *MediaTrack_Metadata) MarshalJSON() ([]byte, error) { } func (t *MediaTrack_Metadata) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -85,7 +84,7 @@ func (t *MediaTrack_Metadata) MarshalCBOR(w io.Writer) error { } func (t *MediaTrack_Metadata) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } @@ -112,7 +111,7 @@ func (t *MediaTrack_Track) MarshalJSON() ([]byte, error) { } func (t *MediaTrack_Track) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -139,7 +138,7 @@ func (t *MediaTrack_Track) MarshalCBOR(w io.Writer) error { } func (t *MediaTrack_Track) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } @@ -157,13 +156,13 @@ func (t *MediaTrack_Track) UnmarshalCBOR(r io.Reader) error { // // Metadata common to all media types. Contains subobjects for other media types. type MediaTrack_CommonMetadata struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.track"` - Audio *Segment_Audio `json:"audio,omitempty" cborgen:"audio,omitempty"` + LexiconTypeID string `json:"$type"` + Audio *Segment_Audio `json:"audio,omitempty"` // durationMs: duration of this track in milliseconds - DurationMs *int64 `json:"durationMs,omitempty" cborgen:"durationMs,omitempty"` + DurationMs *int64 `json:"durationMs,omitempty"` // language: IETF BCP 47 language tag corresponding to the content of this track - Language *string `json:"language,omitempty" cborgen:"language,omitempty"` - Video *Segment_Video `json:"video,omitempty" cborgen:"video,omitempty"` + Language *string `json:"language,omitempty"` + Video *Segment_Video `json:"video,omitempty"` } func (t *MediaTrack_CommonMetadata) MarshalCBOR(w io.Writer) error { @@ -172,20 +171,20 @@ func (t *MediaTrack_CommonMetadata) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.track" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaTrack_CommonMetadata) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaTrack_TrackView is a "trackView" in the place.stream.media.track schema. type MediaTrack_TrackView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.track"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` - Cid string `json:"cid" cborgen:"cid"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` } func (t *MediaTrack_TrackView) MarshalCBOR(w io.Writer) error { @@ -194,9 +193,9 @@ func (t *MediaTrack_TrackView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.track" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaTrack_TrackView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/mediaviewCount.go b/pkg/placestream/mediaviewcount.go similarity index 70% rename from pkg/streamplace/mediaviewCount.go rename to pkg/placestream/mediaviewcount.go index dbe8fbbf..4f3f1c98 100644 --- a/pkg/streamplace/mediaviewCount.go +++ b/pkg/placestream/mediaviewcount.go @@ -1,37 +1,36 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.media.viewCount -package streamplace +package placestream import ( "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { - lexutil.RegisterType("place.stream.media.viewCount", &MediaViewCount{}) + glexrt.RegisterType("place.stream.media.viewCount", &MediaViewCount{}) } // A streamplace node's report of view counts for one place.stream.video over a closed time window. Published in the reporting node's server repo (not the streamer's), so a video served by multiple nodes accumulates multiple records — consumers are expected to sum across trusted reporters. The rkey is conventionally `-` so re-running the aggregator over the same window is idempotent. Counts represent the reporting node's best effort given the data it has; the `tracks` array carries the objective byte / duration totals it observed. type MediaViewCount struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.viewCount"` + LexiconTypeID string `json:"$type"` // count: Number of distinct sessions the reporting node observed as a view over [windowStart, windowEnd). - Count int64 `json:"count" cborgen:"count"` + Count int64 `json:"count"` // indexedAt: When the reporting node ran this aggregation. Useful for ordering successive reports. - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + IndexedAt string `json:"indexedAt"` // tracks: Per-track totals of bytes + playback duration the reporting node served over the window. Each entry references the place.stream.media.track record whose bytes were transferred, so user-contributed tracks (transcripts, transcodes published by other accounts) attribute naturally to their own records. - Tracks []*MediaViewCount_TrackUsage `json:"tracks,omitempty" cborgen:"tracks,omitempty"` + Tracks []MediaViewCount_TrackUsage `json:"tracks,omitempty"` // video: AT-URI of the place.stream.video this count is for. - Video string `json:"video" cborgen:"video"` + Video string `json:"video"` // windowEnd: Exclusive upper bound of the aggregation window. - WindowEnd string `json:"windowEnd" cborgen:"windowEnd"` + WindowEnd string `json:"windowEnd"` // windowStart: Inclusive lower bound of the aggregation window. - WindowStart string `json:"windowStart" cborgen:"windowStart"` + WindowStart string `json:"windowStart"` } func (t *MediaViewCount) MarshalCBOR(w io.Writer) error { @@ -40,24 +39,24 @@ func (t *MediaViewCount) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.viewCount" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaViewCount) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MediaViewCount_TrackUsage is a "trackUsage" in the place.stream.media.viewCount schema. // // One row of the tracks array: bytes + duration transferred for a single place.stream.media.track record over the window. type MediaViewCount_TrackUsage struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.media.viewCount"` + LexiconTypeID string `json:"$type"` // bytes: Total bytes served from this track over the window. Sum across attributed segment_requests' Range intersections with the track's segment offsets in the metafile. - Bytes int64 `json:"bytes" cborgen:"bytes"` + Bytes int64 `json:"bytes"` // durationMs: Total playback duration served from this track, in milliseconds. Per HLS segment in the range: (overlap bytes / segment bytes) * segment duration, so partial-segment fetches credit a proportional share of duration. - DurationMs int64 `json:"durationMs" cborgen:"durationMs"` + DurationMs int64 `json:"durationMs"` // track: Strong reference to the place.stream.media.track record whose bytes were transferred. - Track *comatproto.RepoStrongRef `json:"track" cborgen:"track"` + Track comatproto.RepoStrongRef `json:"track"` } func (t *MediaViewCount_TrackUsage) MarshalCBOR(w io.Writer) error { @@ -66,9 +65,9 @@ func (t *MediaViewCount_TrackUsage) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.media.viewCount" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MediaViewCount_TrackUsage) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/metadataconfiguration.go b/pkg/placestream/metadataconfiguration.go similarity index 54% rename from pkg/streamplace/metadataconfiguration.go rename to pkg/placestream/metadataconfiguration.go index 3937cc2a..10697661 100644 --- a/pkg/streamplace/metadataconfiguration.go +++ b/pkg/placestream/metadataconfiguration.go @@ -1,27 +1,26 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.metadata.configuration -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.metadata.configuration", &MetadataConfiguration{}) + glexrt.RegisterType("place.stream.metadata.configuration", &MetadataConfiguration{}) } // Default metadata record for livestream including content warnings, rights, and distribution policy type MetadataConfiguration struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.metadata.configuration"` - ContentRights *MetadataContentRights `json:"contentRights,omitempty" cborgen:"contentRights,omitempty"` - ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty" cborgen:"contentWarnings,omitempty"` - DistributionPolicy *MetadataDistributionPolicy `json:"distributionPolicy,omitempty" cborgen:"distributionPolicy,omitempty"` + LexiconTypeID string `json:"$type"` + ContentRights *MetadataContentRights `json:"contentRights,omitempty"` + ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` + DistributionPolicy *MetadataDistributionPolicy `json:"distributionPolicy,omitempty"` } func (t *MetadataConfiguration) MarshalCBOR(w io.Writer) error { @@ -30,9 +29,9 @@ func (t *MetadataConfiguration) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.metadata.configuration" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MetadataConfiguration) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/placestream/metadatacontentrights.go b/pkg/placestream/metadatacontentrights.go new file mode 100644 index 00000000..400ce2fd --- /dev/null +++ b/pkg/placestream/metadatacontentrights.go @@ -0,0 +1,44 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.metadata.contentRights + +package placestream + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("place.stream.metadata.contentRights#main", &MetadataContentRights{}) +} + +// Content rights and attribution information. +type MetadataContentRights struct { + LexiconTypeID string `json:"$type"` + // copyrightNotice: Copyright notice for the work. + CopyrightNotice *string `json:"copyrightNotice,omitempty"` + // copyrightYear: Year of creation or publication. + CopyrightYear *int64 `json:"copyrightYear,omitempty"` + // creator: Name of the creator of the work. + Creator *string `json:"creator,omitempty"` + // creditLine: Credit line for the work. + CreditLine *string `json:"creditLine,omitempty"` + // license: License URL or identifier. + License *string `json:"license,omitempty"` +} + +func (t *MetadataContentRights) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.metadata.contentRights" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MetadataContentRights) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/placestream/metadatacontentwarnings.go b/pkg/placestream/metadatacontentwarnings.go new file mode 100644 index 00000000..1aa6cb55 --- /dev/null +++ b/pkg/placestream/metadatacontentwarnings.go @@ -0,0 +1,35 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.metadata.contentWarnings + +package placestream + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("place.stream.metadata.contentWarnings#main", &MetadataContentWarnings{}) +} + +// Content warnings for a stream. +type MetadataContentWarnings struct { + LexiconTypeID string `json:"$type"` + Warnings []string `json:"warnings,omitempty"` +} + +func (t *MetadataContentWarnings) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.metadata.contentWarnings" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MetadataContentWarnings) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/streamplace/metadatadistributionPolicy.go b/pkg/placestream/metadatadistributionpolicy.go similarity index 61% rename from pkg/streamplace/metadatadistributionPolicy.go rename to pkg/placestream/metadatadistributionpolicy.go index 76dc71a8..c39584ae 100644 --- a/pkg/streamplace/metadatadistributionPolicy.go +++ b/pkg/placestream/metadatadistributionpolicy.go @@ -1,28 +1,27 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.metadata.distributionPolicy -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.metadata.distributionPolicy#main", &MetadataDistributionPolicy{}) + glexrt.RegisterType("place.stream.metadata.distributionPolicy#main", &MetadataDistributionPolicy{}) } // Distribution and rebroadcast policy. type MetadataDistributionPolicy struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.metadata.distributionPolicy"` + LexiconTypeID string `json:"$type"` // allowedBroadcasters: List of did:webs of the broadcasters you want to allow to distribute your content. "*" allows anyone. Starting a line with a "!" bans that broadcaster. - AllowedBroadcasters []string `json:"allowedBroadcasters,omitempty" cborgen:"allowedBroadcasters,omitempty"` + AllowedBroadcasters []string `json:"allowedBroadcasters,omitempty"` // deleteAfter: Duration in seconds after which segments should be deleted. Each segment will expire N seconds after its creation time. -1 to allow indefinite archival. - DeleteAfter *int64 `json:"deleteAfter,omitempty" cborgen:"deleteAfter,omitempty"` + DeleteAfter *int64 `json:"deleteAfter,omitempty"` } func (t *MetadataDistributionPolicy) MarshalCBOR(w io.Writer) error { @@ -31,9 +30,9 @@ func (t *MetadataDistributionPolicy) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.metadata.distributionPolicy" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MetadataDistributionPolicy) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/moderationcreateBlock.go b/pkg/placestream/moderationcreateblock.go similarity index 54% rename from pkg/streamplace/moderationcreateBlock.go rename to pkg/placestream/moderationcreateblock.go index 3553efbf..5ce7b348 100644 --- a/pkg/streamplace/moderationcreateBlock.go +++ b/pkg/placestream/moderationcreateblock.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.createBlock -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationCreateBlock_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createBlock#main"` + LexiconTypeID string `json:"$type"` // reason: Optional reason for the block. - Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` + Reason *string `json:"reason,omitempty"` // streamer: The DID of the streamer whose chat this block applies to. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` // subject: The DID of the user being blocked from chat. - Subject string `json:"subject" cborgen:"subject"` + Subject string `json:"subject"` } func (t *ModerationCreateBlock_Input) MarshalCBOR(w io.Writer) error { @@ -29,19 +28,19 @@ func (t *ModerationCreateBlock_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createBlock#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreateBlock_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationCreateBlock_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createBlock#main"` + LexiconTypeID string `json:"$type"` // cid: The CID of the created block record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: The AT-URI of the created block record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *ModerationCreateBlock_Output) MarshalCBOR(w io.Writer) error { @@ -50,19 +49,21 @@ func (t *ModerationCreateBlock_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createBlock#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreateBlock_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationCreateBlock calls the XRPC method "place.stream.moderation.createBlock". -func ModerationCreateBlock(ctx context.Context, c lexutil.LexClient, input *ModerationCreateBlock_Input) (*ModerationCreateBlock_Output, error) { +// +// Create a block (ban) on behalf of a streamer. Requires 'ban' permission. Creates an app.bsky.graph.block record in the streamer's repository. +func ModerationCreateBlock(ctx context.Context, c glexrt.LexClient, input *ModerationCreateBlock_Input) (*ModerationCreateBlock_Output, error) { var out ModerationCreateBlock_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.createBlock", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.createBlock", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationcreateGate.go b/pkg/placestream/moderationcreategate.go similarity index 53% rename from pkg/streamplace/moderationcreateGate.go rename to pkg/placestream/moderationcreategate.go index c418f9c4..4cc7e450 100644 --- a/pkg/streamplace/moderationcreateGate.go +++ b/pkg/placestream/moderationcreategate.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.createGate -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationCreateGate_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createGate#main"` + LexiconTypeID string `json:"$type"` // messageUri: The AT-URI of the chat message to hide. - MessageUri string `json:"messageUri" cborgen:"messageUri"` + MessageUri string `json:"messageUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ModerationCreateGate_Input) MarshalCBOR(w io.Writer) error { @@ -27,19 +26,19 @@ func (t *ModerationCreateGate_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreateGate_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationCreateGate_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createGate#main"` + LexiconTypeID string `json:"$type"` // cid: The CID of the created gate record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: The AT-URI of the created gate record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *ModerationCreateGate_Output) MarshalCBOR(w io.Writer) error { @@ -48,19 +47,21 @@ func (t *ModerationCreateGate_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreateGate_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationCreateGate calls the XRPC method "place.stream.moderation.createGate". -func ModerationCreateGate(ctx context.Context, c lexutil.LexClient, input *ModerationCreateGate_Input) (*ModerationCreateGate_Output, error) { +// +// Create a gate (hide message) on behalf of a streamer. Requires 'hide' permission. Creates a place.stream.chat.gate record in the streamer's repository. +func ModerationCreateGate(ctx context.Context, c glexrt.LexClient, input *ModerationCreateGate_Input) (*ModerationCreateGate_Output, error) { var out ModerationCreateGate_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.createGate", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.createGate", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationcreatePin.go b/pkg/placestream/moderationcreatepin.go similarity index 53% rename from pkg/streamplace/moderationcreatePin.go rename to pkg/placestream/moderationcreatepin.go index 0164b4a9..41eac194 100644 --- a/pkg/streamplace/moderationcreatePin.go +++ b/pkg/placestream/moderationcreatepin.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.createPin -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationCreatePin_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createPin#main"` + LexiconTypeID string `json:"$type"` // expiresAt: Optional expiration time for this pin. - ExpiresAt *string `json:"expiresAt,omitempty" cborgen:"expiresAt,omitempty"` + ExpiresAt *string `json:"expiresAt,omitempty"` // messageUri: The AT-URI of the chat message to pin. - MessageUri string `json:"messageUri" cborgen:"messageUri"` + MessageUri string `json:"messageUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ModerationCreatePin_Input) MarshalCBOR(w io.Writer) error { @@ -29,19 +28,19 @@ func (t *ModerationCreatePin_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createPin#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreatePin_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationCreatePin_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createPin#main"` + LexiconTypeID string `json:"$type"` // cid: The CID of the created pinned record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: The AT-URI of the created pinned record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *ModerationCreatePin_Output) MarshalCBOR(w io.Writer) error { @@ -50,19 +49,21 @@ func (t *ModerationCreatePin_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createPin#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreatePin_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationCreatePin calls the XRPC method "place.stream.moderation.createPin". -func ModerationCreatePin(ctx context.Context, c lexutil.LexClient, input *ModerationCreatePin_Input) (*ModerationCreatePin_Output, error) { +// +// Pin a chat message on behalf of a streamer. Requires 'message.pin' permission. Creates a place.stream.chat.pinnedRecord in the streamer's repo, replacing any existing pin. +func ModerationCreatePin(ctx context.Context, c glexrt.LexClient, input *ModerationCreatePin_Input) (*ModerationCreatePin_Output, error) { var out ModerationCreatePin_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.createPin", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.createPin", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationcreateVodGate.go b/pkg/placestream/moderationcreatevodgate.go similarity index 54% rename from pkg/streamplace/moderationcreateVodGate.go rename to pkg/placestream/moderationcreatevodgate.go index 2c9646ce..1fa227cd 100644 --- a/pkg/streamplace/moderationcreateVodGate.go +++ b/pkg/placestream/moderationcreatevodgate.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.createVodGate -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationCreateVodGate_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createVodGate#main"` + LexiconTypeID string `json:"$type"` // commentUri: The AT-URI of the VOD comment to hide. - CommentUri string `json:"commentUri" cborgen:"commentUri"` + CommentUri string `json:"commentUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ModerationCreateVodGate_Input) MarshalCBOR(w io.Writer) error { @@ -27,19 +26,19 @@ func (t *ModerationCreateVodGate_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createVodGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreateVodGate_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationCreateVodGate_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.createVodGate#main"` + LexiconTypeID string `json:"$type"` // cid: The CID of the created gate record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: The AT-URI of the created gate record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *ModerationCreateVodGate_Output) MarshalCBOR(w io.Writer) error { @@ -48,19 +47,21 @@ func (t *ModerationCreateVodGate_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.createVodGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationCreateVodGate_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationCreateVodGate calls the XRPC method "place.stream.moderation.createVodGate". -func ModerationCreateVodGate(ctx context.Context, c lexutil.LexClient, input *ModerationCreateVodGate_Input) (*ModerationCreateVodGate_Output, error) { +// +// Create a gate (hide VOD comment) on behalf of a streamer. Requires 'vod.comment.hide' permission. Creates a place.stream.vod.gate record in the streamer's repository. +func ModerationCreateVodGate(ctx context.Context, c glexrt.LexClient, input *ModerationCreateVodGate_Input) (*ModerationCreateVodGate_Output, error) { var out ModerationCreateVodGate_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.createVodGate", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.createVodGate", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationdefs.go b/pkg/placestream/moderationdefs.go similarity index 54% rename from pkg/streamplace/moderationdefs.go rename to pkg/placestream/moderationdefs.go index 8901f27f..c56efe1d 100644 --- a/pkg/streamplace/moderationdefs.go +++ b/pkg/placestream/moderationdefs.go @@ -1,29 +1,28 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.defs -package streamplace +package placestream import ( "io" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" ) // ModerationDefs_PermissionView is a "permissionView" in the place.stream.moderation.defs schema. type ModerationDefs_PermissionView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.defs"` + LexiconTypeID string `json:"$type"` // author: The streamer who granted these permissions - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` // cid: Content identifier of the permission record - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // record: The permission record itself - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` + Record *glexrt.LexiconTypeDecoder `json:"record"` // uri: AT-URI of the permission record - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *ModerationDefs_PermissionView) MarshalCBOR(w io.Writer) error { @@ -32,9 +31,9 @@ func (t *ModerationDefs_PermissionView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDefs_PermissionView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/moderationdeleteBlock.go b/pkg/placestream/moderationdeleteblock.go similarity index 54% rename from pkg/streamplace/moderationdeleteBlock.go rename to pkg/placestream/moderationdeleteblock.go index d6165466..caa5f430 100644 --- a/pkg/streamplace/moderationdeleteBlock.go +++ b/pkg/placestream/moderationdeleteblock.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.deleteBlock -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationDeleteBlock_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deleteBlock#main"` + LexiconTypeID string `json:"$type"` // blockUri: The AT-URI of the block record to delete. - BlockUri string `json:"blockUri" cborgen:"blockUri"` + BlockUri string `json:"blockUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ModerationDeleteBlock_Input) MarshalCBOR(w io.Writer) error { @@ -27,15 +26,15 @@ func (t *ModerationDeleteBlock_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deleteBlock#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeleteBlock_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationDeleteBlock_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deleteBlock#main"` + LexiconTypeID string `json:"$type"` } func (t *ModerationDeleteBlock_Output) MarshalCBOR(w io.Writer) error { @@ -44,19 +43,21 @@ func (t *ModerationDeleteBlock_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deleteBlock#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeleteBlock_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationDeleteBlock calls the XRPC method "place.stream.moderation.deleteBlock". -func ModerationDeleteBlock(ctx context.Context, c lexutil.LexClient, input *ModerationDeleteBlock_Input) (*ModerationDeleteBlock_Output, error) { +// +// Delete a block (unban) on behalf of a streamer. Requires 'ban' permission. Deletes an app.bsky.graph.block record from the streamer's repository. +func ModerationDeleteBlock(ctx context.Context, c glexrt.LexClient, input *ModerationDeleteBlock_Input) (*ModerationDeleteBlock_Output, error) { var out ModerationDeleteBlock_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.deleteBlock", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.deleteBlock", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationdeleteGate.go b/pkg/placestream/moderationdeletegate.go similarity index 54% rename from pkg/streamplace/moderationdeleteGate.go rename to pkg/placestream/moderationdeletegate.go index 98772eaf..7a13b422 100644 --- a/pkg/streamplace/moderationdeleteGate.go +++ b/pkg/placestream/moderationdeletegate.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.deleteGate -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationDeleteGate_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deleteGate#main"` + LexiconTypeID string `json:"$type"` // gateUri: The AT-URI of the gate record to delete. - GateUri string `json:"gateUri" cborgen:"gateUri"` + GateUri string `json:"gateUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ModerationDeleteGate_Input) MarshalCBOR(w io.Writer) error { @@ -27,15 +26,15 @@ func (t *ModerationDeleteGate_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deleteGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeleteGate_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationDeleteGate_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deleteGate#main"` + LexiconTypeID string `json:"$type"` } func (t *ModerationDeleteGate_Output) MarshalCBOR(w io.Writer) error { @@ -44,19 +43,21 @@ func (t *ModerationDeleteGate_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deleteGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeleteGate_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationDeleteGate calls the XRPC method "place.stream.moderation.deleteGate". -func ModerationDeleteGate(ctx context.Context, c lexutil.LexClient, input *ModerationDeleteGate_Input) (*ModerationDeleteGate_Output, error) { +// +// Delete a gate (unhide message) on behalf of a streamer. Requires 'hide' permission. Deletes a place.stream.chat.gate record from the streamer's repository. +func ModerationDeleteGate(ctx context.Context, c glexrt.LexClient, input *ModerationDeleteGate_Input) (*ModerationDeleteGate_Output, error) { var out ModerationDeleteGate_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.deleteGate", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.deleteGate", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationdeletePin.go b/pkg/placestream/moderationdeletepin.go similarity index 54% rename from pkg/streamplace/moderationdeletePin.go rename to pkg/placestream/moderationdeletepin.go index 8e44eb43..d1c3e7fc 100644 --- a/pkg/streamplace/moderationdeletePin.go +++ b/pkg/placestream/moderationdeletepin.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.deletePin -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationDeletePin_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deletePin#main"` + LexiconTypeID string `json:"$type"` // pinUri: The AT-URI of the pinned record to delete. - PinUri string `json:"pinUri" cborgen:"pinUri"` + PinUri string `json:"pinUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ModerationDeletePin_Input) MarshalCBOR(w io.Writer) error { @@ -27,15 +26,15 @@ func (t *ModerationDeletePin_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deletePin#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeletePin_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationDeletePin_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deletePin#main"` + LexiconTypeID string `json:"$type"` } func (t *ModerationDeletePin_Output) MarshalCBOR(w io.Writer) error { @@ -44,19 +43,21 @@ func (t *ModerationDeletePin_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deletePin#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeletePin_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationDeletePin calls the XRPC method "place.stream.moderation.deletePin". -func ModerationDeletePin(ctx context.Context, c lexutil.LexClient, input *ModerationDeletePin_Input) (*ModerationDeletePin_Output, error) { +// +// Unpin a pinned chat message on behalf of a streamer. Requires 'message.pin' permission. Deletes the place.stream.chat.pinnedRecord from the streamer's repo. +func ModerationDeletePin(ctx context.Context, c glexrt.LexClient, input *ModerationDeletePin_Input) (*ModerationDeletePin_Output, error) { var out ModerationDeletePin_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.deletePin", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.deletePin", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationdeleteVodGate.go b/pkg/placestream/moderationdeletevodgate.go similarity index 54% rename from pkg/streamplace/moderationdeleteVodGate.go rename to pkg/placestream/moderationdeletevodgate.go index 18a8bdab..72e8b9a2 100644 --- a/pkg/streamplace/moderationdeleteVodGate.go +++ b/pkg/placestream/moderationdeletevodgate.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.deleteVodGate -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationDeleteVodGate_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deleteVodGate#main"` + LexiconTypeID string `json:"$type"` // gateUri: The AT-URI of the gate record to delete. - GateUri string `json:"gateUri" cborgen:"gateUri"` + GateUri string `json:"gateUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` } func (t *ModerationDeleteVodGate_Input) MarshalCBOR(w io.Writer) error { @@ -27,15 +26,15 @@ func (t *ModerationDeleteVodGate_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deleteVodGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeleteVodGate_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationDeleteVodGate_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.deleteVodGate#main"` + LexiconTypeID string `json:"$type"` } func (t *ModerationDeleteVodGate_Output) MarshalCBOR(w io.Writer) error { @@ -44,19 +43,21 @@ func (t *ModerationDeleteVodGate_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.deleteVodGate#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationDeleteVodGate_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationDeleteVodGate calls the XRPC method "place.stream.moderation.deleteVodGate". -func ModerationDeleteVodGate(ctx context.Context, c lexutil.LexClient, input *ModerationDeleteVodGate_Input) (*ModerationDeleteVodGate_Output, error) { +// +// Delete a gate (unhide VOD comment) on behalf of a streamer. Requires 'vod.comment.hide' permission. Deletes a place.stream.vod.gate record from the streamer's repository. +func ModerationDeleteVodGate(ctx context.Context, c glexrt.LexClient, input *ModerationDeleteVodGate_Input) (*ModerationDeleteVodGate_Output, error) { var out ModerationDeleteVodGate_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.deleteVodGate", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.deleteVodGate", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/moderationpermission.go b/pkg/placestream/moderationpermission.go similarity index 58% rename from pkg/streamplace/moderationpermission.go rename to pkg/placestream/moderationpermission.go index 2d952fbc..13b8813b 100644 --- a/pkg/streamplace/moderationpermission.go +++ b/pkg/placestream/moderationpermission.go @@ -1,32 +1,31 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.permission -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.moderation.permission", &ModerationPermission{}) + glexrt.RegisterType("place.stream.moderation.permission", &ModerationPermission{}) } // Record granting moderation permissions to a user for this streamer's content. type ModerationPermission struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.permission"` + LexiconTypeID string `json:"$type"` // createdAt: Client-declared timestamp when this moderator was added. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // expirationTime: Optional expiration time for this delegation. If set, the delegation is invalid after this time. - ExpirationTime *string `json:"expirationTime,omitempty" cborgen:"expirationTime,omitempty"` + ExpirationTime *string `json:"expirationTime,omitempty"` // moderator: The DID of the user granted moderator permissions. - Moderator string `json:"moderator" cborgen:"moderator"` + Moderator string `json:"moderator"` // permissions: Array of permissions granted to this moderator. 'ban' covers blocks/bans (with optional expiration), 'hide' covers message gates, 'livestream.manage' allows updating livestream metadata. - Permissions []string `json:"permissions" cborgen:"permissions"` + Permissions []string `json:"permissions"` } func (t *ModerationPermission) MarshalCBOR(w io.Writer) error { @@ -35,9 +34,9 @@ func (t *ModerationPermission) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.permission" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationPermission) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/moderationupdateLivestream.go b/pkg/placestream/moderationupdatelivestream.go similarity index 53% rename from pkg/streamplace/moderationupdateLivestream.go rename to pkg/placestream/moderationupdatelivestream.go index 07d047fe..1fb0d2a6 100644 --- a/pkg/streamplace/moderationupdateLivestream.go +++ b/pkg/placestream/moderationupdatelivestream.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.moderation.updateLivestream -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ModerationUpdateLivestream_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.updateLivestream#main"` + LexiconTypeID string `json:"$type"` // livestreamUri: The AT-URI of the livestream record to update. - LivestreamUri string `json:"livestreamUri" cborgen:"livestreamUri"` + LivestreamUri string `json:"livestreamUri"` // streamer: The DID of the streamer. - Streamer string `json:"streamer" cborgen:"streamer"` + Streamer string `json:"streamer"` // title: New title for the livestream. - Title *string `json:"title,omitempty" cborgen:"title,omitempty"` + Title *string `json:"title,omitempty"` } func (t *ModerationUpdateLivestream_Input) MarshalCBOR(w io.Writer) error { @@ -29,19 +28,19 @@ func (t *ModerationUpdateLivestream_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.updateLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationUpdateLivestream_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ModerationUpdateLivestream_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.moderation.updateLivestream#main"` + LexiconTypeID string `json:"$type"` // cid: The CID of the updated livestream record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // uri: The AT-URI of the updated livestream record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *ModerationUpdateLivestream_Output) MarshalCBOR(w io.Writer) error { @@ -50,19 +49,21 @@ func (t *ModerationUpdateLivestream_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.moderation.updateLivestream#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ModerationUpdateLivestream_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ModerationUpdateLivestream calls the XRPC method "place.stream.moderation.updateLivestream". -func ModerationUpdateLivestream(ctx context.Context, c lexutil.LexClient, input *ModerationUpdateLivestream_Input) (*ModerationUpdateLivestream_Output, error) { +// +// Update livestream metadata on behalf of a streamer. Requires 'livestream.manage' permission. Updates a place.stream.livestream record in the streamer's repository. +func ModerationUpdateLivestream(ctx context.Context, c glexrt.LexClient, input *ModerationUpdateLivestream_Input) (*ModerationUpdateLivestream_Output, error) { var out ModerationUpdateLivestream_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.moderation.updateLivestream", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.moderation.updateLivestream", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/placestream/multistreamcreatetarget.go b/pkg/placestream/multistreamcreatetarget.go new file mode 100644 index 00000000..65a86c75 --- /dev/null +++ b/pkg/placestream/multistreamcreatetarget.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.multistream.createTarget + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type MultistreamCreateTarget_Input struct { + LexiconTypeID string `json:"$type"` + MultistreamTarget MultistreamTarget `json:"multistreamTarget"` +} + +func (t *MultistreamCreateTarget_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.multistream.createTarget#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MultistreamCreateTarget_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// MultistreamCreateTarget calls the XRPC method "place.stream.multistream.createTarget". +// +// Create a new target for rebroadcasting a Streamplace stream. +func MultistreamCreateTarget(ctx context.Context, c glexrt.LexClient, input *MultistreamCreateTarget_Input) (*MultistreamDefs_TargetView, error) { + var out MultistreamDefs_TargetView + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.multistream.createTarget", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/placestream/multistreamdefs.go b/pkg/placestream/multistreamdefs.go new file mode 100644 index 00000000..b4434e23 --- /dev/null +++ b/pkg/placestream/multistreamdefs.go @@ -0,0 +1,55 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.multistream.defs + +package placestream + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +// MultistreamDefs_Event is a "event" in the place.stream.multistream.defs schema. +type MultistreamDefs_Event struct { + LexiconTypeID string `json:"$type"` + CreatedAt string `json:"createdAt"` + Message string `json:"message"` + Status string `json:"status"` +} + +func (t *MultistreamDefs_Event) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.multistream.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MultistreamDefs_Event) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// MultistreamDefs_TargetView is a "targetView" in the place.stream.multistream.defs schema. +type MultistreamDefs_TargetView struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + LatestEvent *MultistreamDefs_Event `json:"latestEvent,omitempty"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` +} + +func (t *MultistreamDefs_TargetView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.multistream.defs" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MultistreamDefs_TargetView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/streamplace/multistreamdeleteTarget.go b/pkg/placestream/multistreamdeletetarget.go similarity index 55% rename from pkg/streamplace/multistreamdeleteTarget.go rename to pkg/placestream/multistreamdeletetarget.go index 01781395..455c739f 100644 --- a/pkg/streamplace/multistreamdeleteTarget.go +++ b/pkg/placestream/multistreamdeletetarget.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.multistream.deleteTarget -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type MultistreamDeleteTarget_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.deleteTarget#main"` + LexiconTypeID string `json:"$type"` // rkey: The Record Key of the target to delete. - Rkey string `json:"rkey" cborgen:"rkey"` + Rkey string `json:"rkey"` } func (t *MultistreamDeleteTarget_Input) MarshalCBOR(w io.Writer) error { @@ -25,15 +24,15 @@ func (t *MultistreamDeleteTarget_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.multistream.deleteTarget#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MultistreamDeleteTarget_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type MultistreamDeleteTarget_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.deleteTarget#main"` + LexiconTypeID string `json:"$type"` } func (t *MultistreamDeleteTarget_Output) MarshalCBOR(w io.Writer) error { @@ -42,19 +41,21 @@ func (t *MultistreamDeleteTarget_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.multistream.deleteTarget#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MultistreamDeleteTarget_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // MultistreamDeleteTarget calls the XRPC method "place.stream.multistream.deleteTarget". -func MultistreamDeleteTarget(ctx context.Context, c lexutil.LexClient, input *MultistreamDeleteTarget_Input) (*MultistreamDeleteTarget_Output, error) { +// +// Delete a target for rebroadcasting a Streamplace stream. +func MultistreamDeleteTarget(ctx context.Context, c glexrt.LexClient, input *MultistreamDeleteTarget_Input) (*MultistreamDeleteTarget_Output, error) { var out MultistreamDeleteTarget_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.multistream.deleteTarget", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.multistream.deleteTarget", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/placestream/multistreamlisttargets.go b/pkg/placestream/multistreamlisttargets.go new file mode 100644 index 00000000..6bf0152c --- /dev/null +++ b/pkg/placestream/multistreamlisttargets.go @@ -0,0 +1,75 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.multistream.listTargets + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type MultistreamListTargets_Output struct { + LexiconTypeID string `json:"$type"` + Cursor *string `json:"cursor,omitempty"` + Targets []MultistreamDefs_TargetView `json:"targets"` +} + +func (t *MultistreamListTargets_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.multistream.listTargets#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MultistreamListTargets_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// MultistreamListTargets calls the XRPC method "place.stream.multistream.listTargets". +// +// List a range of targets for rebroadcasting a Streamplace stream. +// +// limit: The number of targets to return. +func MultistreamListTargets(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*MultistreamListTargets_Output, error) { + var out MultistreamListTargets_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != nil { + params["limit"] = *limit + } + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.multistream.listTargets", params, nil, &out); err != nil { + return nil, err + } + return &out, nil +} + +// MultistreamListTargets_Record is a "record" in the place.stream.multistream.listTargets schema. +type MultistreamListTargets_Record struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Uri string `json:"uri"` + Value *glexrt.LexiconTypeDecoder `json:"value"` +} + +func (t *MultistreamListTargets_Record) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.multistream.listTargets" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MultistreamListTargets_Record) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/placestream/multistreamputtarget.go b/pkg/placestream/multistreamputtarget.go new file mode 100644 index 00000000..3acc1fbe --- /dev/null +++ b/pkg/placestream/multistreamputtarget.go @@ -0,0 +1,45 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.multistream.putTarget + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type MultistreamPutTarget_Input struct { + LexiconTypeID string `json:"$type"` + MultistreamTarget MultistreamTarget `json:"multistreamTarget"` + // rkey: The Record Key. + Rkey *string `json:"rkey,omitempty"` +} + +func (t *MultistreamPutTarget_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.multistream.putTarget#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *MultistreamPutTarget_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// MultistreamPutTarget calls the XRPC method "place.stream.multistream.putTarget". +// +// Update an existing target for rebroadcasting a Streamplace stream. +func MultistreamPutTarget(ctx context.Context, c glexrt.LexClient, input *MultistreamPutTarget_Input) (*MultistreamDefs_TargetView, error) { + var out MultistreamDefs_TargetView + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.multistream.putTarget", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/streamplace/multistreamtarget.go b/pkg/placestream/multistreamtarget.go similarity index 52% rename from pkg/streamplace/multistreamtarget.go rename to pkg/placestream/multistreamtarget.go index 52cced10..d4791253 100644 --- a/pkg/streamplace/multistreamtarget.go +++ b/pkg/placestream/multistreamtarget.go @@ -1,32 +1,31 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.multistream.target -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.multistream.target", &MultistreamTarget{}) + glexrt.RegisterType("place.stream.multistream.target", &MultistreamTarget{}) } // An external server for rebroadcasting a Streamplace stream type MultistreamTarget struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.target"` + LexiconTypeID string `json:"$type"` // active: Whether this target is currently active. - Active bool `json:"active" cborgen:"active"` + Active bool `json:"active"` // createdAt: When this target was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // name: A user-friendly name for this target. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` + Name *string `json:"name,omitempty"` // url: The rtmp:// or rtmps:// url of the target server. - Url string `json:"url" cborgen:"url"` + Url string `json:"url"` } func (t *MultistreamTarget) MarshalCBOR(w io.Writer) error { @@ -35,9 +34,9 @@ func (t *MultistreamTarget) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.multistream.target" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *MultistreamTarget) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/playbackgetLivePlaylist.go b/pkg/placestream/playbackgetliveplaylist.go similarity index 53% rename from pkg/streamplace/playbackgetLivePlaylist.go rename to pkg/placestream/playbackgetliveplaylist.go index ff642da4..eb01b34d 100644 --- a/pkg/streamplace/playbackgetLivePlaylist.go +++ b/pkg/placestream/playbackgetliveplaylist.go @@ -1,22 +1,24 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.playback.getLivePlaylist -package streamplace +package placestream import ( "bytes" "context" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" ) // PlaybackGetLivePlaylist calls the XRPC method "place.stream.playback.getLivePlaylist". // +// Get an HLS CMAF playlist for a live stream. Returns a master playlist when `track` is omitted, or a single-track media playlist when `track` is supplied. The playlist references each segment + per-track init segment via getLiveSegment. Segments come from an in-memory sliding window fed as the stream is ingested (or replicated to this node), so a playlist is only available while the stream is live here. +// // sid: Opaque playback session identifier. Omit on the master playlist request; the server generates one and threads it through the sub-playlist + segment URLs it returns, for view-count correlation. // streamer: The streamer to play back: a DID (did:plc/did:web/did:key) or a Bluesky handle, which is resolved to its DID. // track: Track ID (stringified u32 matching the MUXL container) for a single-track media playlist. Omit for the master playlist. -func PlaybackGetLivePlaylist(ctx context.Context, c lexutil.LexClient, sid string, streamer string, track string) ([]byte, error) { +func PlaybackGetLivePlaylist(ctx context.Context, c glexrt.LexClient, sid string, streamer string, track string) ([]byte, error) { buf := new(bytes.Buffer) params := map[string]interface{}{} @@ -27,9 +29,9 @@ func PlaybackGetLivePlaylist(ctx context.Context, c lexutil.LexClient, sid strin params["track"] = track } params["streamer"] = streamer - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.playback.getLivePlaylist", params, nil, buf); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.playback.getLivePlaylist", params, nil, buf); err != nil { return nil, err } - return buf.Bytes(), nil } diff --git a/pkg/streamplace/playbackgetLiveSegment.go b/pkg/placestream/playbackgetlivesegment.go similarity index 53% rename from pkg/streamplace/playbackgetLiveSegment.go rename to pkg/placestream/playbackgetlivesegment.go index 810f7541..0089e827 100644 --- a/pkg/streamplace/playbackgetLiveSegment.go +++ b/pkg/placestream/playbackgetlivesegment.go @@ -1,23 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.playback.getLiveSegment -package streamplace +package placestream import ( "bytes" "context" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" ) // PlaybackGetLiveSegment calls the XRPC method "place.stream.playback.getLiveSegment". // +// Fetch a single live HLS segment, or a track's init segment, from the in-memory live window. `seg` is `init` for the EXT-X-MAP init segment, otherwise the segment's media-sequence number; a cosmetic `.m4s` suffix is accepted (and ignored) so ffmpeg-based HLS players will fetch it. HTTP Range is honored. Segments are the verbatim signed canonical .m4s, so provenance travels with playback. +// // seg: `init` for the track's init segment, or the segment's media-sequence number. A trailing `.m4s` is accepted and ignored. // sid: Opaque playback session identifier, propagated from the media playlist that referenced this segment. Logged for view-count correlation; not used for access control. // streamer: The streamer: a DID or a Bluesky handle (resolved to its DID). // track: Track ID (stringified u32 matching the MUXL container). -func PlaybackGetLiveSegment(ctx context.Context, c lexutil.LexClient, seg string, sid string, streamer string, track string) ([]byte, error) { +func PlaybackGetLiveSegment(ctx context.Context, c glexrt.LexClient, seg string, sid string, streamer string, track string) ([]byte, error) { buf := new(bytes.Buffer) params := map[string]interface{}{} @@ -27,9 +29,9 @@ func PlaybackGetLiveSegment(ctx context.Context, c lexutil.LexClient, seg string params["seg"] = seg params["streamer"] = streamer params["track"] = track - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.playback.getLiveSegment", params, nil, buf); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.playback.getLiveSegment", params, nil, buf); err != nil { return nil, err } - return buf.Bytes(), nil } diff --git a/pkg/streamplace/playbackgetPlaybackServer.go b/pkg/placestream/playbackgetplaybackserver.go similarity index 56% rename from pkg/streamplace/playbackgetPlaybackServer.go rename to pkg/placestream/playbackgetplaybackserver.go index 6e69857b..bf5f06da 100644 --- a/pkg/streamplace/playbackgetPlaybackServer.go +++ b/pkg/placestream/playbackgetplaybackserver.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.playback.getPlaybackServer -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type PlaybackGetPlaybackServer_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.playback.getPlaybackServer#main"` + LexiconTypeID string `json:"$type"` // servers: List of available playback server addresses - Servers []string `json:"servers" cborgen:"servers"` + Servers []string `json:"servers"` } func (t *PlaybackGetPlaybackServer_Output) MarshalCBOR(w io.Writer) error { @@ -25,24 +24,26 @@ func (t *PlaybackGetPlaybackServer_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.playback.getPlaybackServer#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *PlaybackGetPlaybackServer_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // PlaybackGetPlaybackServer calls the XRPC method "place.stream.playback.getPlaybackServer". // +// Get available playback servers for a livestream. +// // stream: Identifier of the stream to get playback servers for -func PlaybackGetPlaybackServer(ctx context.Context, c lexutil.LexClient, stream string) (*PlaybackGetPlaybackServer_Output, error) { +func PlaybackGetPlaybackServer(ctx context.Context, c glexrt.LexClient, stream string) (*PlaybackGetPlaybackServer_Output, error) { var out PlaybackGetPlaybackServer_Output params := map[string]interface{}{} params["stream"] = stream - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.playback.getPlaybackServer", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.playback.getPlaybackServer", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/placestream/playbackgetvideoblob.go b/pkg/placestream/playbackgetvideoblob.go new file mode 100644 index 00000000..d7302696 --- /dev/null +++ b/pkg/placestream/playbackgetvideoblob.go @@ -0,0 +1,35 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.playback.getVideoBlob + +package placestream + +import ( + "bytes" + "context" + + glexrt "github.com/streamplace/glex/runtime" +) + +// PlaybackGetVideoBlob calls the XRPC method "place.stream.playback.getVideoBlob". +// +// Fetch a content-addressed MUXL playback blob by CID. Serves either a primary fMP4 archive or a per-track init segment — both are CID-addressed and indistinguishable from the endpoint's point of view. HTTP `Range` headers are honored; HLS media playlists generated by getVideoPlaylist reference this endpoint with `EXT-X-BYTERANGE` to serve segments out of the primary blob. The `did` identifies the owning account for egress accounting: the blob itself is content-addressed and owner-agnostic, so the caller carries the attribution. +// +// cid: BLAKE-3 BDASL CID of the requested blob. +// did: DID of the account that owns the record this blob is being served for. Used for egress/usage accounting, not for access control — the blob is served purely by CID. +// sid: Opaque playback session identifier, propagated unmodified from the media playlist that referenced this blob. Logged for view-count correlation; not used for access control. +func PlaybackGetVideoBlob(ctx context.Context, c glexrt.LexClient, cid string, did string, sid string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + if sid != "" { + params["sid"] = sid + } + params["cid"] = cid + params["did"] = did + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.playback.getVideoBlob", params, nil, buf); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/pkg/streamplace/playbackgetVideoPlaylist.go b/pkg/placestream/playbackgetvideoplaylist.go similarity index 61% rename from pkg/streamplace/playbackgetVideoPlaylist.go rename to pkg/placestream/playbackgetvideoplaylist.go index 1e09c12b..bc31f8f6 100644 --- a/pkg/streamplace/playbackgetVideoPlaylist.go +++ b/pkg/placestream/playbackgetvideoplaylist.go @@ -1,43 +1,45 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.playback.getVideoPlaylist -package streamplace +package placestream import ( "bytes" "context" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" ) // PlaybackGetVideoPlaylist calls the XRPC method "place.stream.playback.getVideoPlaylist". // +// Get an HLS CMAF playlist for a video. Returns a master playlist when `track` is omitted, or a single-track media playlist when `track` is supplied. The playlist references each segment + per-track init segment via getVideoBlob, addressed by content hash. The `uri` is an AT-URI pointing at a playable record — today only place.stream.video records are supported, but the surface is collection-agnostic so other record types can join later. +// // end: End time in milliseconds. Omit to include all remaining content. Local to the clip's timeline when playing back a sourceClip record. // sid: Opaque playback session identifier. Omit on the master playlist request; the server generates one and embeds it in every sub-playlist URL it returns. Players never have to construct it themselves — they just follow the URLs the master playlist hands them, which carry the sid into media-playlist + segment requests. Used downstream to correlate a player's playlist + segment fetches for view-count accounting. // start: Start time in milliseconds from the beginning of the video. Defaults to 0. For a place.stream.video record whose source is a place.stream.media.defs#sourceClip, this is in the clip's local timeline (0 == the clip's start). // track: Track ID (stringified u32 matching the MUXL container) for a single-track media playlist. Omit for the master playlist. // uri: AT-URI of the record to play back (e.g. at://did:plc:.../place.stream.video/). -func PlaybackGetVideoPlaylist(ctx context.Context, c lexutil.LexClient, end int64, sid string, start int64, track string, uri string) ([]byte, error) { +func PlaybackGetVideoPlaylist(ctx context.Context, c glexrt.LexClient, end *int64, sid string, start *int64, track string, uri string) ([]byte, error) { buf := new(bytes.Buffer) params := map[string]interface{}{} - if end != 0 { - params["end"] = end + if end != nil { + params["end"] = *end } if sid != "" { params["sid"] = sid } - if start != 0 { - params["start"] = start + if start != nil { + params["start"] = *start } if track != "" { params["track"] = track } params["uri"] = uri - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.playback.getVideoPlaylist", params, nil, buf); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.playback.getVideoPlaylist", params, nil, buf); err != nil { return nil, err } - return buf.Bytes(), nil } diff --git a/pkg/streamplace/playbackwhep.go b/pkg/placestream/playbackwhep.go similarity index 52% rename from pkg/streamplace/playbackwhep.go rename to pkg/placestream/playbackwhep.go index cb12564f..a0d1f265 100644 --- a/pkg/streamplace/playbackwhep.go +++ b/pkg/placestream/playbackwhep.go @@ -1,30 +1,32 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.playback.whep -package streamplace +package placestream import ( "bytes" "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" ) // PlaybackWhep calls the XRPC method "place.stream.playback.whep". // +// Play a stream over WebRTC using WHEP. +// // rendition: The rendition of the stream to play. // streamer: The DID of the streamer to play. -func PlaybackWhep(ctx context.Context, c lexutil.LexClient, rendition string, streamer string, input io.Reader) ([]byte, error) { +func PlaybackWhep(ctx context.Context, c glexrt.LexClient, rendition string, streamer string, input io.Reader) ([]byte, error) { buf := new(bytes.Buffer) params := map[string]interface{}{} params["rendition"] = rendition params["streamer"] = streamer - if err := c.LexDo(ctx, lexutil.Procedure, "*/*", "place.stream.playback.whep", params, input, buf); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "*/*", "place.stream.playback.whep", params, input, buf); err != nil { return nil, err } - return buf.Bytes(), nil } diff --git a/pkg/streamplace/richtextfacet.go b/pkg/placestream/richtextfacet.go similarity index 51% rename from pkg/streamplace/richtextfacet.go rename to pkg/placestream/richtextfacet.go index 2a70c577..ffa12c38 100644 --- a/pkg/streamplace/richtextfacet.go +++ b/pkg/placestream/richtextfacet.go @@ -1,29 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.richtext.facet -package streamplace +package placestream import ( + "bytes" "encoding/json" "fmt" "io" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" ) func init() { - lexutil.RegisterType("place.stream.richtext.facet#main", &RichtextFacet{}) + glexrt.RegisterType("place.stream.richtext.facet#main", &RichtextFacet{}) } // Annotation of a sub-string within rich text in a livestream chat message. type RichtextFacet struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.richtext.facet"` - Features []*RichtextFacet_Features_Elem `json:"features" cborgen:"features"` - Index *appbsky.RichtextFacet_ByteSlice `json:"index" cborgen:"index"` + LexiconTypeID string `json:"$type"` + Features []RichtextFacet_Features_Elem `json:"features"` + Index appbsky.RichtextFacet_ByteSlice `json:"index"` } func (t *RichtextFacet) MarshalCBOR(w io.Writer) error { @@ -32,43 +32,76 @@ func (t *RichtextFacet) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.richtext.facet" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *RichtextFacet) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type RichtextFacet_Features_Elem struct { - RichtextFacet_Mention *appbsky.RichtextFacet_Mention RichtextFacet_Link *appbsky.RichtextFacet_Link + RichtextFacet_Mention *appbsky.RichtextFacet_Mention } func (t *RichtextFacet_Features_Elem) MarshalJSON() ([]byte, error) { - if t.RichtextFacet_Mention != nil { - t.RichtextFacet_Mention.LexiconTypeID = "app.bsky.richtext.facet#mention" - return json.Marshal(t.RichtextFacet_Mention) - } if t.RichtextFacet_Link != nil { t.RichtextFacet_Link.LexiconTypeID = "app.bsky.richtext.facet#link" return json.Marshal(t.RichtextFacet_Link) } + if t.RichtextFacet_Mention != nil { + t.RichtextFacet_Mention.LexiconTypeID = "app.bsky.richtext.facet#mention" + return json.Marshal(t.RichtextFacet_Mention) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *RichtextFacet_Features_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } switch typ { + case "app.bsky.richtext.facet#link": + t.RichtextFacet_Link = new(appbsky.RichtextFacet_Link) + return json.Unmarshal(b, t.RichtextFacet_Link) case "app.bsky.richtext.facet#mention": t.RichtextFacet_Mention = new(appbsky.RichtextFacet_Mention) return json.Unmarshal(b, t.RichtextFacet_Mention) + default: + return nil + } +} + +func (t *RichtextFacet_Features_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.RichtextFacet_Link != nil { + return t.RichtextFacet_Link.MarshalCBOR(w) + } + if t.RichtextFacet_Mention != nil { + return t.RichtextFacet_Mention.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *RichtextFacet_Features_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { case "app.bsky.richtext.facet#link": t.RichtextFacet_Link = new(appbsky.RichtextFacet_Link) - return json.Unmarshal(b, t.RichtextFacet_Link) + return t.RichtextFacet_Link.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.richtext.facet#mention": + t.RichtextFacet_Mention = new(appbsky.RichtextFacet_Mention) + return t.RichtextFacet_Mention.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } diff --git a/pkg/streamplace/richtextvideoFacet.go b/pkg/placestream/richtextvideofacet.go similarity index 52% rename from pkg/streamplace/richtextvideoFacet.go rename to pkg/placestream/richtextvideofacet.go index c3fe5f2c..95b94fb3 100644 --- a/pkg/streamplace/richtextvideoFacet.go +++ b/pkg/placestream/richtextvideofacet.go @@ -1,29 +1,29 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.richtext.videoFacet -package streamplace +package placestream import ( + "bytes" "encoding/json" "fmt" "io" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" ) func init() { - lexutil.RegisterType("place.stream.richtext.videoFacet#main", &RichtextVideoFacet{}) + glexrt.RegisterType("place.stream.richtext.videoFacet#main", &RichtextVideoFacet{}) } // Annotation of a sub-string within rich text in a VOD description or comment. type RichtextVideoFacet struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.richtext.videoFacet"` - Features []*RichtextVideoFacet_Features_Elem `json:"features" cborgen:"features"` - Index *appbsky.RichtextFacet_ByteSlice `json:"index" cborgen:"index"` + LexiconTypeID string `json:"$type"` + Features []RichtextVideoFacet_Features_Elem `json:"features"` + Index appbsky.RichtextFacet_ByteSlice `json:"index"` } func (t *RichtextVideoFacet) MarshalCBOR(w io.Writer) error { @@ -32,43 +32,76 @@ func (t *RichtextVideoFacet) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.richtext.videoFacet" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *RichtextVideoFacet) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type RichtextVideoFacet_Features_Elem struct { - RichtextFacet_Mention *appbsky.RichtextFacet_Mention RichtextFacet_Link *appbsky.RichtextFacet_Link + RichtextFacet_Mention *appbsky.RichtextFacet_Mention } func (t *RichtextVideoFacet_Features_Elem) MarshalJSON() ([]byte, error) { - if t.RichtextFacet_Mention != nil { - t.RichtextFacet_Mention.LexiconTypeID = "app.bsky.richtext.facet#mention" - return json.Marshal(t.RichtextFacet_Mention) - } if t.RichtextFacet_Link != nil { t.RichtextFacet_Link.LexiconTypeID = "app.bsky.richtext.facet#link" return json.Marshal(t.RichtextFacet_Link) } + if t.RichtextFacet_Mention != nil { + t.RichtextFacet_Mention.LexiconTypeID = "app.bsky.richtext.facet#mention" + return json.Marshal(t.RichtextFacet_Mention) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *RichtextVideoFacet_Features_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } switch typ { + case "app.bsky.richtext.facet#link": + t.RichtextFacet_Link = new(appbsky.RichtextFacet_Link) + return json.Unmarshal(b, t.RichtextFacet_Link) case "app.bsky.richtext.facet#mention": t.RichtextFacet_Mention = new(appbsky.RichtextFacet_Mention) return json.Unmarshal(b, t.RichtextFacet_Mention) + default: + return nil + } +} + +func (t *RichtextVideoFacet_Features_Elem) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.RichtextFacet_Link != nil { + return t.RichtextFacet_Link.MarshalCBOR(w) + } + if t.RichtextFacet_Mention != nil { + return t.RichtextFacet_Mention.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *RichtextVideoFacet_Features_Elem) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { case "app.bsky.richtext.facet#link": t.RichtextFacet_Link = new(appbsky.RichtextFacet_Link) - return json.Unmarshal(b, t.RichtextFacet_Link) + return t.RichtextFacet_Link.UnmarshalCBOR(bytes.NewReader(b)) + case "app.bsky.richtext.facet#mention": + t.RichtextFacet_Mention = new(appbsky.RichtextFacet_Mention) + return t.RichtextFacet_Mention.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } diff --git a/pkg/placestream/segment.go b/pkg/placestream/segment.go new file mode 100644 index 00000000..7be3cc27 --- /dev/null +++ b/pkg/placestream/segment.go @@ -0,0 +1,134 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.segment + +package placestream + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + glexrt.RegisterType("place.stream.segment", &Segment{}) +} + +// Media file representing a segment of a livestream +type Segment struct { + LexiconTypeID string `json:"$type"` + Audio []Segment_Audio `json:"audio,omitempty"` + ContentRights *MetadataContentRights `json:"contentRights,omitempty"` + ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` + Creator string `json:"creator"` + DistributionPolicy *MetadataDistributionPolicy `json:"distributionPolicy,omitempty"` + // duration: The duration of the segment in nanoseconds + Duration *int64 `json:"duration,omitempty"` + // id: Unique identifier for the segment + Id string `json:"id"` + // signingKey: The DID of the signing key used for this segment + SigningKey string `json:"signingKey"` + // size: The size of the segment in bytes + Size *int64 `json:"size,omitempty"` + // startTime: When this segment started + StartTime string `json:"startTime"` + Video []Segment_Video `json:"video,omitempty"` +} + +func (t *Segment) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.segment" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Segment) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Segment_Audio is a "audio" in the place.stream.segment schema. +type Segment_Audio struct { + LexiconTypeID string `json:"$type"` + Channels int64 `json:"channels"` + Codec string `json:"codec"` + Rate int64 `json:"rate"` +} + +func (t *Segment_Audio) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.segment" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Segment_Audio) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Segment_Framerate is a "framerate" in the place.stream.segment schema. +type Segment_Framerate struct { + LexiconTypeID string `json:"$type"` + Den int64 `json:"den"` + Num int64 `json:"num"` +} + +func (t *Segment_Framerate) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.segment" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Segment_Framerate) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Segment_SegmentView is a "segmentView" in the place.stream.segment schema. +type Segment_SegmentView struct { + LexiconTypeID string `json:"$type"` + Cid string `json:"cid"` + Record *glexrt.LexiconTypeDecoder `json:"record"` +} + +func (t *Segment_SegmentView) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.segment" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Segment_SegmentView) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// Segment_Video is a "video" in the place.stream.segment schema. +type Segment_Video struct { + LexiconTypeID string `json:"$type"` + Bframes *bool `json:"bframes,omitempty"` + Codec string `json:"codec"` + Framerate *Segment_Framerate `json:"framerate,omitempty"` + Height int64 `json:"height"` + Width int64 `json:"width"` +} + +func (t *Segment_Video) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.segment" + return glexrt.MarshalCBOR(w, t) +} + +func (t *Segment_Video) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/streamplace/servercreateWebhook.go b/pkg/placestream/servercreatewebhook.go similarity index 50% rename from pkg/streamplace/servercreateWebhook.go rename to pkg/placestream/servercreatewebhook.go index d6476541..b0a598ff 100644 --- a/pkg/streamplace/servercreateWebhook.go +++ b/pkg/placestream/servercreatewebhook.go @@ -1,38 +1,37 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.createWebhook -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ServerCreateWebhook_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.createWebhook#main"` + LexiconTypeID string `json:"$type"` // active: Whether this webhook should be active upon creation. - Active *bool `json:"active,omitempty" cborgen:"active,omitempty"` + Active *bool `json:"active,omitempty"` // description: A description of what this webhook is used for. - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Description *string `json:"description,omitempty"` // events: The types of events this webhook should receive. - Events []string `json:"events" cborgen:"events"` + Events []string `json:"events"` // muteWords: Words to filter out from chat messages. Messages containing any of these words will not be forwarded. - MuteWords []string `json:"muteWords,omitempty" cborgen:"muteWords,omitempty"` + MuteWords []string `json:"muteWords,omitempty"` // name: A user-friendly name for this webhook. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` + Name *string `json:"name,omitempty"` // prefix: Text to prepend to webhook messages. - Prefix *string `json:"prefix,omitempty" cborgen:"prefix,omitempty"` + Prefix *string `json:"prefix,omitempty"` // rewrite: Text replacement rules for webhook messages. - Rewrite []*ServerDefs_RewriteRule `json:"rewrite,omitempty" cborgen:"rewrite,omitempty"` + Rewrite []ServerDefs_RewriteRule `json:"rewrite,omitempty"` // suffix: Text to append to webhook messages. - Suffix *string `json:"suffix,omitempty" cborgen:"suffix,omitempty"` + Suffix *string `json:"suffix,omitempty"` // url: The webhook URL where events will be sent. - Url string `json:"url" cborgen:"url"` + Url string `json:"url"` } func (t *ServerCreateWebhook_Input) MarshalCBOR(w io.Writer) error { @@ -41,16 +40,16 @@ func (t *ServerCreateWebhook_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.createWebhook#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerCreateWebhook_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ServerCreateWebhook_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.createWebhook#main"` - Webhook *ServerDefs_Webhook `json:"webhook" cborgen:"webhook"` + LexiconTypeID string `json:"$type"` + Webhook ServerDefs_Webhook `json:"webhook"` } func (t *ServerCreateWebhook_Output) MarshalCBOR(w io.Writer) error { @@ -59,19 +58,21 @@ func (t *ServerCreateWebhook_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.createWebhook#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerCreateWebhook_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerCreateWebhook calls the XRPC method "place.stream.server.createWebhook". -func ServerCreateWebhook(ctx context.Context, c lexutil.LexClient, input *ServerCreateWebhook_Input) (*ServerCreateWebhook_Output, error) { +// +// Create a new webhook for receiving Streamplace events. +func ServerCreateWebhook(ctx context.Context, c glexrt.LexClient, input *ServerCreateWebhook_Input) (*ServerCreateWebhook_Output, error) { var out ServerCreateWebhook_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.server.createWebhook", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.server.createWebhook", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/serverdefs.go b/pkg/placestream/serverdefs.go similarity index 58% rename from pkg/streamplace/serverdefs.go rename to pkg/placestream/serverdefs.go index ad809fda..a3fe9550 100644 --- a/pkg/streamplace/serverdefs.go +++ b/pkg/placestream/serverdefs.go @@ -1,23 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.defs -package streamplace +package placestream import ( "io" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) // ServerDefs_RewriteRule is a "rewriteRule" in the place.stream.server.defs schema. type ServerDefs_RewriteRule struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.defs"` + LexiconTypeID string `json:"$type"` // from: Text to search for and replace. - From string `json:"from" cborgen:"from"` + From string `json:"from"` // to: Text to replace with. - To string `json:"to" cborgen:"to"` + To string `json:"to"` } func (t *ServerDefs_RewriteRule) MarshalCBOR(w io.Writer) error { @@ -26,22 +26,22 @@ func (t *ServerDefs_RewriteRule) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerDefs_RewriteRule) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerDefs_Storage is a "storage" in the place.stream.server.defs schema. // // S3 storage configuration for backups. type ServerDefs_Storage struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.defs"` + LexiconTypeID string `json:"$type"` // isActive: Whether backup storage is currently active. - IsActive bool `json:"isActive" cborgen:"isActive"` + IsActive bool `json:"isActive"` // url: S3 storage URL with masked secret key in format: s3+https://ACCESS_KEY:***@endpoint/bucket - Url string `json:"url" cborgen:"url"` + Url string `json:"url"` } func (t *ServerDefs_Storage) MarshalCBOR(w io.Writer) error { @@ -50,46 +50,46 @@ func (t *ServerDefs_Storage) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerDefs_Storage) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerDefs_Webhook is a "webhook" in the place.stream.server.defs schema. // // A webhook configuration for receiving Streamplace events. type ServerDefs_Webhook struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.defs"` + LexiconTypeID string `json:"$type"` // active: Whether this webhook is currently active. - Active bool `json:"active" cborgen:"active"` + Active bool `json:"active"` // createdAt: When this webhook was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // description: A description of what this webhook is used for. - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Description *string `json:"description,omitempty"` // errorCount: Number of consecutive errors for this webhook. - ErrorCount *int64 `json:"errorCount,omitempty" cborgen:"errorCount,omitempty"` + ErrorCount *int64 `json:"errorCount,omitempty"` // events: The types of events this webhook should receive. - Events []string `json:"events" cborgen:"events"` + Events []string `json:"events"` // id: Unique identifier for this webhook. - Id string `json:"id" cborgen:"id"` + Id string `json:"id"` // lastTriggered: When this webhook was last triggered. - LastTriggered *string `json:"lastTriggered,omitempty" cborgen:"lastTriggered,omitempty"` + LastTriggered *string `json:"lastTriggered,omitempty"` // muteWords: Words to filter out from chat messages. Messages containing any of these words will not be forwarded. - MuteWords []string `json:"muteWords,omitempty" cborgen:"muteWords,omitempty"` + MuteWords []string `json:"muteWords,omitempty"` // name: A user-friendly name for this webhook. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` + Name *string `json:"name,omitempty"` // prefix: Text to prepend to webhook messages. - Prefix *string `json:"prefix,omitempty" cborgen:"prefix,omitempty"` + Prefix *string `json:"prefix,omitempty"` // rewrite: Text replacement rules for webhook messages. - Rewrite []*ServerDefs_RewriteRule `json:"rewrite,omitempty" cborgen:"rewrite,omitempty"` + Rewrite []ServerDefs_RewriteRule `json:"rewrite,omitempty"` // suffix: Text to append to webhook messages. - Suffix *string `json:"suffix,omitempty" cborgen:"suffix,omitempty"` + Suffix *string `json:"suffix,omitempty"` // updatedAt: When this webhook was last updated. - UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` // url: The webhook URL where events will be sent. - Url string `json:"url" cborgen:"url"` + Url string `json:"url"` } func (t *ServerDefs_Webhook) MarshalCBOR(w io.Writer) error { @@ -98,9 +98,9 @@ func (t *ServerDefs_Webhook) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerDefs_Webhook) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/serverdeleteStorage.go b/pkg/placestream/serverdeletestorage.go similarity index 50% rename from pkg/streamplace/serverdeleteStorage.go rename to pkg/placestream/serverdeletestorage.go index 07b241d2..3ee25802 100644 --- a/pkg/streamplace/serverdeleteStorage.go +++ b/pkg/placestream/serverdeletestorage.go @@ -1,21 +1,20 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.deleteStorage -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ServerDeleteStorage_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.deleteStorage#main"` - Success bool `json:"success" cborgen:"success"` + LexiconTypeID string `json:"$type"` + Success bool `json:"success"` } func (t *ServerDeleteStorage_Output) MarshalCBOR(w io.Writer) error { @@ -24,19 +23,21 @@ func (t *ServerDeleteStorage_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.deleteStorage#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerDeleteStorage_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerDeleteStorage calls the XRPC method "place.stream.server.deleteStorage". -func ServerDeleteStorage(ctx context.Context, c lexutil.LexClient) (*ServerDeleteStorage_Output, error) { +// +// Delete S3 storage configuration. +func ServerDeleteStorage(ctx context.Context, c glexrt.LexClient) (*ServerDeleteStorage_Output, error) { var out ServerDeleteStorage_Output - if err := c.LexDo(ctx, lexutil.Procedure, "", "place.stream.server.deleteStorage", nil, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "", "place.stream.server.deleteStorage", nil, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/serverdeleteWebhook.go b/pkg/placestream/serverdeletewebhook.go similarity index 54% rename from pkg/streamplace/serverdeleteWebhook.go rename to pkg/placestream/serverdeletewebhook.go index 65744feb..77446804 100644 --- a/pkg/streamplace/serverdeleteWebhook.go +++ b/pkg/placestream/serverdeletewebhook.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.deleteWebhook -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ServerDeleteWebhook_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.deleteWebhook#main"` + LexiconTypeID string `json:"$type"` // id: The ID of the webhook to delete. - Id string `json:"id" cborgen:"id"` + Id string `json:"id"` } func (t *ServerDeleteWebhook_Input) MarshalCBOR(w io.Writer) error { @@ -25,17 +24,17 @@ func (t *ServerDeleteWebhook_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.deleteWebhook#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerDeleteWebhook_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ServerDeleteWebhook_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.deleteWebhook#main"` + LexiconTypeID string `json:"$type"` // success: Whether the webhook was successfully deleted. - Success bool `json:"success" cborgen:"success"` + Success bool `json:"success"` } func (t *ServerDeleteWebhook_Output) MarshalCBOR(w io.Writer) error { @@ -44,19 +43,21 @@ func (t *ServerDeleteWebhook_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.deleteWebhook#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerDeleteWebhook_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerDeleteWebhook calls the XRPC method "place.stream.server.deleteWebhook". -func ServerDeleteWebhook(ctx context.Context, c lexutil.LexClient, input *ServerDeleteWebhook_Input) (*ServerDeleteWebhook_Output, error) { +// +// Delete an existing webhook. +func ServerDeleteWebhook(ctx context.Context, c glexrt.LexClient, input *ServerDeleteWebhook_Input) (*ServerDeleteWebhook_Output, error) { var out ServerDeleteWebhook_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.server.deleteWebhook", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.server.deleteWebhook", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/servergetServerTime.go b/pkg/placestream/servergetservertime.go similarity index 52% rename from pkg/streamplace/servergetServerTime.go rename to pkg/placestream/servergetservertime.go index 4c1b1faf..ee5c2468 100644 --- a/pkg/streamplace/servergetServerTime.go +++ b/pkg/placestream/servergetservertime.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.getServerTime -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ServerGetServerTime_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.getServerTime#main"` + LexiconTypeID string `json:"$type"` // serverTime: Current server time in RFC3339 format - ServerTime string `json:"serverTime" cborgen:"serverTime"` + ServerTime string `json:"serverTime"` } func (t *ServerGetServerTime_Output) MarshalCBOR(w io.Writer) error { @@ -25,19 +24,21 @@ func (t *ServerGetServerTime_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.getServerTime#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerGetServerTime_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerGetServerTime calls the XRPC method "place.stream.server.getServerTime". -func ServerGetServerTime(ctx context.Context, c lexutil.LexClient) (*ServerGetServerTime_Output, error) { +// +// Get the current server time for client clock synchronization +func ServerGetServerTime(ctx context.Context, c glexrt.LexClient) (*ServerGetServerTime_Output, error) { var out ServerGetServerTime_Output - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.server.getServerTime", nil, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.server.getServerTime", nil, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/placestream/servergetstorage.go b/pkg/placestream/servergetstorage.go new file mode 100644 index 00000000..41be17f6 --- /dev/null +++ b/pkg/placestream/servergetstorage.go @@ -0,0 +1,43 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.server.getStorage + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerGetStorage_Output struct { + LexiconTypeID string `json:"$type"` + Storage *ServerDefs_Storage `json:"storage,omitempty"` +} + +func (t *ServerGetStorage_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.server.getStorage#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerGetStorage_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerGetStorage calls the XRPC method "place.stream.server.getStorage". +// +// Get S3 storage configuration (with masked secret key). +func ServerGetStorage(ctx context.Context, c glexrt.LexClient) (*ServerGetStorage_Output, error) { + var out ServerGetStorage_Output + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.server.getStorage", nil, nil, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/streamplace/servergetWebhook.go b/pkg/placestream/servergetwebhook.go similarity index 52% rename from pkg/streamplace/servergetWebhook.go rename to pkg/placestream/servergetwebhook.go index 0b9fbd84..8681c7e2 100644 --- a/pkg/streamplace/servergetWebhook.go +++ b/pkg/placestream/servergetwebhook.go @@ -1,21 +1,20 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.getWebhook -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ServerGetWebhook_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.getWebhook#main"` - Webhook *ServerDefs_Webhook `json:"webhook" cborgen:"webhook"` + LexiconTypeID string `json:"$type"` + Webhook ServerDefs_Webhook `json:"webhook"` } func (t *ServerGetWebhook_Output) MarshalCBOR(w io.Writer) error { @@ -24,24 +23,26 @@ func (t *ServerGetWebhook_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.getWebhook#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerGetWebhook_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerGetWebhook calls the XRPC method "place.stream.server.getWebhook". // +// Get details for a specific webhook. +// // id: The ID of the webhook to retrieve. -func ServerGetWebhook(ctx context.Context, c lexutil.LexClient, id string) (*ServerGetWebhook_Output, error) { +func ServerGetWebhook(ctx context.Context, c glexrt.LexClient, id string) (*ServerGetWebhook_Output, error) { var out ServerGetWebhook_Output params := map[string]interface{}{} params["id"] = id - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.server.getWebhook", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.server.getWebhook", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/serverlistWebhooks.go b/pkg/placestream/serverlistwebhooks.go similarity index 54% rename from pkg/streamplace/serverlistWebhooks.go rename to pkg/placestream/serverlistwebhooks.go index 23a0cd9e..3ae967b6 100644 --- a/pkg/streamplace/serverlistWebhooks.go +++ b/pkg/placestream/serverlistwebhooks.go @@ -1,23 +1,22 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.listWebhooks -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ServerListWebhooks_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.listWebhooks#main"` + LexiconTypeID string `json:"$type"` // cursor: A cursor for pagination, if there are more results. - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Webhooks []*ServerDefs_Webhook `json:"webhooks" cborgen:"webhooks"` + Cursor *string `json:"cursor,omitempty"` + Webhooks []ServerDefs_Webhook `json:"webhooks"` } func (t *ServerListWebhooks_Output) MarshalCBOR(w io.Writer) error { @@ -26,25 +25,27 @@ func (t *ServerListWebhooks_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.listWebhooks#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerListWebhooks_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerListWebhooks calls the XRPC method "place.stream.server.listWebhooks". // +// List webhooks for the authenticated user. +// // active: Filter webhooks by active status. // cursor: An optional cursor for pagination. // event: Filter webhooks that handle this event type. // limit: The number of webhooks to return. -func ServerListWebhooks(ctx context.Context, c lexutil.LexClient, active bool, cursor string, event string, limit int64) (*ServerListWebhooks_Output, error) { +func ServerListWebhooks(ctx context.Context, c glexrt.LexClient, active *bool, cursor string, event string, limit *int64) (*ServerListWebhooks_Output, error) { var out ServerListWebhooks_Output params := map[string]interface{}{} - if active { - params["active"] = active + if active != nil { + params["active"] = *active } if cursor != "" { params["cursor"] = cursor @@ -52,12 +53,12 @@ func ServerListWebhooks(ctx context.Context, c lexutil.LexClient, active bool, c if event != "" { params["event"] = event } - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.server.listWebhooks", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.server.listWebhooks", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/serversettings.go b/pkg/placestream/serversettings.go similarity index 58% rename from pkg/streamplace/serversettings.go rename to pkg/placestream/serversettings.go index ec63e628..138db26a 100644 --- a/pkg/streamplace/serversettings.go +++ b/pkg/placestream/serversettings.go @@ -1,28 +1,27 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.settings -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.server.settings", &ServerSettings{}) + glexrt.RegisterType("place.stream.server.settings", &ServerSettings{}) } // Record containing user settings for a particular Streamplace node type ServerSettings struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.settings"` + LexiconTypeID string `json:"$type"` // debugRecording: Whether this node may archive your livestream for improving the service - DebugRecording *bool `json:"debugRecording,omitempty" cborgen:"debugRecording,omitempty"` + DebugRecording *bool `json:"debugRecording,omitempty"` // livestreamRecording: Whether this node should record your livestreams into VODs that you can publish - LivestreamRecording *bool `json:"livestreamRecording,omitempty" cborgen:"livestreamRecording,omitempty"` + LivestreamRecording *bool `json:"livestreamRecording,omitempty"` } func (t *ServerSettings) MarshalCBOR(w io.Writer) error { @@ -31,9 +30,9 @@ func (t *ServerSettings) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.settings" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerSettings) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/placestream/serverupdatewebhook.go b/pkg/placestream/serverupdatewebhook.go new file mode 100644 index 00000000..127e1b28 --- /dev/null +++ b/pkg/placestream/serverupdatewebhook.go @@ -0,0 +1,80 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.server.updateWebhook + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type ServerUpdateWebhook_Input struct { + LexiconTypeID string `json:"$type"` + // active: Whether this webhook should be active. + Active *bool `json:"active,omitempty"` + // description: A description of what this webhook is used for. + Description *string `json:"description,omitempty"` + // events: The types of events this webhook should receive. + Events []string `json:"events,omitempty"` + // id: The ID of the webhook to update. + Id string `json:"id"` + // muteWords: Words to filter out from chat messages. Messages containing any of these words will not be forwarded. + MuteWords []string `json:"muteWords,omitempty"` + // name: A user-friendly name for this webhook. + Name *string `json:"name,omitempty"` + // prefix: Text to prepend to webhook messages. + Prefix *string `json:"prefix,omitempty"` + // rewrite: Text replacement rules for webhook messages. + Rewrite []ServerDefs_RewriteRule `json:"rewrite,omitempty"` + // suffix: Text to append to webhook messages. + Suffix *string `json:"suffix,omitempty"` + // url: The webhook URL where events will be sent. + Url *string `json:"url,omitempty"` +} + +func (t *ServerUpdateWebhook_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.server.updateWebhook#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerUpdateWebhook_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type ServerUpdateWebhook_Output struct { + LexiconTypeID string `json:"$type"` + Webhook ServerDefs_Webhook `json:"webhook"` +} + +func (t *ServerUpdateWebhook_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.server.updateWebhook#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *ServerUpdateWebhook_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// ServerUpdateWebhook calls the XRPC method "place.stream.server.updateWebhook". +// +// Update an existing webhook configuration. +func ServerUpdateWebhook(ctx context.Context, c glexrt.LexClient, input *ServerUpdateWebhook_Input) (*ServerUpdateWebhook_Output, error) { + var out ServerUpdateWebhook_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.server.updateWebhook", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/streamplace/serverupsertStorage.go b/pkg/placestream/serverupsertstorage.go similarity index 52% rename from pkg/streamplace/serverupsertStorage.go rename to pkg/placestream/serverupsertstorage.go index a206a22f..f559fd55 100644 --- a/pkg/streamplace/serverupsertStorage.go +++ b/pkg/placestream/serverupsertstorage.go @@ -1,24 +1,23 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.server.upsertStorage -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type ServerUpsertStorage_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.upsertStorage#main"` + LexiconTypeID string `json:"$type"` // isActive: Whether backup storage is currently active. - IsActive *bool `json:"isActive,omitempty" cborgen:"isActive,omitempty"` + IsActive *bool `json:"isActive,omitempty"` // url: S3 storage URL in format: s3+https://ACCESS_KEY:SECRET_KEY@endpoint/bucket - Url *string `json:"url,omitempty" cborgen:"url,omitempty"` + Url *string `json:"url,omitempty"` } func (t *ServerUpsertStorage_Input) MarshalCBOR(w io.Writer) error { @@ -27,16 +26,16 @@ func (t *ServerUpsertStorage_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.upsertStorage#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerUpsertStorage_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type ServerUpsertStorage_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.upsertStorage#main"` - Storage *ServerDefs_Storage `json:"storage" cborgen:"storage"` + LexiconTypeID string `json:"$type"` + Storage ServerDefs_Storage `json:"storage"` } func (t *ServerUpsertStorage_Output) MarshalCBOR(w io.Writer) error { @@ -45,19 +44,21 @@ func (t *ServerUpsertStorage_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.server.upsertStorage#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *ServerUpsertStorage_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // ServerUpsertStorage calls the XRPC method "place.stream.server.upsertStorage". -func ServerUpsertStorage(ctx context.Context, c lexutil.LexClient, input *ServerUpsertStorage_Input) (*ServerUpsertStorage_Output, error) { +// +// Create or update S3 storage configuration for backups. +func ServerUpsertStorage(ctx context.Context, c glexrt.LexClient, input *ServerUpsertStorage_Input) (*ServerUpsertStorage_Output, error) { var out ServerUpsertStorage_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.server.upsertStorage", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.server.upsertStorage", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/video.go b/pkg/placestream/video.go similarity index 79% rename from pkg/streamplace/video.go rename to pkg/placestream/video.go index cb625c5a..0bb70552 100644 --- a/pkg/streamplace/video.go +++ b/pkg/placestream/video.go @@ -1,8 +1,8 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.video -package streamplace +package placestream import ( "bytes" @@ -10,43 +10,42 @@ import ( "fmt" "io" - comatproto "github.com/bluesky-social/indigo/api/atproto" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + comatproto "stream.place/streamplace/pkg/comatproto" ) func init() { - lexutil.RegisterType("place.stream.video", &Video{}) + glexrt.RegisterType("place.stream.video", &Video{}) } // Some audiovisual content. type Video struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.video"` + LexiconTypeID string `json:"$type"` // activity: The game or activity in the video. - Activity *Video_Activity `json:"activity,omitempty" cborgen:"activity,omitempty"` + Activity *Video_Activity `json:"activity,omitempty"` // connections: Free-form list of atproto records related in some way to this video - Connections []*Video_Connections_Elem `json:"connections,omitempty" cborgen:"connections,omitempty"` + Connections []Video_Connections_Elem `json:"connections,omitempty"` // contentRights: copyright and licensing information for this VOD - ContentRights *MetadataContentRights `json:"contentRights,omitempty" cborgen:"contentRights,omitempty"` + ContentRights *MetadataContentRights `json:"contentRights,omitempty"` // contentWarnings: content warning data for this VOD - ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty" cborgen:"contentWarnings,omitempty"` + ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` // createdAt: Timestamp when this video record was created. Populated server-side at publication time by place.stream.media.publishVideo. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedAt string `json:"createdAt"` // description: Description of this video - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Description *string `json:"description,omitempty"` // descriptionFacets: Annotations of text (mentions, URLs, etc) - DescriptionFacets []*RichtextVideoFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"` + DescriptionFacets []RichtextVideoFacet `json:"descriptionFacets,omitempty"` // durationMs: Duration of the video in milliseconds - DurationMs int64 `json:"durationMs" cborgen:"durationMs"` + DurationMs int64 `json:"durationMs"` // source: What is the source of this video? - Source *Video_Source `json:"source" cborgen:"source"` + Source Video_Source `json:"source"` // tags: Freeform tags for this stream. Each tag must be alphanumeric (a-z, A-Z, 0-9) plus colon. Tags with colons indicate a specific tag group (e.g. 'lang:en' indicates the stream's primary language). - Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` + Tags []string `json:"tags,omitempty"` // thumb: Thumbnail image for the video. - Thumb *lex.Blob `json:"thumb,omitempty" cborgen:"thumb,omitempty"` + Thumb *glexrt.Blob `json:"thumb,omitempty"` // title: Title of the video referenced by this record - Title string `json:"title" cborgen:"title"` + Title string `json:"title"` } func (t *Video) MarshalCBOR(w io.Writer) error { @@ -55,11 +54,11 @@ func (t *Video) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.video" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Video) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // The game or activity in the video. @@ -81,7 +80,7 @@ func (t *Video_Activity) MarshalJSON() ([]byte, error) { } func (t *Video_Activity) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -114,7 +113,7 @@ func (t *Video_Activity) MarshalCBOR(w io.Writer) error { } func (t *Video_Activity) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } @@ -144,7 +143,7 @@ func (t *Video_Connections_Elem) MarshalJSON() ([]byte, error) { } func (t *Video_Connections_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -171,7 +170,7 @@ func (t *Video_Connections_Elem) MarshalCBOR(w io.Writer) error { } func (t *Video_Connections_Elem) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } @@ -187,35 +186,35 @@ func (t *Video_Connections_Elem) UnmarshalCBOR(r io.Reader) error { // What is the source of this video? type Video_Source struct { - MediaDefs_SourceTracks *MediaDefs_SourceTracks MediaDefs_SourceClip *MediaDefs_SourceClip + MediaDefs_SourceTracks *MediaDefs_SourceTracks } func (t *Video_Source) MarshalJSON() ([]byte, error) { - if t.MediaDefs_SourceTracks != nil { - t.MediaDefs_SourceTracks.LexiconTypeID = "place.stream.media.defs#sourceTracks" - return json.Marshal(t.MediaDefs_SourceTracks) - } if t.MediaDefs_SourceClip != nil { t.MediaDefs_SourceClip.LexiconTypeID = "place.stream.media.defs#sourceClip" return json.Marshal(t.MediaDefs_SourceClip) } + if t.MediaDefs_SourceTracks != nil { + t.MediaDefs_SourceTracks.LexiconTypeID = "place.stream.media.defs#sourceTracks" + return json.Marshal(t.MediaDefs_SourceTracks) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *Video_Source) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } switch typ { - case "place.stream.media.defs#sourceTracks": - t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) - return json.Unmarshal(b, t.MediaDefs_SourceTracks) case "place.stream.media.defs#sourceClip": t.MediaDefs_SourceClip = new(MediaDefs_SourceClip) return json.Unmarshal(b, t.MediaDefs_SourceClip) + case "place.stream.media.defs#sourceTracks": + t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) + return json.Unmarshal(b, t.MediaDefs_SourceTracks) default: return nil } @@ -227,28 +226,28 @@ func (t *Video_Source) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if t.MediaDefs_SourceTracks != nil { - return t.MediaDefs_SourceTracks.MarshalCBOR(w) - } if t.MediaDefs_SourceClip != nil { return t.MediaDefs_SourceClip.MarshalCBOR(w) } + if t.MediaDefs_SourceTracks != nil { + return t.MediaDefs_SourceTracks.MarshalCBOR(w) + } return fmt.Errorf("can not marshal empty union as CBOR") } func (t *Video_Source) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } switch typ { - case "place.stream.media.defs#sourceTracks": - t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) - return t.MediaDefs_SourceTracks.UnmarshalCBOR(bytes.NewReader(b)) case "place.stream.media.defs#sourceClip": t.MediaDefs_SourceClip = new(MediaDefs_SourceClip) return t.MediaDefs_SourceClip.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.media.defs#sourceTracks": + t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) + return t.MediaDefs_SourceTracks.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } @@ -256,8 +255,8 @@ func (t *Video_Source) UnmarshalCBOR(r io.Reader) error { // Video_Connection is a "connection" in the place.stream.video schema. type Video_Connection struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.video"` - Ref *comatproto.RepoStrongRef `json:"ref,omitempty" cborgen:"ref,omitempty"` + LexiconTypeID string `json:"$type"` + Ref *comatproto.RepoStrongRef `json:"ref,omitempty"` } func (t *Video_Connection) MarshalCBOR(w io.Writer) error { @@ -266,9 +265,9 @@ func (t *Video_Connection) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.video" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *Video_Connection) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/placestream/vodcomment.go b/pkg/placestream/vodcomment.go new file mode 100644 index 00000000..f6f4ae20 --- /dev/null +++ b/pkg/placestream/vodcomment.go @@ -0,0 +1,64 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.vod.comment + +package placestream + +import ( + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" + comatproto "stream.place/streamplace/pkg/comatproto" +) + +func init() { + glexrt.RegisterType("place.stream.vod.comment", &VodComment{}) +} + +// Record containing a comment on a VOD. +type VodComment struct { + LexiconTypeID string `json:"$type"` + // createdAt: Client-declared timestamp when this comment was created. + CreatedAt string `json:"createdAt"` + // facets: Annotations of text (mentions, URLs, etc) + Facets []RichtextFacet `json:"facets,omitempty"` + Reply *VodComment_ReplyRef `json:"reply,omitempty"` + // text: The comment text content. + Text string `json:"text"` + // video: AT-URI of the place.stream.video record this comment belongs to. + Video string `json:"video"` +} + +func (t *VodComment) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.vod.comment" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VodComment) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// VodComment_ReplyRef is a "replyRef" in the place.stream.vod.comment schema. +type VodComment_ReplyRef struct { + LexiconTypeID string `json:"$type"` + Parent comatproto.RepoStrongRef `json:"parent"` + Root comatproto.RepoStrongRef `json:"root"` +} + +func (t *VodComment_ReplyRef) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.vod.comment" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VodComment_ReplyRef) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} diff --git a/pkg/placestream/vodcreatedraft.go b/pkg/placestream/vodcreatedraft.go new file mode 100644 index 00000000..30e57cdd --- /dev/null +++ b/pkg/placestream/vodcreatedraft.go @@ -0,0 +1,61 @@ +// Code generated by glex; DO NOT EDIT. + +// Lexicon schema: place.stream.vod.createDraft + +package placestream + +import ( + "context" + "io" + + glexrt "github.com/streamplace/glex/runtime" + cbg "github.com/whyrusleeping/cbor-gen" +) + +type VodCreateDraft_Input struct { + LexiconTypeID string `json:"$type"` +} + +func (t *VodCreateDraft_Input) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.vod.createDraft#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VodCreateDraft_Input) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +type VodCreateDraft_Output struct { + LexiconTypeID string `json:"$type"` + // uri: The ats:// URI of the newly created draft record. + Uri string `json:"uri"` +} + +func (t *VodCreateDraft_Output) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + t.LexiconTypeID = "place.stream.vod.createDraft#main" + return glexrt.MarshalCBOR(w, t) +} + +func (t *VodCreateDraft_Output) UnmarshalCBOR(r io.Reader) error { + return glexrt.UnmarshalCBOR(r, t) +} + +// VodCreateDraft calls the XRPC method "place.stream.vod.createDraft". +// +// Create an empty draft VOD in the 'processing' state. The draft is the durable anchor for an upload: the client creates it first, then passes its URI to place.stream.media.createUpload so the upload's processing fills this draft. Lets the user start editing metadata while the upload runs, and supports re-upload (a failed upload leaves the draft intact; a new createUpload with the same draftUri re-points it). +func VodCreateDraft(ctx context.Context, c glexrt.LexClient, input *VodCreateDraft_Input) (*VodCreateDraft_Output, error) { + var out VodCreateDraft_Output + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.vod.createDraft", nil, input, &out); err != nil { + return nil, err + } + return &out, nil +} diff --git a/pkg/streamplace/voddefs.go b/pkg/placestream/voddefs.go similarity index 53% rename from pkg/streamplace/voddefs.go rename to pkg/placestream/voddefs.go index dcbb4b9f..7b770e74 100644 --- a/pkg/streamplace/voddefs.go +++ b/pkg/placestream/voddefs.go @@ -1,32 +1,32 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.defs -package streamplace +package placestream import ( + "bytes" "encoding/json" "fmt" "io" - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" + appbsky "stream.place/streamplace/pkg/appbsky" ) // VodDefs_CommentView is a "commentView" in the place.stream.vod.defs schema. type VodDefs_CommentView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.defs"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` + IndexedAt string `json:"indexedAt"` // likeCount: Number of likes on this comment. - LikeCount int64 `json:"likeCount" cborgen:"likeCount"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` + LikeCount int64 `json:"likeCount"` + Record *glexrt.LexiconTypeDecoder `json:"record"` // replyTo: The parent comment this one replies to, if any. A non-recursive view (it carries no replyTo of its own), so the thread is flattened to a single hop; walk `record.reply` to follow the chain further. - ReplyTo *VodDefs_CommentView_ReplyTo `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"` - Uri string `json:"uri" cborgen:"uri"` + ReplyTo *VodDefs_CommentView_ReplyTo `json:"replyTo,omitempty"` + Uri string `json:"uri"` } func (t *VodDefs_CommentView) MarshalCBOR(w io.Writer) error { @@ -35,11 +35,11 @@ func (t *VodDefs_CommentView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodDefs_CommentView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // The parent comment this one replies to, if any. A non-recursive view (it carries no replyTo of its own), so the thread is flattened to a single hop; walk `record.reply` to follow the chain further. @@ -56,7 +56,7 @@ func (t *VodDefs_CommentView_ReplyTo) MarshalJSON() ([]byte, error) { } func (t *VodDefs_CommentView_ReplyTo) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -70,18 +70,45 @@ func (t *VodDefs_CommentView_ReplyTo) UnmarshalJSON(b []byte) error { } } +func (t *VodDefs_CommentView_ReplyTo) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.VodDefs_CommentViewBasic != nil { + return t.VodDefs_CommentViewBasic.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *VodDefs_CommentView_ReplyTo) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "place.stream.vod.defs#commentViewBasic": + t.VodDefs_CommentViewBasic = new(VodDefs_CommentViewBasic) + return t.VodDefs_CommentViewBasic.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + // VodDefs_CommentViewBasic is a "commentViewBasic" in the place.stream.vod.defs schema. // // A comment view without its own `replyTo`, used to represent the parent of a reply without recursively nesting the whole thread. type VodDefs_CommentViewBasic struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.defs"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + LexiconTypeID string `json:"$type"` + Author appbsky.ActorDefs_ProfileViewBasic `json:"author"` + Cid string `json:"cid"` + IndexedAt string `json:"indexedAt"` // likeCount: Number of likes on this comment. - LikeCount int64 `json:"likeCount" cborgen:"likeCount"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` + LikeCount int64 `json:"likeCount"` + Record *glexrt.LexiconTypeDecoder `json:"record"` + Uri string `json:"uri"` } func (t *VodDefs_CommentViewBasic) MarshalCBOR(w io.Writer) error { @@ -90,9 +117,9 @@ func (t *VodDefs_CommentViewBasic) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.defs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodDefs_CommentViewBasic) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/voddeleteDraft.go b/pkg/placestream/voddeletedraft.go similarity index 54% rename from pkg/streamplace/voddeleteDraft.go rename to pkg/placestream/voddeletedraft.go index 3b6b8831..f7891218 100644 --- a/pkg/streamplace/voddeleteDraft.go +++ b/pkg/placestream/voddeletedraft.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.deleteDraft -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type VodDeleteDraft_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.deleteDraft#main"` + LexiconTypeID string `json:"$type"` // uri: The ats:// URI of the draft to discard. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *VodDeleteDraft_Input) MarshalCBOR(w io.Writer) error { @@ -25,15 +24,15 @@ func (t *VodDeleteDraft_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.deleteDraft#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodDeleteDraft_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type VodDeleteDraft_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.deleteDraft#main"` + LexiconTypeID string `json:"$type"` } func (t *VodDeleteDraft_Output) MarshalCBOR(w io.Writer) error { @@ -42,19 +41,21 @@ func (t *VodDeleteDraft_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.deleteDraft#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodDeleteDraft_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // VodDeleteDraft calls the XRPC method "place.stream.vod.deleteDraft". -func VodDeleteDraft(ctx context.Context, c lexutil.LexClient, input *VodDeleteDraft_Input) (*VodDeleteDraft_Output, error) { +// +// Discard a draft VOD. The processed content blob is not deleted (it may be referenced elsewhere). Only the draft record is removed. +func VodDeleteDraft(ctx context.Context, c glexrt.LexClient, input *VodDeleteDraft_Input) (*VodDeleteDraft_Output, error) { var out VodDeleteDraft_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.vod.deleteDraft", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.vod.deleteDraft", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/voddraftDefs.go b/pkg/placestream/voddraftdefs.go similarity index 65% rename from pkg/streamplace/voddraftDefs.go rename to pkg/placestream/voddraftdefs.go index fee26769..a4de264b 100644 --- a/pkg/streamplace/voddraftDefs.go +++ b/pkg/placestream/voddraftdefs.go @@ -1,28 +1,27 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.draftDefs -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) // VodDraftDefs_DraftView is a "draftView" in the place.stream.vod.draftDefs schema. // // A draft VOD with its ats:// URI and CID, for list/get responses. type VodDraftDefs_DraftView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.draftDefs"` + LexiconTypeID string `json:"$type"` // cid: CID (sha256 of CBOR record bytes, base32) of the draft record. - Cid string `json:"cid" cborgen:"cid"` + Cid string `json:"cid"` // record: The place.stream.vod.draftVideo record body. Typed as unknown (matching commentView/livestreamView/videoView) because the @atproto/api client validator cannot validate a ref to a record-type lexicon. - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` + Record *glexrt.LexiconTypeDecoder `json:"record"` // uri: The ats:// URI of the draft record. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *VodDraftDefs_DraftView) MarshalCBOR(w io.Writer) error { @@ -31,9 +30,9 @@ func (t *VodDraftDefs_DraftView) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.draftDefs" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodDraftDefs_DraftView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/voddraftVideo.go b/pkg/placestream/voddraftvideo.go similarity index 78% rename from pkg/streamplace/voddraftVideo.go rename to pkg/placestream/voddraftvideo.go index 18f64a6c..e6b6f85b 100644 --- a/pkg/streamplace/voddraftVideo.go +++ b/pkg/placestream/voddraftvideo.go @@ -1,8 +1,8 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.draftVideo -package streamplace +package placestream import ( "bytes" @@ -10,43 +10,42 @@ import ( "fmt" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.vod.draftVideo", &VodDraftVideo{}) + glexrt.RegisterType("place.stream.vod.draftVideo", &VodDraftVideo{}) } // A draft VOD: pre-publication video metadata and processing state. Modeled as a permissioned-data-style record (CBOR-serialized, addressed by an ats:// URI) stored in statedb until the permissioned-data spec ships (bluesky-social/proposals PR #94, the 0016-permissioned-data proposal). Publishing promotes it to a public place.stream.video record. type VodDraftVideo struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.draftVideo"` + LexiconTypeID string `json:"$type"` // activity: The game or activity in the video. - Activity *VodDraftVideo_Activity `json:"activity,omitempty" cborgen:"activity,omitempty"` + Activity *VodDraftVideo_Activity `json:"activity,omitempty"` // connections: Related records (e.g. the source livestream for a finalized VOD). - Connections []*VodDraftVideo_Connections_Elem `json:"connections,omitempty" cborgen:"connections,omitempty"` - ContentRights *MetadataContentRights `json:"contentRights,omitempty" cborgen:"contentRights,omitempty"` - ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty" cborgen:"contentWarnings,omitempty"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Connections []VodDraftVideo_Connections_Elem `json:"connections,omitempty"` + ContentRights *MetadataContentRights `json:"contentRights,omitempty"` + ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` + CreatedAt string `json:"createdAt"` // description: Description of the video. - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Description *string `json:"description,omitempty"` // descriptionFacets: Annotations of text (mentions, URLs, etc). - DescriptionFacets []*RichtextVideoFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"` + DescriptionFacets []RichtextVideoFacet `json:"descriptionFacets,omitempty"` // durationMs: Duration in milliseconds. Filled when status is 'ready'. - DurationMs *int64 `json:"durationMs,omitempty" cborgen:"durationMs,omitempty"` + DurationMs *int64 `json:"durationMs,omitempty"` // error: Error message when status is 'error'. - Error *string `json:"error,omitempty" cborgen:"error,omitempty"` + Error *string `json:"error,omitempty"` // source: Source tracks. Filled by the server when processing completes (status 'ready'). - Source *VodDraftVideo_Source `json:"source,omitempty" cborgen:"source,omitempty"` + Source *VodDraftVideo_Source `json:"source,omitempty"` // status: Processing state: 'processing' while the job runs, 'ready' when publishable, 'error' if processing failed. - Status string `json:"status" cborgen:"status"` + Status string `json:"status"` // tags: Freeform tags (same rules as place.stream.video). - Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` + Tags []string `json:"tags,omitempty"` // thumb: Thumbnail image. Generated by the server at publish time if absent. - Thumb *lex.Blob `json:"thumb,omitempty" cborgen:"thumb,omitempty"` + Thumb *glexrt.Blob `json:"thumb,omitempty"` // title: Title of the video. May be a placeholder while processing; the user edits before publishing. - Title string `json:"title" cborgen:"title"` + Title string `json:"title"` } func (t *VodDraftVideo) MarshalCBOR(w io.Writer) error { @@ -55,11 +54,11 @@ func (t *VodDraftVideo) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.draftVideo" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodDraftVideo) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // The game or activity in the video. @@ -81,7 +80,7 @@ func (t *VodDraftVideo_Activity) MarshalJSON() ([]byte, error) { } func (t *VodDraftVideo_Activity) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -114,7 +113,7 @@ func (t *VodDraftVideo_Activity) MarshalCBOR(w io.Writer) error { } func (t *VodDraftVideo_Activity) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } @@ -144,7 +143,7 @@ func (t *VodDraftVideo_Connections_Elem) MarshalJSON() ([]byte, error) { } func (t *VodDraftVideo_Connections_Elem) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -171,7 +170,7 @@ func (t *VodDraftVideo_Connections_Elem) MarshalCBOR(w io.Writer) error { } func (t *VodDraftVideo_Connections_Elem) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } @@ -187,35 +186,35 @@ func (t *VodDraftVideo_Connections_Elem) UnmarshalCBOR(r io.Reader) error { // Source tracks. Filled by the server when processing completes (status 'ready'). type VodDraftVideo_Source struct { - MediaDefs_SourceTracks *MediaDefs_SourceTracks MediaDefs_SourceClip *MediaDefs_SourceClip + MediaDefs_SourceTracks *MediaDefs_SourceTracks } func (t *VodDraftVideo_Source) MarshalJSON() ([]byte, error) { - if t.MediaDefs_SourceTracks != nil { - t.MediaDefs_SourceTracks.LexiconTypeID = "place.stream.media.defs#sourceTracks" - return json.Marshal(t.MediaDefs_SourceTracks) - } if t.MediaDefs_SourceClip != nil { t.MediaDefs_SourceClip.LexiconTypeID = "place.stream.media.defs#sourceClip" return json.Marshal(t.MediaDefs_SourceClip) } + if t.MediaDefs_SourceTracks != nil { + t.MediaDefs_SourceTracks.LexiconTypeID = "place.stream.media.defs#sourceTracks" + return json.Marshal(t.MediaDefs_SourceTracks) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } func (t *VodDraftVideo_Source) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } switch typ { - case "place.stream.media.defs#sourceTracks": - t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) - return json.Unmarshal(b, t.MediaDefs_SourceTracks) case "place.stream.media.defs#sourceClip": t.MediaDefs_SourceClip = new(MediaDefs_SourceClip) return json.Unmarshal(b, t.MediaDefs_SourceClip) + case "place.stream.media.defs#sourceTracks": + t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) + return json.Unmarshal(b, t.MediaDefs_SourceTracks) default: return nil } @@ -227,28 +226,28 @@ func (t *VodDraftVideo_Source) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if t.MediaDefs_SourceTracks != nil { - return t.MediaDefs_SourceTracks.MarshalCBOR(w) - } if t.MediaDefs_SourceClip != nil { return t.MediaDefs_SourceClip.MarshalCBOR(w) } + if t.MediaDefs_SourceTracks != nil { + return t.MediaDefs_SourceTracks.MarshalCBOR(w) + } return fmt.Errorf("can not marshal empty union as CBOR") } func (t *VodDraftVideo_Source) UnmarshalCBOR(r io.Reader) error { - typ, b, err := lexutil.CborTypeExtractReader(r) + typ, b, err := glexrt.CborTypeExtractReader(r) if err != nil { return err } switch typ { - case "place.stream.media.defs#sourceTracks": - t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) - return t.MediaDefs_SourceTracks.UnmarshalCBOR(bytes.NewReader(b)) case "place.stream.media.defs#sourceClip": t.MediaDefs_SourceClip = new(MediaDefs_SourceClip) return t.MediaDefs_SourceClip.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.media.defs#sourceTracks": + t.MediaDefs_SourceTracks = new(MediaDefs_SourceTracks) + return t.MediaDefs_SourceTracks.UnmarshalCBOR(bytes.NewReader(b)) default: return nil } diff --git a/pkg/streamplace/vodgate.go b/pkg/placestream/vodgate.go similarity index 51% rename from pkg/streamplace/vodgate.go rename to pkg/placestream/vodgate.go index f39d416c..9ec475e4 100644 --- a/pkg/streamplace/vodgate.go +++ b/pkg/placestream/vodgate.go @@ -1,26 +1,25 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.gate -package streamplace +package placestream import ( "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) func init() { - lexutil.RegisterType("place.stream.vod.gate", &VodGate{}) + glexrt.RegisterType("place.stream.vod.gate", &VodGate{}) } // Record defining a single gated VOD comment. type VodGate struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.gate"` + LexiconTypeID string `json:"$type"` // hiddenComment: URI of the hidden VOD comment. - HiddenComment string `json:"hiddenComment" cborgen:"hiddenComment"` + HiddenComment string `json:"hiddenComment"` } func (t *VodGate) MarshalCBOR(w io.Writer) error { @@ -29,9 +28,9 @@ func (t *VodGate) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.gate" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodGate) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } diff --git a/pkg/streamplace/vodgetComments.go b/pkg/placestream/vodgetcomments.go similarity index 51% rename from pkg/streamplace/vodgetComments.go rename to pkg/placestream/vodgetcomments.go index 3dbd877c..c21c5e58 100644 --- a/pkg/streamplace/vodgetComments.go +++ b/pkg/placestream/vodgetcomments.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.getComments -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type VodGetComments_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.getComments#main"` - Comments []*VodDefs_CommentView `json:"comments" cborgen:"comments"` - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + LexiconTypeID string `json:"$type"` + Comments []VodDefs_CommentView `json:"comments"` + Cursor *string `json:"cursor,omitempty"` } func (t *VodGetComments_Output) MarshalCBOR(w io.Writer) error { @@ -25,32 +24,34 @@ func (t *VodGetComments_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.getComments#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodGetComments_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // VodGetComments calls the XRPC method "place.stream.vod.getComments". // +// Get comments for a place.stream.video record. +// // cursor: Optional pagination cursor. // limit: Maximum number of comments to return. // video: AT-URI of the place.stream.video record. -func VodGetComments(ctx context.Context, c lexutil.LexClient, cursor string, limit int64, video string) (*VodGetComments_Output, error) { +func VodGetComments(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64, video string) (*VodGetComments_Output, error) { var out VodGetComments_Output params := map[string]interface{}{} if cursor != "" { params["cursor"] = cursor } - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } params["video"] = video - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.vod.getComments", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.vod.getComments", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/vodgetDraft.go b/pkg/placestream/vodgetdraft.go similarity index 51% rename from pkg/streamplace/vodgetDraft.go rename to pkg/placestream/vodgetdraft.go index 2627aaa7..d3243404 100644 --- a/pkg/streamplace/vodgetDraft.go +++ b/pkg/placestream/vodgetdraft.go @@ -1,21 +1,20 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.getDraft -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type VodGetDraft_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.getDraft#main"` - Draft *VodDraftDefs_DraftView `json:"draft" cborgen:"draft"` + LexiconTypeID string `json:"$type"` + Draft VodDraftDefs_DraftView `json:"draft"` } func (t *VodGetDraft_Output) MarshalCBOR(w io.Writer) error { @@ -24,24 +23,26 @@ func (t *VodGetDraft_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.getDraft#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodGetDraft_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // VodGetDraft calls the XRPC method "place.stream.vod.getDraft". // +// Get a single draft VOD by its ats:// URI. Only accessible by the draft's author. +// // uri: The ats:// URI of the draft record. -func VodGetDraft(ctx context.Context, c lexutil.LexClient, uri string) (*VodGetDraft_Output, error) { +func VodGetDraft(ctx context.Context, c glexrt.LexClient, uri string) (*VodGetDraft_Output, error) { var out VodGetDraft_Output params := map[string]interface{}{} params["uri"] = uri - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.vod.getDraft", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.vod.getDraft", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/vodlistDrafts.go b/pkg/placestream/vodlistdrafts.go similarity index 52% rename from pkg/streamplace/vodlistDrafts.go rename to pkg/placestream/vodlistdrafts.go index 2046b5fd..c0fff19f 100644 --- a/pkg/streamplace/vodlistDrafts.go +++ b/pkg/placestream/vodlistdrafts.go @@ -1,23 +1,22 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.listDrafts -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type VodListDrafts_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.listDrafts#main"` + LexiconTypeID string `json:"$type"` // cursor: Pagination cursor for the next page, if more results exist. - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Drafts []*VodDraftDefs_DraftView `json:"drafts" cborgen:"drafts"` + Cursor *string `json:"cursor,omitempty"` + Drafts []VodDraftDefs_DraftView `json:"drafts"` } func (t *VodListDrafts_Output) MarshalCBOR(w io.Writer) error { @@ -26,30 +25,32 @@ func (t *VodListDrafts_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.listDrafts#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodListDrafts_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // VodListDrafts calls the XRPC method "place.stream.vod.listDrafts". // +// List the authenticated user's draft VODs, newest first. +// // cursor: Pagination cursor from a previous response. // limit: Number of drafts to return. -func VodListDrafts(ctx context.Context, c lexutil.LexClient, cursor string, limit int64) (*VodListDrafts_Output, error) { +func VodListDrafts(ctx context.Context, c glexrt.LexClient, cursor string, limit *int64) (*VodListDrafts_Output, error) { var out VodListDrafts_Output params := map[string]interface{}{} if cursor != "" { params["cursor"] = cursor } - if limit != 0 { - params["limit"] = limit + if limit != nil { + params["limit"] = *limit } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.vod.listDrafts", params, nil, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Query, "", "place.stream.vod.listDrafts", params, nil, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/vodpublishDraft.go b/pkg/placestream/vodpublishdraft.go similarity index 53% rename from pkg/streamplace/vodpublishDraft.go rename to pkg/placestream/vodpublishdraft.go index 5b25a7d8..5107b00b 100644 --- a/pkg/streamplace/vodpublishDraft.go +++ b/pkg/placestream/vodpublishdraft.go @@ -1,22 +1,21 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.publishDraft -package streamplace +package placestream import ( "context" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type VodPublishDraft_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.publishDraft#main"` + LexiconTypeID string `json:"$type"` // uri: The ats:// URI of the draft to publish. Must have status 'ready'. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *VodPublishDraft_Input) MarshalCBOR(w io.Writer) error { @@ -25,19 +24,19 @@ func (t *VodPublishDraft_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.publishDraft#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodPublishDraft_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type VodPublishDraft_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.publishDraft#main"` + LexiconTypeID string `json:"$type"` // videoCid: CID of the created place.stream.video record. - VideoCid string `json:"videoCid" cborgen:"videoCid"` + VideoCid string `json:"videoCid"` // videoUri: AT-URI of the created place.stream.video record. - VideoUri string `json:"videoUri" cborgen:"videoUri"` + VideoUri string `json:"videoUri"` } func (t *VodPublishDraft_Output) MarshalCBOR(w io.Writer) error { @@ -46,19 +45,21 @@ func (t *VodPublishDraft_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.publishDraft#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodPublishDraft_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // VodPublishDraft calls the XRPC method "place.stream.vod.publishDraft". -func VodPublishDraft(ctx context.Context, c lexutil.LexClient, input *VodPublishDraft_Input) (*VodPublishDraft_Output, error) { +// +// Promote a ready draft VOD to a public place.stream.video record. The server carries over source and durationMs from the draft, backfills a generated thumbnail if the draft has none, writes the video record via putRecord, then deletes the draft. +func VodPublishDraft(ctx context.Context, c glexrt.LexClient, input *VodPublishDraft_Input) (*VodPublishDraft_Output, error) { var out VodPublishDraft_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.vod.publishDraft", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.vod.publishDraft", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/streamplace/vodupdateDraft.go b/pkg/placestream/vodupdatedraft.go similarity index 52% rename from pkg/streamplace/vodupdateDraft.go rename to pkg/placestream/vodupdatedraft.go index 16c778dd..8db5d1bd 100644 --- a/pkg/streamplace/vodupdateDraft.go +++ b/pkg/placestream/vodupdatedraft.go @@ -1,32 +1,32 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. +// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.vod.updateDraft -package streamplace +package placestream import ( + "bytes" "context" "encoding/json" "fmt" "io" - lexutil "github.com/bluesky-social/indigo/lex/util" + glexrt "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" ) type VodUpdateDraft_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.updateDraft#main"` - Activity *VodUpdateDraft_Input_Activity `json:"activity,omitempty" cborgen:"activity,omitempty"` - ContentRights *MetadataContentRights `json:"contentRights,omitempty" cborgen:"contentRights,omitempty"` - ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty" cborgen:"contentWarnings,omitempty"` - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` - DescriptionFacets []*RichtextVideoFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"` - Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` - Thumb *lex.Blob `json:"thumb,omitempty" cborgen:"thumb,omitempty"` - Title *string `json:"title,omitempty" cborgen:"title,omitempty"` + LexiconTypeID string `json:"$type"` + Activity *VodUpdateDraft_Input_Activity `json:"activity,omitempty"` + ContentRights *MetadataContentRights `json:"contentRights,omitempty"` + ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty"` + Description *string `json:"description,omitempty"` + DescriptionFacets []RichtextVideoFacet `json:"descriptionFacets,omitempty"` + Tags []string `json:"tags,omitempty"` + Thumb *glexrt.Blob `json:"thumb,omitempty"` + Title *string `json:"title,omitempty"` // uri: The ats:// URI of the draft to update. - Uri string `json:"uri" cborgen:"uri"` + Uri string `json:"uri"` } func (t *VodUpdateDraft_Input) MarshalCBOR(w io.Writer) error { @@ -35,11 +35,11 @@ func (t *VodUpdateDraft_Input) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.updateDraft#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodUpdateDraft_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } type VodUpdateDraft_Input_Activity struct { @@ -60,7 +60,7 @@ func (t *VodUpdateDraft_Input_Activity) MarshalJSON() ([]byte, error) { } func (t *VodUpdateDraft_Input_Activity) UnmarshalJSON(b []byte) error { - typ, err := lexutil.TypeExtract(b) + typ, err := glexrt.TypeExtract(b) if err != nil { return err } @@ -77,9 +77,42 @@ func (t *VodUpdateDraft_Input_Activity) UnmarshalJSON(b []byte) error { } } +func (t *VodUpdateDraft_Input_Activity) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.Defs_ActivityGame != nil { + return t.Defs_ActivityGame.MarshalCBOR(w) + } + if t.Defs_ActivityLabel != nil { + return t.Defs_ActivityLabel.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *VodUpdateDraft_Input_Activity) UnmarshalCBOR(r io.Reader) error { + typ, b, err := glexrt.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "place.stream.defs#activityGame": + t.Defs_ActivityGame = new(Defs_ActivityGame) + return t.Defs_ActivityGame.UnmarshalCBOR(bytes.NewReader(b)) + case "place.stream.defs#activityLabel": + t.Defs_ActivityLabel = new(Defs_ActivityLabel) + return t.Defs_ActivityLabel.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + type VodUpdateDraft_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.updateDraft#main"` - Draft *VodDraftDefs_DraftView `json:"draft" cborgen:"draft"` + LexiconTypeID string `json:"$type"` + Draft VodDraftDefs_DraftView `json:"draft"` } func (t *VodUpdateDraft_Output) MarshalCBOR(w io.Writer) error { @@ -88,19 +121,21 @@ func (t *VodUpdateDraft_Output) MarshalCBOR(w io.Writer) error { return err } t.LexiconTypeID = "place.stream.vod.updateDraft#main" - return lex.MarshalCBOR(w, t) + return glexrt.MarshalCBOR(w, t) } func (t *VodUpdateDraft_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) + return glexrt.UnmarshalCBOR(r, t) } // VodUpdateDraft calls the XRPC method "place.stream.vod.updateDraft". -func VodUpdateDraft(ctx context.Context, c lexutil.LexClient, input *VodUpdateDraft_Input) (*VodUpdateDraft_Output, error) { +// +// Update a draft VOD's editable metadata. Server-authoritative fields (source, durationMs, status) are preserved. Editing is allowed in any status, so the user can pre-fill metadata while processing. All fields except uri are optional (partial update). +func VodUpdateDraft(ctx context.Context, c glexrt.LexClient, input *VodUpdateDraft_Input) (*VodUpdateDraft_Output, error) { var out VodUpdateDraft_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.vod.updateDraft", nil, input, &out); err != nil { + + if err := c.LexDo(ctx, glexrt.Procedure, "application/json", "place.stream.vod.updateDraft", nil, input, &out); err != nil { return nil, err } - return &out, nil } diff --git a/pkg/renditions/renditions.go b/pkg/renditions/renditions.go index 8c4fdf3c..e0692bcd 100644 --- a/pkg/renditions/renditions.go +++ b/pkg/renditions/renditions.go @@ -4,7 +4,7 @@ import ( "fmt" "math" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type FPS struct { diff --git a/pkg/renditions/renditions_test.go b/pkg/renditions/renditions_test.go index 480d1171..ac6667b8 100644 --- a/pkg/renditions/renditions_test.go +++ b/pkg/renditions/renditions_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func seg(width int, height int, fpsNum int, fpsDen int) *streamplace.Segment { diff --git a/pkg/replication/iroh_replicator/kv.go b/pkg/replication/iroh_replicator/kv.go index 8ef853c7..1a3de5ca 100644 --- a/pkg/replication/iroh_replicator/kv.go +++ b/pkg/replication/iroh_replicator/kv.go @@ -20,7 +20,7 @@ import ( "stream.place/streamplace/pkg/media" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/spmetrics" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type IrohSwarm struct { diff --git a/pkg/replication/replicator.go b/pkg/replication/replicator.go index 5237b348..71ac2f40 100644 --- a/pkg/replication/replicator.go +++ b/pkg/replication/replicator.go @@ -5,7 +5,7 @@ import ( "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/media" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type Replicator interface { diff --git a/pkg/replication/websocketrep/websocket_replicator.go b/pkg/replication/websocketrep/websocket_replicator.go index e51e0ca2..9feee585 100644 --- a/pkg/replication/websocketrep/websocket_replicator.go +++ b/pkg/replication/websocketrep/websocket_replicator.go @@ -14,7 +14,7 @@ import ( "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/media" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type WebsocketReplicator struct { diff --git a/pkg/spxrpc/beta_invite_test.go b/pkg/spxrpc/beta_invite_test.go index e422675a..5b30a252 100644 --- a/pkg/spxrpc/beta_invite_test.go +++ b/pkg/spxrpc/beta_invite_test.go @@ -9,7 +9,7 @@ import ( "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) const ( diff --git a/pkg/spxrpc/graph.go b/pkg/spxrpc/graph.go index 438cb81b..c9dee39f 100644 --- a/pkg/spxrpc/graph.go +++ b/pkg/spxrpc/graph.go @@ -7,7 +7,7 @@ import ( "github.com/bluesky-social/indigo/api/atproto" "github.com/bluesky-social/indigo/atproto/syntax" "go.opentelemetry.io/otel" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamGraphGetFollowingUser(ctx context.Context, subjectDID string, userDID string) (*placestreamtypes.GraphGetFollowingUser_Output, error) { diff --git a/pkg/spxrpc/labels_test.go b/pkg/spxrpc/labels_test.go index 7d3ecc3c..66d079d4 100644 --- a/pkg/spxrpc/labels_test.go +++ b/pkg/spxrpc/labels_test.go @@ -16,7 +16,7 @@ import ( "stream.place/streamplace/pkg/atproto" "stream.place/streamplace/pkg/blob" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/vod" ) diff --git a/pkg/spxrpc/place_stream_badge.go b/pkg/spxrpc/place_stream_badge.go index 9a1e983c..d07d5632 100644 --- a/pkg/spxrpc/place_stream_badge.go +++ b/pkg/spxrpc/place_stream_badge.go @@ -10,7 +10,7 @@ import ( "stream.place/streamplace/pkg/badges" "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/log" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamBadgeGetValidBadges(ctx context.Context, streamer string) (*placestream.BadgeGetValidBadges_Output, error) { diff --git a/pkg/spxrpc/place_stream_beta.go b/pkg/spxrpc/place_stream_beta.go index 4c163aaa..40f1efc8 100644 --- a/pkg/spxrpc/place_stream_beta.go +++ b/pkg/spxrpc/place_stream_beta.go @@ -8,7 +8,7 @@ import ( "github.com/labstack/echo/v4" "github.com/streamplace/oatproxy/pkg/oatproxy" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) // handlePlaceStreamBetaGetStatus reports an account's access status for a diff --git a/pkg/spxrpc/place_stream_branding.go b/pkg/spxrpc/place_stream_branding.go index 4edcc82d..4f6e2742 100644 --- a/pkg/spxrpc/place_stream_branding.go +++ b/pkg/spxrpc/place_stream_branding.go @@ -14,7 +14,7 @@ import ( "gorm.io/gorm" "stream.place/streamplace/js/app" "stream.place/streamplace/pkg/log" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) var defaultBrandingAssets = map[string]struct { diff --git a/pkg/spxrpc/place_stream_broadcast.go b/pkg/spxrpc/place_stream_broadcast.go index 993e1483..f1761c79 100644 --- a/pkg/spxrpc/place_stream_broadcast.go +++ b/pkg/spxrpc/place_stream_broadcast.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamBroadcastGetBroadcaster(ctx context.Context) (*placestreamtypes.BroadcastGetBroadcaster_Output, error) { diff --git a/pkg/spxrpc/place_stream_config.go b/pkg/spxrpc/place_stream_config.go index 7719d651..6a2b6fae 100644 --- a/pkg/spxrpc/place_stream_config.go +++ b/pkg/spxrpc/place_stream_config.go @@ -3,7 +3,7 @@ package spxrpc import ( "context" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamConfigGetEnv(ctx context.Context) (*placestream.ConfigGetEnv_Output, error) { diff --git a/pkg/spxrpc/place_stream_game.go b/pkg/spxrpc/place_stream_game.go index f994be1d..6933167a 100644 --- a/pkg/spxrpc/place_stream_game.go +++ b/pkg/spxrpc/place_stream_game.go @@ -10,7 +10,7 @@ import ( "strings" "github.com/labstack/echo/v4" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamGameSearch(ctx context.Context, cursor string, limit int, q string) (*placestream.GameSearch_Output, error) { diff --git a/pkg/spxrpc/place_stream_ingest.go b/pkg/spxrpc/place_stream_ingest.go index 6275ed4e..734ae9b1 100644 --- a/pkg/spxrpc/place_stream_ingest.go +++ b/pkg/spxrpc/place_stream_ingest.go @@ -6,7 +6,7 @@ import ( "net" "strings" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func hostPort(host, port, defaultPort string) string { diff --git a/pkg/spxrpc/place_stream_live.go b/pkg/spxrpc/place_stream_live.go index 65b84c43..4373d377 100644 --- a/pkg/spxrpc/place_stream_live.go +++ b/pkg/spxrpc/place_stream_live.go @@ -27,7 +27,7 @@ import ( "stream.place/streamplace/pkg/spid" "stream.place/streamplace/pkg/spmetrics" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamLiveDenyTeleport(ctx context.Context, input *placestream.LiveDenyTeleport_Input) (*placestream.LiveDenyTeleport_Output, error) { diff --git a/pkg/spxrpc/place_stream_live_searchActorsTypeahead.go b/pkg/spxrpc/place_stream_live_searchActorsTypeahead.go index 5ff210e1..5d1296b9 100644 --- a/pkg/spxrpc/place_stream_live_searchActorsTypeahead.go +++ b/pkg/spxrpc/place_stream_live_searchActorsTypeahead.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/labstack/echo/v4" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamLiveSearchActorsTypeahead(ctx context.Context, limit int, q string) (*placestreamtypes.LiveSearchActorsTypeahead_Output, error) { diff --git a/pkg/spxrpc/place_stream_media.go b/pkg/spxrpc/place_stream_media.go index 567f31f8..6815661b 100644 --- a/pkg/spxrpc/place_stream_media.go +++ b/pkg/spxrpc/place_stream_media.go @@ -9,7 +9,7 @@ import ( "github.com/labstack/echo/v4" "github.com/streamplace/oatproxy/pkg/oatproxy" "stream.place/streamplace/pkg/log" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamMediaCreateUpload(ctx context.Context, body *placestream.MediaCreateUpload_Input) (*placestream.MediaCreateUpload_Output, error) { diff --git a/pkg/spxrpc/place_stream_media_finalizelivestream.go b/pkg/spxrpc/place_stream_media_finalizelivestream.go index cf968004..4161fb92 100644 --- a/pkg/spxrpc/place_stream_media_finalizelivestream.go +++ b/pkg/spxrpc/place_stream_media_finalizelivestream.go @@ -8,7 +8,7 @@ import ( "github.com/labstack/echo/v4" "github.com/streamplace/oatproxy/pkg/oatproxy" "stream.place/streamplace/pkg/statedb" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) // handlePlaceStreamMediaFinalizeLivestream turns a finished livestream into a diff --git a/pkg/spxrpc/place_stream_media_getvideo.go b/pkg/spxrpc/place_stream_media_getvideo.go index 0dd43038..31f88d91 100644 --- a/pkg/spxrpc/place_stream_media_getvideo.go +++ b/pkg/spxrpc/place_stream_media_getvideo.go @@ -6,7 +6,7 @@ import ( "github.com/labstack/echo/v4" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) // handlePlaceStreamMediaGetVideo serves a hydrated view of a video diff --git a/pkg/spxrpc/place_stream_media_getvideolist.go b/pkg/spxrpc/place_stream_media_getvideolist.go index a03eadcb..b0cfb819 100644 --- a/pkg/spxrpc/place_stream_media_getvideolist.go +++ b/pkg/spxrpc/place_stream_media_getvideolist.go @@ -6,7 +6,7 @@ import ( "github.com/labstack/echo/v4" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) // handlePlaceStreamMediaGetVideoList returns a paginated, hydrated diff --git a/pkg/spxrpc/place_stream_media_publishvideo.go b/pkg/spxrpc/place_stream_media_publishvideo.go index 295d6803..586e450f 100644 --- a/pkg/spxrpc/place_stream_media_publishvideo.go +++ b/pkg/spxrpc/place_stream_media_publishvideo.go @@ -7,7 +7,7 @@ import ( "github.com/labstack/echo/v4" "github.com/streamplace/oatproxy/pkg/oatproxy" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/vod" ) diff --git a/pkg/spxrpc/place_stream_moderation.go b/pkg/spxrpc/place_stream_moderation.go index 9bb7e79f..5acc7347 100644 --- a/pkg/spxrpc/place_stream_moderation.go +++ b/pkg/spxrpc/place_stream_moderation.go @@ -16,7 +16,7 @@ import ( "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // handlePlaceStreamModerationCreateBlock creates a block (ban) on behalf of a streamer diff --git a/pkg/spxrpc/place_stream_multistream.go b/pkg/spxrpc/place_stream_multistream.go index f2573ea2..bcf2fd9c 100644 --- a/pkg/spxrpc/place_stream_multistream.go +++ b/pkg/spxrpc/place_stream_multistream.go @@ -11,7 +11,7 @@ import ( "github.com/labstack/echo/v4" "github.com/streamplace/oatproxy/pkg/oatproxy" "go.opentelemetry.io/otel" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) var allowedSchemes = []string{"rtmp", "rtmps"} diff --git a/pkg/spxrpc/place_stream_playback.go b/pkg/spxrpc/place_stream_playback.go index 0afa265e..5d5c542f 100644 --- a/pkg/spxrpc/place_stream_playback.go +++ b/pkg/spxrpc/place_stream_playback.go @@ -13,7 +13,7 @@ import ( "github.com/pion/webrtc/v4" "github.com/streamplace/oatproxy/pkg/oatproxy" "stream.place/streamplace/pkg/constants" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamPlaybackGetPlaybackServer(ctx context.Context, stream string) (*placestream.PlaybackGetPlaybackServer_Output, error) { diff --git a/pkg/spxrpc/place_stream_playback_getvideo.go b/pkg/spxrpc/place_stream_playback_getvideo.go index 8e8c2d59..b875e512 100644 --- a/pkg/spxrpc/place_stream_playback_getvideo.go +++ b/pkg/spxrpc/place_stream_playback_getvideo.go @@ -18,7 +18,7 @@ import ( "stream.place/streamplace/pkg/blob" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/vod" ) diff --git a/pkg/spxrpc/place_stream_playback_getvideo_test.go b/pkg/spxrpc/place_stream_playback_getvideo_test.go index 4559bf91..df5b5edb 100644 --- a/pkg/spxrpc/place_stream_playback_getvideo_test.go +++ b/pkg/spxrpc/place_stream_playback_getvideo_test.go @@ -16,7 +16,7 @@ import ( "stream.place/streamplace/pkg/blob" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/vod" ) diff --git a/pkg/spxrpc/place_stream_server.go b/pkg/spxrpc/place_stream_server.go index 6dfabf3f..0af756e3 100644 --- a/pkg/spxrpc/place_stream_server.go +++ b/pkg/spxrpc/place_stream_server.go @@ -5,7 +5,7 @@ import ( "time" "github.com/bluesky-social/indigo/util" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamServerGetServerTime(ctx context.Context) (*placestreamtypes.ServerGetServerTime_Output, error) { diff --git a/pkg/spxrpc/place_stream_vod.go b/pkg/spxrpc/place_stream_vod.go index 75a9f655..aa525540 100644 --- a/pkg/spxrpc/place_stream_vod.go +++ b/pkg/spxrpc/place_stream_vod.go @@ -8,7 +8,7 @@ import ( "github.com/bluesky-social/indigo/atproto/syntax" "github.com/labstack/echo/v4" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamVodGetComments(ctx context.Context, cursor string, limit int, video string) (*placestream.VodGetComments_Output, error) { diff --git a/pkg/spxrpc/place_stream_vod_drafts.go b/pkg/spxrpc/place_stream_vod_drafts.go index cffe0662..2705e96c 100644 --- a/pkg/spxrpc/place_stream_vod_drafts.go +++ b/pkg/spxrpc/place_stream_vod_drafts.go @@ -11,7 +11,7 @@ import ( "github.com/streamplace/oatproxy/pkg/oatproxy" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/statedb" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" "stream.place/streamplace/pkg/vod" ) diff --git a/pkg/spxrpc/storage.go b/pkg/spxrpc/storage.go index 8573b3a1..3bf6b16d 100644 --- a/pkg/spxrpc/storage.go +++ b/pkg/spxrpc/storage.go @@ -11,7 +11,7 @@ import ( "github.com/streamplace/oatproxy/pkg/oatproxy" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/statedb" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamServerUpsertStorage(ctx context.Context, input *placestreamtypes.ServerUpsertStorage_Input) (*placestreamtypes.ServerUpsertStorage_Output, error) { diff --git a/pkg/spxrpc/stubs.go b/pkg/spxrpc/stubs.go index b2181b1c..7b481e70 100644 --- a/pkg/spxrpc/stubs.go +++ b/pkg/spxrpc/stubs.go @@ -8,7 +8,7 @@ import ( appbsky "github.com/bluesky-social/indigo/api/bsky" "github.com/labstack/echo/v4" "go.opentelemetry.io/otel" - placestream "stream.place/streamplace/pkg/streamplace" + placestream "stream.place/streamplace/pkg/placestream" ) func (s *Server) RegisterHandlersAppBsky(e *echo.Echo) error { diff --git a/pkg/spxrpc/webhook.go b/pkg/spxrpc/webhook.go index 7668d51b..c26030d2 100644 --- a/pkg/spxrpc/webhook.go +++ b/pkg/spxrpc/webhook.go @@ -12,7 +12,7 @@ import ( "github.com/streamplace/oatproxy/pkg/oatproxy" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/statedb" - placestreamtypes "stream.place/streamplace/pkg/streamplace" + placestreamtypes "stream.place/streamplace/pkg/placestream" ) func (s *Server) handlePlaceStreamServerCreateWebhook(ctx context.Context, input *placestreamtypes.ServerCreateWebhook_Input) (*placestreamtypes.ServerCreateWebhook_Output, error) { diff --git a/pkg/statedb/draft_video.go b/pkg/statedb/draft_video.go index 861185fc..fbcfcf52 100644 --- a/pkg/statedb/draft_video.go +++ b/pkg/statedb/draft_video.go @@ -13,7 +13,7 @@ import ( "gorm.io/gorm" "gorm.io/gorm/clause" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // DraftVideo is a draft VOD: a permissioned-data-style record (CBOR-serialized, diff --git a/pkg/statedb/draft_video_test.go b/pkg/statedb/draft_video_test.go index d8299a0a..3bacd664 100644 --- a/pkg/statedb/draft_video_test.go +++ b/pkg/statedb/draft_video_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func newDraftRec(title, status string) *streamplace.VodDraftVideo { diff --git a/pkg/statedb/multistream_target.go b/pkg/statedb/multistream_target.go index 5b60eca1..e61b6239 100644 --- a/pkg/statedb/multistream_target.go +++ b/pkg/statedb/multistream_target.go @@ -8,7 +8,7 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" "github.com/bluesky-social/indigo/util" "stream.place/streamplace/pkg/spid" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) const MAX_MULTISTREAM_TARGETS = 100 diff --git a/pkg/statedb/queue_processor.go b/pkg/statedb/queue_processor.go index 4e5dd95a..1834ba33 100644 --- a/pkg/statedb/queue_processor.go +++ b/pkg/statedb/queue_processor.go @@ -17,7 +17,7 @@ import ( "stream.place/streamplace/pkg/integrations/webhook" "stream.place/streamplace/pkg/log" notificationpkg "stream.place/streamplace/pkg/notifications" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" comatproto "github.com/bluesky-social/indigo/api/atproto" ) diff --git a/pkg/statedb/queue_processor_draft_test.go b/pkg/statedb/queue_processor_draft_test.go index 4bc6f203..5facbba8 100644 --- a/pkg/statedb/queue_processor_draft_test.go +++ b/pkg/statedb/queue_processor_draft_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/model" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // TestDraftLifecycleThroughVODProcessor is the gating test for the draft diff --git a/pkg/statedb/storage.go b/pkg/statedb/storage.go index 17117d15..f982fd98 100644 --- a/pkg/statedb/storage.go +++ b/pkg/statedb/storage.go @@ -6,7 +6,7 @@ import ( "github.com/google/uuid" "gorm.io/gorm" - streamplace "stream.place/streamplace/pkg/streamplace" + streamplace "stream.place/streamplace/pkg/placestream" ) // Storage represents S3 storage configuration for a user diff --git a/pkg/statedb/webhook.go b/pkg/statedb/webhook.go index 375a784a..c0a71ef4 100644 --- a/pkg/statedb/webhook.go +++ b/pkg/statedb/webhook.go @@ -8,7 +8,7 @@ import ( "github.com/google/uuid" "gorm.io/gorm" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) type Webhook struct { diff --git a/pkg/statedb/webhook_test.go b/pkg/statedb/webhook_test.go index bd4ee3f6..5acdbd36 100644 --- a/pkg/statedb/webhook_test.go +++ b/pkg/statedb/webhook_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) func TestWebhookCreation(t *testing.T) { diff --git a/pkg/streamplace/badgedef.go b/pkg/streamplace/badgedef.go deleted file mode 100644 index 6f67a594..00000000 --- a/pkg/streamplace/badgedef.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.badge.def - -package streamplace - -import ( - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -func init() { - lexutil.RegisterType("place.stream.badge.def", &BadgeDef{}) -} - -// Defines a badge's visual appearance and type. Created by the issuer and referenced by issuance records. -type BadgeDef struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.badge.def"` - // badgeType: The category of this badge, used for scope and display rules. - BadgeType string `json:"badgeType" cborgen:"badgeType"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - // description: Optional description of the badge. - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` - // image: Badge icon image. - Image *lex.Blob `json:"image,omitempty" cborgen:"image,omitempty"` - // name: Display name for this badge. - Name string `json:"name" cborgen:"name"` -} - -func (t *BadgeDef) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.badge.def" - return lex.MarshalCBOR(w, t) -} - -func (t *BadgeDef) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/broadcastdefs.go b/pkg/streamplace/broadcastdefs.go deleted file mode 100644 index eaec3760..00000000 --- a/pkg/streamplace/broadcastdefs.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.broadcast.defs - -package streamplace - -import ( - "io" - - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -// BroadcastDefs_BroadcastOriginView is a "broadcastOriginView" in the place.stream.broadcast.defs schema. -type BroadcastDefs_BroadcastOriginView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.broadcast.defs"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` - Cid string `json:"cid" cborgen:"cid"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *BroadcastDefs_BroadcastOriginView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.broadcast.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *BroadcastDefs_BroadcastOriginView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/configgetEnv.go b/pkg/streamplace/configgetEnv.go deleted file mode 100644 index 8f58a3e2..00000000 --- a/pkg/streamplace/configgetEnv.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.config.getEnv - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type ConfigGetEnv_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.config.getEnv#main"` - // gamesEnabled: Whether the games API is configured and available - GamesEnabled *bool `json:"gamesEnabled,omitempty" cborgen:"gamesEnabled,omitempty"` - // playbackWorkerUrl: URL of the Cloudflare playback router worker - PlaybackWorkerUrl *string `json:"playbackWorkerUrl,omitempty" cborgen:"playbackWorkerUrl,omitempty"` -} - -func (t *ConfigGetEnv_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.config.getEnv#main" - return lex.MarshalCBOR(w, t) -} - -func (t *ConfigGetEnv_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// ConfigGetEnv calls the XRPC method "place.stream.config.getEnv". -func ConfigGetEnv(ctx context.Context, c lexutil.LexClient) (*ConfigGetEnv_Output, error) { - var out ConfigGetEnv_Output - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.config.getEnv", nil, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/streamplace/gamegetGame.go b/pkg/streamplace/gamegetGame.go deleted file mode 100644 index 1b49ed3b..00000000 --- a/pkg/streamplace/gamegetGame.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.game.getGame - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type GameGetGame_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.game.getGame#main"` - CoverUrl *string `json:"coverUrl,omitempty" cborgen:"coverUrl,omitempty"` - Genres []string `json:"genres,omitempty" cborgen:"genres,omitempty"` - Name string `json:"name" cborgen:"name"` - Summary *string `json:"summary,omitempty" cborgen:"summary,omitempty"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *GameGetGame_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.game.getGame#main" - return lex.MarshalCBOR(w, t) -} - -func (t *GameGetGame_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// GameGetGame calls the XRPC method "place.stream.game.getGame". -func GameGetGame(ctx context.Context, c lexutil.LexClient, uri string) (*GameGetGame_Output, error) { - var out GameGetGame_Output - - params := map[string]interface{}{} - params["uri"] = uri - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.game.getGame", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/streamplace/getLikes.go b/pkg/streamplace/getLikes.go deleted file mode 100644 index 9aaf00d7..00000000 --- a/pkg/streamplace/getLikes.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.getLikes - -package streamplace - -import ( - "context" - "io" - - appbsky "github.com/bluesky-social/indigo/api/bsky" - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type GetLikes_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.getLikes#main"` - // count: Total number of likes for this subject. - Count int64 `json:"count" cborgen:"count"` - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Likes []*GetLikes_LikeView `json:"likes,omitempty" cborgen:"likes,omitempty"` - Subject string `json:"subject" cborgen:"subject"` -} - -func (t *GetLikes_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.getLikes#main" - return lex.MarshalCBOR(w, t) -} - -func (t *GetLikes_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// GetLikes calls the XRPC method "place.stream.getLikes". -// -// cursor: Optional pagination cursor. -// limit: Maximum number of likes to return. -// subject: AT-URI of the subject (video or comment). -func GetLikes(ctx context.Context, c lexutil.LexClient, cursor string, limit int64, subject string) (*GetLikes_Output, error) { - var out GetLikes_Output - - params := map[string]interface{}{} - if cursor != "" { - params["cursor"] = cursor - } - if limit != 0 { - params["limit"] = limit - } - params["subject"] = subject - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.getLikes", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} - -// GetLikes_LikeView is a "likeView" in the place.stream.getLikes schema. -type GetLikes_LikeView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.getLikes"` - Author *appbsky.ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *GetLikes_LikeView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.getLikes" - return lex.MarshalCBOR(w, t) -} - -func (t *GetLikes_LikeView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/livegetLiveUsers.go b/pkg/streamplace/livegetLiveUsers.go deleted file mode 100644 index ea2a2cba..00000000 --- a/pkg/streamplace/livegetLiveUsers.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.live.getLiveUsers - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type LiveGetLiveUsers_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.live.getLiveUsers#main"` - Streams []*Livestream_LivestreamView `json:"streams,omitempty" cborgen:"streams,omitempty"` -} - -func (t *LiveGetLiveUsers_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.live.getLiveUsers#main" - return lex.MarshalCBOR(w, t) -} - -func (t *LiveGetLiveUsers_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// LiveGetLiveUsers calls the XRPC method "place.stream.live.getLiveUsers". -func LiveGetLiveUsers(ctx context.Context, c lexutil.LexClient, before string, limit int64) (*LiveGetLiveUsers_Output, error) { - var out LiveGetLiveUsers_Output - - params := map[string]interface{}{} - if before != "" { - params["before"] = before - } - if limit != 0 { - params["limit"] = limit - } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.live.getLiveUsers", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/streamplace/livegetProfileCard.go b/pkg/streamplace/livegetProfileCard.go deleted file mode 100644 index 17498c71..00000000 --- a/pkg/streamplace/livegetProfileCard.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.live.getProfileCard - -package streamplace - -import ( - "bytes" - "context" - - lexutil "github.com/bluesky-social/indigo/lex/util" -) - -// LiveGetProfileCard calls the XRPC method "place.stream.live.getProfileCard". -// -// id: The DID or handle of the account. -func LiveGetProfileCard(ctx context.Context, c lexutil.LexClient, id string) ([]byte, error) { - buf := new(bytes.Buffer) - - params := map[string]interface{}{} - params["id"] = id - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.live.getProfileCard", params, nil, buf); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} diff --git a/pkg/streamplace/livesubscribeSegments.go b/pkg/streamplace/livesubscribeSegments.go deleted file mode 100644 index afeacd92..00000000 --- a/pkg/streamplace/livesubscribeSegments.go +++ /dev/null @@ -1,5 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.live.subscribeSegments - -package streamplace diff --git a/pkg/streamplace/metadatacontentRights.go b/pkg/streamplace/metadatacontentRights.go deleted file mode 100644 index 4b569a61..00000000 --- a/pkg/streamplace/metadatacontentRights.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.metadata.contentRights - -package streamplace - -import ( - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -func init() { - lexutil.RegisterType("place.stream.metadata.contentRights#main", &MetadataContentRights{}) -} - -// Content rights and attribution information. -type MetadataContentRights struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.metadata.contentRights"` - // copyrightNotice: Copyright notice for the work. - CopyrightNotice *string `json:"copyrightNotice,omitempty" cborgen:"copyrightNotice,omitempty"` - // copyrightYear: Year of creation or publication. - CopyrightYear *int64 `json:"copyrightYear,omitempty" cborgen:"copyrightYear,omitempty"` - // creator: Name of the creator of the work. - Creator *string `json:"creator,omitempty" cborgen:"creator,omitempty"` - // creditLine: Credit line for the work. - CreditLine *string `json:"creditLine,omitempty" cborgen:"creditLine,omitempty"` - // license: License URL or identifier. - License *string `json:"license,omitempty" cborgen:"license,omitempty"` -} - -func (t *MetadataContentRights) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.metadata.contentRights" - return lex.MarshalCBOR(w, t) -} - -func (t *MetadataContentRights) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/metadatacontentWarnings.go b/pkg/streamplace/metadatacontentWarnings.go deleted file mode 100644 index de6db4fc..00000000 --- a/pkg/streamplace/metadatacontentWarnings.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.metadata.contentWarnings - -package streamplace - -import ( - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -func init() { - lexutil.RegisterType("place.stream.metadata.contentWarnings#main", &MetadataContentWarnings{}) -} - -// Content warnings for a stream. -type MetadataContentWarnings struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.metadata.contentWarnings"` - Warnings []string `json:"warnings,omitempty" cborgen:"warnings,omitempty"` -} - -func (t *MetadataContentWarnings) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.metadata.contentWarnings" - return lex.MarshalCBOR(w, t) -} - -func (t *MetadataContentWarnings) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/multistreamcreateTarget.go b/pkg/streamplace/multistreamcreateTarget.go deleted file mode 100644 index 31db20c3..00000000 --- a/pkg/streamplace/multistreamcreateTarget.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.multistream.createTarget - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type MultistreamCreateTarget_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.createTarget#main"` - MultistreamTarget *MultistreamTarget `json:"multistreamTarget" cborgen:"multistreamTarget"` -} - -func (t *MultistreamCreateTarget_Input) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.multistream.createTarget#main" - return lex.MarshalCBOR(w, t) -} - -func (t *MultistreamCreateTarget_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// MultistreamCreateTarget calls the XRPC method "place.stream.multistream.createTarget". -func MultistreamCreateTarget(ctx context.Context, c lexutil.LexClient, input *MultistreamCreateTarget_Input) (*MultistreamDefs_TargetView, error) { - var out MultistreamDefs_TargetView - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.multistream.createTarget", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/streamplace/multistreamdefs.go b/pkg/streamplace/multistreamdefs.go deleted file mode 100644 index 033dbf9c..00000000 --- a/pkg/streamplace/multistreamdefs.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.multistream.defs - -package streamplace - -import ( - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -// MultistreamDefs_Event is a "event" in the place.stream.multistream.defs schema. -type MultistreamDefs_Event struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.defs"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Message string `json:"message" cborgen:"message"` - Status string `json:"status" cborgen:"status"` -} - -func (t *MultistreamDefs_Event) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.multistream.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *MultistreamDefs_Event) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// MultistreamDefs_TargetView is a "targetView" in the place.stream.multistream.defs schema. -type MultistreamDefs_TargetView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.defs"` - Cid string `json:"cid" cborgen:"cid"` - LatestEvent *MultistreamDefs_Event `json:"latestEvent,omitempty" cborgen:"latestEvent,omitempty"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *MultistreamDefs_TargetView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.multistream.defs" - return lex.MarshalCBOR(w, t) -} - -func (t *MultistreamDefs_TargetView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/multistreamlistTargets.go b/pkg/streamplace/multistreamlistTargets.go deleted file mode 100644 index 6db1e41b..00000000 --- a/pkg/streamplace/multistreamlistTargets.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.multistream.listTargets - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type MultistreamListTargets_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.listTargets#main"` - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Targets []*MultistreamDefs_TargetView `json:"targets" cborgen:"targets"` -} - -func (t *MultistreamListTargets_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.multistream.listTargets#main" - return lex.MarshalCBOR(w, t) -} - -func (t *MultistreamListTargets_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// MultistreamListTargets calls the XRPC method "place.stream.multistream.listTargets". -// -// limit: The number of targets to return. -func MultistreamListTargets(ctx context.Context, c lexutil.LexClient, cursor string, limit int64) (*MultistreamListTargets_Output, error) { - var out MultistreamListTargets_Output - - params := map[string]interface{}{} - if cursor != "" { - params["cursor"] = cursor - } - if limit != 0 { - params["limit"] = limit - } - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.multistream.listTargets", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} - -// MultistreamListTargets_Record is a "record" in the place.stream.multistream.listTargets schema. -type MultistreamListTargets_Record struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.listTargets"` - Cid string `json:"cid" cborgen:"cid"` - Uri string `json:"uri" cborgen:"uri"` - Value *lexutil.LexiconTypeDecoder `json:"value" cborgen:"value"` -} - -func (t *MultistreamListTargets_Record) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.multistream.listTargets" - return lex.MarshalCBOR(w, t) -} - -func (t *MultistreamListTargets_Record) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/multistreamputTarget.go b/pkg/streamplace/multistreamputTarget.go deleted file mode 100644 index 756275d2..00000000 --- a/pkg/streamplace/multistreamputTarget.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.multistream.putTarget - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type MultistreamPutTarget_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.multistream.putTarget#main"` - MultistreamTarget *MultistreamTarget `json:"multistreamTarget" cborgen:"multistreamTarget"` - // rkey: The Record Key. - Rkey *string `json:"rkey,omitempty" cborgen:"rkey,omitempty"` -} - -func (t *MultistreamPutTarget_Input) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.multistream.putTarget#main" - return lex.MarshalCBOR(w, t) -} - -func (t *MultistreamPutTarget_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// MultistreamPutTarget calls the XRPC method "place.stream.multistream.putTarget". -func MultistreamPutTarget(ctx context.Context, c lexutil.LexClient, input *MultistreamPutTarget_Input) (*MultistreamDefs_TargetView, error) { - var out MultistreamDefs_TargetView - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.multistream.putTarget", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/streamplace/playbackgetVideoBlob.go b/pkg/streamplace/playbackgetVideoBlob.go deleted file mode 100644 index 1ac08624..00000000 --- a/pkg/streamplace/playbackgetVideoBlob.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.playback.getVideoBlob - -package streamplace - -import ( - "bytes" - "context" - - lexutil "github.com/bluesky-social/indigo/lex/util" -) - -// PlaybackGetVideoBlob calls the XRPC method "place.stream.playback.getVideoBlob". -// -// cid: BLAKE-3 BDASL CID of the requested blob. -// did: DID of the account that owns the record this blob is being served for. Used for egress/usage accounting, not for access control — the blob is served purely by CID. -// sid: Opaque playback session identifier, propagated unmodified from the media playlist that referenced this blob. Logged for view-count correlation; not used for access control. -func PlaybackGetVideoBlob(ctx context.Context, c lexutil.LexClient, cid string, did string, sid string) ([]byte, error) { - buf := new(bytes.Buffer) - - params := map[string]interface{}{} - if sid != "" { - params["sid"] = sid - } - params["cid"] = cid - params["did"] = did - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.playback.getVideoBlob", params, nil, buf); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} diff --git a/pkg/streamplace/segment.go b/pkg/streamplace/segment.go deleted file mode 100644 index a824feac..00000000 --- a/pkg/streamplace/segment.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.segment - -package streamplace - -import ( - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -func init() { - lexutil.RegisterType("place.stream.segment", &Segment{}) -} - -// Media file representing a segment of a livestream -type Segment struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.segment"` - Audio []*Segment_Audio `json:"audio,omitempty" cborgen:"audio,omitempty"` - ContentRights *MetadataContentRights `json:"contentRights,omitempty" cborgen:"contentRights,omitempty"` - ContentWarnings *MetadataContentWarnings `json:"contentWarnings,omitempty" cborgen:"contentWarnings,omitempty"` - Creator string `json:"creator" cborgen:"creator"` - DistributionPolicy *MetadataDistributionPolicy `json:"distributionPolicy,omitempty" cborgen:"distributionPolicy,omitempty"` - // duration: The duration of the segment in nanoseconds - Duration *int64 `json:"duration,omitempty" cborgen:"duration,omitempty"` - // id: Unique identifier for the segment - Id string `json:"id" cborgen:"id"` - // signingKey: The DID of the signing key used for this segment - SigningKey string `json:"signingKey" cborgen:"signingKey"` - // size: The size of the segment in bytes - Size *int64 `json:"size,omitempty" cborgen:"size,omitempty"` - // startTime: When this segment started - StartTime string `json:"startTime" cborgen:"startTime"` - Video []*Segment_Video `json:"video,omitempty" cborgen:"video,omitempty"` -} - -func (t *Segment) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.segment" - return lex.MarshalCBOR(w, t) -} - -func (t *Segment) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Segment_Audio is a "audio" in the place.stream.segment schema. -type Segment_Audio struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.segment"` - Channels int64 `json:"channels" cborgen:"channels"` - Codec string `json:"codec" cborgen:"codec"` - Rate int64 `json:"rate" cborgen:"rate"` -} - -func (t *Segment_Audio) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.segment" - return lex.MarshalCBOR(w, t) -} - -func (t *Segment_Audio) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Segment_Framerate is a "framerate" in the place.stream.segment schema. -type Segment_Framerate struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.segment"` - Den int64 `json:"den" cborgen:"den"` - Num int64 `json:"num" cborgen:"num"` -} - -func (t *Segment_Framerate) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.segment" - return lex.MarshalCBOR(w, t) -} - -func (t *Segment_Framerate) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Segment_SegmentView is a "segmentView" in the place.stream.segment schema. -type Segment_SegmentView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.segment"` - Cid string `json:"cid" cborgen:"cid"` - Record *lexutil.LexiconTypeDecoder `json:"record" cborgen:"record"` -} - -func (t *Segment_SegmentView) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.segment" - return lex.MarshalCBOR(w, t) -} - -func (t *Segment_SegmentView) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// Segment_Video is a "video" in the place.stream.segment schema. -type Segment_Video struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.segment"` - Bframes *bool `json:"bframes,omitempty" cborgen:"bframes,omitempty"` - Codec string `json:"codec" cborgen:"codec"` - Framerate *Segment_Framerate `json:"framerate,omitempty" cborgen:"framerate,omitempty"` - Height int64 `json:"height" cborgen:"height"` - Width int64 `json:"width" cborgen:"width"` -} - -func (t *Segment_Video) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.segment" - return lex.MarshalCBOR(w, t) -} - -func (t *Segment_Video) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/servergetStorage.go b/pkg/streamplace/servergetStorage.go deleted file mode 100644 index f540c37a..00000000 --- a/pkg/streamplace/servergetStorage.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.server.getStorage - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type ServerGetStorage_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.getStorage#main"` - Storage *ServerDefs_Storage `json:"storage,omitempty" cborgen:"storage,omitempty"` -} - -func (t *ServerGetStorage_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.server.getStorage#main" - return lex.MarshalCBOR(w, t) -} - -func (t *ServerGetStorage_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// ServerGetStorage calls the XRPC method "place.stream.server.getStorage". -func ServerGetStorage(ctx context.Context, c lexutil.LexClient) (*ServerGetStorage_Output, error) { - var out ServerGetStorage_Output - if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.server.getStorage", nil, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/streamplace/serverupdateWebhook.go b/pkg/streamplace/serverupdateWebhook.go deleted file mode 100644 index b1480ca9..00000000 --- a/pkg/streamplace/serverupdateWebhook.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.server.updateWebhook - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type ServerUpdateWebhook_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.updateWebhook#main"` - // active: Whether this webhook should be active. - Active *bool `json:"active,omitempty" cborgen:"active,omitempty"` - // description: A description of what this webhook is used for. - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` - // events: The types of events this webhook should receive. - Events []string `json:"events,omitempty" cborgen:"events,omitempty"` - // id: The ID of the webhook to update. - Id string `json:"id" cborgen:"id"` - // muteWords: Words to filter out from chat messages. Messages containing any of these words will not be forwarded. - MuteWords []string `json:"muteWords,omitempty" cborgen:"muteWords,omitempty"` - // name: A user-friendly name for this webhook. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` - // prefix: Text to prepend to webhook messages. - Prefix *string `json:"prefix,omitempty" cborgen:"prefix,omitempty"` - // rewrite: Text replacement rules for webhook messages. - Rewrite []*ServerDefs_RewriteRule `json:"rewrite,omitempty" cborgen:"rewrite,omitempty"` - // suffix: Text to append to webhook messages. - Suffix *string `json:"suffix,omitempty" cborgen:"suffix,omitempty"` - // url: The webhook URL where events will be sent. - Url *string `json:"url,omitempty" cborgen:"url,omitempty"` -} - -func (t *ServerUpdateWebhook_Input) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.server.updateWebhook#main" - return lex.MarshalCBOR(w, t) -} - -func (t *ServerUpdateWebhook_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -type ServerUpdateWebhook_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.server.updateWebhook#main"` - Webhook *ServerDefs_Webhook `json:"webhook" cborgen:"webhook"` -} - -func (t *ServerUpdateWebhook_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.server.updateWebhook#main" - return lex.MarshalCBOR(w, t) -} - -func (t *ServerUpdateWebhook_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// ServerUpdateWebhook calls the XRPC method "place.stream.server.updateWebhook". -func ServerUpdateWebhook(ctx context.Context, c lexutil.LexClient, input *ServerUpdateWebhook_Input) (*ServerUpdateWebhook_Output, error) { - var out ServerUpdateWebhook_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.server.updateWebhook", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/streamplace/vodcomment.go b/pkg/streamplace/vodcomment.go deleted file mode 100644 index 3a5b5cfa..00000000 --- a/pkg/streamplace/vodcomment.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.vod.comment - -package streamplace - -import ( - "io" - - comatproto "github.com/bluesky-social/indigo/api/atproto" - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -func init() { - lexutil.RegisterType("place.stream.vod.comment", &VodComment{}) -} - -// Record containing a comment on a VOD. -type VodComment struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.comment"` - // createdAt: Client-declared timestamp when this comment was created. - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - // facets: Annotations of text (mentions, URLs, etc) - Facets []*RichtextFacet `json:"facets,omitempty" cborgen:"facets,omitempty"` - Reply *VodComment_ReplyRef `json:"reply,omitempty" cborgen:"reply,omitempty"` - // text: The comment text content. - Text string `json:"text" cborgen:"text"` - // video: AT-URI of the place.stream.video record this comment belongs to. - Video string `json:"video" cborgen:"video"` -} - -func (t *VodComment) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.vod.comment" - return lex.MarshalCBOR(w, t) -} - -func (t *VodComment) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// VodComment_ReplyRef is a "replyRef" in the place.stream.vod.comment schema. -type VodComment_ReplyRef struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.comment"` - Parent *comatproto.RepoStrongRef `json:"parent" cborgen:"parent"` - Root *comatproto.RepoStrongRef `json:"root" cborgen:"root"` -} - -func (t *VodComment_ReplyRef) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.vod.comment" - return lex.MarshalCBOR(w, t) -} - -func (t *VodComment_ReplyRef) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} diff --git a/pkg/streamplace/vodcreateDraft.go b/pkg/streamplace/vodcreateDraft.go deleted file mode 100644 index e28786c7..00000000 --- a/pkg/streamplace/vodcreateDraft.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by glex (legacy mode); DO NOT EDIT. - -// Lexicon schema: place.stream.vod.createDraft - -package streamplace - -import ( - "context" - "io" - - lexutil "github.com/bluesky-social/indigo/lex/util" - cbg "github.com/whyrusleeping/cbor-gen" - lex "stream.place/streamplace/pkg/lex" -) - -type VodCreateDraft_Input struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.createDraft#main"` -} - -func (t *VodCreateDraft_Input) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.vod.createDraft#main" - return lex.MarshalCBOR(w, t) -} - -func (t *VodCreateDraft_Input) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -type VodCreateDraft_Output struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.vod.createDraft#main"` - // uri: The ats:// URI of the newly created draft record. - Uri string `json:"uri" cborgen:"uri"` -} - -func (t *VodCreateDraft_Output) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - t.LexiconTypeID = "place.stream.vod.createDraft#main" - return lex.MarshalCBOR(w, t) -} - -func (t *VodCreateDraft_Output) UnmarshalCBOR(r io.Reader) error { - return lex.UnmarshalCBOR(r, t) -} - -// VodCreateDraft calls the XRPC method "place.stream.vod.createDraft". -func VodCreateDraft(ctx context.Context, c lexutil.LexClient, input *VodCreateDraft_Input) (*VodCreateDraft_Output, error) { - var out VodCreateDraft_Output - if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "place.stream.vod.createDraft", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/pkg/upload/upload.go b/pkg/upload/upload.go index 3021a46a..0a8e5270 100644 --- a/pkg/upload/upload.go +++ b/pkg/upload/upload.go @@ -33,7 +33,7 @@ import ( "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // Backend identifies which TUS data store backs an upload. diff --git a/pkg/viewlog/publish.go b/pkg/viewlog/publish.go index fedbb975..885d63c1 100644 --- a/pkg/viewlog/publish.go +++ b/pkg/viewlog/publish.go @@ -16,7 +16,7 @@ import ( "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/log" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) var aggregateTracer = otel.Tracer("viewlog") diff --git a/pkg/vod/publish.go b/pkg/vod/publish.go index b24d8663..65f5193f 100644 --- a/pkg/vod/publish.go +++ b/pkg/vod/publish.go @@ -19,7 +19,7 @@ import ( "stream.place/streamplace/pkg/media" "stream.place/streamplace/pkg/spid" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // trackRefJSON is the shape stored in Upload.TrackURIs. diff --git a/pkg/vod/publish_draft.go b/pkg/vod/publish_draft.go index 04b8ea81..4c091c9e 100644 --- a/pkg/vod/publish_draft.go +++ b/pkg/vod/publish_draft.go @@ -19,7 +19,7 @@ import ( "stream.place/streamplace/pkg/constants" "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // ErrDraftNotFound / ErrDraftNotReady let the publishDraft XRPC handler map diff --git a/pkg/vod/publish_draft_test.go b/pkg/vod/publish_draft_test.go index e2580e87..2ebd219c 100644 --- a/pkg/vod/publish_draft_test.go +++ b/pkg/vod/publish_draft_test.go @@ -9,7 +9,7 @@ import ( "stream.place/streamplace/pkg/config" "stream.place/streamplace/pkg/model" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // newDraftTestState builds an in-memory statedb for draft tests that don't need diff --git a/pkg/vod/publish_video.go b/pkg/vod/publish_video.go index c768afc0..86821ec9 100644 --- a/pkg/vod/publish_video.go +++ b/pkg/vod/publish_video.go @@ -21,7 +21,7 @@ import ( "stream.place/streamplace/pkg/log" "stream.place/streamplace/pkg/spid" "stream.place/streamplace/pkg/statedb" - "stream.place/streamplace/pkg/streamplace" + "stream.place/streamplace/pkg/placestream" ) // ErrUploadNotFound / ErrUploadNotReady let the publishVideo XRPC handler map