Romani Gate, v1.5
Posted on

Web service for an interaction with the Instagram* Direct API.
Update the Instagram* API client, improve the JSON-RPC API and the documentation.
* Запрещена в России / Banned in Russia.
Change Log
- Update the Instagram* API client.
- JSON-RPC API:
- Use a full regexp match in the JSON Schema of an user ID.
- Make different types of timestamp fields same in a response of commands:
send_message;send_photo;get_thread_history.
- Doesn't escape Unicode characters in a command on a logging.
- Documentation:
- Move JSON Schemas of API commands to the single directory.
- Add a stuff for the Postman tool.
* Запрещена в России / Banned in Russia.
API
API description in the Swagger format:
openapi: '3.0.0'
info:
title: romani-gate
version: 1.5.0
servers:
- url: http://localhost:{port}
variables:
port:
default: '8080'
paths:
/:
post:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/command'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/message'
- $ref: '#/components/schemas/user'
- $ref: '#/components/schemas/thread'
- $ref: '#/components/schemas/history'
400:
$ref: '#/components/responses/error'
405:
$ref: '#/components/responses/error'
500:
$ref: '#/components/responses/error'
components:
schemas:
positive_integer:
type: integer
minimum: 0
nullable_positive_integer:
type: integer
minimum: 0
nullable: true
nullable_number:
type: number
nullable: true
nullable_string:
type: string
nullable: true
numeric_string:
type: string
pattern: ^\\d+$
nullable_numeric_string:
type: string
pattern: ^\\d+$
nullable: true
alphabetical_string:
type: string
pattern: ^[a-z_]+$
geo:
type: object
required:
- latitude
- longitude
properties:
latitude:
$ref: '#/components/schemas/nullable_number'
longitude:
$ref: '#/components/schemas/nullable_number'
address:
type: object
required:
- street
- city
- zip
- country_code
properties:
street:
$ref: '#/components/schemas/nullable_string'
city:
$ref: '#/components/schemas/nullable_string'
zip:
$ref: '#/components/schemas/nullable_string'
country_code:
$ref: '#/components/schemas/nullable_positive_integer'
location:
type: object
required:
- geo
- address
properties:
geo:
$ref: '#/components/schemas/geo'
address:
$ref: '#/components/schemas/address'
command:
type: object
required:
- name
- parameters
properties:
name:
$ref: '#/components/schemas/alphabetical_string'
parameters:
type: object
message:
type: object
required:
- id
- timestamp
properties:
id:
$ref: '#/components/schemas/numeric_string'
user_id:
$ref: '#/components/schemas/numeric_string'
type:
$ref: '#/components/schemas/alphabetical_string'
timestamp:
$ref: '#/components/schemas/positive_integer'
text:
$ref: '#/components/schemas/nullable_string'
user:
type: object
required:
- id
- category
- username
- full_name
- gender
- birthday
- biography
- location
- counters
- flags
properties:
id:
$ref: '#/components/schemas/numeric_string'
category:
$ref: '#/components/schemas/nullable_string'
username:
type: string
full_name:
type: string
gender:
$ref: '#/components/schemas/nullable_positive_integer'
birthday:
$ref: '#/components/schemas/nullable_string'
biography:
$ref: '#/components/schemas/nullable_string'
location:
$ref: '#/components/schemas/location'
counters:
type: object
required:
- media
- followers
- followings
properties:
media:
$ref: '#/components/schemas/nullable_positive_integer'
followers:
$ref: '#/components/schemas/nullable_positive_integer'
followings:
$ref: '#/components/schemas/nullable_positive_integer'
flags:
type: object
required:
- is_private
- is_business
- is_verified
properties:
is_private:
type: boolean
is_business:
type: boolean
nullable: true
is_verified:
type: boolean
thread:
type: object
required:
- id
properties:
id:
$ref: '#/components/schemas/numeric_string'
history:
type: object
required:
- messages
- minimal_cursor_id
properties:
messages:
type: array
items:
$ref: '#/components/schemas/message'
minimal_cursor_id:
$ref: '#/components/schemas/nullable_numeric_string'
responses:
error:
description: Some Error
content:
text/plain:
schema:
type: string
Screenshots
send_message() command in the Postman tool

send_photo() command in the Postman tool

get_user() command in the Postman tool

get_thread() command in the Postman tool

get_thread_history() command in the Postman tool
