// Path: src/main/java/com/github/vaibhavsinha/kong/api/plugin/authentication/HmacAuthService.java
// public interface HmacAuthService {
//     void addCredentials(String consumerIdOrUsername, String username, String secret);
// }
// 
// Path: src/main/java/com/github/vaibhavsinha/kong/exception/KongClientException.java
// public class KongClientException extends RuntimeException {
// 
//     private int code;
// 
//     private String error;
// 
//     public KongClientException(String message) {
//         super(message);
//     }
// 
//     public KongClientException(String message, int code, String error) {
//         super(message);
//         this.code = code;
//         this.error = error;
//     }
// 
//     public int getCode() {
//         return code;
//     }
// 
//     public String getError() {
//         return error;
//     }
// }


import com.github.vaibhavsinha.kong.api.plugin.authentication.HmacAuthService;
import com.github.vaibhavsinha.kong.exception.KongClientException;
import com.github.vaibhavsinha.kong.internal.plugin.authentication.RetrofitHmacAuthService;
import com.github.vaibhavsinha.kong.model.plugin.authentication.hmac.HmacAuthCredential;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import java.io.IOException;
package com.github.vaibhavsinha.kong.impl.service.plugin.authentication;



/**
 * Created by vaibhav on 15/06/17.
 *
 * Updated by fanhua on 2017-08-07.
 */
public class HmacAuthServiceImpl implements HmacAuthService {

    private RetrofitHmacAuthService retrofitHmacAuthService;

    public HmacAuthServiceImpl(RetrofitHmacAuthService retrofitHmacAuthService) {
        this.retrofitHmacAuthService = retrofitHmacAuthService;
    }

    @Override
    public void addCredentials(String consumerIdOrUsername, String username, String secret) {
        try {
            retrofitHmacAuthService.addCredentials(consumerIdOrUsername, new HmacAuthCredential(username, secret)).execute();
        } catch (IOException e) {
// Path: src/main/java/com/github/vaibhavsinha/kong/api/plugin/authentication/HmacAuthService.java
// public interface HmacAuthService {
//     void addCredentials(String consumerIdOrUsername, String username, String secret);
// }
// 
// Path: src/main/java/com/github/vaibhavsinha/kong/exception/KongClientException.java
// public class KongClientException extends RuntimeException {
// 
//     private int code;
// 
//     private String error;
// 
//     public KongClientException(String message) {
//         super(message);
//     }
// 
//     public KongClientException(String message, int code, String error) {
//         super(message);
//         this.code = code;
//         this.error = error;
//     }
// 
//     public int getCode() {
//         return code;
//     }
// 
//     public String getError() {
//         return error;
//     }
// }


// Path: src/main/java/com/github/vaibhavsinha/kong/impl/service/plugin/authentication/HmacAuthServiceImpl.java
import com.github.vaibhavsinha.kong.api.plugin.authentication.HmacAuthService;
import com.github.vaibhavsinha.kong.exception.KongClientException;
import com.github.vaibhavsinha.kong.internal.plugin.authentication.RetrofitHmacAuthService;
import com.github.vaibhavsinha.kong.model.plugin.authentication.hmac.HmacAuthCredential;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import java.io.IOException;

package com.github.vaibhavsinha.kong.impl.service.plugin.authentication;



/**
 * Created by vaibhav on 15/06/17.
 *
 * Updated by fanhua on 2017-08-07.
 */
public class HmacAuthServiceImpl implements HmacAuthService {

    private RetrofitHmacAuthService retrofitHmacAuthService;

    public HmacAuthServiceImpl(RetrofitHmacAuthService retrofitHmacAuthService) {
        this.retrofitHmacAuthService = retrofitHmacAuthService;
    }

    @Override
    public void addCredentials(String consumerIdOrUsername, String username, String secret) {
        try {
            retrofitHmacAuthService.addCredentials(consumerIdOrUsername, new HmacAuthCredential(username, secret)).execute();
        } catch (IOException e) {
            throw new KongClientException(e.getMessage());