Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
implement filetransfer.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k1o committed Apr 19, 2024
1 parent b6be4f0 commit b302c98
Show file tree
Hide file tree
Showing 20 changed files with 1,403 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ test-results/
playwright-report/

/src/page/plugins/*
!/src/page/plugins/filetransfer
!/src/page/plugins/.gitkeep
128 changes: 128 additions & 0 deletions src/page/plugins/filetransfer/OpenApi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
openapi: 3.0.0

info:
title: n.eko REST API
description: Next Gen Renderer Browser.
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
version: "1.0.0"

servers:
- description: Local server
url: http://localhost:3000
# Added by API Auto Mocking Plugin
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/m1k1o/n.eko/1.0.0

tags:
- name: filetransfer
description: File Transfer API

paths:

#
# filetransfer
#

/api/filetransfer:
get:
tags:
- filetransfer
parameters:
- name: filename
in: query
required: true
schema:
type: string
description: The file name
summary: download file
operationId: downloadFile
responses:
'200':
description: OK
content:
application/octet-stream:
schema:
type: string
format: binary
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
post:
tags:
- filetransfer
summary: upload file
operationId: uploadFile
responses:
'200':
description: OK
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/FileUpload'

components:
securitySchemes:
CookieAuth:
type: apiKey
in: cookie
name: NEKO_SESSION
BearerAuth:
type: http
scheme: bearer
TokenAuth:
type: apiKey
in: query
name: token

responses:
NotFound:
description: The specified resource was not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
Unauthorized:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
Forbidden:
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'

schemas:
ErrorMessage:
type: object
properties:
message:
type: string

#
# filetransfer
#

FileUpload:
type: object
properties:
files:
type: array
items:
type: string
format: binary

security:
- BearerAuth: []
- CookieAuth: []
- TokenAuth: []
18 changes: 18 additions & 0 deletions src/page/plugins/filetransfer/api-gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
VERSION="1.0.0"

rm -rf "${PWD}/api"
mkdir "${PWD}/api"

docker run --rm \
--user "$(id -u):$(id -g)" \
-v "${PWD}/api:/local/out" \
-v "${PWD}/OpenApi.yaml:/local/in.yaml" \
openapitools/openapi-generator-cli generate \
-i /local/in.yaml \
-g typescript-axios \
-o /local/out \
--additional-properties=enumPropertyNaming=original,modelPropertyNaming=original,withSeparateModelsAndApi=true,modelPackage=models,apiPackage=api

# Remove not needed git_push.sh
rm -f "${PWD}/api/git_push.sh"
4 changes: 4 additions & 0 deletions src/page/plugins/filetransfer/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
1 change: 1 addition & 0 deletions src/page/plugins/filetransfer/api/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
23 changes: 23 additions & 0 deletions src/page/plugins/filetransfer/api/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
12 changes: 12 additions & 0 deletions src/page/plugins/filetransfer/api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.gitignore
.npmignore
.openapi-generator-ignore
api.ts
api/filetransfer-api.ts
base.ts
common.ts
configuration.ts
git_push.sh
index.ts
models/error-message.ts
models/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.5.0-SNAPSHOT
18 changes: 18 additions & 0 deletions src/page/plugins/filetransfer/api/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* tslint:disable */
/* eslint-disable */
/**
* n.eko REST API
* Next Gen Renderer Browser.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/



export * from './api/filetransfer-api';

Loading

0 comments on commit b302c98

Please sign in to comment.