# Package com.drake.net.request

## Types

BaseRequest
Link copied to clipboard
abstract class BaseRequest
Content copied to clipboard
BodyRequest
Link copied to clipboard
open class BodyRequest : BaseRequest
Content copied to clipboard
MediaConst
Link copied to clipboard
object MediaConst
Content copied to clipboard
Method
Link copied to clipboard
enum Method : Enum<Method>
Content copied to clipboard
UrlRequest
Link copied to clipboard
open class UrlRequest : BaseRequest
Content copied to clipboard

## Functions

addDownloadListener
Link copied to clipboard
fun Request.addDownloadListener(progressListener: ProgressListener)
Content copied to clipboard
添加下载监听器
addUploadListener
Link copied to clipboard
fun Request.addUploadListener(progressListener: ProgressListener)
Content copied to clipboard
添加上传监听器
converter
Link copied to clipboard
fun Request.converter(): NetConverter
Content copied to clipboard
返回请求包含的转换器
downloadConflictRename
Link copied to clipboard
fun Request.downloadConflictRename(): Boolean
Content copied to clipboard
当指定下载目录存在同名文件是覆盖还是进行重命名, 重命名规则是: $文件名_($序号).
downloadFileDir
Link copied to clipboard
fun Request.downloadFileDir(): String
Content copied to clipboard
下载文件目录
downloadFileName
Link copied to clipboard
fun Request.downloadFileName(): String?
Content copied to clipboard
下载文件名
downloadFileNameDecode
Link copied to clipboard
fun Request.downloadFileNameDecode(): Boolean
Content copied to clipboard
下载的文件名称是否解码 例如下载的文件名如果是中文, 服务器传输给你的会是被URL编码的字符串.
downloadListeners
Link copied to clipboard
fun Request.downloadListeners(): ConcurrentLinkedQueue<ProgressListener>
Content copied to clipboard
全部的下载监听器
fun Request.Builder.downloadListeners(): ConcurrentLinkedQueue<ProgressListener>
Content copied to clipboard
全部的下载监听器
downloadMd5Verify
Link copied to clipboard
fun Request.downloadMd5Verify(): Boolean
Content copied to clipboard
是否进行校验文件md5, 如果校验则匹配上既马上返回文件而不会进行下载
downloadTempFile
Link copied to clipboard
fun Request.downloadTempFile(): Boolean
Content copied to clipboard
下载是否使用临时文件 避免下载失败后覆盖同名文件或者无法判别是否已下载完整, 仅在下载完整以后才会显示为原有文件名 临时文件命名规则: 文件名 + .net-download 下载文件名: install.apk, 临时文件名: install.apk.
group
Link copied to clipboard
fun Request.group(): Any?
Content copied to clipboard
headers
Link copied to clipboard
fun Request.Builder.headers(): Headers.Builder
Content copied to clipboard
全部的请求头
id
Link copied to clipboard
fun Request.id(): Any?
Content copied to clipboard
isLogRecord
Link copied to clipboard
fun Request.isLogRecord(): Boolean?
Content copied to clipboard
kType
Link copied to clipboard
fun Request.kType(): KType?
Content copied to clipboard
label
Link copied to clipboard
inline fun <T> Request.label(): T?
Content copied to clipboard
返回OkHttp的tag(通过Class区分的tag)
inline fun <T> Request.Builder.label(): T?
Content copied to clipboard
返回OkHttp的tag(通过Class区分的tag)
labels
Link copied to clipboard
fun Request.labels(): MutableMap<Class<*>, Any?>
Content copied to clipboard
标签集合
fun Request.Builder.labels(): MutableMap<Class<*>, Any?>
Content copied to clipboard
标签集合
logString
Link copied to clipboard
fun Request.logString(byteCount: Long = 1024 * 1024, urlDecode: Boolean = true): String?
Content copied to clipboard
请求日志信息 只会输出 application/x-www-form-urlencoded, application/json, text/`*` 的请求体类型日志
setConverter
Link copied to clipboard
fun Request.Builder.setConverter(converter: NetConverter): Request.Builder
Content copied to clipboard
设置转换器
setGroup
Link copied to clipboard
fun Request.Builder.setGroup(group: Any?): Request.Builder
Content copied to clipboard
设置请求分组
setId
Link copied to clipboard
fun Request.Builder.setId(id: Any?): Request.Builder
Content copied to clipboard
设置请求Id
setKType
Link copied to clipboard
fun Request.Builder.setKType(type: KType): Request.Builder
Content copied to clipboard
设置KType
setLabel
Link copied to clipboard
inline fun <T> Request.setLabel(value: T): Request
Content copied to clipboard
设置OkHttp的tag(通过Class区分的tag)
inline fun <T> Request.Builder.setLabel(value: T): Request.Builder
Content copied to clipboard
设置OkHttp的tag(通过Class区分的tag)
setLogRecord
Link copied to clipboard
fun Request.Builder.setLogRecord(enabled: Boolean): Request.Builder
Content copied to clipboard
设置是否记录日志
setTag
Link copied to clipboard
fun Request.setTag(name: String, value: Any?)
Content copied to clipboard
设置键值对的标签
fun Request.Builder.setTag(name: String, value: Any?): Request.Builder
Content copied to clipboard
设置键值对的tag
tag
Link copied to clipboard
fun Request.tag(name: String): Any?
Content copied to clipboard
返回键值对的标签 键值对标签即OkHttp中的实际tag(在Net中叫label)中的一个Map集合
tags
Link copied to clipboard
fun Request.tags(): HashMap<String, Any?>
Content copied to clipboard
全部键值对标签
fun Request.Builder.tags(): HashMap<String, Any?>
Content copied to clipboard
全部键值对标签
uploadListeners
Link copied to clipboard
fun Request.uploadListeners(): ConcurrentLinkedQueue<ProgressListener>
Content copied to clipboard
全部的上传监听器
fun Request.Builder.uploadListeners(): ConcurrentLinkedQueue<ProgressListener>
Content copied to clipboard
全部的上传监听器

## Properties

group
Link copied to clipboard
var Request.group: Any?
Content copied to clipboard
请求的分组名 Group和Id本质上都是任意对象Any.
id
Link copied to clipboard
var Request.id: Any?
Content copied to clipboard
请求的Id
kType
Link copied to clipboard
var Request.kType: KType?
Content copied to clipboard
KType属于Kotlin特有的Type, 某些kotlin独占框架可能会使用到.
logRecord
Link copied to clipboard
var Request.logRecord: Boolean?
Content copied to clipboard
是否输出网络请求日志 该属性和NetConfig.logEnabled有所区别