this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

start work on a pds implementation

+3930 -29
+53
api/atproto/accountcreate.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.account.create 11 + 12 + type AccountCreate_Input struct { 13 + Email string `json:"email"` 14 + Handle string `json:"handle"` 15 + InviteCode string `json:"inviteCode"` 16 + Password string `json:"password"` 17 + RecoveryKey string `json:"recoveryKey"` 18 + } 19 + 20 + func (t *AccountCreate_Input) MarshalJSON() ([]byte, error) { 21 + out := make(map[string]interface{}) 22 + out["email"] = t.Email 23 + out["handle"] = t.Handle 24 + out["inviteCode"] = t.InviteCode 25 + out["password"] = t.Password 26 + out["recoveryKey"] = t.RecoveryKey 27 + return json.Marshal(out) 28 + } 29 + 30 + type AccountCreate_Output struct { 31 + Handle string `json:"handle"` 32 + Did string `json:"did"` 33 + AccessJwt string `json:"accessJwt"` 34 + RefreshJwt string `json:"refreshJwt"` 35 + } 36 + 37 + func (t *AccountCreate_Output) MarshalJSON() ([]byte, error) { 38 + out := make(map[string]interface{}) 39 + out["accessJwt"] = t.AccessJwt 40 + out["did"] = t.Did 41 + out["handle"] = t.Handle 42 + out["refreshJwt"] = t.RefreshJwt 43 + return json.Marshal(out) 44 + } 45 + 46 + func AccountCreate(ctx context.Context, c *xrpc.Client, input AccountCreate_Input) (*AccountCreate_Output, error) { 47 + var out AccountCreate_Output 48 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.account.create", nil, input, &out); err != nil { 49 + return nil, err 50 + } 51 + 52 + return &out, nil 53 + }
+39
api/atproto/accountcreateInviteCode.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.account.createInviteCode 11 + 12 + type AccountCreateInviteCode_Input struct { 13 + UseCount int64 `json:"useCount"` 14 + } 15 + 16 + func (t *AccountCreateInviteCode_Input) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["useCount"] = t.UseCount 19 + return json.Marshal(out) 20 + } 21 + 22 + type AccountCreateInviteCode_Output struct { 23 + Code string `json:"code"` 24 + } 25 + 26 + func (t *AccountCreateInviteCode_Output) MarshalJSON() ([]byte, error) { 27 + out := make(map[string]interface{}) 28 + out["code"] = t.Code 29 + return json.Marshal(out) 30 + } 31 + 32 + func AccountCreateInviteCode(ctx context.Context, c *xrpc.Client, input AccountCreateInviteCode_Input) (*AccountCreateInviteCode_Output, error) { 33 + var out AccountCreateInviteCode_Output 34 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.account.createInviteCode", nil, input, &out); err != nil { 35 + return nil, err 36 + } 37 + 38 + return &out, nil 39 + }
+17
api/atproto/accountdelete.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + 6 + "github.com/whyrusleeping/gosky/xrpc" 7 + ) 8 + 9 + // schema: com.atproto.account.delete 10 + 11 + func AccountDelete(ctx context.Context, c *xrpc.Client) error { 12 + if err := c.Do(ctx, xrpc.Procedure, "", "com.atproto.account.delete", nil, nil, nil); err != nil { 13 + return err 14 + } 15 + 16 + return nil 17 + }
+17
api/atproto/accountget.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + 6 + "github.com/whyrusleeping/gosky/xrpc" 7 + ) 8 + 9 + // schema: com.atproto.account.get 10 + 11 + func AccountGet(ctx context.Context, c *xrpc.Client) error { 12 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.account.get", nil, nil, nil); err != nil { 13 + return err 14 + } 15 + 16 + return nil 17 + }
+28
api/atproto/accountrequestPasswordReset.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.account.requestPasswordReset 11 + 12 + type AccountRequestPasswordReset_Input struct { 13 + Email string `json:"email"` 14 + } 15 + 16 + func (t *AccountRequestPasswordReset_Input) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["email"] = t.Email 19 + return json.Marshal(out) 20 + } 21 + 22 + func AccountRequestPasswordReset(ctx context.Context, c *xrpc.Client, input AccountRequestPasswordReset_Input) error { 23 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.account.requestPasswordReset", nil, input, nil); err != nil { 24 + return err 25 + } 26 + 27 + return nil 28 + }
+30
api/atproto/accountresetPassword.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.account.resetPassword 11 + 12 + type AccountResetPassword_Input struct { 13 + Password string `json:"password"` 14 + Token string `json:"token"` 15 + } 16 + 17 + func (t *AccountResetPassword_Input) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["password"] = t.Password 20 + out["token"] = t.Token 21 + return json.Marshal(out) 22 + } 23 + 24 + func AccountResetPassword(ctx context.Context, c *xrpc.Client, input AccountResetPassword_Input) error { 25 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.account.resetPassword", nil, input, nil); err != nil { 26 + return err 27 + } 28 + 29 + return nil 30 + }
+33
api/atproto/handleresolve.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.handle.resolve 11 + 12 + type HandleResolve_Output struct { 13 + Did string `json:"did"` 14 + } 15 + 16 + func (t *HandleResolve_Output) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["did"] = t.Did 19 + return json.Marshal(out) 20 + } 21 + 22 + func HandleResolve(ctx context.Context, c *xrpc.Client, handle string) (*HandleResolve_Output, error) { 23 + var out HandleResolve_Output 24 + 25 + params := map[string]interface{}{ 26 + "handle": handle, 27 + } 28 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.handle.resolve", params, nil, &out); err != nil { 29 + return nil, err 30 + } 31 + 32 + return &out, nil 33 + }
+123
api/atproto/repobatchWrite.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + "fmt" 7 + 8 + "github.com/whyrusleeping/gosky/lex/util" 9 + "github.com/whyrusleeping/gosky/xrpc" 10 + ) 11 + 12 + // schema: com.atproto.repo.batchWrite 13 + 14 + type RepoBatchWrite_Delete struct { 15 + Action string `json:"action"` 16 + Collection string `json:"collection"` 17 + Rkey string `json:"rkey"` 18 + } 19 + 20 + func (t *RepoBatchWrite_Delete) MarshalJSON() ([]byte, error) { 21 + t.Action = "delete" 22 + out := make(map[string]interface{}) 23 + out["action"] = t.Action 24 + out["collection"] = t.Collection 25 + out["rkey"] = t.Rkey 26 + return json.Marshal(out) 27 + } 28 + 29 + type RepoBatchWrite_Input struct { 30 + Did string `json:"did"` 31 + Validate bool `json:"validate"` 32 + Writes []*RepoBatchWrite_Input_Writes_Elem `json:"writes"` 33 + } 34 + 35 + func (t *RepoBatchWrite_Input) MarshalJSON() ([]byte, error) { 36 + out := make(map[string]interface{}) 37 + out["did"] = t.Did 38 + out["validate"] = t.Validate 39 + out["writes"] = t.Writes 40 + return json.Marshal(out) 41 + } 42 + 43 + type RepoBatchWrite_Input_Writes_Elem struct { 44 + RepoBatchWrite_Create *RepoBatchWrite_Create 45 + RepoBatchWrite_Update *RepoBatchWrite_Update 46 + RepoBatchWrite_Delete *RepoBatchWrite_Delete 47 + } 48 + 49 + func (t *RepoBatchWrite_Input_Writes_Elem) MarshalJSON() ([]byte, error) { 50 + if t.RepoBatchWrite_Create != nil { 51 + return json.Marshal(t.RepoBatchWrite_Create) 52 + } 53 + if t.RepoBatchWrite_Update != nil { 54 + return json.Marshal(t.RepoBatchWrite_Update) 55 + } 56 + if t.RepoBatchWrite_Delete != nil { 57 + return json.Marshal(t.RepoBatchWrite_Delete) 58 + } 59 + return nil, fmt.Errorf("cannot marshal empty enum") 60 + } 61 + func (t *RepoBatchWrite_Input_Writes_Elem) UnmarshalJSON(b []byte) error { 62 + typ, err := util.EnumTypeExtract(b) 63 + if err != nil { 64 + return err 65 + } 66 + 67 + switch typ { 68 + case "com.atproto.repo.batchWrite#create": 69 + t.RepoBatchWrite_Create = new(RepoBatchWrite_Create) 70 + return json.Unmarshal(b, t.RepoBatchWrite_Create) 71 + case "com.atproto.repo.batchWrite#update": 72 + t.RepoBatchWrite_Update = new(RepoBatchWrite_Update) 73 + return json.Unmarshal(b, t.RepoBatchWrite_Update) 74 + case "com.atproto.repo.batchWrite#delete": 75 + t.RepoBatchWrite_Delete = new(RepoBatchWrite_Delete) 76 + return json.Unmarshal(b, t.RepoBatchWrite_Delete) 77 + 78 + default: 79 + return fmt.Errorf("closed enums must have a matching value") 80 + } 81 + } 82 + 83 + type RepoBatchWrite_Create struct { 84 + Action string `json:"action"` 85 + Collection string `json:"collection"` 86 + Rkey string `json:"rkey"` 87 + Value any `json:"value"` 88 + } 89 + 90 + func (t *RepoBatchWrite_Create) MarshalJSON() ([]byte, error) { 91 + t.Action = "create" 92 + out := make(map[string]interface{}) 93 + out["action"] = t.Action 94 + out["collection"] = t.Collection 95 + out["rkey"] = t.Rkey 96 + out["value"] = t.Value 97 + return json.Marshal(out) 98 + } 99 + 100 + type RepoBatchWrite_Update struct { 101 + Action string `json:"action"` 102 + Collection string `json:"collection"` 103 + Rkey string `json:"rkey"` 104 + Value any `json:"value"` 105 + } 106 + 107 + func (t *RepoBatchWrite_Update) MarshalJSON() ([]byte, error) { 108 + t.Action = "update" 109 + out := make(map[string]interface{}) 110 + out["action"] = t.Action 111 + out["collection"] = t.Collection 112 + out["rkey"] = t.Rkey 113 + out["value"] = t.Value 114 + return json.Marshal(out) 115 + } 116 + 117 + func RepoBatchWrite(ctx context.Context, c *xrpc.Client, input RepoBatchWrite_Input) error { 118 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.batchWrite", nil, input, nil); err != nil { 119 + return err 120 + } 121 + 122 + return nil 123 + }
+47
api/atproto/repocreateRecord.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.repo.createRecord 11 + 12 + type RepoCreateRecord_Input struct { 13 + Did string `json:"did"` 14 + Collection string `json:"collection"` 15 + Validate bool `json:"validate"` 16 + Record any `json:"record"` 17 + } 18 + 19 + func (t *RepoCreateRecord_Input) MarshalJSON() ([]byte, error) { 20 + out := make(map[string]interface{}) 21 + out["collection"] = t.Collection 22 + out["did"] = t.Did 23 + out["record"] = t.Record 24 + out["validate"] = t.Validate 25 + return json.Marshal(out) 26 + } 27 + 28 + type RepoCreateRecord_Output struct { 29 + Uri string `json:"uri"` 30 + Cid string `json:"cid"` 31 + } 32 + 33 + func (t *RepoCreateRecord_Output) MarshalJSON() ([]byte, error) { 34 + out := make(map[string]interface{}) 35 + out["cid"] = t.Cid 36 + out["uri"] = t.Uri 37 + return json.Marshal(out) 38 + } 39 + 40 + func RepoCreateRecord(ctx context.Context, c *xrpc.Client, input RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) { 41 + var out RepoCreateRecord_Output 42 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.createRecord", nil, input, &out); err != nil { 43 + return nil, err 44 + } 45 + 46 + return &out, nil 47 + }
+32
api/atproto/repodeleteRecord.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.repo.deleteRecord 11 + 12 + type RepoDeleteRecord_Input struct { 13 + Rkey string `json:"rkey"` 14 + Did string `json:"did"` 15 + Collection string `json:"collection"` 16 + } 17 + 18 + func (t *RepoDeleteRecord_Input) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["collection"] = t.Collection 21 + out["did"] = t.Did 22 + out["rkey"] = t.Rkey 23 + return json.Marshal(out) 24 + } 25 + 26 + func RepoDeleteRecord(ctx context.Context, c *xrpc.Client, input RepoDeleteRecord_Input) error { 27 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.deleteRecord", nil, input, nil); err != nil { 28 + return err 29 + } 30 + 31 + return nil 32 + }
+41
api/atproto/repodescribe.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.repo.describe 11 + 12 + type RepoDescribe_Output struct { 13 + Handle string `json:"handle"` 14 + Did string `json:"did"` 15 + DidDoc any `json:"didDoc"` 16 + Collections []string `json:"collections"` 17 + HandleIsCorrect bool `json:"handleIsCorrect"` 18 + } 19 + 20 + func (t *RepoDescribe_Output) MarshalJSON() ([]byte, error) { 21 + out := make(map[string]interface{}) 22 + out["collections"] = t.Collections 23 + out["did"] = t.Did 24 + out["didDoc"] = t.DidDoc 25 + out["handle"] = t.Handle 26 + out["handleIsCorrect"] = t.HandleIsCorrect 27 + return json.Marshal(out) 28 + } 29 + 30 + func RepoDescribe(ctx context.Context, c *xrpc.Client, user string) (*RepoDescribe_Output, error) { 31 + var out RepoDescribe_Output 32 + 33 + params := map[string]interface{}{ 34 + "user": user, 35 + } 36 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.repo.describe", params, nil, &out); err != nil { 37 + return nil, err 38 + } 39 + 40 + return &out, nil 41 + }
+40
api/atproto/repogetRecord.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.repo.getRecord 11 + 12 + type RepoGetRecord_Output struct { 13 + Uri string `json:"uri"` 14 + Cid string `json:"cid"` 15 + Value any `json:"value"` 16 + } 17 + 18 + func (t *RepoGetRecord_Output) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["cid"] = t.Cid 21 + out["uri"] = t.Uri 22 + out["value"] = t.Value 23 + return json.Marshal(out) 24 + } 25 + 26 + func RepoGetRecord(ctx context.Context, c *xrpc.Client, cid string, collection string, rkey string, user string) (*RepoGetRecord_Output, error) { 27 + var out RepoGetRecord_Output 28 + 29 + params := map[string]interface{}{ 30 + "cid": cid, 31 + "collection": collection, 32 + "rkey": rkey, 33 + "user": user, 34 + } 35 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.repo.getRecord", params, nil, &out); err != nil { 36 + return nil, err 37 + } 38 + 39 + return &out, nil 40 + }
+54
api/atproto/repolistRecords.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.repo.listRecords 11 + 12 + type RepoListRecords_Output struct { 13 + Cursor string `json:"cursor"` 14 + Records []*RepoListRecords_Record `json:"records"` 15 + } 16 + 17 + func (t *RepoListRecords_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["cursor"] = t.Cursor 20 + out["records"] = t.Records 21 + return json.Marshal(out) 22 + } 23 + 24 + type RepoListRecords_Record struct { 25 + Uri string `json:"uri"` 26 + Cid string `json:"cid"` 27 + Value any `json:"value"` 28 + } 29 + 30 + func (t *RepoListRecords_Record) MarshalJSON() ([]byte, error) { 31 + out := make(map[string]interface{}) 32 + out["cid"] = t.Cid 33 + out["uri"] = t.Uri 34 + out["value"] = t.Value 35 + return json.Marshal(out) 36 + } 37 + 38 + func RepoListRecords(ctx context.Context, c *xrpc.Client, after string, before string, collection string, limit int64, reverse bool, user string) (*RepoListRecords_Output, error) { 39 + var out RepoListRecords_Output 40 + 41 + params := map[string]interface{}{ 42 + "after": after, 43 + "before": before, 44 + "collection": collection, 45 + "limit": limit, 46 + "reverse": reverse, 47 + "user": user, 48 + } 49 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.repo.listRecords", params, nil, &out); err != nil { 50 + return nil, err 51 + } 52 + 53 + return &out, nil 54 + }
+49
api/atproto/repoputRecord.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.repo.putRecord 11 + 12 + type RepoPutRecord_Input struct { 13 + Did string `json:"did"` 14 + Collection string `json:"collection"` 15 + Rkey string `json:"rkey"` 16 + Validate bool `json:"validate"` 17 + Record any `json:"record"` 18 + } 19 + 20 + func (t *RepoPutRecord_Input) MarshalJSON() ([]byte, error) { 21 + out := make(map[string]interface{}) 22 + out["collection"] = t.Collection 23 + out["did"] = t.Did 24 + out["record"] = t.Record 25 + out["rkey"] = t.Rkey 26 + out["validate"] = t.Validate 27 + return json.Marshal(out) 28 + } 29 + 30 + type RepoPutRecord_Output struct { 31 + Uri string `json:"uri"` 32 + Cid string `json:"cid"` 33 + } 34 + 35 + func (t *RepoPutRecord_Output) MarshalJSON() ([]byte, error) { 36 + out := make(map[string]interface{}) 37 + out["cid"] = t.Cid 38 + out["uri"] = t.Uri 39 + return json.Marshal(out) 40 + } 41 + 42 + func RepoPutRecord(ctx context.Context, c *xrpc.Client, input RepoPutRecord_Input) (*RepoPutRecord_Output, error) { 43 + var out RepoPutRecord_Output 44 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.putRecord", nil, input, &out); err != nil { 45 + return nil, err 46 + } 47 + 48 + return &out, nil 49 + }
+19
api/atproto/repostrongRef.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + ) 6 + 7 + // schema: com.atproto.repo.strongRef 8 + 9 + type RepoStrongRef struct { 10 + Uri string `json:"uri"` 11 + Cid string `json:"cid"` 12 + } 13 + 14 + func (t *RepoStrongRef) MarshalJSON() ([]byte, error) { 15 + out := make(map[string]interface{}) 16 + out["cid"] = t.Cid 17 + out["uri"] = t.Uri 18 + return json.Marshal(out) 19 + }
+31
api/atproto/servergetAccountsConfig.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.server.getAccountsConfig 11 + 12 + type ServerGetAccountsConfig_Output struct { 13 + InviteCodeRequired bool `json:"inviteCodeRequired"` 14 + AvailableUserDomains []string `json:"availableUserDomains"` 15 + } 16 + 17 + func (t *ServerGetAccountsConfig_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["availableUserDomains"] = t.AvailableUserDomains 20 + out["inviteCodeRequired"] = t.InviteCodeRequired 21 + return json.Marshal(out) 22 + } 23 + 24 + func ServerGetAccountsConfig(ctx context.Context, c *xrpc.Client) (*ServerGetAccountsConfig_Output, error) { 25 + var out ServerGetAccountsConfig_Output 26 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.server.getAccountsConfig", nil, nil, &out); err != nil { 27 + return nil, err 28 + } 29 + 30 + return &out, nil 31 + }
+47
api/atproto/sessioncreate.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.session.create 11 + 12 + type SessionCreate_Input struct { 13 + Handle string `json:"handle"` 14 + Password string `json:"password"` 15 + } 16 + 17 + func (t *SessionCreate_Input) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["handle"] = t.Handle 20 + out["password"] = t.Password 21 + return json.Marshal(out) 22 + } 23 + 24 + type SessionCreate_Output struct { 25 + AccessJwt string `json:"accessJwt"` 26 + RefreshJwt string `json:"refreshJwt"` 27 + Handle string `json:"handle"` 28 + Did string `json:"did"` 29 + } 30 + 31 + func (t *SessionCreate_Output) MarshalJSON() ([]byte, error) { 32 + out := make(map[string]interface{}) 33 + out["accessJwt"] = t.AccessJwt 34 + out["did"] = t.Did 35 + out["handle"] = t.Handle 36 + out["refreshJwt"] = t.RefreshJwt 37 + return json.Marshal(out) 38 + } 39 + 40 + func SessionCreate(ctx context.Context, c *xrpc.Client, input SessionCreate_Input) (*SessionCreate_Output, error) { 41 + var out SessionCreate_Output 42 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.session.create", nil, input, &out); err != nil { 43 + return nil, err 44 + } 45 + 46 + return &out, nil 47 + }
+17
api/atproto/sessiondelete.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + 6 + "github.com/whyrusleeping/gosky/xrpc" 7 + ) 8 + 9 + // schema: com.atproto.session.delete 10 + 11 + func SessionDelete(ctx context.Context, c *xrpc.Client) error { 12 + if err := c.Do(ctx, xrpc.Procedure, "", "com.atproto.session.delete", nil, nil, nil); err != nil { 13 + return err 14 + } 15 + 16 + return nil 17 + }
+31
api/atproto/sessionget.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.session.get 11 + 12 + type SessionGet_Output struct { 13 + Handle string `json:"handle"` 14 + Did string `json:"did"` 15 + } 16 + 17 + func (t *SessionGet_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["did"] = t.Did 20 + out["handle"] = t.Handle 21 + return json.Marshal(out) 22 + } 23 + 24 + func SessionGet(ctx context.Context, c *xrpc.Client) (*SessionGet_Output, error) { 25 + var out SessionGet_Output 26 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.session.get", nil, nil, &out); err != nil { 27 + return nil, err 28 + } 29 + 30 + return &out, nil 31 + }
+35
api/atproto/sessionrefresh.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.session.refresh 11 + 12 + type SessionRefresh_Output struct { 13 + AccessJwt string `json:"accessJwt"` 14 + RefreshJwt string `json:"refreshJwt"` 15 + Handle string `json:"handle"` 16 + Did string `json:"did"` 17 + } 18 + 19 + func (t *SessionRefresh_Output) MarshalJSON() ([]byte, error) { 20 + out := make(map[string]interface{}) 21 + out["accessJwt"] = t.AccessJwt 22 + out["did"] = t.Did 23 + out["handle"] = t.Handle 24 + out["refreshJwt"] = t.RefreshJwt 25 + return json.Marshal(out) 26 + } 27 + 28 + func SessionRefresh(ctx context.Context, c *xrpc.Client) (*SessionRefresh_Output, error) { 29 + var out SessionRefresh_Output 30 + if err := c.Do(ctx, xrpc.Procedure, "", "com.atproto.session.refresh", nil, nil, &out); err != nil { 31 + return nil, err 32 + } 33 + 34 + return &out, nil 35 + }
+24
api/atproto/syncgetRepo.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "bytes" 5 + "context" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.sync.getRepo 11 + 12 + func SyncGetRepo(ctx context.Context, c *xrpc.Client, did string, from string) ([]byte, error) { 13 + buf := new(bytes.Buffer) 14 + 15 + params := map[string]interface{}{ 16 + "did": did, 17 + "from": from, 18 + } 19 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.sync.getRepo", params, nil, buf); err != nil { 20 + return nil, err 21 + } 22 + 23 + return buf.Bytes(), nil 24 + }
+33
api/atproto/syncgetRoot.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.sync.getRoot 11 + 12 + type SyncGetRoot_Output struct { 13 + Root string `json:"root"` 14 + } 15 + 16 + func (t *SyncGetRoot_Output) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["root"] = t.Root 19 + return json.Marshal(out) 20 + } 21 + 22 + func SyncGetRoot(ctx context.Context, c *xrpc.Client, did string) (*SyncGetRoot_Output, error) { 23 + var out SyncGetRoot_Output 24 + 25 + params := map[string]interface{}{ 26 + "did": did, 27 + } 28 + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.sync.getRoot", params, nil, &out); err != nil { 29 + return nil, err 30 + } 31 + 32 + return &out, nil 33 + }
+22
api/atproto/syncupdateRepo.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "io" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: com.atproto.sync.updateRepo 11 + 12 + func SyncUpdateRepo(ctx context.Context, c *xrpc.Client, input io.Reader, did string) error { 13 + 14 + params := map[string]interface{}{ 15 + "did": did, 16 + } 17 + if err := c.Do(ctx, xrpc.Procedure, "application/cbor", "com.atproto.sync.updateRepo", params, input, nil); err != nil { 18 + return err 19 + } 20 + 21 + return nil 22 + }
+45
api/bsky/actorcreateScene.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.actor.createScene 11 + 12 + type ActorCreateScene_Input struct { 13 + Handle string `json:"handle"` 14 + RecoveryKey string `json:"recoveryKey"` 15 + } 16 + 17 + func (t *ActorCreateScene_Input) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["handle"] = t.Handle 20 + out["recoveryKey"] = t.RecoveryKey 21 + return json.Marshal(out) 22 + } 23 + 24 + type ActorCreateScene_Output struct { 25 + Handle string `json:"handle"` 26 + Did string `json:"did"` 27 + Declaration *SystemDeclRef `json:"declaration"` 28 + } 29 + 30 + func (t *ActorCreateScene_Output) MarshalJSON() ([]byte, error) { 31 + out := make(map[string]interface{}) 32 + out["declaration"] = t.Declaration 33 + out["did"] = t.Did 34 + out["handle"] = t.Handle 35 + return json.Marshal(out) 36 + } 37 + 38 + func ActorCreateScene(ctx context.Context, c *xrpc.Client, input ActorCreateScene_Input) (*ActorCreateScene_Output, error) { 39 + var out ActorCreateScene_Output 40 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "app.bsky.actor.createScene", nil, input, &out); err != nil { 41 + return nil, err 42 + } 43 + 44 + return &out, nil 45 + }
+65
api/bsky/actorgetProfile.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.actor.getProfile 11 + 12 + type ActorGetProfile_Output struct { 13 + Did string `json:"did"` 14 + Declaration *SystemDeclRef `json:"declaration"` 15 + Handle string `json:"handle"` 16 + DisplayName string `json:"displayName"` 17 + FollowersCount int64 `json:"followersCount"` 18 + MembersCount int64 `json:"membersCount"` 19 + PostsCount int64 `json:"postsCount"` 20 + Creator string `json:"creator"` 21 + Description string `json:"description"` 22 + FollowsCount int64 `json:"followsCount"` 23 + MyState *ActorGetProfile_MyState `json:"myState"` 24 + } 25 + 26 + func (t *ActorGetProfile_Output) MarshalJSON() ([]byte, error) { 27 + out := make(map[string]interface{}) 28 + out["creator"] = t.Creator 29 + out["declaration"] = t.Declaration 30 + out["description"] = t.Description 31 + out["did"] = t.Did 32 + out["displayName"] = t.DisplayName 33 + out["followersCount"] = t.FollowersCount 34 + out["followsCount"] = t.FollowsCount 35 + out["handle"] = t.Handle 36 + out["membersCount"] = t.MembersCount 37 + out["myState"] = t.MyState 38 + out["postsCount"] = t.PostsCount 39 + return json.Marshal(out) 40 + } 41 + 42 + type ActorGetProfile_MyState struct { 43 + Follow string `json:"follow"` 44 + Member string `json:"member"` 45 + } 46 + 47 + func (t *ActorGetProfile_MyState) MarshalJSON() ([]byte, error) { 48 + out := make(map[string]interface{}) 49 + out["follow"] = t.Follow 50 + out["member"] = t.Member 51 + return json.Marshal(out) 52 + } 53 + 54 + func ActorGetProfile(ctx context.Context, c *xrpc.Client, actor string) (*ActorGetProfile_Output, error) { 55 + var out ActorGetProfile_Output 56 + 57 + params := map[string]interface{}{ 58 + "actor": actor, 59 + } 60 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.actor.getProfile", params, nil, &out); err != nil { 61 + return nil, err 62 + } 63 + 64 + return &out, nil 65 + }
+68
api/bsky/actorgetSuggestions.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.actor.getSuggestions 11 + 12 + type ActorGetSuggestions_Output struct { 13 + Cursor string `json:"cursor"` 14 + Actors []*ActorGetSuggestions_Actor `json:"actors"` 15 + } 16 + 17 + func (t *ActorGetSuggestions_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["actors"] = t.Actors 20 + out["cursor"] = t.Cursor 21 + return json.Marshal(out) 22 + } 23 + 24 + type ActorGetSuggestions_Actor struct { 25 + MyState *ActorGetSuggestions_MyState `json:"myState"` 26 + Did string `json:"did"` 27 + Declaration *SystemDeclRef `json:"declaration"` 28 + Handle string `json:"handle"` 29 + DisplayName string `json:"displayName"` 30 + Description string `json:"description"` 31 + IndexedAt string `json:"indexedAt"` 32 + } 33 + 34 + func (t *ActorGetSuggestions_Actor) MarshalJSON() ([]byte, error) { 35 + out := make(map[string]interface{}) 36 + out["declaration"] = t.Declaration 37 + out["description"] = t.Description 38 + out["did"] = t.Did 39 + out["displayName"] = t.DisplayName 40 + out["handle"] = t.Handle 41 + out["indexedAt"] = t.IndexedAt 42 + out["myState"] = t.MyState 43 + return json.Marshal(out) 44 + } 45 + 46 + type ActorGetSuggestions_MyState struct { 47 + Follow string `json:"follow"` 48 + } 49 + 50 + func (t *ActorGetSuggestions_MyState) MarshalJSON() ([]byte, error) { 51 + out := make(map[string]interface{}) 52 + out["follow"] = t.Follow 53 + return json.Marshal(out) 54 + } 55 + 56 + func ActorGetSuggestions(ctx context.Context, c *xrpc.Client, cursor string, limit int64) (*ActorGetSuggestions_Output, error) { 57 + var out ActorGetSuggestions_Output 58 + 59 + params := map[string]interface{}{ 60 + "cursor": cursor, 61 + "limit": limit, 62 + } 63 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.actor.getSuggestions", params, nil, &out); err != nil { 64 + return nil, err 65 + } 66 + 67 + return &out, nil 68 + }
+19
api/bsky/actorprofile.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + ) 6 + 7 + // schema: app.bsky.actor.profile 8 + 9 + type ActorProfile struct { 10 + DisplayName string `json:"displayName"` 11 + Description string `json:"description"` 12 + } 13 + 14 + func (t *ActorProfile) MarshalJSON() ([]byte, error) { 15 + out := make(map[string]interface{}) 16 + out["description"] = t.Description 17 + out["displayName"] = t.DisplayName 18 + return json.Marshal(out) 19 + }
+35
api/bsky/actorref.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + ) 6 + 7 + // schema: app.bsky.actor.ref 8 + 9 + type ActorRef struct { 10 + Did string `json:"did"` 11 + DeclarationCid string `json:"declarationCid"` 12 + } 13 + 14 + func (t *ActorRef) MarshalJSON() ([]byte, error) { 15 + out := make(map[string]interface{}) 16 + out["declarationCid"] = t.DeclarationCid 17 + out["did"] = t.Did 18 + return json.Marshal(out) 19 + } 20 + 21 + type ActorRef_WithInfo struct { 22 + Did string `json:"did"` 23 + Declaration *SystemDeclRef `json:"declaration"` 24 + Handle string `json:"handle"` 25 + DisplayName string `json:"displayName"` 26 + } 27 + 28 + func (t *ActorRef_WithInfo) MarshalJSON() ([]byte, error) { 29 + out := make(map[string]interface{}) 30 + out["declaration"] = t.Declaration 31 + out["did"] = t.Did 32 + out["displayName"] = t.DisplayName 33 + out["handle"] = t.Handle 34 + return json.Marshal(out) 35 + }
+57
api/bsky/actorsearch.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.actor.search 11 + 12 + type ActorSearch_Output struct { 13 + Cursor string `json:"cursor"` 14 + Users []*ActorSearch_User `json:"users"` 15 + } 16 + 17 + func (t *ActorSearch_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["cursor"] = t.Cursor 20 + out["users"] = t.Users 21 + return json.Marshal(out) 22 + } 23 + 24 + type ActorSearch_User struct { 25 + Did string `json:"did"` 26 + Declaration *SystemDeclRef `json:"declaration"` 27 + Handle string `json:"handle"` 28 + DisplayName string `json:"displayName"` 29 + Description string `json:"description"` 30 + IndexedAt string `json:"indexedAt"` 31 + } 32 + 33 + func (t *ActorSearch_User) MarshalJSON() ([]byte, error) { 34 + out := make(map[string]interface{}) 35 + out["declaration"] = t.Declaration 36 + out["description"] = t.Description 37 + out["did"] = t.Did 38 + out["displayName"] = t.DisplayName 39 + out["handle"] = t.Handle 40 + out["indexedAt"] = t.IndexedAt 41 + return json.Marshal(out) 42 + } 43 + 44 + func ActorSearch(ctx context.Context, c *xrpc.Client, before string, limit int64, term string) (*ActorSearch_Output, error) { 45 + var out ActorSearch_Output 46 + 47 + params := map[string]interface{}{ 48 + "before": before, 49 + "limit": limit, 50 + "term": term, 51 + } 52 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.actor.search", params, nil, &out); err != nil { 53 + return nil, err 54 + } 55 + 56 + return &out, nil 57 + }
+50
api/bsky/actorsearchTypeahead.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.actor.searchTypeahead 11 + 12 + type ActorSearchTypeahead_Output struct { 13 + Users []*ActorSearchTypeahead_User `json:"users"` 14 + } 15 + 16 + func (t *ActorSearchTypeahead_Output) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["users"] = t.Users 19 + return json.Marshal(out) 20 + } 21 + 22 + type ActorSearchTypeahead_User struct { 23 + Did string `json:"did"` 24 + Declaration *SystemDeclRef `json:"declaration"` 25 + Handle string `json:"handle"` 26 + DisplayName string `json:"displayName"` 27 + } 28 + 29 + func (t *ActorSearchTypeahead_User) MarshalJSON() ([]byte, error) { 30 + out := make(map[string]interface{}) 31 + out["declaration"] = t.Declaration 32 + out["did"] = t.Did 33 + out["displayName"] = t.DisplayName 34 + out["handle"] = t.Handle 35 + return json.Marshal(out) 36 + } 37 + 38 + func ActorSearchTypeahead(ctx context.Context, c *xrpc.Client, limit int64, term string) (*ActorSearchTypeahead_Output, error) { 39 + var out ActorSearchTypeahead_Output 40 + 41 + params := map[string]interface{}{ 42 + "limit": limit, 43 + "term": term, 44 + } 45 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.actor.searchTypeahead", params, nil, &out); err != nil { 46 + return nil, err 47 + } 48 + 49 + return &out, nil 50 + }
+47
api/bsky/actorupdateProfile.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.actor.updateProfile 11 + 12 + type ActorUpdateProfile_Input struct { 13 + Did string `json:"did"` 14 + DisplayName string `json:"displayName"` 15 + Description string `json:"description"` 16 + } 17 + 18 + func (t *ActorUpdateProfile_Input) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["description"] = t.Description 21 + out["did"] = t.Did 22 + out["displayName"] = t.DisplayName 23 + return json.Marshal(out) 24 + } 25 + 26 + type ActorUpdateProfile_Output struct { 27 + Uri string `json:"uri"` 28 + Cid string `json:"cid"` 29 + Record any `json:"record"` 30 + } 31 + 32 + func (t *ActorUpdateProfile_Output) MarshalJSON() ([]byte, error) { 33 + out := make(map[string]interface{}) 34 + out["cid"] = t.Cid 35 + out["record"] = t.Record 36 + out["uri"] = t.Uri 37 + return json.Marshal(out) 38 + } 39 + 40 + func ActorUpdateProfile(ctx context.Context, c *xrpc.Client, input ActorUpdateProfile_Input) (*ActorUpdateProfile_Output, error) { 41 + var out ActorUpdateProfile_Output 42 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "app.bsky.actor.updateProfile", nil, input, &out); err != nil { 43 + return nil, err 44 + } 45 + 46 + return &out, nil 47 + }
+108
api/bsky/feedembed.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + "fmt" 6 + 7 + "github.com/whyrusleeping/gosky/lex/util" 8 + ) 9 + 10 + // schema: app.bsky.feed.embed 11 + 12 + type FeedEmbed struct { 13 + Items []*FeedEmbed_Items_Elem `json:"items"` 14 + } 15 + 16 + func (t *FeedEmbed) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["items"] = t.Items 19 + return json.Marshal(out) 20 + } 21 + 22 + type FeedEmbed_Items_Elem struct { 23 + FeedEmbed_Media *FeedEmbed_Media 24 + FeedEmbed_Record *FeedEmbed_Record 25 + FeedEmbed_External *FeedEmbed_External 26 + } 27 + 28 + func (t *FeedEmbed_Items_Elem) MarshalJSON() ([]byte, error) { 29 + if t.FeedEmbed_Media != nil { 30 + return json.Marshal(t.FeedEmbed_Media) 31 + } 32 + if t.FeedEmbed_Record != nil { 33 + return json.Marshal(t.FeedEmbed_Record) 34 + } 35 + if t.FeedEmbed_External != nil { 36 + return json.Marshal(t.FeedEmbed_External) 37 + } 38 + return nil, fmt.Errorf("cannot marshal empty enum") 39 + } 40 + func (t *FeedEmbed_Items_Elem) UnmarshalJSON(b []byte) error { 41 + typ, err := util.EnumTypeExtract(b) 42 + if err != nil { 43 + return err 44 + } 45 + 46 + switch typ { 47 + case "app.bsky.feed.embed#media": 48 + t.FeedEmbed_Media = new(FeedEmbed_Media) 49 + return json.Unmarshal(b, t.FeedEmbed_Media) 50 + case "app.bsky.feed.embed#record": 51 + t.FeedEmbed_Record = new(FeedEmbed_Record) 52 + return json.Unmarshal(b, t.FeedEmbed_Record) 53 + case "app.bsky.feed.embed#external": 54 + t.FeedEmbed_External = new(FeedEmbed_External) 55 + return json.Unmarshal(b, t.FeedEmbed_External) 56 + 57 + default: 58 + return nil 59 + } 60 + } 61 + 62 + type FeedEmbed_Media struct { 63 + Alt string `json:"alt"` 64 + Thumb *util.Blob `json:"thumb"` 65 + Original *util.Blob `json:"original"` 66 + } 67 + 68 + func (t *FeedEmbed_Media) MarshalJSON() ([]byte, error) { 69 + out := make(map[string]interface{}) 70 + out["alt"] = t.Alt 71 + out["original"] = t.Original 72 + out["thumb"] = t.Thumb 73 + return json.Marshal(out) 74 + } 75 + 76 + type FeedEmbed_Record struct { 77 + Type string `json:"type"` 78 + Author *ActorRef_WithInfo `json:"author"` 79 + Record any `json:"record"` 80 + } 81 + 82 + func (t *FeedEmbed_Record) MarshalJSON() ([]byte, error) { 83 + t.Type = "record" 84 + out := make(map[string]interface{}) 85 + out["author"] = t.Author 86 + out["record"] = t.Record 87 + out["type"] = t.Type 88 + return json.Marshal(out) 89 + } 90 + 91 + type FeedEmbed_External struct { 92 + Type string `json:"type"` 93 + Uri string `json:"uri"` 94 + Title string `json:"title"` 95 + Description string `json:"description"` 96 + ImageUri string `json:"imageUri"` 97 + } 98 + 99 + func (t *FeedEmbed_External) MarshalJSON() ([]byte, error) { 100 + t.Type = "external" 101 + out := make(map[string]interface{}) 102 + out["description"] = t.Description 103 + out["imageUri"] = t.ImageUri 104 + out["title"] = t.Title 105 + out["type"] = t.Type 106 + out["uri"] = t.Uri 107 + return json.Marshal(out) 108 + }
+85
api/bsky/feedgetAuthorFeed.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.feed.getAuthorFeed 11 + 12 + type FeedGetAuthorFeed_Output struct { 13 + Cursor string `json:"cursor"` 14 + Feed []*FeedGetAuthorFeed_FeedItem `json:"feed"` 15 + } 16 + 17 + func (t *FeedGetAuthorFeed_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["cursor"] = t.Cursor 20 + out["feed"] = t.Feed 21 + return json.Marshal(out) 22 + } 23 + 24 + type FeedGetAuthorFeed_FeedItem struct { 25 + IndexedAt string `json:"indexedAt"` 26 + Cid string `json:"cid"` 27 + TrendedBy *ActorRef_WithInfo `json:"trendedBy"` 28 + Record any `json:"record"` 29 + ReplyCount int64 `json:"replyCount"` 30 + RepostCount int64 `json:"repostCount"` 31 + UpvoteCount int64 `json:"upvoteCount"` 32 + DownvoteCount int64 `json:"downvoteCount"` 33 + MyState *FeedGetAuthorFeed_MyState `json:"myState"` 34 + Uri string `json:"uri"` 35 + Author *ActorRef_WithInfo `json:"author"` 36 + RepostedBy *ActorRef_WithInfo `json:"repostedBy"` 37 + Embed *FeedEmbed `json:"embed"` 38 + } 39 + 40 + func (t *FeedGetAuthorFeed_FeedItem) MarshalJSON() ([]byte, error) { 41 + out := make(map[string]interface{}) 42 + out["author"] = t.Author 43 + out["cid"] = t.Cid 44 + out["downvoteCount"] = t.DownvoteCount 45 + out["embed"] = t.Embed 46 + out["indexedAt"] = t.IndexedAt 47 + out["myState"] = t.MyState 48 + out["record"] = t.Record 49 + out["replyCount"] = t.ReplyCount 50 + out["repostCount"] = t.RepostCount 51 + out["repostedBy"] = t.RepostedBy 52 + out["trendedBy"] = t.TrendedBy 53 + out["upvoteCount"] = t.UpvoteCount 54 + out["uri"] = t.Uri 55 + return json.Marshal(out) 56 + } 57 + 58 + type FeedGetAuthorFeed_MyState struct { 59 + Downvote string `json:"downvote"` 60 + Repost string `json:"repost"` 61 + Upvote string `json:"upvote"` 62 + } 63 + 64 + func (t *FeedGetAuthorFeed_MyState) MarshalJSON() ([]byte, error) { 65 + out := make(map[string]interface{}) 66 + out["downvote"] = t.Downvote 67 + out["repost"] = t.Repost 68 + out["upvote"] = t.Upvote 69 + return json.Marshal(out) 70 + } 71 + 72 + func FeedGetAuthorFeed(ctx context.Context, c *xrpc.Client, author string, before string, limit int64) (*FeedGetAuthorFeed_Output, error) { 73 + var out FeedGetAuthorFeed_Output 74 + 75 + params := map[string]interface{}{ 76 + "author": author, 77 + "before": before, 78 + "limit": limit, 79 + } 80 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.feed.getAuthorFeed", params, nil, &out); err != nil { 81 + return nil, err 82 + } 83 + 84 + return &out, nil 85 + }
+196
api/bsky/feedgetPostThread.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + "fmt" 7 + 8 + "github.com/whyrusleeping/gosky/lex/util" 9 + "github.com/whyrusleeping/gosky/xrpc" 10 + ) 11 + 12 + // schema: app.bsky.feed.getPostThread 13 + 14 + type FeedGetPostThread_NotFoundPost struct { 15 + Uri string `json:"uri"` 16 + NotFound bool `json:"notFound"` 17 + } 18 + 19 + func (t *FeedGetPostThread_NotFoundPost) MarshalJSON() ([]byte, error) { 20 + t.NotFound = true 21 + out := make(map[string]interface{}) 22 + out["notFound"] = t.NotFound 23 + out["uri"] = t.Uri 24 + return json.Marshal(out) 25 + } 26 + 27 + type FeedGetPostThread_MyState struct { 28 + Repost string `json:"repost"` 29 + Upvote string `json:"upvote"` 30 + Downvote string `json:"downvote"` 31 + } 32 + 33 + func (t *FeedGetPostThread_MyState) MarshalJSON() ([]byte, error) { 34 + out := make(map[string]interface{}) 35 + out["downvote"] = t.Downvote 36 + out["repost"] = t.Repost 37 + out["upvote"] = t.Upvote 38 + return json.Marshal(out) 39 + } 40 + 41 + type FeedGetPostThread_Output struct { 42 + Thread *FeedGetPostThread_Output_Thread `json:"thread"` 43 + } 44 + 45 + func (t *FeedGetPostThread_Output) MarshalJSON() ([]byte, error) { 46 + out := make(map[string]interface{}) 47 + out["thread"] = t.Thread 48 + return json.Marshal(out) 49 + } 50 + 51 + type FeedGetPostThread_Output_Thread struct { 52 + FeedGetPostThread_Post *FeedGetPostThread_Post 53 + FeedGetPostThread_NotFoundPost *FeedGetPostThread_NotFoundPost 54 + } 55 + 56 + func (t *FeedGetPostThread_Output_Thread) MarshalJSON() ([]byte, error) { 57 + if t.FeedGetPostThread_Post != nil { 58 + return json.Marshal(t.FeedGetPostThread_Post) 59 + } 60 + if t.FeedGetPostThread_NotFoundPost != nil { 61 + return json.Marshal(t.FeedGetPostThread_NotFoundPost) 62 + } 63 + return nil, fmt.Errorf("cannot marshal empty enum") 64 + } 65 + func (t *FeedGetPostThread_Output_Thread) UnmarshalJSON(b []byte) error { 66 + typ, err := util.EnumTypeExtract(b) 67 + if err != nil { 68 + return err 69 + } 70 + 71 + switch typ { 72 + case "app.bsky.feed.getPostThread#post": 73 + t.FeedGetPostThread_Post = new(FeedGetPostThread_Post) 74 + return json.Unmarshal(b, t.FeedGetPostThread_Post) 75 + case "app.bsky.feed.getPostThread#notFoundPost": 76 + t.FeedGetPostThread_NotFoundPost = new(FeedGetPostThread_NotFoundPost) 77 + return json.Unmarshal(b, t.FeedGetPostThread_NotFoundPost) 78 + 79 + default: 80 + return nil 81 + } 82 + } 83 + 84 + type FeedGetPostThread_Post struct { 85 + ReplyCount int64 `json:"replyCount"` 86 + MyState *FeedGetPostThread_MyState `json:"myState"` 87 + Uri string `json:"uri"` 88 + Parent *FeedGetPostThread_Post_Parent `json:"parent"` 89 + Record any `json:"record"` 90 + Embed *FeedEmbed `json:"embed"` 91 + Replies []*FeedGetPostThread_Post_Replies_Elem `json:"replies"` 92 + RepostCount int64 `json:"repostCount"` 93 + UpvoteCount int64 `json:"upvoteCount"` 94 + DownvoteCount int64 `json:"downvoteCount"` 95 + Cid string `json:"cid"` 96 + Author *ActorRef_WithInfo `json:"author"` 97 + IndexedAt string `json:"indexedAt"` 98 + } 99 + 100 + func (t *FeedGetPostThread_Post) MarshalJSON() ([]byte, error) { 101 + out := make(map[string]interface{}) 102 + out["author"] = t.Author 103 + out["cid"] = t.Cid 104 + out["downvoteCount"] = t.DownvoteCount 105 + out["embed"] = t.Embed 106 + out["indexedAt"] = t.IndexedAt 107 + out["myState"] = t.MyState 108 + out["parent"] = t.Parent 109 + out["record"] = t.Record 110 + out["replies"] = t.Replies 111 + out["replyCount"] = t.ReplyCount 112 + out["repostCount"] = t.RepostCount 113 + out["upvoteCount"] = t.UpvoteCount 114 + out["uri"] = t.Uri 115 + return json.Marshal(out) 116 + } 117 + 118 + type FeedGetPostThread_Post_Parent struct { 119 + FeedGetPostThread_Post *FeedGetPostThread_Post 120 + FeedGetPostThread_NotFoundPost *FeedGetPostThread_NotFoundPost 121 + } 122 + 123 + func (t *FeedGetPostThread_Post_Parent) MarshalJSON() ([]byte, error) { 124 + if t.FeedGetPostThread_Post != nil { 125 + return json.Marshal(t.FeedGetPostThread_Post) 126 + } 127 + if t.FeedGetPostThread_NotFoundPost != nil { 128 + return json.Marshal(t.FeedGetPostThread_NotFoundPost) 129 + } 130 + return nil, fmt.Errorf("cannot marshal empty enum") 131 + } 132 + func (t *FeedGetPostThread_Post_Parent) UnmarshalJSON(b []byte) error { 133 + typ, err := util.EnumTypeExtract(b) 134 + if err != nil { 135 + return err 136 + } 137 + 138 + switch typ { 139 + case "app.bsky.feed.getPostThread#post": 140 + t.FeedGetPostThread_Post = new(FeedGetPostThread_Post) 141 + return json.Unmarshal(b, t.FeedGetPostThread_Post) 142 + case "app.bsky.feed.getPostThread#notFoundPost": 143 + t.FeedGetPostThread_NotFoundPost = new(FeedGetPostThread_NotFoundPost) 144 + return json.Unmarshal(b, t.FeedGetPostThread_NotFoundPost) 145 + 146 + default: 147 + return nil 148 + } 149 + } 150 + 151 + type FeedGetPostThread_Post_Replies_Elem struct { 152 + FeedGetPostThread_Post *FeedGetPostThread_Post 153 + FeedGetPostThread_NotFoundPost *FeedGetPostThread_NotFoundPost 154 + } 155 + 156 + func (t *FeedGetPostThread_Post_Replies_Elem) MarshalJSON() ([]byte, error) { 157 + if t.FeedGetPostThread_Post != nil { 158 + return json.Marshal(t.FeedGetPostThread_Post) 159 + } 160 + if t.FeedGetPostThread_NotFoundPost != nil { 161 + return json.Marshal(t.FeedGetPostThread_NotFoundPost) 162 + } 163 + return nil, fmt.Errorf("cannot marshal empty enum") 164 + } 165 + func (t *FeedGetPostThread_Post_Replies_Elem) UnmarshalJSON(b []byte) error { 166 + typ, err := util.EnumTypeExtract(b) 167 + if err != nil { 168 + return err 169 + } 170 + 171 + switch typ { 172 + case "app.bsky.feed.getPostThread#post": 173 + t.FeedGetPostThread_Post = new(FeedGetPostThread_Post) 174 + return json.Unmarshal(b, t.FeedGetPostThread_Post) 175 + case "app.bsky.feed.getPostThread#notFoundPost": 176 + t.FeedGetPostThread_NotFoundPost = new(FeedGetPostThread_NotFoundPost) 177 + return json.Unmarshal(b, t.FeedGetPostThread_NotFoundPost) 178 + 179 + default: 180 + return nil 181 + } 182 + } 183 + 184 + func FeedGetPostThread(ctx context.Context, c *xrpc.Client, depth int64, uri string) (*FeedGetPostThread_Output, error) { 185 + var out FeedGetPostThread_Output 186 + 187 + params := map[string]interface{}{ 188 + "depth": depth, 189 + "uri": uri, 190 + } 191 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.feed.getPostThread", params, nil, &out); err != nil { 192 + return nil, err 193 + } 194 + 195 + return &out, nil 196 + }
+62
api/bsky/feedgetRepostedBy.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.feed.getRepostedBy 11 + 12 + type FeedGetRepostedBy_Output struct { 13 + Uri string `json:"uri"` 14 + Cid string `json:"cid"` 15 + Cursor string `json:"cursor"` 16 + RepostedBy []*FeedGetRepostedBy_RepostedBy `json:"repostedBy"` 17 + } 18 + 19 + func (t *FeedGetRepostedBy_Output) MarshalJSON() ([]byte, error) { 20 + out := make(map[string]interface{}) 21 + out["cid"] = t.Cid 22 + out["cursor"] = t.Cursor 23 + out["repostedBy"] = t.RepostedBy 24 + out["uri"] = t.Uri 25 + return json.Marshal(out) 26 + } 27 + 28 + type FeedGetRepostedBy_RepostedBy struct { 29 + Did string `json:"did"` 30 + Declaration *SystemDeclRef `json:"declaration"` 31 + Handle string `json:"handle"` 32 + DisplayName string `json:"displayName"` 33 + CreatedAt string `json:"createdAt"` 34 + IndexedAt string `json:"indexedAt"` 35 + } 36 + 37 + func (t *FeedGetRepostedBy_RepostedBy) MarshalJSON() ([]byte, error) { 38 + out := make(map[string]interface{}) 39 + out["createdAt"] = t.CreatedAt 40 + out["declaration"] = t.Declaration 41 + out["did"] = t.Did 42 + out["displayName"] = t.DisplayName 43 + out["handle"] = t.Handle 44 + out["indexedAt"] = t.IndexedAt 45 + return json.Marshal(out) 46 + } 47 + 48 + func FeedGetRepostedBy(ctx context.Context, c *xrpc.Client, before string, cid string, limit int64, uri string) (*FeedGetRepostedBy_Output, error) { 49 + var out FeedGetRepostedBy_Output 50 + 51 + params := map[string]interface{}{ 52 + "before": before, 53 + "cid": cid, 54 + "limit": limit, 55 + "uri": uri, 56 + } 57 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.feed.getRepostedBy", params, nil, &out); err != nil { 58 + return nil, err 59 + } 60 + 61 + return &out, nil 62 + }
+85
api/bsky/feedgetTimeline.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.feed.getTimeline 11 + 12 + type FeedGetTimeline_Output struct { 13 + Cursor string `json:"cursor"` 14 + Feed []*FeedGetTimeline_FeedItem `json:"feed"` 15 + } 16 + 17 + func (t *FeedGetTimeline_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["cursor"] = t.Cursor 20 + out["feed"] = t.Feed 21 + return json.Marshal(out) 22 + } 23 + 24 + type FeedGetTimeline_FeedItem struct { 25 + Embed *FeedEmbed `json:"embed"` 26 + ReplyCount int64 `json:"replyCount"` 27 + DownvoteCount int64 `json:"downvoteCount"` 28 + Author *ActorRef_WithInfo `json:"author"` 29 + TrendedBy *ActorRef_WithInfo `json:"trendedBy"` 30 + RepostedBy *ActorRef_WithInfo `json:"repostedBy"` 31 + RepostCount int64 `json:"repostCount"` 32 + UpvoteCount int64 `json:"upvoteCount"` 33 + IndexedAt string `json:"indexedAt"` 34 + MyState *FeedGetTimeline_MyState `json:"myState"` 35 + Uri string `json:"uri"` 36 + Cid string `json:"cid"` 37 + Record any `json:"record"` 38 + } 39 + 40 + func (t *FeedGetTimeline_FeedItem) MarshalJSON() ([]byte, error) { 41 + out := make(map[string]interface{}) 42 + out["author"] = t.Author 43 + out["cid"] = t.Cid 44 + out["downvoteCount"] = t.DownvoteCount 45 + out["embed"] = t.Embed 46 + out["indexedAt"] = t.IndexedAt 47 + out["myState"] = t.MyState 48 + out["record"] = t.Record 49 + out["replyCount"] = t.ReplyCount 50 + out["repostCount"] = t.RepostCount 51 + out["repostedBy"] = t.RepostedBy 52 + out["trendedBy"] = t.TrendedBy 53 + out["upvoteCount"] = t.UpvoteCount 54 + out["uri"] = t.Uri 55 + return json.Marshal(out) 56 + } 57 + 58 + type FeedGetTimeline_MyState struct { 59 + Repost string `json:"repost"` 60 + Upvote string `json:"upvote"` 61 + Downvote string `json:"downvote"` 62 + } 63 + 64 + func (t *FeedGetTimeline_MyState) MarshalJSON() ([]byte, error) { 65 + out := make(map[string]interface{}) 66 + out["downvote"] = t.Downvote 67 + out["repost"] = t.Repost 68 + out["upvote"] = t.Upvote 69 + return json.Marshal(out) 70 + } 71 + 72 + func FeedGetTimeline(ctx context.Context, c *xrpc.Client, algorithm string, before string, limit int64) (*FeedGetTimeline_Output, error) { 73 + var out FeedGetTimeline_Output 74 + 75 + params := map[string]interface{}{ 76 + "algorithm": algorithm, 77 + "before": before, 78 + "limit": limit, 79 + } 80 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.feed.getTimeline", params, nil, &out); err != nil { 81 + return nil, err 82 + } 83 + 84 + return &out, nil 85 + }
+59
api/bsky/feedgetVotes.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.feed.getVotes 11 + 12 + type FeedGetVotes_Output struct { 13 + Uri string `json:"uri"` 14 + Cid string `json:"cid"` 15 + Cursor string `json:"cursor"` 16 + Votes []*FeedGetVotes_Vote `json:"votes"` 17 + } 18 + 19 + func (t *FeedGetVotes_Output) MarshalJSON() ([]byte, error) { 20 + out := make(map[string]interface{}) 21 + out["cid"] = t.Cid 22 + out["cursor"] = t.Cursor 23 + out["uri"] = t.Uri 24 + out["votes"] = t.Votes 25 + return json.Marshal(out) 26 + } 27 + 28 + type FeedGetVotes_Vote struct { 29 + CreatedAt string `json:"createdAt"` 30 + Actor *ActorRef_WithInfo `json:"actor"` 31 + Direction string `json:"direction"` 32 + IndexedAt string `json:"indexedAt"` 33 + } 34 + 35 + func (t *FeedGetVotes_Vote) MarshalJSON() ([]byte, error) { 36 + out := make(map[string]interface{}) 37 + out["actor"] = t.Actor 38 + out["createdAt"] = t.CreatedAt 39 + out["direction"] = t.Direction 40 + out["indexedAt"] = t.IndexedAt 41 + return json.Marshal(out) 42 + } 43 + 44 + func FeedGetVotes(ctx context.Context, c *xrpc.Client, before string, cid string, direction string, limit int64, uri string) (*FeedGetVotes_Output, error) { 45 + var out FeedGetVotes_Output 46 + 47 + params := map[string]interface{}{ 48 + "before": before, 49 + "cid": cid, 50 + "direction": direction, 51 + "limit": limit, 52 + "uri": uri, 53 + } 54 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.feed.getVotes", params, nil, &out); err != nil { 55 + return nil, err 56 + } 57 + 58 + return &out, nil 59 + }
+63
api/bsky/feedpost.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + 6 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 7 + ) 8 + 9 + // schema: app.bsky.feed.post 10 + 11 + type FeedPost struct { 12 + Entities []*FeedPost_Entity `json:"entities"` 13 + Reply *FeedPost_ReplyRef `json:"reply"` 14 + CreatedAt string `json:"createdAt"` 15 + Text string `json:"text"` 16 + } 17 + 18 + func (t *FeedPost) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["createdAt"] = t.CreatedAt 21 + out["entities"] = t.Entities 22 + out["reply"] = t.Reply 23 + out["text"] = t.Text 24 + return json.Marshal(out) 25 + } 26 + 27 + type FeedPost_ReplyRef struct { 28 + Root *comatprototypes.RepoStrongRef `json:"root"` 29 + Parent *comatprototypes.RepoStrongRef `json:"parent"` 30 + } 31 + 32 + func (t *FeedPost_ReplyRef) MarshalJSON() ([]byte, error) { 33 + out := make(map[string]interface{}) 34 + out["parent"] = t.Parent 35 + out["root"] = t.Root 36 + return json.Marshal(out) 37 + } 38 + 39 + type FeedPost_Entity struct { 40 + Index *FeedPost_TextSlice `json:"index"` 41 + Type string `json:"type"` 42 + Value string `json:"value"` 43 + } 44 + 45 + func (t *FeedPost_Entity) MarshalJSON() ([]byte, error) { 46 + out := make(map[string]interface{}) 47 + out["index"] = t.Index 48 + out["type"] = t.Type 49 + out["value"] = t.Value 50 + return json.Marshal(out) 51 + } 52 + 53 + type FeedPost_TextSlice struct { 54 + End int64 `json:"end"` 55 + Start int64 `json:"start"` 56 + } 57 + 58 + func (t *FeedPost_TextSlice) MarshalJSON() ([]byte, error) { 59 + out := make(map[string]interface{}) 60 + out["end"] = t.End 61 + out["start"] = t.Start 62 + return json.Marshal(out) 63 + }
+21
api/bsky/feedrepost.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + 6 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 7 + ) 8 + 9 + // schema: app.bsky.feed.repost 10 + 11 + type FeedRepost struct { 12 + Subject *comatprototypes.RepoStrongRef `json:"subject"` 13 + CreatedAt string `json:"createdAt"` 14 + } 15 + 16 + func (t *FeedRepost) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["createdAt"] = t.CreatedAt 19 + out["subject"] = t.Subject 20 + return json.Marshal(out) 21 + }
+44
api/bsky/feedsetVote.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 8 + "github.com/whyrusleeping/gosky/xrpc" 9 + ) 10 + 11 + // schema: app.bsky.feed.setVote 12 + 13 + type FeedSetVote_Input struct { 14 + Subject *comatprototypes.RepoStrongRef `json:"subject"` 15 + Direction string `json:"direction"` 16 + } 17 + 18 + func (t *FeedSetVote_Input) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["direction"] = t.Direction 21 + out["subject"] = t.Subject 22 + return json.Marshal(out) 23 + } 24 + 25 + type FeedSetVote_Output struct { 26 + Downvote string `json:"downvote"` 27 + Upvote string `json:"upvote"` 28 + } 29 + 30 + func (t *FeedSetVote_Output) MarshalJSON() ([]byte, error) { 31 + out := make(map[string]interface{}) 32 + out["downvote"] = t.Downvote 33 + out["upvote"] = t.Upvote 34 + return json.Marshal(out) 35 + } 36 + 37 + func FeedSetVote(ctx context.Context, c *xrpc.Client, input FeedSetVote_Input) (*FeedSetVote_Output, error) { 38 + var out FeedSetVote_Output 39 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "app.bsky.feed.setVote", nil, input, &out); err != nil { 40 + return nil, err 41 + } 42 + 43 + return &out, nil 44 + }
+21
api/bsky/feedtrend.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + 6 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 7 + ) 8 + 9 + // schema: app.bsky.feed.trend 10 + 11 + type FeedTrend struct { 12 + Subject *comatprototypes.RepoStrongRef `json:"subject"` 13 + CreatedAt string `json:"createdAt"` 14 + } 15 + 16 + func (t *FeedTrend) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["createdAt"] = t.CreatedAt 19 + out["subject"] = t.Subject 20 + return json.Marshal(out) 21 + }
+23
api/bsky/feedvote.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + 6 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 7 + ) 8 + 9 + // schema: app.bsky.feed.vote 10 + 11 + type FeedVote struct { 12 + CreatedAt string `json:"createdAt"` 13 + Subject *comatprototypes.RepoStrongRef `json:"subject"` 14 + Direction string `json:"direction"` 15 + } 16 + 17 + func (t *FeedVote) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["createdAt"] = t.CreatedAt 20 + out["direction"] = t.Direction 21 + out["subject"] = t.Subject 22 + return json.Marshal(out) 23 + }
+5
api/bsky/graphassertCreator.go
··· 1 + package schemagen 2 + 3 + // schema: app.bsky.graph.assertCreator 4 + 5 + const GraphAssertCreator = "app.bsky.graph.assertCreator#main"
+5
api/bsky/graphassertMember.go
··· 1 + package schemagen 2 + 3 + // schema: app.bsky.graph.assertMember 4 + 5 + const GraphAssertMember = "app.bsky.graph.assertMember#main"
+21
api/bsky/graphassertion.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + ) 6 + 7 + // schema: app.bsky.graph.assertion 8 + 9 + type GraphAssertion struct { 10 + Subject *ActorRef `json:"subject"` 11 + CreatedAt string `json:"createdAt"` 12 + Assertion string `json:"assertion"` 13 + } 14 + 15 + func (t *GraphAssertion) MarshalJSON() ([]byte, error) { 16 + out := make(map[string]interface{}) 17 + out["assertion"] = t.Assertion 18 + out["createdAt"] = t.CreatedAt 19 + out["subject"] = t.Subject 20 + return json.Marshal(out) 21 + }
+23
api/bsky/graphconfirmation.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + 6 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 7 + ) 8 + 9 + // schema: app.bsky.graph.confirmation 10 + 11 + type GraphConfirmation struct { 12 + Assertion *comatprototypes.RepoStrongRef `json:"assertion"` 13 + CreatedAt string `json:"createdAt"` 14 + Originator *ActorRef `json:"originator"` 15 + } 16 + 17 + func (t *GraphConfirmation) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["assertion"] = t.Assertion 20 + out["createdAt"] = t.CreatedAt 21 + out["originator"] = t.Originator 22 + return json.Marshal(out) 23 + }
+19
api/bsky/graphfollow.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + ) 6 + 7 + // schema: app.bsky.graph.follow 8 + 9 + type GraphFollow struct { 10 + Subject *ActorRef `json:"subject"` 11 + CreatedAt string `json:"createdAt"` 12 + } 13 + 14 + func (t *GraphFollow) MarshalJSON() ([]byte, error) { 15 + out := make(map[string]interface{}) 16 + out["createdAt"] = t.CreatedAt 17 + out["subject"] = t.Subject 18 + return json.Marshal(out) 19 + }
+80
api/bsky/graphgetAssertions.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.graph.getAssertions 11 + 12 + type GraphGetAssertions_Output struct { 13 + Cursor string `json:"cursor"` 14 + Assertions []*GraphGetAssertions_Assertion `json:"assertions"` 15 + } 16 + 17 + func (t *GraphGetAssertions_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["assertions"] = t.Assertions 20 + out["cursor"] = t.Cursor 21 + return json.Marshal(out) 22 + } 23 + 24 + type GraphGetAssertions_Assertion struct { 25 + IndexedAt string `json:"indexedAt"` 26 + CreatedAt string `json:"createdAt"` 27 + Uri string `json:"uri"` 28 + Cid string `json:"cid"` 29 + Assertion string `json:"assertion"` 30 + Confirmation *GraphGetAssertions_Confirmation `json:"confirmation"` 31 + Author *ActorRef_WithInfo `json:"author"` 32 + Subject *ActorRef_WithInfo `json:"subject"` 33 + } 34 + 35 + func (t *GraphGetAssertions_Assertion) MarshalJSON() ([]byte, error) { 36 + out := make(map[string]interface{}) 37 + out["assertion"] = t.Assertion 38 + out["author"] = t.Author 39 + out["cid"] = t.Cid 40 + out["confirmation"] = t.Confirmation 41 + out["createdAt"] = t.CreatedAt 42 + out["indexedAt"] = t.IndexedAt 43 + out["subject"] = t.Subject 44 + out["uri"] = t.Uri 45 + return json.Marshal(out) 46 + } 47 + 48 + type GraphGetAssertions_Confirmation struct { 49 + Uri string `json:"uri"` 50 + Cid string `json:"cid"` 51 + IndexedAt string `json:"indexedAt"` 52 + CreatedAt string `json:"createdAt"` 53 + } 54 + 55 + func (t *GraphGetAssertions_Confirmation) MarshalJSON() ([]byte, error) { 56 + out := make(map[string]interface{}) 57 + out["cid"] = t.Cid 58 + out["createdAt"] = t.CreatedAt 59 + out["indexedAt"] = t.IndexedAt 60 + out["uri"] = t.Uri 61 + return json.Marshal(out) 62 + } 63 + 64 + func GraphGetAssertions(ctx context.Context, c *xrpc.Client, assertion string, author string, before string, confirmed bool, limit int64, subject string) (*GraphGetAssertions_Output, error) { 65 + var out GraphGetAssertions_Output 66 + 67 + params := map[string]interface{}{ 68 + "assertion": assertion, 69 + "author": author, 70 + "before": before, 71 + "confirmed": confirmed, 72 + "limit": limit, 73 + "subject": subject, 74 + } 75 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.graph.getAssertions", params, nil, &out); err != nil { 76 + return nil, err 77 + } 78 + 79 + return &out, nil 80 + }
+75
api/bsky/graphgetFollowers.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.graph.getFollowers 11 + 12 + type GraphGetFollowers_Output struct { 13 + Subject *GraphGetFollowers_Subject `json:"subject"` 14 + Cursor string `json:"cursor"` 15 + Followers []*GraphGetFollowers_Follower `json:"followers"` 16 + } 17 + 18 + func (t *GraphGetFollowers_Output) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["cursor"] = t.Cursor 21 + out["followers"] = t.Followers 22 + out["subject"] = t.Subject 23 + return json.Marshal(out) 24 + } 25 + 26 + type GraphGetFollowers_Subject struct { 27 + DisplayName string `json:"displayName"` 28 + Did string `json:"did"` 29 + Declaration *SystemDeclRef `json:"declaration"` 30 + Handle string `json:"handle"` 31 + } 32 + 33 + func (t *GraphGetFollowers_Subject) MarshalJSON() ([]byte, error) { 34 + out := make(map[string]interface{}) 35 + out["declaration"] = t.Declaration 36 + out["did"] = t.Did 37 + out["displayName"] = t.DisplayName 38 + out["handle"] = t.Handle 39 + return json.Marshal(out) 40 + } 41 + 42 + type GraphGetFollowers_Follower struct { 43 + IndexedAt string `json:"indexedAt"` 44 + Did string `json:"did"` 45 + Declaration *SystemDeclRef `json:"declaration"` 46 + Handle string `json:"handle"` 47 + DisplayName string `json:"displayName"` 48 + CreatedAt string `json:"createdAt"` 49 + } 50 + 51 + func (t *GraphGetFollowers_Follower) MarshalJSON() ([]byte, error) { 52 + out := make(map[string]interface{}) 53 + out["createdAt"] = t.CreatedAt 54 + out["declaration"] = t.Declaration 55 + out["did"] = t.Did 56 + out["displayName"] = t.DisplayName 57 + out["handle"] = t.Handle 58 + out["indexedAt"] = t.IndexedAt 59 + return json.Marshal(out) 60 + } 61 + 62 + func GraphGetFollowers(ctx context.Context, c *xrpc.Client, before string, limit int64, user string) (*GraphGetFollowers_Output, error) { 63 + var out GraphGetFollowers_Output 64 + 65 + params := map[string]interface{}{ 66 + "before": before, 67 + "limit": limit, 68 + "user": user, 69 + } 70 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.graph.getFollowers", params, nil, &out); err != nil { 71 + return nil, err 72 + } 73 + 74 + return &out, nil 75 + }
+59
api/bsky/graphgetFollows.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.graph.getFollows 11 + 12 + type GraphGetFollows_Output struct { 13 + Follows []*GraphGetFollows_Follow `json:"follows"` 14 + Subject *ActorRef_WithInfo `json:"subject"` 15 + Cursor string `json:"cursor"` 16 + } 17 + 18 + func (t *GraphGetFollows_Output) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["cursor"] = t.Cursor 21 + out["follows"] = t.Follows 22 + out["subject"] = t.Subject 23 + return json.Marshal(out) 24 + } 25 + 26 + type GraphGetFollows_Follow struct { 27 + Declaration *SystemDeclRef `json:"declaration"` 28 + Handle string `json:"handle"` 29 + DisplayName string `json:"displayName"` 30 + CreatedAt string `json:"createdAt"` 31 + IndexedAt string `json:"indexedAt"` 32 + Did string `json:"did"` 33 + } 34 + 35 + func (t *GraphGetFollows_Follow) MarshalJSON() ([]byte, error) { 36 + out := make(map[string]interface{}) 37 + out["createdAt"] = t.CreatedAt 38 + out["declaration"] = t.Declaration 39 + out["did"] = t.Did 40 + out["displayName"] = t.DisplayName 41 + out["handle"] = t.Handle 42 + out["indexedAt"] = t.IndexedAt 43 + return json.Marshal(out) 44 + } 45 + 46 + func GraphGetFollows(ctx context.Context, c *xrpc.Client, before string, limit int64, user string) (*GraphGetFollows_Output, error) { 47 + var out GraphGetFollows_Output 48 + 49 + params := map[string]interface{}{ 50 + "before": before, 51 + "limit": limit, 52 + "user": user, 53 + } 54 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.graph.getFollows", params, nil, &out); err != nil { 55 + return nil, err 56 + } 57 + 58 + return &out, nil 59 + }
+59
api/bsky/graphgetMembers.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.graph.getMembers 11 + 12 + type GraphGetMembers_Output struct { 13 + Subject *ActorRef_WithInfo `json:"subject"` 14 + Cursor string `json:"cursor"` 15 + Members []*GraphGetMembers_Member `json:"members"` 16 + } 17 + 18 + func (t *GraphGetMembers_Output) MarshalJSON() ([]byte, error) { 19 + out := make(map[string]interface{}) 20 + out["cursor"] = t.Cursor 21 + out["members"] = t.Members 22 + out["subject"] = t.Subject 23 + return json.Marshal(out) 24 + } 25 + 26 + type GraphGetMembers_Member struct { 27 + Did string `json:"did"` 28 + Declaration *SystemDeclRef `json:"declaration"` 29 + Handle string `json:"handle"` 30 + DisplayName string `json:"displayName"` 31 + CreatedAt string `json:"createdAt"` 32 + IndexedAt string `json:"indexedAt"` 33 + } 34 + 35 + func (t *GraphGetMembers_Member) MarshalJSON() ([]byte, error) { 36 + out := make(map[string]interface{}) 37 + out["createdAt"] = t.CreatedAt 38 + out["declaration"] = t.Declaration 39 + out["did"] = t.Did 40 + out["displayName"] = t.DisplayName 41 + out["handle"] = t.Handle 42 + out["indexedAt"] = t.IndexedAt 43 + return json.Marshal(out) 44 + } 45 + 46 + func GraphGetMembers(ctx context.Context, c *xrpc.Client, actor string, before string, limit int64) (*GraphGetMembers_Output, error) { 47 + var out GraphGetMembers_Output 48 + 49 + params := map[string]interface{}{ 50 + "actor": actor, 51 + "before": before, 52 + "limit": limit, 53 + } 54 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.graph.getMembers", params, nil, &out); err != nil { 55 + return nil, err 56 + } 57 + 58 + return &out, nil 59 + }
+59
api/bsky/graphgetMemberships.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.graph.getMemberships 11 + 12 + type GraphGetMemberships_Membership struct { 13 + Handle string `json:"handle"` 14 + DisplayName string `json:"displayName"` 15 + CreatedAt string `json:"createdAt"` 16 + IndexedAt string `json:"indexedAt"` 17 + Did string `json:"did"` 18 + Declaration *SystemDeclRef `json:"declaration"` 19 + } 20 + 21 + func (t *GraphGetMemberships_Membership) MarshalJSON() ([]byte, error) { 22 + out := make(map[string]interface{}) 23 + out["createdAt"] = t.CreatedAt 24 + out["declaration"] = t.Declaration 25 + out["did"] = t.Did 26 + out["displayName"] = t.DisplayName 27 + out["handle"] = t.Handle 28 + out["indexedAt"] = t.IndexedAt 29 + return json.Marshal(out) 30 + } 31 + 32 + type GraphGetMemberships_Output struct { 33 + Subject *ActorRef_WithInfo `json:"subject"` 34 + Cursor string `json:"cursor"` 35 + Memberships []*GraphGetMemberships_Membership `json:"memberships"` 36 + } 37 + 38 + func (t *GraphGetMemberships_Output) MarshalJSON() ([]byte, error) { 39 + out := make(map[string]interface{}) 40 + out["cursor"] = t.Cursor 41 + out["memberships"] = t.Memberships 42 + out["subject"] = t.Subject 43 + return json.Marshal(out) 44 + } 45 + 46 + func GraphGetMemberships(ctx context.Context, c *xrpc.Client, actor string, before string, limit int64) (*GraphGetMemberships_Output, error) { 47 + var out GraphGetMemberships_Output 48 + 49 + params := map[string]interface{}{ 50 + "actor": actor, 51 + "before": before, 52 + "limit": limit, 53 + } 54 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.graph.getMemberships", params, nil, &out); err != nil { 55 + return nil, err 56 + } 57 + 58 + return &out, nil 59 + }
+29
api/bsky/notificationgetCount.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.notification.getCount 11 + 12 + type NotificationGetCount_Output struct { 13 + Count int64 `json:"count"` 14 + } 15 + 16 + func (t *NotificationGetCount_Output) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["count"] = t.Count 19 + return json.Marshal(out) 20 + } 21 + 22 + func NotificationGetCount(ctx context.Context, c *xrpc.Client) (*NotificationGetCount_Output, error) { 23 + var out NotificationGetCount_Output 24 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.notification.getCount", nil, nil, &out); err != nil { 25 + return nil, err 26 + } 27 + 28 + return &out, nil 29 + }
+60
api/bsky/notificationlist.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.notification.list 11 + 12 + type NotificationList_Output struct { 13 + Cursor string `json:"cursor"` 14 + Notifications []*NotificationList_Notification `json:"notifications"` 15 + } 16 + 17 + func (t *NotificationList_Output) MarshalJSON() ([]byte, error) { 18 + out := make(map[string]interface{}) 19 + out["cursor"] = t.Cursor 20 + out["notifications"] = t.Notifications 21 + return json.Marshal(out) 22 + } 23 + 24 + type NotificationList_Notification struct { 25 + Author *ActorRef_WithInfo `json:"author"` 26 + Reason string `json:"reason"` 27 + ReasonSubject string `json:"reasonSubject"` 28 + Record any `json:"record"` 29 + IsRead bool `json:"isRead"` 30 + IndexedAt string `json:"indexedAt"` 31 + Uri string `json:"uri"` 32 + Cid string `json:"cid"` 33 + } 34 + 35 + func (t *NotificationList_Notification) MarshalJSON() ([]byte, error) { 36 + out := make(map[string]interface{}) 37 + out["author"] = t.Author 38 + out["cid"] = t.Cid 39 + out["indexedAt"] = t.IndexedAt 40 + out["isRead"] = t.IsRead 41 + out["reason"] = t.Reason 42 + out["reasonSubject"] = t.ReasonSubject 43 + out["record"] = t.Record 44 + out["uri"] = t.Uri 45 + return json.Marshal(out) 46 + } 47 + 48 + func NotificationList(ctx context.Context, c *xrpc.Client, before string, limit int64) (*NotificationList_Output, error) { 49 + var out NotificationList_Output 50 + 51 + params := map[string]interface{}{ 52 + "before": before, 53 + "limit": limit, 54 + } 55 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.notification.list", params, nil, &out); err != nil { 56 + return nil, err 57 + } 58 + 59 + return &out, nil 60 + }
+28
api/bsky/notificationupdateSeen.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "encoding/json" 6 + 7 + "github.com/whyrusleeping/gosky/xrpc" 8 + ) 9 + 10 + // schema: app.bsky.notification.updateSeen 11 + 12 + type NotificationUpdateSeen_Input struct { 13 + SeenAt string `json:"seenAt"` 14 + } 15 + 16 + func (t *NotificationUpdateSeen_Input) MarshalJSON() ([]byte, error) { 17 + out := make(map[string]interface{}) 18 + out["seenAt"] = t.SeenAt 19 + return json.Marshal(out) 20 + } 21 + 22 + func NotificationUpdateSeen(ctx context.Context, c *xrpc.Client, input NotificationUpdateSeen_Input) error { 23 + if err := c.Do(ctx, xrpc.Procedure, "application/json", "app.bsky.notification.updateSeen", nil, input, nil); err != nil { 24 + return err 25 + } 26 + 27 + return nil 28 + }
+5
api/bsky/systemactorScene.go
··· 1 + package schemagen 2 + 3 + // schema: app.bsky.system.actorScene 4 + 5 + const SystemActorScene = "app.bsky.system.actorScene#main"
+5
api/bsky/systemactorUser.go
··· 1 + package schemagen 2 + 3 + // schema: app.bsky.system.actorUser 4 + 5 + const SystemActorUser = "app.bsky.system.actorUser#main"
+19
api/bsky/systemdeclRef.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + ) 6 + 7 + // schema: app.bsky.system.declRef 8 + 9 + type SystemDeclRef struct { 10 + Cid string `json:"cid"` 11 + ActorType string `json:"actorType"` 12 + } 13 + 14 + func (t *SystemDeclRef) MarshalJSON() ([]byte, error) { 15 + out := make(map[string]interface{}) 16 + out["actorType"] = t.ActorType 17 + out["cid"] = t.Cid 18 + return json.Marshal(out) 19 + }
+17
api/bsky/systemdeclaration.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "encoding/json" 5 + ) 6 + 7 + // schema: app.bsky.system.declaration 8 + 9 + type SystemDeclaration struct { 10 + ActorType string `json:"actorType"` 11 + } 12 + 13 + func (t *SystemDeclaration) MarshalJSON() ([]byte, error) { 14 + out := make(map[string]interface{}) 15 + out["actorType"] = t.ActorType 16 + return json.Marshal(out) 17 + }
+45
api/server/auth.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "time" 6 + 7 + "github.com/lestrrat-go/jwx/jwa" 8 + jwt "github.com/lestrrat-go/jwx/jwt" 9 + "github.com/whyrusleeping/gosky/xrpc" 10 + ) 11 + 12 + const actorUserDeclarationCid = "bafyreid27zk7lbis4zw5fz4podbvbs4fc5ivwji3dmrwa6zggnj4bnd57u" 13 + 14 + func makeToken(subject string, scope string, exp time.Time) jwt.Token { 15 + tok := jwt.New() 16 + tok.Set("scope", scope) 17 + tok.Set("sub", subject) 18 + tok.Set("iat", time.Now().Unix()) 19 + tok.Set("exp", exp.Unix()) 20 + 21 + return tok 22 + 23 + } 24 + 25 + func (s *Server) createAuthTokenForUser(ctx context.Context, handle, did string) (*xrpc.AuthInfo, error) { 26 + accessTok := makeToken(did, "com.atproto.access", time.Now().Add(24*time.Hour)) 27 + refreshTok := makeToken(did, "com.atproto.refresh", time.Now().Add(7*24*time.Hour)) 28 + 29 + accSig, err := jwt.Sign(accessTok, jwa.HS256, s.signingKey) 30 + if err != nil { 31 + return nil, err 32 + } 33 + 34 + refSig, err := jwt.Sign(refreshTok, jwa.HS256, s.signingKey) 35 + if err != nil { 36 + return nil, err 37 + } 38 + 39 + return &xrpc.AuthInfo{ 40 + AccessJwt: string(accSig), 41 + RefreshJwt: string(refSig), 42 + Handle: handle, 43 + Did: did, 44 + }, nil 45 + }
+38
api/server/fakedid.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "crypto/rand" 5 + "encoding/hex" 6 + 7 + "gorm.io/gorm" 8 + ) 9 + 10 + type FakeDidMapping struct { 11 + gorm.Model 12 + Handle string 13 + Did string 14 + } 15 + 16 + type FakeDid struct { 17 + db *gorm.DB 18 + } 19 + 20 + func NewFakeDid(db *gorm.DB) *FakeDid { 21 + db.AutoMigrate(&FakeDidMapping{}) 22 + return &FakeDid{db} 23 + } 24 + 25 + func (fd *FakeDid) NewForHandle(handle string) (string, error) { 26 + buf := make([]byte, 8) 27 + rand.Read(buf) 28 + d := "did:plc:" + hex.EncodeToString(buf) 29 + 30 + if err := fd.db.Create(&FakeDidMapping{ 31 + Handle: handle, 32 + Did: d, 33 + }).Error; err != nil { 34 + return "", err 35 + } 36 + 37 + return d, nil 38 + }
+203
api/server/handlers.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "context" 5 + "io" 6 + 7 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 8 + appbskytypes "github.com/whyrusleeping/gosky/api/bsky" 9 + ) 10 + 11 + func (s *Server) handleAppBskyActorCreateScene(ctx context.Context, input *appbskytypes.ActorCreateScene_Input) (*appbskytypes.ActorCreateScene_Output, error) { 12 + panic("not yet implemented") 13 + } 14 + 15 + func (s *Server) handleAppBskyActorGetProfile(ctx context.Context, actor string) (*appbskytypes.ActorGetProfile_Output, error) { 16 + panic("not yet implemented") 17 + } 18 + 19 + func (s *Server) handleAppBskyActorGetSuggestions(ctx context.Context, cursor string, limit int) (*appbskytypes.ActorGetSuggestions_Output, error) { 20 + panic("not yet implemented") 21 + } 22 + 23 + func (s *Server) handleAppBskyActorSearch(ctx context.Context, before string, limit int, term string) (*appbskytypes.ActorSearch_Output, error) { 24 + panic("not yet implemented") 25 + } 26 + 27 + func (s *Server) handleAppBskyActorSearchTypeahead(ctx context.Context, limit int, term string) (*appbskytypes.ActorSearchTypeahead_Output, error) { 28 + panic("not yet implemented") 29 + } 30 + 31 + func (s *Server) handleAppBskyActorUpdateProfile(ctx context.Context, input *appbskytypes.ActorUpdateProfile_Input) (*appbskytypes.ActorUpdateProfile_Output, error) { 32 + panic("not yet implemented") 33 + } 34 + 35 + func (s *Server) handleAppBskyFeedGetAuthorFeed(ctx context.Context, author string, before string, limit int) (*appbskytypes.FeedGetAuthorFeed_Output, error) { 36 + panic("not yet implemented") 37 + } 38 + 39 + func (s *Server) handleAppBskyFeedGetPostThread(ctx context.Context, depth int, uri string) (*appbskytypes.FeedGetPostThread_Output, error) { 40 + panic("not yet implemented") 41 + } 42 + 43 + func (s *Server) handleAppBskyFeedGetRepostedBy(ctx context.Context, before string, cid string, limit int, uri string) (*appbskytypes.FeedGetRepostedBy_Output, error) { 44 + panic("not yet implemented") 45 + } 46 + 47 + func (s *Server) handleAppBskyFeedGetTimeline(ctx context.Context, algorithm string, before string, limit int) (*appbskytypes.FeedGetTimeline_Output, error) { 48 + panic("not yet implemented") 49 + } 50 + 51 + func (s *Server) handleAppBskyFeedGetVotes(ctx context.Context, before string, cid string, direction string, limit int, uri string) (*appbskytypes.FeedGetVotes_Output, error) { 52 + panic("not yet implemented") 53 + } 54 + 55 + func (s *Server) handleAppBskyFeedSetVote(ctx context.Context, input *appbskytypes.FeedSetVote_Input) (*appbskytypes.FeedSetVote_Output, error) { 56 + panic("not yet implemented") 57 + } 58 + 59 + func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context, assertion string, author string, before string) (*appbskytypes.GraphGetAssertions_Output, error) { 60 + panic("not yet implemented") 61 + } 62 + 63 + func (s *Server) handleAppBskyGraphGetFollowers(ctx context.Context, before string, limit int, user string) (*appbskytypes.GraphGetFollowers_Output, error) { 64 + panic("not yet implemented") 65 + } 66 + 67 + func (s *Server) handleAppBskyGraphGetFollows(ctx context.Context, before string, limit int, user string) (*appbskytypes.GraphGetFollows_Output, error) { 68 + panic("not yet implemented") 69 + } 70 + 71 + func (s *Server) handleAppBskyGraphGetMembers(ctx context.Context, actor string, before string, limit int) (*appbskytypes.GraphGetMembers_Output, error) { 72 + panic("not yet implemented") 73 + } 74 + 75 + func (s *Server) handleAppBskyGraphGetMemberships(ctx context.Context, actor string, before string, limit int) (*appbskytypes.GraphGetMemberships_Output, error) { 76 + panic("not yet implemented") 77 + } 78 + 79 + func (s *Server) handleAppBskyNotificationGetCount(ctx context.Context) (*appbskytypes.NotificationGetCount_Output, error) { 80 + panic("not yet implemented") 81 + } 82 + 83 + func (s *Server) handleAppBskyNotificationList(ctx context.Context, before string, limit int) (*appbskytypes.NotificationList_Output, error) { 84 + panic("not yet implemented") 85 + } 86 + 87 + func (s *Server) handleAppBskyNotificationUpdateSeen(ctx context.Context, input *appbskytypes.NotificationUpdateSeen_Input) error { 88 + panic("not yet implemented") 89 + } 90 + 91 + func (s *Server) handleComAtprotoAccountCreate(ctx context.Context, input *comatprototypes.AccountCreate_Input) (*comatprototypes.AccountCreate_Output, error) { 92 + if err := s.db.Create(&User{ 93 + Handle: input.Handle, 94 + Password: input.Password, 95 + RecoveryKey: input.RecoveryKey, 96 + }).Error; err != nil { 97 + return nil, err 98 + } 99 + 100 + d, err := s.fakeDid.NewForHandle(input.Handle) 101 + if err != nil { 102 + return nil, err 103 + } 104 + 105 + tok, err := s.createAuthTokenForUser(ctx, input.Handle, d) 106 + if err != nil { 107 + return nil, err 108 + } 109 + 110 + return &comatprototypes.AccountCreate_Output{ 111 + Handle: input.Handle, 112 + Did: d, 113 + AccessJwt: tok.AccessJwt, 114 + RefreshJwt: tok.RefreshJwt, 115 + }, nil 116 + } 117 + 118 + func (s *Server) handleComAtprotoAccountCreateInviteCode(ctx context.Context, input *comatprototypes.AccountCreateInviteCode_Input) (*comatprototypes.AccountCreateInviteCode_Output, error) { 119 + panic("not yet implemented") 120 + } 121 + 122 + func (s *Server) handleComAtprotoAccountDelete(ctx context.Context) error { 123 + panic("not yet implemented") 124 + } 125 + 126 + func (s *Server) handleComAtprotoAccountGet(ctx context.Context) error { 127 + panic("not yet implemented") 128 + } 129 + 130 + func (s *Server) handleComAtprotoAccountRequestPasswordReset(ctx context.Context, input *comatprototypes.AccountRequestPasswordReset_Input) error { 131 + panic("not yet implemented") 132 + } 133 + 134 + func (s *Server) handleComAtprotoAccountResetPassword(ctx context.Context, input *comatprototypes.AccountResetPassword_Input) error { 135 + panic("not yet implemented") 136 + } 137 + 138 + func (s *Server) handleComAtprotoHandleResolve(ctx context.Context, handle string) (*comatprototypes.HandleResolve_Output, error) { 139 + panic("not yet implemented") 140 + } 141 + 142 + func (s *Server) handleComAtprotoRepoBatchWrite(ctx context.Context, input *comatprototypes.RepoBatchWrite_Input) error { 143 + panic("not yet implemented") 144 + } 145 + 146 + func (s *Server) handleComAtprotoRepoCreateRecord(ctx context.Context, input *comatprototypes.RepoCreateRecord_Input) (*comatprototypes.RepoCreateRecord_Output, error) { 147 + u, err := s.getUser(ctx) 148 + if err != nil { 149 + return nil, err 150 + } 151 + } 152 + 153 + func (s *Server) handleComAtprotoRepoDeleteRecord(ctx context.Context, input *comatprototypes.RepoDeleteRecord_Input) error { 154 + panic("not yet implemented") 155 + } 156 + 157 + func (s *Server) handleComAtprotoRepoDescribe(ctx context.Context, user string) (*comatprototypes.RepoDescribe_Output, error) { 158 + panic("not yet implemented") 159 + } 160 + 161 + func (s *Server) handleComAtprotoRepoGetRecord(ctx context.Context, cid string, collection string, rkey string, user string) (*comatprototypes.RepoGetRecord_Output, error) { 162 + panic("not yet implemented") 163 + } 164 + 165 + func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context, after string, before string, collection string, limit int) (*comatprototypes.RepoListRecords_Output, error) { 166 + panic("not yet implemented") 167 + } 168 + 169 + func (s *Server) handleComAtprotoRepoPutRecord(ctx context.Context, input *comatprototypes.RepoPutRecord_Input) (*comatprototypes.RepoPutRecord_Output, error) { 170 + panic("not yet implemented") 171 + } 172 + 173 + func (s *Server) handleComAtprotoServerGetAccountsConfig(ctx context.Context) (*comatprototypes.ServerGetAccountsConfig_Output, error) { 174 + panic("not yet implemented") 175 + } 176 + 177 + func (s *Server) handleComAtprotoSessionCreate(ctx context.Context, input *comatprototypes.SessionCreate_Input) (*comatprototypes.SessionCreate_Output, error) { 178 + panic("not yet implemented") 179 + } 180 + 181 + func (s *Server) handleComAtprotoSessionDelete(ctx context.Context) error { 182 + panic("not yet implemented") 183 + } 184 + 185 + func (s *Server) handleComAtprotoSessionGet(ctx context.Context) (*comatprototypes.SessionGet_Output, error) { 186 + panic("not yet implemented") 187 + } 188 + 189 + func (s *Server) handleComAtprotoSessionRefresh(ctx context.Context) (*comatprototypes.SessionRefresh_Output, error) { 190 + panic("not yet implemented") 191 + } 192 + 193 + func (s *Server) handleComAtprotoSyncGetRepo(ctx context.Context, did string, from string) (io.Reader, error) { 194 + panic("not yet implemented") 195 + } 196 + 197 + func (s *Server) handleComAtprotoSyncGetRoot(ctx context.Context, did string) (*comatprototypes.SyncGetRoot_Output, error) { 198 + panic("not yet implemented") 199 + } 200 + 201 + func (s *Server) handleComAtprotoSyncUpdateRepo(ctx context.Context, r io.Reader) error { 202 + panic("not yet implemented") 203 + }
+53
api/server/keygen_test.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "bytes" 5 + "crypto/ecdsa" 6 + "crypto/elliptic" 7 + "encoding/json" 8 + "fmt" 9 + "testing" 10 + 11 + "github.com/lestrrat-go/jwx/v2/jwk" 12 + ) 13 + 14 + // make a root signing key for testing 15 + func TestJWK_GenKey(t *testing.T) { 16 + // to get the same values every time, we need to create a static source 17 + // of "randomness" 18 + rdr := bytes.NewReader([]byte("01234567890123456789012345678901234567890123456789ABCDEF")) 19 + raw, err := ecdsa.GenerateKey(elliptic.P384(), rdr) 20 + if err != nil { 21 + fmt.Printf("failed to generate new ECDSA private key: %s\n", err) 22 + return 23 + } 24 + 25 + key, err := jwk.FromRaw(raw) 26 + if err != nil { 27 + fmt.Printf("failed to create ECDSA key: %s\n", err) 28 + return 29 + } 30 + if _, ok := key.(jwk.ECDSAPrivateKey); !ok { 31 + fmt.Printf("expected jwk.ECDSAPrivateKey, got %T\n", key) 32 + return 33 + } 34 + 35 + key.Set(jwk.KeyIDKey, "mykey") 36 + 37 + buf, err := json.MarshalIndent(key, "", " ") 38 + if err != nil { 39 + fmt.Printf("failed to marshal key into JSON: %s\n", err) 40 + return 41 + } 42 + fmt.Printf("%s\n", buf) 43 + 44 + // OUTPUT: 45 + // { 46 + // "crv": "P-384", 47 + // "d": "ODkwMTIzNDU2Nzg5MDEyMz7deMbyLt8g4cjcxozuIoygLLlAeoQ1AfM9TSvxkFHJ", 48 + // "kid": "mykey", 49 + // "kty": "EC", 50 + // "x": "gvvRMqm1w5aHn7sVNA2QUJeOVcedUnmiug6VhU834gzS9k87crVwu9dz7uLOdoQl", 51 + // "y": "7fVF7b6J_6_g6Wu9RuJw8geWxEi5ja9Gp2TSdELm5u2E-M7IF-bsxqcdOj3n1n7N" 52 + // } 53 + }
+92
api/server/server.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "crypto/ecdsa" 5 + "crypto/elliptic" 6 + "fmt" 7 + "os" 8 + 9 + "github.com/golang-jwt/jwt" 10 + "github.com/labstack/echo/v4" 11 + "github.com/labstack/echo/v4/middleware" 12 + jwk "github.com/lestrrat-go/jwx/jwk" 13 + "github.com/whyrusleeping/gosky/carstore" 14 + "gorm.io/gorm" 15 + ) 16 + 17 + type Server struct { 18 + db *gorm.DB 19 + cs *carstore.CarStore 20 + signingKey []byte 21 + 22 + fakeDid *FakeDid 23 + } 24 + 25 + func NewServer(db *gorm.DB, cs *carstore.CarStore, kfile string) (*Server, error) { 26 + kb, err := os.ReadFile(kfile) 27 + if err != nil { 28 + return nil, err 29 + } 30 + 31 + sk, err := jwk.ParseKey(kb) 32 + if err != nil { 33 + return nil, err 34 + } 35 + 36 + var spk ecdsa.PrivateKey 37 + if err := sk.Raw(&spk); err != nil { 38 + return nil, err 39 + } 40 + 41 + serkey := elliptic.Marshal(spk.Curve, spk.X, spk.Y) 42 + 43 + db.AutoMigrate(&User{}) 44 + 45 + return &Server{ 46 + signingKey: serkey, 47 + db: db, 48 + cs: cs, 49 + fakeDid: NewFakeDid(db), 50 + }, nil 51 + } 52 + 53 + func (s *Server) RunAPI(listen string) error { 54 + e := echo.New() 55 + 56 + cfg := middleware.JWTConfig{ 57 + KeyFunc: s.getKey, 58 + SigningKey: s.signingKey, 59 + } 60 + 61 + e.HTTPErrorHandler = func(err error, ctx echo.Context) { 62 + fmt.Println("HANDLER ERROR: ", err) 63 + } 64 + 65 + s.RegisterHandlersComAtproto(e.Group("")) 66 + s.RegisterHandlersAppBsky(e.Group("", middleware.JWTWithConfig(cfg))) 67 + 68 + return e.Start(listen) 69 + } 70 + 71 + type User struct { 72 + gorm.Model 73 + Handle string 74 + Password string 75 + RecoveryKey string 76 + DID string 77 + } 78 + 79 + func (s *Server) handleAuth(next echo.HandlerFunc) echo.HandlerFunc { 80 + return func(c echo.Context) error { 81 + authstr := c.Request().Header.Get("Authorization") 82 + _ = authstr 83 + 84 + return nil 85 + } 86 + } 87 + 88 + func (s *Server) getKey(token *jwt.Token) (interface{}, error) { 89 + fmt.Println("token: ", token) 90 + 91 + return nil, nil 92 + }
+775
api/server/stubs.go
··· 1 + package schemagen 2 + 3 + import ( 4 + "io" 5 + "strconv" 6 + 7 + "github.com/labstack/echo/v4" 8 + comatprototypes "github.com/whyrusleeping/gosky/api/atproto" 9 + appbskytypes "github.com/whyrusleeping/gosky/api/bsky" 10 + "go.opentelemetry.io/otel" 11 + ) 12 + 13 + func (s *Server) RegisterHandlersAppBsky(e *echo.Group) error { 14 + e.POST("/xrpc/app.bsky.actor.createScene", s.HandleAppBskyActorCreateScene) 15 + e.GET("/xrpc/app.bsky.actor.getProfile", s.HandleAppBskyActorGetProfile) 16 + e.GET("/xrpc/app.bsky.actor.getSuggestions", s.HandleAppBskyActorGetSuggestions) 17 + e.GET("/xrpc/app.bsky.actor.search", s.HandleAppBskyActorSearch) 18 + e.GET("/xrpc/app.bsky.actor.searchTypeahead", s.HandleAppBskyActorSearchTypeahead) 19 + e.POST("/xrpc/app.bsky.actor.updateProfile", s.HandleAppBskyActorUpdateProfile) 20 + e.GET("/xrpc/app.bsky.feed.getAuthorFeed", s.HandleAppBskyFeedGetAuthorFeed) 21 + e.GET("/xrpc/app.bsky.feed.getPostThread", s.HandleAppBskyFeedGetPostThread) 22 + e.GET("/xrpc/app.bsky.feed.getRepostedBy", s.HandleAppBskyFeedGetRepostedBy) 23 + e.GET("/xrpc/app.bsky.feed.getTimeline", s.HandleAppBskyFeedGetTimeline) 24 + e.GET("/xrpc/app.bsky.feed.getVotes", s.HandleAppBskyFeedGetVotes) 25 + e.POST("/xrpc/app.bsky.feed.setVote", s.HandleAppBskyFeedSetVote) 26 + e.GET("/xrpc/app.bsky.graph.getAssertions", s.HandleAppBskyGraphGetAssertions) 27 + e.GET("/xrpc/app.bsky.graph.getFollowers", s.HandleAppBskyGraphGetFollowers) 28 + e.GET("/xrpc/app.bsky.graph.getFollows", s.HandleAppBskyGraphGetFollows) 29 + e.GET("/xrpc/app.bsky.graph.getMembers", s.HandleAppBskyGraphGetMembers) 30 + e.GET("/xrpc/app.bsky.graph.getMemberships", s.HandleAppBskyGraphGetMemberships) 31 + e.GET("/xrpc/app.bsky.notification.getCount", s.HandleAppBskyNotificationGetCount) 32 + e.GET("/xrpc/app.bsky.notification.list", s.HandleAppBskyNotificationList) 33 + e.POST("/xrpc/app.bsky.notification.updateSeen", s.HandleAppBskyNotificationUpdateSeen) 34 + return nil 35 + } 36 + 37 + func (s *Server) HandleAppBskyActorCreateScene(c echo.Context) error { 38 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorCreateScene") 39 + defer span.End() 40 + 41 + var body appbskytypes.ActorCreateScene_Input 42 + if err := c.Bind(&body); err != nil { 43 + return err 44 + } 45 + var out *appbskytypes.ActorCreateScene_Output 46 + var handleErr error 47 + // func (s *Server) handleAppBskyActorCreateScene(ctx context.Context,body appbskytypes.ActorCreateScene_Input) (*appbskytypes.ActorCreateScene_Output, error) 48 + out, handleErr = s.handleAppBskyActorCreateScene(ctx, &body) 49 + if handleErr != nil { 50 + return handleErr 51 + } 52 + return c.JSON(200, out) 53 + } 54 + 55 + func (s *Server) HandleAppBskyActorGetProfile(c echo.Context) error { 56 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorGetProfile") 57 + defer span.End() 58 + actor := c.QueryParam("actor") 59 + var out *appbskytypes.ActorGetProfile_Output 60 + var handleErr error 61 + // func (s *Server) handleAppBskyActorGetProfile(ctx context.Context,actor string) (*appbskytypes.ActorGetProfile_Output, error) 62 + out, handleErr = s.handleAppBskyActorGetProfile(ctx, actor) 63 + if handleErr != nil { 64 + return handleErr 65 + } 66 + return c.JSON(200, out) 67 + } 68 + 69 + func (s *Server) HandleAppBskyActorGetSuggestions(c echo.Context) error { 70 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorGetSuggestions") 71 + defer span.End() 72 + cursor := c.QueryParam("cursor") 73 + 74 + limit, err := strconv.Atoi(c.QueryParam("limit")) 75 + if err != nil { 76 + return err 77 + } 78 + var out *appbskytypes.ActorGetSuggestions_Output 79 + var handleErr error 80 + // func (s *Server) handleAppBskyActorGetSuggestions(ctx context.Context,cursor string,limit int) (*appbskytypes.ActorGetSuggestions_Output, error) 81 + out, handleErr = s.handleAppBskyActorGetSuggestions(ctx, cursor, limit) 82 + if handleErr != nil { 83 + return handleErr 84 + } 85 + return c.JSON(200, out) 86 + } 87 + 88 + func (s *Server) HandleAppBskyActorSearch(c echo.Context) error { 89 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorSearch") 90 + defer span.End() 91 + before := c.QueryParam("before") 92 + 93 + limit, err := strconv.Atoi(c.QueryParam("limit")) 94 + if err != nil { 95 + return err 96 + } 97 + term := c.QueryParam("term") 98 + var out *appbskytypes.ActorSearch_Output 99 + var handleErr error 100 + // func (s *Server) handleAppBskyActorSearch(ctx context.Context,before string,limit int,term string) (*appbskytypes.ActorSearch_Output, error) 101 + out, handleErr = s.handleAppBskyActorSearch(ctx, before, limit, term) 102 + if handleErr != nil { 103 + return handleErr 104 + } 105 + return c.JSON(200, out) 106 + } 107 + 108 + func (s *Server) HandleAppBskyActorSearchTypeahead(c echo.Context) error { 109 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorSearchTypeahead") 110 + defer span.End() 111 + 112 + limit, err := strconv.Atoi(c.QueryParam("limit")) 113 + if err != nil { 114 + return err 115 + } 116 + term := c.QueryParam("term") 117 + var out *appbskytypes.ActorSearchTypeahead_Output 118 + var handleErr error 119 + // func (s *Server) handleAppBskyActorSearchTypeahead(ctx context.Context,limit int,term string) (*appbskytypes.ActorSearchTypeahead_Output, error) 120 + out, handleErr = s.handleAppBskyActorSearchTypeahead(ctx, limit, term) 121 + if handleErr != nil { 122 + return handleErr 123 + } 124 + return c.JSON(200, out) 125 + } 126 + 127 + func (s *Server) HandleAppBskyActorUpdateProfile(c echo.Context) error { 128 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorUpdateProfile") 129 + defer span.End() 130 + 131 + var body appbskytypes.ActorUpdateProfile_Input 132 + if err := c.Bind(&body); err != nil { 133 + return err 134 + } 135 + var out *appbskytypes.ActorUpdateProfile_Output 136 + var handleErr error 137 + // func (s *Server) handleAppBskyActorUpdateProfile(ctx context.Context,body appbskytypes.ActorUpdateProfile_Input) (*appbskytypes.ActorUpdateProfile_Output, error) 138 + out, handleErr = s.handleAppBskyActorUpdateProfile(ctx, &body) 139 + if handleErr != nil { 140 + return handleErr 141 + } 142 + return c.JSON(200, out) 143 + } 144 + 145 + func (s *Server) HandleAppBskyFeedGetAuthorFeed(c echo.Context) error { 146 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetAuthorFeed") 147 + defer span.End() 148 + author := c.QueryParam("author") 149 + before := c.QueryParam("before") 150 + 151 + limit, err := strconv.Atoi(c.QueryParam("limit")) 152 + if err != nil { 153 + return err 154 + } 155 + var out *appbskytypes.FeedGetAuthorFeed_Output 156 + var handleErr error 157 + // func (s *Server) handleAppBskyFeedGetAuthorFeed(ctx context.Context,author string,before string,limit int) (*appbskytypes.FeedGetAuthorFeed_Output, error) 158 + out, handleErr = s.handleAppBskyFeedGetAuthorFeed(ctx, author, before, limit) 159 + if handleErr != nil { 160 + return handleErr 161 + } 162 + return c.JSON(200, out) 163 + } 164 + 165 + func (s *Server) HandleAppBskyFeedGetPostThread(c echo.Context) error { 166 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetPostThread") 167 + defer span.End() 168 + 169 + depth, err := strconv.Atoi(c.QueryParam("depth")) 170 + if err != nil { 171 + return err 172 + } 173 + uri := c.QueryParam("uri") 174 + var out *appbskytypes.FeedGetPostThread_Output 175 + var handleErr error 176 + // func (s *Server) handleAppBskyFeedGetPostThread(ctx context.Context,depth int,uri string) (*appbskytypes.FeedGetPostThread_Output, error) 177 + out, handleErr = s.handleAppBskyFeedGetPostThread(ctx, depth, uri) 178 + if handleErr != nil { 179 + return handleErr 180 + } 181 + return c.JSON(200, out) 182 + } 183 + 184 + func (s *Server) HandleAppBskyFeedGetRepostedBy(c echo.Context) error { 185 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetRepostedBy") 186 + defer span.End() 187 + before := c.QueryParam("before") 188 + cid := c.QueryParam("cid") 189 + 190 + limit, err := strconv.Atoi(c.QueryParam("limit")) 191 + if err != nil { 192 + return err 193 + } 194 + uri := c.QueryParam("uri") 195 + var out *appbskytypes.FeedGetRepostedBy_Output 196 + var handleErr error 197 + // func (s *Server) handleAppBskyFeedGetRepostedBy(ctx context.Context,before string,cid string,limit int,uri string) (*appbskytypes.FeedGetRepostedBy_Output, error) 198 + out, handleErr = s.handleAppBskyFeedGetRepostedBy(ctx, before, cid, limit, uri) 199 + if handleErr != nil { 200 + return handleErr 201 + } 202 + return c.JSON(200, out) 203 + } 204 + 205 + func (s *Server) HandleAppBskyFeedGetTimeline(c echo.Context) error { 206 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetTimeline") 207 + defer span.End() 208 + algorithm := c.QueryParam("algorithm") 209 + before := c.QueryParam("before") 210 + 211 + limit, err := strconv.Atoi(c.QueryParam("limit")) 212 + if err != nil { 213 + return err 214 + } 215 + var out *appbskytypes.FeedGetTimeline_Output 216 + var handleErr error 217 + // func (s *Server) handleAppBskyFeedGetTimeline(ctx context.Context,algorithm string,before string,limit int) (*appbskytypes.FeedGetTimeline_Output, error) 218 + out, handleErr = s.handleAppBskyFeedGetTimeline(ctx, algorithm, before, limit) 219 + if handleErr != nil { 220 + return handleErr 221 + } 222 + return c.JSON(200, out) 223 + } 224 + 225 + func (s *Server) HandleAppBskyFeedGetVotes(c echo.Context) error { 226 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetVotes") 227 + defer span.End() 228 + before := c.QueryParam("before") 229 + cid := c.QueryParam("cid") 230 + direction := c.QueryParam("direction") 231 + 232 + limit, err := strconv.Atoi(c.QueryParam("limit")) 233 + if err != nil { 234 + return err 235 + } 236 + uri := c.QueryParam("uri") 237 + var out *appbskytypes.FeedGetVotes_Output 238 + var handleErr error 239 + // func (s *Server) handleAppBskyFeedGetVotes(ctx context.Context,before string,cid string,direction string,limit int,uri string) (*appbskytypes.FeedGetVotes_Output, error) 240 + out, handleErr = s.handleAppBskyFeedGetVotes(ctx, before, cid, direction, limit, uri) 241 + if handleErr != nil { 242 + return handleErr 243 + } 244 + return c.JSON(200, out) 245 + } 246 + 247 + func (s *Server) HandleAppBskyFeedSetVote(c echo.Context) error { 248 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedSetVote") 249 + defer span.End() 250 + 251 + var body appbskytypes.FeedSetVote_Input 252 + if err := c.Bind(&body); err != nil { 253 + return err 254 + } 255 + var out *appbskytypes.FeedSetVote_Output 256 + var handleErr error 257 + // func (s *Server) handleAppBskyFeedSetVote(ctx context.Context,body appbskytypes.FeedSetVote_Input) (*appbskytypes.FeedSetVote_Output, error) 258 + out, handleErr = s.handleAppBskyFeedSetVote(ctx, &body) 259 + if handleErr != nil { 260 + return handleErr 261 + } 262 + return c.JSON(200, out) 263 + } 264 + 265 + func (s *Server) HandleAppBskyGraphGetAssertions(c echo.Context) error { 266 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetAssertions") 267 + defer span.End() 268 + assertion := c.QueryParam("assertion") 269 + author := c.QueryParam("author") 270 + before := c.QueryParam("before") 271 + var out *appbskytypes.GraphGetAssertions_Output 272 + var handleErr error 273 + // func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context,assertion string,author string,before string) (*appbskytypes.GraphGetAssertions_Output, error) 274 + out, handleErr = s.handleAppBskyGraphGetAssertions(ctx, assertion, author, before) 275 + if handleErr != nil { 276 + return handleErr 277 + } 278 + return c.JSON(200, out) 279 + } 280 + 281 + func (s *Server) HandleAppBskyGraphGetFollowers(c echo.Context) error { 282 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetFollowers") 283 + defer span.End() 284 + before := c.QueryParam("before") 285 + 286 + limit, err := strconv.Atoi(c.QueryParam("limit")) 287 + if err != nil { 288 + return err 289 + } 290 + user := c.QueryParam("user") 291 + var out *appbskytypes.GraphGetFollowers_Output 292 + var handleErr error 293 + // func (s *Server) handleAppBskyGraphGetFollowers(ctx context.Context,before string,limit int,user string) (*appbskytypes.GraphGetFollowers_Output, error) 294 + out, handleErr = s.handleAppBskyGraphGetFollowers(ctx, before, limit, user) 295 + if handleErr != nil { 296 + return handleErr 297 + } 298 + return c.JSON(200, out) 299 + } 300 + 301 + func (s *Server) HandleAppBskyGraphGetFollows(c echo.Context) error { 302 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetFollows") 303 + defer span.End() 304 + before := c.QueryParam("before") 305 + 306 + limit, err := strconv.Atoi(c.QueryParam("limit")) 307 + if err != nil { 308 + return err 309 + } 310 + user := c.QueryParam("user") 311 + var out *appbskytypes.GraphGetFollows_Output 312 + var handleErr error 313 + // func (s *Server) handleAppBskyGraphGetFollows(ctx context.Context,before string,limit int,user string) (*appbskytypes.GraphGetFollows_Output, error) 314 + out, handleErr = s.handleAppBskyGraphGetFollows(ctx, before, limit, user) 315 + if handleErr != nil { 316 + return handleErr 317 + } 318 + return c.JSON(200, out) 319 + } 320 + 321 + func (s *Server) HandleAppBskyGraphGetMembers(c echo.Context) error { 322 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetMembers") 323 + defer span.End() 324 + actor := c.QueryParam("actor") 325 + before := c.QueryParam("before") 326 + 327 + limit, err := strconv.Atoi(c.QueryParam("limit")) 328 + if err != nil { 329 + return err 330 + } 331 + var out *appbskytypes.GraphGetMembers_Output 332 + var handleErr error 333 + // func (s *Server) handleAppBskyGraphGetMembers(ctx context.Context,actor string,before string,limit int) (*appbskytypes.GraphGetMembers_Output, error) 334 + out, handleErr = s.handleAppBskyGraphGetMembers(ctx, actor, before, limit) 335 + if handleErr != nil { 336 + return handleErr 337 + } 338 + return c.JSON(200, out) 339 + } 340 + 341 + func (s *Server) HandleAppBskyGraphGetMemberships(c echo.Context) error { 342 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetMemberships") 343 + defer span.End() 344 + actor := c.QueryParam("actor") 345 + before := c.QueryParam("before") 346 + 347 + limit, err := strconv.Atoi(c.QueryParam("limit")) 348 + if err != nil { 349 + return err 350 + } 351 + var out *appbskytypes.GraphGetMemberships_Output 352 + var handleErr error 353 + // func (s *Server) handleAppBskyGraphGetMemberships(ctx context.Context,actor string,before string,limit int) (*appbskytypes.GraphGetMemberships_Output, error) 354 + out, handleErr = s.handleAppBskyGraphGetMemberships(ctx, actor, before, limit) 355 + if handleErr != nil { 356 + return handleErr 357 + } 358 + return c.JSON(200, out) 359 + } 360 + 361 + func (s *Server) HandleAppBskyNotificationGetCount(c echo.Context) error { 362 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationGetCount") 363 + defer span.End() 364 + var out *appbskytypes.NotificationGetCount_Output 365 + var handleErr error 366 + // func (s *Server) handleAppBskyNotificationGetCount(ctx context.Context) (*appbskytypes.NotificationGetCount_Output, error) 367 + out, handleErr = s.handleAppBskyNotificationGetCount(ctx) 368 + if handleErr != nil { 369 + return handleErr 370 + } 371 + return c.JSON(200, out) 372 + } 373 + 374 + func (s *Server) HandleAppBskyNotificationList(c echo.Context) error { 375 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationList") 376 + defer span.End() 377 + before := c.QueryParam("before") 378 + 379 + limit, err := strconv.Atoi(c.QueryParam("limit")) 380 + if err != nil { 381 + return err 382 + } 383 + var out *appbskytypes.NotificationList_Output 384 + var handleErr error 385 + // func (s *Server) handleAppBskyNotificationList(ctx context.Context,before string,limit int) (*appbskytypes.NotificationList_Output, error) 386 + out, handleErr = s.handleAppBskyNotificationList(ctx, before, limit) 387 + if handleErr != nil { 388 + return handleErr 389 + } 390 + return c.JSON(200, out) 391 + } 392 + 393 + func (s *Server) HandleAppBskyNotificationUpdateSeen(c echo.Context) error { 394 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationUpdateSeen") 395 + defer span.End() 396 + 397 + var body appbskytypes.NotificationUpdateSeen_Input 398 + if err := c.Bind(&body); err != nil { 399 + return err 400 + } 401 + var handleErr error 402 + // func (s *Server) handleAppBskyNotificationUpdateSeen(ctx context.Context,body appbskytypes.NotificationUpdateSeen_Input) error 403 + handleErr = s.handleAppBskyNotificationUpdateSeen(ctx, &body) 404 + if handleErr != nil { 405 + return handleErr 406 + } 407 + return nil 408 + } 409 + 410 + func (s *Server) RegisterHandlersComAtproto(e *echo.Group) error { 411 + e.POST("/xrpc/com.atproto.account.create", s.HandleComAtprotoAccountCreate) 412 + e.POST("/xrpc/com.atproto.account.createInviteCode", s.HandleComAtprotoAccountCreateInviteCode) 413 + e.POST("/xrpc/com.atproto.account.delete", s.HandleComAtprotoAccountDelete) 414 + e.GET("/xrpc/com.atproto.account.get", s.HandleComAtprotoAccountGet) 415 + e.POST("/xrpc/com.atproto.account.requestPasswordReset", s.HandleComAtprotoAccountRequestPasswordReset) 416 + e.POST("/xrpc/com.atproto.account.resetPassword", s.HandleComAtprotoAccountResetPassword) 417 + e.GET("/xrpc/com.atproto.handle.resolve", s.HandleComAtprotoHandleResolve) 418 + e.POST("/xrpc/com.atproto.repo.batchWrite", s.HandleComAtprotoRepoBatchWrite) 419 + e.POST("/xrpc/com.atproto.repo.createRecord", s.HandleComAtprotoRepoCreateRecord) 420 + e.POST("/xrpc/com.atproto.repo.deleteRecord", s.HandleComAtprotoRepoDeleteRecord) 421 + e.GET("/xrpc/com.atproto.repo.describe", s.HandleComAtprotoRepoDescribe) 422 + e.GET("/xrpc/com.atproto.repo.getRecord", s.HandleComAtprotoRepoGetRecord) 423 + e.GET("/xrpc/com.atproto.repo.listRecords", s.HandleComAtprotoRepoListRecords) 424 + e.POST("/xrpc/com.atproto.repo.putRecord", s.HandleComAtprotoRepoPutRecord) 425 + e.GET("/xrpc/com.atproto.server.getAccountsConfig", s.HandleComAtprotoServerGetAccountsConfig) 426 + e.POST("/xrpc/com.atproto.session.create", s.HandleComAtprotoSessionCreate) 427 + e.POST("/xrpc/com.atproto.session.delete", s.HandleComAtprotoSessionDelete) 428 + e.GET("/xrpc/com.atproto.session.get", s.HandleComAtprotoSessionGet) 429 + e.POST("/xrpc/com.atproto.session.refresh", s.HandleComAtprotoSessionRefresh) 430 + e.GET("/xrpc/com.atproto.sync.getRepo", s.HandleComAtprotoSyncGetRepo) 431 + e.GET("/xrpc/com.atproto.sync.getRoot", s.HandleComAtprotoSyncGetRoot) 432 + e.POST("/xrpc/com.atproto.sync.updateRepo", s.HandleComAtprotoSyncUpdateRepo) 433 + return nil 434 + } 435 + 436 + func (s *Server) HandleComAtprotoAccountCreate(c echo.Context) error { 437 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountCreate") 438 + defer span.End() 439 + 440 + var body comatprototypes.AccountCreate_Input 441 + if err := c.Bind(&body); err != nil { 442 + return err 443 + } 444 + var out *comatprototypes.AccountCreate_Output 445 + var handleErr error 446 + // func (s *Server) handleComAtprotoAccountCreate(ctx context.Context,body comatprototypes.AccountCreate_Input) (*comatprototypes.AccountCreate_Output, error) 447 + out, handleErr = s.handleComAtprotoAccountCreate(ctx, &body) 448 + if handleErr != nil { 449 + return handleErr 450 + } 451 + return c.JSON(200, out) 452 + } 453 + 454 + func (s *Server) HandleComAtprotoAccountCreateInviteCode(c echo.Context) error { 455 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountCreateInviteCode") 456 + defer span.End() 457 + 458 + var body comatprototypes.AccountCreateInviteCode_Input 459 + if err := c.Bind(&body); err != nil { 460 + return err 461 + } 462 + var out *comatprototypes.AccountCreateInviteCode_Output 463 + var handleErr error 464 + // func (s *Server) handleComAtprotoAccountCreateInviteCode(ctx context.Context,body comatprototypes.AccountCreateInviteCode_Input) (*comatprototypes.AccountCreateInviteCode_Output, error) 465 + out, handleErr = s.handleComAtprotoAccountCreateInviteCode(ctx, &body) 466 + if handleErr != nil { 467 + return handleErr 468 + } 469 + return c.JSON(200, out) 470 + } 471 + 472 + func (s *Server) HandleComAtprotoAccountDelete(c echo.Context) error { 473 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountDelete") 474 + defer span.End() 475 + var handleErr error 476 + // func (s *Server) handleComAtprotoAccountDelete(ctx context.Context) error 477 + handleErr = s.handleComAtprotoAccountDelete(ctx) 478 + if handleErr != nil { 479 + return handleErr 480 + } 481 + return nil 482 + } 483 + 484 + func (s *Server) HandleComAtprotoAccountGet(c echo.Context) error { 485 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountGet") 486 + defer span.End() 487 + var handleErr error 488 + // func (s *Server) handleComAtprotoAccountGet(ctx context.Context) error 489 + handleErr = s.handleComAtprotoAccountGet(ctx) 490 + if handleErr != nil { 491 + return handleErr 492 + } 493 + return nil 494 + } 495 + 496 + func (s *Server) HandleComAtprotoAccountRequestPasswordReset(c echo.Context) error { 497 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountRequestPasswordReset") 498 + defer span.End() 499 + 500 + var body comatprototypes.AccountRequestPasswordReset_Input 501 + if err := c.Bind(&body); err != nil { 502 + return err 503 + } 504 + var handleErr error 505 + // func (s *Server) handleComAtprotoAccountRequestPasswordReset(ctx context.Context,body comatprototypes.AccountRequestPasswordReset_Input) error 506 + handleErr = s.handleComAtprotoAccountRequestPasswordReset(ctx, &body) 507 + if handleErr != nil { 508 + return handleErr 509 + } 510 + return nil 511 + } 512 + 513 + func (s *Server) HandleComAtprotoAccountResetPassword(c echo.Context) error { 514 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountResetPassword") 515 + defer span.End() 516 + 517 + var body comatprototypes.AccountResetPassword_Input 518 + if err := c.Bind(&body); err != nil { 519 + return err 520 + } 521 + var handleErr error 522 + // func (s *Server) handleComAtprotoAccountResetPassword(ctx context.Context,body comatprototypes.AccountResetPassword_Input) error 523 + handleErr = s.handleComAtprotoAccountResetPassword(ctx, &body) 524 + if handleErr != nil { 525 + return handleErr 526 + } 527 + return nil 528 + } 529 + 530 + func (s *Server) HandleComAtprotoHandleResolve(c echo.Context) error { 531 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoHandleResolve") 532 + defer span.End() 533 + handle := c.QueryParam("handle") 534 + var out *comatprototypes.HandleResolve_Output 535 + var handleErr error 536 + // func (s *Server) handleComAtprotoHandleResolve(ctx context.Context,handle string) (*comatprototypes.HandleResolve_Output, error) 537 + out, handleErr = s.handleComAtprotoHandleResolve(ctx, handle) 538 + if handleErr != nil { 539 + return handleErr 540 + } 541 + return c.JSON(200, out) 542 + } 543 + 544 + func (s *Server) HandleComAtprotoRepoBatchWrite(c echo.Context) error { 545 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoBatchWrite") 546 + defer span.End() 547 + 548 + var body comatprototypes.RepoBatchWrite_Input 549 + if err := c.Bind(&body); err != nil { 550 + return err 551 + } 552 + var handleErr error 553 + // func (s *Server) handleComAtprotoRepoBatchWrite(ctx context.Context,body comatprototypes.RepoBatchWrite_Input) error 554 + handleErr = s.handleComAtprotoRepoBatchWrite(ctx, &body) 555 + if handleErr != nil { 556 + return handleErr 557 + } 558 + return nil 559 + } 560 + 561 + func (s *Server) HandleComAtprotoRepoCreateRecord(c echo.Context) error { 562 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoCreateRecord") 563 + defer span.End() 564 + 565 + var body comatprototypes.RepoCreateRecord_Input 566 + if err := c.Bind(&body); err != nil { 567 + return err 568 + } 569 + var out *comatprototypes.RepoCreateRecord_Output 570 + var handleErr error 571 + // func (s *Server) handleComAtprotoRepoCreateRecord(ctx context.Context,body comatprototypes.RepoCreateRecord_Input) (*comatprototypes.RepoCreateRecord_Output, error) 572 + out, handleErr = s.handleComAtprotoRepoCreateRecord(ctx, &body) 573 + if handleErr != nil { 574 + return handleErr 575 + } 576 + return c.JSON(200, out) 577 + } 578 + 579 + func (s *Server) HandleComAtprotoRepoDeleteRecord(c echo.Context) error { 580 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDeleteRecord") 581 + defer span.End() 582 + 583 + var body comatprototypes.RepoDeleteRecord_Input 584 + if err := c.Bind(&body); err != nil { 585 + return err 586 + } 587 + var handleErr error 588 + // func (s *Server) handleComAtprotoRepoDeleteRecord(ctx context.Context,body comatprototypes.RepoDeleteRecord_Input) error 589 + handleErr = s.handleComAtprotoRepoDeleteRecord(ctx, &body) 590 + if handleErr != nil { 591 + return handleErr 592 + } 593 + return nil 594 + } 595 + 596 + func (s *Server) HandleComAtprotoRepoDescribe(c echo.Context) error { 597 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDescribe") 598 + defer span.End() 599 + user := c.QueryParam("user") 600 + var out *comatprototypes.RepoDescribe_Output 601 + var handleErr error 602 + // func (s *Server) handleComAtprotoRepoDescribe(ctx context.Context,user string) (*comatprototypes.RepoDescribe_Output, error) 603 + out, handleErr = s.handleComAtprotoRepoDescribe(ctx, user) 604 + if handleErr != nil { 605 + return handleErr 606 + } 607 + return c.JSON(200, out) 608 + } 609 + 610 + func (s *Server) HandleComAtprotoRepoGetRecord(c echo.Context) error { 611 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoGetRecord") 612 + defer span.End() 613 + cid := c.QueryParam("cid") 614 + collection := c.QueryParam("collection") 615 + rkey := c.QueryParam("rkey") 616 + user := c.QueryParam("user") 617 + var out *comatprototypes.RepoGetRecord_Output 618 + var handleErr error 619 + // func (s *Server) handleComAtprotoRepoGetRecord(ctx context.Context,cid string,collection string,rkey string,user string) (*comatprototypes.RepoGetRecord_Output, error) 620 + out, handleErr = s.handleComAtprotoRepoGetRecord(ctx, cid, collection, rkey, user) 621 + if handleErr != nil { 622 + return handleErr 623 + } 624 + return c.JSON(200, out) 625 + } 626 + 627 + func (s *Server) HandleComAtprotoRepoListRecords(c echo.Context) error { 628 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoListRecords") 629 + defer span.End() 630 + after := c.QueryParam("after") 631 + before := c.QueryParam("before") 632 + collection := c.QueryParam("collection") 633 + 634 + limit, err := strconv.Atoi(c.QueryParam("limit")) 635 + if err != nil { 636 + return err 637 + } 638 + var out *comatprototypes.RepoListRecords_Output 639 + var handleErr error 640 + // func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context,after string,before string,collection string,limit int) (*comatprototypes.RepoListRecords_Output, error) 641 + out, handleErr = s.handleComAtprotoRepoListRecords(ctx, after, before, collection, limit) 642 + if handleErr != nil { 643 + return handleErr 644 + } 645 + return c.JSON(200, out) 646 + } 647 + 648 + func (s *Server) HandleComAtprotoRepoPutRecord(c echo.Context) error { 649 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoPutRecord") 650 + defer span.End() 651 + 652 + var body comatprototypes.RepoPutRecord_Input 653 + if err := c.Bind(&body); err != nil { 654 + return err 655 + } 656 + var out *comatprototypes.RepoPutRecord_Output 657 + var handleErr error 658 + // func (s *Server) handleComAtprotoRepoPutRecord(ctx context.Context,body comatprototypes.RepoPutRecord_Input) (*comatprototypes.RepoPutRecord_Output, error) 659 + out, handleErr = s.handleComAtprotoRepoPutRecord(ctx, &body) 660 + if handleErr != nil { 661 + return handleErr 662 + } 663 + return c.JSON(200, out) 664 + } 665 + 666 + func (s *Server) HandleComAtprotoServerGetAccountsConfig(c echo.Context) error { 667 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerGetAccountsConfig") 668 + defer span.End() 669 + var out *comatprototypes.ServerGetAccountsConfig_Output 670 + var handleErr error 671 + // func (s *Server) handleComAtprotoServerGetAccountsConfig(ctx context.Context) (*comatprototypes.ServerGetAccountsConfig_Output, error) 672 + out, handleErr = s.handleComAtprotoServerGetAccountsConfig(ctx) 673 + if handleErr != nil { 674 + return handleErr 675 + } 676 + return c.JSON(200, out) 677 + } 678 + 679 + func (s *Server) HandleComAtprotoSessionCreate(c echo.Context) error { 680 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionCreate") 681 + defer span.End() 682 + 683 + var body comatprototypes.SessionCreate_Input 684 + if err := c.Bind(&body); err != nil { 685 + return err 686 + } 687 + var out *comatprototypes.SessionCreate_Output 688 + var handleErr error 689 + // func (s *Server) handleComAtprotoSessionCreate(ctx context.Context,body comatprototypes.SessionCreate_Input) (*comatprototypes.SessionCreate_Output, error) 690 + out, handleErr = s.handleComAtprotoSessionCreate(ctx, &body) 691 + if handleErr != nil { 692 + return handleErr 693 + } 694 + return c.JSON(200, out) 695 + } 696 + 697 + func (s *Server) HandleComAtprotoSessionDelete(c echo.Context) error { 698 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionDelete") 699 + defer span.End() 700 + var handleErr error 701 + // func (s *Server) handleComAtprotoSessionDelete(ctx context.Context) error 702 + handleErr = s.handleComAtprotoSessionDelete(ctx) 703 + if handleErr != nil { 704 + return handleErr 705 + } 706 + return nil 707 + } 708 + 709 + func (s *Server) HandleComAtprotoSessionGet(c echo.Context) error { 710 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionGet") 711 + defer span.End() 712 + var out *comatprototypes.SessionGet_Output 713 + var handleErr error 714 + // func (s *Server) handleComAtprotoSessionGet(ctx context.Context) (*comatprototypes.SessionGet_Output, error) 715 + out, handleErr = s.handleComAtprotoSessionGet(ctx) 716 + if handleErr != nil { 717 + return handleErr 718 + } 719 + return c.JSON(200, out) 720 + } 721 + 722 + func (s *Server) HandleComAtprotoSessionRefresh(c echo.Context) error { 723 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionRefresh") 724 + defer span.End() 725 + var out *comatprototypes.SessionRefresh_Output 726 + var handleErr error 727 + // func (s *Server) handleComAtprotoSessionRefresh(ctx context.Context) (*comatprototypes.SessionRefresh_Output, error) 728 + out, handleErr = s.handleComAtprotoSessionRefresh(ctx) 729 + if handleErr != nil { 730 + return handleErr 731 + } 732 + return c.JSON(200, out) 733 + } 734 + 735 + func (s *Server) HandleComAtprotoSyncGetRepo(c echo.Context) error { 736 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetRepo") 737 + defer span.End() 738 + did := c.QueryParam("did") 739 + from := c.QueryParam("from") 740 + var out io.Reader 741 + var handleErr error 742 + // func (s *Server) handleComAtprotoSyncGetRepo(ctx context.Context,did string,from string) (io.Reader, error) 743 + out, handleErr = s.handleComAtprotoSyncGetRepo(ctx, did, from) 744 + if handleErr != nil { 745 + return handleErr 746 + } 747 + return c.JSON(200, out) 748 + } 749 + 750 + func (s *Server) HandleComAtprotoSyncGetRoot(c echo.Context) error { 751 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetRoot") 752 + defer span.End() 753 + did := c.QueryParam("did") 754 + var out *comatprototypes.SyncGetRoot_Output 755 + var handleErr error 756 + // func (s *Server) handleComAtprotoSyncGetRoot(ctx context.Context,did string) (*comatprototypes.SyncGetRoot_Output, error) 757 + out, handleErr = s.handleComAtprotoSyncGetRoot(ctx, did) 758 + if handleErr != nil { 759 + return handleErr 760 + } 761 + return c.JSON(200, out) 762 + } 763 + 764 + func (s *Server) HandleComAtprotoSyncUpdateRepo(c echo.Context) error { 765 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncUpdateRepo") 766 + defer span.End() 767 + body := c.Request().Body 768 + var handleErr error 769 + // func (s *Server) handleComAtprotoSyncUpdateRepo(ctx context.Context,r io.Reader) error 770 + handleErr = s.handleComAtprotoSyncUpdateRepo(ctx, body) 771 + if handleErr != nil { 772 + return handleErr 773 + } 774 + return nil 775 + }
+39
cmd/pds/main.go
··· 1 + package main 2 + 3 + import ( 4 + "github.com/urfave/cli/v2" 5 + server "github.com/whyrusleeping/gosky/api/server" 6 + "github.com/whyrusleeping/gosky/carstore" 7 + "gorm.io/driver/sqlite" 8 + "gorm.io/gorm" 9 + ) 10 + 11 + func main() { 12 + app := cli.NewApp() 13 + 14 + app.Action = func(cctx *cli.Context) error { 15 + db, err := gorm.Open(sqlite.Open("pds.db")) 16 + if err != nil { 17 + return err 18 + } 19 + 20 + carstdb, err := gorm.Open(sqlite.Open("carstore.db")) 21 + if err != nil { 22 + return err 23 + } 24 + 25 + cs, err := carstore.NewCarStore(carstdb, "carstore") 26 + if err != nil { 27 + return err 28 + } 29 + 30 + srv, err := server.NewServer(db, cs, "server.key") 31 + if err != nil { 32 + return err 33 + } 34 + 35 + return srv.RunAPI(":4989") 36 + } 37 + 38 + app.RunAndExitOnError() 39 + }
+6 -1
go.mod
··· 3 3 go 1.18 4 4 5 5 require ( 6 + github.com/golang-jwt/jwt v3.2.2+incompatible 6 7 github.com/ipfs/go-block-format v0.0.3 7 8 github.com/ipfs/go-bs-sqlite3 v0.0.0-20221122195556-bfcee1be620d 8 9 github.com/ipfs/go-car v0.0.4 ··· 15 16 github.com/ipld/go-car v0.5.0 16 17 github.com/ipld/go-car/v2 v2.5.1 17 18 github.com/labstack/echo/v4 v4.7.2 19 + github.com/lestrrat-go/jwx v1.2.25 18 20 github.com/multiformats/go-multihash v0.1.0 19 21 github.com/urfave/cli/v2 v2.23.0 20 22 github.com/whyrusleeping/cbor-gen v0.0.0-20221120232258-33755d0abe95 ··· 51 53 github.com/jinzhu/now v1.1.5 // indirect 52 54 github.com/klauspost/cpuid/v2 v2.0.9 // indirect 53 55 github.com/labstack/gommon v0.3.1 // indirect 56 + github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect 54 57 github.com/lestrrat-go/blackmagic v1.0.1 // indirect 55 58 github.com/lestrrat-go/httpcc v1.0.1 // indirect 56 59 github.com/lestrrat-go/httprc v1.0.1 // indirect ··· 69 72 github.com/multiformats/go-multicodec v0.5.0 // indirect 70 73 github.com/multiformats/go-varint v0.0.6 // indirect 71 74 github.com/opentracing/opentracing-go v1.2.0 // indirect 75 + github.com/pkg/errors v0.9.1 // indirect 72 76 github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect 73 77 github.com/russross/blackfriday/v2 v2.1.0 // indirect 74 78 github.com/spaolacci/murmur3 v1.1.0 // indirect ··· 80 84 go.uber.org/atomic v1.7.0 // indirect 81 85 go.uber.org/multierr v1.7.0 // indirect 82 86 go.uber.org/zap v1.16.0 // indirect 83 - golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect 87 + golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect 84 88 golang.org/x/exp v0.0.0-20210615023648-acb5c1269671 // indirect 85 89 golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect 86 90 golang.org/x/sys v0.0.0-20211103235746-7861aae1554b // indirect 87 91 golang.org/x/text v0.3.7 // indirect 92 + golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect 88 93 google.golang.org/protobuf v1.27.1 // indirect 89 94 lukechampine.com/blake3 v1.1.6 // indirect 90 95 )
+13 -1
go.sum
··· 96 96 github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= 97 97 github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= 98 98 github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= 99 + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE= 99 100 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= 100 101 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= 101 102 github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= ··· 151 152 github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= 152 153 github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 153 154 github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 155 + github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= 156 + github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= 154 157 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 155 158 github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 156 159 github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= ··· 438 441 github.com/labstack/echo/v4 v4.7.2/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= 439 442 github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= 440 443 github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= 444 + github.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A= 445 + github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= 446 + github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ= 441 447 github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= 442 448 github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= 443 449 github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= 444 450 github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= 445 451 github.com/lestrrat-go/httprc v1.0.1 h1:Cnc4NxIySph38pQPzKbjg5OkKsGR/Cf5xcWt5OlSUDI= 446 452 github.com/lestrrat-go/httprc v1.0.1/go.mod h1:5Ml+nB++j6IC0e6LzefJnrpMQDKgDwDCaIQQzhbqhJM= 453 + github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= 447 454 github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= 448 455 github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= 456 + github.com/lestrrat-go/jwx v1.2.25 h1:tAx93jN2SdPvFn08fHNAhqFJazn5mBBOB8Zli0g0otA= 457 + github.com/lestrrat-go/jwx v1.2.25/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY= 449 458 github.com/lestrrat-go/jwx/v2 v2.0.0 h1:P0ufz+eqGrKDSIdcTQXRbtOhBZ8gTXG6zlnoc/AH7hM= 450 459 github.com/lestrrat-go/jwx/v2 v2.0.0/go.mod h1:6JfwCE7IwHTaUBdNgNUmTYN8Cxi557CjJM764daXDao= 451 460 github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= ··· 1023 1032 golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= 1024 1033 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 1025 1034 golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= 1026 - golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= 1027 1035 golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 1036 + golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= 1037 + golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 1028 1038 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 1029 1039 golang.org/x/exp v0.0.0-20210615023648-acb5c1269671 h1:ddvpKwqE7dm58PoWjRCmaCiA3DANEW0zWGfNYQD212Y= 1030 1040 golang.org/x/exp v0.0.0-20210615023648-acb5c1269671/go.mod h1:DVyR6MI7P4kEQgvZJSj1fQGrWIi2RzIrfYWycwheUAc= ··· 1158 1168 golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 1159 1169 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 1160 1170 golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 1171 + golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= 1172 + golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 1161 1173 golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 1162 1174 golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 1163 1175 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+78 -23
lex/gen.go
··· 455 455 return err 456 456 } 457 457 458 - fname := filepath.Join(dir, "handlers.go") 459 - if err := writeCodeFile(buf.Bytes(), fname); err != nil { 460 - return err 461 - } 462 - 458 + fname := filepath.Join(dir, "handlers.go") 459 + if err := writeCodeFile(buf.Bytes(), fname); err != nil { 460 + return err 461 + } 463 462 464 463 } 465 464 ··· 481 480 fmt.Fprintf(w, "\t%s\"%s\"\n", importNameForPrefix(k), v) 482 481 } 483 482 fmt.Fprintf(w, ")\n\n") 484 - 485 483 486 484 for _, s := range schemas { 487 485 ··· 519 517 fmt.Fprintf(w, "\t\"encoding/json\"\n") 520 518 fmt.Fprintf(w, "\t\"github.com/whyrusleeping/gosky/xrpc\"\n") 521 519 fmt.Fprintf(w, "\t\"github.com/labstack/echo/v4\"\n") 520 + 521 + var prefixes []string 522 522 for k, v := range impmap { 523 + prefixes = append(prefixes, k) 523 524 fmt.Fprintf(w, "\t%s\"%s\"\n", importNameForPrefix(k), v) 524 525 } 525 526 fmt.Fprintf(w, ")\n\n") 526 527 527 - fmt.Fprintf(w, "func (s *Server) RegisterHandlers(e echo.Echo) error {\n") 528 + 529 + ssets := make(map[string][]*Schema) 528 530 for _, s := range schemas { 531 + var pref string 532 + for _, p := range prefixes { 533 + if strings.HasPrefix(s.ID, p) { 534 + pref = p 535 + break 536 + } 537 + } 538 + if pref == "" { 539 + return fmt.Errorf("no matching prefix for schema %q", s.ID) 540 + } 541 + 542 + ssets[pref] = append(ssets[pref], s) 543 + 544 + } 545 + 546 + for _, p := range prefixes { 547 + ss := ssets[p] 548 + 549 + fmt.Fprintf(w, "func (s *Server) RegisterHandlers%s(e *echo.Echo) error {\n", idToTitle(p)) 550 + for _, s := range ss { 529 551 530 552 main, ok := s.Defs["main"] 531 553 if !ok { ··· 547 569 548 570 fmt.Fprintf(w, "return nil\n}\n\n") 549 571 550 - for _, s := range schemas { 572 + for _, s := range ss { 551 573 552 574 var prefix string 553 575 for k := range impmap { ··· 571 593 } 572 594 } 573 595 } 596 + } 574 597 575 598 return nil 576 599 } ··· 601 624 return nil 602 625 }) 603 626 } 604 - } 627 + } 605 628 606 629 returndef := "error" 607 630 if s.Output != nil { ··· 609 632 case "application/json": 610 633 returndef = fmt.Sprintf("(*%s.%s_Output, error)", impname, shortname) 611 634 case "application/cbor": 612 - returndef = fmt.Sprintf("([]byte, error)" ) 635 + returndef = fmt.Sprintf("(io.Reader, error)") 613 636 default: 614 - return fmt.Errorf("unsupported encoding: %q", s.Output.Encoding) 637 + return fmt.Errorf("unrecognized output encoding: %q", s.Output.Encoding) 615 638 } 616 639 } 617 640 618 - fmt.Fprintf(w, "func (s *Server) handle%s(%s) %s\n", fname, strings.Join(paramtypes, ","), returndef) 641 + if s.Input != nil { 642 + switch s.Input.Encoding { 643 + case "application/json": 644 + paramtypes = append(paramtypes, fmt.Sprintf("input *%s.%s_Input", impname, shortname)) 645 + case "application/cbor": 646 + paramtypes = append(paramtypes, "r io.Reader") 647 + } 648 + } 649 + 650 + fmt.Fprintf(w, "func (s *Server) handle%s(%s) %s {\n", fname, strings.Join(paramtypes, ","), returndef) 651 + fmt.Fprintf(w, "panic(\"not yet implemented\")\n}\n\n") 619 652 620 653 return nil 621 654 } ··· 656 689 }) 657 690 } 658 691 } else if s.Type == "procedure" { 659 - fmt.Fprintf(w, ` 660 - var body %s.%s 692 + if s.Input != nil { 693 + intname := impname + "." + tname + "_Input" 694 + switch s.Input.Encoding { 695 + case "application/json": 696 + fmt.Fprintf(w, ` 697 + var body %s 661 698 if err := c.Bind(&body); err != nil { 662 699 return err 663 700 } 664 - `, impname, tname+"_Input") 701 + `, intname) 702 + paramtypes = append(paramtypes, "body " + intname ) 703 + params = append(params, "&body") 704 + case "application/cbor": 705 + fmt.Fprintf(w, "body := c.Request().Body\n") 706 + paramtypes = append(paramtypes, "r io.Reader") 707 + params = append(params, "body") 708 + default: 709 + return fmt.Errorf("unrecognized input encoding: %q", s.Input.Encoding) 710 + } 711 + } 665 712 } else { 666 713 return fmt.Errorf("can only generate handlers for queries or procedures") 667 714 } ··· 669 716 assign := "handleErr" 670 717 returndef := "error" 671 718 if s.Output != nil { 672 - assign = "out, handleErr" 673 - fmt.Fprintf(w, "var out *%s.%s\n", impname, tname+"_Output") 674 - returndef = fmt.Sprintf("(*%s.%s_Output, error)", impname, tname) 719 + switch s.Output.Encoding { 720 + case "application/json": 721 + assign = "out, handleErr" 722 + fmt.Fprintf(w, "var out *%s.%s\n", impname, tname+"_Output") 723 + returndef = fmt.Sprintf("(*%s.%s_Output, error)", impname, tname) 724 + case "application/cbor": 725 + assign = "out, handleErr" 726 + fmt.Fprintf(w, "var out io.Reader\n") 727 + returndef = "(io.Reader, error)" 728 + default: 729 + return fmt.Errorf("unrecognized output encoding: %q", s.Output.Encoding) 730 + } 675 731 } 676 732 fmt.Fprintf(w, "var handleErr error\n") 677 733 fmt.Fprintf(w, "// func (s *Server) handle%s(%s) %s\n", fname, strings.Join(paramtypes, ","), returndef) ··· 679 735 fmt.Fprintf(w, "if handleErr != nil {\nreturn handleErr\n}\n") 680 736 681 737 if s.Output != nil { 682 - fmt.Fprintf(w, "return c.JSON(200, out)\n}\n\n") 683 - } else { 684 - fmt.Fprintf(w, "return nil\n}\n\n") 685 - } 738 + fmt.Fprintf(w, "return c.JSON(200, out)\n}\n\n") 739 + } else { 740 + fmt.Fprintf(w, "return nil\n}\n\n") 741 + } 686 742 687 743 return nil 688 744 } ··· 986 1042 if strings.HasPrefix(e, "#") { 987 1043 e = ts.id + e 988 1044 } 989 - 990 1045 991 1046 goname := ts.typeNameFromRef(e) 992 1047
+5 -4
xrpc/xrpc.go
··· 27 27 type XRPCRequestType int 28 28 29 29 type AuthInfo struct { 30 - AccessJwt string `json:"accessJwt"` 31 - RefreshJwt string `json:"refreshJwt"` 32 - Handle string `json:"handle"` 33 - Did string `json:"did"` 30 + AccessJwt string `json:"accessJwt"` 31 + RefreshJwt string `json:"refreshJwt"` 32 + Handle string `json:"handle"` 33 + Did string `json:"did"` 34 + DeclarationCid string `json:"declarationCid"` 34 35 } 35 36 36 37 const (