package com.ydl.ydlnet.builder.api

import com.google.gson.Gson
import com.ydl.ydlnet.YDLHttpUtils.Companion.obtainApi
import com.ydl.ydlnet.builder.bean.ApiErrorActionBean
import com.ydl.ydlnet.builder.bean.BaseAPIResponse
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody

/**
 * Created by Ykai on 2021/3/15.
 */
class ApiUtil{

    companion object {
        /**
         * 行为数据埋点统计
         */
        fun actionDataCount(actionDataParams: ApiErrorActionBean): Observable<BaseAPIResponse<String>> {
            val body = RequestBody.create(
                MediaType.parse("application/json; charset=utf-8"),
                Gson().toJson(actionDataParams)
            )
            return obtainApi(NetApi::class.java).actionDataCount(body)
        }
    }
}