-
Notifications
You must be signed in to change notification settings - Fork 193
/
pokemon.smithy
158 lines (139 loc) · 3.16 KB
/
pokemon.smithy
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
$version: "2"
namespace com.aws.example
use aws.protocols#restJson1
use smithy.framework#ValidationException
use com.aws.example#PokemonSpecies
use com.aws.example#GetServerStatistics
use com.aws.example#DoNothing
use com.aws.example#CheckHealth
use com.aws.example#ResourceNotFoundException
/// The Pokémon Service allows you to retrieve information about Pokémon species.
@title("Pokémon Service")
@restJson1
service PokemonService {
version: "2024-03-18"
resources: [
PokemonSpecies
Storage
]
operations: [
GetServerStatistics
DoNothing
CapturePokemon
CheckHealth
StreamPokemonRadio
]
}
/// A users current Pokémon storage.
resource Storage {
identifiers: {
user: String
}
read: GetStorage
}
/// Retrieve information about your Pokédex.
@readonly
@http(uri: "/pokedex/{user}", method: "GET")
operation GetStorage {
input := @sensitive @documentation("A request to access Pokémon storage.") {
@required
@httpLabel
user: String
@required
@httpHeader("passcode")
passcode: String
}
output := @documentation("Contents of the Pokémon storage.") {
@required
collection: SpeciesCollection
}
errors: [
ResourceNotFoundException
StorageAccessNotAuthorized
ValidationException
]
}
/// Not authorized to access Pokémon storage.
@error("client")
@httpError(401)
structure StorageAccessNotAuthorized {}
/// A list of Pokémon species.
list SpeciesCollection {
member: String
}
/// Capture Pokémons via event streams.
@http(uri: "/capture-pokemon-event/{region}", method: "POST")
operation CapturePokemon {
input := {
@httpPayload
events: AttemptCapturingPokemonEvent
@httpLabel
@required
region: String
}
output := {
@httpPayload
events: CapturePokemonEvents
}
errors: [
UnsupportedRegionError
ThrottlingError
ValidationException
]
}
@streaming
union AttemptCapturingPokemonEvent {
event: CapturingEvent
masterball_unsuccessful: MasterBallUnsuccessful
}
structure CapturingEvent {
@eventPayload
payload: CapturingPayload
}
structure CapturingPayload for PokemonSpecies {
$name
pokeball: String
}
@streaming
union CapturePokemonEvents {
event: CaptureEvent
invalid_pokeball: InvalidPokeballError
throttlingError: ThrottlingError
}
structure CaptureEvent {
@eventHeader
name: String
@eventHeader
captured: Boolean
@eventHeader
shiny: Boolean
@eventPayload
pokedex_update: Blob
}
@error("server")
structure UnsupportedRegionError {
@required
region: String
}
@error("client")
structure InvalidPokeballError {
@required
pokeball: String
}
@error("server")
structure MasterBallUnsuccessful {
message: String
}
@error("client")
structure ThrottlingError {}
/// Fetch a radio song from the database and stream it back as a playable audio.
@readonly
@http(uri: "/radio", method: "GET")
operation StreamPokemonRadio {
output := {
@httpPayload
data: StreamingBlob = ""
}
}
@streaming
blob StreamingBlob