本文整理汇总了Java中org.eclipse.egit.github.core.client.GitHubRequest.setUri方法的典型用法代码示例。如果您正苦于以下问题:Java GitHubRequest.setUri方法的具体用法?Java GitHubRequest.setUri怎么用?Java GitHubRequest.setUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.egit.github.core.client.GitHubRequest
的用法示例。
在下文中一共展示了GitHubRequest.setUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReference
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get reference with given name
*
* @param repository
* @param name
* @return reference
* @throws IOException
*/
public Reference getReference(IRepositoryIdProvider repository, String name)
throws IOException {
final String id = getId(repository);
if (name == null)
throw new IllegalArgumentException("Name cannot be null"); //$NON-NLS-1$
if (name.length() == 0)
throw new IllegalArgumentException("Name cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder();
uri.append(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_GIT);
if (!name.startsWith("refs/")) //$NON-NLS-1$
uri.append(SEGMENT_REFS);
uri.append('/').append(name);
GitHubRequest request = createRequest();
request.setType(Reference.class);
request.setUri(uri);
return (Reference) client.get(request).getBody();
}
示例2: getRawBlobAsStream
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
public InputStream getRawBlobAsStream(IRepositoryIdProvider repository, String sha)
throws IOException {
final String id = getId(repository);
if (sha == null)
throw new IllegalArgumentException("SHA-1 cannot be null"); //$NON-NLS-1$
if (sha.length() == 0)
throw new IllegalArgumentException("SHA-1 cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder();
uri.append(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_GIT);
uri.append(SEGMENT_BLOBS);
uri.append('/').append(sha);
GitHubRequest request = createRequest();
request.setUri(uri);
return client.getStream(request);
}
示例3: getMembership
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
public TeamMembership getMembership(int id, String user) throws IOException {
if (user == null)
throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$
if (user.length() == 0)
throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_TEAMS);
uri.append('/').append(id);
uri.append(SEGMENT_MEMBERSHIPS);
uri.append('/').append(user);
GitHubRequest request = createRequest();
request.setUri(uri);
request.setType(TeamMembership.class);
return (TeamMembership) client.get(request).getBody();
}
示例4: getCommit
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get commit with given SHA-1 from given repository
*
* @param repository
* @param sha
* @return repository commit
* @throws IOException
*/
public RepositoryCommit getCommit(IRepositoryIdProvider repository,
String sha) throws IOException {
String id = getId(repository);
if (sha == null)
throw new IllegalArgumentException("Sha cannot be null"); //$NON-NLS-1$
if (sha.length() == 0)
throw new IllegalArgumentException("Sha cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_COMMITS);
uri.append('/').append(sha);
GitHubRequest request = createRequest();
request.setUri(uri);
request.setType(RepositoryCommit.class);
return (RepositoryCommit) client.get(request).getBody();
}
示例5: getTag
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get tag for given SHA-1
*
* @param repository
* @param sha
* @return tag
* @throws IOException
*/
public Tag getTag(IRepositoryIdProvider repository, String sha)
throws IOException {
final String id = getId(repository);
if (sha == null)
throw new IllegalArgumentException("SHA-1 cannot be null"); //$NON-NLS-1$
if (sha.length() == 0)
throw new IllegalArgumentException("SHA-1 cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder();
uri.append(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_GIT);
uri.append(SEGMENT_TAGS);
uri.append('/').append(sha);
GitHubRequest request = createRequest();
request.setType(Tag.class);
request.setUri(uri);
return (Tag) client.get(request).getBody();
}
示例6: compare
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Compare base and head commits
*
* @param repository
* @param base
* @param head
* @return commit compare
* @throws IOException
*/
public RepositoryCommitCompare compare(IRepositoryIdProvider repository,
String base, String head) throws IOException {
String id = getId(repository);
if (base == null)
throw new IllegalArgumentException("Base cannot be null"); //$NON-NLS-1$
if (base.length() == 0)
throw new IllegalArgumentException("Base cannot be empty"); //$NON-NLS-1$
if (head == null)
throw new IllegalArgumentException("Head cannot be null"); //$NON-NLS-1$
if (head.length() == 0)
throw new IllegalArgumentException("Head cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_COMPARE);
uri.append('/').append(base).append("...").append(head); //$NON-NLS-1$
GitHubRequest request = createRequest();
request.setType(RepositoryCommitCompare.class);
request.setUri(uri);
return (RepositoryCommitCompare) client.get(request).getBody();
}
示例7: getRawFileAsStream
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
public InputStream getRawFileAsStream(Repository repo, String path, String ref) throws Exception
{
String id = repo.generateId();
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_CONTENTS);
if (path != null && path.length() > 0) {
if (path.charAt(0) != '/')
uri.append('/');
uri.append(path);
}
GitHubRequest request = createRequest();
request.setUri(uri);
if (ref != null && ref.length() > 0)
request.setParams(Collections.singletonMap("ref", ref));
return client.getStream(request);
}
示例8: getIssue
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
private Issue getIssue(String repoId, String issueNumber)
throws IOException {
if (issueNumber == null)
throw new IllegalArgumentException("Issue number cannot be null"); //$NON-NLS-1$
if (issueNumber.length() == 0)
throw new IllegalArgumentException("Issue number cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(repoId);
uri.append(SEGMENT_ISSUES);
uri.append('/').append(issueNumber);
GitHubRequest request = createRequest();
request.setUri(uri);
request.setType(Issue.class);
return (Issue) client.get(request).getBody();
}
示例9: checkVerifedEmail
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
public boolean checkVerifedEmail(String accessToken) throws Exception
{
RawGitHubClient client=new RawGitHubClient();
client.setOAuth2Token(accessToken);
GitHubRequest request=new GitHubRequest();
request.setType(List.class);
request.setUri("/user/emails");
String result=FileUtils.dumpInputStreamIntoString(client.getStream(request),GitHubConstants.UTF8ENCODING);
System.out.println(result);
if(result.contains("\"verified\":true"))
{
return true;
}
else
{
return false;
}
}
示例10: getPullRequest
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
@Override
public ExtendedPullRequest getPullRequest(final IRepositoryIdProvider repository, final int id) throws IOException {
String repoId = this.getId(repository);
StringBuilder uri = new StringBuilder("/repos");
uri.append('/').append(repoId);
uri.append("/pulls");
uri.append('/').append(id);
GitHubRequest request = this.createRequest();
request.setUri(uri);
request.setType(ExtendedPullRequest.class);
return (ExtendedPullRequest) getClient().get(request).getBody();
}
示例11: getIssueEvents
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Retrieves a list of issue events together with the new ETag if the events are updated,
* and an empty list with the current ETag if there are no new events.
*
* @param repository The repository from which to retrieve the issue
* @param issueId The numeric ID of the issue
* @param eTag The eTag to be added to the request header
* @return list of issue events
* @throws IOException
*/
public GitHubEventsResponse getIssueEvents(IRepositoryIdProvider repository, int issueId, String eTag)
throws IOException {
GitHubRequest request = createRequest();
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(repository.generateId())
.append(SEGMENT_ISSUES).append('/').append(issueId)
.append(SEGMENT_EVENTS);
request.setUri(uri);
request.setType(IssueEvent[].class);
return ghClient.getEvent(request, eTag);
}
示例12: getPullRequest
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Create request for single pull request
*
* @param repository
* @param id
* @return request
* @throws IOException
*/
public PullRequest getPullRequest(IRepositoryIdProvider repository, int id)
throws IOException {
final String repoId = getId(repository);
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(repoId);
uri.append(SEGMENT_PULLS);
uri.append('/').append(id);
GitHubRequest request = createRequest();
request.setUri(uri);
request.setType(PullRequest.class);
return (PullRequest) client.get(request).getBody();
}
示例13: getUser
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get currently authenticated user
*
* @return user
* @throws IOException
*/
public User getUser() throws IOException {
GitHubRequest request = createRequest();
request.setUri(SEGMENT_USER);
request.setType(User.class);
return (User) client.get(request).getBody();
}
示例14: getAuthorization
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get authorization with given id
*
* @param id
* @return authorization
* @throws IOException
*/
public Authorization getAuthorization(int id) throws IOException {
GitHubRequest request = createRequest();
StringBuilder uri = new StringBuilder(SEGMENT_AUTHORIZATIONS);
uri.append('/').append(id);
request.setUri(uri);
request.setType(Authorization.class);
return (Authorization) client.get(request).getBody();
}
示例15: getDownload
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get download metadata for given repository and id
*
* @param repository
* @param id
* @return download
* @throws IOException
*/
public Download getDownload(IRepositoryIdProvider repository, int id)
throws IOException {
final String repoId = getId(repository);
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(repoId);
uri.append(SEGMENT_DOWNLOADS);
uri.append('/').append(id);
GitHubRequest request = createRequest();
request.setUri(uri);
request.setType(Download.class);
return (Download) client.get(request).getBody();
}