From 6df089f88601c9d650e2f628dd8f7a0dd881d854 Mon Sep 17 00:00:00 2001 From: rushannanayakkara Date: Thu, 26 Sep 2024 22:46:59 +0530 Subject: [PATCH] Add system template endpoints --- .../pom.xml | 2 +- .../template/common/Constants.java | 13 +- .../pom.xml | 2 +- .../template/v1/NotificationApi.java | 152 +++++++++++------ .../template/v1/NotificationApiService.java | 4 + ...atesService.java => TemplatesService.java} | 56 +++++- .../v1/impl/NotificationApiServiceImpl.java | 56 +++--- .../notification-template-server-v1-cxf.xml | 2 +- .../main/resources/notification-template.yml | 159 ++++++++++++------ .../pom.xml | 2 +- pom.xml | 4 +- 11 files changed, 320 insertions(+), 132 deletions(-) rename components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/core/{ApplicationTemplatesService.java => TemplatesService.java} (88%) diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/pom.xml b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/pom.xml index 41f71c6d5b..cd555002d7 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.notification.template - 1.2.196-SNAPSHOT + 1.2.228-SNAPSHOT ../pom.xml diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/src/main/java/org/wso2/carbon/identity/api/server/notification/template/common/Constants.java b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/src/main/java/org/wso2/carbon/identity/api/server/notification/template/common/Constants.java index 11c15e7a9e..03d5206389 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/src/main/java/org/wso2/carbon/identity/api/server/notification/template/common/Constants.java +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.api.server.notification.template.common/src/main/java/org/wso2/carbon/identity/api/server/notification/template/common/Constants.java @@ -18,6 +18,8 @@ package org.wso2.carbon.identity.api.server.notification.template.common; +import org.wso2.carbon.email.mgt.constants.TemplateMgtConstants; + import java.util.HashMap; import java.util.Map; import javax.ws.rs.core.Response.Status; @@ -42,8 +44,8 @@ public class Constants { public static final String APP_TEMPLATES_PATH = "/app-templates"; public static final String ORG_TEMPLATES_PATH = "/org-templates"; public static final String PATH_SEPARATOR = "/"; - public static final String NOTIFICATION_CHANNEL_EMAIL = "email"; - public static final String NOTIFICATION_CHANNEL_SMS = "sms"; + public static final String NOTIFICATION_CHANNEL_EMAIL = "EMAIL"; + public static final String NOTIFICATION_CHANNEL_SMS = "SMS"; // ERROR MESSAGES private static final Map NTM_ERROR_CODE_MAP = new HashMap<>(); @@ -94,7 +96,10 @@ public enum ErrorMessage { "Server encountered an error while deleting the email template."), ERROR_ERROR_DELETING_SMS_TEMPLATE("60010", Status.INTERNAL_SERVER_ERROR, "Unable to delete the SMS template.", - "Server encountered an error while deleting the SMS template."); + "Server encountered an error while deleting the SMS template."), + ERROR_SYSTEM_RESOURCE_DELETION_NOT_ALLOWED("60011", Status.FORBIDDEN, + "System resource deletion not allowed.", + "System resources are not eligible for deletion."); private final String message; private final Status httpStatus; @@ -143,6 +148,8 @@ public String toString() { NTM_ERROR_CODE_MAP.put(TEMPLATE_NOT_FOUND, ErrorMessage.ERROR_TEMPLATE_NOT_FOUND); NTM_ERROR_CODE_MAP.put(ERROR_ADDING_TEMPLATE, ErrorMessage.ERROR_ERROR_ADDING_TEMPLATE); NTM_ERROR_CODE_MAP.put(ERROR_UPDATING_TEMPLATE, ErrorMessage.ERROR_ERROR_UPDATING_TEMPLATE); + NTM_ERROR_CODE_MAP.put(TemplateMgtConstants.ErrorCodes.ERROR_SYSTEM_RESOURCE_DELETION_NOT_ALLOWED, + ErrorMessage.ERROR_SYSTEM_RESOURCE_DELETION_NOT_ALLOWED); } public static ErrorMessage getNTMMappedErrorMessage(String errorCode) { diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/pom.xml index 0e5584f085..20d6e6a438 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.notification.template - 1.2.196-SNAPSHOT + 1.2.228-SNAPSHOT 4.0.0 diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApi.java b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApi.java index 96bcbbcda0..56fdf11b26 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApi.java +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApi.java @@ -54,7 +54,7 @@ public class NotificationApi { @Path("/email/template-types/{template-type-id}/app-templates/{app-uuid}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Adds a new application email template to an existing email template type.", notes = "Another application email template with the same locale should not already exist in the respective email template type.
Scopes required:
* internal_email_mgt_create ", response = SimpleTemplate.class, authorizations = { + @ApiOperation(value = "Adds a new application email template to an existing email template type.", notes = "Another application email template with the same locale should not already exist in the respective email template type.
Scope required:
* internal_notification_email_mgt_create ", response = SimpleTemplate.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -69,7 +69,7 @@ public class NotificationApi { @ApiResponse(code = 409, message = "Item Already Exists.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response addAppEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "Email template to be added." ) @Valid EmailTemplateWithID emailTemplateWithID) { + public Response addAppEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "Email template to be added." ) @Valid EmailTemplateWithID emailTemplateWithID) { return delegate.addAppEmailTemplate(templateTypeId, appUuid, emailTemplateWithID ); } @@ -79,7 +79,7 @@ public Response addAppEmailTemplate(@ApiParam(value = "Email Template Type ID.", @Path("/sms/template-types/{template-type-id}/app-templates/{app-uuid}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Adds a new application SMS template to an existing SMS template type.", notes = "Another application SMS template with the same locale should not already exist in the respective SMS template type.
Scopes required:
* internal_sms_mgt_create ", response = SimpleTemplate.class, authorizations = { + @ApiOperation(value = "Adds a new application SMS template to an existing SMS template type.", notes = "Another application SMS template with the same locale should not already exist in the respective SMS template type.
Scope required:
* internal_notification_sms_mgt_create ", response = SimpleTemplate.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -94,7 +94,7 @@ public Response addAppEmailTemplate(@ApiParam(value = "Email Template Type ID.", @ApiResponse(code = 409, message = "Item Already Exists.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response addAppSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "SMS template to be added." ) @Valid SMSTemplateWithID smSTemplateWithID) { + public Response addAppSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "SMS template to be added." ) @Valid SMSTemplateWithID smSTemplateWithID) { return delegate.addAppSMSTemplate(templateTypeId, appUuid, smSTemplateWithID ); } @@ -104,7 +104,7 @@ public Response addAppSMSTemplate(@ApiParam(value = "Email Template Type ID.",re @Path("/email/template-types") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Adds a new email template type.", notes = "Adds a new email template type to the system. An email template type can have any number of organization or application email templates.
* Attribute _**displayName**_ of the template type should be unique.
Scopes required:
* internal_email_mgt_create ", response = TemplateTypeWithID.class, authorizations = { + @ApiOperation(value = "Adds a new email template type.", notes = "Adds a new email template type to the system. An email template type can have any number of organization or application email templates.
* Attribute _**displayName**_ of the template type should be unique.
Scope required:
* internal_notification_email_mgt_create ", response = TemplateTypeWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -128,7 +128,7 @@ public Response addEmailTemplateType(@ApiParam(value = "Email template type to b @Path("/email/template-types/{template-type-id}/org-templates") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Adds a new email template to an existing email template type.", notes = "Another email template with the same locale should not already exist in the respective email template type.
Scopes required:
* internal_email_mgt_create ", response = SimpleTemplate.class, authorizations = { + @ApiOperation(value = "Adds a new email template to an existing email template type.", notes = "Another email template with the same locale should not already exist in the respective email template type.
Scope required:
* internal_notification_email_mgt_create ", response = SimpleTemplate.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -143,7 +143,7 @@ public Response addEmailTemplateType(@ApiParam(value = "Email template type to b @ApiResponse(code = 409, message = "Item Already Exists.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response addOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Email template to be added." ) @Valid EmailTemplateWithID emailTemplateWithID) { + public Response addOrgEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Email template to be added." ) @Valid EmailTemplateWithID emailTemplateWithID) { return delegate.addOrgEmailTemplate(templateTypeId, emailTemplateWithID ); } @@ -153,7 +153,7 @@ public Response addOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.", @Path("/sms/template-types/{template-type-id}/org-templates") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Adds a new organization SMS template to an existing SMS template type.", notes = "Another SMS organization template with the same locale should not already exist in the respective SMS template type.
Scopes required:
* internal_sms_mgt_create ", response = SimpleTemplate.class, authorizations = { + @ApiOperation(value = "Adds a new organization SMS template to an existing SMS template type.", notes = "Another SMS organization template with the same locale should not already exist in the respective SMS template type.
Scope required:
* internal_notification_sms_mgt_create ", response = SimpleTemplate.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -168,7 +168,7 @@ public Response addOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.", @ApiResponse(code = 409, message = "Item Already Exists.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response addOrgSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "SMS template to be added." ) @Valid SMSTemplateWithID smSTemplateWithID) { + public Response addOrgSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "SMS template to be added." ) @Valid SMSTemplateWithID smSTemplateWithID) { return delegate.addOrgSMSTemplate(templateTypeId, smSTemplateWithID ); } @@ -178,7 +178,7 @@ public Response addOrgSMSTemplate(@ApiParam(value = "Email Template Type ID.",re @Path("/sms/template-types") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Adds a new SMS template type.", notes = "Adds a new SMS template type to the system. An SMS template type can have any number of organization or application SMS templates.
* Attribute _**displayName**_ of the template type should be unique.
Scopes required:
* internal_sms_mgt_create ", response = TemplateTypeWithID.class, authorizations = { + @ApiOperation(value = "Adds a new SMS template type.", notes = "Adds a new SMS template type to the system. An SMS template type can have any number of organization or application SMS templates.
* Attribute _**displayName**_ of the template type should be unique.
Scope required:
* internal_notification_sms_mgt_create ", response = TemplateTypeWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -202,7 +202,7 @@ public Response addSMSTemplateType(@ApiParam(value = "SMS template type to be ad @Path("/email/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Removes an email template.", notes = "Removes an email template identified by the template-type-id and the locale.
Scopes required:
* internal_email_mgt_delete ", response = Void.class, authorizations = { + @ApiOperation(value = "Removes an email template.", notes = "Removes an email template identified by the template-type-id and the locale.
Scope required:
* internal_notification_email_mgt_delete ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -216,7 +216,7 @@ public Response addSMSTemplateType(@ApiParam(value = "SMS template type to be ad @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response deleteAppEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response deleteAppEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.deleteAppEmailTemplate(templateTypeId, appUuid, locale ); } @@ -226,7 +226,7 @@ public Response deleteAppEmailTemplate(@ApiParam(value = "Email Template Type ID @Path("/sms/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Removes an SMS template.", notes = "Removes an SMS template identified by the template-type-id and the locale.
Scopes required:
* internal_sms_mgt_delete ", response = Void.class, authorizations = { + @ApiOperation(value = "Removes an SMS template.", notes = "Removes an SMS template identified by the template-type-id and the locale.
Scope required:
* internal_notification_sms_mgt_delete ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -240,7 +240,7 @@ public Response deleteAppEmailTemplate(@ApiParam(value = "Email Template Type ID @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response deleteAppSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response deleteAppSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.deleteAppSMSTemplate(templateTypeId, appUuid, locale ); } @@ -250,7 +250,7 @@ public Response deleteAppSMSTemplate(@ApiParam(value = "Email Template Type ID." @Path("/email/template-types/{template-type-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Removes an email template type.", notes = "Removes an existing email template type with all its email templates from the system.
Scopes required:
* internal_email_mgt_delete ", response = Void.class, authorizations = { + @ApiOperation(value = "Removes an email template type.", notes = "Removes an existing email template type with all its email templates from the system.
Scope required:
* internal_notification_email_mgt_delete ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -264,7 +264,7 @@ public Response deleteAppSMSTemplate(@ApiParam(value = "Email Template Type ID." @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response deleteEmailTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { + public Response deleteEmailTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { return delegate.deleteEmailTemplateType(templateTypeId ); } @@ -274,7 +274,7 @@ public Response deleteEmailTemplateType(@ApiParam(value = "Email Template Type I @Path("/email/template-types/{template-type-id}/org-templates/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Removes an email template.", notes = "Removes an email template identified by the template-type-id and the locale.
Scopes required:
* internal_email_mgt_delete ", response = Void.class, authorizations = { + @ApiOperation(value = "Removes an email template.", notes = "Removes an email template identified by the template-type-id and the locale.
Scope required:
* internal_notification_email_mgt_delete ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -288,7 +288,7 @@ public Response deleteEmailTemplateType(@ApiParam(value = "Email Template Type I @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response deleteOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response deleteOrgEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.deleteOrgEmailTemplate(templateTypeId, locale ); } @@ -298,7 +298,7 @@ public Response deleteOrgEmailTemplate(@ApiParam(value = "Email Template Type ID @Path("/sms/template-types/{template-type-id}/org-templates/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Removes an organization SMS template.", notes = "Removes an organization SMS template identified by the template-type-id and the locale.
Scopes required:
* internal_sms_mgt_delete ", response = Void.class, authorizations = { + @ApiOperation(value = "Removes an organization SMS template.", notes = "Removes an organization SMS template identified by the template-type-id and the locale.
Scope required:
* internal_notification_sms_mgt_delete ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -312,7 +312,7 @@ public Response deleteOrgEmailTemplate(@ApiParam(value = "Email Template Type ID @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response deleteOrgSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response deleteOrgSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.deleteOrgSMSTemplate(templateTypeId, locale ); } @@ -322,7 +322,7 @@ public Response deleteOrgSMSTemplate(@ApiParam(value = "Email Template Type ID." @Path("/sms/template-types/{template-type-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Removes an SMS template type.", notes = "Removes an existing SMS template type with all its SMS templates from the system.
Scopes required:
* internal_sms_mgt_delete ", response = Void.class, authorizations = { + @ApiOperation(value = "Removes an SMS template type.", notes = "Removes an existing SMS template type with all its SMS templates from the system.
Scope required:
* internal_notification_sms_mgt_delete ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -336,7 +336,7 @@ public Response deleteOrgSMSTemplate(@ApiParam(value = "Email Template Type ID." @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response deleteSMSTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { + public Response deleteSMSTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { return delegate.deleteSMSTemplateType(templateTypeId ); } @@ -346,7 +346,7 @@ public Response deleteSMSTemplateType(@ApiParam(value = "Email Template Type ID. @Path("/email/template-types") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves all the email template types.", notes = "Retrieves all the email template types in the system.

Scopes required:
* internal_email_mgt_view ", response = TemplateTypeWithID.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieves all the email template types.", notes = "Retrieves all the email template types in the system.

Scope required:
* internal_notification_email_mgt_view ", response = TemplateTypeWithID.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -369,7 +369,7 @@ public Response getAllEmailTemplateTypes() { @Path("/sms/template-types") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves all the sms template types.", notes = "Retrieves all the SMS template types in the system.
Scopes required:
* internal_sms_mgt_view ", response = TemplateTypeWithID.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieves all the sms template types.", notes = "Retrieves all the SMS template types in the system.
Scope required:
* internal_notification_sms_mgt_view ", response = TemplateTypeWithID.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -392,7 +392,7 @@ public Response getAllSMSTemplateTypes() { @Path("/email/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves a single email template of application.", notes = "Retrieves the application email template that matches to the template-type-id and the locale.
Scope required:
* internal_email_mgt_view ", response = EmailTemplateWithID.class, authorizations = { + @ApiOperation(value = "Retrieves a single email template of application.", notes = "Retrieves the application email template that matches to the template-type-id and the locale.
Scope required:
* internal_notification_email_mgt_view ", response = EmailTemplateWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -406,7 +406,7 @@ public Response getAllSMSTemplateTypes() { @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getAppEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response getAppEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.getAppEmailTemplate(templateTypeId, appUuid, locale ); } @@ -416,7 +416,7 @@ public Response getAppEmailTemplate(@ApiParam(value = "Email Template Type ID.", @Path("/sms/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves a single SMS template of application.", notes = "Retrieves the application SMS template that matches to the template-type-id and the locale.
Scope required:
* internal_sms_mgt_view ", response = SMSTemplateWithID.class, authorizations = { + @ApiOperation(value = "Retrieves a single SMS template of application.", notes = "Retrieves the application SMS template that matches to the template-type-id and the locale.
Scope required:
* internal_notification_sms_mgt_view ", response = SMSTemplateWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -430,7 +430,7 @@ public Response getAppEmailTemplate(@ApiParam(value = "Email Template Type ID.", @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getAppSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response getAppSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.getAppSMSTemplate(templateTypeId, appUuid, locale ); } @@ -440,7 +440,7 @@ public Response getAppSMSTemplate(@ApiParam(value = "Email Template Type ID.",re @Path("/email/template-types/{template-type-id}/app-templates/{app-uuid}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves the list of application email templates in the template type id.", notes = "Retrieves the list of application email templates in the template type id.
Scope required:
* internal_email_mgt_view
", response = EmailTemplateWithID.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieves the list of application email templates in the template type id.", notes = "Retrieves the list of application email templates in the template type id.
Scope required:
* internal_notification_email_mgt_view
", response = EmailTemplateWithID.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -454,7 +454,7 @@ public Response getAppSMSTemplate(@ApiParam(value = "Email Template Type ID.",re @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getAppTemplatesListOfEmailTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid) { + public Response getAppTemplatesListOfEmailTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid) { return delegate.getAppTemplatesListOfEmailTemplateType(templateTypeId, appUuid ); } @@ -464,7 +464,7 @@ public Response getAppTemplatesListOfEmailTemplateType(@ApiParam(value = "Email @Path("/sms/template-types/{template-type-id}/app-templates/{app-uuid}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves the list of application SMS templates in the template type id.", notes = "Retrieves the list of application SMS templates in the template type id.
Scope required:
* internal_sms_mgt_view
", response = SMSTemplateWithID.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieves the list of application SMS templates in the template type id.", notes = "Retrieves the list of application SMS templates in the template type id.
Scope required:
* internal_notification_sms_mgt_view
", response = SMSTemplateWithID.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -478,17 +478,65 @@ public Response getAppTemplatesListOfEmailTemplateType(@ApiParam(value = "Email @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getAppTemplatesListOfSMSTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid) { + public Response getAppTemplatesListOfSMSTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid) { return delegate.getAppTemplatesListOfSMSTemplateType(templateTypeId, appUuid ); } + @Valid + @GET + @Path("/email/template-types/{template-type-id}/system-templates/{locale}") + + @Produces({ "application/json" }) + @ApiOperation(value = "Retrieves the default email template for given type and locale.", notes = "Retrieves the default email template that matches to the template-type-id and the locale.
Scope required:
* internal_notification_email_mgt_view ", response = EmailTemplateWithID.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ "Email Templates", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Search results matching the given criteria.", response = EmailTemplateWithID.class), + @ApiResponse(code = 400, message = "Invalid input request.", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized.", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden.", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) + }) + public Response getDefaultEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + + return delegate.getDefaultEmailTemplate(templateTypeId, locale ); + } + + @Valid + @GET + @Path("/sms/template-types/{template-type-id}/system-templates/{locale}") + + @Produces({ "application/json" }) + @ApiOperation(value = "Retrieves the default organization SMS template.", notes = "Retrieves the default SMS template that matches to the template-type-id and the locale.
Scope required:
* internal_notification_sms_mgt_view ", response = SMSTemplateWithID.class, authorizations = { + @Authorization(value = "BasicAuth"), + @Authorization(value = "OAuth2", scopes = { + + }) + }, tags={ "SMS Templates", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Search results matching the given criteria.", response = SMSTemplateWithID.class), + @ApiResponse(code = 400, message = "Invalid input request.", response = Error.class), + @ApiResponse(code = 401, message = "Unauthorized.", response = Void.class), + @ApiResponse(code = 403, message = "Forbidden.", response = Void.class), + @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), + @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) + }) + public Response getDefaultSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + + return delegate.getDefaultSMSTemplate(templateTypeId, locale ); + } + @Valid @GET @Path("/email/template-types/{template-type-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves the email template type corresponding to the template type id.", notes = "Retrieves the email template type in the system identified by the template-type-id.
Scopes required:
* internal_email_mgt_view
", response = TemplateTypeWithID.class, authorizations = { + @ApiOperation(value = "Retrieves the email template type corresponding to the template type id.", notes = "Retrieves the email template type in the system identified by the template-type-id.
Scope required:
* internal_notification_email_mgt_view
", response = TemplateTypeWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -502,7 +550,7 @@ public Response getAppTemplatesListOfSMSTemplateType(@ApiParam(value = "Email Te @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getEmailTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { + public Response getEmailTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { return delegate.getEmailTemplateType(templateTypeId ); } @@ -512,7 +560,7 @@ public Response getEmailTemplateType(@ApiParam(value = "Email Template Type ID." @Path("/email/template-types/{template-type-id}/org-templates/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves a single email template.", notes = "Retrieves the email template that matches to the template-type-id and the locale.
Scope required:
* internal_email_mgt_view ", response = EmailTemplateWithID.class, authorizations = { + @ApiOperation(value = "Retrieves a single email template.", notes = "Retrieves the email template that matches to the template-type-id and the locale.
Scope required:
* internal_notification_email_mgt_view ", response = EmailTemplateWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -526,7 +574,7 @@ public Response getEmailTemplateType(@ApiParam(value = "Email Template Type ID." @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response getOrgEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.getOrgEmailTemplate(templateTypeId, locale ); } @@ -536,7 +584,7 @@ public Response getOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.", @Path("/sms/template-types/{template-type-id}/org-templates/{locale}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves a single organization SMS template.", notes = "Retrieves the SMS template that matches to the template-type-id and the locale.
Scope required:
* internal_sms_mgt_view ", response = SMSTemplateWithID.class, authorizations = { + @ApiOperation(value = "Retrieves a single organization SMS template.", notes = "Retrieves the SMS template that matches to the template-type-id and the locale.
Scope required:
* internal_notification_sms_mgt_view ", response = SMSTemplateWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -550,7 +598,7 @@ public Response getOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.", @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getOrgSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { + public Response getOrgSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale) { return delegate.getOrgSMSTemplate(templateTypeId, locale ); } @@ -560,7 +608,7 @@ public Response getOrgSMSTemplate(@ApiParam(value = "Email Template Type ID.",re @Path("/email/template-types/{template-type-id}/org-templates") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves the list of organization email templates in the template type id.", notes = "Retrieves the list of organization email templates in the template type id.
Scope required:
* internal_email_mgt_view
", response = EmailTemplateWithID.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieves the list of organization email templates in the template type id.", notes = "Retrieves the list of organization email templates in the template type id.
Scope required:
* internal_notification_email_mgt_view
", response = EmailTemplateWithID.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -574,7 +622,7 @@ public Response getOrgSMSTemplate(@ApiParam(value = "Email Template Type ID.",re @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getOrgTemplatesListOfEmailTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { + public Response getOrgTemplatesListOfEmailTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { return delegate.getOrgTemplatesListOfEmailTemplateType(templateTypeId ); } @@ -584,7 +632,7 @@ public Response getOrgTemplatesListOfEmailTemplateType(@ApiParam(value = "Email @Path("/sms/template-types/{template-type-id}/org-templates") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves the list of organization SMS templates in the template type id.", notes = "Retrieves the list of organization SMS templates in the template type id.
Scope required:
* internal_sms_mgt_view
", response = SMSTemplateWithID.class, responseContainer = "List", authorizations = { + @ApiOperation(value = "Retrieves the list of organization SMS templates in the template type id.", notes = "Retrieves the list of organization SMS templates in the template type id.
Scope required:
* internal_notification_sms_mgt_view
", response = SMSTemplateWithID.class, responseContainer = "List", authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -598,7 +646,7 @@ public Response getOrgTemplatesListOfEmailTemplateType(@ApiParam(value = "Email @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getOrgTemplatesListOfSMSTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { + public Response getOrgTemplatesListOfSMSTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { return delegate.getOrgTemplatesListOfSMSTemplateType(templateTypeId ); } @@ -608,7 +656,7 @@ public Response getOrgTemplatesListOfSMSTemplateType(@ApiParam(value = "Email Te @Path("/sms/template-types/{template-type-id}") @Produces({ "application/json" }) - @ApiOperation(value = "Retrieves the SMS template type corresponding to the template type id.", notes = "Retrieves the SMS template type in the system identified by the template-type-id.
Scopes required:
* internal_sms_mgt_view
", response = TemplateTypeWithID.class, authorizations = { + @ApiOperation(value = "Retrieves the SMS template type corresponding to the template type id.", notes = "Retrieves the SMS template type in the system identified by the template-type-id.
Scope required:
* internal_notification_sms_mgt_view
", response = TemplateTypeWithID.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -622,7 +670,7 @@ public Response getOrgTemplatesListOfSMSTemplateType(@ApiParam(value = "Email Te @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response getSMSTemplateType(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { + public Response getSMSTemplateType(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) { return delegate.getSMSTemplateType(templateTypeId ); } @@ -632,7 +680,7 @@ public Response getSMSTemplateType(@ApiParam(value = "Email Template Type ID.",r @Path("/email/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Replaces an existing application email template.", notes = "Replaces the application email template identified by the template-type-id and the locale.
Scopes required:
* internal_email_mgt_update ", response = Void.class, authorizations = { + @ApiOperation(value = "Replaces an existing application email template.", notes = "Replaces the application email template identified by the template-type-id and the locale.
Scope required:
* internal_notification_email_mgt_update ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -646,7 +694,7 @@ public Response getSMSTemplateType(@ApiParam(value = "Email Template Type ID.",r @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response updateAppEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "Email templates for the template type." ) @Valid EmailTemplate emailTemplate) { + public Response updateAppEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "Email templates for the template type." ) @Valid EmailTemplate emailTemplate) { return delegate.updateAppEmailTemplate(templateTypeId, appUuid, locale, emailTemplate ); } @@ -656,7 +704,7 @@ public Response updateAppEmailTemplate(@ApiParam(value = "Email Template Type ID @Path("/sms/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Replaces an existing application SMS template.", notes = "Replaces the application SMS template identified by the template-type-id and the locale.
Scopes required:
* internal_sms_mgt_update ", response = Void.class, authorizations = { + @ApiOperation(value = "Replaces an existing application SMS template.", notes = "Replaces the application SMS template identified by the template-type-id and the locale.
Scope required:
* internal_notification_sms_mgt_update ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -670,7 +718,7 @@ public Response updateAppEmailTemplate(@ApiParam(value = "Email Template Type ID @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response updateAppSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "Email templates for the template type." ) @Valid SMSTemplate smSTemplate) { + public Response updateAppSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "Application UUID.",required=true) @PathParam("app-uuid") String appUuid, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "Email templates for the template type." ) @Valid SMSTemplate smSTemplate) { return delegate.updateAppSMSTemplate(templateTypeId, appUuid, locale, smSTemplate ); } @@ -680,7 +728,7 @@ public Response updateAppSMSTemplate(@ApiParam(value = "Email Template Type ID." @Path("/email/template-types/{template-type-id}/org-templates/{locale}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Replaces an existing email template.", notes = "Replaces the email template identified by the template-type-id and the locale.
Scopes required:
* internal_email_mgt_update ", response = Void.class, authorizations = { + @ApiOperation(value = "Replaces an existing email template.", notes = "Replaces the email template identified by the template-type-id and the locale.
Scope required:
* internal_notification_email_mgt_update ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -694,7 +742,7 @@ public Response updateAppSMSTemplate(@ApiParam(value = "Email Template Type ID." @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response updateOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "Email templates for the template type." ) @Valid EmailTemplate emailTemplate) { + public Response updateOrgEmailTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "Email templates for the template type." ) @Valid EmailTemplate emailTemplate) { return delegate.updateOrgEmailTemplate(templateTypeId, locale, emailTemplate ); } @@ -704,7 +752,7 @@ public Response updateOrgEmailTemplate(@ApiParam(value = "Email Template Type ID @Path("/sms/template-types/{template-type-id}/org-templates/{locale}") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @ApiOperation(value = "Replaces an existing organization SMS template.", notes = "Replaces the organization SMS template identified by the template-type-id and the locale.
Scopes required:
* internal_sms_mgt_update ", response = Void.class, authorizations = { + @ApiOperation(value = "Replaces an existing organization SMS template.", notes = "Replaces the organization SMS template identified by the template-type-id and the locale.
Scope required:
* internal_notification_sms_mgt_update ", response = Void.class, authorizations = { @Authorization(value = "BasicAuth"), @Authorization(value = "OAuth2", scopes = { @@ -718,7 +766,7 @@ public Response updateOrgEmailTemplate(@ApiParam(value = "Email Template Type ID @ApiResponse(code = 404, message = "The specified resource is not found.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) - public Response updateOrgSMSTemplate(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "SMS templates for the template type." ) @Valid SMSTemplate smSTemplate) { + public Response updateOrgSMSTemplate(@ApiParam(value = "Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId, @ApiParam(value = "This should be a valid locale.",required=true) @PathParam("locale") String locale, @ApiParam(value = "SMS templates for the template type." ) @Valid SMSTemplate smSTemplate) { return delegate.updateOrgSMSTemplate(templateTypeId, locale, smSTemplate ); } diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApiService.java b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApiService.java index 3548a1cfce..3fd361fce1 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApiService.java +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/gen/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/NotificationApiService.java @@ -73,6 +73,10 @@ public interface NotificationApiService { public Response getAppTemplatesListOfSMSTemplateType(String templateTypeId, String appUuid); + public Response getDefaultEmailTemplate(String templateTypeId, String locale); + + public Response getDefaultSMSTemplate(String templateTypeId, String locale); + public Response getEmailTemplateType(String templateTypeId); public Response getOrgEmailTemplate(String templateTypeId, String locale); diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/core/ApplicationTemplatesService.java b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/core/TemplatesService.java similarity index 88% rename from components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/core/ApplicationTemplatesService.java rename to components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/core/TemplatesService.java index 8609987e86..ed97e8e5d2 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/core/ApplicationTemplatesService.java +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/core/TemplatesService.java @@ -38,7 +38,7 @@ /** * Service class for application email templates. */ -public class ApplicationTemplatesService { +public class TemplatesService { /** * Adds a new organization email template to the given template type. Template ID should not exist in the system. @@ -274,6 +274,60 @@ public SMSTemplateWithID getSMSTemplate(String templateTypeId, String templateId } } + /** + * Retrieves the default email template of the given template type and locale. + * + * @param templateTypeId Template type ID. + * @param templateId Template ID. + * @return Default email template. + */ + public EmailTemplateWithID getSystemEmailTemplate(String templateTypeId, String templateId) { + + try { + String templateTypeDisplayName = Util.decodeTemplateTypeId(templateTypeId); + NotificationTemplate internalTemplate = TemplatesServiceHolder.getNotificationTemplateManager(). + getSystemNotificationTemplate(Constants.NOTIFICATION_CHANNEL_EMAIL, + templateTypeDisplayName, templateId); + // NotificationTemplateManager sends the default template if no matching template found. + // We need to check for the locale specifically. + if (!internalTemplate.getLocale().equals(templateId)) { + throw Util.handleError(Constants.ErrorMessage.ERROR_TEMPLATE_NOT_FOUND); + } else { + return Util.buildEmailTemplateWithID(internalTemplate); + } + } catch (NotificationTemplateManagerException e) { + throw Util.handleNotificationTemplateManagerException(e, + Constants.ErrorMessage.ERROR_ERROR_RETRIEVING_TEMPLATE); + } + } + + /** + * Retrieves the default SMS template of the given template type and locale. + * + * @param templateTypeId Template type ID. + * @param templateId Template ID. + * @return Default SMS template. + */ + public SMSTemplateWithID getSystemSmsTemplate(String templateTypeId, String templateId) { + + try { + String templateTypeDisplayName = Util.decodeTemplateTypeId(templateTypeId); + NotificationTemplate internalTemplate = TemplatesServiceHolder.getNotificationTemplateManager(). + getSystemNotificationTemplate(Constants.NOTIFICATION_CHANNEL_SMS, + templateTypeDisplayName, templateId); + // NotificationTemplateManager sends the default template if no matching template found. + // We need to check for the locale specifically. + if (!internalTemplate.getLocale().equals(templateId)) { + throw Util.handleError(Constants.ErrorMessage.ERROR_TEMPLATE_NOT_FOUND); + } else { + return Util.buildSMSTemplateWithID(internalTemplate); + } + } catch (NotificationTemplateManagerException e) { + throw Util.handleNotificationTemplateManagerException(e, + Constants.ErrorMessage.ERROR_ERROR_RETRIEVING_TEMPLATE); + } + } + /** * Updates the organization email template of the given template type and locale. * diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/impl/NotificationApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/impl/NotificationApiServiceImpl.java index 24d96d2791..5de5508572 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/impl/NotificationApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/notification/template/v1/impl/NotificationApiServiceImpl.java @@ -22,8 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.wso2.carbon.identity.api.server.notification.template.common.Constants; import org.wso2.carbon.identity.rest.api.server.notification.template.v1.NotificationApiService; -import org.wso2.carbon.identity.rest.api.server.notification.template.v1.core.ApplicationTemplatesService; import org.wso2.carbon.identity.rest.api.server.notification.template.v1.core.TemplateTypeService; +import org.wso2.carbon.identity.rest.api.server.notification.template.v1.core.TemplatesService; import org.wso2.carbon.identity.rest.api.server.notification.template.v1.model.EmailTemplate; import org.wso2.carbon.identity.rest.api.server.notification.template.v1.model.EmailTemplateWithID; import org.wso2.carbon.identity.rest.api.server.notification.template.v1.model.SMSTemplate; @@ -54,7 +54,7 @@ public class NotificationApiServiceImpl implements NotificationApiService { @Autowired - private ApplicationTemplatesService applicationTemplatesService; + private TemplatesService templatesService; @Autowired private TemplateTypeService templateTypeService; @@ -62,7 +62,7 @@ public class NotificationApiServiceImpl implements NotificationApiService { public Response addAppEmailTemplate(String templateTypeId, String appUuid, EmailTemplateWithID emailTemplateWithID) { - SimpleTemplate simpleEmailTemplate = applicationTemplatesService.addEmailTemplate(templateTypeId, + SimpleTemplate simpleEmailTemplate = templatesService.addEmailTemplate(templateTypeId, emailTemplateWithID, appUuid); URI headerLocation = buildURIForHeader(V1_API_PATH_COMPONENT + NOTIFICATION_TEMPLATES_API_PATH + NOTIFICATION_TEMPLATES_API_BASE_PATH_EMAIL + TEMPLATE_TYPES_PATH + PATH_SEPARATOR @@ -74,7 +74,7 @@ public Response addAppEmailTemplate(String templateTypeId, String appUuid, @Override public Response addAppSMSTemplate(String templateTypeId, String appUuid, SMSTemplateWithID smSTemplateWithID) { - SimpleTemplate simpleSMSTemplate = applicationTemplatesService.addSMSTemplate(templateTypeId, + SimpleTemplate simpleSMSTemplate = templatesService.addSMSTemplate(templateTypeId, smSTemplateWithID, appUuid); URI headerLocation = buildURIForHeader(V1_API_PATH_COMPONENT + NOTIFICATION_TEMPLATES_API_PATH + NOTIFICATION_TEMPLATES_API_BASE_PATH_SMS + TEMPLATE_TYPES_PATH + PATH_SEPARATOR @@ -98,7 +98,7 @@ public Response addEmailTemplateType(TemplateTypeOverview templateTypeOverview) @Override public Response addOrgEmailTemplate(String templateTypeId, EmailTemplateWithID emailTemplateWithID) { - SimpleTemplate simpleEmailTemplate = applicationTemplatesService.addEmailTemplate(templateTypeId, + SimpleTemplate simpleEmailTemplate = templatesService.addEmailTemplate(templateTypeId, emailTemplateWithID); URI headerLocation = buildURIForHeader( V1_API_PATH_COMPONENT + NOTIFICATION_TEMPLATES_API_PATH @@ -110,7 +110,7 @@ public Response addOrgEmailTemplate(String templateTypeId, EmailTemplateWithID e @Override public Response addOrgSMSTemplate(String templateTypeId, SMSTemplateWithID smSTemplateWithID) { - SimpleTemplate simpleSMSTemplate = applicationTemplatesService.addSMSTemplate(templateTypeId, + SimpleTemplate simpleSMSTemplate = templatesService.addSMSTemplate(templateTypeId, smSTemplateWithID); URI headerLocation = buildURIForHeader( V1_API_PATH_COMPONENT + NOTIFICATION_TEMPLATES_API_PATH @@ -134,14 +134,14 @@ public Response addSMSTemplateType(TemplateTypeOverview templateTypeOverview) { @Override public Response deleteAppEmailTemplate(String templateTypeId, String appUuid, String locale) { - applicationTemplatesService.deleteEmailTemplate(templateTypeId, locale, appUuid); + templatesService.deleteEmailTemplate(templateTypeId, locale, appUuid); return Response.noContent().build(); } @Override public Response deleteAppSMSTemplate(String templateTypeId, String appUuid, String locale) { - applicationTemplatesService.deleteSMSTemplate(templateTypeId, locale, appUuid); + templatesService.deleteSMSTemplate(templateTypeId, locale, appUuid); return Response.noContent().build(); } @@ -155,14 +155,14 @@ public Response deleteEmailTemplateType(String templateTypeId) { @Override public Response deleteOrgEmailTemplate(String templateTypeId, String locale) { - applicationTemplatesService.deleteEmailTemplate(templateTypeId, locale); + templatesService.deleteEmailTemplate(templateTypeId, locale); return Response.noContent().build(); } @Override public Response deleteOrgSMSTemplate(String templateTypeId, String locale) { - applicationTemplatesService.deleteSMSTemplate(templateTypeId, locale); + templatesService.deleteSMSTemplate(templateTypeId, locale); return Response.noContent().build(); } @@ -190,14 +190,14 @@ public Response getAllSMSTemplateTypes() { @Override public Response getAppEmailTemplate(String templateTypeId, String appUuid, String locale) { - return Response.ok().entity(applicationTemplatesService.getEmailTemplate(templateTypeId, locale, appUuid)) + return Response.ok().entity(templatesService.getEmailTemplate(templateTypeId, locale, appUuid)) .build(); } @Override public Response getAppSMSTemplate(String templateTypeId, String appUuid, String locale) { - return Response.ok().entity(applicationTemplatesService.getSMSTemplate(templateTypeId, locale, appUuid)) + return Response.ok().entity(templatesService.getSMSTemplate(templateTypeId, locale, appUuid)) .build(); } @@ -205,14 +205,14 @@ public Response getAppSMSTemplate(String templateTypeId, String appUuid, String public Response getAppTemplatesListOfEmailTemplateType(String templateTypeId, String appUuid) { return Response.ok().entity( - applicationTemplatesService.getTemplatesListOfEmailTemplateType(templateTypeId, appUuid)).build(); + templatesService.getTemplatesListOfEmailTemplateType(templateTypeId, appUuid)).build(); } @Override public Response getAppTemplatesListOfSMSTemplateType(String templateTypeId, String appUuid) { return Response.ok().entity( - applicationTemplatesService.getTemplatesListOfSMSTemplateType(templateTypeId, appUuid)).build(); + templatesService.getTemplatesListOfSMSTemplateType(templateTypeId, appUuid)).build(); } @Override @@ -225,26 +225,26 @@ public Response getEmailTemplateType(String templateTypeId) { @Override public Response getOrgEmailTemplate(String templateTypeId, String locale) { - return Response.ok().entity(applicationTemplatesService.getEmailTemplate(templateTypeId, locale)).build(); + return Response.ok().entity(templatesService.getEmailTemplate(templateTypeId, locale)).build(); } @Override public Response getOrgSMSTemplate(String templateTypeId, String locale) { - return Response.ok().entity(applicationTemplatesService.getSMSTemplate(templateTypeId, locale)).build(); + return Response.ok().entity(templatesService.getSMSTemplate(templateTypeId, locale)).build(); } @Override public Response getOrgTemplatesListOfEmailTemplateType(String templateTypeId) { - return Response.ok().entity(applicationTemplatesService.getTemplatesListOfEmailTemplateType(templateTypeId)) + return Response.ok().entity(templatesService.getTemplatesListOfEmailTemplateType(templateTypeId)) .build(); } @Override public Response getOrgTemplatesListOfSMSTemplateType(String templateTypeId) { - return Response.ok().entity(applicationTemplatesService.getTemplatesListOfSMSTemplateType(templateTypeId)) + return Response.ok().entity(templatesService.getTemplatesListOfSMSTemplateType(templateTypeId)) .build(); } @@ -255,11 +255,23 @@ public Response getSMSTemplateType(String templateTypeId) { templateTypeId)).build(); } + @Override + public Response getDefaultEmailTemplate(String templateTypeId, String locale) { + + return Response.ok().entity(templatesService.getSystemEmailTemplate(templateTypeId, locale)).build(); + } + + @Override + public Response getDefaultSMSTemplate(String templateTypeId, String locale) { + + return Response.ok().entity(templatesService.getSystemSmsTemplate(templateTypeId, locale)).build(); + } + @Override public Response updateAppEmailTemplate(String templateTypeId, String appUuid, String locale, EmailTemplate emailTemplate) { - applicationTemplatesService.updateEmailTemplate(templateTypeId, locale, emailTemplate, appUuid); + templatesService.updateEmailTemplate(templateTypeId, locale, emailTemplate, appUuid); return Response.ok().build(); } @@ -267,7 +279,7 @@ public Response updateAppEmailTemplate(String templateTypeId, String appUuid, St public Response updateAppSMSTemplate(String templateTypeId, String appUuid, String locale, SMSTemplate smsTemplate) { - applicationTemplatesService.updateSMSTemplate(templateTypeId, locale, smsTemplate, appUuid); + templatesService.updateSMSTemplate(templateTypeId, locale, smsTemplate, appUuid); return Response.ok().build(); } @@ -275,14 +287,14 @@ public Response updateAppSMSTemplate(String templateTypeId, String appUuid, Stri public Response updateOrgEmailTemplate(String templateTypeId, String locale, EmailTemplate emailTemplate) { - applicationTemplatesService.updateEmailTemplate(templateTypeId, locale, emailTemplate); + templatesService.updateEmailTemplate(templateTypeId, locale, emailTemplate); return Response.ok().build(); } @Override public Response updateOrgSMSTemplate(String templateTypeId, String locale, SMSTemplate smsTemplate) { - applicationTemplatesService.updateSMSTemplate(templateTypeId, locale, smsTemplate); + templatesService.updateSMSTemplate(templateTypeId, locale, smsTemplate); return Response.ok().build(); } } diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/META-INF/cxf/notification-template-server-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/META-INF/cxf/notification-template-server-v1-cxf.xml index 35e871860e..27e3f3b5be 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/META-INF/cxf/notification-template-server-v1-cxf.xml +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/META-INF/cxf/notification-template-server-v1-cxf.xml @@ -17,7 +17,7 @@ - + diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/notification-template.yml b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/notification-template.yml index acfbddea99..4712690c51 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/notification-template.yml +++ b/components/org.wso2.carbon.identity.api.server.notification.template/org.wso2.carbon.identity.rest.api.server.notification.template.v1/src/main/resources/notification-template.yml @@ -33,8 +33,8 @@ paths: Retrieves all the email template types in the system.

- Scopes required: -
* internal_email_mgt_view + Scope required: +
* internal_notification_email_mgt_view responses: '200': description: Search results matching the given criteria. @@ -63,8 +63,8 @@ paths: * Attribute _**displayName**_ of the template type should be unique.
- Scopes required: -
* internal_email_mgt_create + Scope required: +
* internal_notification_email_mgt_create requestBody: content: application/json: @@ -102,8 +102,8 @@ paths: description: | Retrieves the email template type in the system identified by the template-type-id.
- Scopes required:
- * internal_email_mgt_view
+ Scope required:
+ * internal_notification_email_mgt_view
parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' responses: @@ -132,8 +132,8 @@ paths: Removes an existing email template type with all its email templates from the system.
- Scopes required:
- * internal_email_mgt_delete + Scope required:
+ * internal_notification_email_mgt_delete parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' responses: @@ -159,7 +159,7 @@ paths: Retrieves the list of organization email templates in the template type id.
Scope required:
- * internal_email_mgt_view
+ * internal_notification_email_mgt_view
parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' responses: @@ -190,7 +190,8 @@ paths: Another email template with the same locale should not already exist in the respective email template type.
- Scopes required:
* internal_email_mgt_create + Scope required:
+ * internal_notification_email_mgt_create parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' requestBody: @@ -233,7 +234,7 @@ paths: Retrieves the list of application email templates in the template type id.
Scope required:
- * internal_email_mgt_view
+ * internal_notification_email_mgt_view
parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -265,7 +266,8 @@ paths: Another application email template with the same locale should not already exist in the respective email template type.
- Scopes required:
* internal_email_mgt_create + Scope required:
+ * internal_notification_email_mgt_create parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -309,7 +311,7 @@ paths: Retrieves the email template that matches to the template-type-id and the locale.
Scope required:
- * internal_email_mgt_view + * internal_notification_email_mgt_view parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/localePathParam' @@ -338,8 +340,8 @@ paths: description: | Replaces the email template identified by the template-type-id and the locale.
- Scopes required:
- * internal_email_mgt_update + Scope required:
+ * internal_notification_email_mgt_update parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/localePathParam' @@ -370,8 +372,8 @@ paths: description: | Removes an email template identified by the template-type-id and the locale.
- Scopes required:
- * internal_email_mgt_delete + Scope required:
+ * internal_notification_email_mgt_delete parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/localePathParam' @@ -388,6 +390,37 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' + '/notification/email/template-types/{template-type-id}/system-templates/{locale}': + get: + tags: + - Email Templates + summary: Retrieves the default email template for given type and locale. + operationId: getDefaultEmailTemplate + description: | + Retrieves the default email template that matches to the template-type-id and the locale.
+ + Scope required:
+ * internal_notification_email_mgt_view + parameters: + - $ref: '#/components/parameters/templateTypeIdPathParam' + - $ref: '#/components/parameters/localePathParam' + responses: + '200': + description: Search results matching the given criteria. + content: + 'application/json': + schema: + $ref: '#/components/schemas/EmailTemplateWithID' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' '/notification/email/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}': get: tags: @@ -398,7 +431,7 @@ paths: Retrieves the application email template that matches to the template-type-id and the locale.
Scope required:
- * internal_email_mgt_view + * internal_notification_email_mgt_view parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -428,8 +461,8 @@ paths: description: | Replaces the application email template identified by the template-type-id and the locale.
- Scopes required:
- * internal_email_mgt_update + Scope required:
+ * internal_notification_email_mgt_update parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -461,8 +494,8 @@ paths: description: | Removes an email template identified by the template-type-id and the locale.
- Scopes required:
- * internal_email_mgt_delete + Scope required:
+ * internal_notification_email_mgt_delete parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -489,8 +522,8 @@ paths: description: | Retrieves all the SMS template types in the system.
- Scopes required: -
* internal_sms_mgt_view + Scope required:
+ * internal_notification_sms_mgt_view responses: '200': description: Search results matching the given criteria. @@ -519,8 +552,8 @@ paths: * Attribute _**displayName**_ of the template type should be unique.
- Scopes required: -
* internal_sms_mgt_create + Scope required:
+ * internal_notification_sms_mgt_create requestBody: content: application/json: @@ -558,8 +591,8 @@ paths: description: | Retrieves the SMS template type in the system identified by the template-type-id.
- Scopes required:
- * internal_sms_mgt_view
+ Scope required:
+ * internal_notification_sms_mgt_view
parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' responses: @@ -588,8 +621,8 @@ paths: Removes an existing SMS template type with all its SMS templates from the system.
- Scopes required:
- * internal_sms_mgt_delete + Scope required:
+ * internal_notification_sms_mgt_delete parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' responses: @@ -615,7 +648,7 @@ paths: Retrieves the list of application SMS templates in the template type id.
Scope required:
- * internal_sms_mgt_view
+ * internal_notification_sms_mgt_view
parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -647,7 +680,8 @@ paths: Another application SMS template with the same locale should not already exist in the respective SMS template type.
- Scopes required:
* internal_sms_mgt_create + Scope required:
+ * internal_notification_sms_mgt_create parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -691,7 +725,7 @@ paths: Retrieves the application SMS template that matches to the template-type-id and the locale.
Scope required:
- * internal_sms_mgt_view + * internal_notification_sms_mgt_view parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -721,8 +755,8 @@ paths: description: | Replaces the application SMS template identified by the template-type-id and the locale.
- Scopes required:
- * internal_sms_mgt_update + Scope required:
+ * internal_notification_sms_mgt_update parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -754,8 +788,8 @@ paths: description: | Removes an SMS template identified by the template-type-id and the locale.
- Scopes required:
- * internal_sms_mgt_delete + Scope required:
+ * internal_notification_sms_mgt_delete parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/appUuidPathParam' @@ -783,7 +817,7 @@ paths: Retrieves the list of organization SMS templates in the template type id.
Scope required:
- * internal_sms_mgt_view
+ * internal_notification_sms_mgt_view
parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' responses: @@ -814,7 +848,8 @@ paths: Another SMS organization template with the same locale should not already exist in the respective SMS template type.
- Scopes required:
* internal_sms_mgt_create + Scope required:
+ * internal_notification_sms_mgt_create parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' requestBody: @@ -857,7 +892,7 @@ paths: Retrieves the SMS template that matches to the template-type-id and the locale.
Scope required:
- * internal_sms_mgt_view + * internal_notification_sms_mgt_view parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/localePathParam' @@ -886,8 +921,8 @@ paths: description: | Replaces the organization SMS template identified by the template-type-id and the locale.
- Scopes required:
- * internal_sms_mgt_update + Scope required:
+ * internal_notification_sms_mgt_update parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/localePathParam' @@ -918,8 +953,8 @@ paths: description: | Removes an organization SMS template identified by the template-type-id and the locale.
- Scopes required:
- * internal_sms_mgt_delete + Scope required:
+ * internal_notification_sms_mgt_delete parameters: - $ref: '#/components/parameters/templateTypeIdPathParam' - $ref: '#/components/parameters/localePathParam' @@ -936,11 +971,39 @@ paths: $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' + '/notification/sms/template-types/{template-type-id}/system-templates/{locale}': + get: + tags: + - SMS Templates + summary: Retrieves the default organization SMS template. + operationId: getDefaultSMSTemplate + description: | + Retrieves the default SMS template that matches to the template-type-id and the locale.
+ + Scope required:
+ * internal_notification_sms_mgt_view + parameters: + - $ref: '#/components/parameters/templateTypeIdPathParam' + - $ref: '#/components/parameters/localePathParam' + responses: + '200': + description: Search results matching the given criteria. + content: + 'application/json': + schema: + $ref: '#/components/schemas/SMSTemplateWithID' + '400': + $ref: '#/components/responses/InvalidInput' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' servers: - # Added by API Auto Mocking Plugin - - description: SwaggerHub API Auto Mocking - url: https://virtserver.swaggerhub.com/RUSHANNANA/NotificationTemplateAPI/1.0.0 - url: 'https://localhost:9443/t/{tenant-domain}/api/server/v1' variables: tenant-domain: @@ -952,7 +1015,7 @@ components: in: path name: template-type-id required: true - description: Email Template Type ID. + description: Template Type ID. schema: type: string localePathParam: diff --git a/components/org.wso2.carbon.identity.api.server.notification.template/pom.xml b/components/org.wso2.carbon.identity.api.server.notification.template/pom.xml index c1b2c6dded..82c45c83c2 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.template/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.notification.template/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.server.api identity-api-server - 1.2.196-SNAPSHOT + 1.2.228-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index 64b75fe247..e31f373ef4 100644 --- a/pom.xml +++ b/pom.xml @@ -808,12 +808,12 @@ 2.3.1.wso2v1 1.4 1.2.4 - 1.10.6 + 1.11.4-SNAPSHOT 7.5.0 3.0.5 1.12.0 **/gen/**/* - 1.8.19 + 1.9.5-SNAPSHOT 7.0.154 5.11.41 1.9.4