Romani Core, v0.1
Posted on

Extendable web service for a running of conversations via Instagram* Direct.
Implement a controlling RESTful API for an addition of users.
* Запрещена в России / Banned in Russia.
Features
- working mode:
- run as a web service;
- control via the RESTful API;
- commands:
- start a conversation with a specified user:
- collect users in a database (SQLite);
- protect against duplicate users.
- start a conversation with a specified user:
Command
Command format in the JSON Schema format:
{
"type": "object",
"required": ["user_id"],
"additionalProperties": false,
"properties": {"user_id": {"type": "string", "pattern": "^\\d+$"}}
}
Example:
{"user_id": "1599620166"}
API
API description in the Swagger format:
openapi: '3.0.0'
info:
title: romani-gate
version: 0.1.0
servers:
- url: http://localhost:{port}/api/v1
variables:
port:
default: '9090'
paths:
/conversations:
post:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/command'
responses:
200:
$ref: '#/components/responses/response'
400:
$ref: '#/components/responses/response'
404:
$ref: '#/components/responses/response'
405:
$ref: '#/components/responses/response'
500:
$ref: '#/components/responses/response'
components:
schemas:
command:
type: object
required:
- user_id
additionalProperties: false
properties:
user_id:
type: string
pattern: ^\\d+$
responses:
response:
description: Some Response
content:
text/plain:
schema:
type: string
Architecture
UML component diagram in the PlantUML language:
@startuml
skinparam componentStyle uml2
package "Romani Core" {
database "SQLite" {
[Conversations]
}
[Web Server] -- API
[Web Server] ..> [Conversations] : add an user
}
@enduml
Rendered UML component diagram:
Screenshots
POST /conversations
