From 5ab2140a6b98d46dbbb88cced6482fdb65ec4779 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Fri, 19 Aug 2022 13:05:01 -0400 Subject: [PATCH 01/11] Don't merge #1 --- openapi/account.yml | 92 -------------------- openapi/components/endpoints/account.yml | 47 ++++++++++ openapi/components/parameters.yml | 47 ++++++++++ openapi/components/schemas/accountSchema.yml | 63 ++++++++++++++ openapi/components/schemas/balanceSchema.yml | 55 ++++++++++++ openapi/main.yml | 4 +- 6 files changed, 214 insertions(+), 94 deletions(-) delete mode 100644 openapi/account.yml create mode 100644 openapi/components/endpoints/account.yml create mode 100644 openapi/components/parameters.yml create mode 100644 openapi/components/schemas/accountSchema.yml create mode 100644 openapi/components/schemas/balanceSchema.yml diff --git a/openapi/account.yml b/openapi/account.yml deleted file mode 100644 index b860838be..000000000 --- a/openapi/account.yml +++ /dev/null @@ -1,92 +0,0 @@ -openapi: 3.0.3 -info: - title: Horizon Account API - version: 0.0.1 - -tags: - - name: account - description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. - externalDocs: - description: Learn more about accounts here - url: https://developers.stellar.org/docs/glossary/accounts/ - -paths: - - /accounts/{account_id}/operations: - get: - tags: - - account - summary: Get operations by account_id and paged list - description: This endpoint represents successful operations for a given account and can be used in streaming mode. Streaming mode allows you to listen for new operations for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time. - operationId: GetOperationsByAccountid - parameters: - - $ref: '#/components/parameters/AccountIDParam' - - $ref: '#/components/parameters/CursorParam' - - $ref: '#/components/parameters/OrderParam' - - $ref: '#/components/parameters/LimitParam' - - $ref: '#/components/parameters/IncludeFailedParam' - responses: - '200': - description: OK - - /accounts/{account_id}: - get: - tags: - - account - summary: Retrieves information about a specific account - description: The single account endpoint provides information on a specific account. - The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet. - operationId: RetrieveAnAccount - parameters: - - $ref: '#/components/parameters/AccountIDParam' - responses: - '200': - description: OK - -components: - parameters: - CursorParam: - name: cursor - in: query - required: false - description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. - schema: - type: integer - example: 6606617478959105 - LimitParam: - name: limit - in: query - required: false - description: The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10. - schema: - type: integer - example: 10 - AccountIDParam: - name: account_id - in: path - required: true - description: This account’s public key encoded in a base32 string representation. - schema: - type: string - example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ - OrderParam: - name: order - in: query - required: false - description: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc. - schema: - type: integer - enum: - - asc - - desc - IncludeFailedParam: - name: includefailed - in: query - required: false - description: Set to true to include failed operations in results. Options include true and false. - schema: - type: boolean - enum: - - true - - false - \ No newline at end of file diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/account.yml new file mode 100644 index 000000000..029abd8cb --- /dev/null +++ b/openapi/components/endpoints/account.yml @@ -0,0 +1,47 @@ +openapi: 3.0.3 +info: + title: Horizon Account API + version: 0.0.1 + +tags: + - name: account + description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. + externalDocs: + description: Learn more about accounts here + url: https://developers.stellar.org/docs/glossary/accounts/ + +paths: + + /accounts/{account_id}: + get: + tags: + - account + summary: Retrieves an Account + description: The single account endpoint provides information on a specific account. + The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet. + operationId: RetrieveAnAccount + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + responses: + '200': + description: OK + + /accounts/{account_id}/operations: + get: + tags: + - account + summary: Retrieve an Account's Operations + description: This endpoint represents successful operations for a given account and can be used in streaming mode. Streaming mode allows you to listen for new operations for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time. + operationId: GetOperationsByAccountid + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + - $ref: '../parameters.yml#/components/parameters/IncludeFailedParam' + responses: + '200': + description: OK + + + diff --git a/openapi/components/parameters.yml b/openapi/components/parameters.yml new file mode 100644 index 000000000..e8b9560b3 --- /dev/null +++ b/openapi/components/parameters.yml @@ -0,0 +1,47 @@ +components: + parameters: + CursorParam: + name: cursor + in: query + required: false + description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. + schema: + type: integer + example: 6606617478959105 + LimitParam: + name: limit + in: query + required: false + description: The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10. + schema: + type: integer + example: 10 + AccountIDParam: + name: account_id + in: path + required: true + description: This account’s public key encoded in a base32 string representation. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + OrderParam: + name: order + in: query + required: false + description: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc. + schema: + type: integer + enum: + - asc + - desc + IncludeFailedParam: + name: includefailed + in: query + required: false + description: Set to true to include failed operations in results. Options include true and false. + schema: + type: boolean + enum: + - true + - false + \ No newline at end of file diff --git a/openapi/components/schemas/accountSchema.yml b/openapi/components/schemas/accountSchema.yml new file mode 100644 index 000000000..7ed588f7e --- /dev/null +++ b/openapi/components/schemas/accountSchema.yml @@ -0,0 +1,63 @@ +components: + schemas: + Account: + type: object + properties: + id: + $ref: '#/components/schemas/address' + account_id: + $ref: '#/components/schemas/address' + sequence: + $ref: '#/components/schemas/sequence' + sequence_ledger: + $ref: '#/components/schemas/sequence_ledger' + sequence_time: + type: string + subentry_count: + $ref: '#/components/schemas/subentry_count' + inflation_destination: + $ref: '#/components/schemas/address' + home_domain: + type: string + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + last_modified_time: + type: string + thresholds: + type: integer + account_flags: + $ref: '#/components/schemas/account_flags' + balances: + + - signers + - data + - num_sponsoring + - num_sponsered + - sponser + - pt + address: + type: string + pattern: "G[A-Z0-9]{55}" + sequence: + type: string + pattern: "[0-9]+" + subentry_count: + type: integer + format: int32 + sequence_ledger: + type: integer + format: uint32 + last_modified_ledger: + type: integer + format: uint32 + account_flags: + type: object + properties: + auth_required: + type: boolean + auth_revocable: + type: boolean + auth_immutable: + type: boolean + auth_clawback_enabled: + type: boolean \ No newline at end of file diff --git a/openapi/components/schemas/balanceSchema.yml b/openapi/components/schemas/balanceSchema.yml new file mode 100644 index 000000000..aaa60f4b5 --- /dev/null +++ b/openapi/components/schemas/balanceSchema.yml @@ -0,0 +1,55 @@ +components: + schemas: + BalanceLineNative: + type: object + properties: + balance: + $ref: '#/components/schemas/currency' + liquidity_pool_id: + type: string + limit: + $ref: '#/components/schemas/currency' + buying_liabilites: + $ref: '#/components/schemas/currency' + selling_liabilites: + $ref: '#/components/schemas/currency' + sponser: + type: string + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + is_authorized: + type: boolean + is_authorized_to_maintain_liabilites: + type: boolean + is_clawback_enabled: + type: boolean + asset_type: + type: string + enum: + - native + required: + - balance + - asset_type + - buying_liabilites + - selling_liabilites + + BalanceLineAsset: + type: object + properties: + balance: + $ref: '#/components/schemas/currency' + + + currency: + type: string + pattern: '[0-9]+\\.[0-9]{7}' + + address: + type: string + pattern: "G[A-Z0-9]{55}" + + last_modified_ledger: + type: integer + format: uint32 + + \ No newline at end of file diff --git a/openapi/main.yml b/openapi/main.yml index 2d553957b..265e37376 100644 --- a/openapi/main.yml +++ b/openapi/main.yml @@ -10,9 +10,9 @@ tags: paths: /accounts/{account_id}: - $ref: 'account.yml#/paths/~1accounts~1{account_id}' + $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}' /accounts/{account_id}/operations: - $ref : 'account.yml#/paths/~1accounts~1{account_id}~1operations' + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1operations' From fa0f5585cbec8d6bbebfe50b1deb65e0fb223ed0 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Fri, 19 Aug 2022 14:37:14 -0400 Subject: [PATCH 02/11] Finishing Account Schema --- openapi/components/schemas/accountSchema.yml | 62 ++++++++++++--- openapi/components/schemas/balanceSchema.yml | 79 ++++++++++++++++++-- 2 files changed, 127 insertions(+), 14 deletions(-) diff --git a/openapi/components/schemas/accountSchema.yml b/openapi/components/schemas/accountSchema.yml index 7ed588f7e..cf8ea1057 100644 --- a/openapi/components/schemas/accountSchema.yml +++ b/openapi/components/schemas/accountSchema.yml @@ -25,16 +25,44 @@ components: type: string thresholds: type: integer - account_flags: - $ref: '#/components/schemas/account_flags' + flags: + $ref: '#/components/schemas/flags' balances: - + type: array + items: + anyOf: + - $ref: '/balanceSchema.yml#/components/schemas/BalanceLineNative' + - $ref: '/balanceSchema.yml#/components/schemas/BalanceLineAsset' + - $ref: '/balanceSchema.yml#/components/schemas/BalanceLineLiquidityPool' + signers: + type: array + items: + - $ref: '#/components/schemas/signers' + data: + type: object + num_sponsoring: + type: integer + num_sponsered: + type: integer + sponser: + - $ref: '#/components/schemas/address' + paging_token: + type: string + required: + - id + - account_id + - sequence + - subentry_count + - last_modified_ledger + - last_modified_time + - thresholds + - flags + - balances - signers - data - - num_sponsoring - - num_sponsered - - sponser - - pt + - num_sponsoring + - num_sponsered + - paging_token address: type: string pattern: "G[A-Z0-9]{55}" @@ -50,7 +78,7 @@ components: last_modified_ledger: type: integer format: uint32 - account_flags: + flags: type: object properties: auth_required: @@ -60,4 +88,20 @@ components: auth_immutable: type: boolean auth_clawback_enabled: - type: boolean \ No newline at end of file + type: boolean + signers: + type: object + properties: + key: + $ref: '#/components/schemas/address' + weight: + type: integer + format: int32 + type: + type: string + enum: + - ed25519_public_key + - sha256_hash + - preauth_tx + sponser: + $ref: '#/components/schemas/address' diff --git a/openapi/components/schemas/balanceSchema.yml b/openapi/components/schemas/balanceSchema.yml index aaa60f4b5..aefed1db6 100644 --- a/openapi/components/schemas/balanceSchema.yml +++ b/openapi/components/schemas/balanceSchema.yml @@ -29,25 +29,94 @@ components: - native required: - balance + - limit - asset_type - buying_liabilites - selling_liabilites - + - last_modified_ledger + - is_authorized + - is_authorized_to_maintain_liabilites + - is_clawback_enabled BalanceLineAsset: type: object properties: balance: $ref: '#/components/schemas/currency' - - + limit: + $ref: '#/components/schemas/currency' + buying_liabilites: + $ref: '#/components/schemas/currency' + selling_liabilites: + $ref: '#/components/schemas/currency' + sponser: + $ref: '#/components/schemas/address' + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + is_authorized: + type: boolean + is_authorized_to_maintain_liabilites: + type: boolean + is_clawback_enabled: + type: boolean + asset_type: + type: string + enum: + - credit_alphanum4 + - credit_alphanum12 + asset_code: + type: string + asset_issuer: + $ref: '#/components/schemas/address' + required: + - balance + - limit + - asset_type + - asset_code + - asset_issuer + - buying_liabilites + - selling_liabilites + - last_modified_ledger + - is_authorized + - is_authorized_to_maintain_liabilites + - is_clawback_enabled + BalanceLineLiquidityPool: + type: object + properties: + liquidity_pool_id: + type: string + asset_type: + type: string + enum: + - liquidity_pool_shares + balance: + $ref: '#/components/schemas/currency' + limit: + $ref: '#/components/schemas/currency' + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + sponser: + $ref: '#/components/schemas/address' + is_authorized: + type: boolean + is_authorized_to_maintain_liabilites: + type: boolean + is_clawback_enabled: + type: boolean + required: + - liquidity_pool_id + - balance + - limit + - asset_type + - last_modified_ledger + - is_authorized + - is_authorized_to_maintain_liabilites + - is_clawback_enabled currency: type: string pattern: '[0-9]+\\.[0-9]{7}' - address: type: string pattern: "G[A-Z0-9]{55}" - last_modified_ledger: type: integer format: uint32 From 04827a039db4887b9ae7379fe501606d9a0901e9 Mon Sep 17 00:00:00 2001 From: taylor-at-Stellar Date: Mon, 12 Sep 2022 11:22:20 -0400 Subject: [PATCH 03/11] TransactionSchemaUpdate --- openapi/components/endpoints/account.yml | 2 +- openapi/components/instance_variables.yml | 41 +++++++ openapi/components/schemas/accountSchema.yml | 53 +++------- .../components/schemas/transactionSchema.yml | 100 ++++++++++++++++++ 4 files changed, 158 insertions(+), 38 deletions(-) create mode 100644 openapi/components/instance_variables.yml create mode 100644 openapi/components/schemas/transactionSchema.yml diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/account.yml index 029abd8cb..00534c798 100644 --- a/openapi/components/endpoints/account.yml +++ b/openapi/components/endpoints/account.yml @@ -16,7 +16,7 @@ paths: get: tags: - account - summary: Retrieves an Account + summary: Retrieve an Account description: The single account endpoint provides information on a specific account. The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet. operationId: RetrieveAnAccount diff --git a/openapi/components/instance_variables.yml b/openapi/components/instance_variables.yml new file mode 100644 index 000000000..ea5ce5016 --- /dev/null +++ b/openapi/components/instance_variables.yml @@ -0,0 +1,41 @@ +components: + schemas: + id: + type: string + address: + type: string + pattern: "G[A-Z0-9]{55}" + sequence: + type: string + pattern: "[0-9]+" + subentry_count: + type: integer + format: int32 + sequence_ledger: + type: integer + format: uint32 + last_modified_ledger: + type: integer + format: uint32 + flags: + type: object + properties: + auth_required: + type: boolean + auth_revocable: + type: boolean + auth_immutable: + type: boolean + auth_clawback_enabled: + type: boolean + thresholds: + type: object + properties: + low_threshold: + type: integer + med_threshold: + type: integer + high_threshold: + type: integer + hash: + type: string \ No newline at end of file diff --git a/openapi/components/schemas/accountSchema.yml b/openapi/components/schemas/accountSchema.yml index cf8ea1057..f7e4b4811 100644 --- a/openapi/components/schemas/accountSchema.yml +++ b/openapi/components/schemas/accountSchema.yml @@ -4,29 +4,29 @@ components: type: object properties: id: - $ref: '#/components/schemas/address' + $ref: '../instance_variables.yml#/components/schemas/id' account_id: - $ref: '#/components/schemas/address' + $ref: '../instance_variables.yml#/components/schemas/address' sequence: - $ref: '#/components/schemas/sequence' + $ref: '../instance_variables.yml#/components/schemas/sequence' sequence_ledger: - $ref: '#/components/schemas/sequence_ledger' + $ref: '../instance_variables.yml#/components/schemas/sequence_ledger' sequence_time: type: string subentry_count: - $ref: '#/components/schemas/subentry_count' + $ref: '../instance_variables.yml#/components/schemas/subentry_count' inflation_destination: - $ref: '#/components/schemas/address' + $ref: '../instance_variables.yml#/components/schemas/address' home_domain: type: string last_modified_ledger: - $ref: '#/components/schemas/last_modified_ledger' + $ref: '../instance_variables.yml#/components/schemas/last_modified_ledger' last_modified_time: type: string thresholds: - type: integer + $ref: '../instance_variables.yml#/components/schemas/thresholds' flags: - $ref: '#/components/schemas/flags' + $ref: '../instance_variables.yml#/components/schemas/flags' balances: type: array items: @@ -63,37 +63,11 @@ components: - num_sponsoring - num_sponsered - paging_token - address: - type: string - pattern: "G[A-Z0-9]{55}" - sequence: - type: string - pattern: "[0-9]+" - subentry_count: - type: integer - format: int32 - sequence_ledger: - type: integer - format: uint32 - last_modified_ledger: - type: integer - format: uint32 - flags: - type: object - properties: - auth_required: - type: boolean - auth_revocable: - type: boolean - auth_immutable: - type: boolean - auth_clawback_enabled: - type: boolean signers: type: object properties: key: - $ref: '#/components/schemas/address' + $ref: '../instance_variables.yml#/components/schemas/address' weight: type: integer format: int32 @@ -104,4 +78,9 @@ components: - sha256_hash - preauth_tx sponser: - $ref: '#/components/schemas/address' + $ref: '../instance_variables.yml#/components/schemas/address' + required: + - key + - weight + - type + diff --git a/openapi/components/schemas/transactionSchema.yml b/openapi/components/schemas/transactionSchema.yml new file mode 100644 index 000000000..67b8d6de5 --- /dev/null +++ b/openapi/components/schemas/transactionSchema.yml @@ -0,0 +1,100 @@ +components: + schemas: + Transaction: + type: object + properties: + id: + $ref: '../instance_variables.yml#/components/schemas/address' + paging_token: + type: string + successful: + type: boolean + hash: + type: string + ledger: + type: int32 + created_at: + type: string + source_account: + $ref: '../instance_variables.yml#/components/schemas/address' + account_muxed: + type: string + account_muxed_id: + asset_type: string + source_account_sequence: + type: string + fee_account: + $ref: '../instance_variables.yml#/components/schemas/address' + fee_account_muxed: + $ref: '../instance_variables.yml#/components/schemas/address' + fee_account_muxed_id: + type: string + fee_charged: + type: string + max_fee: + type: string + operation_count: + type: int32 + envelope_xdr: + type: string + result_xdr: + type: string + result_meta_xdr: + type: string + fee_meta_xdr: + type: string + memo_type: + type: string + memo_bytes: + type: string + memo: + type: string + signatures: + type: array + items: + type: string + valid_after: + type: string + valid_before: + type: string + preconditions: + $ref: '#/components/schemas/TransactionPreconditions' + + TransactionPreconditionsTimebounds: + type: object + properties: + min_time: + type: string + max_time: + type: string + + TransactionPreconditionsLedgerbounds: + type: object + properties: + min_ledger: + type: string + max_ledger: + type: string + + TransactionPreconditions: + type: object + properties: + timebounds: + $ref: '#/components/schemas/TransactionPreconditionsTimebounds' + ledgerbounds: + $ref: '#/components/schemas/TransactionPreconditionsLedgerbounds' + min_account_sequence: + type: string + min_account_sequence_age: + type: string + min_account_sequence_ledger_gap: + type: uint32 + extra_signers: + type: array + items: + type: string + FeeBumpTransaction: + type: object + properties: + hash: + $ref: '../instance_variables.yml#/components/schemas/hash' From a19c8ab5d33ee202667c27b180428b91c2ef8ae1 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Mon, 12 Sep 2022 17:12:10 -0400 Subject: [PATCH 04/11] Server Update --- openapi/components/endpoints/account.yml | 123 +- openapi/components/instance_variables.yml | 6 +- openapi/components/parameters.yml | 29 +- .../components/schemas/transactionSchema.yml | 25 +- openapi/main.yml | 8 + openapi/multi-file/components/pets.yaml | 145 --- openapi/multi-file/openapi.yaml | 1062 ----------------- 7 files changed, 180 insertions(+), 1218 deletions(-) delete mode 100644 openapi/multi-file/components/pets.yaml delete mode 100644 openapi/multi-file/openapi.yaml diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/account.yml index 00534c798..68b4a460c 100644 --- a/openapi/components/endpoints/account.yml +++ b/openapi/components/endpoints/account.yml @@ -3,6 +3,12 @@ info: title: Horizon Account API version: 0.0.1 +servers: + - url: https://horizon.stellar.org/ + description: The main network + - url: https://horizon-testnet.stellar.org/ + description: The test network + tags: - name: account description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. @@ -11,7 +17,24 @@ tags: url: https://developers.stellar.org/docs/glossary/accounts/ paths: - + /accounts: + get: + tags: + - account + summary: List all Accounts + description: "This endpoint lists accounts by one of three filters : signer, asset, or sponsor." + operationId: ListAllAccounts + parameters: + - $ref: '../parameters.yml#/components/parameters/SponserParam' + - $ref: '../parameters.yml#/components/parameters/AssetParam' + - $ref: '../parameters.yml#/components/parameters/SignerParam' + - $ref: '../parameters.yml#/components/parameters/LiquidityPoolParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + responses: + '200': + description: OK /accounts/{account_id}: get: tags: @@ -24,7 +47,10 @@ paths: - $ref: '../parameters.yml#/components/parameters/AccountIDParam' responses: '200': - description: OK + description: OK + + + /accounts/{account_id}/operations: get: @@ -42,6 +68,97 @@ paths: responses: '200': description: OK + - +components: + schemas: + id: + type: string + address: + type: string + pattern: "G[A-Z0-9]{55}" + sequence: + type: string + pattern: "[0-9]+" + subentry_count: + type: integer + format: int32 + sequence_ledger: + type: integer + format: uint32 + last_modified_ledger: + type: integer + format: uint32 + flags: + type: object + properties: + auth_required: + type: boolean + auth_revocable: + type: boolean + auth_immutable: + type: boolean + auth_clawback_enabled: + type: boolean + thresholds: + type: object + properties: + low_threshold: + type: integer + med_threshold: + type: integer + high_threshold: + type: integer + hash: + type: string + signatures: + type: array + items: + type: string + parameters: + CursorParam: + name: cursor + in: query + required: false + description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. + schema: + type: integer + example: 6606617478959105 + LimitParam: + name: limit + in: query + required: false + description: The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10. + schema: + type: integer + example: 10 + AccountIDParam: + name: account_id + in: path + required: true + description: This account’s public key encoded in a base32 string representation. + schema: + type: string + example: GAYOLLLUIZE4DZMBB2ZBKGBUBZLIOYU6XFLW37GBP2VZD3ABNXCW4BVA + OrderParam: + name: order + in: query + required: false + description: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc. + schema: + type: integer + enum: + - asc + - desc + IncludeFailedParam: + name: includefailed + in: query + required: false + description: Set to true to include failed operations in results. Options include true and false. + schema: + type: boolean + enum: + - true + - false + \ No newline at end of file diff --git a/openapi/components/instance_variables.yml b/openapi/components/instance_variables.yml index ea5ce5016..3e8bf31bd 100644 --- a/openapi/components/instance_variables.yml +++ b/openapi/components/instance_variables.yml @@ -38,4 +38,8 @@ components: high_threshold: type: integer hash: - type: string \ No newline at end of file + type: string + signatures: + type: array + items: + type: string \ No newline at end of file diff --git a/openapi/components/parameters.yml b/openapi/components/parameters.yml index e8b9560b3..a170ffd3f 100644 --- a/openapi/components/parameters.yml +++ b/openapi/components/parameters.yml @@ -1,6 +1,27 @@ components: parameters: - CursorParam: + AssetParam: + name: asset + in: query + required: false + description: An issued asset represented as “Code:IssuerAccountID”. Every account in the response will have a trustline for the given asset. + SponserParam: + name: sponser + in: query + required: false + description: Account ID of the sponsor. Every account in the response will either be sponsored by the given account ID or have a subentry (trustline, offer, or data entry) which is sponsored by the given account ID. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + SignerParam: + name: signer + in: query + required: false + description: Account ID of the signer. Every account in the response will have the given account ID as a signer. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + CursorParam: name: cursor in: query required: false @@ -44,4 +65,8 @@ components: enum: - true - false - \ No newline at end of file + LiquidityPoolParam: + name: liqudity_pool + in: query + required: false + description: With this parameter, the results will include only accounts which have trustlines to the specified liquidity pool. \ No newline at end of file diff --git a/openapi/components/schemas/transactionSchema.yml b/openapi/components/schemas/transactionSchema.yml index 67b8d6de5..a009b6329 100644 --- a/openapi/components/schemas/transactionSchema.yml +++ b/openapi/components/schemas/transactionSchema.yml @@ -50,15 +50,17 @@ components: memo: type: string signatures: - type: array - items: - type: string + $ref: '../instance_variables.yml#/components/schemas/signatures' valid_after: type: string valid_before: type: string preconditions: $ref: '#/components/schemas/TransactionPreconditions' + fee_bump_transaction: + $ref: '#/components/schemas/FeeBumpTransaction' + inner_transaction: + $ref: '#/components/schemas/InnerTransaction' TransactionPreconditionsTimebounds: type: object @@ -93,8 +95,21 @@ components: type: array items: type: string + FeeBumpTransaction: type: object properties: - hash: - $ref: '../instance_variables.yml#/components/schemas/hash' + hash: + $ref: '../instance_variables.yml#/components/schemas/hash' + signatures: + $ref: '../instance_variables.yml#/components/schemas/signatures' + + InnerTransaction: + type: object + properties: + hash: + $ref: '../instance_variables.yml#/components/schemas/hash' + signatures: + $ref: '../instance_variables.yml#/components/schemas/signatures' + max_fee: + type: string \ No newline at end of file diff --git a/openapi/main.yml b/openapi/main.yml index 265e37376..cc855f138 100644 --- a/openapi/main.yml +++ b/openapi/main.yml @@ -2,6 +2,12 @@ openapi: 3.0.3 info: title: Horizon version: 0.0.1 + +servers: + - url: https://horizon.stellar.org/ + description: The main network + - url: https://horizon-testnet.stellar.org/ + description: The test network tags: - name: account description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. @@ -9,6 +15,8 @@ tags: description: Assets are representations of value issued on the Stellar network. An asset consists of a type, code, and issuer. paths: + /accounts: + $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts' /accounts/{account_id}: $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}' /accounts/{account_id}/operations: diff --git a/openapi/multi-file/components/pets.yaml b/openapi/multi-file/components/pets.yaml deleted file mode 100644 index 020aa0686..000000000 --- a/openapi/multi-file/components/pets.yaml +++ /dev/null @@ -1,145 +0,0 @@ -components: - schemas: - Id: - type: integer - format: int64 - readOnly: true - Tag: - type: object - properties: - id: - description: Tag ID - allOf: - - $ref: '#/components/schemas/Id' - name: - description: Tag name - type: string - minLength: 1 - xml: - name: Tag - Category: - type: object - properties: - id: - description: Category ID - allOf: - - $ref: '#/components/schemas/Id' - name: - description: Category name - type: string - minLength: 1 - sub: - description: Test Sub Category - type: object - properties: - prop1: - type: string - description: Dumb Property - xml: - name: Category - Cat: - description: A representation of a cat - allOf: - - $ref: '#/components/schemas/Pet' - - type: object - properties: - huntingSkill: - type: string - description: The measured skill for hunting - default: lazy - example: adventurous - enum: - - clueless - - lazy - - adventurous - - aggressive - required: - - huntingSkill - Dog: - description: A representation of a dog - allOf: - - $ref: '#/components/schemas/Pet' - - type: object - properties: - packSize: - type: integer - format: int32 - description: The size of the pack the dog is from - default: 1 - minimum: 1 - required: - - packSize - HoneyBee: - description: A representation of a honey bee - allOf: - - $ref: '#/components/schemas/Pet' - - type: object - properties: - honeyPerDay: - type: number - description: Average amount of honey produced per day in ounces - example: 3.14 - multipleOf: .01 - required: - - honeyPerDay - Pet: - type: object - required: - - name - - photoUrls - discriminator: - propertyName: petType - mapping: - cat: '#/components/schemas/Cat' - dog: '#/components/schemas/Dog' - bee: '#/components/schemas/HoneyBee' - properties: - id: - externalDocs: - description: 'Find more info here' - url: 'https://example.com' - description: Pet ID - allOf: - - $ref: '#/components/schemas/Id' - category: - description: Categories this pet belongs to - allOf: - - $ref: '#/components/schemas/Category' - name: - description: The name given to a pet - type: string - example: Guru - photoUrls: - description: The list of URL to a cute photos featuring pet - type: array - maxItems: 20 - xml: - name: photoUrl - wrapped: true - items: - type: string - format: url - friend: - allOf: - - $ref: '#/components/schemas/Pet' - tags: - description: Tags attached to the pet - type: array - minItems: 1 - xml: - name: tag - wrapped: true - items: - $ref: '#/components/schemas/Tag' - status: - type: string - description: Pet status in the store - enum: - - available - - pending - - sold - petType: - description: Type of a pet - type: string - xml: - name: Pet diff --git a/openapi/multi-file/openapi.yaml b/openapi/multi-file/openapi.yaml deleted file mode 100644 index 099d6d01e..000000000 --- a/openapi/multi-file/openapi.yaml +++ /dev/null @@ -1,1062 +0,0 @@ -openapi: 3.0.0 -servers: - - url: //petstore.swagger.io/v2 - description: Default server - - url: //petstore.swagger.io/sandbox - description: Sandbox server -info: - description: | - This is a sample server Petstore server. - You can find out more about Swagger at - [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). - For this sample, you can use the api key `special-key` to test the authorization filters. - - # Introduction - This API is documented in **OpenAPI format** and is based on - [Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. - It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) - tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard - OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md). - - # OpenAPI Specification - This API is documented in **OpenAPI format** and is based on - [Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. - It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) - tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard - OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md). - - # Cross-Origin Resource Sharing - This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). - And that allows cross-domain communication from the browser. - All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. - - # Authentication - - Petstore offers two forms of authentication: - - API Key - - OAuth2 - OAuth2 - an open protocol to allow secure authorization in a simple - and standard method from web, mobile and desktop applications. - - - - version: 1.0.0 - title: Swagger Petstore [Automatic Page From File] - termsOfService: 'http://swagger.io/terms/' - contact: - name: API Support - email: apiteam@swagger.io - url: https://github.com/Redocly/redoc - x-logo: - url: 'https://redocly.github.io/redoc/petstore-logo.png' - altText: Petstore logo - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -externalDocs: - description: Find out how to create Github repo for your OpenAPI spec. - url: 'https://github.com/Rebilly/generator-openapi-repo' -tags: - - name: pet - description: Everything about your Pets - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - - name: pet_model - x-displayName: The Pet Model - description: | - - - name: store_model - x-displayName: The Order Model - description: | - -x-tagGroups: - - name: General - tags: - - pet - - store - - name: User Management - tags: - - user - - name: Models - tags: - - pet_model - - store_model -paths: - /pet: - parameters: - - name: Accept-Language - in: header - description: 'The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US' - example: en-US - required: false - schema: - type: string - default: en-AU - - name: cookieParam - in: cookie - description: Some cookie - required: true - schema: - type: integer - format: int64 - post: - tags: - - pet - summary: Add a new pet to the store - description: Add new pet to the store inventory. - operationId: addPet - responses: - '405': - description: Invalid input - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' - x-codeSamples: - - lang: 'C#' - source: | - PetStore.v1.Pet pet = new PetStore.v1.Pet(); - pet.setApiKey("your api key"); - pet.petType = PetStore.v1.Pet.TYPE_DOG; - pet.name = "Rex"; - // set other fields - PetStoreResponse response = pet.create(); - if (response.statusCode == HttpStatusCode.Created) - { - // Successfully created - } - else - { - // Something wrong -- check response for errors - Console.WriteLine(response.getRawResponse()); - } - - lang: PHP - source: | - $form = new \PetStore\Entities\Pet(); - $form->setPetType("Dog"); - $form->setName("Rex"); - // set other fields - try { - $pet = $client->pets()->create($form); - } catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); - } - requestBody: - $ref: '#/components/requestBodies/Pet' - put: - tags: - - pet - summary: Update an existing pet - description: '' - operationId: updatePet - responses: - '400': - description: Invalid ID supplied - '404': - description: Pet not found - '405': - description: Validation exception - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' - x-codeSamples: - - lang: PHP - source: | - $form = new \PetStore\Entities\Pet(); - $form->setPetId(1); - $form->setPetType("Dog"); - $form->setName("Rex"); - // set other fields - try { - $pet = $client->pets()->update($form); - } catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); - } - requestBody: - $ref: '#/components/requestBodies/Pet' - '/pet/{petId}': - get: - tags: - - pet - summary: Find pet by ID - description: Returns a single pet - operationId: getPetById - parameters: - - name: petId - in: path - description: ID of pet to return - required: true - deprecated: true - schema: - type: integer - format: int64 - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: 'components/pets.yaml#/components/schemas/Pet' - application/xml: - schema: - $ref: 'components/pets.yaml#/components/schemas/Pet' - '400': - description: Invalid ID supplied - '404': - description: Pet not found - security: - - api_key: [] - post: - tags: - - pet - summary: Updates a pet in the store with form data - description: '' - operationId: updatePetWithForm - parameters: - - name: petId - in: path - description: ID of pet that needs to be updated - required: true - schema: - type: integer - format: int64 - responses: - '405': - description: Invalid input - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' - requestBody: - content: - application/x-www-form-urlencoded: - schema: - type: object - properties: - name: - description: Updated name of the pet - type: string - status: - description: Updated status of the pet - type: string - delete: - tags: - - pet - summary: Deletes a pet - description: '' - operationId: deletePet - parameters: - - name: api_key - in: header - required: false - schema: - type: string - example: 'Bearer ' - - name: petId - in: path - description: Pet id to delete - required: true - schema: - type: integer - format: int64 - responses: - '400': - description: Invalid pet value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' - '/pet/{petId}/uploadImage': - post: - tags: - - pet - summary: uploads an image - description: '' - operationId: uploadFile - parameters: - - name: petId - in: path - description: ID of pet to update - required: true - schema: - type: integer - format: int64 - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' - requestBody: - content: - application/octet-stream: - schema: - type: string - format: binary - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - style: form - schema: - type: array - minItems: 1 - maxItems: 3 - items: - type: string - enum: - - available - - pending - - sold - default: available - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: array - items: - $ref: 'components/pets.yaml#/components/schemas/Pet' - application/xml: - schema: - type: array - items: - $ref: 'components/pets.yaml#/components/schemas/Pet' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' - /pet/findByTags: - get: - tags: - - pet - summary: Finds Pets by tags - description: >- - Multiple tags can be provided with comma separated strings. Use tag1, - tag2, tag3 for testing. - operationId: findPetsByTags - deprecated: true - parameters: - - name: tags - in: query - description: Tags to filter by - required: true - style: form - schema: - type: array - items: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: array - items: - $ref: 'components/pets.yaml#/components/schemas/Pet' - application/xml: - schema: - type: array - items: - $ref: 'components/pets.yaml#/components/schemas/Pet' - '400': - description: Invalid tag value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' - /store/inventory: - get: - tags: - - store - summary: Returns pet inventories by status - description: Returns a map of status codes to quantities - operationId: getInventory - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - additionalProperties: - type: integer - format: int32 - security: - - api_key: [] - /store/order: - post: - tags: - - store - summary: Place an order for a pet - description: '' - operationId: placeOrder - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Order' - application/xml: - schema: - $ref: '#/components/schemas/Order' - '400': - description: Invalid Order - content: - application/json: - example: - status: 400 - message: 'Invalid Order' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Order' - description: order placed for purchasing the pet - required: true - '/store/order/{orderId}': - get: - tags: - - store - summary: Find purchase order by ID - description: >- - For valid response try integer IDs with value <= 5 or > 10. Other values - will generated exceptions - operationId: getOrderById - parameters: - - name: orderId - in: path - description: ID of pet that needs to be fetched - required: true - schema: - type: integer - format: int64 - minimum: 1 - maximum: 5 - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Order' - application/xml: - schema: - $ref: '#/components/schemas/Order' - '400': - description: Invalid ID supplied - '404': - description: Order not found - delete: - tags: - - store - summary: Delete purchase order by ID - description: >- - For valid response try integer IDs with value < 1000. Anything above - 1000 or nonintegers will generate API errors - operationId: deleteOrder - parameters: - - name: orderId - in: path - description: ID of the order that needs to be deleted - required: true - schema: - type: string - minimum: 1 - responses: - '400': - description: Invalid ID supplied - '404': - description: Order not found - /store/subscribe: - post: - tags: - - store - summary: Subscribe to the Store events - description: Add subscription for a store events - requestBody: - content: - application/json: - schema: - type: object - properties: - callbackUrl: - type: string - format: uri - description: This URL will be called by the server when the desired event will occur - example: https://myserver.com/send/callback/here - eventName: - type: string - description: Event name for the subscription - enum: - - orderInProgress - - orderShipped - - orderDelivered - example: orderInProgress - required: - - callbackUrl - - eventName - responses: - '201': - description: Subscription added - content: - application/json: - schema: - type: object - properties: - subscriptionId: - type: string - example: AAA-123-BBB-456 - callbacks: - orderInProgress: - '{$request.body#/callbackUrl}?event={$request.body#/eventName}': - servers: - - url: //callback-url.path-level/v1 - description: Path level server 1 - - url: //callback-url.path-level/v2 - description: Path level server 2 - post: - summary: Order in Progress (Summary) - description: A callback triggered every time an Order is updated status to "inProgress" (Description) - externalDocs: - description: Find out more - url: 'https://more-details.com/demo' - requestBody: - content: - application/json: - schema: - type: object - properties: - orderId: - type: string - example: '123' - timestamp: - type: string - format: date-time - example: '2018-10-19T16:46:45Z' - status: - type: string - example: 'inProgress' - application/xml: - schema: - type: object - properties: - orderId: - type: string - example: '123' - example: | - - - 123 - inProgress - 2018-10-19T16:46:45Z - - responses: - '200': - description: Callback successfully processed and no retries will be performed - content: - application/json: - schema: - type: object - properties: - someProp: - type: string - example: '123' - '299': - description: Response for cancelling subscription - '500': - description: Callback processing failed and retries will be performed - x-codeSamples: - - lang: 'C#' - source: | - PetStore.v1.Pet pet = new PetStore.v1.Pet(); - pet.setApiKey("your api key"); - pet.petType = PetStore.v1.Pet.TYPE_DOG; - pet.name = "Rex"; - // set other fields - PetStoreResponse response = pet.create(); - if (response.statusCode == HttpStatusCode.Created) - { - // Successfully created - } - else - { - // Something wrong -- check response for errors - Console.WriteLine(response.getRawResponse()); - } - - lang: PHP - source: | - $form = new \PetStore\Entities\Pet(); - $form->setPetType("Dog"); - $form->setName("Rex"); - // set other fields - try { - $pet = $client->pets()->create($form); - } catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); - } - put: - description: Order in Progress (Only Description) - servers: - - url: //callback-url.operation-level/v1 - description: Operation level server 1 (Operation override) - - url: //callback-url.operation-level/v2 - description: Operation level server 2 (Operation override) - requestBody: - content: - application/json: - schema: - type: object - properties: - orderId: - type: string - example: '123' - timestamp: - type: string - format: date-time - example: '2018-10-19T16:46:45Z' - status: - type: string - example: 'inProgress' - application/xml: - schema: - type: object - properties: - orderId: - type: string - example: '123' - example: | - - - 123 - inProgress - 2018-10-19T16:46:45Z - - responses: - '200': - description: Callback successfully processed and no retries will be performed - content: - application/json: - schema: - type: object - properties: - someProp: - type: string - example: '123' - orderShipped: - '{$request.body#/callbackUrl}?event={$request.body#/eventName}': - post: - description: | - Very long description - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis - nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in - culpa qui officia deserunt mollit anim id est laborum. - requestBody: - content: - application/json: - schema: - type: object - properties: - orderId: - type: string - example: '123' - timestamp: - type: string - format: date-time - example: '2018-10-19T16:46:45Z' - estimatedDeliveryDate: - type: string - format: date-time - example: '2018-11-11T16:00:00Z' - responses: - '200': - description: Callback successfully processed and no retries will be performed - orderDelivered: - 'http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}': - post: - deprecated: true - summary: Order delivered - description: A callback triggered every time an Order is delivered to the recipient - requestBody: - content: - application/json: - schema: - type: object - properties: - orderId: - type: string - example: '123' - timestamp: - type: string - format: date-time - example: '2018-10-19T16:46:45Z' - responses: - '200': - description: Callback successfully processed and no retries will be performed - /user: - post: - tags: - - user - summary: Create user - description: This can only be done by the logged in user. - operationId: createUser - responses: - default: - description: successful operation - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/User' - description: Created user object - required: true - '/user/{username}': - get: - tags: - - user - summary: Get user by user name - description: '' - operationId: getUserByName - parameters: - - name: username - in: path - description: 'The name that needs to be fetched. Use user1 for testing. ' - required: true - schema: - type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/User' - application/xml: - schema: - $ref: '#/components/schemas/User' - '400': - description: Invalid username supplied - '404': - description: User not found - put: - tags: - - user - summary: Updated user - description: This can only be done by the logged in user. - operationId: updateUser - parameters: - - name: username - in: path - description: name that need to be deleted - required: true - schema: - type: string - responses: - '400': - description: Invalid user supplied - '404': - description: User not found - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/User' - description: Updated user object - required: true - delete: - tags: - - user - summary: Delete user - description: This can only be done by the logged in user. - operationId: deleteUser - parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - schema: - type: string - responses: - '400': - description: Invalid username supplied - '404': - description: User not found - /user/createWithArray: - post: - tags: - - user - summary: Creates list of users with given input array - description: '' - operationId: createUsersWithArrayInput - responses: - default: - description: successful operation - requestBody: - $ref: '#/components/requestBodies/UserArray' - /user/createWithList: - post: - tags: - - user - summary: Creates list of users with given input array - description: '' - operationId: createUsersWithListInput - responses: - default: - description: successful operation - requestBody: - $ref: '#/components/requestBodies/UserArray' - /user/login: - get: - tags: - - user - summary: Logs user into the system - description: '' - operationId: loginUser - parameters: - - name: username - in: query - description: The user name for login - required: true - schema: - type: string - - name: password - in: query - description: The password for login in clear text - required: true - schema: - type: string - responses: - '200': - description: successful operation - headers: - X-Rate-Limit: - description: calls per hour allowed by the user - schema: - type: integer - format: int32 - X-Expires-After: - description: date in UTC when token expires - schema: - type: string - format: date-time - content: - application/json: - schema: - type: string - examples: - response: - value: OK - application/xml: - schema: - type: string - examples: - response: - value: OK - text/plain: - examples: - response: - value: OK - '400': - description: Invalid username/password supplied - /user/logout: - get: - tags: - - user - summary: Logs out current logged in user session - description: '' - operationId: logoutUser - responses: - default: - description: successful operation -components: - schemas: - ApiResponse: - type: object - properties: - code: - type: integer - format: int32 - type: - type: string - message: - type: string - Order: - type: object - properties: - id: - description: Order ID - allOf: - - $ref: 'components/pets.yaml#/components/schemas/Id' - petId: - description: Pet ID - allOf: - - $ref: 'components/pets.yaml#/components/schemas/Id' - quantity: - type: integer - format: int32 - minimum: 1 - default: 1 - shipDate: - description: Estimated ship date - type: string - format: date-time - status: - type: string - description: Order Status - enum: - - placed - - approved - - delivered - complete: - description: Indicates whenever order was completed or not - type: boolean - default: false - readOnly: true - requestId: - description: Unique Request Id - type: string - writeOnly: true - xml: - name: Order - User: - type: object - properties: - id: - $ref: 'components/pets.yaml#/components/schemas/Id' - pet: - oneOf: - - $ref: 'components/pets.yaml#/components/schemas/Pet' - - $ref: 'components/pets.yaml#/components/schemas/Tag' - username: - description: User supplied username - type: string - minLength: 4 - example: John78 - firstName: - description: User first name - type: string - minLength: 1 - example: John - lastName: - description: User last name - type: string - minLength: 1 - example: Smith - email: - description: User email address - type: string - format: email - example: john.smith@example.com - password: - type: string - description: >- - User password, MUST contain a mix of upper and lower case letters, - as well as digits - format: password - minLength: 8 - pattern: '/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/' - example: drowssaP123 - phone: - description: User phone number in international format - type: string - pattern: '/^\+(?:[0-9]-?){6,14}[0-9]$/' - example: +1-202-555-0192 - userStatus: - description: User status - type: integer - format: int32 - xml: - name: User - requestBodies: - Pet: - content: - application/json: - schema: - allOf: - - description: My Pet - title: Pettie - - $ref: 'components/pets.yaml#/components/schemas/Pet' - application/xml: - schema: - type: 'object' - properties: - name: - type: string - description: hooray - description: Pet object that needs to be added to the store - required: true - UserArray: - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/User' - description: List of user object - required: true - securitySchemes: - petstore_auth: - description: | - Get access to data while protecting your account credentials. - OAuth2 is also a safer and more secure way to give you access. - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - description: > - For this sample, you can use the api key `special-key` to test the - authorization filters. - type: apiKey - name: api_key - in: header - examples: - Order: - value: - quantity: 1 - shipDate: '2018-10-19T16:46:45Z' - status: placed - complete: false -x-webhooks: - newPet: - post: - summary: New pet - description: Information about a new pet in the systems - operationId: newPet - tags: - - pet - requestBody: - content: - application/json: - schema: - $ref: 'components/pets.yaml#/components/schemas/Pet' - responses: - '200': - description: Return a 200 status to indicate that the data was received successfully From 03fad1da1a46f79decaf616913dbfe12bf1c6e5c Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Tue, 13 Sep 2022 21:53:20 -0400 Subject: [PATCH 05/11] Finished Account Copy --- openapi/components/endpoints/account.yml | 190 +++++++++++------------ openapi/components/parameters.yml | 17 +- openapi/main.yml | 12 ++ 3 files changed, 119 insertions(+), 100 deletions(-) diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/account.yml index 68b4a460c..86d1bd468 100644 --- a/openapi/components/endpoints/account.yml +++ b/openapi/components/endpoints/account.yml @@ -48,10 +48,22 @@ paths: responses: '200': description: OK - - - - + /accounts/{account_id}/transactions: + get: + tags: + - account + summary: Retrieve an Account's Transactions + description: "This endpoint represents successful transactions for a given account and can be used in streaming mode. Streaming mode allows you to listen for new transactions for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known transaction unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream transactions created since your request time." + operationId: GetTransactionsByAccountid + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + - $ref: '../parameters.yml#/components/parameters/IncludeFailedParam' + responses: + '200': + description: OK /accounts/{account_id}/operations: get: tags: @@ -65,100 +77,82 @@ paths: - $ref: '../parameters.yml#/components/parameters/OrderParam' - $ref: '../parameters.yml#/components/parameters/LimitParam' - $ref: '../parameters.yml#/components/parameters/IncludeFailedParam' + - $ref: '../parameters.yml#/components/parameters/JoinParam' responses: '200': description: OK - - - -components: - schemas: - id: - type: string - address: - type: string - pattern: "G[A-Z0-9]{55}" - sequence: - type: string - pattern: "[0-9]+" - subentry_count: - type: integer - format: int32 - sequence_ledger: - type: integer - format: uint32 - last_modified_ledger: - type: integer - format: uint32 - flags: - type: object - properties: - auth_required: - type: boolean - auth_revocable: - type: boolean - auth_immutable: - type: boolean - auth_clawback_enabled: - type: boolean - thresholds: - type: object - properties: - low_threshold: - type: integer - med_threshold: - type: integer - high_threshold: - type: integer - hash: - type: string - signatures: - type: array - items: - type: string - parameters: - CursorParam: - name: cursor - in: query - required: false - description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. - schema: - type: integer - example: 6606617478959105 - LimitParam: - name: limit - in: query - required: false - description: The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10. - schema: - type: integer - example: 10 - AccountIDParam: - name: account_id - in: path - required: true - description: This account’s public key encoded in a base32 string representation. - schema: - type: string - example: GAYOLLLUIZE4DZMBB2ZBKGBUBZLIOYU6XFLW37GBP2VZD3ABNXCW4BVA - OrderParam: - name: order - in: query - required: false - description: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc. - schema: - type: integer - enum: - - asc - - desc - IncludeFailedParam: - name: includefailed - in: query - required: false - description: Set to true to include failed operations in results. Options include true and false. - schema: - type: boolean - enum: - - true - - false - \ No newline at end of file + /accounts/{account_id}/payments: + get: + tags: + - account + summary: Retrieve an Account's Payments + description: "This endpoint represents successful payments for a given account and can be used in streaming mode. Streaming mode allows you to listen for new payments for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known payment unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream payments created since your request time." + operationId: GetPaymentsbyAccountid + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + - $ref: '../parameters.yml#/components/parameters/IncludeFailedParam' + - $ref: '../parameters.yml#/components/parameters/JoinParam' + responses: + '200': + description: OK + /accounts/{account_id}/effects: + get: + tags: + - account + summary: Retrieve an Account's Effects + description: This endpoint returns the effects of a specific account and can be used in streaming mode. Streaming mode allows you to listen for new effects for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known effect unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream effects created since your request time. + operationId: GetEffectsbyAccountid + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + responses: + '200': + description: OK + /accounts/{account_id}/offers: + get: + tags: + - account + summary: Retrieve an Account's Offers + description: This endpoint represents all offers a given account has currently open and can be used in streaming mode. Streaming mode allows you to listen for new offers for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known offer unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream offers created since your request time. + operationId: GetOffersbyAccountid + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + responses: + '200': + description: OK + /accounts/{account_id}/trades: + get: + tags: + - account + summary: Retrieve an Account's Trades + description: This endpoint represents all trades for a given account and can be used in streaming mode. Streaming mode allows you to listen for trades for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. + operationId: GetTradesbyAccountid + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + responses: + '200': + description: OK + /accounts/{account_id}/data/{key}: + get: + tags: + - account + summary: Retrieve an Account's Data + description: This endpoint represents a single data for a given account. + operationId: GetDatabyAccountid + parameters: + - $ref: '../parameters.yml#/components/parameters/AccountIDParam' + - $ref: '../parameters.yml#/components/parameters/DataParam' + responses: + '200': + description: OK diff --git a/openapi/components/parameters.yml b/openapi/components/parameters.yml index a170ffd3f..29b100666 100644 --- a/openapi/components/parameters.yml +++ b/openapi/components/parameters.yml @@ -51,7 +51,7 @@ components: required: false description: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc. schema: - type: integer + type: string enum: - asc - desc @@ -69,4 +69,17 @@ components: name: liqudity_pool in: query required: false - description: With this parameter, the results will include only accounts which have trustlines to the specified liquidity pool. \ No newline at end of file + description: With this parameter, the results will include only accounts which have trustlines to the specified liquidity pool. + JoinParam: + name: join + in: query + required: false + description: Set to transactions to include the transactions which created each of the operations in the response. + DataParam: + name: key + in: path + required: true + description: The key name for this data. + schema: + type: string + example: config.memo_required \ No newline at end of file diff --git a/openapi/main.yml b/openapi/main.yml index cc855f138..39c851d1b 100644 --- a/openapi/main.yml +++ b/openapi/main.yml @@ -19,8 +19,20 @@ paths: $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts' /accounts/{account_id}: $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}' + /accounts/{account_id}/transactions: + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1transactions' /accounts/{account_id}/operations: $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1operations' + /accounts/{account_id}/payments: + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1payments' + /accounts/{account_id}/effects: + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1effects' + /accounts/{account_id}/offers: + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1offers' + /accounts/{account_id}/trades: + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1trades' + /accounts/{account_id}/data/{key}: + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1data~1{key}' From 18227daa75fe9ba55d69a21d2e8fddc251bd8b96 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Wed, 14 Sep 2022 17:45:54 -0400 Subject: [PATCH 06/11] Documenting Retrieve Account Response --- openapi/_build/main.yml | 72 +++++++++++++++++++ openapi/components/endpoints/account.yml | 28 +++----- openapi/components/instance_variables.yml | 12 +++- .../components/schemas/accountLinkSchema.yml | 33 +++++++++ openapi/components/schemas/accountSchema.yml | 10 +-- openapi/components/schemas/balanceSchema.yml | 2 +- redocly.yaml | 29 ++++++++ 7 files changed, 159 insertions(+), 27 deletions(-) create mode 100644 openapi/_build/main.yml create mode 100644 openapi/components/schemas/accountLinkSchema.yml create mode 100644 redocly.yaml diff --git a/openapi/_build/main.yml b/openapi/_build/main.yml new file mode 100644 index 000000000..1b88c5c28 --- /dev/null +++ b/openapi/_build/main.yml @@ -0,0 +1,72 @@ +openapi: 3.0.3 +info: + title: Horizon + version: 0.0.1 +tags: + - name: account + description: 'Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions.' + - name: assets + description: 'Assets are representations of value issued on the Stellar network. An asset consists of a type, code, and issuer.' +paths: + '/accounts/{account_id}': + get: + tags: + - account + summary: Retrieve an Account + description: 'The single account endpoint provides information on a specific account. The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet.' + operationId: RetrieveAnAccount + parameters: + - name: account_id + in: path + required: true + description: This account’s public key encoded in a base32 string representation. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + responses: + '200': + description: OK + '/accounts/{account_id}/operations': + get: + tags: + - account + summary: Retrieve an Account's Operations + description: 'This endpoint represents successful operations for a given account and can be used in streaming mode. Streaming mode allows you to listen for new operations for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time.' + operationId: GetOperationsByAccountid + parameters: + - $ref: '#/paths/~1accounts~1%7Baccount_id%7D/get/parameters/0' + - name: cursor + in: query + required: false + description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. + schema: + type: integer + example: 6606617478959105 + - name: order + in: query + required: false + description: 'A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc.' + schema: + type: integer + enum: + - asc + - desc + - name: limit + in: query + required: false + description: 'The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.' + schema: + type: integer + example: 10 + - name: includefailed + in: query + required: false + description: Set to true to include failed operations in results. Options include true and false. + schema: + type: boolean + enum: + - true + - false + responses: + '200': + description: OK diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/account.yml index 86d1bd468..8aa6207e3 100644 --- a/openapi/components/endpoints/account.yml +++ b/openapi/components/endpoints/account.yml @@ -1,21 +1,3 @@ -openapi: 3.0.3 -info: - title: Horizon Account API - version: 0.0.1 - -servers: - - url: https://horizon.stellar.org/ - description: The main network - - url: https://horizon-testnet.stellar.org/ - description: The test network - -tags: - - name: account - description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. - externalDocs: - description: Learn more about accounts here - url: https://developers.stellar.org/docs/glossary/accounts/ - paths: /accounts: get: @@ -47,7 +29,13 @@ paths: - $ref: '../parameters.yml#/components/parameters/AccountIDParam' responses: '200': - description: OK + description: Returns details like balances, sponserships etc. about an account. + content: + application/json: + schema: + allOf: + - $ref: "../schemas/accountLinkSchema.yml#/components/schemas/AccountLink" + - $ref: "../schemas/accountSchema.yml#/components/schemas/Account" /accounts/{account_id}/transactions: get: tags: @@ -155,4 +143,4 @@ paths: - $ref: '../parameters.yml#/components/parameters/DataParam' responses: '200': - description: OK + description: OK \ No newline at end of file diff --git a/openapi/components/instance_variables.yml b/openapi/components/instance_variables.yml index 3e8bf31bd..1aac411d4 100644 --- a/openapi/components/instance_variables.yml +++ b/openapi/components/instance_variables.yml @@ -42,4 +42,14 @@ components: signatures: type: array items: - type: string \ No newline at end of file + type: string + link: + type: object + properties: + href: + type: string + format: link + templated: + type: boolean + required: + ["href"] \ No newline at end of file diff --git a/openapi/components/schemas/accountLinkSchema.yml b/openapi/components/schemas/accountLinkSchema.yml new file mode 100644 index 000000000..876fff2c8 --- /dev/null +++ b/openapi/components/schemas/accountLinkSchema.yml @@ -0,0 +1,33 @@ +components: + schemas: + AccountLink: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + transactions: + $ref: '../instance_variables.yml#/components/schemas/link' + operations: + $ref: '../instance_variables.yml#/components/schemas/link' + payments: + $ref: '../instance_variables.yml#/components/schemas/link' + effects: + $ref: '../instance_variables.yml#/components/schemas/link' + offers: + $ref: '../instance_variables.yml#/components/schemas/link' + trades: + $ref: '../instance_variables.yml#/components/schemas/link' + data: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - transactions + - operations + - payments + - effects + - offers + - trades + - data \ No newline at end of file diff --git a/openapi/components/schemas/accountSchema.yml b/openapi/components/schemas/accountSchema.yml index f7e4b4811..0e4a24231 100644 --- a/openapi/components/schemas/accountSchema.yml +++ b/openapi/components/schemas/accountSchema.yml @@ -31,13 +31,13 @@ components: type: array items: anyOf: - - $ref: '/balanceSchema.yml#/components/schemas/BalanceLineNative' - - $ref: '/balanceSchema.yml#/components/schemas/BalanceLineAsset' - - $ref: '/balanceSchema.yml#/components/schemas/BalanceLineLiquidityPool' + - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineNative' + - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineAsset' + - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineLiquidityPool' signers: type: array items: - - $ref: '#/components/schemas/signers' + $ref: '#/components/schemas/signers' data: type: object num_sponsoring: @@ -45,7 +45,7 @@ components: num_sponsered: type: integer sponser: - - $ref: '#/components/schemas/address' + $ref: '../instance_variables.yml#/components/schemas/address' paging_token: type: string required: diff --git a/openapi/components/schemas/balanceSchema.yml b/openapi/components/schemas/balanceSchema.yml index aefed1db6..a5de33d73 100644 --- a/openapi/components/schemas/balanceSchema.yml +++ b/openapi/components/schemas/balanceSchema.yml @@ -113,7 +113,7 @@ components: - is_clawback_enabled currency: type: string - pattern: '[0-9]+\\.[0-9]{7}' + pattern: '[0-9]+\.[0-9]{7}' address: type: string pattern: "G[A-Z0-9]{55}" diff --git a/redocly.yaml b/redocly.yaml new file mode 100644 index 000000000..feea299f1 --- /dev/null +++ b/redocly.yaml @@ -0,0 +1,29 @@ +# See https://redocly.com/docs/cli/configuration/ + +apis: + # Update the apiName with your actual API name, and the version with your actual API version. + Horizon@0.0.1: + # Update the path to your OpenAPI root file + root: ./openapi/main.yaml + +lint: + extends: + - recommended + rules: + tag-description: off + operation-summary: error + no-unresolved-refs: error + no-unused-components: error + operation-2xx-response: error + operation-operationId: error + operation-singular-tag: error + no-enum-type-mismatch: error + no-identical-paths: error + no-ambiguous-paths: error + +features.openapi: + generateCodeSamples: + languages: + - lang: curl + - lang: Node.js + - lang: Python \ No newline at end of file From e64a46174f6c47439f9d079ad3fd0080cec40334 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Mon, 19 Sep 2022 17:03:41 -0400 Subject: [PATCH 07/11] Documenting Account Responses #2 --- openapi/components/endpoints/account.yml | 27 +++++++++-- .../components/schemas/accountLinkSchema.yml | 46 +++++++++++-------- openapi/components/schemas/linksSchema.yml | 18 ++++++++ .../schemas/transactionLinkSchema.yml | 31 +++++++++++++ openapi/main.yml | 26 +++++------ redocly.yaml | 1 + 6 files changed, 113 insertions(+), 36 deletions(-) create mode 100644 openapi/components/schemas/linksSchema.yml create mode 100644 openapi/components/schemas/transactionLinkSchema.yml diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/account.yml index 8aa6207e3..18964dd09 100644 --- a/openapi/components/endpoints/account.yml +++ b/openapi/components/endpoints/account.yml @@ -1,10 +1,15 @@ +# Notes: +# September 19: +# - investigate Hal Links +# - consult for response descriptions +# - skipping operations endpoint for now paths: /accounts: get: tags: - account summary: List all Accounts - description: "This endpoint lists accounts by one of three filters : signer, asset, or sponsor." + description: "This endpoint lists accounts by one of four filters : signer, asset, liquidity pool or sponsor." operationId: ListAllAccounts parameters: - $ref: '../parameters.yml#/components/parameters/SponserParam' @@ -16,7 +21,14 @@ paths: - $ref: '../parameters.yml#/components/parameters/LimitParam' responses: '200': - description: OK + description: "Returns accounts based on provided filter: signer , asset, sponser or liquidity pool" + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/accountLinkSchema.yml#/components/schemas/AccountLink" + - $ref: "../schemas/accountSchema.yml#/components/schemas/Account" /accounts/{account_id}: get: tags: @@ -51,7 +63,16 @@ paths: - $ref: '../parameters.yml#/components/parameters/IncludeFailedParam' responses: '200': - description: OK + description: blank + content: + application/json: + schema: + allOf: + #TODO: 9/20 Compare results to Postman results, edit object as necessary + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/transactionLinkSchema.yml#/components/schemas/TransactionLink" + - $ref: "../schemas/transactionSchema.yml#/components/schemas/Transaction" + /accounts/{account_id}/operations: get: tags: diff --git a/openapi/components/schemas/accountLinkSchema.yml b/openapi/components/schemas/accountLinkSchema.yml index 876fff2c8..25e65e319 100644 --- a/openapi/components/schemas/accountLinkSchema.yml +++ b/openapi/components/schemas/accountLinkSchema.yml @@ -3,25 +3,33 @@ components: AccountLink: type: object properties: - _links: - type: object - properties: - self: - $ref: '../instance_variables.yml#/components/schemas/link' - transactions: - $ref: '../instance_variables.yml#/components/schemas/link' - operations: - $ref: '../instance_variables.yml#/components/schemas/link' - payments: - $ref: '../instance_variables.yml#/components/schemas/link' - effects: - $ref: '../instance_variables.yml#/components/schemas/link' - offers: - $ref: '../instance_variables.yml#/components/schemas/link' - trades: - $ref: '../instance_variables.yml#/components/schemas/link' - data: - $ref: '../instance_variables.yml#/components/schemas/link' + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + transactions: + $ref: '../instance_variables.yml#/components/schemas/link' + operations: + $ref: '../instance_variables.yml#/components/schemas/link' + payments: + $ref: '../instance_variables.yml#/components/schemas/link' + effects: + $ref: '../instance_variables.yml#/components/schemas/link' + offers: + $ref: '../instance_variables.yml#/components/schemas/link' + trades: + $ref: '../instance_variables.yml#/components/schemas/link' + data: + $ref: '../instance_variables.yml#/components/schemas/link' required: - self - transactions diff --git a/openapi/components/schemas/linksSchema.yml b/openapi/components/schemas/linksSchema.yml new file mode 100644 index 000000000..8da427883 --- /dev/null +++ b/openapi/components/schemas/linksSchema.yml @@ -0,0 +1,18 @@ +components: + schemas: + Links: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + next: + $ref: '../instance_variables.yml#/components/schemas/link' + prev: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - next + - prev \ No newline at end of file diff --git a/openapi/components/schemas/transactionLinkSchema.yml b/openapi/components/schemas/transactionLinkSchema.yml new file mode 100644 index 000000000..003c5438c --- /dev/null +++ b/openapi/components/schemas/transactionLinkSchema.yml @@ -0,0 +1,31 @@ +# Sept 19: I have not determined how the links schema works in OpenApo +# yet, therefore I am not sure the links will stay in this format. +components: + schemas: + TransactionLink: + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + account: + $ref: '../instance_variables.yml#/components/schemas/link' + ledger: + $ref: '../instance_variables.yml#/components/schemas/link' + operations: + $ref: '../instance_variables.yml#/components/schemas/link' + effects: + $ref: '../instance_variables.yml#/components/schemas/link' + precedes: + $ref: '../instance_variables.yml#/components/schemas/link' + succeeds: + $ref: '../instance_variables.yml#/components/schemas/link' + transaction: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - account + - ledger + - operations + - effects + - precedes + - succeeds + - transaction diff --git a/openapi/main.yml b/openapi/main.yml index 39c851d1b..dbe26148e 100644 --- a/openapi/main.yml +++ b/openapi/main.yml @@ -4,9 +4,9 @@ info: version: 0.0.1 servers: - - url: https://horizon.stellar.org/ + - url: https://horizon.stellar.org description: The main network - - url: https://horizon-testnet.stellar.org/ + - url: https://horizon-testnet.stellar.org description: The test network tags: - name: account @@ -16,23 +16,21 @@ tags: paths: /accounts: - $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts' + $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts' /accounts/{account_id}: - $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}' + $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}' /accounts/{account_id}/transactions: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1transactions' + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1transactions' /accounts/{account_id}/operations: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1operations' + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1operations' /accounts/{account_id}/payments: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1payments' + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1payments' /accounts/{account_id}/effects: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1effects' + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1effects' /accounts/{account_id}/offers: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1offers' + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1offers' /accounts/{account_id}/trades: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1trades' + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1trades' /accounts/{account_id}/data/{key}: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1data~1{key}' - - - + $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1data~1{key}' + \ No newline at end of file diff --git a/redocly.yaml b/redocly.yaml index feea299f1..052d5f585 100644 --- a/redocly.yaml +++ b/redocly.yaml @@ -20,6 +20,7 @@ lint: no-enum-type-mismatch: error no-identical-paths: error no-ambiguous-paths: error + security-defined: off features.openapi: generateCodeSamples: From c0760aa28e9778ac34ecaaf41b4c9e761e5b5fa3 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Wed, 21 Sep 2022 18:32:32 -0400 Subject: [PATCH 08/11] Learned how to bundle api --- openapi/_build/main.yml | 72 -- openapi/bundled.yml | 821 ++++++++++++++++++ openapi/components/endpoints/account.yml | 13 +- openapi/components/instance_variables.yml | 3 +- .../components/schemas/accountLinkSchema.yml | 1 + openapi/components/schemas/accountSchema.yml | 157 ++-- openapi/components/schemas/paymentSchema.yml | 84 ++ .../components/schemas/transactionSchema.yml | 154 ++-- 8 files changed, 1110 insertions(+), 195 deletions(-) delete mode 100644 openapi/_build/main.yml create mode 100644 openapi/bundled.yml create mode 100644 openapi/components/schemas/paymentSchema.yml diff --git a/openapi/_build/main.yml b/openapi/_build/main.yml deleted file mode 100644 index 1b88c5c28..000000000 --- a/openapi/_build/main.yml +++ /dev/null @@ -1,72 +0,0 @@ -openapi: 3.0.3 -info: - title: Horizon - version: 0.0.1 -tags: - - name: account - description: 'Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions.' - - name: assets - description: 'Assets are representations of value issued on the Stellar network. An asset consists of a type, code, and issuer.' -paths: - '/accounts/{account_id}': - get: - tags: - - account - summary: Retrieve an Account - description: 'The single account endpoint provides information on a specific account. The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet.' - operationId: RetrieveAnAccount - parameters: - - name: account_id - in: path - required: true - description: This account’s public key encoded in a base32 string representation. - schema: - type: string - example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ - responses: - '200': - description: OK - '/accounts/{account_id}/operations': - get: - tags: - - account - summary: Retrieve an Account's Operations - description: 'This endpoint represents successful operations for a given account and can be used in streaming mode. Streaming mode allows you to listen for new operations for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time.' - operationId: GetOperationsByAccountid - parameters: - - $ref: '#/paths/~1accounts~1%7Baccount_id%7D/get/parameters/0' - - name: cursor - in: query - required: false - description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. - schema: - type: integer - example: 6606617478959105 - - name: order - in: query - required: false - description: 'A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc.' - schema: - type: integer - enum: - - asc - - desc - - name: limit - in: query - required: false - description: 'The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.' - schema: - type: integer - example: 10 - - name: includefailed - in: query - required: false - description: Set to true to include failed operations in results. Options include true and false. - schema: - type: boolean - enum: - - true - - false - responses: - '200': - description: OK diff --git a/openapi/bundled.yml b/openapi/bundled.yml new file mode 100644 index 000000000..5dd5f9990 --- /dev/null +++ b/openapi/bundled.yml @@ -0,0 +1,821 @@ +openapi: 3.0.3 +info: + title: Horizon + version: 0.0.1 +servers: + - url: https://horizon.stellar.org + description: The main network + - url: https://horizon-testnet.stellar.org + description: The test network +tags: + - name: account + description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. + - name: assets + description: Assets are representations of value issued on the Stellar network. An asset consists of a type, code, and issuer. +paths: + /accounts: + get: + tags: + - account + summary: List all Accounts + description: 'This endpoint lists accounts by one of four filters : signer, asset, liquidity pool or sponsor.' + operationId: ListAllAccounts + parameters: + - $ref: '#/components/parameters/SponserParam' + - $ref: '#/components/parameters/AssetParam' + - $ref: '#/components/parameters/SignerParam' + - $ref: '#/components/parameters/LiquidityPoolParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + responses: + '200': + description: 'Returns accounts based on provided filter: signer , asset, sponser or liquidity pool' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Account' + /accounts/{account_id}: + get: + tags: + - account + summary: Retrieve an Account + description: The single account endpoint provides information on a specific account. The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet. + operationId: RetrieveAnAccount + parameters: + - $ref: '#/components/parameters/AccountIDParam' + responses: + '200': + description: Returns details like balances, sponserships etc. about an account. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/AccountLink' + - $ref: '#/components/schemas/Account' + /accounts/{account_id}/transactions: + get: + tags: + - account + summary: Retrieve an Account's Transactions + description: This endpoint represents successful transactions for a given account and can be used in streaming mode. Streaming mode allows you to listen for new transactions for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known transaction unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream transactions created since your request time. + operationId: GetTransactionsByAccountid + parameters: + - $ref: '#/components/parameters/AccountIDParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + - $ref: '#/components/parameters/IncludeFailedParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Transaction' + /accounts/{account_id}/operations: + get: + tags: + - account + summary: Retrieve an Account's Operations + description: This endpoint represents successful operations for a given account and can be used in streaming mode. Streaming mode allows you to listen for new operations for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time. + operationId: GetOperationsByAccountid + parameters: + - $ref: '#/components/parameters/AccountIDParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + - $ref: '#/components/parameters/IncludeFailedParam' + - $ref: '#/components/parameters/JoinParam' + responses: + '200': + description: OK + /accounts/{account_id}/payments: + get: + tags: + - account + summary: Retrieve an Account's Payments + description: This endpoint represents successful payments for a given account and can be used in streaming mode. Streaming mode allows you to listen for new payments for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known payment unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream payments created since your request time. + operationId: GetPaymentsbyAccountid + parameters: + - $ref: '#/components/parameters/AccountIDParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + - $ref: '#/components/parameters/IncludeFailedParam' + - $ref: '#/components/parameters/JoinParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Payment' + /accounts/{account_id}/effects: + get: + tags: + - account + summary: Retrieve an Account's Effects + description: This endpoint returns the effects of a specific account and can be used in streaming mode. Streaming mode allows you to listen for new effects for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known effect unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream effects created since your request time. + operationId: GetEffectsbyAccountid + parameters: + - $ref: '#/components/parameters/AccountIDParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + responses: + '200': + description: OK + /accounts/{account_id}/offers: + get: + tags: + - account + summary: Retrieve an Account's Offers + description: This endpoint represents all offers a given account has currently open and can be used in streaming mode. Streaming mode allows you to listen for new offers for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known offer unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream offers created since your request time. + operationId: GetOffersbyAccountid + parameters: + - $ref: '#/components/parameters/AccountIDParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + responses: + '200': + description: OK + /accounts/{account_id}/trades: + get: + tags: + - account + summary: Retrieve an Account's Trades + description: This endpoint represents all trades for a given account and can be used in streaming mode. Streaming mode allows you to listen for trades for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. + operationId: GetTradesbyAccountid + parameters: + - $ref: '#/components/parameters/AccountIDParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + responses: + '200': + description: OK + /accounts/{account_id}/data/{key}: + get: + tags: + - account + summary: Retrieve an Account's Data + description: This endpoint represents a single data for a given account. + operationId: GetDatabyAccountid + parameters: + - $ref: '#/components/parameters/AccountIDParam' + - $ref: '#/components/parameters/DataParam' + responses: + '200': + description: OK +components: + parameters: + SponserParam: + name: sponser + in: query + required: false + description: Account ID of the sponsor. Every account in the response will either be sponsored by the given account ID or have a subentry (trustline, offer, or data entry) which is sponsored by the given account ID. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + AssetParam: + name: asset + in: query + required: false + description: An issued asset represented as “Code:IssuerAccountID”. Every account in the response will have a trustline for the given asset. + SignerParam: + name: signer + in: query + required: false + description: Account ID of the signer. Every account in the response will have the given account ID as a signer. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + LiquidityPoolParam: + name: liqudity_pool + in: query + required: false + description: With this parameter, the results will include only accounts which have trustlines to the specified liquidity pool. + CursorParam: + name: cursor + in: query + required: false + description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. + schema: + type: integer + example: 6606617478959105 + OrderParam: + name: order + in: query + required: false + description: A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc. + schema: + type: string + enum: + - asc + - desc + LimitParam: + name: limit + in: query + required: false + description: The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10. + schema: + type: integer + example: 10 + AccountIDParam: + name: account_id + in: path + required: true + description: This account’s public key encoded in a base32 string representation. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + IncludeFailedParam: + name: includefailed + in: query + required: false + description: Set to true to include failed operations in results. Options include true and false. + schema: + type: boolean + enum: + - true + - false + JoinParam: + name: join + in: query + required: false + description: Set to transactions to include the transactions which created each of the operations in the response. + DataParam: + name: key + in: path + required: true + description: The key name for this data. + schema: + type: string + example: config.memo_required + schemas: + link: + type: object + properties: + href: + type: string + format: link + templated: + type: boolean + required: + - href + Links: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '#/components/schemas/link' + next: + $ref: '#/components/schemas/link' + prev: + $ref: '#/components/schemas/link' + id: + type: string + address: + type: string + pattern: G[A-Z0-9]{55} + sequence: + type: string + pattern: '[0-9]+' + sequence_ledger: + type: integer + format: uint32 + subentry_count: + type: integer + format: int32 + last_modified_ledger: + type: integer + format: uint32 + thresholds: + type: object + properties: + low_threshold: + type: integer + med_threshold: + type: integer + high_threshold: + type: integer + flags: + type: object + properties: + auth_required: + type: boolean + auth_revocable: + type: boolean + auth_immutable: + type: boolean + auth_clawback_enabled: + type: boolean + currency: + type: string + pattern: '[0-9]+\.[0-9]{7}' + BalanceLineNative: + type: object + properties: + balance: + $ref: '#/components/schemas/currency' + liquidity_pool_id: + type: string + limit: + $ref: '#/components/schemas/currency' + buying_liabilites: + $ref: '#/components/schemas/currency' + selling_liabilites: + $ref: '#/components/schemas/currency' + sponser: + type: string + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + is_authorized: + type: boolean + is_authorized_to_maintain_liabilites: + type: boolean + is_clawback_enabled: + type: boolean + asset_type: + type: string + enum: + - native + required: + - balance + - limit + - asset_type + - buying_liabilites + - selling_liabilites + - last_modified_ledger + - is_authorized + - is_authorized_to_maintain_liabilites + - is_clawback_enabled + BalanceLineAsset: + type: object + properties: + balance: + $ref: '#/components/schemas/currency' + limit: + $ref: '#/components/schemas/currency' + buying_liabilites: + $ref: '#/components/schemas/currency' + selling_liabilites: + $ref: '#/components/schemas/currency' + sponser: + $ref: '#/components/schemas/address' + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + is_authorized: + type: boolean + is_authorized_to_maintain_liabilites: + type: boolean + is_clawback_enabled: + type: boolean + asset_type: + type: string + enum: + - credit_alphanum4 + - credit_alphanum12 + asset_code: + type: string + asset_issuer: + $ref: '#/components/schemas/address' + required: + - balance + - limit + - asset_type + - asset_code + - asset_issuer + - buying_liabilites + - selling_liabilites + - last_modified_ledger + - is_authorized + - is_authorized_to_maintain_liabilites + - is_clawback_enabled + BalanceLineLiquidityPool: + type: object + properties: + liquidity_pool_id: + type: string + asset_type: + type: string + enum: + - liquidity_pool_shares + balance: + $ref: '#/components/schemas/currency' + limit: + $ref: '#/components/schemas/currency' + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + sponser: + $ref: '#/components/schemas/address' + is_authorized: + type: boolean + is_authorized_to_maintain_liabilites: + type: boolean + is_clawback_enabled: + type: boolean + required: + - liquidity_pool_id + - balance + - limit + - asset_type + - last_modified_ledger + - is_authorized + - is_authorized_to_maintain_liabilites + - is_clawback_enabled + signers: + type: object + properties: + key: + $ref: '#/components/schemas/address' + weight: + type: integer + format: int32 + type: + type: string + enum: + - ed25519_public_key + - sha256_hash + - preauth_tx + sponser: + $ref: '#/components/schemas/address' + required: + - key + - weight + - type + Account: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '#/components/schemas/link' + transactions: + $ref: '#/components/schemas/link' + operations: + $ref: '#/components/schemas/link' + payments: + $ref: '#/components/schemas/link' + effects: + $ref: '#/components/schemas/link' + offers: + $ref: '#/components/schemas/link' + trades: + $ref: '#/components/schemas/link' + data: + $ref: '#/components/schemas/link' + required: + - self + - transactions + - operations + - payments + - effects + - offers + - trades + - data + id: + $ref: '#/components/schemas/id' + account_id: + $ref: '#/components/schemas/address' + sequence: + $ref: '#/components/schemas/sequence' + sequence_ledger: + $ref: '#/components/schemas/sequence_ledger' + sequence_time: + type: string + subentry_count: + $ref: '#/components/schemas/subentry_count' + inflation_destination: + $ref: '#/components/schemas/address' + home_domain: + type: string + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + last_modified_time: + type: string + thresholds: + $ref: '#/components/schemas/thresholds' + flags: + $ref: '#/components/schemas/flags' + balances: + type: array + items: + anyOf: + - $ref: '#/components/schemas/BalanceLineNative' + - $ref: '#/components/schemas/BalanceLineAsset' + - $ref: '#/components/schemas/BalanceLineLiquidityPool' + signers: + type: array + items: + $ref: '#/components/schemas/signers' + data: + type: object + num_sponsoring: + type: integer + num_sponsered: + type: integer + sponser: + $ref: '#/components/schemas/address' + paging_token: + type: string + required: + - id + - account_id + - sequence + - subentry_count + - last_modified_ledger + - last_modified_time + - thresholds + - flags + - balances + - signers + - data + - num_sponsoring + - num_sponsered + - paging_token + AccountLink: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: ../instance_variables.yml#/components/schemas/link + transactions: + $ref: ../instance_variables.yml#/components/schemas/link + operations: + $ref: ../instance_variables.yml#/components/schemas/link + payments: + $ref: ../instance_variables.yml#/components/schemas/link + effects: + $ref: ../instance_variables.yml#/components/schemas/link + offers: + $ref: ../instance_variables.yml#/components/schemas/link + trades: + $ref: ../instance_variables.yml#/components/schemas/link + data: + $ref: ../instance_variables.yml#/components/schemas/link + $ref: '#/components/schemas/Account' + required: + - self + - transactions + - operations + - payments + - effects + - offers + - trades + - data + signatures: + type: array + items: + type: string + pattern: G[A-Z0-9]{55} + TransactionPreconditionsTimebounds: + type: object + properties: + min_time: + type: string + max_time: + type: string + TransactionPreconditionsLedgerbounds: + type: object + properties: + min_ledger: + type: string + max_ledger: + type: string + TransactionPreconditions: + type: object + properties: + timebounds: + $ref: '#/components/schemas/TransactionPreconditionsTimebounds' + ledgerbounds: + $ref: '#/components/schemas/TransactionPreconditionsLedgerbounds' + min_account_sequence: + type: string + min_account_sequence_age: + type: string + min_account_sequence_ledger_gap: + type: uint32 + extra_signers: + type: array + items: + type: string + hash: + type: string + FeeBumpTransaction: + type: object + properties: + hash: + $ref: '#/components/schemas/hash' + signatures: + $ref: '#/components/schemas/signatures' + InnerTransaction: + type: object + properties: + hash: + $ref: '#/components/schemas/hash' + signatures: + $ref: '#/components/schemas/signatures' + max_fee: + type: string + Transaction: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + memo: + type: string + memo_bytes: + type: string + _links: + type: object + properties: + self: + $ref: '#/components/schemas/link' + account: + $ref: '#/components/schemas/link' + ledger: + $ref: '#/components/schemas/link' + operations: + $ref: '#/components/schemas/link' + effects: + $ref: '#/components/schemas/link' + precedes: + $ref: '#/components/schemas/link' + succeeds: + $ref: '#/components/schemas/link' + transaction: + $ref: '#/components/schemas/link' + required: + - self + - account + - ledger + - operations + - effects + - precedes + - succeeds + - transaction + id: + $ref: '#/components/schemas/id' + paging_token: + type: string + successful: + type: boolean + hash: + type: string + ledger: + type: int32 + created_at: + type: string + source_account: + $ref: '#/components/schemas/address' + account_muxed: + type: string + account_muxed_id: + type: string + source_account_sequence: + type: string + fee_account: + $ref: '#/components/schemas/address' + fee_account_muxed: + $ref: '#/components/schemas/address' + fee_account_muxed_id: + type: string + fee_charged: + type: string + max_fee: + type: string + operation_count: + type: int32 + envelope_xdr: + type: string + result_xdr: + type: string + result_meta_xdr: + type: string + fee_meta_xdr: + type: string + memo_type: + type: string + signatures: + $ref: '#/components/schemas/signatures' + valid_after: + type: string + valid_before: + type: string + preconditions: + $ref: '#/components/schemas/TransactionPreconditions' + fee_bump_transaction: + $ref: '#/components/schemas/FeeBumpTransaction' + inner_transaction: + $ref: '#/components/schemas/InnerTransaction' + Payment: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '#/components/schemas/link' + transaction: + $ref: '#/components/schemas/link' + effects: + $ref: '#/components/schemas/link' + succeeds: + $ref: '#/components/schemas/link' + precedes: + $ref: '#/components/schemas/link' + required: + - self + - transaction + - effects + - succeeds + - precedes + id: + $ref: '#/components/schemas/id' + paging_token: + type: string + transaction_successful: + type: boolean + source_account: + $ref: '#/components/schemas/address' + type: + type: string + example: payment + type_i: + type: string + created_at: + type: string + transaction_hash: + type: string + asset_type: + type: string + asset_code: + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + asset_issuer: + $ref: '#/components/schemas/address' + from: + $ref: '#/components/schemas/address' + to: + $ref: '#/components/schemas/address' + amount: + type: string + required: + - id + - paging_token + - transaction_successful + - source_account + - type + - type_i + - created_at + - transaction_hash + - asset_type + - from + - to + - amount diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/account.yml index 18964dd09..9ab280f17 100644 --- a/openapi/components/endpoints/account.yml +++ b/openapi/components/endpoints/account.yml @@ -27,7 +27,6 @@ paths: schema: allOf: - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" - - $ref: "../schemas/accountLinkSchema.yml#/components/schemas/AccountLink" - $ref: "../schemas/accountSchema.yml#/components/schemas/Account" /accounts/{account_id}: get: @@ -68,11 +67,10 @@ paths: application/json: schema: allOf: - #TODO: 9/20 Compare results to Postman results, edit object as necessary - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" - - $ref: "../schemas/transactionLinkSchema.yml#/components/schemas/TransactionLink" - $ref: "../schemas/transactionSchema.yml#/components/schemas/Transaction" + #TODO: 9/22 Investigate Operations object /accounts/{account_id}/operations: get: tags: @@ -106,7 +104,14 @@ paths: - $ref: '../parameters.yml#/components/parameters/JoinParam' responses: '200': - description: OK + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/paymentSchema.yml#/components/schemas/Payment" + /accounts/{account_id}/effects: get: tags: diff --git a/openapi/components/instance_variables.yml b/openapi/components/instance_variables.yml index 1aac411d4..297ba8a5a 100644 --- a/openapi/components/instance_variables.yml +++ b/openapi/components/instance_variables.yml @@ -42,7 +42,8 @@ components: signatures: type: array items: - type: string + type: string + pattern: "G[A-Z0-9]{55}" link: type: object properties: diff --git a/openapi/components/schemas/accountLinkSchema.yml b/openapi/components/schemas/accountLinkSchema.yml index 25e65e319..bd9580ea2 100644 --- a/openapi/components/schemas/accountLinkSchema.yml +++ b/openapi/components/schemas/accountLinkSchema.yml @@ -30,6 +30,7 @@ components: $ref: '../instance_variables.yml#/components/schemas/link' data: $ref: '../instance_variables.yml#/components/schemas/link' + $ref: '../schemas/accountSchema.yml#/components/schemas/Account' required: - self - transactions diff --git a/openapi/components/schemas/accountSchema.yml b/openapi/components/schemas/accountSchema.yml index 0e4a24231..9fa09b172 100644 --- a/openapi/components/schemas/accountSchema.yml +++ b/openapi/components/schemas/accountSchema.yml @@ -2,67 +2,104 @@ components: schemas: Account: type: object - properties: - id: - $ref: '../instance_variables.yml#/components/schemas/id' - account_id: - $ref: '../instance_variables.yml#/components/schemas/address' - sequence: - $ref: '../instance_variables.yml#/components/schemas/sequence' - sequence_ledger: - $ref: '../instance_variables.yml#/components/schemas/sequence_ledger' - sequence_time: - type: string - subentry_count: - $ref: '../instance_variables.yml#/components/schemas/subentry_count' - inflation_destination: - $ref: '../instance_variables.yml#/components/schemas/address' - home_domain: - type: string - last_modified_ledger: - $ref: '../instance_variables.yml#/components/schemas/last_modified_ledger' - last_modified_time: - type: string - thresholds: - $ref: '../instance_variables.yml#/components/schemas/thresholds' - flags: - $ref: '../instance_variables.yml#/components/schemas/flags' - balances: - type: array - items: - anyOf: - - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineNative' - - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineAsset' - - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineLiquidityPool' - signers: - type: array - items: - $ref: '#/components/schemas/signers' - data: + properties: + _embedded: type: object - num_sponsoring: - type: integer - num_sponsered: - type: integer - sponser: - $ref: '../instance_variables.yml#/components/schemas/address' - paging_token: - type: string - required: - - id - - account_id - - sequence - - subentry_count - - last_modified_ledger - - last_modified_time - - thresholds - - flags - - balances - - signers - - data - - num_sponsoring - - num_sponsered - - paging_token + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + transactions: + $ref: '../instance_variables.yml#/components/schemas/link' + operations: + $ref: '../instance_variables.yml#/components/schemas/link' + payments: + $ref: '../instance_variables.yml#/components/schemas/link' + effects: + $ref: '../instance_variables.yml#/components/schemas/link' + offers: + $ref: '../instance_variables.yml#/components/schemas/link' + trades: + $ref: '../instance_variables.yml#/components/schemas/link' + data: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - transactions + - operations + - payments + - effects + - offers + - trades + - data + id: + $ref: '../instance_variables.yml#/components/schemas/id' + account_id: + $ref: '../instance_variables.yml#/components/schemas/address' + sequence: + $ref: '../instance_variables.yml#/components/schemas/sequence' + sequence_ledger: + $ref: '../instance_variables.yml#/components/schemas/sequence_ledger' + sequence_time: + type: string + subentry_count: + $ref: '../instance_variables.yml#/components/schemas/subentry_count' + inflation_destination: + $ref: '../instance_variables.yml#/components/schemas/address' + home_domain: + type: string + last_modified_ledger: + $ref: '../instance_variables.yml#/components/schemas/last_modified_ledger' + last_modified_time: + type: string + thresholds: + $ref: '../instance_variables.yml#/components/schemas/thresholds' + flags: + $ref: '../instance_variables.yml#/components/schemas/flags' + balances: + type: array + items: + anyOf: + - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineNative' + - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineAsset' + - $ref: '../schemas/balanceSchema.yml#/components/schemas/BalanceLineLiquidityPool' + signers: + type: array + items: + $ref: '#/components/schemas/signers' + data: + type: object + num_sponsoring: + type: integer + num_sponsered: + type: integer + sponser: + $ref: '../instance_variables.yml#/components/schemas/address' + paging_token: + type: string + required: + - id + - account_id + - sequence + - subentry_count + - last_modified_ledger + - last_modified_time + - thresholds + - flags + - balances + - signers + - data + - num_sponsoring + - num_sponsered + - paging_token + signers: type: object properties: diff --git a/openapi/components/schemas/paymentSchema.yml b/openapi/components/schemas/paymentSchema.yml new file mode 100644 index 000000000..dc1919270 --- /dev/null +++ b/openapi/components/schemas/paymentSchema.yml @@ -0,0 +1,84 @@ +# TODO: Review Todo's written in here +# - 3 operations: Create account, account merge, payment +# - Determine if this needs seperate examples for the three operations +components: + schemas: + Payment: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + transaction: + $ref: '../instance_variables.yml#/components/schemas/link' + effects: + $ref: '../instance_variables.yml#/components/schemas/link' + succeeds: + $ref: '../instance_variables.yml#/components/schemas/link' + precedes: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - transaction + - effects + - succeeds + - precedes + id: + $ref: '../instance_variables.yml#/components/schemas/id' + paging_token: + type: string + transaction_successful: + type: boolean + source_account: + $ref: '../instance_variables.yml#/components/schemas/address' + type: + type: string + example: payment + #TODO: 9/22 What is this? + type_i: + type: string + created_at: + type: string + #TODO: Ask if the transaction hashs have a pattern + transaction_hash: + type: string + # Ask about enum for asset type + asset_type: + type: string + asset_code: + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + asset_issuer: + $ref: '../instance_variables.yml#/components/schemas/address' + #TODO: What is the data type for starting balance? + from: + $ref: '../instance_variables.yml#/components/schemas/address' + to: + $ref: '../instance_variables.yml#/components/schemas/address' + amount: + type: string + required: + - id + - paging_token + - transaction_successful + - source_account + - type + - type_i + - created_at + - transaction_hash + - asset_type + - from + - to + - amount \ No newline at end of file diff --git a/openapi/components/schemas/transactionSchema.yml b/openapi/components/schemas/transactionSchema.yml index a009b6329..f03f09a6a 100644 --- a/openapi/components/schemas/transactionSchema.yml +++ b/openapi/components/schemas/transactionSchema.yml @@ -3,64 +3,102 @@ components: Transaction: type: object properties: - id: - $ref: '../instance_variables.yml#/components/schemas/address' - paging_token: - type: string - successful: - type: boolean - hash: - type: string - ledger: - type: int32 - created_at: - type: string - source_account: - $ref: '../instance_variables.yml#/components/schemas/address' - account_muxed: - type: string - account_muxed_id: - asset_type: string - source_account_sequence: - type: string - fee_account: - $ref: '../instance_variables.yml#/components/schemas/address' - fee_account_muxed: - $ref: '../instance_variables.yml#/components/schemas/address' - fee_account_muxed_id: - type: string - fee_charged: - type: string - max_fee: - type: string - operation_count: - type: int32 - envelope_xdr: - type: string - result_xdr: - type: string - result_meta_xdr: - type: string - fee_meta_xdr: - type: string - memo_type: - type: string - memo_bytes: - type: string - memo: - type: string - signatures: - $ref: '../instance_variables.yml#/components/schemas/signatures' - valid_after: - type: string - valid_before: - type: string - preconditions: - $ref: '#/components/schemas/TransactionPreconditions' - fee_bump_transaction: - $ref: '#/components/schemas/FeeBumpTransaction' - inner_transaction: - $ref: '#/components/schemas/InnerTransaction' + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + memo: + type: string + memo_bytes: + type: string + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + account: + $ref: '../instance_variables.yml#/components/schemas/link' + ledger: + $ref: '../instance_variables.yml#/components/schemas/link' + operations: + $ref: '../instance_variables.yml#/components/schemas/link' + effects: + $ref: '../instance_variables.yml#/components/schemas/link' + precedes: + $ref: '../instance_variables.yml#/components/schemas/link' + succeeds: + $ref: '../instance_variables.yml#/components/schemas/link' + transaction: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - account + - ledger + - operations + - effects + - precedes + - succeeds + - transaction + + id: + $ref: '../instance_variables.yml#/components/schemas/id' + paging_token: + type: string + successful: + type: boolean + hash: + type: string + ledger: + type: int32 + created_at: + type: string + source_account: + $ref: '../instance_variables.yml#/components/schemas/address' + account_muxed: + type: string + # Todo: Fix issue + account_muxed_id: + type: string + source_account_sequence: + type: string + fee_account: + $ref: '../instance_variables.yml#/components/schemas/address' + fee_account_muxed: + $ref: '../instance_variables.yml#/components/schemas/address' + fee_account_muxed_id: + type: string + fee_charged: + type: string + max_fee: + type: string + operation_count: + type: int32 + envelope_xdr: + type: string + result_xdr: + type: string + result_meta_xdr: + type: string + fee_meta_xdr: + type: string + memo_type: + type: string + signatures: + $ref: '../instance_variables.yml#/components/schemas/signatures' + valid_after: + type: string + valid_before: + type: string + preconditions: + $ref: '#/components/schemas/TransactionPreconditions' + fee_bump_transaction: + $ref: '#/components/schemas/FeeBumpTransaction' + inner_transaction: + $ref: '#/components/schemas/InnerTransaction' TransactionPreconditionsTimebounds: type: object From b52bbeb909bac404e0fd28b4fee5f7fb4b6bce52 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Thu, 22 Sep 2022 17:40:10 -0400 Subject: [PATCH 09/11] Trades & Offers --- .../endpoints/{account.yml => accounts.yml} | 59 ++++-- openapi/components/endpoints/offers.yml | 58 ++++++ openapi/components/endpoints/trades.yml | 32 +++ openapi/components/instance_variables.yml | 4 +- openapi/components/parameters.yml | 190 +++++++++++++++--- openapi/components/schemas/assetSchema.yml | 22 ++ openapi/components/schemas/offerSchema.yml | 57 ++++++ openapi/components/schemas/tradeSchema.yml | 93 +++++++++ .../components/schemas/transactionSchema.yml | 10 +- openapi/main.yml | 34 ++-- 10 files changed, 492 insertions(+), 67 deletions(-) rename openapi/components/endpoints/{account.yml => accounts.yml} (87%) create mode 100644 openapi/components/endpoints/offers.yml create mode 100644 openapi/components/endpoints/trades.yml create mode 100644 openapi/components/schemas/assetSchema.yml create mode 100644 openapi/components/schemas/offerSchema.yml create mode 100644 openapi/components/schemas/tradeSchema.yml diff --git a/openapi/components/endpoints/account.yml b/openapi/components/endpoints/accounts.yml similarity index 87% rename from openapi/components/endpoints/account.yml rename to openapi/components/endpoints/accounts.yml index 9ab280f17..01074ecaa 100644 --- a/openapi/components/endpoints/account.yml +++ b/openapi/components/endpoints/accounts.yml @@ -1,18 +1,23 @@ # Notes: -# September 19: +# September 22: # - investigate Hal Links # - consult for response descriptions -# - skipping operations endpoint for now +# - skipping operations endpoint for now +# - skipping payments endpoint for now +# - review number formats & time formats +# - review for omit empty in data structures (9/23 ) +# - clean up string patterns +# - review todos in payments schemas paths: /accounts: get: tags: - - account + - Accounts summary: List all Accounts description: "This endpoint lists accounts by one of four filters : signer, asset, liquidity pool or sponsor." operationId: ListAllAccounts parameters: - - $ref: '../parameters.yml#/components/parameters/SponserParam' + - $ref: '../parameters.yml#/components/parameters/SponsorParam' - $ref: '../parameters.yml#/components/parameters/AssetParam' - $ref: '../parameters.yml#/components/parameters/SignerParam' - $ref: '../parameters.yml#/components/parameters/LiquidityPoolParam' @@ -31,7 +36,7 @@ paths: /accounts/{account_id}: get: tags: - - account + - Accounts summary: Retrieve an Account description: The single account endpoint provides information on a specific account. The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet. @@ -50,7 +55,7 @@ paths: /accounts/{account_id}/transactions: get: tags: - - account + - Accounts summary: Retrieve an Account's Transactions description: "This endpoint represents successful transactions for a given account and can be used in streaming mode. Streaming mode allows you to listen for new transactions for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known transaction unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream transactions created since your request time." operationId: GetTransactionsByAccountid @@ -70,11 +75,11 @@ paths: - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" - $ref: "../schemas/transactionSchema.yml#/components/schemas/Transaction" - #TODO: 9/22 Investigate Operations object + #TODO: 9/23 Investigate Operations object /accounts/{account_id}/operations: get: tags: - - account + - Accounts summary: Retrieve an Account's Operations description: This endpoint represents successful operations for a given account and can be used in streaming mode. Streaming mode allows you to listen for new operations for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time. operationId: GetOperationsByAccountid @@ -91,7 +96,7 @@ paths: /accounts/{account_id}/payments: get: tags: - - account + - Accounts summary: Retrieve an Account's Payments description: "This endpoint represents successful payments for a given account and can be used in streaming mode. Streaming mode allows you to listen for new payments for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known payment unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream payments created since your request time." operationId: GetPaymentsbyAccountid @@ -111,11 +116,10 @@ paths: allOf: - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" - $ref: "../schemas/paymentSchema.yml#/components/schemas/Payment" - /accounts/{account_id}/effects: get: tags: - - account + - Accounts summary: Retrieve an Account's Effects description: This endpoint returns the effects of a specific account and can be used in streaming mode. Streaming mode allows you to listen for new effects for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known effect unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream effects created since your request time. operationId: GetEffectsbyAccountid @@ -130,7 +134,7 @@ paths: /accounts/{account_id}/offers: get: tags: - - account + - Accounts summary: Retrieve an Account's Offers description: This endpoint represents all offers a given account has currently open and can be used in streaming mode. Streaming mode allows you to listen for new offers for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known offer unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream offers created since your request time. operationId: GetOffersbyAccountid @@ -141,11 +145,18 @@ paths: - $ref: '../parameters.yml#/components/parameters/LimitParam' responses: '200': - description: OK + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/offerSchema.yml#/components/schemas/Offer" + /accounts/{account_id}/trades: get: tags: - - account + - Accounts summary: Retrieve an Account's Trades description: This endpoint represents all trades for a given account and can be used in streaming mode. Streaming mode allows you to listen for trades for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. operationId: GetTradesbyAccountid @@ -156,11 +167,18 @@ paths: - $ref: '../parameters.yml#/components/parameters/LimitParam' responses: '200': - description: OK + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/tradeSchema.yml#/components/schemas/Trade" + /accounts/{account_id}/data/{key}: get: tags: - - account + - Accounts summary: Retrieve an Account's Data description: This endpoint represents a single data for a given account. operationId: GetDatabyAccountid @@ -169,4 +187,11 @@ paths: - $ref: '../parameters.yml#/components/parameters/DataParam' responses: '200': - description: OK \ No newline at end of file + description: blank + content: + application/json: + schema: + type: object + properties: + value: + type: string \ No newline at end of file diff --git a/openapi/components/endpoints/offers.yml b/openapi/components/endpoints/offers.yml new file mode 100644 index 000000000..48e184643 --- /dev/null +++ b/openapi/components/endpoints/offers.yml @@ -0,0 +1,58 @@ +paths: + /offers: + get: + tags: + - Offers + summary: List All Offers + description: "This endpoint lists all currently open offers and can be used in streaming mode. Streaming mode allows you to listen for new offers as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known offer unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream offers created since your request time. When filtering by buying or selling arguments, you must use a combination of selling_asset_type, selling_asset_issuer, and selling_asset_code for the selling asset, or a combination of buying_asset_type, buying_asset_issuer, and buying_asset_code for the buying asset." + operationId: GetAllOffers + parameters: + - $ref: '../parameters.yml#/components/parameters/SponsorParam' + - $ref: '../parameters.yml#/components/parameters/SellerParam' + - $ref: '../parameters.yml#/components/parameters/SellingAssetTypeParam' + - $ref: '../parameters.yml#/components/parameters/SellingAssetIssuerParam' + - $ref: '../parameters.yml#/components/parameters/SellingAssetCodeParam' + - $ref: '../parameters.yml#/components/parameters/BuyingAssetTypeParam' + - $ref: '../parameters.yml#/components/parameters/BuyingAssetIssuerParam' + - $ref: '../parameters.yml#/components/parameters/BuyingAssetCodeParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/offerSchema.yml#/components/schemas/Offer" + /offers/{offer_id}: + get: + tags: + - Offers + summary: Retrieve an Offer + description: The single offer endpoint provides information on a specific offer. + operationId: GetOfferbyOfferid + parameters: + - $ref: '../parameters.yml#/components/parameters/OfferIDParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/offerSchema.yml#/components/schemas/Offer" + + + + + + + + + + + diff --git a/openapi/components/endpoints/trades.yml b/openapi/components/endpoints/trades.yml new file mode 100644 index 000000000..d6114b616 --- /dev/null +++ b/openapi/components/endpoints/trades.yml @@ -0,0 +1,32 @@ +paths: + /trades: + get: + tags: + - Trades + summary: List All Trades + description: "This endpoint lists all trades and can be used in streaming mode. Streaming mode allows you to listen for new trades as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. When filtering for a specific orderbook, you must use use all six of these arguments: base_asset_type, base_asset_issuer, base_asset_code, counter_asset_type, counter_asset_issuer, and counter_asset_code. If the base or counter asset is XLM, you only need to indicate the asset type as native and do not need to designate the code or the issuer." + operationId: GetAllTrades + parameters: + - $ref: '../parameters.yml#/components/parameters/OfferIdParam' + - $ref: '../parameters.yml#/components/parameters/BaseAssetTypeParam' + - $ref: '../parameters.yml#/components/parameters/BaseAssetIssuerParam' + - $ref: '../parameters.yml#/components/parameters/BaseAssetCodeParam' + - $ref: '../parameters.yml#/components/parameters/CounterAssetTypeParam' + - $ref: '../parameters.yml#/components/parameters/CounterAssetIssuerParam' + - $ref: '../parameters.yml#/components/parameters/CounterAssetCodeParam' + - $ref: '../parameters.yml#/components/parameters/TradeTypeParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/tradeSchema.yml#/components/schemas/Trade" + + \ No newline at end of file diff --git a/openapi/components/instance_variables.yml b/openapi/components/instance_variables.yml index 297ba8a5a..a80838e3d 100644 --- a/openapi/components/instance_variables.yml +++ b/openapi/components/instance_variables.yml @@ -53,4 +53,6 @@ components: templated: type: boolean required: - ["href"] \ No newline at end of file + ["href"] + paging_token: + type: string \ No newline at end of file diff --git a/openapi/components/parameters.yml b/openapi/components/parameters.yml index 29b100666..51e66b7f3 100644 --- a/openapi/components/parameters.yml +++ b/openapi/components/parameters.yml @@ -1,26 +1,90 @@ components: parameters: + AccountIDParam: + name: account_id + in: path + required: true + description: This account’s public key encoded in a base32 string representation. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ AssetParam: name: asset in: query required: false description: An issued asset represented as “Code:IssuerAccountID”. Every account in the response will have a trustline for the given asset. - SponserParam: - name: sponser + BaseAssetCodeParam: + name: base_asset_code in: query required: false - description: Account ID of the sponsor. Every account in the response will either be sponsored by the given account ID or have a subentry (trustline, offer, or data entry) which is sponsored by the given account ID. + description: The code for the base asset. schema: type: string - example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ - SignerParam: - name: signer + example: USD + BaseAssetIssuerParam: + name: base_asset_issuer in: query required: false - description: Account ID of the signer. Every account in the response will have the given account ID as a signer. + description: The Stellar address of the base asset’s issuer. + schema: + type: string + example: GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX + BaseAssetTypeParam: + name: base_asset_type + in: query + required: false + description: The type for the base asset. Either native, credit_alphanum4, or credit_alphanum12. + schema: + type: string + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + BuyingAssetCodeParam: + name: buying_asset_code + in: query + required: false + description: The code for the buying asset. + BuyingAssetIssuerParam: + name: buying_asset_issuer + in: query + required: false + description: The Stellar address of the buying asset’s issuer. + BuyingAssetTypeParam: + name: buying_asset_type + in: query + required: false + description: The type for the buying asset. Either native, credit_alphanum4, or credit_alphanum12. schema: type: string - example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + CounterAssetCodeParam: + name: counter_asset_code + in: query + required: false + description: The code for the counter asset. + CounterAssetIssuerParam: + name: counter_asset_issuer + in: query + required: false + description: The Stellar address of the counter asset’s issuer. + schema: + type: string + example: GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX + CounterAssetTypeParam: + name: counter_asset_type + in: query + required: false + description: The type for the counter asset. Either native, credit_alphanum4, or credit_alphanum12. + schema: + type: string + enum: + - native + - credit_alphanum4 + - credit_alphanum12 CursorParam: name: cursor in: query @@ -29,6 +93,29 @@ components: schema: type: integer example: 6606617478959105 + DataParam: + name: key + in: path + required: true + description: The key name for this data. + schema: + type: string + example: config.memo_required + IncludeFailedParam: + name: includefailed + in: query + required: false + description: Set to true to include failed operations in results. Options include true and false. + schema: + type: boolean + enum: + - true + - false + JoinParam: + name: join + in: query + required: false + description: Set to transactions to include the transactions which created each of the operations in the response. LimitParam: name: limit in: query @@ -37,14 +124,21 @@ components: schema: type: integer example: 10 - AccountIDParam: - name: account_id + LiquidityPoolParam: + name: liqudity_pool + in: query + required: false + description: With this parameter, the results will include only accounts which have trustlines to the specified liquidity pool. + OfferIdParam: + name: offer_id + in: query + required: false + description: The offer ID. Used to filter for trades originating from a specific offer. + OfferIDParam: + name: offer_id in: path required: true - description: This account’s public key encoded in a base32 string representation. - schema: - type: string - example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + description: A unique identifier for this offer. OrderParam: name: order in: query @@ -54,32 +148,62 @@ components: type: string enum: - asc - - desc - IncludeFailedParam: - name: includefailed + - desc + SellerParam: + name: seller in: query required: false - description: Set to true to include failed operations in results. Options include true and false. + description: The account ID of the offer creator. + SellingAssetCodeParam: + name: selling_asset_code + in: query + required: false + description: The code for the selling asset. + SellingAssetIssuerParam: + name: selling_asset_issuer + in: query + required: false + description: The Stellar address of the selling asset’s issuer. + SellingAssetTypeParam: + name: selling_asset_type + in: query + required: false + description: The type for the selling asset. Either native, credit_alphanum4, or credit_alphanum12. schema: - type: boolean + type: string enum: - - true - - false - LiquidityPoolParam: - name: liqudity_pool + - native + - credit_alphanum4 + - credit_alphanum12 + SignerParam: + name: signer in: query required: false - description: With this parameter, the results will include only accounts which have trustlines to the specified liquidity pool. - JoinParam: - name: join + description: Account ID of the signer. Every account in the response will have the given account ID as a signer. + schema: + type: string + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + SponsorParam: + name: sponser in: query required: false - description: Set to transactions to include the transactions which created each of the operations in the response. - DataParam: - name: key - in: path - required: true - description: The key name for this data. + description: Account ID of the sponsor. Every account in the response will either be sponsored by the given account ID or have a subentry (trustline, offer, or data entry) which is sponsored by the given account ID. schema: type: string - example: config.memo_required \ No newline at end of file + example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + TradeTypeParam: + name: trade_type + in: query + required: false + description: Can be set to all, orderbook, or liquidity_pools to filter only trades executed across a given mechanism. + schema: + type: string + enum: + - all + - orderbook + - liquidity_pools + + + + + \ No newline at end of file diff --git a/openapi/components/schemas/assetSchema.yml b/openapi/components/schemas/assetSchema.yml new file mode 100644 index 000000000..770ba5a05 --- /dev/null +++ b/openapi/components/schemas/assetSchema.yml @@ -0,0 +1,22 @@ +components: + schemas: + Asset: + type: object + properties: + asset_type: + type: string + asset_code: + type: string + asset_issuer: + type: string + required: + - asset_type + Price: + type: object + properties: + n: + type: integer + format: int32 + d: + type: integer + format: int32 \ No newline at end of file diff --git a/openapi/components/schemas/offerSchema.yml b/openapi/components/schemas/offerSchema.yml new file mode 100644 index 000000000..b9176635b --- /dev/null +++ b/openapi/components/schemas/offerSchema.yml @@ -0,0 +1,57 @@ +components: + schemas: + Offer: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + offer_maker: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - offer_maker + id: + $ref: '../instance_variables.yml#/components/schemas/id' + paging_token: + type: string + seller: + $ref: '../instance_variables.yml#/components/schemas/address' + selling: + $ref: 'assetSchema.yml#/components/schemas/Asset' + buying: + $ref: 'assetSchema.yml#/components/schemas/Asset' + amount: + type: string + price_r: + $ref: 'assetSchema.yml#/components/schemas/Price' + price: + type: string + last_modified_ledger: + $ref: '../instance_variables.yml#/components/schemas/last_modified_ledger' + last_modified_time: + type: string + sponser: + type: string + required: + - id + - paging_token + - seller + - selling + - buying + - amount + - price_r + - price + - last_modified_ledger + - last_modified_time + \ No newline at end of file diff --git a/openapi/components/schemas/tradeSchema.yml b/openapi/components/schemas/tradeSchema.yml new file mode 100644 index 000000000..53b13dd7f --- /dev/null +++ b/openapi/components/schemas/tradeSchema.yml @@ -0,0 +1,93 @@ +components: + schemas: + Trade: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + base: + $ref: '../instance_variables.yml#/components/schemas/link' + counter: + $ref: '../instance_variables.yml#/components/schemas/link' + operation: + $ref: '../instance_variables.yml#/components/schemas/link' + required: + - self + - base + - counter + - operation + id: + $ref: '../instance_variables.yml#/components/schemas/id' + paging_token: + $ref: '../instance_variables.yml#/components/schemas/paging_token' + ledger_close_time: + type: string + offer_id: + type: string + trade_type: + type: string + liquidity_pool_fee_bp: + type: number + format: uint32 + base_liquidity_pool_id: + type: string + base_offer_id: + type: string + base_account: + $ref: '../instance_variables.yml#/components/schemas/address' + base_amount: + type: string + base_asset_type: + type: string + base_asset_code: + type: string + base_asset_issuer: + type: string + counter_liquidity_pool_id: + type: string + counter_offer_id: + type: string + counter_account: + $ref: '../instance_variables.yml#/components/schemas/address' + counter_amount: + type: string + counter_asset_type: + type: string + counter_asset_code: + type: string + counter_asset_issuer: + $ref: '../instance_variables.yml#/components/schemas/address' + base_is_seller: + type: boolean + price: + $ref: '#/components/schemas/tradePrice' + + required: + - id + - paging_token + - ledger_close_time + - trade_type + - base_amount + - base_asset_type + - counter_amount + - counter_asset_type + - base_is_seller + tradePrice: + type: object + properties: + n: + type: string + d: + type: string + \ No newline at end of file diff --git a/openapi/components/schemas/transactionSchema.yml b/openapi/components/schemas/transactionSchema.yml index f03f09a6a..bca357d9b 100644 --- a/openapi/components/schemas/transactionSchema.yml +++ b/openapi/components/schemas/transactionSchema.yml @@ -53,14 +53,14 @@ components: hash: type: string ledger: - type: int32 + type: integer + format: int32 created_at: type: string source_account: $ref: '../instance_variables.yml#/components/schemas/address' account_muxed: type: string - # Todo: Fix issue account_muxed_id: type: string source_account_sequence: @@ -76,7 +76,8 @@ components: max_fee: type: string operation_count: - type: int32 + type: integer + format: int32 envelope_xdr: type: string result_xdr: @@ -128,7 +129,8 @@ components: min_account_sequence_age: type: string min_account_sequence_ledger_gap: - type: uint32 + type: integer + format: uint32 extra_signers: type: array items: diff --git a/openapi/main.yml b/openapi/main.yml index dbe26148e..ebce24985 100644 --- a/openapi/main.yml +++ b/openapi/main.yml @@ -9,28 +9,38 @@ servers: - url: https://horizon-testnet.stellar.org description: The test network tags: - - name: account + - name: Accounts description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. - - name: assets + - name: Assets description: Assets are representations of value issued on the Stellar network. An asset consists of a type, code, and issuer. + - name: Offers + description: Offers are statements about how much of an asset an account wants to buy or sell. + - name: Trades + description: When an offer is fully or partially fulfilled, a trade happens. Trades can also be caused by successful path payments, because path payments involve fulfilling offers. A trade occurs between two parties—base and counter. Which is which is either arbitrary or determined by the calling query. paths: /accounts: - $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts' + $ref: '../openapi/components/endpoints/accounts.yml#/paths/~1accounts' /accounts/{account_id}: - $ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}' + $ref: '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}' /accounts/{account_id}/transactions: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1transactions' + $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1transactions' /accounts/{account_id}/operations: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1operations' + $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1operations' /accounts/{account_id}/payments: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1payments' + $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1payments' /accounts/{account_id}/effects: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1effects' + $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1effects' /accounts/{account_id}/offers: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1offers' + $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1offers' /accounts/{account_id}/trades: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1trades' + $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1trades' /accounts/{account_id}/data/{key}: - $ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1data~1{key}' - \ No newline at end of file + $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1data~1{key}' + /offers: + $ref : '../openapi/components/endpoints/offers.yml#/paths/~1offers' + /offers/{offer_id}: + $ref : '../openapi/components/endpoints/offers.yml#/paths/~1offers~1{offer_id}' + /trades: + $ref : '../openapi/components/endpoints/trades.yml#/paths/~1trades' + \ No newline at end of file From 3515d884b953aaa72e909100d4f3e3e8cce0dd66 Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Fri, 23 Sep 2022 16:09:03 -0400 Subject: [PATCH 10/11] Base Asset Update --- openapi/bundled.yml | 461 ++++++++++++++++-- openapi/components/endpoints/offers.yml | 23 +- .../{assetSchema.yml => baseAssetSchema.yml} | 2 +- openapi/components/schemas/offerSchema.yml | 6 +- openapi/main.yml | 2 + 5 files changed, 460 insertions(+), 34 deletions(-) rename openapi/components/schemas/{assetSchema.yml => baseAssetSchema.yml} (96%) diff --git a/openapi/bundled.yml b/openapi/bundled.yml index 5dd5f9990..23d3ebbaf 100644 --- a/openapi/bundled.yml +++ b/openapi/bundled.yml @@ -8,20 +8,24 @@ servers: - url: https://horizon-testnet.stellar.org description: The test network tags: - - name: account + - name: Accounts description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. - - name: assets + - name: Assets description: Assets are representations of value issued on the Stellar network. An asset consists of a type, code, and issuer. + - name: Offers + description: Offers are statements about how much of an asset an account wants to buy or sell. + - name: Trades + description: When an offer is fully or partially fulfilled, a trade happens. Trades can also be caused by successful path payments, because path payments involve fulfilling offers. A trade occurs between two parties—base and counter. Which is which is either arbitrary or determined by the calling query. paths: /accounts: get: tags: - - account + - Accounts summary: List all Accounts description: 'This endpoint lists accounts by one of four filters : signer, asset, liquidity pool or sponsor.' operationId: ListAllAccounts parameters: - - $ref: '#/components/parameters/SponserParam' + - $ref: '#/components/parameters/SponsorParam' - $ref: '#/components/parameters/AssetParam' - $ref: '#/components/parameters/SignerParam' - $ref: '#/components/parameters/LiquidityPoolParam' @@ -40,7 +44,7 @@ paths: /accounts/{account_id}: get: tags: - - account + - Accounts summary: Retrieve an Account description: The single account endpoint provides information on a specific account. The balances section in the response will also list all the trustlines this account has established, including trustlines that haven’t been authorized yet. operationId: RetrieveAnAccount @@ -58,7 +62,7 @@ paths: /accounts/{account_id}/transactions: get: tags: - - account + - Accounts summary: Retrieve an Account's Transactions description: This endpoint represents successful transactions for a given account and can be used in streaming mode. Streaming mode allows you to listen for new transactions for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known transaction unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream transactions created since your request time. operationId: GetTransactionsByAccountid @@ -80,7 +84,7 @@ paths: /accounts/{account_id}/operations: get: tags: - - account + - Accounts summary: Retrieve an Account's Operations description: This endpoint represents successful operations for a given account and can be used in streaming mode. Streaming mode allows you to listen for new operations for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time. operationId: GetOperationsByAccountid @@ -97,7 +101,7 @@ paths: /accounts/{account_id}/payments: get: tags: - - account + - Accounts summary: Retrieve an Account's Payments description: This endpoint represents successful payments for a given account and can be used in streaming mode. Streaming mode allows you to listen for new payments for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known payment unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream payments created since your request time. operationId: GetPaymentsbyAccountid @@ -120,7 +124,7 @@ paths: /accounts/{account_id}/effects: get: tags: - - account + - Accounts summary: Retrieve an Account's Effects description: This endpoint returns the effects of a specific account and can be used in streaming mode. Streaming mode allows you to listen for new effects for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known effect unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream effects created since your request time. operationId: GetEffectsbyAccountid @@ -135,7 +139,7 @@ paths: /accounts/{account_id}/offers: get: tags: - - account + - Accounts summary: Retrieve an Account's Offers description: This endpoint represents all offers a given account has currently open and can be used in streaming mode. Streaming mode allows you to listen for new offers for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known offer unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream offers created since your request time. operationId: GetOffersbyAccountid @@ -146,11 +150,17 @@ paths: - $ref: '#/components/parameters/LimitParam' responses: '200': - description: OK + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Offer' /accounts/{account_id}/trades: get: tags: - - account + - Accounts summary: Retrieve an Account's Trades description: This endpoint represents all trades for a given account and can be used in streaming mode. Streaming mode allows you to listen for trades for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. operationId: GetTradesbyAccountid @@ -161,11 +171,17 @@ paths: - $ref: '#/components/parameters/LimitParam' responses: '200': - description: OK + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Trade' /accounts/{account_id}/data/{key}: get: tags: - - account + - Accounts summary: Retrieve an Account's Data description: This endpoint represents a single data for a given account. operationId: GetDatabyAccountid @@ -174,10 +190,112 @@ paths: - $ref: '#/components/parameters/DataParam' responses: '200': - description: OK + description: blank + content: + application/json: + schema: + type: object + properties: + value: + type: string + /offers: + get: + tags: + - Offers + summary: List All Offers + description: This endpoint lists all currently open offers and can be used in streaming mode. Streaming mode allows you to listen for new offers as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known offer unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream offers created since your request time. When filtering by buying or selling arguments, you must use a combination of selling_asset_type, selling_asset_issuer, and selling_asset_code for the selling asset, or a combination of buying_asset_type, buying_asset_issuer, and buying_asset_code for the buying asset. + operationId: GetAllOffers + parameters: + - $ref: '#/components/parameters/SponsorParam' + - $ref: '#/components/parameters/SellerParam' + - $ref: '#/components/parameters/SellingAssetTypeParam' + - $ref: '#/components/parameters/SellingAssetIssuerParam' + - $ref: '#/components/parameters/SellingAssetCodeParam' + - $ref: '#/components/parameters/BuyingAssetTypeParam' + - $ref: '#/components/parameters/BuyingAssetIssuerParam' + - $ref: '#/components/parameters/BuyingAssetCodeParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Offer' + /offers/{offer_id}: + get: + tags: + - Offers + summary: Retrieve an Offer + description: The single offer endpoint provides information on a specific offer. + operationId: GetOfferbyOfferid + parameters: + - $ref: '#/components/parameters/OfferIDParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Offer' + /offers/{offer_id}/trades: + get: + tags: + - Offers + summary: Retrieve an Account's Trades + description: This endpoint represents all trades for a given offer and can be used in streaming mode. Streaming mode allows you to listen for trades for this offer as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. + operationId: GetTradebyOfferid + parameters: + - $ref: '#/components/parameters/OfferIDParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Trade' + /trades: + get: + tags: + - Trades + summary: List All Trades + description: 'This endpoint lists all trades and can be used in streaming mode. Streaming mode allows you to listen for new trades as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. When filtering for a specific orderbook, you must use use all six of these arguments: base_asset_type, base_asset_issuer, base_asset_code, counter_asset_type, counter_asset_issuer, and counter_asset_code. If the base or counter asset is XLM, you only need to indicate the asset type as native and do not need to designate the code or the issuer.' + operationId: GetAllTrades + parameters: + - $ref: '#/components/parameters/OfferIdParam' + - $ref: '#/components/parameters/BaseAssetTypeParam' + - $ref: '#/components/parameters/BaseAssetIssuerParam' + - $ref: '#/components/parameters/BaseAssetCodeParam' + - $ref: '#/components/parameters/CounterAssetTypeParam' + - $ref: '#/components/parameters/CounterAssetIssuerParam' + - $ref: '#/components/parameters/CounterAssetCodeParam' + - $ref: '#/components/parameters/TradeTypeParam' + - $ref: '#/components/parameters/CursorParam' + - $ref: '#/components/parameters/OrderParam' + - $ref: '#/components/parameters/LimitParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Links' + - $ref: '#/components/schemas/Trade' components: parameters: - SponserParam: + SponsorParam: name: sponser in: query required: false @@ -260,6 +378,125 @@ components: schema: type: string example: config.memo_required + SellerParam: + name: seller + in: query + required: false + description: The account ID of the offer creator. + SellingAssetTypeParam: + name: selling_asset_type + in: query + required: false + description: The type for the selling asset. Either native, credit_alphanum4, or credit_alphanum12. + schema: + type: string + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + SellingAssetIssuerParam: + name: selling_asset_issuer + in: query + required: false + description: The Stellar address of the selling asset’s issuer. + SellingAssetCodeParam: + name: selling_asset_code + in: query + required: false + description: The code for the selling asset. + BuyingAssetTypeParam: + name: buying_asset_type + in: query + required: false + description: The type for the buying asset. Either native, credit_alphanum4, or credit_alphanum12. + schema: + type: string + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + BuyingAssetIssuerParam: + name: buying_asset_issuer + in: query + required: false + description: The Stellar address of the buying asset’s issuer. + BuyingAssetCodeParam: + name: buying_asset_code + in: query + required: false + description: The code for the buying asset. + OfferIDParam: + name: offer_id + in: path + required: true + description: A unique identifier for this offer. + OfferIdParam: + name: offer_id + in: query + required: false + description: The offer ID. Used to filter for trades originating from a specific offer. + BaseAssetTypeParam: + name: base_asset_type + in: query + required: false + description: The type for the base asset. Either native, credit_alphanum4, or credit_alphanum12. + schema: + type: string + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + BaseAssetIssuerParam: + name: base_asset_issuer + in: query + required: false + description: The Stellar address of the base asset’s issuer. + schema: + type: string + example: GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX + BaseAssetCodeParam: + name: base_asset_code + in: query + required: false + description: The code for the base asset. + schema: + type: string + example: USD + CounterAssetTypeParam: + name: counter_asset_type + in: query + required: false + description: The type for the counter asset. Either native, credit_alphanum4, or credit_alphanum12. + schema: + type: string + enum: + - native + - credit_alphanum4 + - credit_alphanum12 + CounterAssetIssuerParam: + name: counter_asset_issuer + in: query + required: false + description: The Stellar address of the counter asset’s issuer. + schema: + type: string + example: GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX + CounterAssetCodeParam: + name: counter_asset_code + in: query + required: false + description: The code for the counter asset. + TradeTypeParam: + name: trade_type + in: query + required: false + description: Can be set to all, orderbook, or liquidity_pools to filter only trades executed across a given mechanism. + schema: + type: string + enum: + - all + - orderbook + - liquidity_pools schemas: link: type: object @@ -484,15 +721,15 @@ components: $ref: '#/components/schemas/link' data: $ref: '#/components/schemas/link' - required: - - self - - transactions - - operations - - payments - - effects - - offers - - trades - - data + required: + - self + - transactions + - operations + - payments + - effects + - offers + - trades + - data id: $ref: '#/components/schemas/id' account_id: @@ -624,7 +861,8 @@ components: min_account_sequence_age: type: string min_account_sequence_ledger_gap: - type: uint32 + type: integer + format: uint32 extra_signers: type: array items: @@ -699,7 +937,8 @@ components: hash: type: string ledger: - type: int32 + type: integer + format: int32 created_at: type: string source_account: @@ -721,7 +960,8 @@ components: max_fee: type: string operation_count: - type: int32 + type: integer + format: int32 envelope_xdr: type: string result_xdr: @@ -819,3 +1059,168 @@ components: - from - to - amount + BaseAsset: + type: object + properties: + asset_type: + type: string + asset_code: + type: string + asset_issuer: + type: string + required: + - asset_type + Price: + type: object + properties: + 'n': + type: integer + format: int32 + d: + type: integer + format: int32 + Offer: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '#/components/schemas/link' + offer_maker: + $ref: '#/components/schemas/link' + required: + - self + - offer_maker + id: + $ref: '#/components/schemas/id' + paging_token: + type: string + seller: + $ref: '#/components/schemas/address' + selling: + $ref: '#/components/schemas/BaseAsset' + buying: + $ref: '#/components/schemas/BaseAsset' + amount: + type: string + price_r: + $ref: '#/components/schemas/Price' + price: + type: string + last_modified_ledger: + $ref: '#/components/schemas/last_modified_ledger' + last_modified_time: + type: string + sponser: + type: string + required: + - id + - paging_token + - seller + - selling + - buying + - amount + - price_r + - price + - last_modified_ledger + - last_modified_time + paging_token: + type: string + tradePrice: + type: object + properties: + 'n': + type: string + d: + type: string + Trade: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '#/components/schemas/link' + base: + $ref: '#/components/schemas/link' + counter: + $ref: '#/components/schemas/link' + operation: + $ref: '#/components/schemas/link' + required: + - self + - base + - counter + - operation + id: + $ref: '#/components/schemas/id' + paging_token: + $ref: '#/components/schemas/paging_token' + ledger_close_time: + type: string + offer_id: + type: string + trade_type: + type: string + liquidity_pool_fee_bp: + type: number + format: uint32 + base_liquidity_pool_id: + type: string + base_offer_id: + type: string + base_account: + $ref: '#/components/schemas/address' + base_amount: + type: string + base_asset_type: + type: string + base_asset_code: + type: string + base_asset_issuer: + type: string + counter_liquidity_pool_id: + type: string + counter_offer_id: + type: string + counter_account: + $ref: '#/components/schemas/address' + counter_amount: + type: string + counter_asset_type: + type: string + counter_asset_code: + type: string + counter_asset_issuer: + $ref: '#/components/schemas/address' + base_is_seller: + type: boolean + price: + $ref: '#/components/schemas/tradePrice' + required: + - id + - paging_token + - ledger_close_time + - trade_type + - base_amount + - base_asset_type + - counter_amount + - counter_asset_type + - base_is_seller diff --git a/openapi/components/endpoints/offers.yml b/openapi/components/endpoints/offers.yml index 48e184643..85d4c3946 100644 --- a/openapi/components/endpoints/offers.yml +++ b/openapi/components/endpoints/offers.yml @@ -45,8 +45,27 @@ paths: allOf: - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" - $ref: "../schemas/offerSchema.yml#/components/schemas/Offer" - - + /offers/{offer_id}/trades: + get: + tags: + - Offers + summary: Retrieve an Account's Trades + description: This endpoint represents all trades for a given offer and can be used in streaming mode. Streaming mode allows you to listen for trades for this offer as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. + operationId: GetTradebyOfferid + parameters: + - $ref: '../parameters.yml#/components/parameters/OfferIDParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/tradeSchema.yml#/components/schemas/Trade" diff --git a/openapi/components/schemas/assetSchema.yml b/openapi/components/schemas/baseAssetSchema.yml similarity index 96% rename from openapi/components/schemas/assetSchema.yml rename to openapi/components/schemas/baseAssetSchema.yml index 770ba5a05..815ed25d9 100644 --- a/openapi/components/schemas/assetSchema.yml +++ b/openapi/components/schemas/baseAssetSchema.yml @@ -1,6 +1,6 @@ components: schemas: - Asset: + BaseAsset: type: object properties: asset_type: diff --git a/openapi/components/schemas/offerSchema.yml b/openapi/components/schemas/offerSchema.yml index b9176635b..278a20d29 100644 --- a/openapi/components/schemas/offerSchema.yml +++ b/openapi/components/schemas/offerSchema.yml @@ -28,13 +28,13 @@ components: seller: $ref: '../instance_variables.yml#/components/schemas/address' selling: - $ref: 'assetSchema.yml#/components/schemas/Asset' + $ref: 'baseassetSchema.yml#/components/schemas/BaseAsset' buying: - $ref: 'assetSchema.yml#/components/schemas/Asset' + $ref: 'baseassetSchema.yml#/components/schemas/BaseAsset' amount: type: string price_r: - $ref: 'assetSchema.yml#/components/schemas/Price' + $ref: 'baseassetSchema.yml#/components/schemas/Price' price: type: string last_modified_ledger: diff --git a/openapi/main.yml b/openapi/main.yml index ebce24985..ff425a739 100644 --- a/openapi/main.yml +++ b/openapi/main.yml @@ -41,6 +41,8 @@ paths: $ref : '../openapi/components/endpoints/offers.yml#/paths/~1offers' /offers/{offer_id}: $ref : '../openapi/components/endpoints/offers.yml#/paths/~1offers~1{offer_id}' + /offers/{offer_id}/trades: + $ref : '../openapi/components/endpoints/offers.yml#/paths/~1offers~1{offer_id}~1trades' /trades: $ref : '../openapi/components/endpoints/trades.yml#/paths/~1trades' \ No newline at end of file From 32408c7e1c2f7b8d1a5a8eb3f1a69d6d03520c9e Mon Sep 17 00:00:00 2001 From: Taylor-at-steller Date: Mon, 26 Sep 2022 11:14:23 -0400 Subject: [PATCH 11/11] Adding Ledger Endpoint --- openapi/components/endpoints/accounts.yml | 3 +- openapi/components/endpoints/assets.yml | 26 ++++++ openapi/components/endpoints/ledgers.yml | 0 openapi/components/endpoints/offers.yml | 4 +- openapi/components/parameters.yml | 10 +++ openapi/components/schemas/assetSchema.yml | 59 +++++++++++++ openapi/components/schemas/ledgerSchema.yml | 94 +++++++++++++++++++++ openapi/main.yml | 4 + 8 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 openapi/components/endpoints/assets.yml create mode 100644 openapi/components/endpoints/ledgers.yml create mode 100644 openapi/components/schemas/assetSchema.yml create mode 100644 openapi/components/schemas/ledgerSchema.yml diff --git a/openapi/components/endpoints/accounts.yml b/openapi/components/endpoints/accounts.yml index 01074ecaa..0a2d8b099 100644 --- a/openapi/components/endpoints/accounts.yml +++ b/openapi/components/endpoints/accounts.yml @@ -7,7 +7,8 @@ # - review number formats & time formats # - review for omit empty in data structures (9/23 ) # - clean up string patterns -# - review todos in payments schemas +# - review todos in payments schemas +# - Ask about baseAsset vs Asset. See google sheet paths: /accounts: get: diff --git a/openapi/components/endpoints/assets.yml b/openapi/components/endpoints/assets.yml new file mode 100644 index 000000000..840c9fba6 --- /dev/null +++ b/openapi/components/endpoints/assets.yml @@ -0,0 +1,26 @@ +paths: + /assets: + get: + tags: + - Assets + summary: List all Assets + description: This endpoint lists all assets. + operationId: ListAllAssets + parameters: + - $ref: '../parameters.yml#/components/parameters/AssetCodeParam' + - $ref: '../parameters.yml#/components/parameters/AssetIssuerParam' + - $ref: '../parameters.yml#/components/parameters/CursorParam' + - $ref: '../parameters.yml#/components/parameters/OrderParam' + - $ref: '../parameters.yml#/components/parameters/LimitParam' + responses: + '200': + description: blank + content: + application/json: + schema: + allOf: + - $ref: "../schemas/linksSchema.yml#/components/schemas/Links" + - $ref: "../schemas/assetSchema.yml#/components/schemas/Asset" + + + diff --git a/openapi/components/endpoints/ledgers.yml b/openapi/components/endpoints/ledgers.yml new file mode 100644 index 000000000..e69de29bb diff --git a/openapi/components/endpoints/offers.yml b/openapi/components/endpoints/offers.yml index 85d4c3946..1a6e4d47f 100644 --- a/openapi/components/endpoints/offers.yml +++ b/openapi/components/endpoints/offers.yml @@ -49,9 +49,9 @@ paths: get: tags: - Offers - summary: Retrieve an Account's Trades + summary: Retrieve an Offer's Trades description: This endpoint represents all trades for a given offer and can be used in streaming mode. Streaming mode allows you to listen for trades for this offer as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known trade unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream trades created since your request time. - operationId: GetTradebyOfferid + operationId: GetTradesbyOfferid parameters: - $ref: '../parameters.yml#/components/parameters/OfferIDParam' - $ref: '../parameters.yml#/components/parameters/CursorParam' diff --git a/openapi/components/parameters.yml b/openapi/components/parameters.yml index 51e66b7f3..6ea10d16e 100644 --- a/openapi/components/parameters.yml +++ b/openapi/components/parameters.yml @@ -8,6 +8,16 @@ components: schema: type: string example: GDMQQNJM4UL7QIA66P7R2PZHMQINWZBM77BEBMHLFXD5JEUAHGJ7R4JZ + AssetCodeParam: + name: asset_code + in: query + required: false + description: The code of the asset you would like to filter by. + AssetIssuerParam: + name: asset_issuer + in: query + required: false + description: The Stellar address of the issuer for the asset you would like to filter by. AssetParam: name: asset in: query diff --git a/openapi/components/schemas/assetSchema.yml b/openapi/components/schemas/assetSchema.yml new file mode 100644 index 000000000..7a5c51b64 --- /dev/null +++ b/openapi/components/schemas/assetSchema.yml @@ -0,0 +1,59 @@ +components: + schemas: + Asset: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + toml: + $ref: '../instance_variables.yml#/components/schemas/link' + asset_type: + type: string + asset_issuer: + $ref: '../instance_variables.yml#/components/schemas/address' + paging_token: + type: string + accounts: + type: object + properties: + authorized: + type: integer + authorized_to_maintain_liabilities: + type: integer + unathorized: + type: integer + num_claimable_balances: + type: integer + balances: + type: object + properties: + authorized: + type: string + authorized_to_maintain_liabilities: + type: string + unathorized: + type: string + claimable_balances_amount: + type: string + amount: + type: string + num_accounts: + type: integer + flags: + type: object + properties: + auth_required: + type: boolean + auth_revocable: + type: boolean + auth_immutable: + type: boolean \ No newline at end of file diff --git a/openapi/components/schemas/ledgerSchema.yml b/openapi/components/schemas/ledgerSchema.yml new file mode 100644 index 000000000..919831e7e --- /dev/null +++ b/openapi/components/schemas/ledgerSchema.yml @@ -0,0 +1,94 @@ +components: + schemas: + Ledger: + type: object + properties: + _embedded: + type: object + properties: + records: + type: array + items: + type: object + properties: + _links: + type: object + properties: + self: + $ref: '../instance_variables.yml#/components/schemas/link' + transactions: + $ref: '../instance_variables.yml#/components/schemas/link' + operations: + $ref: '../instance_variables.yml#/components/schemas/link' + payments: + $ref: '../instance_variables.yml#/components/schemas/link' + effects: + $ref: '../instance_variables.yml#/components/schemas/link' + id: + $ref: '../instance_variables.yml#/components/schemas/id' + paging_token: + $ref: '../instance_variables.yml#/components/schemas/paging_token' + hash: + $ref: '../instance_variables.yml#/components/schemas/hash' + pre_hash: + $ref: '../instance_variables.yml#/components/schemas/hash' + sequence: + type: integer + format: int32 + successful_transaction_count: + type: integer + format: int32 + failed_transaction_count: + type: integer + format: int32 + operation_count: + type: integer + format: int32 + tx_set_operation_count: + type: integer + format: int32 + closed_at: + type: string + total_coins: + type: string + fee_pool: + type: string + base_fee_in_stroops: + type: integer + format: int32 + base_reserve_in_stroops: + type: integer + format: int32 + max_tx_set_size: + type: integer + format: int32 + protocol_version: + type: integer + format: int32 + header_xdr: + type: string + required: + - id + - paging_token + - hash + - sequence + - successful_transaction_count + - failed_transaction_count + - operation_count + - tx_set_operation_count + - closed_at + - total_coins + - fee_pool + - base_fee_in_stroops + - base_reserve_in_stroops + - max_tx_set_size + - protocol_version + - header_xdr + + + + + + + + \ No newline at end of file diff --git a/openapi/main.yml b/openapi/main.yml index ff425a739..d61dabae5 100644 --- a/openapi/main.yml +++ b/openapi/main.yml @@ -13,6 +13,8 @@ tags: description: Users interact with the Stellar network through accounts. Everything else in the ledger—assets, offers, trustlines, etc. are owned by accounts, and accounts must authorize all changes to the ledger through signed transactions. - name: Assets description: Assets are representations of value issued on the Stellar network. An asset consists of a type, code, and issuer. + - name: Ledgers + description: Each ledger stores the state of the network at a point in time and contains all the changes - transactions, operations, effects, etc. - to that state. - name: Offers description: Offers are statements about how much of an asset an account wants to buy or sell. - name: Trades @@ -37,6 +39,8 @@ paths: $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1trades' /accounts/{account_id}/data/{key}: $ref : '../openapi/components/endpoints/accounts.yml#/paths/~1accounts~1{account_id}~1data~1{key}' + /assets: + $ref : '../openapi/components/endpoints/assets.yml#/paths/~1assets' /offers: $ref : '../openapi/components/endpoints/offers.yml#/paths/~1offers' /offers/{offer_id}: