Exemple #1
0
  /**
   * Gets a paged collection of bounced subscribers who have bounced out of the list since the
   * provided date.
   *
   * @param subscribedFrom The API will only return subscribers who bounced out on or after this
   *     date. This field is required
   * @param page The page number or results to get. Use <code>null</code> for the default (page=1)
   * @param pageSize The number of records to get on the current page. Use <code>null</code> for the
   *     default.
   * @param orderField The field used to order the results by. Use <code>null</code> for the
   *     default.
   * @param orderDirection The direction to order the results by. Use <code>null</code> for the
   *     default.
   * @return The paged subscribers returned by the api call.
   * @throws CreateSendException Thrown when the API responds with a HTTP Status >= 400
   * @see <a href="http://www.campaignmonitor.com/api/lists/#getting_bounced_subscribers"
   *     target="_blank"> Getting bounced subscribers</a>
   */
  public PagedResult<Subscriber> bounced(
      Date subscribedFrom, Integer page, Integer pageSize, String orderField, String orderDirection)
      throws CreateSendException {
    MultivaluedMap<String, String> queryString = new MultivaluedMapImpl();
    queryString.add("date", JsonProvider.ApiDateFormat.format(subscribedFrom));

    return client.getPagedResult(
        page, pageSize, orderField, orderDirection, queryString, "lists", listID, "bounced.json");
  }
Exemple #2
0
 /**
  * Tests the specified webhook
  *
  * @param webhookID The ID of the webhook
  * @throws CreateSendException Thrown when the API responds with HTTP Status >= 400. I.e the test
  *     fails
  * @see <a href="http://www.campaignmonitor.com/api/lists/#testing_a_webhook" target="_blank">
  *     Testing a webhook</a>
  */
 public void testWebhook(String webhookID) throws CreateSendException {
   client.get(
       String.class,
       new ErrorDeserialiser<WebhookTestFailureDetails>(),
       "lists",
       listID,
       "webhooks",
       webhookID,
       "test.json");
 }
Exemple #3
0
 /**
  * Deactivates the specified webhook.
  *
  * @param webhookID The ID of the webhook to deactivate
  * @throws CreateSendException Thrown when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#deactivating_a_webhook"
  *     target="_blank"> Activating a webhook</a>
  */
 public void deactivateWebhook(String webhookID) throws CreateSendException {
   client.put("", "lists", listID, "webhooks", webhookID, "activate.json");
 }
Exemple #4
0
 /**
  * Deletes the specified webhook
  *
  * @param webhookID The ID of the webhook to delete
  * @throws CreateSendException Raised when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#deleting_a_webhook" target="_blank">
  *     Deleting a webhook</a>
  */
 public void deleteWebhook(String webhookID) throws CreateSendException {
   client.delete("lists", listID, "webhooks", webhookID + ".json");
 }
Exemple #5
0
 /**
  * Creates a new webhook on the specified list.
  *
  * @param webhook The webhook details
  * @return The ID of the newly created webhook
  * @throws CreateSendException Thrown when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#creating_a_webhook" target="_blank">
  *     Creating a webhook</a>
  */
 public String createWebhook(Webhook webhook) throws CreateSendException {
   return client.post(String.class, webhook, "lists", listID, "webhooks.json");
 }
Exemple #6
0
 /**
  * Gets all webhooks which have been attached to events on the specified list
  *
  * @return The webhooks which have been attached to events for the specified list
  * @throws CreateSendException Thrown when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#getting_list_webhooks" target="_blank">
  *     Getting list webhooks</a>
  */
 public Webhook[] webhooks() throws CreateSendException {
   return client.get(Webhook[].class, "lists", listID, "webhooks.json");
 }
Exemple #7
0
 /**
  * Deletes the custom field with the specified key
  *
  * @param fieldKey The <em>Key</em> of the custom field to delete. This must be surrounded by [].
  * @throws CreateSendException Thrown when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#deleting_a_custom_field"
  *     target="_blank"> Deleting a custom field</a>
  */
 public void deleteCustomField(String fieldKey) throws CreateSendException {
   client.delete("lists", listID, "customFields", fieldKey + ".json");
 }
