com.createsend
Class Templates

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

public class Templates
extends CreateSendBase

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


Field Summary
 
Fields inherited from class com.createsend.CreateSendBase
jerseyClient, urlEncodingScheme
 
Constructor Summary
Templates(AuthenticationDetails auth)
          Constructor used to create new templates.
Templates(AuthenticationDetails auth, java.lang.String templateID)
          Constructor for working with existing templates.
 
Method Summary
 java.lang.String create(java.lang.String clientID, TemplateForCreate template)
          Creates a new template for the specified client.
 void delete()
          Deletes the template with the current ID
 TemplateDetails get()
          Gets the details of the current template
 java.lang.String getTemplateID()
          Gets the current template ID.
 void setTemplateID(java.lang.String templateID)
          Sets the ID of the template to apply API calls to.
 void update(TemplateForCreate template)
          Updates a template with the specified details
 
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

Templates

public Templates(AuthenticationDetails auth)
Constructor used to create new templates.

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

Templates

public Templates(AuthenticationDetails auth,
                 java.lang.String templateID)
Constructor for working with existing templates.

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

getTemplateID

public java.lang.String getTemplateID()
Gets the current template ID.

Returns:
The current template ID.

setTemplateID

public void setTemplateID(java.lang.String templateID)
Sets the ID of the template to apply API calls to.

Parameters:
templateID - The ID of the template to apply API calls to.

create

public java.lang.String create(java.lang.String clientID,
                               TemplateForCreate template)
                        throws CreateSendException
Creates a new template for the specified client. After a successful call, this method sets the current template ID to that of the newly created template.

Parameters:
clientID - The ID of the client to create the template for.
template - The template details.
Returns:
The ID of the newly created template
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Creating a template

get

public TemplateDetails get()
                    throws CreateSendException
Gets the details of the current template

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

update

public void update(TemplateForCreate template)
            throws CreateSendException
Updates a template with the specified details

Parameters:
template - The template details to use
Throws:
CreateSendException - Thrown when the API responds with HTTP Status >= 400
See Also:
Updating a template

delete

public void delete()
            throws CreateSendException
Deletes the template with the current ID

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