chatgraph 0.3.13__py3-none-any.whl → 0.3.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chatgraph might be problematic. Click here for more details.

@@ -2,6 +2,7 @@ from chatgraph.gRPC.gRPCCall import WhatsappServiceClient, UserStateServiceClien
2
2
  from chatgraph.types.message_types import Message, Button, ListElements, messageTypes, MessageTypes
3
3
  from dataclasses import dataclass
4
4
  from typing import Optional
5
+ from datetime import datetime
5
6
  import json, os
6
7
 
7
8
  @dataclass
@@ -73,6 +74,28 @@ class UserState:
73
74
 
74
75
  user_state_client.delete_user_state(self.customer_id)
75
76
 
77
+ @classmethod
78
+ def get_user_state(cls, customer_id: str, grpc_uri: Optional[str] = None) -> 'UserState':
79
+ if grpc_uri is None:
80
+ grpc_uri = os.getenv('GRPC_URI')
81
+ user_state_client = UserStateServiceClient(grpc_uri)
82
+
83
+ response = user_state_client.select_user_state(user_id=customer_id)
84
+
85
+ if not response:
86
+ raise ValueError("Erro ao buscar estado do usuário.")
87
+
88
+ date = datetime.strptime(response.date, "%Y-%m-%d %H:%M:%S")
89
+ return cls(
90
+ customer_id=response.user_id,
91
+ menu=response.menu_id,
92
+ route=response.route,
93
+ obs=json.loads(response.obs),
94
+ direction_in=response.direction,
95
+ voll_id=response.voll_id,
96
+ platform=response.platform,
97
+ lst_update=date,
98
+ )
76
99
  class UserCall:
77
100
  """
78
101
  Representa uma mensagem recebida ou enviada pelo chatbot.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chatgraph
3
- Version: 0.3.13
3
+ Version: 0.3.14
4
4
  Summary: A user-friendly chatbot library
5
5
  Home-page: https://github.com/irissonnlima/chatgraph
6
6
  License: MIT
@@ -15,10 +15,10 @@ chatgraph/pb/voll_pb2.py,sha256=WLwE7F1pe_elcnwRnSFqVDcFihLZ3JBq4ScTHNCqWGA,5328
15
15
  chatgraph/pb/voll_pb2_grpc.py,sha256=U-_nXTAIEzo2GMYjHiphbSyTx3zyipsnKebFuZuoU1k,17685
16
16
  chatgraph/types/end_types.py,sha256=--Ty2gM_y7J-yRAvZV26e4HMUpoguAMAhfOIS9-kQTk,1316
17
17
  chatgraph/types/message_types.py,sha256=l488K4sVhTdOY5bbk47Y-qjfvfyn4h7bpmOFf2xGods,3334
18
- chatgraph/types/request_types.py,sha256=_TMQlGx6FD--XlLtSf3_sciJiWKAuJrFGM32h5nCBos,10743
18
+ chatgraph/types/request_types.py,sha256=LOJPZF0GtSlvTw8pDqmAzQ5zR3znADJdDkItRA5E2Wg,11641
19
19
  chatgraph/types/route.py,sha256=2fuHEPKUL_Vuv4g8pB6M7eJLouxXasqjesdju6_eumE,2757
20
- chatgraph-0.3.13.dist-info/entry_points.txt,sha256=bO9_Q-PqE5vCNNo6ke_-3j2gHfKQMDGnKDTkNuCdBuA,48
21
- chatgraph-0.3.13.dist-info/LICENSE,sha256=rVJozpRzDlplOpvI8A1GvmfVS0ReYdZvMWc1j2jV0v8,1090
22
- chatgraph-0.3.13.dist-info/METADATA,sha256=BJ8Kmg4aM8vF9D7puWofNAsQLJp8aRTpIh9aXIhBrSI,12782
23
- chatgraph-0.3.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
24
- chatgraph-0.3.13.dist-info/RECORD,,
20
+ chatgraph-0.3.14.dist-info/entry_points.txt,sha256=bO9_Q-PqE5vCNNo6ke_-3j2gHfKQMDGnKDTkNuCdBuA,48
21
+ chatgraph-0.3.14.dist-info/LICENSE,sha256=rVJozpRzDlplOpvI8A1GvmfVS0ReYdZvMWc1j2jV0v8,1090
22
+ chatgraph-0.3.14.dist-info/METADATA,sha256=COT96mOosUKy3nvw1M5KLAf7FVWmEJp5wwAt9Tlm8_I,12782
23
+ chatgraph-0.3.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
24
+ chatgraph-0.3.14.dist-info/RECORD,,