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.v3.oas.annotations.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.info.Info;
27 import io.swagger.v3.oas.annotations.media.ArraySchema;
28 import io.swagger.v3.oas.annotations.media.Content;
29 import io.swagger.v3.oas.annotations.media.Schema;
30 import io.swagger.v3.oas.annotations.responses.ApiResponse;
31 import org.openecomp.sdcrests.notifications.types.NotificationsStatusDto;
32 import org.openecomp.sdcrests.notifications.types.UpdateNotificationResponseStatus;
33 import org.springframework.validation.annotation.Validated;
35 import javax.validation.constraints.NotNull;
37 import javax.ws.rs.core.MediaType;
38 import javax.ws.rs.core.Response;
39 import java.lang.reflect.InvocationTargetException;
40 import java.util.UUID;
42 import static org.openecomp.sdcrests.common.RestConstants.*;
44 @Path("/v1.0/notifications")
45 @Produces(MediaType.APPLICATION_JSON)
46 @Consumes(MediaType.APPLICATION_JSON)
47 @OpenAPIDefinition(info = @Info(title = "Notifications"))
49 public interface Notifications {
50 String LIMIT_QUERY_PARAM = "NOTIFICATION_ROWS_LIMIT";
51 String END_OF_PAGE_QUERY_PARAM = "END_OF_PAGE_EVENT_ID";
54 @Operation(description = "Retrieve all user notifications", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = NotificationsStatusDto.class)))))
55 Response getNotifications(
56 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
57 @QueryParam(LAST_DELIVERED_QUERY_PARAM) UUID lastDelvered,
58 @QueryParam(END_OF_PAGE_QUERY_PARAM) UUID endOfPage);
61 @Path("/{notificationId}")
62 @Operation(description = "Mark notification as read", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UpdateNotificationResponseStatus.class))))
64 @Parameter(description = "Notification Id") @PathParam("notificationId") String notificationId,
65 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
66 throws InvocationTargetException, IllegalAccessException;
69 @Path("/last-seen/{notificationId}")
70 @Operation(description = "Update Last Seen Notification", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UpdateNotificationResponseStatus.class))))
71 Response updateLastSeenNotification(
72 @Parameter(description = "Notification Id") @PathParam("notificationId") String notificationId,
73 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
74 throws InvocationTargetException, IllegalAccessException;
78 @Operation(description = "Retrive user not delivered notifications",responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = NotificationsStatusDto.class)))))
79 Response getNewNotificationsByOwnerId(
80 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user,
81 @QueryParam(LAST_DELIVERED_QUERY_PARAM) String eventId,
82 @QueryParam(LIMIT_QUERY_PARAM) String limit);