com.createsend
Class Clients

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

public class Clients
extends CreateSendBase

Provides methods for accessing all Client resources in the Campaign Monitor API


Field Summary
 
Fields inherited from class com.createsend.CreateSendBase
jerseyClient, urlEncodingScheme
 
Constructor Summary
Clients(AuthenticationDetails auth)
          Constructor used to create new clients.
Clients(AuthenticationDetails auth, java.lang.String clientID)
          Constructor used for working with existing clients.
 
Method Summary
 java.lang.String create(Client client)
          Creates a new client based on the provided data.
 void delete()
          Deletes the current client
 AllClientDetails details()
          Gets the details of the current client
 DraftCampaign[] draftCampaigns()
          Gets all draft campaigns created for the current client
 java.lang.String getClientID()
          Gets the current client ID
 java.lang.String getPrimaryContact()
          looks up the primary contact for this client
 ListBasics[] lists()
          Gets all lists for the current client
 ListForEmail[] listsForEmailAddress(java.lang.String emailAddress)
          Gets the lists across a client, to which a subscriber with a particular email address belongs.
 Person[] people()
          returns a list of people associated with the client.
 ScheduledCampaign[] scheduledCampaigns()
          Gets all campaigns scheduled to tbe sent by the current client
 Segment[] segments()
          Gets all segments defined for the current client
 SentCampaign[] sentCampaigns()
          Gets all campaigns sent by the current client
 void setBasics(Client client)
          Sets the basic details for the current client.
 void setClientID(java.lang.String clientID)
          Sets the current client ID.
 void setMonthlyBilling(BillingDetails billing)
          Sets a client to be billed monthly based on the current number of active subscribers across all lists.
 void setPaygBilling(BillingDetails billing)
          Sets a client to be billed per campaign sent.
 void setPrimaryContact(java.lang.String emailAddress)
          sets the primary contact for this client to the person with the specified email address
 void suppress(SuppressionDetails details)
           
 PagedResult<SuppressedSubscriber> suppressionList(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of subscribers who are suppressed from the current clients lists.
 Template[] templates()
          Gets all templates defined for the current client.
 CreditsTransferResult transferCredits(CreditsTransferDetails details)
          Transfer credits to or from this client.
 void unsuppress(java.lang.String email)
           
 
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

Clients

public Clients(AuthenticationDetails auth)
Constructor used to create new clients.

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

Clients

public Clients(AuthenticationDetails auth,
               java.lang.String clientID)
Constructor used for working with existing clients.

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

setClientID

public void setClientID(java.lang.String clientID)
Sets the current client ID.

Parameters:
clientID - The ID of the client to apply API calls to.

getClientID

public java.lang.String getClientID()
Gets the current client ID

Returns:
The current client ID

create

public java.lang.String create(Client client)
                        throws CreateSendException
Creates a new client based on the provided data. After a successful call the current clientID property will be set to that of the newly created client.

Parameters:
client - The client information to use during creation
Returns:
The ID of the newly created client
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Creating a client

details

public AllClientDetails details()
                         throws CreateSendException
Gets the details of the current client

Returns:
The details of the current client
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting a client

sentCampaigns

public SentCampaign[] sentCampaigns()
                             throws CreateSendException
Gets all campaigns sent by the current client

Returns:
All campaigns which have been sent by the current client
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting sent campaigns

scheduledCampaigns

public ScheduledCampaign[] scheduledCampaigns()
                                       throws CreateSendException
Gets all campaigns scheduled to tbe sent by the current client

Returns:
All campaigns which are currently scheduled to send for the current client
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting sent campaigns

draftCampaigns

public DraftCampaign[] draftCampaigns()
                               throws CreateSendException
Gets all draft campaigns created for the current client

Returns:
All draft campaigns available to the current client
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting draft campaigns

lists

public ListBasics[] lists()
                   throws CreateSendException
Gets all lists for the current client

Returns:
All lists available to the current client.
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting subscriber lists

listsForEmailAddress

public ListForEmail[] listsForEmailAddress(java.lang.String emailAddress)
                                    throws CreateSendException
Gets the lists across a client, to which a subscriber with a particular email address belongs.

Parameters:
emailAddress - A subscriber's email address
Returns:
All client lists to which the email address is subscribed.
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Lists for an email address

segments

public Segment[] segments()
                   throws CreateSendException
Gets all segments defined for the current client

Returns:
All segments defined for the current client
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting segments

suppressionList

public PagedResult<SuppressedSubscriber> suppressionList(java.lang.Integer page,
                                                         java.lang.Integer pageSize,
                                                         java.lang.String orderField,
                                                         java.lang.String orderDirection)
                                                  throws CreateSendException
Gets a paged collection of subscribers who are suppressed from the current clients lists.

Parameters:
page - The page number or results to get. Use null for the default (page=1)
pageSize - The number of records to get on the current page. Use null for the default.
orderField - The field used to order the results by. Use null for the default.
orderDirection - The direction to order the results by. Use null for the default.
Returns:
Subscribers who are suppressed from the current clients lists
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting client suppression list

suppress

public void suppress(SuppressionDetails details)
              throws CreateSendException
Throws:
CreateSendException

unsuppress

public void unsuppress(java.lang.String email)
                throws CreateSendException
Throws:
CreateSendException

templates

public Template[] templates()
                     throws CreateSendException
Gets all templates defined for the current client.

Returns:
A collection of templates defined for the current client
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting client templates

setBasics

public void setBasics(Client client)
               throws CreateSendException
Sets the basic details for the current client.

Parameters:
client - The basic details to use for the current client.
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Setting basic details

setPaygBilling

public void setPaygBilling(BillingDetails billing)
                    throws CreateSendException
Sets a client to be billed per campaign sent. Markup values may be provided in the billing options.

Parameters:
billing - The billing options available to the client, including any markup.
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Setting payg billing

setMonthlyBilling

public void setMonthlyBilling(BillingDetails billing)
                       throws CreateSendException
Sets a client to be billed monthly based on the current number of active subscribers across all lists. Markup rates can be provided in the billing options

Parameters:
billing - The billing options available to the client, including any markup.
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Setting monthly billing

transferCredits

public CreditsTransferResult transferCredits(CreditsTransferDetails details)
                                      throws CreateSendException
Transfer credits to or from this client.

Parameters:
details - The credit transfer details.
Returns:
The result of the credits transfer.
Throws:
CreateSendException

delete

public void delete()
            throws CreateSendException
Deletes the current client

Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Deleting a client

people

public Person[] people()
                throws CreateSendException
returns a list of people associated with the client.

Returns:
all people associated with the client
Throws:
CreateSendException
See Also:
Getting people

getPrimaryContact

public java.lang.String getPrimaryContact()
                                   throws CreateSendException
looks up the primary contact for this client

Returns:
the email address of the primary contact for the client
Throws:
CreateSendException
See Also:
Getting primary contact

setPrimaryContact

public void setPrimaryContact(java.lang.String emailAddress)
                       throws CreateSendException
sets the primary contact for this client to the person with the specified email address

Throws:
CreateSendException
See Also:
Setting primary contact