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

  /// Service for managing [DataStore][google.cloud.discoveryengine.v1.DataStore]
  /// configuration.
  ///
  /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
  ///
  /// @Snippet(path: "DataStoreServiceQuickstart")
  public class DataStoreServiceClient: Clients.DataStoreServiceProtocol {
    let inner: any Clients.DataStoreServiceStub
    let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
    let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

    /// Creates a new `DataStoreServiceClient` instance.
    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      var inner: any Clients.DataStoreServiceStub = try Clients.DataStoreServiceTransport(options)
      inner = Clients.DataStoreServiceRetry(inner, options: options)
      if let logger = options.logger {
        inner = Clients.DataStoreServiceLogging(inner, logger: logger)
      }
      self.inner = inner
      self.pollingErrorPolicy = options.pollingErrorPolicy
      self.pollingBackoffPolicy = options.pollingBackoffPolicy
    }

    /// Creates a [DataStore][google.cloud.discoveryengine.v1.DataStore].
    ///
    /// DataStore is for storing
    /// [Documents][google.cloud.discoveryengine.v1.Document]. To serve these
    /// documents for Search, or Recommendation use case, an
    /// [Engine][google.cloud.discoveryengine.v1.Engine] needs to be created
    /// separately.
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    /// [google.cloud.discoveryengine.v1.Document]: <doc:Document>
    /// [google.cloud.discoveryengine.v1.Engine]: <doc:Engine>
    ///
    /// @Snippet(path: "DataStoreService_CreateDataStore")
    public func createDataStore(
      request: CreateDataStoreRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self.inner.createDataStore(request: request, options: options)
    }

    /// Creates a [DataStore][google.cloud.discoveryengine.v1.DataStore].
    ///
    /// DataStore is for storing
    /// [Documents][google.cloud.discoveryengine.v1.Document]. To serve these
    /// documents for Search, or Recommendation use case, an
    /// [Engine][google.cloud.discoveryengine.v1.Engine] needs to be created
    /// separately.
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    /// [google.cloud.discoveryengine.v1.Document]: <doc:Document>
    /// [google.cloud.discoveryengine.v1.Engine]: <doc:Engine>
    ///
    /// @Snippet(path: "DataStoreService_CreateDataStore")
    public func createDataStore(
      withPolling: CreateDataStoreRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<DataStore> {
      let extractStatus = {
        (op: GoogleLongRunning.Operation) throws
          -> GoogleCloudGax._PollableOperationImpl<DataStore>.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 DataStore(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.createDataStore(request: withPolling, options: options)
      let initialState = try extractStatus(rawOp)
      let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<DataStore>.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,
      )
    }

    /// Gets a [DataStore][google.cloud.discoveryengine.v1.DataStore].
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    ///
    /// @Snippet(path: "DataStoreService_GetDataStore")
    public func getDataStore(
      request: GetDataStoreRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore {
      try await self.inner.getDataStore(request: request, options: options)
    }

    /// Lists all the [DataStore][google.cloud.discoveryengine.v1.DataStore]s
    /// associated with the project.
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    ///
    /// @Snippet(path: "DataStoreService_ListDataStores")
    public func listDataStores(
      request: ListDataStoresRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDiscoveryEngineV1.ListDataStoresResponse {
      try await self.inner.listDataStores(request: request, options: options)
    }

    /// Lists all the [DataStore][google.cloud.discoveryengine.v1.DataStore]s
    /// associated with the project.
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    ///
    /// @Snippet(path: "DataStoreService_ListDataStores")
    public func listDataStores(
      byItem: ListDataStoresRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<DataStore, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudDiscoveryEngineV1.ListDataStoresResponse in
        var request = byItem
        request.pageToken = token
        return try await self.listDataStores(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    /// Deletes a [DataStore][google.cloud.discoveryengine.v1.DataStore].
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    ///
    /// @Snippet(path: "DataStoreService_DeleteDataStore")
    public func deleteDataStore(
      request: DeleteDataStoreRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self.inner.deleteDataStore(request: request, options: options)
    }

    /// Deletes a [DataStore][google.cloud.discoveryengine.v1.DataStore].
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    ///
    /// @Snippet(path: "DataStoreService_DeleteDataStore")
    public func deleteDataStore(
      withPolling: DeleteDataStoreRequest, 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.deleteDataStore(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,
      )
    }

    /// Updates a [DataStore][google.cloud.discoveryengine.v1.DataStore]
    ///
    /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
    ///
    /// @Snippet(path: "DataStoreService_UpdateDataStore")
    public func updateDataStore(
      request: UpdateDataStoreRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore {
      try await self.inner.updateDataStore(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: "DataStoreService_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: "DataStoreService_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: "DataStoreService_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: "DataStoreService_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 `DataStoreServiceClient`.
    ///
    /// To mock `DataStoreServiceClient` change your functions to receive
    /// `some DataStoreServiceProtocol` or `any DataStoreServiceProtocol`
    /// and pass a mock implementation in your tests.
    public protocol DataStoreServiceProtocol {
      /// See `DataStoreServiceClient.createDataStore`.
      func createDataStore(request: CreateDataStoreRequest) async throws
        -> GoogleLongRunning.Operation

      /// See `DataStoreServiceClient.createDataStore`.
      func createDataStore(withPolling: CreateDataStoreRequest) async throws -> any GoogleCloudGax
        .PollableOperation<DataStore>

      /// See `DataStoreServiceClient.createDataStore`.
      func createDataStore(
        parent: Swift.String,
        dataStore: DataStore?,
        dataStoreId: Swift.String,
      ) async throws -> any GoogleCloudGax.PollableOperation<DataStore>

      /// See `DataStoreServiceClient.getDataStore`.
      func getDataStore(request: GetDataStoreRequest) async throws
        -> GoogleCloudDiscoveryEngineV1.DataStore

      /// See `DataStoreServiceClient.getDataStore`.
      func getDataStore(
        name: Swift.String,
      ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore

      /// See `DataStoreServiceClient.listDataStores`.
      func listDataStores(request: ListDataStoresRequest) async throws
        -> GoogleCloudDiscoveryEngineV1.ListDataStoresResponse

      /// See `DataStoreServiceClient.listDataStores`.
      func listDataStores(
        byItem: ListDataStoresRequest
      ) throws -> any AsyncSequence<DataStore, Swift.Error>

      /// See `DataStoreServiceClient.listDataStores`.
      func listDataStores(
        parent: Swift.String,
      ) throws -> any AsyncSequence<DataStore, Swift.Error>

      /// See `DataStoreServiceClient.deleteDataStore`.
      func deleteDataStore(request: DeleteDataStoreRequest) async throws
        -> GoogleLongRunning.Operation

      /// See `DataStoreServiceClient.deleteDataStore`.
      func deleteDataStore(withPolling: DeleteDataStoreRequest) async throws -> any GoogleCloudGax
        .PollableOperation<Void>

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

      /// See `DataStoreServiceClient.updateDataStore`.
      func updateDataStore(request: UpdateDataStoreRequest) async throws
        -> GoogleCloudDiscoveryEngineV1.DataStore

      /// See `DataStoreServiceClient.updateDataStore`.
      func updateDataStore(
        dataStore: DataStore?,
        updateMask: GoogleCloudWkt.FieldMask?,
      ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore

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

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

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

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

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

      /// See `DataStoreServiceClient.createDataStore`.
      func createDataStore(
        request: CreateDataStoreRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      /// See `DataStoreServiceClient.createDataStore`.
      func createDataStore(
        withPolling: CreateDataStoreRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> any GoogleCloudGax.PollableOperation<DataStore>

      /// See `DataStoreServiceClient.getDataStore`.
      func getDataStore(
        request: GetDataStoreRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore

      /// See `DataStoreServiceClient.listDataStores`.
      func listDataStores(
        request: ListDataStoresRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDiscoveryEngineV1.ListDataStoresResponse

      /// See `DataStoreServiceClient.listDataStores`.
      func listDataStores(
        byItem: ListDataStoresRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<DataStore, Swift.Error>

      /// See `DataStoreServiceClient.deleteDataStore`.
      func deleteDataStore(
        request: DeleteDataStoreRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      /// See `DataStoreServiceClient.deleteDataStore`.
      func deleteDataStore(
        withPolling: DeleteDataStoreRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> any GoogleCloudGax.PollableOperation<Void>

      /// See `DataStoreServiceClient.updateDataStore`.
      func updateDataStore(
        request: UpdateDataStoreRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore

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

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

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

  // Default implementations
  extension Clients.DataStoreServiceProtocol {
    public func createDataStore(request: CreateDataStoreRequest) async throws
      -> GoogleLongRunning.Operation
    {
      try await self.createDataStore(request: request, options: .init())
    }

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

    public func createDataStore(withPolling: CreateDataStoreRequest) async throws
      -> any GoogleCloudGax.PollableOperation<DataStore>
    {
      try await self.createDataStore(withPolling: withPolling, options: .init())
    }

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

    public func createDataStore(
      parent: Swift.String,
      dataStore: DataStore?,
      dataStoreId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<DataStore> {
      let request = CreateDataStoreRequest().with {
        $0.parent = parent
        $0.dataStore = dataStore
        $0.dataStoreId = dataStoreId
      }
      return try await self.createDataStore(withPolling: request)
    }

    public func getDataStore(request: GetDataStoreRequest) async throws
      -> GoogleCloudDiscoveryEngineV1.DataStore
    {
      try await self.getDataStore(request: request, options: .init())
    }

    public func getDataStore(
      request: GetDataStoreRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func getDataStore(
      name: Swift.String,
    ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore {
      let request = GetDataStoreRequest().with {
        $0.name = name
      }
      return try await self.getDataStore(request: request)
    }

    public func listDataStores(request: ListDataStoresRequest) async throws
      -> GoogleCloudDiscoveryEngineV1.ListDataStoresResponse
    {
      try await self.listDataStores(request: request, options: .init())
    }

    public func listDataStores(
      request: ListDataStoresRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDiscoveryEngineV1.ListDataStoresResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listDataStores(
      byItem: ListDataStoresRequest
    ) throws -> any AsyncSequence<DataStore, Swift.Error> {
      try self.listDataStores(byItem: byItem, options: .init())
    }

    public func listDataStores(
      byItem: ListDataStoresRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<DataStore, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudDiscoveryEngineV1.ListDataStoresResponse in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

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

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

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

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

    public func deleteDataStore(
      withPolling: DeleteDataStoreRequest, 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 deleteDataStore(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
      let request = DeleteDataStoreRequest().with {
        $0.name = name
      }
      return try await self.deleteDataStore(withPolling: request)
    }

    public func updateDataStore(request: UpdateDataStoreRequest) async throws
      -> GoogleCloudDiscoveryEngineV1.DataStore
    {
      try await self.updateDataStore(request: request, options: .init())
    }

    public func updateDataStore(
      request: UpdateDataStoreRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func updateDataStore(
      dataStore: DataStore?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudDiscoveryEngineV1.DataStore {
      let request = UpdateDataStoreRequest().with {
        $0.dataStore = dataStore
        $0.updateMask = updateMask
      }
      return try await self.updateDataStore(request: request)
    }

    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
