Skip to content

Commit

Permalink
Fix the order of input files
Browse files Browse the repository at this point in the history
  • Loading branch information
mnogu committed Sep 28, 2024
1 parent 25fcbb0 commit 598d18a
Show file tree
Hide file tree
Showing 30 changed files with 497 additions and 556 deletions.
2 changes: 1 addition & 1 deletion atproto
Submodule atproto updated 327 files
34 changes: 17 additions & 17 deletions chitose/app/bsky/actor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None:
self.call = call
self.subscribe = subscribe

def get_preferences(self) -> bytes:
"""Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth."""
return _get_preferences(self.call)

def get_profile(self, actor: str) -> bytes:
"""Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth.
Expand All @@ -27,6 +31,18 @@ def get_profile(self, actor: str) -> bytes:
"""
return _get_profile(self.call, actor)

def get_profiles(self, actors: list[str]) -> bytes:
"""Get detailed profile views of multiple actors."""
return _get_profiles(self.call, actors)

def get_suggestions(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes:
"""Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding."""
return _get_suggestions(self.call, limit, cursor)

def put_preferences(self, preferences: chitose.app.bsky.actor.defs.Preferences) -> bytes:
"""Set the private preferences attached to the account."""
return _put_preferences(self.call, preferences)

def search_actors(self, term: typing.Optional[str]=None, q: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes:
"""Find actors (profiles) matching search criteria. Does not require auth.
Expand All @@ -37,10 +53,6 @@ def search_actors(self, term: typing.Optional[str]=None, q: typing.Optional[str]
"""
return _search_actors(self.call, term, q, limit, cursor)

def get_suggestions(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes:
"""Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding."""
return _get_suggestions(self.call, limit, cursor)

def search_actors_typeahead(self, term: typing.Optional[str]=None, q: typing.Optional[str]=None, limit: typing.Optional[int]=None) -> bytes:
"""Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth.
Expand All @@ -49,16 +61,4 @@ def search_actors_typeahead(self, term: typing.Optional[str]=None, q: typing.Opt
:param q: Search query prefix; not a full query string.
"""
return _search_actors_typeahead(self.call, term, q, limit)

def put_preferences(self, preferences: chitose.app.bsky.actor.defs.Preferences) -> bytes:
"""Set the private preferences attached to the account."""
return _put_preferences(self.call, preferences)

def get_preferences(self) -> bytes:
"""Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth."""
return _get_preferences(self.call)

def get_profiles(self, actors: list[str]) -> bytes:
"""Get detailed profile views of multiple actors."""
return _get_profiles(self.call, actors)
return _search_actors_typeahead(self.call, term, q, limit)
33 changes: 5 additions & 28 deletions chitose/app/bsky/actor/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import chitose.app.bsky.actor.defs
import chitose.app.bsky.graph.defs
import chitose.com.atproto.label.defs
import chitose.com.atproto.repo.strong_ref
import typing

class ProfileViewBasic(chitose.Object):
Expand Down Expand Up @@ -45,7 +44,7 @@ def to_dict(self) -> dict[str, typing.Any]:
class ProfileViewDetailed(chitose.Object):
""""""

def __init__(self, did: str, handle: str, display_name: typing.Optional[str]=None, description: typing.Optional[str]=None, avatar: typing.Optional[str]=None, banner: typing.Optional[str]=None, followers_count: typing.Optional[int]=None, follows_count: typing.Optional[int]=None, posts_count: typing.Optional[int]=None, associated: typing.Optional[chitose.app.bsky.actor.defs.ProfileAssociated]=None, joined_via_starter_pack: typing.Optional[chitose.app.bsky.graph.defs.StarterPackViewBasic]=None, indexed_at: typing.Optional[str]=None, created_at: typing.Optional[str]=None, viewer: typing.Optional[chitose.app.bsky.actor.defs.ViewerState]=None, labels: typing.Optional[list[chitose.com.atproto.label.defs.Label]]=None, pinned_post: typing.Optional[chitose.com.atproto.repo.strong_ref.StrongRef]=None) -> None:
def __init__(self, did: str, handle: str, display_name: typing.Optional[str]=None, description: typing.Optional[str]=None, avatar: typing.Optional[str]=None, banner: typing.Optional[str]=None, followers_count: typing.Optional[int]=None, follows_count: typing.Optional[int]=None, posts_count: typing.Optional[int]=None, associated: typing.Optional[chitose.app.bsky.actor.defs.ProfileAssociated]=None, joined_via_starter_pack: typing.Optional[chitose.app.bsky.graph.defs.StarterPackViewBasic]=None, indexed_at: typing.Optional[str]=None, created_at: typing.Optional[str]=None, viewer: typing.Optional[chitose.app.bsky.actor.defs.ViewerState]=None, labels: typing.Optional[list[chitose.com.atproto.label.defs.Label]]=None) -> None:
self.did = did
self.handle = handle
self.display_name = display_name
Expand All @@ -61,10 +60,9 @@ def __init__(self, did: str, handle: str, display_name: typing.Optional[str]=Non
self.created_at = created_at
self.viewer = viewer
self.labels = labels
self.pinned_post = pinned_post

def to_dict(self) -> dict[str, typing.Any]:
return {'did': self.did, 'handle': self.handle, 'displayName': self.display_name, 'description': self.description, 'avatar': self.avatar, 'banner': self.banner, 'followersCount': self.followers_count, 'followsCount': self.follows_count, 'postsCount': self.posts_count, 'associated': self.associated, 'joinedViaStarterPack': self.joined_via_starter_pack, 'indexedAt': self.indexed_at, 'createdAt': self.created_at, 'viewer': self.viewer, 'labels': self.labels, 'pinnedPost': self.pinned_post, '$type': 'app.bsky.actor.defs#profileViewDetailed'}
return {'did': self.did, 'handle': self.handle, 'displayName': self.display_name, 'description': self.description, 'avatar': self.avatar, 'banner': self.banner, 'followersCount': self.followers_count, 'followsCount': self.follows_count, 'postsCount': self.posts_count, 'associated': self.associated, 'joinedViaStarterPack': self.joined_via_starter_pack, 'indexedAt': self.indexed_at, 'createdAt': self.created_at, 'viewer': self.viewer, 'labels': self.labels, '$type': 'app.bsky.actor.defs#profileViewDetailed'}

class ProfileAssociated(chitose.Object):
""""""
Expand Down Expand Up @@ -314,17 +312,14 @@ class BskyAppStatePref(chitose.Object):
:param queued_nudges: An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user.
:param nuxs: Storage for NUXs the user has encountered.
"""

def __init__(self, active_progress_guide: typing.Optional[chitose.app.bsky.actor.defs.BskyAppProgressGuide]=None, queued_nudges: typing.Optional[list[str]]=None, nuxs: typing.Optional[list[chitose.app.bsky.actor.defs.Nux]]=None) -> None:
def __init__(self, active_progress_guide: typing.Optional[chitose.app.bsky.actor.defs.BskyAppProgressGuide]=None, queued_nudges: typing.Optional[list[str]]=None) -> None:
self.active_progress_guide = active_progress_guide
self.queued_nudges = queued_nudges
self.nuxs = nuxs

def to_dict(self) -> dict[str, typing.Any]:
return {'activeProgressGuide': self.active_progress_guide, 'queuedNudges': self.queued_nudges, 'nuxs': self.nuxs, '$type': 'app.bsky.actor.defs#bskyAppStatePref'}
return {'activeProgressGuide': self.active_progress_guide, 'queuedNudges': self.queued_nudges, '$type': 'app.bsky.actor.defs#bskyAppStatePref'}

class BskyAppProgressGuide(chitose.Object):
"""If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress."""
Expand All @@ -333,22 +328,4 @@ def __init__(self, guide: str) -> None:
self.guide = guide

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

class Nux(chitose.Object):
"""A new user experiences (NUX) storage object
:param data: Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters.
:param expires_at: The date and time at which the NUX will expire and should be considered completed.
"""

def __init__(self, id: str, completed: bool, data: typing.Optional[str]=None, expires_at: typing.Optional[str]=None) -> None:
self.id = id
self.completed = completed
self.data = data
self.expires_at = expires_at

def to_dict(self) -> dict[str, typing.Any]:
return {'id': self.id, 'completed': self.completed, 'data': self.data, 'expiresAt': self.expires_at, '$type': 'app.bsky.actor.defs#nux'}
return {'guide': self.guide, '$type': 'app.bsky.actor.defs#bskyAppProgressGuide'}
5 changes: 2 additions & 3 deletions chitose/app/bsky/actor/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ class Profile(chitose.Record):
:param labels: Self-label values, specific to the Bluesky application, on the overall account.
"""

def __init__(self, display_name: typing.Optional[str]=None, description: typing.Optional[str]=None, avatar: typing.Optional[chitose.Blob]=None, banner: typing.Optional[chitose.Blob]=None, labels: typing.Optional[chitose.com.atproto.label.defs.SelfLabels]=None, joined_via_starter_pack: typing.Optional[chitose.com.atproto.repo.strong_ref.StrongRef]=None, pinned_post: typing.Optional[chitose.com.atproto.repo.strong_ref.StrongRef]=None, created_at: typing.Optional[str]=None) -> None:
def __init__(self, display_name: typing.Optional[str]=None, description: typing.Optional[str]=None, avatar: typing.Optional[chitose.Blob]=None, banner: typing.Optional[chitose.Blob]=None, labels: typing.Optional[chitose.com.atproto.label.defs.SelfLabels]=None, joined_via_starter_pack: typing.Optional[chitose.com.atproto.repo.strong_ref.StrongRef]=None, created_at: typing.Optional[str]=None) -> None:
self.display_name = display_name
self.description = description
self.avatar = avatar
self.banner = banner
self.labels = labels
self.joined_via_starter_pack = joined_via_starter_pack
self.pinned_post = pinned_post
self.created_at = created_at

def to_dict(self) -> dict[str, typing.Any]:
return {'displayName': self.display_name, 'description': self.description, 'avatar': self.avatar, 'banner': self.banner, 'labels': self.labels, 'joinedViaStarterPack': self.joined_via_starter_pack, 'pinnedPost': self.pinned_post, 'createdAt': self.created_at, '$type': 'app.bsky.actor.profile'}
return {'displayName': self.display_name, 'description': self.description, 'avatar': self.avatar, 'banner': self.banner, 'labels': self.labels, 'joinedViaStarterPack': self.joined_via_starter_pack, 'createdAt': self.created_at, '$type': 'app.bsky.actor.profile'}
Loading

0 comments on commit 598d18a

Please sign in to comment.