-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from apivideo/static-wrapper
Add static wrapper
- Loading branch information
Showing
7 changed files
with
417 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# Uploader static wrapper documentation | ||
|
||
## Overview | ||
|
||
The `UploaderStaticWrapper` class serves as a static interface to the underlying object-oriented uploader library. | ||
|
||
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. | ||
|
||
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. | ||
|
||
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. | ||
|
||
## Common functions | ||
|
||
### `UploaderStaticWrapper.setApplicationName(name: string, version: string)` | ||
|
||
Sets the application name and version for the SDK. | ||
|
||
- **Parameters:** | ||
- `name: string` - The name of the application using the SDK. | ||
- `version: string` - The version of the application. | ||
|
||
### `UploaderStaticWrapper.setChunkSize(chunkSize: number)` | ||
|
||
Sets the chunk size for the video upload. | ||
|
||
- **Parameters:** | ||
- `chunkSize: number` - The size of each chunk in bytes. | ||
|
||
|
||
### `UploaderStaticWrapper.cancelAll()` | ||
|
||
Cancels all ongoing uploads, both progressive and standard. | ||
|
||
|
||
## Standard uploads functions | ||
|
||
|
||
### `UploaderStaticWrapper.uploadWithUploadToken(blob: Blob, uploadToken: string, videoName: string, onProgress: (event: number) => void, videoId?: string)` | ||
|
||
Uploads a video with an upload token. | ||
|
||
- **Parameters:** | ||
- `blob: Blob` - The video file to be uploaded. | ||
- `uploadToken: string` - The upload token provided by the backend. | ||
- `videoName: string` - The name of the video. | ||
- `onProgress: (event: number) => void` - The callback to call on progress updates. | ||
- `videoId?: string` - The ID of the video to be uploaded (optional). | ||
|
||
- **Returns:** | ||
- `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. | ||
|
||
### `UploaderStaticWrapper.uploadWithApiKey(blob: Blob, apiKey: string, onProgress: (event: number) => void, videoId: string)` | ||
|
||
Uploads a video with an API key. | ||
|
||
- **Parameters:** | ||
- `blob: Blob` - The video file to be uploaded. | ||
- `apiKey: string` - The API key provided by the backend. | ||
- `onProgress: (event: number) => void` - The callback to call on progress updates. | ||
- `videoId: string` - The ID of the video to be uploaded (optional). | ||
|
||
- **Returns:** | ||
- `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. | ||
|
||
## Progressive uploads functions | ||
|
||
### `UploaderStaticWrapper.createProgressiveUploadWithUploadTokenSession(sessionId: string, uploadToken: string, videoId: string)` | ||
|
||
Creates a new progressive upload session with an upload token. | ||
|
||
- **Parameters:** | ||
- `sessionId: string` - The unique session identifier. | ||
- `uploadToken: string` - The upload token provided by the backend. | ||
- `videoId: string` - The ID of the video to be uploaded. | ||
|
||
### `UploaderStaticWrapper.createProgressiveUploadWithApiKeySession(sessionId: string, apiKey: string, videoId: string)` | ||
|
||
Creates a new progressive upload session with an API key. | ||
|
||
- **Parameters:** | ||
- `sessionId: string` - The unique session identifier. | ||
- `apiKey: string` - The API key provided by the backend. | ||
- `videoId: string` - The ID of the video to be uploaded. | ||
|
||
### `UploaderStaticWrapper.uploadPart(sessionId: string, blob: Blob, onProgress: (progress: number) => void)` | ||
|
||
Uploads a part of a video in a progressive upload session. | ||
|
||
- **Parameters:** | ||
- `sessionId: string` - The unique session identifier. | ||
- `blob: Blob` - The video part. | ||
- `onProgress: (progress: number) => void` - The callback to call on progress updates. | ||
|
||
- **Returns:** | ||
- `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. | ||
- | ||
### `UploaderStaticWrapper.uploadLastPart(sessionId: string, blob: Blob, onProgress: (progress: number) => void)` | ||
|
||
Uploads the last part of a video in a progressive upload session and finalizes the upload. | ||
|
||
- **Parameters:** | ||
- `sessionId: string` - The unique session identifier. | ||
- `blob: Blob` - The video part. | ||
- `onProgress: (progress: number) => void` - The callback to call on progress updates. | ||
|
||
- **Returns:** | ||
- `Promise<string>` - A promise resolving to a JSON representation of the `VideoUploadResponse` object. | ||
|
||
### `UploaderStaticWrapper.disposeProgressiveUploadSession(sessionId: string)` | ||
|
||
Disposes a progressive upload session by its ID. | ||
|
||
- **Parameters:** | ||
- `sessionId: string` - The unique session identifier to dispose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.