From 3f3cdcf2fa8cc5867dcc7cdedf4d0d454fc8fd7f Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 26 Feb 2019 23:41:39 -0500 Subject: [PATCH 1/5] [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 + + + From cc461c4e5014a39bf05d1dbdb892531350d1154a Mon Sep 17 00:00:00 2001 From: Miguel Tenorio <46824157+AntiD2ta@users.noreply.github.com> Date: Wed, 27 Feb 2019 21:37:01 -0500 Subject: [PATCH 2/5] Update AntiD2ta_specs.yml fixed requested changes --- AntiD2ta_specs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AntiD2ta_specs.yml b/AntiD2ta_specs.yml index 8c6c448..25beb4a 100644 --- a/AntiD2ta_specs.yml +++ b/AntiD2ta_specs.yml @@ -109,8 +109,8 @@ paths: type: string responses: - '204': # status code - description: "No content : transactions from the address are not observed." + '200': + description: "Ok" content: application/json: schema: @@ -137,8 +137,8 @@ paths: type: string responses: - '204': # status code - description: "No content : transactions to the address are not observed" + '200': + description: "Ok" content: application/json: schema: From 53da491dda8d8df10719f66fe02e7a3b917722f5 Mon Sep 17 00:00:00 2001 From: Marcos Maceo Date: Thu, 28 Feb 2019 16:53:02 -0500 Subject: [PATCH 3/5] [spec] Rename espec.yml to spec.yml --- espec.yml => spec.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename espec.yml => spec.yml (100%) diff --git a/espec.yml b/spec.yml similarity index 100% rename from espec.yml rename to spec.yml From 711f4cab942537148a11060b2f87613c7ef22b45 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 28 Feb 2019 17:31:30 -0500 Subject: [PATCH 4/5] [spec] Rename and update espec.yml to spec.yml --- espec.yml | 65 ---------------------------------- AntiD2ta_specs.yml => spec.yml | 0 2 files changed, 65 deletions(-) delete mode 100644 espec.yml rename AntiD2ta_specs.yml => spec.yml (100%) diff --git a/espec.yml b/espec.yml deleted file mode 100644 index 12b2c90..0000000 --- a/espec.yml +++ /dev/null @@ -1,65 +0,0 @@ -openapi: 3.0.0 -info: - title: Python to .Net - description: Still whitout 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: - /somePath: - get: - summary: This is a example of a get method. - description: Some description, is not optional. - responses: - '200': # status code - description: A response of arrays - content: - application/json: - schema: - type: array - items: - type: string - default: - $ref : '#/components/schemas/genericError' - post: - summary: This is a example of a post method. - description: Some description, is not optional. - - security: - - CsrfTokenAuth: [] - - responses: - '200': # status code - description: A response of arrays - content: - application/json: - schema: - type: array - items: - type: string - 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 diff --git a/AntiD2ta_specs.yml b/spec.yml similarity index 100% rename from AntiD2ta_specs.yml rename to spec.yml From bd811ba69cb3131e85bd3e0115dd2dfa064907f9 Mon Sep 17 00:00:00 2001 From: stdevMac <35319980+stdevMac@users.noreply.github.com> Date: Thu, 28 Feb 2019 17:48:18 -0500 Subject: [PATCH 5/5] Update spec.yml With merge some lines where duplicated --- spec.yml | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/spec.yml b/spec.yml index b160bb1..8499d61 100644 --- a/spec.yml +++ b/spec.yml @@ -4,33 +4,6 @@ info: description: Still whitout 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: -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