Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.larksuite.oapi.service.drive.v1.DriveService Maven / Gradle / Ivy
// Code generated by lark suite oapi sdk gen
package com.larksuite.oapi.service.drive.v1;
import com.larksuite.oapi.core.api.AccessTokenType;
import com.larksuite.oapi.core.api.Api;
import com.larksuite.oapi.core.api.ReqCaller;
import com.larksuite.oapi.core.api.request.*;
import com.larksuite.oapi.core.api.response.*;
import com.larksuite.oapi.core.Config;
import com.larksuite.oapi.core.event.Event;
import com.larksuite.oapi.core.event.IHandler;
import com.larksuite.oapi.service.drive.v1.model.*;
import java.io.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class DriveService {
private final Config config;
private final Files files;
private final FileComments fileComments;
private final FileCommentReplys fileCommentReplys;
private final Medias medias;
public DriveService(Config config) {
this.config = config;
this.files = new Files(this);
this.fileComments = new FileComments(this);
this.fileCommentReplys = new FileCommentReplys(this);
this.medias = new Medias(this);
}
public Files getFiles() {
return files;
}
public static class Files {
private final DriveService service;
public Files(DriveService service) {
this.service = service;
}
public FileUploadFinishReqCall uploadFinish(FileUploadFinishReqBody body, RequestOptFn... optFns) {
return new FileUploadFinishReqCall(this, body, optFns);
}
public FileUploadPrepareReqCall uploadPrepare(UploadInfo body, RequestOptFn... optFns) {
return new FileUploadPrepareReqCall(this, body, optFns);
}
public FileUploadAllReqCall uploadAll(RequestOptFn... optFns) {
return new FileUploadAllReqCall(this, optFns);
}
public FileUploadPartReqCall uploadPart(RequestOptFn... optFns) {
return new FileUploadPartReqCall(this, optFns);
}
public FileDownloadReqCall download(RequestOptFn... optFns) {
return new FileDownloadReqCall(this, optFns);
}
public FileSubscribeReqCall subscribe(RequestOptFn... optFns) {
return new FileSubscribeReqCall(this, optFns);
}
}
public static class FileUploadFinishReqCall extends ReqCaller {
private final Files files;
private final FileUploadFinishReqBody body;
private final List optFns;
private FileUploadFinishResult result;
private FileUploadFinishReqCall(Files files, FileUploadFinishReqBody body, RequestOptFn... optFns) {
this.body = body;
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new FileUploadFinishResult();
this.files = files;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/files/upload_finish", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.files.service.config, request);
}
}
public static class FileUploadPrepareReqCall extends ReqCaller {
private final Files files;
private final UploadInfo body;
private final List optFns;
private FileUploadPrepareResult result;
private FileUploadPrepareReqCall(Files files, UploadInfo body, RequestOptFn... optFns) {
this.body = body;
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new FileUploadPrepareResult();
this.files = files;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/files/upload_prepare", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.files.service.config, request);
}
}
public static class FileUploadAllReqCall extends ReqCaller {
private final Files files;
private final FormData body;
private final List optFns;
private FileUploadAllResult result;
private FileUploadAllReqCall(Files files, RequestOptFn... optFns) {
this.body = new FormData();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new FileUploadAllResult();
this.files = files;
}
public FileUploadAllReqCall setFileName(String fileName){
this.body.addField("file_name", fileName);
return this;
}
public FileUploadAllReqCall setParentType(String parentType){
this.body.addField("parent_type", parentType);
return this;
}
public FileUploadAllReqCall setParentNode(String parentNode){
this.body.addField("parent_node", parentNode);
return this;
}
public FileUploadAllReqCall setSize(Integer size){
this.body.addField("size", size);
return this;
}
public FileUploadAllReqCall setChecksum(String checksum){
this.body.addField("checksum", checksum);
return this;
}
public FileUploadAllReqCall setFile(FormDataFile file){
this.body.addFile("file", file);
return this;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/files/upload_all", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.files.service.config, request);
}
}
public static class FileUploadPartReqCall extends ReqCaller {
private final Files files;
private final FormData body;
private final List optFns;
private EmptyData result;
private FileUploadPartReqCall(Files files, RequestOptFn... optFns) {
this.body = new FormData();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new EmptyData();
this.files = files;
}
public FileUploadPartReqCall setUploadId(String uploadId){
this.body.addField("upload_id", uploadId);
return this;
}
public FileUploadPartReqCall setSeq(Integer seq){
this.body.addField("seq", seq);
return this;
}
public FileUploadPartReqCall setSize(Integer size){
this.body.addField("size", size);
return this;
}
public FileUploadPartReqCall setChecksum(String checksum){
this.body.addField("checksum", checksum);
return this;
}
public FileUploadPartReqCall setFile(FormDataFile file){
this.body.addFile("file", file);
return this;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/files/upload_part", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.files.service.config, request);
}
}
public static class FileDownloadReqCall extends ReqCaller {
private final Files files;
private final Map pathParams;
private final List optFns;
private OutputStream result;
private FileDownloadReqCall(Files files, RequestOptFn... optFns) {
this.pathParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.files = files;
}
public FileDownloadReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileDownloadReqCall setResponseStream(OutputStream result){
this.result = result;
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setResponseStream());
Request request = Request.newRequest("drive/v1/files/:file_token/download", "GET",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.files.service.config, request);
}
}
public static class FileSubscribeReqCall extends ReqCaller {
private final Files files;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private EmptyData result;
private FileSubscribeReqCall(Files files, RequestOptFn... optFns) {
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new EmptyData();
this.files = files;
}
public FileSubscribeReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileSubscribeReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/subscribe", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.files.service.config, request);
}
}
public FileComments getFileComments() {
return fileComments;
}
public static class FileComments {
private final DriveService service;
public FileComments(DriveService service) {
this.service = service;
}
public FileCommentCreateReqCall create(FileComment body, RequestOptFn... optFns) {
return new FileCommentCreateReqCall(this, body, optFns);
}
public FileCommentGetReqCall get(RequestOptFn... optFns) {
return new FileCommentGetReqCall(this, optFns);
}
public FileCommentListReqCall list(RequestOptFn... optFns) {
return new FileCommentListReqCall(this, optFns);
}
public FileCommentPatchReqCall patch(FileCommentPatchReqBody body, RequestOptFn... optFns) {
return new FileCommentPatchReqCall(this, body, optFns);
}
}
public static class FileCommentCreateReqCall extends ReqCaller {
private final FileComments fileComments;
private final FileComment body;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private FileComment result;
private FileCommentCreateReqCall(FileComments fileComments, FileComment body, RequestOptFn... optFns) {
this.body = body;
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new FileComment();
this.fileComments = fileComments;
}
public FileCommentCreateReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileCommentCreateReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
public FileCommentCreateReqCall setUserIdType(String userIdType){
this.queryParams.put("user_id_type", userIdType);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/comments", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.fileComments.service.config, request);
}
}
public static class FileCommentGetReqCall extends ReqCaller {
private final FileComments fileComments;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private FileComment result;
private FileCommentGetReqCall(FileComments fileComments, RequestOptFn... optFns) {
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new FileComment();
this.fileComments = fileComments;
}
public FileCommentGetReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileCommentGetReqCall setCommentId(Long commentId){
this.pathParams.put("comment_id", commentId);
return this;
}
public FileCommentGetReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
public FileCommentGetReqCall setUserIdType(String userIdType){
this.queryParams.put("user_id_type", userIdType);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/comments/:comment_id", "GET",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.fileComments.service.config, request);
}
}
public static class FileCommentListReqCall extends ReqCaller {
private final FileComments fileComments;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private FileCommentListResult result;
private FileCommentListReqCall(FileComments fileComments, RequestOptFn... optFns) {
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new FileCommentListResult();
this.fileComments = fileComments;
}
public FileCommentListReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileCommentListReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
public FileCommentListReqCall setUserIdType(String userIdType){
this.queryParams.put("user_id_type", userIdType);
return this;
}
public FileCommentListReqCall setIsSolved(Boolean isSolved){
this.queryParams.put("is_solved", isSolved);
return this;
}
public FileCommentListReqCall setPageToken(String pageToken){
this.queryParams.put("page_token", pageToken);
return this;
}
public FileCommentListReqCall setPageSize(Integer pageSize){
this.queryParams.put("page_size", pageSize);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/comments", "GET",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.fileComments.service.config, request);
}
}
public static class FileCommentPatchReqCall extends ReqCaller {
private final FileComments fileComments;
private final FileCommentPatchReqBody body;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private EmptyData result;
private FileCommentPatchReqCall(FileComments fileComments, FileCommentPatchReqBody body, RequestOptFn... optFns) {
this.body = body;
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new EmptyData();
this.fileComments = fileComments;
}
public FileCommentPatchReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileCommentPatchReqCall setCommentId(Long commentId){
this.pathParams.put("comment_id", commentId);
return this;
}
public FileCommentPatchReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/comments/:comment_id", "PATCH",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.fileComments.service.config, request);
}
}
public FileCommentReplys getFileCommentReplys() {
return fileCommentReplys;
}
public static class FileCommentReplys {
private final DriveService service;
public FileCommentReplys(DriveService service) {
this.service = service;
}
public FileCommentReplyUpdateReqCall update(FileCommentReplyUpdateReqBody body, RequestOptFn... optFns) {
return new FileCommentReplyUpdateReqCall(this, body, optFns);
}
public FileCommentReplyDeleteReqCall delete(RequestOptFn... optFns) {
return new FileCommentReplyDeleteReqCall(this, optFns);
}
public FileCommentReplyCreateReqCall create(FileCommentReplyCreateReqBody body, RequestOptFn... optFns) {
return new FileCommentReplyCreateReqCall(this, body, optFns);
}
}
public static class FileCommentReplyUpdateReqCall extends ReqCaller {
private final FileCommentReplys fileCommentReplys;
private final FileCommentReplyUpdateReqBody body;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private EmptyData result;
private FileCommentReplyUpdateReqCall(FileCommentReplys fileCommentReplys, FileCommentReplyUpdateReqBody body, RequestOptFn... optFns) {
this.body = body;
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new EmptyData();
this.fileCommentReplys = fileCommentReplys;
}
public FileCommentReplyUpdateReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileCommentReplyUpdateReqCall setCommentId(Long commentId){
this.pathParams.put("comment_id", commentId);
return this;
}
public FileCommentReplyUpdateReqCall setReplyId(Long replyId){
this.pathParams.put("reply_id", replyId);
return this;
}
public FileCommentReplyUpdateReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
public FileCommentReplyUpdateReqCall setUserIdType(String userIdType){
this.queryParams.put("user_id_type", userIdType);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/comments/:comment_id/replies/:reply_id", "PUT",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.fileCommentReplys.service.config, request);
}
}
public static class FileCommentReplyDeleteReqCall extends ReqCaller {
private final FileCommentReplys fileCommentReplys;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private EmptyData result;
private FileCommentReplyDeleteReqCall(FileCommentReplys fileCommentReplys, RequestOptFn... optFns) {
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new EmptyData();
this.fileCommentReplys = fileCommentReplys;
}
public FileCommentReplyDeleteReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileCommentReplyDeleteReqCall setCommentId(Long commentId){
this.pathParams.put("comment_id", commentId);
return this;
}
public FileCommentReplyDeleteReqCall setReplyId(Long replyId){
this.pathParams.put("reply_id", replyId);
return this;
}
public FileCommentReplyDeleteReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/comments/:comment_id/replies/:reply_id", "DELETE",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.fileCommentReplys.service.config, request);
}
}
public static class FileCommentReplyCreateReqCall extends ReqCaller {
private final FileCommentReplys fileCommentReplys;
private final FileCommentReplyCreateReqBody body;
private final Map pathParams;
private final Map queryParams;
private final List optFns;
private FileCommentReplyCreateResult result;
private FileCommentReplyCreateReqCall(FileCommentReplys fileCommentReplys, FileCommentReplyCreateReqBody body, RequestOptFn... optFns) {
this.body = body;
this.pathParams = new HashMap<>();
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new FileCommentReplyCreateResult();
this.fileCommentReplys = fileCommentReplys;
}
public FileCommentReplyCreateReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public FileCommentReplyCreateReqCall setCommentId(Long commentId){
this.pathParams.put("comment_id", commentId);
return this;
}
public FileCommentReplyCreateReqCall setFileType(String fileType){
this.queryParams.put("file_type", fileType);
return this;
}
public FileCommentReplyCreateReqCall setUserIdType(String userIdType){
this.queryParams.put("user_id_type", userIdType);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/files/:file_token/comments/:comment_id/replies", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.fileCommentReplys.service.config, request);
}
}
public Medias getMedias() {
return medias;
}
public static class Medias {
private final DriveService service;
public Medias(DriveService service) {
this.service = service;
}
public MediaUploadPartReqCall uploadPart(RequestOptFn... optFns) {
return new MediaUploadPartReqCall(this, optFns);
}
public MediaUploadAllReqCall uploadAll(RequestOptFn... optFns) {
return new MediaUploadAllReqCall(this, optFns);
}
public MediaUploadFinishReqCall uploadFinish(MediaUploadFinishReqBody body, RequestOptFn... optFns) {
return new MediaUploadFinishReqCall(this, body, optFns);
}
public MediaUploadPrepareReqCall uploadPrepare(UploadInfo body, RequestOptFn... optFns) {
return new MediaUploadPrepareReqCall(this, body, optFns);
}
public MediaBatchGetTmpDownloadUrlReqCall batchGetTmpDownloadUrl(RequestOptFn... optFns) {
return new MediaBatchGetTmpDownloadUrlReqCall(this, optFns);
}
public MediaDownloadReqCall download(RequestOptFn... optFns) {
return new MediaDownloadReqCall(this, optFns);
}
}
public static class MediaUploadPartReqCall extends ReqCaller {
private final Medias medias;
private final FormData body;
private final List optFns;
private EmptyData result;
private MediaUploadPartReqCall(Medias medias, RequestOptFn... optFns) {
this.body = new FormData();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new EmptyData();
this.medias = medias;
}
public MediaUploadPartReqCall setUploadId(String uploadId){
this.body.addField("upload_id", uploadId);
return this;
}
public MediaUploadPartReqCall setSeq(Integer seq){
this.body.addField("seq", seq);
return this;
}
public MediaUploadPartReqCall setSize(Integer size){
this.body.addField("size", size);
return this;
}
public MediaUploadPartReqCall setChecksum(String checksum){
this.body.addField("checksum", checksum);
return this;
}
public MediaUploadPartReqCall setFile(FormDataFile file){
this.body.addFile("file", file);
return this;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/medias/upload_part", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.medias.service.config, request);
}
}
public static class MediaUploadAllReqCall extends ReqCaller {
private final Medias medias;
private final FormData body;
private final List optFns;
private MediaUploadAllResult result;
private MediaUploadAllReqCall(Medias medias, RequestOptFn... optFns) {
this.body = new FormData();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new MediaUploadAllResult();
this.medias = medias;
}
public MediaUploadAllReqCall setFileName(String fileName){
this.body.addField("file_name", fileName);
return this;
}
public MediaUploadAllReqCall setParentType(String parentType){
this.body.addField("parent_type", parentType);
return this;
}
public MediaUploadAllReqCall setParentNode(String parentNode){
this.body.addField("parent_node", parentNode);
return this;
}
public MediaUploadAllReqCall setSize(Integer size){
this.body.addField("size", size);
return this;
}
public MediaUploadAllReqCall setChecksum(String checksum){
this.body.addField("checksum", checksum);
return this;
}
public MediaUploadAllReqCall setFile(FormDataFile file){
this.body.addFile("file", file);
return this;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/medias/upload_all", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.medias.service.config, request);
}
}
public static class MediaUploadFinishReqCall extends ReqCaller {
private final Medias medias;
private final MediaUploadFinishReqBody body;
private final List optFns;
private MediaUploadFinishResult result;
private MediaUploadFinishReqCall(Medias medias, MediaUploadFinishReqBody body, RequestOptFn... optFns) {
this.body = body;
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new MediaUploadFinishResult();
this.medias = medias;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/medias/upload_finish", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.medias.service.config, request);
}
}
public static class MediaUploadPrepareReqCall extends ReqCaller {
private final Medias medias;
private final UploadInfo body;
private final List optFns;
private MediaUploadPrepareResult result;
private MediaUploadPrepareReqCall(Medias medias, UploadInfo body, RequestOptFn... optFns) {
this.body = body;
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new MediaUploadPrepareResult();
this.medias = medias;
}
@Override
public Response execute() throws Exception {
Request request = Request.newRequest("drive/v1/medias/upload_prepare", "POST",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.medias.service.config, request);
}
}
public static class MediaBatchGetTmpDownloadUrlReqCall extends ReqCaller {
private final Medias medias;
private final Map queryParams;
private final List optFns;
private MediaBatchGetTmpDownloadUrlResult result;
private MediaBatchGetTmpDownloadUrlReqCall(Medias medias, RequestOptFn... optFns) {
this.queryParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.result = new MediaBatchGetTmpDownloadUrlResult();
this.medias = medias;
}
public MediaBatchGetTmpDownloadUrlReqCall setFileTokens(String... fileTokens){
this.queryParams.put("file_tokens", fileTokens);
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setQueryParams(this.queryParams));
Request request = Request.newRequest("drive/v1/medias/batch_get_tmp_download_url", "GET",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.medias.service.config, request);
}
}
public static class MediaDownloadReqCall extends ReqCaller {
private final Medias medias;
private final Map pathParams;
private final List optFns;
private OutputStream result;
private MediaDownloadReqCall(Medias medias, RequestOptFn... optFns) {
this.pathParams = new HashMap<>();
this.optFns = new ArrayList<>();
this.optFns.addAll(Arrays.asList(optFns));
this.medias = medias;
}
public MediaDownloadReqCall setFileToken(String fileToken){
this.pathParams.put("file_token", fileToken);
return this;
}
public MediaDownloadReqCall setResponseStream(OutputStream result){
this.result = result;
return this;
}
@Override
public Response execute() throws Exception {
this.optFns.add(Request.setPathParams(this.pathParams));
this.optFns.add(Request.setResponseStream());
Request request = Request.newRequest("drive/v1/medias/:file_token/download", "GET",
new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
return Api.send(this.medias.service.config, request);
}
}
public void setFileDeletedEventHandler(FileDeletedEventHandler handler) {
Event.setTypeHandler(this.config, "drive.file.deleted_v1", handler);
}
public abstract static class FileDeletedEventHandler implements IHandler {
@Override
public FileDeletedEvent getEvent() {
return new FileDeletedEvent();
}
}
public void setFilePermissionMemberAddedEventHandler(FilePermissionMemberAddedEventHandler handler) {
Event.setTypeHandler(this.config, "drive.file.permission_member_added_v1", handler);
}
public abstract static class FilePermissionMemberAddedEventHandler implements IHandler {
@Override
public FilePermissionMemberAddedEvent getEvent() {
return new FilePermissionMemberAddedEvent();
}
}
public void setFilePermissionMemberRemovedEventHandler(FilePermissionMemberRemovedEventHandler handler) {
Event.setTypeHandler(this.config, "drive.file.permission_member_removed_v1", handler);
}
public abstract static class FilePermissionMemberRemovedEventHandler implements IHandler {
@Override
public FilePermissionMemberRemovedEvent getEvent() {
return new FilePermissionMemberRemovedEvent();
}
}
public void setFileReadEventHandler(FileReadEventHandler handler) {
Event.setTypeHandler(this.config, "drive.file.read_v1", handler);
}
public abstract static class FileReadEventHandler implements IHandler {
@Override
public FileReadEvent getEvent() {
return new FileReadEvent();
}
}
public void setFileTitleUpdatedEventHandler(FileTitleUpdatedEventHandler handler) {
Event.setTypeHandler(this.config, "drive.file.title_updated_v1", handler);
}
public abstract static class FileTitleUpdatedEventHandler implements IHandler {
@Override
public FileTitleUpdatedEvent getEvent() {
return new FileTitleUpdatedEvent();
}
}
public void setFileTrashedEventHandler(FileTrashedEventHandler handler) {
Event.setTypeHandler(this.config, "drive.file.trashed_v1", handler);
}
public abstract static class FileTrashedEventHandler implements IHandler {
@Override
public FileTrashedEvent getEvent() {
return new FileTrashedEvent();
}
}
}