|
| 1 | +import { UploadResponse } from "./UploadResponse"; |
| 2 | + |
1 | 3 | type Asset = { |
2 | 4 | url: string; |
3 | 5 | }; |
@@ -74,8 +76,78 @@ export interface WebhookEventVideoTransformationError extends WebhookEventVideoT |
74 | 76 | }; |
75 | 77 | } |
76 | 78 |
|
| 79 | +type TransformationType = "transformation" | "abs" | "gif-to-video" | "thumbnail"; |
| 80 | + |
| 81 | +interface PreTransformationBase { |
| 82 | + id: string; |
| 83 | + created_at: string; |
| 84 | + request: { |
| 85 | + x_request_id: string; |
| 86 | + transformation: string; |
| 87 | + }; |
| 88 | +} |
| 89 | + |
| 90 | +interface PostTransformationBase { |
| 91 | + id: string; |
| 92 | + created_at: string; |
| 93 | + request: { |
| 94 | + x_request_id: string; |
| 95 | + transformation: { |
| 96 | + type: TransformationType; |
| 97 | + value?: string; |
| 98 | + protocol?: 'hls' | 'dash'; |
| 99 | + }; |
| 100 | + }; |
| 101 | +} |
| 102 | + |
| 103 | +export interface WebhookEventUploadPreTransformationSuccess extends PreTransformationBase { |
| 104 | + type: "upload.pre-transform.success"; |
| 105 | + data: UploadResponse; |
| 106 | +} |
| 107 | + |
| 108 | +export interface WebhookEventUploadPreTransformationError extends PostTransformationBase { |
| 109 | + type: "upload.pre-transform.error"; |
| 110 | + data: { |
| 111 | + name: string; |
| 112 | + path: string; |
| 113 | + transformation: { |
| 114 | + error: { |
| 115 | + reason: string; |
| 116 | + }; |
| 117 | + }; |
| 118 | + }; |
| 119 | +} |
| 120 | + |
| 121 | +export interface WebhookEventUploadPostTransformationSuccess extends PostTransformationBase { |
| 122 | + type: "upload.post-transform.success"; |
| 123 | + data: { |
| 124 | + fileId: string; |
| 125 | + url: string; |
| 126 | + name: string; |
| 127 | + }; |
| 128 | +} |
| 129 | + |
| 130 | +export interface WebhookEventUploadPostTransformationError extends PostTransformationBase { |
| 131 | + type: "upload.post-transform.error"; |
| 132 | + data: { |
| 133 | + fileId: string; |
| 134 | + url: string; |
| 135 | + name: string; |
| 136 | + path: string; |
| 137 | + transformation: { |
| 138 | + error: { |
| 139 | + reason: string; |
| 140 | + }; |
| 141 | + }; |
| 142 | + }; |
| 143 | +} |
| 144 | + |
77 | 145 | export type WebhookEvent = |
78 | 146 | | WebhookEventVideoTransformationAccepted |
79 | 147 | | WebhookEventVideoTransformationReady |
80 | 148 | | WebhookEventVideoTransformationError |
| 149 | + | WebhookEventUploadPreTransformationSuccess |
| 150 | + | WebhookEventUploadPreTransformationError |
| 151 | + | WebhookEventUploadPostTransformationSuccess |
| 152 | + | WebhookEventUploadPostTransformationError |
81 | 153 | | Object; |
0 commit comments