/**
 * Autogenerated by Thrift for /opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated @nocommit
 */
#pragma once

#include <thrift/lib/cpp2/gen/client_h.h>

#include "thrift/lib/thrift/gen-cpp2/metadata_types.h"

namespace apache { namespace thrift {
  class Cpp2RequestContext;
  namespace detail { namespace ac { struct ClientRequestContext; }}
  namespace transport { class THeader; }
}}

namespace apache::thrift::metadata {
class ThriftMetadataService;
} // namespace apache::thrift::metadata
namespace apache::thrift {

namespace detail {

template<>
struct ServiceMethodTypesFootprint<::apache::thrift::metadata::ThriftMetadataService> {
  // The types that appear in the definitions of service methods.
  // e.g. if it appears as a type of an input, output, exception sink or stream
  // parameter of a client stub, it appears here,
  using TypesInMethods = folly::tag_t<
  ::apache::thrift::metadata::ThriftServiceMetadataResponse>;
};
} // namespace detail

template <>
class Client<::apache::thrift::metadata::ThriftMetadataService> : public apache::thrift::GeneratedAsyncClient {
  static_assert(!folly::is_detected_v<::apache::thrift::detail::st::detect_complete, ::apache::thrift::metadata::ThriftMetadataService>, "Definition collision with service tag. Either rename the Thrift service using @cpp.Name annotation or rename the conflicting C++ type.");
 public:
  using apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient;

  std::string_view getServiceName() const noexcept override {
    return "ThriftMetadataService";
  }

