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

  extension Clients {
    protocol DatasetServiceStub {
      func createDataset(
        request: CreateDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func getDataset(
        request: GetDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.Dataset

      func updateDataset(
        request: UpdateDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.Dataset

      func listDatasets(
        request: ListDatasetsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListDatasetsResponse

      func deleteDataset(
        request: DeleteDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func importData(
        request: ImportDataRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func exportData(
        request: ExportDataRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func createDatasetVersion(
        request: CreateDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func updateDatasetVersion(
        request: UpdateDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.DatasetVersion

      func deleteDatasetVersion(
        request: DeleteDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func getDatasetVersion(
        request: GetDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.DatasetVersion

      func listDatasetVersions(
        request: ListDatasetVersionsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListDatasetVersionsResponse

      func restoreDatasetVersion(
        request: RestoreDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func listDataItems(
        request: ListDataItemsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListDataItemsResponse

      func searchDataItems(
        request: SearchDataItemsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.SearchDataItemsResponse

      func listSavedQueries(
        request: ListSavedQueriesRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListSavedQueriesResponse

      func deleteSavedQuery(
        request: DeleteSavedQueryRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func getAnnotationSpec(
        request: GetAnnotationSpecRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.AnnotationSpec

      func listAnnotations(
        request: ListAnnotationsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListAnnotationsResponse

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

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

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

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

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

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

      func getOperation(
        request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation

      func deleteOperation(
        request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws

      func cancelOperation(
        request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws

      func waitOperation(
        request: GoogleLongRunning.WaitOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation
    }

    class DatasetServiceTransport: DatasetServiceStub {
      let inner: GoogleCloudGax.HTTPClient

      public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
        self.inner = try GoogleCloudGax.HTTPClient(
          from: options, withDefaultEndpoint: "https://aiplatform.googleapis.com")
      }

      public func createDataset(
        request: CreateDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
          }
          return "/v1/\(pathVariable0)/datasets"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.dataset {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func getDataset(
        request: GetDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.Dataset {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.Dataset.self, from: data)
      }

      public func updateDataset(
        request: UpdateDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.Dataset {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.dataset.map({ $0.name }), !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding(
              "'request.dataset.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.updateMask, prefix: "updateMask"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "PATCH"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.dataset {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.Dataset.self, from: data)
      }

      public func listDatasets(
        request: ListDatasetsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListDatasetsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
          }
          return "/v1/\(pathVariable0)/datasets"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.ListDatasetsResponse.self, from: data)
      }

      public func deleteDataset(
        request: DeleteDatasetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "DELETE"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func importData(
        request: ImportDataRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0):import"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        req.setValue("application/json", forHTTPHeaderField: "Content-Type")
        req.httpBody = try JSONEncoder().encode(request)
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func exportData(
        request: ExportDataRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0):export"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        req.setValue("application/json", forHTTPHeaderField: "Content-Type")
        req.httpBody = try JSONEncoder().encode(request)
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func createDatasetVersion(
        request: CreateDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
          }
          return "/v1/\(pathVariable0)/datasetVersions"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.datasetVersion {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func updateDatasetVersion(
        request: UpdateDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.DatasetVersion {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.datasetVersion.map({ $0.name }), !pathVariable0.isEmpty
          else {
            throw GoogleCloudGax.RequestError.binding(
              "'request.dataset_version.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.updateMask, prefix: "updateMask"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "PATCH"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.datasetVersion {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.DatasetVersion.self, from: data)
      }

      public func deleteDatasetVersion(
        request: DeleteDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "DELETE"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func getDatasetVersion(
        request: GetDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.DatasetVersion {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.DatasetVersion.self, from: data)
      }

      public func listDatasetVersions(
        request: ListDatasetVersionsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListDatasetVersionsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
          }
          return "/v1/\(pathVariable0)/datasetVersions"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.ListDatasetVersionsResponse.self, from: data)
      }

      public func restoreDatasetVersion(
        request: RestoreDatasetVersionRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0):restore"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func listDataItems(
        request: ListDataItemsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListDataItemsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
          }
          return "/v1/\(pathVariable0)/dataItems"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.ListDataItemsResponse.self, from: data)
      }

      public func searchDataItems(
        request: SearchDataItemsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.SearchDataItemsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.dataset as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.dataset' is not set or is empty")
          }
          return "/v1/\(pathVariable0):searchDataItems"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(
          contentsOf: try encoder.encode(
            request.order.flatMap { (oneof) -> Swift.String? in
              if case let .orderByDataItem(v) = oneof { v } else { nil }
            }, prefix: "orderByDataItem"))
        query.append(
          contentsOf: try encoder.encode(
            request.order.flatMap { (oneof) -> SearchDataItemsRequest.OrderByAnnotation? in
              if case let .orderByAnnotation(v) = oneof { v } else { nil }
            }, prefix: "orderByAnnotation"))
        query.append(contentsOf: try encoder.encode(request.savedQuery, prefix: "savedQuery"))
        query.append(
          contentsOf: try encoder.encode(request.dataLabelingJob, prefix: "dataLabelingJob"))
        query.append(
          contentsOf: try encoder.encode(request.dataItemFilter, prefix: "dataItemFilter"))
        query.append(
          contentsOf: try encoder.encode(request.annotationsFilter, prefix: "annotationsFilter"))
        query.append(
          contentsOf: try encoder.encode(request.annotationFilters, prefix: "annotationFilters"))
        query.append(contentsOf: try encoder.encode(request.fieldMask, prefix: "fieldMask"))
        query.append(
          contentsOf: try encoder.encode(request.annotationsLimit, prefix: "annotationsLimit"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.SearchDataItemsResponse.self, from: data)
      }

      public func listSavedQueries(
        request: ListSavedQueriesRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListSavedQueriesResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
          }
          return "/v1/\(pathVariable0)/savedQueries"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.ListSavedQueriesResponse.self, from: data)
      }

      public func deleteSavedQuery(
        request: DeleteSavedQueryRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "DELETE"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func getAnnotationSpec(
        request: GetAnnotationSpecRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.AnnotationSpec {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/v1/\(pathVariable0)"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.AnnotationSpec.self, from: data)
      }

      public func listAnnotations(
        request: ListAnnotationsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudAIPlatformV1.ListAnnotationsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
          }
          return "/v1/\(pathVariable0)/annotations"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(contentsOf: try encoder.encode(request.readMask, prefix: "readMask"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudAIPlatformV1.ListAnnotationsResponse.self, from: data)
      }

      public func listLocations(
        request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudLocation.ListLocationsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/ui/\(pathVariable0)/locations"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudLocation.ListLocationsResponse.self, from: data)
      }

      public func getLocation(
        request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudLocation.Location {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/ui/\(pathVariable0)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudLocation.Location.self, from: data)
      }

      public func setIamPolicy(
        request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleIAMV1.Policy {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.resource as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.resource' is not set or is empty")
          }
          return "/v1/\(pathVariable0):setIamPolicy"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        req.setValue("application/json", forHTTPHeaderField: "Content-Type")
        req.httpBody = try JSONEncoder().encode(request)
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleIAMV1.Policy.self, from: data)
      }

      public func getIamPolicy(
        request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleIAMV1.Policy {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.resource as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.resource' is not set or is empty")
          }
          return "/v1/\(pathVariable0):getIamPolicy"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.options, prefix: "options"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleIAMV1.Policy.self, from: data)
      }

      public func testIamPermissions(
        request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.resource as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.resource' is not set or is empty")
          }
          return "/v1/\(pathVariable0):testIamPermissions"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.permissions, prefix: "permissions"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleIAMV1.TestIamPermissionsResponse.self, from: data)
      }

      public func listOperations(
        request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.ListOperationsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/ui/\(pathVariable0)/operations"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(
          contentsOf: try encoder.encode(
            request.returnPartialSuccess, prefix: "returnPartialSuccess"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.ListOperationsResponse.self, from: data)
      }

      public func getOperation(
        request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/ui/\(pathVariable0)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }

      public func deleteOperation(
        request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/ui/\(pathVariable0)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "DELETE"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        _ = try await self.inner.rpc(for: req).get()
      }

      public func cancelOperation(
        request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/ui/\(pathVariable0):cancel"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        _ = try await self.inner.rpc(for: req).get()
      }

      public func waitOperation(
        request: GoogleLongRunning.WaitOperationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleLongRunning.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
          }
          return "/ui/\(pathVariable0):wait"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.timeout, prefix: "timeout"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleLongRunning.Operation.self, from: data)
      }
    }
  }
#endif
