Skip to content

Commit

Permalink
Update chat lexicons (#3564)
Browse files Browse the repository at this point in the history
* new chat lex

* changeset
  • Loading branch information
rafaelbsky authored Feb 21, 2025
1 parent 01874c4 commit 22af31a
Show file tree
Hide file tree
Showing 34 changed files with 1,474 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/neat-colts-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/api": patch
---

Update chat lexicons
31 changes: 31 additions & 0 deletions lexicons/chat/bsky/convo/acceptConvo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"lexicon": 1,
"id": "chat.bsky.convo.acceptConvo",
"defs": {
"main": {
"type": "procedure",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["convoId"],
"properties": {
"convoId": { "type": "string" }
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"properties": {
"rev": {
"description": "Rev when the convo was accepted. If not present, the convo was already accepted.",
"type": "string"
}
}
}
}
}
}
}
41 changes: 40 additions & 1 deletion lexicons/chat/bsky/convo/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@
"refs": ["#messageView", "#deletedMessageView"]
},
"muted": { "type": "boolean" },
"opened": { "type": "boolean" },
"status": {
"type": "string",
"knownValues": ["request", "accepted"]
},
"unreadCount": { "type": "integer" }
}
},
Expand All @@ -102,6 +105,14 @@
"convoId": { "type": "string" }
}
},
"logAcceptConvo": {
"type": "object",
"required": ["rev", "convoId"],
"properties": {
"rev": { "type": "string" },
"convoId": { "type": "string" }
}
},
"logLeaveConvo": {
"type": "object",
"required": ["rev", "convoId"],
Expand All @@ -110,6 +121,22 @@
"convoId": { "type": "string" }
}
},
"logMuteConvo": {
"type": "object",
"required": ["rev", "convoId"],
"properties": {
"rev": { "type": "string" },
"convoId": { "type": "string" }
}
},
"logUnmuteConvo": {
"type": "object",
"required": ["rev", "convoId"],
"properties": {
"rev": { "type": "string" },
"convoId": { "type": "string" }
}
},
"logCreateMessage": {
"type": "object",
"required": ["rev", "convoId", "message"],
Expand All @@ -133,6 +160,18 @@
"refs": ["#messageView", "#deletedMessageView"]
}
}
},
"logReadMessage": {
"type": "object",
"required": ["rev", "convoId", "message"],
"properties": {
"rev": { "type": "string" },
"convoId": { "type": "string" },
"message": {
"type": "union",
"refs": ["#messageView", "#deletedMessageView"]
}
}
}
}
}
41 changes: 41 additions & 0 deletions lexicons/chat/bsky/convo/getConvoAvailability.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"lexicon": 1,
"id": "chat.bsky.convo.getConvoAvailability",
"defs": {
"main": {
"type": "query",
"description": "Get whether the requester and the other members can chat. If an existing convo is found for these members, it is returned.",
"parameters": {
"type": "params",
"required": ["members"],
"properties": {
"members": {
"type": "array",
"minLength": 1,
"maxLength": 10,
"items": {
"type": "string",
"format": "did"
}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["canChat"],
"properties": {
"canChat": {
"type": "boolean"
},
"convo": {
"type": "ref",
"ref": "chat.bsky.convo.defs#convoView"
}
}
}
}
}
}
}
1 change: 1 addition & 0 deletions lexicons/chat/bsky/convo/getLog.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"type": "union",
"refs": [
"chat.bsky.convo.defs#logBeginConvo",
"chat.bsky.convo.defs#logAcceptConvo",
"chat.bsky.convo.defs#logLeaveConvo",
"chat.bsky.convo.defs#logCreateMessage",
"chat.bsky.convo.defs#logDeleteMessage"
Expand Down
10 changes: 9 additions & 1 deletion lexicons/chat/bsky/convo/listConvos.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
"maximum": 100,
"default": 50
},
"cursor": { "type": "string" }
"cursor": { "type": "string" },
"readState": {
"type": "string",
"knownValues": ["unread"]
},
"status": {
"type": "string",
"knownValues": ["request", "accepted"]
}
}
},
"output": {
Expand Down
28 changes: 28 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,11 @@ import * as ChatBskyActorDeclaration from './types/chat/bsky/actor/declaration.j
import * as ChatBskyActorDefs from './types/chat/bsky/actor/defs.js'
import * as ChatBskyActorDeleteAccount from './types/chat/bsky/actor/deleteAccount.js'
import * as ChatBskyActorExportAccountData from './types/chat/bsky/actor/exportAccountData.js'
import * as ChatBskyConvoAcceptConvo from './types/chat/bsky/convo/acceptConvo.js'
import * as ChatBskyConvoDefs from './types/chat/bsky/convo/defs.js'
import * as ChatBskyConvoDeleteMessageForSelf from './types/chat/bsky/convo/deleteMessageForSelf.js'
import * as ChatBskyConvoGetConvo from './types/chat/bsky/convo/getConvo.js'
import * as ChatBskyConvoGetConvoAvailability from './types/chat/bsky/convo/getConvoAvailability.js'
import * as ChatBskyConvoGetConvoForMembers from './types/chat/bsky/convo/getConvoForMembers.js'
import * as ChatBskyConvoGetLog from './types/chat/bsky/convo/getLog.js'
import * as ChatBskyConvoGetMessages from './types/chat/bsky/convo/getMessages.js'
Expand Down Expand Up @@ -413,9 +415,11 @@ export * as ChatBskyActorDeclaration from './types/chat/bsky/actor/declaration.j
export * as ChatBskyActorDefs from './types/chat/bsky/actor/defs.js'
export * as ChatBskyActorDeleteAccount from './types/chat/bsky/actor/deleteAccount.js'
export * as ChatBskyActorExportAccountData from './types/chat/bsky/actor/exportAccountData.js'
export * as ChatBskyConvoAcceptConvo from './types/chat/bsky/convo/acceptConvo.js'
export * as ChatBskyConvoDefs from './types/chat/bsky/convo/defs.js'
export * as ChatBskyConvoDeleteMessageForSelf from './types/chat/bsky/convo/deleteMessageForSelf.js'
export * as ChatBskyConvoGetConvo from './types/chat/bsky/convo/getConvo.js'
export * as ChatBskyConvoGetConvoAvailability from './types/chat/bsky/convo/getConvoAvailability.js'
export * as ChatBskyConvoGetConvoForMembers from './types/chat/bsky/convo/getConvoForMembers.js'
export * as ChatBskyConvoGetLog from './types/chat/bsky/convo/getLog.js'
export * as ChatBskyConvoGetMessages from './types/chat/bsky/convo/getMessages.js'
Expand Down Expand Up @@ -3419,6 +3423,18 @@ export class ChatBskyConvoNS {
this._client = client
}

acceptConvo(
data?: ChatBskyConvoAcceptConvo.InputSchema,
opts?: ChatBskyConvoAcceptConvo.CallOptions,
): Promise<ChatBskyConvoAcceptConvo.Response> {
return this._client.call(
'chat.bsky.convo.acceptConvo',
opts?.qp,
data,
opts,
)
}

deleteMessageForSelf(
data?: ChatBskyConvoDeleteMessageForSelf.InputSchema,
opts?: ChatBskyConvoDeleteMessageForSelf.CallOptions,
Expand All @@ -3443,6 +3459,18 @@ export class ChatBskyConvoNS {
)
}

getConvoAvailability(
params?: ChatBskyConvoGetConvoAvailability.QueryParams,
opts?: ChatBskyConvoGetConvoAvailability.CallOptions,
): Promise<ChatBskyConvoGetConvoAvailability.Response> {
return this._client.call(
'chat.bsky.convo.getConvoAvailability',
params,
undefined,
opts,
)
}

getConvoForMembers(
params?: ChatBskyConvoGetConvoForMembers.QueryParams,
opts?: ChatBskyConvoGetConvoForMembers.CallOptions,
Expand Down
Loading

0 comments on commit 22af31a

Please sign in to comment.