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

cn.lnkdoc.sdk.uia.instance.bccastle.request.RefreshTokenRequest.kt Maven / Gradle / Ivy

The newest version!
package cn.lnkdoc.sdk.uia.instance.bccastle.request

import cn.lnkdoc.sdk.uia.common.HttpMethod
import cn.lnkdoc.sdk.uia.common.exception.UiaException
import cn.lnkdoc.sdk.uia.common.property.IUiaProperty
import cn.lnkdoc.sdk.uia.common.request.AbstractUiaRequest
import cn.lnkdoc.sdk.uia.common.request.IUiaRequest
import cn.lnkdoc.sdk.uia.common.util.Assert.required
import cn.lnkdoc.sdk.uia.instance.bccastle.property.BccastleProperty

/**
 * @author langkye
 * @since 1.0.0.RELEASE
 */
@Suppress("Unchecked_cast", "unused")
class RefreshTokenRequest : AbstractUiaRequest(), IUiaRequest {
    /**
     * body
     */
    var body: String? = null

    /**
     * request body
     *
     * @return request body
     */
    override fun  body(): T {
        return body!! as T
    }

    /**
     * url
     *
     * @param property property
     * @return request url
     */
    override fun url(property: IUiaProperty): String {
        val varProperty = property as BccastleProperty
        required(property, "统一认证配置不能为空")
        return try {
            (varProperty.domain
                    + varProperty.accessTokenPath)
        } catch (e: Exception) {
            throw UiaException(e)
        }
    }

    /**
     * request method
     *
     * @return request method
     */
    override fun method(): HttpMethod {
        return HttpMethod.POST
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy