com.mailgun.api.v3.MailgunTemplatesApi Maven / Gradle / Ivy
Show all versions of mailgun-java Show documentation
package com.mailgun.api.v3;
import com.mailgun.api.MailgunApi;
import com.mailgun.model.PagingWithPivot;
import com.mailgun.model.ResponseWithMessage;
import com.mailgun.model.templates.TemplateAllVersionsResponse;
import com.mailgun.model.templates.TemplateRequest;
import com.mailgun.model.templates.TemplateResponse;
import com.mailgun.model.templates.TemplateStatusResponse;
import com.mailgun.model.templates.TemplateVersionRequest;
import com.mailgun.model.templates.TemplateVersionResponse;
import com.mailgun.model.templates.TemplateWithMessageResponse;
import com.mailgun.model.templates.TemplateWithVersionResponse;
import com.mailgun.model.templates.TemplatesResult;
import com.mailgun.model.templates.UpdateTemplateVersionRequest;
import feign.Headers;
import feign.Param;
import feign.QueryMap;
import feign.RequestLine;
import feign.Response;
/**
*
* Templates Api.
*
*
* This API allows you to store predefined templates and use them to send messages using the Sending API.
*
*
* The API has the following limitations:
*
*
* 100 templates per domain
* 10 versions per template
* 100Kb max template size
*
*
* @see Templates
*/
@Headers("Accept: application/json")
public interface MailgunTemplatesApi extends MailgunApi {
/**
*
* Returns a list of stored templates for the domain (limit to 10 entries).
*
*
* @param domain Name of the domain
* @return {@link TemplatesResult}
*/
@RequestLine("GET /{domain}/templates")
TemplatesResult getAllTemplates(@Param("domain") String domain);
/**
*
* Returns a list of stored templates for the domain (limit to 10 entries).
*
*
* @param domain Name of the domain
* @return {@link Response}
*/
@RequestLine("GET /{domain}/templates")
Response getAllTemplatesFeignResponse(@Param("domain") String domain);
/**
*
* Returns a list of stored templates for the domain with paging.
*
*
* @param domain Name of the domain
* @param queryOptions {@link PagingWithPivot}
* @return {@link TemplatesResult}
*/
@RequestLine("GET /{domain}/templates")
TemplatesResult getAllTemplates(@Param("domain") String domain, @QueryMap PagingWithPivot queryOptions);
/**
*
* Returns a list of stored templates for the domain with paging.
*
*
* @param domain Name of the domain
* @param queryOptions {@link PagingWithPivot}
* @return {@link Response}
*/
@RequestLine("GET /{domain}/templates")
Response getAllTemplatesFeignResponse(@Param("domain") String domain, @QueryMap PagingWithPivot queryOptions);
/**
*
* Returns metadata information about a stored template.
*
*
* @param domain Name of the domain
* @param name Name of the template
* @return {@link TemplateResponse}
*/
@RequestLine("GET /{domain}/templates/{name}")
TemplateResponse getTemplate(@Param("domain") String domain, @Param("name") String name);
/**
*
* Returns metadata information about a stored template.
*
*
* @param domain Name of the domain
* @param name Name of the template
* @return {@link Response}
*/
@RequestLine("GET /{domain}/templates/{name}")
Response getTemplateFeignResponse(@Param("domain") String domain, @Param("name") String name);
/**
*
* Returns the content of the active version of the template with metadata information.
*
*
* @param domain Name of the domain
* @param name Name of the template
* @return {@link TemplateWithVersionResponse}
*/
@RequestLine("GET /{domain}/templates/{name}?active=yes")
TemplateWithVersionResponse getActiveTemplateVersionContent(@Param("domain") String domain, @Param("name") String name);
/**
*
* Returns the content of the active version of the template with metadata information.
*
*
* @param domain Name of the domain
* @param name Name of the template
* @return {@link Response}
*/
@RequestLine("GET /{domain}/templates/{name}?active=yes")
Response getActiveTemplateVersionContentFeignResponse(@Param("domain") String domain, @Param("name") String name);
/**
*
* This API stores a new template, including its name, description and (optionally) the template content.
*
*
* If the template content is provided, a new version is automatically created and becomes the active version.
*
*
* @param domain Name of the domain
* @param request {@link TemplateRequest}
* @return {@link TemplateWithMessageResponse}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/templates")
TemplateWithMessageResponse storeNewTemplate(@Param("domain") String domain, TemplateRequest request);
/**
*
* This API stores a new template, including its name, description and (optionally) the template content.
*
*
* If the template content is provided, a new version is automatically created and becomes the active version.
*
*
* @param domain Name of the domain
* @param request {@link TemplateRequest}
* @return {@link Response}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/templates")
Response storeNewTemplateFeignResponse(@Param("domain") String domain, TemplateRequest request);
/**
*
* Update the metadata information of the template.
*
*
* @param domain Name of the domain
* @param name Name of the template
* @param description Updated description of the template
* @return {@link TemplateStatusResponse}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("PUT /{domain}/templates/{name}")
TemplateStatusResponse updateTemplate(@Param("domain") String domain, @Param("name") String name, @Param("description") String description);
/**
*
* Update the metadata information of the template.
*
*
* @param domain Name of the domain
* @param name Name of the template
* @param description Updated description of the template
* @return {@link Response}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("PUT /{domain}/templates/{name}")
Response updateTemplateFeignResponse(@Param("domain") String domain, @Param("name") String name, @Param("description") String description);
/**
*
* Delete the template.
*
* NOTE: This method deletes all versions of the specified template.
*
* @param domain Name of the domain
* @param name Name of the template
* @return {@link TemplateStatusResponse}
*/
@RequestLine("DELETE /{domain}/templates/{name}")
TemplateStatusResponse deleteTemplate(@Param("domain") String domain, @Param("name") String name);
/**
*
* Delete the template.
*
* NOTE: This method deletes all versions of the specified template.
*
* @param domain Name of the domain
* @param name Name of the template
* @return {@link Response}
*/
@RequestLine("DELETE /{domain}/templates/{name}")
Response deleteTemplateFeignResponse(@Param("domain") String domain, @Param("name") String name);
/**
*
* Delete all stored templates for the domain.
*
*
* @param domain Name of the domain
* @return {@link ResponseWithMessage}
*/
@RequestLine("DELETE /{domain}/templates")
ResponseWithMessage deleteAllTemplatesInDomain(@Param("domain") String domain);
/**
*
* Delete all stored templates for the domain.
*
*
* @param domain Name of the domain
* @return {@link Response}
*/
@RequestLine("DELETE /{domain}/templates")
Response deleteAllTemplatesInDomainFeignResponse(@Param("domain") String domain);
/**
*
* Returns a list of stored versions of the template (limit to 10 entries).
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @return {@link TemplateAllVersionsResponse}
*/
@RequestLine("GET /{domain}/templates/{templateName}/versions")
TemplateAllVersionsResponse getAllTemplateVersions(@Param("domain") String domain, @Param("templateName") String templateName);
/**
*
* Returns a list of stored versions of the template (limit to 10 entries).
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @return {@link Response}
*/
@RequestLine("GET /{domain}/templates/{templateName}/versions")
Response getAllTemplateVersionsFeignResponse(@Param("domain") String domain, @Param("templateName") String templateName);
/**
*
* Returns a list of stored versions of the template.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param queryOptions {@link PagingWithPivot}
* @return {@link TemplateAllVersionsResponse}
*/
@RequestLine("GET /{domain}/templates/{templateName}/versions")
TemplateAllVersionsResponse getAllTemplateVersions(@Param("domain") String domain, @Param("templateName") String templateName, @QueryMap PagingWithPivot queryOptions);
/**
*
* Returns a list of stored versions of the template.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param queryOptions {@link PagingWithPivot}
* @return {@link Response}
*/
@RequestLine("GET /{domain}/templates/{templateName}/versions")
Response getAllTemplateVersionsFeignResponse(@Param("domain") String domain, @Param("templateName") String templateName, @QueryMap PagingWithPivot queryOptions);
/**
*
* Retrieve information and content of specified version of the template.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param tag Tag of the template version
* @return {@link TemplateWithVersionResponse}
*/
@RequestLine("GET /{domain}/templates/{templateName}/versions/{tag}")
TemplateWithVersionResponse getSpecifiedVersionTemplateContent(@Param("domain") String domain, @Param("templateName") String templateName, @Param("tag") String tag);
/**
*
* Retrieve information and content of specified version of the template.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param tag Tag of the template version
* @return {@link Response}
*/
@RequestLine("GET /{domain}/templates/{templateName}/versions/{tag}")
Response getSpecifiedVersionTemplateContentFeignResponse(@Param("domain") String domain, @Param("templateName") String templateName, @Param("tag") String tag);
/**
*
* Create a new version of a template. If the template does not contain any other versions, the first version becomes active.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param request {@link TemplateVersionRequest}
* @return {@link TemplateWithMessageResponse}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/templates/{templateName}/versions")
TemplateWithMessageResponse createNewTemplateVersion(@Param("domain") String domain, @Param("templateName") String templateName, TemplateVersionRequest request);
/**
*
* Create a new version of a template. If the template does not contain any other versions, the first version becomes active.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param request {@link TemplateVersionRequest}
* @return {@link Response}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("POST /{domain}/templates/{templateName}/versions")
Response createNewTemplateVersionFeignResponse(@Param("domain") String domain, @Param("templateName") String templateName, TemplateVersionRequest request);
/**
*
* Update information or content of the specific version of the template.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param tag Tag of the template version
* @param request {@link UpdateTemplateVersionRequest}
* @return {@link TemplateVersionResponse}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("PUT /{domain}/templates/{templateName}/versions/{tag}")
TemplateVersionResponse updateSpecificTemplateVersion(@Param("domain") String domain, @Param("templateName") String templateName,
@Param("tag") String tag, UpdateTemplateVersionRequest request);
/**
*
* Update information or content of the specific version of the template.
*
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param tag Tag of the template version
* @param request {@link UpdateTemplateVersionRequest}
* @return {@link Response}
*/
@Headers("Content-Type: multipart/form-data")
@RequestLine("PUT /{domain}/templates/{templateName}/versions/{tag}")
Response updateSpecificTemplateVersionFeignResponse(@Param("domain") String domain, @Param("templateName") String templateName,
@Param("tag") String tag, UpdateTemplateVersionRequest request);
/**
* Delete a specific version of the template.
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param templateVersion Template version tag
* @return {@link TemplateVersionResponse}
*/
@RequestLine("DELETE /{domain}/templates/{templateName}/versions/{templateVersion}")
TemplateVersionResponse deleteSpecificTemplateVersion(@Param("domain") String domain, @Param("templateName") String templateName, @Param("templateVersion") String templateVersion);
/**
* Delete a specific version of the template.
*
* @param domain Name of the domain
* @param templateName Name of the template
* @param templateVersion Template version tag
* @return {@link Response}
*/
@RequestLine("DELETE /{domain}/templates/{templateName}/versions/{templateVersion}")
Response deleteSpecificTemplateVersionFeignResponse(@Param("domain") String domain, @Param("templateName") String templateName, @Param("templateVersion") String templateVersion);
}