Exemple #8
0
 /**
  * Updates the available options for a Multi-Valued custom field.
  *
  * @param fieldKey The <em>Key</em> of the custom field to update. This must be surrounded by [].
  * @param options The new options to use for the field.
  * @throws CreateSendException Raised when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#updating_custom_field_options"
  *     target="_blank"> Updating custom field options</a>
  */
 public void updateCustomFieldOptions(String fieldKey, UpdateFieldOptions options)
     throws CreateSendException {
   client.put(options, "lists", listID, "customFields", fieldKey, "options.json");
 }
Exemple #9
0
 /**
  * Creates a new custom field with the specified data
  *
  * @param customField The custom field options
  * @return The Key of the newly created custom field
  * @throws CreateSendException Thrown when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#creating_a_custom_field"
  *     target="_blank"> Creating a custom field</a>
  */
 public String createCustomField(CustomFieldForCreate customField) throws CreateSendException {
   return client.post(String.class, customField, "lists", listID, "customfields.json");
 }
Exemple #10
0
 /**
  * Gets the custom fields available for the list with the specified ID
  *
  * @return The custom fields available for the specified list
  * @throws CreateSendException Raised when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#getting_list_custom_fields"
  *     target="_blank"> Getting list custom fields</a>
  */
 public CustomField[] customFields() throws CreateSendException {
   return client.get(CustomField[].class, "lists", listID, "customfields.json");
 }
Exemple #11
0
 /**
  * Gets the segments available in the list with the specified ID
  *
  * @return The segments available in the specified list
  * @throws CreateSendException Raised when the API responds with HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#getting_list_segments" target="_blank">
  *     Getting list segments</a>
  */
 public Segment[] segments() throws CreateSendException {
   return client.get(Segment[].class, "lists", listID, "segments.json");
 }
Exemple #12
0
 /**
  * Gets subscriber statistics for the list with the specified ID
  *
  * @return Subscriber statistics for the list with the specified ID
  * @throws CreateSendException Raised when the API responds with HTTP status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#getting_list_stats" target="_blank">
  *     Getting list stats</a>
  */
 public Statistics stats() throws CreateSendException {
   return client.get(Statistics.class, "lists", listID, "stats.json");
 }
Exemple #13
0
 /**
  * Gets the details of the list with the given ID
  *
  * @return The details of the list with the given ID
  * @throws CreateSendException Raised when the API returns a HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#getting_list_details" target="_blank">
  *     Getting list details</a>
  */
 public List details() throws CreateSendException {
   return client.get(List.class, "lists", listID + ".json");
 }
Exemple #14
0
 /**
  * Deletes the list with the specified ID
  *
  * @throws CreateSendException Thrown when the API responds with a HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#deleting_a_list" target="_blank">
  *     Deleting a list</a>
  */
 public void delete() throws CreateSendException {
   client.delete("lists", listID + ".json");
 }
Exemple #15
0
 /**
  * Updates the basic list details for an existing subscriber list
  *
  * @param list The new basic details for the list
  * @throws CreateSendException Thrown when the API responds with a HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#updating_a_list" target="_blank">
  *     Updating a list</a>
  */
 public void update(List list) throws CreateSendException {
   client.put(list, "lists", listID + ".json");
 }
Exemple #16
0
 /**
  * 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.
  *
  * @param clientID The ID of the client owning the new list
  * @param list The details of the new list
  * @return The ID of the newly created list
  * @throws CreateSendException Thrown when the API responds with a HTTP Status >= 400
  * @see <a href="http://www.campaignmonitor.com/api/lists/#creating_a_list" target="_blank">
  *     Creating a list</a>
  */
 public String create(String clientID, List list) throws CreateSendException {
   listID = client.post(String.class, list, "lists", clientID + ".json");
   return listID;
 }