mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Merge branch 'swagger_apidocs' into 'master'
Swagger API docs initial setup See merge request CIEFWorldwideSdnBhd/shipping-portal!1
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 665 B |
Binary file not shown.
|
After Width: | Height: | Size: 628 B |
+3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+4
File diff suppressed because one or more lines are too long
@@ -0,0 +1,82 @@
|
||||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="./swagger-assets/swagger-ui.css" />
|
||||
<link rel="icon" type="image/png" href="./swagger-assets/favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="./swagger-assets/favicon-16x16.png" sizes="16x16" />
|
||||
<style>
|
||||
html
|
||||
{
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after
|
||||
{
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
margin:0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="./swagger-assets/swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||
<script src="./swagger-assets/swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// Begin Swagger UI call region
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "{{ env('APP_URL') }}/swagger/json",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
responseInterceptor:
|
||||
function (response) {
|
||||
if (response.obj.data) {
|
||||
console.log('Response');
|
||||
console.log(response.obj);
|
||||
if (response.obj.data.token) {
|
||||
console.log("Auth Token: " + response.obj.data.token);
|
||||
const token = response.obj.data.token;
|
||||
localStorage.setItem("token", token)
|
||||
}
|
||||
return response;
|
||||
}
|
||||
},
|
||||
requestInterceptor:
|
||||
function (request) {
|
||||
console.log('Request');
|
||||
console.log(request);
|
||||
if( request.url.indexOf('login') < 0 && request.url.indexOf('swagger/json') < 0) {
|
||||
request.headers.Authorization = "Bearer " + localStorage.getItem("token");
|
||||
}
|
||||
return request;
|
||||
},
|
||||
layout: "StandaloneLayout"
|
||||
});
|
||||
// End Swagger UI call region
|
||||
|
||||
window.ui = ui;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
{"swagger":"2.0","info":{"description":"Shipping Portal to manage parcel","version":"1.0.0","title":"Shipping Portal"},"host":"{{request()->getHttpHost()}}","basePath":"/api","tags":[{"name":"Account","description":"Endpoints related to user module, e.g. login, register."},{"name":"Address","description":"Endpoints related t address module, e.g. create, district."}],"schemes":["http","https"],"paths":{"/account/authentication/login/attempt":{"post":{"tags":["Account"],"produces":["application/json"],"summary":"Logs user into the system","description":"","parameters":[{"name":"username","in":"query","description":"The user name for login","required":true,"type":"string"},{"name":"password","in":"query","description":"The password for login in clear text","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"400":{"description":"Invalid username/password supplied"}}}},"/account/authentication/logout":{"get":{"tags":["Account"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/address/id/show":{"get":{"tags":["Address"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/address/create":{"post":{"tags":["Address"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/address/update/id":{"put":{"tags":["Address"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/address/delete/id":{"delete":{"tags":["Address"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}}},"securityDefinitions":{"Authorization":{"type":"apiKey","name":"api_key","in":"header"},"petstore_auth":{"type":"oauth2","authorizationUrl":"https://petstore.swagger.io/oauth/authorize","flow":"implicit","scopes":{"read:pets":"read your pets","write:pets":"modify pets in your account"}}},"definitions":{"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"title":{"type":"string"},"message":{"type":"string"},"payload":{"type":"object"}}}}}
|
||||
@@ -16,3 +16,12 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'swagger'], function () {
|
||||
Route::get('/', function () {
|
||||
return view('swagger.index');
|
||||
});
|
||||
Route::get('/json', function () {
|
||||
return view('swagger.json');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user