fork of indigo with slightly nicer lexgen

incremental implementation of xrpc methods

+2 -2
api/atproto/accountcreate.go
··· 20 } 21 22 type AccountCreate_Output struct { 23 AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 24 RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 25 - Handle string `json:"handle" cborgen:"handle"` 26 - Did string `json:"did" cborgen:"did"` 27 } 28 29 func AccountCreate(ctx context.Context, c *xrpc.Client, input AccountCreate_Input) (*AccountCreate_Output, error) {
··· 20 } 21 22 type AccountCreate_Output struct { 23 + Handle string `json:"handle" cborgen:"handle"` 24 + Did string `json:"did" cborgen:"did"` 25 AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 26 RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 27 } 28 29 func AccountCreate(ctx context.Context, c *xrpc.Client, input AccountCreate_Input) (*AccountCreate_Output, error) {
+21 -21
api/atproto/repobatchWrite.go
··· 14 func init() { 15 } 16 17 - type RepoBatchWrite_Create struct { 18 - Action string `json:"action" cborgen:"action"` 19 - Collection string `json:"collection" cborgen:"collection"` 20 - Rkey *string `json:"rkey" cborgen:"rkey"` 21 - Value any `json:"value" cborgen:"value"` 22 - } 23 - 24 - type RepoBatchWrite_Update struct { 25 - Action string `json:"action" cborgen:"action"` 26 - Collection string `json:"collection" cborgen:"collection"` 27 - Rkey string `json:"rkey" cborgen:"rkey"` 28 - Value any `json:"value" cborgen:"value"` 29 - } 30 - 31 - type RepoBatchWrite_Delete struct { 32 - Action string `json:"action" cborgen:"action"` 33 - Collection string `json:"collection" cborgen:"collection"` 34 - Rkey string `json:"rkey" cborgen:"rkey"` 35 - } 36 - 37 type RepoBatchWrite_Input struct { 38 Validate *bool `json:"validate" cborgen:"validate"` 39 Writes []*RepoBatchWrite_Input_Writes_Elem `json:"writes" cborgen:"writes"` 40 - Did string `json:"did" cborgen:"did"` 41 } 42 43 type RepoBatchWrite_Input_Writes_Elem struct { ··· 78 default: 79 return fmt.Errorf("closed enums must have a matching value") 80 } 81 } 82 83 func RepoBatchWrite(ctx context.Context, c *xrpc.Client, input RepoBatchWrite_Input) error {
··· 14 func init() { 15 } 16 17 type RepoBatchWrite_Input struct { 18 + Did string `json:"did" cborgen:"did"` 19 Validate *bool `json:"validate" cborgen:"validate"` 20 Writes []*RepoBatchWrite_Input_Writes_Elem `json:"writes" cborgen:"writes"` 21 } 22 23 type RepoBatchWrite_Input_Writes_Elem struct { ··· 58 default: 59 return fmt.Errorf("closed enums must have a matching value") 60 } 61 + } 62 + 63 + type RepoBatchWrite_Create struct { 64 + Action string `json:"action" cborgen:"action"` 65 + Collection string `json:"collection" cborgen:"collection"` 66 + Rkey *string `json:"rkey" cborgen:"rkey"` 67 + Value any `json:"value" cborgen:"value"` 68 + } 69 + 70 + type RepoBatchWrite_Update struct { 71 + Value any `json:"value" cborgen:"value"` 72 + Action string `json:"action" cborgen:"action"` 73 + Collection string `json:"collection" cborgen:"collection"` 74 + Rkey string `json:"rkey" cborgen:"rkey"` 75 + } 76 + 77 + type RepoBatchWrite_Delete struct { 78 + Action string `json:"action" cborgen:"action"` 79 + Collection string `json:"collection" cborgen:"collection"` 80 + Rkey string `json:"rkey" cborgen:"rkey"` 81 } 82 83 func RepoBatchWrite(ctx context.Context, c *xrpc.Client, input RepoBatchWrite_Input) error {
+3 -3
api/atproto/repocreateRecord.go
··· 12 } 13 14 type RepoCreateRecord_Input struct { 15 - Validate *bool `json:"validate" cborgen:"validate"` 16 - Record any `json:"record" cborgen:"record"` 17 Did string `json:"did" cborgen:"did"` 18 Collection string `json:"collection" cborgen:"collection"` 19 } 20 21 type RepoCreateRecord_Output struct { 22 - Uri string `json:"uri" cborgen:"uri"` 23 Cid string `json:"cid" cborgen:"cid"` 24 } 25 26 func RepoCreateRecord(ctx context.Context, c *xrpc.Client, input RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
··· 12 } 13 14 type RepoCreateRecord_Input struct { 15 Did string `json:"did" cborgen:"did"` 16 Collection string `json:"collection" cborgen:"collection"` 17 + Validate *bool `json:"validate" cborgen:"validate"` 18 + Record any `json:"record" cborgen:"record"` 19 } 20 21 type RepoCreateRecord_Output struct { 22 Cid string `json:"cid" cborgen:"cid"` 23 + Uri string `json:"uri" cborgen:"uri"` 24 } 25 26 func RepoCreateRecord(ctx context.Context, c *xrpc.Client, input RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
+2 -2
api/atproto/repodescribe.go
··· 12 } 13 14 type RepoDescribe_Output struct { 15 DidDoc any `json:"didDoc" cborgen:"didDoc"` 16 Collections []string `json:"collections" cborgen:"collections"` 17 HandleIsCorrect bool `json:"handleIsCorrect" cborgen:"handleIsCorrect"` 18 - Handle string `json:"handle" cborgen:"handle"` 19 - Did string `json:"did" cborgen:"did"` 20 } 21 22 func RepoDescribe(ctx context.Context, c *xrpc.Client, user string) (*RepoDescribe_Output, error) {
··· 12 } 13 14 type RepoDescribe_Output struct { 15 + Handle string `json:"handle" cborgen:"handle"` 16 + Did string `json:"did" cborgen:"did"` 17 DidDoc any `json:"didDoc" cborgen:"didDoc"` 18 Collections []string `json:"collections" cborgen:"collections"` 19 HandleIsCorrect bool `json:"handleIsCorrect" cborgen:"handleIsCorrect"` 20 } 21 22 func RepoDescribe(ctx context.Context, c *xrpc.Client, user string) (*RepoDescribe_Output, error) {
+1 -1
api/atproto/repogetRecord.go
··· 12 } 13 14 type RepoGetRecord_Output struct { 15 Uri string `json:"uri" cborgen:"uri"` 16 Cid *string `json:"cid" cborgen:"cid"` 17 - Value any `json:"value" cborgen:"value"` 18 } 19 20 func RepoGetRecord(ctx context.Context, c *xrpc.Client, cid string, collection string, rkey string, user string) (*RepoGetRecord_Output, error) {
··· 12 } 13 14 type RepoGetRecord_Output struct { 15 + Value any `json:"value" cborgen:"value"` 16 Uri string `json:"uri" cborgen:"uri"` 17 Cid *string `json:"cid" cborgen:"cid"` 18 } 19 20 func RepoGetRecord(ctx context.Context, c *xrpc.Client, cid string, collection string, rkey string, user string) (*RepoGetRecord_Output, error) {
+1 -1
api/atproto/sessioncreate.go
··· 17 } 18 19 type SessionCreate_Output struct { 20 - Did string `json:"did" cborgen:"did"` 21 AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 22 RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 23 Handle string `json:"handle" cborgen:"handle"` 24 } 25 26 func SessionCreate(ctx context.Context, c *xrpc.Client, input SessionCreate_Input) (*SessionCreate_Output, error) {
··· 17 } 18 19 type SessionCreate_Output struct { 20 AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 21 RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 22 Handle string `json:"handle" cborgen:"handle"` 23 + Did string `json:"did" cborgen:"did"` 24 } 25 26 func SessionCreate(ctx context.Context, c *xrpc.Client, input SessionCreate_Input) (*SessionCreate_Output, error) {
+1 -1
api/atproto/sessionrefresh.go
··· 12 } 13 14 type SessionRefresh_Output struct { 15 AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 16 RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 17 Handle string `json:"handle" cborgen:"handle"` 18 - Did string `json:"did" cborgen:"did"` 19 } 20 21 func SessionRefresh(ctx context.Context, c *xrpc.Client) (*SessionRefresh_Output, error) {
··· 12 } 13 14 type SessionRefresh_Output struct { 15 + Did string `json:"did" cborgen:"did"` 16 AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 17 RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 18 Handle string `json:"handle" cborgen:"handle"` 19 } 20 21 func SessionRefresh(ctx context.Context, c *xrpc.Client) (*SessionRefresh_Output, error) {
+6 -6
api/bsky/actorgetProfile.go
··· 12 } 13 14 type ActorGetProfile_Output struct { 15 Description *string `json:"description" cborgen:"description"` 16 FollowersCount int64 `json:"followersCount" cborgen:"followersCount"` 17 MembersCount int64 `json:"membersCount" cborgen:"membersCount"` 18 - PostsCount int64 `json:"postsCount" cborgen:"postsCount"` 19 Did string `json:"did" cborgen:"did"` 20 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 21 - Handle string `json:"handle" cborgen:"handle"` 22 MyState *ActorGetProfile_MyState `json:"myState" cborgen:"myState"` 23 - Creator string `json:"creator" cborgen:"creator"` 24 - DisplayName *string `json:"displayName" cborgen:"displayName"` 25 FollowsCount int64 `json:"followsCount" cborgen:"followsCount"` 26 } 27 28 type ActorGetProfile_MyState struct { 29 - Follow string `json:"follow" cborgen:"follow"` 30 - Member string `json:"member" cborgen:"member"` 31 } 32 33 func ActorGetProfile(ctx context.Context, c *xrpc.Client, actor string) (*ActorGetProfile_Output, error) {
··· 12 } 13 14 type ActorGetProfile_Output struct { 15 + Handle string `json:"handle" cborgen:"handle"` 16 + Creator string `json:"creator" cborgen:"creator"` 17 + DisplayName *string `json:"displayName" cborgen:"displayName"` 18 Description *string `json:"description" cborgen:"description"` 19 FollowersCount int64 `json:"followersCount" cborgen:"followersCount"` 20 MembersCount int64 `json:"membersCount" cborgen:"membersCount"` 21 Did string `json:"did" cborgen:"did"` 22 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 23 MyState *ActorGetProfile_MyState `json:"myState" cborgen:"myState"` 24 FollowsCount int64 `json:"followsCount" cborgen:"followsCount"` 25 + PostsCount int64 `json:"postsCount" cborgen:"postsCount"` 26 } 27 28 type ActorGetProfile_MyState struct { 29 + Follow *string `json:"follow" cborgen:"follow"` 30 + Member *string `json:"member" cborgen:"member"` 31 } 32 33 func ActorGetProfile(ctx context.Context, c *xrpc.Client, actor string) (*ActorGetProfile_Output, error) {
+2 -2
api/bsky/actorgetSuggestions.go
··· 17 } 18 19 type ActorGetSuggestions_Actor struct { 20 - MyState *ActorGetSuggestions_MyState `json:"myState" cborgen:"myState"` 21 Did string `json:"did" cborgen:"did"` 22 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 23 Handle string `json:"handle" cborgen:"handle"` 24 DisplayName *string `json:"displayName" cborgen:"displayName"` 25 Description *string `json:"description" cborgen:"description"` 26 IndexedAt *string `json:"indexedAt" cborgen:"indexedAt"` 27 } 28 29 type ActorGetSuggestions_MyState struct { 30 - Follow string `json:"follow" cborgen:"follow"` 31 } 32 33 func ActorGetSuggestions(ctx context.Context, c *xrpc.Client, cursor string, limit int64) (*ActorGetSuggestions_Output, error) {
··· 17 } 18 19 type ActorGetSuggestions_Actor struct { 20 Did string `json:"did" cborgen:"did"` 21 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 22 Handle string `json:"handle" cborgen:"handle"` 23 DisplayName *string `json:"displayName" cborgen:"displayName"` 24 Description *string `json:"description" cborgen:"description"` 25 IndexedAt *string `json:"indexedAt" cborgen:"indexedAt"` 26 + MyState *ActorGetSuggestions_MyState `json:"myState" cborgen:"myState"` 27 } 28 29 type ActorGetSuggestions_MyState struct { 30 + Follow *string `json:"follow" cborgen:"follow"` 31 } 32 33 func ActorGetSuggestions(ctx context.Context, c *xrpc.Client, cursor string, limit int64) (*ActorGetSuggestions_Output, error) {
+1 -1
api/bsky/actorref.go
··· 11 } 12 13 type ActorRef_WithInfo struct { 14 - Did string `json:"did" cborgen:"did"` 15 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 16 Handle string `json:"handle" cborgen:"handle"` 17 DisplayName *string `json:"displayName" cborgen:"displayName"` 18 }
··· 11 } 12 13 type ActorRef_WithInfo struct { 14 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 15 Handle string `json:"handle" cborgen:"handle"` 16 DisplayName *string `json:"displayName" cborgen:"displayName"` 17 + Did string `json:"did" cborgen:"did"` 18 }
+3 -3
api/bsky/actorsearch.go
··· 17 } 18 19 type ActorSearch_User struct { 20 DisplayName *string `json:"displayName" cborgen:"displayName"` 21 Description *string `json:"description" cborgen:"description"` 22 IndexedAt *string `json:"indexedAt" cborgen:"indexedAt"` 23 - Did string `json:"did" cborgen:"did"` 24 - Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 25 - Handle string `json:"handle" cborgen:"handle"` 26 } 27 28 func ActorSearch(ctx context.Context, c *xrpc.Client, before string, limit int64, term string) (*ActorSearch_Output, error) {
··· 17 } 18 19 type ActorSearch_User struct { 20 + Did string `json:"did" cborgen:"did"` 21 + Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 22 + Handle string `json:"handle" cborgen:"handle"` 23 DisplayName *string `json:"displayName" cborgen:"displayName"` 24 Description *string `json:"description" cborgen:"description"` 25 IndexedAt *string `json:"indexedAt" cborgen:"indexedAt"` 26 } 27 28 func ActorSearch(ctx context.Context, c *xrpc.Client, before string, limit int64, term string) (*ActorSearch_Output, error) {
+5 -5
api/bsky/actorsearchTypeahead.go
··· 11 func init() { 12 } 13 14 - type ActorSearchTypeahead_Output struct { 15 - Users []*ActorSearchTypeahead_User `json:"users" cborgen:"users"` 16 - } 17 - 18 type ActorSearchTypeahead_User struct { 19 Did string `json:"did" cborgen:"did"` 20 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 21 Handle string `json:"handle" cborgen:"handle"` 22 - DisplayName *string `json:"displayName" cborgen:"displayName"` 23 } 24 25 func ActorSearchTypeahead(ctx context.Context, c *xrpc.Client, limit int64, term string) (*ActorSearchTypeahead_Output, error) {
··· 11 func init() { 12 } 13 14 type ActorSearchTypeahead_User struct { 15 + DisplayName *string `json:"displayName" cborgen:"displayName"` 16 Did string `json:"did" cborgen:"did"` 17 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 18 Handle string `json:"handle" cborgen:"handle"` 19 + } 20 + 21 + type ActorSearchTypeahead_Output struct { 22 + Users []*ActorSearchTypeahead_User `json:"users" cborgen:"users"` 23 } 24 25 func ActorSearchTypeahead(ctx context.Context, c *xrpc.Client, limit int64, term string) (*ActorSearchTypeahead_Output, error) {
+3 -3
api/bsky/actorupdateProfile.go
··· 12 } 13 14 type ActorUpdateProfile_Input struct { 15 - DisplayName string `json:"displayName" cborgen:"displayName"` 16 - Description string `json:"description" cborgen:"description"` 17 - Did string `json:"did" cborgen:"did"` 18 } 19 20 type ActorUpdateProfile_Output struct {
··· 12 } 13 14 type ActorUpdateProfile_Input struct { 15 + Did *string `json:"did" cborgen:"did"` 16 + DisplayName *string `json:"displayName" cborgen:"displayName"` 17 + Description *string `json:"description" cborgen:"description"` 18 } 19 20 type ActorUpdateProfile_Output struct {
+14 -14
api/bsky/feedembed.go
··· 12 func init() { 13 } 14 15 type FeedEmbed struct { 16 Items []*FeedEmbed_Items_Elem `json:"items" cborgen:"items"` 17 } ··· 61 Thumb *util.Blob `json:"thumb" cborgen:"thumb"` 62 Original *util.Blob `json:"original" cborgen:"original"` 63 } 64 - 65 - type FeedEmbed_Record struct { 66 - Type string `json:"type" cborgen:"type"` 67 - Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 68 - Record any `json:"record" cborgen:"record"` 69 - } 70 - 71 - type FeedEmbed_External struct { 72 - Uri string `json:"uri" cborgen:"uri"` 73 - Title string `json:"title" cborgen:"title"` 74 - Description string `json:"description" cborgen:"description"` 75 - ImageUri string `json:"imageUri" cborgen:"imageUri"` 76 - Type string `json:"type" cborgen:"type"` 77 - }
··· 12 func init() { 13 } 14 15 + type FeedEmbed_Record struct { 16 + Record any `json:"record" cborgen:"record"` 17 + Type string `json:"type" cborgen:"type"` 18 + Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 19 + } 20 + 21 + type FeedEmbed_External struct { 22 + ImageUri string `json:"imageUri" cborgen:"imageUri"` 23 + Type string `json:"type" cborgen:"type"` 24 + Uri string `json:"uri" cborgen:"uri"` 25 + Title string `json:"title" cborgen:"title"` 26 + Description string `json:"description" cborgen:"description"` 27 + } 28 + 29 type FeedEmbed struct { 30 Items []*FeedEmbed_Items_Elem `json:"items" cborgen:"items"` 31 } ··· 75 Thumb *util.Blob `json:"thumb" cborgen:"thumb"` 76 Original *util.Blob `json:"original" cborgen:"original"` 77 }
+11 -11
api/bsky/feedgetAuthorFeed.go
··· 12 } 13 14 type FeedGetAuthorFeed_Output struct { 15 - Feed []*FeedGetAuthorFeed_FeedItem `json:"feed" cborgen:"feed"` 16 Cursor *string `json:"cursor" cborgen:"cursor"` 17 } 18 19 type FeedGetAuthorFeed_FeedItem struct { 20 - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 21 - RepostedBy *ActorRef_WithInfo `json:"repostedBy" cborgen:"repostedBy"` 22 ReplyCount int64 `json:"replyCount" cborgen:"replyCount"` 23 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 24 - TrendedBy *ActorRef_WithInfo `json:"trendedBy" cborgen:"trendedBy"` 25 Record any `json:"record" cborgen:"record"` 26 Embed *FeedEmbed `json:"embed" cborgen:"embed"` 27 - RepostCount int64 `json:"repostCount" cborgen:"repostCount"` 28 - UpvoteCount int64 `json:"upvoteCount" cborgen:"upvoteCount"` 29 - Uri string `json:"uri" cborgen:"uri"` 30 Cid string `json:"cid" cborgen:"cid"` 31 DownvoteCount int64 `json:"downvoteCount" cborgen:"downvoteCount"` 32 - MyState *FeedGetAuthorFeed_MyState `json:"myState" cborgen:"myState"` 33 } 34 35 type FeedGetAuthorFeed_MyState struct { 36 - Repost string `json:"repost" cborgen:"repost"` 37 - Upvote string `json:"upvote" cborgen:"upvote"` 38 - Downvote string `json:"downvote" cborgen:"downvote"` 39 } 40 41 func FeedGetAuthorFeed(ctx context.Context, c *xrpc.Client, author string, before string, limit int64) (*FeedGetAuthorFeed_Output, error) {
··· 12 } 13 14 type FeedGetAuthorFeed_Output struct { 15 Cursor *string `json:"cursor" cborgen:"cursor"` 16 + Feed []*FeedGetAuthorFeed_FeedItem `json:"feed" cborgen:"feed"` 17 } 18 19 type FeedGetAuthorFeed_FeedItem struct { 20 ReplyCount int64 `json:"replyCount" cborgen:"replyCount"` 21 + UpvoteCount int64 `json:"upvoteCount" cborgen:"upvoteCount"` 22 + MyState *FeedGetAuthorFeed_MyState `json:"myState" cborgen:"myState"` 23 + Uri string `json:"uri" cborgen:"uri"` 24 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 25 + RepostedBy *ActorRef_WithInfo `json:"repostedBy" cborgen:"repostedBy"` 26 Record any `json:"record" cborgen:"record"` 27 Embed *FeedEmbed `json:"embed" cborgen:"embed"` 28 Cid string `json:"cid" cborgen:"cid"` 29 + TrendedBy *ActorRef_WithInfo `json:"trendedBy" cborgen:"trendedBy"` 30 + RepostCount int64 `json:"repostCount" cborgen:"repostCount"` 31 DownvoteCount int64 `json:"downvoteCount" cborgen:"downvoteCount"` 32 + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 33 } 34 35 type FeedGetAuthorFeed_MyState struct { 36 + Downvote *string `json:"downvote" cborgen:"downvote"` 37 + Repost *string `json:"repost" cborgen:"repost"` 38 + Upvote *string `json:"upvote" cborgen:"upvote"` 39 } 40 41 func FeedGetAuthorFeed(ctx context.Context, c *xrpc.Client, author string, before string, limit int64) (*FeedGetAuthorFeed_Output, error) {
+17 -17
api/bsky/feedgetPostThread.go
··· 14 func init() { 15 } 16 17 type FeedGetPostThread_Output struct { 18 Thread *FeedGetPostThread_Output_Thread `json:"thread" cborgen:"thread"` 19 } ··· 52 } 53 54 type FeedGetPostThread_Post struct { 55 DownvoteCount int64 `json:"downvoteCount" cborgen:"downvoteCount"` 56 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 57 - Replies []*FeedGetPostThread_Post_Replies_Elem `json:"replies" cborgen:"replies"` 58 - Uri string `json:"uri" cborgen:"uri"` 59 Cid string `json:"cid" cborgen:"cid"` 60 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 61 Record any `json:"record" cborgen:"record"` 62 Embed *FeedEmbed `json:"embed" cborgen:"embed"` 63 - Parent *FeedGetPostThread_Post_Parent `json:"parent" cborgen:"parent"` 64 - ReplyCount int64 `json:"replyCount" cborgen:"replyCount"` 65 RepostCount int64 `json:"repostCount" cborgen:"repostCount"` 66 - UpvoteCount int64 `json:"upvoteCount" cborgen:"upvoteCount"` 67 - MyState *FeedGetPostThread_MyState `json:"myState" cborgen:"myState"` 68 } 69 70 type FeedGetPostThread_Post_Parent struct { ··· 131 default: 132 return nil 133 } 134 - } 135 - 136 - type FeedGetPostThread_NotFoundPost struct { 137 - Uri string `json:"uri" cborgen:"uri"` 138 - NotFound bool `json:"notFound" cborgen:"notFound"` 139 - } 140 - 141 - type FeedGetPostThread_MyState struct { 142 - Repost string `json:"repost" cborgen:"repost"` 143 - Upvote string `json:"upvote" cborgen:"upvote"` 144 - Downvote string `json:"downvote" cborgen:"downvote"` 145 } 146 147 func FeedGetPostThread(ctx context.Context, c *xrpc.Client, depth int64, uri string) (*FeedGetPostThread_Output, error) {
··· 14 func init() { 15 } 16 17 + type FeedGetPostThread_NotFoundPost struct { 18 + Uri string `json:"uri" cborgen:"uri"` 19 + NotFound bool `json:"notFound" cborgen:"notFound"` 20 + } 21 + 22 + type FeedGetPostThread_MyState struct { 23 + Repost *string `json:"repost" cborgen:"repost"` 24 + Upvote *string `json:"upvote" cborgen:"upvote"` 25 + Downvote *string `json:"downvote" cborgen:"downvote"` 26 + } 27 + 28 type FeedGetPostThread_Output struct { 29 Thread *FeedGetPostThread_Output_Thread `json:"thread" cborgen:"thread"` 30 } ··· 63 } 64 65 type FeedGetPostThread_Post struct { 66 + MyState *FeedGetPostThread_MyState `json:"myState" cborgen:"myState"` 67 + Uri string `json:"uri" cborgen:"uri"` 68 + Parent *FeedGetPostThread_Post_Parent `json:"parent" cborgen:"parent"` 69 + ReplyCount int64 `json:"replyCount" cborgen:"replyCount"` 70 + Replies []*FeedGetPostThread_Post_Replies_Elem `json:"replies" cborgen:"replies"` 71 + UpvoteCount int64 `json:"upvoteCount" cborgen:"upvoteCount"` 72 DownvoteCount int64 `json:"downvoteCount" cborgen:"downvoteCount"` 73 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 74 Cid string `json:"cid" cborgen:"cid"` 75 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 76 Record any `json:"record" cborgen:"record"` 77 Embed *FeedEmbed `json:"embed" cborgen:"embed"` 78 RepostCount int64 `json:"repostCount" cborgen:"repostCount"` 79 } 80 81 type FeedGetPostThread_Post_Parent struct { ··· 142 default: 143 return nil 144 } 145 } 146 147 func FeedGetPostThread(ctx context.Context, c *xrpc.Client, depth int64, uri string) (*FeedGetPostThread_Output, error) {
+2 -2
api/bsky/feedgetRepostedBy.go
··· 12 } 13 14 type FeedGetRepostedBy_Output struct { 15 Uri string `json:"uri" cborgen:"uri"` 16 Cid *string `json:"cid" cborgen:"cid"` 17 - Cursor *string `json:"cursor" cborgen:"cursor"` 18 - RepostedBy []*FeedGetRepostedBy_RepostedBy `json:"repostedBy" cborgen:"repostedBy"` 19 } 20 21 type FeedGetRepostedBy_RepostedBy struct {
··· 12 } 13 14 type FeedGetRepostedBy_Output struct { 15 + Cursor *string `json:"cursor" cborgen:"cursor"` 16 + RepostedBy []*FeedGetRepostedBy_RepostedBy `json:"repostedBy" cborgen:"repostedBy"` 17 Uri string `json:"uri" cborgen:"uri"` 18 Cid *string `json:"cid" cborgen:"cid"` 19 } 20 21 type FeedGetRepostedBy_RepostedBy struct {
+10 -10
api/bsky/feedgetTimeline.go
··· 11 func init() { 12 } 13 14 - type FeedGetTimeline_MyState struct { 15 - Repost string `json:"repost" cborgen:"repost"` 16 - Upvote string `json:"upvote" cborgen:"upvote"` 17 - Downvote string `json:"downvote" cborgen:"downvote"` 18 - } 19 - 20 type FeedGetTimeline_Output struct { 21 Cursor *string `json:"cursor" cborgen:"cursor"` 22 Feed []*FeedGetTimeline_FeedItem `json:"feed" cborgen:"feed"` 23 } 24 25 type FeedGetTimeline_FeedItem struct { 26 ReplyCount int64 `json:"replyCount" cborgen:"replyCount"` 27 - TrendedBy *ActorRef_WithInfo `json:"trendedBy" cborgen:"trendedBy"` 28 RepostedBy *ActorRef_WithInfo `json:"repostedBy" cborgen:"repostedBy"` 29 Embed *FeedEmbed `json:"embed" cborgen:"embed"` 30 - Record any `json:"record" cborgen:"record"` 31 RepostCount int64 `json:"repostCount" cborgen:"repostCount"` 32 UpvoteCount int64 `json:"upvoteCount" cborgen:"upvoteCount"` 33 DownvoteCount int64 `json:"downvoteCount" cborgen:"downvoteCount"` 34 - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 35 - Uri string `json:"uri" cborgen:"uri"` 36 Cid string `json:"cid" cborgen:"cid"` 37 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 38 MyState *FeedGetTimeline_MyState `json:"myState" cborgen:"myState"` 39 } 40 41 func FeedGetTimeline(ctx context.Context, c *xrpc.Client, algorithm string, before string, limit int64) (*FeedGetTimeline_Output, error) {
··· 11 func init() { 12 } 13 14 type FeedGetTimeline_Output struct { 15 Cursor *string `json:"cursor" cborgen:"cursor"` 16 Feed []*FeedGetTimeline_FeedItem `json:"feed" cborgen:"feed"` 17 } 18 19 type FeedGetTimeline_FeedItem struct { 20 + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 21 + Uri string `json:"uri" cborgen:"uri"` 22 + Record any `json:"record" cborgen:"record"` 23 ReplyCount int64 `json:"replyCount" cborgen:"replyCount"` 24 RepostedBy *ActorRef_WithInfo `json:"repostedBy" cborgen:"repostedBy"` 25 Embed *FeedEmbed `json:"embed" cborgen:"embed"` 26 RepostCount int64 `json:"repostCount" cborgen:"repostCount"` 27 UpvoteCount int64 `json:"upvoteCount" cborgen:"upvoteCount"` 28 DownvoteCount int64 `json:"downvoteCount" cborgen:"downvoteCount"` 29 Cid string `json:"cid" cborgen:"cid"` 30 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` 31 + TrendedBy *ActorRef_WithInfo `json:"trendedBy" cborgen:"trendedBy"` 32 MyState *FeedGetTimeline_MyState `json:"myState" cborgen:"myState"` 33 + } 34 + 35 + type FeedGetTimeline_MyState struct { 36 + Repost *string `json:"repost" cborgen:"repost"` 37 + Upvote *string `json:"upvote" cborgen:"upvote"` 38 + Downvote *string `json:"downvote" cborgen:"downvote"` 39 } 40 41 func FeedGetTimeline(ctx context.Context, c *xrpc.Client, algorithm string, before string, limit int64) (*FeedGetTimeline_Output, error) {
+1 -1
api/bsky/feedgetVotes.go
··· 19 } 20 21 type FeedGetVotes_Vote struct { 22 Direction string `json:"direction" cborgen:"direction"` 23 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 24 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 25 - Actor *ActorRef_WithInfo `json:"actor" cborgen:"actor"` 26 } 27 28 func FeedGetVotes(ctx context.Context, c *xrpc.Client, before string, cid string, direction string, limit int64, uri string) (*FeedGetVotes_Output, error) {
··· 19 } 20 21 type FeedGetVotes_Vote struct { 22 + Actor *ActorRef_WithInfo `json:"actor" cborgen:"actor"` 23 Direction string `json:"direction" cborgen:"direction"` 24 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 25 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 26 } 27 28 func FeedGetVotes(ctx context.Context, c *xrpc.Client, before string, cid string, direction string, limit int64, uri string) (*FeedGetVotes_Output, error) {
+10 -10
api/bsky/feedpost.go
··· 11 util.RegisterType("app.bsky.feed.post", FeedPost{}) 12 } 13 14 - // RECORDTYPE: FeedPost 15 - type FeedPost struct { 16 - LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.feed.post"` 17 - Text string `json:"text" cborgen:"text"` 18 - Entities []*FeedPost_Entity `json:"entities" cborgen:"entities"` 19 - Reply *FeedPost_ReplyRef `json:"reply" cborgen:"reply"` 20 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 21 - } 22 - 23 type FeedPost_ReplyRef struct { 24 Root *comatprototypes.RepoStrongRef `json:"root" cborgen:"root"` 25 Parent *comatprototypes.RepoStrongRef `json:"parent" cborgen:"parent"` ··· 32 } 33 34 type FeedPost_TextSlice struct { 35 End int64 `json:"end" cborgen:"end"` 36 - Start int64 `json:"start" cborgen:"start"` 37 }
··· 11 util.RegisterType("app.bsky.feed.post", FeedPost{}) 12 } 13 14 type FeedPost_ReplyRef struct { 15 Root *comatprototypes.RepoStrongRef `json:"root" cborgen:"root"` 16 Parent *comatprototypes.RepoStrongRef `json:"parent" cborgen:"parent"` ··· 23 } 24 25 type FeedPost_TextSlice struct { 26 + Start int64 `json:"start" cborgen:"start"` 27 End int64 `json:"end" cborgen:"end"` 28 + } 29 + 30 + // RECORDTYPE: FeedPost 31 + type FeedPost struct { 32 + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.feed.post"` 33 + Text string `json:"text" cborgen:"text"` 34 + Entities []*FeedPost_Entity `json:"entities" cborgen:"entities"` 35 + Reply *FeedPost_ReplyRef `json:"reply" cborgen:"reply"` 36 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 37 }
+2 -2
api/bsky/feedsetVote.go
··· 18 } 19 20 type FeedSetVote_Output struct { 21 - Upvote string `json:"upvote" cborgen:"upvote"` 22 - Downvote string `json:"downvote" cborgen:"downvote"` 23 } 24 25 func FeedSetVote(ctx context.Context, c *xrpc.Client, input FeedSetVote_Input) (*FeedSetVote_Output, error) {
··· 18 } 19 20 type FeedSetVote_Output struct { 21 + Upvote *string `json:"upvote" cborgen:"upvote"` 22 + Downvote *string `json:"downvote" cborgen:"downvote"` 23 } 24 25 func FeedSetVote(ctx context.Context, c *xrpc.Client, input FeedSetVote_Input) (*FeedSetVote_Output, error) {
+1 -1
api/bsky/graphassertion.go
··· 13 // RECORDTYPE: GraphAssertion 14 type GraphAssertion struct { 15 LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.graph.assertion"` 16 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 17 Assertion string `json:"assertion" cborgen:"assertion"` 18 - Subject *ActorRef `json:"subject" cborgen:"subject"` 19 }
··· 13 // RECORDTYPE: GraphAssertion 14 type GraphAssertion struct { 15 LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.graph.assertion"` 16 + Subject *ActorRef `json:"subject" cborgen:"subject"` 17 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 18 Assertion string `json:"assertion" cborgen:"assertion"` 19 }
+1 -1
api/bsky/graphfollow.go
··· 13 // RECORDTYPE: GraphFollow 14 type GraphFollow struct { 15 LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.graph.follow"` 16 - Subject *ActorRef `json:"subject" cborgen:"subject"` 17 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 18 }
··· 13 // RECORDTYPE: GraphFollow 14 type GraphFollow struct { 15 LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.graph.follow"` 16 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 17 + Subject *ActorRef `json:"subject" cborgen:"subject"` 18 }
+1 -1
api/bsky/graphgetAssertions.go
··· 17 } 18 19 type GraphGetAssertions_Assertion struct { 20 - Cid string `json:"cid" cborgen:"cid"` 21 Assertion string `json:"assertion" cborgen:"assertion"` 22 Confirmation *GraphGetAssertions_Confirmation `json:"confirmation" cborgen:"confirmation"` 23 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` ··· 25 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 26 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 27 Uri string `json:"uri" cborgen:"uri"` 28 } 29 30 type GraphGetAssertions_Confirmation struct {
··· 17 } 18 19 type GraphGetAssertions_Assertion struct { 20 Assertion string `json:"assertion" cborgen:"assertion"` 21 Confirmation *GraphGetAssertions_Confirmation `json:"confirmation" cborgen:"confirmation"` 22 Author *ActorRef_WithInfo `json:"author" cborgen:"author"` ··· 24 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 25 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 26 Uri string `json:"uri" cborgen:"uri"` 27 + Cid string `json:"cid" cborgen:"cid"` 28 } 29 30 type GraphGetAssertions_Confirmation struct {
+6 -6
api/bsky/graphgetFollowers.go
··· 12 } 13 14 type GraphGetFollowers_Output struct { 15 Subject *GraphGetFollowers_Subject `json:"subject" cborgen:"subject"` 16 Cursor *string `json:"cursor" cborgen:"cursor"` 17 - Followers []*GraphGetFollowers_Follower `json:"followers" cborgen:"followers"` 18 } 19 20 type GraphGetFollowers_Subject struct { 21 - Did string `json:"did" cborgen:"did"` 22 - Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 23 Handle string `json:"handle" cborgen:"handle"` 24 DisplayName *string `json:"displayName" cborgen:"displayName"` 25 } 26 27 type GraphGetFollowers_Follower struct { 28 CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 29 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 30 Did string `json:"did" cborgen:"did"` 31 - Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 32 - Handle string `json:"handle" cborgen:"handle"` 33 - DisplayName *string `json:"displayName" cborgen:"displayName"` 34 } 35 36 func GraphGetFollowers(ctx context.Context, c *xrpc.Client, before string, limit int64, user string) (*GraphGetFollowers_Output, error) {
··· 12 } 13 14 type GraphGetFollowers_Output struct { 15 + Followers []*GraphGetFollowers_Follower `json:"followers" cborgen:"followers"` 16 Subject *GraphGetFollowers_Subject `json:"subject" cborgen:"subject"` 17 Cursor *string `json:"cursor" cborgen:"cursor"` 18 } 19 20 type GraphGetFollowers_Subject struct { 21 Handle string `json:"handle" cborgen:"handle"` 22 DisplayName *string `json:"displayName" cborgen:"displayName"` 23 + Did string `json:"did" cborgen:"did"` 24 + Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 25 } 26 27 type GraphGetFollowers_Follower struct { 28 + Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 29 + Handle string `json:"handle" cborgen:"handle"` 30 + DisplayName *string `json:"displayName" cborgen:"displayName"` 31 CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 32 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 33 Did string `json:"did" cborgen:"did"` 34 } 35 36 func GraphGetFollowers(ctx context.Context, c *xrpc.Client, before string, limit int64, user string) (*GraphGetFollowers_Output, error) {
+3 -3
api/bsky/graphgetFollows.go
··· 12 } 13 14 type GraphGetFollows_Output struct { 15 Cursor *string `json:"cursor" cborgen:"cursor"` 16 Follows []*GraphGetFollows_Follow `json:"follows" cborgen:"follows"` 17 - Subject *ActorRef_WithInfo `json:"subject" cborgen:"subject"` 18 } 19 20 type GraphGetFollows_Follow struct { 21 Did string `json:"did" cborgen:"did"` 22 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 23 Handle string `json:"handle" cborgen:"handle"` 24 DisplayName *string `json:"displayName" cborgen:"displayName"` 25 - CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 26 - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 27 } 28 29 func GraphGetFollows(ctx context.Context, c *xrpc.Client, before string, limit int64, user string) (*GraphGetFollows_Output, error) {
··· 12 } 13 14 type GraphGetFollows_Output struct { 15 + Subject *ActorRef_WithInfo `json:"subject" cborgen:"subject"` 16 Cursor *string `json:"cursor" cborgen:"cursor"` 17 Follows []*GraphGetFollows_Follow `json:"follows" cborgen:"follows"` 18 } 19 20 type GraphGetFollows_Follow struct { 21 + CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 22 + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 23 Did string `json:"did" cborgen:"did"` 24 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 25 Handle string `json:"handle" cborgen:"handle"` 26 DisplayName *string `json:"displayName" cborgen:"displayName"` 27 } 28 29 func GraphGetFollows(ctx context.Context, c *xrpc.Client, before string, limit int64, user string) (*GraphGetFollows_Output, error) {
+3 -3
api/bsky/graphgetMembers.go
··· 12 } 13 14 type GraphGetMembers_Output struct { 15 - Subject *ActorRef_WithInfo `json:"subject" cborgen:"subject"` 16 Cursor *string `json:"cursor" cborgen:"cursor"` 17 Members []*GraphGetMembers_Member `json:"members" cborgen:"members"` 18 } 19 20 type GraphGetMembers_Member struct { 21 - Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 22 - Handle string `json:"handle" cborgen:"handle"` 23 DisplayName *string `json:"displayName" cborgen:"displayName"` 24 CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 25 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 26 Did string `json:"did" cborgen:"did"` 27 } 28 29 func GraphGetMembers(ctx context.Context, c *xrpc.Client, actor string, before string, limit int64) (*GraphGetMembers_Output, error) {
··· 12 } 13 14 type GraphGetMembers_Output struct { 15 Cursor *string `json:"cursor" cborgen:"cursor"` 16 Members []*GraphGetMembers_Member `json:"members" cborgen:"members"` 17 + Subject *ActorRef_WithInfo `json:"subject" cborgen:"subject"` 18 } 19 20 type GraphGetMembers_Member struct { 21 DisplayName *string `json:"displayName" cborgen:"displayName"` 22 CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 23 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 24 Did string `json:"did" cborgen:"did"` 25 + Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 26 + Handle string `json:"handle" cborgen:"handle"` 27 } 28 29 func GraphGetMembers(ctx context.Context, c *xrpc.Client, actor string, before string, limit int64) (*GraphGetMembers_Output, error) {
+2 -2
api/bsky/graphgetMemberships.go
··· 18 } 19 20 type GraphGetMemberships_Membership struct { 21 - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 22 - Did string `json:"did" cborgen:"did"` 23 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 24 Handle string `json:"handle" cborgen:"handle"` 25 DisplayName *string `json:"displayName" cborgen:"displayName"` 26 CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 27 } 28 29 func GraphGetMemberships(ctx context.Context, c *xrpc.Client, actor string, before string, limit int64) (*GraphGetMemberships_Output, error) {
··· 18 } 19 20 type GraphGetMemberships_Membership struct { 21 Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 22 Handle string `json:"handle" cborgen:"handle"` 23 DisplayName *string `json:"displayName" cborgen:"displayName"` 24 CreatedAt *string `json:"createdAt" cborgen:"createdAt"` 25 + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 26 + Did string `json:"did" cborgen:"did"` 27 } 28 29 func GraphGetMemberships(ctx context.Context, c *xrpc.Client, actor string, before string, limit int64) (*GraphGetMemberships_Output, error) {
+1 -1
api/bsky/systemdeclRef.go
··· 6 } 7 8 type SystemDeclRef struct { 9 - ActorType string `json:"actorType" cborgen:"actorType"` 10 Cid string `json:"cid" cborgen:"cid"` 11 }
··· 6 } 7 8 type SystemDeclRef struct { 9 Cid string `json:"cid" cborgen:"cid"` 10 + ActorType string `json:"actorType" cborgen:"actorType"` 11 }
+6
api/server/auth.go
··· 2 3 import ( 4 "context" 5 "time" 6 7 "github.com/lestrrat-go/jwx/jwa" ··· 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 {
··· 2 3 import ( 4 "context" 5 + "crypto/rand" 6 + "encoding/base64" 7 "time" 8 9 "github.com/lestrrat-go/jwx/jwa" ··· 27 func (s *Server) createAuthTokenForUser(ctx context.Context, handle, did string) (*xrpc.AuthInfo, error) { 28 accessTok := makeToken(did, "com.atproto.access", time.Now().Add(24*time.Hour)) 29 refreshTok := makeToken(did, "com.atproto.refresh", time.Now().Add(7*24*time.Hour)) 30 + 31 + rval := make([]byte, 10) 32 + rand.Read(rval) 33 + refreshTok.Set("jti", base64.StdEncoding.EncodeToString(rval)) 34 35 accSig, err := jwt.Sign(accessTok, jwa.HS256, s.signingKey) 36 if err != nil {
+184 -33
api/server/feedgen.go
··· 24 25 type FeedPost struct { 26 gorm.Model 27 - Author uint 28 - RepostedBy uint 29 - TrendedBy uint 30 - Tid string 31 Cid string 32 UpCount int64 33 ReplyCount int64 ··· 36 37 type ActorInfo struct { 38 gorm.Model 39 - User uint `gorm:"index"` 40 - Handle string 41 - Did string 42 - Name string 43 - Following int 44 - Followers int 45 - Posts int 46 - DeclRefCid string 47 - Type string 48 } 49 50 - type UpVoteRecord struct { 51 gorm.Model 52 - User uint 53 - Likes uint 54 } 55 56 type FollowRecord struct { ··· 63 db.AutoMigrate(&FeedPost{}) 64 db.AutoMigrate(&ActorInfo{}) 65 db.AutoMigrate(&FollowRecord{}) 66 - db.AutoMigrate(&UpVoteRecord{}) 67 68 return &FeedGenerator{ 69 db: db, ··· 113 return "", err 114 } 115 116 - return ai.Handle, nil 117 } 118 119 func (fg *FeedGenerator) getActorRefInfo(ctx context.Context, user uint) (*bsky.ActorRef_WithInfo, error) { ··· 143 } 144 145 out := HydratedFeedItem{ 146 - Uri: "at://" + authorDid + "/" + item.Tid, 147 ReplyCount: item.ReplyCount, 148 RepostCount: item.RepostCount, 149 UpvoteCount: item.UpCount, ··· 272 } 273 274 type parsedUri struct { 275 - Did string 276 - Rkey string 277 } 278 279 func parseAtUri(uri string) (*parsedUri, error) { ··· 287 return nil, fmt.Errorf("AT uris must have three parts: did, collection, tid") 288 } 289 290 - did := parts[0] 291 - rkey := parts[1] + "/" + parts[2] 292 - 293 return &parsedUri{ 294 - Did: did, 295 - Rkey: rkey, 296 }, nil 297 } 298 ··· 300 switch rec := evt.Record.(type) { 301 case *bsky.FeedPost: 302 fp := FeedPost{ 303 - Tid: evt.Rkey, 304 Cid: evt.RecCid.String(), 305 Author: evt.User, 306 } ··· 314 return nil 315 case *bsky.FeedVote: 316 var val int 317 switch rec.Direction { 318 case "up": 319 val = 1 320 case "down": 321 val = -1 322 default: 323 return fmt.Errorf("invalid vote direction: %q", rec.Direction) 324 } ··· 334 } 335 336 var post FeedPost 337 - if err := fg.db.First(&post, "tid = ? AND author = ?", puri.Rkey, act.User).Error; err != nil { 338 return err 339 } 340 341 - if err := fg.db.Create(&UpVoteRecord{ 342 - User: evt.User, 343 - Likes: post.ID, 344 }).Error; err != nil { 345 return err 346 } ··· 371 372 func (fg *FeedGenerator) GetActorProfile(ctx context.Context, actor string) (*ActorInfo, error) { 373 var ai ActorInfo 374 - if err := fg.db.First(&ai, "handle = ?", actor).Error; err != nil { 375 return nil, err 376 } 377 378 - return nil, nil 379 }
··· 24 25 type FeedPost struct { 26 gorm.Model 27 + Author uint 28 + RepostedBy uint 29 + TrendedBy uint 30 + // TODO: only keeping rkey here, assuming collection is app.bsky.feed.post 31 + Rkey string 32 Cid string 33 UpCount int64 34 ReplyCount int64 ··· 37 38 type ActorInfo struct { 39 gorm.Model 40 + User uint `gorm:"index"` 41 + Handle string 42 + DisplayName string 43 + Did string 44 + Name string 45 + Following int64 46 + Followers int64 47 + Posts int64 48 + DeclRefCid string 49 + Type string 50 + } 51 + 52 + type VoteDir int 53 + 54 + func (vd VoteDir) String() string { 55 + switch vd { 56 + case VoteDirUp: 57 + return "up" 58 + case VoteDirDown: 59 + return "down" 60 + default: 61 + return "<unknown>" 62 + } 63 } 64 65 + const ( 66 + VoteDirUp = VoteDir(1) 67 + VoteDirDown = VoteDir(2) 68 + ) 69 + 70 + type VoteRecord struct { 71 gorm.Model 72 + Dir VoteDir 73 + User uint 74 + Post uint 75 + Created string 76 } 77 78 type FollowRecord struct { ··· 85 db.AutoMigrate(&FeedPost{}) 86 db.AutoMigrate(&ActorInfo{}) 87 db.AutoMigrate(&FollowRecord{}) 88 + db.AutoMigrate(&VoteRecord{}) 89 90 return &FeedGenerator{ 91 db: db, ··· 135 return "", err 136 } 137 138 + return ai.Did, nil 139 } 140 141 func (fg *FeedGenerator) getActorRefInfo(ctx context.Context, user uint) (*bsky.ActorRef_WithInfo, error) { ··· 165 } 166 167 out := HydratedFeedItem{ 168 + Uri: "at://" + authorDid + "/app.bsky.feed.post/" + item.Rkey, 169 ReplyCount: item.ReplyCount, 170 RepostCount: item.RepostCount, 171 UpvoteCount: item.UpCount, ··· 294 } 295 296 type parsedUri struct { 297 + Did string 298 + Collection string 299 + Rkey string 300 } 301 302 func parseAtUri(uri string) (*parsedUri, error) { ··· 310 return nil, fmt.Errorf("AT uris must have three parts: did, collection, tid") 311 } 312 313 return &parsedUri{ 314 + Did: parts[0], 315 + Collection: parts[1], 316 + Rkey: parts[2], 317 }, nil 318 } 319 ··· 321 switch rec := evt.Record.(type) { 322 case *bsky.FeedPost: 323 fp := FeedPost{ 324 + Rkey: evt.Rkey, 325 Cid: evt.RecCid.String(), 326 Author: evt.User, 327 } ··· 335 return nil 336 case *bsky.FeedVote: 337 var val int 338 + var dbdir VoteDir 339 switch rec.Direction { 340 case "up": 341 val = 1 342 + dbdir = VoteDirUp 343 case "down": 344 val = -1 345 + dbdir = VoteDirDown 346 default: 347 return fmt.Errorf("invalid vote direction: %q", rec.Direction) 348 } ··· 358 } 359 360 var post FeedPost 361 + if err := fg.db.First(&post, "rkey = ? AND author = ?", puri.Rkey, act.User).Error; err != nil { 362 return err 363 } 364 365 + if err := fg.db.Create(&VoteRecord{ 366 + Dir: dbdir, 367 + User: evt.User, 368 + Post: post.ID, 369 + Created: rec.CreatedAt, 370 }).Error; err != nil { 371 return err 372 } ··· 397 398 func (fg *FeedGenerator) GetActorProfile(ctx context.Context, actor string) (*ActorInfo, error) { 399 var ai ActorInfo 400 + if strings.HasPrefix(actor, "did:") { 401 + if err := fg.db.First(&ai, "did = ?", actor).Error; err != nil { 402 + return nil, err 403 + } 404 + } else { 405 + if err := fg.db.First(&ai, "handle = ?", actor).Error; err != nil { 406 + return nil, err 407 + } 408 + } 409 + 410 + return &ai, nil 411 + } 412 + 413 + func (fg *FeedGenerator) GetPost(ctx context.Context, uri string) (*FeedPost, error) { 414 + puri, err := parseAtUri(uri) 415 + if err != nil { 416 + return nil, err 417 + } 418 + 419 + var post FeedPost 420 + if err := fg.db.First(&post, "rkey = ? AND author = (?)", puri.Rkey, fg.db.Model(ActorInfo{}).Where("did = ?", puri.Did).Select("id")).Error; err != nil { 421 + return nil, err 422 + } 423 + 424 + return &post, nil 425 + } 426 + 427 + type ThreadPost struct { 428 + Post *HydratedFeedItem 429 + 430 + ParentUri string 431 + Parent *ThreadPost 432 + } 433 + 434 + func (fg *FeedGenerator) GetPostThread(ctx context.Context, uri string, depth int) (*ThreadPost, error) { 435 + post, err := fg.GetPost(ctx, uri) 436 + if err != nil { 437 + return nil, fmt.Errorf("getting post for thread: %w", err) 438 + } 439 + 440 + hi, err := fg.hydrateItem(ctx, post) 441 + if err != nil { 442 return nil, err 443 } 444 445 + p, ok := hi.Record.(*bsky.FeedPost) 446 + if !ok { 447 + return nil, fmt.Errorf("getPostThread can only operate on app.bsky.feed.post records") 448 + } 449 + 450 + out := &ThreadPost{ 451 + Post: hi, 452 + } 453 + 454 + if p.Reply != nil { 455 + out.ParentUri = p.Reply.Parent.Uri 456 + if depth > 0 { 457 + 458 + parent, err := fg.GetPostThread(ctx, p.Reply.Parent.Uri, depth-1) 459 + if err != nil { 460 + // TODO: check for and handle 'not found' 461 + return nil, err 462 + } 463 + out.Parent = parent 464 + } 465 + } 466 + 467 + return out, nil 468 + } 469 + 470 + type HydratedVote struct { 471 + Actor *bsky.ActorRef_WithInfo 472 + Direction string 473 + IndexedAt time.Time 474 + CreatedAt string 475 + } 476 + 477 + func (fg *FeedGenerator) hydrateVote(ctx context.Context, v *VoteRecord) (*HydratedVote, error) { 478 + aref, err := fg.getActorRefInfo(ctx, v.User) 479 + if err != nil { 480 + return nil, err 481 + } 482 + 483 + return &HydratedVote{ 484 + Actor: aref, 485 + Direction: v.Dir.String(), 486 + IndexedAt: v.UpdatedAt, 487 + CreatedAt: v.Created, 488 + }, nil 489 + } 490 + 491 + func (fg *FeedGenerator) GetVotes(ctx context.Context, uri string, pcid cid.Cid, dir string, limit int, before string) ([]*HydratedVote, error) { 492 + if before != "" { 493 + log.Println("not respecting 'before' yet") 494 + } 495 + 496 + p, err := fg.GetPost(ctx, uri) 497 + if err != nil { 498 + return nil, err 499 + } 500 + 501 + if p.Cid != pcid.String() { 502 + return nil, fmt.Errorf("listing likes of old post versions not supported") 503 + } 504 + 505 + var dbdir VoteDir 506 + switch dir { 507 + case "up": 508 + dbdir = VoteDirUp 509 + case "down": 510 + dbdir = VoteDirDown 511 + default: 512 + return nil, fmt.Errorf("there are only two directions, up or down") 513 + } 514 + 515 + var voterecs []VoteRecord 516 + if err := fg.db.Limit(limit).Find(&voterecs, "dir = ? AND post = ?", dbdir, p.ID).Error; err != nil { 517 + return nil, err 518 + } 519 + 520 + var out []*HydratedVote 521 + for _, vr := range voterecs { 522 + hv, err := fg.hydrateVote(ctx, &vr) 523 + if err != nil { 524 + return nil, err 525 + } 526 + out = append(out, hv) 527 + } 528 + 529 + return out, nil 530 }
+122 -31
api/server/handlers.go
··· 18 } 19 20 func (s *Server) handleAppBskyActorGetProfile(ctx context.Context, actor string) (*appbskytypes.ActorGetProfile_Output, error) { 21 - fmt.Println("Get profile:", actor) 22 - 23 - return nil, nil 24 - 25 - /* 26 - profile, err := s.feedgen.GetActorProfile(ctx, actor) 27 - if err != nil { 28 - return nil, err 29 - } 30 31 - var out appbskytypes.ActorGetProfile_Output 32 - out := ActorGetProfile_Output { 33 - MyState : nil, //*ActorGetProfile_MyState `json:"myState" cborgen:"myState"` 34 - Did string `json:"did" cborgen:"did"` 35 - Declaration *SystemDeclRef `json:"declaration" cborgen:"declaration"` 36 - Description string `json:"description" cborgen:"description"` 37 - PostsCount int64 `json:"postsCount" cborgen:"postsCount"` 38 - FollowsCount int64 `json:"followsCount" cborgen:"followsCount"` 39 - MembersCount int64 `json:"membersCount" cborgen:"membersCount"` 40 - Handle string `json:"handle" cborgen:"handle"` 41 - Creator string `json:"creator" cborgen:"creator"` 42 - DisplayName string `json:"displayName" cborgen:"displayName"` 43 - FollowersCount int64 `json:"followersCount" cborgen:"followersCount"` 44 - } 45 - */ 46 } 47 48 func (s *Server) handleAppBskyActorGetSuggestions(ctx context.Context, cursor string, limit int) (*appbskytypes.ActorGetSuggestions_Output, error) { ··· 103 return &out, nil 104 } 105 106 - func (s *Server) handleAppBskyFeedGetPostThread(ctx context.Context, depth int, uri string) (*appbskytypes.FeedGetPostThread_Output, error) { 107 - panic("not yet implemented") 108 } 109 110 func (s *Server) handleAppBskyFeedGetRepostedBy(ctx context.Context, before string, cid string, limit int, uri string) (*appbskytypes.FeedGetRepostedBy_Output, error) { ··· 146 return &out, nil 147 } 148 149 - func (s *Server) handleAppBskyFeedGetVotes(ctx context.Context, before string, cid string, direction string, limit int, uri string) (*appbskytypes.FeedGetVotes_Output, error) { 150 - panic("not yet implemented") 151 } 152 153 func (s *Server) handleAppBskyFeedSetVote(ctx context.Context, input *appbskytypes.FeedSetVote_Input) (*appbskytypes.FeedSetVote_Output, error) { ··· 193 } 194 195 func (s *Server) handleAppBskyGraphGetMemberships(ctx context.Context, actor string, before string, limit int) (*appbskytypes.GraphGetMemberships_Output, error) { 196 - panic("not yet implemented") 197 } 198 199 func (s *Server) handleAppBskyNotificationGetCount(ctx context.Context) (*appbskytypes.NotificationGetCount_Output, error) { ··· 226 227 if err := s.validateHandle(input.Handle); err != nil { 228 return nil, err 229 230 } 231 232 var recoveryKey string ··· 326 return nil, err 327 } 328 329 - rkey, recid, err := s.repoman.CreateRecord(ctx, u.ID, input.Collection, rec) 330 if err != nil { 331 return nil, err 332 } 333 334 return &comatprototypes.RepoCreateRecord_Output{ 335 - Uri: "at://" + u.DID + "/" + rkey, 336 Cid: recid.String(), 337 }, nil 338 }
··· 18 } 19 20 func (s *Server) handleAppBskyActorGetProfile(ctx context.Context, actor string) (*appbskytypes.ActorGetProfile_Output, error) { 21 + profile, err := s.feedgen.GetActorProfile(ctx, actor) 22 + if err != nil { 23 + return nil, err 24 + } 25 26 + return &appbskytypes.ActorGetProfile_Output{ 27 + MyState: nil, //*ActorGetProfile_MyState `json:"myState" cborgen:"myState"` 28 + Did: profile.Did, 29 + Declaration: &appbskytypes.SystemDeclRef{ 30 + Cid: profile.DeclRefCid, 31 + ActorType: profile.Type, 32 + }, 33 + Description: nil, 34 + PostsCount: profile.Posts, 35 + FollowsCount: profile.Following, 36 + MembersCount: 0, // TODO: 37 + Handle: profile.Handle, 38 + Creator: "", //TODO: 39 + DisplayName: &profile.DisplayName, 40 + FollowersCount: profile.Followers, 41 + }, nil 42 } 43 44 func (s *Server) handleAppBskyActorGetSuggestions(ctx context.Context, cursor string, limit int) (*appbskytypes.ActorGetSuggestions_Output, error) { ··· 99 return &out, nil 100 } 101 102 + func (s *Server) handleAppBskyFeedGetPostThread(ctx context.Context, depth *int, uri string) (*appbskytypes.FeedGetPostThread_Output, error) { 103 + 104 + d := 6 105 + if depth != nil { 106 + d = *depth 107 + } 108 + 109 + pthread, err := s.feedgen.GetPostThread(ctx, uri, d) 110 + if err != nil { 111 + return nil, err 112 + } 113 + 114 + var convertToOutputType func(thr *ThreadPost) *appbskytypes.FeedGetPostThread_Post 115 + convertToOutputType = func(thr *ThreadPost) *appbskytypes.FeedGetPostThread_Post { 116 + p := thr.Post 117 + out := &appbskytypes.FeedGetPostThread_Post{ 118 + MyState: nil, // TODO: 119 + Uri: p.Uri, 120 + Parent: nil, 121 + ReplyCount: p.ReplyCount, 122 + Replies: []*appbskytypes.FeedGetPostThread_Post_Replies_Elem{}, 123 + UpvoteCount: p.UpvoteCount, 124 + DownvoteCount: 0, // TODO: 125 + IndexedAt: p.IndexedAt, 126 + Cid: p.Cid, 127 + Author: p.Author, 128 + Record: p.Record, 129 + Embed: nil, // TODO: embeds 130 + RepostCount: p.RepostCount, 131 + } 132 + 133 + if thr.ParentUri != "" { 134 + if thr.Parent == nil { 135 + out.Parent = &appbskytypes.FeedGetPostThread_Post_Parent{ 136 + FeedGetPostThread_NotFoundPost: &appbskytypes.FeedGetPostThread_NotFoundPost{ 137 + Uri: thr.ParentUri, 138 + NotFound: true, 139 + }, 140 + } 141 + } else { 142 + out.Parent = &appbskytypes.FeedGetPostThread_Post_Parent{ 143 + FeedGetPostThread_Post: convertToOutputType(thr.Parent), 144 + } 145 + } 146 + } 147 + 148 + return out 149 + } 150 + 151 + out := appbskytypes.FeedGetPostThread_Output{ 152 + Thread: &appbskytypes.FeedGetPostThread_Output_Thread{ 153 + FeedGetPostThread_Post: convertToOutputType(pthread), 154 + //FeedGetPostThread_NotFoundPost: &appbskytypes.FeedGetPostThread_NotFoundPost{}, 155 + }, 156 + } 157 + 158 + return &out, nil 159 } 160 161 func (s *Server) handleAppBskyFeedGetRepostedBy(ctx context.Context, before string, cid string, limit int, uri string) (*appbskytypes.FeedGetRepostedBy_Output, error) { ··· 197 return &out, nil 198 } 199 200 + func (s *Server) handleAppBskyFeedGetVotes(ctx context.Context, before string, cc string, direction string, limit int, uri string) (*appbskytypes.FeedGetVotes_Output, error) { 201 + pcid, err := cid.Decode(cc) 202 + if err != nil { 203 + return nil, err 204 + } 205 + 206 + votes, err := s.feedgen.GetVotes(ctx, uri, pcid, direction, limit, before) 207 + if err != nil { 208 + return nil, err 209 + } 210 + 211 + var out appbskytypes.FeedGetVotes_Output 212 + out.Uri = uri 213 + out.Votes = []*appbskytypes.FeedGetVotes_Vote{} 214 + 215 + for _, v := range votes { 216 + out.Votes = append(out.Votes, &appbskytypes.FeedGetVotes_Vote{ 217 + Actor: v.Actor, 218 + Direction: v.Direction, 219 + IndexedAt: v.IndexedAt.Format(time.RFC3339), 220 + CreatedAt: v.CreatedAt, 221 + }) 222 + } 223 + 224 + return &out, nil 225 } 226 227 func (s *Server) handleAppBskyFeedSetVote(ctx context.Context, input *appbskytypes.FeedSetVote_Input) (*appbskytypes.FeedSetVote_Output, error) { ··· 267 } 268 269 func (s *Server) handleAppBskyGraphGetMemberships(ctx context.Context, actor string, before string, limit int) (*appbskytypes.GraphGetMemberships_Output, error) { 270 + ai, err := s.feedgen.GetActorProfile(ctx, actor) 271 + if err != nil { 272 + return nil, err 273 + } 274 + 275 + return &appbskytypes.GraphGetMemberships_Output{ 276 + Subject: infoToActorRef(ai), 277 + Memberships: []*appbskytypes.GraphGetMemberships_Membership{}, 278 + }, nil 279 } 280 281 func (s *Server) handleAppBskyNotificationGetCount(ctx context.Context) (*appbskytypes.NotificationGetCount_Output, error) { ··· 308 309 if err := s.validateHandle(input.Handle); err != nil { 310 return nil, err 311 + } 312 313 + _, err := s.lookupUserByHandle(ctx, input.Handle) 314 + switch err { 315 + default: 316 + return nil, err 317 + case nil: 318 + return nil, fmt.Errorf("handle already registered") 319 + case ErrNoSuchUser: 320 + // handle is available, lets go 321 } 322 323 var recoveryKey string ··· 417 return nil, err 418 } 419 420 + rpath, recid, err := s.repoman.CreateRecord(ctx, u.ID, input.Collection, rec) 421 if err != nil { 422 return nil, err 423 } 424 425 return &comatprototypes.RepoCreateRecord_Output{ 426 + Uri: "at://" + u.DID + "/" + rpath, 427 Cid: recid.String(), 428 }, nil 429 }
+24 -1
api/server/server.go
··· 16 "github.com/labstack/echo/v4" 17 "github.com/labstack/echo/v4/middleware" 18 jwk "github.com/lestrrat-go/jwx/jwk" 19 "github.com/whyrusleeping/gosky/carstore" 20 "github.com/whyrusleeping/gosky/lex/util" 21 "github.com/whyrusleeping/gosky/repomgr" ··· 137 DID string `gorm:"uniqueIndex"` 138 } 139 140 func toTime(i interface{}) (time.Time, error) { 141 ival, ok := i.(float64) 142 if !ok { ··· 225 return &u, nil 226 } 227 228 func (s *Server) lookupUserByHandle(ctx context.Context, handle string) (*User, error) { 229 var didEntry FakeDidMapping 230 if err := s.db.First(&didEntry, "handle = ?", handle).Error; err != nil { 231 return nil, err 232 } 233 234 var u User 235 if err := s.db.First(&u, "handle = ?", didEntry.Handle).Error; err != nil { 236 if err == gorm.ErrRecordNotFound { 237 - return nil, fmt.Errorf("no such user with handle: %s", handle) 238 } 239 return nil, err 240 } ··· 328 329 return nil 330 }
··· 16 "github.com/labstack/echo/v4" 17 "github.com/labstack/echo/v4/middleware" 18 jwk "github.com/lestrrat-go/jwx/jwk" 19 + appbskytypes "github.com/whyrusleeping/gosky/api/bsky" 20 "github.com/whyrusleeping/gosky/carstore" 21 "github.com/whyrusleeping/gosky/lex/util" 22 "github.com/whyrusleeping/gosky/repomgr" ··· 138 DID string `gorm:"uniqueIndex"` 139 } 140 141 + type RefreshToken struct { 142 + gorm.Model 143 + Token string 144 + } 145 + 146 func toTime(i interface{}) (time.Time, error) { 147 ival, ok := i.(float64) 148 if !ok { ··· 231 return &u, nil 232 } 233 234 + var ErrNoSuchUser = fmt.Errorf("no such user") 235 + 236 func (s *Server) lookupUserByHandle(ctx context.Context, handle string) (*User, error) { 237 var didEntry FakeDidMapping 238 if err := s.db.First(&didEntry, "handle = ?", handle).Error; err != nil { 239 + if err == gorm.ErrRecordNotFound { 240 + return nil, ErrNoSuchUser 241 + } 242 return nil, err 243 } 244 245 var u User 246 if err := s.db.First(&u, "handle = ?", didEntry.Handle).Error; err != nil { 247 if err == gorm.ErrRecordNotFound { 248 + return nil, ErrNoSuchUser 249 } 250 return nil, err 251 } ··· 339 340 return nil 341 } 342 + 343 + func infoToActorRef(ai *ActorInfo) *appbskytypes.ActorRef_WithInfo { 344 + return &appbskytypes.ActorRef_WithInfo{ 345 + Declaration: &appbskytypes.SystemDeclRef{ 346 + Cid: ai.DeclRefCid, 347 + ActorType: ai.Type, 348 + }, 349 + Handle: ai.Handle, 350 + DisplayName: &ai.DisplayName, 351 + Did: ai.Did, 352 + } 353 + }
+473 -391
api/server/stubs.go
··· 10 "go.opentelemetry.io/otel" 11 ) 12 13 - func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { 14 - e.POST("/xrpc/com.atproto.account.create", s.HandleComAtprotoAccountCreate) 15 - e.POST("/xrpc/com.atproto.account.createInviteCode", s.HandleComAtprotoAccountCreateInviteCode) 16 - e.POST("/xrpc/com.atproto.account.delete", s.HandleComAtprotoAccountDelete) 17 - e.GET("/xrpc/com.atproto.account.get", s.HandleComAtprotoAccountGet) 18 - e.POST("/xrpc/com.atproto.account.requestPasswordReset", s.HandleComAtprotoAccountRequestPasswordReset) 19 - e.POST("/xrpc/com.atproto.account.resetPassword", s.HandleComAtprotoAccountResetPassword) 20 - e.GET("/xrpc/com.atproto.handle.resolve", s.HandleComAtprotoHandleResolve) 21 - e.POST("/xrpc/com.atproto.repo.batchWrite", s.HandleComAtprotoRepoBatchWrite) 22 - e.POST("/xrpc/com.atproto.repo.createRecord", s.HandleComAtprotoRepoCreateRecord) 23 - e.POST("/xrpc/com.atproto.repo.deleteRecord", s.HandleComAtprotoRepoDeleteRecord) 24 - e.GET("/xrpc/com.atproto.repo.describe", s.HandleComAtprotoRepoDescribe) 25 - e.GET("/xrpc/com.atproto.repo.getRecord", s.HandleComAtprotoRepoGetRecord) 26 - e.GET("/xrpc/com.atproto.repo.listRecords", s.HandleComAtprotoRepoListRecords) 27 - e.POST("/xrpc/com.atproto.repo.putRecord", s.HandleComAtprotoRepoPutRecord) 28 - e.GET("/xrpc/com.atproto.server.getAccountsConfig", s.HandleComAtprotoServerGetAccountsConfig) 29 - e.POST("/xrpc/com.atproto.session.create", s.HandleComAtprotoSessionCreate) 30 - e.POST("/xrpc/com.atproto.session.delete", s.HandleComAtprotoSessionDelete) 31 - e.GET("/xrpc/com.atproto.session.get", s.HandleComAtprotoSessionGet) 32 - e.POST("/xrpc/com.atproto.session.refresh", s.HandleComAtprotoSessionRefresh) 33 - e.GET("/xrpc/com.atproto.sync.getRepo", s.HandleComAtprotoSyncGetRepo) 34 - e.GET("/xrpc/com.atproto.sync.getRoot", s.HandleComAtprotoSyncGetRoot) 35 - e.POST("/xrpc/com.atproto.sync.updateRepo", s.HandleComAtprotoSyncUpdateRepo) 36 return nil 37 } 38 39 - func (s *Server) HandleComAtprotoAccountCreate(c echo.Context) error { 40 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountCreate") 41 defer span.End() 42 43 - var body comatprototypes.AccountCreate_Input 44 if err := c.Bind(&body); err != nil { 45 return err 46 } 47 - var out *comatprototypes.AccountCreate_Output 48 var handleErr error 49 - // func (s *Server) handleComAtprotoAccountCreate(ctx context.Context,body comatprototypes.AccountCreate_Input) (*comatprototypes.AccountCreate_Output, error) 50 - out, handleErr = s.handleComAtprotoAccountCreate(ctx, &body) 51 if handleErr != nil { 52 return handleErr 53 } 54 return c.JSON(200, out) 55 } 56 57 - func (s *Server) HandleComAtprotoAccountCreateInviteCode(c echo.Context) error { 58 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountCreateInviteCode") 59 defer span.End() 60 - 61 - var body comatprototypes.AccountCreateInviteCode_Input 62 - if err := c.Bind(&body); err != nil { 63 - return err 64 - } 65 - var out *comatprototypes.AccountCreateInviteCode_Output 66 var handleErr error 67 - // func (s *Server) handleComAtprotoAccountCreateInviteCode(ctx context.Context,body comatprototypes.AccountCreateInviteCode_Input) (*comatprototypes.AccountCreateInviteCode_Output, error) 68 - out, handleErr = s.handleComAtprotoAccountCreateInviteCode(ctx, &body) 69 if handleErr != nil { 70 return handleErr 71 } 72 return c.JSON(200, out) 73 } 74 75 - func (s *Server) HandleComAtprotoAccountDelete(c echo.Context) error { 76 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountDelete") 77 defer span.End() 78 - var handleErr error 79 - // func (s *Server) handleComAtprotoAccountDelete(ctx context.Context) error 80 - handleErr = s.handleComAtprotoAccountDelete(ctx) 81 - if handleErr != nil { 82 - return handleErr 83 } 84 - return nil 85 - } 86 - 87 - func (s *Server) HandleComAtprotoAccountGet(c echo.Context) error { 88 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountGet") 89 - defer span.End() 90 var handleErr error 91 - // func (s *Server) handleComAtprotoAccountGet(ctx context.Context) error 92 - handleErr = s.handleComAtprotoAccountGet(ctx) 93 if handleErr != nil { 94 return handleErr 95 } 96 - return nil 97 } 98 99 - func (s *Server) HandleComAtprotoAccountRequestPasswordReset(c echo.Context) error { 100 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountRequestPasswordReset") 101 defer span.End() 102 103 - var body comatprototypes.AccountRequestPasswordReset_Input 104 - if err := c.Bind(&body); err != nil { 105 - return err 106 } 107 var handleErr error 108 - // func (s *Server) handleComAtprotoAccountRequestPasswordReset(ctx context.Context,body comatprototypes.AccountRequestPasswordReset_Input) error 109 - handleErr = s.handleComAtprotoAccountRequestPasswordReset(ctx, &body) 110 if handleErr != nil { 111 return handleErr 112 } 113 - return nil 114 } 115 116 - func (s *Server) HandleComAtprotoAccountResetPassword(c echo.Context) error { 117 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountResetPassword") 118 defer span.End() 119 120 - var body comatprototypes.AccountResetPassword_Input 121 - if err := c.Bind(&body); err != nil { 122 - return err 123 } 124 - var handleErr error 125 - // func (s *Server) handleComAtprotoAccountResetPassword(ctx context.Context,body comatprototypes.AccountResetPassword_Input) error 126 - handleErr = s.handleComAtprotoAccountResetPassword(ctx, &body) 127 - if handleErr != nil { 128 - return handleErr 129 - } 130 - return nil 131 - } 132 - 133 - func (s *Server) HandleComAtprotoHandleResolve(c echo.Context) error { 134 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoHandleResolve") 135 - defer span.End() 136 - handle := c.QueryParam("handle") 137 - var out *comatprototypes.HandleResolve_Output 138 var handleErr error 139 - // func (s *Server) handleComAtprotoHandleResolve(ctx context.Context,handle string) (*comatprototypes.HandleResolve_Output, error) 140 - out, handleErr = s.handleComAtprotoHandleResolve(ctx, handle) 141 if handleErr != nil { 142 return handleErr 143 } 144 return c.JSON(200, out) 145 } 146 147 - func (s *Server) HandleComAtprotoRepoBatchWrite(c echo.Context) error { 148 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoBatchWrite") 149 defer span.End() 150 151 - var body comatprototypes.RepoBatchWrite_Input 152 if err := c.Bind(&body); err != nil { 153 return err 154 } 155 var handleErr error 156 - // func (s *Server) handleComAtprotoRepoBatchWrite(ctx context.Context,body comatprototypes.RepoBatchWrite_Input) error 157 - handleErr = s.handleComAtprotoRepoBatchWrite(ctx, &body) 158 if handleErr != nil { 159 return handleErr 160 } 161 - return nil 162 } 163 164 - func (s *Server) HandleComAtprotoRepoCreateRecord(c echo.Context) error { 165 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoCreateRecord") 166 defer span.End() 167 168 - var body comatprototypes.RepoCreateRecord_Input 169 - if err := c.Bind(&body); err != nil { 170 - return err 171 } 172 - var out *comatprototypes.RepoCreateRecord_Output 173 var handleErr error 174 - // func (s *Server) handleComAtprotoRepoCreateRecord(ctx context.Context,body comatprototypes.RepoCreateRecord_Input) (*comatprototypes.RepoCreateRecord_Output, error) 175 - out, handleErr = s.handleComAtprotoRepoCreateRecord(ctx, &body) 176 if handleErr != nil { 177 return handleErr 178 } 179 return c.JSON(200, out) 180 } 181 182 - func (s *Server) HandleComAtprotoRepoDeleteRecord(c echo.Context) error { 183 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDeleteRecord") 184 defer span.End() 185 186 - var body comatprototypes.RepoDeleteRecord_Input 187 - if err := c.Bind(&body); err != nil { 188 - return err 189 } 190 var handleErr error 191 - // func (s *Server) handleComAtprotoRepoDeleteRecord(ctx context.Context,body comatprototypes.RepoDeleteRecord_Input) error 192 - handleErr = s.handleComAtprotoRepoDeleteRecord(ctx, &body) 193 if handleErr != nil { 194 return handleErr 195 } 196 - return nil 197 } 198 199 - func (s *Server) HandleComAtprotoRepoDescribe(c echo.Context) error { 200 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDescribe") 201 defer span.End() 202 - user := c.QueryParam("user") 203 - var out *comatprototypes.RepoDescribe_Output 204 var handleErr error 205 - // func (s *Server) handleComAtprotoRepoDescribe(ctx context.Context,user string) (*comatprototypes.RepoDescribe_Output, error) 206 - out, handleErr = s.handleComAtprotoRepoDescribe(ctx, user) 207 if handleErr != nil { 208 return handleErr 209 } 210 return c.JSON(200, out) 211 } 212 213 - func (s *Server) HandleComAtprotoRepoGetRecord(c echo.Context) error { 214 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoGetRecord") 215 defer span.End() 216 - cid := c.QueryParam("cid") 217 - collection := c.QueryParam("collection") 218 - rkey := c.QueryParam("rkey") 219 - user := c.QueryParam("user") 220 - var out *comatprototypes.RepoGetRecord_Output 221 var handleErr error 222 - // func (s *Server) handleComAtprotoRepoGetRecord(ctx context.Context,cid string,collection string,rkey string,user string) (*comatprototypes.RepoGetRecord_Output, error) 223 - out, handleErr = s.handleComAtprotoRepoGetRecord(ctx, cid, collection, rkey, user) 224 if handleErr != nil { 225 return handleErr 226 } 227 return c.JSON(200, out) 228 } 229 230 - func (s *Server) HandleComAtprotoRepoListRecords(c echo.Context) error { 231 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoListRecords") 232 defer span.End() 233 - after := c.QueryParam("after") 234 before := c.QueryParam("before") 235 - collection := c.QueryParam("collection") 236 237 - limit, err := strconv.Atoi(c.QueryParam("limit")) 238 - if err != nil { 239 - return err 240 } 241 - var out *comatprototypes.RepoListRecords_Output 242 var handleErr error 243 - // func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context,after string,before string,collection string,limit int) (*comatprototypes.RepoListRecords_Output, error) 244 - out, handleErr = s.handleComAtprotoRepoListRecords(ctx, after, before, collection, limit) 245 if handleErr != nil { 246 return handleErr 247 } 248 return c.JSON(200, out) 249 } 250 251 - func (s *Server) HandleComAtprotoRepoPutRecord(c echo.Context) error { 252 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoPutRecord") 253 defer span.End() 254 255 - var body comatprototypes.RepoPutRecord_Input 256 if err := c.Bind(&body); err != nil { 257 return err 258 } 259 - var out *comatprototypes.RepoPutRecord_Output 260 var handleErr error 261 - // func (s *Server) handleComAtprotoRepoPutRecord(ctx context.Context,body comatprototypes.RepoPutRecord_Input) (*comatprototypes.RepoPutRecord_Output, error) 262 - out, handleErr = s.handleComAtprotoRepoPutRecord(ctx, &body) 263 if handleErr != nil { 264 return handleErr 265 } 266 return c.JSON(200, out) 267 } 268 269 - func (s *Server) HandleComAtprotoServerGetAccountsConfig(c echo.Context) error { 270 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerGetAccountsConfig") 271 defer span.End() 272 - var out *comatprototypes.ServerGetAccountsConfig_Output 273 var handleErr error 274 - // func (s *Server) handleComAtprotoServerGetAccountsConfig(ctx context.Context) (*comatprototypes.ServerGetAccountsConfig_Output, error) 275 - out, handleErr = s.handleComAtprotoServerGetAccountsConfig(ctx) 276 if handleErr != nil { 277 return handleErr 278 } 279 return c.JSON(200, out) 280 } 281 282 - func (s *Server) HandleComAtprotoSessionCreate(c echo.Context) error { 283 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionCreate") 284 defer span.End() 285 286 - var body comatprototypes.SessionCreate_Input 287 - if err := c.Bind(&body); err != nil { 288 - return err 289 } 290 - var out *comatprototypes.SessionCreate_Output 291 var handleErr error 292 - // func (s *Server) handleComAtprotoSessionCreate(ctx context.Context,body comatprototypes.SessionCreate_Input) (*comatprototypes.SessionCreate_Output, error) 293 - out, handleErr = s.handleComAtprotoSessionCreate(ctx, &body) 294 if handleErr != nil { 295 return handleErr 296 } 297 return c.JSON(200, out) 298 } 299 300 - func (s *Server) HandleComAtprotoSessionDelete(c echo.Context) error { 301 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionDelete") 302 defer span.End() 303 var handleErr error 304 - // func (s *Server) handleComAtprotoSessionDelete(ctx context.Context) error 305 - handleErr = s.handleComAtprotoSessionDelete(ctx) 306 if handleErr != nil { 307 return handleErr 308 } 309 - return nil 310 } 311 312 - func (s *Server) HandleComAtprotoSessionGet(c echo.Context) error { 313 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionGet") 314 defer span.End() 315 - var out *comatprototypes.SessionGet_Output 316 var handleErr error 317 - // func (s *Server) handleComAtprotoSessionGet(ctx context.Context) (*comatprototypes.SessionGet_Output, error) 318 - out, handleErr = s.handleComAtprotoSessionGet(ctx) 319 if handleErr != nil { 320 return handleErr 321 } 322 return c.JSON(200, out) 323 } 324 325 - func (s *Server) HandleComAtprotoSessionRefresh(c echo.Context) error { 326 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionRefresh") 327 defer span.End() 328 - var out *comatprototypes.SessionRefresh_Output 329 var handleErr error 330 - // func (s *Server) handleComAtprotoSessionRefresh(ctx context.Context) (*comatprototypes.SessionRefresh_Output, error) 331 - out, handleErr = s.handleComAtprotoSessionRefresh(ctx) 332 if handleErr != nil { 333 return handleErr 334 } 335 return c.JSON(200, out) 336 } 337 338 - func (s *Server) HandleComAtprotoSyncGetRepo(c echo.Context) error { 339 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetRepo") 340 defer span.End() 341 - did := c.QueryParam("did") 342 - from := c.QueryParam("from") 343 - var out io.Reader 344 var handleErr error 345 - // func (s *Server) handleComAtprotoSyncGetRepo(ctx context.Context,did string,from string) (io.Reader, error) 346 - out, handleErr = s.handleComAtprotoSyncGetRepo(ctx, did, from) 347 if handleErr != nil { 348 return handleErr 349 } 350 return c.JSON(200, out) 351 } 352 353 - func (s *Server) HandleComAtprotoSyncGetRoot(c echo.Context) error { 354 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetRoot") 355 defer span.End() 356 - did := c.QueryParam("did") 357 - var out *comatprototypes.SyncGetRoot_Output 358 var handleErr error 359 - // func (s *Server) handleComAtprotoSyncGetRoot(ctx context.Context,did string) (*comatprototypes.SyncGetRoot_Output, error) 360 - out, handleErr = s.handleComAtprotoSyncGetRoot(ctx, did) 361 if handleErr != nil { 362 return handleErr 363 } 364 return c.JSON(200, out) 365 } 366 367 - func (s *Server) HandleComAtprotoSyncUpdateRepo(c echo.Context) error { 368 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncUpdateRepo") 369 defer span.End() 370 - body := c.Request().Body 371 var handleErr error 372 - // func (s *Server) handleComAtprotoSyncUpdateRepo(ctx context.Context,r io.Reader) error 373 - handleErr = s.handleComAtprotoSyncUpdateRepo(ctx, body) 374 if handleErr != nil { 375 return handleErr 376 } 377 return nil 378 } 379 380 - func (s *Server) RegisterHandlersAppBsky(e *echo.Echo) error { 381 - e.POST("/xrpc/app.bsky.actor.createScene", s.HandleAppBskyActorCreateScene) 382 - e.GET("/xrpc/app.bsky.actor.getProfile", s.HandleAppBskyActorGetProfile) 383 - e.GET("/xrpc/app.bsky.actor.getSuggestions", s.HandleAppBskyActorGetSuggestions) 384 - e.GET("/xrpc/app.bsky.actor.search", s.HandleAppBskyActorSearch) 385 - e.GET("/xrpc/app.bsky.actor.searchTypeahead", s.HandleAppBskyActorSearchTypeahead) 386 - e.POST("/xrpc/app.bsky.actor.updateProfile", s.HandleAppBskyActorUpdateProfile) 387 - e.GET("/xrpc/app.bsky.feed.getAuthorFeed", s.HandleAppBskyFeedGetAuthorFeed) 388 - e.GET("/xrpc/app.bsky.feed.getPostThread", s.HandleAppBskyFeedGetPostThread) 389 - e.GET("/xrpc/app.bsky.feed.getRepostedBy", s.HandleAppBskyFeedGetRepostedBy) 390 - e.GET("/xrpc/app.bsky.feed.getTimeline", s.HandleAppBskyFeedGetTimeline) 391 - e.GET("/xrpc/app.bsky.feed.getVotes", s.HandleAppBskyFeedGetVotes) 392 - e.POST("/xrpc/app.bsky.feed.setVote", s.HandleAppBskyFeedSetVote) 393 - e.GET("/xrpc/app.bsky.graph.getAssertions", s.HandleAppBskyGraphGetAssertions) 394 - e.GET("/xrpc/app.bsky.graph.getFollowers", s.HandleAppBskyGraphGetFollowers) 395 - e.GET("/xrpc/app.bsky.graph.getFollows", s.HandleAppBskyGraphGetFollows) 396 - e.GET("/xrpc/app.bsky.graph.getMembers", s.HandleAppBskyGraphGetMembers) 397 - e.GET("/xrpc/app.bsky.graph.getMemberships", s.HandleAppBskyGraphGetMemberships) 398 - e.GET("/xrpc/app.bsky.notification.getCount", s.HandleAppBskyNotificationGetCount) 399 - e.GET("/xrpc/app.bsky.notification.list", s.HandleAppBskyNotificationList) 400 - e.POST("/xrpc/app.bsky.notification.updateSeen", s.HandleAppBskyNotificationUpdateSeen) 401 return nil 402 } 403 404 - func (s *Server) HandleAppBskyActorCreateScene(c echo.Context) error { 405 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorCreateScene") 406 defer span.End() 407 408 - var body appbskytypes.ActorCreateScene_Input 409 if err := c.Bind(&body); err != nil { 410 return err 411 } 412 - var out *appbskytypes.ActorCreateScene_Output 413 var handleErr error 414 - // func (s *Server) handleAppBskyActorCreateScene(ctx context.Context,body appbskytypes.ActorCreateScene_Input) (*appbskytypes.ActorCreateScene_Output, error) 415 - out, handleErr = s.handleAppBskyActorCreateScene(ctx, &body) 416 if handleErr != nil { 417 return handleErr 418 } 419 return c.JSON(200, out) 420 } 421 422 - func (s *Server) HandleAppBskyActorGetProfile(c echo.Context) error { 423 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorGetProfile") 424 defer span.End() 425 - actor := c.QueryParam("actor") 426 - var out *appbskytypes.ActorGetProfile_Output 427 var handleErr error 428 - // func (s *Server) handleAppBskyActorGetProfile(ctx context.Context,actor string) (*appbskytypes.ActorGetProfile_Output, error) 429 - out, handleErr = s.handleAppBskyActorGetProfile(ctx, actor) 430 if handleErr != nil { 431 return handleErr 432 } 433 return c.JSON(200, out) 434 } 435 436 - func (s *Server) HandleAppBskyActorGetSuggestions(c echo.Context) error { 437 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorGetSuggestions") 438 defer span.End() 439 - cursor := c.QueryParam("cursor") 440 441 - limit, err := strconv.Atoi(c.QueryParam("limit")) 442 - if err != nil { 443 - return err 444 - } 445 - var out *appbskytypes.ActorGetSuggestions_Output 446 var handleErr error 447 - // func (s *Server) handleAppBskyActorGetSuggestions(ctx context.Context,cursor string,limit int) (*appbskytypes.ActorGetSuggestions_Output, error) 448 - out, handleErr = s.handleAppBskyActorGetSuggestions(ctx, cursor, limit) 449 if handleErr != nil { 450 return handleErr 451 } 452 - return c.JSON(200, out) 453 } 454 455 - func (s *Server) HandleAppBskyActorSearch(c echo.Context) error { 456 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorSearch") 457 defer span.End() 458 - before := c.QueryParam("before") 459 460 - limit, err := strconv.Atoi(c.QueryParam("limit")) 461 - if err != nil { 462 return err 463 } 464 - term := c.QueryParam("term") 465 - var out *appbskytypes.ActorSearch_Output 466 var handleErr error 467 - // func (s *Server) handleAppBskyActorSearch(ctx context.Context,before string,limit int,term string) (*appbskytypes.ActorSearch_Output, error) 468 - out, handleErr = s.handleAppBskyActorSearch(ctx, before, limit, term) 469 if handleErr != nil { 470 return handleErr 471 } 472 - return c.JSON(200, out) 473 } 474 475 - func (s *Server) HandleAppBskyActorSearchTypeahead(c echo.Context) error { 476 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorSearchTypeahead") 477 defer span.End() 478 479 - limit, err := strconv.Atoi(c.QueryParam("limit")) 480 - if err != nil { 481 return err 482 } 483 - term := c.QueryParam("term") 484 - var out *appbskytypes.ActorSearchTypeahead_Output 485 var handleErr error 486 - // func (s *Server) handleAppBskyActorSearchTypeahead(ctx context.Context,limit int,term string) (*appbskytypes.ActorSearchTypeahead_Output, error) 487 - out, handleErr = s.handleAppBskyActorSearchTypeahead(ctx, limit, term) 488 if handleErr != nil { 489 return handleErr 490 } 491 return c.JSON(200, out) 492 } 493 494 - func (s *Server) HandleAppBskyActorUpdateProfile(c echo.Context) error { 495 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorUpdateProfile") 496 defer span.End() 497 498 - var body appbskytypes.ActorUpdateProfile_Input 499 if err := c.Bind(&body); err != nil { 500 return err 501 } 502 - var out *appbskytypes.ActorUpdateProfile_Output 503 var handleErr error 504 - // func (s *Server) handleAppBskyActorUpdateProfile(ctx context.Context,body appbskytypes.ActorUpdateProfile_Input) (*appbskytypes.ActorUpdateProfile_Output, error) 505 - out, handleErr = s.handleAppBskyActorUpdateProfile(ctx, &body) 506 if handleErr != nil { 507 return handleErr 508 } 509 - return c.JSON(200, out) 510 } 511 512 - func (s *Server) HandleAppBskyFeedGetAuthorFeed(c echo.Context) error { 513 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetAuthorFeed") 514 defer span.End() 515 - author := c.QueryParam("author") 516 - before := c.QueryParam("before") 517 518 - limit, err := strconv.Atoi(c.QueryParam("limit")) 519 - if err != nil { 520 return err 521 } 522 - var out *appbskytypes.FeedGetAuthorFeed_Output 523 var handleErr error 524 - // func (s *Server) handleAppBskyFeedGetAuthorFeed(ctx context.Context,author string,before string,limit int) (*appbskytypes.FeedGetAuthorFeed_Output, error) 525 - out, handleErr = s.handleAppBskyFeedGetAuthorFeed(ctx, author, before, limit) 526 if handleErr != nil { 527 return handleErr 528 } 529 return c.JSON(200, out) 530 } 531 532 - func (s *Server) HandleAppBskyFeedGetPostThread(c echo.Context) error { 533 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetPostThread") 534 defer span.End() 535 536 - depth, err := strconv.Atoi(c.QueryParam("depth")) 537 - if err != nil { 538 return err 539 } 540 - uri := c.QueryParam("uri") 541 - var out *appbskytypes.FeedGetPostThread_Output 542 var handleErr error 543 - // func (s *Server) handleAppBskyFeedGetPostThread(ctx context.Context,depth int,uri string) (*appbskytypes.FeedGetPostThread_Output, error) 544 - out, handleErr = s.handleAppBskyFeedGetPostThread(ctx, depth, uri) 545 if handleErr != nil { 546 return handleErr 547 } 548 - return c.JSON(200, out) 549 } 550 551 - func (s *Server) HandleAppBskyFeedGetRepostedBy(c echo.Context) error { 552 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetRepostedBy") 553 defer span.End() 554 - before := c.QueryParam("before") 555 - cid := c.QueryParam("cid") 556 - 557 - limit, err := strconv.Atoi(c.QueryParam("limit")) 558 - if err != nil { 559 - return err 560 - } 561 - uri := c.QueryParam("uri") 562 - var out *appbskytypes.FeedGetRepostedBy_Output 563 var handleErr error 564 - // func (s *Server) handleAppBskyFeedGetRepostedBy(ctx context.Context,before string,cid string,limit int,uri string) (*appbskytypes.FeedGetRepostedBy_Output, error) 565 - out, handleErr = s.handleAppBskyFeedGetRepostedBy(ctx, before, cid, limit, uri) 566 if handleErr != nil { 567 return handleErr 568 } 569 return c.JSON(200, out) 570 } 571 572 - func (s *Server) HandleAppBskyFeedGetTimeline(c echo.Context) error { 573 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetTimeline") 574 defer span.End() 575 - algorithm := c.QueryParam("algorithm") 576 - before := c.QueryParam("before") 577 - 578 - limit, err := strconv.Atoi(c.QueryParam("limit")) 579 - if err != nil { 580 - return err 581 - } 582 - var out *appbskytypes.FeedGetTimeline_Output 583 var handleErr error 584 - // func (s *Server) handleAppBskyFeedGetTimeline(ctx context.Context,algorithm string,before string,limit int) (*appbskytypes.FeedGetTimeline_Output, error) 585 - out, handleErr = s.handleAppBskyFeedGetTimeline(ctx, algorithm, before, limit) 586 if handleErr != nil { 587 return handleErr 588 } 589 return c.JSON(200, out) 590 } 591 592 - func (s *Server) HandleAppBskyFeedGetVotes(c echo.Context) error { 593 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetVotes") 594 defer span.End() 595 before := c.QueryParam("before") 596 - cid := c.QueryParam("cid") 597 - direction := c.QueryParam("direction") 598 599 - limit, err := strconv.Atoi(c.QueryParam("limit")) 600 - if err != nil { 601 - return err 602 } 603 - uri := c.QueryParam("uri") 604 - var out *appbskytypes.FeedGetVotes_Output 605 var handleErr error 606 - // func (s *Server) handleAppBskyFeedGetVotes(ctx context.Context,before string,cid string,direction string,limit int,uri string) (*appbskytypes.FeedGetVotes_Output, error) 607 - out, handleErr = s.handleAppBskyFeedGetVotes(ctx, before, cid, direction, limit, uri) 608 if handleErr != nil { 609 return handleErr 610 } 611 return c.JSON(200, out) 612 } 613 614 - func (s *Server) HandleAppBskyFeedSetVote(c echo.Context) error { 615 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedSetVote") 616 defer span.End() 617 618 - var body appbskytypes.FeedSetVote_Input 619 if err := c.Bind(&body); err != nil { 620 return err 621 } 622 - var out *appbskytypes.FeedSetVote_Output 623 var handleErr error 624 - // func (s *Server) handleAppBskyFeedSetVote(ctx context.Context,body appbskytypes.FeedSetVote_Input) (*appbskytypes.FeedSetVote_Output, error) 625 - out, handleErr = s.handleAppBskyFeedSetVote(ctx, &body) 626 if handleErr != nil { 627 return handleErr 628 } 629 return c.JSON(200, out) 630 } 631 632 - func (s *Server) HandleAppBskyGraphGetAssertions(c echo.Context) error { 633 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetAssertions") 634 defer span.End() 635 - assertion := c.QueryParam("assertion") 636 - author := c.QueryParam("author") 637 - before := c.QueryParam("before") 638 - var out *appbskytypes.GraphGetAssertions_Output 639 var handleErr error 640 - // func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context,assertion string,author string,before string) (*appbskytypes.GraphGetAssertions_Output, error) 641 - out, handleErr = s.handleAppBskyGraphGetAssertions(ctx, assertion, author, before) 642 if handleErr != nil { 643 return handleErr 644 } 645 return c.JSON(200, out) 646 } 647 648 - func (s *Server) HandleAppBskyGraphGetFollowers(c echo.Context) error { 649 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetFollowers") 650 defer span.End() 651 - before := c.QueryParam("before") 652 653 - limit, err := strconv.Atoi(c.QueryParam("limit")) 654 - if err != nil { 655 return err 656 } 657 - user := c.QueryParam("user") 658 - var out *appbskytypes.GraphGetFollowers_Output 659 var handleErr error 660 - // func (s *Server) handleAppBskyGraphGetFollowers(ctx context.Context,before string,limit int,user string) (*appbskytypes.GraphGetFollowers_Output, error) 661 - out, handleErr = s.handleAppBskyGraphGetFollowers(ctx, before, limit, user) 662 if handleErr != nil { 663 return handleErr 664 } 665 return c.JSON(200, out) 666 } 667 668 - func (s *Server) HandleAppBskyGraphGetFollows(c echo.Context) error { 669 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetFollows") 670 defer span.End() 671 - before := c.QueryParam("before") 672 - 673 - limit, err := strconv.Atoi(c.QueryParam("limit")) 674 - if err != nil { 675 - return err 676 - } 677 - user := c.QueryParam("user") 678 - var out *appbskytypes.GraphGetFollows_Output 679 var handleErr error 680 - // func (s *Server) handleAppBskyGraphGetFollows(ctx context.Context,before string,limit int,user string) (*appbskytypes.GraphGetFollows_Output, error) 681 - out, handleErr = s.handleAppBskyGraphGetFollows(ctx, before, limit, user) 682 if handleErr != nil { 683 return handleErr 684 } 685 - return c.JSON(200, out) 686 } 687 688 - func (s *Server) HandleAppBskyGraphGetMembers(c echo.Context) error { 689 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetMembers") 690 defer span.End() 691 - actor := c.QueryParam("actor") 692 - before := c.QueryParam("before") 693 - 694 - limit, err := strconv.Atoi(c.QueryParam("limit")) 695 - if err != nil { 696 - return err 697 - } 698 - var out *appbskytypes.GraphGetMembers_Output 699 var handleErr error 700 - // func (s *Server) handleAppBskyGraphGetMembers(ctx context.Context,actor string,before string,limit int) (*appbskytypes.GraphGetMembers_Output, error) 701 - out, handleErr = s.handleAppBskyGraphGetMembers(ctx, actor, before, limit) 702 if handleErr != nil { 703 return handleErr 704 } 705 return c.JSON(200, out) 706 } 707 708 - func (s *Server) HandleAppBskyGraphGetMemberships(c echo.Context) error { 709 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetMemberships") 710 defer span.End() 711 - actor := c.QueryParam("actor") 712 - before := c.QueryParam("before") 713 - 714 - limit, err := strconv.Atoi(c.QueryParam("limit")) 715 - if err != nil { 716 - return err 717 - } 718 - var out *appbskytypes.GraphGetMemberships_Output 719 var handleErr error 720 - // func (s *Server) handleAppBskyGraphGetMemberships(ctx context.Context,actor string,before string,limit int) (*appbskytypes.GraphGetMemberships_Output, error) 721 - out, handleErr = s.handleAppBskyGraphGetMemberships(ctx, actor, before, limit) 722 if handleErr != nil { 723 return handleErr 724 } 725 return c.JSON(200, out) 726 } 727 728 - func (s *Server) HandleAppBskyNotificationGetCount(c echo.Context) error { 729 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationGetCount") 730 defer span.End() 731 - var out *appbskytypes.NotificationGetCount_Output 732 var handleErr error 733 - // func (s *Server) handleAppBskyNotificationGetCount(ctx context.Context) (*appbskytypes.NotificationGetCount_Output, error) 734 - out, handleErr = s.handleAppBskyNotificationGetCount(ctx) 735 if handleErr != nil { 736 return handleErr 737 } 738 return c.JSON(200, out) 739 } 740 741 - func (s *Server) HandleAppBskyNotificationList(c echo.Context) error { 742 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationList") 743 defer span.End() 744 - before := c.QueryParam("before") 745 - 746 - limit, err := strconv.Atoi(c.QueryParam("limit")) 747 - if err != nil { 748 - return err 749 - } 750 - var out *appbskytypes.NotificationList_Output 751 var handleErr error 752 - // func (s *Server) handleAppBskyNotificationList(ctx context.Context,before string,limit int) (*appbskytypes.NotificationList_Output, error) 753 - out, handleErr = s.handleAppBskyNotificationList(ctx, before, limit) 754 if handleErr != nil { 755 return handleErr 756 } 757 return c.JSON(200, out) 758 } 759 760 - func (s *Server) HandleAppBskyNotificationUpdateSeen(c echo.Context) error { 761 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationUpdateSeen") 762 defer span.End() 763 - 764 - var body appbskytypes.NotificationUpdateSeen_Input 765 - if err := c.Bind(&body); err != nil { 766 - return err 767 - } 768 var handleErr error 769 - // func (s *Server) handleAppBskyNotificationUpdateSeen(ctx context.Context,body appbskytypes.NotificationUpdateSeen_Input) error 770 - handleErr = s.handleAppBskyNotificationUpdateSeen(ctx, &body) 771 if handleErr != nil { 772 return handleErr 773 }
··· 10 "go.opentelemetry.io/otel" 11 ) 12 13 + func (s *Server) RegisterHandlersAppBsky(e *echo.Echo) 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 + var limit int 75 + if p := c.QueryParam("limit"); p != "" { 76 + var err error 77 + limit, err = strconv.Atoi(p) 78 + if err != nil { 79 + return err 80 + } 81 + } else { 82 + limit = 50 83 } 84 + var out *appbskytypes.ActorGetSuggestions_Output 85 var handleErr error 86 + // func (s *Server) handleAppBskyActorGetSuggestions(ctx context.Context,cursor string,limit int) (*appbskytypes.ActorGetSuggestions_Output, error) 87 + out, handleErr = s.handleAppBskyActorGetSuggestions(ctx, cursor, limit) 88 if handleErr != nil { 89 return handleErr 90 } 91 + return c.JSON(200, out) 92 } 93 94 + func (s *Server) HandleAppBskyActorSearch(c echo.Context) error { 95 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorSearch") 96 defer span.End() 97 + before := c.QueryParam("before") 98 99 + var limit int 100 + if p := c.QueryParam("limit"); p != "" { 101 + var err error 102 + limit, err = strconv.Atoi(p) 103 + if err != nil { 104 + return err 105 + } 106 + } else { 107 + limit = 50 108 } 109 + term := c.QueryParam("term") 110 + var out *appbskytypes.ActorSearch_Output 111 var handleErr error 112 + // func (s *Server) handleAppBskyActorSearch(ctx context.Context,before string,limit int,term string) (*appbskytypes.ActorSearch_Output, error) 113 + out, handleErr = s.handleAppBskyActorSearch(ctx, before, limit, term) 114 if handleErr != nil { 115 return handleErr 116 } 117 + return c.JSON(200, out) 118 } 119 120 + func (s *Server) HandleAppBskyActorSearchTypeahead(c echo.Context) error { 121 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorSearchTypeahead") 122 defer span.End() 123 124 + var limit int 125 + if p := c.QueryParam("limit"); p != "" { 126 + var err error 127 + limit, err = strconv.Atoi(p) 128 + if err != nil { 129 + return err 130 + } 131 + } else { 132 + limit = 50 133 } 134 + term := c.QueryParam("term") 135 + var out *appbskytypes.ActorSearchTypeahead_Output 136 var handleErr error 137 + // func (s *Server) handleAppBskyActorSearchTypeahead(ctx context.Context,limit int,term string) (*appbskytypes.ActorSearchTypeahead_Output, error) 138 + out, handleErr = s.handleAppBskyActorSearchTypeahead(ctx, limit, term) 139 if handleErr != nil { 140 return handleErr 141 } 142 return c.JSON(200, out) 143 } 144 145 + func (s *Server) HandleAppBskyActorUpdateProfile(c echo.Context) error { 146 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyActorUpdateProfile") 147 defer span.End() 148 149 + var body appbskytypes.ActorUpdateProfile_Input 150 if err := c.Bind(&body); err != nil { 151 return err 152 } 153 + var out *appbskytypes.ActorUpdateProfile_Output 154 var handleErr error 155 + // func (s *Server) handleAppBskyActorUpdateProfile(ctx context.Context,body appbskytypes.ActorUpdateProfile_Input) (*appbskytypes.ActorUpdateProfile_Output, error) 156 + out, handleErr = s.handleAppBskyActorUpdateProfile(ctx, &body) 157 if handleErr != nil { 158 return handleErr 159 } 160 + return c.JSON(200, out) 161 } 162 163 + func (s *Server) HandleAppBskyFeedGetAuthorFeed(c echo.Context) error { 164 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetAuthorFeed") 165 defer span.End() 166 + author := c.QueryParam("author") 167 + before := c.QueryParam("before") 168 169 + var limit int 170 + if p := c.QueryParam("limit"); p != "" { 171 + var err error 172 + limit, err = strconv.Atoi(p) 173 + if err != nil { 174 + return err 175 + } 176 + } else { 177 + limit = 50 178 } 179 + var out *appbskytypes.FeedGetAuthorFeed_Output 180 var handleErr error 181 + // func (s *Server) handleAppBskyFeedGetAuthorFeed(ctx context.Context,author string,before string,limit int) (*appbskytypes.FeedGetAuthorFeed_Output, error) 182 + out, handleErr = s.handleAppBskyFeedGetAuthorFeed(ctx, author, before, limit) 183 if handleErr != nil { 184 return handleErr 185 } 186 return c.JSON(200, out) 187 } 188 189 + func (s *Server) HandleAppBskyFeedGetPostThread(c echo.Context) error { 190 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetPostThread") 191 defer span.End() 192 193 + var depth *int 194 + if p := c.QueryParam("depth"); p != "" { 195 + depth_val, err := strconv.Atoi(p) 196 + if err != nil { 197 + return err 198 + } 199 + depth = &depth_val 200 } 201 + uri := c.QueryParam("uri") 202 + var out *appbskytypes.FeedGetPostThread_Output 203 var handleErr error 204 + // func (s *Server) handleAppBskyFeedGetPostThread(ctx context.Context,depth *int,uri string) (*appbskytypes.FeedGetPostThread_Output, error) 205 + out, handleErr = s.handleAppBskyFeedGetPostThread(ctx, depth, uri) 206 if handleErr != nil { 207 return handleErr 208 } 209 + return c.JSON(200, out) 210 } 211 212 + func (s *Server) HandleAppBskyFeedGetRepostedBy(c echo.Context) error { 213 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetRepostedBy") 214 defer span.End() 215 + before := c.QueryParam("before") 216 + cid := c.QueryParam("cid") 217 + 218 + var limit int 219 + if p := c.QueryParam("limit"); p != "" { 220 + var err error 221 + limit, err = strconv.Atoi(p) 222 + if err != nil { 223 + return err 224 + } 225 + } else { 226 + limit = 50 227 + } 228 + uri := c.QueryParam("uri") 229 + var out *appbskytypes.FeedGetRepostedBy_Output 230 var handleErr error 231 + // func (s *Server) handleAppBskyFeedGetRepostedBy(ctx context.Context,before string,cid string,limit int,uri string) (*appbskytypes.FeedGetRepostedBy_Output, error) 232 + out, handleErr = s.handleAppBskyFeedGetRepostedBy(ctx, before, cid, limit, uri) 233 if handleErr != nil { 234 return handleErr 235 } 236 return c.JSON(200, out) 237 } 238 239 + func (s *Server) HandleAppBskyFeedGetTimeline(c echo.Context) error { 240 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetTimeline") 241 defer span.End() 242 + algorithm := c.QueryParam("algorithm") 243 + before := c.QueryParam("before") 244 + 245 + var limit int 246 + if p := c.QueryParam("limit"); p != "" { 247 + var err error 248 + limit, err = strconv.Atoi(p) 249 + if err != nil { 250 + return err 251 + } 252 + } else { 253 + limit = 50 254 + } 255 + var out *appbskytypes.FeedGetTimeline_Output 256 var handleErr error 257 + // func (s *Server) handleAppBskyFeedGetTimeline(ctx context.Context,algorithm string,before string,limit int) (*appbskytypes.FeedGetTimeline_Output, error) 258 + out, handleErr = s.handleAppBskyFeedGetTimeline(ctx, algorithm, before, limit) 259 if handleErr != nil { 260 return handleErr 261 } 262 return c.JSON(200, out) 263 } 264 265 + func (s *Server) HandleAppBskyFeedGetVotes(c echo.Context) error { 266 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetVotes") 267 defer span.End() 268 before := c.QueryParam("before") 269 + cid := c.QueryParam("cid") 270 + direction := c.QueryParam("direction") 271 272 + var limit int 273 + if p := c.QueryParam("limit"); p != "" { 274 + var err error 275 + limit, err = strconv.Atoi(p) 276 + if err != nil { 277 + return err 278 + } 279 + } else { 280 + limit = 50 281 } 282 + uri := c.QueryParam("uri") 283 + var out *appbskytypes.FeedGetVotes_Output 284 var handleErr error 285 + // func (s *Server) handleAppBskyFeedGetVotes(ctx context.Context,before string,cid string,direction string,limit int,uri string) (*appbskytypes.FeedGetVotes_Output, error) 286 + out, handleErr = s.handleAppBskyFeedGetVotes(ctx, before, cid, direction, limit, uri) 287 if handleErr != nil { 288 return handleErr 289 } 290 return c.JSON(200, out) 291 } 292 293 + func (s *Server) HandleAppBskyFeedSetVote(c echo.Context) error { 294 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedSetVote") 295 defer span.End() 296 297 + var body appbskytypes.FeedSetVote_Input 298 if err := c.Bind(&body); err != nil { 299 return err 300 } 301 + var out *appbskytypes.FeedSetVote_Output 302 var handleErr error 303 + // func (s *Server) handleAppBskyFeedSetVote(ctx context.Context,body appbskytypes.FeedSetVote_Input) (*appbskytypes.FeedSetVote_Output, error) 304 + out, handleErr = s.handleAppBskyFeedSetVote(ctx, &body) 305 if handleErr != nil { 306 return handleErr 307 } 308 return c.JSON(200, out) 309 } 310 311 + func (s *Server) HandleAppBskyGraphGetAssertions(c echo.Context) error { 312 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetAssertions") 313 defer span.End() 314 + assertion := c.QueryParam("assertion") 315 + author := c.QueryParam("author") 316 + before := c.QueryParam("before") 317 + var out *appbskytypes.GraphGetAssertions_Output 318 var handleErr error 319 + // func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context,assertion string,author string,before string) (*appbskytypes.GraphGetAssertions_Output, error) 320 + out, handleErr = s.handleAppBskyGraphGetAssertions(ctx, assertion, author, before) 321 if handleErr != nil { 322 return handleErr 323 } 324 return c.JSON(200, out) 325 } 326 327 + func (s *Server) HandleAppBskyGraphGetFollowers(c echo.Context) error { 328 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetFollowers") 329 defer span.End() 330 + before := c.QueryParam("before") 331 332 + var limit int 333 + if p := c.QueryParam("limit"); p != "" { 334 + var err error 335 + limit, err = strconv.Atoi(p) 336 + if err != nil { 337 + return err 338 + } 339 + } else { 340 + limit = 50 341 } 342 + user := c.QueryParam("user") 343 + var out *appbskytypes.GraphGetFollowers_Output 344 var handleErr error 345 + // func (s *Server) handleAppBskyGraphGetFollowers(ctx context.Context,before string,limit int,user string) (*appbskytypes.GraphGetFollowers_Output, error) 346 + out, handleErr = s.handleAppBskyGraphGetFollowers(ctx, before, limit, user) 347 if handleErr != nil { 348 return handleErr 349 } 350 return c.JSON(200, out) 351 } 352 353 + func (s *Server) HandleAppBskyGraphGetFollows(c echo.Context) error { 354 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetFollows") 355 defer span.End() 356 + before := c.QueryParam("before") 357 + 358 + var limit int 359 + if p := c.QueryParam("limit"); p != "" { 360 + var err error 361 + limit, err = strconv.Atoi(p) 362 + if err != nil { 363 + return err 364 + } 365 + } else { 366 + limit = 50 367 + } 368 + user := c.QueryParam("user") 369 + var out *appbskytypes.GraphGetFollows_Output 370 var handleErr error 371 + // func (s *Server) handleAppBskyGraphGetFollows(ctx context.Context,before string,limit int,user string) (*appbskytypes.GraphGetFollows_Output, error) 372 + out, handleErr = s.handleAppBskyGraphGetFollows(ctx, before, limit, user) 373 if handleErr != nil { 374 return handleErr 375 } 376 + return c.JSON(200, out) 377 } 378 379 + func (s *Server) HandleAppBskyGraphGetMembers(c echo.Context) error { 380 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetMembers") 381 defer span.End() 382 + actor := c.QueryParam("actor") 383 + before := c.QueryParam("before") 384 + 385 + var limit int 386 + if p := c.QueryParam("limit"); p != "" { 387 + var err error 388 + limit, err = strconv.Atoi(p) 389 + if err != nil { 390 + return err 391 + } 392 + } else { 393 + limit = 50 394 + } 395 + var out *appbskytypes.GraphGetMembers_Output 396 var handleErr error 397 + // func (s *Server) handleAppBskyGraphGetMembers(ctx context.Context,actor string,before string,limit int) (*appbskytypes.GraphGetMembers_Output, error) 398 + out, handleErr = s.handleAppBskyGraphGetMembers(ctx, actor, before, limit) 399 if handleErr != nil { 400 return handleErr 401 } 402 return c.JSON(200, out) 403 } 404 405 + func (s *Server) HandleAppBskyGraphGetMemberships(c echo.Context) error { 406 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetMemberships") 407 defer span.End() 408 + actor := c.QueryParam("actor") 409 + before := c.QueryParam("before") 410 + 411 + var limit int 412 + if p := c.QueryParam("limit"); p != "" { 413 + var err error 414 + limit, err = strconv.Atoi(p) 415 + if err != nil { 416 + return err 417 + } 418 + } else { 419 + limit = 50 420 + } 421 + var out *appbskytypes.GraphGetMemberships_Output 422 var handleErr error 423 + // func (s *Server) handleAppBskyGraphGetMemberships(ctx context.Context,actor string,before string,limit int) (*appbskytypes.GraphGetMemberships_Output, error) 424 + out, handleErr = s.handleAppBskyGraphGetMemberships(ctx, actor, before, limit) 425 if handleErr != nil { 426 return handleErr 427 } 428 return c.JSON(200, out) 429 } 430 431 + func (s *Server) HandleAppBskyNotificationGetCount(c echo.Context) error { 432 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationGetCount") 433 defer span.End() 434 + var out *appbskytypes.NotificationGetCount_Output 435 var handleErr error 436 + // func (s *Server) handleAppBskyNotificationGetCount(ctx context.Context) (*appbskytypes.NotificationGetCount_Output, error) 437 + out, handleErr = s.handleAppBskyNotificationGetCount(ctx) 438 if handleErr != nil { 439 return handleErr 440 } 441 return c.JSON(200, out) 442 } 443 444 + func (s *Server) HandleAppBskyNotificationList(c echo.Context) error { 445 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationList") 446 defer span.End() 447 + before := c.QueryParam("before") 448 + 449 + var limit int 450 + if p := c.QueryParam("limit"); p != "" { 451 + var err error 452 + limit, err = strconv.Atoi(p) 453 + if err != nil { 454 + return err 455 + } 456 + } else { 457 + limit = 50 458 + } 459 + var out *appbskytypes.NotificationList_Output 460 var handleErr error 461 + // func (s *Server) handleAppBskyNotificationList(ctx context.Context,before string,limit int) (*appbskytypes.NotificationList_Output, error) 462 + out, handleErr = s.handleAppBskyNotificationList(ctx, before, limit) 463 if handleErr != nil { 464 return handleErr 465 } 466 return c.JSON(200, out) 467 } 468 469 + func (s *Server) HandleAppBskyNotificationUpdateSeen(c echo.Context) error { 470 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyNotificationUpdateSeen") 471 defer span.End() 472 + 473 + var body appbskytypes.NotificationUpdateSeen_Input 474 + if err := c.Bind(&body); err != nil { 475 + return err 476 + } 477 var handleErr error 478 + // func (s *Server) handleAppBskyNotificationUpdateSeen(ctx context.Context,body appbskytypes.NotificationUpdateSeen_Input) error 479 + handleErr = s.handleAppBskyNotificationUpdateSeen(ctx, &body) 480 if handleErr != nil { 481 return handleErr 482 } 483 return nil 484 } 485 486 + func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { 487 + e.POST("/xrpc/com.atproto.account.create", s.HandleComAtprotoAccountCreate) 488 + e.POST("/xrpc/com.atproto.account.createInviteCode", s.HandleComAtprotoAccountCreateInviteCode) 489 + e.POST("/xrpc/com.atproto.account.delete", s.HandleComAtprotoAccountDelete) 490 + e.GET("/xrpc/com.atproto.account.get", s.HandleComAtprotoAccountGet) 491 + e.POST("/xrpc/com.atproto.account.requestPasswordReset", s.HandleComAtprotoAccountRequestPasswordReset) 492 + e.POST("/xrpc/com.atproto.account.resetPassword", s.HandleComAtprotoAccountResetPassword) 493 + e.GET("/xrpc/com.atproto.handle.resolve", s.HandleComAtprotoHandleResolve) 494 + e.POST("/xrpc/com.atproto.repo.batchWrite", s.HandleComAtprotoRepoBatchWrite) 495 + e.POST("/xrpc/com.atproto.repo.createRecord", s.HandleComAtprotoRepoCreateRecord) 496 + e.POST("/xrpc/com.atproto.repo.deleteRecord", s.HandleComAtprotoRepoDeleteRecord) 497 + e.GET("/xrpc/com.atproto.repo.describe", s.HandleComAtprotoRepoDescribe) 498 + e.GET("/xrpc/com.atproto.repo.getRecord", s.HandleComAtprotoRepoGetRecord) 499 + e.GET("/xrpc/com.atproto.repo.listRecords", s.HandleComAtprotoRepoListRecords) 500 + e.POST("/xrpc/com.atproto.repo.putRecord", s.HandleComAtprotoRepoPutRecord) 501 + e.GET("/xrpc/com.atproto.server.getAccountsConfig", s.HandleComAtprotoServerGetAccountsConfig) 502 + e.POST("/xrpc/com.atproto.session.create", s.HandleComAtprotoSessionCreate) 503 + e.POST("/xrpc/com.atproto.session.delete", s.HandleComAtprotoSessionDelete) 504 + e.GET("/xrpc/com.atproto.session.get", s.HandleComAtprotoSessionGet) 505 + e.POST("/xrpc/com.atproto.session.refresh", s.HandleComAtprotoSessionRefresh) 506 + e.GET("/xrpc/com.atproto.sync.getRepo", s.HandleComAtprotoSyncGetRepo) 507 + e.GET("/xrpc/com.atproto.sync.getRoot", s.HandleComAtprotoSyncGetRoot) 508 + e.POST("/xrpc/com.atproto.sync.updateRepo", s.HandleComAtprotoSyncUpdateRepo) 509 return nil 510 } 511 512 + func (s *Server) HandleComAtprotoAccountCreate(c echo.Context) error { 513 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountCreate") 514 defer span.End() 515 516 + var body comatprototypes.AccountCreate_Input 517 if err := c.Bind(&body); err != nil { 518 return err 519 } 520 + var out *comatprototypes.AccountCreate_Output 521 var handleErr error 522 + // func (s *Server) handleComAtprotoAccountCreate(ctx context.Context,body comatprototypes.AccountCreate_Input) (*comatprototypes.AccountCreate_Output, error) 523 + out, handleErr = s.handleComAtprotoAccountCreate(ctx, &body) 524 if handleErr != nil { 525 return handleErr 526 } 527 return c.JSON(200, out) 528 } 529 530 + func (s *Server) HandleComAtprotoAccountCreateInviteCode(c echo.Context) error { 531 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountCreateInviteCode") 532 defer span.End() 533 + 534 + var body comatprototypes.AccountCreateInviteCode_Input 535 + if err := c.Bind(&body); err != nil { 536 + return err 537 + } 538 + var out *comatprototypes.AccountCreateInviteCode_Output 539 var handleErr error 540 + // func (s *Server) handleComAtprotoAccountCreateInviteCode(ctx context.Context,body comatprototypes.AccountCreateInviteCode_Input) (*comatprototypes.AccountCreateInviteCode_Output, error) 541 + out, handleErr = s.handleComAtprotoAccountCreateInviteCode(ctx, &body) 542 if handleErr != nil { 543 return handleErr 544 } 545 return c.JSON(200, out) 546 } 547 548 + func (s *Server) HandleComAtprotoAccountDelete(c echo.Context) error { 549 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountDelete") 550 defer span.End() 551 + var handleErr error 552 + // func (s *Server) handleComAtprotoAccountDelete(ctx context.Context) error 553 + handleErr = s.handleComAtprotoAccountDelete(ctx) 554 + if handleErr != nil { 555 + return handleErr 556 + } 557 + return nil 558 + } 559 560 + func (s *Server) HandleComAtprotoAccountGet(c echo.Context) error { 561 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountGet") 562 + defer span.End() 563 var handleErr error 564 + // func (s *Server) handleComAtprotoAccountGet(ctx context.Context) error 565 + handleErr = s.handleComAtprotoAccountGet(ctx) 566 if handleErr != nil { 567 return handleErr 568 } 569 + return nil 570 } 571 572 + func (s *Server) HandleComAtprotoAccountRequestPasswordReset(c echo.Context) error { 573 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountRequestPasswordReset") 574 defer span.End() 575 576 + var body comatprototypes.AccountRequestPasswordReset_Input 577 + if err := c.Bind(&body); err != nil { 578 return err 579 } 580 var handleErr error 581 + // func (s *Server) handleComAtprotoAccountRequestPasswordReset(ctx context.Context,body comatprototypes.AccountRequestPasswordReset_Input) error 582 + handleErr = s.handleComAtprotoAccountRequestPasswordReset(ctx, &body) 583 if handleErr != nil { 584 return handleErr 585 } 586 + return nil 587 } 588 589 + func (s *Server) HandleComAtprotoAccountResetPassword(c echo.Context) error { 590 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAccountResetPassword") 591 defer span.End() 592 593 + var body comatprototypes.AccountResetPassword_Input 594 + if err := c.Bind(&body); err != nil { 595 return err 596 } 597 + var handleErr error 598 + // func (s *Server) handleComAtprotoAccountResetPassword(ctx context.Context,body comatprototypes.AccountResetPassword_Input) error 599 + handleErr = s.handleComAtprotoAccountResetPassword(ctx, &body) 600 + if handleErr != nil { 601 + return handleErr 602 + } 603 + return nil 604 + } 605 + 606 + func (s *Server) HandleComAtprotoHandleResolve(c echo.Context) error { 607 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoHandleResolve") 608 + defer span.End() 609 + handle := c.QueryParam("handle") 610 + var out *comatprototypes.HandleResolve_Output 611 var handleErr error 612 + // func (s *Server) handleComAtprotoHandleResolve(ctx context.Context,handle string) (*comatprototypes.HandleResolve_Output, error) 613 + out, handleErr = s.handleComAtprotoHandleResolve(ctx, handle) 614 if handleErr != nil { 615 return handleErr 616 } 617 return c.JSON(200, out) 618 } 619 620 + func (s *Server) HandleComAtprotoRepoBatchWrite(c echo.Context) error { 621 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoBatchWrite") 622 defer span.End() 623 624 + var body comatprototypes.RepoBatchWrite_Input 625 if err := c.Bind(&body); err != nil { 626 return err 627 } 628 var handleErr error 629 + // func (s *Server) handleComAtprotoRepoBatchWrite(ctx context.Context,body comatprototypes.RepoBatchWrite_Input) error 630 + handleErr = s.handleComAtprotoRepoBatchWrite(ctx, &body) 631 if handleErr != nil { 632 return handleErr 633 } 634 + return nil 635 } 636 637 + func (s *Server) HandleComAtprotoRepoCreateRecord(c echo.Context) error { 638 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoCreateRecord") 639 defer span.End() 640 641 + var body comatprototypes.RepoCreateRecord_Input 642 + if err := c.Bind(&body); err != nil { 643 return err 644 } 645 + var out *comatprototypes.RepoCreateRecord_Output 646 var handleErr error 647 + // func (s *Server) handleComAtprotoRepoCreateRecord(ctx context.Context,body comatprototypes.RepoCreateRecord_Input) (*comatprototypes.RepoCreateRecord_Output, error) 648 + out, handleErr = s.handleComAtprotoRepoCreateRecord(ctx, &body) 649 if handleErr != nil { 650 return handleErr 651 } 652 return c.JSON(200, out) 653 } 654 655 + func (s *Server) HandleComAtprotoRepoDeleteRecord(c echo.Context) error { 656 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDeleteRecord") 657 defer span.End() 658 659 + var body comatprototypes.RepoDeleteRecord_Input 660 + if err := c.Bind(&body); err != nil { 661 return err 662 } 663 var handleErr error 664 + // func (s *Server) handleComAtprotoRepoDeleteRecord(ctx context.Context,body comatprototypes.RepoDeleteRecord_Input) error 665 + handleErr = s.handleComAtprotoRepoDeleteRecord(ctx, &body) 666 if handleErr != nil { 667 return handleErr 668 } 669 + return nil 670 } 671 672 + func (s *Server) HandleComAtprotoRepoDescribe(c echo.Context) error { 673 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoDescribe") 674 defer span.End() 675 + user := c.QueryParam("user") 676 + var out *comatprototypes.RepoDescribe_Output 677 var handleErr error 678 + // func (s *Server) handleComAtprotoRepoDescribe(ctx context.Context,user string) (*comatprototypes.RepoDescribe_Output, error) 679 + out, handleErr = s.handleComAtprotoRepoDescribe(ctx, user) 680 if handleErr != nil { 681 return handleErr 682 } 683 return c.JSON(200, out) 684 } 685 686 + func (s *Server) HandleComAtprotoRepoGetRecord(c echo.Context) error { 687 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoGetRecord") 688 defer span.End() 689 + cid := c.QueryParam("cid") 690 + collection := c.QueryParam("collection") 691 + rkey := c.QueryParam("rkey") 692 + user := c.QueryParam("user") 693 + var out *comatprototypes.RepoGetRecord_Output 694 var handleErr error 695 + // func (s *Server) handleComAtprotoRepoGetRecord(ctx context.Context,cid string,collection string,rkey string,user string) (*comatprototypes.RepoGetRecord_Output, error) 696 + out, handleErr = s.handleComAtprotoRepoGetRecord(ctx, cid, collection, rkey, user) 697 if handleErr != nil { 698 return handleErr 699 } 700 return c.JSON(200, out) 701 } 702 703 + func (s *Server) HandleComAtprotoRepoListRecords(c echo.Context) error { 704 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoListRecords") 705 defer span.End() 706 + after := c.QueryParam("after") 707 before := c.QueryParam("before") 708 + collection := c.QueryParam("collection") 709 710 + var limit int 711 + if p := c.QueryParam("limit"); p != "" { 712 + var err error 713 + limit, err = strconv.Atoi(p) 714 + if err != nil { 715 + return err 716 + } 717 + } else { 718 + limit = 50 719 } 720 + var out *comatprototypes.RepoListRecords_Output 721 var handleErr error 722 + // func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context,after string,before string,collection string,limit int) (*comatprototypes.RepoListRecords_Output, error) 723 + out, handleErr = s.handleComAtprotoRepoListRecords(ctx, after, before, collection, limit) 724 if handleErr != nil { 725 return handleErr 726 } 727 return c.JSON(200, out) 728 } 729 730 + func (s *Server) HandleComAtprotoRepoPutRecord(c echo.Context) error { 731 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoPutRecord") 732 defer span.End() 733 734 + var body comatprototypes.RepoPutRecord_Input 735 if err := c.Bind(&body); err != nil { 736 return err 737 } 738 + var out *comatprototypes.RepoPutRecord_Output 739 var handleErr error 740 + // func (s *Server) handleComAtprotoRepoPutRecord(ctx context.Context,body comatprototypes.RepoPutRecord_Input) (*comatprototypes.RepoPutRecord_Output, error) 741 + out, handleErr = s.handleComAtprotoRepoPutRecord(ctx, &body) 742 if handleErr != nil { 743 return handleErr 744 } 745 return c.JSON(200, out) 746 } 747 748 + func (s *Server) HandleComAtprotoServerGetAccountsConfig(c echo.Context) error { 749 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerGetAccountsConfig") 750 defer span.End() 751 + var out *comatprototypes.ServerGetAccountsConfig_Output 752 var handleErr error 753 + // func (s *Server) handleComAtprotoServerGetAccountsConfig(ctx context.Context) (*comatprototypes.ServerGetAccountsConfig_Output, error) 754 + out, handleErr = s.handleComAtprotoServerGetAccountsConfig(ctx) 755 if handleErr != nil { 756 return handleErr 757 } 758 return c.JSON(200, out) 759 } 760 761 + func (s *Server) HandleComAtprotoSessionCreate(c echo.Context) error { 762 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionCreate") 763 defer span.End() 764 765 + var body comatprototypes.SessionCreate_Input 766 + if err := c.Bind(&body); err != nil { 767 return err 768 } 769 + var out *comatprototypes.SessionCreate_Output 770 var handleErr error 771 + // func (s *Server) handleComAtprotoSessionCreate(ctx context.Context,body comatprototypes.SessionCreate_Input) (*comatprototypes.SessionCreate_Output, error) 772 + out, handleErr = s.handleComAtprotoSessionCreate(ctx, &body) 773 if handleErr != nil { 774 return handleErr 775 } 776 return c.JSON(200, out) 777 } 778 779 + func (s *Server) HandleComAtprotoSessionDelete(c echo.Context) error { 780 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionDelete") 781 defer span.End() 782 var handleErr error 783 + // func (s *Server) handleComAtprotoSessionDelete(ctx context.Context) error 784 + handleErr = s.handleComAtprotoSessionDelete(ctx) 785 if handleErr != nil { 786 return handleErr 787 } 788 + return nil 789 } 790 791 + func (s *Server) HandleComAtprotoSessionGet(c echo.Context) error { 792 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionGet") 793 defer span.End() 794 + var out *comatprototypes.SessionGet_Output 795 var handleErr error 796 + // func (s *Server) handleComAtprotoSessionGet(ctx context.Context) (*comatprototypes.SessionGet_Output, error) 797 + out, handleErr = s.handleComAtprotoSessionGet(ctx) 798 if handleErr != nil { 799 return handleErr 800 } 801 return c.JSON(200, out) 802 } 803 804 + func (s *Server) HandleComAtprotoSessionRefresh(c echo.Context) error { 805 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSessionRefresh") 806 defer span.End() 807 + var out *comatprototypes.SessionRefresh_Output 808 var handleErr error 809 + // func (s *Server) handleComAtprotoSessionRefresh(ctx context.Context) (*comatprototypes.SessionRefresh_Output, error) 810 + out, handleErr = s.handleComAtprotoSessionRefresh(ctx) 811 if handleErr != nil { 812 return handleErr 813 } 814 return c.JSON(200, out) 815 } 816 817 + func (s *Server) HandleComAtprotoSyncGetRepo(c echo.Context) error { 818 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetRepo") 819 defer span.End() 820 + did := c.QueryParam("did") 821 + from := c.QueryParam("from") 822 + var out io.Reader 823 var handleErr error 824 + // func (s *Server) handleComAtprotoSyncGetRepo(ctx context.Context,did string,from string) (io.Reader, error) 825 + out, handleErr = s.handleComAtprotoSyncGetRepo(ctx, did, from) 826 if handleErr != nil { 827 return handleErr 828 } 829 return c.JSON(200, out) 830 } 831 832 + func (s *Server) HandleComAtprotoSyncGetRoot(c echo.Context) error { 833 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetRoot") 834 defer span.End() 835 + did := c.QueryParam("did") 836 + var out *comatprototypes.SyncGetRoot_Output 837 var handleErr error 838 + // func (s *Server) handleComAtprotoSyncGetRoot(ctx context.Context,did string) (*comatprototypes.SyncGetRoot_Output, error) 839 + out, handleErr = s.handleComAtprotoSyncGetRoot(ctx, did) 840 if handleErr != nil { 841 return handleErr 842 } 843 return c.JSON(200, out) 844 } 845 846 + func (s *Server) HandleComAtprotoSyncUpdateRepo(c echo.Context) error { 847 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncUpdateRepo") 848 defer span.End() 849 + body := c.Request().Body 850 var handleErr error 851 + // func (s *Server) handleComAtprotoSyncUpdateRepo(ctx context.Context,r io.Reader) error 852 + handleErr = s.handleComAtprotoSyncUpdateRepo(ctx, body) 853 if handleErr != nil { 854 return handleErr 855 }
+26
docs/auth.md
···
··· 1 + # Auth 2 + 3 + The auth system uses two tokens, an access token and a refresh token. 4 + 5 + The access token is a jwt with the following values: 6 + ``` 7 + scope: "com.atproto.access" 8 + sub: <the users DID> 9 + iat: the current time, in unix epoch seconds 10 + exp: the expiry date, usually around an hour, but at least 15 minutes 11 + ``` 12 + 13 + The refresh token is a jwt with the following values: 14 + ``` 15 + scope: "com.atproto.refresh" 16 + sub: <the users DID> 17 + iat: the current time, in unix epoch seconds 18 + exp: the expiry date, usually around a week, must be significantly longer than the access token 19 + jti: a unique identifier for this token 20 + ``` 21 + 22 + The access token is what is used for all requests, however since it expires 23 + quickly, it must be refreshed periodically using the refresh token. 24 + When the refresh token is used, it must be marked as deleted, and the new token then replaces it. 25 + Note: The old access token is not necessarily disabled at that point of refreshing. 26 +
+54 -25
lex/gen.go
··· 67 Const any `json:"const"` 68 Enum []string `json:"enum"` 69 Closed bool `json:"closed"` 70 } 71 72 func (s *Schema) Name() string { ··· 254 255 if t.Type.record && !strings.Contains(t.Name, "_") { 256 id := t.Type.id 257 - if t.Type.defName != "" { 258 - id = id + "#" + t.Type.defName 259 - } 260 fmt.Fprintf(w, "util.RegisterType(%q, %s{})\n", id, t.Name) 261 } 262 } ··· 631 func (s *TypeSchema) WriteHandlerStub(w io.Writer, fname, shortname, impname string) error { 632 paramtypes := []string{"ctx context.Context"} 633 if s.Type == "query" { 634 if s.Parameters != nil { 635 orderedMapIter[TypeSchema](s.Parameters.Properties, func(k string, t TypeSchema) error { 636 switch t.Type { 637 case "string": 638 paramtypes = append(paramtypes, k+" string") 639 case "integer": 640 - paramtypes = append(paramtypes, k+" int") 641 case "number": 642 return fmt.Errorf("non-integer numbers currently unsupported") 643 default: ··· 683 fmt.Fprintf(w, "ctx, span := otel.Tracer(\"server\").Start(c.Request().Context(), %q)\n", "Handle"+fname) 684 fmt.Fprintf(w, "defer span.End()\n") 685 686 - var required map[string]bool 687 - if s.Required != nil { 688 - for _, r := range s.Required { 689 - required[r] = true 690 - } 691 - } 692 - 693 paramtypes := []string{"ctx context.Context"} 694 params := []string{"ctx"} 695 if s.Type == "query" { 696 if s.Parameters != nil { 697 orderedMapIter[TypeSchema](s.Parameters.Properties, func(k string, t TypeSchema) error { 698 switch t.Type { 699 case "string": ··· 703 case "integer": 704 params = append(params, k) 705 706 - if required != nil && !required[k] { 707 - paramtypes = append(paramtypes, k+" *int") 708 - fmt.Fprintf(w, ` 709 var %s *int 710 if p := c.QueryParam("%s"); p != "" { 711 - %s_val, err := strconv.Atoi(p) 712 if err != nil { 713 return err 714 } 715 - %s = &%s_val 716 } 717 - `, k, k, k, k, k) 718 } else { 719 - paramtypes = append(paramtypes, k+" int") 720 - fmt.Fprintf(w, ` 721 %s, err := strconv.Atoi(c.QueryParam("%s")) 722 if err != nil { 723 return err 724 } 725 `, k, k) 726 } 727 - 728 729 case "number": 730 return fmt.Errorf("non-integer numbers currently unsupported") ··· 918 fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type\" cborgen:\"$type,const=%s\"`\n", ts.id) 919 } 920 921 - var required map[string]bool 922 - if ts.Required != nil { 923 - required = make(map[string]bool) 924 for _, req := range ts.Required { 925 required[req] = true 926 } 927 - } 928 929 for k, v := range ts.Properties { 930 goname := strings.Title(k) ··· 935 } 936 937 var ptr string 938 - if required != nil && !required[k] { 939 if !strings.HasPrefix(tname, "*") && !strings.HasPrefix(tname, "[]") { 940 ptr = "*" 941 }
··· 67 Const any `json:"const"` 68 Enum []string `json:"enum"` 69 Closed bool `json:"closed"` 70 + 71 + Default any `json:"default"` 72 + Minimum any `json:"minimum"` 73 + Maximum any `json:"maximum"` 74 } 75 76 func (s *Schema) Name() string { ··· 258 259 if t.Type.record && !strings.Contains(t.Name, "_") { 260 id := t.Type.id 261 + if t.Type.defName != "" { 262 + id = id + "#" + t.Type.defName 263 + } 264 fmt.Fprintf(w, "util.RegisterType(%q, %s{})\n", id, t.Name) 265 } 266 } ··· 635 func (s *TypeSchema) WriteHandlerStub(w io.Writer, fname, shortname, impname string) error { 636 paramtypes := []string{"ctx context.Context"} 637 if s.Type == "query" { 638 + 639 if s.Parameters != nil { 640 + var required map[string]bool 641 + if s.Parameters.Required != nil { 642 + required = make(map[string]bool) 643 + for _, r := range s.Required { 644 + required[r] = true 645 + } 646 + } 647 orderedMapIter[TypeSchema](s.Parameters.Properties, func(k string, t TypeSchema) error { 648 switch t.Type { 649 case "string": 650 paramtypes = append(paramtypes, k+" string") 651 case "integer": 652 + if required != nil && !required[k] { 653 + paramtypes = append(paramtypes, k+" *int") 654 + } else { 655 + paramtypes = append(paramtypes, k+" int") 656 + } 657 case "number": 658 return fmt.Errorf("non-integer numbers currently unsupported") 659 default: ··· 699 fmt.Fprintf(w, "ctx, span := otel.Tracer(\"server\").Start(c.Request().Context(), %q)\n", "Handle"+fname) 700 fmt.Fprintf(w, "defer span.End()\n") 701 702 paramtypes := []string{"ctx context.Context"} 703 params := []string{"ctx"} 704 if s.Type == "query" { 705 if s.Parameters != nil { 706 + required := make(map[string]bool) 707 + for _, r := range s.Parameters.Required { 708 + required[r] = true 709 + } 710 + for k, v := range s.Parameters.Properties { 711 + if v.Default != nil { 712 + required[k] = true 713 + } 714 + } 715 orderedMapIter[TypeSchema](s.Parameters.Properties, func(k string, t TypeSchema) error { 716 switch t.Type { 717 case "string": ··· 721 case "integer": 722 params = append(params, k) 723 724 + if !required[k] { 725 + paramtypes = append(paramtypes, k+" *int") 726 + fmt.Fprintf(w, ` 727 var %s *int 728 if p := c.QueryParam("%s"); p != "" { 729 + %s_val, err := strconv.Atoi(p) 730 + if err != nil { 731 + return err 732 + } 733 + %s = &%s_val 734 + } 735 + `, k, k, k, k, k) 736 + } else if t.Default != nil { 737 + paramtypes = append(paramtypes, k+" int") 738 + fmt.Fprintf(w, ` 739 + var %s int 740 + if p := c.QueryParam("%s"); p != "" { 741 + var err error 742 + %s, err = strconv.Atoi(p) 743 if err != nil { 744 return err 745 } 746 + } else { 747 + %s = %d 748 } 749 + `, k, k,k, k, int(t.Default.(float64))) 750 } else { 751 + 752 + paramtypes = append(paramtypes, k+" int") 753 + fmt.Fprintf(w, ` 754 %s, err := strconv.Atoi(c.QueryParam("%s")) 755 if err != nil { 756 return err 757 } 758 `, k, k) 759 } 760 761 case "number": 762 return fmt.Errorf("non-integer numbers currently unsupported") ··· 950 fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type\" cborgen:\"$type,const=%s\"`\n", ts.id) 951 } 952 953 + required := make(map[string]bool) 954 for _, req := range ts.Required { 955 required[req] = true 956 } 957 958 for k, v := range ts.Properties { 959 goname := strings.Title(k) ··· 964 } 965 966 var ptr string 967 + if !required[k] { 968 if !strings.HasPrefix(tname, "*") && !strings.HasPrefix(tname, "[]") { 969 ptr = "*" 970 }
+115
lex/util/cbor_gen.go
···
··· 1 + // Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT. 2 + 3 + package util 4 + 5 + import ( 6 + "fmt" 7 + "io" 8 + "math" 9 + "sort" 10 + 11 + cid "github.com/ipfs/go-cid" 12 + cbg "github.com/whyrusleeping/cbor-gen" 13 + xerrors "golang.org/x/xerrors" 14 + ) 15 + 16 + var _ = xerrors.Errorf 17 + var _ = cid.Undef 18 + var _ = math.E 19 + var _ = sort.Sort 20 + 21 + func (t *CborChecker) MarshalCBOR(w io.Writer) error { 22 + if t == nil { 23 + _, err := w.Write(cbg.CborNull) 24 + return err 25 + } 26 + 27 + cw := cbg.NewCborWriter(w) 28 + 29 + if _, err := cw.Write([]byte{161}); err != nil { 30 + return err 31 + } 32 + 33 + // t.Type (string) (string) 34 + if len("$type") > cbg.MaxLength { 35 + return xerrors.Errorf("Value in field \"$type\" was too long") 36 + } 37 + 38 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 39 + return err 40 + } 41 + if _, err := io.WriteString(w, string("$type")); err != nil { 42 + return err 43 + } 44 + 45 + if len(t.Type) > cbg.MaxLength { 46 + return xerrors.Errorf("Value in field t.Type was too long") 47 + } 48 + 49 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Type))); err != nil { 50 + return err 51 + } 52 + if _, err := io.WriteString(w, string(t.Type)); err != nil { 53 + return err 54 + } 55 + return nil 56 + } 57 + 58 + func (t *CborChecker) UnmarshalCBOR(r io.Reader) (err error) { 59 + *t = CborChecker{} 60 + 61 + cr := cbg.NewCborReader(r) 62 + 63 + maj, extra, err := cr.ReadHeader() 64 + if err != nil { 65 + return err 66 + } 67 + defer func() { 68 + if err == io.EOF { 69 + err = io.ErrUnexpectedEOF 70 + } 71 + }() 72 + 73 + if maj != cbg.MajMap { 74 + return fmt.Errorf("cbor input should be of type map") 75 + } 76 + 77 + if extra > cbg.MaxLength { 78 + return fmt.Errorf("CborChecker: map struct too large (%d)", extra) 79 + } 80 + 81 + var name string 82 + n := extra 83 + 84 + for i := uint64(0); i < n; i++ { 85 + 86 + { 87 + sval, err := cbg.ReadString(cr) 88 + if err != nil { 89 + return err 90 + } 91 + 92 + name = string(sval) 93 + } 94 + 95 + switch name { 96 + // t.Type (string) (string) 97 + case "$type": 98 + 99 + { 100 + sval, err := cbg.ReadString(cr) 101 + if err != nil { 102 + return err 103 + } 104 + 105 + t.Type = string(sval) 106 + } 107 + 108 + default: 109 + // Field doesn't exist on this type, so ignore it 110 + cbg.ScanForLinks(r, func(cid.Cid) {}) 111 + } 112 + } 113 + 114 + return nil 115 + }
+78
lex/util/decoder.go
···
··· 1 + package util 2 + 3 + import ( 4 + "bytes" 5 + "encoding/json" 6 + "fmt" 7 + "reflect" 8 + 9 + cbg "github.com/whyrusleeping/cbor-gen" 10 + ) 11 + 12 + var lexTypesMap map[string]reflect.Type 13 + 14 + func init() { 15 + lexTypesMap = make(map[string]reflect.Type) 16 + } 17 + 18 + func RegisterType(id string, val any) { 19 + t := reflect.TypeOf(val) 20 + 21 + if t.Kind() == reflect.Pointer { 22 + t = t.Elem() 23 + } 24 + 25 + if _, ok := lexTypesMap[id]; ok { 26 + panic(fmt.Sprintf("already registered type for %q", id)) 27 + } 28 + 29 + lexTypesMap[id] = t 30 + } 31 + 32 + func JsonDecodeValue(b []byte) (any, error) { 33 + tstr, err := TypeExtract(b) 34 + if err != nil { 35 + return nil, err 36 + } 37 + 38 + t, ok := lexTypesMap[tstr] 39 + if !ok { 40 + return nil, fmt.Errorf("unrecognized type: %q", tstr) 41 + } 42 + 43 + val := reflect.New(t) 44 + 45 + ival := val.Interface() 46 + if err := json.Unmarshal(b, ival); err != nil { 47 + return nil, err 48 + } 49 + 50 + return ival, nil 51 + } 52 + 53 + func CborDecodeValue(b []byte) (any, error) { 54 + tstr, err := CborTypeExtract(b) 55 + if err != nil { 56 + return nil, err 57 + } 58 + 59 + t, ok := lexTypesMap[tstr] 60 + if !ok { 61 + return nil, fmt.Errorf("unrecognized type: %q", tstr) 62 + } 63 + 64 + val := reflect.New(t) 65 + 66 + ival, ok := val.Interface().(cbg.CBORUnmarshaler) 67 + if !ok { 68 + return nil, fmt.Errorf("registered type did not have proper cbor hooks") 69 + } 70 + 71 + if err := ival.UnmarshalCBOR(bytes.NewReader(b)); err != nil { 72 + return nil, err 73 + } 74 + 75 + fmt.Printf("DECODED VALUE: %#v\n", ival) 76 + 77 + return ival, nil 78 + }
+8 -6
repo/repo.go
··· 113 return r.bs 114 } 115 116 - func (r *Repo) CreateRecord(ctx context.Context, nsid string, rec CborMarshaler) (cid.Cid, error) { 117 r.dirty = true 118 t, err := r.getMst(ctx) 119 if err != nil { 120 - return cid.Undef, fmt.Errorf("failed to get mst: %w", err) 121 } 122 123 k, err := r.cst.Put(ctx, rec) 124 if err != nil { 125 - return cid.Undef, err 126 } 127 128 - nmst, err := t.Add(ctx, nsid+"/"+NextTID(), k, -1) 129 if err != nil { 130 - return cid.Undef, fmt.Errorf("mst.Add failed: %w", err) 131 } 132 133 r.mst = nmst 134 - return k, nil 135 } 136 137 func (r *Repo) Commit(ctx context.Context) (cid.Cid, error) {
··· 113 return r.bs 114 } 115 116 + func (r *Repo) CreateRecord(ctx context.Context, nsid string, rec CborMarshaler) (cid.Cid, string, error) { 117 r.dirty = true 118 t, err := r.getMst(ctx) 119 if err != nil { 120 + return cid.Undef, "", fmt.Errorf("failed to get mst: %w", err) 121 } 122 123 k, err := r.cst.Put(ctx, rec) 124 if err != nil { 125 + return cid.Undef, "", err 126 } 127 128 + tid := NextTID() 129 + 130 + nmst, err := t.Add(ctx, nsid+"/"+tid, k, -1) 131 if err != nil { 132 + return cid.Undef, "", fmt.Errorf("mst.Add failed: %w", err) 133 } 134 135 r.mst = nmst 136 + return k, tid, nil 137 } 138 139 func (r *Repo) Commit(ctx context.Context) (cid.Cid, error) {
+3 -5
repomgr/repomgr.go
··· 116 } 117 118 func (rm *RepoManager) CreateRecord(ctx context.Context, user uint, collection string, rec cbg.CBORMarshaler) (string, cid.Cid, error) { 119 - ntid := repo.NextTID() 120 - rkey := collection + "/" + ntid 121 122 unlock := rm.lockUser(user) 123 defer unlock() ··· 137 return "", cid.Undef, err 138 } 139 140 - cc, err := r.CreateRecord(ctx, rkey, rec) 141 if err != nil { 142 return "", cid.Undef, err 143 } ··· 163 OldRoot: head, 164 NewRoot: nroot, 165 Collection: collection, 166 - Rkey: rkey, 167 Record: rec, 168 RecCid: cc, 169 }) 170 } 171 172 - return rkey, cc, nil 173 } 174 175 func (rm *RepoManager) InitNewActor(ctx context.Context, user uint, handle, did, displayname string, declcid, actortype string) error {
··· 116 } 117 118 func (rm *RepoManager) CreateRecord(ctx context.Context, user uint, collection string, rec cbg.CBORMarshaler) (string, cid.Cid, error) { 119 120 unlock := rm.lockUser(user) 121 defer unlock() ··· 135 return "", cid.Undef, err 136 } 137 138 + cc, tid, err := r.CreateRecord(ctx, collection, rec) 139 if err != nil { 140 return "", cid.Undef, err 141 } ··· 161 OldRoot: head, 162 NewRoot: nroot, 163 Collection: collection, 164 + Rkey: tid, 165 Record: rec, 166 RecCid: cc, 167 }) 168 } 169 170 + return collection + "/" + tid, cc, nil 171 } 172 173 func (rm *RepoManager) InitNewActor(ctx context.Context, user uint, handle, did, displayname string, declcid, actortype string) error {