|
| 1 | +# Uploader static wrapper documentation |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The `UploaderStaticWrapper` class serves as a static interface to the underlying object-oriented uploader library. |
| 6 | + |
| 7 | +This static abstraction is particularly beneficial in contexts where direct object manipulation can be challenging, such as when working within cross-platform frameworks like Flutter or React Native, or in no-code solutions. |
| 8 | + |
| 9 | +By providing a suite of static methods, `UploaderStaticWrapper` allows developers to leverage the power of the library without the complexity of handling instances or managing object lifecycles. |
| 10 | + |
| 11 | +This approach simplifies integration, making it more accessible for a wider range of development environments where traditional object-oriented paradigms are less suitable or harder to implement. |
| 12 | + |
| 13 | +## Common functions |
| 14 | + |
| 15 | +### `UploaderStaticWrapper.setApplicationName(name: string, version: string)` |
| 16 | + |
| 17 | +Sets the application name and version for the SDK. |
| 18 | + |
| 19 | +- **Parameters:** |
| 20 | + - `name: string` - The name of the application using the SDK. |
| 21 | + - `version: string` - The version of the application. |
| 22 | + |
| 23 | +### `UploaderStaticWrapper.setChunkSize(chunkSize: number)` |
| 24 | + |
| 25 | +Sets the chunk size for the video upload. |
| 26 | + |
| 27 | +- **Parameters:** |
| 28 | + - `chunkSize: number` - The size of each chunk in bytes. |
| 29 | + |
| 30 | + |
| 31 | +### `UploaderStaticWrapper.cancelAll()` |
| 32 | + |
| 33 | +Cancels all ongoing uploads, both progressive and standard. |
| 34 | + |
| 35 | + |
| 36 | +## Standard uploads functions |
| 37 | + |
| 38 | + |
| 39 | +### `UploaderStaticWrapper.uploadWithUploadToken(blob: Blob, uploadToken: string, videoName: string, onProgress: (event: number) => void, videoId?: string)` |
| 40 | + |
| 41 | +Uploads a video with an upload token. |
| 42 | + |
| 43 | +- **Parameters:** |
| 44 | + - `blob: Blob` - The video file to be uploaded. |
| 45 | + - `uploadToken: string` - The upload token provided by the backend. |
| 46 | + - `videoName: string` - The name of the video. |
| 47 | + - `onProgress: (event: number) => void` - The callback to call on progress updates. |
| 48 | + - `videoId?: string` - The ID of the video to be uploaded (optional). |
| 49 | + |
| 50 | +- **Returns:** |
| 51 | + - `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. |
| 52 | + |
| 53 | +### `UploaderStaticWrapper.uploadWithApiKey(blob: Blob, apiKey: string, onProgress: (event: number) => void, videoId: string)` |
| 54 | + |
| 55 | +Uploads a video with an API key. |
| 56 | + |
| 57 | +- **Parameters:** |
| 58 | + - `blob: Blob` - The video file to be uploaded. |
| 59 | + - `apiKey: string` - The API key provided by the backend. |
| 60 | + - `onProgress: (event: number) => void` - The callback to call on progress updates. |
| 61 | + - `videoId: string` - The ID of the video to be uploaded (optional). |
| 62 | + |
| 63 | +- **Returns:** |
| 64 | + - `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. |
| 65 | + |
| 66 | +## Progressive uploads functions |
| 67 | + |
| 68 | +### `UploaderStaticWrapper.createProgressiveUploadWithUploadTokenSession(sessionId: string, uploadToken: string, videoId: string)` |
| 69 | + |
| 70 | +Creates a new progressive upload session with an upload token. |
| 71 | + |
| 72 | +- **Parameters:** |
| 73 | + - `sessionId: string` - The unique session identifier. |
| 74 | + - `uploadToken: string` - The upload token provided by the backend. |
| 75 | + - `videoId: string` - The ID of the video to be uploaded. |
| 76 | + |
| 77 | +### `UploaderStaticWrapper.createProgressiveUploadWithApiKeySession(sessionId: string, apiKey: string, videoId: string)` |
| 78 | + |
| 79 | +Creates a new progressive upload session with an API key. |
| 80 | + |
| 81 | +- **Parameters:** |
| 82 | + - `sessionId: string` - The unique session identifier. |
| 83 | + - `apiKey: string` - The API key provided by the backend. |
| 84 | + - `videoId: string` - The ID of the video to be uploaded. |
| 85 | + |
| 86 | +### `UploaderStaticWrapper.uploadPart(sessionId: string, blob: Blob, onProgress: (progress: number) => void)` |
| 87 | + |
| 88 | +Uploads a part of a video in a progressive upload session. |
| 89 | + |
| 90 | +- **Parameters:** |
| 91 | + - `sessionId: string` - The unique session identifier. |
| 92 | + - `blob: Blob` - The video part. |
| 93 | + - `onProgress: (progress: number) => void` - The callback to call on progress updates. |
| 94 | + |
| 95 | +- **Returns:** |
| 96 | + - `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. |
| 97 | +- |
| 98 | +### `UploaderStaticWrapper.uploadLastPart(sessionId: string, blob: Blob, onProgress: (progress: number) => void)` |
| 99 | + |
| 100 | +Uploads the last part of a video in a progressive upload session and finalizes the upload. |
| 101 | + |
| 102 | +- **Parameters:** |
| 103 | + - `sessionId: string` - The unique session identifier. |
| 104 | + - `blob: Blob` - The video part. |
| 105 | + - `onProgress: (progress: number) => void` - The callback to call on progress updates. |
| 106 | + |
| 107 | +- **Returns:** |
| 108 | + - `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. |
| 109 | + |
| 110 | +### `UploaderStaticWrapper.disposeProgressiveUploadSession(sessionId: string)` |
| 111 | + |
| 112 | +Disposes a progressive upload session by its ID. |
| 113 | + |
| 114 | +- **Parameters:** |
| 115 | + - `sessionId: string` - The unique session identifier to dispose. |
0 commit comments