diff --git a/api/spec/dns.json b/api/spec/dns.json new file mode 100644 index 0000000..5cd3a93 --- /dev/null +++ b/api/spec/dns.json @@ -0,0 +1,246 @@ +{ + "components": { + "requestBodies": { + "DnsQueryRequest": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryRequest" + } + } + }, + "description": "DnsQueryRequest" + } + }, + "responses": { + "DnsQueryResponse": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryResponse" + } + } + }, + "description": "DnsQueryResponse" + }, + "MicroAPIError": { + "content": { + "application/json": { + "schema": { + "properties": { + "Code": { + "description": "Error code", + "example": 500, + "type": "number" + }, + "Detail": { + "description": "Error detail", + "example": "service not found", + "type": "string" + }, + "Id": { + "description": "Error ID", + "type": "string" + }, + "Status": { + "description": "Error status message", + "example": "Internal Server Error", + "type": "string" + } + }, + "title": "MicroAPIError", + "type": "object" + } + } + }, + "description": "Error from the Micro API" + } + }, + "schemas": { + "Answer": { + "properties": { + "TTL": { + "description": "time to live", + "format": "int32", + "type": "number" + }, + "data": { + "description": "the answer", + "type": "string" + }, + "name": { + "description": "name resolved", + "type": "string" + }, + "type": { + "description": "type of record", + "format": "int32", + "type": "number" + } + }, + "title": "Answer", + "type": "object" + }, + "QueryRequest": { + "description": "Query an addresss", + "properties": { + "name": { + "description": "name to resolve", + "type": "string" + }, + "type": { + "description": "type of query e.g A, AAAA, MX, SRV", + "type": "string" + } + }, + "title": "QueryRequest", + "type": "object" + }, + "QueryResponse": { + "properties": { + "AD": { + "type": "boolean" + }, + "CD": { + "type": "boolean" + }, + "RA": { + "type": "boolean" + }, + "RD": { + "type": "boolean" + }, + "TC": { + "type": "boolean" + }, + "answer": { + "items": { + "properties": { + "TTL": { + "description": "time to live", + "format": "int32", + "type": "number" + }, + "data": { + "description": "the answer", + "type": "string" + }, + "name": { + "description": "name resolved", + "type": "string" + }, + "type": { + "description": "type of record", + "format": "int32", + "type": "number" + } + }, + "type": "object" + }, + "type": "array" + }, + "provider": { + "type": "string" + }, + "question": { + "items": { + "properties": { + "name": { + "description": "name to query", + "type": "string" + }, + "type": { + "description": "type of record", + "format": "int32", + "type": "number" + } + }, + "type": "object" + }, + "type": "array" + }, + "status": { + "format": "int32", + "type": "number" + } + }, + "title": "QueryResponse", + "type": "object" + }, + "Question": { + "properties": { + "name": { + "description": "name to query", + "type": "string" + }, + "type": { + "description": "type of record", + "format": "int32", + "type": "number" + } + }, + "title": "Question", + "type": "object" + } + }, + "securitySchemes": { + "M3OAPIToken": { + "bearerFormat": "token", + "description": "M3O API token", + "scheme": "bearer", + "type": "http" + } + } + }, + "info": { + "description": "Generated by protoc-gen-openapi", + "title": "Dns", + "version": "1", + "x-logo": { + "altText": "M3O logo", + "backgroundColor": "#000000", + "url": "https://raw.githubusercontent.com/m3o/m3o/main/images/logo.png" + } + }, + "openapi": "3.0.0", + "paths": { + "/dns/Dns/Query": { + "parameters": [ + { + "in": "header", + "name": "Micro-Namespace", + "required": true, + "schema": { + "default": "micro", + "type": "string" + } + } + ], + "post": { + "requestBody": { + "$ref": "#/components/requestBodies/DnsQueryRequest" + }, + "responses": { + "200": { + "$ref": "#/components/responses/DnsQueryResponse" + }, + "default": { + "$ref": "#/components/responses/MicroAPIError" + } + }, + "security": [ + { + "MicroAPIToken": [] + } + ], + "summary": "Dns.Query(QueryRequest)" + } + } + }, + "servers": [ + { + "url": "https://api.m3o.com/v1", + "description": "M3O platform" + } + ] +} \ No newline at end of file diff --git a/api/spec/stock.json b/api/spec/stock.json index 8e7d487..ee946c9 100644 --- a/api/spec/stock.json +++ b/api/spec/stock.json @@ -11,16 +11,6 @@ }, "description": "StockHistoryRequest" }, - "StockOrderBookRequest": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OrderBookRequest" - } - } - }, - "description": "StockOrderBookRequest" - }, "StockPriceRequest": { "content": { "application/json": { @@ -85,16 +75,6 @@ }, "description": "StockHistoryResponse" }, - "StockOrderBookResponse": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OrderBookResponse" - } - } - }, - "description": "StockOrderBookResponse" - }, "StockPriceResponse": { "content": { "application/json": { @@ -171,111 +151,6 @@ "title": "HistoryResponse", "type": "object" }, - "Order": { - "properties": { - "ask_price": { - "description": "the asking price", - "format": "double", - "type": "number" - }, - "ask_size": { - "description": "the ask size", - "format": "int32", - "type": "number" - }, - "bid_price": { - "description": "the bidding price", - "format": "double", - "type": "number" - }, - "bid_size": { - "description": "the bid size", - "format": "int32", - "type": "number" - }, - "timestamp": { - "description": "the UTC timestamp of the quote", - "type": "string" - } - }, - "title": "Order", - "type": "object" - }, - "OrderBookRequest": { - "description": "Get the historic order book and each trade by timestamp", - "properties": { - "date": { - "description": "the date in format YYYY-MM-dd", - "type": "string" - }, - "end": { - "description": "optional RFC3339Nano end time e.g 2006-01-02T15:04:05.999999999Z07:00", - "type": "string" - }, - "limit": { - "description": "limit number of prices", - "format": "int32", - "type": "number" - }, - "start": { - "description": "optional RFC3339Nano start time e.g 2006-01-02T15:04:05.999999999Z07:00", - "type": "string" - }, - "stock": { - "description": "stock to retrieve e.g AAPL", - "type": "string" - } - }, - "title": "OrderBookRequest", - "type": "object" - }, - "OrderBookResponse": { - "properties": { - "date": { - "description": "date of the request", - "type": "string" - }, - "orders": { - "description": "list of orders", - "items": { - "properties": { - "ask_price": { - "description": "the asking price", - "format": "double", - "type": "number" - }, - "ask_size": { - "description": "the ask size", - "format": "int32", - "type": "number" - }, - "bid_price": { - "description": "the bidding price", - "format": "double", - "type": "number" - }, - "bid_size": { - "description": "the bid size", - "format": "int32", - "type": "number" - }, - "timestamp": { - "description": "the UTC timestamp of the quote", - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "symbol": { - "description": "the stock symbol", - "type": "string" - } - }, - "title": "OrderBookResponse", - "type": "object" - }, "PriceRequest": { "description": "Get the last price for a given stock ticker", "properties": { @@ -401,38 +276,6 @@ "summary": "Stock.History(HistoryRequest)" } }, - "/stock/Stock/OrderBook": { - "parameters": [ - { - "in": "header", - "name": "Micro-Namespace", - "required": true, - "schema": { - "default": "micro", - "type": "string" - } - } - ], - "post": { - "requestBody": { - "$ref": "#/components/requestBodies/StockOrderBookRequest" - }, - "responses": { - "200": { - "$ref": "#/components/responses/StockOrderBookResponse" - }, - "default": { - "$ref": "#/components/responses/MicroAPIError" - } - }, - "security": [ - { - "MicroAPIToken": [] - } - ], - "summary": "Stock.OrderBook(OrderBookRequest)" - } - }, "/stock/Stock/Price": { "parameters": [ {