galaxy-ruby 0.5.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.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/README.md +26 -5
  4. data/SKILL.md +6 -4
  5. data/api.md +8 -8
  6. data/lib/galaxy-ruby/client.rb +43 -12
  7. data/lib/galaxy-ruby/errors.rb +40 -0
  8. data/lib/galaxy-ruby/file_part.rb +13 -1
  9. data/lib/galaxy-ruby/internal/transport/base_client.rb +278 -42
  10. data/lib/galaxy-ruby/internal/transport/connection_pool.rb +160 -0
  11. data/lib/galaxy-ruby/internal/transport/pooled_net_requester.rb +77 -10
  12. data/lib/galaxy-ruby/internal/type/base_model.rb +62 -17
  13. data/lib/galaxy-ruby/internal/type/boolean.rb +3 -1
  14. data/lib/galaxy-ruby/internal/type/converter.rb +13 -3
  15. data/lib/galaxy-ruby/internal/type/enum.rb +9 -4
  16. data/lib/galaxy-ruby/internal/type/file_input.rb +8 -2
  17. data/lib/galaxy-ruby/internal/type/hash_of.rb +3 -1
  18. data/lib/galaxy-ruby/internal/type/union.rb +17 -6
  19. data/lib/galaxy-ruby/internal/type/unknown.rb +3 -1
  20. data/lib/galaxy-ruby/internal/util.rb +273 -15
  21. data/lib/galaxy-ruby/internal/webhook_verifier.rb +240 -0
  22. data/lib/galaxy-ruby/internal.rb +4 -1
  23. data/lib/galaxy-ruby/models/authentication_create_token_params.rb +7 -1
  24. data/lib/galaxy-ruby/models/authentication_create_user_params.rb +2 -0
  25. data/lib/galaxy-ruby/models/celestial_body_create_params.rb +3 -3
  26. data/lib/galaxy-ruby/models/celestial_body_param.rb +72 -0
  27. data/lib/galaxy-ruby/models/credentials.rb +1 -9
  28. data/lib/galaxy-ruby/models/planet_create_params.rb +11 -1
  29. data/lib/galaxy-ruby/models/{planet_list_all_data_params.rb → planet_list_params.rb} +2 -2
  30. data/lib/galaxy-ruby/models/{planet_list_all_data_response.rb → planet_list_response.rb} +9 -9
  31. data/lib/galaxy-ruby/models/planet_param.rb +204 -0
  32. data/lib/galaxy-ruby/models/planet_update_params.rb +12 -1
  33. data/lib/galaxy-ruby/models/{planet_delte_image_params.rb → planet_upload_image_params.rb} +2 -2
  34. data/lib/galaxy-ruby/models/{planet_delte_image_response.rb → planet_upload_image_response.rb} +2 -2
  35. data/lib/galaxy-ruby/models/user_param.rb +19 -0
  36. data/lib/galaxy-ruby/models/webhook_unwrap_params.rb +2 -0
  37. data/lib/galaxy-ruby/models.rb +38 -33
  38. data/lib/galaxy-ruby/request_options.rb +13 -5
  39. data/lib/galaxy-ruby/resources/celestial_bodies.rb +1 -1
  40. data/lib/galaxy-ruby/resources/planets.rb +37 -47
  41. data/lib/galaxy-ruby/resources/webhooks.rb +63 -6
  42. data/lib/galaxy-ruby/version.rb +1 -1
  43. data/lib/galaxy-ruby.rb +12 -10
  44. data/rbi/galaxy-ruby/client.rbi +23 -0
  45. data/rbi/galaxy-ruby/errors.rbi +25 -27
  46. data/rbi/galaxy-ruby/internal/transport/base_client.rbi +88 -68
  47. data/rbi/galaxy-ruby/internal/transport/connection_pool.rbi +44 -0
  48. data/rbi/galaxy-ruby/internal/transport/pooled_net_requester.rbi +18 -19
  49. data/rbi/galaxy-ruby/internal/type/base_model.rbi +27 -49
  50. data/rbi/galaxy-ruby/internal/type/base_page.rbi +1 -2
  51. data/rbi/galaxy-ruby/internal/type/converter.rbi +12 -51
  52. data/rbi/galaxy-ruby/internal/type/enum.rbi +1 -5
  53. data/rbi/galaxy-ruby/internal/type/request_parameters.rbi +2 -6
  54. data/rbi/galaxy-ruby/internal/type/union.rbi +2 -11
  55. data/rbi/galaxy-ruby/internal/util.rbi +101 -115
  56. data/rbi/galaxy-ruby/internal/webhook_verifier.rbi +86 -0
  57. data/rbi/galaxy-ruby/internal.rbi +1 -4
  58. data/rbi/galaxy-ruby/models/authentication_create_token_params.rbi +11 -5
  59. data/rbi/galaxy-ruby/models/celestial_body_create_params.rbi +8 -5
  60. data/rbi/galaxy-ruby/models/celestial_body_param.rbi +138 -0
  61. data/rbi/galaxy-ruby/models/credentials.rbi +2 -5
  62. data/rbi/galaxy-ruby/models/planet_create_params.rbi +22 -5
  63. data/rbi/galaxy-ruby/models/{planet_list_all_data_params.rbi → planet_list_params.rbi} +2 -5
  64. data/rbi/galaxy-ruby/models/{planet_list_all_data_response.rbi → planet_list_response.rbi} +11 -15
  65. data/rbi/galaxy-ruby/models/planet_param.rbi +346 -0
  66. data/rbi/galaxy-ruby/models/planet_update_params.rbi +19 -2
  67. data/rbi/galaxy-ruby/models/{planet_delte_image_params.rbi → planet_upload_image_params.rbi} +2 -2
  68. data/rbi/galaxy-ruby/models/{planet_delte_image_response.rbi → planet_upload_image_response.rbi} +2 -2
  69. data/rbi/galaxy-ruby/models/unwrap_webhook_event.rbi +1 -1
  70. data/rbi/galaxy-ruby/models/user_param.rbi +27 -0
  71. data/rbi/galaxy-ruby/models/webhook_unwrap_params.rbi +2 -0
  72. data/rbi/galaxy-ruby/models.rbi +10 -2
  73. data/rbi/galaxy-ruby/request_options.rbi +4 -10
  74. data/rbi/galaxy-ruby/resources/celestial_bodies.rbi +2 -2
  75. data/rbi/galaxy-ruby/resources/planets.rbi +22 -30
  76. data/rbi/galaxy-ruby/resources/webhooks.rbi +64 -3
  77. data/sig/galaxy-ruby/client.rbs +8 -0
  78. data/sig/galaxy-ruby/errors.rbs +13 -0
  79. data/sig/galaxy-ruby/internal/transport/base_client.rbs +38 -2
  80. data/sig/galaxy-ruby/internal/transport/connection_pool.rbs +19 -0
  81. data/sig/galaxy-ruby/internal/transport/pooled_net_requester.rbs +13 -2
  82. data/sig/galaxy-ruby/internal/type/base_model.rbs +4 -0
  83. data/sig/galaxy-ruby/internal/util.rbs +29 -1
  84. data/sig/galaxy-ruby/internal/webhook_verifier.rbs +53 -0
  85. data/sig/galaxy-ruby/models/authentication_create_token_params.rbs +13 -3
  86. data/sig/galaxy-ruby/models/celestial_body_create_params.rbs +4 -4
  87. data/sig/galaxy-ruby/models/celestial_body_param.rbs +69 -0
  88. data/sig/galaxy-ruby/models/credentials.rbs +1 -3
  89. data/sig/galaxy-ruby/models/planet_create_params.rbs +14 -3
  90. data/sig/galaxy-ruby/models/{planet_list_all_data_params.rbs → planet_list_params.rbs} +2 -2
  91. data/sig/galaxy-ruby/models/{planet_list_all_data_response.rbs → planet_list_response.rbs} +15 -13
  92. data/sig/galaxy-ruby/models/planet_param.rbs +199 -0
  93. data/sig/galaxy-ruby/models/planet_update_params.rbs +8 -1
  94. data/sig/galaxy-ruby/models/{planet_delte_image_params.rbs → planet_upload_image_params.rbs} +2 -2
  95. data/sig/galaxy-ruby/models/{planet_delte_image_response.rbs → planet_upload_image_response.rbs} +2 -2
  96. data/sig/galaxy-ruby/models/user_param.rbs +15 -0
  97. data/sig/galaxy-ruby/models/webhook_unwrap_params.rbs +4 -0
  98. data/sig/galaxy-ruby/models.rbs +10 -2
  99. data/sig/galaxy-ruby/resources/celestial_bodies.rbs +1 -1
  100. data/sig/galaxy-ruby/resources/planets.rbs +10 -14
  101. data/sig/galaxy-ruby/resources/webhooks.rbs +17 -1
  102. metadata +32 -71
