Skip to content

Commit

Permalink
feat: added swagger api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EncryptEx committed Jul 7, 2024
1 parent eec977e commit aa549d1
Show file tree
Hide file tree
Showing 6 changed files with 817 additions and 73 deletions.
17 changes: 17 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

/**
* @OA\Info(
* title="Femtolink API Documentation",
* version="1.0.0",
* )
* @OA\Tag(
* name="Links",
* description="Operations about links"
* ),
* @OA\SecurityScheme(
* type="http",
* securityScheme="bearerAuth",
* scheme="bearer",
* bearerFormat="JWT"
* )
*
*/
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
Expand Down
19 changes: 19 additions & 0 deletions app/Http/Controllers/LinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ public function get(string $short_url)
return abort(404);
}


/**
* @OA\Post(
* path="/api/link",
* summary="Create a new shorted link",
* tags={"Links"},
* @OA\Parameter(
* name="long_url",
* in="query",
* description="The long URL to be shortened",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response="200", description="Link created successfully"),
* @OA\Response(response="401", description="Unauthorized"),
* @OA\Response(response="400", description="Bad Request"),
* security={{"bearerAuth":{}}}
* )
*/
public function store(Request $request)
{

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"darkaonline/l5-swagger": "^8.6",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
Expand Down
Loading

0 comments on commit aa549d1

Please sign in to comment.