+2
-3
api/atproto/admindefs.go
+2
-3
api/atproto/admindefs.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
)
9
11
10
12
// schema: com.atproto.admin.defs
11
-
12
-
func init() {
13
-
}
14
13
15
14
type AdminDefs_ActionReversal struct {
16
15
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+2
-3
api/atproto/admindisableInviteCodes.go
+2
-3
api/atproto/admindisableInviteCodes.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.disableInviteCodes
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminDisableInviteCodes_Input struct {
15
14
Accounts []string `json:"accounts,omitempty" cborgen:"accounts,omitempty"`
+2
-3
api/atproto/admingetInviteCodes.go
+2
-3
api/atproto/admingetInviteCodes.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.getInviteCodes
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminGetInviteCodes_Output struct {
15
14
Codes []*ServerDefs_InviteCode `json:"codes" cborgen:"codes"`
+2
-2
api/atproto/admingetModerationAction.go
+2
-2
api/atproto/admingetModerationAction.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.admin.getModerationAction
10
12
11
-
func init() {
12
-
}
13
13
func AdminGetModerationAction(ctx context.Context, c *xrpc.Client, id int64) (*AdminDefs_ActionViewDetail, error) {
14
14
var out AdminDefs_ActionViewDetail
15
15
+2
-3
api/atproto/admingetModerationActions.go
+2
-3
api/atproto/admingetModerationActions.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.getModerationActions
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminGetModerationActions_Output struct {
15
14
Actions []*AdminDefs_ActionView `json:"actions" cborgen:"actions"`
+2
-2
api/atproto/admingetModerationReport.go
+2
-2
api/atproto/admingetModerationReport.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.admin.getModerationReport
10
12
11
-
func init() {
12
-
}
13
13
func AdminGetModerationReport(ctx context.Context, c *xrpc.Client, id int64) (*AdminDefs_ReportViewDetail, error) {
14
14
var out AdminDefs_ReportViewDetail
15
15
+2
-3
api/atproto/admingetModerationReports.go
+2
-3
api/atproto/admingetModerationReports.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.getModerationReports
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminGetModerationReports_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-2
api/atproto/admingetRecord.go
+2
-2
api/atproto/admingetRecord.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.admin.getRecord
10
12
11
-
func init() {
12
-
}
13
13
func AdminGetRecord(ctx context.Context, c *xrpc.Client, cid string, uri string) (*AdminDefs_RecordViewDetail, error) {
14
14
var out AdminDefs_RecordViewDetail
15
15
+2
-2
api/atproto/admingetRepo.go
+2
-2
api/atproto/admingetRepo.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.admin.getRepo
10
12
11
-
func init() {
12
-
}
13
13
func AdminGetRepo(ctx context.Context, c *xrpc.Client, did string) (*AdminDefs_RepoViewDetail, error) {
14
14
var out AdminDefs_RepoViewDetail
15
15
+2
-3
api/atproto/adminresolveModerationReports.go
+2
-3
api/atproto/adminresolveModerationReports.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.resolveModerationReports
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminResolveModerationReports_Input struct {
15
14
ActionId int64 `json:"actionId" cborgen:"actionId"`
+2
-3
api/atproto/adminreverseModerationAction.go
+2
-3
api/atproto/adminreverseModerationAction.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.reverseModerationAction
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminReverseModerationAction_Input struct {
15
14
CreatedBy string `json:"createdBy" cborgen:"createdBy"`
+2
-3
api/atproto/adminsearchRepos.go
+2
-3
api/atproto/adminsearchRepos.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.searchRepos
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminSearchRepos_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-3
api/atproto/admintakeModerationAction.go
+2
-3
api/atproto/admintakeModerationAction.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
10
12
)
11
13
12
14
// schema: com.atproto.admin.takeModerationAction
13
-
14
-
func init() {
15
-
}
16
15
17
16
type AdminTakeModerationAction_Input struct {
18
17
Action string `json:"action" cborgen:"action"`
+2
-3
api/atproto/adminupdateAccountEmail.go
+2
-3
api/atproto/adminupdateAccountEmail.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.updateAccountEmail
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminUpdateAccountEmail_Input struct {
15
14
Account string `json:"account" cborgen:"account"`
+2
-3
api/atproto/adminupdateAccountHandle.go
+2
-3
api/atproto/adminupdateAccountHandle.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.admin.updateAccountHandle
10
-
11
-
func init() {
12
-
}
13
12
14
13
type AdminUpdateAccountHandle_Input struct {
15
14
Did string `json:"did" cborgen:"did"`
+2
-3
api/atproto/identityresolveHandle.go
+2
-3
api/atproto/identityresolveHandle.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.identity.resolveHandle
10
-
11
-
func init() {
12
-
}
13
12
14
13
type IdentityResolveHandle_Output struct {
15
14
Did string `json:"did" cborgen:"did"`
+2
-3
api/atproto/identityupdateHandle.go
+2
-3
api/atproto/identityupdateHandle.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.identity.updateHandle
10
-
11
-
func init() {
12
-
}
13
12
14
13
type IdentityUpdateHandle_Input struct {
15
14
Handle string `json:"handle" cborgen:"handle"`
+2
-3
api/atproto/labeldefs.go
+2
-3
api/atproto/labeldefs.go
+2
-3
api/atproto/labelqueryLabels.go
+2
-3
api/atproto/labelqueryLabels.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.label.queryLabels
10
-
11
-
func init() {
12
-
}
13
12
14
13
type LabelQueryLabels_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-3
api/atproto/labelsubscribeLabels.go
+2
-3
api/atproto/labelsubscribeLabels.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
// schema: com.atproto.label.subscribeLabels
4
-
5
-
func init() {
6
-
}
7
6
8
7
type LabelSubscribeLabels_Info struct {
9
8
Message *string `json:"message,omitempty" cborgen:"message,omitempty"`
+2
-3
api/atproto/moderationcreateReport.go
+2
-3
api/atproto/moderationcreateReport.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
10
12
)
11
13
12
14
// schema: com.atproto.moderation.createReport
13
-
14
-
func init() {
15
-
}
16
15
17
16
type ModerationCreateReport_Input struct {
18
17
Reason *string `json:"reason,omitempty" cborgen:"reason,omitempty"`
+2
-3
api/atproto/moderationdefs.go
+2
-3
api/atproto/moderationdefs.go
+2
-3
api/atproto/repoapplyWrites.go
+2
-3
api/atproto/repoapplyWrites.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
10
12
)
11
13
12
14
// schema: com.atproto.repo.applyWrites
13
-
14
-
func init() {
15
-
}
16
15
17
16
// RECORDTYPE: RepoApplyWrites_Create
18
17
type RepoApplyWrites_Create struct {
+2
-3
api/atproto/repocreateRecord.go
+2
-3
api/atproto/repocreateRecord.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
)
9
11
10
12
// schema: com.atproto.repo.createRecord
11
-
12
-
func init() {
13
-
}
14
13
15
14
type RepoCreateRecord_Input struct {
16
15
Collection string `json:"collection" cborgen:"collection"`
+2
-3
api/atproto/repodeleteRecord.go
+2
-3
api/atproto/repodeleteRecord.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.repo.deleteRecord
10
-
11
-
func init() {
12
-
}
13
12
14
13
type RepoDeleteRecord_Input struct {
15
14
Collection string `json:"collection" cborgen:"collection"`
+2
-3
api/atproto/repodescribeRepo.go
+2
-3
api/atproto/repodescribeRepo.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
)
9
11
10
12
// schema: com.atproto.repo.describeRepo
11
-
12
-
func init() {
13
-
}
14
13
15
14
type RepoDescribeRepo_Output struct {
16
15
Collections []string `json:"collections" cborgen:"collections"`
+2
-3
api/atproto/repogetRecord.go
+2
-3
api/atproto/repogetRecord.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
)
9
11
10
12
// schema: com.atproto.repo.getRecord
11
-
12
-
func init() {
13
-
}
14
13
15
14
type RepoGetRecord_Output struct {
16
15
Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
+2
-3
api/atproto/repolistRecords.go
+2
-3
api/atproto/repolistRecords.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
)
9
11
10
12
// schema: com.atproto.repo.listRecords
11
-
12
-
func init() {
13
-
}
14
13
15
14
type RepoListRecords_Output struct {
16
15
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-3
api/atproto/repoputRecord.go
+2
-3
api/atproto/repoputRecord.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
)
9
11
10
12
// schema: com.atproto.repo.putRecord
11
-
12
-
func init() {
13
-
}
14
13
15
14
type RepoPutRecord_Input struct {
16
15
Collection string `json:"collection" cborgen:"collection"`
+3
-3
api/atproto/repostrongRef.go
+3
-3
api/atproto/repostrongRef.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
func init() {
10
12
util.RegisterType("com.atproto.repo.strongRef#main", &RepoStrongRef{})
11
-
}
12
-
13
-
// RECORDTYPE: RepoStrongRef
13
+
} // RECORDTYPE: RepoStrongRef
14
14
type RepoStrongRef struct {
15
15
LexiconTypeID string `json:"$type,const=com.atproto.repo.strongRef,omitempty" cborgen:"$type,const=com.atproto.repo.strongRef,omitempty"`
16
16
Cid string `json:"cid" cborgen:"cid"`
+2
-3
api/atproto/repouploadBlob.go
+2
-3
api/atproto/repouploadBlob.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
9
11
)
10
12
11
13
// schema: com.atproto.repo.uploadBlob
12
-
13
-
func init() {
14
-
}
15
14
16
15
type RepoUploadBlob_Output struct {
17
16
Blob *util.LexBlob `json:"blob" cborgen:"blob"`
+2
-3
api/atproto/servercreateAccount.go
+2
-3
api/atproto/servercreateAccount.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.createAccount
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerCreateAccount_Input struct {
15
14
Email string `json:"email" cborgen:"email"`
+2
-3
api/atproto/servercreateAppPassword.go
+2
-3
api/atproto/servercreateAppPassword.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.createAppPassword
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerCreateAppPassword_AppPassword struct {
15
14
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+2
-3
api/atproto/servercreateInviteCode.go
+2
-3
api/atproto/servercreateInviteCode.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.createInviteCode
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerCreateInviteCode_Input struct {
15
14
ForAccount *string `json:"forAccount,omitempty" cborgen:"forAccount,omitempty"`
+2
-3
api/atproto/servercreateInviteCodes.go
+2
-3
api/atproto/servercreateInviteCodes.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.createInviteCodes
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerCreateInviteCodes_AccountCodes struct {
15
14
Account string `json:"account" cborgen:"account"`
+2
-3
api/atproto/servercreateSession.go
+2
-3
api/atproto/servercreateSession.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.createSession
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerCreateSession_Input struct {
15
14
Identifier string `json:"identifier" cborgen:"identifier"`
+2
-3
api/atproto/serverdefs.go
+2
-3
api/atproto/serverdefs.go
+2
-3
api/atproto/serverdeleteAccount.go
+2
-3
api/atproto/serverdeleteAccount.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.deleteAccount
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerDeleteAccount_Input struct {
15
14
Did string `json:"did" cborgen:"did"`
+2
-2
api/atproto/serverdeleteSession.go
+2
-2
api/atproto/serverdeleteSession.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.server.deleteSession
10
12
11
-
func init() {
12
-
}
13
13
func ServerDeleteSession(ctx context.Context, c *xrpc.Client) error {
14
14
if err := c.Do(ctx, xrpc.Procedure, "", "com.atproto.server.deleteSession", nil, nil, nil); err != nil {
15
15
return err
+2
-3
api/atproto/serverdescribeServer.go
+2
-3
api/atproto/serverdescribeServer.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.describeServer
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerDescribeServer_Links struct {
15
14
PrivacyPolicy *string `json:"privacyPolicy,omitempty" cborgen:"privacyPolicy,omitempty"`
+2
-3
api/atproto/servergetAccountInviteCodes.go
+2
-3
api/atproto/servergetAccountInviteCodes.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.getAccountInviteCodes
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerGetAccountInviteCodes_Output struct {
15
14
Codes []*ServerDefs_InviteCode `json:"codes" cborgen:"codes"`
+2
-3
api/atproto/servergetSession.go
+2
-3
api/atproto/servergetSession.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.getSession
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerGetSession_Output struct {
15
14
Did string `json:"did" cborgen:"did"`
+2
-3
api/atproto/serverlistAppPasswords.go
+2
-3
api/atproto/serverlistAppPasswords.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.listAppPasswords
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerListAppPasswords_AppPassword struct {
15
14
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+2
-3
api/atproto/serverrefreshSession.go
+2
-3
api/atproto/serverrefreshSession.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.refreshSession
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerRefreshSession_Output struct {
15
14
AccessJwt string `json:"accessJwt" cborgen:"accessJwt"`
+2
-2
api/atproto/serverrequestAccountDelete.go
+2
-2
api/atproto/serverrequestAccountDelete.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.server.requestAccountDelete
10
12
11
-
func init() {
12
-
}
13
13
func ServerRequestAccountDelete(ctx context.Context, c *xrpc.Client) error {
14
14
if err := c.Do(ctx, xrpc.Procedure, "", "com.atproto.server.requestAccountDelete", nil, nil, nil); err != nil {
15
15
return err
+2
-3
api/atproto/serverrequestPasswordReset.go
+2
-3
api/atproto/serverrequestPasswordReset.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.requestPasswordReset
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerRequestPasswordReset_Input struct {
15
14
Email string `json:"email" cborgen:"email"`
+2
-3
api/atproto/serverresetPassword.go
+2
-3
api/atproto/serverresetPassword.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.resetPassword
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerResetPassword_Input struct {
15
14
Password string `json:"password" cborgen:"password"`
+2
-3
api/atproto/serverrevokeAppPassword.go
+2
-3
api/atproto/serverrevokeAppPassword.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.server.revokeAppPassword
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ServerRevokeAppPassword_Input struct {
15
14
Name string `json:"name" cborgen:"name"`
+2
-2
api/atproto/syncgetBlob.go
+2
-2
api/atproto/syncgetBlob.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
9
11
10
12
// schema: com.atproto.sync.getBlob
11
13
12
-
func init() {
13
-
}
14
14
func SyncGetBlob(ctx context.Context, c *xrpc.Client, cid string, did string) ([]byte, error) {
15
15
buf := new(bytes.Buffer)
16
16
+2
-2
api/atproto/syncgetBlocks.go
+2
-2
api/atproto/syncgetBlocks.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
9
11
10
12
// schema: com.atproto.sync.getBlocks
11
13
12
-
func init() {
13
-
}
14
14
func SyncGetBlocks(ctx context.Context, c *xrpc.Client, cids []string, did string) ([]byte, error) {
15
15
buf := new(bytes.Buffer)
16
16
+2
-2
api/atproto/syncgetCheckout.go
+2
-2
api/atproto/syncgetCheckout.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
9
11
10
12
// schema: com.atproto.sync.getCheckout
11
13
12
-
func init() {
13
-
}
14
14
func SyncGetCheckout(ctx context.Context, c *xrpc.Client, commit string, did string) ([]byte, error) {
15
15
buf := new(bytes.Buffer)
16
16
+2
-3
api/atproto/syncgetCommitPath.go
+2
-3
api/atproto/syncgetCommitPath.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.sync.getCommitPath
10
-
11
-
func init() {
12
-
}
13
12
14
13
type SyncGetCommitPath_Output struct {
15
14
Commits []string `json:"commits" cborgen:"commits"`
+2
-3
api/atproto/syncgetHead.go
+2
-3
api/atproto/syncgetHead.go
+2
-2
api/atproto/syncgetRecord.go
+2
-2
api/atproto/syncgetRecord.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
9
11
10
12
// schema: com.atproto.sync.getRecord
11
13
12
-
func init() {
13
-
}
14
14
func SyncGetRecord(ctx context.Context, c *xrpc.Client, collection string, commit string, did string, rkey string) ([]byte, error) {
15
15
buf := new(bytes.Buffer)
16
16
+2
-2
api/atproto/syncgetRepo.go
+2
-2
api/atproto/syncgetRepo.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
9
11
10
12
// schema: com.atproto.sync.getRepo
11
13
12
-
func init() {
13
-
}
14
14
func SyncGetRepo(ctx context.Context, c *xrpc.Client, did string, earliest string, latest string) ([]byte, error) {
15
15
buf := new(bytes.Buffer)
16
16
+2
-3
api/atproto/synclistBlobs.go
+2
-3
api/atproto/synclistBlobs.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.sync.listBlobs
10
-
11
-
func init() {
12
-
}
13
12
14
13
type SyncListBlobs_Output struct {
15
14
Cids []string `json:"cids" cborgen:"cids"`
+2
-3
api/atproto/synclistRepos.go
+2
-3
api/atproto/synclistRepos.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: com.atproto.sync.listRepos
10
-
11
-
func init() {
12
-
}
13
12
14
13
type SyncListRepos_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-2
api/atproto/syncnotifyOfUpdate.go
+2
-2
api/atproto/syncnotifyOfUpdate.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.sync.notifyOfUpdate
10
12
11
-
func init() {
12
-
}
13
13
func SyncNotifyOfUpdate(ctx context.Context, c *xrpc.Client, hostname string) error {
14
14
15
15
params := map[string]interface{}{
+2
-2
api/atproto/syncrequestCrawl.go
+2
-2
api/atproto/syncrequestCrawl.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
8
10
9
11
// schema: com.atproto.sync.requestCrawl
10
12
11
-
func init() {
12
-
}
13
13
func SyncRequestCrawl(ctx context.Context, c *xrpc.Client, hostname string) error {
14
14
15
15
params := map[string]interface{}{
+2
-3
api/atproto/syncsubscribeRepos.go
+2
-3
api/atproto/syncsubscribeRepos.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package atproto
2
4
3
5
import (
···
5
7
)
6
8
7
9
// schema: com.atproto.sync.subscribeRepos
8
-
9
-
func init() {
10
-
}
11
10
12
11
type SyncSubscribeRepos_Commit struct {
13
12
Blobs []util.LexLink `json:"blobs" cborgen:"blobs"`
+2
-3
api/bsky/actordefs.go
+2
-3
api/bsky/actordefs.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
5
7
)
6
8
7
9
// schema: app.bsky.actor.defs
8
-
9
-
func init() {
10
-
}
11
10
12
11
type ActorDefs_ProfileView struct {
13
12
Avatar *string `json:"avatar,omitempty" cborgen:"avatar,omitempty"`
+2
-2
api/bsky/actorgetProfile.go
+2
-2
api/bsky/actorgetProfile.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
8
10
9
11
// schema: app.bsky.actor.getProfile
10
12
11
-
func init() {
12
-
}
13
13
func ActorGetProfile(ctx context.Context, c *xrpc.Client, actor string) (*ActorDefs_ProfileViewDetailed, error) {
14
14
var out ActorDefs_ProfileViewDetailed
15
15
+2
-3
api/bsky/actorgetProfiles.go
+2
-3
api/bsky/actorgetProfiles.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.actor.getProfiles
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ActorGetProfiles_Output struct {
15
14
Profiles []*ActorDefs_ProfileViewDetailed `json:"profiles" cborgen:"profiles"`
+2
-3
api/bsky/actorgetSuggestions.go
+2
-3
api/bsky/actorgetSuggestions.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.actor.getSuggestions
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ActorGetSuggestions_Output struct {
15
14
Actors []*ActorDefs_ProfileView `json:"actors" cborgen:"actors"`
+3
-3
api/bsky/actorprofile.go
+3
-3
api/bsky/actorprofile.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
8
10
9
11
func init() {
10
12
util.RegisterType("app.bsky.actor.profile", &ActorProfile{})
11
-
}
12
-
13
-
// RECORDTYPE: ActorProfile
13
+
} // RECORDTYPE: ActorProfile
14
14
type ActorProfile struct {
15
15
LexiconTypeID string `json:"$type,const=app.bsky.actor.profile" cborgen:"$type,const=app.bsky.actor.profile"`
16
16
Avatar *util.LexBlob `json:"avatar,omitempty" cborgen:"avatar,omitempty"`
+2
-3
api/bsky/actorsearchActors.go
+2
-3
api/bsky/actorsearchActors.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.actor.searchActors
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ActorSearchActors_Output struct {
15
14
Actors []*ActorDefs_ProfileView `json:"actors" cborgen:"actors"`
+2
-3
api/bsky/actorsearchActorsTypeahead.go
+2
-3
api/bsky/actorsearchActorsTypeahead.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.actor.searchActorsTypeahead
10
-
11
-
func init() {
12
-
}
13
12
14
13
type ActorSearchActorsTypeahead_Output struct {
15
14
Actors []*ActorDefs_ProfileViewBasic `json:"actors" cborgen:"actors"`
+3
-3
api/bsky/embedexternal.go
+3
-3
api/bsky/embedexternal.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
8
10
9
11
func init() {
10
12
util.RegisterType("app.bsky.embed.external#main", &EmbedExternal{})
11
-
}
12
-
13
-
// RECORDTYPE: EmbedExternal
13
+
} // RECORDTYPE: EmbedExternal
14
14
type EmbedExternal struct {
15
15
LexiconTypeID string `json:"$type,const=app.bsky.embed.external" cborgen:"$type,const=app.bsky.embed.external"`
16
16
External *EmbedExternal_External `json:"external" cborgen:"external"`
+3
-3
api/bsky/embedimages.go
+3
-3
api/bsky/embedimages.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
8
10
9
11
func init() {
10
12
util.RegisterType("app.bsky.embed.images#main", &EmbedImages{})
11
-
}
12
-
13
-
// RECORDTYPE: EmbedImages
13
+
} // RECORDTYPE: EmbedImages
14
14
type EmbedImages struct {
15
15
LexiconTypeID string `json:"$type,const=app.bsky.embed.images" cborgen:"$type,const=app.bsky.embed.images"`
16
16
Images []*EmbedImages_Image `json:"images" cborgen:"images"`
+3
-3
api/bsky/embedrecord.go
+3
-3
api/bsky/embedrecord.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
12
14
13
15
func init() {
14
16
util.RegisterType("app.bsky.embed.record#main", &EmbedRecord{})
15
-
}
16
-
17
-
// RECORDTYPE: EmbedRecord
17
+
} // RECORDTYPE: EmbedRecord
18
18
type EmbedRecord struct {
19
19
LexiconTypeID string `json:"$type,const=app.bsky.embed.record" cborgen:"$type,const=app.bsky.embed.record"`
20
20
Record *comatprototypes.RepoStrongRef `json:"record" cborgen:"record"`
+3
-3
api/bsky/embedrecordWithMedia.go
+3
-3
api/bsky/embedrecordWithMedia.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
14
16
15
17
func init() {
16
18
util.RegisterType("app.bsky.embed.recordWithMedia#main", &EmbedRecordWithMedia{})
17
-
}
18
-
19
-
// RECORDTYPE: EmbedRecordWithMedia
19
+
} // RECORDTYPE: EmbedRecordWithMedia
20
20
type EmbedRecordWithMedia struct {
21
21
LexiconTypeID string `json:"$type,const=app.bsky.embed.recordWithMedia" cborgen:"$type,const=app.bsky.embed.recordWithMedia"`
22
22
Media *EmbedRecordWithMedia_Media `json:"media" cborgen:"media"`
+2
-3
api/bsky/feeddefs.go
+2
-3
api/bsky/feeddefs.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
9
11
)
10
12
11
13
// schema: app.bsky.feed.defs
12
-
13
-
func init() {
14
-
}
15
14
16
15
type FeedDefs_FeedViewPost struct {
17
16
Post *FeedDefs_PostView `json:"post" cborgen:"post"`
+2
-3
api/bsky/feedgetAuthorFeed.go
+2
-3
api/bsky/feedgetAuthorFeed.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.feed.getAuthorFeed
10
-
11
-
func init() {
12
-
}
13
12
14
13
type FeedGetAuthorFeed_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-3
api/bsky/feedgetLikes.go
+2
-3
api/bsky/feedgetLikes.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.feed.getLikes
10
-
11
-
func init() {
12
-
}
13
12
14
13
type FeedGetLikes_Like struct {
15
14
Actor *ActorDefs_ProfileView `json:"actor" cborgen:"actor"`
+2
-3
api/bsky/feedgetPostThread.go
+2
-3
api/bsky/feedgetPostThread.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
10
12
)
11
13
12
14
// schema: app.bsky.feed.getPostThread
13
-
14
-
func init() {
15
-
}
16
15
17
16
type FeedGetPostThread_Output struct {
18
17
Thread *FeedGetPostThread_Output_Thread `json:"thread" cborgen:"thread"`
+28
api/bsky/feedgetPosts.go
+28
api/bsky/feedgetPosts.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
3
+
package bsky
4
+
5
+
import (
6
+
"context"
7
+
8
+
"github.com/bluesky-social/indigo/xrpc"
9
+
)
10
+
11
+
// schema: app.bsky.feed.getPosts
12
+
13
+
type FeedGetPosts_Output struct {
14
+
Posts []*FeedDefs_PostView `json:"posts" cborgen:"posts"`
15
+
}
16
+
17
+
func FeedGetPosts(ctx context.Context, c *xrpc.Client, uris []string) (*FeedGetPosts_Output, error) {
18
+
var out FeedGetPosts_Output
19
+
20
+
params := map[string]interface{}{
21
+
"uris": uris,
22
+
}
23
+
if err := c.Do(ctx, xrpc.Query, "", "app.bsky.feed.getPosts", params, nil, &out); err != nil {
24
+
return nil, err
25
+
}
26
+
27
+
return &out, nil
28
+
}
+2
-3
api/bsky/feedgetRepostedBy.go
+2
-3
api/bsky/feedgetRepostedBy.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.feed.getRepostedBy
10
-
11
-
func init() {
12
-
}
13
12
14
13
type FeedGetRepostedBy_Output struct {
15
14
Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
+2
-3
api/bsky/feedgetTimeline.go
+2
-3
api/bsky/feedgetTimeline.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.feed.getTimeline
10
-
11
-
func init() {
12
-
}
13
12
14
13
type FeedGetTimeline_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+3
-3
api/bsky/feedlike.go
+3
-3
api/bsky/feedlike.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
9
11
10
12
func init() {
11
13
util.RegisterType("app.bsky.feed.like", &FeedLike{})
12
-
}
13
-
14
-
// RECORDTYPE: FeedLike
14
+
} // RECORDTYPE: FeedLike
15
15
type FeedLike struct {
16
16
LexiconTypeID string `json:"$type,const=app.bsky.feed.like" cborgen:"$type,const=app.bsky.feed.like"`
17
17
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+3
-3
api/bsky/feedpost.go
+3
-3
api/bsky/feedpost.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
15
17
16
18
func init() {
17
19
util.RegisterType("app.bsky.feed.post", &FeedPost{})
18
-
}
19
-
20
-
// RECORDTYPE: FeedPost
20
+
} // RECORDTYPE: FeedPost
21
21
type FeedPost struct {
22
22
LexiconTypeID string `json:"$type,const=app.bsky.feed.post" cborgen:"$type,const=app.bsky.feed.post"`
23
23
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+3
-3
api/bsky/feedrepost.go
+3
-3
api/bsky/feedrepost.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
9
11
10
12
func init() {
11
13
util.RegisterType("app.bsky.feed.repost", &FeedRepost{})
12
-
}
13
-
14
-
// RECORDTYPE: FeedRepost
14
+
} // RECORDTYPE: FeedRepost
15
15
type FeedRepost struct {
16
16
LexiconTypeID string `json:"$type,const=app.bsky.feed.repost" cborgen:"$type,const=app.bsky.feed.repost"`
17
17
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+3
-3
api/bsky/graphfollow.go
+3
-3
api/bsky/graphfollow.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
8
10
9
11
func init() {
10
12
util.RegisterType("app.bsky.graph.follow", &GraphFollow{})
11
-
}
12
-
13
-
// RECORDTYPE: GraphFollow
13
+
} // RECORDTYPE: GraphFollow
14
14
type GraphFollow struct {
15
15
LexiconTypeID string `json:"$type,const=app.bsky.graph.follow" cborgen:"$type,const=app.bsky.graph.follow"`
16
16
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
+2
-3
api/bsky/graphgetFollowers.go
+2
-3
api/bsky/graphgetFollowers.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.graph.getFollowers
10
-
11
-
func init() {
12
-
}
13
12
14
13
type GraphGetFollowers_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-3
api/bsky/graphgetFollows.go
+2
-3
api/bsky/graphgetFollows.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.graph.getFollows
10
-
11
-
func init() {
12
-
}
13
12
14
13
type GraphGetFollows_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-3
api/bsky/graphgetMutes.go
+2
-3
api/bsky/graphgetMutes.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.graph.getMutes
10
-
11
-
func init() {
12
-
}
13
12
14
13
type GraphGetMutes_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+2
-3
api/bsky/graphmuteActor.go
+2
-3
api/bsky/graphmuteActor.go
+2
-3
api/bsky/graphunmuteActor.go
+2
-3
api/bsky/graphunmuteActor.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.graph.unmuteActor
10
-
11
-
func init() {
12
-
}
13
12
14
13
type GraphUnmuteActor_Input struct {
15
14
Actor string `json:"actor" cborgen:"actor"`
+2
-3
api/bsky/notificationgetUnreadCount.go
+2
-3
api/bsky/notificationgetUnreadCount.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.notification.getUnreadCount
10
-
11
-
func init() {
12
-
}
13
12
14
13
type NotificationGetUnreadCount_Output struct {
15
14
Count int64 `json:"count" cborgen:"count"`
+2
-3
api/bsky/notificationlistNotifications.go
+2
-3
api/bsky/notificationlistNotifications.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
9
11
)
10
12
11
13
// schema: app.bsky.notification.listNotifications
12
-
13
-
func init() {
14
-
}
15
14
16
15
type NotificationListNotifications_Notification struct {
17
16
Author *ActorDefs_ProfileView `json:"author" cborgen:"author"`
+2
-3
api/bsky/notificationupdateSeen.go
+2
-3
api/bsky/notificationupdateSeen.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.notification.updateSeen
10
-
11
-
func init() {
12
-
}
13
12
14
13
type NotificationUpdateSeen_Input struct {
15
14
SeenAt string `json:"seenAt" cborgen:"seenAt"`
+2
-3
api/bsky/richtextfacet.go
+2
-3
api/bsky/richtextfacet.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
11
13
)
12
14
13
15
// schema: app.bsky.richtext.facet
14
-
15
-
func init() {
16
-
}
17
16
18
17
type RichtextFacet struct {
19
18
Features []*RichtextFacet_Features_Elem `json:"features" cborgen:"features"`
+2
-3
api/bsky/unspeccedgetPopular.go
+2
-3
api/bsky/unspeccedgetPopular.go
···
1
+
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
+
1
3
package bsky
2
4
3
5
import (
···
7
9
)
8
10
9
11
// schema: app.bsky.unspecced.getPopular
10
-
11
-
func init() {
12
-
}
13
12
14
13
type UnspeccedGetPopular_Output struct {
15
14
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
+5
-4
go.mod
+5
-4
go.mod
···
39
39
go.opentelemetry.io/otel/exporters/jaeger v1.14.0
40
40
go.opentelemetry.io/otel/sdk v1.14.0
41
41
golang.org/x/sync v0.1.0
42
+
golang.org/x/tools v0.8.0
42
43
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
43
44
gorm.io/driver/postgres v1.5.0
44
45
gorm.io/driver/sqlite v1.4.4
···
105
106
github.com/prometheus/procfs v0.9.0 // indirect
106
107
github.com/prometheus/statsd_exporter v0.23.1 // indirect
107
108
github.com/russross/blackfriday/v2 v2.1.0 // indirect
108
-
github.com/sashabaranov/go-openai v1.7.0 // indirect
109
109
github.com/spaolacci/murmur3 v1.1.0 // indirect
110
110
github.com/valyala/bytebufferpool v1.0.0 // indirect
111
111
github.com/valyala/fasttemplate v1.2.2 // indirect
···
118
118
go.uber.org/zap v1.24.0 // indirect
119
119
golang.org/x/crypto v0.7.0 // indirect
120
120
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
121
-
golang.org/x/net v0.8.0 // indirect
122
-
golang.org/x/sys v0.6.0 // indirect
123
-
golang.org/x/text v0.8.0 // indirect
121
+
golang.org/x/mod v0.10.0 // indirect
122
+
golang.org/x/net v0.9.0 // indirect
123
+
golang.org/x/sys v0.7.0 // indirect
124
+
golang.org/x/text v0.9.0 // indirect
124
125
golang.org/x/time v0.3.0 // indirect
125
126
google.golang.org/protobuf v1.30.0 // indirect
126
127
gopkg.in/yaml.v2 v2.4.0 // indirect
+10
-7
go.sum
+10
-7
go.sum
···
586
586
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
587
587
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
588
588
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
589
-
github.com/sashabaranov/go-openai v1.7.0 h1:D1dBXoZhtf/aKNu6WFf0c7Ah2NM30PZ/3Mqly6cZ7fk=
590
-
github.com/sashabaranov/go-openai v1.7.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
591
589
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
592
590
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
593
591
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
···
742
740
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
743
741
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
744
742
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
745
-
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
746
743
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
744
+
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
745
+
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
747
746
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
748
747
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
749
748
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
···
785
784
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
786
785
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
787
786
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
788
-
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
789
787
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
788
+
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
789
+
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
790
790
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
791
791
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
792
792
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
···
866
866
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
867
867
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
868
868
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
869
-
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
870
869
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
870
+
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
871
+
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
871
872
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
872
873
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
873
874
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
···
881
882
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
882
883
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
883
884
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
884
-
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
885
885
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
886
+
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
887
+
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
886
888
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
887
889
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
888
890
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
···
936
938
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
937
939
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
938
940
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
939
-
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
940
941
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
942
+
golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y=
943
+
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
941
944
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
942
945
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
943
946
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+159
-148
lex/gen.go
+159
-148
lex/gen.go
···
1
+
// Package lex generates Go code for lexicons.
2
+
//
3
+
// (It is not a lexer.)
1
4
package lex
2
5
3
6
import (
4
7
"bytes"
5
8
"encoding/json"
6
9
"fmt"
7
-
"go/format"
8
10
"html/template"
9
11
"io"
10
12
"os"
11
-
"os/exec"
12
13
"path/filepath"
13
14
"sort"
14
15
"strings"
16
+
17
+
"golang.org/x/tools/imports"
15
18
)
16
19
17
20
const (
···
287
290
}
288
291
}
289
292
293
+
func printerf(w io.Writer) func(format string, args ...any) {
294
+
return func(format string, args ...any) {
295
+
fmt.Fprintf(w, format, args...)
296
+
}
297
+
}
298
+
290
299
func GenCodeForSchema(pkg string, prefix string, fname string, reqcode bool, s *Schema, defmap map[string]*ExtDef, imports map[string]string) error {
291
300
buf := new(bytes.Buffer)
301
+
pf := printerf(buf)
292
302
293
303
s.prefix = prefix
294
304
for _, d := range s.Defs {
295
305
d.prefix = prefix
296
306
}
297
307
298
-
fmt.Fprintf(buf, "package %s\n\n", pkg)
299
-
fmt.Fprintf(buf, "import (\n")
300
-
fmt.Fprintf(buf, "\t\"context\"\n")
301
-
fmt.Fprintf(buf, "\t\"fmt\"\n")
302
-
fmt.Fprintf(buf, "\t\"encoding/json\"\n")
303
-
fmt.Fprintf(buf, "\tcbg \"github.com/whyrusleeping/cbor-gen\"\n")
304
-
fmt.Fprintf(buf, "\t\"github.com/bluesky-social/indigo/xrpc\"\n")
305
-
fmt.Fprintf(buf, "\t\"github.com/bluesky-social/indigo/lex/util\"\n")
308
+
// Add the standard Go generated code header as recognized by GitHub, VS Code, etc.
309
+
// See https://golang.org/s/generatedcode.
310
+
pf("// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.\n\n")
311
+
312
+
pf("package %s\n\n", pkg)
313
+
pf("import (\n")
314
+
pf("\t\"context\"\n")
315
+
pf("\t\"fmt\"\n")
316
+
pf("\t\"encoding/json\"\n")
317
+
pf("\tcbg \"github.com/whyrusleeping/cbor-gen\"\n")
318
+
pf("\t\"github.com/bluesky-social/indigo/xrpc\"\n")
319
+
pf("\t\"github.com/bluesky-social/indigo/lex/util\"\n")
306
320
for k, v := range imports {
307
321
if k != prefix {
308
-
fmt.Fprintf(buf, "\t%s %q\n", importNameForPrefix(k), v)
322
+
pf("\t%s %q\n", importNameForPrefix(k), v)
309
323
}
310
324
}
311
-
fmt.Fprintf(buf, ")\n\n")
312
-
fmt.Fprintf(buf, "// schema: %s\n\n", s.ID)
325
+
pf(")\n\n")
326
+
pf("// schema: %s\n\n", s.ID)
313
327
314
328
tps := s.AllTypes(prefix, defmap)
315
329
···
345
359
}
346
360
347
361
func writeDecoderRegister(w io.Writer, tps []outputType) error {
348
-
fmt.Fprintln(w, "func init() {")
349
-
for _, t := range tps {
362
+
var buf bytes.Buffer
363
+
outf := printerf(&buf)
350
364
365
+
for _, t := range tps {
351
366
if t.Type.needsType && !strings.Contains(t.Name, "_") {
352
367
id := t.Type.id
353
368
if t.Type.defName != "" {
354
369
id = id + "#" + t.Type.defName
355
370
}
356
-
fmt.Fprintf(w, "util.RegisterType(%q, &%s{})\n", id, t.Name)
371
+
if buf.Len() == 0 {
372
+
outf("func init() {\n")
373
+
}
374
+
outf("util.RegisterType(%q, &%s{})\n", id, t.Name)
357
375
}
358
376
}
359
-
fmt.Fprintln(w, "}")
360
-
361
-
return nil
377
+
if buf.Len() == 0 {
378
+
return nil
379
+
}
380
+
outf("}")
381
+
_, err := w.Write(buf.Bytes())
382
+
return err
362
383
}
363
384
364
385
func writeCodeFile(b []byte, fname string) error {
365
-
formatted, err := format.Source(b)
386
+
fixed, err := imports.Process(fname, b, nil)
366
387
if err != nil {
367
-
fmt.Println(string(b))
368
-
return fmt.Errorf("failed to format generated file: %w", err)
369
-
}
370
-
371
-
fixed, err := fixImports(formatted)
372
-
if err != nil {
373
-
return err
388
+
return fmt.Errorf("failed to format output of %q with goimports: %w", fname, err)
374
389
}
375
390
376
391
if err := os.WriteFile(fname, fixed, 0664); err != nil {
···
380
395
return nil
381
396
}
382
397
383
-
func fixImports(b []byte) ([]byte, error) {
384
-
cmd := exec.Command("goimports")
385
-
386
-
cmd.Stdin = bytes.NewReader(b)
387
-
buf := new(bytes.Buffer)
388
-
cmd.Stdout = buf
389
-
390
-
if err := cmd.Run(); err != nil {
391
-
return nil, err
392
-
}
393
-
394
-
return buf.Bytes(), nil
395
-
}
396
-
397
398
func writeMethods(typename string, ts *TypeSchema, w io.Writer) error {
398
399
switch ts.Type {
399
400
case "token":
···
448
449
}
449
450
450
451
func (s *TypeSchema) WriteRPC(w io.Writer, typename string) error {
452
+
pf := printerf(w)
451
453
fname := typename
452
454
453
455
params := "ctx context.Context, c *xrpc.Client"
···
500
502
}
501
503
}
502
504
503
-
fmt.Fprintf(w, "func %s(%s) %s {\n", fname, params, out)
505
+
pf("func %s(%s) %s {\n", fname, params, out)
504
506
505
507
outvar := "nil"
506
508
errRet := "err"
···
508
510
if s.Output != nil {
509
511
switch s.Output.Encoding {
510
512
case EncodingCBOR, EncodingCAR, EncodingANY:
511
-
fmt.Fprintf(w, "buf := new(bytes.Buffer)\n")
513
+
pf("buf := new(bytes.Buffer)\n")
512
514
outvar = "buf"
513
515
errRet = "nil, err"
514
516
outRet = "buf.Bytes(), nil"
···
517
519
if s.Output.Schema.Type == "ref" {
518
520
outname = s.typeNameFromRef(s.Output.Schema.Ref)
519
521
}
520
-
fmt.Fprintf(w, "\tvar out %s\n", outname)
522
+
pf("\tvar out %s\n", outname)
521
523
outvar = "&out"
522
524
errRet = "nil, err"
523
525
outRet = "&out, nil"
···
529
531
queryparams := "nil"
530
532
if s.Parameters != nil {
531
533
queryparams = "params"
532
-
fmt.Fprintf(w, `
534
+
pf(`
533
535
params := map[string]interface{}{
534
536
`)
535
537
if err := orderedMapIter[*TypeSchema](s.Parameters.Properties, func(name string, t *TypeSchema) error {
536
-
fmt.Fprintf(w, `"%s": %s,
538
+
pf(`"%s": %s,
537
539
`, name, name)
538
540
return nil
539
541
}); err != nil {
540
542
return err
541
543
}
542
-
fmt.Fprintf(w, "}\n")
544
+
pf("}\n")
543
545
}
544
546
545
547
var reqtype string
···
552
554
return fmt.Errorf("can only generate RPC for Query or Procedure (got %s)", s.Type)
553
555
}
554
556
555
-
fmt.Fprintf(w, "\tif err := c.Do(ctx, %s, %q, \"%s\", %s, %s, %s); err != nil {\n", reqtype, inpenc, s.id, queryparams, inpvar, outvar)
556
-
fmt.Fprintf(w, "\t\treturn %s\n", errRet)
557
-
fmt.Fprintf(w, "\t}\n\n")
558
-
fmt.Fprintf(w, "\treturn %s\n", outRet)
559
-
fmt.Fprintf(w, "}\n\n")
557
+
pf("\tif err := c.Do(ctx, %s, %q, \"%s\", %s, %s, %s); err != nil {\n", reqtype, inpenc, s.id, queryparams, inpvar, outvar)
558
+
pf("\t\treturn %s\n", errRet)
559
+
pf("\t}\n\n")
560
+
pf("\treturn %s\n", outRet)
561
+
pf("}\n\n")
560
562
561
563
return nil
562
564
}
···
606
608
}
607
609
608
610
func WriteServerHandlers(w io.Writer, schemas []*Schema, pkg string, impmap map[string]string) error {
609
-
fmt.Fprintf(w, "package %s\n\n", pkg)
610
-
fmt.Fprintf(w, "import (\n")
611
-
fmt.Fprintf(w, "\t\"context\"\n")
612
-
fmt.Fprintf(w, "\t\"fmt\"\n")
613
-
fmt.Fprintf(w, "\t\"encoding/json\"\n")
614
-
fmt.Fprintf(w, "\t\"github.com/bluesky-social/indigo/xrpc\"\n")
611
+
pf := printerf(w)
612
+
pf("package %s\n\n", pkg)
613
+
pf("import (\n")
614
+
pf("\t\"context\"\n")
615
+
pf("\t\"fmt\"\n")
616
+
pf("\t\"encoding/json\"\n")
617
+
pf("\t\"github.com/bluesky-social/indigo/xrpc\"\n")
615
618
for k, v := range impmap {
616
-
fmt.Fprintf(w, "\t%s\"%s\"\n", importNameForPrefix(k), v)
619
+
pf("\t%s\"%s\"\n", importNameForPrefix(k), v)
617
620
}
618
-
fmt.Fprintf(w, ")\n\n")
621
+
pf(")\n\n")
619
622
620
623
for _, s := range schemas {
621
624
···
647
650
}
648
651
649
652
func WriteXrpcServer(w io.Writer, schemas []*Schema, pkg string, impmap map[string]string) error {
650
-
fmt.Fprintf(w, "package %s\n\n", pkg)
651
-
fmt.Fprintf(w, "import (\n")
652
-
fmt.Fprintf(w, "\t\"context\"\n")
653
-
fmt.Fprintf(w, "\t\"fmt\"\n")
654
-
fmt.Fprintf(w, "\t\"encoding/json\"\n")
655
-
fmt.Fprintf(w, "\t\"github.com/bluesky-social/indigo/xrpc\"\n")
656
-
fmt.Fprintf(w, "\t\"github.com/labstack/echo/v4\"\n")
653
+
pf := printerf(w)
654
+
pf("package %s\n\n", pkg)
655
+
pf("import (\n")
656
+
pf("\t\"context\"\n")
657
+
pf("\t\"fmt\"\n")
658
+
pf("\t\"encoding/json\"\n")
659
+
pf("\t\"github.com/bluesky-social/indigo/xrpc\"\n")
660
+
pf("\t\"github.com/labstack/echo/v4\"\n")
657
661
658
662
var prefixes []string
659
663
orderedMapIter[string](impmap, func(k, v string) error {
660
664
prefixes = append(prefixes, k)
661
-
fmt.Fprintf(w, "\t%s\"%s\"\n", importNameForPrefix(k), v)
665
+
pf("\t%s\"%s\"\n", importNameForPrefix(k), v)
662
666
return nil
663
667
})
664
-
fmt.Fprintf(w, ")\n\n")
668
+
pf(")\n\n")
665
669
666
670
ssets := make(map[string][]*Schema)
667
671
for _, s := range schemas {
···
682
686
for _, p := range prefixes {
683
687
ss := ssets[p]
684
688
685
-
fmt.Fprintf(w, "func (s *Server) RegisterHandlers%s(e *echo.Echo) error {\n", idToTitle(p))
689
+
pf("func (s *Server) RegisterHandlers%s(e *echo.Echo) error {\n", idToTitle(p))
686
690
for _, s := range ss {
687
691
688
692
main, ok := s.Defs["main"]
···
700
704
continue
701
705
}
702
706
703
-
fmt.Fprintf(w, "e.%s(\"/xrpc/%s\", s.Handle%s)\n", verb, s.ID, idToTitle(s.ID))
707
+
pf("e.%s(\"/xrpc/%s\", s.Handle%s)\n", verb, s.ID, idToTitle(s.ID))
704
708
}
705
709
706
-
fmt.Fprintf(w, "return nil\n}\n\n")
710
+
pf("return nil\n}\n\n")
707
711
708
712
for _, s := range ss {
709
713
···
743
747
}
744
748
745
749
func (s *TypeSchema) WriteHandlerStub(w io.Writer, fname, shortname, impname string) error {
750
+
pf := printerf(w)
746
751
paramtypes := []string{"ctx context.Context"}
747
752
if s.Type == "query" {
748
753
···
802
807
}
803
808
}
804
809
805
-
fmt.Fprintf(w, "func (s *Server) handle%s(%s) %s {\n", fname, strings.Join(paramtypes, ","), returndef)
806
-
fmt.Fprintf(w, "panic(\"not yet implemented\")\n}\n\n")
810
+
pf("func (s *Server) handle%s(%s) %s {\n", fname, strings.Join(paramtypes, ","), returndef)
811
+
pf("panic(\"not yet implemented\")\n}\n\n")
807
812
808
813
return nil
809
814
}
810
815
811
816
func (s *TypeSchema) WriteRPCHandler(w io.Writer, fname, shortname, impname string) error {
817
+
pf := printerf(w)
812
818
tname := shortname
813
819
814
-
fmt.Fprintf(w, "func (s *Server) Handle%s(c echo.Context) error {\n", fname)
820
+
pf("func (s *Server) Handle%s(c echo.Context) error {\n", fname)
815
821
816
-
fmt.Fprintf(w, "ctx, span := otel.Tracer(\"server\").Start(c.Request().Context(), %q)\n", "Handle"+fname)
817
-
fmt.Fprintf(w, "defer span.End()\n")
822
+
pf("ctx, span := otel.Tracer(\"server\").Start(c.Request().Context(), %q)\n", "Handle"+fname)
823
+
pf("defer span.End()\n")
818
824
819
825
paramtypes := []string{"ctx context.Context"}
820
826
params := []string{"ctx"}
···
835
841
case "string":
836
842
params = append(params, k)
837
843
paramtypes = append(paramtypes, k+" string")
838
-
fmt.Fprintf(w, "%s := c.QueryParam(\"%s\")\n", k, k)
844
+
pf("%s := c.QueryParam(\"%s\")\n", k, k)
839
845
case "integer":
840
846
params = append(params, k)
841
847
842
848
if !required[k] {
843
849
paramtypes = append(paramtypes, k+" *int")
844
-
fmt.Fprintf(w, `
850
+
pf(`
845
851
var %s *int
846
852
if p := c.QueryParam("%s"); p != "" {
847
853
%s_val, err := strconv.Atoi(p)
···
853
859
`, k, k, k, k, k)
854
860
} else if t.Default != nil {
855
861
paramtypes = append(paramtypes, k+" int")
856
-
fmt.Fprintf(w, `
862
+
pf(`
857
863
var %s int
858
864
if p := c.QueryParam("%s"); p != "" {
859
865
var err error
···
868
874
} else {
869
875
870
876
paramtypes = append(paramtypes, k+" int")
871
-
fmt.Fprintf(w, `
877
+
pf(`
872
878
%s, err := strconv.Atoi(c.QueryParam("%s"))
873
879
if err != nil {
874
880
return err
···
882
888
params = append(params, k)
883
889
if !required[k] {
884
890
paramtypes = append(paramtypes, k+" *bool")
885
-
fmt.Fprintf(w, `
891
+
pf(`
886
892
var %s *bool
887
893
if p := c.QueryParam("%s"); p != "" {
888
894
%s_val, err := strconv.ParseBool(p)
···
894
900
`, k, k, k, k, k)
895
901
} else if t.Default != nil {
896
902
paramtypes = append(paramtypes, k+" bool")
897
-
fmt.Fprintf(w, `
903
+
pf(`
898
904
var %s bool
899
905
if p := c.QueryParam("%s"); p != "" {
900
906
var err error
···
909
915
} else {
910
916
911
917
paramtypes = append(paramtypes, k+" bool")
912
-
fmt.Fprintf(w, `
918
+
pf(`
913
919
%s, err := strconv.ParseBool(c.QueryParam("%s"))
914
920
if err != nil {
915
921
return err
···
923
929
}
924
930
paramtypes = append(paramtypes, k+" []string")
925
931
params = append(params, k)
926
-
fmt.Fprintf(w, `
932
+
pf(`
927
933
%s := c.QueryParams()["%s"]
928
934
`, k, k)
929
935
···
940
946
intname := impname + "." + tname + "_Input"
941
947
switch s.Input.Encoding {
942
948
case EncodingJSON:
943
-
fmt.Fprintf(w, `
949
+
pf(`
944
950
var body %s
945
951
if err := c.Bind(&body); err != nil {
946
952
return err
···
949
955
paramtypes = append(paramtypes, "body *"+intname)
950
956
params = append(params, "&body")
951
957
case EncodingCBOR:
952
-
fmt.Fprintf(w, "body := c.Request().Body\n")
958
+
pf("body := c.Request().Body\n")
953
959
paramtypes = append(paramtypes, "r io.Reader")
954
960
params = append(params, "body")
955
961
case EncodingANY:
956
-
fmt.Fprintf(w, "body := c.Request().Body\n")
957
-
fmt.Fprintf(w, "contentType := c.Request().Header.Get(\"Content-Type\")\n")
962
+
pf("body := c.Request().Body\n")
963
+
pf("contentType := c.Request().Header.Get(\"Content-Type\")\n")
958
964
paramtypes = append(paramtypes, "r io.Reader", "contentType string")
959
965
params = append(params, "body", "contentType")
960
966
···
976
982
if s.Output.Schema.Type == "ref" {
977
983
outname = s.typeNameFromRef(s.Output.Schema.Ref)
978
984
}
979
-
fmt.Fprintf(w, "var out *%s.%s\n", impname, outname)
985
+
pf("var out *%s.%s\n", impname, outname)
980
986
returndef = fmt.Sprintf("(*%s.%s, error)", impname, outname)
981
987
case EncodingCBOR, EncodingCAR, EncodingANY:
982
988
assign = "out, handleErr"
983
-
fmt.Fprintf(w, "var out io.Reader\n")
989
+
pf("var out io.Reader\n")
984
990
returndef = "(io.Reader, error)"
985
991
default:
986
992
return fmt.Errorf("unrecognized output encoding (RPC output handler): %q", s.Output.Encoding)
987
993
}
988
994
}
989
-
fmt.Fprintf(w, "var handleErr error\n")
990
-
fmt.Fprintf(w, "// func (s *Server) handle%s(%s) %s\n", fname, strings.Join(paramtypes, ","), returndef)
991
-
fmt.Fprintf(w, "%s = s.handle%s(%s)\n", assign, fname, strings.Join(params, ","))
992
-
fmt.Fprintf(w, "if handleErr != nil {\nreturn handleErr\n}\n")
995
+
pf("var handleErr error\n")
996
+
pf("// func (s *Server) handle%s(%s) %s\n", fname, strings.Join(paramtypes, ","), returndef)
997
+
pf("%s = s.handle%s(%s)\n", assign, fname, strings.Join(params, ","))
998
+
pf("if handleErr != nil {\nreturn handleErr\n}\n")
993
999
994
1000
if s.Output != nil {
995
1001
switch s.Output.Encoding {
996
1002
case EncodingJSON:
997
-
fmt.Fprintf(w, "return c.JSON(200, out)\n}\n\n")
1003
+
pf("return c.JSON(200, out)\n}\n\n")
998
1004
case EncodingANY:
999
-
fmt.Fprintf(w, "return c.Stream(200, \"application/octet-stream\", out)\n}\n\n")
1005
+
pf("return c.Stream(200, \"application/octet-stream\", out)\n}\n\n")
1000
1006
case EncodingCBOR:
1001
-
fmt.Fprintf(w, "return c.Stream(200, \"application/octet-stream\", out)\n}\n\n")
1007
+
pf("return c.Stream(200, \"application/octet-stream\", out)\n}\n\n")
1002
1008
case EncodingCAR:
1003
-
fmt.Fprintf(w, "return c.Stream(200, \"application/vnd.ipld.car\", out)\n}\n\n")
1009
+
pf("return c.Stream(200, \"application/vnd.ipld.car\", out)\n}\n\n")
1004
1010
default:
1005
1011
return fmt.Errorf("unrecognized output encoding (RPC output handler return): %q", s.Output.Encoding)
1006
1012
}
1007
1013
} else {
1008
-
fmt.Fprintf(w, "return nil\n}\n\n")
1014
+
pf("return nil\n}\n\n")
1009
1015
}
1010
1016
1011
1017
return nil
···
1122
1128
}
1123
1129
1124
1130
func (ts *TypeSchema) writeTypeDefinition(name string, w io.Writer) error {
1131
+
pf := printerf(w)
1125
1132
switch ts.Type {
1126
1133
case "string":
1127
1134
// TODO: deal with max length
1128
-
fmt.Fprintf(w, "type %s string\n", name)
1135
+
pf("type %s string\n", name)
1129
1136
case "float":
1130
-
fmt.Fprintf(w, "type %s float64\n", name)
1137
+
pf("type %s float64\n", name)
1131
1138
case "integer":
1132
-
fmt.Fprintf(w, "type %s int64\n", name)
1139
+
pf("type %s int64\n", name)
1133
1140
case "boolean":
1134
-
fmt.Fprintf(w, "type %s bool\n", name)
1141
+
pf("type %s bool\n", name)
1135
1142
case "object":
1136
1143
if len(ts.Properties) == 0 {
1137
-
fmt.Fprintf(w, "type %s interface{}\n", name)
1144
+
pf("type %s interface{}\n", name)
1138
1145
return nil
1139
1146
}
1140
1147
1141
1148
if ts.needsType {
1142
-
fmt.Fprintf(w, "// RECORDTYPE: %s\n", name)
1149
+
pf("// RECORDTYPE: %s\n", name)
1143
1150
}
1144
1151
1145
-
fmt.Fprintf(w, "type %s struct {\n", name)
1152
+
pf("type %s struct {\n", name)
1146
1153
1147
1154
if ts.needsType {
1148
1155
var omit string
1149
1156
if ts.id == "com.atproto.repo.strongRef" { // TODO: hack
1150
1157
omit = ",omitempty"
1151
1158
}
1152
-
fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,const=%s%s\" cborgen:\"$type,const=%s%s\"`\n", ts.id, omit, ts.id, omit)
1159
+
pf("\tLexiconTypeID string `json:\"$type,const=%s%s\" cborgen:\"$type,const=%s%s\"`\n", ts.id, omit, ts.id, omit)
1153
1160
} else {
1154
-
//fmt.Fprintf(w, "\tLexiconTypeID string `json:\"$type,omitempty\" cborgen:\"$type,omitempty\"`\n")
1161
+
//pf("\tLexiconTypeID string `json:\"$type,omitempty\" cborgen:\"$type,omitempty\"`\n")
1155
1162
}
1156
1163
1157
1164
required := make(map[string]bool)
···
1195
1202
jsonOmit = ",omitempty"
1196
1203
}
1197
1204
1198
-
fmt.Fprintf(w, "\t%s %s%s `json:\"%s%s\" cborgen:\"%s%s\"`\n", goname, ptr, tname, k, jsonOmit, k, cborOmit)
1205
+
pf("\t%s %s%s `json:\"%s%s\" cborgen:\"%s%s\"`\n", goname, ptr, tname, k, jsonOmit, k, cborOmit)
1199
1206
return nil
1200
1207
}); err != nil {
1201
1208
return err
1202
1209
}
1203
1210
1204
-
fmt.Fprintf(w, "}\n\n")
1211
+
pf("}\n\n")
1205
1212
1206
1213
case "array":
1207
1214
tname, err := ts.typeNameForField(name, "elem", *ts.Items)
···
1209
1216
return err
1210
1217
}
1211
1218
1212
-
fmt.Fprintf(w, "type %s []%s\n", name, tname)
1219
+
pf("type %s []%s\n", name, tname)
1213
1220
1214
1221
case "union":
1215
1222
if len(ts.Refs) > 0 {
1216
-
fmt.Fprintf(w, "type %s struct {\n", name)
1223
+
pf("type %s struct {\n", name)
1217
1224
for _, r := range ts.Refs {
1218
1225
tname := ts.typeNameFromRef(r)
1219
-
fmt.Fprintf(w, "\t%s *%s\n", tname, tname)
1226
+
pf("\t%s *%s\n", tname, tname)
1220
1227
}
1221
-
fmt.Fprintf(w, "}\n\n")
1228
+
pf("}\n\n")
1222
1229
}
1223
1230
default:
1224
1231
return fmt.Errorf("%s has unrecognized type type %s", name, ts.Type)
···
1302
1309
}
1303
1310
1304
1311
func (ts *TypeSchema) writeJsonMarshalerEnum(name string, w io.Writer) error {
1305
-
fmt.Fprintf(w, "func (t *%s) MarshalJSON() ([]byte, error) {\n", name)
1312
+
pf := printerf(w)
1313
+
pf("func (t *%s) MarshalJSON() ([]byte, error) {\n", name)
1306
1314
1307
1315
for _, e := range ts.Refs {
1308
1316
tname := ts.typeNameFromRef(e)
···
1310
1318
e = ts.id + e
1311
1319
}
1312
1320
1313
-
fmt.Fprintf(w, "\tif t.%s != nil {\n", tname)
1314
-
fmt.Fprintf(w, "\tt.%s.LexiconTypeID = %q\n", tname, e)
1315
-
fmt.Fprintf(w, "\t\treturn json.Marshal(t.%s)\n\t}\n", tname)
1321
+
pf("\tif t.%s != nil {\n", tname)
1322
+
pf("\tt.%s.LexiconTypeID = %q\n", tname, e)
1323
+
pf("\t\treturn json.Marshal(t.%s)\n\t}\n", tname)
1316
1324
}
1317
1325
1318
-
fmt.Fprintf(w, "\treturn nil, fmt.Errorf(\"cannot marshal empty enum\")\n}\n")
1326
+
pf("\treturn nil, fmt.Errorf(\"cannot marshal empty enum\")\n}\n")
1319
1327
return nil
1320
1328
}
1321
1329
1322
1330
func (s *TypeSchema) writeJsonUnmarshalerObject(name string, w io.Writer) error {
1323
1331
// TODO: would be nice to add some validation...
1324
1332
return nil
1325
-
//fmt.Fprintf(w, "func (t *%s) UnmarshalJSON(b []byte) (error) {\n", name)
1333
+
//pf("func (t *%s) UnmarshalJSON(b []byte) (error) {\n", name)
1326
1334
}
1327
1335
1328
1336
func (ts *TypeSchema) getTypeConstValueForType(ref string) (any, error) {
···
1340
1348
}
1341
1349
1342
1350
func (ts *TypeSchema) writeJsonUnmarshalerEnum(name string, w io.Writer) error {
1343
-
fmt.Fprintf(w, "func (t *%s) UnmarshalJSON(b []byte) (error) {\n", name)
1344
-
fmt.Fprintf(w, "\ttyp, err := util.TypeExtract(b)\n")
1345
-
fmt.Fprintf(w, "\tif err != nil {\n\t\treturn err\n\t}\n\n")
1346
-
fmt.Fprintf(w, "\tswitch typ {\n")
1351
+
pf := printerf(w)
1352
+
pf("func (t *%s) UnmarshalJSON(b []byte) (error) {\n", name)
1353
+
pf("\ttyp, err := util.TypeExtract(b)\n")
1354
+
pf("\tif err != nil {\n\t\treturn err\n\t}\n\n")
1355
+
pf("\tswitch typ {\n")
1347
1356
for _, e := range ts.Refs {
1348
1357
if strings.HasPrefix(e, "#") {
1349
1358
e = ts.id + e
···
1351
1360
1352
1361
goname := ts.typeNameFromRef(e)
1353
1362
1354
-
fmt.Fprintf(w, "\t\tcase \"%s\":\n", e)
1355
-
fmt.Fprintf(w, "\t\t\tt.%s = new(%s)\n", goname, goname)
1356
-
fmt.Fprintf(w, "\t\t\treturn json.Unmarshal(b, t.%s)\n", goname)
1363
+
pf("\t\tcase \"%s\":\n", e)
1364
+
pf("\t\t\tt.%s = new(%s)\n", goname, goname)
1365
+
pf("\t\t\treturn json.Unmarshal(b, t.%s)\n", goname)
1357
1366
}
1358
1367
1359
1368
if ts.Closed {
1360
-
fmt.Fprintf(w, `
1369
+
pf(`
1361
1370
default:
1362
1371
return fmt.Errorf("closed enums must have a matching value")
1363
1372
`)
1364
1373
} else {
1365
-
fmt.Fprintf(w, `
1374
+
pf(`
1366
1375
default:
1367
1376
return nil
1368
1377
`)
1369
1378
1370
1379
}
1371
1380
1372
-
fmt.Fprintf(w, "\t}\n")
1373
-
fmt.Fprintf(w, "}\n\n")
1381
+
pf("\t}\n")
1382
+
pf("}\n\n")
1374
1383
1375
1384
return nil
1376
1385
}
1377
1386
1378
1387
func (ts *TypeSchema) writeCborMarshalerEnum(name string, w io.Writer) error {
1379
-
fmt.Fprintf(w, "func (t *%s) MarshalCBOR(w io.Writer) error {\n", name)
1380
-
fmt.Fprintf(w, `
1388
+
pf := printerf(w)
1389
+
pf("func (t *%s) MarshalCBOR(w io.Writer) error {\n", name)
1390
+
pf(`
1381
1391
if t == nil {
1382
1392
_, err := w.Write(cbg.CborNull)
1383
1393
return err
···
1386
1396
1387
1397
for _, e := range ts.Refs {
1388
1398
tname := ts.typeNameFromRef(e)
1389
-
fmt.Fprintf(w, "\tif t.%s != nil {\n", tname)
1390
-
fmt.Fprintf(w, "\t\treturn t.%s.MarshalCBOR(w)\n\t}\n", tname)
1399
+
pf("\tif t.%s != nil {\n", tname)
1400
+
pf("\t\treturn t.%s.MarshalCBOR(w)\n\t}\n", tname)
1391
1401
}
1392
1402
1393
-
fmt.Fprintf(w, "\treturn fmt.Errorf(\"cannot cbor marshal empty enum\")\n}\n")
1403
+
pf("\treturn fmt.Errorf(\"cannot cbor marshal empty enum\")\n}\n")
1394
1404
return nil
1395
1405
}
1396
1406
1397
1407
func (ts *TypeSchema) writeCborUnmarshalerEnum(name string, w io.Writer) error {
1398
-
fmt.Fprintf(w, "func (t *%s) UnmarshalCBOR(r io.Reader) error {\n", name)
1399
-
fmt.Fprintf(w, "\ttyp, b, err := util.CborTypeExtractReader(r)\n")
1400
-
fmt.Fprintf(w, "\tif err != nil {\n\t\treturn err\n\t}\n\n")
1401
-
fmt.Fprintf(w, "\tswitch typ {\n")
1408
+
pf := printerf(w)
1409
+
pf("func (t *%s) UnmarshalCBOR(r io.Reader) error {\n", name)
1410
+
pf("\ttyp, b, err := util.CborTypeExtractReader(r)\n")
1411
+
pf("\tif err != nil {\n\t\treturn err\n\t}\n\n")
1412
+
pf("\tswitch typ {\n")
1402
1413
for _, e := range ts.Refs {
1403
1414
if strings.HasPrefix(e, "#") {
1404
1415
e = ts.id + e
···
1406
1417
1407
1418
goname := ts.typeNameFromRef(e)
1408
1419
1409
-
fmt.Fprintf(w, "\t\tcase \"%s\":\n", e)
1410
-
fmt.Fprintf(w, "\t\t\tt.%s = new(%s)\n", goname, goname)
1411
-
fmt.Fprintf(w, "\t\t\treturn t.%s.UnmarshalCBOR(bytes.NewReader(b))\n", goname)
1420
+
pf("\t\tcase \"%s\":\n", e)
1421
+
pf("\t\t\tt.%s = new(%s)\n", goname, goname)
1422
+
pf("\t\t\treturn t.%s.UnmarshalCBOR(bytes.NewReader(b))\n", goname)
1412
1423
}
1413
1424
1414
1425
if ts.Closed {
1415
-
fmt.Fprintf(w, `
1426
+
pf(`
1416
1427
default:
1417
1428
return fmt.Errorf("closed enums must have a matching value")
1418
1429
`)
1419
1430
} else {
1420
-
fmt.Fprintf(w, `
1431
+
pf(`
1421
1432
default:
1422
1433
return nil
1423
1434
`)
1424
1435
1425
1436
}
1426
1437
1427
-
fmt.Fprintf(w, "\t}\n")
1428
-
fmt.Fprintf(w, "}\n\n")
1438
+
pf("\t}\n")
1439
+
pf("}\n\n")
1429
1440
1430
1441
return nil
1431
1442
}