Skip to content
Snippets Groups Projects
Commit a547c5d7 authored by Jawnnypoo's avatar Jawnnypoo
Browse files

LoganSquare -> Moshi

parent ad4cafdd
No related branches found
No related tags found
No related merge requests found
Showing
with 175 additions and 221 deletions
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.commit451.gitlab.util.ObjectUtil;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -12,17 +11,16 @@ import java.util.List;
import java.util.Set;
 
@Parcel
@JsonObject
public class Contributor {
@JsonField(name = "name")
@Json(name = "name")
String name;
@JsonField(name = "email")
@Json(name = "email")
String email;
@JsonField(name = "commits")
@Json(name = "commits")
int commits;
@JsonField(name = "additions")
@Json(name = "additions")
int additions;
@JsonField(name = "deletions")
@Json(name = "deletions")
int deletions;
 
public Contributor() {}
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
@Parcel
@JsonObject
public class Diff {
@JsonField(name = "old_path")
@Json(name = "old_path")
String oldPath;
@JsonField(name = "new_path")
@Json(name = "new_path")
String newPath;
@JsonField(name = "a_mode")
@Json(name = "a_mode")
int aMode;
@JsonField(name = "b_mode")
@Json(name = "b_mode")
int bMode;
@JsonField(name = "diff")
@Json(name = "diff")
String diff;
@JsonField(name = "new_file")
@Json(name = "new_file")
boolean newFile;
@JsonField(name = "renamed_file")
@Json(name = "renamed_file")
boolean renamedFile;
@JsonField(name = "deleted_file")
@Json(name = "deleted_file")
boolean deletedFile;
 
public Diff() {}
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
@Parcel
@JsonObject
public class Email {
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "email")
@Json(name = "email")
String email;
 
public Email() {}
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -9,16 +8,15 @@ import org.parceler.Parcel;
* Response when a file is uploaded
*/
@Parcel
@JsonObject
public class FileUploadResponse {
 
@JsonField(name = "alt")
@Json(name = "alt")
String alt;
@JsonField(name = "url")
@Json(name = "url")
String url;
@JsonField(name = "is_image")
@Json(name = "is_image")
boolean isImage;
@JsonField(name = "markdown")
@Json(name = "markdown")
String markdown;
 
protected FileUploadResponse() {
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
@Parcel
@JsonObject
public class ForkedFromProject {
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "name")
@Json(name = "name")
String name;
@JsonField(name = "name_with_namespace")
@Json(name = "name_with_namespace")
String nameWithNamespace;
@JsonField(name = "path")
@Json(name = "path")
String path;
@JsonField(name = "path_with_namespace")
@Json(name = "path_with_namespace")
String pathWithNamespace;
 
public ForkedFromProject() {}
Loading
Loading
Loading
Loading
@@ -3,25 +3,23 @@ package com.commit451.gitlab.model.api;
import android.net.Uri;
import android.support.annotation.Nullable;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
@Parcel
@JsonObject
public class Group {
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "name")
@Json(name = "name")
String name;
@JsonField(name = "path")
@Json(name = "path")
String path;
@JsonField(name = "description")
@Json(name = "description")
String description;
@JsonField(name = "avatar_url")
@Json(name = "avatar_url")
String avatarUrl;
@JsonField(name = "web_url")
@Json(name = "web_url")
String webUrl;
 
public Group() {}
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
import java.util.List;
 
@Parcel
@JsonObject
public class GroupDetail extends Group {
@JsonField(name = "projects")
@Json(name = "projects")
List<Project> projects;
 
public GroupDetail() {}
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
@Parcel
@JsonObject
public class Identity {
@JsonField(name = "provider")
@Json(name = "provider")
String provider;
@JsonField(name = "extern_uid")
@Json(name = "extern_uid")
String externUid;
 
public Identity() {}
Loading
Loading
Loading
Loading
@@ -2,8 +2,7 @@ package com.commit451.gitlab.model.api;
 
import android.support.annotation.StringDef;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -13,7 +12,6 @@ import java.util.Date;
import java.util.List;
 
@Parcel
@JsonObject
public class Issue {
public static final String STATE_REOPEN = "reopen";
public static final String STATE_CLOSE = "close";
Loading
Loading
@@ -32,32 +30,32 @@ public class Issue {
public @interface State {
}
 
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "iid")
@Json(name = "iid")
long iId;
@JsonField(name = "project_id")
@Json(name = "project_id")
long projectId;
@JsonField(name = "title")
@Json(name = "title")
String title;
@JsonField(name = "description")
@Json(name = "description")
String description;
@JsonField(name = "state")
@Json(name = "state")
@State
String state;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "updated_at")
@Json(name = "updated_at")
Date updatedAt;
@JsonField(name = "labels")
@Json(name = "labels")
List<String> labels;
@JsonField(name = "milestone")
@Json(name = "milestone")
Milestone milestone;
@JsonField(name = "assignee")
@Json(name = "assignee")
UserBasic assignee;
@JsonField(name = "author")
@Json(name = "author")
UserBasic author;
@JsonField(name = "confidential")
@Json(name = "confidential")
boolean confidential;
 
public Issue() {
Loading
Loading
Loading
Loading
@@ -3,8 +3,7 @@ package com.commit451.gitlab.model.api;
import android.graphics.Color;
import android.support.annotation.ColorInt;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -12,22 +11,21 @@ import org.parceler.Parcel;
* A label
*/
@Parcel
@JsonObject
public class Label {
 
@JsonField(name = "color")
@Json(name = "color")
String color;
@JsonField(name = "name")
@Json(name = "name")
String name;
@JsonField(name = "description")
@Json(name = "description")
String description;
@JsonField(name = "open_issues_count")
@Json(name = "open_issues_count")
int openIssuesCount;
@JsonField(name = "closed_issues_count")
@Json(name = "closed_issues_count")
int closedIssuesCount;
@JsonField(name = "open_merge_requests_count")
@Json(name = "open_merge_requests_count")
int openMergeRequestsCount;
@JsonField(name = "subscribed")
@Json(name = "subscribed")
boolean subscribed;
 
protected Label() {
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
@Parcel
@JsonObject
public class Member extends UserBasic {
@JsonField(name = "access_level")
@Json(name = "access_level")
int accessLevel;
 
public Member() {}
Loading
Loading
Loading
Loading
@@ -3,8 +3,7 @@ package com.commit451.gitlab.model.api;
import android.support.annotation.Nullable;
import android.support.annotation.StringDef;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -14,7 +13,6 @@ import java.util.Date;
import java.util.List;
 
@Parcel
@JsonObject
public class MergeRequest {
 
public static final String STATE_OPENED = "opened";
Loading
Loading
@@ -25,50 +23,50 @@ public class MergeRequest {
@Retention(RetentionPolicy.SOURCE)
public @interface State {}
 
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "iid")
@Json(name = "iid")
long iId;
@JsonField(name = "project_id")
@Json(name = "project_id")
long projectId;
@JsonField(name = "title")
@Json(name = "title")
String title;
@JsonField(name = "description")
@Json(name = "description")
String description;
@JsonField(name = "state")
@Json(name = "state")
@State
String state;
@JsonField(name = "updated_at")
@Json(name = "updated_at")
Date updatedAt;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "target_branch")
@Json(name = "target_branch")
String targetBranch;
@JsonField(name = "source_branch")
@Json(name = "source_branch")
String sourceBranch;
@JsonField(name = "upvotes")
@Json(name = "upvotes")
long upvotes;
@JsonField(name = "downvotes")
@Json(name = "downvotes")
long downvotes;
@JsonField(name = "author")
@Json(name = "author")
UserBasic author;
@JsonField(name = "assignee")
@Json(name = "assignee")
UserBasic assignee;
@JsonField(name = "source_project_id")
@Json(name = "source_project_id")
long sourceProjectId;
@JsonField(name = "target_project_id")
@Json(name = "target_project_id")
long targetProjectId;
@JsonField(name = "labels")
@Json(name = "labels")
List<String> labels;
@JsonField(name = "work_in_progress")
@Json(name = "work_in_progress")
boolean workInProgress;
@JsonField(name = "milestone")
@Json(name = "milestone")
Milestone milestone;
@JsonField(name = "merge_when_build_succeeds")
@Json(name = "merge_when_build_succeeds")
boolean mergeWhenBuildSucceeds;
@JsonField(name = "merge_status")
@Json(name = "merge_status")
String mergeStatus;
@JsonField(name = "changes")
@Json(name = "changes")
@Nullable
List<Diff> changes;
 
Loading
Loading
package com.commit451.gitlab.model.api;
 
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
/**
* The structure for a message from the server, which is usually found in a response body
*/
@JsonObject
public class Message {
 
@JsonField(name = "message")
@Json(name = "message")
String message;
 
public String getMessage() {
Loading
Loading
Loading
Loading
@@ -3,20 +3,16 @@ package com.commit451.gitlab.model.api;
import android.support.annotation.Nullable;
import android.support.annotation.StringDef;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.commit451.gitlab.api.converter.DueDateTypeConverter;
import com.commit451.gitlab.api.converter.DashDateAdapter;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
 
@Parcel
@JsonObject
public class Milestone {
public static final String STATE_ACTIVE = "active";
public static final String STATE_CLOSED = "closed";
Loading
Loading
@@ -32,25 +28,24 @@ public class Milestone {
@Retention(RetentionPolicy.SOURCE)
public @interface StateEvent {}
 
public static final SimpleDateFormat DUE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-d", Locale.US);
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "iid")
@Json(name = "iid")
long iId;
@JsonField(name = "project_id")
@Json(name = "project_id")
long projectId;
@JsonField(name = "title")
@Json(name = "title")
String title;
@JsonField(name = "description")
@Json(name = "description")
String description;
@JsonField(name = "state")
@Json(name = "state")
String state;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "updated_at")
@Json(name = "updated_at")
Date updatedAt;
@JsonField(name = "due_date", typeConverter = DueDateTypeConverter.class)
@DashDateAdapter.DueDate
@Json(name = "due_date")
Date dueDate;
 
public Milestone() {}
Loading
Loading
Loading
Loading
@@ -2,8 +2,7 @@ package com.commit451.gitlab.model.api;
 
import android.support.annotation.StringDef;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -12,7 +11,6 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Date;
 
@Parcel
@JsonObject
public class Note {
 
public static final String TYPE_ISSUE = "Issue";
Loading
Loading
@@ -22,24 +20,24 @@ public class Note {
@Retention(RetentionPolicy.SOURCE)
public @interface Type {}
 
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "body")
@Json(name = "body")
String body;
@JsonField(name = "author")
@Json(name = "author")
UserBasic author;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "system")
@Json(name = "system")
boolean system;
@JsonField(name = "noteable_id")
@Json(name = "noteable_id")
long noteableId;
@JsonField(name = "noteable_type")
@Json(name = "noteable_type")
@Type
String noteableType;
@JsonField(name = "upvote?")
@Json(name = "upvote?")
boolean upvote;
@JsonField(name = "downvote?")
@Json(name = "downvote?")
boolean downvote;
 
public Note() {}
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -11,24 +10,23 @@ import java.util.Date;
* A pipeline.
*/
@Parcel
@JsonObject
public class Pipeline {
 
@JsonField(name = "user")
@Json(name = "user")
CommitUser user;
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "sha")
@Json(name = "sha")
String sha;
@JsonField(name = "ref")
@Json(name = "ref")
String ref;
@JsonField(name = "status")
@Json(name = "status")
String status;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "started_at")
@Json(name = "started_at")
Date startedAt;
@JsonField(name = "finished_at")
@Json(name = "finished_at")
Date finishedAt;
 
public CommitUser getUser() {
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
import java.util.Date;
/**
* Represents a pipeline
*/
@Parcel
@JsonObject
public class Pipelines {
 
@JsonField(name = "sha")
@Json(name = "sha")
String sha;
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "ref")
@Json(name = "ref")
String ref;
@JsonField(name = "status")
@Json(name = "status")
String status;
 
public long getId() {
Loading
Loading
Loading
Loading
@@ -3,8 +3,7 @@ package com.commit451.gitlab.model.api;
import android.net.Uri;
import android.support.annotation.Nullable;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
Loading
Loading
@@ -12,65 +11,64 @@ import java.util.Date;
import java.util.List;
 
@Parcel
@JsonObject
public class Project {
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "description")
@Json(name = "description")
String description;
@JsonField(name = "default_branch")
@Json(name = "default_branch")
String defaultBranch;
@JsonField(name = "tag_list")
@Json(name = "tag_list")
List<String> tagList;
@JsonField(name = "public")
@Json(name = "public")
boolean isPublic;
@JsonField(name = "archived")
@Json(name = "archived")
boolean archived;
@JsonField(name = "visibility_level")
@Json(name = "visibility_level")
int visibilityLevel;
@JsonField(name = "ssh_url_to_repo")
@Json(name = "ssh_url_to_repo")
String sshUrlToRepo;
@JsonField(name = "http_url_to_repo")
@Json(name = "http_url_to_repo")
String httpUrlToRepo;
@JsonField(name = "web_url")
@Json(name = "web_url")
String webUrl;
@JsonField(name = "owner")
@Json(name = "owner")
UserBasic owner;
@JsonField(name = "name")
@Json(name = "name")
String name;
@JsonField(name = "name_with_namespace")
@Json(name = "name_with_namespace")
String nameWithNamespace;
@JsonField(name = "path")
@Json(name = "path")
String path;
@JsonField(name = "path_with_namespace")
@Json(name = "path_with_namespace")
String pathWithNamespace;
@JsonField(name = "issues_enabled")
@Json(name = "issues_enabled")
Boolean issuesEnabled;
@JsonField(name = "merge_requests_enabled")
@Json(name = "merge_requests_enabled")
Boolean mergeRequestsEnabled;
@JsonField(name = "wiki_enabled")
@Json(name = "wiki_enabled")
Boolean wikiEnabled;
@JsonField(name = "builds_enabled")
@Json(name = "builds_enabled")
Boolean buildEnabled;
@JsonField(name = "snippets_enabled")
@Json(name = "snippets_enabled")
Boolean snippetsEnabled;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "last_activity_at")
@Json(name = "last_activity_at")
Date lastActivityAt;
@JsonField(name = "creator_id")
@Json(name = "creator_id")
long creatorId;
@JsonField(name = "namespace")
@Json(name = "namespace")
ProjectNamespace namespace;
@JsonField(name = "forked_from_project")
@Json(name = "forked_from_project")
ForkedFromProject forkedFromProject;
@JsonField(name = "avatar_url")
@Json(name = "avatar_url")
String avatarUrl;
@JsonField(name = "star_count")
@Json(name = "star_count")
int starCount;
@JsonField(name = "forks_count")
@Json(name = "forks_count")
int forksCount;
@JsonField(name = "open_issues_count")
@Json(name = "open_issues_count")
int openIssuesCount;
 
public Project() {}
Loading
Loading
Loading
Loading
@@ -2,33 +2,31 @@ package com.commit451.gitlab.model.api;
 
import android.net.Uri;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
import java.util.Date;
 
@Parcel
@JsonObject
public class ProjectNamespace {
@JsonField(name = "id")
@Json(name = "id")
long id;
@JsonField(name = "name")
@Json(name = "name")
String name;
@JsonField(name = "path")
@Json(name = "path")
String path;
@JsonField(name = "owner_id")
@Json(name = "owner_id")
long ownerId;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "updated_at")
@Json(name = "updated_at")
Date updatedAt;
@JsonField(name = "description")
@Json(name = "description")
String description;
@JsonField(name = "avatar")
@Json(name = "avatar")
Avatar avatar;
@JsonField(name = "public")
@Json(name = "public")
boolean isPublic;
 
public ProjectNamespace() {
Loading
Loading
@@ -86,9 +84,8 @@ public class ProjectNamespace {
}
 
@Parcel
@JsonObject
public static class Avatar {
@JsonField(name = "url")
@Json(name = "url")
Uri url;
 
public Avatar() {
Loading
Loading
package com.commit451.gitlab.model.api;
 
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.commit451.gitlab.util.ObjectUtil;
import com.squareup.moshi.Json;
 
import org.parceler.Parcel;
 
import java.util.Date;
 
@Parcel
@JsonObject
public class RepositoryCommit {
@JsonField(name = "id")
@Json(name = "id")
String id;
@JsonField(name = "short_id")
@Json(name = "short_id")
String shortId;
@JsonField(name = "title")
@Json(name = "title")
String title;
@JsonField(name = "author_name")
@Json(name = "author_name")
String authorName;
@JsonField(name = "author_email")
@Json(name = "author_email")
String authorEmail;
@JsonField(name = "created_at")
@Json(name = "created_at")
Date createdAt;
@JsonField(name = "message")
@Json(name = "message")
String message;
 
public RepositoryCommit() {}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment