Skip to content

Commit

Permalink
Release: v1.4.62
Browse files Browse the repository at this point in the history
update part_size to 200mb

fix type hinting in search_community_data

use switch storage for private chats
  • Loading branch information
New-dev0 committed Sep 30, 2024
1 parent aa6ea96 commit e980609
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![GitHub stars](https://img.shields.io/github/stars/switchcollab/Switch-Bots-Python-Library)
![GitHub Forks](https://img.shields.io/github/forks/switchcollab/Switch-Bots-Python-Library)
![Version](https://img.shields.io/badge/version-1.4.55-green.svg)
![Version](https://img.shields.io/badge/version-1.4.62-green.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/swibots)

# SwiBots: Python Library for Switch App
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

setup(
name="swibots",
version="1.4.60",
packages=find_packages(include=['swibots']),
version="1.4.62",
packages=find_packages(include=['swibots*']),
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/switchcollab/Switch-Bots-Python-Library",
Expand Down
15 changes: 15 additions & 0 deletions swibots/api/chat/controllers/heading_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ async def delete_heading(self, community_id: str, heading_name: str):
response = await self.client.post(f"/headings/delete-headings?{query}")
return response.data


async def edit_heading(
self,
community_id: str,
Expand All @@ -77,3 +78,17 @@ async def edit_heading(
)
response = await self.client.post(f"/headings/edit-headings?{query}")
return response.data

async def rearrange_headings(self,
community_id: str,
heading_names: List[str],
subheading: str = ''
):
body = {
"communityId": community_id,
"headingNames": heading_names,
"subHeading": subheading
}
response = await self.client.post("/headings/rearrange-headings",
data=body)

4 changes: 2 additions & 2 deletions swibots/api/chat/controllers/media_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def __init__(self, client: "ChatClient") -> None:
self.client = client
self.api_url = "https://storage.switch.click"

self._min_file_size = 150 * 1024 * 1024
self._min_file_size = 200 * 1024 * 1024

async def get_upload_url(self):
async with AsyncClient(timeout=None) as client:
Expand Down Expand Up @@ -291,7 +291,7 @@ async def upload_media(
callback: UploadProgressCallback = None,
callback_args: Optional[tuple] = None,
auto_thumb: Optional[bool] = True,
part_size: int = int(os.getenv("UPLOAD_PART_SIZE", 100 * 1024 * 1024)),
part_size: int = int(os.getenv("UPLOAD_PART_SIZE", 200 * 1024 * 1024)),
task_count: int = int(os.getenv("UPLOAD_TASKS", 0)),
for_document: bool = False,
premium: bool = False,
Expand Down
8 changes: 4 additions & 4 deletions swibots/api/chat/controllers/message_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async def send_media(
async def _upload_media(media):
if document:
force_storage_method = kwargs.get("secondary_upload", False)
private_community = None
private_community = bool(user_id)
if community_id:
community = await self.client.app.get_community(community_id)
private_community = not community.is_public
Expand Down Expand Up @@ -782,8 +782,8 @@ async def search_community_data(
query: str,
community_id: str,
filter: Literal[
"MESSAGES", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
] = "MESSAGES",
"MESSAGE", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
] = "MESSAGE",
limit: int = 10,
page: int = 0,
) -> Union[List[Message], List[Group], List[Channel], List[SearchResultUser]]:
Expand All @@ -810,7 +810,7 @@ async def search_community_data(
response = await self.client.get(
"/v1/search/community-data?{}".format(urlencode(data))
)
if filter in ["MESSAGES", "MEDIA", "LINK"]:
if filter in ["MESSAGE", "MEDIA", "LINK"]:
return self.client.build_list(Message, response.data)
elif filter == "GROUP":
return self.client.build_list(Group, response.data)
Expand Down
4 changes: 2 additions & 2 deletions swibots/api/chat/methods/get_community_media_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ async def search_community_data(
query: str,
community_id: str,
filter: Literal[
"MESSAGES", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
] = "MESSAGES",
"MESSAGE", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
] = "MESSAGE",
limit: int = 10,
page: int = 0,
) -> Union[List[Message], List[Group], List[Channel], List[SearchResultUser]]:
Expand Down

0 comments on commit e980609

Please sign in to comment.