com.createsend
Class Lists

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

public class Lists
extends CreateSendBase

Provides methods for accessing all List resources in the Campaign Monitor API *


Field Summary
 
Fields inherited from class com.createsend.CreateSendBase
jerseyClient, urlEncodingScheme
 
Constructor Summary
Lists(AuthenticationDetails auth)
          Constructor used to create new lists.
Lists(AuthenticationDetails auth, java.lang.String listID)
          Constructor for working with existing lists.
 
Method Summary
 void activateWebhook(java.lang.String webhookID)
          Activates the specified webhook.
 PagedResult<Subscriber> active()
          Gets a paged collection of active subscribers who have subscribed to the list.
 PagedResult<Subscriber> active(java.util.Date subscribedFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of active subscribers who have subscribed to the list since the provided date.
 PagedResult<Subscriber> active(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of active subscribers who have subscribed to the list.
 PagedResult<Subscriber> bounced()
          Gets a paged collection of bounced subscribers who have bounced out of the list.
 PagedResult<Subscriber> bounced(java.util.Date subscribedFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of bounced subscribers who have bounced out of the list since the provided date.
 PagedResult<Subscriber> bounced(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of bounced subscribers who have bounced out of the list.
 java.lang.String create(java.lang.String clientID, List list)
          Creates a new empty subscriber list.
 java.lang.String createCustomField(CustomFieldForCreate customField)
          Creates a new custom field with the specified data
 java.lang.String createWebhook(Webhook webhook)
          Creates a new webhook on the specified list.
 CustomField[] customFields()
          Gets the custom fields available for the list with the specified ID
 void deactivateWebhook(java.lang.String webhookID)
          Deactivates the specified webhook.
 void delete()
          Deletes the list with the specified ID
 void deleteCustomField(java.lang.String fieldKey)
          Deletes the custom field with the specified key
 PagedResult<Subscriber> deleted()
          Gets a paged collection of subscribers who have been deleted from the list.
 PagedResult<Subscriber> deleted(java.util.Date subscribedFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of subscribers who have been deleted from the list since the provided date.
 PagedResult<Subscriber> deleted(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of subscribers who have been deleted from the list.
 void deleteWebhook(java.lang.String webhookID)
          Deletes the specified webhook
 List details()
          Gets the details of the list with the given ID
 java.lang.String getListID()
          Gets the current list ID.
 Segment[] segments()
          Gets the segments available in the list with the specified ID
 void setListID(java.lang.String listID)
          Sets the current list ID.
 Statistics stats()
          Gets subscriber statistics for the list with the specified ID
 void testWebhook(java.lang.String webhookID)
          Tests the specified webhook
 PagedResult<Subscriber> unconfirmed()
          Gets a paged collection of unconfirmed subscribers who have subscribed to the list.
 PagedResult<Subscriber> unconfirmed(java.util.Date subscribedFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of unconfirmed subscribers who have subscribed to the list since the provided date.
 PagedResult<Subscriber> unconfirmed(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of unconfirmed subscribers who have subscribed to the list.
 PagedResult<Subscriber> unsubscribed()
          Gets a paged collection of unsubscribed subscribers who have unsubscribed from the list.
 PagedResult<Subscriber> unsubscribed(java.util.Date subscribedFrom, java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of unsubscribed subscribers who have unsubscribed from the list since the provided date.
 PagedResult<Subscriber> unsubscribed(java.lang.Integer page, java.lang.Integer pageSize, java.lang.String orderField, java.lang.String orderDirection)
          Gets a paged collection of unsubscribed subscribers who have unsubscribed from the list.
 void update(ListForUpdate list)
          Updates the basic list details for an existing subscriber list
 java.lang.String updateCustomField(java.lang.String fieldKey, CustomFieldForUpdate customField)
          Updates a new custom field.
 void updateCustomFieldOptions(java.lang.String fieldKey, UpdateFieldOptions options)
          Updates the available options for a Multi-Valued custom field.
 Webhook[] webhooks()
          Gets all webhooks which have been attached to events on the specified list
 
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

Lists

public Lists(AuthenticationDetails auth)
Constructor used to create new lists.

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

Lists

public Lists(AuthenticationDetails auth,
             java.lang.String listID)
Constructor for working with existing lists.

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.

create

public java.lang.String create(java.lang.String clientID,
                               List list)
                        throws CreateSendException
Creates a new empty subscriber list. After a successful call, the current list id property will be set the ID of the newly created list.

Parameters:
clientID - The ID of the client owning the new list
list - The details of the new list
Returns:
The ID of the newly created list
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Creating a list

update

public void update(ListForUpdate list)
            throws CreateSendException
Updates the basic list details for an existing subscriber list

Parameters:
list - The new basic details for the list
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Updating a list

delete

public void delete()
            throws CreateSendException
Deletes the list with the specified ID

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

details

public List details()
             throws CreateSendException
Gets the details of the list with the given ID

Returns:
The details of the list with the given ID
Throws:
CreateSendException - Raised when the API returns a HTTP Status >= 400
See Also:
Getting list details

stats

public Statistics stats()
                 throws CreateSendException
Gets subscriber statistics for the list with the specified ID

Returns:
Subscriber statistics for the list with the specified ID
Throws:
CreateSendException - Raised when the API responds with HTTP status >= 400
See Also:
Getting list stats

customFields

public CustomField[] customFields()
                           throws CreateSendException
Gets the custom fields available for the list with the specified ID

Returns:
The custom fields available for the specified list
Throws:
CreateSendException - Raised when the API responds with HTTP Status >= 400
See Also:
Getting list custom fields

segments

public Segment[] segments()
                   throws CreateSendException
Gets the segments available in the list with the specified ID

Returns:
The segments available in the specified list
Throws:
CreateSendException - Raised when the API responds with HTTP Status >= 400
See Also:
Getting list segments

active

public PagedResult<Subscriber> active()
                               throws CreateSendException
Gets a paged collection of active subscribers who have subscribed to the list.

Returns:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting active subscribers

active

public PagedResult<Subscriber> active(java.lang.Integer page,
                                      java.lang.Integer pageSize,
                                      java.lang.String orderField,
                                      java.lang.String orderDirection)
                               throws CreateSendException
Gets a paged collection of active subscribers who have subscribed to the list.

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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting active subscribers

active

public PagedResult<Subscriber> active(java.util.Date subscribedFrom,
                                      java.lang.Integer page,
                                      java.lang.Integer pageSize,
                                      java.lang.String orderField,
                                      java.lang.String orderDirection)
                               throws CreateSendException
Gets a paged collection of active subscribers who have subscribed to the list since the provided date.

Parameters:
subscribedFrom - The API will only return subscribers who became active on or after this date. This field is required
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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting active subscribers

unconfirmed

public PagedResult<Subscriber> unconfirmed()
                                    throws CreateSendException
Gets a paged collection of unconfirmed subscribers who have subscribed to the list.

Returns:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting active subscribers

unconfirmed

public PagedResult<Subscriber> unconfirmed(java.lang.Integer page,
                                           java.lang.Integer pageSize,
                                           java.lang.String orderField,
                                           java.lang.String orderDirection)
                                    throws CreateSendException
Gets a paged collection of unconfirmed subscribers who have subscribed to the list.

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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting active subscribers

unconfirmed

public PagedResult<Subscriber> unconfirmed(java.util.Date subscribedFrom,
                                           java.lang.Integer page,
                                           java.lang.Integer pageSize,
                                           java.lang.String orderField,
                                           java.lang.String orderDirection)
                                    throws CreateSendException
Gets a paged collection of unconfirmed subscribers who have subscribed to the list since the provided date.

Parameters:
subscribedFrom - The API will only return subscribers who subscribed on or after this date. This field is required
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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting active subscribers

unsubscribed

public PagedResult<Subscriber> unsubscribed()
                                     throws CreateSendException
Gets a paged collection of unsubscribed subscribers who have unsubscribed from the list.

Returns:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting unsubscribed subscribers

unsubscribed

public PagedResult<Subscriber> unsubscribed(java.lang.Integer page,
                                            java.lang.Integer pageSize,
                                            java.lang.String orderField,
                                            java.lang.String orderDirection)
                                     throws CreateSendException
Gets a paged collection of unsubscribed subscribers who have unsubscribed from the list.

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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting unsubscribed subscribers

unsubscribed

public PagedResult<Subscriber> unsubscribed(java.util.Date subscribedFrom,
                                            java.lang.Integer page,
                                            java.lang.Integer pageSize,
                                            java.lang.String orderField,
                                            java.lang.String orderDirection)
                                     throws CreateSendException
Gets a paged collection of unsubscribed subscribers who have unsubscribed from the list since the provided date.

Parameters:
subscribedFrom - The API will only return subscribers who unsubscribed on or after this date.
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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting unsubscribed subscribers

deleted

public PagedResult<Subscriber> deleted()
                                throws CreateSendException
Gets a paged collection of subscribers who have been deleted from the list.

Returns:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting deleted subscribers

deleted

public PagedResult<Subscriber> deleted(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 have been deleted from the list.

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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting deleted subscribers

deleted

public PagedResult<Subscriber> deleted(java.util.Date subscribedFrom,
                                       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 have been deleted from the list since the provided date.

Parameters:
subscribedFrom - The API will only return subscribers who were deleted on or after this date.
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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting deleted subscribers

bounced

public PagedResult<Subscriber> bounced()
                                throws CreateSendException
Gets a paged collection of bounced subscribers who have bounced out of the list.

Returns:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting bounced subscribers

bounced

public PagedResult<Subscriber> bounced(java.lang.Integer page,
                                       java.lang.Integer pageSize,
                                       java.lang.String orderField,
                                       java.lang.String orderDirection)
                                throws CreateSendException
Gets a paged collection of bounced subscribers who have bounced out of the list.

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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting bounced subscribers

bounced

public PagedResult<Subscriber> bounced(java.util.Date subscribedFrom,
                                       java.lang.Integer page,
                                       java.lang.Integer pageSize,
                                       java.lang.String orderField,
                                       java.lang.String orderDirection)
                                throws CreateSendException
Gets a paged collection of bounced subscribers who have bounced out of the list since the provided date.

Parameters:
subscribedFrom - The API will only return subscribers who bounced out on or after this date.
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:
The paged subscribers returned by the api call.
Throws:
CreateSendException - Thrown when the API responds with a HTTP Status >= 400
See Also:
Getting bounced subscribers

createCustomField

public java.lang.String createCustomField(CustomFieldForCreate customField)
                                   throws CreateSendException
Creates a new custom field with the specified data

Parameters:
customField - The custom field options
Returns:
The Key of the newly created custom field
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Creating a custom field

updateCustomField

public java.lang.String updateCustomField(java.lang.String fieldKey,
                                          CustomFieldForUpdate customField)
                                   throws CreateSendException
Updates a new custom field.

Parameters:
fieldKey - The Key of the custom field to update. This must be surrounded by [].
customField - The custom field options
Returns:
The Key of the updated custom field
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Creating a custom field

updateCustomFieldOptions

public void updateCustomFieldOptions(java.lang.String fieldKey,
                                     UpdateFieldOptions options)
                              throws CreateSendException
Updates the available options for a Multi-Valued custom field.

Parameters:
fieldKey - The Key of the custom field to update. This must be surrounded by [].
options - The new options to use for the field.
Throws:
CreateSendException - Raised when the API responds with HTTP Status >= 400
See Also:
Updating custom field options

deleteCustomField

public void deleteCustomField(java.lang.String fieldKey)
                       throws CreateSendException
Deletes the custom field with the specified key

Parameters:
fieldKey - The Key of the custom field to delete. This must be surrounded by [].
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Deleting a custom field

webhooks

public Webhook[] webhooks()
                   throws CreateSendException
Gets all webhooks which have been attached to events on the specified list

Returns:
The webhooks which have been attached to events for the specified list
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Getting list webhooks

createWebhook

public java.lang.String createWebhook(Webhook webhook)
                               throws CreateSendException
Creates a new webhook on the specified list.

Parameters:
webhook - The webhook details
Returns:
The ID of the newly created webhook
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Creating a webhook

testWebhook

public void testWebhook(java.lang.String webhookID)
                 throws CreateSendException
Tests the specified webhook

Parameters:
webhookID - The ID of the webhook
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400. I.e the test fails
See Also:
Testing a webhook

deleteWebhook

public void deleteWebhook(java.lang.String webhookID)
                   throws CreateSendException
Deletes the specified webhook

Parameters:
webhookID - The ID of the webhook to delete
Throws:
CreateSendException - Raised when the API responds with HTTP Status >= 400
See Also:
Deleting a webhook

activateWebhook

public void activateWebhook(java.lang.String webhookID)
                     throws CreateSendException
Activates the specified webhook.

Parameters:
webhookID - The ID of the webhook to activate
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Activating a webhook

deactivateWebhook

public void deactivateWebhook(java.lang.String webhookID)
                       throws CreateSendException
Deactivates the specified webhook.

Parameters:
webhookID - The ID of the webhook to deactivate
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Activating a webhook