Skip to content

Commit 4ab06b0

Browse files
feat(api): add BaseWebhookEvent
1 parent 00f7055 commit 4ab06b0

10 files changed

+3
-301
lines changed

.stats.yml

Lines changed: 3 additions & 3 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-3d7da4b8ef2ed30aa32c4fb3e98e498e67402e91aaa5fd4c628fc080bfe82ea1.yml
3-
openapi_spec_hash: aaa50fcbccec6f2cf1165f34bc6ac886
4-
config_hash: 9f8a678d9d4d06daec522e8deb49e3ad
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml
3+
openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a
4+
config_hash: 4e73c7e12a531edcd1366dab7eccc360

image-kit-java-core/src/main/kotlin/com/imagekit/api/models/webhooks/UnsafeUnwrapWebhookEvent.kt

Lines changed: 0 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ import com.imagekit.api.errors.ImageKitInvalidDataException
1818
import java.util.Objects
1919
import java.util.Optional
2020

21-
/**
22-
* Triggered when a new video transformation request is accepted for processing. This event confirms
23-
* that ImageKit has received and queued your transformation request. Use this for debugging and
24-
* tracking transformation lifecycle.
25-
*/
2621
@JsonDeserialize(using = UnsafeUnwrapWebhookEvent.Deserializer::class)
2722
@JsonSerialize(using = UnsafeUnwrapWebhookEvent.Serializer::class)
2823
class UnsafeUnwrapWebhookEvent
@@ -37,56 +32,24 @@ private constructor(
3732
private val _json: JsonValue? = null,
3833
) {
3934

40-
/**
41-
* Triggered when a new video transformation request is accepted for processing. This event
42-
* confirms that ImageKit has received and queued your transformation request. Use this for
43-
* debugging and tracking transformation lifecycle.
44-
*/
4535
fun videoTransformationAccepted(): Optional<VideoTransformationAcceptedEvent> =
4636
Optional.ofNullable(videoTransformationAccepted)
4737

48-
/**
49-
* Triggered when video encoding is finished and the transformed resource is ready to be served.
50-
* This is the key event to listen for - update your database or CMS flags when you receive this
51-
* so your application can start showing the transformed video to users.
52-
*/
5338
fun videoTransformationReady(): Optional<VideoTransformationReadyEvent> =
5439
Optional.ofNullable(videoTransformationReady)
5540

56-
/**
57-
* Triggered when an error occurs during video encoding. Listen to this webhook to log error
58-
* reasons and debug issues. Check your origin and URL endpoint settings if the reason is
59-
* related to download failure. For other errors, contact ImageKit support.
60-
*/
6141
fun videoTransformationError(): Optional<VideoTransformationErrorEvent> =
6242
Optional.ofNullable(videoTransformationError)
6343

64-
/**
65-
* Triggered when a pre-transformation completes successfully. The file has been processed with
66-
* the requested transformation and is now available in the Media Library.
67-
*/
6844
fun uploadPreTransformSuccess(): Optional<UploadPreTransformSuccessEvent> =
6945
Optional.ofNullable(uploadPreTransformSuccess)
7046

71-
/**
72-
* Triggered when a pre-transformation fails. The file upload may have been accepted, but the
73-
* requested transformation could not be applied.
74-
*/
7547
fun uploadPreTransformError(): Optional<UploadPreTransformErrorEvent> =
7648
Optional.ofNullable(uploadPreTransformError)
7749

78-
/**
79-
* Triggered when a post-transformation completes successfully. The transformed version of the
80-
* file is now ready and can be accessed via the provided URL. Note that each
81-
* post-transformation generates a separate webhook event.
82-
*/
8350
fun uploadPostTransformSuccess(): Optional<UploadPostTransformSuccessEvent> =
8451
Optional.ofNullable(uploadPostTransformSuccess)
8552

86-
/**
87-
* Triggered when a post-transformation fails. The original file remains available, but the
88-
* requested transformation could not be generated.
89-
*/
9053
fun uploadPostTransformError(): Optional<UploadPostTransformErrorEvent> =
9154
Optional.ofNullable(uploadPostTransformError)
9255

@@ -104,56 +67,24 @@ private constructor(
10467

10568
fun isUploadPostTransformError(): Boolean = uploadPostTransformError != null
10669

107-
/**
108-
* Triggered when a new video transformation request is accepted for processing. This event
109-
* confirms that ImageKit has received and queued your transformation request. Use this for
110-
* debugging and tracking transformation lifecycle.
111-
*/
11270
fun asVideoTransformationAccepted(): VideoTransformationAcceptedEvent =
11371
videoTransformationAccepted.getOrThrow("videoTransformationAccepted")
11472

115-
/**
116-
* Triggered when video encoding is finished and the transformed resource is ready to be served.
117-
* This is the key event to listen for - update your database or CMS flags when you receive this
118-
* so your application can start showing the transformed video to users.
119-
*/
12073
fun asVideoTransformationReady(): VideoTransformationReadyEvent =
12174
videoTransformationReady.getOrThrow("videoTransformationReady")
12275

123-
/**
124-
* Triggered when an error occurs during video encoding. Listen to this webhook to log error
125-
* reasons and debug issues. Check your origin and URL endpoint settings if the reason is
126-
* related to download failure. For other errors, contact ImageKit support.
127-
*/
12876
fun asVideoTransformationError(): VideoTransformationErrorEvent =
12977
videoTransformationError.getOrThrow("videoTransformationError")
13078

131-
/**
132-
* Triggered when a pre-transformation completes successfully. The file has been processed with
133-
* the requested transformation and is now available in the Media Library.
134-
*/
13579
fun asUploadPreTransformSuccess(): UploadPreTransformSuccessEvent =
13680
uploadPreTransformSuccess.getOrThrow("uploadPreTransformSuccess")
13781

138-
/**
139-
* Triggered when a pre-transformation fails. The file upload may have been accepted, but the
140-
* requested transformation could not be applied.
141-
*/
14282
fun asUploadPreTransformError(): UploadPreTransformErrorEvent =
14383
uploadPreTransformError.getOrThrow("uploadPreTransformError")
14484

145-
/**
146-
* Triggered when a post-transformation completes successfully. The transformed version of the
147-
* file is now ready and can be accessed via the provided URL. Note that each
148-
* post-transformation generates a separate webhook event.
149-
*/
15085
fun asUploadPostTransformSuccess(): UploadPostTransformSuccessEvent =
15186
uploadPostTransformSuccess.getOrThrow("uploadPostTransformSuccess")
15287

153-
/**
154-
* Triggered when a post-transformation fails. The original file remains available, but the
155-
* requested transformation could not be generated.
156-
*/
15788
fun asUploadPostTransformError(): UploadPostTransformErrorEvent =
15889
uploadPostTransformError.getOrThrow("uploadPostTransformError")
15990

@@ -330,64 +261,32 @@ private constructor(
330261

331262
companion object {
332263

333-
/**
334-
* Triggered when a new video transformation request is accepted for processing. This event
335-
* confirms that ImageKit has received and queued your transformation request. Use this for
336-
* debugging and tracking transformation lifecycle.
337-
*/
338264
@JvmStatic
339265
fun ofVideoTransformationAccepted(
340266
videoTransformationAccepted: VideoTransformationAcceptedEvent
341267
) = UnsafeUnwrapWebhookEvent(videoTransformationAccepted = videoTransformationAccepted)
342268

343-
/**
344-
* Triggered when video encoding is finished and the transformed resource is ready to be
345-
* served. This is the key event to listen for - update your database or CMS flags when you
346-
* receive this so your application can start showing the transformed video to users.
347-
*/
348269
@JvmStatic
349270
fun ofVideoTransformationReady(videoTransformationReady: VideoTransformationReadyEvent) =
350271
UnsafeUnwrapWebhookEvent(videoTransformationReady = videoTransformationReady)
351272

352-
/**
353-
* Triggered when an error occurs during video encoding. Listen to this webhook to log error
354-
* reasons and debug issues. Check your origin and URL endpoint settings if the reason is
355-
* related to download failure. For other errors, contact ImageKit support.
356-
*/
357273
@JvmStatic
358274
fun ofVideoTransformationError(videoTransformationError: VideoTransformationErrorEvent) =
359275
UnsafeUnwrapWebhookEvent(videoTransformationError = videoTransformationError)
360276

361-
/**
362-
* Triggered when a pre-transformation completes successfully. The file has been processed
363-
* with the requested transformation and is now available in the Media Library.
364-
*/
365277
@JvmStatic
366278
fun ofUploadPreTransformSuccess(uploadPreTransformSuccess: UploadPreTransformSuccessEvent) =
367279
UnsafeUnwrapWebhookEvent(uploadPreTransformSuccess = uploadPreTransformSuccess)
368280

369-
/**
370-
* Triggered when a pre-transformation fails. The file upload may have been accepted, but
371-
* the requested transformation could not be applied.
372-
*/
373281
@JvmStatic
374282
fun ofUploadPreTransformError(uploadPreTransformError: UploadPreTransformErrorEvent) =
375283
UnsafeUnwrapWebhookEvent(uploadPreTransformError = uploadPreTransformError)
376284

377-
/**
378-
* Triggered when a post-transformation completes successfully. The transformed version of
379-
* the file is now ready and can be accessed via the provided URL. Note that each
380-
* post-transformation generates a separate webhook event.
381-
*/
382285
@JvmStatic
383286
fun ofUploadPostTransformSuccess(
384287
uploadPostTransformSuccess: UploadPostTransformSuccessEvent
385288
) = UnsafeUnwrapWebhookEvent(uploadPostTransformSuccess = uploadPostTransformSuccess)
386289

387-
/**
388-
* Triggered when a post-transformation fails. The original file remains available, but the
389-
* requested transformation could not be generated.
390-
*/
391290
@JvmStatic
392291
fun ofUploadPostTransformError(uploadPostTransformError: UploadPostTransformErrorEvent) =
393292
UnsafeUnwrapWebhookEvent(uploadPostTransformError = uploadPostTransformError)
@@ -399,60 +298,28 @@ private constructor(
399298
*/
400299
interface Visitor<out T> {
401300

402-
/**
403-
* Triggered when a new video transformation request is accepted for processing. This event
404-
* confirms that ImageKit has received and queued your transformation request. Use this for
405-
* debugging and tracking transformation lifecycle.
406-
*/
407301
fun visitVideoTransformationAccepted(
408302
videoTransformationAccepted: VideoTransformationAcceptedEvent
409303
): T
410304

411-
/**
412-
* Triggered when video encoding is finished and the transformed resource is ready to be
413-
* served. This is the key event to listen for - update your database or CMS flags when you
414-
* receive this so your application can start showing the transformed video to users.
415-
*/
416305
fun visitVideoTransformationReady(
417306
videoTransformationReady: VideoTransformationReadyEvent
418307
): T
419308

420-
/**
421-
* Triggered when an error occurs during video encoding. Listen to this webhook to log error
422-
* reasons and debug issues. Check your origin and URL endpoint settings if the reason is
423-
* related to download failure. For other errors, contact ImageKit support.
424-
*/
425309
fun visitVideoTransformationError(
426310
videoTransformationError: VideoTransformationErrorEvent
427311
): T
428312

429-
/**
430-
* Triggered when a pre-transformation completes successfully. The file has been processed
431-
* with the requested transformation and is now available in the Media Library.
432-
*/
433313
fun visitUploadPreTransformSuccess(
434314
uploadPreTransformSuccess: UploadPreTransformSuccessEvent
435315
): T
436316

437-
/**
438-
* Triggered when a pre-transformation fails. The file upload may have been accepted, but
439-
* the requested transformation could not be applied.
440-
*/
441317
fun visitUploadPreTransformError(uploadPreTransformError: UploadPreTransformErrorEvent): T
442318

443-
/**
444-
* Triggered when a post-transformation completes successfully. The transformed version of
445-
* the file is now ready and can be accessed via the provided URL. Note that each
446-
* post-transformation generates a separate webhook event.
447-
*/
448319
fun visitUploadPostTransformSuccess(
449320
uploadPostTransformSuccess: UploadPostTransformSuccessEvent
450321
): T
451322

452-
/**
453-
* Triggered when a post-transformation fails. The original file remains available, but the
454-
* requested transformation could not be generated.
455-
*/
456323
fun visitUploadPostTransformError(
457324
uploadPostTransformError: UploadPostTransformErrorEvent
458325
): T

0 commit comments

Comments
 (0)