@@ -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::User::OrHash,
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::User::OrHash,
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::PlanetDelteImageResponse)
151
+ ).returns(ScalarGalaxy::Models::PlanetUploadImageResponse)
142
152
  end
143
- def delte_image(
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(ScalarGalaxy::NewPlanetWebhookEvent)
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: @client.webhook_secret
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
 
@@ -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?,
@@ -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: (top conn, Float deadline) -> void
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]
@@ -0,0 +1,53 @@
1
+ module StandardWebhooks
2
+ class StandardWebhooksError < StandardError
3
+ end
4
+
5
+ class WebhookVerificationError < StandardWebhooksError
6
+ end
7
+ end
8
+
9
+ module ScalarGalaxy
10
+ module Errors
11
+ class WebhookVerificationError < ::StandardWebhooks::WebhookVerificationError
12
+ def initialize: (?String? message) -> void
13
+ end
14
+ end
15
+
16
+ module Internal
17
+ module WebhookVerifier
18
+ SECRET_PREFIX: String
19
+
20
+ TOLERANCE_SECONDS: Integer
21
+
22
+ DEFAULT_ALGORITHM: String
23
+
24
+ HMAC_DIGESTS: ::Hash[String, String]
25
+
26
+ def self.verify!: (
27
+ String payload,
28
+ ::Hash[String | Symbol, String | ::Array[String]] headers,
29
+ String secret,
30
+ ?algorithm: String,
31
+ ?id_header: String,
32
+ ?timestamp_header: String,
33
+ ?signature_header: String,
34
+ ?tolerance: Integer,
35
+ ?decoder: String?
36
+ ) -> void
37
+
38
+ def self.header_value: (
39
+ ::Hash[String | Symbol, String | ::Array[String]] headers,
40
+ String name
41
+ ) -> String?
42
+
43
+ def self.decode_secret: (String secret) -> String
44
+
45
+ def self.verify_timestamp!: (String msg_timestamp, ?Integer tolerance) -> void
46
+
47
+ def self.secure_compare: (
48
+ String expected,
49
+ String? signature
50
+ ) -> bool
51
+ end
52
+ end
53
+ end
@@ -1,15 +1,25 @@
1
1
  module ScalarGalaxy
2
2
  module Models
3
3
  type authentication_create_token_params =
4
- { } & ScalarGalaxy::Internal::Type::request_parameters
4
+ { password: String } & ScalarGalaxy::Internal::Type::request_parameters
5
5
 
6
6
  class AuthenticationCreateTokenParams < ScalarGalaxy::Models::Credentials
7
7
  extend ScalarGalaxy::Internal::Type::RequestParameters::Converter
8
8
  include ScalarGalaxy::Internal::Type::RequestParameters
9
9
 
10
- def initialize: (?request_options: ScalarGalaxy::request_opts) -> void
10
+ def password: -> String
11
11
 
12
- def to_hash: -> { request_options: ScalarGalaxy::RequestOptions }
12
+ def password=: (String _) -> String
13
+
14
+ def initialize: (
15
+ password: String,
16
+ ?request_options: ScalarGalaxy::request_opts
17
+ ) -> void
18
+
19
+ def to_hash: -> {
20
+ password: String,
21
+ request_options: ScalarGalaxy::RequestOptions
22
+ }
13
23
  end
14
24
  end
15
25
  end
@@ -1,22 +1,22 @@
1
1
  module ScalarGalaxy
2
2
  module Models
3
3
  type celestial_body_create_params =
4
- { celestial_body: ScalarGalaxy::Models::celestial_body }
4
+ { celestial_body: ScalarGalaxy::Models::celestial_body_param }
5
5
  & ScalarGalaxy::Internal::Type::request_parameters
6
6
 
7
7
  class CelestialBodyCreateParams < ScalarGalaxy::Internal::Type::BaseModel
8
8
  extend ScalarGalaxy::Internal::Type::RequestParameters::Converter
9
9
  include ScalarGalaxy::Internal::Type::RequestParameters
10
10
 
11
- attr_accessor celestial_body: ScalarGalaxy::Models::celestial_body
11
+ attr_accessor celestial_body: ScalarGalaxy::Models::celestial_body_param
12
12
 
13
13
  def initialize: (
14
- celestial_body: ScalarGalaxy::Models::celestial_body,
14
+ celestial_body: ScalarGalaxy::Models::celestial_body_param,
15
15
  ?request_options: ScalarGalaxy::request_opts
16
16
  ) -> void
17
17
 
18
18
  def to_hash: -> {
19
- celestial_body: ScalarGalaxy::Models::celestial_body,
19
+ celestial_body: ScalarGalaxy::Models::celestial_body_param,
20
20
  request_options: ScalarGalaxy::RequestOptions
21
21
  }
22
22
  end
@@ -0,0 +1,69 @@
1
+ module ScalarGalaxy
2
+ module Models
3
+ type celestial_body_param =
4
+ ScalarGalaxy::PlanetParam | ScalarGalaxy::CelestialBodyParam::Satellite
5
+
6
+ module CelestialBodyParam
7
+ extend ScalarGalaxy::Internal::Type::Union
8
+
9
+ type satellite =
10
+ {
11
+ name: String,
12
+ description: String?,
13
+ diameter: Float,
14
+ orbit: top,
15
+ type: ScalarGalaxy::Models::CelestialBodyParam::Satellite::type_
16
+ }
17
+
18
+ class Satellite < ScalarGalaxy::Internal::Type::BaseModel
19
+ attr_accessor name: String
20
+
21
+ attr_accessor description: String?
22
+
23
+ attr_reader diameter: Float?
24
+
25
+ def diameter=: (Float) -> Float
26
+
27
+ attr_reader orbit: top?
28
+
29
+ def orbit=: (top) -> top
30
+
31
+ attr_reader type: ScalarGalaxy::Models::CelestialBodyParam::Satellite::type_?
32
+
33
+ def type=: (
34
+ ScalarGalaxy::Models::CelestialBodyParam::Satellite::type_
35
+ ) -> ScalarGalaxy::Models::CelestialBodyParam::Satellite::type_
36
+
37
+ def initialize: (
38
+ name: String,
39
+ ?description: String?,
40
+ ?diameter: Float,
41
+ ?orbit: top,
42
+ ?type: ScalarGalaxy::Models::CelestialBodyParam::Satellite::type_
43
+ ) -> void
44
+
45
+ def to_hash: -> {
46
+ name: String,
47
+ description: String?,
48
+ diameter: Float,
49
+ orbit: top,
50
+ type: ScalarGalaxy::Models::CelestialBodyParam::Satellite::type_
51
+ }
52
+
53
+ type type_ = :moon | :asteroid | :comet
54
+
55
+ module Type
56
+ extend ScalarGalaxy::Internal::Type::Enum
57
+
58
+ MOON: :moon
59
+ ASTEROID: :asteroid
60
+ COMET: :comet
61
+
62
+ def self?.values: -> ::Array[ScalarGalaxy::Models::CelestialBodyParam::Satellite::type_]
63
+ end
64
+ end
65
+
66
+ def self?.variants: -> ::Array[ScalarGalaxy::Models::celestial_body_param]
67
+ end
68
+ end
69
+ end
@@ -5,9 +5,7 @@ module ScalarGalaxy
5
5
  class Credentials < ScalarGalaxy::Internal::Type::BaseModel
6
6
  attr_accessor email: String
7
7
 
8
- attr_accessor password: String
9
-
10
- def initialize: (email: String, password: String) -> void
8
+ def initialize: (email: String) -> void
11
9
 
12
10
  def to_hash: -> { email: String, password: String }
13
11
  end