Skip to content

Commit e9bad22

Browse files
feat(api): manual updates
1 parent c0417fb commit e9bad22

File tree

8 files changed

+35
-74
lines changed

8 files changed

+35
-74
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml
3-
openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-9ae7b43dcfd6208ca37c32c887630ae186ec338bcdd36902b6fe5d1cc66459dc.yml
3+
openapi_spec_hash: 25fb64c067e64bcff6eaaabda26de397
44
config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c

README.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ image_kit = Imagekit::Client.new(
3333
password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted
3434
)
3535

36-
response = image_kit.files.upload(
37-
file: StringIO.new("https://www.example.com/public-url.jpg"),
38-
file_name: "file-name.jpg"
39-
)
36+
response = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg")
4037

4138
puts(response.videoCodec)
4239
```
@@ -69,10 +66,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
6966

7067
```ruby
7168
begin
72-
file = image_kit.files.upload(
73-
file: StringIO.new("https://www.example.com/public-url.jpg"),
74-
file_name: "file-name.jpg"
75-
)
69+
file = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg")
7670
rescue Imagekit::Errors::APIConnectionError => e
7771
puts("The server could not be reached")
7872
puts(e.cause) # an underlying Exception, likely raised within `net/http`
@@ -116,7 +110,7 @@ image_kit = Imagekit::Client.new(
116110

117111
# Or, configure per-request:
118112
image_kit.files.upload(
119-
file: StringIO.new("https://www.example.com/public-url.jpg"),
113+
file: "https://www.example.com/public-url.jpg",
120114
file_name: "file-name.jpg",
121115
request_options: {max_retries: 5}
122116
)
@@ -134,7 +128,7 @@ image_kit = Imagekit::Client.new(
134128

135129
# Or, configure per-request:
136130
image_kit.files.upload(
137-
file: StringIO.new("https://www.example.com/public-url.jpg"),
131+
file: "https://www.example.com/public-url.jpg",
138132
file_name: "file-name.jpg",
139133
request_options: {timeout: 5}
140134
)
@@ -169,7 +163,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
169163
```ruby
170164
response =
171165
image_kit.files.upload(
172-
file: StringIO.new("https://www.example.com/public-url.jpg"),
166+
file: "https://www.example.com/public-url.jpg",
173167
file_name: "file-name.jpg",
174168
request_options: {
175169
extra_query: {my_query_parameter: value},
@@ -216,26 +210,17 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
216210
You can provide typesafe request parameters like so:
217211

218212
```ruby
219-
image_kit.files.upload(
220-
file: StringIO.new("https://www.example.com/public-url.jpg"),
221-
file_name: "file-name.jpg"
222-
)
213+
image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg")
223214
```
224215

225216
Or, equivalently:
226217

227218
```ruby
228219
# Hashes work, but are not typesafe:
229-
image_kit.files.upload(
230-
file: StringIO.new("https://www.example.com/public-url.jpg"),
231-
file_name: "file-name.jpg"
232-
)
220+
image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg")
233221

234222
# You can also splat a full Params class:
235-
params = Imagekit::FileUploadParams.new(
236-
file: StringIO.new("https://www.example.com/public-url.jpg"),
237-
file_name: "file-name.jpg"
238-
)
223+
params = Imagekit::FileUploadParams.new(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg")
239224
image_kit.files.upload(**params)
240225
```
241226

lib/imagekit/models/file_upload_params.rb

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel
88
include Imagekit::Internal::Type::RequestParameters
99

1010
# @!attribute file
11-
# The API accepts any of the following:
11+
# The URL of the file to upload. A publicly reachable URL that ImageKit servers
12+
# can fetch. The server must receive the response headers within 8 seconds;
13+
# otherwise the request fails with 400 Bad Request.
1214
#
13-
# - **Binary data** – send the raw bytes as `multipart/form-data`.
14-
# - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can
15-
# fetch.
16-
# - **Base64 string** – the file encoded as a Base64 data URI or plain Base64.
17-
#
18-
# When supplying a URL, the server must receive the response headers within 8
19-
# seconds; otherwise the request fails with 400 Bad Request.
20-
#
21-
# @return [Pathname, StringIO, IO, String, Imagekit::FilePart]
22-
required :file, Imagekit::Internal::Type::FileInput
15+
# @return [String]
16+
required :file, String
2317

2418
# @!attribute file_name
2519
# The name with which the file has to be uploaded. The file name can contain:
@@ -240,7 +234,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel
240234
# Some parameter documentations has been truncated, see
241235
# {Imagekit::Models::FileUploadParams} for more details.
242236
#
243-
# @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following:
237+
# @param file [String] The URL of the file to upload. A publicly reachable URL that ImageKit servers ca
244238
#
245239
# @param file_name [String] The name with which the file has to be uploaded.
246240
#

lib/imagekit/resources/files.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def rename(params)
221221
#
222222
# @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {})
223223
#
224-
# @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following:
224+
# @param file [String] The URL of the file to upload. A publicly reachable URL that ImageKit servers ca
225225
#
226226
# @param file_name [String] The name with which the file has to be uploaded.
227227
#

rbi/imagekit/models/file_upload_params.rbi

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,10 @@ module Imagekit
1111
T.any(Imagekit::FileUploadParams, Imagekit::Internal::AnyHash)
1212
end
1313

14-
# The API accepts any of the following:
15-
#
16-
# - **Binary data** – send the raw bytes as `multipart/form-data`.
17-
# - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can
18-
# fetch.
19-
# - **Base64 string** – the file encoded as a Base64 data URI or plain Base64.
20-
#
21-
# When supplying a URL, the server must receive the response headers within 8
22-
# seconds; otherwise the request fails with 400 Bad Request.
23-
sig { returns(Imagekit::Internal::FileInput) }
14+
# The URL of the file to upload. A publicly reachable URL that ImageKit servers
15+
# can fetch. The server must receive the response headers within 8 seconds;
16+
# otherwise the request fails with 400 Bad Request.
17+
sig { returns(String) }
2418
attr_accessor :file
2519

2620
# The name with which the file has to be uploaded. The file name can contain:
@@ -290,7 +284,7 @@ module Imagekit
290284

291285
sig do
292286
params(
293-
file: Imagekit::Internal::FileInput,
287+
file: String,
294288
file_name: String,
295289
token: String,
296290
checks: String,
@@ -325,15 +319,9 @@ module Imagekit
325319
).returns(T.attached_class)
326320
end
327321
def self.new(
328-
# The API accepts any of the following:
329-
#
330-
# - **Binary data** – send the raw bytes as `multipart/form-data`.
331-
# - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can
332-
# fetch.
333-
# - **Base64 string** – the file encoded as a Base64 data URI or plain Base64.
334-
#
335-
# When supplying a URL, the server must receive the response headers within 8
336-
# seconds; otherwise the request fails with 400 Bad Request.
322+
# The URL of the file to upload. A publicly reachable URL that ImageKit servers
323+
# can fetch. The server must receive the response headers within 8 seconds;
324+
# otherwise the request fails with 400 Bad Request.
337325
file:,
338326
# The name with which the file has to be uploaded. The file name can contain:
339327
#
@@ -462,7 +450,7 @@ module Imagekit
462450
sig do
463451
override.returns(
464452
{
465-
file: Imagekit::Internal::FileInput,
453+
file: String,
466454
file_name: String,
467455
token: String,
468456
checks: String,

rbi/imagekit/resources/files.rbi

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ module Imagekit
189189
# technologies.
190190
sig do
191191
params(
192-
file: Imagekit::Internal::FileInput,
192+
file: String,
193193
file_name: String,
194194
token: String,
195195
checks: String,
@@ -224,15 +224,9 @@ module Imagekit
224224
).returns(Imagekit::Models::FileUploadResponse)
225225
end
226226
def upload(
227-
# The API accepts any of the following:
228-
#
229-
# - **Binary data** – send the raw bytes as `multipart/form-data`.
230-
# - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can
231-
# fetch.
232-
# - **Base64 string** – the file encoded as a Base64 data URI or plain Base64.
233-
#
234-
# When supplying a URL, the server must receive the response headers within 8
235-
# seconds; otherwise the request fails with 400 Bad Request.
227+
# The URL of the file to upload. A publicly reachable URL that ImageKit servers
228+
# can fetch. The server must receive the response headers within 8 seconds;
229+
# otherwise the request fails with 400 Bad Request.
236230
file:,
237231
# The name with which the file has to be uploaded. The file name can contain:
238232
#

sig/imagekit/models/file_upload_params.rbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Imagekit
22
module Models
33
type file_upload_params =
44
{
5-
file: Imagekit::Internal::file_input,
5+
file: String,
66
file_name: String,
77
token: String,
88
checks: String,
@@ -32,7 +32,7 @@ module Imagekit
3232
extend Imagekit::Internal::Type::RequestParameters::Converter
3333
include Imagekit::Internal::Type::RequestParameters
3434

35-
attr_accessor file: Imagekit::Internal::file_input
35+
attr_accessor file: String
3636

3737
attr_accessor file_name: String
3838

@@ -127,7 +127,7 @@ module Imagekit
127127
def webhook_url=: (String) -> String
128128

129129
def initialize: (
130-
file: Imagekit::Internal::file_input,
130+
file: String,
131131
file_name: String,
132132
?token: String,
133133
?checks: String,
@@ -154,7 +154,7 @@ module Imagekit
154154
) -> void
155155

156156
def to_hash: -> {
157-
file: Imagekit::Internal::file_input,
157+
file: String,
158158
file_name: String,
159159
token: String,
160160
checks: String,

sig/imagekit/resources/files.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module Imagekit
4444
) -> Imagekit::Models::FileRenameResponse
4545

4646
def upload: (
47-
file: Imagekit::Internal::file_input,
47+
file: String,
4848
file_name: String,
4949
?token: String,
5050
?checks: String,

0 commit comments

Comments
 (0)