.. _osxpert-thrift-lib:

**************
osxpert.thrift
**************

A C++ library which aims to reduce the required boilerplate code for the interaction with the turret API.

Everything is inside the ``osxpert::thrift`` namespace.

=====
Usage
=====

See :ref:`Examples`

==============
Reference
==============

ThriftClient.h
==============

.. cpp:struct:: ClientTlsOptions

    .. cpp:member:: bool        VerifyHost
    .. cpp:member:: std::string CertificateFile
    .. cpp:member:: std::string PrivateKeyFile
    .. cpp:member:: std::string TrustedCaFile

.. cpp:struct:: ClientOptions

    .. cpp:type:: std::shared_ptr<apache::thrift::transport::TSSLSocketFactory> \
                  SslSocketFactoryPtr

    .. cpp:function:: ClientOptions(const std::string&  host, \
                                    int                 port, \
                                    int                 timeoutMillis = 0, \
                                    SslSocketFactoryPtr tlsSocketFactory = nullptr)

    .. cpp:member:: std::string Host
    .. cpp:member:: int         Port
    .. cpp:member:: int         ConnectionTimeoutMillis
    .. cpp:member:: SslSocketFactoryPtr TlsSocketFactory

.. cpp:function:: template <class ClientType> \
                  std::shared_ptr<ClientType> makeClient(const ClientOptions& options)

.. cpp:class:: template <class ClientType> ClientConnection

.. cpp:function:: template <class ClientType> \
                  ClientConnection<ClientType> connect(std::shared_ptr<ClientType> client)

ThriftServer.h
==============

.. cpp:struct:: ServerTlsOptions

    .. cpp:member:: bool        AuthenticateClient = false
    .. cpp:member:: bool        VerifyClientHost = false
    .. cpp:member:: std::string CertificateFile
    .. cpp:member:: std::string PrivateKeyFile
    .. cpp:member:: std::string TrustedCaFile

.. cpp:struct:: ServerOptions

    .. cpp:member:: std::string                       ListenAddress
    .. cpp:member:: int                               ListenPort
    .. cpp:member:: boost::optional<ServerTlsOptions> TlsOptions

.. cpp:class:: Server

    .. cpp:function:: void listen()
    .. cpp:function:: void stop()
