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

com.larksuite.oapi.service.authen.v1.AuthenService 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.authen.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.service.authen.v1.model.*;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

public class AuthenService {

    private final Config config;
    private final Authens authens;

    public AuthenService(Config config) {
        this.config = config;
        this.authens = new Authens(this);
    }

    public Authens getAuthens() {
        return authens;
    }

    public static class Authens {

        private final AuthenService service;

        public Authens(AuthenService service) {
            this.service = service;
        }
    
        public AuthenAccessTokenReqCall accessToken(AuthenAccessTokenReqBody body, RequestOptFn... optFns) {
            return new AuthenAccessTokenReqCall(this, body, optFns);
        }
    
        public AuthenRefreshAccessTokenReqCall refreshAccessToken(AuthenRefreshAccessTokenReqBody body, RequestOptFn... optFns) {
            return new AuthenRefreshAccessTokenReqCall(this, body, optFns);
        }
    
        public AuthenUserInfoReqCall userInfo(RequestOptFn... optFns) {
            return new AuthenUserInfoReqCall(this, optFns);
        }
    
    }
    public static class AuthenAccessTokenReqCall extends ReqCaller {
        private final Authens authens;
        
        private final AuthenAccessTokenReqBody body;
        private final List optFns;
        private UserAccessTokenInfo result;
        
        private AuthenAccessTokenReqCall(Authens authens, AuthenAccessTokenReqBody body, RequestOptFn... optFns) {
        
            this.body = body;
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new UserAccessTokenInfo();
            this.authens = authens;
        }
        

        @Override
        public Response execute() throws Exception {
            Request request = Request.newRequest("authen/v1/access_token", "POST",
                    new AccessTokenType[]{AccessTokenType.App},
                    this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.authens.service.config, request);
        }
    }
    public static class AuthenRefreshAccessTokenReqCall extends ReqCaller {
        private final Authens authens;
        
        private final AuthenRefreshAccessTokenReqBody body;
        private final List optFns;
        private UserAccessTokenInfo result;
        
        private AuthenRefreshAccessTokenReqCall(Authens authens, AuthenRefreshAccessTokenReqBody body, RequestOptFn... optFns) {
        
            this.body = body;
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new UserAccessTokenInfo();
            this.authens = authens;
        }
        

        @Override
        public Response execute() throws Exception {
            Request request = Request.newRequest("authen/v1/refresh_access_token", "POST",
                    new AccessTokenType[]{AccessTokenType.App},
                    this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.authens.service.config, request);
        }
    }
    public static class AuthenUserInfoReqCall extends ReqCaller {
        private final Authens authens;
        
        private final List optFns;
        private UserInfo result;
        
        private AuthenUserInfoReqCall(Authens authens, RequestOptFn... optFns) {
        
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new UserInfo();
            this.authens = authens;
        }
        

        @Override
        public Response execute() throws Exception {
            Request request = Request.newRequest("authen/v1/user_info", "GET",
                    new AccessTokenType[]{AccessTokenType.User},
                    null, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.authens.service.config, request);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy