Class GitHubTemplate
- java.lang.Object
-
- org.springframework.social.oauth2.AbstractOAuth2ApiBinding
-
- org.springframework.social.github.api.impl.GitHubTemplate
-
- All Implemented Interfaces:
ApiBinding,GitHub
public class GitHubTemplate extends AbstractOAuth2ApiBinding implements GitHub
The central class for interacting with GitHub.
- Author:
- Craig Walls, Willie Wheeler (willie.wheeler@gmail.com)
-
-
Constructor Summary
Constructors Constructor Description GitHubTemplate()No-arg constructor to support cases in which you want to call the GitHub API without requiring authorization.GitHubTemplate(String accessToken)Constructs a GitHubTemplate with the minimal amount of information required to sign requests with an OAuthAuthorizationheader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OAuth2VersiongetOAuth2Version()GistOperationsgistOperations()Returns the portion of the GitHub API containing the gist operations.RepoOperationsrepoOperations()Returns the portion of the GitHub API containing the repo operations.org.springframework.web.client.RestOperationsrestOperations()Returns the underlyingRestOperationsobject allowing for consumption of GitHub endpoints that may not be otherwise covered by the API binding.UserOperationsuserOperations()Returns the portion of the GitHub API containing the user operations.-
Methods inherited from class org.springframework.social.oauth2.AbstractOAuth2ApiBinding
configureRestTemplate, getByteArrayMessageConverter, getFormMessageConverter, getJsonMessageConverter, getMessageConverters, getRestTemplate, isAuthorized, setRequestFactory
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.social.ApiBinding
isAuthorized
-
-
-
-
Constructor Detail
-
GitHubTemplate
public GitHubTemplate()
No-arg constructor to support cases in which you want to call the GitHub API without requiring authorization. This is useful for public operations, such as getting the list of watchers for a public repository.
-
GitHubTemplate
public GitHubTemplate(String accessToken)
Constructs a GitHubTemplate with the minimal amount of information required to sign requests with an OAuthAuthorizationheader.- Parameters:
accessToken- An access token granted to the application after OAuth authentication.
-
-
Method Detail
-
getOAuth2Version
protected OAuth2Version getOAuth2Version()
- Overrides:
getOAuth2Versionin classAbstractOAuth2ApiBinding
-
gistOperations
public GistOperations gistOperations()
Description copied from interface:GitHubReturns the portion of the GitHub API containing the gist operations.- Specified by:
gistOperationsin interfaceGitHub- Returns:
- gist operations
-
repoOperations
public RepoOperations repoOperations()
Description copied from interface:GitHubReturns the portion of the GitHub API containing the repo operations.- Specified by:
repoOperationsin interfaceGitHub- Returns:
- repo operations
-
userOperations
public UserOperations userOperations()
Description copied from interface:GitHubReturns the portion of the GitHub API containing the user operations.- Specified by:
userOperationsin interfaceGitHub- Returns:
- user operations
-
restOperations
public org.springframework.web.client.RestOperations restOperations()
Description copied from interface:GitHubReturns the underlyingRestOperationsobject allowing for consumption of GitHub endpoints that may not be otherwise covered by the API binding. The RestOperations object returned is configured to include an OAuth "Authorization" header on all requests.- Specified by:
restOperationsin interfaceGitHub- Returns:
- RestOperations
-
-