2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdcrests.notifications.rest.services;
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
27 import org.openecomp.sdcrests.notifications.types.UpdateNotificationResponseStatus;
28 import org.springframework.validation.annotation.Validated;
30 import javax.validation.constraints.NotNull;
32 import javax.ws.rs.core.MediaType;
33 import javax.ws.rs.core.Response;
34 import java.lang.reflect.InvocationTargetException;
35 import java.util.UUID;
37 import static org.openecomp.sdcrests.common.RestConstants.*;
39 @Path("/v1.0/notifications")
40 @Produces(MediaType.APPLICATION_JSON)
41 @Consumes(MediaType.APPLICATION_JSON)
42 @Api(value = "Notifications")
44 public interface Notifications {
45 String LIMIT_QUERY_PARAM = "NOTIFICATION_ROWS_LIMIT";
46 String END_OF_PAGE_QUERY_PARAM = "END_OF_PAGE_EVENT_ID";
49 @ApiOperation(value = "Retrive all user notifications",
50 response = NotificationsStatusDto.class,
51 responseContainer = "List")
52 Response getNotifications(
53 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
54 @QueryParam(LAST_DELIVERED_QUERY_PARAM) UUID lastDelvered,
55 @QueryParam(END_OF_PAGE_QUERY_PARAM) UUID endOfPage);
58 @Path("/{notificationId}")
59 @ApiOperation(value = "Mark notification as read",
60 response = UpdateNotificationResponseStatus.class)
62 @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
63 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
64 throws InvocationTargetException, IllegalAccessException;
67 @Path("/last-seen/{notificationId}")
68 @ApiOperation(value = "Update Last Seen Notification",
69 response = UpdateNotificationResponseStatus.class)
70 Response updateLastSeenNotification(
71 @ApiParam(value = "Notification Id") @PathParam("notificationId") String notificationId,
72 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
73 throws InvocationTargetException, IllegalAccessException;
77 @ApiOperation(value = "Retrive user not delivered notifications",
78 response = NotificationsStatusDto.class,
79 responseContainer = "List")
80 Response getNewNotificationsByOwnerId(
81 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
82 @QueryParam(LAST_DELIVERED_QUERY_PARAM) String eventId,
83 @QueryParam(LIMIT_QUERY_PARAM) String limit);