package com.yidian.yac.newscontent.template

import com.yidian.common.http.HttpResult
import com.yidian.common.utils.FileDownloadUtil
import com.yidian.common.utils.UploadFileUtils
import com.yidian.yac.newscontent.http.ApiService
import com.yidian.yac.newscontent.http.httpbean.AppInitBean
import com.yidian.yac.newscontent.http.httpbean.IUploadFileCallback
import java.io.File

/**
 * Author: hy
 * Date: 4/29/21
 * Description:
 */
class HttpTemplate {
    companion object{

        fun request(){
            ApiService.appInit(AppInitBean.Request("build;version;user;navi;counts;itemsnew;resnew;task", "{}", "0"))
        }

        fun download(){
            FileDownloadUtil.instance.startDownload("http://pkg.appresource.net/version/1564/app1564343/2.92010/app1564343.apk?v=2.92010")
        }

        fun upload(){
            val requestBody = UploadFileUtils.fileToMultipartBodyPart("profile", File("path"))
            ApiService.uploadFile(object : IUploadFileCallback{
                override fun uploadFileCallBack(t: HttpResult<Any?>?) {
                }
            }, requestBody)
        }
    }
}