com.createsend
Class General

java.lang.Object
  extended by com.createsend.CreateSendBase
      extended by com.createsend.General

public class General
extends CreateSendBase

Provides methods for accessing all Account methods in the Campaign Monitor API


Field Summary
 
Fields inherited from class com.createsend.CreateSendBase
jerseyClient, urlEncodingScheme
 
Constructor Summary
General(AuthenticationDetails auth)
          Constructor.
 
Method Summary
 Administrator[] administrators()
           
static OAuthTokenDetails exchangeToken(int clientID, java.lang.String clientSecret, java.lang.String redirectUri, java.lang.String code)
          Exchange a provided OAuth code for an OAuth access token, 'expires in' value, and refresh token.
 java.lang.String getAPIKey(java.lang.String siteAddress, java.lang.String username, java.lang.String password)
          Gets the API Key to use with the given authentication data
static java.lang.String getAuthorizeUrl(int clientID, java.lang.String redirectUri, java.lang.String scope, java.lang.String state)
          Get the authorization URL for your application, given the application's Client ID, Redirect URI, Scope, and optional State data.
 BillingDetails getBillingDetails()
           
 ClientBasics[] getClients()
           
 java.lang.String[] getCountries()
           
 java.lang.String getExternalSessionUrl(ExternalSessionOptions sessionOptions)
          Get a URL which initiates a new external session for the user with the given email.
 java.lang.String getPrimaryContact()
           
 java.util.Date getSystemDate()
           
 java.lang.String[] getTimezones()
           
 void setPrimaryContact(java.lang.String emailAddress)
           
 
Methods inherited from class com.createsend.CreateSendBase
refreshToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

General

public General(AuthenticationDetails auth)
Constructor.

Parameters:
auth - The authentication details to use when making API calls. May be either an OAuthAuthenticationDetails or ApiKeyAuthenticationDetails instance.
Method Detail

getAuthorizeUrl

public static java.lang.String getAuthorizeUrl(int clientID,
                                               java.lang.String redirectUri,
                                               java.lang.String scope,
                                               java.lang.String state)
Get the authorization URL for your application, given the application's Client ID, Redirect URI, Scope, and optional State data.

Parameters:
clientID - The Client ID value for your application.
redirectUri - The Redirect URI value for your application.
scope - The permission scope your application is requesting.
state - Optional state data to include in the authorization URL.
Returns:
The authorization URL to which your application should redirect your users.

exchangeToken

public static OAuthTokenDetails exchangeToken(int clientID,
                                              java.lang.String clientSecret,
                                              java.lang.String redirectUri,
                                              java.lang.String code)
                                       throws CreateSendException
Exchange a provided OAuth code for an OAuth access token, 'expires in' value, and refresh token.

Parameters:
clientID - The Client ID value for your application.
clientSecret - The Client Secret value for your application.
redirectUri - The Redirect URI value for your application.
code - A unique code provided to your user which can be exchanged for an access token.
Returns:
An OAuthTokenDetails object containing the access token, 'expires in' value, and refresh token.
Throws:
CreateSendException

getAPIKey

public java.lang.String getAPIKey(java.lang.String siteAddress,
                                  java.lang.String username,
                                  java.lang.String password)
                           throws CreateSendException
Gets the API Key to use with the given authentication data

Parameters:
siteAddress - The create send site address for the account
username - The username used to login
password - The password of the account
Returns:
The API key for the specified authentication data
Throws:
CreateSendException
See Also:
Getting you API Key

getClients

public ClientBasics[] getClients()
                          throws CreateSendException
Returns:
An array of active clients in the create send account.
Throws:
CreateSendException
See Also:
Getting your clients

getBillingDetails

public BillingDetails getBillingDetails()
                                 throws CreateSendException
Returns:
Gets your billing details.
Throws:
CreateSendException
See Also:
Getting your billing details

getCountries

public java.lang.String[] getCountries()
                                throws CreateSendException
Returns:
An array of valid countries for use in the Create Send API
Throws:
CreateSendException
See Also:
Getting valid countries

getTimezones

public java.lang.String[] getTimezones()
                                throws CreateSendException
Returns:
An array of valid timezones for use in the Create Send API
Throws:
CreateSendException
See Also:
Getting valid timezones

getSystemDate

public java.util.Date getSystemDate()
                             throws CreateSendException
Returns:
The current date in the timezone of the authorised account
Throws:
CreateSendException
See Also:
Getting the current date

administrators

public Administrator[] administrators()
                               throws CreateSendException
Throws:
CreateSendException

getPrimaryContact

public java.lang.String getPrimaryContact()
                                   throws CreateSendException
Throws:
CreateSendException

setPrimaryContact

public void setPrimaryContact(java.lang.String emailAddress)
                       throws CreateSendException
Throws:
CreateSendException

getExternalSessionUrl

public java.lang.String getExternalSessionUrl(ExternalSessionOptions sessionOptions)
                                       throws CreateSendException
Get a URL which initiates a new external session for the user with the given email. Full details: http://www.campaignmonitor.com/api/account/#single_sign_on

Parameters:
sessionOptions - The session options to use.
Returns:
The URL to initiate the external Campaign Monitor session.
Throws:
CreateSendException