org.urbanstew.soundcloudapi
Class SoundCloudAPI

java.lang.Object
  extended by org.urbanstew.soundcloudapi.SoundCloudAPI

public class SoundCloudAPI
extends java.lang.Object


Nested Class Summary
static class SoundCloudAPI.OAuthVersion
           
static class SoundCloudAPI.SoundCloudSystem
           
static class SoundCloudAPI.State
           
 
Field Summary
static SoundCloudOptions USE_PRODUCTION
           
static SoundCloudOptions USE_SANDBOX
           
 
Constructor Summary
SoundCloudAPI(SoundCloudAPI soundCloudAPI)
          Constructor from another SoundCloudAPI.
SoundCloudAPI(java.lang.String consumerKey, java.lang.String consumerSecret)
          Constructor for the case when neither the request or access token have been obtained.
SoundCloudAPI(java.lang.String consumerKey, java.lang.String consumerSecret, SoundCloudOptions options)
          Constructor for the case when neither the request or access token have been obtained, with specified options.
SoundCloudAPI(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String token, java.lang.String tokenSecret)
          Constructor for the case when the access token has been obtained.
SoundCloudAPI(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String token, java.lang.String tokenSecret, SoundCloudOptions options)
          Constructor for the case when the access token has been obtained, with specified options.
 
