Skip to content

Commit

Permalink
Merge pull request #90 from apivideo/nodejs-upload-stream
Browse files Browse the repository at this point in the history
feat(nodejs): upload methods file can be Readable or Buffer
  • Loading branch information
bot-api-video committed May 6, 2022
2 parents 592df5b + 806e63e commit 8d089c0
Show file tree
Hide file tree
Showing 23 changed files with 856 additions and 1,309 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Expand Up @@ -8,7 +8,9 @@
"rules": {
"no-console": "warn",
"@typescript-eslint/ban-ts-comment": "off",
"unused-imports/no-unused-imports": "error",
"@typescript-eslint/no-explicit-any": ["warn", { "ignoreRestArgs": true }],
"@typescript-eslint/no-unused-vars": "off" // Hard to guess if a library will be used in one of the operations
}
},
"plugins": ["unused-imports"]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [2.2.7] - 2022-05-06
- Upload methods (except for videos upload) now accept Readable and Buffer in addition to the file path.

## [2.2.6] - 2022-04-21
- Fix `video.publishedAt` type

Expand Down
2 changes: 1 addition & 1 deletion doc/api/CaptionsApi.md
Expand Up @@ -25,7 +25,7 @@ Upload a VTT file to add captions to your video.
| ------------- | ------------- | ------------- | ------------- |
| **videoId** | **string**| **yes**| The unique identifier for the video you want to add a caption to. |
| **language** | **string**| **yes**| A valid BCP 47 language representation. |
| **file** | **string**| **yes**| The video text track (VTT) you want to upload. |
| **file** | **string \| Readable \| Buffer**| **yes**| The video text track (VTT) you want to upload. |


### Return type
Expand Down
2 changes: 1 addition & 1 deletion doc/api/ChaptersApi.md
Expand Up @@ -24,7 +24,7 @@ Chapters help break the video into sections. Read our [tutorial](https://api.vid
| ------------- | ------------- | ------------- | ------------- |
| **videoId** | **string**| **yes**| The unique identifier for the video you want to upload a chapter for. |
| **language** | **string**| **yes**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. |
| **file** | **string**| **yes**| The VTT file describing the chapters you want to upload. |
| **file** | **string \| Readable \| Buffer**| **yes**| The VTT file describing the chapters you want to upload. |


### Return type
Expand Down
2 changes: 1 addition & 1 deletion doc/api/LiveStreamsApi.md
Expand Up @@ -223,7 +223,7 @@ Upload an image to use as a backdrop for your livestream. Tutorials that [update
| Name | Type | Required | Description |
| ------------- | ------------- | ------------- | ------------- |
| **liveStreamId** | **string**| **yes**| The unique ID for the live stream you want to upload. |
| **file** | **string**| **yes**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. |
| **file** | **string \| Readable \| Buffer**| **yes**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. |


### Return type
Expand Down
2 changes: 1 addition & 1 deletion doc/api/PlayerThemesApi.md
Expand Up @@ -215,7 +215,7 @@ The uploaded image maximum size should be 200x100 and its weight should be 100KB
| Name | Type | Required | Description |
| ------------- | ------------- | ------------- | ------------- |
| **playerId** | **string**| **yes**| The unique identifier for the player. |
| **file** | **string**| **yes**| The name of the file you want to use for your logo. |
| **file** | **string \| Readable \| Buffer**| **yes**| The name of the file you want to use for your logo. |
| **link** | **string**| no| A public link that you want to advertise in your player. For example, you could add a link to your company. When a viewer clicks on your logo, they will be taken to this address. |


Expand Down
6 changes: 3 additions & 3 deletions doc/api/VideosApi.md
Expand Up @@ -115,7 +115,7 @@ The latter allows you to split a video source into X chunks and send those chunk
| Name | Type | Required | Description |
| ------------- | ------------- | ------------- | ------------- |
| **videoId** | **string**| **yes**| Enter the videoId you want to use to upload your video. |
| **file** | **string**| **yes**| The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the \\\"/videos\\\" endpoint and add the \\\"source\\\" parameter when you create a new video. |
| **file** | **string \| Readable \| Buffer**| **yes**| The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the \\\"/videos\\\" endpoint and add the \\\"source\\\" parameter when you create a new video. |
| **progressListener** | **(event: UploadProgressEvent) => void \| undefined** | no | Optional upload progress listener |

### Return type
Expand Down Expand Up @@ -186,7 +186,7 @@ This method allows you to send a video using an upload token. Upload tokens are
| Name | Type | Required | Description |
| ------------- | ------------- | ------------- | ------------- |
| **token** | **string**| **yes**| The unique identifier for the token you want to use to upload a video. |
| **file** | **string**| **yes**| The path to the video you want to upload. |
| **file** | **string \| Readable \| Buffer**| **yes**| The path to the video you want to upload. |
| **progressListener** | **(event: UploadProgressEvent) => void \| undefined** | no | Optional upload progress listener |

### Return type
Expand Down Expand Up @@ -417,7 +417,7 @@ Note: There may be a short delay before the new thumbnail is delivered to our CD
| Name | Type | Required | Description |
| ------------- | ------------- | ------------- | ------------- |
| **videoId** | **string**| **yes**| Unique identifier of the chosen video |
| **file** | **string**| **yes**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. |
| **file** | **string \| Readable \| Buffer**| **yes**| The image to be added as a thumbnail. The mime type should be image/jpeg, image/png or image/webp. The max allowed size is 8 MiB. |


### Return type
Expand Down
2 changes: 1 addition & 1 deletion doc/api/WatermarksApi.md
Expand Up @@ -19,7 +19,7 @@ Create a new watermark by uploading a `JPG` or a `PNG` image. A watermark is a s

| Name | Type | Required | Description |
| ------------- | ------------- | ------------- | ------------- |
| **file** | **string**| **yes**| The `.jpg` or `.png` image to be added as a watermark. |
| **file** | **string \| Readable \| Buffer**| **yes**| The `.jpg` or `.png` image to be added as a watermark. |


### Return type
Expand Down

0 comments on commit 8d089c0

Please sign in to comment.