// Path: sample/src/main/java/com/vimeo/sample/model/DateParser.java
// public class DateParser extends TypeAdapter<Date> {
// 
//     private static final SimpleDateFormat dateFormat =
//             new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZZZZ", Locale.ENGLISH);
// 
//     @Override
//     public void write(JsonWriter out, Date value) throws IOException {
//         out.value(dateFormat.format(value));
//     }
// 
//     @Override
//     public Date read(JsonReader in) throws IOException {
//         try {
//             return dateFormat.parse(in.nextString());
//         } catch (ParseException e) {
//             throw new IOException("Date parsing failed", e);
//         }
//     }
// }
// 
// Path: sample/src/main/java/com/vimeo/sample/model/Video.java
// @UseStag
// public class Video {
// 
//     @SerializedName("user")
//     public User mUser;
// 
//     @SerializedName("link")
//     public String mLink;
// 
//     @SerializedName("name")
//     public String mName;
// 
//     @SerializedName("created_time")
//     public Date mCreatedTime;
// 
//     @SerializedName("stats")
//     public Stats mStats;
// 
//     @Override
//     public String toString() {
//         return "user: { " + (mUser != null ? mUser.toString() : null) + " }\nlink: " + mLink + "\nname: " +
//                mName + "\ncreated_time: " + mCreatedTime + "\nstats: { " +
//                (mStats != null ? mStats.toString() : null) + " }";
//     }
// }


import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.TypeAdapter;
import com.vimeo.sample.model.DateParser;
import com.vimeo.sample.model.Video;
import com.vimeo.sample.model.VideoList;
import com.vimeo.sample.model.VideoList$TypeAdapter;
import com.vimeo.sample.stag.generated.Stag;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Executors;

        void cancelRequest() {
            mCallback = null;
            cancel(true);
        }

        @Override
        protected List<Video> doInBackground(Void... params) {
            String url = "https://api.vimeo.com/channels/staffpicks/videos";
            String token = "bearer b8e31bd89ba1ee093dc6ab0f863db1bd";
            ArrayList<Video> videos = new ArrayList<>();

            StringBuilder builder = new StringBuilder();
            BufferedReader stream = null;
            try {

                URL uri = new URL(url);
                HttpURLConnection connection = (HttpURLConnection) uri.openConnection();
                connection.setRequestProperty("Authorization", token);
                connection.setRequestMethod("GET");
                stream = new BufferedReader(new InputStreamReader(connection.getInputStream()));

                String line;

                while ((line = stream.readLine()) != null) {
                    builder.append(line);
                }


                Stag.Factory factory = new Stag.Factory();
// Path: sample/src/main/java/com/vimeo/sample/model/DateParser.java
// public class DateParser extends TypeAdapter<Date> {
// 
//     private static final SimpleDateFormat dateFormat =
//             new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZZZZ", Locale.ENGLISH);
// 
//     @Override
//     public void write(JsonWriter out, Date value) throws IOException {
//         out.value(dateFormat.format(value));
//     }
// 
//     @Override
//     public Date read(JsonReader in) throws IOException {
//         try {
//             return dateFormat.parse(in.nextString());
//         } catch (ParseException e) {
//             throw new IOException("Date parsing failed", e);
//         }
//     }
// }
// 
// Path: sample/src/main/java/com/vimeo/sample/model/Video.java
// @UseStag
// public class Video {
// 
//     @SerializedName("user")
//     public User mUser;
// 
//     @SerializedName("link")
//     public String mLink;
// 
//     @SerializedName("name")
//     public String mName;
// 
//     @SerializedName("created_time")
//     public Date mCreatedTime;
// 
//     @SerializedName("stats")
//     public Stats mStats;
// 
//     @Override
//     public String toString() {
//         return "user: { " + (mUser != null ? mUser.toString() : null) + " }\nlink: " + mLink + "\nname: " +
//                mName + "\ncreated_time: " + mCreatedTime + "\nstats: { " +
//                (mStats != null ? mStats.toString() : null) + " }";
//     }
// }


// Path: sample/src/main/java/com/vimeo/sample/network/NetworkRequest.java
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.TypeAdapter;
import com.vimeo.sample.model.DateParser;
import com.vimeo.sample.model.Video;
import com.vimeo.sample.model.VideoList;
import com.vimeo.sample.model.VideoList$TypeAdapter;
import com.vimeo.sample.stag.generated.Stag;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Executors;


        void cancelRequest() {
            mCallback = null;
            cancel(true);
        }

        @Override
        protected List<Video> doInBackground(Void... params) {
            String url = "https://api.vimeo.com/channels/staffpicks/videos";
            String token = "bearer b8e31bd89ba1ee093dc6ab0f863db1bd";
            ArrayList<Video> videos = new ArrayList<>();

            StringBuilder builder = new StringBuilder();
            BufferedReader stream = null;
            try {

                URL uri = new URL(url);
                HttpURLConnection connection = (HttpURLConnection) uri.openConnection();
                connection.setRequestProperty("Authorization", token);
                connection.setRequestMethod("GET");
                stream = new BufferedReader(new InputStreamReader(connection.getInputStream()));

                String line;

                while ((line = stream.readLine()) != null) {
                    builder.append(line);
                }


                Stag.Factory factory = new Stag.Factory();
                Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new DateParser())