From f613a5032cf4f878f1d265c5dcafaa1101aee220 Mon Sep 17 00:00:00 2001 From: "DarkyAmagai@gmail.com" Date: Wed, 19 Jul 2023 11:48:19 -0700 Subject: [PATCH] Added fetch_public_communities into global client. --- PKG-INFO | 2 +- pymino/__init__.py | 2 +- pymino/ext/async_global_client.py | 24 +++++++++++++++++++++++- pymino/ext/global_client.py | 24 +++++++++++++++++++++++- setup.cfg | 2 +- 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/PKG-INFO b/PKG-INFO index e3673b20..c5ca555b 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -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 diff --git a/pymino/__init__.py b/pymino/__init__.py index 788bf297..994758fa 100644 --- a/pymino/__init__.py +++ b/pymino/__init__.py @@ -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 diff --git a/pymino/ext/async_global_client.py b/pymino/ext/async_global_client.py index 708f348a..9d2bec99 100644 --- a/pymino/ext/async_global_client.py +++ b/pymino/ext/async_global_client.py @@ -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)) \ No newline at end of file + 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" + )) \ No newline at end of file diff --git a/pymino/ext/global_client.py b/pymino/ext/global_client.py index 90e3bf9d..f4abd370 100644 --- a/pymino/ext/global_client.py +++ b/pymino/ext/global_client.py @@ -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)) \ No newline at end of file + 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" + )) \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 2fc148b2..0b2bb09e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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.