package com.zhaohaoting.framework.requset;

import com.zhaohaoting.framework.abs.entity.ResultEntity;

import java.util.List;
import java.util.Map;

import io.reactivex.Flowable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

/**
 * 获取网络
 */
public interface HttpMethod {

    @FormUrlEncoded
    @POST
    Flowable<ResponseBody> post(@Url String url, @FieldMap Map<String, Object> params);

    /**
     * 用于body里传json
     */
    @POST
    Flowable<ResponseBody> post(@Url String url, @Body RequestBody body);

    /**
     * 用于body里传json
     */
    @POST
    Flowable<ResponseBody> post(@Url String url, @Body RequestBody data, @QueryMap Map<String, String> params);

    /**
     * get
     *
     * @return
     */
    @GET
    Flowable<ResponseBody> get(@Url String url, @QueryMap Map<String, String> params);

    /**
     * get
     *
     * @return
     */
    @GET
    Flowable<ResponseBody> get(@Url String url);


    /**
     * delete
     *
     * @return
     */
    @DELETE
    Flowable<ResponseBody> delete(@Url String url, @QueryMap Map<String, String> params);


    @FormUrlEncoded
    @PUT
    Flowable<ResponseBody> put(@Url String url, @FieldMap Map<String, String> params);

    @Multipart
    @POST
    Flowable<ResultEntity<String>> uploadFile(@Url String url, @Part List<MultipartBody.Part> bodys);
}


