Skip to content

Commit

Permalink
add account_currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pdp2121 committed Jan 21, 2025
1 parent 5198851 commit 1cc20ca
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 44 deletions.
79 changes: 79 additions & 0 deletions async_api/requests/account_currencies_async_api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
components:
schemas:
AccountCurrenciesRequest:
type: object
allOf:
- $ref: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesRequest
properties:
command:
type: string
enum:
- account_currencies
id:
description: A unique identifier for the request.
required:
- command
- id
example:
command: 'account_currencies'
account: 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59'
ledger_index: 'validated'
AccountCurrenciesResponse:
type: object
properties:
result:
type: object
discriminator:
propertyName: status
mapping:
success: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesSuccessResponse
error: '#/components/schemas/AccountCurrenciesErrorResponse'
oneOf:
- $ref: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesSuccessResponse
- $ref: '#/components/schemas/AccountCurrenciesErrorResponse'
id:
description: A unique identifier for the request.
type:
type: string
description:
The value response indicates a direct response to an API request.
Asynchronous notifications use a different value such as
`ledgerClosed` or `transaction`.
enum:
- response
required:
- id
- type
example:
result:
ledger_index: 11775823,
receive_currencies:
[
'BTC',
'CNY',
'DYM',
'EUR',
'JOE',
'MXN',
'USD',
'015841551A748AD2C1F76FF6ECB0CCCD00000000',
]
send_currencies:
[
'ASP',
'BTC',
'CHF',
'CNY',
'DYM',
'EUR',
'JOE',
'JPY',
'MXN',
'USD',
]
status: 'success'
validated: true
AccountCurrenciesErrorResponse:
oneOf:
- $ref: ../../shared/base.yaml#/components/schemas/WebsocketErrorFields
- $ref: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesErrorResponse
17 changes: 17 additions & 0 deletions async_api/websocket_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ components:
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryRequest'

# Account channels request message
AccountCurrenciesRequest:
name: AccountCurrenciesRequest
messageId: AccountCurrenciesRequest
contentType: application/json
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesRequest'

# ... (Add definitions for additional message types)

# Account channels response message
Expand Down Expand Up @@ -134,4 +142,13 @@ components:
contentType: application/json
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryResponse'

# Account currencies response message
AccountCurrenciesResponse:
name: AccountCurrenciesResponse
messageId: AccountCurrenciesResponse
contentType: application/json
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesResponse'

# ... (Add definitions for additional response types)
145 changes: 101 additions & 44 deletions async_api/websocket_api_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,115 @@ servers:
protocol: wss
description: Testnet (not for production usage)

# Refactored channels section for better reusability
channels:
# Root channel for all requests and responses
/:
# In AsyncAPI 2.x 'subscribe' is from the api's perspective - so an end user sends a request to
# a channel where the api is 'subscribed'. This is changed in 3.0.0.
description: The root channel for sending requests and receiving responses.
# Leverages operationId for clarity
subscribe:
operationId: subscribeToRoot
message:
oneOf:
- name: AccountChannelsRequest
messageId: AccountChannelsRequest
contentType: application/json
payload:
$ref: './requests/account_channels_async_api.yaml#/components/schemas/AccountChannelsRequest'
- name: AccountInfoRequest
messageId: AccountInfoRequest
contentType: application/json
payload:
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoRequest'
- name: AccountLinesRequest
messageId: AccountLinesRequest
contentType: application/json
payload:
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesRequest'
- name: LedgerEntryRequest
messageId: LedgerEntryRequest
contentType: application/json
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryRequest'
# TODO: Add additional request types for individual requests here
# Reusable message references
- $ref: '#/components/messages/AccountChannelsRequest'
- $ref: '#/components/messages/AccountInfoRequest'
- $ref: '#/components/messages/AccountLinesRequest'
- $ref: '#/components/messages/LedgerEntryRequest'
# ... (Add references for additional requests)
publish:
operationId: publishToRoot
message:
oneOf:
- name: AccountChannelsResponse
messageId: AccountChannelsResponse
contentType: application/json
payload:
$ref: './requests/account_channels_async_api.yaml#/components/schemas/AccountChannelsResponse'
- name: AccountInfoResponse
messageId: AccountInfoResponse
contentType: application/json
payload:
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoResponseV2'
- name: AccountLinesResponse
messageId: AccountLinesResponse
contentType: application/json
payload:
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesResponse'
- name: LedgerEntryResponse
messageId: LedgerEntryResponse
contentType: application/json
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryResponse'
# TODO: Add additional response types for individual requests here
- $ref: '#/components/messages/AccountChannelsResponse'
- $ref: '#/components/messages/AccountInfoResponseV2'
- $ref: '#/components/messages/AccountLinesResponse'
- $ref: '#/components/messages/LedgerEntryResponse'
# ... (Add references for additional responses)

