-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pending changes exported from your codespace
- Loading branch information
1 parent
0dc42c5
commit 28c0061
Showing
2 changed files
with
197 additions
and
0 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 |
---|---|---|
@@ -1,2 +1,92 @@ | ||
# file-system-service | ||
|
||
Création d'un service en Go pour pouvoir m'y connecter via mon portfolio-apple et interagire avec le système de fichier via l'IHM. | ||
|
||
|
||
## API Reference | ||
|
||
#### Get directory list content items | ||
|
||
```http | ||
GET /file-system/${path...} | ||
``` | ||
|
||
| Parameter | Type | Description | Default value | | ||
| :-------- | :------- | :------------------------- | :------------ | | ||
| `path` | `string` | **Optional**. The path of the directory you would like open | / | | ||
|
||
### Response 200 | ||
|
||
```json | ||
[ | ||
{ | ||
"type": "directory", | ||
"path": "/home", | ||
"name": "nchoquet" | ||
}, | ||
{ | ||
"type": "file", | ||
"path": "/home", | ||
"name": ".bashrc" | ||
}, | ||
... | ||
] | ||
``` | ||
|
||
### Response 400 | ||
|
||
```json | ||
{ | ||
"code": 400, | ||
"message": "an error message" | ||
} | ||
``` | ||
|
||
#### Get file content | ||
|
||
```http | ||
GET /file/${path...} | ||
``` | ||
|
||
| Parameter | Type | Description | Default value | | ||
| :-------- | :------- | :-------------------------------- | :------------ | | ||
| `path` | `string` | **Optional**. The path of the directory you would like open | / | | ||
|
||
#### Create file | ||
|
||
```http | ||
POST /file | ||
Content-Type: application/json | ||
Accept: application/json | ||
{ | ||
"type": "file" | ||
"path": "/path/to/create", | ||
"name": "file-to-create", | ||
"extension": "your-extension" | ||
} | ||
``` | ||
|
||
### Response 200 | ||
|
||
```json | ||
{ | ||
"path": "/path/to/create", | ||
"name": "file-to-create", | ||
"extension": "your-extension" | ||
} | ||
``` | ||
|
||
### Response 400 | ||
|
||
```json | ||
{ | ||
"code": 400, | ||
"message": "an error message" | ||
} | ||
``` | ||
|
||
| Parameter | Type | Description | Default value | | ||
| :-------- | :------- | :-------------------------------- | :------------ | | ||
| `path` | `string` | **Optional**. The path of the directory you would like open | / | | ||
|
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,107 @@ | ||
openapi: '3.0.2' | ||
|
||
info: | ||
title: File system Service | ||
version: 0.4.0 | ||
|
||
servers: | ||
- url: http://{host}:{port} | ||
variables: | ||
host: | ||
default: 'localhost' | ||
port: | ||
default: '3000' | ||
description: Port where is exposed service. | ||
|
||
components: | ||
schemas: | ||
HttpError: | ||
type: object | ||
properties: | ||
code: | ||
type: integer | ||
format: integer | ||
message: | ||
type: string | ||
|
||
FileSystemItem: | ||
type: object | ||
properties: | ||
type: | ||
type: string | ||
path: | ||
type: string | ||
name: | ||
type: string | ||
|
||
tags: | ||
- name: File System | ||
description: All concerns file system. | ||
- name: Files | ||
description: All concerns files. | ||
- name: Directories | ||
description: All concerns directories. | ||
|
||
paths: | ||
/file-system/{path}: | ||
summary: Get all content of directory (flat) | ||
description: Get all elements in search directory (in {path}) | ||
|
||
parameters: | ||
- name: path | ||
required: true | ||
in: path | ||
description: Path of file to get. | ||
schema: | ||
type: string | ||
explode: true | ||
style: simple | ||
example: "home\/nchoquet" | ||
|
||
get: | ||
tags: | ||
- File System | ||
|
||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/FileSystemItem' | ||
|
||
'400': | ||
description: Bad Request | ||
# headers: | ||
|
||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/HttpError' | ||
|
||
/file-system: | ||
summary: Get all content of root directory (flat) | ||
description: Get all elements in search directory (in root of your system) | ||
|
||
get: | ||
tags: | ||
- File System | ||
|
||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/FileSystemItem' | ||
|
||
'400': | ||
description: Bad Request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/HttpError' |