Skip to content

Commit 7f285f9

Browse files
Merge pull request #92 from apivideo/fix/android_upload_token_video_id
fix(java): fix upload with upload token and video id for file smaller…
2 parents a5f3113 + a82e10f commit 7f285f9

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.3.1] - 2023-08-10
5+
- Fix upload with upload token and video id when video is smaller than chunk size
6+
47
## [1.3.0] - 2023-06-28
58
- Introducing new live streams restream feature
69
- Introducing new analytics endpoints

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Add this dependency to your project's POM:
5656
<dependency>
5757
<groupId>video.api</groupId>
5858
<artifactId>java-api-client</artifactId>
59-
<version>1.3.0</version>
59+
<version>1.3.1</version>
6060
<scope>compile</scope>
6161
</dependency>
6262
```
@@ -66,7 +66,7 @@ Add this dependency to your project's POM:
6666
Add this dependency to your project's build file:
6767

6868
```groovy
69-
implementation "video.api:java-api-client:1.3.0"
69+
implementation "video.api:java-api-client:1.3.1"
7070
```
7171

7272
### Others
@@ -79,7 +79,7 @@ mvn clean package
7979

8080
Then manually install the following JARs:
8181

82-
* `target/java-api-client-1.3.0.jar`
82+
* `target/java-api-client-1.3.1.jar`
8383
* `target/lib/*.jar`
8484

8585
## Code sample

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'com.diffplug.spotless'
44
apply plugin: 'maven-publish'
55

66
group = 'video.api'
7-
version = '1.3.0'
7+
version = '1.3.1'
88

99
buildscript {
1010
repositories {

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>java-api-client</artifactId>
66
<packaging>jar</packaging>
77
<name>${project.groupId}:${project.artifactId}</name>
8-
<version>1.3.0</version>
8+
<version>1.3.1</version>
99
<url>https://github.com/apivideo/api.video-java-client</url>
1010
<description>api.video Java API client</description>
1111
<scm>

src/main/java/video/api/client/api/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private OkHttpClient initHttpClient(List<Interceptor> interceptors) {
118118
private void init() {
119119
verifyingSsl = true;
120120
json = new JSON();
121-
addDefaultHeader("AV-Origin-Client", "java:1.3.0");
121+
addDefaultHeader("AV-Origin-Client", "java:1.3.1");
122122
}
123123

124124
private boolean isValid(String regex, String field) {

src/main/java/video/api/client/api/clients/VideosApi.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ public void onDownloadProgress(long bytesRead, long contentLength, boolean done)
899899
* </tr>
900900
* </table>
901901
*/
902-
private okhttp3.Call uploadWithUploadTokenCall(String token, File file, final ApiCallback _callback)
902+
private okhttp3.Call uploadWithUploadTokenCall(String token, File file, String videoId, final ApiCallback _callback)
903903
throws ApiException {
904904
Object localVarPostBody = null;
905905

@@ -920,6 +920,10 @@ private okhttp3.Call uploadWithUploadTokenCall(String token, File file, final Ap
920920
localVarQueryParams.addAll(localVarApiClient.parameterToPair("token", token));
921921
}
922922

923+
if (videoId != null) {
924+
localVarFormParams.put("videoId", videoId);
925+
}
926+
923927
final String[] localVarAccepts = { "application/json" };
924928
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
925929
if (localVarAccept != null) {
@@ -983,8 +987,8 @@ private okhttp3.Call uploadWithUploadTokenChunkCall(String token, File file, Str
983987
}
984988

985989
@SuppressWarnings("rawtypes")
986-
private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File file, final ApiCallback _callback)
987-
throws ApiException {
990+
private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File file, String videoId,
991+
final ApiCallback _callback) throws ApiException {
988992

989993
// verify the required parameter 'token' is set
990994
if (token == null) {
@@ -996,7 +1000,7 @@ private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File
9961000
throw new ApiException("Missing the required parameter 'file' when calling uploadWithUploadToken");
9971001
}
9981002

999-
okhttp3.Call localVarCall = uploadWithUploadTokenCall(token, file, _callback);
1003+
okhttp3.Call localVarCall = uploadWithUploadTokenCall(token, file, videoId, _callback);
10001004
return localVarCall;
10011005
}
10021006

@@ -1372,7 +1376,7 @@ public void onDownloadProgress(long bytesRead, long contentLength, boolean done)
13721376
}
13731377
};
13741378

1375-
okhttp3.Call localVarCall = uploadWithUploadTokenValidateBeforeCall(token, file, apiCallback);
1379+
okhttp3.Call localVarCall = uploadWithUploadTokenValidateBeforeCall(token, file, videoId, apiCallback);
13761380
Type localVarReturnType = new TypeToken<Video>() {
13771381
}.getType();
13781382
return localVarApiClient.execute(localVarCall, localVarReturnType);

0 commit comments

Comments
 (0)