Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Push Notification provider configuration related APIs #776

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ public class NotificationSenderManagementConstants {
public static final String URL_ENCODED_SPACE = "%20";
public static final String EMAIL_PUBLISHER_TYPE = "email";
public static final String SMS_PUBLISHER_TYPE = "sms";
public static final String PUSH_PUBLISHER_TYPE = "push";
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.
*/
* Copyright (c) 2023, 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.api.server.notification.sender.v1;

Expand All @@ -26,6 +28,9 @@
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.EmailSenderAdd;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.EmailSenderUpdateRequest;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.Error;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.PushSender;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.PushSenderAdd;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.PushSenderUpdateRequest;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.SMSSender;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.SMSSenderAdd;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.SMSSenderUpdateRequest;
Expand Down Expand Up @@ -72,6 +77,32 @@ public Response createEmailSender(@ApiParam(value = "" ) @Valid EmailSenderAdd e
return delegate.createEmailSender(emailSenderAdd );
}

@Valid
@POST
@Path("/push")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Create a push notification sender", notes = "This API provides the capability to create a push notification sender.\\n\\nIf the 'name' is not defined, 'PushPublisher' is taken as the default name. <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/configmgt/add <br> <b>Scope required:</b> <br> * internal_config_mgt_add ", response = PushSender.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Push Notification Senders", })
@ApiResponses(value = {
@ApiResponse(code = 201, message = "Successful Response", response = PushSender.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 405, message = "Method Not Allowed.", response = Error.class),
@ApiResponse(code = 409, message = "Conflict", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response createPushSender(@ApiParam(value = "" ) @Valid PushSenderAdd pushSenderAdd) {

return delegate.createPushSender(pushSenderAdd );
}

@Valid
@POST
@Path("/sms")
Expand Down Expand Up @@ -123,6 +154,31 @@ public Response deleteEmailSender(@ApiParam(value = "name of the email sender",r
return delegate.deleteEmailSender(senderName );
}

@Valid
@DELETE
@Path("/push/{sender-name}")

@Produces({ "application/json" })
@ApiOperation(value = "Delete a push notification sender by name", notes = "This API provides the capability to delete a push notification sender by name. The URL encoded push notification sender name is used as sender-name.<br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/configmgt/delete <br> <b>Scope required:</b> <br> * internal_config_mgt_delete ", response = Void.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Push Notification Senders", })
@ApiResponses(value = {
@ApiResponse(code = 204, message = "No Content", response = Void.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 405, message = "Method Not Allowed.", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response deletePushSender(@ApiParam(value = "name of the email sender",required=true) @PathParam("sender-name") String senderName) {

return delegate.deletePushSender(senderName );
}

@Valid
@DELETE
@Path("/sms/{sender-name}")
Expand Down Expand Up @@ -198,6 +254,56 @@ public Response getEmailSenders() {
return delegate.getEmailSenders();
}

@Valid
@GET
@Path("/push/{sender-name}")

@Produces({ "application/json" })
@ApiOperation(value = "Retrieve a push notification sender by name", notes = "This API provides the capability to retrieve a push notification sender by name. The URL encoded push notification sender name is used as sender-name.<br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/configmgt/view <br> <b>Scope required:</b> <br> * internal_config_mgt_view ", response = PushSender.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Push Notification Senders", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful Response", response = PushSender.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 405, message = "Method Not Allowed.", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response getPushSender(@ApiParam(value = "name of the push notification sender",required=true) @PathParam("sender-name") String senderName) {

return delegate.getPushSender(senderName );
}

@Valid
@GET
@Path("/push")

@Produces({ "application/json" })
@ApiOperation(value = "Get a list of push notification senders", notes = "This API provides the capability to retrieve the list of push notification senders. <br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/configmgt/view <br> <b>Scope required:</b> <br> * internal_config_mgt_view ", response = PushSender.class, responseContainer = "List", authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Push Notification Senders", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful response", response = PushSender.class, responseContainer = "List"),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 405, message = "Method Not Allowed.", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response getPushSenders() {

return delegate.getPushSenders();
}

@Valid
@GET
@Path("/sms/{sender-name}")
Expand Down Expand Up @@ -273,6 +379,31 @@ public Response updateEmailSender(@ApiParam(value = "name of the email sender",r
return delegate.updateEmailSender(senderName, emailSenderUpdateRequest );
}

@Valid
@PUT
@Path("/push/{sender-name}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Update a push notification sender", notes = "This API provides the capability to update a push notification sender by name. The URL encoded push notification sender name is used as sender-name.<br> <b>Permission required:</b> <br> * /permission/admin/manage/identity/configmgt/update <br> <b>Scope required:</b> <br> * internal_config_mgt_update ", response = PushSender.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Push Notification Senders", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful Response", response = PushSender.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 405, message = "Method Not Allowed.", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response updatePushSender(@ApiParam(value = "name of the push notification sender",required=true) @PathParam("sender-name") String senderName, @ApiParam(value = "" ,required=true) @Valid PushSenderUpdateRequest pushSenderUpdateRequest) {

return delegate.updatePushSender(senderName, pushSenderUpdateRequest );
}

@Valid
@PUT
@Path("/sms/{sender-name}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.
*/
* Copyright (c) 2023, 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.api.server.notification.sender.v1;

Expand All @@ -26,6 +28,9 @@
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.EmailSenderAdd;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.EmailSenderUpdateRequest;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.Error;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.PushSender;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.PushSenderAdd;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.PushSenderUpdateRequest;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.SMSSender;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.SMSSenderAdd;
import org.wso2.carbon.identity.api.server.notification.sender.v1.model.SMSSenderUpdateRequest;
Expand All @@ -36,21 +41,31 @@ public interface NotificationSendersApiService {

public Response createEmailSender(EmailSenderAdd emailSenderAdd);

public Response createPushSender(PushSenderAdd pushSenderAdd);

public Response createSMSSender(SMSSenderAdd smSSenderAdd);

public Response deleteEmailSender(String senderName);

public Response deletePushSender(String senderName);

public Response deleteSMSSender(String senderName);

public Response getEmailSender(String senderName);

public Response getEmailSenders();

public Response getPushSender(String senderName);

public Response getPushSenders();

public Response getSMSSender(String senderName);

public Response getSMSSenders();

public Response updateEmailSender(String senderName, EmailSenderUpdateRequest emailSenderUpdateRequest);

public Response updatePushSender(String senderName, PushSenderUpdateRequest pushSenderUpdateRequest);

public Response updateSMSSender(String senderName, SMSSenderUpdateRequest smSSenderUpdateRequest);
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.
*/
* Copyright (c) 2023, 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.api.server.notification.sender.v1.factories;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.
*/
* Copyright (c) 2023, 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.api.server.notification.sender.v1.model;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.
*/
* Copyright (c) 2023, 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.api.server.notification.sender.v1.model;

Expand Down
Loading
Loading