Skip to content

Commit

Permalink
working with API documentaion . Now its moved optional
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaldreams committed Dec 2, 2018
1 parent d971382 commit 79eb4b1
Show file tree
Hide file tree
Showing 22 changed files with 207 additions and 189 deletions.
19 changes: 1 addition & 18 deletions resources/templates/controller/api/destroy.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
/**
* Delete an existing @@modelName@@
*
* @Delete("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("id", description="The primary key of @@modelName@@",type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
* "status": 200,
* "message": "@@modelName@@ successfully deleted"
* }),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."}),
* @Response(500, body={"message": "Error occurred while deleting @@modelName@@"})
* })
*/
@@documentation@@
public function destroy(@@requestClass@@ $request, $@@modelNameParam@@)
{
$@@modelNameParam@@ = @@modelName@@::findOrFail($@@modelNameParam@@);
Expand Down
19 changes: 19 additions & 0 deletions resources/templates/controller/api/docs/destroy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Delete an existing @@modelName@@
*
* @Delete("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("id", description="The primary key of @@modelName@@",type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
* "status": 200,
* "message": "@@modelName@@ successfully deleted"
* }),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."}),
* @Response(500, body={"message": "Error occurred while deleting @@modelName@@"})
* })
*/

13 changes: 13 additions & 0 deletions resources/templates/controller/api/docs/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* List of @@modelName@@
*
* @Get("/")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("page", description="The page of results to view.", type="integer", default=1)
* })
* @Response(200, body={
"data": {{@@apiResponse@@}}
})
*/
17 changes: 17 additions & 0 deletions resources/templates/controller/api/docs/show.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Show details about a @@modelName@@
*
* @Get("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("id", description="The primary key of @@modelName@@",type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
* "data": {@@apiResponse@@}
* }),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."})
* })
*/

14 changes: 14 additions & 0 deletions resources/templates/controller/api/docs/store.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Create a @@modelName@@
*
*
* @Post("/store")
*
* @Versions({"v1"})
* @Transaction({
* @Request(@@apiRequest@@),
* @Response(200, body=@@apiResponse@@),
* @Response(500, body={"message": "Error occurred while saving @@modelName@@"})
* })
*/

