Init oc-shared

This commit is contained in:
mr
2024-08-12 14:12:51 +02:00
commit 944131a7f0
32 changed files with 2091 additions and 0 deletions

BIN
swagger/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

BIN
swagger/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

60
swagger/index.html Normal file
View 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" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "swagger.json",
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>

View File

@@ -0,0 +1,79 @@
<!doctype html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<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.schema.get("flow") === "authorization_code"
) && !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();
}
if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>
</body>
</html>

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

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

4
swagger/swagger-ui.css Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
swagger/swagger-ui.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

329
swagger/swagger.json Normal file
View File

@@ -0,0 +1,329 @@
{
"swagger": "2.0",
"info": {
"title": "beego Test API",
"description": "beego has a very cool tools to autogenerate documents for your API\n",
"version": "1.0.0",
"termsOfService": "http://beego.me/",
"contact": {
"email": "astaxie@gmail.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"basePath": "/oc/shared/",
"paths": {
"/version/": {
"get": {
"tags": [
"version"
],
"description": "get version\n\u003cbr\u003e",
"operationId": "VersionController.GetAll",
"responses": {
"200": {
"description": ""
}
}
}
},
"/workspace/": {
"get": {
"tags": [
"workspace"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.GetAll",
"responses": {
"200": {
"description": "{shared_workspace} models.shared_workspace"
}
}
},
"post": {
"tags": [
"workspace"
],
"description": "create shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Create",
"parameters": [
{
"in": "body",
"name": "data",
"description": "body for data content (Json format)",
"required": true,
"schema": {
"$ref": "#/definitions/json"
}
}
],
"responses": {
"200": {
"description": "{shared workspace} models.shared_workspace"
}
}
}
},
"/workspace/rule/": {
"get": {
"tags": [
"workspace/rule"
],
"description": "find rule by id\n\u003cbr\u003e",
"operationId": "RuleController.GetAll",
"responses": {
"200": {
"description": "{rule} models.rule"
}
}
},
"post": {
"tags": [
"workspace/rule"
],
"description": "create rule\n\u003cbr\u003e",
"operationId": "RuleController.Create",
"parameters": [
{
"in": "body",
"name": "data",
"description": "body for data content (Json format)",
"required": true,
"schema": {
"$ref": "#/definitions/json"
}
}
],
"responses": {
"200": {
"description": "{rule} models.rule"
}
}
}
},
"/workspace/rule/search/{search}": {
"get": {
"tags": [
"workspace/rule"
],
"description": "search rule\n\u003cbr\u003e",
"operationId": "RuleController.Search",
"parameters": [
{
"in": "path",
"name": "search",
"description": "the word search you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{rule} models.rule"
}
}
}
},
"/workspace/rule/{id}": {
"get": {
"tags": [
"workspace/rule"
],
"description": "find rule by id\n\u003cbr\u003e",
"operationId": "RuleController.Get",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the id you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{rule} models.rule"
}
}
},
"put": {
"tags": [
"workspace/rule"
],
"description": "create rules\n\u003cbr\u003e",
"operationId": "RuleController.Update",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the rule id you want to get",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"description": "The rule content",
"required": true,
"schema": {
"$ref": "#/definitions/models.rule"
}
}
],
"responses": {
"200": {
"description": "{rule} models.rule"
}
}
},
"delete": {
"tags": [
"workspace/rule"
],
"description": "delete the rule\n\u003cbr\u003e",
"operationId": "RuleController.Delete",
"parameters": [
{
"in": "path",
"name": "id",
"description": "The id you want to delete",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{rule} delete success!"
}
}
}
},
"/workspace/search/{search}": {
"get": {
"tags": [
"workspace"
],
"description": "search shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Search",
"parameters": [
{
"in": "path",
"name": "search",
"description": "the word search you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{shared workspace} models.shared_workspace"
}
}
}
},
"/workspace/{id}": {
"get": {
"tags": [
"workspace"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Get",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the id you want to get",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{shared workspace} models.shared_workspace"
}
}
},
"put": {
"tags": [
"workspace"
],
"description": "create shared workspaces\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Update",
"parameters": [
{
"in": "path",
"name": "id",
"description": "the shared workspace id you want to get",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"description": "The shared workspace content",
"required": true,
"schema": {
"$ref": "#/definitions/models.workspace"
}
}
],
"responses": {
"200": {
"description": "{shared workspace} models.shared_workspace"
}
}
},
"delete": {
"tags": [
"workspace"
],
"description": "delete the shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Delete",
"parameters": [
{
"in": "path",
"name": "id",
"description": "The id you want to delete",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "{shared workspace} delete success!"
}
}
}
}
},
"definitions": {
"json": {
"title": "json",
"type": "object"
},
"models.rule": {
"title": "rule",
"type": "object"
},
"models.workspace": {
"title": "workspace",
"type": "object"
}
},
"tags": [
{
"name": "workspace",
"description": "Operations about workspace\n"
},
{
"name": "workspace/rule",
"description": "Operations about rule\n"
},
{
"name": "version",
"description": "VersionController operations for Version\n"
}
]
}

