Skip to content

Commit

Permalink
Documenting Retrieve Account Response
Browse files Browse the repository at this point in the history
  • Loading branch information
Taylor-at-Stellar committed Sep 14, 2022
1 parent 03fad1d commit 18227da
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 27 deletions.
72 changes: 72 additions & 0 deletions openapi/_build/main.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 8 additions & 20 deletions openapi/components/endpoints/account.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -155,4 +143,4 @@ paths:
- $ref: '../parameters.yml#/components/parameters/DataParam'
responses:
'200':
description: OK
description: OK
12 changes: 11 additions & 1 deletion openapi/components/instance_variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,14 @@ components:
signatures:
type: array
items:
type: string
type: string
link:
type: object
properties:
href:
type: string
format: link
templated:
type: boolean
required:
["href"]
33 changes: 33 additions & 0 deletions openapi/components/schemas/accountLinkSchema.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions openapi/components/schemas/accountSchema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ 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:
type: integer
num_sponsered:
type: integer
sponser:
- $ref: '#/components/schemas/address'
$ref: '../instance_variables.yml#/components/schemas/address'
paging_token:
type: string
required:
Expand Down
2 changes: 1 addition & 1 deletion openapi/components/schemas/balanceSchema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
29 changes: 29 additions & 0 deletions redocly.yaml
Original file line number Diff line number Diff line change
@@ -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.
[email protected]:
# 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

0 comments on commit 18227da

Please sign in to comment.