Method Summary
 boolean authorizeUsingUrl(java.lang.String url, java.lang.String response, AuthorizationURLOpener URLOpener)
          Completes the OAuth 1.0a authorization steps with SoundCloud, assuming the consumer application can use a local port to receive the verification code.
 void cancelAuthorizeUsingUrl()
          If a call to authorizeUsingUrl is currently executing, it will be canceled and return shortly after cancelAuthorizeUsingUrl is called.
 org.apache.http.HttpResponse delete(java.lang.String resource)
          Performs a DELETE request on a specified resource.
 org.apache.http.HttpResponse delete(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Performs a DELETE request on a specified resource, with parameters.
 org.apache.http.client.methods.HttpUriRequest deleteRequest(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Prepares a DELETE request on a specified resource, with parameters.
 org.apache.http.HttpResponse get(java.lang.String resource)
          Performs a GET request on a specified resource.
 org.apache.http.HttpResponse get(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Performs a GET request on a specified resource, with parameters.
 java.lang.String getRedirectedStreamUrl(java.lang.String resource)
          Returns a URL you can use to access a stream resource without any further need for signing.
 org.apache.http.client.methods.HttpUriRequest getRequest(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Prepares a GET request on a specified resource, with parameters.
 SoundCloudAPI.State getState()
          Returns the current state of the API wrapper.
 org.apache.http.HttpResponse getStream(java.lang.String resource)
           
 org.apache.http.HttpResponse getStreamRedirect(java.lang.String url)
          Executes a GET request for the given URL, without following any redirects.
 java.lang.String getToken()
          Returns the Request or Access Token.
 java.lang.String getTokenSecret()
          Returns the Request or Access Token Secret.
 void obtainAccessToken(java.lang.String verificationCode)
          Swaps the authorized request token for an access token.
 java.lang.String obtainRequestToken()
          Obtains the request token from Sound Cloud
 java.lang.String obtainRequestToken(java.lang.String callbackURL)
          Obtains the request token from Sound Cloud, with a specified callback URL.
 java.lang.String parseRedirectResponse(org.apache.http.HttpResponse response)
          Utility function that returns the value of the Location header in a redirect response.
 org.apache.http.HttpResponse post(java.lang.String resource)
          Performs a POST request on a specified resource.
 org.apache.http.HttpResponse post(java.lang.String resource, org.apache.http.HttpEntity entity)
          Performs a POST request on a specified resource, with an entity.
 org.apache.http.HttpResponse post(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Performs a POST request on a specified resource, with parameters.
 org.apache.http.client.methods.HttpUriRequest postRequest(java.lang.String resource, org.apache.http.HttpEntity entity)
          Prepares a POST request on a specified resource, with an entity.
 org.apache.http.client.methods.HttpUriRequest postRequest(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Prepares a POST request on a specified resource, with parameters.
 org.apache.http.HttpResponse put(java.lang.String resource)
          Performs a PUT request on a specified resource.
 org.apache.http.HttpResponse put(java.lang.String resource, org.apache.http.HttpEntity entity)
          Performs a PUT request on a specified resource, with an entity.
 org.apache.http.HttpResponse put(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Performs a PUT request on a specified resource, with parameters.
 org.apache.http.client.methods.HttpUriRequest putRequest(java.lang.String resource, org.apache.http.HttpEntity entity)
          Prepares a PUT request on a specified resource, with an entity.
 org.apache.http.client.methods.HttpUriRequest putRequest(java.lang.String resource, java.util.List<org.apache.http.NameValuePair> params)
          Prepares a PUT request on a specified resource, with parameters.
 java.lang.String signStreamUrl(java.lang.String url)
          Signs the provided URL.
 void unauthorize()
           
 org.apache.http.HttpResponse upload(org.apache.http.entity.mime.content.ContentBody fileBody, java.util.List<org.apache.http.NameValuePair> params)
          Uploads an arbitrary body by performing a POST request on the "tracks" resource.
 org.apache.http.HttpResponse upload(java.io.File file, java.util.List<org.apache.http.NameValuePair> params)
          Uploads a file by performing a POST request on the "tracks" resource.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_SANDBOX

public static final SoundCloudOptions USE_SANDBOX

USE_PRODUCTION

public static final SoundCloudOptions USE_PRODUCTION
Constructor Detail

SoundCloudAPI

public SoundCloudAPI(java.lang.String consumerKey,
                     java.lang.String consumerSecret)
Constructor for the case when neither the request or access token have been obtained.


SoundCloudAPI

public SoundCloudAPI(java.lang.String consumerKey,
                     java.lang.String consumerSecret,
                     SoundCloudOptions options)
Constructor for the case when neither the request or access token have been obtained, with specified options.


SoundCloudAPI

public SoundCloudAPI(java.lang.String consumerKey,
                     java.lang.String consumerSecret,
                     java.lang.String token,
                     java.lang.String tokenSecret)
Constructor for the case when the access token has been obtained.


SoundCloudAPI

public SoundCloudAPI(java.lang.String consumerKey,
                     java.lang.String consumerSecret,
                     java.lang.String token,
                     java.lang.String tokenSecret,
                     SoundCloudOptions options)
Constructor for the case when the access token has been obtained, with specified options.


SoundCloudAPI

public SoundCloudAPI(SoundCloudAPI soundCloudAPI)
Constructor from another SoundCloudAPI.

Method Detail

unauthorize

public void unauthorize()

obtainRequestToken

public java.lang.String obtainRequestToken()
                                    throws oauth.signpost.exception.OAuthMessageSignerException,
                                           oauth.signpost.exception.OAuthNotAuthorizedException,
                                           oauth.signpost.exception.OAuthExpectationFailedException,
                                           oauth.signpost.exception.OAuthCommunicationException
Obtains the request token from Sound Cloud

Returns:
authorization URL on success, null otherwise.
Throws:
oauth.signpost.exception.OAuthCommunicationException
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthNotAuthorizedException
oauth.signpost.exception.OAuthMessageSignerException

obtainRequestToken

public java.lang.String obtainRequestToken(java.lang.String callbackURL)
                                    throws oauth.signpost.exception.OAuthMessageSignerException,
                                           oauth.signpost.exception.OAuthNotAuthorizedException,
                                           oauth.signpost.exception.OAuthExpectationFailedException,
                                           oauth.signpost.exception.OAuthCommunicationException
Obtains the request token from Sound Cloud, with a specified callback URL.

Returns:
authorization URL on success, null otherwise.
Throws:
oauth.signpost.exception.OAuthCommunicationException
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthNotAuthorizedException
oauth.signpost.exception.OAuthMessageSignerException

authorizeUsingUrl

public boolean authorizeUsingUrl(java.lang.String url,
                                 java.lang.String response,
                                 AuthorizationURLOpener URLOpener)
                          throws oauth.signpost.exception.OAuthMessageSignerException,
                                 oauth.signpost.exception.OAuthNotAuthorizedException,
                                 oauth.signpost.exception.OAuthExpectationFailedException,
                                 oauth.signpost.exception.OAuthCommunicationException,
                                 java.io.IOException
Completes the OAuth 1.0a authorization steps with SoundCloud, assuming the consumer application can use a local port to receive the verification code.

The function acts as a minimal HTTP server and will listen on the port specified in the url (or the default HTTP port, if no port is specified in the url). It will provide the specified response when it receives a request for the path specified in the url, and assuming the request includes the verification code, terminate successfully. To all other requests it will respond with a Not Found error, and continue listening.

The following example assumes the consumer application is running on the client's computer / device. Hence, it uses a local URL ("http://localhost:8088/") to receive the verification code callback. The function will listen on specified port 8088 to receive the callback.

 soundcloudapi.authorizeUsingUrl
	(
		"http://localhost:8088/",
		"Thank you for authorizing",
		new AuthorizationURLOpener()
		{
			public void openAuthorizationURL(String authorizationURL)
			{
				System.out.println("Please visit " + authorizationURL);
			}
		}
	);
 
 

Parameters:
url - - a callback URL via which the user can provide the verification code.
response - - a response given back to the user when they allow access and get redirected to the callback URL.
URLOpener - - an AuthorizationURLOpener which can open the authorization URL to the user when needed.
Returns:
true if the process is completed successfully, false if the process was canceled via cancelAuthorizeUsingUrl.
Throws:
oauth.signpost.exception.OAuthCommunicationException
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthNotAuthorizedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
Since:
0.9.1
See Also:
cancelAuthorizeUsingUrl()

cancelAuthorizeUsingUrl

public void cancelAuthorizeUsingUrl()
If a call to authorizeUsingUrl is currently executing, it will be canceled and return shortly after cancelAuthorizeUsingUrl is called. If there is no active authorizeUsingUrl call, there is no effect.

Since:
0.9.1
See Also:
authorizeUsingUrl(String, String, AuthorizationURLOpener)

obtainAccessToken

public void obtainAccessToken(java.lang.String verificationCode)
                       throws oauth.signpost.exception.OAuthMessageSignerException,
                              oauth.signpost.exception.OAuthNotAuthorizedException,
                              oauth.signpost.exception.OAuthExpectationFailedException,
                              oauth.signpost.exception.OAuthCommunicationException
Swaps the authorized request token for an access token.

Throws:
oauth.signpost.exception.OAuthCommunicationException
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthNotAuthorizedException
oauth.signpost.exception.OAuthMessageSignerException

get

public org.apache.http.HttpResponse get(java.lang.String resource)
                                 throws oauth.signpost.exception.OAuthMessageSignerException,
                                        oauth.signpost.exception.OAuthExpectationFailedException,
                                        org.apache.http.client.ClientProtocolException,
                                        java.io.IOException,
                                        oauth.signpost.exception.OAuthCommunicationException
Performs a GET request on a specified resource.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

get

public org.apache.http.HttpResponse get(java.lang.String resource,
                                        java.util.List<org.apache.http.NameValuePair> params)
                                 throws oauth.signpost.exception.OAuthMessageSignerException,
                                        oauth.signpost.exception.OAuthExpectationFailedException,
                                        org.apache.http.client.ClientProtocolException,
                                        java.io.IOException,
                                        oauth.signpost.exception.OAuthCommunicationException
Performs a GET request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

getRequest

public org.apache.http.client.methods.HttpUriRequest getRequest(java.lang.String resource,
                                                                java.util.List<org.apache.http.NameValuePair> params)
                                                         throws oauth.signpost.exception.OAuthMessageSignerException,
                                                                oauth.signpost.exception.OAuthExpectationFailedException,
                                                                oauth.signpost.exception.OAuthCommunicationException
Prepares a GET request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException

put

public org.apache.http.HttpResponse put(java.lang.String resource)
                                 throws oauth.signpost.exception.OAuthMessageSignerException,
                                        oauth.signpost.exception.OAuthExpectationFailedException,
                                        org.apache.http.client.ClientProtocolException,
                                        java.io.IOException,
                                        oauth.signpost.exception.OAuthCommunicationException
Performs a PUT request on a specified resource.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

put

public org.apache.http.HttpResponse put(java.lang.String resource,
                                        java.util.List<org.apache.http.NameValuePair> params)
                                 throws oauth.signpost.exception.OAuthMessageSignerException,
                                        oauth.signpost.exception.OAuthExpectationFailedException,
                                        org.apache.http.client.ClientProtocolException,
                                        java.io.IOException,
                                        oauth.signpost.exception.OAuthCommunicationException
Performs a PUT request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

putRequest

public org.apache.http.client.methods.HttpUriRequest putRequest(java.lang.String resource,
                                                                java.util.List<org.apache.http.NameValuePair> params)
                                                         throws oauth.signpost.exception.OAuthMessageSignerException,
                                                                oauth.signpost.exception.OAuthExpectationFailedException,
                                                                oauth.signpost.exception.OAuthCommunicationException
Prepares a PUT request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException

put

public org.apache.http.HttpResponse put(java.lang.String resource,
                                        org.apache.http.HttpEntity entity)
                                 throws oauth.signpost.exception.OAuthMessageSignerException,
                                        oauth.signpost.exception.OAuthExpectationFailedException,
                                        org.apache.http.client.ClientProtocolException,
                                        java.io.IOException,
                                        oauth.signpost.exception.OAuthCommunicationException
Performs a PUT request on a specified resource, with an entity.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

putRequest

public org.apache.http.client.methods.HttpUriRequest putRequest(java.lang.String resource,
                                                                org.apache.http.HttpEntity entity)
                                                         throws oauth.signpost.exception.OAuthMessageSignerException,
                                                                oauth.signpost.exception.OAuthExpectationFailedException,
                                                                oauth.signpost.exception.OAuthCommunicationException,
                                                                java.io.UnsupportedEncodingException
Prepares a PUT request on a specified resource, with an entity.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException
java.io.UnsupportedEncodingException

post

public org.apache.http.HttpResponse post(java.lang.String resource)
                                  throws oauth.signpost.exception.OAuthMessageSignerException,
                                         oauth.signpost.exception.OAuthExpectationFailedException,
                                         org.apache.http.client.ClientProtocolException,
                                         java.io.IOException,
                                         oauth.signpost.exception.OAuthCommunicationException
Performs a POST request on a specified resource.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

post

public org.apache.http.HttpResponse post(java.lang.String resource,
                                         java.util.List<org.apache.http.NameValuePair> params)
                                  throws oauth.signpost.exception.OAuthMessageSignerException,
                                         oauth.signpost.exception.OAuthExpectationFailedException,
                                         org.apache.http.client.ClientProtocolException,
                                         java.io.IOException,
                                         oauth.signpost.exception.OAuthCommunicationException
Performs a POST request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

postRequest

public org.apache.http.client.methods.HttpUriRequest postRequest(java.lang.String resource,
                                                                 java.util.List<org.apache.http.NameValuePair> params)
                                                          throws oauth.signpost.exception.OAuthMessageSignerException,
                                                                 oauth.signpost.exception.OAuthExpectationFailedException,
                                                                 oauth.signpost.exception.OAuthCommunicationException,
                                                                 java.io.UnsupportedEncodingException
Prepares a POST request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException
java.io.UnsupportedEncodingException

post

public org.apache.http.HttpResponse post(java.lang.String resource,
                                         org.apache.http.HttpEntity entity)
                                  throws oauth.signpost.exception.OAuthMessageSignerException,
                                         oauth.signpost.exception.OAuthExpectationFailedException,
                                         org.apache.http.client.ClientProtocolException,
                                         java.io.IOException,
                                         oauth.signpost.exception.OAuthCommunicationException
Performs a POST request on a specified resource, with an entity.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

postRequest

public org.apache.http.client.methods.HttpUriRequest postRequest(java.lang.String resource,
                                                                 org.apache.http.HttpEntity entity)
                                                          throws oauth.signpost.exception.OAuthMessageSignerException,
                                                                 oauth.signpost.exception.OAuthExpectationFailedException,
                                                                 oauth.signpost.exception.OAuthCommunicationException,
                                                                 java.io.UnsupportedEncodingException
Prepares a POST request on a specified resource, with an entity.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException
java.io.UnsupportedEncodingException

delete

public org.apache.http.HttpResponse delete(java.lang.String resource)
                                    throws oauth.signpost.exception.OAuthMessageSignerException,
                                           oauth.signpost.exception.OAuthExpectationFailedException,
                                           org.apache.http.client.ClientProtocolException,
                                           java.io.IOException,
                                           oauth.signpost.exception.OAuthCommunicationException
Performs a DELETE request on a specified resource.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

delete

public org.apache.http.HttpResponse delete(java.lang.String resource,
                                           java.util.List<org.apache.http.NameValuePair> params)
                                    throws oauth.signpost.exception.OAuthMessageSignerException,
                                           oauth.signpost.exception.OAuthExpectationFailedException,
                                           org.apache.http.client.ClientProtocolException,
                                           java.io.IOException,
                                           oauth.signpost.exception.OAuthCommunicationException
Performs a DELETE request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

deleteRequest

public org.apache.http.client.methods.HttpUriRequest deleteRequest(java.lang.String resource,
                                                                   java.util.List<org.apache.http.NameValuePair> params)
                                                            throws oauth.signpost.exception.OAuthMessageSignerException,
                                                                   oauth.signpost.exception.OAuthExpectationFailedException,
                                                                   oauth.signpost.exception.OAuthCommunicationException
Prepares a DELETE request on a specified resource, with parameters.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException

upload

public org.apache.http.HttpResponse upload(java.io.File file,
                                           java.util.List<org.apache.http.NameValuePair> params)
                                    throws oauth.signpost.exception.OAuthMessageSignerException,
                                           oauth.signpost.exception.OAuthExpectationFailedException,
                                           org.apache.http.client.ClientProtocolException,
                                           java.io.IOException,
                                           oauth.signpost.exception.OAuthCommunicationException
Uploads a file by performing a POST request on the "tracks" resource.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

upload

public org.apache.http.HttpResponse upload(org.apache.http.entity.mime.content.ContentBody fileBody,
                                           java.util.List<org.apache.http.NameValuePair> params)
                                    throws oauth.signpost.exception.OAuthMessageSignerException,
                                           oauth.signpost.exception.OAuthExpectationFailedException,
                                           org.apache.http.client.ClientProtocolException,
                                           java.io.IOException,
                                           oauth.signpost.exception.OAuthCommunicationException
Uploads an arbitrary body by performing a POST request on the "tracks" resource.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
java.io.IOException
org.apache.http.client.ClientProtocolException
oauth.signpost.exception.OAuthCommunicationException

signStreamUrl

public java.lang.String signStreamUrl(java.lang.String url)
                               throws oauth.signpost.exception.OAuthMessageSignerException,
                                      oauth.signpost.exception.OAuthExpectationFailedException,
                                      oauth.signpost.exception.OAuthCommunicationException
Signs the provided URL. Useful for stream URLs which you might need to access using e.g., an audio player which won't do the signing for you.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException

getStreamRedirect

public org.apache.http.HttpResponse getStreamRedirect(java.lang.String url)
                                               throws oauth.signpost.exception.OAuthMessageSignerException,
                                                      oauth.signpost.exception.OAuthExpectationFailedException,
                                                      oauth.signpost.exception.OAuthCommunicationException,
                                                      org.apache.http.client.ClientProtocolException,
                                                      java.io.IOException
Executes a GET request for the given URL, without following any redirects. Useful for stream URLs which return a redirect.

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException
org.apache.http.client.ClientProtocolException
java.io.IOException

parseRedirectResponse

public java.lang.String parseRedirectResponse(org.apache.http.HttpResponse response)
Utility function that returns the value of the Location header in a redirect response.


getRedirectedStreamUrl

public java.lang.String getRedirectedStreamUrl(java.lang.String resource)
                                        throws oauth.signpost.exception.OAuthMessageSignerException,
                                               oauth.signpost.exception.OAuthExpectationFailedException,
                                               oauth.signpost.exception.OAuthCommunicationException,
                                               org.apache.http.client.ClientProtocolException,
                                               java.io.IOException
Returns a URL you can use to access a stream resource without any further need for signing. If the GET request on the stream URL results in a redirect, this is equivalent to parseRedirectResoinse(getStreamRedirect(resource). If not, it is equivalent to signStreamUrl(resource).

Throws:
oauth.signpost.exception.OAuthExpectationFailedException
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthCommunicationException
org.apache.http.client.ClientProtocolException
java.io.IOException

getStream

public org.apache.http.HttpResponse getStream(java.lang.String resource)
                                       throws oauth.signpost.exception.OAuthMessageSignerException,
                                              oauth.signpost.exception.OAuthExpectationFailedException,
                                              org.apache.http.client.ClientProtocolException,
                                              java.io.IOException,
                                              oauth.signpost.exception.OAuthCommunicationException
Throws:
oauth.signpost.exception.OAuthMessageSignerException
oauth.signpost.exception.OAuthExpectationFailedException
org.apache.http.client.ClientProtocolException
java.io.IOException
oauth.signpost.exception.OAuthCommunicationException

getToken

public java.lang.String getToken()
Returns the Request or Access Token.


getTokenSecret

public java.lang.String getTokenSecret()
Returns the Request or Access Token Secret.


getState

public SoundCloudAPI.State getState()
Returns the current state of the API wrapper.