Skip to content

Commit

Permalink
Update atproto
Browse files Browse the repository at this point in the history
  • Loading branch information
mnogu committed May 19, 2024
1 parent 336b0c4 commit af6e117
Show file tree
Hide file tree
Showing 35 changed files with 760 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics \
--exclude chitose/app,chitose/com,chitose/tools,docs/source/conf.py
--exclude chitose/app,chitose/chat,chitose/com,chitose/tools,docs/source/conf.py
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics \
--exclude chitose/app,chitose/com,docs/source/conf.py
--exclude chitose/app,chitose/chat,chitose/com,docs/source/conf.py
- name: Lint with mypy
run: |
mypy . --exclude docs/source/conf.py --strict
2 changes: 1 addition & 1 deletion atproto
Submodule atproto updated 155 files
14 changes: 12 additions & 2 deletions chitose/app/bsky/actor/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,23 @@ def to_dict(self) -> dict[str, typing.Any]:
class ProfileAssociated(chitose.Object):
""""""

def __init__(self, lists: typing.Optional[int]=None, feedgens: typing.Optional[int]=None, labeler: typing.Optional[bool]=None) -> None:
def __init__(self, lists: typing.Optional[int]=None, feedgens: typing.Optional[int]=None, labeler: typing.Optional[bool]=None, chat: typing.Optional[chitose.app.bsky.actor.defs.ProfileAssociatedChat]=None) -> None:
self.lists = lists
self.feedgens = feedgens
self.labeler = labeler
self.chat = chat

def to_dict(self) -> dict[str, typing.Any]:
return {'lists': self.lists, 'feedgens': self.feedgens, 'labeler': self.labeler, '$type': 'app.bsky.actor.defs#profileAssociated'}
return {'lists': self.lists, 'feedgens': self.feedgens, 'labeler': self.labeler, 'chat': self.chat, '$type': 'app.bsky.actor.defs#profileAssociated'}

class ProfileAssociatedChat(chitose.Object):
""""""

def __init__(self, allow_incoming: typing.Literal['all', 'none', 'following']) -> None:
self.allow_incoming = allow_incoming

def to_dict(self) -> dict[str, typing.Any]:
return {'allowIncoming': self.allow_incoming, '$type': 'app.bsky.actor.defs#profileAssociatedChat'}

class ViewerState(chitose.Object):
"""Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests."""
Expand Down
16 changes: 16 additions & 0 deletions chitose/chat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# GENERATED CODE - DO NOT MODIFY
from __future__ import annotations
from chitose.xrpc import XrpcCall
from chitose.xrpc import XrpcSubscribe
from .bsky import Bsky_

class Chat_:
"""We recommend calling methods in this class via the :doc:`chitose.BskyAgent <chitose>` class instead of creating instances of this class directly."""

def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None:
self.call = call
self.subscribe = subscribe

@property
def bsky(self) -> Bsky_:
return Bsky_(self.call, self.subscribe)
26 changes: 26 additions & 0 deletions chitose/chat/bsky/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# GENERATED CODE - DO NOT MODIFY
from __future__ import annotations
from chitose.xrpc import XrpcCall
from chitose.xrpc import XrpcSubscribe
from .actor import Actor_
from .convo import Convo_
from .moderation import Moderation_

class Bsky_:
"""We recommend calling methods in this class via the :doc:`chitose.BskyAgent <chitose>` class instead of creating instances of this class directly."""

def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None:
self.call = call
self.subscribe = subscribe

@property
def actor(self) -> Actor_:
return Actor_(self.call, self.subscribe)

@property
def convo(self) -> Convo_:
return Convo_(self.call, self.subscribe)

@property
def moderation(self) -> Moderation_:
return Moderation_(self.call, self.subscribe)
21 changes: 21 additions & 0 deletions chitose/chat/bsky/actor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# GENERATED CODE - DO NOT MODIFY
from __future__ import annotations
from chitose.xrpc import XrpcCall
from chitose.xrpc import XrpcSubscribe
from .delete_account import _delete_account
from .export_account_data import _export_account_data

class Actor_:
"""We recommend calling methods in this class via the :doc:`chitose.BskyAgent <chitose>` class instead of creating instances of this class directly."""

def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None:
self.call = call
self.subscribe = subscribe

def export_account_data(self) -> bytes:
""""""
return _export_account_data(self.call)

def delete_account(self) -> bytes:
""""""
return _delete_account(self.call)
14 changes: 14 additions & 0 deletions chitose/chat/bsky/actor/declaration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# GENERATED CODE - DO NOT MODIFY
""""""
from __future__ import annotations
import chitose
import typing

class Declaration(chitose.Record):
""""""

def __init__(self, allow_incoming: typing.Literal['all', 'none', 'following']) -> None:
self.allow_incoming = allow_incoming

def to_dict(self) -> dict[str, typing.Any]:
return {'allowIncoming': self.allow_incoming, '$type': 'chat.bsky.actor.declaration'}
27 changes: 27 additions & 0 deletions chitose/chat/bsky/actor/defs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# GENERATED CODE - DO NOT MODIFY
""""""
from __future__ import annotations
import chitose
import chitose.app.bsky.actor.defs
import chitose.com.atproto.label.defs
import typing

class ProfileViewBasic(chitose.Object):
"""
:param chat_disabled: Set to true when the actor cannot actively participate in converations
"""

def __init__(self, did: str, handle: str, display_name: typing.Optional[str]=None, avatar: typing.Optional[str]=None, associated: typing.Optional[chitose.app.bsky.actor.defs.ProfileAssociated]=None, viewer: typing.Optional[chitose.app.bsky.actor.defs.ViewerState]=None, labels: typing.Optional[list[chitose.com.atproto.label.defs.Label]]=None, chat_disabled: typing.Optional[bool]=None) -> None:
self.did = did
self.handle = handle
self.display_name = display_name
self.avatar = avatar
self.associated = associated
self.viewer = viewer
self.labels = labels
self.chat_disabled = chat_disabled

def to_dict(self) -> dict[str, typing.Any]:
return {'did': self.did, 'handle': self.handle, 'displayName': self.display_name, 'avatar': self.avatar, 'associated': self.associated, 'viewer': self.viewer, 'labels': self.labels, 'chatDisabled': self.chat_disabled, '$type': 'chat.bsky.actor.defs#profileViewBasic'}
8 changes: 8 additions & 0 deletions chitose/chat/bsky/actor/delete_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GENERATED CODE - DO NOT MODIFY
""""""
from __future__ import annotations
import chitose

def _delete_account(call: chitose.xrpc.XrpcCall) -> bytes:
""""""
return call('chat.bsky.actor.deleteAccount', [], {}, {})
8 changes: 8 additions & 0 deletions chitose/chat/bsky/actor/export_account_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GENERATED CODE - DO NOT MODIFY
""""""
from __future__ import annotations
import chitose

def _export_account_data(call: chitose.xrpc.XrpcCall) -> bytes:
""""""
return call('chat.bsky.actor.exportAccountData', [], None, {})
74 changes: 74 additions & 0 deletions chitose/chat/bsky/convo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# GENERATED CODE - DO NOT MODIFY
from __future__ import annotations
from chitose.xrpc import XrpcCall
from chitose.xrpc import XrpcSubscribe
from .delete_message_for_self import _delete_message_for_self
from .get_convo import _get_convo
from .get_convo_for_members import _get_convo_for_members
from .get_log import _get_log
from .get_messages import _get_messages
from .leave_convo import _leave_convo
from .list_convos import _list_convos
from .mute_convo import _mute_convo
from .send_message import _send_message
from .send_message_batch import _send_message_batch
from .unmute_convo import _unmute_convo
from .update_read import _update_read
import chitose.chat.bsky.convo.defs
import chitose.chat.bsky.convo.send_message_batch
import typing

