Skip to content

Commit 2d65a57

Browse files
feat(api): manual updates
1 parent bfc46ad commit 2d65a57

File tree

9 files changed

+266
-42
lines changed

9 files changed

+266
-42
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-dd864816d7f4316ae89f57394da2fd1926166d4704db5a0bb5d23461d2d75e49.yml
3-
openapi_spec_hash: 7f7c416563a15bbaea98804ecdc1a8f9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml
3+
openapi_spec_hash: 1d382866fce3284f26d341f112988d9d
44
config_hash: 54c05a157f2cc730fac9e1df5dc3ca29

src/Files/FileUpdateParams.php

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use ImageKit\ExtensionItem\AIAutoDescription;
1313
use ImageKit\ExtensionItem\AutoTaggingExtension;
1414
use ImageKit\ExtensionItem\RemoveBg;
15+
use ImageKit\Files\FileUpdateParams\Publish;
1516
use ImageKit\Files\FileUpdateParams\RemoveAITags;
1617

1718
/**
@@ -38,7 +39,7 @@
3839
* removeAITags?: string|list<string>,
3940
* tags?: list<string>|null,
4041
* webhookURL?: string,
41-
* body: mixed,
42+
* publish?: Publish,
4243
* }
4344
*/
4445
final class FileUpdateParams implements BaseModel
@@ -101,23 +102,12 @@ final class FileUpdateParams implements BaseModel
101102
#[Api('webhookUrl', optional: true)]
102103
public ?string $webhookURL;
103104

104-
#[Api]
105-
public mixed $body;
106-
107105
/**
108-
* `new FileUpdateParams()` is missing required properties by the API.
109-
*
110-
* To enforce required parameters use
111-
* ```
112-
* FileUpdateParams::with(body: ...)
113-
* ```
114-
*
115-
* Otherwise ensure the following setters are called
116-
*
117-
* ```
118-
* (new FileUpdateParams)->withBody(...)
119-
* ```
106+
* Configure the publication status of a file and its versions.
120107
*/
108+
#[Api(optional: true)]
109+
public ?Publish $publish;
110+
121111
public function __construct()
122112
{
123113
$this->initialize();
@@ -134,26 +124,25 @@ public function __construct()
134124
* @param list<string>|null $tags
135125
*/
136126
public static function with(
137-
mixed $body,
138127
?string $customCoordinates = null,
139128
?array $customMetadata = null,
140129
?string $description = null,
141130
?array $extensions = null,
142131
string|array|null $removeAITags = null,
143132
?array $tags = null,
144133
?string $webhookURL = null,
134+
?Publish $publish = null,
145135
): self {
146136
$obj = new self;
147137

148-
$obj->body = $body;
149-
150138
null !== $customCoordinates && $obj->customCoordinates = $customCoordinates;
151139
null !== $customMetadata && $obj->customMetadata = $customMetadata;
152140
null !== $description && $obj->description = $description;
153141
null !== $extensions && $obj->extensions = $extensions;
154142
null !== $removeAITags && $obj->removeAITags = $removeAITags;
155143
null !== $tags && $obj->tags = $tags;
156144
null !== $webhookURL && $obj->webhookURL = $webhookURL;
145+
null !== $publish && $obj->publish = $publish;
157146

158147
return $obj;
159148
}
@@ -247,10 +236,13 @@ public function withWebhookURL(string $webhookURL): self
247236
return $obj;
248237
}
249238

