Skip to content

Commit 3ac5bb6

Browse files
feat(api): manual updates
1 parent d47d531 commit 3ac5bb6

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
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-eab9713fd85da68b41e881dfd9cd71f654e8620132da2023bab7dd01e5f7852e.yml
3+
openapi_spec_hash: b5037b26fbe7360c6bfaf9947a65bb85
44
config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ $client = new Client(
5252
password: getenv("OPTIONAL_IMAGEKIT_IGNORES_THIS") ?: "do_not_set",
5353
);
5454

55-
$response = $client->files->upload(file: 'file', fileName: "file-name.jpg");
55+
$response = $client->files->upload(
56+
file: "https://www.example.com/public-url.jpg", fileName: "file-name.jpg"
57+
);
5658

5759
var_dump($response->videoCodec);
5860
```
@@ -74,7 +76,9 @@ When the library is unable to connect to the API, or if the API returns a non-su
7476
use ImageKit\Core\Exceptions\APIConnectionException;
7577

7678
try {
77-
$response = $client->files->upload(file: 'file', fileName: "file-name.jpg");
79+
$response = $client->files->upload(
80+
file: "https://www.example.com/public-url.jpg", fileName: "file-name.jpg"
81+
);
7882
} catch (APIConnectionException $e) {
7983
echo "The server could not be reached", PHP_EOL;
8084
var_dump($e->getPrevious());
@@ -122,7 +126,7 @@ $client = new Client(maxRetries: 0);
122126
// Or, configure per-request:
123127

124128
$result = $client->files->upload(
125-
file: 'file',
129+
file: "https://www.example.com/public-url.jpg",
126130
fileName: "file-name.jpg",
127131
requestOptions: RequestOptions::with(maxRetries: 5),
128132
);
@@ -144,7 +148,7 @@ Note: the `extra*` parameters of the same name overrides the documented paramete
144148
use ImageKit\RequestOptions;
145149

146150
$response = $client->files->upload(
147-
file: 'file',
151+
file: "https://www.example.com/public-url.jpg",
148152
fileName: "file-name.jpg",
149153
requestOptions: RequestOptions::with(
150154
extraQueryParams: ["my_query_parameter" => "value"],

tests/Services/FilesTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ public function testUpload(): void
163163
$this->markTestSkipped('Prism tests are disabled');
164164
}
165165

166-
$result = $this->client->files->upload(file: 'file', fileName: 'fileName');
166+
$result = $this->client->files->upload(
167+
file: 'https://www.example.com/path/to-image.jpg',
168+
fileName: 'fileName'
169+
);
167170

168171
$this->assertTrue(true); // @phpstan-ignore-line
169172
}
@@ -175,7 +178,10 @@ public function testUploadWithOptionalParams(): void
175178
$this->markTestSkipped('Prism tests are disabled');
176179
}
177180

178-
$result = $this->client->files->upload(file: 'file', fileName: 'fileName');
181+
$result = $this->client->files->upload(
182+
file: 'https://www.example.com/path/to-image.jpg',
183+
fileName: 'fileName'
184+
);
179185

180186
$this->assertTrue(true); // @phpstan-ignore-line
181187
}

0 commit comments

Comments
 (0)