// 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 Intents
  import Foundation
  #if canImport(FoundationNetworking)
    import FoundationNetworking
  #endif
  import GoogleCloudLocation
  import GoogleCloudWkt
  import GoogleLongRunning
  import GoogleRpc
  import GoogleCloudGax

  /// Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent].
  ///
  /// [google.cloud.dialogflow.cx.v3.Intent]: <doc:Intent>
  ///
  /// @Snippet(path: "IntentsQuickstart")
  public class IntentsClient: Clients.IntentsProtocol {
    let inner: any Clients.IntentsStub
    let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
    let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

    /// Creates a new `IntentsClient` instance.
    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      var inner: any Clients.IntentsStub = try Clients.IntentsTransport(options)
      inner = Clients.IntentsRetry(inner, options: options)
      if let logger = options.logger {
        inner = Clients.IntentsLogging(inner, logger: logger)
      }
      self.inner = inner
      self.pollingErrorPolicy = options.pollingErrorPolicy
      self.pollingBackoffPolicy = options.pollingBackoffPolicy
    }

    /// Returns the list of all intents in the specified agent.
    ///
    /// @Snippet(path: "Intents_ListIntents")
    public func listIntents(
      request: ListIntentsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.ListIntentsResponse {
      try await self.inner.listIntents(request: request, options: options)
    }

    /// Returns the list of all intents in the specified agent.
    ///
    /// @Snippet(path: "Intents_ListIntents")
    public func listIntents(
      byItem: ListIntentsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Intent, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudDialogflowCXV3.ListIntentsResponse in
        var request = byItem
        request.pageToken = token
        return try await self.listIntents(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    /// Retrieves the specified intent.
    ///
    /// @Snippet(path: "Intents_GetIntent")
    public func getIntent(
      request: GetIntentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      try await self.inner.getIntent(request: request, options: options)
    }

    /// Creates an intent in the specified agent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// @Snippet(path: "Intents_CreateIntent")
    public func createIntent(
      request: CreateIntentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      try await self.inner.createIntent(request: request, options: options)
    }

    /// Updates the specified intent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// @Snippet(path: "Intents_UpdateIntent")
    public func updateIntent(
      request: UpdateIntentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      try await self.inner.updateIntent(request: request, options: options)
    }

    /// Deletes the specified intent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// @Snippet(path: "Intents_DeleteIntent")
    public func deleteIntent(
      request: DeleteIntentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self.inner.deleteIntent(request: request, options: options)
    }

    /// Imports the specified intents into the agent.
    ///
    /// 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`:
    /// [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3.ImportIntentsMetadata]
    /// - `response`:
    /// [ImportIntentsResponse][google.cloud.dialogflow.cx.v3.ImportIntentsResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ImportIntentsMetadata]: <doc:ImportIntentsMetadata>
    /// [google.cloud.dialogflow.cx.v3.ImportIntentsResponse]: <doc:ImportIntentsResponse>
    ///
    /// @Snippet(path: "Intents_ImportIntents")
    public func importIntents(
      request: ImportIntentsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self.inner.importIntents(request: request, options: options)
    }

    /// Imports the specified intents into the agent.
    ///
    /// 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`:
    /// [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3.ImportIntentsMetadata]
    /// - `response`:
    /// [ImportIntentsResponse][google.cloud.dialogflow.cx.v3.ImportIntentsResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ImportIntentsMetadata]: <doc:ImportIntentsMetadata>
    /// [google.cloud.dialogflow.cx.v3.ImportIntentsResponse]: <doc:ImportIntentsResponse>
    ///
    /// @Snippet(path: "Intents_ImportIntents")
    public func importIntents(
      withPolling: ImportIntentsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<ImportIntentsResponse> {
      let extractStatus = {
        (op: GoogleLongRunning.Operation) throws
          -> GoogleCloudGax._PollableOperationImpl<ImportIntentsResponse>.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 ImportIntentsResponse(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.importIntents(request: withPolling, options: options)
      let initialState = try extractStatus(rawOp)
      let poll = {
        () async throws -> GoogleCloudGax._PollableOperationImpl<ImportIntentsResponse>.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,
      )
    }

    /// Exports the selected intents.
    ///
    /// 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`:
    /// [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3.ExportIntentsMetadata]
    /// - `response`:
    /// [ExportIntentsResponse][google.cloud.dialogflow.cx.v3.ExportIntentsResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ExportIntentsMetadata]: <doc:ExportIntentsMetadata>
    /// [google.cloud.dialogflow.cx.v3.ExportIntentsResponse]: <doc:ExportIntentsResponse>
    ///
    /// @Snippet(path: "Intents_ExportIntents")
    public func exportIntents(
      request: ExportIntentsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self.inner.exportIntents(request: request, options: options)
    }

    /// Exports the selected intents.
    ///
    /// 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`:
    /// [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3.ExportIntentsMetadata]
    /// - `response`:
    /// [ExportIntentsResponse][google.cloud.dialogflow.cx.v3.ExportIntentsResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ExportIntentsMetadata]: <doc:ExportIntentsMetadata>
    /// [google.cloud.dialogflow.cx.v3.ExportIntentsResponse]: <doc:ExportIntentsResponse>
    ///
    /// @Snippet(path: "Intents_ExportIntents")
    public func exportIntents(
      withPolling: ExportIntentsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<ExportIntentsResponse> {
      let extractStatus = {
        (op: GoogleLongRunning.Operation) throws
          -> GoogleCloudGax._PollableOperationImpl<ExportIntentsResponse>.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 ExportIntentsResponse(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.exportIntents(request: withPolling, options: options)
      let initialState = try extractStatus(rawOp)
      let poll = {
        () async throws -> GoogleCloudGax._PollableOperationImpl<ExportIntentsResponse>.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,
      )
    }

    /// 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: "Intents_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: "Intents_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: "Intents_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: "Intents_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: "Intents_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: "Intents_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: "Intents_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 `IntentsClient`.
    ///
    /// To mock `IntentsClient` change your functions to receive
    /// `some IntentsProtocol` or `any IntentsProtocol`
    /// and pass a mock implementation in your tests.
    public protocol IntentsProtocol {
      /// See `IntentsClient.listIntents`.
      func listIntents(request: ListIntentsRequest) async throws
        -> GoogleCloudDialogflowCXV3.ListIntentsResponse

      /// See `IntentsClient.listIntents`.
      func listIntents(
        byItem: ListIntentsRequest
      ) throws -> any AsyncSequence<Intent, Swift.Error>

      /// See `IntentsClient.listIntents`.
      func listIntents(
        parent: Swift.String,
      ) throws -> any AsyncSequence<Intent, Swift.Error>

      /// See `IntentsClient.getIntent`.
      func getIntent(request: GetIntentRequest) async throws -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.getIntent`.
      func getIntent(
        name: Swift.String,
      ) async throws -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.createIntent`.
      func createIntent(request: CreateIntentRequest) async throws
        -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.createIntent`.
      func createIntent(
        parent: Swift.String,
        intent: Intent?,
      ) async throws -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.updateIntent`.
      func updateIntent(request: UpdateIntentRequest) async throws
        -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.updateIntent`.
      func updateIntent(
        intent: Intent?,
        updateMask: GoogleCloudWkt.FieldMask?,
      ) async throws -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.deleteIntent`.
      func deleteIntent(request: DeleteIntentRequest) async throws

      /// See `IntentsClient.deleteIntent`.
      func deleteIntent(
        name: Swift.String,
      ) async throws

      /// See `IntentsClient.importIntents`.
      func importIntents(request: ImportIntentsRequest) async throws -> GoogleLongRunning.Operation

      /// See `IntentsClient.importIntents`.
      func importIntents(withPolling: ImportIntentsRequest) async throws -> any GoogleCloudGax
        .PollableOperation<ImportIntentsResponse>

      /// See `IntentsClient.exportIntents`.
      func exportIntents(request: ExportIntentsRequest) async throws -> GoogleLongRunning.Operation

      /// See `IntentsClient.exportIntents`.
      func exportIntents(withPolling: ExportIntentsRequest) async throws -> any GoogleCloudGax
        .PollableOperation<ExportIntentsResponse>

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

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

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

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

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

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

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

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

      /// See `IntentsClient.listIntents`.
      func listIntents(
        request: ListIntentsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.ListIntentsResponse

      /// See `IntentsClient.listIntents`.
      func listIntents(
        byItem: ListIntentsRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<Intent, Swift.Error>

      /// See `IntentsClient.getIntent`.
      func getIntent(
        request: GetIntentRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.createIntent`.
      func createIntent(
        request: CreateIntentRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.updateIntent`.
      func updateIntent(
        request: UpdateIntentRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowCXV3.Intent

      /// See `IntentsClient.deleteIntent`.
      func deleteIntent(
        request: DeleteIntentRequest, options: GoogleCloudGax.RequestOptions
      ) async throws

      /// See `IntentsClient.importIntents`.
      func importIntents(
        request: ImportIntentsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      /// See `IntentsClient.importIntents`.
      func importIntents(
        withPolling: ImportIntentsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> any GoogleCloudGax.PollableOperation<ImportIntentsResponse>

      /// See `IntentsClient.exportIntents`.
      func exportIntents(
        request: ExportIntentsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      /// See `IntentsClient.exportIntents`.
      func exportIntents(
        withPolling: ExportIntentsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> any GoogleCloudGax.PollableOperation<ExportIntentsResponse>

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

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

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

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

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

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

  // Default implementations
  extension Clients.IntentsProtocol {
    public func listIntents(request: ListIntentsRequest) async throws
      -> GoogleCloudDialogflowCXV3.ListIntentsResponse
    {
      try await self.listIntents(request: request, options: .init())
    }

    public func listIntents(
      request: ListIntentsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.ListIntentsResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listIntents(
      byItem: ListIntentsRequest
    ) throws -> any AsyncSequence<Intent, Swift.Error> {
      try self.listIntents(byItem: byItem, options: .init())
    }

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

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

    public func getIntent(request: GetIntentRequest) async throws
      -> GoogleCloudDialogflowCXV3.Intent
    {
      try await self.getIntent(request: request, options: .init())
    }

    public func getIntent(
      request: GetIntentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      throw GoogleCloudGax.RequestError.unimplemented
    }

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

    public func createIntent(request: CreateIntentRequest) async throws
      -> GoogleCloudDialogflowCXV3.Intent
    {
      try await self.createIntent(request: request, options: .init())
    }

    public func createIntent(
      request: CreateIntentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func createIntent(
      parent: Swift.String,
      intent: Intent?,
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      let request = CreateIntentRequest().with {
        $0.parent = parent
        $0.intent = intent
      }
      return try await self.createIntent(request: request)
    }

    public func updateIntent(request: UpdateIntentRequest) async throws
      -> GoogleCloudDialogflowCXV3.Intent
    {
      try await self.updateIntent(request: request, options: .init())
    }

    public func updateIntent(
      request: UpdateIntentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func updateIntent(
      intent: Intent?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudDialogflowCXV3.Intent {
      let request = UpdateIntentRequest().with {
        $0.intent = intent
        $0.updateMask = updateMask
      }
      return try await self.updateIntent(request: request)
    }

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

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

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

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

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

    public func importIntents(withPolling: ImportIntentsRequest) async throws -> any GoogleCloudGax
      .PollableOperation<ImportIntentsResponse>
    {
      try await self.importIntents(withPolling: withPolling, options: .init())
    }

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

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

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

    public func exportIntents(withPolling: ExportIntentsRequest) async throws -> any GoogleCloudGax
      .PollableOperation<ExportIntentsResponse>
    {
      try await self.exportIntents(withPolling: withPolling, options: .init())
    }

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

    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
