// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/Param.java
// public class Param {
//     public Param(String key,String value) {
//         this.key = key;
//         this.value = value;
//     }
// 
//     public String key;
//     public String value;
// 
// 
//     @Override
//     public String toString() {
//         return key + "=" + value;
//     }
// }
// 
// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/utils/HeaderUtils.java
// public class HeaderUtils {
// 
//     public static List<Param> validateHeaders(Map<String, String> header) {
//         if (header == null || header.size() == 0)
//             return null;
//         List<Param> results = new LinkedList<>();
//         Set<Map.Entry<String, String>> entrySet = header.entrySet();
//         for (Map.Entry<String, String> entry : entrySet) {
//             Param param = new Param(entry.getKey(), entry.getValue());
//             results.add(param);
//         }
//         return results;
// 
// 
//     }
// }


import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import okhttp3.MultipartBody;
import okhttp3.Request;
import okhttp3.RequestBody;
import com.jiang.android.architecture.okhttp.Param;
import com.jiang.android.architecture.okhttp.utils.HeaderUtils;
/**
 * created by jiang, 15/10/19
 * Copyright (c) 2015, jyuesong@gmail.com All Rights Reserved.
 * *                #                                                   #
 * #                       _oo0oo_                     #
 * #                      o8888888o                    #
 * #                      88" . "88                    #
 * #                      (| -_- |)                    #
 * #                      0\  =  /0                    #
 * #                    ___/`---'\___                  #
 * #                  .' \\|     |# '.                 #
 * #                 / \\|||  :  |||# \                #
 * #                / _||||| -:- |||||- \              #
 * #               |   | \\\  -  #/ |   |              #
 * #               | \_|  ''\---/''  |_/ |             #
 * #               \  .-\__  '-'  ___/-. /             #
 * #             ___'. .'  /--.--\  `. .'___           #
 * #          ."" '<  `.___\_<|>_/___.' >' "".         #
 * #         | | :  `- \`.;`\ _ /`;.`/ - ` : | |       #
 * #         \  \ `_.   \_ __\ /__ _/   .-` /  /       #
 * #     =====`-.____`.___ \_____/___.-`___.-'=====    #
 * #                       `=---='                     #
 * #     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   #
 * #                                                   #
 * #               佛祖保佑         永无BUG              #
 * #                                                   #
 */
package com.jiang.android.architecture.okhttp.request;





/**
 * delete
 * Created by jiang on 15/10/16.
 */
public class DeleteRequest {


    public static Request buildDeleteRequest(String url, Map<String, String> params, Object tag, Map<String, String> headers) {
        if (params == null) {
            params = new HashMap<>();
        }

        Request.Builder reqBuilder = new Request.Builder();
        if (params != null && params.size() > 0) {
            MultipartBody.Builder builder = new MultipartBody.Builder()
                    .setType(MultipartBody.FORM);
            Set<Map.Entry<String, String>> entrySet = params.entrySet();
            for (Map.Entry<String, String> entry : entrySet) {
                builder.addFormDataPart(entry.getKey(), entry.getValue());
            }
            RequestBody requestBody = builder.build();
            reqBuilder.delete(requestBody);
        } else {
            reqBuilder.delete();
        }
        reqBuilder.url(url);


// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/Param.java
// public class Param {
//     public Param(String key,String value) {
//         this.key = key;
//         this.value = value;
//     }
// 
//     public String key;
//     public String value;
// 
// 
//     @Override
//     public String toString() {
//         return key + "=" + value;
//     }
// }
// 
// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/utils/HeaderUtils.java
// public class HeaderUtils {
// 
//     public static List<Param> validateHeaders(Map<String, String> header) {
//         if (header == null || header.size() == 0)
//             return null;
//         List<Param> results = new LinkedList<>();
//         Set<Map.Entry<String, String>> entrySet = header.entrySet();
//         for (Map.Entry<String, String> entry : entrySet) {
//             Param param = new Param(entry.getKey(), entry.getValue());
//             results.add(param);
//         }
//         return results;
// 
// 
//     }
// }


// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/request/DeleteRequest.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import okhttp3.MultipartBody;
import okhttp3.Request;
import okhttp3.RequestBody;
import com.jiang.android.architecture.okhttp.Param;
import com.jiang.android.architecture.okhttp.utils.HeaderUtils;

/**
 * created by jiang, 15/10/19
 * Copyright (c) 2015, jyuesong@gmail.com All Rights Reserved.
 * *                #                                                   #
 * #                       _oo0oo_                     #
 * #                      o8888888o                    #
 * #                      88" . "88                    #
 * #                      (| -_- |)                    #
 * #                      0\  =  /0                    #
 * #                    ___/`---'\___                  #
 * #                  .' \\|     |# '.                 #
 * #                 / \\|||  :  |||# \                #
 * #                / _||||| -:- |||||- \              #
 * #               |   | \\\  -  #/ |   |              #
 * #               | \_|  ''\---/''  |_/ |             #
 * #               \  .-\__  '-'  ___/-. /             #
 * #             ___'. .'  /--.--\  `. .'___           #
 * #          ."" '<  `.___\_<|>_/___.' >' "".         #
 * #         | | :  `- \`.;`\ _ /`;.`/ - ` : | |       #
 * #         \  \ `_.   \_ __\ /__ _/   .-` /  /       #
 * #     =====`-.____`.___ \_____/___.-`___.-'=====    #
 * #                       `=---='                     #
 * #     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   #
 * #                                                   #
 * #               佛祖保佑         永无BUG              #
 * #                                                   #
 */
package com.jiang.android.architecture.okhttp.request;





/**
 * delete
 * Created by jiang on 15/10/16.
 */
public class DeleteRequest {


    public static Request buildDeleteRequest(String url, Map<String, String> params, Object tag, Map<String, String> headers) {
        if (params == null) {
            params = new HashMap<>();
        }

        Request.Builder reqBuilder = new Request.Builder();
        if (params != null && params.size() > 0) {
            MultipartBody.Builder builder = new MultipartBody.Builder()
                    .setType(MultipartBody.FORM);
            Set<Map.Entry<String, String>> entrySet = params.entrySet();
            for (Map.Entry<String, String> entry : entrySet) {
                builder.addFormDataPart(entry.getKey(), entry.getValue());
            }
            RequestBody requestBody = builder.build();
            reqBuilder.delete(requestBody);
        } else {
            reqBuilder.delete();
        }
        reqBuilder.url(url);


        List<Param> valdatedHeaders = HeaderUtils.validateHeaders(headers);