-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
224 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: publish npm | ||
|
||
on: | ||
push: | ||
tags: | ||
- v*.*.* | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
call-workflow-passing-data: | ||
uses: IceWhaleTech/github/.github/workflows/npm_release.yml@main | ||
secrets: | ||
NPM_TOKEN_PRIVATE: ${{ secrets.NPM_TOKEN_PRIVATE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,8 @@ __debug_bin | |
|
||
|
||
dist/ | ||
/github | ||
/github | ||
node_modules | ||
yarn.lock | ||
generate | ||
openapitools.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
openapi: 3.0.3 | ||
|
||
info: | ||
title: CasaOS Gateway API | ||
version: v1 | ||
description: |- | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/IceWhaleTech/logo/main/casaos/casaos_banner_dark_night_800px.png"> | ||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/IceWhaleTech/logo/main/casaos/casaos_banner_twilight_blue_800px.png"> | ||
<img alt="CasaOS" src="https://raw.githubusercontent.com/IceWhaleTech/logo/main/casaos/casaos_banner_twilight_blue_800px.png"> | ||
</picture> | ||
servers: | ||
- url: /v1/gateway | ||
|
||
tags: | ||
- name: USB methods | ||
description: |- | ||
USB methods | ||
security: | ||
- access_token: [] | ||
|
||
paths: | ||
/port: | ||
put: | ||
summary: Set gateway port | ||
description: |- | ||
Set gateway port | ||
operationId: setGatewayPort | ||
tags: | ||
- Gateway methods | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
port: | ||
type: integer | ||
description: Gateway port | ||
example: 80 | ||
responses: | ||
"200": | ||
$ref: "#/components/responses/ResponseOK" | ||
get: | ||
summary: Get gateway port | ||
description: |- | ||
Get gateway port | ||
operationId: getGatewayPort | ||
tags: | ||
- Gateway methods | ||
responses: | ||
"200": | ||
$ref: "#/components/responses/ResponseStringOK" | ||
"400": | ||
$ref: "#/components/responses/ResponseBadRequest" | ||
"500": | ||
$ref: "#/components/responses/ResponseInternalServerError" | ||
|
||
components: | ||
securitySchemes: | ||
access_token: | ||
type: apiKey | ||
in: header | ||
name: Authorization | ||
|
||
responses: | ||
ResponseOK: | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/BaseResponse" | ||
ResponseStringOK: | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/SuccessResponseString" | ||
ResponseBadRequest: | ||
description: Bad Request | ||
content: | ||
application/json: | ||
schema: | ||
readOnly: true | ||
allOf: | ||
- $ref: "#/components/schemas/BaseResponse" | ||
example: | ||
message: "Bad Request" | ||
ResponseInternalServerError: | ||
description: Internal Server Error | ||
content: | ||
application/json: | ||
schema: | ||
readOnly: true | ||
allOf: | ||
- $ref: "#/components/schemas/BaseResponse" | ||
example: | ||
message: "Internal Server Error" | ||
schemas: | ||
BaseResponse: | ||
properties: | ||
message: | ||
readOnly: true | ||
description: message returned by server side if there is any | ||
type: string | ||
example: "" | ||
|
||
SuccessResponseString: | ||
allOf: | ||
- $ref: "#/components/schemas/BaseResponse" | ||
- properties: | ||
data: | ||
type: string | ||
description: When the interface returns success, this field is the specific success information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<title>CasaOS | Developers</title> | ||
|
||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet"> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<redoc spec-url='gateway/openapi.yaml' expandResponses='all' jsonSampleExpandLevel='all'></redoc> | ||
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "@icewhale/casaos-gateway-openapi", | ||
"version": "0.0.1", | ||
"scripts": { | ||
"clean": "rm -rf generate", | ||
"build": "rm -rf dist && tsc && yarn clean", | ||
"generate:local": "openapi-generator-cli generate -g typescript-axios -i ./api/gateway/openapi.yaml -o ./generate", | ||
"generate:npx": "npx @openapitools/openapi-generator-cli generate -g typescript-axios -i ./api/gateway/openapi.yaml -o ./generate", | ||
"generate:ts": "npx openapi-typescript-codegen --input ./api/gateway/openapi.yaml --output ./generate", | ||
"start": "yarn generate:local && yarn build" | ||
}, | ||
"homepage": "https://github.com/IceWhaleTech/CasaOS-Gateway#readme", | ||
"description": "CasaOS Gateway Typescript+Axios SDK", | ||
"keywords": [ | ||
"CasaOS", | ||
"SDK", | ||
"CasaOS Axios" | ||
], | ||
"main": "dist/index.js", | ||
"files": [ | ||
"LICENSE", | ||
"README.md", | ||
"dist", | ||
"generate" | ||
], | ||
"dependencies": { | ||
"axios": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"all-contributors-cli": "^6.24.0", | ||
"@openapitools/openapi-generator-cli": "2.5.2", | ||
"@types/node": "^18.8.3", | ||
"openapi-typescript-codegen": "^0.23.0", | ||
"typescript": "^4.9.5" | ||
}, | ||
"author": "casaos", | ||
"license": "Apache-2.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"lib": [ | ||
"es2017", | ||
"DOM" | ||
], | ||
"module": "commonjs", | ||
"target": "es6", | ||
"skipLibCheck": true, | ||
"sourceMap": false, | ||
"strict": true, | ||
"useUnknownInCatchVariables": false, | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true, | ||
"outDir": "dist", | ||
"types": [ | ||
"node" | ||
], | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
], | ||
"main": "generate/index" | ||
} |