Skip to content

Commit

Permalink
Give examples
Browse files Browse the repository at this point in the history
Issue: PENDING
Reviewer: pending
  • Loading branch information
Randolf Tjandra committed Nov 9, 2023
1 parent dfa573b commit 5f1073c
Show file tree
Hide file tree
Showing 7 changed files with 664 additions and 10 deletions.
122 changes: 119 additions & 3 deletions API-Modules/v2-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,128 @@
V2 API documentation

## Table of Contents
- [/v2/sum](#endpt-1)
- [/v2/sum](#endpt-2)
- [/v2/data](#endpt-1)
- [/v2/data](#endpt-2)
- [/v2/data](#endpt-3)
- [/v2/sum](#endpt-4)
- [/v2/sum](#endpt-5)

___
###### endpt #1
```
DELETE - /v2/data
```

**Status**: LIVE

**Availability**: PUBLIC

#### Description:
- updates stored numbers

Params:

| Name | Type | Description |
|--|--|--|
| **version** | `integer` | A version number (*Required)


Example Request:
```
{
"version": 1
}
```

Example Response:
```
[
true
]
```
___
###### endpt #2
```
PATCH - /v2/data
```

**Status**: LIVE

**Availability**: PUBLIC

#### Description:
- updates stored numbers

Params:

| Name | Type | Description |
|--|--|--|
| **a** | `integer` | a number (Optional)
| **b** | `integer` | a number (Optional)
| **version** | `integer` | A version number (*Required)


Example Request:
```
{
"a": 10,
"b": 25,
"version": 1
}
```

Example Response:
```
[
{
"a": 10,
"b": 25
}
]
```
___
###### endpt #3
```
PUT - /v2/data
```

**Status**: LIVE

**Availability**: PUBLIC

#### Description:
- stores numbers

Params:

| Name | Type | Description |
|--|--|--|
| **a** | `integer` | a number (*Required)
| **b** | `integer` | a number (*Required)
| **version** | `integer` | A version number (*Required)


Example Request:
```
{
"a": 10,
"b": 25,
"version": 1
}
```

Example Response:
```
[
{
"a": 10,
"b": 25
}
]
```
___
###### endpt #4
```
GET - /v2/sum
```

Expand Down Expand Up @@ -46,7 +162,7 @@ Example Response:
}
```
___
###### endpt #2
###### endpt #5
```
POST - /v2/sum
```
Expand Down
4 changes: 2 additions & 2 deletions AUTOGENERATED-API-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [/greetings/say](API-Modules/greetings-say-API.md) (1 total endpoint)
- [/greetings](API-Modules/greetings-API.md) (2 total endpoints)
- [/math](API-Modules/math-API.md) (2 total endpoints)
- [/v2](API-Modules/v2-API.md) (2 total endpoints)
- [/v2](API-Modules/v2-API.md) (5 total endpoints)
- [Misc](API-Modules/Misc-API.md) (2 total endpoints)

Total Endpoints: 9
Total Endpoints: 12
4 changes: 2 additions & 2 deletions PUBLIC-AUTOGENERATED-API-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [/greetings/say](Public-API-Modules/greetings-say-API.md) (1 total endpoint)
- [/greetings](Public-API-Modules/greetings-API.md) (2 total endpoints)
- [/math](Public-API-Modules/math-API.md) (1 total endpoint)
- [/v2](Public-API-Modules/v2-API.md) (2 total endpoints)
- [/v2](Public-API-Modules/v2-API.md) (5 total endpoints)
- [Misc](Public-API-Modules/Misc-API.md) (2 total endpoints)

Total Endpoints: 8
Total Endpoints: 11
122 changes: 119 additions & 3 deletions Public-API-Modules/v2-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,128 @@
V2 API documentation

## Table of Contents
- [/v2/sum](#endpt-1)
- [/v2/sum](#endpt-2)
- [/v2/data](#endpt-1)
- [/v2/data](#endpt-2)
- [/v2/data](#endpt-3)
- [/v2/sum](#endpt-4)
- [/v2/sum](#endpt-5)

___
###### endpt #1
```
DELETE - /v2/data
```

**Status**: LIVE

**Availability**: PUBLIC

#### Description:
- updates stored numbers

Params:

| Name | Type | Description |
|--|--|--|
| **version** | `integer` | A version number (*Required)


Example Request:
```
{
"version": 1
}
```

Example Response:
```
[
true
]
```
___
###### endpt #2
```
PATCH - /v2/data
```

**Status**: LIVE

**Availability**: PUBLIC

#### Description:
- updates stored numbers

Params:

| Name | Type | Description |
|--|--|--|
| **a** | `integer` | a number (Optional)
| **b** | `integer` | a number (Optional)
| **version** | `integer` | A version number (*Required)


Example Request:
```
{
"a": 10,
"b": 25,
"version": 1
}
```

Example Response:
```
[
{
"a": 10,
"b": 25
}
]
```
___
###### endpt #3
```
PUT - /v2/data
```

**Status**: LIVE

**Availability**: PUBLIC

#### Description:
- stores numbers

Params:

| Name | Type | Description |
|--|--|--|
| **a** | `integer` | a number (*Required)
| **b** | `integer` | a number (*Required)
| **version** | `integer` | A version number (*Required)


Example Request:
```
{
"a": 10,
"b": 25,
"version": 1
}
```

Example Response:
```
[
{
"a": 10,
"b": 25
}
]
```
___
###### endpt #4
```
GET - /v2/sum
```

Expand Down Expand Up @@ -46,7 +162,7 @@ Example Response:
}
```
___
###### endpt #2
###### endpt #5
```
POST - /v2/sum
```
Expand Down
18 changes: 18 additions & 0 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ rio.router.post(routerName, '/sum', (req, res) => {
res.status(200).send(JSON.stringify({ result: a + b }));
}, [rio.rInt('a', 'a number', 10), rio.rInt('b', 'a number', 25)], 'Adds numbers', [35]);

rio.router.put(routerName, '/data', (req, res) => {
let { a, b } = req.body;
a = rio.formatter.Int(a);
b = rio.formatter.Int(b);
res.status(200).send(JSON.stringify({ result: {a: a, b: b} }));

Check failure on line 41 in api.js

View workflow job for this annotation

GitHub Actions / linter

A space is required after '{'

Check failure on line 41 in api.js

View workflow job for this annotation

GitHub Actions / linter

Expected property shorthand

Check failure on line 41 in api.js

View workflow job for this annotation

GitHub Actions / linter

Expected property shorthand

Check failure on line 41 in api.js

View workflow job for this annotation

GitHub Actions / linter

A space is required before '}'
}, [rio.rInt('a', 'a number', 10), rio.rInt('b', 'a number', 25)], 'stores numbers', [{a: 10, b: 25}]);

Check failure on line 42 in api.js

View workflow job for this annotation

GitHub Actions / linter

A space is required after '{'

Check failure on line 42 in api.js

View workflow job for this annotation

GitHub Actions / linter

A space is required before '}'

rio.router.patch(routerName, '/data', (req, res) => {
let { a, b } = req.body;
a = rio.formatter.Int(a);
b = rio.formatter.Int(b);
res.status(200).send(JSON.stringify({ result: {a: a, b: b} }));

Check failure on line 48 in api.js

View workflow job for this annotation

GitHub Actions / linter

A space is required after '{'

Check failure on line 48 in api.js

View workflow job for this annotation

GitHub Actions / linter

Expected property shorthand

Check failure on line 48 in api.js

View workflow job for this annotation

GitHub Actions / linter

Expected property shorthand

Check failure on line 48 in api.js

View workflow job for this annotation

GitHub Actions / linter

A space is required before '}'
}, [rio.oInt('a', 'a number', 10), rio.oInt('b', 'a number', 25)], 'updates stored numbers', [{a: 10, b: 25}]);

rio.router.delete(routerName, '/data', (req, res) => {
res.status(200).send(JSON.stringify({ result: true }));
}, [], 'updates stored numbers', [true]);

app.use(routerName, router);

rio.get('/greetings/say/hi', (req, res) => {
Expand Down
Loading

0 comments on commit 5f1073c

Please sign in to comment.