// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java
// public class FoursquareErrorHandler implements ErrorHandler {
//   @Override
//   public Throwable handleError(RetrofitError cause) {
//     if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) {
//       FoursquareResponse response = (FoursquareResponse) cause.getBody();
//       if (response.getMeta().getErrorDetail() != null) {
//         return new FoursquareException(response.getMeta().getErrorDetail(), cause);
//       }
//     }
//     return cause;
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java
// public class FoursquareException extends Exception {
//   public FoursquareException(String detailMessage, Throwable throwable) {
//     super(detailMessage, throwable);
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java
// public class FoursquareRequestInterceptor implements RequestInterceptor {
//   @Override
//   public void intercept(RequestFacade request) {
//     request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID);
//     request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET);
//     request.addQueryParam("v", "20141914");
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java
// public class FoursquareResponse {
//   public static final String FIELD_RESPONSE = "response";
//   public static final String FIELD_META = "meta";
// 
//   @SerializedName(FIELD_META) @NotNull private Meta meta;
//   @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response;
// 
//   @NotNull
//   public Meta getMeta() {
//     return meta;
//   }
// 
//   public ResponseWrapper getResponse() {
//     return response;
//   }
// }


import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler;
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException;
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor;
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.http.GET;
import retrofit.http.Query;
package com.timehop.droidcon2014retrofitsample.data.foursquare;



public interface FoursquareService {

  @GET("/venues/search")
  FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException;

  @GET("/venues/search")
  void searchVenues(
      @Query("near") String location,
      Callback<FoursquareResponse> callback);

  class Implementation {
    public static FoursquareService get() {
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java
// public class FoursquareErrorHandler implements ErrorHandler {
//   @Override
//   public Throwable handleError(RetrofitError cause) {
//     if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) {
//       FoursquareResponse response = (FoursquareResponse) cause.getBody();
//       if (response.getMeta().getErrorDetail() != null) {
//         return new FoursquareException(response.getMeta().getErrorDetail(), cause);
//       }
//     }
//     return cause;
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java
// public class FoursquareException extends Exception {
//   public FoursquareException(String detailMessage, Throwable throwable) {
//     super(detailMessage, throwable);
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java
// public class FoursquareRequestInterceptor implements RequestInterceptor {
//   @Override
//   public void intercept(RequestFacade request) {
//     request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID);
//     request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET);
//     request.addQueryParam("v", "20141914");
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java
// public class FoursquareResponse {
//   public static final String FIELD_RESPONSE = "response";
//   public static final String FIELD_META = "meta";
// 
//   @SerializedName(FIELD_META) @NotNull private Meta meta;
//   @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response;
// 
//   @NotNull
//   public Meta getMeta() {
//     return meta;
//   }
// 
//   public ResponseWrapper getResponse() {
//     return response;
//   }
// }


// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler;
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException;
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor;
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.http.GET;
import retrofit.http.Query;

package com.timehop.droidcon2014retrofitsample.data.foursquare;



public interface FoursquareService {

  @GET("/venues/search")
  FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException;

  @GET("/venues/search")
  void searchVenues(
      @Query("near") String location,
      Callback<FoursquareResponse> callback);

  class Implementation {
    public static FoursquareService get() {
      return getBuilder()