ImRetrofitApi.kt 3.61 KB
Newer Older
konghaorui committed
1 2 3 4 5 6 7
package com.yidianling.im.http

import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils
konghaorui committed
8
import com.yidianling.im.api.bean.IMExpertBuild
严久程 committed
9
import com.yidianling.im.bean.*
konghaorui committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
import io.reactivex.Observable
import retrofit2.http.*

/**
 * im相关网络接口
 * Created by hrvie on 17-11-24.
 */
interface ImRetrofitApi {

    companion object {
        var instance: ImRetrofitApi? = null

        fun getImRetrofitApi(): ImRetrofitApi {
            if (instance == null) {
                instance = YDLHttpUtils.obtainApi(ImRetrofitApi::class.java)
            }
            return instance!!
        }

        fun getImJavaApi(): ImRetrofitApi {
            return YDLHttpUtils.obtainApi(ImRetrofitApi::class.java)
        }
    }

    //私聊 获取聊天者的订单关系数据
    @FormUrlEncoded
    @POST("consult/get-expert")
    fun getExpert(@FieldMap params: Map<String, String>): Observable<BaseResponse<IMExpertBuild>>


    //获取用户的状态(用户、专家、助理)
    @GET("user/userType")
    @Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
严久程 committed
43
    fun getUserType(@Query("targetUid") uid: String): Observable<BaseResponse<UserTypeBean>>
konghaorui committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

    //根据专家uid获取私聊的目标uid(有可能是专家uid,有可能是助理uid)
    @GET("doctor/chat-user")
    @Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
    fun getChatUid(@Query("doctorUid") uid: String): Observable<BaseAPIResponse<DoctorAssistantRespDtoBean>>

    //私聊 获取聊天者的订单关系数据   -----进入聊天前调用的接口,采用新的java接口,直接php  getExpert 接口废弃
    @GET("doctor/personalChat")
    @Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
    fun getPersonalChat(@Query("doctorUid") doctorUid: String): Observable<BaseResponse<IMExpertBuild>>

    //获取举报理由
    @FormUrlEncoded
    @POST("ask/report-reason")
    fun getReportReason(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //举报心事或者心事回复(动态)
    @FormUrlEncoded
    @POST("ask/report")
    fun reportWorry(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //删除私聊记录
    @FormUrlEncoded
    @POST("consult/rm-history")
    fun rmHistory(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //加入黑名单
    @FormUrlEncoded
    @POST("consult/set-black")
    fun setBlackCall(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //从黑名单移除
    @FormUrlEncoded
    @POST("consult/rm-black")
    fun rmBlackCall(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>

    //红包详情
    @FormUrlEncoded
    @POST("uc/bonus-info")
    fun redPacketDetail(@FieldMap params: Map<String, String>): Observable<BaseResponse<RedPacketDetailBean>>

    //设置课程直播状态
    @POST("course/set-live-status")
    @FormUrlEncoded
    fun setCourseStatus(@FieldMap maps: Map<String, String>): Observable<BaseResponse<Any>>

    //获取课程直播状态
    @POST("course/get-live-status")
    @FormUrlEncoded
    fun getCourseStatus(@FieldMap maps: Map<String, String>): Observable<BaseResponse<CourseStatusBean>>

    /**
     * 私聊更多按钮 - 推荐倾诉 - by :洪平
     * @param uid
     * @param listenerUid
     * @return
     */
    @GET("chat/pushServeStatus")
    @Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
    fun getPushConfideStatus(@Query("uid") uid: String, @Query("listenerUid") listenerUid: String): Observable<BaseAPIResponse<PushConfideStatusBean>>

}