1
1
package au.org.ala.profile.api
2
2
3
3
import au.ala.org.ws.security.RequireApiKey
4
- import au.org.ala.profile.analytics.Analytics
5
4
import au.org.ala.profile.hub.BaseController
6
5
import au.org.ala.profile.hub.MapService
7
6
import au.org.ala.profile.hub.ProfileService
@@ -21,7 +20,6 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement
21
20
import io.swagger.v3.oas.annotations.security.SecurityScheme
22
21
import au.org.ala.plugins.openapi.Path
23
22
24
- @Analytics
25
23
@SecurityScheme (name = " auth" ,
26
24
type = SecuritySchemeType .HTTP ,
27
25
scheme = " bearer"
@@ -36,6 +34,78 @@ class ApiController extends BaseController {
36
34
MapService mapService
37
35
ApiService apiService
38
36
37
+ @Path (" /api/opus/{opusId}" )
38
+ @Operation (
39
+ summary = " Get collection (opus) details" ,
40
+ operationId = " /api/opus/{opusId}" ,
41
+ method = " GET" ,
42
+ responses = [
43
+ @ApiResponse (
44
+ responseCode = " 200" ,
45
+ content = @Content (
46
+ mediaType = " application/json" ,
47
+ array = @ArraySchema (
48
+ schema = @Schema (
49
+ implementation = OpusResponse .class
50
+ )
51
+ )
52
+ ),
53
+ headers = [
54
+ @Header (name = ' Access-Control-Allow-Headers' , description = " CORS header" , schema = @Schema (type = " String" )),
55
+ @Header (name = ' Access-Control-Allow-Methods' , description = " CORS header" , schema = @Schema (type = " String" )),
56
+ @Header (name = ' Access-Control-Allow-Origin' , description = " CORS header" , schema = @Schema (type = " String" ))
57
+ ]
58
+ ),
59
+ @ApiResponse (responseCode = " 400" ,
60
+ description = " opusId is a required parameter" ),
61
+ @ApiResponse (responseCode = " 403" ,
62
+ description = " You do not have the necessary permissions to perform this action." ),
63
+ @ApiResponse (responseCode = " 405" ,
64
+ description = " An unexpected error has occurred while processing your request." ),
65
+ @ApiResponse (responseCode = " 404" ,
66
+ description = " Collection not found" ),
67
+ @ApiResponse (responseCode = " 500" ,
68
+ description = " An unexpected error has occurred while processing your request." )
69
+ ],
70
+ parameters = [
71
+ @Parameter (
72
+ name = " opusId" ,
73
+ in = ParameterIn .PATH ,
74
+ required = true ,
75
+ description = " Collection id"
76
+ ),
77
+ @Parameter (name = " Access-Token" ,
78
+ in = ParameterIn .HEADER ,
79
+ required = false ,
80
+ description = " Access token to read private collection" ),
81
+ @Parameter (name = " Accept-Version" ,
82
+ in = ParameterIn .HEADER ,
83
+ required = true ,
84
+ description = " The API version" ,
85
+ schema = @Schema (
86
+ name = " Accept-Version" ,
87
+ type = " string" ,
88
+ defaultValue = ' 1.0' ,
89
+ allowableValues = [" 1.0" ]
90
+ )
91
+ )
92
+ ],
93
+ security = [@SecurityRequirement (name = " auth" ), @SecurityRequirement (name = " oauth" )]
94
+ )
95
+ def getOpus () {
96
+ if (! params. opusId) {
97
+ badRequest " opusId is a required parameter"
98
+ } else {
99
+ Map opus = profileService. getOpus(params. opusId)
100
+ if (! opus) {
101
+ notFound()
102
+ } else {
103
+ opus. remove(' accessToken' )
104
+ render opus as JSON
105
+ }
106
+ }
107
+ }
108
+
39
109
@Path (" /api/opus/{opusId}/profile" )
40
110
@Operation (
41
111
summary = " List profiles in a collection" ,
0 commit comments