Working on Swagger

This commit is contained in:
Hillel Coren 2015-11-08 23:53:13 +02:00
parent 2f9dd707f7
commit 5d3a24800e
5 changed files with 117 additions and 4 deletions

View File

@ -28,6 +28,7 @@ class InvoiceApiController extends Controller
* @SWG\Get(
* path="/invoices",
* summary="List of invoices",
* tags={"invoice"},
* @SWG\Response(
* response=200,
* description="A list with invoices",
@ -69,6 +70,28 @@ class InvoiceApiController extends Controller
return Response::make($response, 200, $headers);
}
/**
* @SWG\Post(
* path="/invoices",
* tags={"invoice"},
* summary="Create an invoice",
* @SWG\Parameter(
* in="body",
* name="body",
* @SWG\Schema(ref="#/definitions/Invoice")
* ),
* @SWG\Response(
* response=200,
* description="Newly created invoice",
* @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Invoice"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function store()
{
$data = Input::all();

View File

@ -16,6 +16,22 @@ class PaymentApiController extends Controller
$this->paymentRepo = $paymentRepo;
}
/**
* @SWG\Get(
* path="/payments",
* tags={"payment"},
* summary="List of payments",
* @SWG\Response(
* response=200,
* description="A list with payments",
* @SWG\Schema(type="array", @SWG\Items(ref="#/definitions/Payment"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function index($clientPublicId = false)
{
$payments = Payment::scope()
@ -37,6 +53,27 @@ class PaymentApiController extends Controller
}
/**
* @SWG\Post(
* path="/payments",
* summary="Create a payment",
* tags={"payment"},
* @SWG\Parameter(
* in="body",
* name="body",
* @SWG\Schema(ref="#/definitions/Payment")
* ),
* @SWG\Response(
* response=200,
* description="New payment",
* @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Payment"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function store()
{
$data = Input::all();

View File

@ -14,6 +14,22 @@ class QuoteApiController extends Controller
$this->invoiceRepo = $invoiceRepo;
}
/**
* @SWG\Get(
* path="/quotes",
* tags={"quote"},
* summary="List of quotes",
* @SWG\Response(
* response=200,
* description="A list with quotes",
* @SWG\Schema(type="array", @SWG\Items(ref="#/definitions/Invoice"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function index($clientPublicId = false)
{
$invoices = Invoice::scope()

View File

@ -15,6 +15,22 @@ class TaskApiController extends Controller
$this->taskRepo = $taskRepo;
}
/**
* @SWG\Get(
* path="/tasks",
* tags={"task"},
* summary="List of tasks",
* @SWG\Response(
* response=200,
* description="A list with tasks",
* @SWG\Schema(type="array", @SWG\Items(ref="#/definitions/Task"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function index($clientPublicId = false)
{
$tasks = Task::scope()->with('client');
@ -34,6 +50,27 @@ class TaskApiController extends Controller
return Response::make($response, 200, $headers);
}
/**
* @SWG\Post(
* path="/tasks",
* tags={"task"},
* summary="Create a task",
* @SWG\Parameter(
* in="body",
* name="body",
* @SWG\Schema(ref="#/definitions/Task")
* ),
* @SWG\Response(
* response=200,
* description="New task",
* @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Task"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function store()
{
$data = Input::all();

View File

@ -12,11 +12,11 @@ use League\Fractal;
class InvoiceTransformer extends EntityTransformer
{
/**
* @SWG\Property(property="id", type="integer", example=1)
* @SWG\Property(property="invoice_number", type="string", example="0001")
* @SWG\Property(property="amount", type="float", example=10)
* @SWG\Property(property="balance", type="float", example=10)
* @SWG\Property(property="id", type="integer", example=1, readOnly=true)
* @SWG\Property(property="amount", type="float", example=10, readOnly=true)
* @SWG\Property(property="balance", type="float", example=10, readOnly=true)
* @SWG\Property(property="client_id", type="integer", example=1)
* @SWG\Property(property="invoice_number", type="string", example="0001")
* @SWG\Property(property="invoice_status_id", type="integer", example=1)
*/