com.createsend
Class Subscribers

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

public class Subscribers
extends CreateSendBase

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


Field Summary
 
Fields inherited from class com.createsend.CreateSendBase
jerseyClient, urlEncodingScheme
 
Constructor Summary
Subscribers(AuthenticationDetails auth, java.lang.String listID)
          Constructor.
 
Method Summary
 java.lang.String add(SubscriberToAdd subscriber)
          Adds a single subscriber to the specified list
 ImportResult addMany(SubscribersToAdd subscribers)
          Import many subscribers into the specified list
 void delete(java.lang.String emailAddress)
          Moves the given email address into the deleted list
 Subscriber details(java.lang.String emailAddress)
          Gets the details for the subscriber with the given email address in the specified list
 java.lang.String getListID()
          Gets the current list ID.
 HistoryItem[] history(java.lang.String emailAddress)
          Gets the complete history for a given subscriber in the specified list
 void setListID(java.lang.String listID)
          Sets the current list ID.
 void unsubscribe(java.lang.String emailAddress)
          Unsubscribes the given email address from the specified list
 void update(java.lang.String originalEmailAddress, SubscriberToAdd newDetails)
          Updates any provided information for an existing subscriber
 
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

Subscribers

public Subscribers(AuthenticationDetails auth,
                   java.lang.String listID)
Constructor.

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

setListID

public void setListID(java.lang.String listID)
Sets the current list ID.

Parameters:
listID - The ID of the list to apply any calls to.

getListID

public java.lang.String getListID()
Gets the current list ID.

Returns:
The current list ID.

add

public java.lang.String add(SubscriberToAdd subscriber)
                     throws CreateSendException
Adds a single subscriber to the specified list

Parameters:
subscriber - The subscriber to add to the list
Returns:
The email addresss of the newly added subscriber
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Adding a subscriber

addMany

public ImportResult addMany(SubscribersToAdd subscribers)
                     throws CreateSendException
Import many subscribers into the specified list

Parameters:
subscribers - The subscribers to add to the list
Returns:
The results of the import. This will detail how many of the subscribers were new, already subscribed to the list or duplicated in the submission
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Importing subscribers

details

public Subscriber details(java.lang.String emailAddress)
                   throws CreateSendException
Gets the details for the subscriber with the given email address in the specified list

Parameters:
emailAddress - The email address to get the subscriber details for
Returns:
The details of the subscriber
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting subscriber details

history

public HistoryItem[] history(java.lang.String emailAddress)
                      throws CreateSendException
Gets the complete history for a given subscriber in the specified list

Parameters:
emailAddress - The email address of the subscriber to get the history for
Returns:
The complete history for the given subscriber
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting subscriber history

unsubscribe

public void unsubscribe(java.lang.String emailAddress)
                 throws CreateSendException
Unsubscribes the given email address from the specified list

Parameters:
emailAddress - The email address to unsubscibe
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Unsubscribing a subscriber

delete

public void delete(java.lang.String emailAddress)
            throws CreateSendException
Moves the given email address into the deleted list

Parameters:
emailAddress - The email address to delete
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Deleting a subscriber

update

public void update(java.lang.String originalEmailAddress,
                   SubscriberToAdd newDetails)
            throws CreateSendException
Updates any provided information for an existing subscriber

Parameters:
originalEmailAddress - The current email address of the existing subscriber
newDetails - The new details for the subscriber. Any details included here will be used in the updated. Any details omitted will not be changed.
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Updating a subscriber