// 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.

import Foundation
#if canImport(FoundationNetworking)
  import FoundationNetworking
#endif
import GoogleCloudLocation
import GoogleCloudWkt
import GoogleIAMV1
import GoogleCloudGax

/// Cloud Tasks allows developers to manage the execution of background
/// work in their applications.
///
/// @Snippet(path: "CloudTasksQuickstart")
public class CloudTasksClient: Clients.CloudTasksProtocol {
  let inner: any Clients.CloudTasksStub

  /// Creates a new `CloudTasksClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.CloudTasksStub = try Clients.CloudTasksTransport(options)
    inner = Clients.CloudTasksRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.CloudTasksLogging(inner, logger: logger)
    }
    self.inner = inner
  }

  /// Lists queues.
  ///
  /// Queues are returned in lexicographical order.
  ///
  /// @Snippet(path: "CloudTasks_ListQueues")
  public func listQueues(
    request: ListQueuesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.ListQueuesResponse {
    try await self.inner.listQueues(request: request, options: options)
  }

  /// Lists queues.
  ///
  /// Queues are returned in lexicographical order.
  ///
  /// @Snippet(path: "CloudTasks_ListQueues")
  public func listQueues(
    byItem: ListQueuesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Queue, Swift.Error> {
    let listRpc = { (token: Swift.String) async throws -> GoogleCloudTasksV2.ListQueuesResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listQueues(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets a queue.
  ///
  /// @Snippet(path: "CloudTasks_GetQueue")
  public func getQueue(
    request: GetQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    try await self.inner.getQueue(request: request, options: options)
  }

  /// Creates a queue.
  ///
  /// Queues created with this method allow tasks to live for a maximum of 31
  /// days. After a task is 31 days old, the task will be deleted regardless of
  /// whether it was dispatched or not.
  ///
  /// WARNING: Using this method may have unintended side effects if you are
  /// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
  /// Read
  /// [Overview of Queue Management and
  /// queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
  /// this method.
  ///
  /// @Snippet(path: "CloudTasks_CreateQueue")
  public func createQueue(
    request: CreateQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    try await self.inner.createQueue(request: request, options: options)
  }

  /// Updates a queue.
  ///
  /// This method creates the queue if it does not exist and updates
  /// the queue if it does exist.
  ///
  /// Queues created with this method allow tasks to live for a maximum of 31
  /// days. After a task is 31 days old, the task will be deleted regardless of
  /// whether it was dispatched or not.
  ///
  /// WARNING: Using this method may have unintended side effects if you are
  /// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
  /// Read
  /// [Overview of Queue Management and
  /// queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
  /// this method.
  ///
  /// @Snippet(path: "CloudTasks_UpdateQueue")
  public func updateQueue(
    request: UpdateQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    try await self.inner.updateQueue(request: request, options: options)
  }

  /// Deletes a queue.
  ///
  /// This command will delete the queue even if it has tasks in it.
  ///
  /// Note: If you delete a queue, a queue with the same name can't be created
  /// for 7 days.
  ///
  /// WARNING: Using this method may have unintended side effects if you are
  /// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
  /// Read
  /// [Overview of Queue Management and
  /// queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
  /// this method.
  ///
  /// @Snippet(path: "CloudTasks_DeleteQueue")
  public func deleteQueue(
    request: DeleteQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteQueue(request: request, options: options)
  }

  /// Purges a queue by deleting all of its tasks.
  ///
  /// All tasks created before this method is called are permanently deleted.
  ///
  /// Purge operations can take up to one minute to take effect. Tasks
  /// might be dispatched before the purge takes effect. A purge is irreversible.
  ///
  /// @Snippet(path: "CloudTasks_PurgeQueue")
  public func purgeQueue(
    request: PurgeQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    try await self.inner.purgeQueue(request: request, options: options)
  }

  /// Pauses the queue.
  ///
  /// If a queue is paused then the system will stop dispatching tasks
  /// until the queue is resumed via
  /// [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can
  /// still be added when the queue is paused. A queue is paused if its
  /// [state][google.cloud.tasks.v2.Queue.state] is
  /// [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
  ///
  /// [google.cloud.tasks.v2.CloudTasks.ResumeQueue]: <doc:CloudTasks/resumeQueue(request:)>
  /// [google.cloud.tasks.v2.Queue.State.PAUSED]: <doc:Queue/State/paused>
  /// [google.cloud.tasks.v2.Queue.state]: <doc:Queue/state>
  ///
  /// @Snippet(path: "CloudTasks_PauseQueue")
  public func pauseQueue(
    request: PauseQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    try await self.inner.pauseQueue(request: request, options: options)
  }

  /// Resume a queue.
  ///
  /// This method resumes a queue after it has been
  /// [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or
  /// [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a
  /// queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state];
  /// after calling this method it will be set to
  /// [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING].
  ///
  /// WARNING: Resuming many high-QPS queues at the same time can
  /// lead to target overloading. If you are resuming high-QPS
  /// queues, follow the 500/50/5 pattern described in
  /// [Managing Cloud Tasks Scaling
  /// Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
  ///
  /// [google.cloud.tasks.v2.Queue.State.DISABLED]: <doc:Queue/State/disabled>
  /// [google.cloud.tasks.v2.Queue.State.PAUSED]: <doc:Queue/State/paused>
  /// [google.cloud.tasks.v2.Queue.State.RUNNING]: <doc:Queue/State/running>
  /// [google.cloud.tasks.v2.Queue.state]: <doc:Queue/state>
  ///
  /// @Snippet(path: "CloudTasks_ResumeQueue")
  public func resumeQueue(
    request: ResumeQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    try await self.inner.resumeQueue(request: request, options: options)
  }

  /// Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
  /// Returns an empty policy if the resource exists and does not have a policy
  /// set.
  ///
  /// Authorization requires the following
  /// [Google IAM](https://cloud.google.com/iam) permission on the specified
  /// resource parent:
  ///
  /// * `cloudtasks.queues.getIamPolicy`
  ///
  /// [google.cloud.tasks.v2.Queue]: <doc:Queue>
  ///
  /// @Snippet(path: "CloudTasks_GetIamPolicy")
  public func getIamPolicy(
    request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.getIamPolicy(request: request, options: options)
  }

  /// Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
  /// Replaces any existing policy.
  ///
  /// Note: The Cloud Console does not check queue-level IAM permissions yet.
  /// Project-level permissions are required to use the Cloud Console.
  ///
  /// Authorization requires the following
  /// [Google IAM](https://cloud.google.com/iam) permission on the specified
  /// resource parent:
  ///
  /// * `cloudtasks.queues.setIamPolicy`
  ///
  /// [google.cloud.tasks.v2.Queue]: <doc:Queue>
  ///
  /// @Snippet(path: "CloudTasks_SetIamPolicy")
  public func setIamPolicy(
    request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.setIamPolicy(request: request, options: options)
  }

  /// Returns permissions that a caller has on a
  /// [Queue][google.cloud.tasks.v2.Queue]. If the resource does not exist, this
  /// will return an empty set of permissions, not a
  /// [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
  ///
  /// Note: This operation is designed to be used for building permission-aware
  /// UIs and command-line tools, not for authorization checking. This operation
  /// may "fail open" without warning.
  ///
  /// [google.cloud.tasks.v2.Queue]: <doc:Queue>
  ///
  /// @Snippet(path: "CloudTasks_TestIamPermissions")
  public func testIamPermissions(
    request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    try await self.inner.testIamPermissions(request: request, options: options)
  }

  /// Lists the tasks in a queue.
  ///
  /// By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is
  /// retrieved due to performance considerations;
  /// [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view]
  /// controls the subset of information which is returned.
  ///
  /// The tasks may be returned in any order. The ordering may change at any
  /// time.
  ///
  /// [google.cloud.tasks.v2.ListTasksRequest.response_view]: <doc:ListTasksRequest/responseView>
  /// [google.cloud.tasks.v2.Task.View.BASIC]: <doc:Task/View/basic>
  ///
  /// @Snippet(path: "CloudTasks_ListTasks")
  public func listTasks(
    request: ListTasksRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.ListTasksResponse {
    try await self.inner.listTasks(request: request, options: options)
  }

  /// Lists the tasks in a queue.
  ///
  /// By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is
  /// retrieved due to performance considerations;
  /// [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view]
  /// controls the subset of information which is returned.
  ///
  /// The tasks may be returned in any order. The ordering may change at any
  /// time.
  ///
  /// [google.cloud.tasks.v2.ListTasksRequest.response_view]: <doc:ListTasksRequest/responseView>
  /// [google.cloud.tasks.v2.Task.View.BASIC]: <doc:Task/View/basic>
  ///
  /// @Snippet(path: "CloudTasks_ListTasks")
  public func listTasks(
    byItem: ListTasksRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Task, Swift.Error> {
    let listRpc = { (token: Swift.String) async throws -> GoogleCloudTasksV2.ListTasksResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listTasks(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets a task.
  ///
  /// @Snippet(path: "CloudTasks_GetTask")
  public func getTask(
    request: GetTaskRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Task {
    try await self.inner.getTask(request: request, options: options)
  }

  /// Creates a task and adds it to a queue.
  ///
  /// Tasks cannot be updated after creation; there is no UpdateTask command.
  ///
  /// * The maximum task size is 100KB.
  ///
  /// @Snippet(path: "CloudTasks_CreateTask")
  public func createTask(
    request: CreateTaskRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Task {
    try await self.inner.createTask(request: request, options: options)
  }

  /// Deletes a task.
  ///
  /// A task can be deleted if it is scheduled or dispatched. A task
  /// cannot be deleted if it has executed successfully or permanently
  /// failed.
  ///
  /// @Snippet(path: "CloudTasks_DeleteTask")
  public func deleteTask(
    request: DeleteTaskRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteTask(request: request, options: options)
  }

  /// Forces a task to run now.
  ///
  /// When this method is called, Cloud Tasks will dispatch the task, even if
  /// the task is already running, the queue has reached its
  /// [RateLimits][google.cloud.tasks.v2.RateLimits] or is
  /// [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
  ///
  /// This command is meant to be used for manual debugging. For
  /// example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to
  /// retry a failed task after a fix has been made or to manually force a task
  /// to be dispatched now.
  ///
  /// The dispatched task is returned. That is, the task that is returned
  /// contains the [status][Task.status] after the task is dispatched but
  /// before the task is received by its target.
  ///
  /// If Cloud Tasks receives a successful response from the task's
  /// target, then the task will be deleted; otherwise the task's
  /// [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to
  /// the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was
  /// called plus the retry delay specified in the queue's
  /// [RetryConfig][google.cloud.tasks.v2.RetryConfig].
  ///
  /// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns
  /// [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
  /// task that has already succeeded or permanently failed.
  ///
  /// [google.cloud.tasks.v2.CloudTasks.RunTask]: <doc:CloudTasks/runTask(request:)>
  /// [google.cloud.tasks.v2.Queue.State.PAUSED]: <doc:Queue/State/paused>
  /// [google.cloud.tasks.v2.RateLimits]: <doc:RateLimits>
  /// [google.cloud.tasks.v2.RetryConfig]: <doc:RetryConfig>
  /// [google.cloud.tasks.v2.Task.schedule_time]: <doc:Task/scheduleTime>
  ///
  /// @Snippet(path: "CloudTasks_RunTask")
  public func runTask(
    request: RunTaskRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Task {
    try await self.inner.runTask(request: request, options: options)
  }

  /// Lists information about the supported locations for this service.
  ///
  /// @Snippet(path: "CloudTasks_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.
  ///
  /// @Snippet(path: "CloudTasks_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: "CloudTasks_GetLocation")
  public func getLocation(
    request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.Location {
    try await self.inner.getLocation(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `CloudTasksClient`.
  ///
  /// To mock `CloudTasksClient` change your functions to receive
  /// `some CloudTasksProtocol` or `any CloudTasksProtocol`
  /// and pass a mock implementation in your tests.
  public protocol CloudTasksProtocol {
    /// See `CloudTasksClient.listQueues`.
    func listQueues(request: ListQueuesRequest) async throws
      -> GoogleCloudTasksV2.ListQueuesResponse

    /// See `CloudTasksClient.listQueues`.
    func listQueues(
      byItem: ListQueuesRequest
    ) throws -> any AsyncSequence<Queue, Swift.Error>

    /// See `CloudTasksClient.listQueues`.
    func listQueues(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Queue, Swift.Error>

    /// See `CloudTasksClient.getQueue`.
    func getQueue(request: GetQueueRequest) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.getQueue`.
    func getQueue(
      name: Swift.String,
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.createQueue`.
    func createQueue(request: CreateQueueRequest) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.createQueue`.
    func createQueue(
      parent: Swift.String,
      queue: Queue?,
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.updateQueue`.
    func updateQueue(request: UpdateQueueRequest) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.updateQueue`.
    func updateQueue(
      queue: Queue?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.deleteQueue`.
    func deleteQueue(request: DeleteQueueRequest) async throws

    /// See `CloudTasksClient.deleteQueue`.
    func deleteQueue(
      name: Swift.String,
    ) async throws

    /// See `CloudTasksClient.purgeQueue`.
    func purgeQueue(request: PurgeQueueRequest) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.purgeQueue`.
    func purgeQueue(
      name: Swift.String,
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.pauseQueue`.
    func pauseQueue(request: PauseQueueRequest) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.pauseQueue`.
    func pauseQueue(
      name: Swift.String,
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.resumeQueue`.
    func resumeQueue(request: ResumeQueueRequest) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.resumeQueue`.
    func resumeQueue(
      name: Swift.String,
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.getIamPolicy`.
    func getIamPolicy(request: GoogleIAMV1.GetIamPolicyRequest) async throws -> GoogleIAMV1.Policy

    /// See `CloudTasksClient.getIamPolicy`.
    func getIamPolicy(
      resource: Swift.String,
    ) async throws -> GoogleIAMV1.Policy

    /// See `CloudTasksClient.setIamPolicy`.
    func setIamPolicy(request: GoogleIAMV1.SetIamPolicyRequest) async throws -> GoogleIAMV1.Policy

    /// See `CloudTasksClient.setIamPolicy`.
    func setIamPolicy(
      resource: Swift.String,
      policy: GoogleIAMV1.Policy?,
    ) async throws -> GoogleIAMV1.Policy

    /// See `CloudTasksClient.testIamPermissions`.
    func testIamPermissions(request: GoogleIAMV1.TestIamPermissionsRequest) async throws
      -> GoogleIAMV1.TestIamPermissionsResponse

    /// See `CloudTasksClient.testIamPermissions`.
    func testIamPermissions(
      resource: Swift.String,
      permissions: [Swift.String],
    ) async throws -> GoogleIAMV1.TestIamPermissionsResponse

    /// See `CloudTasksClient.listTasks`.
    func listTasks(request: ListTasksRequest) async throws -> GoogleCloudTasksV2.ListTasksResponse

    /// See `CloudTasksClient.listTasks`.
    func listTasks(
      byItem: ListTasksRequest
    ) throws -> any AsyncSequence<Task, Swift.Error>

    /// See `CloudTasksClient.listTasks`.
    func listTasks(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Task, Swift.Error>

    /// See `CloudTasksClient.getTask`.
    func getTask(request: GetTaskRequest) async throws -> GoogleCloudTasksV2.Task

    /// See `CloudTasksClient.getTask`.
    func getTask(
      name: Swift.String,
    ) async throws -> GoogleCloudTasksV2.Task

    /// See `CloudTasksClient.createTask`.
    func createTask(request: CreateTaskRequest) async throws -> GoogleCloudTasksV2.Task

    /// See `CloudTasksClient.createTask`.
    func createTask(
      parent: Swift.String,
      task: Task?,
    ) async throws -> GoogleCloudTasksV2.Task

    /// See `CloudTasksClient.deleteTask`.
    func deleteTask(request: DeleteTaskRequest) async throws

    /// See `CloudTasksClient.deleteTask`.
    func deleteTask(
      name: Swift.String,
    ) async throws

    /// See `CloudTasksClient.runTask`.
    func runTask(request: RunTaskRequest) async throws -> GoogleCloudTasksV2.Task

    /// See `CloudTasksClient.runTask`.
    func runTask(
      name: Swift.String,
    ) async throws -> GoogleCloudTasksV2.Task

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

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

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

    /// See `CloudTasksClient.listQueues`.
    func listQueues(
      request: ListQueuesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.ListQueuesResponse

    /// See `CloudTasksClient.listQueues`.
    func listQueues(
      byItem: ListQueuesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Queue, Swift.Error>

    /// See `CloudTasksClient.getQueue`.
    func getQueue(
      request: GetQueueRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.createQueue`.
    func createQueue(
      request: CreateQueueRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.updateQueue`.
    func updateQueue(
      request: UpdateQueueRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.deleteQueue`.
    func deleteQueue(
      request: DeleteQueueRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    /// See `CloudTasksClient.purgeQueue`.
    func purgeQueue(
      request: PurgeQueueRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.pauseQueue`.
    func pauseQueue(
      request: PauseQueueRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.resumeQueue`.
    func resumeQueue(
      request: ResumeQueueRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Queue

    /// See `CloudTasksClient.getIamPolicy`.
    func getIamPolicy(
      request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy

    /// See `CloudTasksClient.setIamPolicy`.
    func setIamPolicy(
      request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy

    /// See `CloudTasksClient.testIamPermissions`.
    func testIamPermissions(
      request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.TestIamPermissionsResponse

    /// See `CloudTasksClient.listTasks`.
    func listTasks(
      request: ListTasksRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.ListTasksResponse

    /// See `CloudTasksClient.listTasks`.
    func listTasks(
      byItem: ListTasksRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Task, Swift.Error>

    /// See `CloudTasksClient.getTask`.
    func getTask(
      request: GetTaskRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Task

    /// See `CloudTasksClient.createTask`.
    func createTask(
      request: CreateTaskRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Task

    /// See `CloudTasksClient.deleteTask`.
    func deleteTask(
      request: DeleteTaskRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    /// See `CloudTasksClient.runTask`.
    func runTask(
      request: RunTaskRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudTasksV2.Task

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

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

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

// Default implementations
extension Clients.CloudTasksProtocol {
  public func listQueues(request: ListQueuesRequest) async throws
    -> GoogleCloudTasksV2.ListQueuesResponse
  {
    try await self.listQueues(request: request, options: .init())
  }

  public func listQueues(
    request: ListQueuesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.ListQueuesResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listQueues(
    byItem: ListQueuesRequest
  ) throws -> any AsyncSequence<Queue, Swift.Error> {
    try self.listQueues(byItem: byItem, options: .init())
  }

  public func listQueues(
    byItem: ListQueuesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Queue, Swift.Error> {
    let listRpc = { (token: Swift.String) async throws -> GoogleCloudTasksV2.ListQueuesResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getQueue(request: GetQueueRequest) async throws -> GoogleCloudTasksV2.Queue {
    try await self.getQueue(request: request, options: .init())
  }

  public func getQueue(
    request: GetQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getQueue(
    name: Swift.String,
  ) async throws -> GoogleCloudTasksV2.Queue {
    let request = GetQueueRequest().with {
      $0.name = name
    }
    return try await self.getQueue(request: request)
  }

  public func createQueue(request: CreateQueueRequest) async throws -> GoogleCloudTasksV2.Queue {
    try await self.createQueue(request: request, options: .init())
  }

  public func createQueue(
    request: CreateQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createQueue(
    parent: Swift.String,
    queue: Queue?,
  ) async throws -> GoogleCloudTasksV2.Queue {
    let request = CreateQueueRequest().with {
      $0.parent = parent
      $0.queue = queue
    }
    return try await self.createQueue(request: request)
  }

  public func updateQueue(request: UpdateQueueRequest) async throws -> GoogleCloudTasksV2.Queue {
    try await self.updateQueue(request: request, options: .init())
  }

  public func updateQueue(
    request: UpdateQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updateQueue(
    queue: Queue?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> GoogleCloudTasksV2.Queue {
    let request = UpdateQueueRequest().with {
      $0.queue = queue
      $0.updateMask = updateMask
    }
    return try await self.updateQueue(request: request)
  }

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

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

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

  public func purgeQueue(request: PurgeQueueRequest) async throws -> GoogleCloudTasksV2.Queue {
    try await self.purgeQueue(request: request, options: .init())
  }

  public func purgeQueue(
    request: PurgeQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func purgeQueue(
    name: Swift.String,
  ) async throws -> GoogleCloudTasksV2.Queue {
    let request = PurgeQueueRequest().with {
      $0.name = name
    }
    return try await self.purgeQueue(request: request)
  }

  public func pauseQueue(request: PauseQueueRequest) async throws -> GoogleCloudTasksV2.Queue {
    try await self.pauseQueue(request: request, options: .init())
  }

  public func pauseQueue(
    request: PauseQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func pauseQueue(
    name: Swift.String,
  ) async throws -> GoogleCloudTasksV2.Queue {
    let request = PauseQueueRequest().with {
      $0.name = name
    }
    return try await self.pauseQueue(request: request)
  }

  public func resumeQueue(request: ResumeQueueRequest) async throws -> GoogleCloudTasksV2.Queue {
    try await self.resumeQueue(request: request, options: .init())
  }

  public func resumeQueue(
    request: ResumeQueueRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Queue {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func resumeQueue(
    name: Swift.String,
  ) async throws -> GoogleCloudTasksV2.Queue {
    let request = ResumeQueueRequest().with {
      $0.name = name
    }
    return try await self.resumeQueue(request: request)
  }

  public func getIamPolicy(request: GoogleIAMV1.GetIamPolicyRequest) async throws
    -> GoogleIAMV1.Policy
  {
    try await self.getIamPolicy(request: request, options: .init())
  }

  public func getIamPolicy(
    request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getIamPolicy(
    resource: Swift.String,
  ) async throws -> GoogleIAMV1.Policy {
    let request = GoogleIAMV1.GetIamPolicyRequest().with {
      $0.resource = resource
    }
    return try await self.getIamPolicy(request: request)
  }

  public func setIamPolicy(request: GoogleIAMV1.SetIamPolicyRequest) async throws
    -> GoogleIAMV1.Policy
  {
    try await self.setIamPolicy(request: request, options: .init())
  }

  public func setIamPolicy(
    request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func setIamPolicy(
    resource: Swift.String,
    policy: GoogleIAMV1.Policy?,
  ) async throws -> GoogleIAMV1.Policy {
    let request = GoogleIAMV1.SetIamPolicyRequest().with {
      $0.resource = resource
      $0.policy = policy
    }
    return try await self.setIamPolicy(request: request)
  }

  public func testIamPermissions(request: GoogleIAMV1.TestIamPermissionsRequest) async throws
    -> GoogleIAMV1.TestIamPermissionsResponse
  {
    try await self.testIamPermissions(request: request, options: .init())
  }

  public func testIamPermissions(
    request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func testIamPermissions(
    resource: Swift.String,
    permissions: [Swift.String],
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    let request = GoogleIAMV1.TestIamPermissionsRequest().with {
      $0.resource = resource
      $0.permissions = permissions
    }
    return try await self.testIamPermissions(request: request)
  }

  public func listTasks(request: ListTasksRequest) async throws
    -> GoogleCloudTasksV2.ListTasksResponse
  {
    try await self.listTasks(request: request, options: .init())
  }

  public func listTasks(
    request: ListTasksRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.ListTasksResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listTasks(
    byItem: ListTasksRequest
  ) throws -> any AsyncSequence<Task, Swift.Error> {
    try self.listTasks(byItem: byItem, options: .init())
  }

  public func listTasks(
    byItem: ListTasksRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Task, Swift.Error> {
    let listRpc = { (token: Swift.String) async throws -> GoogleCloudTasksV2.ListTasksResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getTask(request: GetTaskRequest) async throws -> GoogleCloudTasksV2.Task {
    try await self.getTask(request: request, options: .init())
  }

  public func getTask(
    request: GetTaskRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Task {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getTask(
    name: Swift.String,
  ) async throws -> GoogleCloudTasksV2.Task {
    let request = GetTaskRequest().with {
      $0.name = name
    }
    return try await self.getTask(request: request)
  }

  public func createTask(request: CreateTaskRequest) async throws -> GoogleCloudTasksV2.Task {
    try await self.createTask(request: request, options: .init())
  }

  public func createTask(
    request: CreateTaskRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Task {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createTask(
    parent: Swift.String,
    task: Task?,
  ) async throws -> GoogleCloudTasksV2.Task {
    let request = CreateTaskRequest().with {
      $0.parent = parent
      $0.task = task
    }
    return try await self.createTask(request: request)
  }

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

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

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

  public func runTask(request: RunTaskRequest) async throws -> GoogleCloudTasksV2.Task {
    try await self.runTask(request: request, options: .init())
  }

  public func runTask(
    request: RunTaskRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudTasksV2.Task {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func runTask(
    name: Swift.String,
  ) async throws -> GoogleCloudTasksV2.Task {
    let request = RunTaskRequest().with {
      $0.name = name
    }
    return try await self.runTask(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
  }
}