class Convo_:
"""We recommend calling methods in this class via the :doc:`chitose.BskyAgent <chitose>` class instead of creating instances of this class directly."""

def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None:
self.call = call
self.subscribe = subscribe

def list_convos(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes:
""""""
return _list_convos(self.call, limit, cursor)

def unmute_convo(self, convo_id: str) -> bytes:
""""""
return _unmute_convo(self.call, convo_id)

def get_log(self, cursor: typing.Optional[str]=None) -> bytes:
""""""
return _get_log(self.call, cursor)

def send_message(self, convo_id: str, message: chitose.chat.bsky.convo.defs.Message) -> bytes:
""""""
return _send_message(self.call, convo_id, message)

def leave_convo(self, convo_id: str) -> bytes:
""""""
return _leave_convo(self.call, convo_id)

def mute_convo(self, convo_id: str) -> bytes:
""""""
return _mute_convo(self.call, convo_id)

def delete_message_for_self(self, convo_id: str, message_id: str) -> bytes:
""""""
return _delete_message_for_self(self.call, convo_id, message_id)

def update_read(self, convo_id: str, message_id: typing.Optional[str]=None) -> bytes:
""""""
return _update_read(self.call, convo_id, message_id)

def get_convo(self, convo_id: str) -> bytes:
""""""
return _get_convo(self.call, convo_id)

def get_messages(self, convo_id: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes:
""""""
return _get_messages(self.call, convo_id, limit, cursor)

def get_convo_for_members(self, members: list[str]) -> bytes:
""""""
return _get_convo_for_members(self.call, members)

def send_message_batch(self, items: list[chitose.chat.bsky.convo.send_message_batch.BatchItem]) -> bytes:
""""""
return _send_message_batch(self.call, items)
131 changes: 131 additions & 0 deletions chitose/chat/bsky/convo/defs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# GENERATED CODE - DO NOT MODIFY
""""""
from __future__ import annotations
import chitose
import chitose.app.bsky.embed.record
import chitose.app.bsky.richtext.facet
import chitose.chat.bsky.actor.defs
import chitose.chat.bsky.convo.defs
import typing

class MessageRef(chitose.Object):
""""""

def __init__(self, did: str, message_id: str) -> None:
self.did = did
self.message_id = message_id

def to_dict(self) -> dict[str, typing.Any]:
return {'did': self.did, 'messageId': self.message_id, '$type': 'chat.bsky.convo.defs#messageRef'}

class Message(chitose.Object):
"""
:param facets: Annotations of text (mentions, URLs, hashtags, etc)
"""

def __init__(self, text: str, id: typing.Optional[str]=None, facets: typing.Optional[list[chitose.app.bsky.richtext.facet.Facet]]=None, embed: typing.Optional[chitose.app.bsky.embed.record.Record]=None) -> None:
self.text = text
self.id = id
self.facets = facets
self.embed = embed

def to_dict(self) -> dict[str, typing.Any]:
return {'text': self.text, 'id': self.id, 'facets': self.facets, 'embed': self.embed, '$type': 'chat.bsky.convo.defs#message'}

class MessageView(chitose.Object):
"""
:param facets: Annotations of text (mentions, URLs, hashtags, etc)
"""

def __init__(self, id: str, rev: str, text: str, sender: chitose.chat.bsky.convo.defs.MessageViewSender, sent_at: str, facets: typing.Optional[list[chitose.app.bsky.richtext.facet.Facet]]=None, embed: typing.Optional[chitose.app.bsky.embed.record.Record]=None) -> None:
self.id = id
self.rev = rev
self.text = text
self.sender = sender
self.sent_at = sent_at
self.facets = facets
self.embed = embed

def to_dict(self) -> dict[str, typing.Any]:
return {'id': self.id, 'rev': self.rev, 'text': self.text, 'sender': self.sender, 'sentAt': self.sent_at, 'facets': self.facets, 'embed': self.embed, '$type': 'chat.bsky.convo.defs#messageView'}

class DeletedMessageView(chitose.Object):
""""""

def __init__(self, id: str, rev: str, sender: chitose.chat.bsky.convo.defs.MessageViewSender, sent_at: str) -> None:
self.id = id
self.rev = rev
self.sender = sender
self.sent_at = sent_at

def to_dict(self) -> dict[str, typing.Any]:
return {'id': self.id, 'rev': self.rev, 'sender': self.sender, 'sentAt': self.sent_at, '$type': 'chat.bsky.convo.defs#deletedMessageView'}

class MessageViewSender(chitose.Object):
""""""

def __init__(self, did: str) -> None:
self.did = did

def to_dict(self) -> dict[str, typing.Any]:
return {'did': self.did, '$type': 'chat.bsky.convo.defs#messageViewSender'}

class ConvoView(chitose.Object):
""""""

def __init__(self, id: str, rev: str, members: list[chitose.chat.bsky.actor.defs.ProfileViewBasic], muted: bool, unread_count: int, last_message: typing.Optional[typing.Union[chitose.chat.bsky.convo.defs.MessageView, chitose.chat.bsky.convo.defs.DeletedMessageView]]=None) -> None:
self.id = id
self.rev = rev
self.members = members
self.muted = muted
self.unread_count = unread_count
self.last_message = last_message

def to_dict(self) -> dict[str, typing.Any]:
return {'id': self.id, 'rev': self.rev, 'members': self.members, 'muted': self.muted, 'unreadCount': self.unread_count, 'lastMessage': self.last_message, '$type': 'chat.bsky.convo.defs#convoView'}

class LogBeginConvo(chitose.Object):
""""""

def __init__(self, rev: str, convo_id: str) -> None:
self.rev = rev
self.convo_id = convo_id

def to_dict(self) -> dict[str, typing.Any]:
return {'rev': self.rev, 'convoId': self.convo_id, '$type': 'chat.bsky.convo.defs#logBeginConvo'}

class LogLeaveConvo(chitose.Object):
""""""

def __init__(self, rev: str, convo_id: str) -> None:
self.rev = rev
self.convo_id = convo_id

def to_dict(self) -> dict[str, typing.Any]:
return {'rev': self.rev, 'convoId': self.convo_id, '$type': 'chat.bsky.convo.defs#logLeaveConvo'}

class LogCreateMessage(chitose.Object):
""""""

def __init__(self, rev: str, convo_id: str, message: typing.Union[chitose.chat.bsky.convo.defs.MessageView, chitose.chat.bsky.convo.defs.DeletedMessageView]) -> None:
self.rev = rev
self.convo_id = convo_id
self.message = message

def to_dict(self) -> dict[str, typing.Any]:
return {'rev': self.rev, 'convoId': self.convo_id, 'message': self.message, '$type': 'chat.bsky.convo.defs#logCreateMessage'}

class LogDeleteMessage(chitose.Object):
""""""

def __init__(self, rev: str, convo_id: str, message: typing.Union[chitose.chat.bsky.convo.defs.MessageView, chitose.chat.bsky.convo.defs.DeletedMessageView]) -> None:
self.rev = rev
self.convo_id = convo_id
self.message = message

def to_dict(self) -> dict[str, typing.Any]:
return {'rev': self.rev, 'convoId': self.convo_id, 'message': self.message, '$type': 'chat.bsky.convo.defs#logDeleteMessage'}
8 changes: 8 additions & 0 deletions chitose/chat/bsky/convo/delete_message_for_self.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GENERATED CODE - DO NOT MODIFY
""""""
from __future__ import annotations
import chitose

def _delete_message_for_self(call: chitose.xrpc.XrpcCall, convo_id: str, message_id: str) -> bytes:
""""""
return call('chat.bsky.convo.deleteMessageForSelf', [], {'convoId': convo_id, 'messageId': message_id}, {'Content-Type': 'application/json'})
Loading

0 comments on commit af6e117

Please sign in to comment.