- Qt 6.12
- Qt GRPC
- QtGrpc Namespace
- Qt 6.12.0 Reference Documentation

# QtGrpc Namespace

The QtGrpc namespace contains miscellaneous identifiers used throughout the QtGrpc library. More...

Header: | `#include <QtGrpcNamespace>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Grpc)` `target_link_libraries(mytarget PRIVATE Qt6::Grpc)`
Since: | Qt 6.5

## Classes

`(since 6.10)` struct | MultiValue_t
`(since 6.11)` struct | RpcDescriptor

## Types

`(since 6.12)` enum class | CompressionAlgorithm { Identity, Deflate, Gzip }
flags | CompressionAlgorithms
`(since 6.11)` flags | InterceptorCapabilities
`(since 6.11)` enum class | InterceptorCapability { Start, InitialMetadata, MessageReceived, WriteMessage, WritesDone, …, Cancel }
`(since 6.11)` enum class | RpcType { UnaryCall, ServerStreaming, ClientStreaming, BidiStreaming }
enum class | SerializationFormat { Default, Protobuf, Json }
enum class | StatusCode { Ok, Cancelled, InvalidArgument, DeadlineExceeded, NotFound, …, Unauthenticated }

## Variables

`(since 6.10)` const struct QtGrpc::MultiValue_t | MultiValue

## Detailed Description

## Classes

### class MultiValue_t

Tag type used to access QMultiHash metadata. More...

### class RpcDescriptor

Describes a gRPC method with its service name, method name, and RPC type. More...

## Type Documentation

### `[since 6.12]` enum class QtGrpc::CompressionAlgorithm
flags QtGrpc::CompressionAlgorithms

Lists the compression algorithms supported for gRPC messages.

The HTTP/2 channel advertises the selected algorithms in the `grpc-accept-encoding` request header, and sends outbound messages compressed with the algorithm selected via setRequestCompression().

Constant | Value | Description
--- | --- | ---
`QtGrpc::CompressionAlgorithm::Identity` | `0x01` | No compression. Always present in the accepted set because the gRPC specification mandates that uncompressed messages are accepted.
`QtGrpc::CompressionAlgorithm::Deflate` | `0x02` | The `deflate` compression algorithm.
`QtGrpc::CompressionAlgorithm::Gzip` | `0x04` | The `gzip` compression algorithm.

This enum was introduced in Qt 6.12.

The CompressionAlgorithms type is a typedef for QFlags<CompressionAlgorithm>. It stores an OR combination of CompressionAlgorithm values.

See also QGrpcChannelOptions::setAcceptedCompressionAlgorithms(), QGrpcChannelOptions::supportedCompressionAlgorithms(), QGrpcChannelOptions::setRequestCompression(), and QGrpcCallOptions::setRequestCompression().

### `[since 6.11]` enum class InterceptorCapability
`[since 6.11]` flags InterceptorCapabilities

Specifies interception hook points supported by an interceptor.

Qt GRPC uses InterceptorCapability values to describe which interception hook points an interceptor provides.

A single interceptor class can implement multiple interceptor interfaces (for example, QGrpcStartInterceptor and QGrpcFinishedInterceptor) and therefore support multiple capabilities.

Constant | Value | Description
--- | --- | ---
`InterceptorCapability::Start` | `0x01` | The interceptor implements QGrpcStartInterceptor.
`InterceptorCapability::InitialMetadata` | `0x02` | The interceptor implements QGrpcInitialMetadataInterceptor.
`InterceptorCapability::MessageReceived` | `0x04` | The interceptor implements QGrpcMessageReceivedInterceptor.
`InterceptorCapability::WriteMessage` | `0x08` | The interceptor implements QGrpcWriteMessageInterceptor.
`InterceptorCapability::WritesDone` | `0x10` | The interceptor implements QGrpcWritesDoneInterceptor.
`InterceptorCapability::TrailingMetadata` | `0x20` | The interceptor implements QGrpcTrailingMetadataInterceptor.
`InterceptorCapability::Finished` | `0x40` | The interceptor implements QGrpcFinishedInterceptor.
`InterceptorCapability::Cancel` | `0x80` | The interceptor implements QGrpcCancelInterceptor.

