| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- // Copyright (c) 2015, Google Inc.
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- // DO NOT EDIT.
- // swift-format-ignore-file
- //
- // Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
- // Source: echo.proto
- //
- // For information on using the generated types, please see the documentation:
- // https://github.com/grpc/grpc-swift
- import GRPCCore
- import GRPCProtobuf
- internal enum Echo_Echo {
- internal enum Method {
- internal enum Get {
- internal typealias Input = Echo_EchoRequest
- internal typealias Output = Echo_EchoResponse
- internal static let descriptor = MethodDescriptor(
- service: "echo.Echo",
- method: "Get"
- )
- }
- internal enum Expand {
- internal typealias Input = Echo_EchoRequest
- internal typealias Output = Echo_EchoResponse
- internal static let descriptor = MethodDescriptor(
- service: "echo.Echo",
- method: "Expand"
- )
- }
- internal enum Collect {
- internal typealias Input = Echo_EchoRequest
- internal typealias Output = Echo_EchoResponse
- internal static let descriptor = MethodDescriptor(
- service: "echo.Echo",
- method: "Collect"
- )
- }
- internal enum Update {
- internal typealias Input = Echo_EchoRequest
- internal typealias Output = Echo_EchoResponse
- internal static let descriptor = MethodDescriptor(
- service: "echo.Echo",
- method: "Update"
- )
- }
- internal static let descriptors: [MethodDescriptor] = [
- Get.descriptor,
- Expand.descriptor,
- Collect.descriptor,
- Update.descriptor
- ]
- }
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal typealias StreamingServiceProtocol = Echo_EchoStreamingServiceProtocol
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal typealias ServiceProtocol = Echo_EchoServiceProtocol
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal typealias ClientProtocol = Echo_EchoClientProtocol
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal typealias Client = Echo_EchoClient
- }
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal protocol Echo_EchoStreamingServiceProtocol: GRPCCore.RegistrableRPCService {
- /// Immediately returns an echo of a request.
- func get(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse>
- /// Splits a request into words and returns each word in a stream of messages.
- func expand(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse>
- /// Collects a stream of messages and returns them concatenated when the caller closes.
- func collect(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse>
- /// Streams back messages as they are received in an input stream.
- func update(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse>
- }
- /// Conformance to `GRPCCore.RegistrableRPCService`.
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- extension Echo_Echo.StreamingServiceProtocol {
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal func registerMethods(with router: inout GRPCCore.RPCRouter) {
- router.registerHandler(
- forMethod: Echo_Echo.Method.Get.descriptor,
- deserializer: ProtobufDeserializer<Echo_EchoRequest>(),
- serializer: ProtobufSerializer<Echo_EchoResponse>(),
- handler: { request in
- try await self.get(request: request)
- }
- )
- router.registerHandler(
- forMethod: Echo_Echo.Method.Expand.descriptor,
- deserializer: ProtobufDeserializer<Echo_EchoRequest>(),
- serializer: ProtobufSerializer<Echo_EchoResponse>(),
- handler: { request in
- try await self.expand(request: request)
- }
- )
- router.registerHandler(
- forMethod: Echo_Echo.Method.Collect.descriptor,
- deserializer: ProtobufDeserializer<Echo_EchoRequest>(),
- serializer: ProtobufSerializer<Echo_EchoResponse>(),
- handler: { request in
- try await self.collect(request: request)
- }
- )
- router.registerHandler(
- forMethod: Echo_Echo.Method.Update.descriptor,
- deserializer: ProtobufDeserializer<Echo_EchoRequest>(),
- serializer: ProtobufSerializer<Echo_EchoResponse>(),
- handler: { request in
- try await self.update(request: request)
- }
- )
- }
- }
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal protocol Echo_EchoServiceProtocol: Echo_Echo.StreamingServiceProtocol {
- /// Immediately returns an echo of a request.
- func get(request: ServerRequest.Single<Echo_EchoRequest>) async throws -> ServerResponse.Single<Echo_EchoResponse>
- /// Splits a request into words and returns each word in a stream of messages.
- func expand(request: ServerRequest.Single<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse>
- /// Collects a stream of messages and returns them concatenated when the caller closes.
- func collect(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Single<Echo_EchoResponse>
- /// Streams back messages as they are received in an input stream.
- func update(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse>
- }
- /// Partial conformance to `Echo_EchoStreamingServiceProtocol`.
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- extension Echo_Echo.ServiceProtocol {
- internal func get(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse> {
- let response = try await self.get(request: ServerRequest.Single(stream: request))
- return ServerResponse.Stream(single: response)
- }
- internal func expand(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse> {
- let response = try await self.expand(request: ServerRequest.Single(stream: request))
- return response
- }
- internal func collect(request: ServerRequest.Stream<Echo_EchoRequest>) async throws -> ServerResponse.Stream<Echo_EchoResponse> {
- let response = try await self.collect(request: request)
- return ServerResponse.Stream(single: response)
- }
- }
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal protocol Echo_EchoClientProtocol: Sendable {
- /// Immediately returns an echo of a request.
- func get<R>(
- request: ClientRequest.Single<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Single<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable
- /// Splits a request into words and returns each word in a stream of messages.
- func expand<R>(
- request: ClientRequest.Single<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Stream<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable
- /// Collects a stream of messages and returns them concatenated when the caller closes.
- func collect<R>(
- request: ClientRequest.Stream<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Single<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable
- /// Streams back messages as they are received in an input stream.
- func update<R>(
- request: ClientRequest.Stream<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Stream<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable
- }
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- extension Echo_Echo.ClientProtocol {
- internal func get<R>(
- request: ClientRequest.Single<Echo_EchoRequest>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.get(
- request: request,
- serializer: ProtobufSerializer<Echo_EchoRequest>(),
- deserializer: ProtobufDeserializer<Echo_EchoResponse>(),
- options: options,
- body
- )
- }
- internal func expand<R>(
- request: ClientRequest.Single<Echo_EchoRequest>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.expand(
- request: request,
- serializer: ProtobufSerializer<Echo_EchoRequest>(),
- deserializer: ProtobufDeserializer<Echo_EchoResponse>(),
- options: options,
- body
- )
- }
- internal func collect<R>(
- request: ClientRequest.Stream<Echo_EchoRequest>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.collect(
- request: request,
- serializer: ProtobufSerializer<Echo_EchoRequest>(),
- deserializer: ProtobufDeserializer<Echo_EchoResponse>(),
- options: options,
- body
- )
- }
- internal func update<R>(
- request: ClientRequest.Stream<Echo_EchoRequest>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.update(
- request: request,
- serializer: ProtobufSerializer<Echo_EchoRequest>(),
- deserializer: ProtobufDeserializer<Echo_EchoResponse>(),
- options: options,
- body
- )
- }
- }
- @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
- internal struct Echo_EchoClient: Echo_Echo.ClientProtocol {
- private let client: GRPCCore.GRPCClient
- internal init(client: GRPCCore.GRPCClient) {
- self.client = client
- }
- /// Immediately returns an echo of a request.
- internal func get<R>(
- request: ClientRequest.Single<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.client.unary(
- request: request,
- descriptor: Echo_Echo.Method.Get.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
- /// Splits a request into words and returns each word in a stream of messages.
- internal func expand<R>(
- request: ClientRequest.Single<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.client.serverStreaming(
- request: request,
- descriptor: Echo_Echo.Method.Expand.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
- /// Collects a stream of messages and returns them concatenated when the caller closes.
- internal func collect<R>(
- request: ClientRequest.Stream<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.client.clientStreaming(
- request: request,
- descriptor: Echo_Echo.Method.Collect.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
- /// Streams back messages as they are received in an input stream.
- internal func update<R>(
- request: ClientRequest.Stream<Echo_EchoRequest>,
- serializer: some MessageSerializer<Echo_EchoRequest>,
- deserializer: some MessageDeserializer<Echo_EchoResponse>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<Echo_EchoResponse>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.client.bidirectionalStreaming(
- request: request,
- descriptor: Echo_Echo.Method.Update.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
- }
|