QGrpcChannelOptions Class | Qt GRPC 6.8.0
Description: The QGrpcChannelOptions is an storage class used to set additional channel options.

- Qt 6.8
- Qt GRPC
- C++ Classes
- QtGrpc (Technical Preview)
- QGrpcChannelOptions
- Qt 6.8.0 Reference Documentation

# QGrpcChannelOptions Class

The QGrpcChannelOptions is an storage class used to set additional channel options. More...

Header: | `#include <QGrpcChannelOptions>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Grpc)` `target_link_libraries(mytarget PRIVATE Qt6::Grpc)`
Since: | Qt 6.6
In QML: | QQmlGrpcChannelOptions
Status: | Technical Preview

- List of all members, including inherited members

## Public Functions

| QGrpcChannelOptions()
| QGrpcChannelOptions(const QGrpcChannelOptions &other)
| QGrpcChannelOptions(QGrpcChannelOptions &&other)
| ~QGrpcChannelOptions()
std::optional<std::chrono::milliseconds> | deadlineTimeout() const
QHash<QByteArray, QByteArray> | metadata() &&
const QHash<QByteArray, QByteArray> & | metadata() const &
`(since 6.8)` QGrpcSerializationFormat | serializationFormat() const
QGrpcChannelOptions & | setDeadlineTimeout(std::chrono::milliseconds timeout)
QGrpcChannelOptions & | setMetadata(QHash<QByteArray, QByteArray> &&metadata)
QGrpcChannelOptions & | setMetadata(const QHash<QByteArray, QByteArray> &metadata)
`(since 6.8)` QGrpcChannelOptions & | setSerializationFormat(const QGrpcSerializationFormat &format)
QGrpcChannelOptions & | setSslConfiguration(const QSslConfiguration &sslConfiguration)
std::optional<QSslConfiguration> | sslConfiguration() const
`(since 6.8)` void | swap(QGrpcChannelOptions &other)
`(since 6.8)` QVariant | operator QVariant() const
QGrpcChannelOptions & | operator=(QGrpcChannelOptions &&other)
QGrpcChannelOptions & | operator=(const QGrpcChannelOptions &other)

## Related Non-Members

`(since 6.8)` QDebug | operator<<(QDebug debug, const QGrpcChannelOptions &chOpts)

## Detailed Description

QGrpcChannelOptions provides a set of functions to set and access the channel and default call options that are used by gRPC channels to communicate with the services.

## Member Function Documentation

### QGrpcChannelOptions &QGrpcChannelOptions::setMetadata(QHash<QByteArray, QByteArray> &&metadata)

### QGrpcChannelOptions &QGrpcChannelOptions::setMetadata(const QHash<QByteArray, QByteArray> &metadata)

Sets metadata for all calls and returns updated QGrpcChannelOptions object.

For HTTP2-based channels, metadata is converted into HTTP/2 headers, that added to each HTTP/2 request.

### QHash<QByteArray, QByteArray> QGrpcChannelOptions::metadata() &&

### `[noexcept]` const QHash<QByteArray, QByteArray> &QGrpcChannelOptions::metadata() const &

Returns metadata used for every call on the channel.

If value was not set returns empty QHash<QByteArray, QByteArray>.

### QGrpcChannelOptions::QGrpcChannelOptions()

Constructs a QGrpcChannelOptions.

### QGrpcChannelOptions::QGrpcChannelOptions(const QGrpcChannelOptions &other)

Construct a copy of QGrpcChannelOptions with other object.

### `[noexcept]` QGrpcChannelOptions::QGrpcChannelOptions(QGrpcChannelOptions &&other)

Move-constructs a new QGrpcChannelOptions from other.

Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

### `[noexcept]` QGrpcChannelOptions::~QGrpcChannelOptions()

Destroys the QGrpcChannelOptions object.

### `[noexcept]` std::optional<std::chrono::milliseconds> QGrpcChannelOptions::deadlineTimeout() const

Returns deadline value for setting up the channel.

Deadline value controls the maximum execution time of any call or stream executed on the channel.

If value was not set returns empty std::optional.

See also setDeadlineTimeout().

### `[since 6.8]` QGrpcSerializationFormat QGrpcChannelOptions::serializationFormat() const

Returns the serialization format used in QAbstractGrpcChannel implementations.

This function was introduced in Qt 6.8.

See also setSerializationFormat().

### QGrpcChannelOptions &QGrpcChannelOptions::setDeadlineTimeout(std::chrono::milliseconds timeout)

Sets deadline value with timeout and returns updated QGrpcChannelOptions object.

See also deadlineTimeout().

### `[since 6.8]` QGrpcChannelOptions &QGrpcChannelOptions::setSerializationFormat(const QGrpcSerializationFormat &format)

Sets the serialization format in the channel and returns updated QGrpcChannelOptions object.

The serialization format should be considered in QAbstractGrpcChannel implementations.

This function was introduced in Qt 6.8.

See also serializationFormat().

### QGrpcChannelOptions &QGrpcChannelOptions::setSslConfiguration(const QSslConfiguration &sslConfiguration)

Sets SSL configuration with sslConfiguration and returns updated QGrpcChannelOptions object.

See also sslConfiguration().

### `[noexcept]` std::optional<QSslConfiguration> QGrpcChannelOptions::sslConfiguration() const

Returns SSL configuration for the channel.

If value was not set returns empty std::optional.

See also setSslConfiguration().

### `[noexcept, since 6.8]` void QGrpcChannelOptions::swap(QGrpcChannelOptions &other)

Swaps this instance with other. This operation is very fast and never fails.

This function was introduced in Qt 6.8.

### `[since 6.8]` QVariant QGrpcChannelOptions::operator QVariant() const

Constructs a new QVariant object from this QGrpcChannelOptions.

This function was introduced in Qt 6.8.

### `[noexcept]` QGrpcChannelOptions &QGrpcChannelOptions::operator=(QGrpcChannelOptions &&other)

Move-assigns other to this QGrpcChannelOptions instance and returns a reference to it.

Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

### QGrpcChannelOptions &QGrpcChannelOptions::operator=(const QGrpcChannelOptions &other)

Assigns other to this QGrpcChannelOptions and returns a reference to this QGrpcChannelOptions.

## Related Non-Members

### `[since 6.8]` QDebug operator<<(QDebug debug, const QGrpcChannelOptions &chOpts)

Writes chOpts to the specified stream debug.

This function was introduced in Qt 6.8.