From a82e10f1d3c2ac69dfbc6604e034d3b9a939d911 Mon Sep 17 00:00:00 2001 From: ThibaultBee Date: Thu, 10 Aug 2023 13:11:11 +0000 Subject: [PATCH] =?UTF-8?q?fix(java):=20fix=20upload=20with=20upload=20tok?= =?UTF-8?q?en=20and=20video=20id=20for=20file=20smaller=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ README.md | 6 +++--- build.gradle | 2 +- pom.xml | 2 +- src/main/java/video/api/client/api/ApiClient.java | 2 +- .../video/api/client/api/clients/VideosApi.java | 14 +++++++++----- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63b1634..3cec674 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.3.1] - 2023-08-10 +- Fix upload with upload token and video id when video is smaller than chunk size + ## [1.3.0] - 2023-06-28 - Introducing new live streams restream feature - Introducing new analytics endpoints diff --git a/README.md b/README.md index a87c44e..ec37aad 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Add this dependency to your project's POM: video.api java-api-client - 1.3.0 + 1.3.1 compile ``` @@ -66,7 +66,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -implementation "video.api:java-api-client:1.3.0" +implementation "video.api:java-api-client:1.3.1" ``` ### Others @@ -79,7 +79,7 @@ mvn clean package Then manually install the following JARs: -* `target/java-api-client-1.3.0.jar` +* `target/java-api-client-1.3.1.jar` * `target/lib/*.jar` ## Code sample diff --git a/build.gradle b/build.gradle index df64d84..2472fcb 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'com.diffplug.spotless' apply plugin: 'maven-publish' group = 'video.api' -version = '1.3.0' +version = '1.3.1' buildscript { repositories { diff --git a/pom.xml b/pom.xml index 4e0dec4..41872d3 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ java-api-client jar ${project.groupId}:${project.artifactId} - 1.3.0 + 1.3.1 https://github.com/apivideo/api.video-java-client api.video Java API client diff --git a/src/main/java/video/api/client/api/ApiClient.java b/src/main/java/video/api/client/api/ApiClient.java index 7d791e6..acfb99a 100644 --- a/src/main/java/video/api/client/api/ApiClient.java +++ b/src/main/java/video/api/client/api/ApiClient.java @@ -118,7 +118,7 @@ private OkHttpClient initHttpClient(List interceptors) { private void init() { verifyingSsl = true; json = new JSON(); - addDefaultHeader("AV-Origin-Client", "java:1.3.0"); + addDefaultHeader("AV-Origin-Client", "java:1.3.1"); } private boolean isValid(String regex, String field) { diff --git a/src/main/java/video/api/client/api/clients/VideosApi.java b/src/main/java/video/api/client/api/clients/VideosApi.java index c91ec02..692c9f2 100644 --- a/src/main/java/video/api/client/api/clients/VideosApi.java +++ b/src/main/java/video/api/client/api/clients/VideosApi.java @@ -899,7 +899,7 @@ public void onDownloadProgress(long bytesRead, long contentLength, boolean done) * * */ - private okhttp3.Call uploadWithUploadTokenCall(String token, File file, final ApiCallback _callback) + private okhttp3.Call uploadWithUploadTokenCall(String token, File file, String videoId, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; @@ -920,6 +920,10 @@ private okhttp3.Call uploadWithUploadTokenCall(String token, File file, final Ap localVarQueryParams.addAll(localVarApiClient.parameterToPair("token", token)); } + if (videoId != null) { + localVarFormParams.put("videoId", videoId); + } + final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -983,8 +987,8 @@ private okhttp3.Call uploadWithUploadTokenChunkCall(String token, File file, Str } @SuppressWarnings("rawtypes") - private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File file, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File file, String videoId, + final ApiCallback _callback) throws ApiException { // verify the required parameter 'token' is set if (token == null) { @@ -996,7 +1000,7 @@ private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File throw new ApiException("Missing the required parameter 'file' when calling uploadWithUploadToken"); } - okhttp3.Call localVarCall = uploadWithUploadTokenCall(token, file, _callback); + okhttp3.Call localVarCall = uploadWithUploadTokenCall(token, file, videoId, _callback); return localVarCall; } @@ -1372,7 +1376,7 @@ public void onDownloadProgress(long bytesRead, long contentLength, boolean done) } }; - okhttp3.Call localVarCall = uploadWithUploadTokenValidateBeforeCall(token, file, apiCallback); + okhttp3.Call localVarCall = uploadWithUploadTokenValidateBeforeCall(token, file, videoId, apiCallback); Type localVarReturnType = new TypeToken