Skip to content

Commit 39c9523

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

28 files changed

+641
-371
lines changed

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

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.mirth.connect.client.core.Permissions;
3838
import com.mirth.connect.client.core.api.BaseServletInterface;
3939
import com.mirth.connect.client.core.api.MirthOperation;
40+
import com.mirth.connect.client.core.api.ApiContentTypes;
4041
import com.mirth.connect.client.core.api.Param;
4142
import com.mirth.connect.model.ChannelHeader;
4243
import com.mirth.connect.model.alert.AlertInfo;
@@ -45,8 +46,8 @@
4546

4647
@Path("/alerts")
4748
@Tag(name = "Alerts")
48-
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
49-
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
49+
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON })
50+
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON })
5051
public interface AlertServletInterface extends BaseServletInterface {
5152

5253
@POST
@@ -58,7 +59,8 @@ public void createAlert(
5859
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
5960
@ExampleObject(name = "alert", ref = "../apiexamples/alert_xml") }),
6061
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
61-
@ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }) }) AlertModel alertModel)
62+
@ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }),
63+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON) }) AlertModel alertModel)
6264
throws ClientException;
6365

6466
@GET
@@ -68,7 +70,8 @@ public void createAlert(
6870
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
6971
@ExampleObject(name = "alert", ref = "../apiexamples/alert_xml") }),
7072
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
71-
@ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }), })
73+
@ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }),
74+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
7275
@MirthOperation(name = "getAlert", display = "Get alerts", permission = Permissions.ALERTS_VIEW)
7376
public AlertModel getAlert(
7477
@Param("alertId") @Parameter(description = "The ID of the alert.", required = true) @PathParam("alertId") String alertId)
@@ -81,7 +84,8 @@ public AlertModel getAlert(
8184
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
8285
@ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_xml") }),
8386
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
84-
@ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }), })
87+
@ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }),
88+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
8589
@MirthOperation(name = "getAlert", display = "Get alerts", permission = Permissions.ALERTS_VIEW)
8690
public List<AlertModel> getAlerts(
8791
@Param("alertIds") @Parameter(description = "The ID of the alert(s). If absent, all alerts will be returned.") @QueryParam("alertId") Set<String> alertIds)
@@ -94,14 +98,17 @@ public List<AlertModel> getAlerts(
9498
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
9599
@ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_xml") }),
96100
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
97-
@ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }) })
101+
@ExampleObject(name = "alert_list", ref = "../apiexamples/alert_list_json") }),
102+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
98103
@MirthOperation(name = "getAlert", display = "Get alerts", permission = Permissions.ALERTS_VIEW)
99104
public List<AlertModel> getAlertsPost(
100105
@Param("alertIds") @RequestBody(description = "The ID of the alert(s). If absent, all alerts will be returned.", content = {
101106
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
102107
@ExampleObject(name = "alert_set", ref = "../apiexamples/guid_set_xml") }),
103108
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
104-
@ExampleObject(name = "alert_set", ref = "../apiexamples/guid_set_json") }) }) Set<String> alertIds)
109+
@ExampleObject(name = "alert_set", ref = "../apiexamples/guid_set_json") }),
110+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
111+
Set<String> alertIds)
105112
throws ClientException;
106113

107114
@GET
@@ -111,7 +118,8 @@ public List<AlertModel> getAlertsPost(
111118
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
112119
@ExampleObject(name = "alert_status_list", ref = "../apiexamples/alert_status_list_xml") }),
113120
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
114-
@ExampleObject(name = "alert_status_list", ref = "../apiexamples/alert_status_list_json") }) })
121+
@ExampleObject(name = "alert_status_list", ref = "../apiexamples/alert_status_list_json") }),
122+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
115123
@MirthOperation(name = "getAlertStatusList", display = "Get alert status list", permission = Permissions.ALERTS_VIEW, type = ExecuteType.ASYNC, auditable = false)
116124
public List<AlertStatus> getAlertStatusList() throws ClientException;
117125

@@ -122,15 +130,18 @@ public List<AlertModel> getAlertsPost(
122130
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
123131
@ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_xml") }),
124132
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
125-
@ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }) })
133+
@ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }),
134+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
126135
@MirthOperation(name = "getAlertInfo", display = "Get alert info", permission = Permissions.ALERTS_VIEW, auditable = false)
127136
public AlertInfo getAlertInfo(// @formatter:off
128137
@Param("alertId") @Parameter(description = "The ID of the alert.", required = true) @PathParam("alertId") String alertId,
129138
@Param("cachedChannels") @RequestBody(description = "A map of ChannelHeader objects telling the server the state of the client-side channel cache.", required = true, content = {
130139
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
131140
@ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_xml") }),
132141
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
133-
@ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }) }) Map<String, ChannelHeader> cachedChannels)
142+
@ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }),
143+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
144+
Map<String, ChannelHeader> cachedChannels)
134145
throws ClientException;
135146
// @formatter:on
136147

