// 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 GoogleCloudWkt
import GoogleIAMV1
import GoogleLongRunning
import GoogleRpc
import GoogleCloudGax

extension Clients {
  protocol AnalyticsHubServiceStub {
    func listDataExchanges(
      request: ListDataExchangesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListDataExchangesResponse

    func listOrgDataExchanges(
      request: ListOrgDataExchangesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListOrgDataExchangesResponse

    func getDataExchange(
      request: GetDataExchangeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.DataExchange

    func createDataExchange(
      request: CreateDataExchangeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.DataExchange

    func updateDataExchange(
      request: UpdateDataExchangeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.DataExchange

    func deleteDataExchange(
      request: DeleteDataExchangeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    func listListings(
      request: ListListingsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListListingsResponse

    func getListing(
      request: GetListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Listing

    func createListing(
      request: CreateListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Listing

    func updateListing(
      request: UpdateListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Listing

    func deleteListing(
      request: DeleteListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    func subscribeListing(
      request: SubscribeListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.SubscribeListingResponse

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

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

    func getSubscription(
      request: GetSubscriptionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Subscription

    func listSubscriptions(
      request: ListSubscriptionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListSubscriptionsResponse

    func listSharedResourceSubscriptions(
      request: ListSharedResourceSubscriptionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListSharedResourceSubscriptionsResponse

    func revokeSubscription(
      request: RevokeSubscriptionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.RevokeSubscriptionResponse

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

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

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

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

    func createQueryTemplate(
      request: CreateQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate

    func getQueryTemplate(
      request: GetQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate

    func listQueryTemplates(
      request: ListQueryTemplatesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListQueryTemplatesResponse

    func updateQueryTemplate(
      request: UpdateQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate

    func deleteQueryTemplate(
      request: DeleteQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    func submitQueryTemplate(
      request: SubmitQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate

    func approveQueryTemplate(
      request: ApproveQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate

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

  class AnalyticsHubServiceTransport: AnalyticsHubServiceStub {
    let inner: GoogleCloudGax.HTTPClient

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

    public func listDataExchanges(
      request: ListDataExchangesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListDataExchangesResponse {
      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)/dataExchanges"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      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(
        GoogleBigQueryAnalyticsHubV1.ListDataExchangesResponse.self, from: data)
    }

    public func listOrgDataExchanges(
      request: ListOrgDataExchangesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListOrgDataExchangesResponse {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.organization as Swift.String?, !pathVariable0.isEmpty
        else {
          throw GoogleCloudGax.RequestError.binding("'request.organization' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/dataExchanges"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      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(
        GoogleBigQueryAnalyticsHubV1.ListOrgDataExchangesResponse.self, from: data)
    }

    public func getDataExchange(
      request: GetDataExchangeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.DataExchange {
      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 = "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(
        GoogleBigQueryAnalyticsHubV1.DataExchange.self, from: data)
    }

    public func createDataExchange(
      request: CreateDataExchangeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.DataExchange {
      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)/dataExchanges"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.dataExchangeId, prefix: "dataExchangeId"))
      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.dataExchange {
        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(
        GoogleBigQueryAnalyticsHubV1.DataExchange.self, from: data)
    }

    public func updateDataExchange(
      request: UpdateDataExchangeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.DataExchange {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.dataExchange.map({ $0.name }), !pathVariable0.isEmpty
        else {
          throw GoogleCloudGax.RequestError.binding(
            "'request.data_exchange.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.dataExchange {
        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(
        GoogleBigQueryAnalyticsHubV1.DataExchange.self, from: data)
    }

    public func deleteDataExchange(
      request: DeleteDataExchangeRequest, 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 "/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")
      _ = try await self.inner.rpc(for: req).get()
    }

    public func listListings(
      request: ListListingsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListListingsResponse {
      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)/listings"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      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(
        GoogleBigQueryAnalyticsHubV1.ListListingsResponse.self, from: data)
    }

    public func getListing(
      request: GetListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Listing {
      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 = "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(
        GoogleBigQueryAnalyticsHubV1.Listing.self, from: data)
    }

    public func createListing(
      request: CreateListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Listing {
      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)/listings"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.listingId, prefix: "listingId"))
      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.listing {
        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(
        GoogleBigQueryAnalyticsHubV1.Listing.self, from: data)
    }

    public func updateListing(
      request: UpdateListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Listing {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.listing.map({ $0.name }), !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.listing.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.listing {
        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(
        GoogleBigQueryAnalyticsHubV1.Listing.self, from: data)
    }

    public func deleteListing(
      request: DeleteListingRequest, 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 "/v1/\(pathVariable0)"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(
        contentsOf: try encoder.encode(request.deleteCommercial, prefix: "deleteCommercial"))
      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 subscribeListing(
      request: SubscribeListingRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.SubscribeListingResponse {
      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):subscribe"
      }()
      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(
        GoogleBigQueryAnalyticsHubV1.SubscribeListingResponse.self, from: data)
    }

    public func subscribeDataExchange(
      request: SubscribeDataExchangeRequest, 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):subscribe"
      }()
      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 refreshSubscription(
      request: RefreshSubscriptionRequest, 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):refresh"
      }()
      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 getSubscription(
      request: GetSubscriptionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.Subscription {
      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 = "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(
        GoogleBigQueryAnalyticsHubV1.Subscription.self, from: data)
    }

    public func listSubscriptions(
      request: ListSubscriptionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListSubscriptionsResponse {
      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)/subscriptions"
      }()
      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(
        GoogleBigQueryAnalyticsHubV1.ListSubscriptionsResponse.self, from: data)
    }

    public func listSharedResourceSubscriptions(
      request: ListSharedResourceSubscriptionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListSharedResourceSubscriptionsResponse {
      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):listSubscriptions"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(
        contentsOf: try encoder.encode(
          request.includeDeletedSubscriptions, prefix: "includeDeletedSubscriptions"))
      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(
        GoogleBigQueryAnalyticsHubV1.ListSharedResourceSubscriptionsResponse.self, from: data)
    }

    public func revokeSubscription(
      request: RevokeSubscriptionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.RevokeSubscriptionResponse {
      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):revoke"
      }()
      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(
        GoogleBigQueryAnalyticsHubV1.RevokeSubscriptionResponse.self, from: data)
    }

    public func deleteSubscription(
      request: DeleteSubscriptionRequest, 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 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"
      }()
      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 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 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"
      }()
      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.TestIamPermissionsResponse.self, from: data)
    }

    public func createQueryTemplate(
      request: CreateQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate {
      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)/queryTemplates"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(
        contentsOf: try encoder.encode(request.queryTemplateId, prefix: "queryTemplateId"))
      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.queryTemplate {
        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(
        GoogleBigQueryAnalyticsHubV1.QueryTemplate.self, from: data)
    }

    public func getQueryTemplate(
      request: GetQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate {
      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 = "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(
        GoogleBigQueryAnalyticsHubV1.QueryTemplate.self, from: data)
    }

    public func listQueryTemplates(
      request: ListQueryTemplatesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.ListQueryTemplatesResponse {
      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)/queryTemplates"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      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(
        GoogleBigQueryAnalyticsHubV1.ListQueryTemplatesResponse.self, from: data)
    }

    public func updateQueryTemplate(
      request: UpdateQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.queryTemplate.map({ $0.name }), !pathVariable0.isEmpty
        else {
          throw GoogleCloudGax.RequestError.binding(
            "'request.query_template.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.queryTemplate {
        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(
        GoogleBigQueryAnalyticsHubV1.QueryTemplate.self, from: data)
    }

    public func deleteQueryTemplate(
      request: DeleteQueryTemplateRequest, 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 "/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")
      _ = try await self.inner.rpc(for: req).get()
    }

    public func submitQueryTemplate(
      request: SubmitQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate {
      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):submit"
      }()
      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(
        GoogleBigQueryAnalyticsHubV1.QueryTemplate.self, from: data)
    }

    public func approveQueryTemplate(
      request: ApproveQueryTemplateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleBigQueryAnalyticsHubV1.QueryTemplate {
      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):approve"
      }()
      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(
        GoogleBigQueryAnalyticsHubV1.QueryTemplate.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 "/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 = "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)
    }
  }
}
