From 3f3cdcf2fa8cc5867dcc7cdedf4d0d454fc8fd7f Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 26 Feb 2019 23:41:39 -0500 Subject: [PATCH] [Spec] refs #3 #13 #14 #15 - Add spec for endpoints /api/addresses/{address}/validity /api/transactions/history/to/{address}/observation /api/transactions/history/from/{address}/observation /api/transactions/history/from/{address}?take=integer&[afterHash=string] --- AntiD2ta_specs.yml | 190 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 AntiD2ta_specs.yml diff --git a/AntiD2ta_specs.yml b/AntiD2ta_specs.yml new file mode 100644 index 0000000..8c6c448 --- /dev/null +++ b/AntiD2ta_specs.yml @@ -0,0 +1,190 @@ +openapi: 3.0.0 +info: + title: Python to .Net + description: Still without description. + version: 0.25.1 +servers: +- url: http://www.skycoin.net + description: Main Skycoin server +- url: http://staging.node.skycoin.net + description: Internal staging server for developer. +components: + securitySchemes: + CsrfTokenAuth: # arbitrary name for the security scheme + type: apiKey + in: header # can be "header", "query" or "cookie" + name: X-CSRF-TOKEN # name of the header, query parameter or cookie + schemas: + genericError: + description: This is a generic error that should be default response + type: object + properties: + code: + type: integer + format: int64 + message: + type: string +paths: + /api/transactions/history/from/{address}: + get: + summary: Get history from address. + description: Should return completed transactions that transfer fund from the `address` and that were broadcasted after the transaction with the `hash` equal to the `afterHash`.
+ If `afterHash` is empty, transactions should be read from the beginning.
+ Should include all transactions broadcasted even if not going through `/transaction/broadcast/*` API endpoints.
+ If there are no transactions to return, empty array should be returned. Amount of the returned transactions should not exceed `take` . + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + in: path + description: Address for find blockchain explorer URLs + required: true + schema: + type: string + - name: take + in: query + required: true + schema: + type: integer + - name: afterHash + in: query + required: false + schema: + type: string + + responses: + '200': + description: Operation ID. The transaction Id. + content: + application/json: + schema: + type: array + items: + properties: + operationId: + type: string + description: Can be empty.
+ Should be not empty for transactions that broadcasted using this API. + timestamp: + type: string + format: date-time + description: 'Transaction moment as ISO 8601 in UTC' + + fromAddress: + type: string + description: Source address. + + toAddress: + type: string + description: Destination address. + + assetId: + type: string + description: Asset ID e.g. SKY + + amount: + type: string + description: 'Amount without fee. Is integer as string, aligned to the asset accuracy. Actual value can be calculated as `x = sourceAmount * (10 ^ asset.Accuracy)`' + + hash: + type: string + description: Transaction hash as base64 string + + default: + $ref : '#/components/schemas/genericError' + + /api/transactions/history/from/{address}/observation: + delete: + summary: Stop observation from address + + description: Should stop observation of the transactions that transfer fund from the address . Should affect result of the [GET] /api/transactions/history/from/{address}. + + parameters: + - name: address + in: path + description: Address from stop being observed + required: true + schema: + type: string + + responses: + '204': # status code + description: "No content : transactions from the address are not observed." + content: + application/json: + schema: + type: object + properties: + signedTransaction: + type: string + + default: + $ref : '#/components/schemas/genericError' + + /api/transactions/history/to/{address}/observation: + delete: + summary: Stop observation to address + + description: Should stop observation of the transactions that transfer fund to the address . Should affect result of the '[GET] /api/transactions/history/to/{address}' . + + parameters: + - name: address + in: path + description: Address to stop being observed + required: true + schema: + type: string + + responses: + '204': # status code + description: "No content : transactions to the address are not observed" + content: + application/json: + schema: + type: object + properties: + signedTransaction: + type: string + + default: + $ref : '#/components/schemas/genericError' + + /api/addresses/{address}/validity: + get: + summary: Valid address API endpoint. + description: Should check and return address validity.
+ Should check and return wallet address validity + security: + - CsrfTokenAuth: [] + + parameters: + - name: address + in: path + description: Address for find blockchain explorer URLs + required: true + schema: + type: string + + responses: + '200': + description: Validation. The Validation value. + content: + application/json: + schema: + type: object + properties: + isValid: + type: boolean + description: Flag, which indicates that the address is valid + + default: + $ref : '#/components/schemas/genericError' + +# To remember : +# Every post method should use security schema. +# Feel free to use and reuse components +# I think, at some point, someone should use oneOf and anyOf, pls take a look + + +