amritk-galaxy-staging 0.2.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +13 -0
- data/LICENSE +201 -0
- data/README.md +169 -0
- data/SECURITY.md +19 -0
- data/SKILL.md +83 -0
- data/api.md +186 -0
- data/lib/amritk-galaxy-staging/client.rb +238 -0
- data/lib/amritk-galaxy-staging/errors.rb +227 -0
- data/lib/amritk-galaxy-staging/file_part.rb +58 -0
- data/lib/amritk-galaxy-staging/internal/transport/base_client.rb +588 -0
- data/lib/amritk-galaxy-staging/internal/transport/pooled_net_requester.rb +224 -0
- data/lib/amritk-galaxy-staging/internal/type/array_of.rb +164 -0
- data/lib/amritk-galaxy-staging/internal/type/base_model.rb +534 -0
- data/lib/amritk-galaxy-staging/internal/type/base_page.rb +55 -0
- data/lib/amritk-galaxy-staging/internal/type/boolean.rb +77 -0
- data/lib/amritk-galaxy-staging/internal/type/converter.rb +333 -0
- data/lib/amritk-galaxy-staging/internal/type/enum.rb +132 -0
- data/lib/amritk-galaxy-staging/internal/type/file_input.rb +111 -0
- data/lib/amritk-galaxy-staging/internal/type/hash_of.rb +186 -0
- data/lib/amritk-galaxy-staging/internal/type/request_parameters.rb +42 -0
- data/lib/amritk-galaxy-staging/internal/type/union.rb +238 -0
- data/lib/amritk-galaxy-staging/internal/type/unknown.rb +81 -0
- data/lib/amritk-galaxy-staging/internal/util.rb +965 -0
- data/lib/amritk-galaxy-staging/internal.rb +18 -0
- data/lib/amritk-galaxy-staging/models/authentication_create_token_params.rb +26 -0
- data/lib/amritk-galaxy-staging/models/authentication_create_user_params.rb +32 -0
- data/lib/amritk-galaxy-staging/models/authentication_list_me_params.rb +14 -0
- data/lib/amritk-galaxy-staging/models/celestial_body.rb +21 -0
- data/lib/amritk-galaxy-staging/models/celestial_body_create_params.rb +20 -0
- data/lib/amritk-galaxy-staging/models/new_planet_webhook_event.rb +9 -0
- data/lib/amritk-galaxy-staging/models/paginated_resource.rb +46 -0
- data/lib/amritk-galaxy-staging/models/planet.rb +221 -0
- data/lib/amritk-galaxy-staging/models/planet_create_params.rb +14 -0
- data/lib/amritk-galaxy-staging/models/planet_delete_params.rb +20 -0
- data/lib/amritk-galaxy-staging/models/planet_list_params.rb +30 -0
- data/lib/amritk-galaxy-staging/models/planet_list_response.rb +16 -0
- data/lib/amritk-galaxy-staging/models/planet_retrieve_params.rb +20 -0
- data/lib/amritk-galaxy-staging/models/planet_update_params.rb +20 -0
- data/lib/amritk-galaxy-staging/models/planet_upload_image_params.rb +29 -0
- data/lib/amritk-galaxy-staging/models/planet_upload_image_response.rb +48 -0
- data/lib/amritk-galaxy-staging/models/satellite.rb +96 -0
- data/lib/amritk-galaxy-staging/models/token.rb +18 -0
- data/lib/amritk-galaxy-staging/models/unwrap_webhook_event.rb +14 -0
- data/lib/amritk-galaxy-staging/models/user.rb +26 -0
- data/lib/amritk-galaxy-staging/models/webhook_unwrap_params.rb +14 -0
- data/lib/amritk-galaxy-staging/models.rb +87 -0
- data/lib/amritk-galaxy-staging/request_options.rb +79 -0
- data/lib/amritk-galaxy-staging/resources/authentication.rb +80 -0
- data/lib/amritk-galaxy-staging/resources/celestial_bodies.rb +36 -0
- data/lib/amritk-galaxy-staging/resources/planets.rb +215 -0
- data/lib/amritk-galaxy-staging/resources/webhooks.rb +37 -0
- data/lib/amritk-galaxy-staging/version.rb +5 -0
- data/lib/amritk-galaxy-staging.rb +79 -0
- data/rbi/amritk-galaxy-staging/client.rbi +130 -0
- data/rbi/amritk-galaxy-staging/errors.rbi +205 -0
- data/rbi/amritk-galaxy-staging/file_part.rbi +37 -0
- data/rbi/amritk-galaxy-staging/internal/transport/base_client.rbi +312 -0
- data/rbi/amritk-galaxy-staging/internal/transport/pooled_net_requester.rbi +84 -0
- data/rbi/amritk-galaxy-staging/internal/type/array_of.rbi +108 -0
- data/rbi/amritk-galaxy-staging/internal/type/base_model.rbi +319 -0
- data/rbi/amritk-galaxy-staging/internal/type/base_page.rbi +43 -0
- data/rbi/amritk-galaxy-staging/internal/type/boolean.rbi +59 -0
- data/rbi/amritk-galaxy-staging/internal/type/converter.rbi +225 -0
- data/rbi/amritk-galaxy-staging/internal/type/enum.rbi +82 -0
- data/rbi/amritk-galaxy-staging/internal/type/file_input.rbi +60 -0
- data/rbi/amritk-galaxy-staging/internal/type/hash_of.rbi +108 -0
- data/rbi/amritk-galaxy-staging/internal/type/request_parameters.rbi +33 -0
- data/rbi/amritk-galaxy-staging/internal/type/union.rbi +134 -0
- data/rbi/amritk-galaxy-staging/internal/type/unknown.rbi +59 -0
- data/rbi/amritk-galaxy-staging/internal/util.rbi +515 -0
- data/rbi/amritk-galaxy-staging/internal.rbi +18 -0
- data/rbi/amritk-galaxy-staging/models/authentication_create_token_params.rbi +46 -0
- data/rbi/amritk-galaxy-staging/models/authentication_create_user_params.rbi +54 -0
- data/rbi/amritk-galaxy-staging/models/authentication_list_me_params.rbi +34 -0
- data/rbi/amritk-galaxy-staging/models/celestial_body.rbi +21 -0
- data/rbi/amritk-galaxy-staging/models/celestial_body_create_params.rbi +53 -0
- data/rbi/amritk-galaxy-staging/models/new_planet_webhook_event.rbi +23 -0
- data/rbi/amritk-galaxy-staging/models/paginated_resource.rbi +93 -0
- data/rbi/amritk-galaxy-staging/models/planet.rbi +373 -0
- data/rbi/amritk-galaxy-staging/models/planet_create_params.rbi +34 -0
- data/rbi/amritk-galaxy-staging/models/planet_delete_params.rbi +41 -0
- data/rbi/amritk-galaxy-staging/models/planet_list_params.rbi +60 -0
- data/rbi/amritk-galaxy-staging/models/planet_list_response.rbi +33 -0
- data/rbi/amritk-galaxy-staging/models/planet_retrieve_params.rbi +41 -0
- data/rbi/amritk-galaxy-staging/models/planet_update_params.rbi +41 -0
- data/rbi/amritk-galaxy-staging/models/planet_upload_image_params.rbi +55 -0
- data/rbi/amritk-galaxy-staging/models/planet_upload_image_response.rbi +85 -0
- data/rbi/amritk-galaxy-staging/models/satellite.rbi +160 -0
- data/rbi/amritk-galaxy-staging/models/token.rbi +30 -0
- data/rbi/amritk-galaxy-staging/models/unwrap_webhook_event.rbi +20 -0
- data/rbi/amritk-galaxy-staging/models/user.rbi +36 -0
- data/rbi/amritk-galaxy-staging/models/webhook_unwrap_params.rbi +34 -0
- data/rbi/amritk-galaxy-staging/models.rbi +45 -0
- data/rbi/amritk-galaxy-staging/request_options.rbi +64 -0
- data/rbi/amritk-galaxy-staging/resources/authentication.rbi +49 -0
- data/rbi/amritk-galaxy-staging/resources/celestial_bodies.rbi +29 -0
- data/rbi/amritk-galaxy-staging/resources/planets.rbi +180 -0
- data/rbi/amritk-galaxy-staging/resources/webhooks.rbi +31 -0
- data/rbi/amritk-galaxy-staging/version.rbi +5 -0
- data/sig/amritk-galaxy-staging/client.rbs +62 -0
- data/sig/amritk-galaxy-staging/errors.rbs +117 -0
- data/sig/amritk-galaxy-staging/file_part.rbs +21 -0
- data/sig/amritk-galaxy-staging/internal/transport/base_client.rbs +133 -0
- data/sig/amritk-galaxy-staging/internal/transport/pooled_net_requester.rbs +48 -0
- data/sig/amritk-galaxy-staging/internal/type/array_of.rbs +48 -0
- data/sig/amritk-galaxy-staging/internal/type/base_model.rbs +102 -0
- data/sig/amritk-galaxy-staging/internal/type/base_page.rbs +24 -0
- data/sig/amritk-galaxy-staging/internal/type/boolean.rbs +26 -0
- data/sig/amritk-galaxy-staging/internal/type/converter.rbs +79 -0
- data/sig/amritk-galaxy-staging/internal/type/enum.rbs +32 -0
- data/sig/amritk-galaxy-staging/internal/type/file_input.rbs +25 -0
- data/sig/amritk-galaxy-staging/internal/type/hash_of.rbs +48 -0
- data/sig/amritk-galaxy-staging/internal/type/request_parameters.rbs +17 -0
- data/sig/amritk-galaxy-staging/internal/type/union.rbs +52 -0
- data/sig/amritk-galaxy-staging/internal/type/unknown.rbs +26 -0
- data/sig/amritk-galaxy-staging/internal/util.rbs +199 -0
- data/sig/amritk-galaxy-staging/internal.rbs +9 -0
- data/sig/amritk-galaxy-staging/models/authentication_create_token_params.rbs +28 -0
- data/sig/amritk-galaxy-staging/models/authentication_create_user_params.rbs +34 -0
- data/sig/amritk-galaxy-staging/models/authentication_list_me_params.rbs +17 -0
- data/sig/amritk-galaxy-staging/models/celestial_body.rbs +12 -0
- data/sig/amritk-galaxy-staging/models/celestial_body_create_params.rbs +24 -0
- data/sig/amritk-galaxy-staging/models/new_planet_webhook_event.rbs +11 -0
- data/sig/amritk-galaxy-staging/models/paginated_resource.rbs +53 -0
- data/sig/amritk-galaxy-staging/models/planet.rbs +210 -0
- data/sig/amritk-galaxy-staging/models/planet_create_params.rbs +17 -0
- data/sig/amritk-galaxy-staging/models/planet_delete_params.rbs +24 -0
- data/sig/amritk-galaxy-staging/models/planet_list_params.rbs +32 -0
- data/sig/amritk-galaxy-staging/models/planet_list_response.rbs +17 -0
- data/sig/amritk-galaxy-staging/models/planet_retrieve_params.rbs +24 -0
- data/sig/amritk-galaxy-staging/models/planet_update_params.rbs +26 -0
- data/sig/amritk-galaxy-staging/models/planet_upload_image_params.rbs +32 -0
- data/sig/amritk-galaxy-staging/models/planet_upload_image_response.rbs +50 -0
- data/sig/amritk-galaxy-staging/models/satellite.rbs +95 -0
- data/sig/amritk-galaxy-staging/models/token.rbs +15 -0
- data/sig/amritk-galaxy-staging/models/unwrap_webhook_event.rbs +11 -0
- data/sig/amritk-galaxy-staging/models/user.rbs +19 -0
- data/sig/amritk-galaxy-staging/models/webhook_unwrap_params.rbs +17 -0
- data/sig/amritk-galaxy-staging/models.rbs +39 -0
- data/sig/amritk-galaxy-staging/request_options.rbs +34 -0
- data/sig/amritk-galaxy-staging/resources/authentication.rbs +24 -0
- data/sig/amritk-galaxy-staging/resources/celestial_bodies.rbs +12 -0
- data/sig/amritk-galaxy-staging/resources/planets.rbs +68 -0
- data/sig/amritk-galaxy-staging/resources/webhooks.rbs +13 -0
- data/sig/amritk-galaxy-staging/version.rbs +3 -0
- data/sig/manifest.yaml +6 -0
- metadata +248 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module DemoApiScalarGalaxy
|
|
4
|
+
module Resources
|
|
5
|
+
# Everything about planets
|
|
6
|
+
class Planets
|
|
7
|
+
# Time to play god and create a new planet. What do you think? Ah, don't think too
|
|
8
|
+
# much. What could go wrong anyway?
|
|
9
|
+
sig do
|
|
10
|
+
params(
|
|
11
|
+
id: Integer,
|
|
12
|
+
name: String,
|
|
13
|
+
type: DemoApiScalarGalaxy::Planet::Type::OrSymbol,
|
|
14
|
+
atmosphere: T::Array[DemoApiScalarGalaxy::Planet::Atmosphere::OrHash],
|
|
15
|
+
creator: DemoApiScalarGalaxy::User::OrHash,
|
|
16
|
+
description: T.nilable(String),
|
|
17
|
+
discovered_at: Time,
|
|
18
|
+
failure_callback_url: String,
|
|
19
|
+
habitability_index: Float,
|
|
20
|
+
image: T.nilable(String),
|
|
21
|
+
last_updated: Time,
|
|
22
|
+
physical_properties:
|
|
23
|
+
DemoApiScalarGalaxy::Planet::PhysicalProperties::OrHash,
|
|
24
|
+
satellites: T::Array[DemoApiScalarGalaxy::Satellite::OrHash],
|
|
25
|
+
success_callback_url: String,
|
|
26
|
+
tags: T::Array[String],
|
|
27
|
+
request_options: DemoApiScalarGalaxy::RequestOptions::OrHash
|
|
28
|
+
).returns(DemoApiScalarGalaxy::Planet)
|
|
29
|
+
end
|
|
30
|
+
def create(
|
|
31
|
+
id:,
|
|
32
|
+
name:,
|
|
33
|
+
type:,
|
|
34
|
+
# Atmospheric composition
|
|
35
|
+
atmosphere: nil,
|
|
36
|
+
# A user
|
|
37
|
+
creator: nil,
|
|
38
|
+
description: nil,
|
|
39
|
+
discovered_at: nil,
|
|
40
|
+
# URL which gets invoked upon a failed operation
|
|
41
|
+
failure_callback_url: nil,
|
|
42
|
+
# A score from 0 to 1 indicating potential habitability
|
|
43
|
+
habitability_index: nil,
|
|
44
|
+
image: nil,
|
|
45
|
+
last_updated: nil,
|
|
46
|
+
physical_properties: nil,
|
|
47
|
+
satellites: nil,
|
|
48
|
+
# URL which gets invoked upon a successful operation
|
|
49
|
+
success_callback_url: nil,
|
|
50
|
+
tags: nil,
|
|
51
|
+
request_options: {}
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# You'll better learn a little bit more about the planets. It might come in handy
|
|
56
|
+
# once space travel is available for everyone.
|
|
57
|
+
sig do
|
|
58
|
+
params(
|
|
59
|
+
planet_id: Integer,
|
|
60
|
+
request_options: DemoApiScalarGalaxy::RequestOptions::OrHash
|
|
61
|
+
).returns(DemoApiScalarGalaxy::Planet)
|
|
62
|
+
end
|
|
63
|
+
def retrieve(
|
|
64
|
+
# The ID of the planet to get
|
|
65
|
+
planet_id,
|
|
66
|
+
request_options: {}
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Sometimes you make mistakes, that's fine. No worries, you can update all
|
|
71
|
+
# planets.
|
|
72
|
+
sig do
|
|
73
|
+
params(
|
|
74
|
+
planet_id: Integer,
|
|
75
|
+
id: Integer,
|
|
76
|
+
name: String,
|
|
77
|
+
type: DemoApiScalarGalaxy::Planet::Type::OrSymbol,
|
|
78
|
+
atmosphere: T::Array[DemoApiScalarGalaxy::Planet::Atmosphere::OrHash],
|
|
79
|
+
creator: DemoApiScalarGalaxy::User::OrHash,
|
|
80
|
+
description: T.nilable(String),
|
|
81
|
+
discovered_at: Time,
|
|
82
|
+
failure_callback_url: String,
|
|
83
|
+
habitability_index: Float,
|
|
84
|
+
image: T.nilable(String),
|
|
85
|
+
last_updated: Time,
|
|
86
|
+
physical_properties:
|
|
87
|
+
DemoApiScalarGalaxy::Planet::PhysicalProperties::OrHash,
|
|
88
|
+
satellites: T::Array[DemoApiScalarGalaxy::Satellite::OrHash],
|
|
89
|
+
success_callback_url: String,
|
|
90
|
+
tags: T::Array[String],
|
|
91
|
+
request_options: DemoApiScalarGalaxy::RequestOptions::OrHash
|
|
92
|
+
).returns(DemoApiScalarGalaxy::Planet)
|
|
93
|
+
end
|
|
94
|
+
def update(
|
|
95
|
+
# The ID of the planet to get
|
|
96
|
+
planet_id,
|
|
97
|
+
id:,
|
|
98
|
+
name:,
|
|
99
|
+
type:,
|
|
100
|
+
# Atmospheric composition
|
|
101
|
+
atmosphere: nil,
|
|
102
|
+
# A user
|
|
103
|
+
creator: nil,
|
|
104
|
+
description: nil,
|
|
105
|
+
discovered_at: nil,
|
|
106
|
+
# URL which gets invoked upon a failed operation
|
|
107
|
+
failure_callback_url: nil,
|
|
108
|
+
# A score from 0 to 1 indicating potential habitability
|
|
109
|
+
habitability_index: nil,
|
|
110
|
+
image: nil,
|
|
111
|
+
last_updated: nil,
|
|
112
|
+
physical_properties: nil,
|
|
113
|
+
satellites: nil,
|
|
114
|
+
# URL which gets invoked upon a successful operation
|
|
115
|
+
success_callback_url: nil,
|
|
116
|
+
tags: nil,
|
|
117
|
+
request_options: {}
|
|
118
|
+
)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# It's easy to say you know them all, but do you really? Retrieve all the planets
|
|
122
|
+
# and check whether you missed one.
|
|
123
|
+
sig do
|
|
124
|
+
params(
|
|
125
|
+
limit: Integer,
|
|
126
|
+
offset: Integer,
|
|
127
|
+
request_options: DemoApiScalarGalaxy::RequestOptions::OrHash
|
|
128
|
+
).returns(DemoApiScalarGalaxy::Models::PlanetListResponse)
|
|
129
|
+
end
|
|
130
|
+
def list(
|
|
131
|
+
# The number of items to return
|
|
132
|
+
limit: nil,
|
|
133
|
+
# The number of items to skip before starting to collect the result set
|
|
134
|
+
offset: nil,
|
|
135
|
+
request_options: {}
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# This endpoint was used to delete planets. Unfortunately, that caused a lot of
|
|
140
|
+
# trouble for planets with life. So, this endpoint is now deprecated and should
|
|
141
|
+
# not be used anymore.
|
|
142
|
+
sig do
|
|
143
|
+
params(
|
|
144
|
+
planet_id: Integer,
|
|
145
|
+
request_options: DemoApiScalarGalaxy::RequestOptions::OrHash
|
|
146
|
+
).void
|
|
147
|
+
end
|
|
148
|
+
def delete(
|
|
149
|
+
# The ID of the planet to get
|
|
150
|
+
planet_id,
|
|
151
|
+
request_options: {}
|
|
152
|
+
)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Got a crazy good photo of a planet? Share it with the world!
|
|
156
|
+
sig do
|
|
157
|
+
params(
|
|
158
|
+
planet_id: Integer,
|
|
159
|
+
image: DemoApiScalarGalaxy::Internal::FileInput,
|
|
160
|
+
request_options: DemoApiScalarGalaxy::RequestOptions::OrHash
|
|
161
|
+
).returns(DemoApiScalarGalaxy::Models::PlanetUploadImageResponse)
|
|
162
|
+
end
|
|
163
|
+
def upload_image(
|
|
164
|
+
# The ID of the planet to get
|
|
165
|
+
planet_id,
|
|
166
|
+
# The image file to upload
|
|
167
|
+
image: nil,
|
|
168
|
+
request_options: {}
|
|
169
|
+
)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# @api private
|
|
173
|
+
sig do
|
|
174
|
+
params(client: DemoApiScalarGalaxy::Client).returns(T.attached_class)
|
|
175
|
+
end
|
|
176
|
+
def self.new(client:)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module DemoApiScalarGalaxy
|
|
4
|
+
module Resources
|
|
5
|
+
class Webhooks
|
|
6
|
+
sig do
|
|
7
|
+
params(
|
|
8
|
+
payload: String,
|
|
9
|
+
headers: T::Hash[String, String],
|
|
10
|
+
key: T.nilable(String)
|
|
11
|
+
).returns(DemoApiScalarGalaxy::NewPlanetWebhookEvent)
|
|
12
|
+
end
|
|
13
|
+
def unwrap(
|
|
14
|
+
# The raw webhook payload as a string
|
|
15
|
+
payload,
|
|
16
|
+
# The raw HTTP headers that came with the payload
|
|
17
|
+
headers:,
|
|
18
|
+
# The webhook signing key
|
|
19
|
+
key: @client.webhook_secret
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @api private
|
|
24
|
+
sig do
|
|
25
|
+
params(client: DemoApiScalarGalaxy::Client).returns(T.attached_class)
|
|
26
|
+
end
|
|
27
|
+
def self.new(client:)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module DemoApiScalarGalaxy
|
|
2
|
+
class Client < DemoApiScalarGalaxy::Internal::Transport::BaseClient
|
|
3
|
+
DEFAULT_MAX_RETRIES: 2
|
|
4
|
+
|
|
5
|
+
DEFAULT_TIMEOUT_IN_SECONDS: Float
|
|
6
|
+
|
|
7
|
+
DEFAULT_INITIAL_RETRY_DELAY: Float
|
|
8
|
+
|
|
9
|
+
DEFAULT_MAX_RETRY_DELAY: Float
|
|
10
|
+
|
|
11
|
+
ENVIRONMENTS: {
|
|
12
|
+
production: "https://galaxy.scalar.com",
|
|
13
|
+
responds_with_your_request_data: "https://void.scalar.com/{path}"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
attr_reader bearer_auth: String?
|
|
17
|
+
|
|
18
|
+
attr_reader basic_auth_username: String?
|
|
19
|
+
|
|
20
|
+
attr_reader basic_auth_password: String?
|
|
21
|
+
|
|
22
|
+
attr_reader api_key_header: String?
|
|
23
|
+
|
|
24
|
+
attr_reader api_key_query: String?
|
|
25
|
+
|
|
26
|
+
attr_reader api_key_cookie: String?
|
|
27
|
+
|
|
28
|
+
attr_reader o_auth2: String?
|
|
29
|
+
|
|
30
|
+
attr_reader open_id_connect: String?
|
|
31
|
+
|
|
32
|
+
attr_reader webhook_secret: String?
|
|
33
|
+
|
|
34
|
+
attr_reader planets: DemoApiScalarGalaxy::Resources::Planets
|
|
35
|
+
|
|
36
|
+
attr_reader celestial_bodies: DemoApiScalarGalaxy::Resources::CelestialBodies
|
|
37
|
+
|
|
38
|
+
attr_reader authentication: DemoApiScalarGalaxy::Resources::Authentication
|
|
39
|
+
|
|
40
|
+
attr_reader webhooks: DemoApiScalarGalaxy::Resources::Webhooks
|
|
41
|
+
|
|
42
|
+
private def auth_headers: -> ::Hash[String, String]
|
|
43
|
+
|
|
44
|
+
def initialize: (
|
|
45
|
+
?bearer_auth: String?,
|
|
46
|
+
?basic_auth_username: String?,
|
|
47
|
+
?basic_auth_password: String?,
|
|
48
|
+
?api_key_header: String?,
|
|
49
|
+
?api_key_query: String?,
|
|
50
|
+
?api_key_cookie: String?,
|
|
51
|
+
?o_auth2: String?,
|
|
52
|
+
?open_id_connect: String?,
|
|
53
|
+
?webhook_secret: String?,
|
|
54
|
+
?environment: :production | :responds_with_your_request_data | nil,
|
|
55
|
+
?base_url: String?,
|
|
56
|
+
?max_retries: Integer,
|
|
57
|
+
?timeout: Float,
|
|
58
|
+
?initial_retry_delay: Float,
|
|
59
|
+
?max_retry_delay: Float
|
|
60
|
+
) -> void
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
module DemoApiScalarGalaxy
|
|
2
|
+
module Errors
|
|
3
|
+
class Error < StandardError
|
|
4
|
+
attr_accessor cause: StandardError?
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class ConversionError < DemoApiScalarGalaxy::Errors::Error
|
|
8
|
+
def cause: -> StandardError?
|
|
9
|
+
|
|
10
|
+
def initialize: (
|
|
11
|
+
on: Class,
|
|
12
|
+
method: Symbol,
|
|
13
|
+
target: top,
|
|
14
|
+
value: top,
|
|
15
|
+
?cause: StandardError?
|
|
16
|
+
) -> void
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class APIError < DemoApiScalarGalaxy::Errors::Error
|
|
20
|
+
attr_accessor url: URI::Generic
|
|
21
|
+
|
|
22
|
+
attr_accessor status: Integer?
|
|
23
|
+
|
|
24
|
+
attr_accessor headers: ::Hash[String, String]?
|
|
25
|
+
|
|
26
|
+
attr_accessor body: top?
|
|
27
|
+
|
|
28
|
+
def initialize: (
|
|
29
|
+
url: URI::Generic,
|
|
30
|
+
?status: Integer?,
|
|
31
|
+
?headers: ::Hash[String, String]?,
|
|
32
|
+
?body: Object?,
|
|
33
|
+
?request: nil,
|
|
34
|
+
?response: nil,
|
|
35
|
+
?message: String?
|
|
36
|
+
) -> void
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
class APIConnectionError < DemoApiScalarGalaxy::Errors::APIError
|
|
40
|
+
def initialize: (
|
|
41
|
+
url: URI::Generic,
|
|
42
|
+
?status: nil,
|
|
43
|
+
?headers: ::Hash[String, String]?,
|
|
44
|
+
?body: nil,
|
|
45
|
+
?request: nil,
|
|
46
|
+
?response: nil,
|
|
47
|
+
?message: String?
|
|
48
|
+
) -> void
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class APITimeoutError < DemoApiScalarGalaxy::Errors::APIConnectionError
|
|
52
|
+
def initialize: (
|
|
53
|
+
url: URI::Generic,
|
|
54
|
+
?status: nil,
|
|
55
|
+
?headers: ::Hash[String, String]?,
|
|
56
|
+
?body: nil,
|
|
57
|
+
?request: nil,
|
|
58
|
+
?response: nil,
|
|
59
|
+
?message: String?
|
|
60
|
+
) -> void
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class APIStatusError < DemoApiScalarGalaxy::Errors::APIError
|
|
64
|
+
def self.for: (
|
|
65
|
+
url: URI::Generic,
|
|
66
|
+
status: Integer,
|
|
67
|
+
headers: ::Hash[String, String]?,
|
|
68
|
+
body: Object?,
|
|
69
|
+
request: nil,
|
|
70
|
+
response: nil,
|
|
71
|
+
?message: String?
|
|
72
|
+
) -> instance
|
|
73
|
+
|
|
74
|
+
def initialize: (
|
|
75
|
+
url: URI::Generic,
|
|
76
|
+
status: Integer,
|
|
77
|
+
headers: ::Hash[String, String]?,
|
|
78
|
+
body: Object?,
|
|
79
|
+
request: nil,
|
|
80
|
+
response: nil,
|
|
81
|
+
?message: String?
|
|
82
|
+
) -> void
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class BadRequestError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
86
|
+
HTTP_STATUS: 400
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class AuthenticationError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
90
|
+
HTTP_STATUS: 401
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
class PermissionDeniedError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
94
|
+
HTTP_STATUS: 403
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
class NotFoundError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
98
|
+
HTTP_STATUS: 404
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
class ConflictError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
102
|
+
HTTP_STATUS: 409
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
class UnprocessableEntityError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
106
|
+
HTTP_STATUS: 422
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
class RateLimitError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
110
|
+
HTTP_STATUS: 429
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
class InternalServerError < DemoApiScalarGalaxy::Errors::APIStatusError
|
|
114
|
+
HTTP_STATUS: Range[Integer]
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module DemoApiScalarGalaxy
|
|
2
|
+
class FilePart
|
|
3
|
+
attr_reader content: Pathname | StringIO | IO | String
|
|
4
|
+
|
|
5
|
+
attr_reader content_type: String?
|
|
6
|
+
|
|
7
|
+
attr_reader filename: String?
|
|
8
|
+
|
|
9
|
+
private def read: -> String
|
|
10
|
+
|
|
11
|
+
def to_json: (*top a) -> String
|
|
12
|
+
|
|
13
|
+
def to_yaml: (*top a) -> String
|
|
14
|
+
|
|
15
|
+
def initialize: (
|
|
16
|
+
Pathname | StringIO | IO | String content,
|
|
17
|
+
?filename: (Pathname | String)?,
|
|
18
|
+
?content_type: String?
|
|
19
|
+
) -> void
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
module DemoApiScalarGalaxy
|
|
2
|
+
module Internal
|
|
3
|
+
module Transport
|
|
4
|
+
class BaseClient
|
|
5
|
+
extend DemoApiScalarGalaxy::Internal::Util::SorbetRuntimeSupport
|
|
6
|
+
|
|
7
|
+
type request_components =
|
|
8
|
+
{
|
|
9
|
+
method: Symbol,
|
|
10
|
+
path: String | ::Array[String],
|
|
11
|
+
query: ::Hash[String, (::Array[String] | String)?]?,
|
|
12
|
+
headers: ::Hash[String, (String
|
|
13
|
+
| Integer
|
|
14
|
+
| ::Array[(String | Integer)?])?]?,
|
|
15
|
+
body: top?,
|
|
16
|
+
unwrap: (Symbol
|
|
17
|
+
| Integer
|
|
18
|
+
| ::Array[(Symbol | Integer)]
|
|
19
|
+
| (^(top arg0) -> top))?,
|
|
20
|
+
page: Class?,
|
|
21
|
+
stream: Class?,
|
|
22
|
+
model: DemoApiScalarGalaxy::Internal::Type::Converter::input?,
|
|
23
|
+
options: DemoApiScalarGalaxy::request_opts?
|
|
24
|
+
}
|
|
25
|
+
type request_input =
|
|
26
|
+
{
|
|
27
|
+
method: Symbol,
|
|
28
|
+
url: URI::Generic,
|
|
29
|
+
headers: ::Hash[String, String],
|
|
30
|
+
body: top,
|
|
31
|
+
max_retries: Integer,
|
|
32
|
+
timeout: Float
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
MAX_REDIRECTS: 20
|
|
36
|
+
|
|
37
|
+
PLATFORM_HEADERS: ::Hash[String, String]
|
|
38
|
+
|
|
39
|
+
def self.validate!: (
|
|
40
|
+
DemoApiScalarGalaxy::Internal::Transport::BaseClient::request_components req
|
|
41
|
+
) -> void
|
|
42
|
+
|
|
43
|
+
def self.should_retry?: (
|
|
44
|
+
Integer status,
|
|
45
|
+
headers: ::Hash[String, String]
|
|
46
|
+
) -> bool
|
|
47
|
+
|
|
48
|
+
def self.follow_redirect: (
|
|
49
|
+
DemoApiScalarGalaxy::Internal::Transport::BaseClient::request_input request,
|
|
50
|
+
status: Integer,
|
|
51
|
+
response_headers: ::Hash[String, String]
|
|
52
|
+
) -> DemoApiScalarGalaxy::Internal::Transport::BaseClient::request_input
|
|
53
|
+
|
|
54
|
+
def self.reap_connection!: (
|
|
55
|
+
Integer | DemoApiScalarGalaxy::Errors::APIConnectionError status,
|
|
56
|
+
stream: Enumerable[String]?
|
|
57
|
+
) -> void
|
|
58
|
+
|
|
59
|
+
attr_reader base_url: URI::Generic
|
|
60
|
+
|
|
61
|
+
attr_reader timeout: Float
|
|
62
|
+
|
|
63
|
+
attr_reader max_retries: Integer
|
|
64
|
+
|
|
65
|
+
attr_reader initial_retry_delay: Float
|
|
66
|
+
|
|
67
|
+
attr_reader max_retry_delay: Float
|
|
68
|
+
|
|
69
|
+
attr_reader headers: ::Hash[String, String]
|
|
70
|
+
|
|
71
|
+
attr_reader idempotency_header: String?
|
|
72
|
+
|
|
73
|
+
# @api private
|
|
74
|
+
attr_reader requester: DemoApiScalarGalaxy::Internal::Transport::PooledNetRequester
|
|
75
|
+
|
|
76
|
+
def initialize: (
|
|
77
|
+
base_url: String,
|
|
78
|
+
?timeout: Float,
|
|
79
|
+
?max_retries: Integer,
|
|
80
|
+
?initial_retry_delay: Float,
|
|
81
|
+
?max_retry_delay: Float,
|
|
82
|
+
?headers: ::Hash[String, (String
|
|
83
|
+
| Integer
|
|
84
|
+
| ::Array[(String | Integer)?])?],
|
|
85
|
+
?idempotency_header: String?
|
|
86
|
+
) -> void
|
|
87
|
+
|
|
88
|
+
private def auth_headers: -> ::Hash[String, String]
|
|
89
|
+
|
|
90
|
+
private def user_agent: -> String
|
|
91
|
+
|
|
92
|
+
private def generate_idempotency_key: -> String
|
|
93
|
+
|
|
94
|
+
private def build_request: (
|
|
95
|
+
DemoApiScalarGalaxy::Internal::Transport::BaseClient::request_components req,
|
|
96
|
+
DemoApiScalarGalaxy::request_options opts
|
|
97
|
+
) -> DemoApiScalarGalaxy::Internal::Transport::BaseClient::request_input
|
|
98
|
+
|
|
99
|
+
private def retry_delay: (
|
|
100
|
+
::Hash[String, String] headers,
|
|
101
|
+
retry_count: Integer
|
|
102
|
+
) -> Float
|
|
103
|
+
|
|
104
|
+
def send_request: (
|
|
105
|
+
DemoApiScalarGalaxy::Internal::Transport::BaseClient::request_input request,
|
|
106
|
+
redirect_count: Integer,
|
|
107
|
+
retry_count: Integer,
|
|
108
|
+
send_retry_header: bool
|
|
109
|
+
) -> [Integer, top, Enumerable[String]]
|
|
110
|
+
|
|
111
|
+
def request: (
|
|
112
|
+
Symbol method,
|
|
113
|
+
String | ::Array[String] path,
|
|
114
|
+
?query: ::Hash[String, (::Array[String] | String)?]?,
|
|
115
|
+
?headers: ::Hash[String, (String
|
|
116
|
+
| Integer
|
|
117
|
+
| ::Array[(String | Integer)?])?]?,
|
|
118
|
+
?body: top?,
|
|
119
|
+
?unwrap: (Symbol
|
|
120
|
+
| Integer
|
|
121
|
+
| ::Array[(Symbol | Integer)]
|
|
122
|
+
| (^(top arg0) -> top))?,
|
|
123
|
+
?page: Class?,
|
|
124
|
+
?stream: Class?,
|
|
125
|
+
?model: DemoApiScalarGalaxy::Internal::Type::Converter::input?,
|
|
126
|
+
?options: DemoApiScalarGalaxy::request_opts?
|
|
127
|
+
) -> top
|
|
128
|
+
|
|
129
|
+
def inspect: -> String
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module DemoApiScalarGalaxy
|
|
2
|
+
module Internal
|
|
3
|
+
module Transport
|
|
4
|
+
class PooledNetRequester
|
|
5
|
+
extend DemoApiScalarGalaxy::Internal::Util::SorbetRuntimeSupport
|
|
6
|
+
|
|
7
|
+
type request =
|
|
8
|
+
{
|
|
9
|
+
method: Symbol,
|
|
10
|
+
url: URI::Generic,
|
|
11
|
+
headers: ::Hash[String, String],
|
|
12
|
+
body: top,
|
|
13
|
+
deadline: Float
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
KEEP_ALIVE_TIMEOUT: 30
|
|
17
|
+
|
|
18
|
+
DEFAULT_MAX_CONNECTIONS: Integer
|
|
19
|
+
|
|
20
|
+
def self.connect: (
|
|
21
|
+
cert_store: OpenSSL::X509::Store,
|
|
22
|
+
url: URI::Generic
|
|
23
|
+
) -> top
|
|
24
|
+
|
|
25
|
+
def self.calibrate_socket_timeout: (top conn, Float deadline) -> void
|
|
26
|
+
|
|
27
|
+
def self.build_request: (
|
|
28
|
+
DemoApiScalarGalaxy::Internal::Transport::PooledNetRequester::request request
|
|
29
|
+
) {
|
|
30
|
+
(String arg0) -> void
|
|
31
|
+
} -> [top, (^-> void)]
|
|
32
|
+
|
|
33
|
+
private def with_pool: (
|
|
34
|
+
URI::Generic url,
|
|
35
|
+
deadline: Float
|
|
36
|
+
) {
|
|
37
|
+
(top arg0) -> void
|
|
38
|
+
} -> void
|
|
39
|
+
|
|
40
|
+
def execute: (
|
|
41
|
+
DemoApiScalarGalaxy::Internal::Transport::PooledNetRequester::request request
|
|
42
|
+
) -> [Integer, top, Enumerable[String]]
|
|
43
|
+
|
|
44
|
+
def initialize: (?size: Integer) -> void
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module DemoApiScalarGalaxy
|
|
2
|
+
module Internal
|
|
3
|
+
module Type
|
|
4
|
+
class ArrayOf[Elem]
|
|
5
|
+
include DemoApiScalarGalaxy::Internal::Type::Converter
|
|
6
|
+
include DemoApiScalarGalaxy::Internal::Util::SorbetRuntimeSupport
|
|
7
|
+
|
|
8
|
+
def self.[]: (
|
|
9
|
+
::Hash[Symbol, top]
|
|
10
|
+
| ^-> DemoApiScalarGalaxy::Internal::Type::Converter::input
|
|
11
|
+
| DemoApiScalarGalaxy::Internal::Type::Converter::input type_info,
|
|
12
|
+
?::Hash[Symbol, top] spec
|
|
13
|
+
) -> instance
|
|
14
|
+
|
|
15
|
+
def ===: (top other) -> bool
|
|
16
|
+
|
|
17
|
+
def ==: (top other) -> bool
|
|
18
|
+
|
|
19
|
+
def hash: -> Integer
|
|
20
|
+
|
|
21
|
+
def coerce: (
|
|
22
|
+
::Array[top] | top value,
|
|
23
|
+
state: DemoApiScalarGalaxy::Internal::Type::Converter::coerce_state
|
|
24
|
+
) -> (::Array[top] | top)
|
|
25
|
+
|
|
26
|
+
def dump: (
|
|
27
|
+
::Array[top] | top value,
|
|
28
|
+
state: DemoApiScalarGalaxy::Internal::Type::Converter::dump_state
|
|
29
|
+
) -> (::Array[top] | top)
|
|
30
|
+
|
|
31
|
+
def to_sorbet_type: -> top
|
|
32
|
+
|
|
33
|
+
def item_type: -> Elem
|
|
34
|
+
|
|
35
|
+
def nilable?: -> bool
|
|
36
|
+
|
|
37
|
+
def initialize: (
|
|
38
|
+
::Hash[Symbol, top]
|
|
39
|
+
| ^-> DemoApiScalarGalaxy::Internal::Type::Converter::input
|
|
40
|
+
| DemoApiScalarGalaxy::Internal::Type::Converter::input type_info,
|
|
41
|
+
?::Hash[Symbol, top] spec
|
|
42
|
+
) -> void
|
|
43
|
+
|
|
44
|
+
def inspect: (?depth: Integer) -> String
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|