All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.larksuite.oapi.service.doc.v2.DocService Maven / Gradle / Ivy

Go to download

Larksuite open platform facilitates the integration of enterprise applications and larksuite, making collaboration and management more efficient

There is a newer version: 1.0.18-rc8
Show newest version
// Code generated by lark suite oapi sdk gen
package com.larksuite.oapi.service.doc.v2;

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.service.doc.v2.model.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

public class DocService {

    private final Config config;
    private final Docs docs;

    public DocService(Config config) {
        this.config = config;
        this.docs = new Docs(this);
    }

    public Docs getDocs() {
        return docs;
    }

    public static class Docs {

        private final DocService service;

        public Docs(DocService service) {
            this.service = service;
        }
    
        public DocBatchUpdateReqCall batchUpdate(DocBatchUpdateReqBody body, RequestOptFn... optFns) {
            return new DocBatchUpdateReqCall(this, body, optFns);
        }
    
        public DocContentReqCall content(RequestOptFn... optFns) {
            return new DocContentReqCall(this, optFns);
        }
    
        public DocCreateReqCall create(DocCreateReqBody body, RequestOptFn... optFns) {
            return new DocCreateReqCall(this, body, optFns);
        }
    
        public DocMetaReqCall meta(RequestOptFn... optFns) {
            return new DocMetaReqCall(this, optFns);
        }
    
        public DocRawContentReqCall rawContent(RequestOptFn... optFns) {
            return new DocRawContentReqCall(this, optFns);
        }
    
    }
    public static class DocBatchUpdateReqCall extends ReqCaller {
        private final Docs docs;
        
        private final DocBatchUpdateReqBody body;
        private final Map pathParams;
        private final List optFns;
        private EmptyData result;
        
        private DocBatchUpdateReqCall(Docs docs, DocBatchUpdateReqBody body, RequestOptFn... optFns) {
        
            this.body = body;
            this.pathParams = new HashMap<>();
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new EmptyData();
            this.docs = docs;
        }
        
        public DocBatchUpdateReqCall setDocToken(String docToken){
            this.pathParams.put("docToken", docToken);
            return this;
        }

        @Override
        public Response execute() throws Exception {
            this.optFns.add(Request.setPathParams(this.pathParams));
            Request request = Request.newRequest("doc/v2/:docToken/batch_update", "POST",
                    new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
                    this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.docs.service.config, request);
        }
    }
    public static class DocContentReqCall extends ReqCaller {
        private final Docs docs;
        
        private final Map pathParams;
        private final List optFns;
        private DocContentResult result;
        
        private DocContentReqCall(Docs docs, RequestOptFn... optFns) {
        
            this.pathParams = new HashMap<>();
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new DocContentResult();
            this.docs = docs;
        }
        
        public DocContentReqCall setDocToken(String docToken){
            this.pathParams.put("docToken", docToken);
            return this;
        }

        @Override
        public Response execute() throws Exception {
            this.optFns.add(Request.setPathParams(this.pathParams));
            Request request = Request.newRequest("doc/v2/:docToken/content", "GET",
                    new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
                    null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.docs.service.config, request);
        }
    }
    public static class DocCreateReqCall extends ReqCaller {
        private final Docs docs;
        
        private final DocCreateReqBody body;
        private final List optFns;
        private DocCreateResult result;
        
        private DocCreateReqCall(Docs docs, DocCreateReqBody body, RequestOptFn... optFns) {
        
            this.body = body;
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new DocCreateResult();
            this.docs = docs;
        }
        

        @Override
        public Response execute() throws Exception {
            Request request = Request.newRequest("doc/v2/create", "POST",
                    new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
                    this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.docs.service.config, request);
        }
    }
    public static class DocMetaReqCall extends ReqCaller {
        private final Docs docs;
        
        private final Map pathParams;
        private final List optFns;
        private DocMetaResult result;
        
        private DocMetaReqCall(Docs docs, RequestOptFn... optFns) {
        
            this.pathParams = new HashMap<>();
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new DocMetaResult();
            this.docs = docs;
        }
        
        public DocMetaReqCall setDocToken(String docToken){
            this.pathParams.put("docToken", docToken);
            return this;
        }

        @Override
        public Response execute() throws Exception {
            this.optFns.add(Request.setPathParams(this.pathParams));
            Request request = Request.newRequest("doc/v2/meta/:docToken", "GET",
                    new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
                    null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.docs.service.config, request);
        }
    }
    public static class DocRawContentReqCall extends ReqCaller {
        private final Docs docs;
        
        private final Map pathParams;
        private final List optFns;
        private DocRawContentResult result;
        
        private DocRawContentReqCall(Docs docs, RequestOptFn... optFns) {
        
            this.pathParams = new HashMap<>();
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new DocRawContentResult();
            this.docs = docs;
        }
        
        public DocRawContentReqCall setDocToken(String docToken){
            this.pathParams.put("docToken", docToken);
            return this;
        }

        @Override
        public Response execute() throws Exception {
            this.optFns.add(Request.setPathParams(this.pathParams));
            Request request = Request.newRequest("doc/v2/:docToken/raw_content", "GET",
                    new AccessTokenType[]{AccessTokenType.User, AccessTokenType.Tenant},
                    null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.docs.service.config, request);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy