ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
get_currencies_response Struct Referencefinal

Response containing currencies with pagination metadata. More...

#include <currency_protocol.hpp>

Collaboration diagram for get_currencies_response:
Collaboration graph

Public Member Functions

std::vector< std::byte > serialize () const
 Serialize response to bytes.
 

Static Public Member Functions

static std::expected< get_currencies_response, comms::messaging::error_code > deserialize (std::span< const std::byte > data)
 Deserialize response from bytes.
 

Public Attributes

std::vector< domain::currencycurrencies
 
std::uint32_t total_available_count = 0
 Total number of currencies available (not just in this page)
 

Detailed Description

Response containing currencies with pagination metadata.

Member Function Documentation

◆ serialize()

std::vector< std::byte > serialize ( ) const

Serialize response to bytes.

Format:

  • 4 bytes: total_available_count (uint32_t)
  • 4 bytes: count (number of currencies in this response)
  • For each currency:
    • 2 bytes: iso_code length
    • N bytes: iso_code (UTF-8)
    • 2 bytes: name length
    • N bytes: name (UTF-8)
    • 2 bytes: numeric_code length
    • N bytes: numeric_code (UTF-8)
    • 2 bytes: symbol length
    • N bytes: symbol (UTF-8)
    • 2 bytes: fraction_symbol length
    • N bytes: fraction_symbol (UTF-8)
    • 4 bytes: fractions_per_unit (int)
    • 2 bytes: rounding_type length
    • N bytes: rounding_type (UTF-8)
    • 4 bytes: rounding_precision (int)
    • 2 bytes: format length
    • N bytes: format (UTF-8)
    • 2 bytes: currency_type length
    • N bytes: currency_type (UTF-8)
    • 2 bytes: recorded_by length
    • N bytes: recorded_by (UTF-8)
    • 2 bytes: recorded_at length
    • N bytes: recorded_at (UTF-8)