Skip to content

Commit 5fcca68

Browse files
committed
Add application/mirthapi+json to each endpoint
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent ad82b2b commit 5fcca68

28 files changed

+4426
-4156
lines changed

server/src/com/mirth/connect/client/core/api/servlets/AlertServletInterface.java

Lines changed: 218 additions & 200 deletions
Large diffs are not rendered by default.
Lines changed: 101 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,102 @@
1-
/*
2-
* Copyright (c) Mirth Corporation. All rights reserved.
3-
*
4-
* http://www.mirthcorp.com
5-
*
6-
* The software in this package is published under the terms of the MPL license a copy of which has
7-
* been included with this distribution in the LICENSE.txt file.
8-
*/
9-
10-
package com.mirth.connect.client.core.api.servlets;
11-
12-
import io.swagger.v3.oas.annotations.Operation;
13-
import io.swagger.v3.oas.annotations.Parameter;
14-
import io.swagger.v3.oas.annotations.media.Content;
15-
import io.swagger.v3.oas.annotations.media.ExampleObject;
16-
import io.swagger.v3.oas.annotations.media.Schema;
17-
import io.swagger.v3.oas.annotations.parameters.RequestBody;
18-
import io.swagger.v3.oas.annotations.responses.ApiResponse;
19-
import io.swagger.v3.oas.annotations.tags.Tag;
20-
21-
import java.util.List;
22-
import java.util.Set;
23-
24-
import javax.ws.rs.Consumes;
25-
import javax.ws.rs.GET;
26-
import javax.ws.rs.POST;
27-
import javax.ws.rs.Path;
28-
import javax.ws.rs.Produces;
29-
import javax.ws.rs.QueryParam;
30-
import javax.ws.rs.core.MediaType;
31-
32-
import org.glassfish.jersey.media.multipart.FormDataParam;
33-
34-
import com.mirth.connect.client.core.ClientException;
35-
import com.mirth.connect.client.core.Operation.ExecuteType;
36-
import com.mirth.connect.client.core.Permissions;
37-
import com.mirth.connect.client.core.api.BaseServletInterface;
38-
import com.mirth.connect.client.core.api.MirthOperation;
39-
import com.mirth.connect.client.core.api.Param;
40-
import com.mirth.connect.model.ChannelGroup;
41-
42-
@Path("/channelgroups")
43-
@Tag(name = "Channel Groups")
44-
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
45-
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
46-
public interface ChannelGroupServletInterface extends BaseServletInterface {
47-
48-
@GET
49-
@Path("/")
50-
@Operation(summary = "Retrieve a list of all channel groups, or multiple channel groups by ID.")
51-
@ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = {
52-
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }),
53-
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
54-
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }) })
55-
@MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false)
56-
public List<ChannelGroup> getChannelGroups(@Param("channelGroupIds") @Parameter(description = "The IDs of the channel groups to retrieve. If absent, all groups will be retrieved.") @QueryParam("channelGroupId") Set<String> channelGroupIds) throws ClientException;
57-
58-
@POST
59-
@Path("/_getChannelGroups")
60-
@Operation(summary = "Retrieve a list of all channel groups, or multiple channel groups by ID. This is a POST request alternative to GET /channelgroups that may be used when there are too many channel group IDs to include in the query parameters.")
61-
@ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = {
62-
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }),
63-
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
64-
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }) })
65-
@MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false)
66-
public List<ChannelGroup> getChannelGroupsPost(@Param("channelGroupIds") @RequestBody(description = "The IDs of the channel groups to retrieve. If absent, all groups will be retrieved.", content = {
67-
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
68-
@ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_xml") }),
69-
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
70-
@ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_json") }) }) Set<String> channelGroupIds) throws ClientException;
71-
72-
@POST
73-
@Path("/_bulkUpdate")
74-
@Consumes(MediaType.MULTIPART_FORM_DATA)
75-
@Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN })
76-
@Operation(summary = "Updates all channel groups in one request. " + SWAGGER_TRY_IT_OUT_DISCLAIMER)
77-
@MirthOperation(name = "updateChannelGroups", display = "Update channel groups", permission = Permissions.CHANNELS_MANAGE)
78-
public boolean updateChannelGroups(// @formatter:off
79-
@Param("channelGroups")
80-
@Parameter(description = "The channel group object to update or create.")
81-
@Schema(description = "The channel group object to update or create.", type = "object")
82-
@FormDataParam("channelGroups")
83-
Set<ChannelGroup> channelGroups,
84-
85-
@Param("removedChannelGroupIds")
86-
@Parameter(description = "All channel group IDs known to be removed.")
87-
@Schema(description = "All channel group IDs known to be removed.", type = "object")
88-
@FormDataParam("removedChannelGroupIds")
89-
Set<String> removedChannelGroupIds,
90-
91-
@Param("override")
92-
@Parameter(description = "If true, the channel groups will be updated even if different revisions exist on the server.", schema = @Schema(defaultValue = "false"))
93-
@QueryParam("override")
94-
boolean override) throws ClientException;
95-
// @formatter:on
1+
/*
2+
* Copyright (c) Mirth Corporation. All rights reserved.
3+
*
4+
* http://www.mirthcorp.com
5+
*
6+
* The software in this package is published under the terms of the MPL license a copy of which has
7+
* been included with this distribution in the LICENSE.txt file.
8+
*/
9+
10+
package com.mirth.connect.client.core.api.servlets;
11+
12+
import io.swagger.v3.oas.annotations.Operation;
13+
import io.swagger.v3.oas.annotations.Parameter;
14+
import io.swagger.v3.oas.annotations.media.Content;
15+
import io.swagger.v3.oas.annotations.media.ExampleObject;
16+
import io.swagger.v3.oas.annotations.media.Schema;
17+
import io.swagger.v3.oas.annotations.parameters.RequestBody;
18+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
19+
import io.swagger.v3.oas.annotations.tags.Tag;
20+
21+
import java.util.List;
22+
import java.util.Set;
23+
24+
import javax.ws.rs.Consumes;
25+
import javax.ws.rs.GET;
26+
import javax.ws.rs.POST;
27+
import javax.ws.rs.Path;
28+
import javax.ws.rs.Produces;
29+
import javax.ws.rs.QueryParam;
30+
import javax.ws.rs.core.MediaType;
31+
32+
import org.glassfish.jersey.media.multipart.FormDataParam;
33+
34+
import com.mirth.connect.client.core.ClientException;
35+
import com.mirth.connect.client.core.Operation.ExecuteType;
36+
import com.mirth.connect.client.core.Permissions;
37+
import com.mirth.connect.client.core.api.ApiContentTypes;
38+
import com.mirth.connect.client.core.api.BaseServletInterface;
39+
import com.mirth.connect.client.core.api.MirthOperation;
40+
import com.mirth.connect.client.core.api.Param;
41+
import com.mirth.connect.model.ChannelGroup;
42+
43+
@Path("/channelgroups")
44+
@Tag(name = "Channel Groups")
45+
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON })
46+
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON })
47+
public interface ChannelGroupServletInterface extends BaseServletInterface {
48+
49+
@GET
50+
@Path("/")
51+
@Operation(summary = "Retrieve a list of all channel groups, or multiple channel groups by ID.")
52+
@ApiResponse(content = {
53+
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
54+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }),
55+
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
56+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }),
57+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
58+
@MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false)
59+
public List<ChannelGroup> getChannelGroups(@Param("channelGroupIds") @Parameter(description = "The IDs of the channel groups to retrieve. If absent, all groups will be retrieved.") @QueryParam("channelGroupId") Set<String> channelGroupIds) throws ClientException;
60+
61+
@POST
62+
@Path("/_getChannelGroups")
63+
@Operation(summary = "Retrieve a list of all channel groups, or multiple channel groups by ID. This is a POST request alternative to GET /channelgroups that may be used when there are too many channel group IDs to include in the query parameters.")
64+
@ApiResponse(content = {
65+
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
66+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }),
67+
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
68+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }),
69+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
70+
@MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false)
71+
public List<ChannelGroup> getChannelGroupsPost(@Param("channelGroupIds") @RequestBody(description = "The IDs of the channel groups to retrieve. If absent, all groups will be retrieved.", content = {
72+
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
73+
@ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_xml") }),
74+
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
75+
@ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_json") }),
76+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set<String> channelGroupIds) throws ClientException;
77+
78+
@POST
79+
@Path("/_bulkUpdate")
80+
@Consumes(MediaType.MULTIPART_FORM_DATA)
81+
@Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN })
82+
@Operation(summary = "Updates all channel groups in one request. " + SWAGGER_TRY_IT_OUT_DISCLAIMER)
83+
@MirthOperation(name = "updateChannelGroups", display = "Update channel groups", permission = Permissions.CHANNELS_MANAGE)
84+
public boolean updateChannelGroups(// @formatter:off
85+
@Param("channelGroups")
86+
@Parameter(description = "The channel group object to update or create.")
87+
@Schema(description = "The channel group object to update or create.", type = "object")
88+
@FormDataParam("channelGroups")
89+
Set<ChannelGroup> channelGroups,
90+
91+
@Param("removedChannelGroupIds")
92+
@Parameter(description = "All channel group IDs known to be removed.")
93+
@Schema(description = "All channel group IDs known to be removed.", type = "object")
94+
@FormDataParam("removedChannelGroupIds")
95+
Set<String> removedChannelGroupIds,
96+
97+
@Param("override")
98+
@Parameter(description = "If true, the channel groups will be updated even if different revisions exist on the server.", schema = @Schema(defaultValue = "false"))
99+
@QueryParam("override")
100+
boolean override) throws ClientException;
101+
// @formatter:on
96102
}

0 commit comments

Comments
 (0)