@@ -141,23 +152,28 @@ public AlertInfo getAlertInfo(// @formatter:off
141152
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
142153
@ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_xml") }),
143154
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
144-
@ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }) })
155+
@ExampleObject(name = "alert_info", ref = "../apiexamples/alert_info_json") }),
156+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
145157
@MirthOperation(name = "getAlertInfo", display = "Get alert info", permission = Permissions.ALERTS_VIEW)
146158
public AlertInfo getAlertInfo(
147159
@Param("cachedChannels") @RequestBody(description = "A map of ChannelHeader objects telling the server the state of the client-side channel cache.", required = true, content = {
148160
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
149161
@ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_xml") }),
150162
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
151-
@ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }) }) Map<String, ChannelHeader> cachedChannels)
163+
@ExampleObject(name = "channel_header_map", ref = "../apiexamples/channel_header_map_json") }),
164+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
165+
Map<String, ChannelHeader> cachedChannels)
152166
throws ClientException;
153167

154168
@GET
155169
@Path("/options")
156170
@Operation(summary = "Returns all alert protocol options.")
157-
@ApiResponse(content = { @Content(mediaType = MediaType.APPLICATION_XML, examples = {
158-
@ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_xml") }),
171+
@ApiResponse(content = {
172+
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
173+
@ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_xml") }),
159174
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
160-
@ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_json") }) })
175+
@ExampleObject(name = "alert_protocol_options", ref = "../apiexamples/alert_protocol_options_json") }),
176+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
161177
@MirthOperation(name = "getAlertProtocolOptions", display = "Get alert protocol options", permission = Permissions.ALERTS_VIEW, auditable = false)
162178
public Map<String, Map<String, String>> getAlertProtocolOptions() throws ClientException;
163179

@@ -171,7 +187,9 @@ public void updateAlert(// @formatter:off
171187
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
172188
@ExampleObject(name = "alert", ref = "../apiexamples/alert_xml") }),
173189
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
174-
@ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }) }) AlertModel alertModel)
190+
@ExampleObject(name = "alert", ref = "../apiexamples/alert_json") }),
191+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
192+
AlertModel alertModel)
175193
throws ClientException;
176194
// @formatter:on
177195

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,45 +34,51 @@
3434
import com.mirth.connect.client.core.ClientException;
3535
import com.mirth.connect.client.core.Operation.ExecuteType;
3636
import com.mirth.connect.client.core.Permissions;
37+
import com.mirth.connect.client.core.api.ApiContentTypes;
3738
import com.mirth.connect.client.core.api.BaseServletInterface;
3839
import com.mirth.connect.client.core.api.MirthOperation;
3940
import com.mirth.connect.client.core.api.Param;
4041
import com.mirth.connect.model.ChannelGroup;
4142

4243
@Path("/channelgroups")
4344
@Tag(name = "Channel Groups")
44-
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
45-
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
45+
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON })
46+
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON })
4647
public interface ChannelGroupServletInterface extends BaseServletInterface {
4748

4849
@GET
4950
@Path("/")
5051
@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") }),
52+
@ApiResponse(content = {
53+
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
54+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }),
5355
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
54-
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }) })
56+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }),
57+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
5558
@MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false)
5659
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;
5760

5861
@POST
5962
@Path("/_getChannelGroups")
6063
@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") }),
64+
@ApiResponse(content = {
65+
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
66+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_xml") }),
6367
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
64-
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }) })
68+
@ExampleObject(name = "channel_group_list", ref = "../apiexamples/channel_group_list_json") }),
69+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), })
6570
@MirthOperation(name = "getChannelGroups", display = "Get channel groups", permission = Permissions.CHANNEL_GROUPS_VIEW, type = ExecuteType.ASYNC, auditable = false)
6671
public List<ChannelGroup> getChannelGroupsPost(@Param("channelGroupIds") @RequestBody(description = "The IDs of the channel groups to retrieve. If absent, all groups will be retrieved.", content = {
6772
@Content(mediaType = MediaType.APPLICATION_XML, examples = {
6873
@ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_xml") }),
6974
@Content(mediaType = MediaType.APPLICATION_JSON, examples = {
70-
@ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_json") }) }) Set<String> channelGroupIds) throws ClientException;
75+
@ExampleObject(name = "group_set", ref = "../apiexamples/guid_set_json") }),
76+
@Content(mediaType = ApiContentTypes.APPLICATION_MIRTHAPI_JSON), }) Set<String> channelGroupIds) throws ClientException;
7177

7278
@POST
7379
@Path("/_bulkUpdate")
7480
@Consumes(MediaType.MULTIPART_FORM_DATA)
75-
@Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN })
81+
@Produces({ MediaType.APPLICATION_JSON, ApiContentTypes.APPLICATION_MIRTHAPI_JSON, MediaType.TEXT_PLAIN })
7682
@Operation(summary = "Updates all channel groups in one request. " + SWAGGER_TRY_IT_OUT_DISCLAIMER)
7783
@MirthOperation(name = "updateChannelGroups", display = "Update channel groups", permission = Permissions.CHANNELS_MANAGE)
7884
public boolean updateChannelGroups(// @formatter:off

0 commit comments

Comments
 (0)