diff options
Diffstat (limited to 'org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java')
-rw-r--r-- | org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java new file mode 100644 index 00000000..43c2a3d2 --- /dev/null +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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.egit.github.core.client; + +import org.apache.commons.httpclient.HttpMethod; + +/** + * GitHub API response class. + */ +public class GitHubResponse { + + private PageLinks links; + + private Object body; + + /** + * Create response + * + * @param method + * @param body + */ + public GitHubResponse(HttpMethod method, Object body) { + links = new PageLinks(method); + this.body = body; + } + + /** + * Get link uri to first page + * + * @return possibly null uri + */ + public String getFirst() { + return this.links.getFirst(); + } + + /** + * Get link uri to previous page + * + * @return possibly null uri + */ + public String getPrevious() { + return this.links.getPrev(); + } + + /** + * Get link uri to next page + * + * @return possibly null uri + */ + public String getNext() { + return this.links.getNext(); + } + + /** + * Get link uri to last page + * + * @return possibly null uri + */ + public String getLast() { + return this.links.getLast(); + } + + /** + * Parsed response body + * + * @return body + */ + public Object getBody() { + return this.body; + } + +} |