From 051679f0797c94e6bb35e3d93054be9b82040295 Mon Sep 17 00:00:00 2001 From: rafaeleyng Date: Wed, 27 May 2026 11:47:41 -0300 Subject: [PATCH] codegen --- api/chat/actordefs.go | 21 ++- api/chat/actorgetStatus.go | 31 ++++ api/chat/convodefs.go | 176 ++++++++++++------- api/chat/convogetConvoMembers.go | 36 ++++ api/chat/convogetMessages.go | 2 + api/chat/convolistConvoRequests.go | 16 +- api/chat/convolistConvos.go | 6 +- api/chat/groupaddMembers.go | 3 +- api/chat/groupdefs.go | 44 +++-- api/chat/groupgetGroupPublicInfo.go | 29 ---- api/chat/groupgetJoinLinkPreviews.go | 29 ++++ api/chat/grouplistMutualGroups.go | 36 ++++ api/chat/moderationgetMessageContext.go | 20 +-- api/chat/moderationsubscribeModEvents.go | 207 +++++++++++++++++++++++ 14 files changed, 530 insertions(+), 126 deletions(-) create mode 100644 api/chat/actorgetStatus.go create mode 100644 api/chat/convogetConvoMembers.go delete mode 100644 api/chat/groupgetGroupPublicInfo.go create mode 100644 api/chat/groupgetJoinLinkPreviews.go create mode 100644 api/chat/grouplistMutualGroups.go diff --git a/api/chat/actordefs.go b/api/chat/actordefs.go index d19f63b4..30509d0b 100644 --- a/api/chat/actordefs.go +++ b/api/chat/actordefs.go @@ -22,7 +22,7 @@ type ActorDefs_DirectConvoMember struct { // ActorDefs_GroupConvoMember is a "groupConvoMember" in the chat.bsky.actor.defs schema. // -// [NOTE: This is under active development and should be considered unstable while this note is here]. +// [NOTE: This is under active development and should be considered unstable while this note is here]. A current group convo member. type ActorDefs_GroupConvoMember struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.actor.defs#groupConvoMember"` // addedBy: Who added this member. Only present if the member was added (instead of joining via link). @@ -31,6 +31,13 @@ type ActorDefs_GroupConvoMember struct { Role *string `json:"role" cborgen:"role"` } +// ActorDefs_PastGroupConvoMember is a "pastGroupConvoMember" in the chat.bsky.actor.defs schema. +// +// [NOTE: This is under active development and should be considered unstable while this note is here]. A past group convo member. +type ActorDefs_PastGroupConvoMember struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.actor.defs#pastGroupConvoMember"` +} + // ActorDefs_ProfileViewBasic is a "profileViewBasic" in the chat.bsky.actor.defs schema. type ActorDefs_ProfileViewBasic struct { Associated *appbsky.ActorDefs_ProfileAssociated `json:"associated,omitempty" cborgen:"associated,omitempty"` @@ -50,8 +57,9 @@ type ActorDefs_ProfileViewBasic struct { // Union field that has data specific to different kinds of convos. type ActorDefs_ProfileViewBasic_Kind struct { - ActorDefs_DirectConvoMember *ActorDefs_DirectConvoMember - ActorDefs_GroupConvoMember *ActorDefs_GroupConvoMember + ActorDefs_DirectConvoMember *ActorDefs_DirectConvoMember + ActorDefs_GroupConvoMember *ActorDefs_GroupConvoMember + ActorDefs_PastGroupConvoMember *ActorDefs_PastGroupConvoMember } func (t *ActorDefs_ProfileViewBasic_Kind) MarshalJSON() ([]byte, error) { @@ -63,6 +71,10 @@ func (t *ActorDefs_ProfileViewBasic_Kind) MarshalJSON() ([]byte, error) { t.ActorDefs_GroupConvoMember.LexiconTypeID = "chat.bsky.actor.defs#groupConvoMember" return json.Marshal(t.ActorDefs_GroupConvoMember) } + if t.ActorDefs_PastGroupConvoMember != nil { + t.ActorDefs_PastGroupConvoMember.LexiconTypeID = "chat.bsky.actor.defs#pastGroupConvoMember" + return json.Marshal(t.ActorDefs_PastGroupConvoMember) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -79,6 +91,9 @@ func (t *ActorDefs_ProfileViewBasic_Kind) UnmarshalJSON(b []byte) error { case "chat.bsky.actor.defs#groupConvoMember": t.ActorDefs_GroupConvoMember = new(ActorDefs_GroupConvoMember) return json.Unmarshal(b, t.ActorDefs_GroupConvoMember) + case "chat.bsky.actor.defs#pastGroupConvoMember": + t.ActorDefs_PastGroupConvoMember = new(ActorDefs_PastGroupConvoMember) + return json.Unmarshal(b, t.ActorDefs_PastGroupConvoMember) default: return nil } diff --git a/api/chat/actorgetStatus.go b/api/chat/actorgetStatus.go new file mode 100644 index 00000000..91ab6878 --- /dev/null +++ b/api/chat/actorgetStatus.go @@ -0,0 +1,31 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.actor.getStatus + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ActorGetStatus_Output is the output of a chat.bsky.actor.getStatus call. +type ActorGetStatus_Output struct { + // canCreateGroups: Whether the viewer's account is allowed to create group chats. New accounts are restricted from creating groups. + CanCreateGroups bool `json:"canCreateGroups" cborgen:"canCreateGroups"` + // chatDisabled: True when the viewer's account is disabled and cannot actively participate in chat. + ChatDisabled bool `json:"chatDisabled" cborgen:"chatDisabled"` + // groupMemberLimit: The maximum number of members allowed in a group conversation. + GroupMemberLimit int64 `json:"groupMemberLimit" cborgen:"groupMemberLimit"` +} + +// ActorGetStatus calls the XRPC method "chat.bsky.actor.getStatus". +func ActorGetStatus(ctx context.Context, c lexutil.LexClient) (*ActorGetStatus_Output, error) { + var out ActorGetStatus_Output + if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.actor.getStatus", nil, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/convodefs.go b/api/chat/convodefs.go index 0ac294fe..0f5c5414 100644 --- a/api/chat/convodefs.go +++ b/api/chat/convodefs.go @@ -12,6 +12,12 @@ import ( lexutil "github.com/bluesky-social/indigo/lex/util" ) +// ConvoDefs_ConvoRef is a "convoRef" in the chat.bsky.convo.defs schema. +type ConvoDefs_ConvoRef struct { + ConvoId string `json:"convoId" cborgen:"convoId"` + Did string `json:"did" cborgen:"did"` +} + // ConvoDefs_ConvoView is a "convoView" in the chat.bsky.convo.defs schema. type ConvoDefs_ConvoView struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#convoView"` @@ -20,7 +26,7 @@ type ConvoDefs_ConvoView struct { Kind *ConvoDefs_ConvoView_Kind `json:"kind,omitempty" cborgen:"kind,omitempty"` LastMessage *ConvoDefs_ConvoView_LastMessage `json:"lastMessage,omitempty" cborgen:"lastMessage,omitempty"` LastReaction *ConvoDefs_ConvoView_LastReaction `json:"lastReaction,omitempty" cborgen:"lastReaction,omitempty"` - // members: Members of this conversation. For direct convos, it will be an immutable list of the 2 members. For group convos, it will a list of important members (the first few members, the viewer, the member who invited the viewer, the member who sent the last message, the member who sent the last reaction), but will not contain the full list of members. NOTE: TBD an endpoint to list all members. + // members: Members of this conversation. For direct convos, it will be an immutable list of the 2 members. For group convos, it will a list of important members (the first few members, the viewer, the member who added the viewer, the member who sent the last message, the member who sent the last reaction), but will not contain the full list of members. Use chat.bsky.convo.getConvoMembers to list all members. Members []*ActorDefs_ProfileViewBasic `json:"members" cborgen:"members"` Muted bool `json:"muted" cborgen:"muted"` Rev string `json:"rev" cborgen:"rev"` @@ -156,9 +162,16 @@ type ConvoDefs_DirectConvo struct { // [NOTE: This is under active development and should be considered unstable while this note is here]. type ConvoDefs_GroupConvo struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#groupConvo"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` JoinLink *GroupDefs_JoinLinkView `json:"joinLink,omitempty" cborgen:"joinLink,omitempty"` + // joinRequestCount: The total number of pending join requests for the group conversation. Only present for the owner. Capped at 21. + JoinRequestCount *int64 `json:"joinRequestCount,omitempty" cborgen:"joinRequestCount,omitempty"` // lockStatus: The lock status of the conversation. LockStatus *string `json:"lockStatus" cborgen:"lockStatus"` + // memberCount: The total number of members in the group conversation. + MemberCount int64 `json:"memberCount" cborgen:"memberCount"` + // memberLimit: The maximum number of members allowed in the group conversation. + MemberLimit int64 `json:"memberLimit" cborgen:"memberLimit"` // name: The display name of the group conversation. Name string `json:"name" cborgen:"name"` } @@ -176,10 +189,13 @@ type ConvoDefs_LogAcceptConvo struct { // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member was added to a group convo. The member who was added gets a logBeginConvo (to create the convo) but also a logAddMember (to show the system message as the first message the user sees). type ConvoDefs_LogAddMember struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logAddMember"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataAddMember `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logAddMember"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataAddMember + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + // relatedProfiles: Profiles referred in the system message. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles" cborgen:"relatedProfiles"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogAddReaction is a "logAddReaction" in the chat.bsky.convo.defs schema. @@ -190,7 +206,9 @@ type ConvoDefs_LogAddReaction struct { ConvoId string `json:"convoId" cborgen:"convoId"` Message *ConvoDefs_LogAddReaction_Message `json:"message" cborgen:"message"` Reaction *ConvoDefs_ReactionView `json:"reaction" cborgen:"reaction"` - Rev string `json:"rev" cborgen:"rev"` + // relatedProfiles: Profiles referred in the message and reaction views. This isn't required for compatibility, because it was added later, but should generally be present. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles,omitempty" cborgen:"relatedProfiles,omitempty"` + Rev string `json:"rev" cborgen:"rev"` } type ConvoDefs_LogAddReaction_Message struct { @@ -252,10 +270,11 @@ type ConvoDefs_LogBeginConvo struct { // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was created for a group convo. type ConvoDefs_LogCreateJoinLink struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logCreateJoinLink"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataCreateJoinLink `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logCreateJoinLink"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataCreateJoinLink + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogCreateMessage is a "logCreateMessage" in the chat.bsky.convo.defs schema. @@ -265,7 +284,9 @@ type ConvoDefs_LogCreateMessage struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logCreateMessage"` ConvoId string `json:"convoId" cborgen:"convoId"` Message *ConvoDefs_LogCreateMessage_Message `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + // relatedProfiles: Profiles referred to in the message view. This isn't required for compatibility, because it was added later, but should generally be present. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles,omitempty" cborgen:"relatedProfiles,omitempty"` + Rev string `json:"rev" cborgen:"rev"` } type ConvoDefs_LogCreateMessage_Message struct { @@ -352,40 +373,44 @@ func (t *ConvoDefs_LogDeleteMessage_Message) UnmarshalJSON(b []byte) error { // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was disabled for a group convo. type ConvoDefs_LogDisableJoinLink struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logDisableJoinLink"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataDisableJoinLink `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logDisableJoinLink"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataDisableJoinLink + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogEditGroup is a "logEditGroup" in the chat.bsky.convo.defs schema. // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating info about group convo was edited. type ConvoDefs_LogEditGroup struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logEditGroup"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataEditGroup `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logEditGroup"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataEditGroup + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogEditJoinLink is a "logEditJoinLink" in the chat.bsky.convo.defs schema. // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a settings about a join link for a group convo were edited. type ConvoDefs_LogEditJoinLink struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logEditJoinLink"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataEditJoinLink `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logEditJoinLink"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataEditJoinLink + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogEnableJoinLink is a "logEnableJoinLink" in the chat.bsky.convo.defs schema. // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was enabled for a group convo. type ConvoDefs_LogEnableJoinLink struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logEnableJoinLink"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataEnableJoinLink `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logEnableJoinLink"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataEnableJoinLink + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogIncomingJoinRequest is a "logIncomingJoinRequest" in the chat.bsky.convo.defs schema. @@ -412,40 +437,52 @@ type ConvoDefs_LogLeaveConvo struct { // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was locked. type ConvoDefs_LogLockConvo struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logLockConvo"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataLockConvo `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logLockConvo"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataLockConvo + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + // relatedProfiles: Profiles referred in the system message. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles" cborgen:"relatedProfiles"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogLockConvoPermanently is a "logLockConvoPermanently" in the chat.bsky.convo.defs schema. // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was locked permanently. type ConvoDefs_LogLockConvoPermanently struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logLockConvoPermanently"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataLockConvoPermanently `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logLockConvoPermanently"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataLockConvoPermanently + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + // relatedProfiles: Profiles referred in the system message. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles" cborgen:"relatedProfiles"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogMemberJoin is a "logMemberJoin" in the chat.bsky.convo.defs schema. // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member joined a group convo via join link. The member who was added gets a logBeginConvo (to create the convo) but also a logMemberJoin (to show the system message as the first message the user sees). type ConvoDefs_LogMemberJoin struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logMemberJoin"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataMemberJoin `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logMemberJoin"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataMemberJoin + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + // relatedProfiles: Profiles referred in the system message. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles" cborgen:"relatedProfiles"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogMemberLeave is a "logMemberLeave" in the chat.bsky.convo.defs schema. // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member voluntarily left a group convo. The member who was removed gets a logLeaveConvo (to leave the convo) but not a logMemberLeave (because they already left, so can't see the system message). type ConvoDefs_LogMemberLeave struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logMemberLeave"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataMemberLeave `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logMemberLeave"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataMemberLeave + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + // relatedProfiles: Profiles referred in the system message. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles" cborgen:"relatedProfiles"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogMuteConvo is a "logMuteConvo" in the chat.bsky.convo.defs schema. @@ -587,10 +624,13 @@ type ConvoDefs_LogRejectJoinRequest struct { // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member was removed from a group convo. The member who was removed gets a logLeaveConvo (to leave the convo) but not a logRemoveMember (because they already left, so can't see the system message). type ConvoDefs_LogRemoveMember struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logRemoveMember"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataRemoveMember `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logRemoveMember"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataRemoveMember + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + // relatedProfiles: Profiles referred in the system message. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles" cborgen:"relatedProfiles"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogRemoveReaction is a "logRemoveReaction" in the chat.bsky.convo.defs schema. @@ -601,7 +641,9 @@ type ConvoDefs_LogRemoveReaction struct { ConvoId string `json:"convoId" cborgen:"convoId"` Message *ConvoDefs_LogRemoveReaction_Message `json:"message" cborgen:"message"` Reaction *ConvoDefs_ReactionView `json:"reaction" cborgen:"reaction"` - Rev string `json:"rev" cborgen:"rev"` + // relatedProfiles: Profiles referred in the message and reaction views. This isn't required for compatibility, because it was added later, but should generally be present. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles,omitempty" cborgen:"relatedProfiles,omitempty"` + Rev string `json:"rev" cborgen:"rev"` } type ConvoDefs_LogRemoveReaction_Message struct { @@ -643,10 +685,13 @@ func (t *ConvoDefs_LogRemoveReaction_Message) UnmarshalJSON(b []byte) error { // // [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was unlocked. type ConvoDefs_LogUnlockConvo struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logUnlockConvo"` - ConvoId string `json:"convoId" cborgen:"convoId"` - Message *ConvoDefs_SystemMessageDataUnlockConvo `json:"message" cborgen:"message"` - Rev string `json:"rev" cborgen:"rev"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logUnlockConvo"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // message: A system message with data of type #systemMessageDataUnlockConvo + Message *ConvoDefs_SystemMessageView `json:"message" cborgen:"message"` + // relatedProfiles: Profiles referred in the system message. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles" cborgen:"relatedProfiles"` + Rev string `json:"rev" cborgen:"rev"` } // ConvoDefs_LogUnmuteConvo is a "logUnmuteConvo" in the chat.bsky.convo.defs schema. @@ -771,10 +816,10 @@ type ConvoDefs_ReactionViewSender struct { // // [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user was added to the group convo. type ConvoDefs_SystemMessageDataAddMember struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataAddMember"` - AddedBy *ActorDefs_ProfileViewBasic `json:"addedBy" cborgen:"addedBy"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataAddMember"` + AddedBy *ConvoDefs_SystemMessageReferredUser `json:"addedBy" cborgen:"addedBy"` // member: Current view of the member who was added. - Member *ActorDefs_ProfileViewBasic `json:"member" cborgen:"member"` + Member *ConvoDefs_SystemMessageReferredUser `json:"member" cborgen:"member"` // role: Role the user was added to the group with. The role from 'member' will reflect the current data, not historical. Role *string `json:"role" cborgen:"role"` } @@ -824,7 +869,7 @@ type ConvoDefs_SystemMessageDataEnableJoinLink struct { type ConvoDefs_SystemMessageDataLockConvo struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataLockConvo"` // lockedBy: Current view of the member who locked the group. - LockedBy *ActorDefs_ProfileViewBasic `json:"lockedBy" cborgen:"lockedBy"` + LockedBy *ConvoDefs_SystemMessageReferredUser `json:"lockedBy" cborgen:"lockedBy"` } // ConvoDefs_SystemMessageDataLockConvoPermanently is a "systemMessageDataLockConvoPermanently" in the chat.bsky.convo.defs schema. @@ -833,7 +878,7 @@ type ConvoDefs_SystemMessageDataLockConvo struct { type ConvoDefs_SystemMessageDataLockConvoPermanently struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataLockConvoPermanently"` // lockedBy: Current view of the member who locked the group. - LockedBy *ActorDefs_ProfileViewBasic `json:"lockedBy" cborgen:"lockedBy"` + LockedBy *ConvoDefs_SystemMessageReferredUser `json:"lockedBy" cborgen:"lockedBy"` } // ConvoDefs_SystemMessageDataMemberJoin is a "systemMessageDataMemberJoin" in the chat.bsky.convo.defs schema. @@ -842,9 +887,9 @@ type ConvoDefs_SystemMessageDataLockConvoPermanently struct { type ConvoDefs_SystemMessageDataMemberJoin struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataMemberJoin"` // approvedBy: If join link was configured to require approval, this will be set to who approved the request. Undefined if approval was not required. - ApprovedBy *ActorDefs_ProfileViewBasic `json:"approvedBy,omitempty" cborgen:"approvedBy,omitempty"` + ApprovedBy *ConvoDefs_SystemMessageReferredUser `json:"approvedBy,omitempty" cborgen:"approvedBy,omitempty"` // member: Current view of the member who joined. - Member *ActorDefs_ProfileViewBasic `json:"member" cborgen:"member"` + Member *ConvoDefs_SystemMessageReferredUser `json:"member" cborgen:"member"` // role: Role the user was added to the group with. The role from 'member' will reflect the current data, not historical. Role *string `json:"role" cborgen:"role"` } @@ -855,7 +900,7 @@ type ConvoDefs_SystemMessageDataMemberJoin struct { type ConvoDefs_SystemMessageDataMemberLeave struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataMemberLeave"` // member: Current view of the member who left the group. - Member *ActorDefs_ProfileViewBasic `json:"member" cborgen:"member"` + Member *ConvoDefs_SystemMessageReferredUser `json:"member" cborgen:"member"` } // ConvoDefs_SystemMessageDataRemoveMember is a "systemMessageDataRemoveMember" in the chat.bsky.convo.defs schema. @@ -864,8 +909,8 @@ type ConvoDefs_SystemMessageDataMemberLeave struct { type ConvoDefs_SystemMessageDataRemoveMember struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataRemoveMember"` // member: Current view of the member who was removed. - Member *ActorDefs_ProfileViewBasic `json:"member" cborgen:"member"` - RemovedBy *ActorDefs_ProfileViewBasic `json:"removedBy" cborgen:"removedBy"` + Member *ConvoDefs_SystemMessageReferredUser `json:"member" cborgen:"member"` + RemovedBy *ConvoDefs_SystemMessageReferredUser `json:"removedBy" cborgen:"removedBy"` } // ConvoDefs_SystemMessageDataUnlockConvo is a "systemMessageDataUnlockConvo" in the chat.bsky.convo.defs schema. @@ -874,7 +919,12 @@ type ConvoDefs_SystemMessageDataRemoveMember struct { type ConvoDefs_SystemMessageDataUnlockConvo struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#systemMessageDataUnlockConvo"` // unlockedBy: Current view of the member who unlocked the group. - UnlockedBy *ActorDefs_ProfileViewBasic `json:"unlockedBy" cborgen:"unlockedBy"` + UnlockedBy *ConvoDefs_SystemMessageReferredUser `json:"unlockedBy" cborgen:"unlockedBy"` +} + +// ConvoDefs_SystemMessageReferredUser is a "systemMessageReferredUser" in the chat.bsky.convo.defs schema. +type ConvoDefs_SystemMessageReferredUser struct { + Did string `json:"did" cborgen:"did"` } // ConvoDefs_SystemMessageView is a "systemMessageView" in the chat.bsky.convo.defs schema. diff --git a/api/chat/convogetConvoMembers.go b/api/chat/convogetConvoMembers.go new file mode 100644 index 00000000..c983ec20 --- /dev/null +++ b/api/chat/convogetConvoMembers.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.convo.getConvoMembers + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ConvoGetConvoMembers_Output is the output of a chat.bsky.convo.getConvoMembers call. +type ConvoGetConvoMembers_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Members []*ActorDefs_ProfileViewBasic `json:"members" cborgen:"members"` +} + +// ConvoGetConvoMembers calls the XRPC method "chat.bsky.convo.getConvoMembers". +func ConvoGetConvoMembers(ctx context.Context, c lexutil.LexClient, convoId string, cursor string, limit int64) (*ConvoGetConvoMembers_Output, error) { + var out ConvoGetConvoMembers_Output + + params := map[string]interface{}{} + params["convoId"] = convoId + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.convo.getConvoMembers", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/convogetMessages.go b/api/chat/convogetMessages.go index 4857f48d..50a35de8 100644 --- a/api/chat/convogetMessages.go +++ b/api/chat/convogetMessages.go @@ -16,6 +16,8 @@ import ( type ConvoGetMessages_Output struct { Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` Messages []*ConvoGetMessages_Output_Messages_Elem `json:"messages" cborgen:"messages"` + // relatedProfiles: Set of all members who authored or reacted to the returned messages. Members referred to by system messages are also included. + RelatedProfiles []*ActorDefs_ProfileViewBasic `json:"relatedProfiles,omitempty" cborgen:"relatedProfiles,omitempty"` } type ConvoGetMessages_Output_Messages_Elem struct { diff --git a/api/chat/convolistConvoRequests.go b/api/chat/convolistConvoRequests.go index 4a25bbd1..3fbbd222 100644 --- a/api/chat/convolistConvoRequests.go +++ b/api/chat/convolistConvoRequests.go @@ -19,8 +19,8 @@ type ConvoListConvoRequests_Output struct { } type ConvoListConvoRequests_Output_Requests_Elem struct { - ConvoDefs_ConvoView *ConvoDefs_ConvoView - GroupDefs_JoinRequestView *GroupDefs_JoinRequestView + ConvoDefs_ConvoView *ConvoDefs_ConvoView + GroupDefs_JoinRequestConvoView *GroupDefs_JoinRequestConvoView } func (t *ConvoListConvoRequests_Output_Requests_Elem) MarshalJSON() ([]byte, error) { @@ -28,9 +28,9 @@ func (t *ConvoListConvoRequests_Output_Requests_Elem) MarshalJSON() ([]byte, err t.ConvoDefs_ConvoView.LexiconTypeID = "chat.bsky.convo.defs#convoView" return json.Marshal(t.ConvoDefs_ConvoView) } - if t.GroupDefs_JoinRequestView != nil { - t.GroupDefs_JoinRequestView.LexiconTypeID = "chat.bsky.group.defs#joinRequestView" - return json.Marshal(t.GroupDefs_JoinRequestView) + if t.GroupDefs_JoinRequestConvoView != nil { + t.GroupDefs_JoinRequestConvoView.LexiconTypeID = "chat.bsky.group.defs#joinRequestConvoView" + return json.Marshal(t.GroupDefs_JoinRequestConvoView) } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -45,9 +45,9 @@ func (t *ConvoListConvoRequests_Output_Requests_Elem) UnmarshalJSON(b []byte) er case "chat.bsky.convo.defs#convoView": t.ConvoDefs_ConvoView = new(ConvoDefs_ConvoView) return json.Unmarshal(b, t.ConvoDefs_ConvoView) - case "chat.bsky.group.defs#joinRequestView": - t.GroupDefs_JoinRequestView = new(GroupDefs_JoinRequestView) - return json.Unmarshal(b, t.GroupDefs_JoinRequestView) + case "chat.bsky.group.defs#joinRequestConvoView": + t.GroupDefs_JoinRequestConvoView = new(GroupDefs_JoinRequestConvoView) + return json.Unmarshal(b, t.GroupDefs_JoinRequestConvoView) default: return nil } diff --git a/api/chat/convolistConvos.go b/api/chat/convolistConvos.go index 36e33bcd..bc2a379e 100644 --- a/api/chat/convolistConvos.go +++ b/api/chat/convolistConvos.go @@ -19,8 +19,9 @@ type ConvoListConvos_Output struct { // ConvoListConvos calls the XRPC method "chat.bsky.convo.listConvos". // // kind: Filter by conversation kind. +// lockStatus: Filter by conversation lock status. Values follow chat.bsky.convo.defs#convoLockStatus. // status: Filter convos by their status. It is discouraged to call with "request" and preferred to call chat.bsky.convo.listConvoRequests, which also includes group join requests made by the user. -func ConvoListConvos(ctx context.Context, c lexutil.LexClient, cursor string, kind string, limit int64, readState string, status string) (*ConvoListConvos_Output, error) { +func ConvoListConvos(ctx context.Context, c lexutil.LexClient, cursor string, kind string, limit int64, lockStatus string, readState string, status string) (*ConvoListConvos_Output, error) { var out ConvoListConvos_Output params := map[string]interface{}{} @@ -33,6 +34,9 @@ func ConvoListConvos(ctx context.Context, c lexutil.LexClient, cursor string, ki if limit != 0 { params["limit"] = limit } + if lockStatus != "" { + params["lockStatus"] = lockStatus + } if readState != "" { params["readState"] = readState } diff --git a/api/chat/groupaddMembers.go b/api/chat/groupaddMembers.go index 89d65f67..c32dc3c4 100644 --- a/api/chat/groupaddMembers.go +++ b/api/chat/groupaddMembers.go @@ -18,7 +18,8 @@ type GroupAddMembers_Input struct { // GroupAddMembers_Output is the output of a chat.bsky.group.addMembers call. type GroupAddMembers_Output struct { - Convo *ConvoDefs_ConvoView `json:"convo" cborgen:"convo"` + AddedMembers []*ActorDefs_ProfileViewBasic `json:"addedMembers,omitempty" cborgen:"addedMembers,omitempty"` + Convo *ConvoDefs_ConvoView `json:"convo" cborgen:"convo"` } // GroupAddMembers calls the XRPC method "chat.bsky.group.addMembers". diff --git a/api/chat/groupdefs.go b/api/chat/groupdefs.go index 56ab826b..9f3e2746 100644 --- a/api/chat/groupdefs.go +++ b/api/chat/groupdefs.go @@ -4,12 +4,19 @@ package chat -// GroupDefs_GroupPublicView is a "groupPublicView" in the chat.bsky.group.defs schema. -type GroupDefs_GroupPublicView struct { - MemberCount int64 `json:"memberCount" cborgen:"memberCount"` - Name string `json:"name" cborgen:"name"` - Owner *ActorDefs_ProfileViewBasic `json:"owner" cborgen:"owner"` - RequireApproval bool `json:"requireApproval" cborgen:"requireApproval"` +// GroupDefs_JoinLinkPreviewView is a "joinLinkPreviewView" in the chat.bsky.group.defs schema. +type GroupDefs_JoinLinkPreviewView struct { + Code string `json:"code" cborgen:"code"` + // convo: Present only if the request is authenticated and the user is a member of the group. + Convo *ConvoDefs_ConvoView `json:"convo,omitempty" cborgen:"convo,omitempty"` + EnabledStatus *string `json:"enabledStatus" cborgen:"enabledStatus"` + JoinRule *string `json:"joinRule" cborgen:"joinRule"` + MemberCount int64 `json:"memberCount" cborgen:"memberCount"` + MemberLimit int64 `json:"memberLimit" cborgen:"memberLimit"` + Name string `json:"name" cborgen:"name"` + Owner *ActorDefs_ProfileViewBasic `json:"owner" cborgen:"owner"` + RequireApproval bool `json:"requireApproval" cborgen:"requireApproval"` + Viewer *GroupDefs_JoinLinkViewerState `json:"viewer,omitempty" cborgen:"viewer,omitempty"` } // GroupDefs_JoinLinkView is a "joinLinkView" in the chat.bsky.group.defs schema. @@ -21,10 +28,27 @@ type GroupDefs_JoinLinkView struct { RequireApproval bool `json:"requireApproval" cborgen:"requireApproval"` } -// GroupDefs_JoinRequestView is a "joinRequestView" in the chat.bsky.group.defs schema. -type GroupDefs_JoinRequestView struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.group.defs#joinRequestView"` +// GroupDefs_JoinLinkViewerState is a "joinLinkViewerState" in the chat.bsky.group.defs schema. +type GroupDefs_JoinLinkViewerState struct { + RequestedAt *string `json:"requestedAt,omitempty" cborgen:"requestedAt,omitempty"` +} + +// GroupDefs_JoinRequestConvoView is a "joinRequestConvoView" in the chat.bsky.group.defs schema. +// +// A join request from the perspective of the requester, including enough group context to render the request in a list (e.g. group name, owner, member count). +type GroupDefs_JoinRequestConvoView struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.group.defs#joinRequestConvoView"` ConvoId string `json:"convoId" cborgen:"convoId"` + MemberCount int64 `json:"memberCount" cborgen:"memberCount"` + MemberLimit int64 `json:"memberLimit" cborgen:"memberLimit"` + Name string `json:"name" cborgen:"name"` + Owner *ActorDefs_ProfileViewBasic `json:"owner" cborgen:"owner"` RequestedAt string `json:"requestedAt" cborgen:"requestedAt"` - RequestedBy *ActorDefs_ProfileViewBasic `json:"requestedBy" cborgen:"requestedBy"` +} + +// GroupDefs_JoinRequestView is a "joinRequestView" in the chat.bsky.group.defs schema. +type GroupDefs_JoinRequestView struct { + ConvoId string `json:"convoId" cborgen:"convoId"` + RequestedAt string `json:"requestedAt" cborgen:"requestedAt"` + RequestedBy *ActorDefs_ProfileViewBasic `json:"requestedBy" cborgen:"requestedBy"` } diff --git a/api/chat/groupgetGroupPublicInfo.go b/api/chat/groupgetGroupPublicInfo.go deleted file mode 100644 index 1342802f..00000000 --- a/api/chat/groupgetGroupPublicInfo.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -// Lexicon schema: chat.bsky.group.getGroupPublicInfo - -package chat - -import ( - "context" - - lexutil "github.com/bluesky-social/indigo/lex/util" -) - -// GroupGetGroupPublicInfo_Output is the output of a chat.bsky.group.getGroupPublicInfo call. -type GroupGetGroupPublicInfo_Output struct { - Group *GroupDefs_GroupPublicView `json:"group" cborgen:"group"` -} - -// GroupGetGroupPublicInfo calls the XRPC method "chat.bsky.group.getGroupPublicInfo". -func GroupGetGroupPublicInfo(ctx context.Context, c lexutil.LexClient, code string) (*GroupGetGroupPublicInfo_Output, error) { - var out GroupGetGroupPublicInfo_Output - - params := map[string]interface{}{} - params["code"] = code - if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.group.getGroupPublicInfo", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/chat/groupgetJoinLinkPreviews.go b/api/chat/groupgetJoinLinkPreviews.go new file mode 100644 index 00000000..e88e91c9 --- /dev/null +++ b/api/chat/groupgetJoinLinkPreviews.go @@ -0,0 +1,29 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.group.getJoinLinkPreviews + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// GroupGetJoinLinkPreviews_Output is the output of a chat.bsky.group.getJoinLinkPreviews call. +type GroupGetJoinLinkPreviews_Output struct { + JoinLinkPreviews []*GroupDefs_JoinLinkPreviewView `json:"joinLinkPreviews" cborgen:"joinLinkPreviews"` +} + +// GroupGetJoinLinkPreviews calls the XRPC method "chat.bsky.group.getJoinLinkPreviews". +func GroupGetJoinLinkPreviews(ctx context.Context, c lexutil.LexClient, codes []string) (*GroupGetJoinLinkPreviews_Output, error) { + var out GroupGetJoinLinkPreviews_Output + + params := map[string]interface{}{} + params["codes"] = codes + if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.group.getJoinLinkPreviews", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/grouplistMutualGroups.go b/api/chat/grouplistMutualGroups.go new file mode 100644 index 00000000..3f279bd4 --- /dev/null +++ b/api/chat/grouplistMutualGroups.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.group.listMutualGroups + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// GroupListMutualGroups_Output is the output of a chat.bsky.group.listMutualGroups call. +type GroupListMutualGroups_Output struct { + Convos []*ConvoDefs_ConvoView `json:"convos" cborgen:"convos"` + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` +} + +// GroupListMutualGroups calls the XRPC method "chat.bsky.group.listMutualGroups". +func GroupListMutualGroups(ctx context.Context, c lexutil.LexClient, cursor string, limit int64, subject string) (*GroupListMutualGroups_Output, error) { + var out GroupListMutualGroups_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + params["subject"] = subject + if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.group.listMutualGroups", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/moderationgetMessageContext.go b/api/chat/moderationgetMessageContext.go index 28b7425e..cff340e6 100644 --- a/api/chat/moderationgetMessageContext.go +++ b/api/chat/moderationgetMessageContext.go @@ -18,9 +18,8 @@ type ModerationGetMessageContext_Output struct { } type ModerationGetMessageContext_Output_Messages_Elem struct { - ConvoDefs_MessageView *ConvoDefs_MessageView - ConvoDefs_DeletedMessageView *ConvoDefs_DeletedMessageView - ConvoDefs_SystemMessageView *ConvoDefs_SystemMessageView + ConvoDefs_MessageView *ConvoDefs_MessageView + ConvoDefs_SystemMessageView *ConvoDefs_SystemMessageView } func (t *ModerationGetMessageContext_Output_Messages_Elem) MarshalJSON() ([]byte, error) { @@ -28,10 +27,6 @@ func (t *ModerationGetMessageContext_Output_Messages_Elem) MarshalJSON() ([]byte t.ConvoDefs_MessageView.LexiconTypeID = "chat.bsky.convo.defs#messageView" return json.Marshal(t.ConvoDefs_MessageView) } - if t.ConvoDefs_DeletedMessageView != nil { - t.ConvoDefs_DeletedMessageView.LexiconTypeID = "chat.bsky.convo.defs#deletedMessageView" - return json.Marshal(t.ConvoDefs_DeletedMessageView) - } if t.ConvoDefs_SystemMessageView != nil { t.ConvoDefs_SystemMessageView.LexiconTypeID = "chat.bsky.convo.defs#systemMessageView" return json.Marshal(t.ConvoDefs_SystemMessageView) @@ -49,9 +44,6 @@ func (t *ModerationGetMessageContext_Output_Messages_Elem) UnmarshalJSON(b []byt case "chat.bsky.convo.defs#messageView": t.ConvoDefs_MessageView = new(ConvoDefs_MessageView) return json.Unmarshal(b, t.ConvoDefs_MessageView) - case "chat.bsky.convo.defs#deletedMessageView": - t.ConvoDefs_DeletedMessageView = new(ConvoDefs_DeletedMessageView) - return json.Unmarshal(b, t.ConvoDefs_DeletedMessageView) case "chat.bsky.convo.defs#systemMessageView": t.ConvoDefs_SystemMessageView = new(ConvoDefs_SystemMessageView) return json.Unmarshal(b, t.ConvoDefs_SystemMessageView) @@ -62,8 +54,11 @@ func (t *ModerationGetMessageContext_Output_Messages_Elem) UnmarshalJSON(b []byt // ModerationGetMessageContext calls the XRPC method "chat.bsky.moderation.getMessageContext". // +// after: Number of user messages after the target to include. System messages between the target and the latest returned user message are also included, capped per gap by `maxInterleavedSystemMessages`. If there are no user messages after the target, up to `maxInterleavedSystemMessages` system messages immediately following the target are returned instead. +// before: Number of user messages before the target to include. System messages between the earliest returned user message and the target are also included, capped per gap by `maxInterleavedSystemMessages`. If there are no user messages before the target, up to `maxInterleavedSystemMessages` system messages immediately preceding the target are returned instead. // convoId: Conversation that the message is from. NOTE: this field will eventually be required. -func ModerationGetMessageContext(ctx context.Context, c lexutil.LexClient, after int64, before int64, convoId string, messageId string) (*ModerationGetMessageContext_Output, error) { +// maxInterleavedSystemMessages: Maximum number of system messages to include per gap between consecutive returned messages (and per side when there are no user messages on that side). Within a gap, the system messages closest to the earlier message are kept. +func ModerationGetMessageContext(ctx context.Context, c lexutil.LexClient, after int64, before int64, convoId string, maxInterleavedSystemMessages int64, messageId string) (*ModerationGetMessageContext_Output, error) { var out ModerationGetMessageContext_Output params := map[string]interface{}{} @@ -76,6 +71,9 @@ func ModerationGetMessageContext(ctx context.Context, c lexutil.LexClient, after if convoId != "" { params["convoId"] = convoId } + if maxInterleavedSystemMessages != 0 { + params["maxInterleavedSystemMessages"] = maxInterleavedSystemMessages + } params["messageId"] = messageId if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.moderation.getMessageContext", params, nil, &out); err != nil { return nil, err diff --git a/api/chat/moderationsubscribeModEvents.go b/api/chat/moderationsubscribeModEvents.go index 63d5e4ae..6f52e49a 100644 --- a/api/chat/moderationsubscribeModEvents.go +++ b/api/chat/moderationsubscribeModEvents.go @@ -4,7 +4,30 @@ package chat +// ModerationSubscribeModEvents_EventChatAccepted is a "eventChatAccepted" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a user accepts a chat convo, either explicitly or by sending a message. +type ModerationSubscribeModEvents_EventChatAccepted struct { + // actorDid: The DID of the person accepting the convo. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the convo was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. Only present for group convos. + GroupMemberCount *int64 `json:"groupMemberCount,omitempty" cborgen:"groupMemberCount,omitempty"` + // groupName: The name of the group chat. Only present for group convos. + GroupName *string `json:"groupName,omitempty" cborgen:"groupName,omitempty"` + // method: How the convo was accepted. + Method string `json:"method" cborgen:"method"` + // ownerDid: The DID of the group chat owner. Only present for group convos. + OwnerDid *string `json:"ownerDid,omitempty" cborgen:"ownerDid,omitempty"` + Rev string `json:"rev" cborgen:"rev"` +} + // ModerationSubscribeModEvents_EventConvoFirstMessage is a "eventConvoFirstMessage" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when the first message was sent on a convo. type ModerationSubscribeModEvents_EventConvoFirstMessage struct { ConvoId string `json:"convoId" cborgen:"convoId"` CreatedAt string `json:"createdAt" cborgen:"createdAt"` @@ -15,3 +38,187 @@ type ModerationSubscribeModEvents_EventConvoFirstMessage struct { // user: The DID of the message author. User string `json:"user" cborgen:"user"` } + +// ModerationSubscribeModEvents_EventGroupChatCreated is a "eventGroupChatCreated" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fire when a group chat is created. +type ModerationSubscribeModEvents_EventGroupChatCreated struct { + // actorDid: The DID of the actor performing the action. For this event, same as ownerDid. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + // groupName: The name set at creation time. + GroupName string `json:"groupName" cborgen:"groupName"` + // initialMemberDids: DIDs of everyone added at creation time. + InitialMemberDids []string `json:"initialMemberDids" cborgen:"initialMemberDids"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + Rev string `json:"rev" cborgen:"rev"` +} + +// ModerationSubscribeModEvents_EventGroupChatJoinRequest is a "eventGroupChatJoinRequest" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a user requests to join a group chat via an join link that requires approval. +type ModerationSubscribeModEvents_EventGroupChatJoinRequest struct { + // actorDid: The DID of the person requesting to join. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + GroupName string `json:"groupName" cborgen:"groupName"` + // joinLinkCode: The code of the join link used to request joining. + JoinLinkCode string `json:"joinLinkCode" cborgen:"joinLinkCode"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + Rev string `json:"rev" cborgen:"rev"` + // subjectFollowsOwner: Whether the requesting member follows the group owner. + SubjectFollowsOwner bool `json:"subjectFollowsOwner" cborgen:"subjectFollowsOwner"` +} + +// ModerationSubscribeModEvents_EventGroupChatJoinRequestApproved is a "eventGroupChatJoinRequestApproved" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a join request is approved by the group owner. +type ModerationSubscribeModEvents_EventGroupChatJoinRequestApproved struct { + // actorDid: The DID of the owner approving the request. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + GroupName string `json:"groupName" cborgen:"groupName"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + Rev string `json:"rev" cborgen:"rev"` + // subjectDid: The DID of the member whose request was approved. + SubjectDid string `json:"subjectDid" cborgen:"subjectDid"` +} + +// ModerationSubscribeModEvents_EventGroupChatJoinRequestRejected is a "eventGroupChatJoinRequestRejected" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a join request is rejected by the group owner. +type ModerationSubscribeModEvents_EventGroupChatJoinRequestRejected struct { + // actorDid: The DID of the owner rejecting the request. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + GroupName string `json:"groupName" cborgen:"groupName"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + Rev string `json:"rev" cborgen:"rev"` + // subjectDid: The DID of the member whose request was rejected. + SubjectDid string `json:"subjectDid" cborgen:"subjectDid"` +} + +// ModerationSubscribeModEvents_EventGroupChatMemberAdded is a "eventGroupChatMemberAdded" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a member is added to a group chat. Note that members are added in the 'request' state. +type ModerationSubscribeModEvents_EventGroupChatMemberAdded struct { + // actorDid: The DID of the actor performing the action. For this event, same as ownerDid. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + GroupName string `json:"groupName" cborgen:"groupName"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + // requestMembersCount: The number of members who have not yet accepted the convo. + RequestMembersCount int64 `json:"requestMembersCount" cborgen:"requestMembersCount"` + Rev string `json:"rev" cborgen:"rev"` + // subjectDid: The DID of the member who was added. + SubjectDid string `json:"subjectDid" cborgen:"subjectDid"` + // subjectFollowsOwner: Whether the added member follows the group owner. + SubjectFollowsOwner bool `json:"subjectFollowsOwner" cborgen:"subjectFollowsOwner"` +} + +// ModerationSubscribeModEvents_EventGroupChatMemberJoined is a "eventGroupChatMemberJoined" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a member joins a group chat via an join link that does not require approval. +type ModerationSubscribeModEvents_EventGroupChatMemberJoined struct { + // actorDid: The DID of the person joining. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + GroupName string `json:"groupName" cborgen:"groupName"` + // joinLinkCode: The code of the join link used to join. + JoinLinkCode string `json:"joinLinkCode" cborgen:"joinLinkCode"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + Rev string `json:"rev" cborgen:"rev"` + // subjectFollowsOwner: Whether the joining member follows the group owner. + SubjectFollowsOwner bool `json:"subjectFollowsOwner" cborgen:"subjectFollowsOwner"` +} + +// ModerationSubscribeModEvents_EventGroupChatMemberLeft is a "eventGroupChatMemberLeft" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a member leaves or is removed from a group chat. +type ModerationSubscribeModEvents_EventGroupChatMemberLeft struct { + // actorDid: The DID of the actor. For voluntary: the person leaving. For kicked: the owner. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + GroupName string `json:"groupName" cborgen:"groupName"` + // leaveMethod: How the member left. + LeaveMethod string `json:"leaveMethod" cborgen:"leaveMethod"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + Rev string `json:"rev" cborgen:"rev"` + // subjectDid: The DID of the member who left or was removed. + SubjectDid string `json:"subjectDid" cborgen:"subjectDid"` +} + +// ModerationSubscribeModEvents_EventGroupChatUpdated is a "eventGroupChatUpdated" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a group chat's metadata or status changes. +type ModerationSubscribeModEvents_EventGroupChatUpdated struct { + // actorDid: The DID of the actor performing the action (the owner). + ActorDid string `json:"actorDid" cborgen:"actorDid"` + // convoCreatedAt: When the group was originally created. + ConvoCreatedAt string `json:"convoCreatedAt" cborgen:"convoCreatedAt"` + ConvoId string `json:"convoId" cborgen:"convoId"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // groupMemberCount: Current member count at the time of the event. + GroupMemberCount int64 `json:"groupMemberCount" cborgen:"groupMemberCount"` + // groupName: Current group name. + GroupName string `json:"groupName" cborgen:"groupName"` + // joinLinkCode: The code of the join link. Only present when updateType is join-link-related. + JoinLinkCode *string `json:"joinLinkCode,omitempty" cborgen:"joinLinkCode,omitempty"` + // joinLinkFollowersOnly: Whether the join link is restricted to followers of the owner. Only present when updateType is join-link-related. + JoinLinkFollowersOnly *bool `json:"joinLinkFollowersOnly,omitempty" cborgen:"joinLinkFollowersOnly,omitempty"` + // joinLinkRequiresApproval: Whether the join link requires owner approval to join. Only present when updateType is join-link-related. + JoinLinkRequiresApproval *bool `json:"joinLinkRequiresApproval,omitempty" cborgen:"joinLinkRequiresApproval,omitempty"` + // lockReason: Why the group was locked. Only present when updateType is 'locked'. + LockReason *string `json:"lockReason,omitempty" cborgen:"lockReason,omitempty"` + // newName: The new group name. Only present when updateType is 'name_changed'. + NewName *string `json:"newName,omitempty" cborgen:"newName,omitempty"` + // oldName: The previous group name. Only present when updateType is 'name_changed'. + OldName *string `json:"oldName,omitempty" cborgen:"oldName,omitempty"` + // ownerDid: The DID of the group chat owner. + OwnerDid string `json:"ownerDid" cborgen:"ownerDid"` + Rev string `json:"rev" cborgen:"rev"` + // updateType: What changed. + UpdateType string `json:"updateType" cborgen:"updateType"` +} -- 2.51.2