From 44aa3a93a9e470aecbad9c5e6d4d97007d1b636a Mon Sep 17 00:00:00 2001 From: prabathabey Date: Sat, 28 May 2016 02:07:17 +0530 Subject: [PATCH] Adding more improvements to swagger annotations --- .../DeviceManagementAdminService.java | 2 +- .../services/DeviceManagementService.java | 20 +++++++++++++------ .../DeviceTypeConfigurationService.java | 9 ++++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index ee2f51d27..a343596c0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -42,7 +42,7 @@ public interface DeviceManagementAdminService { @ApiOperation( consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", - value = "Adding a Device Lock on Android Devices", + value = "Adds a Device Lock on Android Devices", notes = "Using this API you have the option of hard locking an Android device, where the Administrator " + "permanently locks the device or screen locking an Android device" ) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java index 81f2d4af0..8bd6de7b8 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java @@ -108,7 +108,7 @@ public interface DeviceManagementService { @ResponseHeader(name = "Location", description = "URL of the device enrolled")}), @ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."), @ApiResponse(code = 500, message = "Internal Server Error. \n " + - "Server error occurred while enrolling the device."), + "Server error occurred while enrolling the device.") }) Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Device device); @@ -144,17 +144,25 @@ public interface DeviceManagementService { @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Device enrollment has been updated successfully", responseHeaders = { - @ResponseHeader(name = "Location", description = "The URL of the updated device."), + @ResponseHeader(name = "Content-Location", description = "The URL of the updated device."), @ResponseHeader(name = "Content-Type", description = "The content type of the body"), @ResponseHeader(name = "ETag", description = "Entity Tag of the response resource.\n" + "Used by caches, or in conditional requests."), @ResponseHeader(name = "Last-Modified", description = "Date and time the resource has been modified the last time.\n" + "Used by caches, or in conditional requests.")}), - @ApiResponse(code = 204, message = "No Content. \n Enrollment of the device has not been updated"), - @ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse(code = 404, message = "Not Found. \n Resource to be deleted does not exist."), - @ApiResponse(code = 500, message = "Internal Server Error. \n " + + @ApiResponse( + code = 204, + message = "No Content. \n Enrollment of the device has not been updated"), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 404, + message = "Not Found. \n Resource to be deleted does not exist."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + "Server error occurred while modifying the current enrollment of the device.") }) Response modifyEnrollment(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java index 46b38d30a..02a4ac76e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java @@ -18,10 +18,7 @@ */ package org.wso2.carbon.mdm.services.android.services; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.*; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; @@ -29,6 +26,8 @@ import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +@Api(value = "Android Configuration Management API", description = "This API carries all resource associated with " + + "manipulating the general configurations of Android platform") @Path("/configuration") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -69,7 +68,7 @@ public interface DeviceTypeConfigurationService { notes = "Update the Android platform configurations using this REST API" ) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Created"), + @ApiResponse(code = 200, message = "OK. \n Platform configuration has successfully been updated"), @ApiResponse(code = 500, message = "Error occurred while modifying configuration settings of " + "Android platform") })