opengater-globalauth-client 0.1.6__tar.gz → 0.2.0__tar.gz

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.
Files changed (19) hide show
  1. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/.idea/misc.xml +3 -0
  2. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/.idea/workspace.xml +4 -1
  3. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/PKG-INFO +1 -1
  4. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/pyproject.toml +1 -1
  5. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/__init__.py +1 -1
  6. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/broker/publisher.py +16 -26
  7. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  8. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/.idea/modules.xml +0 -0
  9. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/.idea/opengater-globalauth-client.iml +0 -0
  10. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/README.md +0 -0
  11. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/broker/__init__.py +0 -0
  12. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/broker/consumer.py +0 -0
  13. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/broker/events.py +0 -0
  14. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/client.py +0 -0
  15. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/exceptions.py +0 -0
  16. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/fastapi/__init__.py +0 -0
  17. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/fastapi/dependencies.py +0 -0
  18. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/fastapi/middleware.py +0 -0
  19. {opengater_globalauth_client-0.1.6 → opengater_globalauth_client-0.2.0}/src/opengater_globalauth_client/models.py +0 -0
@@ -1,4 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.13 (Raffle)" />
5
+ </component>
3
6
  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (Raffle)" project-jdk-type="Python SDK" />
4
7
  </project>
@@ -84,7 +84,10 @@
84
84
  <workItem from="1769150497374" duration="620000" />
85
85
  <workItem from="1769431218749" duration="1266000" />
86
86
  <workItem from="1769441499505" duration="3030000" />
87
- <workItem from="1769700383611" duration="1547000" />
87
+ <workItem from="1769700383611" duration="2175000" />
88
+ <workItem from="1770031924559" duration="599000" />
89
+ <workItem from="1770066805324" duration="622000" />
90
+ <workItem from="1770186351714" duration="1460000" />
88
91
  </task>
89
92
  <servers />
90
93
  </component>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opengater-globalauth-client
3
- Version: 0.1.6
3
+ Version: 0.2.0
4
4
  Summary: Client library for GlobalAuth authentication service
5
5
  Project-URL: Homepage, https://github.com/opengater/globalauth-client
6
6
  Project-URL: Documentation, https://github.com/opengater/globalauth-client#readme
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "opengater-globalauth-client"
3
- version = "0.1.6"
3
+ version = "0.2.0"
4
4
  description = "Client library for GlobalAuth authentication service"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -63,7 +63,7 @@ FastAPI integration:
63
63
  ```
64
64
  """
65
65
 
66
- __version__ = "0.1.6"
66
+ __version__ = "0.2.0"
67
67
 
68
68
  from opengater_globalauth_client.client import GlobalAuthClient
69
69
  from opengater_globalauth_client.models import (
@@ -1,7 +1,9 @@
1
1
  """
2
2
  RabbitMQ publisher for GlobalAuth commands.
3
3
  """
4
- from pydantic import BaseModel
4
+ from uuid import UUID
5
+ from typing import Literal
6
+ from pydantic import BaseModel, field_validator
5
7
 
6
8
  from faststream.rabbit import RabbitBroker
7
9
 
@@ -34,12 +36,13 @@ class GlobalAuthPublisher:
34
36
  )
35
37
  ```
36
38
  """
37
-
39
+
38
40
  COMMANDS_QUEUE = "globalauth.commands"
39
-
40
- def __init__(self, broker: RabbitBroker):
41
+
42
+ def __init__(self, broker: RabbitBroker, service_slug: str):
41
43
  self.broker = broker
42
-
44
+ self.service_slug = service_slug
45
+
43
46
  async def _publish(self, message: BaseModel) -> None:
44
47
  """Publish message to commands queue"""
45
48
  await self.broker.publish(
@@ -47,16 +50,10 @@ class GlobalAuthPublisher:
47
50
  queue=self.COMMANDS_QUEUE,
48
51
  persist=True,
49
52
  )
50
-
53
+
51
54
  async def create_user(
52
- self,
53
- auth_type: str,
54
- identifier: str,
55
- language: str = "ru",
56
- extra_data: dict | None = None,
57
- invited_by_id: str | None = None,
58
- event_id: str | None = None,
59
- event_service: str | None = None,
55
+ self,
56
+ command: CreateUserCommand
60
57
  ) -> None:
61
58
  """
62
59
  Send create_user command to GlobalAuth.
@@ -95,18 +92,11 @@ class GlobalAuthPublisher:
95
92
  )
96
93
  ```
97
94
  """
98
- command = CreateUserCommand(
99
- auth_type=auth_type,
100
- identifier=identifier,
101
- language=language,
102
- extra_data=extra_data,
103
- invited_by_id=invited_by_id,
104
- event_id=event_id,
105
- event_service=event_service,
106
- )
107
-
95
+ if not command.event_service:
96
+ command.event_service = self.service_slug
97
+
108
98
  await self._publish(command)
109
-
99
+
110
100
  async def send_command(self, command: str, **kwargs) -> None:
111
101
  """
112
102
  Send generic command to GlobalAuth.
@@ -118,7 +108,7 @@ class GlobalAuthPublisher:
118
108
  **kwargs: Command parameters
119
109
  """
120
110
  message = {"command": command, **kwargs}
121
-
111
+
122
112
  await self.broker.publish(
123
113
  message,
124
114
  queue=self.COMMANDS_QUEUE,