forked from EvolutionAPI/evolution-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstance_operations.py
More file actions
28 lines (21 loc) · 1.2 KB
/
instance_operations.py
File metadata and controls
28 lines (21 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from ..models.presence import PresenceStatus, PresenceConfig
class InstanceOperationsService:
def __init__(self, client):
self.client = client
def connect(self, instance_id: str, instance_token: str):
return self.client.get(f'instance/connect/{instance_id}', instance_token)
def restart(self, instance_id: str, instance_token: str):
return self.client.post(f'instance/restart/{instance_id}', instance_token=instance_token)
def set_presence(self, instance_id: str, presence: PresenceStatus, instance_token: str):
config = PresenceConfig(presence)
return self.client.post(
f'instance/setPresence/{instance_id}',
data=config.__dict__,
instance_token=instance_token
)
def get_connection_state(self, instance_id: str, instance_token: str):
return self.client.get(f'instance/connectionState/{instance_id}', instance_token)
def logout(self, instance_id: str, instance_token: str):
return self.client.delete(f'instance/logout/{instance_id}', instance_token)
def delete(self, instance_id: str, instance_token: str):
return self.client.delete(f'instance/delete/{instance_id}', instance_token)