this repo has no description
0
fork

Configure Feed

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

Improve cbor type inclusion detection during codegen (#110)

Previously we werent detecting that the richtext facet features union
needed to have the special union cbor type encoding set on it. This was
because the 'walk' function we use to recursively set this field didnt
cross schema boundaries, and even if we did that shallowly, we could
have already processed the referenced schema and not actually passed the
flag down recursively. So now as a hack i'm just calling the walk-set
function twice. This is obviously bad, and I think we should just
rewrite the codegen code instead of trying to improve it, it was written
before several large lexicon refactors and its super messy as a result.

authored by

Whyrusleeping and committed by
GitHub
5fc31fb5 6567e300

+542 -1157
+28 -34
api/atproto/admindefs.go
··· 13 13 } 14 14 15 15 type AdminDefs_ActionReversal struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 18 - CreatedBy string `json:"createdBy" cborgen:"createdBy"` 19 - Reason string `json:"reason" cborgen:"reason"` 16 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 17 + CreatedBy string `json:"createdBy" cborgen:"createdBy"` 18 + Reason string `json:"reason" cborgen:"reason"` 20 19 } 21 20 22 21 type AdminDefs_ActionView struct { 23 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 24 22 Action *string `json:"action" cborgen:"action"` 25 23 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 26 24 CreatedBy string `json:"createdBy" cborgen:"createdBy"` ··· 33 31 } 34 32 35 33 type AdminDefs_ActionViewCurrent struct { 36 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 37 - Action *string `json:"action" cborgen:"action"` 38 - Id int64 `json:"id" cborgen:"id"` 34 + Action *string `json:"action" cborgen:"action"` 35 + Id int64 `json:"id" cborgen:"id"` 39 36 } 40 37 41 38 type AdminDefs_ActionViewDetail struct { 42 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 43 39 Action *string `json:"action" cborgen:"action"` 44 40 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 45 41 CreatedBy string `json:"createdBy" cborgen:"createdBy"` ··· 122 118 } 123 119 124 120 type AdminDefs_BlobView struct { 125 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 126 - Cid string `json:"cid" cborgen:"cid"` 127 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 128 - Details *AdminDefs_BlobView_Details `json:"details,omitempty" cborgen:"details,omitempty"` 129 - MimeType string `json:"mimeType" cborgen:"mimeType"` 130 - Moderation *AdminDefs_Moderation `json:"moderation,omitempty" cborgen:"moderation,omitempty"` 131 - Size int64 `json:"size" cborgen:"size"` 121 + Cid string `json:"cid" cborgen:"cid"` 122 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 123 + Details *AdminDefs_BlobView_Details `json:"details,omitempty" cborgen:"details,omitempty"` 124 + MimeType string `json:"mimeType" cborgen:"mimeType"` 125 + Moderation *AdminDefs_Moderation `json:"moderation,omitempty" cborgen:"moderation,omitempty"` 126 + Size int64 `json:"size" cborgen:"size"` 132 127 } 133 128 134 129 type AdminDefs_BlobView_Details struct { ··· 166 161 } 167 162 } 168 163 164 + // RECORDTYPE: AdminDefs_ImageDetails 169 165 type AdminDefs_ImageDetails struct { 170 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 166 + LexiconTypeID string `json:"$type,const=com.atproto.admin.defs" cborgen:"$type,const=com.atproto.admin.defs"` 171 167 Height int64 `json:"height" cborgen:"height"` 172 168 Width int64 `json:"width" cborgen:"width"` 173 169 } 174 170 175 171 type AdminDefs_Moderation struct { 176 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 177 172 CurrentAction *AdminDefs_ActionViewCurrent `json:"currentAction,omitempty" cborgen:"currentAction,omitempty"` 178 173 } 179 174 180 175 type AdminDefs_ModerationDetail struct { 181 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 182 176 Actions []*AdminDefs_ActionView `json:"actions" cborgen:"actions"` 183 177 CurrentAction *AdminDefs_ActionViewCurrent `json:"currentAction,omitempty" cborgen:"currentAction,omitempty"` 184 178 Reports []*AdminDefs_ReportView `json:"reports" cborgen:"reports"` 185 179 } 186 180 181 + // RECORDTYPE: AdminDefs_RecordView 187 182 type AdminDefs_RecordView struct { 188 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 183 + LexiconTypeID string `json:"$type,const=com.atproto.admin.defs" cborgen:"$type,const=com.atproto.admin.defs"` 189 184 BlobCids []string `json:"blobCids" cborgen:"blobCids"` 190 185 Cid string `json:"cid" cborgen:"cid"` 191 186 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` ··· 196 191 } 197 192 198 193 type AdminDefs_RecordViewDetail struct { 199 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 200 - Blobs []*AdminDefs_BlobView `json:"blobs" cborgen:"blobs"` 201 - Cid string `json:"cid" cborgen:"cid"` 202 - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 203 - Moderation *AdminDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` 204 - Repo *AdminDefs_RepoView `json:"repo" cborgen:"repo"` 205 - Uri string `json:"uri" cborgen:"uri"` 206 - Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 194 + Blobs []*AdminDefs_BlobView `json:"blobs" cborgen:"blobs"` 195 + Cid string `json:"cid" cborgen:"cid"` 196 + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 197 + Moderation *AdminDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` 198 + Repo *AdminDefs_RepoView `json:"repo" cborgen:"repo"` 199 + Uri string `json:"uri" cborgen:"uri"` 200 + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 207 201 } 208 202 203 + // RECORDTYPE: AdminDefs_RepoRef 209 204 type AdminDefs_RepoRef struct { 210 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 205 + LexiconTypeID string `json:"$type,const=com.atproto.admin.defs" cborgen:"$type,const=com.atproto.admin.defs"` 211 206 Did string `json:"did" cborgen:"did"` 212 207 } 213 208 209 + // RECORDTYPE: AdminDefs_RepoView 214 210 type AdminDefs_RepoView struct { 215 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 211 + LexiconTypeID string `json:"$type,const=com.atproto.admin.defs" cborgen:"$type,const=com.atproto.admin.defs"` 216 212 Did string `json:"did" cborgen:"did"` 217 213 Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 218 214 Handle string `json:"handle" cborgen:"handle"` ··· 222 218 } 223 219 224 220 type AdminDefs_RepoViewDetail struct { 225 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 226 221 Did string `json:"did" cborgen:"did"` 227 222 Email *string `json:"email,omitempty" cborgen:"email,omitempty"` 228 223 Handle string `json:"handle" cborgen:"handle"` ··· 232 227 } 233 228 234 229 type AdminDefs_ReportView struct { 235 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 236 230 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 237 231 Id int64 `json:"id" cborgen:"id"` 238 232 Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` ··· 243 237 } 244 238 245 239 type AdminDefs_ReportViewDetail struct { 246 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 247 240 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 248 241 Id int64 `json:"id" cborgen:"id"` 249 242 Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` ··· 323 316 } 324 317 } 325 318 319 + // RECORDTYPE: AdminDefs_VideoDetails 326 320 type AdminDefs_VideoDetails struct { 327 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 321 + LexiconTypeID string `json:"$type,const=com.atproto.admin.defs" cborgen:"$type,const=com.atproto.admin.defs"` 328 322 Height int64 `json:"height" cborgen:"height"` 329 323 Length int64 `json:"length" cborgen:"length"` 330 324 Width int64 `json:"width" cborgen:"width"`
+2 -3
api/atproto/admingetModerationActions.go
··· 12 12 } 13 13 14 14 type AdminGetModerationActions_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Actions []*AdminDefs_ActionView `json:"actions" cborgen:"actions"` 17 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 15 + Actions []*AdminDefs_ActionView `json:"actions" cborgen:"actions"` 16 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 18 17 } 19 18 20 19 func AdminGetModerationActions(ctx context.Context, c *xrpc.Client, cursor string, limit int64, subject string) (*AdminGetModerationActions_Output, error) {
+2 -3
api/atproto/admingetModerationReports.go
··· 12 12 } 13 13 14 14 type AdminGetModerationReports_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Reports []*AdminDefs_ReportView `json:"reports" cborgen:"reports"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Reports []*AdminDefs_ReportView `json:"reports" cborgen:"reports"` 18 17 } 19 18 20 19 func AdminGetModerationReports(ctx context.Context, c *xrpc.Client, cursor string, limit int64, resolved bool, subject string) (*AdminGetModerationReports_Output, error) {
+3 -4
api/atproto/adminresolveModerationReports.go
··· 12 12 } 13 13 14 14 type AdminResolveModerationReports_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - ActionId int64 `json:"actionId" cborgen:"actionId"` 17 - CreatedBy string `json:"createdBy" cborgen:"createdBy"` 18 - ReportIds []int64 `json:"reportIds" cborgen:"reportIds"` 15 + ActionId int64 `json:"actionId" cborgen:"actionId"` 16 + CreatedBy string `json:"createdBy" cborgen:"createdBy"` 17 + ReportIds []int64 `json:"reportIds" cborgen:"reportIds"` 19 18 } 20 19 21 20 func AdminResolveModerationReports(ctx context.Context, c *xrpc.Client, input *AdminResolveModerationReports_Input) (*AdminDefs_ActionView, error) {
+3 -4
api/atproto/adminreverseModerationAction.go
··· 12 12 } 13 13 14 14 type AdminReverseModerationAction_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - CreatedBy string `json:"createdBy" cborgen:"createdBy"` 17 - Id int64 `json:"id" cborgen:"id"` 18 - Reason string `json:"reason" cborgen:"reason"` 15 + CreatedBy string `json:"createdBy" cborgen:"createdBy"` 16 + Id int64 `json:"id" cborgen:"id"` 17 + Reason string `json:"reason" cborgen:"reason"` 19 18 } 20 19 21 20 func AdminReverseModerationAction(ctx context.Context, c *xrpc.Client, input *AdminReverseModerationAction_Input) (*AdminDefs_ActionView, error) {
+2 -3
api/atproto/adminsearchRepos.go
··· 12 12 } 13 13 14 14 type AdminSearchRepos_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Repos []*AdminDefs_RepoView `json:"repos" cborgen:"repos"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Repos []*AdminDefs_RepoView `json:"repos" cborgen:"repos"` 18 17 } 19 18 20 19 func AdminSearchRepos(ctx context.Context, c *xrpc.Client, cursor string, limit int64, term string) (*AdminSearchRepos_Output, error) {
-1
api/atproto/admintakeModerationAction.go
··· 15 15 } 16 16 17 17 type AdminTakeModerationAction_Input struct { 18 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 19 18 Action string `json:"action" cborgen:"action"` 20 19 CreatedBy string `json:"createdBy" cborgen:"createdBy"` 21 20 Reason string `json:"reason" cborgen:"reason"`
+8 -263
api/atproto/cbor_gen.go
··· 96 96 return err 97 97 } 98 98 99 - if len(t.LexiconTypeID) > cbg.MaxLength { 100 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 101 - } 102 - 103 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 99 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("com.atproto.repo.strongRef"))); err != nil { 104 100 return err 105 101 } 106 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 102 + if _, err := io.WriteString(w, string("com.atproto.repo.strongRef")); err != nil { 107 103 return err 108 104 } 109 105 } ··· 197 193 } 198 194 199 195 cw := cbg.NewCborWriter(w) 200 - fieldCount := 11 201 196 202 - if t.LexiconTypeID == "" { 203 - fieldCount-- 204 - } 205 - 206 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 197 + if _, err := cw.Write([]byte{170}); err != nil { 207 198 return err 208 199 } 209 200 ··· 316 307 return err 317 308 } 318 309 319 - // t.LexiconTypeID (string) (string) 320 - if t.LexiconTypeID != "" { 321 - 322 - if len("$type") > cbg.MaxLength { 323 - return xerrors.Errorf("Value in field \"$type\" was too long") 324 - } 325 - 326 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 327 - return err 328 - } 329 - if _, err := io.WriteString(w, string("$type")); err != nil { 330 - return err 331 - } 332 - 333 - if len(t.LexiconTypeID) > cbg.MaxLength { 334 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 335 - } 336 - 337 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 338 - return err 339 - } 340 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 341 - return err 342 - } 343 - } 344 - 345 310 // t.Blobs ([]util.LexLink) (slice) 346 311 if len("blobs") > cbg.MaxLength { 347 312 return xerrors.Errorf("Value in field \"blobs\" was too long") ··· 577 542 578 543 t.Time = string(sval) 579 544 } 580 - // t.LexiconTypeID (string) (string) 581 - case "$type": 582 - 583 - { 584 - sval, err := cbg.ReadString(cr) 585 - if err != nil { 586 - return err 587 - } 588 - 589 - t.LexiconTypeID = string(sval) 590 - } 591 545 // t.Blobs ([]util.LexLink) (slice) 592 546 case "blobs": 593 547 ··· 702 656 } 703 657 704 658 cw := cbg.NewCborWriter(w) 705 - fieldCount := 5 706 659 707 - if t.LexiconTypeID == "" { 708 - fieldCount-- 709 - } 710 - 711 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 660 + if _, err := cw.Write([]byte{164}); err != nil { 712 661 return err 713 662 } 714 663 ··· 780 729 return err 781 730 } 782 731 783 - // t.LexiconTypeID (string) (string) 784 - if t.LexiconTypeID != "" { 785 - 786 - if len("$type") > cbg.MaxLength { 787 - return xerrors.Errorf("Value in field \"$type\" was too long") 788 - } 789 - 790 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 791 - return err 792 - } 793 - if _, err := io.WriteString(w, string("$type")); err != nil { 794 - return err 795 - } 796 - 797 - if len(t.LexiconTypeID) > cbg.MaxLength { 798 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 799 - } 800 - 801 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 802 - return err 803 - } 804 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 805 - return err 806 - } 807 - } 808 - 809 732 // t.Handle (string) (string) 810 733 if len("handle") > cbg.MaxLength { 811 734 return xerrors.Errorf("Value in field \"handle\" was too long") ··· 917 840 918 841 t.Time = string(sval) 919 842 } 920 - // t.LexiconTypeID (string) (string) 921 - case "$type": 922 - 923 - { 924 - sval, err := cbg.ReadString(cr) 925 - if err != nil { 926 - return err 927 - } 928 - 929 - t.LexiconTypeID = string(sval) 930 - } 931 843 // t.Handle (string) (string) 932 844 case "handle": 933 845 ··· 955 867 } 956 868 957 869 cw := cbg.NewCborWriter(w) 958 - fieldCount := 3 959 - 960 - if t.LexiconTypeID == "" { 961 - fieldCount-- 962 - } 870 + fieldCount := 2 963 871 964 872 if t.Message == nil { 965 873 fieldCount-- ··· 992 900 return err 993 901 } 994 902 995 - // t.LexiconTypeID (string) (string) 996 - if t.LexiconTypeID != "" { 997 - 998 - if len("$type") > cbg.MaxLength { 999 - return xerrors.Errorf("Value in field \"$type\" was too long") 1000 - } 1001 - 1002 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 1003 - return err 1004 - } 1005 - if _, err := io.WriteString(w, string("$type")); err != nil { 1006 - return err 1007 - } 1008 - 1009 - if len(t.LexiconTypeID) > cbg.MaxLength { 1010 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 1011 - } 1012 - 1013 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 1014 - return err 1015 - } 1016 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 1017 - return err 1018 - } 1019 - } 1020 - 1021 903 // t.Message (string) (string) 1022 904 if t.Message != nil { 1023 905 ··· 1101 983 1102 984 t.Name = string(sval) 1103 985 } 1104 - // t.LexiconTypeID (string) (string) 1105 - case "$type": 1106 - 1107 - { 1108 - sval, err := cbg.ReadString(cr) 1109 - if err != nil { 1110 - return err 1111 - } 1112 - 1113 - t.LexiconTypeID = string(sval) 1114 - } 1115 986 // t.Message (string) (string) 1116 987 case "message": 1117 988 ··· 1149 1020 } 1150 1021 1151 1022 cw := cbg.NewCborWriter(w) 1152 - fieldCount := 5 1153 1023 1154 - if t.LexiconTypeID == "" { 1155 - fieldCount-- 1156 - } 1157 - 1158 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1024 + if _, err := cw.Write([]byte{164}); err != nil { 1159 1025 return err 1160 1026 } 1161 1027 ··· 1227 1093 return err 1228 1094 } 1229 1095 1230 - // t.LexiconTypeID (string) (string) 1231 - if t.LexiconTypeID != "" { 1232 - 1233 - if len("$type") > cbg.MaxLength { 1234 - return xerrors.Errorf("Value in field \"$type\" was too long") 1235 - } 1236 - 1237 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 1238 - return err 1239 - } 1240 - if _, err := io.WriteString(w, string("$type")); err != nil { 1241 - return err 1242 - } 1243 - 1244 - if len(t.LexiconTypeID) > cbg.MaxLength { 1245 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 1246 - } 1247 - 1248 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 1249 - return err 1250 - } 1251 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 1252 - return err 1253 - } 1254 - } 1255 - 1256 1096 // t.MigrateTo (string) (string) 1257 1097 if len("migrateTo") > cbg.MaxLength { 1258 1098 return xerrors.Errorf("Value in field \"migrateTo\" was too long") ··· 1370 1210 1371 1211 t.Time = string(sval) 1372 1212 } 1373 - // t.LexiconTypeID (string) (string) 1374 - case "$type": 1375 - 1376 - { 1377 - sval, err := cbg.ReadString(cr) 1378 - if err != nil { 1379 - return err 1380 - } 1381 - 1382 - t.LexiconTypeID = string(sval) 1383 - } 1384 1213 // t.MigrateTo (string) (string) 1385 1214 case "migrateTo": 1386 1215 ··· 1418 1247 } 1419 1248 1420 1249 cw := cbg.NewCborWriter(w) 1421 - fieldCount := 4 1422 - 1423 - if t.LexiconTypeID == "" { 1424 - fieldCount-- 1425 - } 1426 1250 1427 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1251 + if _, err := cw.Write([]byte{163}); err != nil { 1428 1252 return err 1429 1253 } 1430 1254 ··· 1467 1291 return err 1468 1292 } 1469 1293 1470 - // t.LexiconTypeID (string) (string) 1471 - if t.LexiconTypeID != "" { 1472 - 1473 - if len("$type") > cbg.MaxLength { 1474 - return xerrors.Errorf("Value in field \"$type\" was too long") 1475 - } 1476 - 1477 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 1478 - return err 1479 - } 1480 - if _, err := io.WriteString(w, string("$type")); err != nil { 1481 - return err 1482 - } 1483 - 1484 - if len(t.LexiconTypeID) > cbg.MaxLength { 1485 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 1486 - } 1487 - 1488 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 1489 - return err 1490 - } 1491 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 1492 - return err 1493 - } 1494 - } 1495 - 1496 1294 // t.Action (string) (string) 1497 1295 if len("action") > cbg.MaxLength { 1498 1296 return xerrors.Errorf("Value in field \"action\" was too long") ··· 1587 1385 1588 1386 t.Path = string(sval) 1589 1387 } 1590 - // t.LexiconTypeID (string) (string) 1591 - case "$type": 1592 - 1593 - { 1594 - sval, err := cbg.ReadString(cr) 1595 - if err != nil { 1596 - return err 1597 - } 1598 - 1599 - t.LexiconTypeID = string(sval) 1600 - } 1601 1388 // t.Action (string) (string) 1602 1389 case "action": 1603 1390 ··· 1625 1412 } 1626 1413 1627 1414 cw := cbg.NewCborWriter(w) 1628 - fieldCount := 4 1629 1415 1630 - if t.LexiconTypeID == "" { 1631 - fieldCount-- 1632 - } 1633 - 1634 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1416 + if _, err := cw.Write([]byte{163}); err != nil { 1635 1417 return err 1636 1418 } 1637 1419 ··· 1702 1484 if _, err := io.WriteString(w, string(t.Time)); err != nil { 1703 1485 return err 1704 1486 } 1705 - 1706 - // t.LexiconTypeID (string) (string) 1707 - if t.LexiconTypeID != "" { 1708 - 1709 - if len("$type") > cbg.MaxLength { 1710 - return xerrors.Errorf("Value in field \"$type\" was too long") 1711 - } 1712 - 1713 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 1714 - return err 1715 - } 1716 - if _, err := io.WriteString(w, string("$type")); err != nil { 1717 - return err 1718 - } 1719 - 1720 - if len(t.LexiconTypeID) > cbg.MaxLength { 1721 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 1722 - } 1723 - 1724 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 1725 - return err 1726 - } 1727 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 1728 - return err 1729 - } 1730 - } 1731 1487 return nil 1732 1488 } 1733 1489 ··· 1816 1572 } 1817 1573 1818 1574 t.Time = string(sval) 1819 - } 1820 - // t.LexiconTypeID (string) (string) 1821 - case "$type": 1822 - 1823 - { 1824 - sval, err := cbg.ReadString(cr) 1825 - if err != nil { 1826 - return err 1827 - } 1828 - 1829 - t.LexiconTypeID = string(sval) 1830 1575 } 1831 1576 1832 1577 default:
+1 -2
api/atproto/identityresolveHandle.go
··· 12 12 } 13 13 14 14 type IdentityResolveHandle_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Did string `json:"did" cborgen:"did"` 15 + Did string `json:"did" cborgen:"did"` 17 16 } 18 17 19 18 func IdentityResolveHandle(ctx context.Context, c *xrpc.Client, handle string) (*IdentityResolveHandle_Output, error) {
+1 -2
api/atproto/identityupdateHandle.go
··· 12 12 } 13 13 14 14 type IdentityUpdateHandle_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Handle string `json:"handle" cborgen:"handle"` 15 + Handle string `json:"handle" cborgen:"handle"` 17 16 } 18 17 19 18 func IdentityUpdateHandle(ctx context.Context, c *xrpc.Client, input *IdentityUpdateHandle_Input) error {
+9 -11
api/atproto/moderationcreateReport.go
··· 15 15 } 16 16 17 17 type ModerationCreateReport_Input struct { 18 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 19 - Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` 20 - ReasonType *string `json:"reasonType" cborgen:"reasonType"` 21 - Subject *ModerationCreateReport_Input_Subject `json:"subject" cborgen:"subject"` 18 + Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` 19 + ReasonType *string `json:"reasonType" cborgen:"reasonType"` 20 + Subject *ModerationCreateReport_Input_Subject `json:"subject" cborgen:"subject"` 22 21 } 23 22 24 23 type ModerationCreateReport_Input_Subject struct { ··· 57 56 } 58 57 59 58 type ModerationCreateReport_Output struct { 60 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 61 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 62 - Id int64 `json:"id" cborgen:"id"` 63 - Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` 64 - ReasonType *string `json:"reasonType" cborgen:"reasonType"` 65 - ReportedBy string `json:"reportedBy" cborgen:"reportedBy"` 66 - Subject *ModerationCreateReport_Output_Subject `json:"subject" cborgen:"subject"` 59 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 60 + Id int64 `json:"id" cborgen:"id"` 61 + Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"` 62 + ReasonType *string `json:"reasonType" cborgen:"reasonType"` 63 + ReportedBy string `json:"reportedBy" cborgen:"reportedBy"` 64 + Subject *ModerationCreateReport_Output_Subject `json:"subject" cborgen:"subject"` 67 65 } 68 66 69 67 type ModerationCreateReport_Output_Subject struct {
+10 -8
api/atproto/repoapplyWrites.go
··· 14 14 func init() { 15 15 } 16 16 17 + // RECORDTYPE: RepoApplyWrites_Create 17 18 type RepoApplyWrites_Create struct { 18 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 19 + LexiconTypeID string `json:"$type,const=com.atproto.repo.applyWrites" cborgen:"$type,const=com.atproto.repo.applyWrites"` 19 20 Collection string `json:"collection" cborgen:"collection"` 20 21 Rkey *string `json:"rkey,omitempty" cborgen:"rkey,omitempty"` 21 22 Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 22 23 } 23 24 25 + // RECORDTYPE: RepoApplyWrites_Delete 24 26 type RepoApplyWrites_Delete struct { 25 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 27 + LexiconTypeID string `json:"$type,const=com.atproto.repo.applyWrites" cborgen:"$type,const=com.atproto.repo.applyWrites"` 26 28 Collection string `json:"collection" cborgen:"collection"` 27 29 Rkey string `json:"rkey" cborgen:"rkey"` 28 30 } 29 31 30 32 type RepoApplyWrites_Input struct { 31 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 32 - Repo string `json:"repo" cborgen:"repo"` 33 - SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 34 - Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"` 35 - Writes []*RepoApplyWrites_Input_Writes_Elem `json:"writes" cborgen:"writes"` 33 + Repo string `json:"repo" cborgen:"repo"` 34 + SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 35 + Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"` 36 + Writes []*RepoApplyWrites_Input_Writes_Elem `json:"writes" cborgen:"writes"` 36 37 } 37 38 38 39 type RepoApplyWrites_Input_Writes_Elem struct { ··· 78 79 } 79 80 } 80 81 82 + // RECORDTYPE: RepoApplyWrites_Update 81 83 type RepoApplyWrites_Update struct { 82 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 84 + LexiconTypeID string `json:"$type,const=com.atproto.repo.applyWrites" cborgen:"$type,const=com.atproto.repo.applyWrites"` 83 85 Collection string `json:"collection" cborgen:"collection"` 84 86 Rkey string `json:"rkey" cborgen:"rkey"` 85 87 Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"`
+8 -10
api/atproto/repocreateRecord.go
··· 13 13 } 14 14 15 15 type RepoCreateRecord_Input struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 - Collection string `json:"collection" cborgen:"collection"` 18 - Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"` 19 - Repo string `json:"repo" cborgen:"repo"` 20 - Rkey *string `json:"rkey,omitempty" cborgen:"rkey,omitempty"` 21 - SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 22 - Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"` 16 + Collection string `json:"collection" cborgen:"collection"` 17 + Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"` 18 + Repo string `json:"repo" cborgen:"repo"` 19 + Rkey *string `json:"rkey,omitempty" cborgen:"rkey,omitempty"` 20 + SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 21 + Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"` 23 22 } 24 23 25 24 type RepoCreateRecord_Output struct { 26 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 27 - Cid string `json:"cid" cborgen:"cid"` 28 - Uri string `json:"uri" cborgen:"uri"` 25 + Cid string `json:"cid" cborgen:"cid"` 26 + Uri string `json:"uri" cborgen:"uri"` 29 27 } 30 28 31 29 func RepoCreateRecord(ctx context.Context, c *xrpc.Client, input *RepoCreateRecord_Input) (*RepoCreateRecord_Output, error) {
+5 -6
api/atproto/repodeleteRecord.go
··· 12 12 } 13 13 14 14 type RepoDeleteRecord_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Collection string `json:"collection" cborgen:"collection"` 17 - Repo string `json:"repo" cborgen:"repo"` 18 - Rkey string `json:"rkey" cborgen:"rkey"` 19 - SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 20 - SwapRecord *string `json:"swapRecord,omitempty" cborgen:"swapRecord,omitempty"` 15 + Collection string `json:"collection" cborgen:"collection"` 16 + Repo string `json:"repo" cborgen:"repo"` 17 + Rkey string `json:"rkey" cborgen:"rkey"` 18 + SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 19 + SwapRecord *string `json:"swapRecord,omitempty" cborgen:"swapRecord,omitempty"` 21 20 } 22 21 23 22 func RepoDeleteRecord(ctx context.Context, c *xrpc.Client, input *RepoDeleteRecord_Input) error {
-1
api/atproto/repodescribeRepo.go
··· 13 13 } 14 14 15 15 type RepoDescribeRepo_Output struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 16 Collections []string `json:"collections" cborgen:"collections"` 18 17 Did string `json:"did" cborgen:"did"` 19 18 DidDoc *util.LexiconTypeDecoder `json:"didDoc" cborgen:"didDoc"`
+3 -4
api/atproto/repogetRecord.go
··· 13 13 } 14 14 15 15 type RepoGetRecord_Output struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 - Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 18 - Uri string `json:"uri" cborgen:"uri"` 19 - Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 16 + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 17 + Uri string `json:"uri" cborgen:"uri"` 18 + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 20 19 } 21 20 22 21 func RepoGetRecord(ctx context.Context, c *xrpc.Client, cid string, collection string, repo string, rkey string) (*RepoGetRecord_Output, error) {
+5 -7
api/atproto/repolistRecords.go
··· 13 13 } 14 14 15 15 type RepoListRecords_Output struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 18 - Records []*RepoListRecords_Record `json:"records" cborgen:"records"` 16 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 + Records []*RepoListRecords_Record `json:"records" cborgen:"records"` 19 18 } 20 19 21 20 type RepoListRecords_Record struct { 22 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 23 - Cid string `json:"cid" cborgen:"cid"` 24 - Uri string `json:"uri" cborgen:"uri"` 25 - Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 21 + Cid string `json:"cid" cborgen:"cid"` 22 + Uri string `json:"uri" cborgen:"uri"` 23 + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` 26 24 } 27 25 28 26 func RepoListRecords(ctx context.Context, c *xrpc.Client, collection string, limit int64, repo string, reverse bool, rkeyEnd string, rkeyStart string) (*RepoListRecords_Output, error) {
+9 -11
api/atproto/repoputRecord.go
··· 13 13 } 14 14 15 15 type RepoPutRecord_Input struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 - Collection string `json:"collection" cborgen:"collection"` 18 - Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"` 19 - Repo string `json:"repo" cborgen:"repo"` 20 - Rkey string `json:"rkey" cborgen:"rkey"` 21 - SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 22 - SwapRecord *string `json:"swapRecord" cborgen:"swapRecord"` 23 - Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"` 16 + Collection string `json:"collection" cborgen:"collection"` 17 + Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"` 18 + Repo string `json:"repo" cborgen:"repo"` 19 + Rkey string `json:"rkey" cborgen:"rkey"` 20 + SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` 21 + SwapRecord *string `json:"swapRecord" cborgen:"swapRecord"` 22 + Validate *bool `json:"validate,omitempty" cborgen:"validate,omitempty"` 24 23 } 25 24 26 25 type RepoPutRecord_Output struct { 27 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 28 - Cid string `json:"cid" cborgen:"cid"` 29 - Uri string `json:"uri" cborgen:"uri"` 26 + Cid string `json:"cid" cborgen:"cid"` 27 + Uri string `json:"uri" cborgen:"uri"` 30 28 } 31 29 32 30 func RepoPutRecord(ctx context.Context, c *xrpc.Client, input *RepoPutRecord_Input) (*RepoPutRecord_Output, error) {
+7 -1
api/atproto/repostrongRef.go
··· 1 1 package atproto 2 2 3 + import ( 4 + "github.com/bluesky-social/indigo/lex/util" 5 + ) 6 + 3 7 // schema: com.atproto.repo.strongRef 4 8 5 9 func init() { 10 + util.RegisterType("com.atproto.repo.strongRef#main", &RepoStrongRef{}) 6 11 } 7 12 13 + // RECORDTYPE: RepoStrongRef 8 14 type RepoStrongRef struct { 9 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 15 + LexiconTypeID string `json:"$type,const=com.atproto.repo.strongRef,omitempty" cborgen:"$type,const=com.atproto.repo.strongRef,omitempty"` 10 16 Cid string `json:"cid" cborgen:"cid"` 11 17 Uri string `json:"uri" cborgen:"uri"` 12 18 }
+1 -2
api/atproto/repouploadBlob.go
··· 14 14 } 15 15 16 16 type RepoUploadBlob_Output struct { 17 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 18 - Blob *util.LexBlob `json:"blob" cborgen:"blob"` 17 + Blob *util.LexBlob `json:"blob" cborgen:"blob"` 19 18 } 20 19 21 20 func RepoUploadBlob(ctx context.Context, c *xrpc.Client, input io.Reader) (*RepoUploadBlob_Output, error) {
+9 -11
api/atproto/servercreateAccount.go
··· 12 12 } 13 13 14 14 type ServerCreateAccount_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Email string `json:"email" cborgen:"email"` 17 - Handle string `json:"handle" cborgen:"handle"` 18 - InviteCode *string `json:"inviteCode,omitempty" cborgen:"inviteCode,omitempty"` 19 - Password string `json:"password" cborgen:"password"` 20 - RecoveryKey *string `json:"recoveryKey,omitempty" cborgen:"recoveryKey,omitempty"` 15 + Email string `json:"email" cborgen:"email"` 16 + Handle string `json:"handle" cborgen:"handle"` 17 + InviteCode *string `json:"inviteCode,omitempty" cborgen:"inviteCode,omitempty"` 18 + Password string `json:"password" cborgen:"password"` 19 + RecoveryKey *string `json:"recoveryKey,omitempty" cborgen:"recoveryKey,omitempty"` 21 20 } 22 21 23 22 type ServerCreateAccount_Output struct { 24 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 25 - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 26 - Did string `json:"did" cborgen:"did"` 27 - Handle string `json:"handle" cborgen:"handle"` 28 - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 23 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 24 + Did string `json:"did" cborgen:"did"` 25 + Handle string `json:"handle" cborgen:"handle"` 26 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 29 27 } 30 28 31 29 func ServerCreateAccount(ctx context.Context, c *xrpc.Client, input *ServerCreateAccount_Input) (*ServerCreateAccount_Output, error) {
+2 -4
api/atproto/servercreateInviteCode.go
··· 12 12 } 13 13 14 14 type ServerCreateInviteCode_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - UseCount int64 `json:"useCount" cborgen:"useCount"` 15 + UseCount int64 `json:"useCount" cborgen:"useCount"` 17 16 } 18 17 19 18 type ServerCreateInviteCode_Output struct { 20 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 21 - Code string `json:"code" cborgen:"code"` 19 + Code string `json:"code" cborgen:"code"` 22 20 } 23 21 24 22 func ServerCreateInviteCode(ctx context.Context, c *xrpc.Client, input *ServerCreateInviteCode_Input) (*ServerCreateInviteCode_Output, error) {
+6 -8
api/atproto/servercreateSession.go
··· 12 12 } 13 13 14 14 type ServerCreateSession_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Identifier *string `json:"identifier,omitempty" cborgen:"identifier,omitempty"` 17 - Password string `json:"password" cborgen:"password"` 15 + Identifier *string `json:"identifier,omitempty" cborgen:"identifier,omitempty"` 16 + Password string `json:"password" cborgen:"password"` 18 17 } 19 18 20 19 type ServerCreateSession_Output struct { 21 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 22 - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 23 - Did string `json:"did" cborgen:"did"` 24 - Handle string `json:"handle" cborgen:"handle"` 25 - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 20 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 21 + Did string `json:"did" cborgen:"did"` 22 + Handle string `json:"handle" cborgen:"handle"` 23 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 26 24 } 27 25 28 26 func ServerCreateSession(ctx context.Context, c *xrpc.Client, input *ServerCreateSession_Input) (*ServerCreateSession_Output, error) {
+3 -4
api/atproto/serverdeleteAccount.go
··· 12 12 } 13 13 14 14 type ServerDeleteAccount_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Did string `json:"did" cborgen:"did"` 17 - Password string `json:"password" cborgen:"password"` 18 - Token string `json:"token" cborgen:"token"` 15 + Did string `json:"did" cborgen:"did"` 16 + Password string `json:"password" cborgen:"password"` 17 + Token string `json:"token" cborgen:"token"` 19 18 } 20 19 21 20 func ServerDeleteAccount(ctx context.Context, c *xrpc.Client, input *ServerDeleteAccount_Input) error {
-2
api/atproto/serverdescribeServer.go
··· 12 12 } 13 13 14 14 type ServerDescribeServer_Links struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 15 PrivacyPolicy *string `json:"privacyPolicy,omitempty" cborgen:"privacyPolicy,omitempty"` 17 16 TermsOfService *string `json:"termsOfService,omitempty" cborgen:"termsOfService,omitempty"` 18 17 } 19 18 20 19 type ServerDescribeServer_Output struct { 21 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 22 20 AvailableUserDomains []string `json:"availableUserDomains" cborgen:"availableUserDomains"` 23 21 InviteCodeRequired *bool `json:"inviteCodeRequired,omitempty" cborgen:"inviteCodeRequired,omitempty"` 24 22 Links *ServerDescribeServer_Links `json:"links,omitempty" cborgen:"links,omitempty"`
+2 -3
api/atproto/servergetSession.go
··· 12 12 } 13 13 14 14 type ServerGetSession_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Did string `json:"did" cborgen:"did"` 17 - Handle string `json:"handle" cborgen:"handle"` 15 + Did string `json:"did" cborgen:"did"` 16 + Handle string `json:"handle" cborgen:"handle"` 18 17 } 19 18 20 19 func ServerGetSession(ctx context.Context, c *xrpc.Client) (*ServerGetSession_Output, error) {
+4 -5
api/atproto/serverrefreshSession.go
··· 12 12 } 13 13 14 14 type ServerRefreshSession_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 17 - Did string `json:"did" cborgen:"did"` 18 - Handle string `json:"handle" cborgen:"handle"` 19 - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 15 + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` 16 + Did string `json:"did" cborgen:"did"` 17 + Handle string `json:"handle" cborgen:"handle"` 18 + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` 20 19 } 21 20 22 21 func ServerRefreshSession(ctx context.Context, c *xrpc.Client) (*ServerRefreshSession_Output, error) {
+1 -2
api/atproto/serverrequestPasswordReset.go
··· 12 12 } 13 13 14 14 type ServerRequestPasswordReset_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Email string `json:"email" cborgen:"email"` 15 + Email string `json:"email" cborgen:"email"` 17 16 } 18 17 19 18 func ServerRequestPasswordReset(ctx context.Context, c *xrpc.Client, input *ServerRequestPasswordReset_Input) error {
+2 -3
api/atproto/serverresetPassword.go
··· 12 12 } 13 13 14 14 type ServerResetPassword_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Password string `json:"password" cborgen:"password"` 17 - Token string `json:"token" cborgen:"token"` 15 + Password string `json:"password" cborgen:"password"` 16 + Token string `json:"token" cborgen:"token"` 18 17 } 19 18 20 19 func ServerResetPassword(ctx context.Context, c *xrpc.Client, input *ServerResetPassword_Input) error {
+1 -2
api/atproto/syncgetCommitPath.go
··· 12 12 } 13 13 14 14 type SyncGetCommitPath_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Commits []string `json:"commits" cborgen:"commits"` 15 + Commits []string `json:"commits" cborgen:"commits"` 17 16 } 18 17 19 18 func SyncGetCommitPath(ctx context.Context, c *xrpc.Client, did string, earliest string, latest string) (*SyncGetCommitPath_Output, error) {
+1 -2
api/atproto/syncgetHead.go
··· 12 12 } 13 13 14 14 type SyncGetHead_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Root string `json:"root" cborgen:"root"` 15 + Root string `json:"root" cborgen:"root"` 17 16 } 18 17 19 18 func SyncGetHead(ctx context.Context, c *xrpc.Client, did string) (*SyncGetHead_Output, error) {
+1 -2
api/atproto/synclistBlobs.go
··· 12 12 } 13 13 14 14 type SyncListBlobs_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cids []string `json:"cids" cborgen:"cids"` 15 + Cids []string `json:"cids" cborgen:"cids"` 17 16 } 18 17 19 18 func SyncListBlobs(ctx context.Context, c *xrpc.Client, did string, earliest string, latest string) (*SyncListBlobs_Output, error) {
+26 -32
api/atproto/syncsubscribeRepos.go
··· 10 10 } 11 11 12 12 type SyncSubscribeRepos_Commit struct { 13 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 14 - Blobs []util.LexLink `json:"blobs" cborgen:"blobs"` 15 - Blocks util.LexBytes `json:"blocks" cborgen:"blocks"` 16 - Commit util.LexLink `json:"commit" cborgen:"commit"` 17 - Ops []*SyncSubscribeRepos_RepoOp `json:"ops" cborgen:"ops"` 18 - Prev *util.LexLink `json:"prev" cborgen:"prev"` 19 - Rebase bool `json:"rebase" cborgen:"rebase"` 20 - Repo string `json:"repo" cborgen:"repo"` 21 - Seq int64 `json:"seq" cborgen:"seq"` 22 - Time string `json:"time" cborgen:"time"` 23 - TooBig bool `json:"tooBig" cborgen:"tooBig"` 13 + Blobs []util.LexLink `json:"blobs" cborgen:"blobs"` 14 + Blocks util.LexBytes `json:"blocks" cborgen:"blocks"` 15 + Commit util.LexLink `json:"commit" cborgen:"commit"` 16 + Ops []*SyncSubscribeRepos_RepoOp `json:"ops" cborgen:"ops"` 17 + Prev *util.LexLink `json:"prev" cborgen:"prev"` 18 + Rebase bool `json:"rebase" cborgen:"rebase"` 19 + Repo string `json:"repo" cborgen:"repo"` 20 + Seq int64 `json:"seq" cborgen:"seq"` 21 + Time string `json:"time" cborgen:"time"` 22 + TooBig bool `json:"tooBig" cborgen:"tooBig"` 24 23 } 25 24 26 25 type SyncSubscribeRepos_Handle struct { 27 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 28 - Did string `json:"did" cborgen:"did"` 29 - Handle string `json:"handle" cborgen:"handle"` 30 - Seq int64 `json:"seq" cborgen:"seq"` 31 - Time string `json:"time" cborgen:"time"` 26 + Did string `json:"did" cborgen:"did"` 27 + Handle string `json:"handle" cborgen:"handle"` 28 + Seq int64 `json:"seq" cborgen:"seq"` 29 + Time string `json:"time" cborgen:"time"` 32 30 } 33 31 34 32 type SyncSubscribeRepos_Info struct { 35 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 36 - Message *string `json:"message,omitempty" cborgen:"message,omitempty"` 37 - Name string `json:"name" cborgen:"name"` 33 + Message *string `json:"message,omitempty" cborgen:"message,omitempty"` 34 + Name string `json:"name" cborgen:"name"` 38 35 } 39 36 40 37 type SyncSubscribeRepos_Migrate struct { 41 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 42 - Did string `json:"did" cborgen:"did"` 43 - MigrateTo *string `json:"migrateTo" cborgen:"migrateTo"` 44 - Seq int64 `json:"seq" cborgen:"seq"` 45 - Time string `json:"time" cborgen:"time"` 38 + Did string `json:"did" cborgen:"did"` 39 + MigrateTo *string `json:"migrateTo" cborgen:"migrateTo"` 40 + Seq int64 `json:"seq" cborgen:"seq"` 41 + Time string `json:"time" cborgen:"time"` 46 42 } 47 43 48 44 type SyncSubscribeRepos_RepoOp struct { 49 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 50 - Action string `json:"action" cborgen:"action"` 51 - Cid *util.LexLink `json:"cid" cborgen:"cid"` 52 - Path string `json:"path" cborgen:"path"` 45 + Action string `json:"action" cborgen:"action"` 46 + Cid *util.LexLink `json:"cid" cborgen:"cid"` 47 + Path string `json:"path" cborgen:"path"` 53 48 } 54 49 55 50 type SyncSubscribeRepos_Tombstone struct { 56 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 57 - Did string `json:"did" cborgen:"did"` 58 - Seq int64 `json:"seq" cborgen:"seq"` 59 - Time string `json:"time" cborgen:"time"` 51 + Did string `json:"did" cborgen:"did"` 52 + Seq int64 `json:"seq" cborgen:"seq"` 53 + Time string `json:"time" cborgen:"time"` 60 54 }
+15 -19
api/bsky/actordefs.go
··· 6 6 } 7 7 8 8 type ActorDefs_ProfileView struct { 9 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 10 - Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"` 11 - Description *string `json:"description,omitempty" cborgen:"description,omitempty"` 12 - Did string `json:"did" cborgen:"did"` 13 - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` 14 - Handle string `json:"handle" cborgen:"handle"` 15 - IndexedAt *string `json:"indexedAt,omitempty" cborgen:"indexedAt,omitempty"` 16 - Viewer *ActorDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` 9 + Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"` 10 + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` 11 + Did string `json:"did" cborgen:"did"` 12 + DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` 13 + Handle string `json:"handle" cborgen:"handle"` 14 + IndexedAt *string `json:"indexedAt,omitempty" cborgen:"indexedAt,omitempty"` 15 + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` 17 16 } 18 17 19 18 type ActorDefs_ProfileViewBasic struct { 20 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 21 - Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"` 22 - Did string `json:"did" cborgen:"did"` 23 - DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` 24 - Handle string `json:"handle" cborgen:"handle"` 25 - Viewer *ActorDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` 19 + Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"` 20 + Did string `json:"did" cborgen:"did"` 21 + DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` 22 + Handle string `json:"handle" cborgen:"handle"` 23 + Viewer *ActorDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` 26 24 } 27 25 28 26 type ActorDefs_ProfileViewDetailed struct { 29 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 30 27 Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"` 31 28 Banner *string `json:"banner,omitempty" cborgen:"banner,omitempty"` 32 29 Description *string `json:"description,omitempty" cborgen:"description,omitempty"` ··· 41 38 } 42 39 43 40 type ActorDefs_ViewerState struct { 44 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 45 - FollowedBy *string `json:"followedBy,omitempty" cborgen:"followedBy,omitempty"` 46 - Following *string `json:"following,omitempty" cborgen:"following,omitempty"` 47 - Muted *bool `json:"muted,omitempty" cborgen:"muted,omitempty"` 41 + FollowedBy *string `json:"followedBy,omitempty" cborgen:"followedBy,omitempty"` 42 + Following *string `json:"following,omitempty" cborgen:"following,omitempty"` 43 + Muted *bool `json:"muted,omitempty" cborgen:"muted,omitempty"` 48 44 }
+1 -2
api/bsky/actorgetProfiles.go
··· 12 12 } 13 13 14 14 type ActorGetProfiles_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Profiles []*ActorDefs_ProfileViewDetailed `json:"profiles" cborgen:"profiles"` 15 + Profiles []*ActorDefs_ProfileViewDetailed `json:"profiles" cborgen:"profiles"` 17 16 } 18 17 19 18 func ActorGetProfiles(ctx context.Context, c *xrpc.Client, actors []string) (*ActorGetProfiles_Output, error) {
+2 -3
api/bsky/actorgetSuggestions.go
··· 12 12 } 13 13 14 14 type ActorGetSuggestions_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Actors []*ActorDefs_ProfileView `json:"actors" cborgen:"actors"` 17 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 15 + Actors []*ActorDefs_ProfileView `json:"actors" cborgen:"actors"` 16 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 18 17 } 19 18 20 19 func ActorGetSuggestions(ctx context.Context, c *xrpc.Client, cursor string, limit int64) (*ActorGetSuggestions_Output, error) {
+2 -3
api/bsky/actorsearchActors.go
··· 12 12 } 13 13 14 14 type ActorSearchActors_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Actors []*ActorDefs_ProfileView `json:"actors" cborgen:"actors"` 17 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 15 + Actors []*ActorDefs_ProfileView `json:"actors" cborgen:"actors"` 16 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 18 17 } 19 18 20 19 func ActorSearchActors(ctx context.Context, c *xrpc.Client, cursor string, limit int64, term string) (*ActorSearchActors_Output, error) {
+1 -2
api/bsky/actorsearchActorsTypeahead.go
··· 12 12 } 13 13 14 14 type ActorSearchActorsTypeahead_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Actors []*ActorDefs_ProfileViewBasic `json:"actors" cborgen:"actors"` 15 + Actors []*ActorDefs_ProfileViewBasic `json:"actors" cborgen:"actors"` 17 16 } 18 17 19 18 func ActorSearchActorsTypeahead(ctx context.Context, c *xrpc.Client, limit int64, term string) (*ActorSearchActorsTypeahead_Output, error) {
+54 -516
api/bsky/cbor_gen.go
··· 558 558 } 559 559 560 560 cw := cbg.NewCborWriter(w) 561 - fieldCount := 4 562 561 563 - if t.LexiconTypeID == "" { 564 - fieldCount-- 565 - } 566 - 567 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 562 + if _, err := cw.Write([]byte{163}); err != nil { 568 563 return err 569 564 } 570 565 ··· 589 584 } 590 585 if _, err := io.WriteString(w, string(t.Type)); err != nil { 591 586 return err 592 - } 593 - 594 - // t.LexiconTypeID (string) (string) 595 - if t.LexiconTypeID != "" { 596 - 597 - if len("$type") > cbg.MaxLength { 598 - return xerrors.Errorf("Value in field \"$type\" was too long") 599 - } 600 - 601 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 602 - return err 603 - } 604 - if _, err := io.WriteString(w, string("$type")); err != nil { 605 - return err 606 - } 607 - 608 - if len(t.LexiconTypeID) > cbg.MaxLength { 609 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 610 - } 611 - 612 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 613 - return err 614 - } 615 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 616 - return err 617 - } 618 587 } 619 588 620 589 // t.Index (bsky.FeedPost_TextSlice) (struct) ··· 707 676 708 677 t.Type = string(sval) 709 678 } 710 - // t.LexiconTypeID (string) (string) 711 - case "$type": 712 - 713 - { 714 - sval, err := cbg.ReadString(cr) 715 - if err != nil { 716 - return err 717 - } 718 - 719 - t.LexiconTypeID = string(sval) 720 - } 721 679 // t.Index (bsky.FeedPost_TextSlice) (struct) 722 680 case "index": 723 681 ··· 765 723 } 766 724 767 725 cw := cbg.NewCborWriter(w) 768 - fieldCount := 3 769 726 770 - if t.LexiconTypeID == "" { 771 - fieldCount-- 772 - } 773 - 774 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 727 + if _, err := cw.Write([]byte{162}); err != nil { 775 728 return err 776 729 } 777 730 ··· 791 744 return err 792 745 } 793 746 794 - // t.LexiconTypeID (string) (string) 795 - if t.LexiconTypeID != "" { 796 - 797 - if len("$type") > cbg.MaxLength { 798 - return xerrors.Errorf("Value in field \"$type\" was too long") 799 - } 800 - 801 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 802 - return err 803 - } 804 - if _, err := io.WriteString(w, string("$type")); err != nil { 805 - return err 806 - } 807 - 808 - if len(t.LexiconTypeID) > cbg.MaxLength { 809 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 810 - } 811 - 812 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 813 - return err 814 - } 815 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 816 - return err 817 - } 818 - } 819 - 820 747 // t.Parent (atproto.RepoStrongRef) (struct) 821 748 if len("parent") > cbg.MaxLength { 822 749 return xerrors.Errorf("Value in field \"parent\" was too long") ··· 893 820 } 894 821 895 822 } 896 - // t.LexiconTypeID (string) (string) 897 - case "$type": 898 - 899 - { 900 - sval, err := cbg.ReadString(cr) 901 - if err != nil { 902 - return err 903 - } 904 - 905 - t.LexiconTypeID = string(sval) 906 - } 907 823 // t.Parent (atproto.RepoStrongRef) (struct) 908 824 case "parent": 909 825 ··· 940 856 } 941 857 942 858 cw := cbg.NewCborWriter(w) 943 - fieldCount := 3 944 859 945 - if t.LexiconTypeID == "" { 946 - fieldCount-- 947 - } 948 - 949 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 860 + if _, err := cw.Write([]byte{162}); err != nil { 950 861 return err 951 862 } 952 863 ··· 972 883 } 973 884 } 974 885 975 - // t.LexiconTypeID (string) (string) 976 - if t.LexiconTypeID != "" { 977 - 978 - if len("$type") > cbg.MaxLength { 979 - return xerrors.Errorf("Value in field \"$type\" was too long") 980 - } 981 - 982 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 983 - return err 984 - } 985 - if _, err := io.WriteString(w, string("$type")); err != nil { 986 - return err 987 - } 988 - 989 - if len(t.LexiconTypeID) > cbg.MaxLength { 990 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 991 - } 992 - 993 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 994 - return err 995 - } 996 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 997 - return err 998 - } 999 - } 1000 - 1001 886 // t.Start (int64) (int64) 1002 887 if len("start") > cbg.MaxLength { 1003 888 return xerrors.Errorf("Value in field \"start\" was too long") ··· 1085 970 } 1086 971 1087 972 t.End = int64(extraI) 1088 - } 1089 - // t.LexiconTypeID (string) (string) 1090 - case "$type": 1091 - 1092 - { 1093 - sval, err := cbg.ReadString(cr) 1094 - if err != nil { 1095 - return err 1096 - } 1097 - 1098 - t.LexiconTypeID = string(sval) 1099 973 } 1100 974 // t.Start (int64) (int64) 1101 975 case "start": ··· 1411 1285 } 1412 1286 1413 1287 cw := cbg.NewCborWriter(w) 1414 - fieldCount := 5 1415 - 1416 - if t.LexiconTypeID == "" { 1417 - fieldCount-- 1418 - } 1288 + fieldCount := 4 1419 1289 1420 1290 if t.Thumb == nil { 1421 1291 fieldCount-- ··· 1448 1318 return err 1449 1319 } 1450 1320 1451 - // t.LexiconTypeID (string) (string) 1452 - if t.LexiconTypeID != "" { 1453 - 1454 - if len("$type") > cbg.MaxLength { 1455 - return xerrors.Errorf("Value in field \"$type\" was too long") 1456 - } 1457 - 1458 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 1459 - return err 1460 - } 1461 - if _, err := io.WriteString(w, string("$type")); err != nil { 1462 - return err 1463 - } 1464 - 1465 - if len(t.LexiconTypeID) > cbg.MaxLength { 1466 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 1467 - } 1468 - 1469 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 1470 - return err 1471 - } 1472 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 1473 - return err 1474 - } 1475 - } 1476 - 1477 1321 // t.Thumb (util.LexBlob) (struct) 1478 1322 if t.Thumb != nil { 1479 1323 ··· 1590 1434 1591 1435 t.Uri = string(sval) 1592 1436 } 1593 - // t.LexiconTypeID (string) (string) 1594 - case "$type": 1595 - 1596 - { 1597 - sval, err := cbg.ReadString(cr) 1598 - if err != nil { 1599 - return err 1600 - } 1601 - 1602 - t.LexiconTypeID = string(sval) 1603 - } 1604 1437 // t.Thumb (util.LexBlob) (struct) 1605 1438 case "thumb": 1606 1439 ··· 1659 1492 } 1660 1493 1661 1494 cw := cbg.NewCborWriter(w) 1662 - fieldCount := 3 1663 1495 1664 - if t.LexiconTypeID == "" { 1665 - fieldCount-- 1666 - } 1667 - 1668 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1496 + if _, err := cw.Write([]byte{162}); err != nil { 1669 1497 return err 1670 1498 } 1671 1499 ··· 1690 1518 } 1691 1519 if _, err := io.WriteString(w, string(t.Alt)); err != nil { 1692 1520 return err 1693 - } 1694 - 1695 - // t.LexiconTypeID (string) (string) 1696 - if t.LexiconTypeID != "" { 1697 - 1698 - if len("$type") > cbg.MaxLength { 1699 - return xerrors.Errorf("Value in field \"$type\" was too long") 1700 - } 1701 - 1702 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 1703 - return err 1704 - } 1705 - if _, err := io.WriteString(w, string("$type")); err != nil { 1706 - return err 1707 - } 1708 - 1709 - if len(t.LexiconTypeID) > cbg.MaxLength { 1710 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 1711 - } 1712 - 1713 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 1714 - return err 1715 - } 1716 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 1717 - return err 1718 - } 1719 1521 } 1720 1522 1721 1523 // t.Image (util.LexBlob) (struct) ··· 1784 1586 } 1785 1587 1786 1588 t.Alt = string(sval) 1787 - } 1788 - // t.LexiconTypeID (string) (string) 1789 - case "$type": 1790 - 1791 - { 1792 - sval, err := cbg.ReadString(cr) 1793 - if err != nil { 1794 - return err 1795 - } 1796 - 1797 - t.LexiconTypeID = string(sval) 1798 1589 } 1799 1590 // t.Image (util.LexBlob) (struct) 1800 1591 case "image": ··· 2571 2362 } 2572 2363 2573 2364 cw := cbg.NewCborWriter(w) 2574 - fieldCount := 3 2575 2365 2576 - if t.LexiconTypeID == "" { 2577 - fieldCount-- 2578 - } 2579 - 2580 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2366 + if _, err := cw.Write([]byte{162}); err != nil { 2581 2367 return err 2582 - } 2583 - 2584 - // t.LexiconTypeID (string) (string) 2585 - if t.LexiconTypeID != "" { 2586 - 2587 - if len("$type") > cbg.MaxLength { 2588 - return xerrors.Errorf("Value in field \"$type\" was too long") 2589 - } 2590 - 2591 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2592 - return err 2593 - } 2594 - if _, err := io.WriteString(w, string("$type")); err != nil { 2595 - return err 2596 - } 2597 - 2598 - if len(t.LexiconTypeID) > cbg.MaxLength { 2599 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 2600 - } 2601 - 2602 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 2603 - return err 2604 - } 2605 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 2606 - return err 2607 - } 2608 2368 } 2609 2369 2610 2370 // t.Index (bsky.RichtextFacet_ByteSlice) (struct) ··· 2688 2448 } 2689 2449 2690 2450 switch name { 2691 - // t.LexiconTypeID (string) (string) 2692 - case "$type": 2693 - 2694 - { 2695 - sval, err := cbg.ReadString(cr) 2696 - if err != nil { 2697 - return err 2698 - } 2699 - 2700 - t.LexiconTypeID = string(sval) 2701 - } 2702 - // t.Index (bsky.RichtextFacet_ByteSlice) (struct) 2451 + // t.Index (bsky.RichtextFacet_ByteSlice) (struct) 2703 2452 case "index": 2704 2453 2705 2454 { ··· 2764 2513 } 2765 2514 2766 2515 cw := cbg.NewCborWriter(w) 2767 - fieldCount := 3 2768 - 2769 - if t.LexiconTypeID == "" { 2770 - fieldCount-- 2771 - } 2772 2516 2773 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2517 + if _, err := cw.Write([]byte{162}); err != nil { 2774 2518 return err 2775 2519 } 2776 2520 2777 - // t.LexiconTypeID (string) (string) 2778 - if t.LexiconTypeID != "" { 2779 - 2780 - if len("$type") > cbg.MaxLength { 2781 - return xerrors.Errorf("Value in field \"$type\" was too long") 2782 - } 2783 - 2784 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2785 - return err 2786 - } 2787 - if _, err := io.WriteString(w, string("$type")); err != nil { 2788 - return err 2789 - } 2790 - 2791 - if len(t.LexiconTypeID) > cbg.MaxLength { 2792 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 2793 - } 2794 - 2795 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 2796 - return err 2797 - } 2798 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 2799 - return err 2800 - } 2801 - } 2802 - 2803 2521 // t.ByteEnd (int64) (int64) 2804 2522 if len("byteEnd") > cbg.MaxLength { 2805 2523 return xerrors.Errorf("Value in field \"byteEnd\" was too long") ··· 2884 2602 } 2885 2603 2886 2604 switch name { 2887 - // t.LexiconTypeID (string) (string) 2888 - case "$type": 2889 - 2890 - { 2891 - sval, err := cbg.ReadString(cr) 2892 - if err != nil { 2893 - return err 2894 - } 2895 - 2896 - t.LexiconTypeID = string(sval) 2897 - } 2898 - // t.ByteEnd (int64) (int64) 2605 + // t.ByteEnd (int64) (int64) 2899 2606 case "byteEnd": 2900 2607 { 2901 2608 maj, extra, err := cr.ReadHeader() ··· 2956 2663 2957 2664 return nil 2958 2665 } 2959 - func (t *RichtextFacet_Features_Elem) MarshalCBOR(w io.Writer) error { 2666 + func (t *RichtextFacet_Link) MarshalCBOR(w io.Writer) error { 2960 2667 if t == nil { 2961 2668 _, err := w.Write(cbg.CborNull) 2962 2669 return err ··· 2968 2675 return err 2969 2676 } 2970 2677 2971 - // t.RichtextFacet_Link (bsky.RichtextFacet_Link) (struct) 2972 - if len("RichtextFacet_Link") > cbg.MaxLength { 2973 - return xerrors.Errorf("Value in field \"RichtextFacet_Link\" was too long") 2974 - } 2975 - 2976 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RichtextFacet_Link"))); err != nil { 2977 - return err 2978 - } 2979 - if _, err := io.WriteString(w, string("RichtextFacet_Link")); err != nil { 2980 - return err 2981 - } 2982 - 2983 - if err := t.RichtextFacet_Link.MarshalCBOR(cw); err != nil { 2984 - return err 2985 - } 2986 - 2987 - // t.RichtextFacet_Mention (bsky.RichtextFacet_Mention) (struct) 2988 - if len("RichtextFacet_Mention") > cbg.MaxLength { 2989 - return xerrors.Errorf("Value in field \"RichtextFacet_Mention\" was too long") 2990 - } 2991 - 2992 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RichtextFacet_Mention"))); err != nil { 2993 - return err 2994 - } 2995 - if _, err := io.WriteString(w, string("RichtextFacet_Mention")); err != nil { 2996 - return err 2997 - } 2998 - 2999 - if err := t.RichtextFacet_Mention.MarshalCBOR(cw); err != nil { 3000 - return err 3001 - } 3002 - return nil 3003 - } 3004 - 3005 - func (t *RichtextFacet_Features_Elem) UnmarshalCBOR(r io.Reader) (err error) { 3006 - *t = RichtextFacet_Features_Elem{} 3007 - 3008 - cr := cbg.NewCborReader(r) 3009 - 3010 - maj, extra, err := cr.ReadHeader() 3011 - if err != nil { 3012 - return err 3013 - } 3014 - defer func() { 3015 - if err == io.EOF { 3016 - err = io.ErrUnexpectedEOF 3017 - } 3018 - }() 3019 - 3020 - if maj != cbg.MajMap { 3021 - return fmt.Errorf("cbor input should be of type map") 3022 - } 3023 - 3024 - if extra > cbg.MaxLength { 3025 - return fmt.Errorf("RichtextFacet_Features_Elem: map struct too large (%d)", extra) 3026 - } 3027 - 3028 - var name string 3029 - n := extra 3030 - 3031 - for i := uint64(0); i < n; i++ { 3032 - 3033 - { 3034 - sval, err := cbg.ReadString(cr) 3035 - if err != nil { 3036 - return err 3037 - } 3038 - 3039 - name = string(sval) 3040 - } 3041 - 3042 - switch name { 3043 - // t.RichtextFacet_Link (bsky.RichtextFacet_Link) (struct) 3044 - case "RichtextFacet_Link": 3045 - 3046 - { 3047 - 3048 - b, err := cr.ReadByte() 3049 - if err != nil { 3050 - return err 3051 - } 3052 - if b != cbg.CborNull[0] { 3053 - if err := cr.UnreadByte(); err != nil { 3054 - return err 3055 - } 3056 - t.RichtextFacet_Link = new(RichtextFacet_Link) 3057 - if err := t.RichtextFacet_Link.UnmarshalCBOR(cr); err != nil { 3058 - return xerrors.Errorf("unmarshaling t.RichtextFacet_Link pointer: %w", err) 3059 - } 3060 - } 3061 - 3062 - } 3063 - // t.RichtextFacet_Mention (bsky.RichtextFacet_Mention) (struct) 3064 - case "RichtextFacet_Mention": 3065 - 3066 - { 3067 - 3068 - b, err := cr.ReadByte() 3069 - if err != nil { 3070 - return err 3071 - } 3072 - if b != cbg.CborNull[0] { 3073 - if err := cr.UnreadByte(); err != nil { 3074 - return err 3075 - } 3076 - t.RichtextFacet_Mention = new(RichtextFacet_Mention) 3077 - if err := t.RichtextFacet_Mention.UnmarshalCBOR(cr); err != nil { 3078 - return xerrors.Errorf("unmarshaling t.RichtextFacet_Mention pointer: %w", err) 3079 - } 3080 - } 3081 - 3082 - } 3083 - 3084 - default: 3085 - // Field doesn't exist on this type, so ignore it 3086 - cbg.ScanForLinks(r, func(cid.Cid) {}) 3087 - } 3088 - } 3089 - 3090 - return nil 3091 - } 3092 - func (t *RichtextFacet_Link) MarshalCBOR(w io.Writer) error { 3093 - if t == nil { 3094 - _, err := w.Write(cbg.CborNull) 3095 - return err 3096 - } 3097 - 3098 - cw := cbg.NewCborWriter(w) 3099 - fieldCount := 2 3100 - 3101 - if t.LexiconTypeID == "" { 3102 - fieldCount-- 3103 - } 3104 - 3105 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 3106 - return err 3107 - } 3108 - 3109 2678 // t.Uri (string) (string) 3110 2679 if len("uri") > cbg.MaxLength { 3111 2680 return xerrors.Errorf("Value in field \"uri\" was too long") ··· 3130 2699 } 3131 2700 3132 2701 // t.LexiconTypeID (string) (string) 3133 - if t.LexiconTypeID != "" { 2702 + if len("$type") > cbg.MaxLength { 2703 + return xerrors.Errorf("Value in field \"$type\" was too long") 2704 + } 3134 2705 3135 - if len("$type") > cbg.MaxLength { 3136 - return xerrors.Errorf("Value in field \"$type\" was too long") 3137 - } 2706 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2707 + return err 2708 + } 2709 + if _, err := io.WriteString(w, string("$type")); err != nil { 2710 + return err 2711 + } 3138 2712 3139 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 3140 - return err 3141 - } 3142 - if _, err := io.WriteString(w, string("$type")); err != nil { 3143 - return err 3144 - } 3145 - 3146 - if len(t.LexiconTypeID) > cbg.MaxLength { 3147 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 3148 - } 3149 - 3150 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 3151 - return err 3152 - } 3153 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 3154 - return err 3155 - } 2713 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.bsky.richtext.facet"))); err != nil { 2714 + return err 2715 + } 2716 + if _, err := io.WriteString(w, string("app.bsky.richtext.facet")); err != nil { 2717 + return err 3156 2718 } 3157 2719 return nil 3158 2720 } ··· 3233 2795 } 3234 2796 3235 2797 cw := cbg.NewCborWriter(w) 3236 - fieldCount := 2 3237 2798 3238 - if t.LexiconTypeID == "" { 3239 - fieldCount-- 3240 - } 3241 - 3242 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2799 + if _, err := cw.Write([]byte{162}); err != nil { 3243 2800 return err 3244 2801 } 3245 2802 ··· 3267 2824 } 3268 2825 3269 2826 // t.LexiconTypeID (string) (string) 3270 - if t.LexiconTypeID != "" { 3271 - 3272 - if len("$type") > cbg.MaxLength { 3273 - return xerrors.Errorf("Value in field \"$type\" was too long") 3274 - } 3275 - 3276 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 3277 - return err 3278 - } 3279 - if _, err := io.WriteString(w, string("$type")); err != nil { 3280 - return err 3281 - } 2827 + if len("$type") > cbg.MaxLength { 2828 + return xerrors.Errorf("Value in field \"$type\" was too long") 2829 + } 3282 2830 3283 - if len(t.LexiconTypeID) > cbg.MaxLength { 3284 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 3285 - } 2831 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2832 + return err 2833 + } 2834 + if _, err := io.WriteString(w, string("$type")); err != nil { 2835 + return err 2836 + } 3286 2837 3287 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 3288 - return err 3289 - } 3290 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 3291 - return err 3292 - } 2838 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.bsky.richtext.facet"))); err != nil { 2839 + return err 2840 + } 2841 + if _, err := io.WriteString(w, string("app.bsky.richtext.facet")); err != nil { 2842 + return err 3293 2843 } 3294 2844 return nil 3295 2845 } ··· 3533 3083 } 3534 3084 3535 3085 cw := cbg.NewCborWriter(w) 3536 - fieldCount := 3 3537 3086 3538 - if t.LexiconTypeID == "" { 3539 - fieldCount-- 3540 - } 3541 - 3542 - if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 3087 + if _, err := cw.Write([]byte{163}); err != nil { 3543 3088 return err 3544 3089 } 3545 3090 ··· 3567 3112 } 3568 3113 3569 3114 // t.LexiconTypeID (string) (string) 3570 - if t.LexiconTypeID != "" { 3571 - 3572 - if len("$type") > cbg.MaxLength { 3573 - return xerrors.Errorf("Value in field \"$type\" was too long") 3574 - } 3575 - 3576 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 3577 - return err 3578 - } 3579 - if _, err := io.WriteString(w, string("$type")); err != nil { 3580 - return err 3581 - } 3115 + if len("$type") > cbg.MaxLength { 3116 + return xerrors.Errorf("Value in field \"$type\" was too long") 3117 + } 3582 3118 3583 - if len(t.LexiconTypeID) > cbg.MaxLength { 3584 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 3585 - } 3119 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 3120 + return err 3121 + } 3122 + if _, err := io.WriteString(w, string("$type")); err != nil { 3123 + return err 3124 + } 3586 3125 3587 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 3588 - return err 3589 - } 3590 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 3591 - return err 3592 - } 3126 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.bsky.feed.defs"))); err != nil { 3127 + return err 3128 + } 3129 + if _, err := io.WriteString(w, string("app.bsky.feed.defs")); err != nil { 3130 + return err 3593 3131 } 3594 3132 3595 3133 // t.NotFound (bool) (bool)
+10 -11
api/bsky/embedexternal.go
··· 17 17 } 18 18 19 19 type EmbedExternal_External struct { 20 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 21 - Description string `json:"description" cborgen:"description"` 22 - Thumb *util.LexBlob `json:"thumb,omitempty" cborgen:"thumb,omitempty"` 23 - Title string `json:"title" cborgen:"title"` 24 - Uri string `json:"uri" cborgen:"uri"` 20 + Description string `json:"description" cborgen:"description"` 21 + Thumb *util.LexBlob `json:"thumb,omitempty" cborgen:"thumb,omitempty"` 22 + Title string `json:"title" cborgen:"title"` 23 + Uri string `json:"uri" cborgen:"uri"` 25 24 } 26 25 26 + // RECORDTYPE: EmbedExternal_View 27 27 type EmbedExternal_View struct { 28 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 28 + LexiconTypeID string `json:"$type,const=app.bsky.embed.external" cborgen:"$type,const=app.bsky.embed.external"` 29 29 External *EmbedExternal_ViewExternal `json:"external" cborgen:"external"` 30 30 } 31 31 32 32 type EmbedExternal_ViewExternal struct { 33 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 34 - Description string `json:"description" cborgen:"description"` 35 - Thumb *string `json:"thumb,omitempty" cborgen:"thumb,omitempty"` 36 - Title string `json:"title" cborgen:"title"` 37 - Uri string `json:"uri" cborgen:"uri"` 33 + Description string `json:"description" cborgen:"description"` 34 + Thumb *string `json:"thumb,omitempty" cborgen:"thumb,omitempty"` 35 + Title string `json:"title" cborgen:"title"` 36 + Uri string `json:"uri" cborgen:"uri"` 38 37 }
+7 -8
api/bsky/embedimages.go
··· 17 17 } 18 18 19 19 type EmbedImages_Image struct { 20 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 21 - Alt string `json:"alt" cborgen:"alt"` 22 - Image *util.LexBlob `json:"image" cborgen:"image"` 20 + Alt string `json:"alt" cborgen:"alt"` 21 + Image *util.LexBlob `json:"image" cborgen:"image"` 23 22 } 24 23 24 + // RECORDTYPE: EmbedImages_View 25 25 type EmbedImages_View struct { 26 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 26 + LexiconTypeID string `json:"$type,const=app.bsky.embed.images" cborgen:"$type,const=app.bsky.embed.images"` 27 27 Images []*EmbedImages_ViewImage `json:"images" cborgen:"images"` 28 28 } 29 29 30 30 type EmbedImages_ViewImage struct { 31 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 32 - Alt string `json:"alt" cborgen:"alt"` 33 - Fullsize string `json:"fullsize" cborgen:"fullsize"` 34 - Thumb string `json:"thumb" cborgen:"thumb"` 31 + Alt string `json:"alt" cborgen:"alt"` 32 + Fullsize string `json:"fullsize" cborgen:"fullsize"` 33 + Thumb string `json:"thumb" cborgen:"thumb"` 35 34 }
+6 -3
api/bsky/embedrecord.go
··· 20 20 Record *comatprototypes.RepoStrongRef `json:"record" cborgen:"record"` 21 21 } 22 22 23 + // RECORDTYPE: EmbedRecord_View 23 24 type EmbedRecord_View struct { 24 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 25 + LexiconTypeID string `json:"$type,const=app.bsky.embed.record" cborgen:"$type,const=app.bsky.embed.record"` 25 26 Record *EmbedRecord_View_Record `json:"record" cborgen:"record"` 26 27 } 27 28 29 + // RECORDTYPE: EmbedRecord_ViewNotFound 28 30 type EmbedRecord_ViewNotFound struct { 29 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 31 + LexiconTypeID string `json:"$type,const=app.bsky.embed.record" cborgen:"$type,const=app.bsky.embed.record"` 30 32 Uri string `json:"uri" cborgen:"uri"` 31 33 } 32 34 35 + // RECORDTYPE: EmbedRecord_ViewRecord 33 36 type EmbedRecord_ViewRecord struct { 34 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 37 + LexiconTypeID string `json:"$type,const=app.bsky.embed.record" cborgen:"$type,const=app.bsky.embed.record"` 35 38 Author *ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` 36 39 Cid string `json:"cid" cborgen:"cid"` 37 40 Embeds []*EmbedRecord_ViewRecord_Embeds_Elem `json:"embeds,omitempty" cborgen:"embeds,omitempty"`
+2 -1
api/bsky/embedrecordWithMedia.go
··· 91 91 } 92 92 } 93 93 94 + // RECORDTYPE: EmbedRecordWithMedia_View 94 95 type EmbedRecordWithMedia_View struct { 95 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 96 + LexiconTypeID string `json:"$type,const=app.bsky.embed.recordWithMedia" cborgen:"$type,const=app.bsky.embed.recordWithMedia"` 96 97 Media *EmbedRecordWithMedia_View_Media `json:"media" cborgen:"media"` 97 98 Record *EmbedRecord_View `json:"record" cborgen:"record"` 98 99 }
+23 -24
api/bsky/feeddefs.go
··· 13 13 } 14 14 15 15 type FeedDefs_FeedViewPost struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 - Post *FeedDefs_PostView `json:"post" cborgen:"post"` 18 - Reason *FeedDefs_FeedViewPost_Reason `json:"reason,omitempty" cborgen:"reason,omitempty"` 19 - Reply *FeedDefs_ReplyRef `json:"reply,omitempty" cborgen:"reply,omitempty"` 16 + Post *FeedDefs_PostView `json:"post" cborgen:"post"` 17 + Reason *FeedDefs_FeedViewPost_Reason `json:"reason,omitempty" cborgen:"reason,omitempty"` 18 + Reply *FeedDefs_ReplyRef `json:"reply,omitempty" cborgen:"reply,omitempty"` 20 19 } 21 20 22 21 type FeedDefs_FeedViewPost_Reason struct { ··· 46 45 } 47 46 } 48 47 48 + // RECORDTYPE: FeedDefs_NotFoundPost 49 49 type FeedDefs_NotFoundPost struct { 50 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 50 + LexiconTypeID string `json:"$type,const=app.bsky.feed.defs" cborgen:"$type,const=app.bsky.feed.defs"` 51 51 NotFound bool `json:"notFound" cborgen:"notFound"` 52 52 Uri string `json:"uri" cborgen:"uri"` 53 53 } 54 54 55 55 type FeedDefs_PostView struct { 56 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 57 - Author *ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` 58 - Cid string `json:"cid" cborgen:"cid"` 59 - Embed *FeedDefs_PostView_Embed `json:"embed,omitempty" cborgen:"embed,omitempty"` 60 - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 61 - LikeCount *int64 `json:"likeCount,omitempty" cborgen:"likeCount,omitempty"` 62 - Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"` 63 - ReplyCount *int64 `json:"replyCount,omitempty" cborgen:"replyCount,omitempty"` 64 - RepostCount *int64 `json:"repostCount,omitempty" cborgen:"repostCount,omitempty"` 65 - Uri string `json:"uri" cborgen:"uri"` 66 - Viewer *FeedDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` 56 + Author *ActorDefs_ProfileViewBasic `json:"author" cborgen:"author"` 57 + Cid string `json:"cid" cborgen:"cid"` 58 + Embed *FeedDefs_PostView_Embed `json:"embed,omitempty" cborgen:"embed,omitempty"` 59 + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 60 + LikeCount *int64 `json:"likeCount,omitempty" cborgen:"likeCount,omitempty"` 61 + Record *util.LexiconTypeDecoder `json:"record" cborgen:"record"` 62 + ReplyCount *int64 `json:"replyCount,omitempty" cborgen:"replyCount,omitempty"` 63 + RepostCount *int64 `json:"repostCount,omitempty" cborgen:"repostCount,omitempty"` 64 + Uri string `json:"uri" cborgen:"uri"` 65 + Viewer *FeedDefs_ViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` 67 66 } 68 67 69 68 type FeedDefs_PostView_Embed struct { ··· 117 116 } 118 117 } 119 118 119 + // RECORDTYPE: FeedDefs_ReasonRepost 120 120 type FeedDefs_ReasonRepost struct { 121 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 121 + LexiconTypeID string `json:"$type,const=app.bsky.feed.defs" cborgen:"$type,const=app.bsky.feed.defs"` 122 122 By *ActorDefs_ProfileViewBasic `json:"by" cborgen:"by"` 123 123 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 124 124 } 125 125 126 126 type FeedDefs_ReplyRef struct { 127 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 128 - Parent *FeedDefs_PostView `json:"parent" cborgen:"parent"` 129 - Root *FeedDefs_PostView `json:"root" cborgen:"root"` 127 + Parent *FeedDefs_PostView `json:"parent" cborgen:"parent"` 128 + Root *FeedDefs_PostView `json:"root" cborgen:"root"` 130 129 } 131 130 131 + // RECORDTYPE: FeedDefs_ThreadViewPost 132 132 type FeedDefs_ThreadViewPost struct { 133 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 133 + LexiconTypeID string `json:"$type,const=app.bsky.feed.defs" cborgen:"$type,const=app.bsky.feed.defs"` 134 134 Parent *FeedDefs_ThreadViewPost_Parent `json:"parent,omitempty" cborgen:"parent,omitempty"` 135 135 Post *FeedDefs_PostView `json:"post" cborgen:"post"` 136 136 Replies []*FeedDefs_ThreadViewPost_Replies_Elem `json:"replies,omitempty" cborgen:"replies,omitempty"` ··· 207 207 } 208 208 209 209 type FeedDefs_ViewerState struct { 210 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 211 - Like *string `json:"like,omitempty" cborgen:"like,omitempty"` 212 - Repost *string `json:"repost,omitempty" cborgen:"repost,omitempty"` 210 + Like *string `json:"like,omitempty" cborgen:"like,omitempty"` 211 + Repost *string `json:"repost,omitempty" cborgen:"repost,omitempty"` 213 212 }
+2 -3
api/bsky/feedgetAuthorFeed.go
··· 12 12 } 13 13 14 14 type FeedGetAuthorFeed_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Feed []*FeedDefs_FeedViewPost `json:"feed" cborgen:"feed"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Feed []*FeedDefs_FeedViewPost `json:"feed" cborgen:"feed"` 18 17 } 19 18 20 19 func FeedGetAuthorFeed(ctx context.Context, c *xrpc.Client, actor string, cursor string, limit int64) (*FeedGetAuthorFeed_Output, error) {
+7 -9
api/bsky/feedgetLikes.go
··· 12 12 } 13 13 14 14 type FeedGetLikes_Like struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Actor *ActorDefs_ProfileView `json:"actor" cborgen:"actor"` 17 - CreatedAt string `json:"createdAt" cborgen:"createdAt"` 18 - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 15 + Actor *ActorDefs_ProfileView `json:"actor" cborgen:"actor"` 16 + CreatedAt string `json:"createdAt" cborgen:"createdAt"` 17 + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` 19 18 } 20 19 21 20 type FeedGetLikes_Output struct { 22 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 23 - Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 24 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 25 - Likes []*FeedGetLikes_Like `json:"likes" cborgen:"likes"` 26 - Uri string `json:"uri" cborgen:"uri"` 21 + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 22 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 23 + Likes []*FeedGetLikes_Like `json:"likes" cborgen:"likes"` 24 + Uri string `json:"uri" cborgen:"uri"` 27 25 } 28 26 29 27 func FeedGetLikes(ctx context.Context, c *xrpc.Client, cid string, cursor string, limit int64, uri string) (*FeedGetLikes_Output, error) {
+1 -2
api/bsky/feedgetPostThread.go
··· 15 15 } 16 16 17 17 type FeedGetPostThread_Output struct { 18 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 19 - Thread *FeedGetPostThread_Output_Thread `json:"thread" cborgen:"thread"` 18 + Thread *FeedGetPostThread_Output_Thread `json:"thread" cborgen:"thread"` 20 19 } 21 20 22 21 type FeedGetPostThread_Output_Thread struct {
+4 -5
api/bsky/feedgetRepostedBy.go
··· 12 12 } 13 13 14 14 type FeedGetRepostedBy_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 17 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 18 - RepostedBy []*ActorDefs_ProfileView `json:"repostedBy" cborgen:"repostedBy"` 19 - Uri string `json:"uri" cborgen:"uri"` 15 + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 16 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 + RepostedBy []*ActorDefs_ProfileView `json:"repostedBy" cborgen:"repostedBy"` 18 + Uri string `json:"uri" cborgen:"uri"` 20 19 } 21 20 22 21 func FeedGetRepostedBy(ctx context.Context, c *xrpc.Client, cid string, cursor string, limit int64, uri string) (*FeedGetRepostedBy_Output, error) {
+2 -3
api/bsky/feedgetTimeline.go
··· 12 12 } 13 13 14 14 type FeedGetTimeline_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Feed []*FeedDefs_FeedViewPost `json:"feed" cborgen:"feed"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Feed []*FeedDefs_FeedViewPost `json:"feed" cborgen:"feed"` 18 17 } 19 18 20 19 func FeedGetTimeline(ctx context.Context, c *xrpc.Client, algorithm string, cursor string, limit int64) (*FeedGetTimeline_Output, error) {
+7 -10
api/bsky/feedpost.go
··· 125 125 } 126 126 127 127 type FeedPost_Entity struct { 128 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 129 - Index *FeedPost_TextSlice `json:"index" cborgen:"index"` 130 - Type string `json:"type" cborgen:"type"` 131 - Value string `json:"value" cborgen:"value"` 128 + Index *FeedPost_TextSlice `json:"index" cborgen:"index"` 129 + Type string `json:"type" cborgen:"type"` 130 + Value string `json:"value" cborgen:"value"` 132 131 } 133 132 134 133 type FeedPost_ReplyRef struct { 135 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 136 - Parent *comatprototypes.RepoStrongRef `json:"parent" cborgen:"parent"` 137 - Root *comatprototypes.RepoStrongRef `json:"root" cborgen:"root"` 134 + Parent *comatprototypes.RepoStrongRef `json:"parent" cborgen:"parent"` 135 + Root *comatprototypes.RepoStrongRef `json:"root" cborgen:"root"` 138 136 } 139 137 140 138 type FeedPost_TextSlice struct { 141 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 142 - End int64 `json:"end" cborgen:"end"` 143 - Start int64 `json:"start" cborgen:"start"` 139 + End int64 `json:"end" cborgen:"end"` 140 + Start int64 `json:"start" cborgen:"start"` 144 141 }
+3 -4
api/bsky/graphgetFollowers.go
··· 12 12 } 13 13 14 14 type GraphGetFollowers_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Followers []*ActorDefs_ProfileView `json:"followers" cborgen:"followers"` 18 - Subject *ActorDefs_ProfileView `json:"subject" cborgen:"subject"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Followers []*ActorDefs_ProfileView `json:"followers" cborgen:"followers"` 17 + Subject *ActorDefs_ProfileView `json:"subject" cborgen:"subject"` 19 18 } 20 19 21 20 func GraphGetFollowers(ctx context.Context, c *xrpc.Client, actor string, cursor string, limit int64) (*GraphGetFollowers_Output, error) {
+3 -4
api/bsky/graphgetFollows.go
··· 12 12 } 13 13 14 14 type GraphGetFollows_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Follows []*ActorDefs_ProfileView `json:"follows" cborgen:"follows"` 18 - Subject *ActorDefs_ProfileView `json:"subject" cborgen:"subject"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Follows []*ActorDefs_ProfileView `json:"follows" cborgen:"follows"` 17 + Subject *ActorDefs_ProfileView `json:"subject" cborgen:"subject"` 19 18 } 20 19 21 20 func GraphGetFollows(ctx context.Context, c *xrpc.Client, actor string, cursor string, limit int64) (*GraphGetFollows_Output, error) {
+2 -3
api/bsky/graphgetMutes.go
··· 12 12 } 13 13 14 14 type GraphGetMutes_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Mutes []*ActorDefs_ProfileView `json:"mutes" cborgen:"mutes"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Mutes []*ActorDefs_ProfileView `json:"mutes" cborgen:"mutes"` 18 17 } 19 18 20 19 func GraphGetMutes(ctx context.Context, c *xrpc.Client, cursor string, limit int64) (*GraphGetMutes_Output, error) {
+1 -2
api/bsky/graphmuteActor.go
··· 12 12 } 13 13 14 14 type GraphMuteActor_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Actor string `json:"actor" cborgen:"actor"` 15 + Actor string `json:"actor" cborgen:"actor"` 17 16 } 18 17 19 18 func GraphMuteActor(ctx context.Context, c *xrpc.Client, input *GraphMuteActor_Input) error {
+1 -2
api/bsky/graphunmuteActor.go
··· 12 12 } 13 13 14 14 type GraphUnmuteActor_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Actor string `json:"actor" cborgen:"actor"` 15 + Actor string `json:"actor" cborgen:"actor"` 17 16 } 18 17 19 18 func GraphUnmuteActor(ctx context.Context, c *xrpc.Client, input *GraphUnmuteActor_Input) error {
+1 -2
api/bsky/notificationgetUnreadCount.go
··· 12 12 } 13 13 14 14 type NotificationGetUnreadCount_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Count int64 `json:"count" cborgen:"count"` 15 + Count int64 `json:"count" cborgen:"count"` 17 16 } 18 17 19 18 func NotificationGetUnreadCount(ctx context.Context, c *xrpc.Client) (*NotificationGetUnreadCount_Output, error) {
-2
api/bsky/notificationlistNotifications.go
··· 13 13 } 14 14 15 15 type NotificationListNotifications_Notification struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 16 Author *ActorDefs_ProfileView `json:"author" cborgen:"author"` 18 17 Cid string `json:"cid" cborgen:"cid"` 19 18 IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` ··· 25 24 } 26 25 27 26 type NotificationListNotifications_Output struct { 28 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 29 27 Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 30 28 Notifications []*NotificationListNotifications_Notification `json:"notifications" cborgen:"notifications"` 31 29 }
+1 -2
api/bsky/notificationupdateSeen.go
··· 12 12 } 13 13 14 14 type NotificationUpdateSeen_Input struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - SeenAt string `json:"seenAt" cborgen:"seenAt"` 15 + SeenAt string `json:"seenAt" cborgen:"seenAt"` 17 16 } 18 17 19 18 func NotificationUpdateSeen(ctx context.Context, c *xrpc.Client, input *NotificationUpdateSeen_Input) error {
+44 -8
api/bsky/richtextfacet.go
··· 1 1 package bsky 2 2 3 3 import ( 4 + "bytes" 4 5 "encoding/json" 5 6 "fmt" 7 + "io" 6 8 7 9 "github.com/bluesky-social/indigo/lex/util" 10 + cbg "github.com/whyrusleeping/cbor-gen" 8 11 ) 9 12 10 13 // schema: app.bsky.richtext.facet ··· 13 16 } 14 17 15 18 type RichtextFacet struct { 16 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 17 - Features []*RichtextFacet_Features_Elem `json:"features" cborgen:"features"` 18 - Index *RichtextFacet_ByteSlice `json:"index" cborgen:"index"` 19 + Features []*RichtextFacet_Features_Elem `json:"features" cborgen:"features"` 20 + Index *RichtextFacet_ByteSlice `json:"index" cborgen:"index"` 19 21 } 20 22 21 23 type RichtextFacet_ByteSlice struct { 22 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 23 - ByteEnd int64 `json:"byteEnd" cborgen:"byteEnd"` 24 - ByteStart int64 `json:"byteStart" cborgen:"byteStart"` 24 + ByteEnd int64 `json:"byteEnd" cborgen:"byteEnd"` 25 + ByteStart int64 `json:"byteStart" cborgen:"byteStart"` 25 26 } 26 27 27 28 type RichtextFacet_Features_Elem struct { ··· 59 60 } 60 61 } 61 62 63 + func (t *RichtextFacet_Features_Elem) MarshalCBOR(w io.Writer) error { 64 + 65 + if t == nil { 66 + _, err := w.Write(cbg.CborNull) 67 + return err 68 + } 69 + if t.RichtextFacet_Mention != nil { 70 + return t.RichtextFacet_Mention.MarshalCBOR(w) 71 + } 72 + if t.RichtextFacet_Link != nil { 73 + return t.RichtextFacet_Link.MarshalCBOR(w) 74 + } 75 + return fmt.Errorf("cannot cbor marshal empty enum") 76 + } 77 + func (t *RichtextFacet_Features_Elem) UnmarshalCBOR(r io.Reader) error { 78 + typ, b, err := util.CborTypeExtractReader(r) 79 + if err != nil { 80 + return err 81 + } 82 + 83 + switch typ { 84 + case "app.bsky.richtext.facet#mention": 85 + t.RichtextFacet_Mention = new(RichtextFacet_Mention) 86 + return t.RichtextFacet_Mention.UnmarshalCBOR(bytes.NewReader(b)) 87 + case "app.bsky.richtext.facet#link": 88 + t.RichtextFacet_Link = new(RichtextFacet_Link) 89 + return t.RichtextFacet_Link.UnmarshalCBOR(bytes.NewReader(b)) 90 + 91 + default: 92 + return nil 93 + } 94 + } 95 + 96 + // RECORDTYPE: RichtextFacet_Link 62 97 type RichtextFacet_Link struct { 63 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 98 + LexiconTypeID string `json:"$type,const=app.bsky.richtext.facet" cborgen:"$type,const=app.bsky.richtext.facet"` 64 99 Uri string `json:"uri" cborgen:"uri"` 65 100 } 66 101 102 + // RECORDTYPE: RichtextFacet_Mention 67 103 type RichtextFacet_Mention struct { 68 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 104 + LexiconTypeID string `json:"$type,const=app.bsky.richtext.facet" cborgen:"$type,const=app.bsky.richtext.facet"` 69 105 Did string `json:"did" cborgen:"did"` 70 106 }
+2 -3
api/bsky/unspeccedgetPopular.go
··· 12 12 } 13 13 14 14 type UnspeccedGetPopular_Output struct { 15 - LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,omitempty"` 16 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 17 - Feed []*FeedDefs_FeedViewPost `json:"feed" cborgen:"feed"` 15 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 16 + Feed []*FeedDefs_FeedViewPost `json:"feed" cborgen:"feed"` 18 17 } 19 18 20 19 func UnspeccedGetPopular(ctx context.Context, c *xrpc.Client, cursor string, limit int64) (*UnspeccedGetPopular_Output, error) {
+70 -4
cmd/gosky/main.go
··· 81 81 resetPasswordCmd, 82 82 readRepoStreamCmd, 83 83 updateHandleCmd, 84 + getRecordCmd, 84 85 } 85 86 86 87 app.RunAndExitOnError() ··· 468 469 } 469 470 470 471 out, err := comatproto.RepoCreateRecord(ctx, xrpcc, &comatproto.RepoCreateRecord_Input{ 471 - LexiconTypeID: "com.atproto.feed.like", 472 - Collection: "com.atproto.feed.like", 473 - Repo: did, 472 + Collection: "com.atproto.feed.like", 473 + Repo: did, 474 474 Record: &lexutil.LexiconTypeDecoder{ 475 475 Val: &appbsky.FeedLike{ 476 476 CreatedAt: time.Now().Format(util.ISO8601), ··· 860 860 if err := json.Unmarshal(b, &out); err != nil { 861 861 return err 862 862 } 863 - out["Blocks"] = fmt.Sprintf("[%d bytes]", len(evt.Blocks)) 863 + out["blocks"] = fmt.Sprintf("[%d bytes]", len(evt.Blocks)) 864 864 865 865 b, err = json.Marshal(out) 866 866 if err != nil { ··· 898 898 }) 899 899 }, 900 900 } 901 + 902 + var getRecordCmd = &cli.Command{ 903 + Name: "getRecord", 904 + Flags: []cli.Flag{ 905 + &cli.StringFlag{ 906 + Name: "repo", 907 + }, 908 + &cli.BoolFlag{ 909 + Name: "raw", 910 + }, 911 + }, 912 + Action: func(cctx *cli.Context) error { 913 + ctx := context.Background() 914 + rfi := cctx.String("repo") 915 + 916 + var repob []byte 917 + if strings.HasPrefix(rfi, "did:") { 918 + xrpcc, err := cliutil.GetXrpcClient(cctx, false) 919 + if err != nil { 920 + return err 921 + } 922 + 923 + rrb, err := comatproto.SyncGetRepo(ctx, xrpcc, rfi, "", "") 924 + if err != nil { 925 + return err 926 + } 927 + repob = rrb 928 + } else { 929 + fb, err := os.ReadFile(rfi) 930 + if err != nil { 931 + return err 932 + } 933 + 934 + repob = fb 935 + } 936 + 937 + rr, err := repo.ReadRepoFromCar(ctx, bytes.NewReader(repob)) 938 + if err != nil { 939 + return err 940 + } 941 + 942 + rc, rec, err := rr.GetRecord(ctx, cctx.Args().First()) 943 + if err != nil { 944 + return err 945 + } 946 + 947 + if cctx.Bool("raw") { 948 + blk, err := rr.Blockstore().Get(ctx, rc) 949 + if err != nil { 950 + return err 951 + } 952 + 953 + fmt.Printf("%x\n", blk.RawData()) 954 + return nil 955 + } 956 + 957 + b, err := json.Marshal(rec) 958 + if err != nil { 959 + return err 960 + } 961 + 962 + fmt.Println(string(b)) 963 + 964 + return nil 965 + }, 966 + }
+3
cmd/lexgen/main.go
··· 131 131 } else { 132 132 defmap := lex.BuildExtDefMap(schemas, []string{"com.atproto", "app.bsky"}) 133 133 134 + // Run this twice as a hack to deal with indirect references referencing indirect references. 135 + // This part of the codegen needs to be redone 136 + lex.FixRecordReferences(schemas, defmap, prefix) 134 137 lex.FixRecordReferences(schemas, defmap, prefix) 135 138 for i, s := range schemas { 136 139 if !strings.HasPrefix(s.ID, prefix) {
+1 -1
gen/main.go
··· 30 30 bsky.EmbedExternal{}, bsky.EmbedExternal_External{}, 31 31 bsky.EmbedImages_Image{}, bsky.GraphFollow{}, bsky.ActorProfile{}, 32 32 bsky.EmbedRecord{}, bsky.FeedLike{}, bsky.RichtextFacet{}, 33 - bsky.RichtextFacet_ByteSlice{}, bsky.RichtextFacet_Features_Elem{}, 33 + bsky.RichtextFacet_ByteSlice{}, 34 34 bsky.RichtextFacet_Link{}, bsky.RichtextFacet_Mention{}, 35 35 bsky.EmbedRecordWithMedia{}, 36 36 bsky.FeedDefs_NotFoundPost{},
+73 -29
lex/gen.go
··· 47 47 } 48 48 49 49 type TypeSchema struct { 50 - prefix string 51 - id string 52 - defName string 53 - defMap map[string]*ExtDef 54 - record bool 50 + prefix string 51 + id string 52 + defName string 53 + defMap map[string]*ExtDef 54 + needsCbor bool 55 + needsType bool 55 56 56 57 Type string `json:"type"` 57 58 Key string `json:"key"` ··· 83 84 } 84 85 85 86 type outputType struct { 86 - Name string 87 - DefName string 88 - Type *TypeSchema 89 - Record bool 87 + Name string 88 + DefName string 89 + Type *TypeSchema 90 + NeedsCbor bool 91 + NeedsType bool 90 92 } 91 93 92 94 func (s *Schema) AllTypes(prefix string, defMap map[string]*ExtDef) []outputType { 93 95 var out []outputType 94 96 95 - var walk func(name string, ts *TypeSchema, record bool) 96 - walk = func(name string, ts *TypeSchema, record bool) { 97 + var walk func(name string, ts *TypeSchema, needsCbor bool) 98 + walk = func(name string, ts *TypeSchema, needsCbor bool) { 97 99 if ts == nil { 98 100 panic(fmt.Sprintf("nil type schema in %q (%s)", name, s.ID)) 99 101 } 100 102 101 - if record { 103 + if needsCbor { 102 104 fmt.Println("Setting to record: ", name) 103 105 if name == "EmbedImages_View" { 104 106 panic("not ok") 105 107 } 106 - ts.record = true 108 + ts.needsCbor = true 107 109 } 108 110 109 111 ts.prefix = prefix ··· 112 114 if ts.Type == "object" || 113 115 (ts.Type == "union" && len(ts.Refs) > 0) { 114 116 out = append(out, outputType{ 115 - Name: name, 116 - Type: ts, 117 - Record: ts.record, 117 + Name: name, 118 + Type: ts, 119 + NeedsCbor: ts.needsCbor, 118 120 }) 121 + 122 + for _, r := range ts.Refs { 123 + refname := r 124 + if strings.HasPrefix(refname, "#") { 125 + refname = s.ID + r 126 + } 127 + 128 + ed, ok := defMap[refname] 129 + if !ok { 130 + panic(fmt.Sprintf("cannot find: %q", refname)) 131 + } 132 + 133 + fmt.Println("UNION REF", refname, name, needsCbor) 134 + 135 + if needsCbor { 136 + ed.Type.needsCbor = true 137 + } 138 + 139 + ed.Type.needsType = true 140 + } 141 + } 142 + 143 + if ts.Type == "ref" { 144 + refname := ts.Ref 145 + if strings.HasPrefix(refname, "#") { 146 + refname = s.ID + ts.Ref 147 + } 148 + 149 + sub, ok := defMap[refname] 150 + if !ok { 151 + panic(fmt.Sprintf("missing ref: %q", refname)) 152 + } 153 + 154 + if needsCbor { 155 + sub.Type.needsCbor = true 156 + } 119 157 } 120 158 121 159 for childname, val := range ts.Properties { 122 - walk(name+"_"+strings.Title(childname), val, ts.record) 160 + walk(name+"_"+strings.Title(childname), val, ts.needsCbor) 123 161 } 124 162 125 163 if ts.Items != nil { 126 - walk(name+"_Elem", ts.Items, ts.record) 164 + walk(name+"_Elem", ts.Items, ts.needsCbor) 127 165 } 128 166 129 167 if ts.Input != nil { ··· 132 170 panic(fmt.Sprintf("strange input type def in %s", s.ID)) 133 171 } 134 172 } else { 135 - walk(name+"_Input", ts.Input.Schema, ts.record) 173 + walk(name+"_Input", ts.Input.Schema, ts.needsCbor) 136 174 } 137 175 } 138 176 ··· 142 180 panic(fmt.Sprintf("strange output type def in %s", s.ID)) 143 181 } 144 182 } else { 145 - walk(name+"_Output", ts.Output.Schema, ts.record) 183 + walk(name+"_Output", ts.Output.Schema, ts.needsCbor) 146 184 } 147 185 } 148 186 149 187 if ts.Type == "record" { 188 + ts.Record.needsType = true 150 189 walk(name, ts.Record, true) 151 190 } 152 191 ··· 159 198 if name == "main" { 160 199 n = tname 161 200 } 162 - walk(n, def, false) 201 + walk(n, def, def.needsCbor) 163 202 } 164 203 165 204 return out ··· 224 263 225 264 tps := s.AllTypes(prefix, defmap) 226 265 for _, t := range tps { 266 + if t.Type.Type == "record" { 267 + t.NeedsType = true 268 + t.Type.needsType = true 269 + } 270 + 227 271 if t.Type.Type == "union" { 228 272 for _, r := range t.Type.Refs { 229 273 if r[0] == '#' { ··· 234 278 panic(fmt.Sprintf("reference to unknown record type: %s", r)) 235 279 } 236 280 237 - if t.Record { 238 - defmap[r].Type.record = true 281 + if t.NeedsCbor { 282 + defmap[r].Type.needsCbor = true 239 283 } 240 284 } 241 285 } ··· 277 321 return tps[i].Name < tps[j].Name 278 322 }) 279 323 for _, ot := range tps { 280 - fmt.Println("TYPE: ", ot.Name, ot.Record) 324 + fmt.Println("TYPE: ", ot.Name, ot.NeedsCbor, ot.NeedsType) 281 325 if err := ot.Type.WriteType(ot.Name, buf); err != nil { 282 326 return err 283 327 } ··· 304 348 fmt.Fprintln(w, "func init() {") 305 349 for _, t := range tps { 306 350 307 - if t.Type.record && !strings.Contains(t.Name, "_") { 351 + if t.Type.needsType && !strings.Contains(t.Name, "_") { 308 352 id := t.Type.id 309 353 if t.Type.defName != "" { 310 354 id = id + "#" + t.Type.defName ··· 1094 1138 return nil 1095 1139 } 1096 1140 1097 - if ts.record { 1141 + if ts.needsType { 1098 1142 fmt.Fprintf(w, "// RECORDTYPE: %s\n", name) 1099 1143 } 1100 1144 1101 1145 fmt.Fprintf(w, "type %s struct {\n", name) 1102 1146 1103 - if ts.record { 1147 + if ts.needsType { 1104 1148 fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,const=%s\" cborgen:\"$type,const=%s\"`\n", ts.id, ts.id) 1105 1149 } else { 1106 - fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,omitempty\" cborgen:\"$type,omitempty\"`\n") 1150 + //fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,omitempty\" cborgen:\"$type,omitempty\"`\n") 1107 1151 } 1108 1152 1109 1153 required := make(map[string]bool) ··· 1204 1248 return err 1205 1249 } 1206 1250 1207 - if ts.record { 1251 + if ts.needsCbor { 1208 1252 if err := ts.writeCborMarshalerEnum(name, w); err != nil { 1209 1253 return err 1210 1254 }
+2 -6
lex/util/cbor_gen.go
··· 304 304 return err 305 305 } 306 306 307 - if len(t.LexiconTypeID) > cbg.MaxLength { 308 - return xerrors.Errorf("Value in field t.LexiconTypeID was too long") 309 - } 310 - 311 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LexiconTypeID))); err != nil { 307 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("blob"))); err != nil { 312 308 return err 313 309 } 314 - if _, err := io.WriteString(w, string(t.LexiconTypeID)); err != nil { 310 + if _, err := io.WriteString(w, string("blob")); err != nil { 315 311 return err 316 312 } 317 313
+1 -1
repomgr/repomgr.go
··· 827 827 for _, op := range diffops { 828 828 out, err := processOp(ctx, bs, op) 829 829 if err != nil { 830 - log.Errorw("failed to process repo op", "err", err, "path", op.Rpath) 830 + log.Errorw("failed to process repo op", "err", err, "path", op.Rpath, "repo", repoDid) 831 831 } 832 832 833 833 if out != nil {
+23
testing/feedpost_test.go
··· 2 2 3 3 import ( 4 4 "bytes" 5 + "encoding/hex" 5 6 "encoding/json" 6 7 "fmt" 7 8 "io" ··· 10 11 11 12 comatproto "github.com/bluesky-social/indigo/api/atproto" 12 13 appbsky "github.com/bluesky-social/indigo/api/bsky" 14 + bsky "github.com/bluesky-social/indigo/api/bsky" 13 15 lexutil "github.com/bluesky-social/indigo/lex/util" 14 16 "github.com/ipfs/go-cid" 15 17 ··· 123 125 assert.NoError(json.Unmarshal([]byte(expectedJson), &expectedJsonObj)) 124 126 assert.Equal(expectedJsonObj, outJsonObj) 125 127 } 128 + 129 + func TestPostToJson(t *testing.T) { 130 + raw := "a464746578747834e38282e38186e38193e381a3e381a1e3818ce69cace5aeb654776974746572e381a7e38184e38184e381aee381a7e381afefbc9f652474797065726170702e62736b792e666565642e706f737465656d626564a2652474797065756170702e62736b792e656d6265642e696d6167657366696d6167657381a263616c746065696d616765a463726566d82a5825000155122071e37fa09ed1814412a06d4dcd4f9462500b2992c267b9dea11884c52f6bacce6473697a6519ef2e65247479706564626c6f62686d696d65547970656a696d6167652f6a706567696372656174656441747818323032332d30342d30335432323a34363a31392e3438375a" 131 + 132 + b, err := hex.DecodeString(raw) 133 + if err != nil { 134 + t.Fatal(err) 135 + } 136 + 137 + var fp bsky.FeedPost 138 + if err := fp.UnmarshalCBOR(bytes.NewReader(b)); err != nil { 139 + t.Fatal(err) 140 + } 141 + 142 + outb, err := json.Marshal(&fp) 143 + if err != nil { 144 + t.Fatal(err) 145 + } 146 + 147 + fmt.Println(string(outb)) 148 + }