Skip to content

Commit a828193

Browse files
Merge pull request #68 from apivideo/fix/android_upload_token_video_id
fix(java): fix upload with upload token and video id for file smaller…
2 parents 2aa1db0 + 52c0e2e commit a828193

File tree

7 files changed

+20
-13
lines changed

7 files changed

+20
-13
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.2.4] - 2023-08-10
5+
- Fix upload with upload token and video id when video is smaller than chunk size
6+
47
## [1.2.3] - 2023-08-08
58
- Fix upload notification resources name
69

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Add this dependency to your project's POM:
4949
<dependency>
5050
<groupId>video.api</groupId>
5151
<artifactId>android-video-uploader</artifactId>
52-
<version>1.2.3</version>
52+
<version>1.2.4</version>
5353
<scope>compile</scope>
5454
</dependency>
5555
```
@@ -59,7 +59,7 @@ Add this dependency to your project's POM:
5959
Add this dependency to your project's build file:
6060

6161
```groovy
62-
implementation "video.api:android-video-uploader:1.2.3"
62+
implementation "video.api:android-video-uploader:1.2.4"
6363
```
6464

6565
### Others
@@ -72,7 +72,7 @@ mvn clean package
7272

7373
Then manually install the following JARs:
7474

75-
* `target/android-video-uploader-1.2.3.jar`
75+
* `target/android-video-uploader-1.2.4.jar`
7676
* `target/lib/*.jar`
7777

7878
## Code sample

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'maven-publish'
55
apply plugin: 'kotlin-android'
66

77
group = 'video.api'
8-
version = '1.2.3'
8+
version = '1.2.4'
99

1010
buildscript {
1111
repositories {

maven-push.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ apply plugin: 'maven-publish'
1818
apply plugin: 'signing'
1919

2020
def isReleaseBuild() {
21-
return !"1.2.3".contains("SNAPSHOT")
21+
return !"1.2.4".contains("SNAPSHOT")
2222
}
2323

2424
def getReleaseRepositoryUrl() {
@@ -47,7 +47,7 @@ afterEvaluate { project ->
4747

4848
groupId = "video.api"
4949
artifactId = "android-video-uploader"
50-
version = "1.2.3"
50+
version = "1.2.4"
5151

5252
pom {
5353
name = "video.api:android-video-uploader"

pom.xml

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

src/main/java/video/api/uploader/VideosApi.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ public void onDownloadProgress(long bytesRead, long contentLength, boolean done)
678678
* </tr>
679679
* </table>
680680
*/
681-
private okhttp3.Call uploadWithUploadTokenCall(String token, File file, final ApiCallback _callback)
681+
private okhttp3.Call uploadWithUploadTokenCall(String token, File file, String videoId, final ApiCallback _callback)
682682
throws ApiException {
683683
Object localVarPostBody = null;
684684

@@ -699,6 +699,10 @@ private okhttp3.Call uploadWithUploadTokenCall(String token, File file, final Ap
699699
localVarQueryParams.addAll(localVarApiClient.parameterToPair("token", token));
700700
}
701701

702+
if (videoId != null) {
703+
localVarFormParams.put("videoId", videoId);
704+
}
705+
702706
final String[] localVarAccepts = { "application/json" };
703707
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
704708
if (localVarAccept != null) {
@@ -762,8 +766,8 @@ private okhttp3.Call uploadWithUploadTokenChunkCall(String token, File file, Str
762766
}
763767

764768
@SuppressWarnings("rawtypes")
765-
private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File file, final ApiCallback _callback)
766-
throws ApiException {
769+
private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File file, String videoId,
770+
final ApiCallback _callback) throws ApiException {
767771

768772
// verify the required parameter 'token' is set
769773
if (token == null) {
@@ -775,7 +779,7 @@ private okhttp3.Call uploadWithUploadTokenValidateBeforeCall(String token, File
775779
throw new ApiException("Missing the required parameter 'file' when calling uploadWithUploadToken");
776780
}
777781

778-
okhttp3.Call localVarCall = uploadWithUploadTokenCall(token, file, _callback);
782+
okhttp3.Call localVarCall = uploadWithUploadTokenCall(token, file, videoId, _callback);
779783
return localVarCall;
780784
}
781785

@@ -1151,7 +1155,7 @@ public void onDownloadProgress(long bytesRead, long contentLength, boolean done)
11511155
}
11521156
};
11531157

1154-
okhttp3.Call localVarCall = uploadWithUploadTokenValidateBeforeCall(token, file, apiCallback);
1158+
okhttp3.Call localVarCall = uploadWithUploadTokenValidateBeforeCall(token, file, videoId, apiCallback);
11551159
Type localVarReturnType = new TypeToken<Video>() {
11561160
}.getType();
11571161
return localVarApiClient.execute(localVarCall, localVarReturnType);

src/main/java/video/api/uploader/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", "android-uploader:1.2.3");
121+
addDefaultHeader("AV-Origin-Client", "android-uploader:1.2.4");
122122
}
123123

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

0 commit comments

Comments
 (0)