Skip to content

Commit 864a1aa

Browse files
feat(api): manual updates
1 parent 84f5b7c commit 864a1aa

11 files changed

+120
-193
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml
33
openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a
4-
config_hash: 4e73c7e12a531edcd1366dab7eccc360
4+
config_hash: 08e12746cdca1c59c897cf2e50893c3c

src/Webhooks/BaseWebhookEvent.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ImageKit\Webhooks;
6+
7+
use ImageKit\Core\Attributes\Api;
8+
use ImageKit\Core\Concerns\SdkModel;
9+
use ImageKit\Core\Contracts\BaseModel;
10+
11+
/**
12+
* @phpstan-type base_webhook_event = array{id: string, type: string}
13+
*/
14+
final class BaseWebhookEvent implements BaseModel
15+
{
16+
/** @use SdkModel<base_webhook_event> */
17+
use SdkModel;
18+
19+
/**
20+
* Unique identifier for the event.
21+
*/
22+
#[Api]
23+
public string $id;
24+
25+
/**
26+
* The type of webhook event.
27+
*/
28+
#[Api]
29+
public string $type;
30+
31+
/**
32+
* `new BaseWebhookEvent()` is missing required properties by the API.
33+
*
34+
* To enforce required parameters use
35+
* ```
36+
* BaseWebhookEvent::with(id: ..., type: ...)
37+
* ```
38+
*
39+
* Otherwise ensure the following setters are called
40+
*
41+
* ```
42+
* (new BaseWebhookEvent)->withID(...)->withType(...)
43+
* ```
44+
*/
45+
public function __construct()
46+
{
47+
$this->initialize();
48+
}
49+
50+
/**
51+
* Construct an instance from the required parameters.
52+
*
53+
* You must use named parameters to construct any parameters with a default value.
54+
*/
55+
public static function with(string $id, string $type): self
56+
{
57+
$obj = new self;
58+
59+
$obj->id = $id;
60+
$obj->type = $type;
61+
62+
return $obj;
63+
}
64+
65+
/**
66+
* Unique identifier for the event.
67+
*/
68+
public function withID(string $id): self
69+
{
70+
$obj = clone $this;
71+
$obj->id = $id;
72+
73+
return $obj;
74+
}
75+
76+
/**
77+
* The type of webhook event.
78+
*/
79+
public function withType(string $type): self
80+
{
81+
$obj = clone $this;
82+
$obj->type = $type;
83+
84+
return $obj;
85+
}
86+
}

src/Webhooks/UnsafeUnwrapWebhookEvent.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use ImageKit\Core\Conversion\Contracts\Converter;
99
use ImageKit\Core\Conversion\Contracts\ConverterSource;
1010

