// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 Google LLC
//
// 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
//
//     https://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.

#if Versions
  import Foundation
  #if canImport(FoundationNetworking)
    import FoundationNetworking
  #endif
  import GoogleCloudLocation
  import GoogleCloudWkt
  import GoogleLongRunning
  import GoogleRpc
  import GoogleCloudGax

  /// Service for managing [Versions][google.cloud.dialogflow.cx.v3.Version].
  ///
  /// [google.cloud.dialogflow.cx.v3.Version]: <doc:Version>
  ///
  /// @Snippet(path: "VersionsQuickstart")
  public class VersionsClient: Clients.VersionsProtocol {
    let inner: any Clients.VersionsStub
    let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
    let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

    /// Creates a new `VersionsClient` instance.
    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      var inner: any Clients.VersionsStub = try Clients.VersionsTransport(options)
      inner = Clients.VersionsRetry(inner, options: options)
      if let logger = options.logger {
        inner = Clients.VersionsLogging(inner, logger: logger)
      }
      self.inner = inner
      self.pollingErrorPolicy = options.pollingErrorPolicy
      self.pollingBackoffPolicy = options.pollingBackoffPolicy
    }

    /// Returns the list of all versions in the specified
    /// [Flow][google.cloud.dialogflow.cx.v3.Flow].
    ///
    /// [google.cloud.dialogflow.cx.v3.Flow]: <doc:Flow>
    ///
    /// @Snippet(path: "Versions_ListVersions")
    public func listVersions(
      request: ListVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.ListVersionsResponse {
      try await self.inner.listVersions(request: request, options: options)
    }

    /// Returns the list of all versions in the specified
    /// [Flow][google.cloud.dialogflow.cx.v3.Flow].
    ///
    /// [google.cloud.dialogflow.cx.v3.Flow]: <doc:Flow>
    ///
    /// @Snippet(path: "Versions_ListVersions")
    public func listVersions(
      byItem: ListVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Version, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudDialogflowCXV3.ListVersionsResponse in
        var request = byItem
        request.pageToken = token
        return try await self.listVersions(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    /// Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version].
    ///
    /// [google.cloud.dialogflow.cx.v3.Version]: <doc:Version>
    ///
    /// @Snippet(path: "Versions_GetVersion")
    public func getVersion(
      request: GetVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Version {
      try await self.inner.getVersion(request: request, options: options)
    }

    /// Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified
    /// [Flow][google.cloud.dialogflow.cx.v3.Flow].
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    /// [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata]
    /// - `response`: [Version][google.cloud.dialogflow.cx.v3.Version]
    ///
    /// [google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata]: <doc:CreateVersionOperationMetadata>
    /// [google.cloud.dialogflow.cx.v3.Flow]: <doc:Flow>
    /// [google.cloud.dialogflow.cx.v3.Version]: <doc:Version>
    ///
    /// @Snippet(path: "Versions_CreateVersion")
    public func createVersion(
      request: CreateVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self.inner.createVersion(request: request, options: options)
    }

    /// Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified
    /// [Flow][google.cloud.dialogflow.cx.v3.Flow].
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    /// [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata]
    /// - `response`: [Version][google.cloud.dialogflow.cx.v3.Version]
    ///
    /// [google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata]: <doc:CreateVersionOperationMetadata>
    /// [google.cloud.dialogflow.cx.v3.Flow]: <doc:Flow>
    /// [google.cloud.dialogflow.cx.v3.Version]: <doc:Version>
    ///
    /// @Snippet(path: "Versions_CreateVersion")
    public func createVersion(
      withPolling: CreateVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Version> {
      let extractStatus = {
        (op: GoogleLongRunning.Operation) throws
          -> GoogleCloudGax._PollableOperationImpl<Version>.State in
        guard op.done else {
          return .init(done: false, result: nil)
        }

        switch op.result {
        case .response(let anyValue):
          guard let anyValueUnwrapped = anyValue else {
            return .init(
              done: true,
              result: .failure(
                GoogleCloudGax.RequestError.binding(
                  "Operation completed but response value was missing")))
          }
          let response = try Version(fromAny: anyValueUnwrapped)
          return .init(done: true, result: .success(response))
        case .error(let status):
          guard let statusUnwrapped = status else {
            return .init(
              done: true,
              result: .failure(
                GoogleCloudGax.RequestError.binding(
                  "Operation completed but error value was missing")))
          }
          let error = GoogleCloudGax.RequestError.service(
            GoogleCloudGax.ServiceError(
              code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
              message: statusUnwrapped.message))
          return .init(done: true, result: .failure(error))
        case .none:
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
        }
      }
      let rawOp = try await self.createVersion(request: withPolling, options: options)
      let initialState = try extractStatus(rawOp)
      let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Version>.State in
        let op = try await self.getOperation(
          request: .init().with { $0.name = rawOp.name }, options: options)
        return try extractStatus(op)
      }
      return GoogleCloudGax._PollableOperationImpl(
        initialState: initialState,
        polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
        backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
        poll: poll,
      )
    }

    /// Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version].
    ///
    /// [google.cloud.dialogflow.cx.v3.Version]: <doc:Version>
    ///
    /// @Snippet(path: "Versions_UpdateVersion")
    public func updateVersion(
      request: UpdateVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Version {
      try await self.inner.updateVersion(request: request, options: options)
    }

    /// Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version].
    ///
    /// [google.cloud.dialogflow.cx.v3.Version]: <doc:Version>
    ///
    /// @Snippet(path: "Versions_DeleteVersion")
    public func deleteVersion(
      request: DeleteVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self.inner.deleteVersion(request: request, options: options)
    }

    /// Loads resources in the specified version to the draft flow.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// @Snippet(path: "Versions_LoadVersion")
    public func loadVersion(
      request: LoadVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self.inner.loadVersion(request: request, options: options)
    }

    /// Loads resources in the specified version to the draft flow.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// @Snippet(path: "Versions_LoadVersion")
    public func loadVersion(
      withPolling: LoadVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
      let extractStatus = {
        (op: GoogleLongRunning.Operation) throws
          -> GoogleCloudGax._PollableOperationImpl<Void>.State in
        guard op.done else {
          return .init(done: false, result: nil)
        }

        switch op.result {
        case .response:
          return .init(done: true, result: .success(()))
        case .error(let status):
          guard let statusUnwrapped = status else {
            return .init(
              done: true,
              result: .failure(
                GoogleCloudGax.RequestError.binding(
                  "Operation completed but error value was missing")))
          }
          let error = GoogleCloudGax.RequestError.service(
            GoogleCloudGax.ServiceError(
              code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
              message: statusUnwrapped.message))
          return .init(done: true, result: .failure(error))
        case .none:
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
        }
      }
      let rawOp = try await self.loadVersion(request: withPolling, options: options)
      let initialState = try extractStatus(rawOp)
      let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Void>.State in
        let op = try await self.getOperation(
          request: .init().with { $0.name = rawOp.name }, options: options)
        return try extractStatus(op)
      }
      return GoogleCloudGax._PollableOperationImpl(
        initialState: initialState,
        polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
        backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
        poll: poll,
      )
    }

    /// Compares the specified base version with target version.
    ///
    /// @Snippet(path: "Versions_CompareVersions")
    public func compareVersions(
      request: CompareVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.CompareVersionsResponse {
      try await self.inner.compareVersions(request: request, options: options)
    }

    /// Lists information about the supported locations for this service.
    ///
    /// This method lists locations based on the resource scope provided in
    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
    /// **Global locations**: If `name` is empty, the method lists the
    /// public locations available to all projects. * **Project-specific
    /// locations**: If `name` follows the format
    /// `projects/{project}`, the method lists locations visible to that
    /// specific project. This includes public, private, or other
    /// project-specific locations enabled for the project.
    ///
    /// For gRPC and client library implementations, the resource name is
    /// passed as the `name` field. For direct service calls, the resource
    /// name is
    /// incorporated into the request path based on the specific service
    /// implementation and version.
    ///
    /// [google.cloud.location.ListLocationsRequest.name]: https://www.google.com/search?q=Swift+google.cloud.location+GoogleCloudLocation.ListLocationsRequest/name
    ///
    /// @Snippet(path: "Versions_ListLocations")
    public func listLocations(
      request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.ListLocationsResponse {
      try await self.inner.listLocations(request: request, options: options)
    }

    /// Lists information about the supported locations for this service.
    ///
    /// This method lists locations based on the resource scope provided in
    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
    /// **Global locations**: If `name` is empty, the method lists the
    /// public locations available to all projects. * **Project-specific
    /// locations**: If `name` follows the format
    /// `projects/{project}`, the method lists locations visible to that
    /// specific project. This includes public, private, or other
    /// project-specific locations enabled for the project.
    ///
    /// For gRPC and client library implementations, the resource name is
    /// passed as the `name` field. For direct service calls, the resource
    /// name is
    /// incorporated into the request path based on the specific service
    /// implementation and version.
    ///
    /// [google.cloud.location.ListLocationsRequest.name]: https://www.google.com/search?q=Swift+google.cloud.location+GoogleCloudLocation.ListLocationsRequest/name
    ///
    /// @Snippet(path: "Versions_ListLocations")
    public func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
        var request = byItem
        request.pageToken = token
        return try await self.listLocations(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    /// Gets information about a location.
    ///
    /// @Snippet(path: "Versions_GetLocation")
    public func getLocation(
      request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.Location {
      try await self.inner.getLocation(request: request, options: options)
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
    ///
    /// @Snippet(path: "Versions_ListOperations")
    public func listOperations(
      request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.ListOperationsResponse {
      try await self.inner.listOperations(request: request, options: options)
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
    ///
    /// @Snippet(path: "Versions_ListOperations")
    public func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
        var request = byItem
        request.pageToken = token
        return try await self.listOperations(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
    ///
    /// @Snippet(path: "Versions_GetOperation")
    func getOperation(
      request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self.inner.getOperation(request: request, options: options)
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
    ///
    /// @Snippet(path: "Versions_CancelOperation")
    public func cancelOperation(
      request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self.inner.cancelOperation(request: request, options: options)
    }
  }

  extension Clients {
    /// A Swift protocol to mock `VersionsClient`.
    ///
    /// To mock `VersionsClient` change your functions to receive
    /// `some VersionsProtocol` or `any VersionsProtocol`
    /// and pass a mock implementation in your tests.
    public protocol VersionsProtocol {
      /// See `VersionsClient.listVersions`.
      func listVersions(request: ListVersionsRequest) async throws
        -> GoogleCloudDialogflowCXV3.ListVersionsResponse

      /// See `VersionsClient.listVersions`.
      func listVersions(
        byItem: ListVersionsRequest
      ) throws -> any AsyncSequence<Version, Swift.Error>

      /// See `VersionsClient.listVersions`.
      func listVersions(
        parent: Swift.String,
      ) throws -> any AsyncSequence<Version, Swift.Error>

      /// See `VersionsClient.getVersion`.
      func getVersion(request: GetVersionRequest) async throws -> GoogleCloudDialogflowCXV3.Version

      /// See `VersionsClient.getVersion`.
      func getVersion(
        name: Swift.String,
      ) async throws -> GoogleCloudDialogflowCXV3.Version

      /// See `VersionsClient.createVersion`.
      func createVersion(request: CreateVersionRequest) async throws -> GoogleLongRunning.Operation

      /// See `VersionsClient.createVersion`.
      func createVersion(withPolling: CreateVersionRequest) async throws -> any GoogleCloudGax
        .PollableOperation<Version>

      /// See `VersionsClient.createVersion`.
      func createVersion(
        parent: Swift.String,
        version: Version?,
      ) async throws -> any GoogleCloudGax.PollableOperation<Version>

      /// See `VersionsClient.updateVersion`.
      func updateVersion(request: UpdateVersionRequest) async throws
        -> GoogleCloudDialogflowCXV3.Version

      /// See `VersionsClient.updateVersion`.
      func updateVersion(
        version: Version?,
        updateMask: GoogleCloudWkt.FieldMask?,
      ) async throws -> GoogleCloudDialogflowCXV3.Version

      /// See `VersionsClient.deleteVersion`.
      func deleteVersion(request: DeleteVersionRequest) async throws

      /// See `VersionsClient.deleteVersion`.
      func deleteVersion(
        name: Swift.String,
      ) async throws

      /// See `VersionsClient.loadVersion`.
      func loadVersion(request: LoadVersionRequest) async throws -> GoogleLongRunning.Operation

      /// See `VersionsClient.loadVersion`.
      func loadVersion(withPolling: LoadVersionRequest) async throws -> any GoogleCloudGax
        .PollableOperation<Void>

      /// See `VersionsClient.loadVersion`.
      func loadVersion(
        name: Swift.String,
      ) async throws -> any GoogleCloudGax.PollableOperation<Void>

      /// See `VersionsClient.compareVersions`.
      func compareVersions(request: CompareVersionsRequest) async throws
        -> GoogleCloudDialogflowCXV3.CompareVersionsResponse

      /// See `VersionsClient.compareVersions`.
      func compareVersions(
        baseVersion: Swift.String,
      ) async throws -> GoogleCloudDialogflowCXV3.CompareVersionsResponse

      /// See `VersionsClient.listLocations`.
      func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
        -> GoogleCloudLocation.ListLocationsResponse

      /// See `VersionsClient.listLocations`.
      func listLocations(
        byItem: GoogleCloudLocation.ListLocationsRequest
      ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

      /// See `VersionsClient.getLocation`.
      func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
        -> GoogleCloudLocation.Location

      /// See `VersionsClient.listOperations`.
      func listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
        -> GoogleLongRunning.ListOperationsResponse

      /// See `VersionsClient.listOperations`.
      func listOperations(
        byItem: GoogleLongRunning.ListOperationsRequest
      ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

      /// See `VersionsClient.listOperations`.
      func listOperations(
        name: Swift.String,
        filter: Swift.String,
      ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

      /// See `VersionsClient.cancelOperation`.
      func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws

      /// See `VersionsClient.cancelOperation`.
      func cancelOperation(
        name: Swift.String,
      ) async throws

      /// See `VersionsClient.listVersions`.
      func listVersions(
        request: ListVersionsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.ListVersionsResponse

      /// See `VersionsClient.listVersions`.
      func listVersions(
        byItem: ListVersionsRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<Version, Swift.Error>

      /// See `VersionsClient.getVersion`.
      func getVersion(
        request: GetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.Version

      /// See `VersionsClient.createVersion`.
      func createVersion(
        request: CreateVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      /// See `VersionsClient.createVersion`.
      func createVersion(
        withPolling: CreateVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> any GoogleCloudGax.PollableOperation<Version>

      /// See `VersionsClient.updateVersion`.
      func updateVersion(
        request: UpdateVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.Version

      /// See `VersionsClient.deleteVersion`.
      func deleteVersion(
        request: DeleteVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws

      /// See `VersionsClient.loadVersion`.
      func loadVersion(
        request: LoadVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      /// See `VersionsClient.loadVersion`.
      func loadVersion(
        withPolling: LoadVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> any GoogleCloudGax.PollableOperation<Void>

      /// See `VersionsClient.compareVersions`.
      func compareVersions(
        request: CompareVersionsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.CompareVersionsResponse

      /// See `VersionsClient.listLocations`.
      func listLocations(
        request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudLocation.ListLocationsResponse

      /// See `VersionsClient.listLocations`.
      func listLocations(
        byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

      /// See `VersionsClient.getLocation`.
      func getLocation(
        request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudLocation.Location

      /// See `VersionsClient.listOperations`.
      func listOperations(
        request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.ListOperationsResponse

      /// See `VersionsClient.listOperations`.
      func listOperations(
        byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

      /// See `VersionsClient.cancelOperation`.
      func cancelOperation(
        request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws
    }
  }

  // Default implementations
  extension Clients.VersionsProtocol {
    public func listVersions(request: ListVersionsRequest) async throws
      -> GoogleCloudDialogflowCXV3.ListVersionsResponse
    {
      try await self.listVersions(request: request, options: .init())
    }

    public func listVersions(
      request: ListVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.ListVersionsResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listVersions(
      byItem: ListVersionsRequest
    ) throws -> any AsyncSequence<Version, Swift.Error> {
      try self.listVersions(byItem: byItem, options: .init())
    }

    public func listVersions(
      byItem: ListVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Version, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudDialogflowCXV3.ListVersionsResponse in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    public func listVersions(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Version, Swift.Error> {
      let request = ListVersionsRequest().with {
        $0.parent = parent
      }
      return try self.listVersions(byItem: request)
    }

    public func getVersion(request: GetVersionRequest) async throws
      -> GoogleCloudDialogflowCXV3.Version
    {
      try await self.getVersion(request: request, options: .init())
    }

    public func getVersion(
      request: GetVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Version {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func getVersion(
      name: Swift.String,
    ) async throws -> GoogleCloudDialogflowCXV3.Version {
      let request = GetVersionRequest().with {
        $0.name = name
      }
      return try await self.getVersion(request: request)
    }

    public func createVersion(request: CreateVersionRequest) async throws
      -> GoogleLongRunning.Operation
    {
      try await self.createVersion(request: request, options: .init())
    }

    public func createVersion(
      request: CreateVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func createVersion(withPolling: CreateVersionRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Version>
    {
      try await self.createVersion(withPolling: withPolling, options: .init())
    }

    public func createVersion(
      withPolling: CreateVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Version> {
      let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Version>.State in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax._PollableOperationImpl(
        initialState: .init(done: false, result: nil), poll: poll)
    }

    public func createVersion(
      parent: Swift.String,
      version: Version?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Version> {
      let request = CreateVersionRequest().with {
        $0.parent = parent
        $0.version = version
      }
      return try await self.createVersion(withPolling: request)
    }

    public func updateVersion(request: UpdateVersionRequest) async throws
      -> GoogleCloudDialogflowCXV3.Version
    {
      try await self.updateVersion(request: request, options: .init())
    }

    public func updateVersion(
      request: UpdateVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Version {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func updateVersion(
      version: Version?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudDialogflowCXV3.Version {
      let request = UpdateVersionRequest().with {
        $0.version = version
        $0.updateMask = updateMask
      }
      return try await self.updateVersion(request: request)
    }

    public func deleteVersion(request: DeleteVersionRequest) async throws {
      try await self.deleteVersion(request: request, options: .init())
    }

    public func deleteVersion(
      request: DeleteVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func deleteVersion(
      name: Swift.String,
    ) async throws {
      let request = DeleteVersionRequest().with {
        $0.name = name
      }
      try await self.deleteVersion(request: request)
    }

    public func loadVersion(request: LoadVersionRequest) async throws -> GoogleLongRunning.Operation
    {
      try await self.loadVersion(request: request, options: .init())
    }

    public func loadVersion(
      request: LoadVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func loadVersion(withPolling: LoadVersionRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Void>
    {
      try await self.loadVersion(withPolling: withPolling, options: .init())
    }

    public func loadVersion(
      withPolling: LoadVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
      let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Void>.State in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax._PollableOperationImpl(
        initialState: .init(done: false, result: nil), poll: poll)
    }

    public func loadVersion(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
      let request = LoadVersionRequest().with {
        $0.name = name
      }
      return try await self.loadVersion(withPolling: request)
    }

    public func compareVersions(request: CompareVersionsRequest) async throws
      -> GoogleCloudDialogflowCXV3.CompareVersionsResponse
    {
      try await self.compareVersions(request: request, options: .init())
    }

    public func compareVersions(
      request: CompareVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.CompareVersionsResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func compareVersions(
      baseVersion: Swift.String,
    ) async throws -> GoogleCloudDialogflowCXV3.CompareVersionsResponse {
      let request = CompareVersionsRequest().with {
        $0.baseVersion = baseVersion
      }
      return try await self.compareVersions(request: request)
    }

    public func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
      -> GoogleCloudLocation.ListLocationsResponse
    {
      try await self.listLocations(request: request, options: .init())
    }

    public func listLocations(
      request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.ListLocationsResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
      try self.listLocations(byItem: byItem, options: .init())
    }

    public func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    public func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
      -> GoogleCloudLocation.Location
    {
      try await self.getLocation(request: request, options: .init())
    }

    public func getLocation(
      request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.Location {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
      -> GoogleLongRunning.ListOperationsResponse
    {
      try await self.listOperations(request: request, options: .init())
    }

    public func listOperations(
      request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.ListOperationsResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
      try self.listOperations(byItem: byItem, options: .init())
    }

    public func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    public func listOperations(
      name: Swift.String,
      filter: Swift.String,
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
      let request = GoogleLongRunning.ListOperationsRequest().with {
        $0.name = name
        $0.filter = filter
      }
      return try self.listOperations(byItem: request)
    }

    public func getOperation(request: GoogleLongRunning.GetOperationRequest) async throws
      -> GoogleLongRunning.Operation
    {
      try await self.getOperation(request: request, options: .init())
    }

    public func getOperation(
      request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func getOperation(
      name: Swift.String,
    ) async throws -> GoogleLongRunning.Operation {
      let request = GoogleLongRunning.GetOperationRequest().with {
        $0.name = name
      }
      return try await self.getOperation(request: request)
    }

    public func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws {
      try await self.cancelOperation(request: request, options: .init())
    }

    public func cancelOperation(
      request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func cancelOperation(
      name: Swift.String,
    ) async throws {
      let request = GoogleLongRunning.CancelOperationRequest().with {
        $0.name = name
      }
      try await self.cancelOperation(request: request)
    }
  }
#endif
