new API page in docs

This commit is contained in:
les
2020-02-02 21:08:16 +01:00
parent 2bcf1fc9a0
commit a1073642b5
9 changed files with 185 additions and 10 deletions

57
docs/.api.md Normal file
View File

@@ -0,0 +1,57 @@
## Add a new event
POST
{: .label .label-orange}
**`/event`**
> info "info"
> `Content-Type` has to be `multipart/form-data` 'cause support image upload
**Params**
| title | `string` | event's title |
| description | `string` | event's description (html accepted and sanitized) |
| place_name | `string` | the name of the place |
| place_address | `string` | the address of the place |
| start_datetime | `integer` | start timestamp |
| multidate | `integer` | is a multidate event? |
| tags | `array` | List of tags |
| recurrent | `object` | Recurrent event details |
| recurrent.frequency | `string` | could be `1w` or `2w` |
| recurrent.type | `string` | not used |
| recurrent.days | `array` | array of days |
| image | `image` | Image |
---
## Get current authenticated user
GET
{: .label .label-green}
**`/api/user`**
**Response**
```json
{
"description" : null,
"recover_code" : "",
"id" : 1,
"createdAt" : "2020-01-29T18:10:16.630Z",
"updatedAt" : "2020-01-30T22:42:14.789Z",
"is_active" : true,
"settings" : "{}",
"email" : "eventi@cisti.org",
"is_admin" : true
}
```
---

View File

@@ -1,6 +1,14 @@
---
layout: default
title: API
permalink: /api
permalink: /dev/api
parent: Hacking
nav_order: 8
---
1. TOC
{:toc}

8
docs/.api_helpers.js Normal file
View File

@@ -0,0 +1,8 @@
exports.if_eq = function(a, b, opts) {
if (a == b) {
return opts.fn(this);
} else {
return opts.inverse(this);
}
}

View File

@@ -1,20 +1,34 @@
{{#orphans}}
### {{description}}
## {{description}}
{{type.names}}
{{#if_eq type.names 'POST'}}
{: .label .label-orange}
{{else}}
{: .label .label-green}
{{/if_eq}}
`{{name}}`
{{#each params}}
| {{name}} | `{{type.names}}` | {{{description}}} |
{{/each}}
**`{{name}}`**
{{#each customTags}}
> {{tag}} "{{tag}}"
> {{{value}}}
{{/each}}
{{#if params}}
**Params**
{{#each params}}
| {{name}} | `{{type.names}}` | {{{description}}} |
{{/each}}
{{/if}}
{{#each examples}}
{{{this}}}
{{/each}}
---
{{/orphans}}

View File

@@ -4,7 +4,7 @@
}
.navigation-list-item a {
color: blue;
color: #7253ed;
}
.navigation-list-item a:hover {
@@ -18,4 +18,4 @@ html, body {
.page-content h1:first-of-type {
font-weight: 500;
}
}

71
docs/dev/api.md Normal file
View File

@@ -0,0 +1,71 @@
---
layout: default
title: API
permalink: /dev/api
parent: Hacking
nav_order: 8
---
1. TOC
{:toc}
## Add a new event
POST
{: .label .label-orange}
**`/event`**
> info "info"
> `Content-Type` has to be `multipart/form-data` 'cause support image upload
**Params**
| title | `string` | event's title |
| description | `string` | event's description (html accepted and sanitized) |
| place_name | `string` | the name of the place |
| place_address | `string` | the address of the place |
| start_datetime | `integer` | start timestamp |
| multidate | `integer` | is a multidate event? |
| tags | `array` | List of tags |
| recurrent | `object` | Recurrent event details |
| recurrent.frequency | `string` | could be `1w` or `2w` |
| recurrent.type | `string` | not used |
| recurrent.days | `array` | array of days |
| image | `image` | Image |
---
## Get current authenticated user
GET
{: .label .label-green}
**`/api/user`**
**Response**
```json
{
"description" : null,
"recover_code" : "",
"id" : 1,
"createdAt" : "2020-01-29T18:10:16.630Z",
"updatedAt" : "2020-01-30T22:42:14.789Z",
"is_active" : true,
"settings" : "{}",
"email" : "eventi@cisti.org",
"is_admin" : true
}
```
---