|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace ImageKit\Files\UpdateFileDetailsRequest; |
| 6 | + |
| 7 | +use ImageKit\Core\Attributes\Api; |
| 8 | +use ImageKit\Core\Concerns\SdkModel; |
| 9 | +use ImageKit\Core\Contracts\BaseModel; |
| 10 | +use ImageKit\ExtensionItem; |
| 11 | +use ImageKit\ExtensionItem\AIAutoDescription; |
| 12 | +use ImageKit\ExtensionItem\AutoTaggingExtension; |
| 13 | +use ImageKit\ExtensionItem\RemoveBg; |
| 14 | +use ImageKit\Files\UpdateFileDetailsRequest\UpdateFileDetails\RemoveAITags; |
| 15 | + |
| 16 | +/** |
| 17 | + * @phpstan-type update_file_details = array{ |
| 18 | + * customCoordinates?: string|null, |
| 19 | + * customMetadata?: array<string, mixed>|null, |
| 20 | + * description?: string|null, |
| 21 | + * extensions?: list<RemoveBg|AutoTaggingExtension|AIAutoDescription>|null, |
| 22 | + * removeAITags?: string|null|list<string>, |
| 23 | + * tags?: list<string>|null, |
| 24 | + * webhookURL?: string|null, |
| 25 | + * } |
| 26 | + */ |
| 27 | +final class UpdateFileDetails implements BaseModel |
| 28 | +{ |
| 29 | + /** @use SdkModel<update_file_details> */ |
| 30 | + use SdkModel; |
| 31 | + |
| 32 | + /** |
| 33 | + * Define an important area in the image in the format `x,y,width,height` e.g. `10,10,100,100`. Send `null` to unset this value. |
| 34 | + */ |
| 35 | + #[Api(nullable: true, optional: true)] |
| 36 | + public ?string $customCoordinates; |
| 37 | + |
| 38 | + /** |
| 39 | + * A key-value data to be associated with the asset. To unset a key, send `null` value for that key. Before setting any custom metadata on an asset you have to create the field using custom metadata fields API. |
| 40 | + * |
| 41 | + * @var array<string, mixed>|null $customMetadata |
| 42 | + */ |
| 43 | + #[Api(map: 'mixed', optional: true)] |
| 44 | + public ?array $customMetadata; |
| 45 | + |
| 46 | + /** |
| 47 | + * Optional text to describe the contents of the file. |
| 48 | + */ |
| 49 | + #[Api(optional: true)] |
| 50 | + public ?string $description; |
| 51 | + |
| 52 | + /** |
| 53 | + * Array of extensions to be applied to the asset. Each extension can be configured with specific parameters based on the extension type. |
| 54 | + * |
| 55 | + * @var list<RemoveBg|AutoTaggingExtension|AIAutoDescription>|null $extensions |
| 56 | + */ |
| 57 | + #[Api(list: ExtensionItem::class, optional: true)] |
| 58 | + public ?array $extensions; |
| 59 | + |
| 60 | + /** |
| 61 | + * An array of AITags associated with the file that you want to remove, e.g. `["car", "vehicle", "motorsports"]`. |
| 62 | + * |
| 63 | + * If you want to remove all AITags associated with the file, send a string - "all". |
| 64 | + * |
| 65 | + * Note: The remove operation for `AITags` executes before any of the `extensions` are processed. |
| 66 | + * |
| 67 | + * @var string|list<string>|null $removeAITags |
| 68 | + */ |
| 69 | + #[Api(union: RemoveAITags::class, optional: true)] |
| 70 | + public string|array|null $removeAITags; |
| 71 | + |
| 72 | + /** |
| 73 | + * An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `null` to unset all tags associated with the file. |
| 74 | + * |
| 75 | + * @var list<string>|null $tags |
| 76 | + */ |
| 77 | + #[Api(list: 'string', nullable: true, optional: true)] |
| 78 | + public ?array $tags; |
| 79 | + |
| 80 | + /** |
| 81 | + * 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. |
| 82 | + */ |
| 83 | + #[Api('webhookUrl', optional: true)] |
| 84 | + public ?string $webhookURL; |
| 85 | + |
| 86 | + public function __construct() |
| 87 | + { |
| 88 | + $this->initialize(); |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * Construct an instance from the required parameters. |
| 93 | + * |
| 94 | + * You must use named parameters to construct any parameters with a default value. |
| 95 | + * |
| 96 | + * @param array<string, mixed> $customMetadata |
| 97 | + * @param list<RemoveBg|AutoTaggingExtension|AIAutoDescription> $extensions |
| 98 | + * @param string|list<string> $removeAITags |
| 99 | + * @param list<string>|null $tags |
| 100 | + */ |
| 101 | + public static function with( |
| 102 | + ?string $customCoordinates = null, |
| 103 | + ?array $customMetadata = null, |
| 104 | + ?string $description = null, |
| 105 | + ?array $extensions = null, |
| 106 | + string|array|null $removeAITags = null, |
| 107 | + ?array $tags = null, |
| 108 | + ?string $webhookURL = null, |
| 109 | + ): self { |
| 110 | + $obj = new self; |
| 111 | + |
| 112 | + null !== $customCoordinates && $obj->customCoordinates = $customCoordinates; |
| 113 | + null !== $customMetadata && $obj->customMetadata = $customMetadata; |
| 114 | + null !== $description && $obj->description = $description; |
| 115 | + null !== $extensions && $obj->extensions = $extensions; |
| 116 | + null !== $removeAITags && $obj->removeAITags = $removeAITags; |
| 117 | + null !== $tags && $obj->tags = $tags; |
| 118 | + null !== $webhookURL && $obj->webhookURL = $webhookURL; |
| 119 | + |
| 120 | + return $obj; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Define an important area in the image in the format `x,y,width,height` e.g. `10,10,100,100`. Send `null` to unset this value. |
| 125 | + */ |
| 126 | + public function withCustomCoordinates(?string $customCoordinates): self |
| 127 | + { |
| 128 | + $obj = clone $this; |
| 129 | + $obj->customCoordinates = $customCoordinates; |
| 130 | + |
| 131 | + return $obj; |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * A key-value data to be associated with the asset. To unset a key, send `null` value for that key. Before setting any custom metadata on an asset you have to create the field using custom metadata fields API. |
| 136 | + * |
| 137 | + * @param array<string, mixed> $customMetadata |
| 138 | + */ |
| 139 | + public function withCustomMetadata(array $customMetadata): self |
| 140 | + { |
| 141 | + $obj = clone $this; |
| 142 | + $obj->customMetadata = $customMetadata; |
| 143 | + |
| 144 | + return $obj; |
| 145 | + } |
| 146 | + |
| 147 | + /** |
| 148 | + * Optional text to describe the contents of the file. |
| 149 | + */ |
| 150 | + public function withDescription(string $description): self |
| 151 | + { |
| 152 | + $obj = clone $this; |
| 153 | + $obj->description = $description; |
| 154 | + |
| 155 | + return $obj; |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * Array of extensions to be applied to the asset. Each extension can be configured with specific parameters based on the extension type. |
| 160 | + * |
| 161 | + * @param list<RemoveBg|AutoTaggingExtension|AIAutoDescription> $extensions |
| 162 | + */ |
| 163 | + public function withExtensions(array $extensions): self |
| 164 | + { |
| 165 | + $obj = clone $this; |
| 166 | + $obj->extensions = $extensions; |
| 167 | + |
| 168 | + return $obj; |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * An array of AITags associated with the file that you want to remove, e.g. `["car", "vehicle", "motorsports"]`. |
| 173 | + * |
| 174 | + * If you want to remove all AITags associated with the file, send a string - "all". |
| 175 | + * |
| 176 | + * Note: The remove operation for `AITags` executes before any of the `extensions` are processed. |
| 177 | + * |
| 178 | + * @param string|list<string> $removeAITags |
| 179 | + */ |
| 180 | + public function withRemoveAITags(string|array $removeAITags): self |
| 181 | + { |
| 182 | + $obj = clone $this; |
| 183 | + $obj->removeAITags = $removeAITags; |
| 184 | + |
| 185 | + return $obj; |
| 186 | + } |
| 187 | + |
| 188 | + /** |
| 189 | + * An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `null` to unset all tags associated with the file. |
| 190 | + * |
| 191 | + * @param list<string>|null $tags |
| 192 | + */ |
| 193 | + public function withTags(?array $tags): self |
| 194 | + { |
| 195 | + $obj = clone $this; |
| 196 | + $obj->tags = $tags; |
| 197 | + |
| 198 | + return $obj; |
| 199 | + } |
| 200 | + |
| 201 | + /** |
| 202 | + * 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. |
| 203 | + */ |
| 204 | + public function withWebhookURL(string $webhookURL): self |
| 205 | + { |
| 206 | + $obj = clone $this; |
| 207 | + $obj->webhookURL = $webhookURL; |
| 208 | + |
| 209 | + return $obj; |
| 210 | + } |
| 211 | +} |
0 commit comments