spring-social-github

org.springframework.social.github.api.impl
Class GitHubTemplate

java.lang.Object
  extended by org.springframework.social.oauth2.AbstractOAuth2ApiBinding
      extended by org.springframework.social.github.api.impl.GitHubTemplate
All Implemented Interfaces:
org.springframework.social.ApiBinding, GitHub

public class GitHubTemplate
extends org.springframework.social.oauth2.AbstractOAuth2ApiBinding
implements GitHub

The central class for interacting with GitHub.

Author:
Craig Walls, Willie Wheeler (willie.wheeler@gmail.com)

Constructor Summary
GitHubTemplate()
          No-arg constructor to support cases in which you want to call the GitHub API without requiring authorization.
GitHubTemplate(java.lang.String accessToken)
          Constructs a GitHubTemplate with the minimal amount of information required to sign requests with an OAuth Authorization header.
 
Method Summary
protected  org.springframework.social.oauth2.OAuth2Version getOAuth2Version()
           
 GistOperations gistOperations()
          Returns the portion of the GitHub API containing the gist operations.
 RepoOperations repoOperations()
          Returns the portion of the GitHub API containing the repo operations.
 org.springframework.web.client.RestOperations restOperations()
          Returns the underlying RestOperations object allowing for consumption of GitHub endpoints that may not be otherwise covered by the API binding.
 UserOperations userOperations()
          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(java.lang.String accessToken)
Constructs a GitHubTemplate with the minimal amount of information required to sign requests with an OAuth Authorization header.

Parameters:
accessToken - An access token granted to the application after OAuth authentication.
Method Detail

getOAuth2Version

protected org.springframework.social.oauth2.OAuth2Version getOAuth2Version()
Overrides:
getOAuth2Version in class org.springframework.social.oauth2.AbstractOAuth2ApiBinding

gistOperations

public GistOperations gistOperations()
Description copied from interface: GitHub
Returns the portion of the GitHub API containing the gist operations.

Specified by:
gistOperations in interface GitHub
Returns:
gist operations

repoOperations

public RepoOperations repoOperations()
Description copied from interface: GitHub
Returns the portion of the GitHub API containing the repo operations.

Specified by:
repoOperations in interface GitHub
Returns:
repo operations

userOperations

public UserOperations userOperations()
Description copied from interface: GitHub
Returns the portion of the GitHub API containing the user operations.

Specified by:
userOperations in interface GitHub
Returns:
user operations

restOperations

public org.springframework.web.client.RestOperations restOperations()
Description copied from interface: GitHub
Returns the underlying RestOperations object 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:
restOperations in interface GitHub

spring-social-github