11+
/**
12+
* Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle.
13+
*/
1114
final class UnsafeUnwrapWebhookEvent implements ConverterSource
1215
{
1316
use SdkUnion;

src/Webhooks/UnwrapWebhookEvent.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use ImageKit\Core\Conversion\Contracts\Converter;
99
use ImageKit\Core\Conversion\Contracts\ConverterSource;
1010

11+
/**
12+
* Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle.
13+
*/
1114
final class UnwrapWebhookEvent implements ConverterSource
1215
{
1316
use SdkUnion;

src/Webhooks/UploadPostTransformErrorEvent.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
use ImageKit\Webhooks\UploadPostTransformErrorEvent\Request;
1212

1313
/**
14+
* Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated.
15+
*
1416
* @phpstan-type upload_post_transform_error_event = array{
15-
* id: string,
16-
* createdAt: \DateTimeInterface,
17-
* data: Data,
18-
* request: Request,
19-
* type: string,
17+
* createdAt: \DateTimeInterface, data: Data, request: Request, type: string
2018
* }
2119
*/
2220
final class UploadPostTransformErrorEvent implements BaseModel
@@ -27,12 +25,6 @@ final class UploadPostTransformErrorEvent implements BaseModel
2725
#[Api]
2826
public string $type = 'upload.post-transform.error';
2927

30-
/**
31-
* Unique identifier for the event.
32-
*/
33-
#[Api]
34-
public string $id;
35-
3628
/**
3729
* Timestamp of when the event occurred in ISO8601 format.
3830
*/
@@ -50,16 +42,13 @@ final class UploadPostTransformErrorEvent implements BaseModel
5042
*
5143
* To enforce required parameters use
5244
* ```
53-
* UploadPostTransformErrorEvent::with(
54-
* id: ..., createdAt: ..., data: ..., request: ...
55-
* )
45+
* UploadPostTransformErrorEvent::with(createdAt: ..., data: ..., request: ...)
5646
* ```
5747
*
5848
* Otherwise ensure the following setters are called
5949
*
6050
* ```
6151
* (new UploadPostTransformErrorEvent)
62-
* ->withID(...)
6352
* ->withCreatedAt(...)
6453
* ->withData(...)
6554
* ->withRequest(...)
@@ -76,32 +65,19 @@ public function __construct()
7665
* You must use named parameters to construct any parameters with a default value.
7766
*/
7867
public static function with(
79-
string $id,
8068
\DateTimeInterface $createdAt,
8169
Data $data,
8270
Request $request
8371
): self {
8472
$obj = new self;
8573

86-
$obj->id = $id;
8774
$obj->createdAt = $createdAt;
8875
$obj->data = $data;
8976
$obj->request = $request;
9077

9178
return $obj;
9279
}
9380

94-
/**
95-
* Unique identifier for the event.
96-
*/
97-
public function withID(string $id): self
98-
{
99-
$obj = clone $this;
100-
$obj->id = $id;
101-
102-
return $obj;
103-
}
104-
10581
/**
10682
* Timestamp of when the event occurred in ISO8601 format.
10783
*/

src/Webhooks/UploadPostTransformSuccessEvent.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
use ImageKit\Webhooks\UploadPostTransformSuccessEvent\Request;
1212

1313
/**
14+
* Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event.
15+
*
1416
* @phpstan-type upload_post_transform_success_event = array{
15-
* id: string,
16-
* createdAt: \DateTimeInterface,
17-
* data: Data,
18-
* request: Request,
19-
* type: string,
17+
* createdAt: \DateTimeInterface, data: Data, request: Request, type: string
2018
* }
2119
*/
2220
final class UploadPostTransformSuccessEvent implements BaseModel
@@ -27,12 +25,6 @@ final class UploadPostTransformSuccessEvent implements BaseModel
2725
#[Api]
2826
public string $type = 'upload.post-transform.success';
2927

30-
/**
31-
* Unique identifier for the event.
32-
*/
33-
#[Api]
34-
public string $id;
35-
3628
/**
3729
* Timestamp of when the event occurred in ISO8601 format.
3830
*/
@@ -50,16 +42,13 @@ final class UploadPostTransformSuccessEvent implements BaseModel
5042
*
5143
* To enforce required parameters use
5244
* ```
53-
* UploadPostTransformSuccessEvent::with(
54-
* id: ..., createdAt: ..., data: ..., request: ...
55-
* )
45+
* UploadPostTransformSuccessEvent::with(createdAt: ..., data: ..., request: ...)
5646
* ```
5747
*
5848
* Otherwise ensure the following setters are called
5949
*
6050
* ```
6151
* (new UploadPostTransformSuccessEvent)
62-
* ->withID(...)
6352
* ->withCreatedAt(...)
6453
* ->withData(...)
6554
* ->withRequest(...)
@@ -76,32 +65,19 @@ public function __construct()
7665
* You must use named parameters to construct any parameters with a default value.
7766
*/
7867
public static function with(
79-
string $id,
8068
\DateTimeInterface $createdAt,
8169
Data $data,
8270
Request $request
8371
): self {
8472
$obj = new self;
8573

86-
$obj->id = $id;
8774
$obj->createdAt = $createdAt;
8875
$obj->data = $data;
8976
$obj->request = $request;
9077

9178
return $obj;
9279
}
9380

94-
/**
95-
* Unique identifier for the event.
96-
*/
97-
public function withID(string $id): self
98-
{
99-
$obj = clone $this;
100-
$obj->id = $id;
101-
102-
return $obj;
103-
}
104-
10581
/**
10682
* Timestamp of when the event occurred in ISO8601 format.
10783
*/

src/Webhooks/UploadPreTransformErrorEvent.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
use ImageKit\Webhooks\UploadPreTransformErrorEvent\Request;
1212

1313
/**
14+
* Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied.
15+
*
1416
* @phpstan-type upload_pre_transform_error_event = array{
15-
* id: string,
16-
* createdAt: \DateTimeInterface,
17-
* data: Data,
18-
* request: Request,
19-
* type: string,
17+
* createdAt: \DateTimeInterface, data: Data, request: Request, type: string
2018
* }
2119
*/
2220
final class UploadPreTransformErrorEvent implements BaseModel
@@ -27,12 +25,6 @@ final class UploadPreTransformErrorEvent implements BaseModel
2725
#[Api]
2826
public string $type = 'upload.pre-transform.error';
2927

30-
/**
31-
* Unique identifier for the event.
32-
*/
33-
#[Api]
34-
public string $id;
35-
3628
/**
3729
* Timestamp of when the event occurred in ISO8601 format.
3830
*/
@@ -50,16 +42,13 @@ final class UploadPreTransformErrorEvent implements BaseModel
5042
*
5143
* To enforce required parameters use
5244
* ```
53-
* UploadPreTransformErrorEvent::with(
54-
* id: ..., createdAt: ..., data: ..., request: ...
55-
* )
45+
* UploadPreTransformErrorEvent::with(createdAt: ..., data: ..., request: ...)
5646
* ```
5747
*
5848
* Otherwise ensure the following setters are called
5949
*
6050
* ```
6151
* (new UploadPreTransformErrorEvent)
62-
* ->withID(...)
6352
* ->withCreatedAt(...)
6453
* ->withData(...)
6554
* ->withRequest(...)
@@ -76,32 +65,19 @@ public function __construct()
7665
* You must use named parameters to construct any parameters with a default value.
7766
*/
7867
public static function with(
79-
string $id,
8068
\DateTimeInterface $createdAt,
8169
Data $data,
8270
Request $request
8371
): self {
8472
$obj = new self;
8573

86-
$obj->id = $id;
8774
$obj->createdAt = $createdAt;
8875
$obj->data = $data;
8976
$obj->request = $request;
9077

9178
return $obj;
9279
}
9380

94-
/**
95-
* Unique identifier for the event.
96-
*/
97-
public function withID(string $id): self
98-
{
99-
$obj = clone $this;
100-
$obj->id = $id;
101-
102-
return $obj;
103-
}
104-
10581
/**
10682
* Timestamp of when the event occurred in ISO8601 format.
10783
*/

0 commit comments

Comments
 (0)