Skip to content

Commit

Permalink
Added fetch_public_communities into global client.
Browse files Browse the repository at this point in the history
  • Loading branch information
FeralAmagai committed Jul 19, 2023
1 parent d9ca0b4 commit f613a50
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pymino
Version: 1.2.3.4
Version: 1.2.3.5
Summary: Easily create a bot for Amino Apps using a modern easy to use synchronous library.
Home-page: https://github.com/forevercynical/pymino
Author: forevercynical
Expand Down
2 changes: 1 addition & 1 deletion pymino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__author__ = 'cynical'
__license__ = 'MIT'
__copyright__ = 'Copyright 2023 Cynical'
__version__ = '1.2.3.4'
__version__ = '1.2.3.5'
__description__ = 'A Python wrapper for the aminoapps.com API'

from .bot import Bot as Bot
Expand Down
24 changes: 23 additions & 1 deletion pymino/ext/async_global_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,4 +1790,26 @@ async def fetch_object_info(self, link: str) -> LinkInfo:
method = "GET",
url = f"/g/s/link-resolution?q={link}"
))
return LinkInfo(self.cache.get(KEY))
return LinkInfo(self.cache.get(KEY))

async def fetch_public_communities(self, type: str = "discover"):
"""
Fetches a list of public communities.
This method retrieves a list of public communities based on the specified parameters.
:param type: The type of communities to fetch (default is "discover").
:type type: str
:return: A `CCommunityList` object containing the list of public communities.
:rtype: CCommunityList
**example usage:**
>>> communities = client.fetch_public_communities()
>>> for community in communities.name:
>>> print(community)
"""
return CCommunityList(await self.make_request(
method = "GET",
url = f"/g/s/topic/0/feed/community?type={type}&categoryKey=recommendation&moduleId=0c56a709-1f96-474d-ae2f-4225d0e998e5"
))
24 changes: 23 additions & 1 deletion pymino/ext/global_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1871,4 +1871,26 @@ def fetch_object_info(self, link: str) -> LinkInfo:
method = "GET",
url = f"/g/s/link-resolution?q={link}"
))
return LinkInfo(self.cache.get(KEY))
return LinkInfo(self.cache.get(KEY))

def fetch_public_communities(self, type: str = "discover"):
"""
Fetches a list of public communities.
This method retrieves a list of public communities based on the specified parameters.
:param type: The type of communities to fetch (default is "discover").
:type type: str
:return: A `CCommunityList` object containing the list of public communities.
:rtype: CCommunityList
**example usage:**
>>> communities = client.fetch_public_communities()
>>> for community in communities.name:
>>> print(community)
"""
return CCommunityList(self.make_request(
method = "GET",
url = f"/g/s/topic/0/feed/community?type={type}&categoryKey=recommendation&moduleId=0c56a709-1f96-474d-ae2f-4225d0e998e5"
))
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pymino
version = 1.2.3.4
version = 1.2.3.5
author = forevercynical
author_email = me@cynical.gg
description = Easily create a bot for Amino Apps using a modern easy to use synchronous library.
Expand Down

0 comments on commit f613a50

Please sign in to comment.