245
swagger/swagger.yml Normal file
View File

@@ -0,0 +1,245 @@
swagger: "2.0"
info:
title: beego Test API
description: |
beego has a very cool tools to autogenerate documents for your API
version: 1.0.0
termsOfService: http://beego.me/
contact:
email: astaxie@gmail.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
basePath: /oc/shared/
paths:
/version/:
get:
tags:
- version
description: |-
get version
<br>
operationId: VersionController.GetAll
responses:
"200":
description: ""
/workspace/:
get:
tags:
- workspace
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.GetAll
responses:
"200":
description: '{shared_workspace} models.shared_workspace'
post:
tags:
- workspace
description: |-
create shared workspace
<br>
operationId: SharedWorkspaceController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/workspace/{id}:
get:
tags:
- workspace
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Get
parameters:
- in: path
name: id
description: the id you want to get
required: true
type: string
responses:
"200":
description: '{shared workspace} models.shared_workspace'
put:
tags:
- workspace
description: |-
create shared workspaces
<br>
operationId: SharedWorkspaceController.Update
parameters:
- in: path
name: id
description: the shared workspace id you want to get
required: true
type: string
- in: body
name: body
description: The shared workspace content
required: true
schema:
$ref: '#/definitions/models.workspace'
responses:
"200":
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- workspace
description: |-
delete the shared workspace
<br>
operationId: SharedWorkspaceController.Delete
parameters:
- in: path
name: id
description: The id you want to delete
required: true
type: string
responses:
"200":
description: '{shared workspace} delete success!'
/workspace/rule/:
get:
tags:
- workspace/rule
description: |-
find rule by id
<br>
operationId: RuleController.GetAll
responses:
"200":
description: '{rule} models.rule'
post:
tags:
- workspace/rule
description: |-
create rule
<br>
operationId: RuleController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: '{rule} models.rule'
/workspace/rule/{id}:
get:
tags:
- workspace/rule
description: |-
find rule by id
<br>
operationId: RuleController.Get
parameters:
- in: path
name: id
description: the id you want to get
required: true
type: string
responses:
"200":
description: '{rule} models.rule'
put:
tags:
- workspace/rule
description: |-
create rules
<br>
operationId: RuleController.Update
parameters:
- in: path
name: id
description: the rule id you want to get
required: true
type: string
- in: body
name: body
description: The rule content
required: true
schema:
$ref: '#/definitions/models.rule'
responses:
"200":
description: '{rule} models.rule'
delete:
tags:
- workspace/rule
description: |-
delete the rule
<br>
operationId: RuleController.Delete
parameters:
- in: path
name: id
description: The id you want to delete
required: true
type: string
responses:
"200":
description: '{rule} delete success!'
/workspace/rule/search/{search}:
get:
tags:
- workspace/rule
description: |-
search rule
<br>
operationId: RuleController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{rule} models.rule'
/workspace/search/{search}:
get:
tags:
- workspace
description: |-
search shared workspace
<br>
operationId: SharedWorkspaceController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{shared workspace} models.shared_workspace'
definitions:
json:
title: json
type: object
models.rule:
title: rule
type: object
models.workspace:
title: workspace
type: object
tags:
- name: workspace
description: |
Operations about workspace
- name: workspace/rule
description: |
Operations about rule
- name: version
description: |
VersionController operations for Version