From dec33a839f902d712036073329f71722a3247e5b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Sun, 10 Apr 2011 10:54:15 -0700 Subject: Add user and request error model support Change-Id: Ic2ddda0eada498ebbabb9aefdd741ce5bd595c34 Signed-off-by: Chris Aniszczyk --- .../mylyn/github/internal/RequestError.java | 42 +++++++++ .../mylyn/github/internal/RequestException.java | 47 ++++++++++ .../org/eclipse/mylyn/github/internal/User.java | 101 +++++++++++++++++++++ 3 files changed, 190 insertions(+) create mode 100644 org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestError.java create mode 100644 org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestException.java create mode 100644 org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/User.java diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestError.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestError.java new file mode 100644 index 00000000..0ba922ca --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestError.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import java.util.List; + +/** + * GitHub request error class + * + * @author Kevin Sawicki (kevin@github.com) + */ +public class RequestError { + + private String message; + + private List errors; + + /** + * @return message + */ + public String getMessage() { + return this.message; + } + + /** + * Get errors + * + * @return list of errors + */ + public List getErrors() { + return this.errors; + } + +} diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestException.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestException.java new file mode 100644 index 00000000..add41565 --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestException.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import java.io.IOException; + +/** + * Request exception class that wraps an {@link RequestError} object. + * + * @author Kevin Sawicki (kevin@github.com) + */ +public class RequestException extends IOException { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1197051396535284852L; + + private RequestError error; + + /** + * Create request exception + * + * @param error + */ + public RequestException(RequestError error) { + super(error.getMessage()); + } + + /** + * Get error + * + * @return error + */ + public RequestError getError() { + return this.error; + } + +} diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/User.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/User.java new file mode 100644 index 00000000..ae00a90b --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/User.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +/** + * GitHub user class. + * + * @author Kevin Sawicki (kevin@github.com) + */ +public class User { + + private String blob; + + private String company; + + private String email; + + private String gravatarUrl; + + private String location; + + private String login; + + private String name; + + private String type; + + private String url; + + /** + * @return blob + */ + public String getBlob() { + return this.blob; + } + + /** + * @return company + */ + public String getCompany() { + return this.company; + } + + /** + * @return email + */ + public String getEmail() { + return this.email; + } + + /** + * @return gravatarUrl + */ + public String getGravatarUrl() { + return this.gravatarUrl; + } + + /** + * @return location + */ + public String getLocation() { + return this.location; + } + + /** + * @return login + */ + public String getLogin() { + return this.login; + } + + /** + * @return name + */ + public String getName() { + return this.name; + } + + /** + * @return type + */ + public String getType() { + return this.type; + } + + /** + * @return url + */ + public String getUrl() { + return this.url; + } + +} -- cgit v1.2.3