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

extension Clients {
  protocol RecaptchaEnterpriseServiceStub {
    func createAssessment(
      request: CreateAssessmentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Assessment

    func annotateAssessment(
      request: AnnotateAssessmentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.AnnotateAssessmentResponse

    func createKey(
      request: CreateKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Key

    func listKeys(
      request: ListKeysRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListKeysResponse

    func retrieveLegacySecretKey(
      request: RetrieveLegacySecretKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.RetrieveLegacySecretKeyResponse

    func getKey(
      request: GetKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Key

    func updateKey(
      request: UpdateKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Key

    func deleteKey(
      request: DeleteKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    func migrateKey(
      request: MigrateKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Key

    func addIpOverride(
      request: AddIpOverrideRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.AddIpOverrideResponse

    func removeIpOverride(
      request: RemoveIpOverrideRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.RemoveIpOverrideResponse

    func listIpOverrides(
      request: ListIpOverridesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListIpOverridesResponse

    func getMetrics(
      request: GetMetricsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Metrics

    func createFirewallPolicy(
      request: CreateFirewallPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.FirewallPolicy

    func listFirewallPolicies(
      request: ListFirewallPoliciesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListFirewallPoliciesResponse

    func getFirewallPolicy(
      request: GetFirewallPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.FirewallPolicy

    func updateFirewallPolicy(
      request: UpdateFirewallPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.FirewallPolicy

    func deleteFirewallPolicy(
      request: DeleteFirewallPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    func reorderFirewallPolicies(
      request: ReorderFirewallPoliciesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ReorderFirewallPoliciesResponse

    func listRelatedAccountGroups(
      request: ListRelatedAccountGroupsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListRelatedAccountGroupsResponse

    func listRelatedAccountGroupMemberships(
      request: ListRelatedAccountGroupMembershipsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListRelatedAccountGroupMembershipsResponse

    func searchRelatedAccountGroupMemberships(
      request: SearchRelatedAccountGroupMembershipsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.SearchRelatedAccountGroupMembershipsResponse
  }

  class RecaptchaEnterpriseServiceTransport: RecaptchaEnterpriseServiceStub {
    let inner: GoogleCloudGax.HTTPClient

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

    public func createAssessment(
      request: CreateAssessmentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Assessment {
      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)/assessments"
      }()
      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.assessment {
        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(
        GoogleCloudRecaptchaEnterpriseV1.Assessment.self, from: data)
    }

    public func annotateAssessment(
      request: AnnotateAssessmentRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.AnnotateAssessmentResponse {
      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):annotate"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.AnnotateAssessmentResponse.self, from: data)
    }

    public func createKey(
      request: CreateKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Key {
      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)/keys"
      }()
      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.key {
        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(
        GoogleCloudRecaptchaEnterpriseV1.Key.self, from: data)
    }

    public func listKeys(
      request: ListKeysRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListKeysResponse {
      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)/keys"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.ListKeysResponse.self, from: data)
    }

    public func retrieveLegacySecretKey(
      request: RetrieveLegacySecretKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.RetrieveLegacySecretKeyResponse {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.key as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.key' is not set or is empty")
        }
        return "/v1/\(pathVariable0):retrieveLegacySecretKey"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.RetrieveLegacySecretKeyResponse.self, from: data)
    }

    public func getKey(
      request: GetKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Key {
      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(
        GoogleCloudRecaptchaEnterpriseV1.Key.self, from: data)
    }

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

    public func deleteKey(
      request: DeleteKeyRequest, 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 migrateKey(
      request: MigrateKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Key {
      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):migrate"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.Key.self, from: data)
    }

    public func addIpOverride(
      request: AddIpOverrideRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.AddIpOverrideResponse {
      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):addIpOverride"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.AddIpOverrideResponse.self, from: data)
    }

    public func removeIpOverride(
      request: RemoveIpOverrideRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.RemoveIpOverrideResponse {
      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):removeIpOverride"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.RemoveIpOverrideResponse.self, from: data)
    }

    public func listIpOverrides(
      request: ListIpOverridesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListIpOverridesResponse {
      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):listIpOverrides"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.ListIpOverridesResponse.self, from: data)
    }

    public func getMetrics(
      request: GetMetricsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.Metrics {
      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(
        GoogleCloudRecaptchaEnterpriseV1.Metrics.self, from: data)
    }

    public func createFirewallPolicy(
      request: CreateFirewallPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.FirewallPolicy {
      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)/firewallpolicies"
      }()
      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.firewallPolicy {
        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(
        GoogleCloudRecaptchaEnterpriseV1.FirewallPolicy.self, from: data)
    }

    public func listFirewallPolicies(
      request: ListFirewallPoliciesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListFirewallPoliciesResponse {
      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)/firewallpolicies"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.ListFirewallPoliciesResponse.self, from: data)
    }

    public func getFirewallPolicy(
      request: GetFirewallPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.FirewallPolicy {
      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(
        GoogleCloudRecaptchaEnterpriseV1.FirewallPolicy.self, from: data)
    }

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

    public func deleteFirewallPolicy(
      request: DeleteFirewallPolicyRequest, 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 reorderFirewallPolicies(
      request: ReorderFirewallPoliciesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ReorderFirewallPoliciesResponse {
      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)/firewallpolicies:reorder"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.ReorderFirewallPoliciesResponse.self, from: data)
    }

    public func listRelatedAccountGroups(
      request: ListRelatedAccountGroupsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListRelatedAccountGroupsResponse {
      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)/relatedaccountgroups"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.ListRelatedAccountGroupsResponse.self, from: data)
    }

    public func listRelatedAccountGroupMemberships(
      request: ListRelatedAccountGroupMembershipsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.ListRelatedAccountGroupMembershipsResponse {
      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)/memberships"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.ListRelatedAccountGroupMembershipsResponse.self, from: data
      )
    }

    public func searchRelatedAccountGroupMemberships(
      request: SearchRelatedAccountGroupMembershipsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudRecaptchaEnterpriseV1.SearchRelatedAccountGroupMembershipsResponse
    {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/relatedaccountgroupmemberships:search"
      }()
      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(
        GoogleCloudRecaptchaEnterpriseV1.SearchRelatedAccountGroupMembershipsResponse.self,
        from: data)
    }
  }
}