This enum was introduced in Qt 6.11.

The InterceptorCapabilities type is a typedef for QFlags<InterceptorCapability>. It stores an OR combination of InterceptorCapability values.

### `[since 6.11]` enum class QtGrpc::RpcType

Describes the type of the RPC (Remote Procedure Call).

This enum specifies the communication pattern used by a gRPC method.

Constant | Value | Description
--- | --- | ---
`QtGrpc::RpcType::UnaryCall` | `0` | uses the QGrpcCallReply handler.
`QtGrpc::RpcType::ServerStreaming` | `1` | uses the QGrpcServerStream handler.
`QtGrpc::RpcType::ClientStreaming` | `2` | uses the QGrpcClientStream handler.
`QtGrpc::RpcType::BidiStreaming` | `3` | uses the QGrpcBidiStream handler.

This enum was introduced in Qt 6.11.

See also QtGrpc::RpcDescriptor.

### enum class QtGrpc::SerializationFormat

Contains preset values for setting the protobuf serializer format.

Constant | Value | Description
--- | --- | ---
`QtGrpc::SerializationFormat::Default` | `0` | The default QGrpcSerializationFormat preset. This preset constructs a QProtobufSerializer with an empty content type suffix.
`QtGrpc::SerializationFormat::Protobuf` | `1` | The embedded protobuf QGrpcSerializationFormat preset. This preset constructs a QProtobufSerializer with the `proto` content type suffix.
`QtGrpc::SerializationFormat::Json` | `2` | The embedded JSON QGrpcSerializationFormat preset. This preset constructs a QProtobufJsonSerializer with the `json` content type suffix.

See also QGrpcSerializationFormat.

### enum class QtGrpc::StatusCode

Channel's status codes.

Constant | Value | Description
--- | --- | ---
`QtGrpc::StatusCode::Ok` | `0` | No error
`QtGrpc::StatusCode::Cancelled` | `1` | The operation was cancelled, typically by the caller.
`QtGrpc::StatusCode::InvalidArgument` | `3` | The client specified an invalid argument,
`QtGrpc::StatusCode::DeadlineExceeded` | `4` | The deadline expired before the operation could complete,
`QtGrpc::StatusCode::NotFound` | `5` | Some requested entity (e.g., file or directory) was not found.
`QtGrpc::StatusCode::AlreadyExists` | `6` | The entity that a client attempted to create (e.g., file or directory) already exists.
`QtGrpc::StatusCode::PermissionDenied` | `7` | The caller does not have permission to execute the specified operation. `PermissionDenied` must not be used for rejections caused by exhausting some resource (use `ResourceExhausted` instead for those errors). `PermissionDenied` must not be used if the caller can not be identified (use `Unauthenticated` instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions.
`QtGrpc::StatusCode::ResourceExhausted` | `8` | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
`QtGrpc::StatusCode::FailedPrecondition` | `9` | The operation was rejected because the system is not in a state required for the operation's execution.
`QtGrpc::StatusCode::Aborted` | `10` | The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
`QtGrpc::StatusCode::OutOfRange` | `11` | The operation was attempted past the valid range.
`QtGrpc::StatusCode::Unimplemented` | `12` | The operation is not implemented or is not supported/enabled in this service.
`QtGrpc::StatusCode::Internal` | `13` | This means that some invariants expected by the underlying system have been broken.
`QtGrpc::StatusCode::Unavailable` | `14` | The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations.
`QtGrpc::StatusCode::DataLoss` | `15` | Unrecoverable data loss or corruption.
`QtGrpc::StatusCode::Unauthenticated` | `16` | The request does not have valid authentication credentials for the operation.

See also gRPC status codes.

## Variable Documentation

### `[since 6.10]` const struct QtGrpc::MultiValue_t QtGrpc::MultiValue

Tag used to access QMultiHash metadata.

This variable was introduced in Qt 6.10.

See also QGrpcChannelOptions::metadata(QtGrpc::MultiValue_t) and QGrpcCallOptions::metadata(QtGrpc::MultiValue_t).