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

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

# QGrpcCallOptions Class

The QGrpcCallOptions is an storage class used to set additional call options. More...

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

- List of all members, including inherited members

## Public Functions

| QGrpcCallOptions()
| QGrpcCallOptions(const QGrpcCallOptions &other)
| QGrpcCallOptions(QGrpcCallOptions &&other)
| ~QGrpcCallOptions()
std::optional<std::chrono::milliseconds> | deadlineTimeout() const
QHash<QByteArray, QByteArray> | metadata() &&
const QHash<QByteArray, QByteArray> & | metadata() const &
QGrpcCallOptions & | setDeadlineTimeout(std::chrono::milliseconds timeout)
QGrpcCallOptions & | setMetadata(QHash<QByteArray, QByteArray> &&metadata)
QGrpcCallOptions & | setMetadata(const QHash<QByteArray, QByteArray> &metadata)
`(since 6.8)` void | swap(QGrpcCallOptions &other)
`(since 6.8)` QVariant | operator QVariant() const
QGrpcCallOptions & | operator=(QGrpcCallOptions &&other)
QGrpcCallOptions & | operator=(const QGrpcCallOptions &other)

## Related Non-Members

`(since 6.8)` QDebug | operator<<(QDebug debug, const QGrpcCallOptions &callOpts)

## Detailed Description

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

## Member Function Documentation

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

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

Returns metadata used for a call.

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

### QGrpcCallOptions::QGrpcCallOptions()

Constructs an empty QGrpcCallOptions object.

### QGrpcCallOptions::QGrpcCallOptions(const QGrpcCallOptions &other)

Construct a copy of QGrpcCallOptions with other object.

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

Move-constructs a new QGrpcCallOptions 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]` QGrpcCallOptions::~QGrpcCallOptions()

Destroys the QGrpcCallOptions object.

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

Returns deadline value for a call.

Deadline value controls the maximum execution time of an call or a stream. This value overrides value set by QGrpcChannelOptions::deadline() for a specific call or stream.

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

See also setDeadlineTimeout().

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

Sets deadline value with timeout and returns updated QGrpcCallOptions object.

See also deadlineTimeout().

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

Sets metadata for a call and returns updated QGrpcCallOptions object.

See also metadata() and setMetadata().

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

Sets metadata for a call and returns updated QGrpcCallOptions object.

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

### `[noexcept, since 6.8]` void QGrpcCallOptions::swap(QGrpcCallOptions &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 QGrpcCallOptions::operator QVariant() const

Constructs a new QVariant object from this QGrpcCallOptions.

This function was introduced in Qt 6.8.

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

Move-assigns other to this QGrpcCallOptions 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.

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

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

## Related Non-Members

### `[since 6.8]` QDebug operator<<(QDebug debug, const QGrpcCallOptions &callOpts)

Writes callOpts to the specified stream debug.

This function was introduced in Qt 6.8.