|
1 | 1 | # This file is auto-generated by oagen. Do not edit. |
2 | 2 |
|
3 | | -from __future__ import annotations |
| 3 | +from typing_extensions import TypeAlias |
| 4 | +from .audit_log_event_actor import AuditLogEventActor |
4 | 5 |
|
5 | | -from dataclasses import dataclass |
6 | | -from typing import Any, Dict, Optional, Union |
7 | | -from workos._types import _raise_deserialize_error |
8 | | - |
9 | | - |
10 | | -@dataclass(slots=True) |
11 | | -class AuditLogEventTarget: |
12 | | - """Audit Log Event Target model.""" |
13 | | - |
14 | | - id: str |
15 | | - """Target identifier.""" |
16 | | - type: str |
17 | | - """Target type.""" |
18 | | - name: Optional[str] = None |
19 | | - """Optional target name.""" |
20 | | - metadata: Optional[Dict[str, Union[str, float, bool]]] = None |
21 | | - """Additional data associated with the event or entity.""" |
22 | | - |
23 | | - @classmethod |
24 | | - def from_dict(cls, data: Dict[str, Any]) -> "AuditLogEventTarget": |
25 | | - """Deserialize from a dictionary.""" |
26 | | - try: |
27 | | - return cls( |
28 | | - id=data["id"], |
29 | | - type=data["type"], |
30 | | - name=data.get("name"), |
31 | | - metadata=data.get("metadata"), |
32 | | - ) |
33 | | - except (KeyError, ValueError) as e: |
34 | | - _raise_deserialize_error("AuditLogEventTarget", e) |
35 | | - |
36 | | - def to_dict(self) -> Dict[str, Any]: |
37 | | - """Serialize to a dictionary.""" |
38 | | - result: Dict[str, Any] = {} |
39 | | - result["id"] = self.id |
40 | | - result["type"] = self.type |
41 | | - if self.name is not None: |
42 | | - result["name"] = self.name |
43 | | - if self.metadata is not None: |
44 | | - result["metadata"] = self.metadata |
45 | | - return result |
| 6 | +AuditLogEventTarget: TypeAlias = AuditLogEventActor |
0 commit comments