This repository was archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
Expand file tree
/
Copy pathCatController.scala
More file actions
73 lines (63 loc) · 2.28 KB
/
CatController.scala
File metadata and controls
73 lines (63 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package testdata
import javax.inject.Inject
import io.swagger.annotations._
import play.api.mvc._
@Api(value = "/apitest/cats", description = "play with cats")
class CatController @Inject() () extends InjectedController {
@ApiOperation(value = "addCat1",
httpMethod = "PUT",
authorizations = Array(),
consumes = "",
protocols = "")
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "cat", value = "Cat object to add", required = true, dataType = "testdata.Cat", paramType = "body")))
def add1 = Action {
request => Ok("test case")
}
@ApiOperation(value = "Updates a new Cat",
notes = "Updates cats nicely",
httpMethod = "POST")
@ApiResponses(Array(
new ApiResponse(code = 405, message = "Invalid input")))
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "cat", value = "Cat object to update", required = true, dataType = "testdata.Cat", paramType = "body")))
def update = Action {
request => Ok("test case")
}
@ApiOperation(value = "Get Cat by Id",
notes = "Returns a cat",
response = classOf[Cat],
httpMethod = "GET",
produces = "")
@ApiResponses(Array(
new ApiResponse(code = 405, message = "Invalid input"),
new ApiResponse(code = 404, message = "Cat not found")))
def get1(@ApiParam(value = "ID of cat to fetch", required = true) id: Long) = Action {
request => Ok("test case")
}
@ApiOperation(value = "List Cats",
nickname = "listCats",
notes = "Returns all cats",
response = classOf[Cat],
responseContainer = "List",
httpMethod = "GET")
@Deprecated
def list = Action {
request => Ok("test case")
}
def no_route = Action {
request => Ok("test case")
}
@ApiOperation(value = "test issue #43",
nickname = "test issue #43_nick",
notes = "test issue #43_notes",
response = classOf[testdata.Cat],
responseContainer = "List",
httpMethod = "GET")
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "test_issue_43_implicit_param", dataType = "Option[Int]", value = "test issue #43 implicit param", paramType = "query")))
def testIssue43(test_issue_43_param: Option[Int]) = Action {
request => Ok("test issue #43")
}
}
case class Cat(id: Long, name: String)