@@ -0,0 +1,1803 @@
+/**%0A * Traq desktop application.%0A *%0A * @author Jack Polgar %3Cjack@polgar.id.au%3E%0A * @license Apache-2.0%0A */%0A%0Apackage traq.models;%0A%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0A%0Aimport com.google.gson.JsonArray;%0Aimport com.google.gson.JsonElement;%0Aimport com.google.gson.JsonObject;%0A%0Aimport traq.API;%0A%0A/**%0A * Site model.%0A */%0Apublic class Site %7B%0A    private static String name;%0A    private static String url;%0A%0A    /**%0A     * @param name site name%0A     * @param url  site URL%0A     */%0A    public Site(String name, String url) %7B%0A        this.name = name;%0A        this.url = url;%0A    %7D%0A%0A    /**%0A     * @return sites name%0A     */%0A    public String getName() %7B%0A        return name;%0A    %7D%0A%0A    /**%0A     * @return sites URL%0A     */%0A    public String getUrl() %7B%0A        return url;%0A    %7D%0A%0A    /**%0A     * Fetch a JSON response from the specified path relative to the sites URL.%0A     *%0A     * @param path path to fetch%0A     *%0A     * @return JsonElement%0A     */%0A    public JsonElement fetch(String path) %7B%0A        try %7B%0A            return API.fetch(this.url + path);%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A            return null;%0A        %7D%0A    %7D%0A%0A    /**%0A     * Get an array list of projects the site contains.%0A     *%0A     * @return array of sites%0A     */%0A    public ArrayList%3CProject%3E getProjects() %7B%0A        ArrayList%3CProject%3E projects = new ArrayList%3CProject%3E();%0A%0A        JsonArray jsonProjects = fetch(%22/projects.json%22).getAsJsonArray();%0A%0A        for (JsonElement o: jsonProjects) %7B%0A            JsonObject obj = o.getAsJsonObject();%0A            Project project = new Project(obj.get(%22id%22).getAsInt(), obj.get(%22name%22).getAsString(), obj.get(%22slug%22).getAsString(), obj.get(%22info%22).getAsString());%0A            projects.add(project);%0A        %7D%0A%0A        return projects;%0A    %7D%0A%0A%7D%0A

Add site model.