15 changes: 15 additions & 0 deletions resources/templates/controller/api/docs/update.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Update a existing @@modelName@@
*
* @Put("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("id", description="The primary key of @@modelName@@", type="integer", required=true)
* })
* @Transaction({
* @Request(@@apiRequest@@),
* @Response(200, body=@@apiResponse@@),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."})
* })
*/
14 changes: 1 addition & 13 deletions resources/templates/controller/api/index.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
/**
* List of @@modelName@@
*
* @Get("/")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("page", description="The page of results to view.", type="integer", default=1)
* })
* @Response(200, body={
"data": {{@@apiResponse@@}}
})
*/
@@documentation@@
public function index(@@requestClass@@ $request)
{
return $this->response->paginator(@@modelName@@::paginate(10), new @@transformer@@());
Expand Down
24 changes: 2 additions & 22 deletions resources/templates/controller/api/parent/destroy.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
/**
* Delete an existing @@modelName@@
*
* @Delete("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("id", description="The primary key of @@modelName@@", type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
* "status": 200,
* "message": "@@modelName@@ successfully deleted"
* }),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."}),
* @Response(500, body={"message": "Error occurred while deleting @@modelName@@"})
* })
*/
public function destroy(@@requestClass@@ $request, $@@parentModelNameParam@@, $@@modelNameParam@@)
@@documentation@@
public function destroy(@@requestClass@@ $request, $@@parentModelNameParam@@, @@modelName@@ $@@modelNameParam@@)
{
$@@modelNameParam@@ = @@modelName@@::findOrFail($@@modelNameParam@@);

if ($@@modelNameParam@@->delete()) {
return $this->response->array(['status' => 200, 'message' => '@@modelName@@ successfully deleted']);
} else {
Expand Down
19 changes: 19 additions & 0 deletions resources/templates/controller/api/parent/docs/destroy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Delete an existing @@modelName@@
*
* @Delete("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("id", description="The primary key of @@modelName@@", type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
* "status": 200,
* "message": "@@modelName@@ successfully deleted"
* }),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."}),
* @Response(500, body={"message": "Error occurred while deleting @@modelName@@"})
* })
*/
14 changes: 14 additions & 0 deletions resources/templates/controller/api/parent/docs/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* List of @@modelName@@
*
* @Get("/")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("page", description="The page of results to view.", type="integer", default=1)
* })
* @Response(200, body={
"data": {}
})
*/
17 changes: 17 additions & 0 deletions resources/templates/controller/api/parent/docs/show.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Show details about a @@modelName@@
*
* @Get("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("id", description="The primary key of @@modelName@@", type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
"data": {}
}),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."})
* })
*/
16 changes: 16 additions & 0 deletions resources/templates/controller/api/parent/docs/store.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Create a @@modelName@@
*
*
* @Post("/store")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true)
* })
* @Transaction({
* @Request(@@apiRequest@@),
* @Response(200, body=@@apiResponse@@),
* @Response(500, body={"message": "Error occurred while saving @@modelName@@"})
* })
*/
16 changes: 16 additions & 0 deletions resources/templates/controller/api/parent/docs/update.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Update a existing @@modelName@@
*
* @Put("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("id", description="The primary key of @@modelName@@", type="integer", required=true)
* })
* @Transaction({
* @Request(@@apiRequest@@),
* @Response(200, body=@@apiResponse@@),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."})
* })
*/
15 changes: 1 addition & 14 deletions resources/templates/controller/api/parent/index.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
/**
* List of @@modelName@@
*
* @Get("/")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("page", description="The page of results to view.", type="integer", default=1)
* })
* @Response(200, body={
"data": {}
})
*/
@@documentation@@
public function index(@@requestClass@@ $request, $@@parentModelNameParam@@)
{
return $this->response->paginator(@@modelName@@::paginate(10), new @@transformer@@());
Expand Down
21 changes: 2 additions & 19 deletions resources/templates/controller/api/parent/show.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
/**
* Show details about a @@modelName@@
*
* @Get("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("id", description="The primary key of @@modelName@@", type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
"data": {}
}),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."})
* })
*/
public function show(@@requestClass@@ $request, $@@parentModelNameParam@@, $@@modelNameParam@@)
@@documentation@@
public function show(@@requestClass@@ $request, $@@parentModelNameParam@@, @@modelName@@ $@@modelNameParam@@)
{
$@@modelNameParam@@ = @@modelName@@::findOrFail($@@modelNameParam@@);
return $this->response->item($@@modelNameParam@@, new @@transformer@@());
}
17 changes: 1 addition & 16 deletions resources/templates/controller/api/parent/store.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
/**
* Create a @@modelName@@
*
*
* @Post("/store")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true)
* })
* @Transaction({
* @Request(@@apiRequest@@),
* @Response(200, body=@@apiResponse@@),
* @Response(500, body={"message": "Error occurred while saving @@modelName@@"})
* })
*/
@@documentation@@
public function store(@@requestClass@@ $request, $@@parentModelNameParam@@)
{
$model=new @@modelName@@;
Expand Down
21 changes: 2 additions & 19 deletions resources/templates/controller/api/parent/update.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
/**
* Update a existing @@modelName@@
*
* @Put("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("@@parentModelNameParam@@", description="The primary key of @@parentModelNameParam@@", type="integer", required=true),
* @Parameter("id", description="The primary key of @@modelName@@", type="integer", required=true)
* })
* @Transaction({
* @Request(@@apiRequest@@),
* @Response(200, body=@@apiResponse@@),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."})
* })
*/
public function update(@@requestClass@@ $request, $@@parentModelNameParam@@, $@@modelNameParam@@)
@@documentation@@
public function update(@@requestClass@@ $request, $@@parentModelNameParam@@, @@modelName@@ $@@modelNameParam@@)
{
$@@modelNameParam@@ = @@modelName@@::findOrFail($@@modelNameParam@@);
$@@modelNameParam@@->fill($request->all());

if ($@@modelNameParam@@->save()) {
return $this->response->item($@@modelNameParam@@, new @@transformer@@());
} else {
Expand Down
20 changes: 2 additions & 18 deletions resources/templates/controller/api/show.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
/**
* Show details about a @@modelName@@
*
* @Get("/{id}")
*
* @Versions({"v1"})
* @Parameters({
* @Parameter("id", description="The primary key of @@modelName@@",type="integer", required=true)
* })
* @Transaction({
* @Response(200, body={
* "data": {@@apiResponse@@}
* }),
* @Response(404, body={"message": "No query results for model [@@fullmodelName@@]."})
* })
*/
public function show(@@requestClass@@ $request, $@@modelNameParam@@)
@@documentation@@
public function show(@@requestClass@@ $request, @@modelName@@ $@@modelNameParam@@)
{
$@@modelNameParam@@ = @@modelName@@::findOrFail($@@modelNameParam@@);
return $this->response->item($@@modelNameParam@@, new @@transformer@@());
}
15 changes: 1 addition & 14 deletions resources/templates/controller/api/store.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
/**
* Create a @@modelName@@
*
*
* @Post("/store")
*
* @Versions({"v1"})
* @Transaction({
* @Request(@@apiRequest@@),
* @Response(200, body=@@apiResponse@@),
* @Response(500, body={"message": "Error occurred while saving @@modelName@@"})
* })
*/
@@documentation@@
public function store(@@requestClass@@ $request)
{
$model=new @@modelName@@;
$model->fill($request->all());

if ($model->save()) {
return $this->response->item($model, new @@transformer@@());
} else {
Expand Down
Loading

0 comments on commit 79eb4b1

Please sign in to comment.