diff --git a/api/tangled/actordefs.go b/api/tangled/actordefs.go new file mode 100644 index 000000000..bb7bf56ed --- /dev/null +++ b/api/tangled/actordefs.go @@ -0,0 +1,35 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.actor.defs + +const () + +// ActorDefs_ProfileViewBasic is a "profileViewBasic" in the sh.tangled.actor.defs schema. +type ActorDefs_ProfileViewBasic struct { + Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"` + Did string `json:"did" cborgen:"did"` + Handle string `json:"handle" cborgen:"handle"` + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` +} + +// ActorDefs_ProfileViewDetailed is a "profileViewDetailed" in the sh.tangled.actor.defs schema. +// +// profileViewBaisc + follow counts +type ActorDefs_ProfileViewDetailed struct { + Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"` + Did string `json:"did" cborgen:"did"` + FollowersCount *int64 `json:"followersCount,omitempty" cborgen:"followersCount,omitempty"` + FollowsCount *int64 `json:"followsCount,omitempty" cborgen:"followsCount,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` +} + +// ActorDefs_ViewerState is a "viewerState" in the sh.tangled.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 { + FollowedBy *string `json:"followedBy,omitempty" cborgen:"followedBy,omitempty"` + Following *string `json:"following,omitempty" cborgen:"following,omitempty"` +} diff --git a/api/tangled/feedgetStar.go b/api/tangled/feedgetStar.go new file mode 100644 index 000000000..6df7d9838 --- /dev/null +++ b/api/tangled/feedgetStar.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.feed.getStar + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + FeedGetStarNSID = "sh.tangled.feed.getStar" +) + +// FeedGetStar_Output is the output of a sh.tangled.feed.getStar call. +type FeedGetStar_Output struct { + // uri: Uri of actor's star record for subject. + Uri string `json:"uri" cborgen:"uri"` +} + +// FeedGetStar calls the XRPC method "sh.tangled.feed.getStar". +// +// actor: DID of the potential stargazer. +// subject: Repo DID to check. +func FeedGetStar(ctx context.Context, c util.LexClient, actor string, subject string) (*FeedGetStar_Output, error) { + var out FeedGetStar_Output + + params := map[string]interface{}{} + params["actor"] = actor + params["subject"] = subject + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.feed.getStar", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/feedgetTimeline.go b/api/tangled/feedgetTimeline.go new file mode 100644 index 000000000..638c17305 --- /dev/null +++ b/api/tangled/feedgetTimeline.go @@ -0,0 +1,140 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.feed.getTimeline + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + FeedGetTimelineNSID = "sh.tangled.feed.getTimeline" +) + +// FeedGetTimeline_FollowEvent is a "followEvent" in the sh.tangled.feed.getTimeline schema. +// +// A user followed another user. +// +// RECORDTYPE: FeedGetTimeline_FollowEvent +type FeedGetTimeline_FollowEvent struct { + LexiconTypeID string `json:"$type,const=sh.tangled.feed.getTimeline#followEvent" cborgen:"$type,const=sh.tangled.feed.getTimeline#followEvent"` + Actor *ActorDefs_ProfileViewBasic `json:"actor" cborgen:"actor"` + Cid string `json:"cid" cborgen:"cid"` + Subject *ActorDefs_ProfileViewDetailed `json:"subject" cborgen:"subject"` + Uri string `json:"uri" cborgen:"uri"` +} + +// FeedGetTimeline_Output is the output of a sh.tangled.feed.getTimeline call. +type FeedGetTimeline_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Feed []*FeedGetTimeline_TimelineItem `json:"feed" cborgen:"feed"` +} + +// FeedGetTimeline_RepoEvent is a "repoEvent" in the sh.tangled.feed.getTimeline schema. +// +// A repository was created (or forked). The actor is repo.owner. +// +// RECORDTYPE: FeedGetTimeline_RepoEvent +type FeedGetTimeline_RepoEvent struct { + LexiconTypeID string `json:"$type,const=sh.tangled.feed.getTimeline#repoEvent" cborgen:"$type,const=sh.tangled.feed.getTimeline#repoEvent"` + Cid string `json:"cid" cborgen:"cid"` + Repo *RepoDefs_RepoViewBasic `json:"repo" cborgen:"repo"` + // source: Fork parent, present only if this repo is a fork. + Source *RepoDefs_RepoViewBasic `json:"source,omitempty" cborgen:"source,omitempty"` + Uri string `json:"uri" cborgen:"uri"` +} + +// FeedGetTimeline_StarEvent is a "starEvent" in the sh.tangled.feed.getTimeline schema. +// +// A repository was starred. +// +// RECORDTYPE: FeedGetTimeline_StarEvent +type FeedGetTimeline_StarEvent struct { + LexiconTypeID string `json:"$type,const=sh.tangled.feed.getTimeline#starEvent" cborgen:"$type,const=sh.tangled.feed.getTimeline#starEvent"` + // actor: Who starred. + Actor *ActorDefs_ProfileViewBasic `json:"actor" cborgen:"actor"` + Cid string `json:"cid" cborgen:"cid"` + // repo: The starred repo. + Repo *RepoDefs_RepoViewBasic `json:"repo" cborgen:"repo"` + Uri string `json:"uri" cborgen:"uri"` +} + +// FeedGetTimeline_TimelineItem is a "timelineItem" in the sh.tangled.feed.getTimeline schema. +type FeedGetTimeline_TimelineItem struct { + Event *FeedGetTimeline_TimelineItem_Event `json:"event" cborgen:"event"` + EventAt string `json:"eventAt" cborgen:"eventAt"` +} + +type FeedGetTimeline_TimelineItem_Event struct { + FeedGetTimeline_RepoEvent *FeedGetTimeline_RepoEvent + FeedGetTimeline_StarEvent *FeedGetTimeline_StarEvent + FeedGetTimeline_FollowEvent *FeedGetTimeline_FollowEvent +} + +func (t *FeedGetTimeline_TimelineItem_Event) MarshalJSON() ([]byte, error) { + if t.FeedGetTimeline_RepoEvent != nil { + t.FeedGetTimeline_RepoEvent.LexiconTypeID = "sh.tangled.feed.getTimeline#repoEvent" + return json.Marshal(t.FeedGetTimeline_RepoEvent) + } + if t.FeedGetTimeline_StarEvent != nil { + t.FeedGetTimeline_StarEvent.LexiconTypeID = "sh.tangled.feed.getTimeline#starEvent" + return json.Marshal(t.FeedGetTimeline_StarEvent) + } + if t.FeedGetTimeline_FollowEvent != nil { + t.FeedGetTimeline_FollowEvent.LexiconTypeID = "sh.tangled.feed.getTimeline#followEvent" + return json.Marshal(t.FeedGetTimeline_FollowEvent) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *FeedGetTimeline_TimelineItem_Event) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "sh.tangled.feed.getTimeline#repoEvent": + t.FeedGetTimeline_RepoEvent = new(FeedGetTimeline_RepoEvent) + return json.Unmarshal(b, t.FeedGetTimeline_RepoEvent) + case "sh.tangled.feed.getTimeline#starEvent": + t.FeedGetTimeline_StarEvent = new(FeedGetTimeline_StarEvent) + return json.Unmarshal(b, t.FeedGetTimeline_StarEvent) + case "sh.tangled.feed.getTimeline#followEvent": + t.FeedGetTimeline_FollowEvent = new(FeedGetTimeline_FollowEvent) + return json.Unmarshal(b, t.FeedGetTimeline_FollowEvent) + + default: + return nil + } +} + +// FeedGetTimeline calls the XRPC method "sh.tangled.feed.getTimeline". +// +// viewer: TODO: deprecate this and use auth instead. +func FeedGetTimeline(ctx context.Context, c util.LexClient, cursor string, followingOnly bool, limit int64, viewer string) (*FeedGetTimeline_Output, error) { + var out FeedGetTimeline_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if followingOnly { + params["followingOnly"] = followingOnly + } + if limit != 0 { + params["limit"] = limit + } + if viewer != "" { + params["viewer"] = viewer + } + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.feed.getTimeline", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/graphgetFollow.go b/api/tangled/graphgetFollow.go new file mode 100644 index 000000000..3e027db38 --- /dev/null +++ b/api/tangled/graphgetFollow.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.graph.getFollow + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + GraphGetFollowNSID = "sh.tangled.graph.getFollow" +) + +// GraphGetFollow_Output is the output of a sh.tangled.graph.getFollow call. +type GraphGetFollow_Output struct { + // uri: Uri of actor's follow record for subject. + Uri string `json:"uri" cborgen:"uri"` +} + +// GraphGetFollow calls the XRPC method "sh.tangled.graph.getFollow". +// +// actor: DID of the potential follower. +// subject: Followee DID to check. +func GraphGetFollow(ctx context.Context, c util.LexClient, actor string, subject string) (*GraphGetFollow_Output, error) { + var out GraphGetFollow_Output + + params := map[string]interface{}{} + params["actor"] = actor + params["subject"] = subject + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.graph.getFollow", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/publicKeygetPublicKey.go b/api/tangled/publicKeygetPublicKey.go new file mode 100644 index 000000000..fbbece666 --- /dev/null +++ b/api/tangled/publicKeygetPublicKey.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.publicKey.getPublicKey + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + PublicKeyGetPublicKeyNSID = "sh.tangled.publicKey.getPublicKey" +) + +// PublicKeyGetPublicKey_Output is the output of a sh.tangled.publicKey.getPublicKey call. +type PublicKeyGetPublicKey_Output struct { + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + Uri string `json:"uri" cborgen:"uri"` + // value: Embedded sh.tangled.publicKey record. + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} + +// PublicKeyGetPublicKey calls the XRPC method "sh.tangled.publicKey.getPublicKey". +// +// publicKey: AT-URI of the sh.tangled.publicKey record to fetch. +func PublicKeyGetPublicKey(ctx context.Context, c util.LexClient, publicKey string) (*PublicKeyGetPublicKey_Output, error) { + var out PublicKeyGetPublicKey_Output + + params := map[string]interface{}{} + params["publicKey"] = publicKey + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.publicKey.getPublicKey", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/queryenrichResponse.go b/api/tangled/queryenrichResponse.go new file mode 100644 index 000000000..2dd5a2768 --- /dev/null +++ b/api/tangled/queryenrichResponse.go @@ -0,0 +1,57 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.query.enrichResponse + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + QueryEnrichResponseNSID = "sh.tangled.query.enrichResponse" +) + +// QueryEnrichResponse_Input is the input argument to a sh.tangled.query.enrichResponse call. +type QueryEnrichResponse_Input struct { + // enrich: Payloads to compute for each found reference. + Enrich []*QueryEnrichResponse_LinkDescriptor `json:"enrich" cborgen:"enrich"` + // params: Parameters for the inner query, exactly as it declares them. + Params *util.LexiconTypeDecoder `json:"params,omitempty" cborgen:"params,omitempty"` + // sources: Record paths into the inner response restricting which references get payloads. All references are enriched when omitted. + Sources []string `json:"sources,omitempty" cborgen:"sources,omitempty"` + // viewer: DID whose own relation to each reference is looked up for viewer payloads. Required when any descriptor requests one. + Viewer *string `json:"viewer,omitempty" cborgen:"viewer,omitempty"` + // xrpc: NSID of the inner query to run, e.g. sh.tangled.repo.listRepos. + Xrpc string `json:"xrpc" cborgen:"xrpc"` +} + +// QueryEnrichResponse_LinkDescriptor is a "linkDescriptor" in the sh.tangled.query.enrichResponse schema. +// +// One sidecar payload, computed from the records at a link source whose reference equals the found reference. +type QueryEnrichResponse_LinkDescriptor struct { + // source: Collection whose records are linked, a colon, then an index-backed path (subject or .repo). + Source string `json:"source" cborgen:"source"` + // type: NSID of the payload type to produce, which also defines the payload's shape. Results land at data[ref][source][type]. + Type string `json:"type" cborgen:"type"` +} + +// QueryEnrichResponse_Output is the output of a sh.tangled.query.enrichResponse call. +type QueryEnrichResponse_Output struct { + // data: Reference (did or at-uri) -> link source -> payload type nsid -> payload. References no descriptor applies to are absent. + Data *util.LexiconTypeDecoder `json:"data" cborgen:"data"` + // output: The inner query's response, unmodified. + Output *util.LexiconTypeDecoder `json:"output" cborgen:"output"` +} + +// QueryEnrichResponse calls the XRPC method "sh.tangled.query.enrichResponse". +func QueryEnrichResponse(ctx context.Context, c util.LexClient, input *QueryEnrichResponse_Input) (*QueryEnrichResponse_Output, error) { + var out QueryEnrichResponse_Output + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.query.enrichResponse", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repocountForks.go b/api/tangled/repocountForks.go new file mode 100644 index 000000000..ad09da9e6 --- /dev/null +++ b/api/tangled/repocountForks.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.countForks + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoCountForksNSID = "sh.tangled.repo.countForks" +) + +// RepoCountForks_Output is the output of a sh.tangled.repo.countForks call. +type RepoCountForks_Output struct { + // count: Total number of matching records. + Count int64 `json:"count" cborgen:"count"` + // distinctAuthors: Number of distinct authors among the matching records. + DistinctAuthors int64 `json:"distinctAuthors" cborgen:"distinctAuthors"` +} + +// RepoCountForks calls the XRPC method "sh.tangled.repo.countForks". +// +// subject: Repo DID to count forks of. +func RepoCountForks(ctx context.Context, c util.LexClient, subject string) (*RepoCountForks_Output, error) { + var out RepoCountForks_Output + + params := map[string]interface{}{} + params["subject"] = subject + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.countForks", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repocountIssues.go b/api/tangled/repocountIssues.go index e3adefbd1..d73228b31 100644 --- a/api/tangled/repocountIssues.go +++ b/api/tangled/repocountIssues.go @@ -24,11 +24,19 @@ type RepoCountIssues_Output struct { // RepoCountIssues calls the XRPC method "sh.tangled.repo.countIssues". // +// author: Restrict to issues authored by this user DID. +// state: Restrict to issues whose latest derived state matches. // subject: Repo DID to list issues for -func RepoCountIssues(ctx context.Context, c util.LexClient, subject string) (*RepoCountIssues_Output, error) { +func RepoCountIssues(ctx context.Context, c util.LexClient, author string, state string, subject string) (*RepoCountIssues_Output, error) { var out RepoCountIssues_Output params := map[string]interface{}{} + if author != "" { + params["author"] = author + } + if state != "" { + params["state"] = state + } params["subject"] = subject if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.countIssues", params, nil, &out); err != nil { return nil, err diff --git a/api/tangled/repocountPulls.go b/api/tangled/repocountPulls.go index 3a73f84b0..292478ed4 100644 --- a/api/tangled/repocountPulls.go +++ b/api/tangled/repocountPulls.go @@ -24,11 +24,19 @@ type RepoCountPulls_Output struct { // RepoCountPulls calls the XRPC method "sh.tangled.repo.countPulls". // +// author: Restrict to pulls authored by this user DID. +// status: Restrict to pulls whose latest derived status matches. // subject: Repo DID to list pulls for -func RepoCountPulls(ctx context.Context, c util.LexClient, subject string) (*RepoCountPulls_Output, error) { +func RepoCountPulls(ctx context.Context, c util.LexClient, author string, status string, subject string) (*RepoCountPulls_Output, error) { var out RepoCountPulls_Output params := map[string]interface{}{} + if author != "" { + params["author"] = author + } + if status != "" { + params["status"] = status + } params["subject"] = subject if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.countPulls", params, nil, &out); err != nil { return nil, err diff --git a/api/tangled/repodefs.go b/api/tangled/repodefs.go new file mode 100644 index 000000000..e14b83b3f --- /dev/null +++ b/api/tangled/repodefs.go @@ -0,0 +1,26 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.defs + +const () + +// RepoDefs_RepoViewBasic is a "repoViewBasic" in the sh.tangled.repo.defs schema. +type RepoDefs_RepoViewBasic struct { + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Did string `json:"did" cborgen:"did"` + IsStarred *bool `json:"isStarred,omitempty" cborgen:"isStarred,omitempty"` + Owner *ActorDefs_ProfileViewBasic `json:"owner" cborgen:"owner"` + Slug string `json:"slug" cborgen:"slug"` + StarCount *int64 `json:"starCount,omitempty" cborgen:"starCount,omitempty"` + Viewer *RepoDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` +} + +// RepoDefs_ViewerState is a "viewerState" in the sh.tangled.repo.defs schema. +// +// Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. +type RepoDefs_ViewerState struct { + Star *string `json:"star,omitempty" cborgen:"star,omitempty"` +} diff --git a/api/tangled/repogetRepoByName.go b/api/tangled/repogetRepoByName.go new file mode 100644 index 000000000..6a103f1f7 --- /dev/null +++ b/api/tangled/repogetRepoByName.go @@ -0,0 +1,40 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.getRepoByName + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoGetRepoByNameNSID = "sh.tangled.repo.getRepoByName" +) + +// RepoGetRepoByName_Output is the output of a sh.tangled.repo.getRepoByName call. +type RepoGetRepoByName_Output struct { + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + Uri string `json:"uri" cborgen:"uri"` + // value: Embedded sh.tangled.repo record. + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} + +// RepoGetRepoByName calls the XRPC method "sh.tangled.repo.getRepoByName". +// +// name: Name of the repo as it appears in its url. +// owner: DID of the account that owns the repo. +func RepoGetRepoByName(ctx context.Context, c util.LexClient, name string, owner string) (*RepoGetRepoByName_Output, error) { + var out RepoGetRepoByName_Output + + params := map[string]interface{}{} + params["name"] = name + params["owner"] = owner + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.getRepoByName", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repogetReposByRepoDids.go b/api/tangled/repogetReposByRepoDids.go new file mode 100644 index 000000000..11ed012c4 --- /dev/null +++ b/api/tangled/repogetReposByRepoDids.go @@ -0,0 +1,43 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.getReposByRepoDids + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoGetReposByRepoDidsNSID = "sh.tangled.repo.getReposByRepoDids" +) + +// RepoGetReposByRepoDids_ListItem is a "listItem" in the sh.tangled.repo.getReposByRepoDids schema. +type RepoGetReposByRepoDids_ListItem struct { + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + Uri string `json:"uri" cborgen:"uri"` + // value: sh.tangled.repo record + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} + +// RepoGetReposByRepoDids_Output is the output of a sh.tangled.repo.getReposByRepoDids call. +type RepoGetReposByRepoDids_Output struct { + Items []*RepoGetReposByRepoDids_ListItem `json:"items" cborgen:"items"` +} + +// RepoGetReposByRepoDids calls the XRPC method "sh.tangled.repo.getReposByRepoDids". +// +// dids: Repo DIDs to fetch. DIDs that resolve to none are omitted from the response. +func RepoGetReposByRepoDids(ctx context.Context, c util.LexClient, dids []string) (*RepoGetReposByRepoDids_Output, error) { + var out RepoGetReposByRepoDids_Output + + params := map[string]interface{}{} + params["dids"] = dids + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.getReposByRepoDids", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/stringgetString.go b/api/tangled/stringgetString.go new file mode 100644 index 000000000..93d67edcc --- /dev/null +++ b/api/tangled/stringgetString.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.string.getString + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + StringGetStringNSID = "sh.tangled.string.getString" +) + +// StringGetString_Output is the output of a sh.tangled.string.getString call. +type StringGetString_Output struct { + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + Uri string `json:"uri" cborgen:"uri"` + // value: Embedded sh.tangled.string record. + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} + +// StringGetString calls the XRPC method "sh.tangled.string.getString". +// +// uri: AT-URI of the sh.tangled.string record to fetch. +func StringGetString(ctx context.Context, c util.LexClient, uri string) (*StringGetString_Output, error) { + var out StringGetString_Output + + params := map[string]interface{}{} + params["uri"] = uri + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.string.getString", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/bobbin/crates/xrpc/src/lib.rs b/bobbin/crates/xrpc/src/lib.rs index 691bef4d9..f2cc747c1 100644 --- a/bobbin/crates/xrpc/src/lib.rs +++ b/bobbin/crates/xrpc/src/lib.rs @@ -773,7 +773,7 @@ struct GetPullQuery { #[derive(Debug, Deserialize)] struct GetStringQuery { - string: AtUri, + uri: AtUri, } #[derive(Debug, Deserialize)] @@ -1535,7 +1535,7 @@ async fn get_string( XrpcQuery(q): XrpcQuery, ) -> Result>>, XrpcError> { let (body, value) = - fetch::>(&state, &q.string).await?; + fetch::>(&state, &q.uri).await?; Ok(Json(Deduped(TangledStringGetRecordOutput { cid: Some(body.cid.clone()), uri: body.uri.clone(), diff --git a/lexicons/string/getString.json b/lexicons/string/getString.json index 0bfa2fee5..2145ac064 100644 --- a/lexicons/string/getString.json +++ b/lexicons/string/getString.json @@ -6,9 +6,9 @@ "type": "query", "parameters": { "type": "params", - "required": ["string"], + "required": ["uri"], "properties": { - "string": { + "uri": { "type": "string", "format": "at-uri", "description": "AT-URI of the sh.tangled.string record to fetch." diff --git a/web/src/lib/api/lexicons/types/sh/tangled/string/getString.ts b/web/src/lib/api/lexicons/types/sh/tangled/string/getString.ts index 3d1b4531d..831a553cb 100644 --- a/web/src/lib/api/lexicons/types/sh/tangled/string/getString.ts +++ b/web/src/lib/api/lexicons/types/sh/tangled/string/getString.ts @@ -7,7 +7,7 @@ const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.string.getString", { /** * AT-URI of the sh.tangled.string record to fetch. */ - string: /*#__PURE__*/ v.resourceUriString(), + uri: /*#__PURE__*/ v.resourceUriString(), }), output: { type: "lex",