Skip to content

Commit

Permalink
docs(java): add async and withHttpInfo methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee authored Apr 22, 2024
1 parent d850558 commit 3f3ea8d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 21 deletions.
6 changes: 4 additions & 2 deletions docs/AdvancedAuthenticationApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Method | HTTP request | Description
<a name="authenticate"></a>
# **authenticate**
> AccessToken authenticate(authenticatePayload)
> okhttp3.Call authenticateAsync(authenticatePayload, callback)
> ApiResponse<AccessToken> authenticateWithHttpInfo(authenticatePayload)
Get Bearer Token

Returns a bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
Expand Down Expand Up @@ -77,7 +78,8 @@ No authorization required
<a name="refresh"></a>
# **refresh**
> AccessToken refresh(refreshTokenPayload)
> okhttp3.Call refreshAsync(refreshTokenPayload, callback)
> ApiResponse<AccessToken> refreshWithHttpInfo(refreshTokenPayload)
Refresh Bearer Token

Accepts the old bearer token and returns a new bearer token that can be used to authenticate other endpoint. You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
Expand Down
6 changes: 4 additions & 2 deletions docs/VideosApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Method | HTTP request | Description
<a name="upload"></a>
# **upload**
> Video upload(videoId, file)
> okhttp3.Call uploadAsync(videoId, file, callback)
> ApiResponse<Video> uploadWithHttpInfo(videoId, file)
Upload a video

To upload a video to the videoId you created. You can only upload your video to the videoId once.
Expand Down Expand Up @@ -124,7 +125,8 @@ Video result = session.uploadLastPart(new File("sample.mp4.partn"));
<a name="uploadWithUploadToken"></a>
# **uploadWithUploadToken**
> Video uploadWithUploadToken(token, file)
> okhttp3.Call uploadWithUploadTokenAsync(token, file, callback)
> ApiResponse<Video> uploadWithUploadTokenWithHttpInfo(token, file)
Upload with an delegated upload token

This method allows you to send a video using an upload token. Upload tokens are especially useful when the upload is done from the client side. If you want to upload a video from your server-side application, you'd better use the [standard upload method](#upload).
Expand Down
28 changes: 21 additions & 7 deletions src/main/java/video/api/uploader/VideosApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ public ApiResponse<Video> uploadWithHttpInfo(String videoId, File file) throws A
return uploadWithHttpInfo(videoId, file, null);
}

public ApiResponse<Video> uploadPartWithHttpInfo(String videoId, File file, Integer part, boolean isLast,
private ApiResponse<Video> uploadPartWithHttpInfoInternal(String videoId, File file, Integer part, boolean isLast,
UploadPartProgressListener uploadProgressListener) throws ApiException {
long fileSize = file.length();
okhttp3.Call localVarCall = uploadChunkValidateBeforeCall(videoId, file, 0, fileSize, fileSize,
Expand Down Expand Up @@ -619,10 +619,17 @@ public Video uploadLastPart(File part, Integer partId, UploadPartProgressListene
@Override
public Video uploadPart(File part, Integer partId, boolean isLastPart,
UploadPartProgressListener uploadProgressListener) throws ApiException {
ApiResponse<Video> localVarResp = uploadPartWithHttpInfo(this.videoId, part, partId, isLastPart,
ApiResponse<Video> localVarResp = uploadPartWithHttpInfo(part, partId, isLastPart, uploadProgressListener);
return localVarResp.getData();
}

@Override
public ApiResponse<Video> uploadPartWithHttpInfo(File part, Integer partId, boolean isLastPart,
UploadPartProgressListener uploadProgressListener) throws ApiException {
ApiResponse<Video> localVarResp = uploadPartWithHttpInfoInternal(this.videoId, part, partId, isLastPart,
uploadProgressListener);

return localVarResp.getData();
return localVarResp;
}
}

Expand Down Expand Up @@ -1202,7 +1209,7 @@ public ApiResponse<Video> uploadWithUploadTokenWithHttpInfo(String token, File f
return uploadWithUploadTokenWithHttpInfo(token, file, null, null);
}

public ApiResponse<Video> uploadWithUploadTokenPartWithHttpInfo(String token, File file, String videoId,
private ApiResponse<Video> uploadWithUploadTokenPartWithHttpInfoInternal(String token, File file, String videoId,
Integer part, boolean isLast, UploadPartProgressListener uploadProgressListener) throws ApiException {
long fileSize = file.length();
okhttp3.Call localVarCall = uploadWithUploadTokenChunkValidateBeforeCall(token, file, videoId, 0, fileSize,
Expand Down Expand Up @@ -1278,12 +1285,19 @@ public Video uploadLastPart(File part, Integer partId, UploadPartProgressListene
@Override
public Video uploadPart(File part, Integer partId, boolean isLastPart,
UploadPartProgressListener uploadProgressListener) throws ApiException {
ApiResponse<Video> localVarResp = uploadWithUploadTokenPartWithHttpInfo(this.token, part, this.videoId,
partId, isLastPart, uploadProgressListener);
ApiResponse<Video> localVarResp = uploadPartWithHttpInfo(part, partId, isLastPart, uploadProgressListener);
return localVarResp.getData();
}

@Override
public ApiResponse<Video> uploadPartWithHttpInfo(File part, Integer partId, boolean isLastPart,
UploadPartProgressListener uploadProgressListener) throws ApiException {
ApiResponse<Video> localVarResp = uploadWithUploadTokenPartWithHttpInfoInternal(this.token, part,
this.videoId, partId, isLastPart, uploadProgressListener);
if (this.videoId == null) {
this.videoId = localVarResp.getData().getVideoId();
}
return localVarResp.getData();
return localVarResp;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
package video.api.uploader.api.upload;

import video.api.uploader.api.ApiException;
import video.api.uploader.api.ApiResponse;
import video.api.uploader.api.models.Video;

import java.io.File;

public interface IProgressiveUploadSession {
public String getVideoId();
String getVideoId();

public String getToken();
String getToken();

public Video uploadPart(File part) throws ApiException;
Video uploadPart(File part) throws ApiException;

public Video uploadLastPart(File part) throws ApiException;
Video uploadLastPart(File part) throws ApiException;

public Video uploadPart(File part, UploadPartProgressListener uploadProgressListener) throws ApiException;
Video uploadPart(File part, UploadPartProgressListener uploadProgressListener) throws ApiException;

public Video uploadLastPart(File part, UploadPartProgressListener uploadProgressListener) throws ApiException;
Video uploadLastPart(File part, UploadPartProgressListener uploadProgressListener) throws ApiException;

public Video uploadPart(File part, boolean isLastPart, UploadPartProgressListener uploadProgressListener)
Video uploadPart(File part, boolean isLastPart, UploadPartProgressListener uploadProgressListener)
throws ApiException;

public Video uploadPart(File part, Integer partId, UploadPartProgressListener uploadProgressListener)
Video uploadPart(File part, Integer partId, UploadPartProgressListener uploadProgressListener) throws ApiException;

Video uploadLastPart(File part, Integer partId, UploadPartProgressListener uploadProgressListener)
throws ApiException;

public Video uploadLastPart(File part, Integer partId, UploadPartProgressListener uploadProgressListener)
Video uploadPart(File part, Integer partId, boolean isLastPart, UploadPartProgressListener uploadProgressListener)
throws ApiException;

public Video uploadPart(File part, Integer partId, boolean isLastPart,
ApiResponse<Video> uploadPartWithHttpInfo(File part, Integer partId, boolean isLastPart,
UploadPartProgressListener uploadProgressListener) throws ApiException;
}

0 comments on commit 3f3ea8d

Please sign in to comment.