mirror of
https://github.com/resources-manager/resources-manager-api.git
synced 2024-12-22 09:03:58 +01:00
commit
5d08af6d42
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
config/sql.json
|
0
classes/README.md
Normal file
0
classes/README.md
Normal file
5
config/sql.json.sample
Normal file
5
config/sql.json.sample
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"dsn": "mysql:dbname=resourcesManager;host=localhost",
|
||||||
|
"user": "resourcesManager",
|
||||||
|
"password": "your pass"
|
||||||
|
}
|
0
public/doc-api/README.md
Normal file
0
public/doc-api/README.md
Normal file
BIN
public/doc-api/favicon-16x16.png
Normal file
BIN
public/doc-api/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 665 B |
BIN
public/doc-api/favicon-32x32.png
Normal file
BIN
public/doc-api/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 628 B |
60
public/doc-api/index.html
Normal file
60
public/doc-api/index.html
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<!-- 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-ui.css" >
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||||
|
<link rel="icon" type="image/png" href="./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-ui-bundle.js"> </script>
|
||||||
|
<script src="./swagger-ui-standalone-preset.js"> </script>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
// Begin Swagger UI call region
|
||||||
|
const ui = SwaggerUIBundle({
|
||||||
|
url: "resources-manager.yml",
|
||||||
|
dom_id: '#swagger-ui',
|
||||||
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout"
|
||||||
|
})
|
||||||
|
// End Swagger UI call region
|
||||||
|
|
||||||
|
window.ui = ui
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
68
public/doc-api/oauth2-redirect.html
Normal file
68
public/doc-api/oauth2-redirect.html
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<title>Swagger UI: OAuth2 Redirect</title>
|
||||||
|
<body onload="run()">
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
function run () {
|
||||||
|
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||||
|
var sentState = oauth2.state;
|
||||||
|
var redirectUrl = oauth2.redirectUrl;
|
||||||
|
var isValid, qp, arr;
|
||||||
|
|
||||||
|
if (/code|token|error/.test(window.location.hash)) {
|
||||||
|
qp = window.location.hash.substring(1);
|
||||||
|
} else {
|
||||||
|
qp = location.search.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
arr = qp.split("&")
|
||||||
|
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
|
||||||
|
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||||
|
function (key, value) {
|
||||||
|
return key === "" ? value : decodeURIComponent(value)
|
||||||
|
}
|
||||||
|
) : {}
|
||||||
|
|
||||||
|
isValid = qp.state === sentState
|
||||||
|
|
||||||
|
if ((
|
||||||
|
oauth2.auth.schema.get("flow") === "accessCode"||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorizationCode"
|
||||||
|
) && !oauth2.auth.code) {
|
||||||
|
if (!isValid) {
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "warning",
|
||||||
|
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qp.code) {
|
||||||
|
delete oauth2.state;
|
||||||
|
oauth2.auth.code = qp.code;
|
||||||
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
|
} else {
|
||||||
|
let oauthErrorMsg
|
||||||
|
if (qp.error) {
|
||||||
|
oauthErrorMsg = "["+qp.error+"]: " +
|
||||||
|
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||||
|
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "error",
|
||||||
|
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
</script>
|
110
public/doc-api/resources-manager.yml
Normal file
110
public/doc-api/resources-manager.yml
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
swagger: "2.0"
|
||||||
|
info:
|
||||||
|
description: "SimplePAD API"
|
||||||
|
version: "1.0.0"
|
||||||
|
title: "SimplePad API"
|
||||||
|
host: "simplepad.localhost"
|
||||||
|
basePath: "/api"
|
||||||
|
tags:
|
||||||
|
- name: "pad"
|
||||||
|
description: "CRUD Pads"
|
||||||
|
schemes:
|
||||||
|
- "https"
|
||||||
|
- "http"
|
||||||
|
paths:
|
||||||
|
/pad:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- "pad"
|
||||||
|
summary: "Create a new pad"
|
||||||
|
description: "Create a new PAD (with a random id)"
|
||||||
|
consumes:
|
||||||
|
- "application/json"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters:
|
||||||
|
- in: "body"
|
||||||
|
name: "body"
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Pad"
|
||||||
|
responses:
|
||||||
|
405:
|
||||||
|
description: "Invalid input"
|
||||||
|
200:
|
||||||
|
description: "SuccessFull"
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Pad"
|
||||||
|
|
||||||
|
/pad/{pad_id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- "pad"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters:
|
||||||
|
- in: "path"
|
||||||
|
name: "pad_id"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
maxLength: 6
|
||||||
|
minLength: 6
|
||||||
|
responses:
|
||||||
|
404:
|
||||||
|
description: "Does not exists"
|
||||||
|
200:
|
||||||
|
description: "SuccessFull"
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Pad"
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- "pad"
|
||||||
|
description: "Create a new PAD with the given ID"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters:
|
||||||
|
- in: "path"
|
||||||
|
name: "pad_id"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
maxLength: 6
|
||||||
|
minLength: 6
|
||||||
|
- in: "body"
|
||||||
|
name: "body"
|
||||||
|
description: "content"
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/PadPost"
|
||||||
|
responses:
|
||||||
|
405:
|
||||||
|
description: "Invalid input"
|
||||||
|
409:
|
||||||
|
description: "Given Id already exists"
|
||||||
|
200:
|
||||||
|
description: "SuccessFull"
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Pad"
|
||||||
|
|
||||||
|
definitions:
|
||||||
|
Pad:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
maxLength: 6
|
||||||
|
minLength: 6
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
create_date:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
PadPost:
|
||||||
|
type: "object"
|
||||||
|
required:
|
||||||
|
- content
|
||||||
|
properties:
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
|
||||||
|
|
134
public/doc-api/swagger-ui-bundle.js
Normal file
134
public/doc-api/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
1
public/doc-api/swagger-ui-bundle.js.map
Normal file
1
public/doc-api/swagger-ui-bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
22
public/doc-api/swagger-ui-standalone-preset.js
Normal file
22
public/doc-api/swagger-ui-standalone-preset.js
Normal file
File diff suppressed because one or more lines are too long
1
public/doc-api/swagger-ui-standalone-preset.js.map
Normal file
1
public/doc-api/swagger-ui-standalone-preset.js.map
Normal file
File diff suppressed because one or more lines are too long
4
public/doc-api/swagger-ui.css
Normal file
4
public/doc-api/swagger-ui.css
Normal file
File diff suppressed because one or more lines are too long
1
public/doc-api/swagger-ui.css.map
Normal file
1
public/doc-api/swagger-ui.css.map
Normal file
File diff suppressed because one or more lines are too long
9
public/doc-api/swagger-ui.js
Normal file
9
public/doc-api/swagger-ui.js
Normal file
File diff suppressed because one or more lines are too long
1
public/doc-api/swagger-ui.js.map
Normal file
1
public/doc-api/swagger-ui.js.map
Normal file
File diff suppressed because one or more lines are too long
0
public/index.php
Normal file
0
public/index.php
Normal file
Loading…
Reference in New Issue
Block a user