chatgraph 0.3.0__py3-none-any.whl → 0.3.2__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.

chatgraph/__init__.py CHANGED
@@ -2,8 +2,9 @@ from .auth.credentials import Credential
2
2
  from .bot.chatbot_model import ChatbotApp
3
3
  from .bot.chatbot_router import ChatbotRouter
4
4
  from .messages.message_consumer import MessageConsumer
5
- from .types.message_types import UserCall, UserState, Element
6
- from .types.output_state import ChatbotResponse, RedirectResponse, EndChatResponse, TransferToHuman
5
+ from .types.request_types import UserCall, UserState
6
+ from .types.end_types import RedirectResponse, EndChatResponse, TransferToHuman
7
+ from .types.message_types import Message, Button, ListElements
7
8
  from .types.route import Route
8
9
 
9
10
  __all__ = [
@@ -18,5 +19,7 @@ __all__ = [
18
19
  'EndChatResponse',
19
20
  'TransferToHuman',
20
21
  'UserState',
21
- 'Element',
22
+ 'Message',
23
+ 'Button',
24
+ 'ListElements'
22
25
  ]
@@ -6,8 +6,9 @@ from logging import error
6
6
 
7
7
  from ..error.chatbot_error import ChatbotError, ChatbotMessageError
8
8
  from ..messages.message_consumer import MessageConsumer
9
- from ..types.message_types import UserCall
10
- from ..types.output_state import ChatbotResponse, RedirectResponse, EndChatResponse, TransferToHuman
9
+ from ..types.request_types import UserCall
10
+ from ..types.message_types import messageTypes, Message, Button, ListElements
11
+ from ..types.end_types import RedirectResponse, EndChatResponse, TransferToHuman
11
12
  from ..types.route import Route
12
13
  from .chatbot_router import ChatbotRouter
13
14
 
@@ -17,13 +18,16 @@ class ChatbotApp:
17
18
  Classe principal para a aplicação do chatbot, gerencia as rotas e a lógica de processamento de mensagens.
18
19
  """
19
20
 
20
- def __init__(self, message_consumer: MessageConsumer):
21
+ def __init__(self, message_consumer: MessageConsumer = None):
21
22
  """
22
23
  Inicializa a classe ChatbotApp com um estado de usuário e um consumidor de mensagens.
23
24
 
24
25
  Args:
25
26
  message_consumer (MessageConsumer): O consumidor de mensagens que lida com a entrada de mensagens no sistema.
26
27
  """
28
+ if not message_consumer:
29
+ message_consumer = MessageConsumer.load_dotenv()
30
+
27
31
  self.__message_consumer = message_consumer
28
32
  self.__routes = {}
29
33
 
@@ -125,6 +129,7 @@ class ChatbotApp:
125
129
  raise ChatbotMessageError(
126
130
  customer_id, f'Rota não encontrada para {route}!'
127
131
  )
132
+
128
133
  func = handler['function']
129
134
  userCall_name = handler['params'].get(UserCall, None)
130
135
  route_state_name = handler['params'].get(Route, None)
@@ -136,42 +141,42 @@ class ChatbotApp:
136
141
  kwargs[route_state_name] = Route(route, list(self.__routes.keys()))
137
142
 
138
143
  userCall_response = func(**kwargs)
144
+
145
+ if isinstance(userCall_response, (list, tuple)):
146
+ for response in userCall_response:
147
+ self.__process_func_response(response, userCall)
139
148
 
140
- if type(userCall_response) in (str, float, int):
141
- response = ChatbotResponse(userCall_response)
142
- response = response.json()
143
- response['user_state'] = {
144
- 'customer_id': customer_id,
145
- 'route': route,
146
- 'menu': menu,
147
- 'obs': obs,
148
- }
149
- return json.dumps(response)
150
- elif type(userCall_response) == ChatbotResponse:
151
- adjusted_route = self.__adjust_route(userCall_response.route, route)
152
- response = userCall_response.json()
153
- response['user_state'] = {
154
- 'customer_id': customer_id,
155
- 'route': adjusted_route,
156
- 'menu': menu,
157
- 'obs': obs,
158
- }
159
- return json.dumps(response)
160
- elif type(userCall_response) in (EndChatResponse, TransferToHuman):
161
- response = userCall_response.json()
162
- response['user_state'] = {
163
- 'customer_id': customer_id,
164
- 'menu': None,
165
- 'route': None,
166
- 'obs': None,
167
- }
168
- return json.dumps(response)
149
+ def __process_func_response(self, userCall_response, userCall: UserCall):
150
+
151
+ if isinstance(userCall_response, (str, float, int)):
152
+ userCall.send(Message(text=userCall_response))
153
+ return
154
+
155
+ elif isinstance(userCall_response, Route):
156
+ userCall.route = userCall_response.current
157
+ return
158
+
159
+ elif isinstance(userCall_response, (Message, Button, ListElements)):
160
+ userCall.send(userCall_response)
161
+
162
+ return
163
+
164
+ elif isinstance(userCall_response, EndChatResponse):
165
+ userCall.end_chat(userCall_response.obersevations, userCall_response.tabulation_id)
166
+ return
169
167
 
170
- elif type(userCall_response) == RedirectResponse:
168
+ elif isinstance(userCall_response, TransferToHuman):
169
+ userCall.transfer_to_human(userCall_response.observations, userCall_response.campaign_id)
170
+ return
171
+
172
+ elif isinstance(userCall_response, RedirectResponse):
171
173
  route = self.__adjust_route(userCall_response.route, route)
172
174
  userCall.route = route
173
175
  return self.process_message(userCall)
174
-
176
+
177
+ elif not userCall_response:
178
+ return
179
+
175
180
  else:
176
181
  error('Tipo de retorno inválido!')
177
182
  return None
@@ -1,3 +1,4 @@
1
+
1
2
  import inspect
2
3
  from functools import wraps
3
4
  from logging import debug
@@ -37,6 +38,7 @@ class ChatbotRouter:
37
38
  signature = inspect.signature(func)
38
39
  output_param = signature.return_annotation
39
40
 
41
+ # Itera sobre os parâmetros da função e extrai seus tipos
40
42
  for name, param in signature.parameters.items():
41
43
  param_type = (
42
44
  param.annotation
@@ -46,6 +48,7 @@ class ChatbotRouter:
46
48
  params[param_type] = name
47
49
  debug(f'Parameter: {name}, Type: {param_type}')
48
50
 
51
+ # Adiciona a função e seus parâmetros à rota especificada
49
52
  self.routes[route_name.strip().lower()] = {
50
53
  'function': func,
51
54
  'params': params,
@@ -74,6 +77,7 @@ class ChatbotRouter:
74
77
  if 'start' not in router.routes.keys():
75
78
  raise ChatbotError('Erro ao incluir rota, start não encontrado!')
76
79
 
80
+ # Adiciona prefixo às rotas do roteador incluído
77
81
  prefixed_routes = {
78
82
  (
79
83
  f'{prefix.lower()}'
@@ -0,0 +1,189 @@
1
+ import typer
2
+ from rich.console import Console
3
+ from rich.table import Table
4
+ from rich.text import Text
5
+ from rich.panel import Panel
6
+ from dotenv import load_dotenv
7
+ from ..gRPC.gRPCCall import WhatsappServiceClient, UserStateServiceClient
8
+ import os, re
9
+
10
+ load_dotenv()
11
+ app = typer.Typer()
12
+
13
+ @app.command()
14
+ def configs():
15
+ """Recupera os IDs necessários."""
16
+ console = Console()
17
+
18
+ username = os.getenv('RABBIT_USER')
19
+ password = os.getenv('RABBIT_PASS')
20
+ url = os.getenv('RABBIT_URI')
21
+ queue = os.getenv('RABBIT_QUEUE')
22
+ prefetch = os.getenv('RABBIT_PREFETCH', 1)
23
+ vhost = os.getenv('RABBIT_VHOST', '/')
24
+ grpc = os.getenv('GRPC_URI')
25
+
26
+
27
+ tableRabbit = Table(show_header=True, header_style="bold magenta", title="RabbitMQ Consumer")
28
+ tableRabbit.add_column("Atributo", justify="center", style="cyan", no_wrap=True)
29
+ tableRabbit.add_column("Valor", justify="center", style="magenta")
30
+
31
+ tableRabbit.add_row("Virtual Host", vhost)
32
+ tableRabbit.add_row("Prefetch Count", str(prefetch))
33
+ tableRabbit.add_row("Queue Consume", queue)
34
+ tableRabbit.add_row("AMQP URL", url)
35
+ tableRabbit.add_row("Username", username)
36
+ tableRabbit.add_row("Password", "******")
37
+
38
+
39
+ tableGRPC = Table(show_header=True, header_style="bold magenta", title="gRPC Consumer")
40
+ tableGRPC.add_column("Atributo", justify="center", style="cyan", no_wrap=True)
41
+ tableGRPC.add_column("Valor", justify="center", style="magenta")
42
+
43
+ tableGRPC.add_row("URI", grpc)
44
+
45
+ console.print(tableGRPC, justify="center")
46
+ console.print(tableRabbit, justify="center")
47
+
48
+ @app.command()
49
+ def campaigns(regex: str = typer.Option(None, "--regex", "-r", help="Filtro regex para campanhas.")):
50
+ """Recupera as campanhas cadastradas."""
51
+ grpc = os.getenv('GRPC_URI')
52
+
53
+ wwp = WhatsappServiceClient(grpc)
54
+ campaigns = wwp.get_all_campaigns()
55
+
56
+ console = Console()
57
+ tableGRPC = Table(show_header=True, header_style="bold magenta", title="Campaigns")
58
+ tableGRPC.add_column("campaign_id", justify="center", style="cyan", no_wrap=True)
59
+ tableGRPC.add_column("campaign_name", justify="center", style="magenta")
60
+ tableGRPC.add_column("last_update", justify="center", style="magenta")
61
+
62
+ # Aplicar filtro de regex, se fornecido
63
+ filtered_campaigns = campaigns.campaigns
64
+ if regex:
65
+ pattern = re.compile(regex)
66
+ filtered_campaigns = [
67
+ campaign for campaign in campaigns.campaigns
68
+ if pattern.search(campaign.campaign_name)
69
+ ]
70
+
71
+ for campaign in filtered_campaigns:
72
+ tableGRPC.add_row(campaign.campaign_id, campaign.campaign_name, campaign.last_update)
73
+
74
+ console.print(tableGRPC, justify="center")
75
+
76
+ @app.command()
77
+ def tabulations(
78
+ regex: str = typer.Option(None, "--regex", "-r", help="Filtro regex para as tabulações.")
79
+ ):
80
+ """Recupera as tabulações cadastradas."""
81
+ grpc = os.getenv('GRPC_URI')
82
+
83
+ wwp = WhatsappServiceClient(grpc)
84
+ tabulations = wwp.get_all_tabulations()
85
+
86
+ console = Console()
87
+ tableGRPC = Table(show_header=True, header_style="bold magenta", title="Tabulations")
88
+ tableGRPC.add_column("tabulation_id", justify="center", style="cyan", no_wrap=True)
89
+ tableGRPC.add_column("tabulation_name", justify="center", style="magenta")
90
+ tableGRPC.add_column("tabulation_type", justify="center", style="magenta")
91
+ tableGRPC.add_column("group_name", justify="center", style="magenta")
92
+ tableGRPC.add_column("customer_service_survey_id", justify="center", style="magenta")
93
+ tableGRPC.add_column("last_update", justify="center", style="magenta")
94
+
95
+ # Aplicar filtro de regex, se fornecido
96
+ filtered_tabulations = tabulations.tabulations
97
+ if regex:
98
+ pattern = re.compile(regex, re.IGNORECASE)
99
+ filtered_tabulations = [
100
+ tabulation for tabulation in tabulations.tabulations
101
+ if (
102
+ pattern.search(tabulation.tabulation_id) or
103
+ pattern.search(tabulation.tabulation_name) or
104
+ pattern.search(tabulation.tabulation_type) or
105
+ pattern.search(tabulation.group_name) or
106
+ (tabulation.customer_service_survey_id and pattern.search(tabulation.customer_service_survey_id)) or
107
+ pattern.search(tabulation.last_update)
108
+ )
109
+ ]
110
+
111
+ for tabulation in filtered_tabulations:
112
+ tableGRPC.add_row(
113
+ tabulation.tabulation_id,
114
+ tabulation.tabulation_name,
115
+ tabulation.tabulation_type,
116
+ tabulation.group_name,
117
+ tabulation.customer_service_survey_id or "N/A",
118
+ tabulation.last_update,
119
+ )
120
+
121
+ console.print(tableGRPC, justify="center")
122
+
123
+
124
+ @app.command("ustate")
125
+ def user_state(
126
+ regex: str = typer.Option(None, "--regex", "-r", help="Filtro regex para os estados do usuário.")
127
+ ):
128
+ """Recupera os UserState em operação no momento."""
129
+ grpc = os.getenv('GRPC_URI')
130
+
131
+ ustate = UserStateServiceClient(grpc)
132
+ userstates = ustate.get_all_user_states()
133
+
134
+ console = Console()
135
+ tableGRPC = Table(show_header=True, header_style="bold magenta", title="User States")
136
+ tableGRPC.add_column("user_id", justify="center", style="cyan", no_wrap=True)
137
+ tableGRPC.add_column("menu_id", justify="center", style="magenta")
138
+ tableGRPC.add_column("route", justify="center", style="magenta")
139
+ tableGRPC.add_column("obs", justify="center", style="magenta")
140
+ tableGRPC.add_column("date", justify="center", style="magenta")
141
+ tableGRPC.add_column("direction", justify="center", style="magenta")
142
+
143
+ # Aplicar filtro de regex, se fornecido
144
+ filtered_user_states = userstates.user_states
145
+ if regex:
146
+ pattern = re.compile(regex, re.IGNORECASE)
147
+ filtered_user_states = [
148
+ userstate for userstate in userstates.user_states
149
+ if (
150
+ pattern.search(userstate.user_id) or
151
+ pattern.search(userstate.menu_id) or
152
+ pattern.search(userstate.route) or
153
+ pattern.search(userstate.obs) or
154
+ pattern.search(userstate.date) or
155
+ pattern.search(str(userstate.direction))
156
+ )
157
+ ]
158
+
159
+ for userstate in filtered_user_states:
160
+ tableGRPC.add_row(
161
+ userstate.user_id,
162
+ userstate.menu_id,
163
+ userstate.route,
164
+ userstate.obs,
165
+ userstate.date,
166
+ str(userstate.direction),
167
+ )
168
+
169
+ console.print(tableGRPC, justify="center")
170
+
171
+ @app.command("del-ustate")
172
+ def delete_user_state(user_id: str = typer.Argument(..., help="ID do UserState a ser deletado.")):
173
+ """Deleta um UserState em operação no momento."""
174
+ grpc = os.getenv('GRPC_URI')
175
+
176
+ ustate = UserStateServiceClient(grpc)
177
+
178
+ # Chama o método para deletar o UserState usando o ID fornecido
179
+ try:
180
+ success = ustate.delete_user_state(user_id)
181
+ if success:
182
+ typer.echo(f"UserState com ID '{user_id}' deletado com sucesso.")
183
+ else:
184
+ typer.echo(f"Falha ao deletar UserState com ID '{user_id}'.", err=True)
185
+ except Exception as e:
186
+ typer.echo(f"Erro ao tentar deletar UserState: {e}", err=True)
187
+
188
+ def main():
189
+ app()
@@ -22,6 +22,7 @@ class WhatsappServiceClient:
22
22
 
23
23
  # Cria o stub (client) para o serviço gRPC
24
24
  self.stub = whatsapp_pb2_grpc.MessageServiceStub(self.channel)
25
+ self.actions_stub = whatsapp_pb2_grpc.ActionsServiceStub(self.channel)
25
26
 
26
27
  def send_button(self, message_data):
27
28
  # Cria o request para o método SendButton
@@ -58,6 +59,78 @@ class WhatsappServiceClient:
58
59
  except grpc.RpcError as e:
59
60
  print(f"Erro ao fazer a requisição gRPC SendText: {e}")
60
61
  return None
62
+
63
+ def transfer_to_human(self, message_data):
64
+ # Cria o request para o método TransferToHuman
65
+ request = whatsapp_pb2.MessageRequest(**message_data)
66
+
67
+ # Faz a chamada ao serviço gRPC
68
+ try:
69
+ response = self.stub.TransferToHuman(request)
70
+ return response
71
+ except grpc.RpcError as e:
72
+ print(f"Erro ao fazer a requisição gRPC TransferToHuman: {e}")
73
+ return None
74
+
75
+ def end_chat(self, message_data):
76
+ # Cria o request para o método EndChat
77
+ request = whatsapp_pb2.MessageRequest(**message_data)
78
+
79
+ # Faz a chamada ao serviço gRPC
80
+ try:
81
+ response = self.stub.EndChat(request)
82
+ return response
83
+ except grpc.RpcError as e:
84
+ print(f"Erro ao fazer a requisição gRPC EndChat: {e}")
85
+ return None
86
+
87
+ def get_campaign_id(self, campaign_name):
88
+ # Cria o request para o método GetCampaignID
89
+ request = whatsapp_pb2.CampaignName(campaign_name=campaign_name)
90
+
91
+ # Faz a chamada ao serviço gRPC
92
+ try:
93
+ response = self.actions_stub.GetCampaignID(request)
94
+ return response
95
+ except grpc.RpcError as e:
96
+ print(f"Erro ao fazer a requisição gRPC GetCampaignID: {e}")
97
+ return None
98
+
99
+ def get_tabulation_id(self, tabulation_name):
100
+ # Cria o request para o método GetTabulationID
101
+ request = whatsapp_pb2.TabulationName(tabulation_name=tabulation_name)
102
+
103
+ # Faz a chamada ao serviço gRPC
104
+ try:
105
+ response = self.actions_stub.GetTabulationID(request)
106
+ return response
107
+ except grpc.RpcError as e:
108
+ print(f"Erro ao fazer a requisição gRPC GetTabulationID: {e}")
109
+ return None
110
+
111
+ def get_all_campaigns(self):
112
+ # Cria o request para o método GetAllCampaigns
113
+ request = whatsapp_pb2.Void()
114
+
115
+ # Faz a chamada ao serviço gRPC
116
+ try:
117
+ response = self.actions_stub.GetCampaignsList(request)
118
+ return response
119
+ except grpc.RpcError as e:
120
+ print(f"Erro ao fazer a requisição gRPC GetAllCampaigns: {e}")
121
+ return None
122
+
123
+ def get_all_tabulations(self):
124
+ # Cria o request para o método GetAllTabulations
125
+ request = whatsapp_pb2.Void()
126
+
127
+ # Faz a chamada ao serviço gRPC
128
+ try:
129
+ response = self.actions_stub.GetTabulationsList(request)
130
+ return response
131
+ except grpc.RpcError as e:
132
+ print(f"Erro ao fazer a requisição gRPC GetAllTabulations: {e}")
133
+ return None
61
134
 
62
135
  class UserStateServiceClient:
63
136
  def __init__(self, grpc_uri=None):
@@ -122,4 +195,16 @@ class UserStateServiceClient:
122
195
  return response
123
196
  except grpc.RpcError as e:
124
197
  print(f"Erro ao fazer a requisição gRPC DeleteUserState: {e}")
198
+ return None
199
+
200
+ def get_all_user_states(self):
201
+ # Cria o request para o método GetAllUserStates
202
+ request = userstate_pb2.Void()
203
+
204
+ # Faz a chamada ao serviço gRPC
205
+ try:
206
+ response = self.stub.GetAllUserStates(request)
207
+ return response
208
+ except grpc.RpcError as e:
209
+ print(f"Erro ao fazer a requisição gRPC GetAllUserStates: {e}")
125
210
  return None
@@ -4,7 +4,7 @@ import os
4
4
  import pika
5
5
  from typing import Callable
6
6
  from ..auth.credentials import Credential
7
- from ..types.message_types import UserCall, UserState
7
+ from ..types.request_types import UserCall, UserState
8
8
  from rich.console import Console
9
9
  from rich.table import Table
10
10
  from rich.text import Text
@@ -146,16 +146,8 @@ class MessageConsumer:
146
146
  message = body.decode()
147
147
  message_json = json.loads(message)
148
148
  pure_message = self.__transform_message(message_json)
149
- response = process_message(pure_message)
149
+ process_message(pure_message)
150
150
 
151
- ch.basic_publish(
152
- exchange='',
153
- routing_key=props.reply_to,
154
- properties=pika.BasicProperties(
155
- correlation_id=props.correlation_id
156
- ),
157
- body=str(response),
158
- )
159
151
  ch.basic_ack(delivery_tag=method.delivery_tag)
160
152
 
161
153
  def __transform_message(self, message: dict) -> UserCall:
@@ -170,6 +162,10 @@ class MessageConsumer:
170
162
  """
171
163
 
172
164
  user_state = message.get('user_state', {})
165
+ obs = user_state.get('obs', {})
166
+ if isinstance(obs, str):
167
+ obs = json.loads(obs)
168
+
173
169
  return UserCall(
174
170
  type=message.get('type', ''),
175
171
  text=message.get('text', ''),
@@ -178,7 +174,7 @@ class MessageConsumer:
178
174
  menu=user_state.get('menu', ''),
179
175
  route=user_state.get('route', ''),
180
176
  lst_update=user_state.get('lst_update', ''),
181
- obs=user_state.get('obs', {}),
177
+ obs=obs,
182
178
  ),
183
179
  channel=message.get('channel', ''),
184
180
  customer_phone=message.get('customer_phone', ''),
@@ -9,6 +9,11 @@ service UserStateService {
9
9
  rpc InsertUserState(UserState) returns (RequestStatus);
10
10
  rpc UpdateUserState(UserState) returns (RequestStatus);
11
11
  rpc DeleteUserState(UserStateId) returns (RequestStatus);
12
+
13
+ rpc GetAllUserStates(Void) returns (UserStatesList);
14
+ }
15
+
16
+ message Void {
12
17
  }
13
18
 
14
19
  message UserState {
@@ -17,6 +22,7 @@ message UserState {
17
22
  string route = 3;
18
23
  string obs = 4;
19
24
  string date = 5;
25
+ string direction = 6;
20
26
  }
21
27
 
22
28
  message UserStateId {
@@ -26,4 +32,8 @@ message UserStateId {
26
32
  message RequestStatus {
27
33
  bool status = 1;
28
34
  string message = 2;
35
+ }
36
+
37
+ message UserStatesList {
38
+ repeated UserState user_states = 1;
29
39
  }
@@ -24,7 +24,7 @@ _sym_db = _symbol_database.Default()
24
24
 
25
25
 
26
26
 
27
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fuserstate.proto\x12\tuserstate\"W\n\tUserState\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x0f\n\x07menu_id\x18\x02 \x01(\t\x12\r\n\x05route\x18\x03 \x01(\t\x12\x0b\n\x03obs\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x61te\x18\x05 \x01(\t\"\x1e\n\x0bUserStateId\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"0\n\rRequestStatus\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t2\x9e\x02\n\x10UserStateService\x12?\n\x0fSelectUserState\x12\x16.userstate.UserStateId\x1a\x14.userstate.UserState\x12\x41\n\x0fInsertUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x41\n\x0fUpdateUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x43\n\x0f\x44\x65leteUserState\x12\x16.userstate.UserStateId\x1a\x18.userstate.RequestStatusB\x10Z\x0e./pb/userstateb\x06proto3')
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fuserstate.proto\x12\tuserstate\"\x06\n\x04Void\"j\n\tUserState\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x0f\n\x07menu_id\x18\x02 \x01(\t\x12\r\n\x05route\x18\x03 \x01(\t\x12\x0b\n\x03obs\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x61te\x18\x05 \x01(\t\x12\x11\n\tdirection\x18\x06 \x01(\t\"\x1e\n\x0bUserStateId\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"0\n\rRequestStatus\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\";\n\x0eUserStatesList\x12)\n\x0buser_states\x18\x01 \x03(\x0b\x32\x14.userstate.UserState2\xde\x02\n\x10UserStateService\x12?\n\x0fSelectUserState\x12\x16.userstate.UserStateId\x1a\x14.userstate.UserState\x12\x41\n\x0fInsertUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x41\n\x0fUpdateUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x43\n\x0f\x44\x65leteUserState\x12\x16.userstate.UserStateId\x1a\x18.userstate.RequestStatus\x12>\n\x10GetAllUserStates\x12\x0f.userstate.Void\x1a\x19.userstate.UserStatesListB\x10Z\x0e./pb/userstateb\x06proto3')
28
28
 
29
29
  _globals = globals()
30
30
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -32,12 +32,16 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'userstate_pb2', _globals)
32
32
  if not _descriptor._USE_C_DESCRIPTORS:
33
33
  _globals['DESCRIPTOR']._loaded_options = None
34
34
  _globals['DESCRIPTOR']._serialized_options = b'Z\016./pb/userstate'
35
- _globals['_USERSTATE']._serialized_start=30
36
- _globals['_USERSTATE']._serialized_end=117
37
- _globals['_USERSTATEID']._serialized_start=119
38
- _globals['_USERSTATEID']._serialized_end=149
39
- _globals['_REQUESTSTATUS']._serialized_start=151
40
- _globals['_REQUESTSTATUS']._serialized_end=199
41
- _globals['_USERSTATESERVICE']._serialized_start=202
42
- _globals['_USERSTATESERVICE']._serialized_end=488
35
+ _globals['_VOID']._serialized_start=30
36
+ _globals['_VOID']._serialized_end=36
37
+ _globals['_USERSTATE']._serialized_start=38
38
+ _globals['_USERSTATE']._serialized_end=144
39
+ _globals['_USERSTATEID']._serialized_start=146
40
+ _globals['_USERSTATEID']._serialized_end=176
41
+ _globals['_REQUESTSTATUS']._serialized_start=178
42
+ _globals['_REQUESTSTATUS']._serialized_end=226
43
+ _globals['_USERSTATESLIST']._serialized_start=228
44
+ _globals['_USERSTATESLIST']._serialized_end=287
45
+ _globals['_USERSTATESERVICE']._serialized_start=290
46
+ _globals['_USERSTATESERVICE']._serialized_end=640
43
47
  # @@protoc_insertion_point(module_scope)
@@ -5,7 +5,7 @@ import warnings
5
5
 
6
6
  import chatgraph.pb.userstate_pb2 as userstate__pb2
7
7
 
8
- GRPC_GENERATED_VERSION = '1.66.2'
8
+ GRPC_GENERATED_VERSION = '1.67.0'
9
9
  GRPC_VERSION = grpc.__version__
10
10
  _version_not_supported = False
11
11
 
@@ -54,6 +54,11 @@ class UserStateServiceStub(object):
54
54
  request_serializer=userstate__pb2.UserStateId.SerializeToString,
55
55
  response_deserializer=userstate__pb2.RequestStatus.FromString,
56
56
  _registered_method=True)
57
+ self.GetAllUserStates = channel.unary_unary(
58
+ '/userstate.UserStateService/GetAllUserStates',
59
+ request_serializer=userstate__pb2.Void.SerializeToString,
60
+ response_deserializer=userstate__pb2.UserStatesList.FromString,
61
+ _registered_method=True)
57
62
 
58
63
 
59
64
  class UserStateServiceServicer(object):
@@ -83,6 +88,12 @@ class UserStateServiceServicer(object):
83
88
  context.set_details('Method not implemented!')
84
89
  raise NotImplementedError('Method not implemented!')
85
90
 
91
+ def GetAllUserStates(self, request, context):
92
+ """Missing associated documentation comment in .proto file."""
93
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
94
+ context.set_details('Method not implemented!')
95
+ raise NotImplementedError('Method not implemented!')
96
+
86
97
 
87
98
  def add_UserStateServiceServicer_to_server(servicer, server):
88
99
  rpc_method_handlers = {
@@ -106,6 +117,11 @@ def add_UserStateServiceServicer_to_server(servicer, server):
106
117
  request_deserializer=userstate__pb2.UserStateId.FromString,
107
118
  response_serializer=userstate__pb2.RequestStatus.SerializeToString,
108
119
  ),
120
+ 'GetAllUserStates': grpc.unary_unary_rpc_method_handler(
121
+ servicer.GetAllUserStates,
122
+ request_deserializer=userstate__pb2.Void.FromString,
123
+ response_serializer=userstate__pb2.UserStatesList.SerializeToString,
124
+ ),
109
125
  }
110
126
  generic_handler = grpc.method_handlers_generic_handler(
111
127
  'userstate.UserStateService', rpc_method_handlers)
@@ -224,3 +240,30 @@ class UserStateService(object):
224
240
  timeout,
225
241
  metadata,
226
242
  _registered_method=True)
243
+
244
+ @staticmethod
245
+ def GetAllUserStates(request,
246
+ target,
247
+ options=(),
248
+ channel_credentials=None,
249
+ call_credentials=None,
250
+ insecure=False,
251
+ compression=None,
252
+ wait_for_ready=None,
253
+ timeout=None,
254
+ metadata=None):
255
+ return grpc.experimental.unary_unary(
256
+ request,
257
+ target,
258
+ '/userstate.UserStateService/GetAllUserStates',
259
+ userstate__pb2.Void.SerializeToString,
260
+ userstate__pb2.UserStatesList.FromString,
261
+ options,
262
+ channel_credentials,
263
+ insecure,
264
+ call_credentials,
265
+ compression,
266
+ wait_for_ready,
267
+ timeout,
268
+ metadata,
269
+ _registered_method=True)