# Moved message definitions to a separate components section
components:
messages:
# Account channels request message
AccountChannelsRequest:
name: AccountChannelsRequest
messageId: AccountChannelsRequest
contentType: application/json
payload:
$ref: './requests/account_channels_async_api.yaml#/components/schemas/AccountChannelsRequest'

# Account info request message
AccountInfoRequest:
name: AccountInfoRequest
messageId: AccountInfoRequest
contentType: application/json
payload:
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoRequest'

# Account lines request message
AccountLinesRequest:
name: AccountLinesRequest
messageId: AccountLinesRequest
contentType: application/json
payload:
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesRequest'

# Ledger entry request message
LedgerEntryRequest:
name: LedgerEntryRequest
messageId: LedgerEntryRequest
contentType: application/json
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryRequest'

# Account channels request message
AccountCurrenciesRequest:
name: AccountCurrenciesRequest
messageId: AccountCurrenciesRequest
contentType: application/json
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesRequest'

# ... (Add definitions for additional message types)

# Account channels response message
AccountChannelsResponse:
name: AccountChannelsResponse
messageId: AccountChannelsResponse
contentType: application/json
payload:
$ref: './requests/account_channels_async_api.yaml#/components/schemas/AccountChannelsResponse'

# Account info response message (version 2)
AccountInfoResponseV2:
name: AccountInfoResponse
messageId: AccountInfoResponseV2 # Consider using a version suffix
contentType: application/json
payload:
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoResponseV2'

# Account lines response message
AccountLinesResponse:
name: AccountLinesResponse
messageId: AccountLinesResponse
contentType: application/json
payload:
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesResponse'

# Ledger entry response message
LedgerEntryResponse:
name: LedgerEntryResponse
messageId: LedgerEntryResponse
contentType: application/json
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryResponse'

# Account currencies response message
AccountCurrenciesResponse:
name: AccountCurrenciesResponse
messageId: AccountCurrenciesResponse
contentType: application/json
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesResponse'

# ... (Add definitions for additional response types)
3 changes: 3 additions & 0 deletions open_api/json_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ paths:
account_lines: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
submit: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV1'
ledger_entry: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
account_currencies: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
# TODO: Add the rest of the JSON RPC requests here
oneOf:
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest'
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV1'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
- $ref: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
# TODO: Add the rest of the JSON RPC requests here
required: true
operationId: 'POST'
Expand All @@ -64,6 +66,7 @@ paths:
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitResponseV1'
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesResponse'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryResponse'
- $ref: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesResponse'
# TODO: Add the rest of the JSON RPC responses here

# TODO: We want to be much more explicit with http error codes for a full implementation of this spec.
Expand Down
3 changes: 3 additions & 0 deletions open_api/json_api_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ paths:
submit: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV2'
account_lines: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
ledger_entry: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
account_currencies: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
# TODO: Add the rest of the JSON RPC requests here
oneOf:
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest'
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV2'
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
- $ref: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
# TODO: Add the rest of the JSON RPC requests here
required: true
operationId: 'POST'
Expand All @@ -56,6 +58,7 @@ paths:
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitResponseV2'
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesResponse'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryResponse'
- $ref: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesResponse'
# TODO: Add the rest of the JSON RPC responses here

# TODO: We want to be much more explicit with http error codes for a full implementation of this spec.
Expand Down
70 changes: 70 additions & 0 deletions open_api/requests/account_currencies_open_api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
components:
schemas:
AccountCurrenciesRequest:
type: object
description: ''
properties:
method:
type: string
enum:
- account_currencies
params:
type: array
items:
$ref: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesRequest
required:
- method
example:
method: account_currencies
params:
- account: 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59'
ledger_index: 'validated'
AccountCurrenciesResponse:
type: object
properties:
result:
type: object
discriminator:
propertyName: status
mapping:
success: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesSuccessResponse
error: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesErrorResponse
oneOf:
- $ref: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesSuccessResponse
- $ref: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesErrorResponse
required:
- result
example:
result:
ledger_index: 11775823,
receive_currencies:
[
'BTC',
'CNY',
'DYM',
'EUR',
'JOE',
'MXN',
'USD',
'015841551A748AD2C1F76FF6ECB0CCCD00000000',
]
send_currencies:
[
'ASP',
'BTC',
'CHF',
'CNY',
'DYM',
'EUR',
'JOE',
'JPY',
'MXN',
'USD',
]
status: 'success'
validated: true
AccountCurrenciesSuccessResponse:
type: object
allOf:
- $ref: ../../shared/base.yaml#/components/schemas/BaseSuccessResponse
- $ref: ../../shared/requests/account_currencies.yaml#/components/schemas/AccountCurrenciesSuccessResponse
Loading

0 comments on commit 1cc20ca

Please sign in to comment.