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

cn.lnkdoc.sdk.uia.instance.gitlab.GitlabSdkInstance.kt Maven / Gradle / Ivy

The newest version!
package cn.lnkdoc.sdk.uia.instance.gitlab

import cn.lnkdoc.sdk.uia.common.request.IUiaRequest
import cn.lnkdoc.sdk.uia.common.response.UiaResponse
import cn.lnkdoc.sdk.uia.instance.AbstractInstance
import cn.lnkdoc.sdk.uia.instance.ISdkInstance
import cn.lnkdoc.sdk.uia.instance.gitlab.client.GitlabUiaClient
import cn.lnkdoc.sdk.uia.instance.gitlab.property.GitlabProperty
import cn.lnkdoc.sdk.uia.instance.gitlab.request.AccessTokenRequest

/**
 * @author langkye
 * @since 1.0.0.RELEASE
 */
@Suppress("Unchecked_cast")
class GitlabSdkInstance(property: GitlabProperty) : AbstractInstance(), ISdkInstance {
    /**
     * constructor
     */
    init {
        client = GitlabUiaClient.getInstance(property)
    }

    /**
     * get accessToken
     *
     * @param r code
     * @return accessToken
     */
    override fun  getAccessToken(r: R): UiaResponse {
        return client.execute((r as AccessTokenRequest)) as UiaResponse
    }

    /**
     * get UserInfo
     *
     * @param accessToken accessToken
     * @return UserInfo
     */
    override fun  getUserInfo(accessToken: R): UiaResponse {
        return client.execute((accessToken as IUiaRequest)) as UiaResponse
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy