Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Avarjana committed Mar 6, 2024
1 parent 472164a commit 5ccba2c
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 418 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.List;

import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateType;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateTypeOverview;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateTypeWithID;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateWithID;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.Error;
Expand Down Expand Up @@ -89,9 +90,9 @@ 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 addEmailTemplateType(@ApiParam(value = "Email template type to be added." ) @Valid EmailTemplateType emailTemplateType) {
public Response addEmailTemplateType(@ApiParam(value = "Email template type to be added." ) @Valid EmailTemplateTypeOverview emailTemplateTypeOverview) {

return delegate.addEmailTemplateType(emailTemplateType );
return delegate.addEmailTemplateType(emailTemplateTypeOverview );
}

@Valid
Expand All @@ -118,54 +119,6 @@ public Response addOrgEmailTemplate(@ApiParam(value = "Email Template Type ID.",
return delegate.addOrgEmailTemplate(templateTypeId, emailTemplateWithID );
}

@Valid
@DELETE
@Path("/template-types/{template-type-id}/app-templates/{app-uuid}")

@Produces({ "application/json" })
@ApiOperation(value = "Removes all email templates under application for the given template type.", notes = "Removes all email templates identified by the template-type-id and the application uuid. <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/emailmgt/delete <br> <b>Scopes required:</b><br> * internal_email_mgt_delete ", response = Void.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Application Email Templates", })
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Item Deleted.", response = Void.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 deleteAllAppEmailTemplates(@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) {

return delegate.deleteAllAppEmailTemplates(templateTypeId, appUuid );
}

@Valid
@DELETE
@Path("/template-types/{template-type-id}/org-templates")

@Produces({ "application/json" })
@ApiOperation(value = "Removes all email templates under organization for the given template type.", notes = "Removes all email templates identified by the template-type-id from the organization. <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/emailmgt/delete <br> <b>Scopes required:</b><br> * internal_email_mgt_delete ", response = Void.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Email Templates", })
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Item Deleted.", response = Void.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 deleteAllOrgEmailTemplates(@ApiParam(value = "Email Template Type ID.",required=true) @PathParam("template-type-id") String templateTypeId) {

return delegate.deleteAllOrgEmailTemplates(templateTypeId );
}

@Valid
@DELETE
@Path("/template-types/{template-type-id}/app-templates/{app-uuid}/{locale}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.InputStream;
import java.util.List;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateType;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateTypeOverview;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateTypeWithID;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.EmailTemplateWithID;
import org.wso2.carbon.identity.rest.api.server.email.template.v2.model.Error;
Expand All @@ -36,14 +37,10 @@ public interface EmailApiService {

public Response addAppEmailTemplate(String templateTypeId, String appUuid, EmailTemplateWithID emailTemplateWithID);

public Response addEmailTemplateType(EmailTemplateType emailTemplateType);
public Response addEmailTemplateType(EmailTemplateTypeOverview emailTemplateTypeOverview);

public Response addOrgEmailTemplate(String templateTypeId, EmailTemplateWithID emailTemplateWithID);

public Response deleteAllAppEmailTemplates(String templateTypeId, String appUuid);

public Response deleteAllOrgEmailTemplates(String templateTypeId);

public Response deleteAppEmailTemplate(String templateTypeId, String appUuid, String locale);

public Response deleteEmailTemplateType(String templateTypeId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.rest.api.server.email.template.v2.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.*;


import io.swagger.annotations.*;
import java.util.Objects;
import javax.validation.Valid;
import javax.xml.bind.annotation.*;

public class EmailTemplateTypeOverview {

private String displayName;

/**
* Display name of the email template type.
**/
public EmailTemplateTypeOverview displayName(String displayName) {

this.displayName = displayName;
return this;
}

@ApiModelProperty(example = "Account Confirmation", required = true, value = "Display name of the email template type.")
@JsonProperty("displayName")
@Valid
@NotNull(message = "Property displayName cannot be null.")

public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}



@Override
public boolean equals(java.lang.Object o) {

if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EmailTemplateTypeOverview emailTemplateTypeOverview = (EmailTemplateTypeOverview) o;
return Objects.equals(this.displayName, emailTemplateTypeOverview.displayName);
}

@Override
public int hashCode() {
return Objects.hash(displayName);
}

@Override
public String toString() {

StringBuilder sb = new StringBuilder();
sb.append("class EmailTemplateTypeOverview {\n");

sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {

if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n");
}
}

This file was deleted.

Loading

0 comments on commit 5ccba2c

Please sign in to comment.