-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.py
More file actions
71 lines (48 loc) · 1.31 KB
/
Copy pathsample.py
File metadata and controls
71 lines (48 loc) · 1.31 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from typing import Any, Dict
import nexusrpc
from pydantic import BaseModel
from typing import Optional
class GetPersonResponse(BaseModel):
"""A simple person schema
Response containing person details.
"""
age: int
"""The person's age"""
id: str
"""The person's identifier"""
name: str
"""The person's name"""
email: Optional[str] = None
"""The person's email address"""
class GetPersonRequest(BaseModel):
"""Request to retrieve a person by their user ID."""
user_id: str
"""The unique identifier of the user."""
class NoInputRequest(BaseModel):
message: str
"""The message to send."""
class NoInputResponse(BaseModel):
message: str
"""The message to send."""
@nexusrpc.service
class Userservice:
"""
Service for managing users.
"""
get_user: nexusrpc.Operation[GetPersonRequest, GetPersonResponse] = nexusrpc.Operation(name="Get User")
"""
Retrieves a user by their ID.
"""
@nexusrpc.service
class Onewayservice:
"""
Sample service for testing one-way operations.
"""
no_input: nexusrpc.Operation[None, NoInputResponse] = nexusrpc.Operation(name="noInput")
"""
Operation for noInput.
"""
no_output: nexusrpc.Operation[NoInputRequest, None] = nexusrpc.Operation(name="noOutput")
"""
Operation for noOutput.
"""