galaxy-ruby 0.4.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +188 -0
- data/README.md +26 -5
- data/SKILL.md +6 -4
- data/api.md +8 -8
- data/lib/galaxy-ruby/client.rb +52 -41
- data/lib/galaxy-ruby/errors.rb +40 -0
- data/lib/galaxy-ruby/file_part.rb +13 -1
- data/lib/galaxy-ruby/internal/transport/base_client.rb +278 -42
- data/lib/galaxy-ruby/internal/transport/connection_pool.rb +160 -0
- data/lib/galaxy-ruby/internal/transport/pooled_net_requester.rb +77 -10
- data/lib/galaxy-ruby/internal/type/base_model.rb +62 -17
- data/lib/galaxy-ruby/internal/type/boolean.rb +3 -1
- data/lib/galaxy-ruby/internal/type/converter.rb +13 -3
- data/lib/galaxy-ruby/internal/type/enum.rb +9 -4
- data/lib/galaxy-ruby/internal/type/file_input.rb +8 -2
- data/lib/galaxy-ruby/internal/type/hash_of.rb +3 -1
- data/lib/galaxy-ruby/internal/type/union.rb +17 -6
- data/lib/galaxy-ruby/internal/type/unknown.rb +3 -1
- data/lib/galaxy-ruby/internal/util.rb +273 -15
- data/lib/galaxy-ruby/internal/webhook_verifier.rb +240 -0
- data/lib/galaxy-ruby/internal.rb +4 -1
- data/lib/galaxy-ruby/models/authentication_create_token_params.rb +7 -1
- data/lib/galaxy-ruby/models/authentication_create_user_params.rb +2 -0
- data/lib/galaxy-ruby/models/celestial_body_create_params.rb +3 -3
- data/lib/galaxy-ruby/models/celestial_body_param.rb +72 -0
- data/lib/galaxy-ruby/models/credentials.rb +1 -9
- data/lib/galaxy-ruby/models/planet_create_params.rb +11 -1
- data/lib/galaxy-ruby/models/{planet_list_all_data_params.rb → planet_list_params.rb} +2 -2
- data/lib/galaxy-ruby/models/{planet_list_all_data_response.rb → planet_list_response.rb} +9 -9
- data/lib/galaxy-ruby/models/planet_param.rb +204 -0
- data/lib/galaxy-ruby/models/planet_update_params.rb +12 -1
- data/lib/galaxy-ruby/models/{planet_delte_image_params.rb → planet_upload_image_params.rb} +2 -2
- data/lib/galaxy-ruby/models/{planet_delte_image_response.rb → planet_upload_image_response.rb} +2 -2
- data/lib/galaxy-ruby/models/user_param.rb +19 -0
- data/lib/galaxy-ruby/models/webhook_unwrap_params.rb +2 -0
- data/lib/galaxy-ruby/models.rb +38 -33
- data/lib/galaxy-ruby/request_options.rb +13 -5
- data/lib/galaxy-ruby/resources/celestial_bodies.rb +1 -1
- data/lib/galaxy-ruby/resources/planets.rb +37 -47
- data/lib/galaxy-ruby/resources/webhooks.rb +63 -6
- data/lib/galaxy-ruby/version.rb +1 -1
- data/lib/galaxy-ruby.rb +12 -10
- data/rbi/galaxy-ruby/client.rbi +28 -5
- data/rbi/galaxy-ruby/errors.rbi +25 -27
- data/rbi/galaxy-ruby/internal/transport/base_client.rbi +88 -68
- data/rbi/galaxy-ruby/internal/transport/connection_pool.rbi +44 -0
- data/rbi/galaxy-ruby/internal/transport/pooled_net_requester.rbi +18 -19
- data/rbi/galaxy-ruby/internal/type/base_model.rbi +27 -49
- data/rbi/galaxy-ruby/internal/type/base_page.rbi +1 -2
- data/rbi/galaxy-ruby/internal/type/converter.rbi +12 -51
- data/rbi/galaxy-ruby/internal/type/enum.rbi +1 -5
- data/rbi/galaxy-ruby/internal/type/request_parameters.rbi +2 -6
- data/rbi/galaxy-ruby/internal/type/union.rbi +2 -11
- data/rbi/galaxy-ruby/internal/util.rbi +101 -115
- data/rbi/galaxy-ruby/internal/webhook_verifier.rbi +86 -0
- data/rbi/galaxy-ruby/internal.rbi +1 -4
- data/rbi/galaxy-ruby/models/authentication_create_token_params.rbi +11 -5
- data/rbi/galaxy-ruby/models/celestial_body_create_params.rbi +8 -5
- data/rbi/galaxy-ruby/models/celestial_body_param.rbi +138 -0
- data/rbi/galaxy-ruby/models/credentials.rbi +2 -5
- data/rbi/galaxy-ruby/models/planet_create_params.rbi +22 -5
- data/rbi/galaxy-ruby/models/{planet_list_all_data_params.rbi → planet_list_params.rbi} +2 -5
- data/rbi/galaxy-ruby/models/{planet_list_all_data_response.rbi → planet_list_response.rbi} +11 -15
- data/rbi/galaxy-ruby/models/planet_param.rbi +346 -0
- data/rbi/galaxy-ruby/models/planet_update_params.rbi +19 -2
- data/rbi/galaxy-ruby/models/{planet_delte_image_params.rbi → planet_upload_image_params.rbi} +2 -2
- data/rbi/galaxy-ruby/models/{planet_delte_image_response.rbi → planet_upload_image_response.rbi} +2 -2
- data/rbi/galaxy-ruby/models/unwrap_webhook_event.rbi +1 -1
- data/rbi/galaxy-ruby/models/user_param.rbi +27 -0
- data/rbi/galaxy-ruby/models/webhook_unwrap_params.rbi +2 -0
- data/rbi/galaxy-ruby/models.rbi +10 -2
- data/rbi/galaxy-ruby/request_options.rbi +4 -10
- data/rbi/galaxy-ruby/resources/celestial_bodies.rbi +2 -2
- data/rbi/galaxy-ruby/resources/planets.rbi +22 -30
- data/rbi/galaxy-ruby/resources/webhooks.rbi +64 -3
- data/sig/galaxy-ruby/client.rbs +13 -5
- data/sig/galaxy-ruby/errors.rbs +13 -0
- data/sig/galaxy-ruby/internal/transport/base_client.rbs +38 -2
- data/sig/galaxy-ruby/internal/transport/connection_pool.rbs +19 -0
- data/sig/galaxy-ruby/internal/transport/pooled_net_requester.rbs +13 -2
- data/sig/galaxy-ruby/internal/type/base_model.rbs +4 -0
- data/sig/galaxy-ruby/internal/util.rbs +29 -1
- data/sig/galaxy-ruby/internal/webhook_verifier.rbs +53 -0
- data/sig/galaxy-ruby/models/authentication_create_token_params.rbs +13 -3
- data/sig/galaxy-ruby/models/celestial_body_create_params.rbs +4 -4
- data/sig/galaxy-ruby/models/celestial_body_param.rbs +69 -0
- data/sig/galaxy-ruby/models/credentials.rbs +1 -3
- data/sig/galaxy-ruby/models/planet_create_params.rbs +14 -3
- data/sig/galaxy-ruby/models/{planet_list_all_data_params.rbs → planet_list_params.rbs} +2 -2
- data/sig/galaxy-ruby/models/{planet_list_all_data_response.rbs → planet_list_response.rbs} +15 -13
- data/sig/galaxy-ruby/models/planet_param.rbs +199 -0
- data/sig/galaxy-ruby/models/planet_update_params.rbs +8 -1
- data/sig/galaxy-ruby/models/{planet_delte_image_params.rbs → planet_upload_image_params.rbs} +2 -2
- data/sig/galaxy-ruby/models/{planet_delte_image_response.rbs → planet_upload_image_response.rbs} +2 -2
- data/sig/galaxy-ruby/models/user_param.rbs +15 -0
- data/sig/galaxy-ruby/models/webhook_unwrap_params.rbs +4 -0
- data/sig/galaxy-ruby/models.rbs +10 -2
- data/sig/galaxy-ruby/resources/celestial_bodies.rbs +1 -1
- data/sig/galaxy-ruby/resources/planets.rbs +10 -14
- data/sig/galaxy-ruby/resources/webhooks.rbs +17 -1
- metadata +32 -71
data/rbi/galaxy-ruby/models/{planet_delte_image_params.rbi → planet_upload_image_params.rbi}
RENAMED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module ScalarGalaxy
|
|
4
4
|
module Models
|
|
5
|
-
class
|
|
5
|
+
class PlanetUploadImageParams < ScalarGalaxy::Internal::Type::BaseModel
|
|
6
6
|
extend ScalarGalaxy::Internal::Type::RequestParameters::Converter
|
|
7
7
|
include ScalarGalaxy::Internal::Type::RequestParameters
|
|
8
8
|
|
|
9
9
|
OrHash =
|
|
10
10
|
T.type_alias do
|
|
11
11
|
T.any(
|
|
12
|
-
ScalarGalaxy::
|
|
12
|
+
ScalarGalaxy::PlanetUploadImageParams,
|
|
13
13
|
ScalarGalaxy::Internal::AnyHash
|
|
14
14
|
)
|
|
15
15
|
end
|
data/rbi/galaxy-ruby/models/{planet_delte_image_response.rbi → planet_upload_image_response.rbi}
RENAMED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module ScalarGalaxy
|
|
4
4
|
module Models
|
|
5
|
-
class
|
|
5
|
+
class PlanetUploadImageResponse < ScalarGalaxy::Internal::Type::BaseModel
|
|
6
6
|
OrHash =
|
|
7
7
|
T.type_alias do
|
|
8
8
|
T.any(
|
|
9
|
-
ScalarGalaxy::Models::
|
|
9
|
+
ScalarGalaxy::Models::PlanetUploadImageResponse,
|
|
10
10
|
ScalarGalaxy::Internal::AnyHash
|
|
11
11
|
)
|
|
12
12
|
end
|
|
@@ -5,7 +5,7 @@ module ScalarGalaxy
|
|
|
5
5
|
module UnwrapWebhookEvent
|
|
6
6
|
extend ScalarGalaxy::Internal::Type::Union
|
|
7
7
|
|
|
8
|
-
Variants = T.type_alias {
|
|
8
|
+
Variants = T.type_alias { ScalarGalaxy::NewPlanetWebhookEvent }
|
|
9
9
|
|
|
10
10
|
sig do
|
|
11
11
|
override.returns(T::Array[ScalarGalaxy::UnwrapWebhookEvent::Variants])
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ScalarGalaxy
|
|
4
|
+
module Models
|
|
5
|
+
class UserParam < ScalarGalaxy::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(ScalarGalaxy::UserParam, ScalarGalaxy::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
sig { returns(T.nilable(String)) }
|
|
12
|
+
attr_reader :name
|
|
13
|
+
|
|
14
|
+
sig { params(name: String).void }
|
|
15
|
+
attr_writer :name
|
|
16
|
+
|
|
17
|
+
# A user
|
|
18
|
+
sig { params(name: String).returns(T.attached_class) }
|
|
19
|
+
def self.new(name: nil)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sig { override.returns({ name: String }) }
|
|
23
|
+
def to_hash
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/rbi/galaxy-ruby/models.rbi
CHANGED
|
@@ -13,6 +13,8 @@ module ScalarGalaxy
|
|
|
13
13
|
|
|
14
14
|
CelestialBodyCreateParams = ScalarGalaxy::Models::CelestialBodyCreateParams
|
|
15
15
|
|
|
16
|
+
CelestialBodyParam = ScalarGalaxy::Models::CelestialBodyParam
|
|
17
|
+
|
|
16
18
|
Credentials = ScalarGalaxy::Models::Credentials
|
|
17
19
|
|
|
18
20
|
NewPlanetWebhookEvent = ScalarGalaxy::Models::NewPlanetWebhookEvent
|
|
@@ -23,17 +25,23 @@ module ScalarGalaxy
|
|
|
23
25
|
|
|
24
26
|
PlanetDeleteParams = ScalarGalaxy::Models::PlanetDeleteParams
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
PlanetListParams = ScalarGalaxy::Models::PlanetListParams
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
PlanetParam = ScalarGalaxy::Models::PlanetParam
|
|
29
31
|
|
|
30
32
|
PlanetRetrieveParams = ScalarGalaxy::Models::PlanetRetrieveParams
|
|
31
33
|
|
|
32
34
|
PlanetUpdateParams = ScalarGalaxy::Models::PlanetUpdateParams
|
|
33
35
|
|
|
36
|
+
PlanetUploadImageParams = ScalarGalaxy::Models::PlanetUploadImageParams
|
|
37
|
+
|
|
34
38
|
UnwrapWebhookEvent = ScalarGalaxy::Models::UnwrapWebhookEvent
|
|
35
39
|
|
|
36
40
|
User = ScalarGalaxy::Models::User
|
|
37
41
|
|
|
42
|
+
UserParam = ScalarGalaxy::Models::UserParam
|
|
43
|
+
|
|
44
|
+
WebhookParsedParams = ScalarGalaxy::Models::WebhookParsedParams
|
|
45
|
+
|
|
38
46
|
WebhookUnwrapParams = ScalarGalaxy::Models::WebhookUnwrapParams
|
|
39
47
|
end
|
|
@@ -17,18 +17,14 @@ module ScalarGalaxy
|
|
|
17
17
|
def self.validate!(opts)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# Idempotency key to send with request and
|
|
21
|
-
#
|
|
20
|
+
# Idempotency key to send with this request and its retries when the client
|
|
21
|
+
# has an idempotency header configured.
|
|
22
22
|
sig { returns(T.nilable(String)) }
|
|
23
23
|
attr_accessor :idempotency_key
|
|
24
24
|
|
|
25
25
|
# Extra query params to send with the request. These are `.merge`’d into any
|
|
26
26
|
# `query` given at the client level.
|
|
27
|
-
sig
|
|
28
|
-
returns(
|
|
29
|
-
T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])
|
|
30
|
-
)
|
|
31
|
-
end
|
|
27
|
+
sig { returns(T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])) }
|
|
32
28
|
attr_accessor :extra_query
|
|
33
29
|
|
|
34
30
|
# Extra headers to send with the request. These are `.merged`’d into any
|
|
@@ -50,9 +46,7 @@ module ScalarGalaxy
|
|
|
50
46
|
attr_accessor :timeout
|
|
51
47
|
|
|
52
48
|
# Returns a new instance of RequestOptions.
|
|
53
|
-
sig
|
|
54
|
-
params(values: ScalarGalaxy::Internal::AnyHash).returns(T.attached_class)
|
|
55
|
-
end
|
|
49
|
+
sig { params(values: ScalarGalaxy::Internal::AnyHash).returns(T.attached_class) }
|
|
56
50
|
def self.new(values = {})
|
|
57
51
|
end
|
|
58
52
|
end
|
|
@@ -10,8 +10,8 @@ module ScalarGalaxy
|
|
|
10
10
|
params(
|
|
11
11
|
celestial_body:
|
|
12
12
|
T.any(
|
|
13
|
-
ScalarGalaxy::
|
|
14
|
-
ScalarGalaxy::
|
|
13
|
+
ScalarGalaxy::PlanetParam::OrHash,
|
|
14
|
+
ScalarGalaxy::CelestialBodyParam::Satellite::OrHash
|
|
15
15
|
),
|
|
16
16
|
request_options: ScalarGalaxy::RequestOptions::OrHash
|
|
17
17
|
).returns(ScalarGalaxy::CelestialBody::Variants)
|
|
@@ -8,16 +8,14 @@ module ScalarGalaxy
|
|
|
8
8
|
# much. What could go wrong anyway?
|
|
9
9
|
sig do
|
|
10
10
|
params(
|
|
11
|
-
id: Integer,
|
|
12
11
|
name: String,
|
|
13
12
|
atmosphere: T::Array[ScalarGalaxy::Planet::Atmosphere::OrHash],
|
|
14
|
-
creator: ScalarGalaxy::
|
|
13
|
+
creator: ScalarGalaxy::UserParam::OrHash,
|
|
15
14
|
description: T.nilable(String),
|
|
16
15
|
discovered_at: Time,
|
|
17
16
|
failure_callback_url: String,
|
|
18
17
|
habitability_index: Float,
|
|
19
18
|
image: T.nilable(String),
|
|
20
|
-
last_updated: Time,
|
|
21
19
|
physical_properties: ScalarGalaxy::Planet::PhysicalProperties::OrHash,
|
|
22
20
|
satellites: T::Array[T.anything],
|
|
23
21
|
success_callback_url: String,
|
|
@@ -27,7 +25,6 @@ module ScalarGalaxy
|
|
|
27
25
|
).returns(ScalarGalaxy::Planet)
|
|
28
26
|
end
|
|
29
27
|
def create(
|
|
30
|
-
id:,
|
|
31
28
|
name:,
|
|
32
29
|
# Atmospheric composition
|
|
33
30
|
atmosphere: nil,
|
|
@@ -40,7 +37,6 @@ module ScalarGalaxy
|
|
|
40
37
|
# A score from 0 to 1 indicating potential habitability
|
|
41
38
|
habitability_index: nil,
|
|
42
39
|
image: nil,
|
|
43
|
-
last_updated: nil,
|
|
44
40
|
physical_properties: nil,
|
|
45
41
|
satellites: nil,
|
|
46
42
|
# URL which gets invoked upon a successful operation
|
|
@@ -71,16 +67,14 @@ module ScalarGalaxy
|
|
|
71
67
|
sig do
|
|
72
68
|
params(
|
|
73
69
|
planet_id: Integer,
|
|
74
|
-
id: Integer,
|
|
75
70
|
name: String,
|
|
76
71
|
atmosphere: T::Array[ScalarGalaxy::Planet::Atmosphere::OrHash],
|
|
77
|
-
creator: ScalarGalaxy::
|
|
72
|
+
creator: ScalarGalaxy::UserParam::OrHash,
|
|
78
73
|
description: T.nilable(String),
|
|
79
74
|
discovered_at: Time,
|
|
80
75
|
failure_callback_url: String,
|
|
81
76
|
habitability_index: Float,
|
|
82
77
|
image: T.nilable(String),
|
|
83
|
-
last_updated: Time,
|
|
84
78
|
physical_properties: ScalarGalaxy::Planet::PhysicalProperties::OrHash,
|
|
85
79
|
satellites: T::Array[T.anything],
|
|
86
80
|
success_callback_url: String,
|
|
@@ -92,7 +86,6 @@ module ScalarGalaxy
|
|
|
92
86
|
def update(
|
|
93
87
|
# The ID of the planet to get
|
|
94
88
|
planet_id,
|
|
95
|
-
id:,
|
|
96
89
|
name:,
|
|
97
90
|
# Atmospheric composition
|
|
98
91
|
atmosphere: nil,
|
|
@@ -105,7 +98,6 @@ module ScalarGalaxy
|
|
|
105
98
|
# A score from 0 to 1 indicating potential habitability
|
|
106
99
|
habitability_index: nil,
|
|
107
100
|
image: nil,
|
|
108
|
-
last_updated: nil,
|
|
109
101
|
physical_properties: nil,
|
|
110
102
|
satellites: nil,
|
|
111
103
|
# URL which gets invoked upon a successful operation
|
|
@@ -116,6 +108,24 @@ module ScalarGalaxy
|
|
|
116
108
|
)
|
|
117
109
|
end
|
|
118
110
|
|
|
111
|
+
# It's easy to say you know them all, but do you really? Retrieve all the planets
|
|
112
|
+
# and check whether you missed one.
|
|
113
|
+
sig do
|
|
114
|
+
params(
|
|
115
|
+
limit: Integer,
|
|
116
|
+
offset: Integer,
|
|
117
|
+
request_options: ScalarGalaxy::RequestOptions::OrHash
|
|
118
|
+
).returns(ScalarGalaxy::Models::PlanetListResponse)
|
|
119
|
+
end
|
|
120
|
+
def list(
|
|
121
|
+
# The number of items to return
|
|
122
|
+
limit: nil,
|
|
123
|
+
# The number of items to skip before starting to collect the result set
|
|
124
|
+
offset: nil,
|
|
125
|
+
request_options: {}
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
|
|
119
129
|
# This endpoint was used to delete planets. Unfortunately, that caused a lot of
|
|
120
130
|
# trouble for planets with life. So, this endpoint is now deprecated and should
|
|
121
131
|
# not be used anymore.
|
|
@@ -138,9 +148,9 @@ module ScalarGalaxy
|
|
|
138
148
|
planet_id: Integer,
|
|
139
149
|
image: ScalarGalaxy::Internal::FileInput,
|
|
140
150
|
request_options: ScalarGalaxy::RequestOptions::OrHash
|
|
141
|
-
).returns(ScalarGalaxy::Models::
|
|
151
|
+
).returns(ScalarGalaxy::Models::PlanetUploadImageResponse)
|
|
142
152
|
end
|
|
143
|
-
def
|
|
153
|
+
def upload_image(
|
|
144
154
|
# The ID of the planet to get
|
|
145
155
|
planet_id,
|
|
146
156
|
# The image file to upload
|
|
@@ -149,24 +159,6 @@ module ScalarGalaxy
|
|
|
149
159
|
)
|
|
150
160
|
end
|
|
151
161
|
|
|
152
|
-
# It's easy to say you know them all, but do you really? Retrieve all the planets
|
|
153
|
-
# and check whether you missed one.
|
|
154
|
-
sig do
|
|
155
|
-
params(
|
|
156
|
-
limit: Integer,
|
|
157
|
-
offset: Integer,
|
|
158
|
-
request_options: ScalarGalaxy::RequestOptions::OrHash
|
|
159
|
-
).returns(ScalarGalaxy::Models::PlanetListAllDataResponse)
|
|
160
|
-
end
|
|
161
|
-
def list_all_data(
|
|
162
|
-
# The number of items to return
|
|
163
|
-
limit: nil,
|
|
164
|
-
# The number of items to skip before starting to collect the result set
|
|
165
|
-
offset: nil,
|
|
166
|
-
request_options: {}
|
|
167
|
-
)
|
|
168
|
-
end
|
|
169
|
-
|
|
170
162
|
# @api private
|
|
171
163
|
sig { params(client: ScalarGalaxy::Client).returns(T.attached_class) }
|
|
172
164
|
def self.new(client:)
|
|
@@ -6,9 +6,11 @@ module ScalarGalaxy
|
|
|
6
6
|
sig do
|
|
7
7
|
params(
|
|
8
8
|
payload: String,
|
|
9
|
-
headers: T::Hash[String, String],
|
|
9
|
+
headers: T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
|
|
10
10
|
key: T.nilable(String)
|
|
11
|
-
).returns(
|
|
11
|
+
).returns(
|
|
12
|
+
ScalarGalaxy::NewPlanetWebhookEvent
|
|
13
|
+
)
|
|
12
14
|
end
|
|
13
15
|
def unwrap(
|
|
14
16
|
# The raw webhook payload as a string
|
|
@@ -16,7 +18,66 @@ module ScalarGalaxy
|
|
|
16
18
|
# The raw HTTP headers that came with the payload
|
|
17
19
|
headers:,
|
|
18
20
|
# The webhook signing key
|
|
19
|
-
key:
|
|
21
|
+
key: nil
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Back-compat alias for `unwrap`, which it calls with the same arguments. SDKs
|
|
26
|
+
# that named this helper `parsed` shipped it under this name.
|
|
27
|
+
#
|
|
28
|
+
# @deprecated Use `unwrap` instead.
|
|
29
|
+
sig do
|
|
30
|
+
params(
|
|
31
|
+
payload: String,
|
|
32
|
+
headers: T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
|
|
33
|
+
key: T.nilable(String)
|
|
34
|
+
).returns(
|
|
35
|
+
ScalarGalaxy::NewPlanetWebhookEvent
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
def parsed(
|
|
39
|
+
# The raw webhook payload as a string
|
|
40
|
+
payload,
|
|
41
|
+
# The raw HTTP headers that came with the payload
|
|
42
|
+
headers:,
|
|
43
|
+
# The webhook signing key
|
|
44
|
+
key: nil
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Verifies that the payload was signed with the webhook key, raising when it was
|
|
49
|
+
# not.
|
|
50
|
+
sig do
|
|
51
|
+
params(
|
|
52
|
+
payload: String,
|
|
53
|
+
headers:
|
|
54
|
+
T::Hash[T.any(String, Symbol), T.any(String, T::Array[String])],
|
|
55
|
+
key: T.nilable(String)
|
|
56
|
+
).returns(T::Hash[Symbol, T.untyped])
|
|
57
|
+
end
|
|
58
|
+
def verify_signature(
|
|
59
|
+
# The raw webhook payload as a string
|
|
60
|
+
payload:,
|
|
61
|
+
# The raw HTTP headers that came with the payload
|
|
62
|
+
headers:,
|
|
63
|
+
# The webhook signing key
|
|
64
|
+
key: nil
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Parses the payload into a typed event without verifying its signature.
|
|
69
|
+
#
|
|
70
|
+
# Only use this for a payload whose signature was already verified, or in tests.
|
|
71
|
+
sig do
|
|
72
|
+
params(
|
|
73
|
+
payload: String
|
|
74
|
+
).returns(
|
|
75
|
+
ScalarGalaxy::NewPlanetWebhookEvent
|
|
76
|
+
)
|
|
77
|
+
end
|
|
78
|
+
def parse_unsafe(
|
|
79
|
+
# The raw webhook payload as a string
|
|
80
|
+
payload
|
|
20
81
|
)
|
|
21
82
|
end
|
|
22
83
|
|
data/sig/galaxy-ruby/client.rbs
CHANGED
|
@@ -13,17 +13,17 @@ module ScalarGalaxy
|
|
|
13
13
|
void: "https://void.scalar.com/"
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
attr_reader bearer_auth: String
|
|
16
|
+
attr_reader bearer_auth: String?
|
|
17
17
|
|
|
18
|
-
attr_reader basic_auth_username: String
|
|
18
|
+
attr_reader basic_auth_username: String?
|
|
19
19
|
|
|
20
|
-
attr_reader basic_auth_password: String
|
|
20
|
+
attr_reader basic_auth_password: String?
|
|
21
21
|
|
|
22
|
-
attr_reader api_key_header: String
|
|
22
|
+
attr_reader api_key_header: String?
|
|
23
23
|
|
|
24
24
|
attr_reader api_key_query: String?
|
|
25
25
|
|
|
26
|
-
attr_reader api_key_cookie: String
|
|
26
|
+
attr_reader api_key_cookie: String?
|
|
27
27
|
|
|
28
28
|
attr_reader o_auth2: String?
|
|
29
29
|
|
|
@@ -31,6 +31,8 @@ module ScalarGalaxy
|
|
|
31
31
|
|
|
32
32
|
attr_reader webhook_secret: String?
|
|
33
33
|
|
|
34
|
+
attr_reader explicit_webhook_secret: String?
|
|
35
|
+
|
|
34
36
|
attr_reader planets: ScalarGalaxy::Resources::Planets
|
|
35
37
|
|
|
36
38
|
attr_reader celestial_bodies: ScalarGalaxy::Resources::CelestialBodies
|
|
@@ -41,6 +43,12 @@ module ScalarGalaxy
|
|
|
41
43
|
|
|
42
44
|
private def auth_headers: -> ::Hash[String, String]
|
|
43
45
|
|
|
46
|
+
private def auth_header_keys: -> ::Array[String]
|
|
47
|
+
|
|
48
|
+
private def auth_query: -> ::Hash[String, String]
|
|
49
|
+
|
|
50
|
+
private def auth_query_keys: -> ::Array[String]
|
|
51
|
+
|
|
44
52
|
def initialize: (
|
|
45
53
|
?bearer_auth: String?,
|
|
46
54
|
?basic_auth_username: String?,
|
data/sig/galaxy-ruby/errors.rbs
CHANGED
|
@@ -25,6 +25,12 @@ module ScalarGalaxy
|
|
|
25
25
|
|
|
26
26
|
attr_accessor body: top?
|
|
27
27
|
|
|
28
|
+
def request_id: -> String?
|
|
29
|
+
|
|
30
|
+
def problem_details: -> ::Hash[String | Symbol, top]?
|
|
31
|
+
|
|
32
|
+
private def response_header: (String name) -> String?
|
|
33
|
+
|
|
28
34
|
def initialize: (
|
|
29
35
|
url: URI::Generic,
|
|
30
36
|
?status: Integer?,
|
|
@@ -113,5 +119,12 @@ module ScalarGalaxy
|
|
|
113
119
|
class InternalServerError < ScalarGalaxy::Errors::APIStatusError
|
|
114
120
|
HTTP_STATUS: Range[Integer]
|
|
115
121
|
end
|
|
122
|
+
|
|
123
|
+
# Raised by SDKs that verify webhook signatures through the `standardwebhooks` gem when that gem
|
|
124
|
+
# is not installed. This SDK verifies them with the standard library and never raises it; the
|
|
125
|
+
# class is declared so code that rescues or names it keeps working.
|
|
126
|
+
class MissingDependencyError < ScalarGalaxy::Errors::Error
|
|
127
|
+
def initialize: (gem_name: String, feature: String) -> void
|
|
128
|
+
end
|
|
116
129
|
end
|
|
117
130
|
end
|
|
@@ -20,6 +20,7 @@ module ScalarGalaxy
|
|
|
20
20
|
page: Class?,
|
|
21
21
|
stream: Class?,
|
|
22
22
|
model: ScalarGalaxy::Internal::Type::Converter::input?,
|
|
23
|
+
security: ::Array[::Array[String]]?,
|
|
23
24
|
options: ScalarGalaxy::request_opts?
|
|
24
25
|
}
|
|
25
26
|
type request_input =
|
|
@@ -29,11 +30,16 @@ module ScalarGalaxy
|
|
|
29
30
|
headers: ::Hash[String, String],
|
|
30
31
|
body: top,
|
|
31
32
|
max_retries: Integer,
|
|
32
|
-
timeout: Float
|
|
33
|
+
timeout: Float,
|
|
34
|
+
?error_url: URI::Generic?,
|
|
35
|
+
?auth_query_sent: ::Hash[String, ::Array[String]],
|
|
36
|
+
?left_origin: bool
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
MAX_REDIRECTS: 20
|
|
36
40
|
|
|
41
|
+
MAX_RETRY_AFTER: 60
|
|
42
|
+
|
|
37
43
|
PLATFORM_HEADERS: ::Hash[String, String]
|
|
38
44
|
|
|
39
45
|
def self.validate!: (
|
|
@@ -45,10 +51,19 @@ module ScalarGalaxy
|
|
|
45
51
|
headers: ::Hash[String, String]
|
|
46
52
|
) -> bool
|
|
47
53
|
|
|
54
|
+
def self.retry_after: (::Hash[String, String] headers) -> Float?
|
|
55
|
+
|
|
56
|
+
def self.redirect?: (
|
|
57
|
+
Integer status,
|
|
58
|
+
headers: ::Hash[String, String]
|
|
59
|
+
) -> bool
|
|
60
|
+
|
|
48
61
|
def self.follow_redirect: (
|
|
49
62
|
ScalarGalaxy::Internal::Transport::BaseClient::request_input request,
|
|
50
63
|
status: Integer,
|
|
51
|
-
response_headers: ::Hash[String, String]
|
|
64
|
+
response_headers: ::Hash[String, String],
|
|
65
|
+
base_url: URI::Generic,
|
|
66
|
+
credential_headers: ::Array[String]
|
|
52
67
|
) -> ScalarGalaxy::Internal::Transport::BaseClient::request_input
|
|
53
68
|
|
|
54
69
|
def self.reap_connection!: (
|
|
@@ -87,6 +102,27 @@ module ScalarGalaxy
|
|
|
87
102
|
|
|
88
103
|
private def auth_headers: -> ::Hash[String, String]
|
|
89
104
|
|
|
105
|
+
private def auth_headers_for: (
|
|
106
|
+
::Array[::Array[String]]? _security
|
|
107
|
+
) -> ::Hash[String, String]
|
|
108
|
+
|
|
109
|
+
private def auth_header_keys: -> ::Array[String]
|
|
110
|
+
|
|
111
|
+
private def auth_query: -> ::Hash[String, String]
|
|
112
|
+
|
|
113
|
+
private def auth_query_for: (
|
|
114
|
+
::Array[::Array[String]]? _security
|
|
115
|
+
) -> ::Hash[String, String]
|
|
116
|
+
|
|
117
|
+
private def auth_query_keys: -> ::Array[String]
|
|
118
|
+
|
|
119
|
+
private def redact_url: (URI::Generic? url) -> URI::Generic?
|
|
120
|
+
|
|
121
|
+
private def reauthorize_redirect: (
|
|
122
|
+
ScalarGalaxy::Internal::Transport::BaseClient::request_input previous,
|
|
123
|
+
ScalarGalaxy::Internal::Transport::BaseClient::request_input redirected
|
|
124
|
+
) -> ScalarGalaxy::Internal::Transport::BaseClient::request_input
|
|
125
|
+
|
|
90
126
|
private def user_agent: -> String
|
|
91
127
|
|
|
92
128
|
private def generate_idempotency_key: -> String
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module ScalarGalaxy
|
|
2
|
+
module Internal
|
|
3
|
+
module Transport
|
|
4
|
+
class ConnectionPool
|
|
5
|
+
def with: (timeout: Float) { (top arg0) -> top } -> top
|
|
6
|
+
|
|
7
|
+
private def checkout: (Float timeout) -> [top, Integer]
|
|
8
|
+
|
|
9
|
+
private def checkin: (top conn, Integer pid) -> void
|
|
10
|
+
|
|
11
|
+
def shutdown: { (top arg0) -> void } -> void
|
|
12
|
+
|
|
13
|
+
private def reset_after_fork: -> void
|
|
14
|
+
|
|
15
|
+
def initialize: (size: Integer) { -> top } -> void
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -10,19 +10,30 @@ module ScalarGalaxy
|
|
|
10
10
|
url: URI::Generic,
|
|
11
11
|
headers: ::Hash[String, String],
|
|
12
12
|
body: top,
|
|
13
|
-
deadline: Float
|
|
13
|
+
deadline: Float,
|
|
14
|
+
?error_url: URI::Generic?
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
KEEP_ALIVE_TIMEOUT: 30
|
|
17
18
|
|
|
18
19
|
DEFAULT_MAX_CONNECTIONS: Integer
|
|
19
20
|
|
|
21
|
+
MAX_POOLS: 16
|
|
22
|
+
|
|
23
|
+
ELAPSED_SOCKET_TIMEOUT: Float
|
|
24
|
+
|
|
25
|
+
attr_reader cert_store: OpenSSL::X509::Store
|
|
26
|
+
|
|
20
27
|
def self.connect: (
|
|
21
28
|
cert_store: OpenSSL::X509::Store,
|
|
22
29
|
url: URI::Generic
|
|
23
30
|
) -> top
|
|
24
31
|
|
|
25
|
-
def self.calibrate_socket_timeout: (
|
|
32
|
+
def self.calibrate_socket_timeout: (
|
|
33
|
+
top conn,
|
|
34
|
+
Float deadline,
|
|
35
|
+
?finishing: bool
|
|
36
|
+
) -> void
|
|
26
37
|
|
|
27
38
|
def self.build_request: (
|
|
28
39
|
ScalarGalaxy::Internal::Transport::PooledNetRequester::request request
|
|
@@ -13,6 +13,8 @@ module ScalarGalaxy
|
|
|
13
13
|
def self.known_fields: -> ::Hash[Symbol, (ScalarGalaxy::Internal::Type::BaseModel::known_field
|
|
14
14
|
& { type_fn: (^-> ScalarGalaxy::Internal::Type::Converter::input) })]
|
|
15
15
|
|
|
16
|
+
def self.dropped_keys: -> ::Hash[Symbol, true]
|
|
17
|
+
|
|
16
18
|
def self.fields: -> ::Hash[Symbol, (ScalarGalaxy::Internal::Type::BaseModel::known_field
|
|
17
19
|
& { type: ScalarGalaxy::Internal::Type::Converter::input })]
|
|
18
20
|
|
|
@@ -50,6 +52,8 @@ module ScalarGalaxy
|
|
|
50
52
|
|
|
51
53
|
private def self.response_only: { -> void } -> void
|
|
52
54
|
|
|
55
|
+
private def self.drop_on_dump: (*Symbol names) -> void
|
|
56
|
+
|
|
53
57
|
def self.==: (top other) -> bool
|
|
54
58
|
|
|
55
59
|
def self.hash: -> Integer
|
|
@@ -55,6 +55,8 @@ module ScalarGalaxy
|
|
|
55
55
|
|
|
56
56
|
def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
|
|
57
57
|
|
|
58
|
+
def self?.unescape_query_component: (String component) -> String
|
|
59
|
+
|
|
58
60
|
def self?.encode_query: (
|
|
59
61
|
::Hash[String, (::Array[String] | String)?]? query
|
|
60
62
|
) -> String?
|
|
@@ -87,6 +89,10 @@ module ScalarGalaxy
|
|
|
87
89
|
| ::Array[(String | Integer)?])?] headers
|
|
88
90
|
) -> ::Hash[String, String]
|
|
89
91
|
|
|
92
|
+
def self?.encode_cookie_value: (top value) -> String
|
|
93
|
+
|
|
94
|
+
def self?.merge_cookies: (*String? values) -> String?
|
|
95
|
+
|
|
90
96
|
class ReadIOAdapter
|
|
91
97
|
def close?: -> bool?
|
|
92
98
|
|
|
@@ -110,6 +116,12 @@ module ScalarGalaxy
|
|
|
110
116
|
JSON_CONTENT: Regexp
|
|
111
117
|
JSONL_CONTENT: Regexp
|
|
112
118
|
|
|
119
|
+
MAX_BUFFERED_BODY_BYTES: Integer
|
|
120
|
+
|
|
121
|
+
MAX_ERROR_BODY_BYTES: Integer
|
|
122
|
+
|
|
123
|
+
MAX_PENDING_STREAM_BYTES: Integer
|
|
124
|
+
|
|
113
125
|
def encode_query_params: (
|
|
114
126
|
::Hash[Symbol, top] query
|
|
115
127
|
) -> ::Hash[Symbol, top]
|
|
@@ -120,6 +132,8 @@ module ScalarGalaxy
|
|
|
120
132
|
top element
|
|
121
133
|
) -> nil
|
|
122
134
|
|
|
135
|
+
def self?.encode_form_name: (Symbol | String name) -> String
|
|
136
|
+
|
|
123
137
|
def self?.write_multipart_content: (
|
|
124
138
|
Enumerator::Yielder y,
|
|
125
139
|
val: top,
|
|
@@ -139,6 +153,10 @@ module ScalarGalaxy
|
|
|
139
153
|
top body
|
|
140
154
|
) -> [String, Enumerable[String]]
|
|
141
155
|
|
|
156
|
+
def self?.encode_form: (::Hash[Symbol, top] body) -> String
|
|
157
|
+
|
|
158
|
+
def self?.form_field_value: (top value) -> top
|
|
159
|
+
|
|
142
160
|
def self?.encode_content: (
|
|
143
161
|
::Hash[String, String] headers,
|
|
144
162
|
top body
|
|
@@ -146,10 +164,18 @@ module ScalarGalaxy
|
|
|
146
164
|
|
|
147
165
|
def self?.force_charset!: (String content_type, text: String) -> void
|
|
148
166
|
|
|
167
|
+
def self?.read_body: (
|
|
168
|
+
Enumerable[String] stream,
|
|
169
|
+
limit: Integer,
|
|
170
|
+
?truncate: bool
|
|
171
|
+
) -> String
|
|
172
|
+
|
|
149
173
|
def self?.decode_content: (
|
|
150
174
|
::Hash[String, String] headers,
|
|
151
175
|
stream: Enumerable[String],
|
|
152
|
-
?suppress_error: bool
|
|
176
|
+
?suppress_error: bool,
|
|
177
|
+
?truncate_at: Integer?,
|
|
178
|
+
?download: bool
|
|
153
179
|
) -> top
|
|
154
180
|
|
|
155
181
|
def self?.fused_enum: (
|
|
@@ -172,6 +198,8 @@ module ScalarGalaxy
|
|
|
172
198
|
|
|
173
199
|
def self?.decode_lines: (Enumerable[String] enum) -> Enumerable[String]
|
|
174
200
|
|
|
201
|
+
def self?.check_pending_stream!: (Integer bytesize) -> void
|
|
202
|
+
|
|
175
203
|
def self?.decode_sse: (
|
|
176
204
|
Enumerable[String] lines
|
|
177
205
|
) -> Enumerable[ScalarGalaxy::Internal::Util::server_sent_event]
|