// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java
// public class RedditListing extends RedditObject {
//   String modhash;
//   String after;
//   String before;
//   List<RedditObject> children;
// 
//   public String getModhash() {
//     return modhash;
//   }
// 
//   public String getAfter() {
//     return after;
//   }
// 
//   public String getBefore() {
//     return before;
//   }
// 
//   public List<RedditObject> getChildren() {
//     return children;
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java
// public abstract class RedditObject {
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java
// public class RedditResponse<T> {
//   RedditResponse(T data) {
//     this.data = data;
//   }
// 
//   T data;
// 
//   public T getData() {
//     return data;
//   }
// }


import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing;
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject;
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse;
import org.joda.time.DateTime;
import java.util.List;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.converter.GsonConverter;
import retrofit.http.GET;
import retrofit.http.Path;
  @GET("/r/{subreddit}/comments/{id}.json")
  void getComments(
      @Path("subreddit") String subreddit,
      @Path("id") String id,
      Callback<List<RedditResponse<RedditListing>>> callback
  );

  @GET("/r/{subreddit}.json")
  RedditResponse<RedditListing> getSubreddit(@Path("subreddit") String subreddit);

  @GET("/r/{subreddit}.json")
  void getSubreddit(
      @Path("subreddit") String subreddit,
      Callback<RedditResponse<RedditListing>> callback);

  public static class Implementation {
    public static RedditService get() {
      return getBuilder()
          .build()
          .create(RedditService.class);
    }

    static RestAdapter.Builder getBuilder() {
      return new RestAdapter.Builder()
          .setConverter(new GsonConverter(getGson()))
          .setEndpoint("http://www.reddit.com");
    }

    private static Gson getGson() {
      return new GsonBuilder()
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java
// public class RedditListing extends RedditObject {
//   String modhash;
//   String after;
//   String before;
//   List<RedditObject> children;
// 
//   public String getModhash() {
//     return modhash;
//   }
// 
//   public String getAfter() {
//     return after;
//   }
// 
//   public String getBefore() {
//     return before;
//   }
// 
//   public List<RedditObject> getChildren() {
//     return children;
//   }
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java
// public abstract class RedditObject {
// }
// 
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java
// public class RedditResponse<T> {
//   RedditResponse(T data) {
//     this.data = data;
//   }
// 
//   T data;
// 
//   public T getData() {
//     return data;
//   }
// }


// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditService.java
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing;
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject;
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse;
import org.joda.time.DateTime;
import java.util.List;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.converter.GsonConverter;
import retrofit.http.GET;
import retrofit.http.Path;

  @GET("/r/{subreddit}/comments/{id}.json")
  void getComments(
      @Path("subreddit") String subreddit,
      @Path("id") String id,
      Callback<List<RedditResponse<RedditListing>>> callback
  );

  @GET("/r/{subreddit}.json")
  RedditResponse<RedditListing> getSubreddit(@Path("subreddit") String subreddit);

  @GET("/r/{subreddit}.json")
  void getSubreddit(
      @Path("subreddit") String subreddit,
      Callback<RedditResponse<RedditListing>> callback);

  public static class Implementation {
    public static RedditService get() {
      return getBuilder()
          .build()
          .create(RedditService.class);
    }

    static RestAdapter.Builder getBuilder() {
      return new RestAdapter.Builder()
          .setConverter(new GsonConverter(getGson()))
          .setEndpoint("http://www.reddit.com");
    }

    private static Gson getGson() {
      return new GsonBuilder()
          .registerTypeAdapter(RedditObject.class, new RedditObjectDeserializer())