  static std::string_view __fbthrift_thrift_uri() {
    return "facebook.com/thrift/metadata/ThriftMetadataService";
  }


  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual void getThriftServiceMetadata(std::unique_ptr<apache::thrift::RequestCallback> callback);
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual void getThriftServiceMetadata(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr<apache::thrift::RequestCallback> callback);
 protected:
  void fbthrift_serialize_and_send_getThriftServiceMetadata(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions = false);
 public:

  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual void sync_getThriftServiceMetadata(::apache::thrift::metadata::ThriftServiceMetadataResponse& _return);
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual void sync_getThriftServiceMetadata(apache::thrift::RpcOptions& rpcOptions, ::apache::thrift::metadata::ThriftServiceMetadataResponse& _return);

  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual folly::Future<::apache::thrift::metadata::ThriftServiceMetadataResponse> future_getThriftServiceMetadata();
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual folly::SemiFuture<::apache::thrift::metadata::ThriftServiceMetadataResponse> semifuture_getThriftServiceMetadata();
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual folly::Future<::apache::thrift::metadata::ThriftServiceMetadataResponse> future_getThriftServiceMetadata(apache::thrift::RpcOptions& rpcOptions);
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual folly::SemiFuture<::apache::thrift::metadata::ThriftServiceMetadataResponse> semifuture_getThriftServiceMetadata(apache::thrift::RpcOptions& rpcOptions);

#if FOLLY_HAS_COROUTINES
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  template <int = 0>
  folly::coro::Task<::apache::thrift::metadata::ThriftServiceMetadataResponse> co_getThriftServiceMetadata() {
    return co_getThriftServiceMetadata<false>(nullptr);
  }
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  template <int = 0>
  folly::coro::Task<::apache::thrift::metadata::ThriftServiceMetadataResponse> co_getThriftServiceMetadata(apache::thrift::RpcOptions& rpcOptions) {
    return co_getThriftServiceMetadata<true>(&rpcOptions);
  }
 private:
  template <bool hasRpcOptions>
  folly::coro::Task<::apache::thrift::metadata::ThriftServiceMetadataResponse> co_getThriftServiceMetadata(apache::thrift::RpcOptions* rpcOptions) {
    const folly::CancellationToken& cancelToken =
        co_await folly::coro::co_current_cancellation_token;
    const bool cancellable = cancelToken.canBeCancelled();
    apache::thrift::ClientReceiveState returnState;
    apache::thrift::ClientCoroCallback<false> callback(&returnState, co_await folly::coro::co_current_executor);
    auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId();
    auto [ctx, header] = getThriftServiceMetadataCtx(rpcOptions);
    using CancellableCallback = apache::thrift::CancellableRequestClientCallback<false>;
    auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr;
    static apache::thrift::RpcOptions* defaultRpcOptions = new apache::thrift::RpcOptions();
    auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback);
    if (ctx != nullptr) {
      auto argsAsRefs = std::tie();
      auto interceptorTry = ctx->processClientInterceptorsOnRequest(apache::thrift::ClientInterceptorOnRequestArguments(argsAsRefs), header.get(), hasRpcOptions ? *rpcOptions : *defaultRpcOptions);
      if (interceptorTry.hasException()) {
        co_yield folly::coro::co_error(std::move(interceptorTry.exception()));
      }
    }
    if constexpr (hasRpcOptions) {
      fbthrift_serialize_and_send_getThriftServiceMetadata(*rpcOptions, header, ctx.get(), std::move(wrappedCallback));
    } else {
      fbthrift_serialize_and_send_getThriftServiceMetadata(*defaultRpcOptions, header, ctx.get(), std::move(wrappedCallback));
    }
    if (cancellable) {
      folly::CancellationCallback cb(cancelToken, [&] { CancellableCallback::cancel(std::move(cancellableCallback)); });
      co_await callback.co_waitUntilDone();
    } else {
      co_await callback.co_waitUntilDone();
    }
    if (returnState.isException()) {
      co_yield folly::coro::co_error(std::move(returnState.exception()));
    }
    returnState.resetProtocolId(protocolId);
    returnState.resetCtx(std::move(ctx));
    ::apache::thrift::metadata::ThriftServiceMetadataResponse _return;
    SCOPE_EXIT {
      if (hasRpcOptions && returnState.header()) {
        auto* rheader = returnState.header();
        if (!rheader->getHeaders().empty()) {
          rpcOptions->setReadHeaders(rheader->releaseHeaders());
        }
        rpcOptions->setRoutingData(rheader->releaseRoutingData());
      }
    };
    auto ew = recv_wrapped_getThriftServiceMetadata(_return, returnState);
    if (returnState.ctx()) {
      returnState.ctx()->processClientInterceptorsOnResponse(returnState.header(), ew, _return).throwUnlessValue();
    }
    if (ew) {
      co_yield folly::coro::co_error(std::move(ew));
    }
    co_return _return;
  }
 public:
#endif // FOLLY_HAS_COROUTINES

  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual void getThriftServiceMetadata(folly::Function<void (::apache::thrift::ClientReceiveState&&)> callback);


  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  static folly::exception_wrapper recv_wrapped_getThriftServiceMetadata(::apache::thrift::metadata::ThriftServiceMetadataResponse& _return, ::apache::thrift::ClientReceiveState& state);
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  static void recv_getThriftServiceMetadata(::apache::thrift::metadata::ThriftServiceMetadataResponse& _return, ::apache::thrift::ClientReceiveState& state);
  // Mock friendly virtual instance method
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual void recv_instance_getThriftServiceMetadata(::apache::thrift::metadata::ThriftServiceMetadataResponse& _return, ::apache::thrift::ClientReceiveState& state);
  /** Glean {"file": "/opt/local/var/macports/build/fbthrift-07c1dc61/work/fbthrift-2025.08.25.00/thrift/lib/thrift/metadata.thrift", "service": "ThriftMetadataService", "function": "getThriftServiceMetadata"} */
  virtual folly::exception_wrapper recv_instance_wrapped_getThriftServiceMetadata(::apache::thrift::metadata::ThriftServiceMetadataResponse& _return, ::apache::thrift::ClientReceiveState& state);
 private:
  apache::thrift::SerializedRequest fbthrift_serialize_getThriftServiceMetadata(const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack);
  template <typename RpcOptions>
  void fbthrift_send_getThriftServiceMetadata(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr<apache::thrift::transport::THeader> header, apache::thrift::RequestClientCallback::Ptr callback, std::unique_ptr<folly::IOBuf> interceptorFrameworkMetadata);
  std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> getThriftServiceMetadataCtx(apache::thrift::RpcOptions* rpcOptions);
  template <typename CallbackType>
  folly::SemiFuture<::apache::thrift::metadata::ThriftServiceMetadataResponse> fbthrift_semifuture_getThriftServiceMetadata(apache::thrift::RpcOptions& rpcOptions);
 public:
};

} // namespace apache::thrift

namespace apache::thrift::metadata {
using ThriftMetadataServiceAsyncClient [[deprecated("Use apache::thrift::Client<ThriftMetadataService> instead")]] = ::apache::thrift::Client<ThriftMetadataService>;
} // namespace apache::thrift::metadata
