···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// IdentitySignPlcOperation_Input is the input argument to a com.atproto.identity.signPlcOperation call.
···2828}
29293030// IdentitySignPlcOperation calls the XRPC method "com.atproto.identity.signPlcOperation".
3131-func IdentitySignPlcOperation(ctx context.Context, c *xrpc.Client, input *IdentitySignPlcOperation_Input) (*IdentitySignPlcOperation_Output, error) {
3131+func IdentitySignPlcOperation(ctx context.Context, c util.LexClient, input *IdentitySignPlcOperation_Input) (*IdentitySignPlcOperation_Output, error) {
3232 var out IdentitySignPlcOperation_Output
3333- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.identity.signPlcOperation", nil, input, &out); err != nil {
3333+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.identity.signPlcOperation", nil, input, &out); err != nil {
3434 return nil, err
3535 }
3636
+3-3
api/agnostic/identitysubmitPlcOperation.go
···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// IdentitySubmitPlcOperation_Input is the input argument to a com.atproto.identity.submitPlcOperation call.
···1717}
18181919// IdentitySubmitPlcOperation calls the XRPC method "com.atproto.identity.submitPlcOperation".
2020-func IdentitySubmitPlcOperation(ctx context.Context, c *xrpc.Client, input *IdentitySubmitPlcOperation_Input) error {
2121- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.identity.submitPlcOperation", nil, input, nil); err != nil {
2020+func IdentitySubmitPlcOperation(ctx context.Context, c util.LexClient, input *IdentitySubmitPlcOperation_Input) error {
2121+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.identity.submitPlcOperation", nil, input, nil); err != nil {
2222 return err
2323 }
2424
+2-3
api/agnostic/repoapplyWrites.go
···1010 "fmt"
11111212 "github.com/bluesky-social/indigo/lex/util"
1313- "github.com/bluesky-social/indigo/xrpc"
1413)
15141615// RepoApplyWrites_Create is a "create" in the com.atproto.repo.applyWrites schema.
···179178}
180179181180// RepoApplyWrites calls the XRPC method "com.atproto.repo.applyWrites".
182182-func RepoApplyWrites(ctx context.Context, c *xrpc.Client, input *RepoApplyWrites_Input) (*RepoApplyWrites_Output, error) {
181181+func RepoApplyWrites(ctx context.Context, c util.LexClient, input *RepoApplyWrites_Input) (*RepoApplyWrites_Output, error) {
183182 var out RepoApplyWrites_Output
184184- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.applyWrites", nil, input, &out); err != nil {
183183+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.repo.applyWrites", nil, input, &out); err != nil {
185184 return nil, err
186185 }
187186
+3-3
api/agnostic/repocreateRecord.go
···77import (
88 "context"
991010- "github.com/bluesky-social/indigo/xrpc"
1010+ "github.com/bluesky-social/indigo/lex/util"
1111)
12121313// RepoDefs_CommitMeta is a "commitMeta" in the com.atproto.repo.defs schema.
···4141}
42424343// RepoCreateRecord calls the XRPC method "com.atproto.repo.createRecord".
4444-func RepoCreateRecord(ctx context.Context, c *xrpc.Client, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
4444+func RepoCreateRecord(ctx context.Context, c util.LexClient, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
4545 var out RepoCreateRecord_Output
4646- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil {
4646+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil {
4747 return nil, err
4848 }
4949
+3-3
api/agnostic/repogetRecord.go
···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// RepoGetRecord_Output is the output of a com.atproto.repo.getRecord call.
···2525// collection: The NSID of the record collection.
2626// repo: The handle or DID of the repo.
2727// rkey: The Record Key.
2828-func RepoGetRecord(ctx context.Context, c *xrpc.Client, cid string, collection string, repo string, rkey string) (*RepoGetRecord_Output, error) {
2828+func RepoGetRecord(ctx context.Context, c util.LexClient, cid string, collection string, repo string, rkey string) (*RepoGetRecord_Output, error) {
2929 var out RepoGetRecord_Output
30303131 params := map[string]interface{}{
···3434 "repo": repo,
3535 "rkey": rkey,
3636 }
3737- if err := c.Do(ctx, xrpc.Query, "", "com.atproto.repo.getRecord", params, nil, &out); err != nil {
3737+ if err := c.LexDo(ctx, util.Query, "", "com.atproto.repo.getRecord", params, nil, &out); err != nil {
3838 return nil, err
3939 }
4040
+3-3
api/agnostic/repolistRecords.go
···88 "context"
99 "encoding/json"
10101111- "github.com/bluesky-social/indigo/xrpc"
1111+ "github.com/bluesky-social/indigo/lex/util"
1212)
13131414// RepoListRecords_Output is the output of a com.atproto.repo.listRecords call.
···3131// limit: The number of records to return.
3232// repo: The handle or DID of the repo.
3333// reverse: Flag to reverse the order of the returned records.
3434-func RepoListRecords(ctx context.Context, c *xrpc.Client, collection string, cursor string, limit int64, repo string, reverse bool) (*RepoListRecords_Output, error) {
3434+func RepoListRecords(ctx context.Context, c util.LexClient, collection string, cursor string, limit int64, repo string, reverse bool) (*RepoListRecords_Output, error) {
3535 var out RepoListRecords_Output
36363737 params := map[string]interface{}{
···4141 "repo": repo,
4242 "reverse": reverse,
4343 }
4444- if err := c.Do(ctx, xrpc.Query, "", "com.atproto.repo.listRecords", params, nil, &out); err != nil {
4444+ if err := c.LexDo(ctx, util.Query, "", "com.atproto.repo.listRecords", params, nil, &out); err != nil {
4545 return nil, err
4646 }
4747
+3-3
api/agnostic/repoputRecord.go
···77import (
88 "context"
991010- "github.com/bluesky-social/indigo/xrpc"
1010+ "github.com/bluesky-social/indigo/lex/util"
1111)
12121313// RepoPutRecord_Input is the input argument to a com.atproto.repo.putRecord call.
···3737}
38383939// RepoPutRecord calls the XRPC method "com.atproto.repo.putRecord".
4040-func RepoPutRecord(ctx context.Context, c *xrpc.Client, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) {
4040+func RepoPutRecord(ctx context.Context, c util.LexClient, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) {
4141 var out RepoPutRecord_Output
4242- if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil {
4242+ if err := c.LexDo(ctx, util.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil {
4343 return nil, err
4444 }
4545
+2
api/bsky/feeddefs.go
···211211type FeedDefs_ReasonRepost struct {
212212 LexiconTypeID string `json:"$type,const=app.bsky.feed.defs#reasonRepost" cborgen:"$type,const=app.bsky.feed.defs#reasonRepost"`
213213 By *ActorDefs_ProfileViewBasic `json:"by" cborgen:"by"`
214214+ Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
214215 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"`
216216+ Uri *string `json:"uri,omitempty" cborgen:"uri,omitempty"`
215217}
216218217219// FeedDefs_ReplyRef is a "replyRef" in the app.bsky.feed.defs schema.
···1919 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"`
2020 IsRead bool `json:"isRead" cborgen:"isRead"`
2121 Labels []*comatprototypes.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"`
2222- // reason: Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', 'starterpack-joined', 'verified', and 'unverified'.
2222+ // reason: The reason why this notification was delivered - e.g. your post was liked, or you received a new follower.
2323 Reason string `json:"reason" cborgen:"reason"`
2424 ReasonSubject *string `json:"reasonSubject,omitempty" cborgen:"reasonSubject,omitempty"`
2525 Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"`
···6464 // For systems with no compressed/uncompressed distinction, returns the same
6565 // value as Bytes().
6666 UncompressedBytes() []byte
6767+6868+ // Serialization as JWK struct (which can be marshalled to JSON)
6969+ JWK() (*JWK, error)
6770}
68716972var ErrInvalidSignature = errors.New("crytographic signature invalid")
+1-1
atproto/data/parse.go
···11111212func parseFloat(f float64) (int64, error) {
1313 if f != float64(int64(f)) {
1414- return 0, fmt.Errorf("number was is not a safe integer: %f", f)
1414+ return 0, fmt.Errorf("number is not a safe integer: %f", f)
1515 }
1616 return int64(f), nil
1717}
···11+package util
22+33+import (
44+ "context"
55+ "net/http"
66+)
77+88+const (
99+ Query = http.MethodGet
1010+ Procedure = http.MethodPost
1111+)
1212+1313+// API client interface used in lexgen.
1414+//
1515+// 'method' is the HTTP method type. 'inputEncoding' is the Content-Type for bodyData in Procedure calls. 'params' are query parameters. 'bodyData' should be either 'nil', an [io.Reader], or a type which can be marshalled to JSON. 'out' is optional; if not nil it should be a pointer to a type which can be un-Marshaled as JSON, for the response body.
1616+type LexClient interface {
1717+ LexDo(ctx context.Context, method string, inputEncoding string, endpoint string, params map[string]any, bodyData any, out any) error
1818+}
+10-8
xrpc/xrpc.go
···3434 return c.Client
3535}
36363737-type XRPCRequestType int
3737+var (
3838+ Query = http.MethodGet
3939+ Procedure = http.MethodPost
4040+)
38413942type AuthInfo struct {
4043 AccessJwt string `json:"accessJwt"`
···110113 Reset time.Time
111114}
112115113113-const (
114114- Query = XRPCRequestType(iota)
115115- Procedure
116116-)
117117-118116// makeParams converts a map of string keys and any values into a URL-encoded string.
119117// If a value is a slice of strings, it will be joined with commas.
120118// Generally the values will be strings, numbers, booleans, or slices of strings
···133131 return params.Encode()
134132}
135133136136-func (c *Client) Do(ctx context.Context, kind XRPCRequestType, inpenc string, method string, params map[string]interface{}, bodyobj interface{}, out interface{}) error {
134134+func (c *Client) Do(ctx context.Context, kind string, inpenc string, method string, params map[string]interface{}, bodyobj interface{}, out interface{}) error {
137135 var body io.Reader
138136 if bodyobj != nil {
139137 if rr, ok := bodyobj.(io.Reader); ok {
···155153 case Procedure:
156154 m = "POST"
157155 default:
158158- return fmt.Errorf("unsupported request kind: %d", kind)
156156+ return fmt.Errorf("unsupported request kind: %s", kind)
159157 }
160158161159 var paramStr string
···227225228226 return nil
229227}
228228+229229+func (c *Client) LexDo(ctx context.Context, method string, inputEncoding string, endpoint string, params map[string]any, bodyData any, out any) error {
230230+ return c.Do(ctx, method, inputEncoding, endpoint, params, bodyData, out)
231231+}