250-
public function withBody(mixed $body): self
239+
/**
240+
* Configure the publication status of a file and its versions.
241+
*/
242+
public function withPublish(Publish $publish): self
251243
{
252244
$obj = clone $this;
253-
$obj->body = $body;
245+
$obj->publish = $publish;
254246

255247
return $obj;
256248
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ImageKit\Files\FileUpdateParams;
6+
7+
use ImageKit\Core\Attributes\Api;
8+
use ImageKit\Core\Concerns\SdkModel;
9+
use ImageKit\Core\Contracts\BaseModel;
10+
11+
/**
12+
* Configure the publication status of a file and its versions.
13+
*
14+
* @phpstan-type publish_alias = array{
15+
* isPublished: bool, includeFileVersions?: bool
16+
* }
17+
*/
18+
final class Publish implements BaseModel
19+
{
20+
/** @use SdkModel<publish_alias> */
21+
use SdkModel;
22+
23+
/**
24+
* Set to `true` to publish the file. Set to `false` to unpublish the file.
25+
*/
26+
#[Api]
27+
public bool $isPublished;
28+
29+
/**
30+
* Set to `true` to publish/unpublish all versions of the file. Set to `false` to publish/unpublish only the current version of the file.
31+
*/
32+
#[Api(optional: true)]
33+
public ?bool $includeFileVersions;
34+
35+
/**
36+
* `new Publish()` is missing required properties by the API.
37+
*
38+
* To enforce required parameters use
39+
* ```
40+
* Publish::with(isPublished: ...)
41+
* ```
42+
*
43+
* Otherwise ensure the following setters are called
44+
*
45+
* ```
46+
* (new Publish)->withIsPublished(...)
47+
* ```
48+
*/
49+
public function __construct()
50+
{
51+
$this->initialize();
52+
}
53+
54+
/**
55+
* Construct an instance from the required parameters.
56+
*
57+
* You must use named parameters to construct any parameters with a default value.
58+
*/
59+
public static function with(
60+
bool $isPublished,
61+
?bool $includeFileVersions = null
62+
): self {
63+
$obj = new self;
64+
65+
$obj->isPublished = $isPublished;
66+
67+
null !== $includeFileVersions && $obj->includeFileVersions = $includeFileVersions;
68+
69+
return $obj;
70+
}
71+
72+
/**
73+
* Set to `true` to publish the file. Set to `false` to unpublish the file.
74+
*/
75+
public function withIsPublished(bool $isPublished): self
76+
{
77+
$obj = clone $this;
78+
$obj->isPublished = $isPublished;
79+
80+
return $obj;
81+
}
82+
83+
/**
84+
* Set to `true` to publish/unpublish all versions of the file. Set to `false` to publish/unpublish only the current version of the file.
85+
*/
86+
public function withIncludeFileVersions(bool $includeFileVersions): self
87+
{
88+
$obj = clone $this;
89+
$obj->includeFileVersions = $includeFileVersions;
90+
91+
return $obj;
92+
}
93+
}

src/Files/UpdateFileRequest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use ImageKit\Core\Concerns\SdkUnion;
88
use ImageKit\Core\Conversion\Contracts\Converter;
99
use ImageKit\Core\Conversion\Contracts\ConverterSource;
10+
use ImageKit\Files\UpdateFileRequest\ChangePublicationStatus;
1011
use ImageKit\Files\UpdateFileRequest\UpdateFileDetails;
1112

1213
/**
@@ -22,6 +23,6 @@ final class UpdateFileRequest implements ConverterSource
2223
*/
2324
public static function variants(): array
2425
{
25-
return [UpdateFileDetails::class, 'mixed'];
26+
return [UpdateFileDetails::class, ChangePublicationStatus::class];
2627
}
2728
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ImageKit\Files\UpdateFileRequest;
6+
7+
use ImageKit\Core\Attributes\Api;
8+
use ImageKit\Core\Concerns\SdkModel;
9+
use ImageKit\Core\Contracts\BaseModel;
10+
use ImageKit\Files\UpdateFileRequest\ChangePublicationStatus\Publish;
11+
12+
/**
13+
* @phpstan-type change_publication_status = array{publish?: Publish}
14+
*/
15+
final class ChangePublicationStatus implements BaseModel
16+
{
17+
/** @use SdkModel<change_publication_status> */
18+
use SdkModel;
19+
20+
/**
21+
* Configure the publication status of a file and its versions.
22+
*/
23+
#[Api(optional: true)]
24+
public ?Publish $publish;
25+
26+
public function __construct()
27+
{
28+
$this->initialize();
29+
}
30+
31+
/**
32+
* Construct an instance from the required parameters.
33+
*
34+
* You must use named parameters to construct any parameters with a default value.
35+
*/
36+
public static function with(?Publish $publish = null): self
37+
{
38+
$obj = new self;
39+
40+
null !== $publish && $obj->publish = $publish;
41+
42+
return $obj;
43+
}
44+
45+
/**
46+
* Configure the publication status of a file and its versions.
47+
*/
48+
public function withPublish(Publish $publish): self
49+
{
50+
$obj = clone $this;
51+
$obj->publish = $publish;
52+
53+
return $obj;
54+
}
55+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ImageKit\Files\UpdateFileRequest\ChangePublicationStatus;
6+
7+
use ImageKit\Core\Attributes\Api;
8+
use ImageKit\Core\Concerns\SdkModel;
9+
use ImageKit\Core\Contracts\BaseModel;
10+
11+
/**
12+
* Configure the publication status of a file and its versions.
13+
*
14+
* @phpstan-type publish_alias = array{
15+
* isPublished: bool, includeFileVersions?: bool
16+
* }
17+
*/
18+
final class Publish implements BaseModel
19+
{
20+
/** @use SdkModel<publish_alias> */
21+
use SdkModel;
22+
23+
/**
24+
* Set to `true` to publish the file. Set to `false` to unpublish the file.
25+
*/
26+
#[Api]
27+
public bool $isPublished;
28+
29+
/**
30+
* Set to `true` to publish/unpublish all versions of the file. Set to `false` to publish/unpublish only the current version of the file.
31+
*/
32+
#[Api(optional: true)]
33+
public ?bool $includeFileVersions;
34+
35+
/**
36+
* `new Publish()` is missing required properties by the API.
37+
*
38+
* To enforce required parameters use
39+
* ```
40+
* Publish::with(isPublished: ...)
41+
* ```
42+
*
43+
* Otherwise ensure the following setters are called
44+
*
45+
* ```
46+
* (new Publish)->withIsPublished(...)
47+
* ```
48+
*/
49+
public function __construct()
50+
{
51+
$this->initialize();
52+
}
53+
54+
/**
55+
* Construct an instance from the required parameters.
56+
*
57+
* You must use named parameters to construct any parameters with a default value.
58+
*/
59+
public static function with(
60+
bool $isPublished,
61+
?bool $includeFileVersions = null
62+
): self {
63+
$obj = new self;
64+
65+
$obj->isPublished = $isPublished;
66+
67+
null !== $includeFileVersions && $obj->includeFileVersions = $includeFileVersions;
68+
69+
return $obj;
70+
}
71+
72+
/**
73+
* Set to `true` to publish the file. Set to `false` to unpublish the file.
74+
*/
75+
public function withIsPublished(bool $isPublished): self
76+
{
77+
$obj = clone $this;
78+
$obj->isPublished = $isPublished;
79+
80+
return $obj;
81+
}
82+
83+
/**
84+
* Set to `true` to publish/unpublish all versions of the file. Set to `false` to publish/unpublish only the current version of the file.
85+
*/
86+
public function withIncludeFileVersions(bool $includeFileVersions): self
87+
{
88+
$obj = clone $this;
89+
$obj->includeFileVersions = $includeFileVersions;
90+
91+
return $obj;
92+
}
93+
}

src/ServiceContracts/FilesContract.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use ImageKit\Files\FileCopyResponse;
1414
use ImageKit\Files\FileMoveResponse;
1515
use ImageKit\Files\FileRenameResponse;
16+
use ImageKit\Files\FileUpdateParams\Publish;
1617
use ImageKit\Files\FileUpdateResponse;
1718
use ImageKit\Files\FileUploadParams\ResponseField;
1819
use ImageKit\Files\FileUploadParams\Transformation;
@@ -38,7 +39,7 @@ interface FilesContract
3839
* Note: The remove operation for `AITags` executes before any of the `extensions` are processed.
3940
* @param list<string>|null $tags An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `null` to unset all tags associated with the file.
4041
* @param string $webhookURL The final status of extensions after they have completed execution will be delivered to this endpoint as a POST request. [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) about the webhook payload structure.
41-
* @param mixed $body
42+
* @param Publish $publish configure the publication status of a file and its versions
4243
*
4344
* @return FileUpdateResponse<HasRawResponse>
4445
*
@@ -53,7 +54,7 @@ public function update(
5354
$removeAITags = omit,
5455
$tags = omit,
5556
$webhookURL = omit,
56-
$body,
57+
$publish = omit,
5758
?RequestOptions $requestOptions = null,
5859
): FileUpdateResponse;
5960

0 commit comments

Comments
 (0)