Skip to content

Commit

Permalink
Merge pull request #92 from apivideo/fix/android_upload_token_video_id
Browse files Browse the repository at this point in the history
fix(java): fix upload with upload token and video id for file smaller…
  • Loading branch information
bot-api-video authored Aug 10, 2023
2 parents a5f3113 + a82e10f commit 7f285f9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>video.api</groupId>
<artifactId>java-api-client</artifactId>
<version>1.3.0</version>
<version>1.3.1</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>java-api-client</artifactId>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<version>1.3.0</version>
<version>1.3.1</version>
<url>https://github.com/apivideo/api.video-java-client</url>
<description>api.video Java API client</description>
<scm>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/video/api/client/api/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private OkHttpClient initHttpClient(List<Interceptor> 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) {
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/video/api/client/api/clients/VideosApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ public void onDownloadProgress(long bytesRead, long contentLength, boolean done)
* </tr>
* </table>
*/
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;

Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -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<Video>() {
}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
Expand Down

0 comments on commit 7f285f9

Please sign in to comment.