From baa5ab4fa3cba765f340e3962aba0a2fd8330fd7 Mon Sep 17 00:00:00 2001 From: Lewis Date: Tue, 2 Jun 2026 11:58:45 +0300 Subject: [PATCH] lexicons: knot-owned endpoints Lewis: May this revision serve well! --- api/tangled/knotaddMember.go | 30 +++++++++ api/tangled/knotlistMembers.go | 61 +++++++++++++++++++ api/tangled/knotlistMembersBy.go | 47 ++++++++++++++ api/tangled/knotremoveMember.go | 30 +++++++++ api/tangled/repoaddCollaborator.go | 32 ++++++++++ api/tangled/repolistCollaborators.go | 61 +++++++++++++++++++ api/tangled/repolistCollaboratorsBy.go | 47 ++++++++++++++ api/tangled/reporemoveCollaborator.go | 32 ++++++++++ lexicons/knot/addMember.json | 26 ++++++++ .../knot/listMembers.json | 31 ++++++++-- .../knot/listMembersBy.json | 0 lexicons/knot/removeMember.json | 26 ++++++++ lexicons/repo/addCollaborator.json | 32 ++++++++++ .../repo/listCollaborators.json | 31 ++++++++-- .../repo/listCollaboratorsBy.json | 0 lexicons/repo/removeCollaborator.json | 32 ++++++++++ 16 files changed, 506 insertions(+), 12 deletions(-) create mode 100644 api/tangled/knotaddMember.go create mode 100644 api/tangled/knotlistMembers.go create mode 100644 api/tangled/knotlistMembersBy.go create mode 100644 api/tangled/knotremoveMember.go create mode 100644 api/tangled/repoaddCollaborator.go create mode 100644 api/tangled/repolistCollaborators.go create mode 100644 api/tangled/repolistCollaboratorsBy.go create mode 100644 api/tangled/reporemoveCollaborator.go create mode 100644 lexicons/knot/addMember.json rename {bobbin/crates/types/lexicons => lexicons}/knot/listMembers.json (62%) rename {bobbin/crates/types/lexicons => lexicons}/knot/listMembersBy.json (100%) create mode 100644 lexicons/knot/removeMember.json create mode 100644 lexicons/repo/addCollaborator.json rename {bobbin/crates/types/lexicons => lexicons}/repo/listCollaborators.json (62%) rename {bobbin/crates/types/lexicons => lexicons}/repo/listCollaboratorsBy.json (100%) create mode 100644 lexicons/repo/removeCollaborator.json diff --git a/api/tangled/knotaddMember.go b/api/tangled/knotaddMember.go new file mode 100644 index 00000000..9996c4a6 --- /dev/null +++ b/api/tangled/knotaddMember.go @@ -0,0 +1,30 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.knot.addMember + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + KnotAddMemberNSID = "sh.tangled.knot.addMember" +) + +// KnotAddMember_Input is the input argument to a sh.tangled.knot.addMember call. +type KnotAddMember_Input struct { + // subject: DID of the member to add + Subject string `json:"subject" cborgen:"subject"` +} + +// KnotAddMember calls the XRPC method "sh.tangled.knot.addMember". +func KnotAddMember(ctx context.Context, c util.LexClient, input *KnotAddMember_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.knot.addMember", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/knotlistMembers.go b/api/tangled/knotlistMembers.go new file mode 100644 index 00000000..77f111c3 --- /dev/null +++ b/api/tangled/knotlistMembers.go @@ -0,0 +1,61 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.knot.listMembers + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + KnotListMembersNSID = "sh.tangled.knot.listMembers" +) + +// KnotListMembers_ListItem is a "listItem" in the sh.tangled.knot.listMembers schema. +type KnotListMembers_ListItem struct { + // addedBy: DID that added this member + AddedBy string `json:"addedBy" cborgen:"addedBy"` + // cid: Optional record CID for record-backed indexers + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + // createdAt: When the member was added + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // subject: DID of the member + Subject string `json:"subject" cborgen:"subject"` + // uri: Optional record AT-URI for record-backed indexers + Uri *string `json:"uri,omitempty" cborgen:"uri,omitempty"` +} + +// KnotListMembers_Output is the output of a sh.tangled.knot.listMembers call. +type KnotListMembers_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Items []*KnotListMembers_ListItem `json:"items" cborgen:"items"` +} + +// KnotListMembers calls the XRPC method "sh.tangled.knot.listMembers". +// +// cursor: Pagination cursor +// order: Sort direction by createdAt. +// subject: Knot identifier whose member records to list. +func KnotListMembers(ctx context.Context, c util.LexClient, cursor string, limit int64, order string, subject string) (*KnotListMembers_Output, error) { + var out KnotListMembers_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + if order != "" { + params["order"] = order + } + params["subject"] = subject + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.knot.listMembers", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/knotlistMembersBy.go b/api/tangled/knotlistMembersBy.go new file mode 100644 index 00000000..114f3d4c --- /dev/null +++ b/api/tangled/knotlistMembersBy.go @@ -0,0 +1,47 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.knot.listMembersBy + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + KnotListMembersByNSID = "sh.tangled.knot.listMembersBy" +) + +// KnotListMembersBy_Output is the output of a sh.tangled.knot.listMembersBy call. +type KnotListMembersBy_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Items []*KnotListMembers_ListItem `json:"items" cborgen:"items"` +} + +// KnotListMembersBy calls the XRPC method "sh.tangled.knot.listMembersBy". +// +// cursor: Pagination cursor +// order: Sort direction by createdAt. +// subject: Actor DID whose knot-member authorings to list. +func KnotListMembersBy(ctx context.Context, c util.LexClient, cursor string, limit int64, order string, subject string) (*KnotListMembersBy_Output, error) { + var out KnotListMembersBy_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + if order != "" { + params["order"] = order + } + params["subject"] = subject + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.knot.listMembersBy", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/knotremoveMember.go b/api/tangled/knotremoveMember.go new file mode 100644 index 00000000..378e1d36 --- /dev/null +++ b/api/tangled/knotremoveMember.go @@ -0,0 +1,30 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.knot.removeMember + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + KnotRemoveMemberNSID = "sh.tangled.knot.removeMember" +) + +// KnotRemoveMember_Input is the input argument to a sh.tangled.knot.removeMember call. +type KnotRemoveMember_Input struct { + // subject: DID of the member to remove + Subject string `json:"subject" cborgen:"subject"` +} + +// KnotRemoveMember calls the XRPC method "sh.tangled.knot.removeMember". +func KnotRemoveMember(ctx context.Context, c util.LexClient, input *KnotRemoveMember_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.knot.removeMember", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/repoaddCollaborator.go b/api/tangled/repoaddCollaborator.go new file mode 100644 index 00000000..e6fcf4b2 --- /dev/null +++ b/api/tangled/repoaddCollaborator.go @@ -0,0 +1,32 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.addCollaborator + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoAddCollaboratorNSID = "sh.tangled.repo.addCollaborator" +) + +// RepoAddCollaborator_Input is the input argument to a sh.tangled.repo.addCollaborator call. +type RepoAddCollaborator_Input struct { + // repo: DID of the repository to add the collaborator to + Repo string `json:"repo" cborgen:"repo"` + // subject: DID of the collaborator to add + Subject string `json:"subject" cborgen:"subject"` +} + +// RepoAddCollaborator calls the XRPC method "sh.tangled.repo.addCollaborator". +func RepoAddCollaborator(ctx context.Context, c util.LexClient, input *RepoAddCollaborator_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.addCollaborator", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/repolistCollaborators.go b/api/tangled/repolistCollaborators.go new file mode 100644 index 00000000..d86db48e --- /dev/null +++ b/api/tangled/repolistCollaborators.go @@ -0,0 +1,61 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.listCollaborators + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoListCollaboratorsNSID = "sh.tangled.repo.listCollaborators" +) + +// RepoListCollaborators_ListItem is a "listItem" in the sh.tangled.repo.listCollaborators schema. +type RepoListCollaborators_ListItem struct { + // addedBy: DID that added this collaborator + AddedBy string `json:"addedBy" cborgen:"addedBy"` + // cid: Optional record CID for record-backed indexers + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + // createdAt: When the collaborator was added + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // subject: DID of the collaborator + Subject string `json:"subject" cborgen:"subject"` + // uri: Optional record AT-URI for record-backed indexers + Uri *string `json:"uri,omitempty" cborgen:"uri,omitempty"` +} + +// RepoListCollaborators_Output is the output of a sh.tangled.repo.listCollaborators call. +type RepoListCollaborators_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Items []*RepoListCollaborators_ListItem `json:"items" cborgen:"items"` +} + +// RepoListCollaborators calls the XRPC method "sh.tangled.repo.listCollaborators". +// +// cursor: Pagination cursor +// order: Sort direction by createdAt. +// subject: Repo DID whose collaborator records to list. +func RepoListCollaborators(ctx context.Context, c util.LexClient, cursor string, limit int64, order string, subject string) (*RepoListCollaborators_Output, error) { + var out RepoListCollaborators_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + if order != "" { + params["order"] = order + } + params["subject"] = subject + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.listCollaborators", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/repolistCollaboratorsBy.go b/api/tangled/repolistCollaboratorsBy.go new file mode 100644 index 00000000..7fec8b50 --- /dev/null +++ b/api/tangled/repolistCollaboratorsBy.go @@ -0,0 +1,47 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.listCollaboratorsBy + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoListCollaboratorsByNSID = "sh.tangled.repo.listCollaboratorsBy" +) + +// RepoListCollaboratorsBy_Output is the output of a sh.tangled.repo.listCollaboratorsBy call. +type RepoListCollaboratorsBy_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Items []*RepoListCollaborators_ListItem `json:"items" cborgen:"items"` +} + +// RepoListCollaboratorsBy calls the XRPC method "sh.tangled.repo.listCollaboratorsBy". +// +// cursor: Pagination cursor +// order: Sort direction by createdAt. +// subject: Actor DID whose collaborator authorings to list. +func RepoListCollaboratorsBy(ctx context.Context, c util.LexClient, cursor string, limit int64, order string, subject string) (*RepoListCollaboratorsBy_Output, error) { + var out RepoListCollaboratorsBy_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + if order != "" { + params["order"] = order + } + params["subject"] = subject + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.listCollaboratorsBy", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/reporemoveCollaborator.go b/api/tangled/reporemoveCollaborator.go new file mode 100644 index 00000000..430192dd --- /dev/null +++ b/api/tangled/reporemoveCollaborator.go @@ -0,0 +1,32 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.repo.removeCollaborator + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + RepoRemoveCollaboratorNSID = "sh.tangled.repo.removeCollaborator" +) + +// RepoRemoveCollaborator_Input is the input argument to a sh.tangled.repo.removeCollaborator call. +type RepoRemoveCollaborator_Input struct { + // repo: DID of the repository to remove the collaborator from + Repo string `json:"repo" cborgen:"repo"` + // subject: DID of the collaborator to remove + Subject string `json:"subject" cborgen:"subject"` +} + +// RepoRemoveCollaborator calls the XRPC method "sh.tangled.repo.removeCollaborator". +func RepoRemoveCollaborator(ctx context.Context, c util.LexClient, input *RepoRemoveCollaborator_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.repo.removeCollaborator", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/lexicons/knot/addMember.json b/lexicons/knot/addMember.json new file mode 100644 index 00000000..2a364f8d --- /dev/null +++ b/lexicons/knot/addMember.json @@ -0,0 +1,26 @@ +{ + "lexicon": 1, + "id": "sh.tangled.knot.addMember", + "defs": { + "main": { + "type": "procedure", + "description": "Add a member to this knot", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "subject" + ], + "properties": { + "subject": { + "type": "string", + "format": "did", + "description": "DID of the member to add" + } + } + } + } + } + } +} diff --git a/bobbin/crates/types/lexicons/knot/listMembers.json b/lexicons/knot/listMembers.json similarity index 62% rename from bobbin/crates/types/lexicons/knot/listMembers.json rename to lexicons/knot/listMembers.json index e71425d3..317f691e 100644 --- a/bobbin/crates/types/lexicons/knot/listMembers.json +++ b/lexicons/knot/listMembers.json @@ -47,13 +47,32 @@ }, "listItem": { "type": "object", - "required": ["uri", "value"], + "required": ["subject", "addedBy", "createdAt"], "properties": { - "uri": { "type": "string", "format": "at-uri" }, - "cid": { "type": "string", "format": "cid" }, - "value": { - "type": "unknown", - "description": "Embedded sh.tangled.knot.member record" + "subject": { + "type": "string", + "format": "did", + "description": "DID of the member" + }, + "addedBy": { + "type": "string", + "format": "did", + "description": "DID that added this member" + }, + "createdAt": { + "type": "string", + "format": "datetime", + "description": "When the member was added" + }, + "uri": { + "type": "string", + "format": "at-uri", + "description": "Optional record AT-URI for record-backed indexers" + }, + "cid": { + "type": "string", + "format": "cid", + "description": "Optional record CID for record-backed indexers" } } } diff --git a/bobbin/crates/types/lexicons/knot/listMembersBy.json b/lexicons/knot/listMembersBy.json similarity index 100% rename from bobbin/crates/types/lexicons/knot/listMembersBy.json rename to lexicons/knot/listMembersBy.json diff --git a/lexicons/knot/removeMember.json b/lexicons/knot/removeMember.json new file mode 100644 index 00000000..71153a64 --- /dev/null +++ b/lexicons/knot/removeMember.json @@ -0,0 +1,26 @@ +{ + "lexicon": 1, + "id": "sh.tangled.knot.removeMember", + "defs": { + "main": { + "type": "procedure", + "description": "Remove a member from this knot", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "subject" + ], + "properties": { + "subject": { + "type": "string", + "format": "did", + "description": "DID of the member to remove" + } + } + } + } + } + } +} diff --git a/lexicons/repo/addCollaborator.json b/lexicons/repo/addCollaborator.json new file mode 100644 index 00000000..1ddaaa10 --- /dev/null +++ b/lexicons/repo/addCollaborator.json @@ -0,0 +1,32 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.addCollaborator", + "defs": { + "main": { + "type": "procedure", + "description": "Add a collaborator to a repository on this knot", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "repo", + "subject" + ], + "properties": { + "repo": { + "type": "string", + "format": "did", + "description": "DID of the repository to add the collaborator to" + }, + "subject": { + "type": "string", + "format": "did", + "description": "DID of the collaborator to add" + } + } + } + } + } + } +} diff --git a/bobbin/crates/types/lexicons/repo/listCollaborators.json b/lexicons/repo/listCollaborators.json similarity index 62% rename from bobbin/crates/types/lexicons/repo/listCollaborators.json rename to lexicons/repo/listCollaborators.json index 693bb20a..42c4f028 100644 --- a/bobbin/crates/types/lexicons/repo/listCollaborators.json +++ b/lexicons/repo/listCollaborators.json @@ -48,13 +48,32 @@ }, "listItem": { "type": "object", - "required": ["uri", "value"], + "required": ["subject", "addedBy", "createdAt"], "properties": { - "uri": { "type": "string", "format": "at-uri" }, - "cid": { "type": "string", "format": "cid" }, - "value": { - "type": "unknown", - "description": "Embedded sh.tangled.repo.collaborator record" + "subject": { + "type": "string", + "format": "did", + "description": "DID of the collaborator" + }, + "addedBy": { + "type": "string", + "format": "did", + "description": "DID that added this collaborator" + }, + "createdAt": { + "type": "string", + "format": "datetime", + "description": "When the collaborator was added" + }, + "uri": { + "type": "string", + "format": "at-uri", + "description": "Optional record AT-URI for record-backed indexers" + }, + "cid": { + "type": "string", + "format": "cid", + "description": "Optional record CID for record-backed indexers" } } } diff --git a/bobbin/crates/types/lexicons/repo/listCollaboratorsBy.json b/lexicons/repo/listCollaboratorsBy.json similarity index 100% rename from bobbin/crates/types/lexicons/repo/listCollaboratorsBy.json rename to lexicons/repo/listCollaboratorsBy.json diff --git a/lexicons/repo/removeCollaborator.json b/lexicons/repo/removeCollaborator.json new file mode 100644 index 00000000..59626e3b --- /dev/null +++ b/lexicons/repo/removeCollaborator.json @@ -0,0 +1,32 @@ +{ + "lexicon": 1, + "id": "sh.tangled.repo.removeCollaborator", + "defs": { + "main": { + "type": "procedure", + "description": "Remove a collaborator from a repository on this knot", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": [ + "repo", + "subject" + ], + "properties": { + "repo": { + "type": "string", + "format": "did", + "description": "DID of the repository to remove the collaborator from" + }, + "subject": { + "type": "string", + "format": "did", + "description": "DID of the collaborator to remove" + } + } + } + } + } + } +} -- 2.51.2