本文整理汇总了Java中org.eclipse.egit.github.core.client.GitHubRequest.setType方法的典型用法代码示例。如果您正苦于以下问题:Java GitHubRequest.setType方法的具体用法?Java GitHubRequest.setType怎么用?Java GitHubRequest.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.egit.github.core.client.GitHubRequest
的用法示例。
在下文中一共展示了GitHubRequest.setType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: getCommit
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get commit for given SHA-1
*
* @param repository
* @param sha
* @return commit
* @throws IOException
*/
public Commit getCommit(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_COMMITS);
uri.append('/').append(sha);
GitHubRequest request = createRequest();
request.setType(Commit.class);
request.setUri(uri);
return (Commit) client.get(request).getBody();
}
示例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: getTree
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get tree with given SHA-1
*
* @param repository
* @param sha
* @param recursive
* @return tree
* @throws IOException
*/
public Tree getTree(IRepositoryIdProvider repository, String sha,
boolean recursive) 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_TREES);
uri.append('/').append(sha);
GitHubRequest request = createRequest();
request.setType(Tree.class);
request.setUri(uri);
if (recursive)
request.setParams(Collections.singletonMap("recursive", "1")); //$NON-NLS-1$ //$NON-NLS-2$
return (Tree) 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: 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();
}
示例8: createTree
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Create tree
*
* @param repository
* @param entries
* @param baseTree
* @return created tree
* @throws IOException
*/
public Tree createTree(IRepositoryIdProvider repository,
Collection<TreeEntry> entries, String baseTree) throws IOException {
final String id = getId(repository);
StringBuilder uri = new StringBuilder();
uri.append(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_GIT);
uri.append(SEGMENT_TREES);
GitHubRequest request = createRequest();
request.setType(Tree.class);
request.setUri(uri);
Map<String, Object> params = new HashMap<String, Object>();
if (entries != null)
params.put("tree", entries.toArray()); //$NON-NLS-1$
if (baseTree != null)
params.put("base_tree", baseTree); //$NON-NLS-1$
return client.post(uri.toString(), params, Tree.class);
}
示例9: getBlob
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
/**
* Get blob for given SHA-1
*
* @param repository
* @param sha
* @return blob
* @throws IOException
*/
public Blob getBlob(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.setType(Blob.class);
request.setUri(uri);
return (Blob) client.get(request).getBody();
}
示例10: 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();
}
示例11: 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();
}
示例12: 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);
}
示例13: getMilestone
import org.eclipse.egit.github.core.client.GitHubRequest; //导入方法依赖的package包/类
private Milestone getMilestone(String id, String number) throws IOException {
if (number == null)
throw new IllegalArgumentException("Milestone cannot be null"); //$NON-NLS-1$
if (number.length() == 0)
throw new IllegalArgumentException("Milestone cannot be empty"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(id);
uri.append(SEGMENT_MILESTONES);
uri.append('/').append(number);
GitHubRequest request = createRequest();
request.setUri(uri);
request.setType(Milestone.class);
return (Milestone) 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();
}