mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 13:14:30 -04:00
Working on Swagger
This commit is contained in:
parent
5d3a24800e
commit
0524f53850
@ -23,6 +23,22 @@ class ClientApiController extends Controller
|
||||
return Response::make('', 200, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @SWG\Get(
|
||||
* path="/clients",
|
||||
* summary="List of clients",
|
||||
* tags={"client"},
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="A list with clients",
|
||||
* @SWG\Schema(type="array", @SWG\Items(ref="#/definitions/Client"))
|
||||
* ),
|
||||
* @SWG\Response(
|
||||
* response="default",
|
||||
* description="an ""unexpected"" error"
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$clients = Client::scope()
|
||||
@ -37,6 +53,27 @@ class ClientApiController extends Controller
|
||||
return Response::make($response, 200, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @SWG\Post(
|
||||
* path="/clients",
|
||||
* tags={"client"},
|
||||
* summary="Create a client",
|
||||
* @SWG\Parameter(
|
||||
* in="body",
|
||||
* name="body",
|
||||
* @SWG\Schema(ref="#/definitions/Client")
|
||||
* ),
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="New client",
|
||||
* @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Client"))
|
||||
* ),
|
||||
* @SWG\Response(
|
||||
* response="default",
|
||||
* description="an ""unexpected"" error"
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function store(CreateClientRequest $request)
|
||||
{
|
||||
$client = $this->clientRepo->save($request->input());
|
||||
|
@ -83,7 +83,7 @@ class InvoiceApiController extends Controller
|
||||
* ),
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="Newly created invoice",
|
||||
* description="New invoice",
|
||||
* @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Invoice"))
|
||||
* ),
|
||||
* @SWG\Response(
|
||||
|
@ -5,8 +5,18 @@ use App\Models\Client;
|
||||
use App\Models\Contact;
|
||||
use League\Fractal;
|
||||
|
||||
/**
|
||||
* @SWG\Definition(definition="Client", @SWG\Xml(name="Client"))
|
||||
*/
|
||||
|
||||
class ClientTransformer extends EntityTransformer
|
||||
{
|
||||
/**
|
||||
* @SWG\Property(property="id", type="integer", example=1, readOnly=true)
|
||||
* @SWG\Property(property="balance", type="float", example=10, readOnly=true)
|
||||
* @SWG\Property(property="paid_to_date", type="float", example=10, readOnly=true)
|
||||
*/
|
||||
|
||||
protected $defaultIncludes = [
|
||||
'contacts',
|
||||
'invoices',
|
||||
|
@ -6,7 +6,7 @@ use App\Models\Invoice;
|
||||
use League\Fractal;
|
||||
|
||||
/**
|
||||
* @SWG\Definition(definition="Invoice",required={"invoice_number"}, @SWG\Xml(name="Invoice"))
|
||||
* @SWG\Definition(definition="Invoice", required={"invoice_number"}, @SWG\Xml(name="Invoice"))
|
||||
*/
|
||||
|
||||
class InvoiceTransformer extends EntityTransformer
|
||||
|
Loading…
x
Reference in New Issue
Block a user