mirror of
https://github.com/EvolutionAPI/evolution-client-python.git
synced 2025-07-13 15:14:48 -06:00
Update version to 0.0.8, modify group service API endpoints to use query parameters, and update test instances. Remove old distribution files and add new ones for version 0.0.8.
This commit is contained in:
parent
f14781cdb6
commit
7e970f5f15
@ -14,39 +14,34 @@ class GroupService:
|
|||||||
|
|
||||||
def update_group_picture(self, instance_id: str, group_jid: str, data: GroupPicture, instance_token: str):
|
def update_group_picture(self, instance_id: str, group_jid: str, data: GroupPicture, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateGroupPicture/{instance_id}',
|
f'group/updateGroupPicture/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_group_subject(self, instance_id: str, group_jid: str, data: GroupSubject, instance_token: str):
|
def update_group_subject(self, instance_id: str, group_jid: str, data: GroupSubject, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateGroupSubject/{instance_id}',
|
f'group/updateGroupSubject/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_group_description(self, instance_id: str, group_jid: str, data: GroupDescription, instance_token: str):
|
def update_group_description(self, instance_id: str, group_jid: str, data: GroupDescription, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateGroupDescription/{instance_id}',
|
f'group/updateGroupDescription/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
def get_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/inviteCode/{instance_id}',
|
f'group/inviteCode/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def revoke_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
def revoke_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/revokeInviteCode/{instance_id}',
|
f'group/revokeInviteCode/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -59,59 +54,52 @@ class GroupService:
|
|||||||
|
|
||||||
def get_invite_info(self, instance_id: str, invite_code: str, instance_token: str):
|
def get_invite_info(self, instance_id: str, invite_code: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/inviteInfo/{instance_id}',
|
f'group/inviteInfo/{instance_id}?inviteCode={invite_code}',
|
||||||
params={'inviteCode': invite_code},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_group_info(self, instance_id: str, group_jid: str, instance_token: str):
|
def get_group_info(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/findGroupInfos/{instance_id}',
|
f'group/findGroupInfos/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def fetch_all_groups(self, instance_id: str, instance_token: str, get_participants: bool = False):
|
def fetch_all_groups(self, instance_id: str, instance_token: str, get_participants: bool = False):
|
||||||
|
url = f'group/fetchAllGroups/{instance_id}?getParticipants={str(get_participants).lower()}'
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/fetchAllGroups/{instance_id}',
|
url,
|
||||||
params={'getParticipants': get_participants},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_participants(self, instance_id: str, group_jid: str, instance_token: str):
|
def get_participants(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/participants/{instance_id}',
|
f'group/participants/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_participant(self, instance_id: str, group_jid: str, data: UpdateParticipant, instance_token: str):
|
def update_participant(self, instance_id: str, group_jid: str, data: UpdateParticipant, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateParticipant/{instance_id}',
|
f'group/updateParticipant/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_setting(self, instance_id: str, group_jid: str, data: UpdateSetting, instance_token: str):
|
def update_setting(self, instance_id: str, group_jid: str, data: UpdateSetting, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateSetting/{instance_id}',
|
f'group/updateSetting/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def toggle_ephemeral(self, instance_id: str, group_jid: str, data: ToggleEphemeral, instance_token: str):
|
def toggle_ephemeral(self, instance_id: str, group_jid: str, data: ToggleEphemeral, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/toggleEphemeral/{instance_id}',
|
f'group/toggleEphemeral/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def leave_group(self, instance_id: str, group_jid: str, instance_token: str):
|
def leave_group(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.delete(
|
return self.client.delete(
|
||||||
f'group/leaveGroup/{instance_id}',
|
f'group/leaveGroup/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
BIN
dist/evolutionapi-0.0.7.tar.gz
vendored
BIN
dist/evolutionapi-0.0.7.tar.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
dist/evolutionapi-0.0.8.tar.gz
vendored
Normal file
BIN
dist/evolutionapi-0.0.8.tar.gz
vendored
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 2.1
|
Metadata-Version: 2.1
|
||||||
Name: evolutionapi
|
Name: evolutionapi
|
||||||
Version: 0.0.7
|
Version: 0.0.8
|
||||||
Summary: Client Python para a API Evolution
|
Summary: Client Python para a API Evolution
|
||||||
Author: Davidson Gomes
|
Author: Davidson Gomes
|
||||||
Author-email: contato@agenciadgcode.com
|
Author-email: contato@agenciadgcode.com
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -14,39 +14,34 @@ class GroupService:
|
|||||||
|
|
||||||
def update_group_picture(self, instance_id: str, group_jid: str, data: GroupPicture, instance_token: str):
|
def update_group_picture(self, instance_id: str, group_jid: str, data: GroupPicture, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateGroupPicture/{instance_id}',
|
f'group/updateGroupPicture/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_group_subject(self, instance_id: str, group_jid: str, data: GroupSubject, instance_token: str):
|
def update_group_subject(self, instance_id: str, group_jid: str, data: GroupSubject, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateGroupSubject/{instance_id}',
|
f'group/updateGroupSubject/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_group_description(self, instance_id: str, group_jid: str, data: GroupDescription, instance_token: str):
|
def update_group_description(self, instance_id: str, group_jid: str, data: GroupDescription, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateGroupDescription/{instance_id}',
|
f'group/updateGroupDescription/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
def get_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/inviteCode/{instance_id}',
|
f'group/inviteCode/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def revoke_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
def revoke_invite_code(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/revokeInviteCode/{instance_id}',
|
f'group/revokeInviteCode/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -59,59 +54,52 @@ class GroupService:
|
|||||||
|
|
||||||
def get_invite_info(self, instance_id: str, invite_code: str, instance_token: str):
|
def get_invite_info(self, instance_id: str, invite_code: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/inviteInfo/{instance_id}',
|
f'group/inviteInfo/{instance_id}?inviteCode={invite_code}',
|
||||||
params={'inviteCode': invite_code},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_group_info(self, instance_id: str, group_jid: str, instance_token: str):
|
def get_group_info(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/findGroupInfos/{instance_id}',
|
f'group/findGroupInfos/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def fetch_all_groups(self, instance_id: str, instance_token: str, get_participants: bool = False):
|
def fetch_all_groups(self, instance_id: str, instance_token: str, get_participants: bool = False):
|
||||||
|
url = f'group/fetchAllGroups/{instance_id}?getParticipants={str(get_participants).lower()}'
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/fetchAllGroups/{instance_id}',
|
url,
|
||||||
params={'getParticipants': get_participants},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_participants(self, instance_id: str, group_jid: str, instance_token: str):
|
def get_participants(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
f'group/participants/{instance_id}',
|
f'group/participants/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_participant(self, instance_id: str, group_jid: str, data: UpdateParticipant, instance_token: str):
|
def update_participant(self, instance_id: str, group_jid: str, data: UpdateParticipant, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateParticipant/{instance_id}',
|
f'group/updateParticipant/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_setting(self, instance_id: str, group_jid: str, data: UpdateSetting, instance_token: str):
|
def update_setting(self, instance_id: str, group_jid: str, data: UpdateSetting, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/updateSetting/{instance_id}',
|
f'group/updateSetting/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def toggle_ephemeral(self, instance_id: str, group_jid: str, data: ToggleEphemeral, instance_token: str):
|
def toggle_ephemeral(self, instance_id: str, group_jid: str, data: ToggleEphemeral, instance_token: str):
|
||||||
return self.client.post(
|
return self.client.post(
|
||||||
f'group/toggleEphemeral/{instance_id}',
|
f'group/toggleEphemeral/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
data=data.__dict__,
|
data=data.__dict__,
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
||||||
|
|
||||||
def leave_group(self, instance_id: str, group_jid: str, instance_token: str):
|
def leave_group(self, instance_id: str, group_jid: str, instance_token: str):
|
||||||
return self.client.delete(
|
return self.client.delete(
|
||||||
f'group/leaveGroup/{instance_id}',
|
f'group/leaveGroup/{instance_id}?groupJid={group_jid}',
|
||||||
params={'groupJid': group_jid},
|
|
||||||
instance_token=instance_token
|
instance_token=instance_token
|
||||||
)
|
)
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='evolutionapi',
|
name='evolutionapi',
|
||||||
version='0.0.7',
|
version='0.0.8',
|
||||||
description='Client Python para a API Evolution',
|
description='Client Python para a API Evolution',
|
||||||
author='Davidson Gomes',
|
author='Davidson Gomes',
|
||||||
author_email='contato@agenciadgcode.com',
|
author_email='contato@agenciadgcode.com',
|
||||||
|
@ -11,8 +11,12 @@ client = EvolutionClient(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
instance_token = "429683C4C977415CAAFCCE10F7D57E11"
|
instance_token = "60BDC703E413-4710-9473-CA2A763866FE"
|
||||||
instance_id = "teste"
|
instance_id = "94a0aafa-e636-4534-a185-5562bf8f2c22"
|
||||||
|
|
||||||
|
response = client.group.fetch_all_groups(instance_id, instance_token, False)
|
||||||
|
|
||||||
|
print(response)
|
||||||
|
|
||||||
# text_message = TextMessage(
|
# text_message = TextMessage(
|
||||||
# number="557499879409",
|
# number="557499879409",
|
||||||
@ -25,18 +29,18 @@ instance_id = "teste"
|
|||||||
# print("Mensagem de texto enviada")
|
# print("Mensagem de texto enviada")
|
||||||
# print(response)
|
# print(response)
|
||||||
|
|
||||||
media_message = MediaMessage(
|
# media_message = MediaMessage(
|
||||||
number="557499879409",
|
# number="557499879409",
|
||||||
mediatype="document",
|
# mediatype="document",
|
||||||
mimetype="application/pdf",
|
# mimetype="application/pdf",
|
||||||
caption="Olá, como vai?",
|
# caption="Olá, como vai?",
|
||||||
fileName="arquivo.pdf"
|
# fileName="arquivo.pdf"
|
||||||
)
|
# )
|
||||||
|
|
||||||
response = client.messages.send_media(instance_id, media_message, instance_token, "arquivo.pdf")
|
# response = client.messages.send_media(instance_id, media_message, instance_token, "arquivo.pdf")
|
||||||
|
|
||||||
print("Mensagem de mídia enviada")
|
# print("Mensagem de mídia enviada")
|
||||||
print(response)
|
# print(response)
|
||||||
|
|
||||||
# print("Buscando instâncias")
|
# print("Buscando instâncias")
|
||||||
# instances = client.instances.fetch_instances()
|
# instances = client.instances.fetch_instances()
|
||||||
|
Loading…
Reference in New Issue
Block a user