/*
 *   Copyright 2016-2026. Couchbase, Inc.
 *   All Rights Reserved.
 *
 *   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
 *
 *       http://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.
 */

// ====================================================================================================
// AUTOGENERATED FILE START - DO NOT EDIT MANUALLY
// Generated-On: 2026-03-01 10:51:59
// ====================================================================================================

#pragma once

#include "Python.h"
#include "cpp_core_enums_autogen.hxx"
#include "cpp_core_types.hxx"
#include "cpp_core_types_autogen.hxx"
#include "cpp_types.hxx"
#include "pytocbpp_defs.hxx"
#include "result.hxx"
#include "utils.hxx"
#include <core/operations.hxx>
#include <core/operations/document_view.hxx>
#include <core/operations/management/analytics.hxx>
#include <core/operations/management/bucket.hxx>
#include <core/operations/management/cluster_developer_preview_enable.hxx>
#include <core/operations/management/collections.hxx>
#include <core/operations/management/eventing.hxx>
#include <core/operations/management/query.hxx>
#include <core/operations/management/search.hxx>
#include <core/operations/management/user.hxx>
#include <core/operations/management/view.hxx>
#include <core/tracing/wrapper_sdk_tracer.hxx>

namespace pycbc
{

// ==========================================================================================
// Key-Value Operations
// ==========================================================================================

// ==========================================================================================
// append request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::append_request> {
  using append_request = couchbase::core::operations::append_request;

  static inline append_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "append_request", __FILE__, __LINE__)) {
      return {};
    }
    append_request req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const append_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::append_response> {
  using append_response = couchbase::core::operations::append_response;

  static inline PyObject* to_py(const append_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline append_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// append_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::append_request_with_legacy_durability> {
  using append_request_with_legacy_durability =
    couchbase::core::operations::append_request_with_legacy_durability;

  static inline append_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "append_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    append_request_with_legacy_durability req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const append_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// decrement request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::decrement_request> {
  using decrement_request = couchbase::core::operations::decrement_request;

  static inline decrement_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "decrement_request", __FILE__, __LINE__)) {
      return {};
    }
    decrement_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::uint64_t>(pyObj, "delta", req.delta);
    extract_field<std::optional<std::uint64_t>>(pyObj, "initial_value", req.initial_value);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const decrement_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::decrement_response> {
  using decrement_response = couchbase::core::operations::decrement_response;

  static inline PyObject* to_py(const decrement_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::uint64_t>(res->raw_result, "content", cppObj.content);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline decrement_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// decrement_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::decrement_request_with_legacy_durability> {
  using decrement_request_with_legacy_durability =
    couchbase::core::operations::decrement_request_with_legacy_durability;

  static inline decrement_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "decrement_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    decrement_request_with_legacy_durability req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::uint64_t>(pyObj, "delta", req.delta);
    extract_field<std::optional<std::uint64_t>>(pyObj, "initial_value", req.initial_value);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const decrement_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// exists request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::exists_request> {
  using exists_request = couchbase::core::operations::exists_request;

  static inline exists_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "exists_request", __FILE__, __LINE__)) {
      return {};
    }
    exists_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const exists_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::exists_response> {
  using exists_response = couchbase::core::operations::exists_response;

  static inline PyObject* to_py(const exists_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<bool>(res->raw_result, "deleted", cppObj.deleted);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::uint32_t>(res->raw_result, "flags", cppObj.flags);
    add_field<std::uint32_t>(res->raw_result, "expiry", cppObj.expiry);
    add_field<std::uint64_t>(res->raw_result, "sequence_number", cppObj.sequence_number);
    add_field<std::uint8_t>(res->raw_result, "datatype", cppObj.datatype);
    add_field<bool>(res->raw_result, "document_exists", cppObj.document_exists);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline exists_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// get request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::get_request> {
  using get_request = couchbase::core::operations::get_request;

  static inline get_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "get_request", __FILE__, __LINE__)) {
      return {};
    }
    get_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const get_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::get_response> {
  using get_response = couchbase::core::operations::get_response;

  static inline PyObject* to_py(const get_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<std::byte>>(res->raw_result, "value", cppObj.value);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::uint32_t>(res->raw_result, "flags", cppObj.flags);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline get_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// get_all_replicas request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::get_all_replicas_request> {
  using get_all_replicas_request = couchbase::core::operations::get_all_replicas_request;

  static inline get_all_replicas_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "get_all_replicas_request", __FILE__, __LINE__)) {
      return {};
    }
    get_all_replicas_request req{ std::move(id) };

    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    extract_field<couchbase::read_preference>(pyObj, "read_preference", req.read_preference);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const get_all_replicas_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::get_all_replicas_response> {
  using get_all_replicas_response = couchbase::core::operations::get_all_replicas_response;

  static inline PyObject* to_py(const get_all_replicas_response& cppObj)
  {
    Py_RETURN_NONE;
  }

  static inline get_all_replicas_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// get_and_lock request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::get_and_lock_request> {
  using get_and_lock_request = couchbase::core::operations::get_and_lock_request;

  static inline get_and_lock_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "get_and_lock_request", __FILE__, __LINE__)) {
      return {};
    }
    get_and_lock_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "lock_time", req.lock_time);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const get_and_lock_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::get_and_lock_response> {
  using get_and_lock_response = couchbase::core::operations::get_and_lock_response;

  static inline PyObject* to_py(const get_and_lock_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<std::byte>>(res->raw_result, "value", cppObj.value);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::uint32_t>(res->raw_result, "flags", cppObj.flags);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline get_and_lock_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// get_and_touch request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::get_and_touch_request> {
  using get_and_touch_request = couchbase::core::operations::get_and_touch_request;

  static inline get_and_touch_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "get_and_touch_request", __FILE__, __LINE__)) {
      return {};
    }
    get_and_touch_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const get_and_touch_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::get_and_touch_response> {
  using get_and_touch_response = couchbase::core::operations::get_and_touch_response;

  static inline PyObject* to_py(const get_and_touch_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<std::byte>>(res->raw_result, "value", cppObj.value);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::uint32_t>(res->raw_result, "flags", cppObj.flags);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline get_and_touch_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// get_any_replica request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::get_any_replica_request> {
  using get_any_replica_request = couchbase::core::operations::get_any_replica_request;

  static inline get_any_replica_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "get_any_replica_request", __FILE__, __LINE__)) {
      return {};
    }
    get_any_replica_request req{ std::move(id) };

    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    extract_field<couchbase::read_preference>(pyObj, "read_preference", req.read_preference);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const get_any_replica_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::get_any_replica_response> {
  using get_any_replica_response = couchbase::core::operations::get_any_replica_response;

  static inline PyObject* to_py(const get_any_replica_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<std::byte>>(res->raw_result, "value", cppObj.value);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::uint32_t>(res->raw_result, "flags", cppObj.flags);
    add_field<bool>(res->raw_result, "replica", cppObj.replica);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline get_any_replica_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// get_projected request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::get_projected_request> {
  using get_projected_request = couchbase::core::operations::get_projected_request;

  static inline get_projected_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "get_projected_request", __FILE__, __LINE__)) {
      return {};
    }
    get_projected_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::vector<std::string>>(pyObj, "projections", req.projections);
    extract_field<bool>(pyObj, "with_expiry", req.with_expiry);
    extract_field<std::vector<std::string>>(
      pyObj, "effective_projections", req.effective_projections);
    extract_field<bool>(pyObj, "preserve_array_indexes", req.preserve_array_indexes);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const get_projected_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::get_projected_response> {
  using get_projected_response = couchbase::core::operations::get_projected_response;

  static inline PyObject* to_py(const get_projected_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<std::byte>>(res->raw_result, "value", cppObj.value);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::uint32_t>(res->raw_result, "flags", cppObj.flags);
    add_field<std::optional<std::uint32_t>>(res->raw_result, "expiry", cppObj.expiry);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline get_projected_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// increment request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::increment_request> {
  using increment_request = couchbase::core::operations::increment_request;

  static inline increment_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "increment_request", __FILE__, __LINE__)) {
      return {};
    }
    increment_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::uint64_t>(pyObj, "delta", req.delta);
    extract_field<std::optional<std::uint64_t>>(pyObj, "initial_value", req.initial_value);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const increment_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::increment_response> {
  using increment_response = couchbase::core::operations::increment_response;

  static inline PyObject* to_py(const increment_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::uint64_t>(res->raw_result, "content", cppObj.content);
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline increment_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// increment_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::increment_request_with_legacy_durability> {
  using increment_request_with_legacy_durability =
    couchbase::core::operations::increment_request_with_legacy_durability;

  static inline increment_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "increment_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    increment_request_with_legacy_durability req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::uint64_t>(pyObj, "delta", req.delta);
    extract_field<std::optional<std::uint64_t>>(pyObj, "initial_value", req.initial_value);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const increment_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// insert request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::insert_request> {
  using insert_request = couchbase::core::operations::insert_request;

  static inline insert_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "insert_request", __FILE__, __LINE__)) {
      return {};
    }
    insert_request req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "flags", req.flags);
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const insert_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::insert_response> {
  using insert_response = couchbase::core::operations::insert_response;

  static inline PyObject* to_py(const insert_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline insert_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// insert_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::insert_request_with_legacy_durability> {
  using insert_request_with_legacy_durability =
    couchbase::core::operations::insert_request_with_legacy_durability;

  static inline insert_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "insert_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    insert_request_with_legacy_durability req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "flags", req.flags);
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const insert_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// lookup_in request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_request> {
  using lookup_in_request = couchbase::core::operations::lookup_in_request;

  static inline lookup_in_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "lookup_in_request", __FILE__, __LINE__)) {
      return {};
    }
    lookup_in_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<bool>(pyObj, "access_deleted", req.access_deleted);
    extract_field<std::vector<couchbase::core::impl::subdoc::command>>(pyObj, "specs", req.specs);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const lookup_in_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_response> {
  using lookup_in_response = couchbase::core::operations::lookup_in_response;

  static inline PyObject* to_py(const lookup_in_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::vector<couchbase::core::operations::lookup_in_response::entry>>(
      res->raw_result, "fields", cppObj.fields);
    add_field<bool>(res->raw_result, "deleted", cppObj.deleted);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline lookup_in_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// lookup_in_all_replicas request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_all_replicas_request> {
  using lookup_in_all_replicas_request =
    couchbase::core::operations::lookup_in_all_replicas_request;

  static inline lookup_in_all_replicas_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "lookup_in_all_replicas_request", __FILE__, __LINE__)) {
      return {};
    }
    lookup_in_all_replicas_request req{ std::move(id) };

    extract_field<std::vector<couchbase::core::impl::subdoc::command>>(pyObj, "specs", req.specs);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    extract_field<couchbase::read_preference>(pyObj, "read_preference", req.read_preference);
    extract_field<bool>(pyObj, "access_deleted", req.access_deleted);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const lookup_in_all_replicas_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_all_replicas_response> {
  using lookup_in_all_replicas_response =
    couchbase::core::operations::lookup_in_all_replicas_response;

  static inline PyObject* to_py(const lookup_in_all_replicas_response& cppObj)
  {
    Py_RETURN_NONE;
  }

  static inline lookup_in_all_replicas_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// lookup_in_any_replica request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_any_replica_request> {
  using lookup_in_any_replica_request = couchbase::core::operations::lookup_in_any_replica_request;

  static inline lookup_in_any_replica_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "lookup_in_any_replica_request", __FILE__, __LINE__)) {
      return {};
    }
    lookup_in_any_replica_request req{ std::move(id) };

    extract_field<std::vector<couchbase::core::impl::subdoc::command>>(pyObj, "specs", req.specs);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    extract_field<couchbase::read_preference>(pyObj, "read_preference", req.read_preference);
    extract_field<bool>(pyObj, "access_deleted", req.access_deleted);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const lookup_in_any_replica_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_any_replica_response> {
  using lookup_in_any_replica_response =
    couchbase::core::operations::lookup_in_any_replica_response;

  static inline PyObject* to_py(const lookup_in_any_replica_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<std::vector<couchbase::core::operations::lookup_in_any_replica_response::entry>>(
      res->raw_result, "fields", cppObj.fields);
    add_field<bool>(res->raw_result, "deleted", cppObj.deleted);
    add_field<bool>(res->raw_result, "is_replica", cppObj.is_replica);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline lookup_in_any_replica_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// mutate_in request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::mutate_in_request> {
  using mutate_in_request = couchbase::core::operations::mutate_in_request;

  static inline mutate_in_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "mutate_in_request", __FILE__, __LINE__)) {
      return {};
    }
    mutate_in_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<bool>(pyObj, "access_deleted", req.access_deleted);
    extract_field<bool>(pyObj, "create_as_deleted", req.create_as_deleted);
    extract_field<bool>(pyObj, "revive_document", req.revive_document);
    extract_field<std::optional<std::uint32_t>>(pyObj, "expiry", req.expiry);
    extract_field<couchbase::store_semantics>(pyObj, "store_semantics", req.store_semantics);
    extract_field<std::vector<couchbase::core::impl::subdoc::command>>(pyObj, "specs", req.specs);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<bool>(pyObj, "preserve_expiry", req.preserve_expiry);
    extract_field<std::optional<std::uint32_t>>(pyObj, "flags", req.flags);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const mutate_in_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::mutate_in_response> {
  using mutate_in_response = couchbase::core::operations::mutate_in_response;

  static inline PyObject* to_py(const mutate_in_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    add_field<std::vector<couchbase::core::operations::mutate_in_response::entry>>(
      res->raw_result, "fields", cppObj.fields);
    add_field<bool>(res->raw_result, "deleted", cppObj.deleted);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline mutate_in_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// mutate_in_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::mutate_in_request_with_legacy_durability> {
  using mutate_in_request_with_legacy_durability =
    couchbase::core::operations::mutate_in_request_with_legacy_durability;

  static inline mutate_in_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "mutate_in_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    mutate_in_request_with_legacy_durability req{ std::move(id) };

    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<bool>(pyObj, "access_deleted", req.access_deleted);
    extract_field<bool>(pyObj, "create_as_deleted", req.create_as_deleted);
    extract_field<bool>(pyObj, "revive_document", req.revive_document);
    extract_field<std::optional<std::uint32_t>>(pyObj, "expiry", req.expiry);
    extract_field<couchbase::store_semantics>(pyObj, "store_semantics", req.store_semantics);
    extract_field<std::vector<couchbase::core::impl::subdoc::command>>(pyObj, "specs", req.specs);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<bool>(pyObj, "preserve_expiry", req.preserve_expiry);
    extract_field<std::optional<std::uint32_t>>(pyObj, "flags", req.flags);
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const mutate_in_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// prepend request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::prepend_request> {
  using prepend_request = couchbase::core::operations::prepend_request;

  static inline prepend_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "prepend_request", __FILE__, __LINE__)) {
      return {};
    }
    prepend_request req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const prepend_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::prepend_response> {
  using prepend_response = couchbase::core::operations::prepend_response;

  static inline PyObject* to_py(const prepend_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline prepend_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// prepend_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::prepend_request_with_legacy_durability> {
  using prepend_request_with_legacy_durability =
    couchbase::core::operations::prepend_request_with_legacy_durability;

  static inline prepend_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "prepend_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    prepend_request_with_legacy_durability req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const prepend_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// remove request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::remove_request> {
  using remove_request = couchbase::core::operations::remove_request;

  static inline remove_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "remove_request", __FILE__, __LINE__)) {
      return {};
    }
    remove_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const remove_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::remove_response> {
  using remove_response = couchbase::core::operations::remove_response;

  static inline PyObject* to_py(const remove_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline remove_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// remove_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::remove_request_with_legacy_durability> {
  using remove_request_with_legacy_durability =
    couchbase::core::operations::remove_request_with_legacy_durability;

  static inline remove_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "remove_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    remove_request_with_legacy_durability req{ std::move(id) };

    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const remove_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// replace request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::replace_request> {
  using replace_request = couchbase::core::operations::replace_request;

  static inline replace_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "replace_request", __FILE__, __LINE__)) {
      return {};
    }
    replace_request req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "flags", req.flags);
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<bool>(pyObj, "preserve_expiry", req.preserve_expiry);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const replace_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::replace_response> {
  using replace_response = couchbase::core::operations::replace_response;

  static inline PyObject* to_py(const replace_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline replace_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// replace_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::replace_request_with_legacy_durability> {
  using replace_request_with_legacy_durability =
    couchbase::core::operations::replace_request_with_legacy_durability;

  static inline replace_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "replace_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    replace_request_with_legacy_durability req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "flags", req.flags);
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<bool>(pyObj, "preserve_expiry", req.preserve_expiry);
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const replace_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// touch request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::touch_request> {
  using touch_request = couchbase::core::operations::touch_request;

  static inline touch_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "touch_request", __FILE__, __LINE__)) {
      return {};
    }
    touch_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const touch_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::touch_response> {
  using touch_response = couchbase::core::operations::touch_response;

  static inline PyObject* to_py(const touch_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline touch_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// unlock request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::unlock_request> {
  using unlock_request = couchbase::core::operations::unlock_request;

  static inline unlock_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "unlock_request", __FILE__, __LINE__)) {
      return {};
    }
    unlock_request req{ std::move(id) };

    // partition
    // opaque
    extract_field<couchbase::cas>(pyObj, "cas", req.cas);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const unlock_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::unlock_response> {
  using unlock_response = couchbase::core::operations::unlock_response;

  static inline PyObject* to_py(const unlock_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline unlock_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// upsert request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::upsert_request> {
  using upsert_request = couchbase::core::operations::upsert_request;

  static inline upsert_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(pyObj, "id", id, "upsert_request", __FILE__, __LINE__)) {
      return {};
    }
    upsert_request req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "flags", req.flags);
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<couchbase::durability_level>(pyObj, "durability_level", req.durability_level);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<bool>(pyObj, "preserve_expiry", req.preserve_expiry);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const upsert_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::upsert_response> {
  using upsert_response = couchbase::core::operations::upsert_response;

  static inline PyObject* to_py(const upsert_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::cas>(res->raw_result, "cas", cppObj.cas);
    add_field<couchbase::mutation_token>(res->raw_result, "token", cppObj.token);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline upsert_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// upsert_with_legacy_durability request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::upsert_request_with_legacy_durability> {
  using upsert_request_with_legacy_durability =
    couchbase::core::operations::upsert_request_with_legacy_durability;

  static inline upsert_request_with_legacy_durability from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase::core::document_id id;
    if (!extract_required_field(
          pyObj, "id", id, "upsert_request_with_legacy_durability", __FILE__, __LINE__)) {
      return {};
    }
    upsert_request_with_legacy_durability req{ std::move(id) };

    extract_field<std::vector<std::byte>>(pyObj, "value", req.value);
    // partition
    // opaque
    extract_field<std::uint32_t>(pyObj, "flags", req.flags);
    extract_field<std::uint32_t>(pyObj, "expiry", req.expiry);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    extract_field<bool>(pyObj, "preserve_expiry", req.preserve_expiry);
    extract_field<couchbase::persist_to>(pyObj, "persist_to", req.persist_to);
    extract_field<couchbase::replicate_to>(pyObj, "replicate_to", req.replicate_to);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const upsert_request_with_legacy_durability&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// Streaming Operations
// ==========================================================================================

// ==========================================================================================
// analytics request
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::analytics_request> {
  using analytics_request = couchbase::core::operations::analytics_request;

  static inline analytics_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_request req;

    if (!extract_required_field<std::string>(
          pyObj, "statement", req.statement, "analytics_request", __FILE__, __LINE__)) {
      return {};
    }
    extract_field<bool>(pyObj, "readonly", req.readonly);
    extract_field<bool>(pyObj, "priority", req.priority);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_qualifier", req.scope_qualifier);
    extract_field<std::optional<couchbase::core::analytics_scan_consistency>>(
      pyObj, "scan_consistency", req.scan_consistency);
    extract_field<std::map<std::string, couchbase::core::json_string>>(pyObj, "raw", req.raw);
    extract_field<std::vector<couchbase::core::json_string>>(
      pyObj, "positional_parameters", req.positional_parameters);
    extract_field<std::map<std::string, couchbase::core::json_string>>(
      pyObj, "named_parameters", req.named_parameters);
    // row_callback
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // body_str
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_request&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// document_view request
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::document_view_request> {
  using document_view_request = couchbase::core::operations::document_view_request;

  static inline document_view_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    document_view_request req;

    if (!extract_required_field<std::string>(
          pyObj, "bucket_name", req.bucket_name, "document_view_request", __FILE__, __LINE__)) {
      return {};
    }
    if (!extract_required_field<std::string>(
          pyObj, "document_name", req.document_name, "document_view_request", __FILE__, __LINE__)) {
      return {};
    }
    if (!extract_required_field<std::string>(
          pyObj, "view_name", req.view_name, "document_view_request", __FILE__, __LINE__)) {
      return {};
    }
    extract_field<couchbase::core::design_document_namespace>(pyObj, "ns", req.ns);
    extract_field<std::optional<std::uint64_t>>(pyObj, "limit", req.limit);
    extract_field<std::optional<std::uint64_t>>(pyObj, "skip", req.skip);
    extract_field<std::optional<couchbase::core::view_scan_consistency>>(
      pyObj, "consistency", req.consistency);
    extract_field<std::vector<std::string>>(pyObj, "keys", req.keys);
    extract_field<std::optional<std::string>>(pyObj, "key", req.key);
    extract_field<std::optional<std::string>>(pyObj, "start_key", req.start_key);
    extract_field<std::optional<std::string>>(pyObj, "end_key", req.end_key);
    extract_field<std::optional<std::string>>(pyObj, "start_key_doc_id", req.start_key_doc_id);
    extract_field<std::optional<std::string>>(pyObj, "end_key_doc_id", req.end_key_doc_id);
    extract_field<std::optional<bool>>(pyObj, "inclusive_end", req.inclusive_end);
    extract_field<std::optional<bool>>(pyObj, "reduce", req.reduce);
    extract_field<std::optional<bool>>(pyObj, "group", req.group);
    extract_field<std::optional<std::uint32_t>>(pyObj, "group_level", req.group_level);
    extract_field<bool>(pyObj, "debug", req.debug);
    extract_field<std::map<std::string, std::string>>(pyObj, "raw", req.raw);
    extract_field<std::optional<bool>>(pyObj, "full_set", req.full_set);
    extract_field<std::optional<couchbase::core::view_sort_order>>(pyObj, "order", req.order);
    extract_field<std::optional<couchbase::core::view_on_error>>(pyObj, "on_error", req.on_error);
    extract_field<std::vector<std::string>>(pyObj, "query_string", req.query_string);
    // row_callback
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const document_view_request&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// query request
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::query_request> {
  using query_request = couchbase::core::operations::query_request;

  static inline query_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    query_request req;

    if (!extract_required_field<std::string>(
          pyObj, "statement", req.statement, "query_request", __FILE__, __LINE__)) {
      return {};
    }
    extract_field<bool>(pyObj, "adhoc", req.adhoc);
    extract_field<bool>(pyObj, "metrics", req.metrics);
    extract_field<bool>(pyObj, "readonly", req.readonly);
    extract_field<bool>(pyObj, "flex_index", req.flex_index);
    extract_field<bool>(pyObj, "preserve_expiry", req.preserve_expiry);
    extract_field<std::optional<bool>>(pyObj, "use_replica", req.use_replica);
    extract_field<std::optional<std::uint64_t>>(pyObj, "max_parallelism", req.max_parallelism);
    extract_field<std::optional<std::uint64_t>>(pyObj, "scan_cap", req.scan_cap);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "scan_wait", req.scan_wait);
    extract_field<std::optional<std::uint64_t>>(pyObj, "pipeline_batch", req.pipeline_batch);
    extract_field<std::optional<std::uint64_t>>(pyObj, "pipeline_cap", req.pipeline_cap);
    extract_field<std::optional<couchbase::query_scan_consistency>>(
      pyObj, "scan_consistency", req.scan_consistency);
    extract_field<std::vector<couchbase::mutation_token>>(
      pyObj, "mutation_state", req.mutation_state);
    extract_field<std::optional<std::string>>(pyObj, "query_context", req.query_context);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    extract_field<std::optional<couchbase::query_profile>>(pyObj, "profile", req.profile);
    extract_field<std::map<std::string, couchbase::core::json_string, std::less<>>>(
      pyObj, "raw", req.raw);
    extract_field<std::vector<couchbase::core::json_string>>(
      pyObj, "positional_parameters", req.positional_parameters);
    extract_field<std::map<std::string, couchbase::core::json_string, std::less<>>>(
      pyObj, "named_parameters", req.named_parameters);
    // row_callback
    // send_to_node
    // ctx_
    // extract_encoded_plan_
    // body_str
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const query_request&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// search request
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_request> {
  using search_request = couchbase::core::operations::search_request;

  static inline search_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_request req;

    if (!extract_required_field<std::string>(
          pyObj, "index_name", req.index_name, "search_request", __FILE__, __LINE__)) {
      return {};
    }
    if (!extract_required_field<couchbase::core::json_string>(
          pyObj, "query", req.query, "search_request", __FILE__, __LINE__)) {
      return {};
    }
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<bool>>(pyObj, "show_request", req.show_request);
    extract_field<std::optional<couchbase::core::json_string>>(
      pyObj, "vector_search", req.vector_search);
    extract_field<std::optional<couchbase::core::vector_query_combination>>(
      pyObj, "vector_query_combination", req.vector_query_combination);
    extract_field<std::optional<std::uint32_t>>(pyObj, "limit", req.limit);
    extract_field<std::optional<std::uint32_t>>(pyObj, "skip", req.skip);
    extract_field<std::optional<bool>>(pyObj, "explain", req.explain);
    extract_field<bool>(pyObj, "disable_scoring", req.disable_scoring);
    extract_field<bool>(pyObj, "include_locations", req.include_locations);
    extract_field<std::optional<couchbase::core::search_highlight_style>>(
      pyObj, "highlight_style", req.highlight_style);
    extract_field<std::vector<std::string>>(pyObj, "highlight_fields", req.highlight_fields);
    extract_field<std::vector<std::string>>(pyObj, "fields", req.fields);
    extract_field<std::vector<std::string>>(pyObj, "collections", req.collections);
    extract_field<std::optional<couchbase::core::search_scan_consistency>>(
      pyObj, "scan_consistency", req.scan_consistency);
    extract_field<std::vector<couchbase::mutation_token>>(
      pyObj, "mutation_state", req.mutation_state);
    extract_field<std::vector<std::string>>(pyObj, "sort_specs", req.sort_specs);
    extract_field<std::map<std::string, std::string>>(pyObj, "facets", req.facets);
    extract_field<std::map<std::string, couchbase::core::json_string>>(pyObj, "raw", req.raw);
    // row_callback
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    extract_field<std::optional<bool>>(pyObj, "log_request", req.log_request);
    extract_field<std::optional<bool>>(pyObj, "log_response", req.log_response);
    // body_str
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_request&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// Analytics Management Operations
// ==========================================================================================

// ==========================================================================================
// analytics_dataset_create request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataset_create_request> {
  using analytics_dataset_create_request =
    couchbase::core::operations::management::analytics_dataset_create_request;

  static inline analytics_dataset_create_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_dataset_create_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::string>(pyObj, "dataset_name", req.dataset_name);
    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "condition", req.condition);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    extract_field<bool>(pyObj, "ignore_if_exists", req.ignore_if_exists);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_dataset_create_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataset_create_response> {
  using analytics_dataset_create_response =
    couchbase::core::operations::management::analytics_dataset_create_response;

  static inline PyObject* to_py(const analytics_dataset_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_dataset_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_dataset_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataset_drop_request> {
  using analytics_dataset_drop_request =
    couchbase::core::operations::management::analytics_dataset_drop_request;

  static inline analytics_dataset_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_dataset_drop_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::string>(pyObj, "dataset_name", req.dataset_name);
    extract_field<bool>(pyObj, "ignore_if_does_not_exist", req.ignore_if_does_not_exist);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_dataset_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataset_drop_response> {
  using analytics_dataset_drop_response =
    couchbase::core::operations::management::analytics_dataset_drop_response;

  static inline PyObject* to_py(const analytics_dataset_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_dataset_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_dataset_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataset_get_all_request> {
  using analytics_dataset_get_all_request =
    couchbase::core::operations::management::analytics_dataset_get_all_request;

  static inline analytics_dataset_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_dataset_get_all_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_dataset_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataset_get_all_response> {
  using analytics_dataset_get_all_response =
    couchbase::core::operations::management::analytics_dataset_get_all_response;

  static inline PyObject* to_py(const analytics_dataset_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::management::analytics::dataset>>(
      res->raw_result, "datasets", cppObj.datasets);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_dataset_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_dataverse_create request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataverse_create_request> {
  using analytics_dataverse_create_request =
    couchbase::core::operations::management::analytics_dataverse_create_request;

  static inline analytics_dataverse_create_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_dataverse_create_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<bool>(pyObj, "ignore_if_exists", req.ignore_if_exists);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_dataverse_create_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataverse_create_response> {
  using analytics_dataverse_create_response =
    couchbase::core::operations::management::analytics_dataverse_create_response;

  static inline PyObject* to_py(const analytics_dataverse_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_dataverse_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_dataverse_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataverse_drop_request> {
  using analytics_dataverse_drop_request =
    couchbase::core::operations::management::analytics_dataverse_drop_request;

  static inline analytics_dataverse_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_dataverse_drop_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<bool>(pyObj, "ignore_if_does_not_exist", req.ignore_if_does_not_exist);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_dataverse_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_dataverse_drop_response> {
  using analytics_dataverse_drop_response =
    couchbase::core::operations::management::analytics_dataverse_drop_response;

  static inline PyObject* to_py(const analytics_dataverse_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_dataverse_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_get_pending_mutations request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_get_pending_mutations_request> {
  using analytics_get_pending_mutations_request =
    couchbase::core::operations::management::analytics_get_pending_mutations_request;

  static inline analytics_get_pending_mutations_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_get_pending_mutations_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_get_pending_mutations_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_get_pending_mutations_response> {
  using analytics_get_pending_mutations_response =
    couchbase::core::operations::management::analytics_get_pending_mutations_response;

  static inline PyObject* to_py(const analytics_get_pending_mutations_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    add_field<std::map<std::string, std::int64_t>>(res->raw_result, "stats", cppObj.stats);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_get_pending_mutations_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_index_create request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_index_create_request> {
  using analytics_index_create_request =
    couchbase::core::operations::management::analytics_index_create_request;

  static inline analytics_index_create_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_index_create_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::string>(pyObj, "dataset_name", req.dataset_name);
    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<std::map<std::string, std::string>>(pyObj, "fields", req.fields);
    extract_field<bool>(pyObj, "ignore_if_exists", req.ignore_if_exists);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_index_create_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_index_create_response> {
  using analytics_index_create_response =
    couchbase::core::operations::management::analytics_index_create_response;

  static inline PyObject* to_py(const analytics_index_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_index_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_index_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_index_drop_request> {
  using analytics_index_drop_request =
    couchbase::core::operations::management::analytics_index_drop_request;

  static inline analytics_index_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_index_drop_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::string>(pyObj, "dataset_name", req.dataset_name);
    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<bool>(pyObj, "ignore_if_does_not_exist", req.ignore_if_does_not_exist);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_index_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_index_drop_response> {
  using analytics_index_drop_response =
    couchbase::core::operations::management::analytics_index_drop_response;

  static inline PyObject* to_py(const analytics_index_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_index_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_index_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_index_get_all_request> {
  using analytics_index_get_all_request =
    couchbase::core::operations::management::analytics_index_get_all_request;

  static inline analytics_index_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_index_get_all_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_index_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_index_get_all_response> {
  using analytics_index_get_all_response =
    couchbase::core::operations::management::analytics_index_get_all_response;

  static inline PyObject* to_py(const analytics_index_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::core::management::analytics::index>>(
      res->raw_result, "indexes", cppObj.indexes);
    add_field<std::vector<couchbase::core::operations::management::analytics_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_index_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_link_connect request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_connect_request> {
  using analytics_link_connect_request =
    couchbase::core::operations::management::analytics_link_connect_request;

  static inline analytics_link_connect_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_link_connect_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::string>(pyObj, "link_name", req.link_name);
    extract_field<bool>(pyObj, "force", req.force);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_link_connect_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_connect_response> {
  using analytics_link_connect_response =
    couchbase::core::operations::management::analytics_link_connect_response;

  static inline PyObject* to_py(const analytics_link_connect_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::analytics_link_connect_response::problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_link_connect_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_link_create_azure_blob_external_link request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_create_request<
  couchbase::core::management::analytics::azure_blob_external_link>> {
  using azure_blob_external_link =
    couchbase::core::operations::management::analytics_link_create_request<
      couchbase::core::management::analytics::azure_blob_external_link>;

  static inline azure_blob_external_link from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    azure_blob_external_link req;

    extract_field<couchbase::core::management::analytics::azure_blob_external_link>(
      pyObj, "link", req.link);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const azure_blob_external_link&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_create_response> {
  using analytics_link_create_response =
    couchbase::core::operations::management::analytics_link_create_response;

  static inline PyObject* to_py(const analytics_link_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::analytics_link_create_response::problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_link_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_link_create_couchbase_remote_link request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_create_request<
  couchbase::core::management::analytics::couchbase_remote_link>> {
  using couchbase_remote_link =
    couchbase::core::operations::management::analytics_link_create_request<
      couchbase::core::management::analytics::couchbase_remote_link>;

  static inline couchbase_remote_link from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase_remote_link req;

    extract_field<couchbase::core::management::analytics::couchbase_remote_link>(
      pyObj, "link", req.link);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const couchbase_remote_link&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// analytics_link_create_s3_external_link request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_create_request<
  couchbase::core::management::analytics::s3_external_link>> {
  using s3_external_link = couchbase::core::operations::management::analytics_link_create_request<
    couchbase::core::management::analytics::s3_external_link>;

  static inline s3_external_link from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    s3_external_link req;

    extract_field<couchbase::core::management::analytics::s3_external_link>(
      pyObj, "link", req.link);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const s3_external_link&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// analytics_link_disconnect request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_disconnect_request> {
  using analytics_link_disconnect_request =
    couchbase::core::operations::management::analytics_link_disconnect_request;

  static inline analytics_link_disconnect_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_link_disconnect_request req;

    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::string>(pyObj, "link_name", req.link_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_link_disconnect_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_disconnect_response> {
  using analytics_link_disconnect_response =
    couchbase::core::operations::management::analytics_link_disconnect_response;

  static inline PyObject* to_py(const analytics_link_disconnect_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::analytics_link_disconnect_response::problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_link_disconnect_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_link_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_drop_request> {
  using analytics_link_drop_request =
    couchbase::core::operations::management::analytics_link_drop_request;

  static inline analytics_link_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_link_drop_request req;

    extract_field<std::string>(pyObj, "link_name", req.link_name);
    extract_field<std::string>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_link_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_drop_response> {
  using analytics_link_drop_response =
    couchbase::core::operations::management::analytics_link_drop_response;

  static inline PyObject* to_py(const analytics_link_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<
      std::vector<couchbase::core::operations::management::analytics_link_drop_response::problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_link_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_link_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_get_all_request> {
  using analytics_link_get_all_request =
    couchbase::core::operations::management::analytics_link_get_all_request;

  static inline analytics_link_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    analytics_link_get_all_request req;

    extract_field<std::optional<std::string>>(pyObj, "link_type", req.link_type);
    extract_field<std::optional<std::string>>(pyObj, "link_name", req.link_name);
    extract_field<std::optional<std::string>>(pyObj, "dataverse_name", req.dataverse_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const analytics_link_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_get_all_response> {
  using analytics_link_get_all_response =
    couchbase::core::operations::management::analytics_link_get_all_response;

  static inline PyObject* to_py(const analytics_link_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::analytics_link_get_all_response::problem>>(
      res->raw_result, "errors", cppObj.errors);
    add_field<std::vector<couchbase::core::management::analytics::couchbase_remote_link>>(
      res->raw_result, "couchbase", cppObj.couchbase);
    add_field<std::vector<couchbase::core::management::analytics::s3_external_link>>(
      res->raw_result, "s3", cppObj.s3);
    add_field<std::vector<couchbase::core::management::analytics::azure_blob_external_link>>(
      res->raw_result, "azure_blob", cppObj.azure_blob);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_link_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_link_replace_azure_blob_external_link request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_replace_request<
  couchbase::core::management::analytics::azure_blob_external_link>> {
  using azure_blob_external_link =
    couchbase::core::operations::management::analytics_link_replace_request<
      couchbase::core::management::analytics::azure_blob_external_link>;

  static inline azure_blob_external_link from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    azure_blob_external_link req;

    extract_field<couchbase::core::management::analytics::azure_blob_external_link>(
      pyObj, "link", req.link);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const azure_blob_external_link&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_replace_response> {
  using analytics_link_replace_response =
    couchbase::core::operations::management::analytics_link_replace_response;

  static inline PyObject* to_py(const analytics_link_replace_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::analytics_link_replace_response::problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline analytics_link_replace_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// analytics_link_replace_couchbase_remote_link request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_replace_request<
  couchbase::core::management::analytics::couchbase_remote_link>> {
  using couchbase_remote_link =
    couchbase::core::operations::management::analytics_link_replace_request<
      couchbase::core::management::analytics::couchbase_remote_link>;

  static inline couchbase_remote_link from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    couchbase_remote_link req;

    extract_field<couchbase::core::management::analytics::couchbase_remote_link>(
      pyObj, "link", req.link);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const couchbase_remote_link&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// analytics_link_replace_s3_external_link request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_link_replace_request<
  couchbase::core::management::analytics::s3_external_link>> {
  using s3_external_link = couchbase::core::operations::management::analytics_link_replace_request<
    couchbase::core::management::analytics::s3_external_link>;

  static inline s3_external_link from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    s3_external_link req;

    extract_field<couchbase::core::management::analytics::s3_external_link>(
      pyObj, "link", req.link);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const s3_external_link&)
  {
    Py_RETURN_NONE;
  }
};

// ==========================================================================================
// Bucket Management Operations
// ==========================================================================================

// ==========================================================================================
// bucket_create request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_create_request> {
  using bucket_create_request = couchbase::core::operations::management::bucket_create_request;

  static inline bucket_create_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    bucket_create_request req;

    extract_field<couchbase::core::management::cluster::bucket_settings>(
      pyObj, "bucket", req.bucket);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const bucket_create_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_create_response> {
  using bucket_create_response = couchbase::core::operations::management::bucket_create_response;

  static inline PyObject* to_py(const bucket_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "error_message", cppObj.error_message);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline bucket_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// bucket_describe request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_describe_request> {
  using bucket_describe_request = couchbase::core::operations::management::bucket_describe_request;

  static inline bucket_describe_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    bucket_describe_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const bucket_describe_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_describe_response> {
  using bucket_describe_response =
    couchbase::core::operations::management::bucket_describe_response;

  static inline PyObject* to_py(const bucket_describe_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::operations::management::bucket_describe_response::bucket_info>(
      res->raw_result, "info", cppObj.info);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline bucket_describe_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// bucket_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_drop_request> {
  using bucket_drop_request = couchbase::core::operations::management::bucket_drop_request;

  static inline bucket_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    bucket_drop_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const bucket_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_drop_response> {
  using bucket_drop_response = couchbase::core::operations::management::bucket_drop_response;

  static inline PyObject* to_py(const bucket_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline bucket_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// bucket_flush request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_flush_request> {
  using bucket_flush_request = couchbase::core::operations::management::bucket_flush_request;

  static inline bucket_flush_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    bucket_flush_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const bucket_flush_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_flush_response> {
  using bucket_flush_response = couchbase::core::operations::management::bucket_flush_response;

  static inline PyObject* to_py(const bucket_flush_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline bucket_flush_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// bucket_get request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_get_request> {
  using bucket_get_request = couchbase::core::operations::management::bucket_get_request;

  static inline bucket_get_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    bucket_get_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const bucket_get_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_get_response> {
  using bucket_get_response = couchbase::core::operations::management::bucket_get_response;

  static inline PyObject* to_py(const bucket_get_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::management::cluster::bucket_settings>(
      res->raw_result, "bucket", cppObj.bucket);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline bucket_get_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// bucket_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_get_all_request> {
  using bucket_get_all_request = couchbase::core::operations::management::bucket_get_all_request;

  static inline bucket_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    bucket_get_all_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const bucket_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_get_all_response> {
  using bucket_get_all_response = couchbase::core::operations::management::bucket_get_all_response;

  static inline PyObject* to_py(const bucket_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<couchbase::core::management::cluster::bucket_settings>>(
      res->raw_result, "buckets", cppObj.buckets);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline bucket_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// bucket_update request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_update_request> {
  using bucket_update_request = couchbase::core::operations::management::bucket_update_request;

  static inline bucket_update_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    bucket_update_request req;

    extract_field<couchbase::core::management::cluster::bucket_settings>(
      pyObj, "bucket", req.bucket);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const bucket_update_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::bucket_update_response> {
  using bucket_update_response = couchbase::core::operations::management::bucket_update_response;

  static inline PyObject* to_py(const bucket_update_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::management::cluster::bucket_settings>(
      res->raw_result, "bucket", cppObj.bucket);
    add_field<std::string>(res->raw_result, "error_message", cppObj.error_message);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline bucket_update_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// Cluster Management Operations
// ==========================================================================================

// ==========================================================================================
// cluster_describe request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::cluster_describe_request> {
  using cluster_describe_request =
    couchbase::core::operations::management::cluster_describe_request;

  static inline cluster_describe_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    cluster_describe_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const cluster_describe_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::cluster_describe_response> {
  using cluster_describe_response =
    couchbase::core::operations::management::cluster_describe_response;

  static inline PyObject* to_py(const cluster_describe_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::operations::management::cluster_describe_response::cluster_info>(
      res->raw_result, "info", cppObj.info);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline cluster_describe_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// cluster_developer_preview_enable request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::cluster_developer_preview_enable_request> {
  using cluster_developer_preview_enable_request =
    couchbase::core::operations::management::cluster_developer_preview_enable_request;

  static inline cluster_developer_preview_enable_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    cluster_developer_preview_enable_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const cluster_developer_preview_enable_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::cluster_developer_preview_enable_response> {
  using cluster_developer_preview_enable_response =
    couchbase::core::operations::management::cluster_developer_preview_enable_response;

  static inline PyObject* to_py(const cluster_developer_preview_enable_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline cluster_developer_preview_enable_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// Collection Management Operations
// ==========================================================================================

// ==========================================================================================
// collection_create request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collection_create_request> {
  using collection_create_request =
    couchbase::core::operations::management::collection_create_request;

  static inline collection_create_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    collection_create_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<std::optional<std::int32_t>>(pyObj, "max_expiry", req.max_expiry);
    extract_field<std::optional<bool>>(pyObj, "history", req.history);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const collection_create_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collection_create_response> {
  using collection_create_response =
    couchbase::core::operations::management::collection_create_response;

  static inline PyObject* to_py(const collection_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::uint64_t>(res->raw_result, "uid", cppObj.uid);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline collection_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// collection_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collection_drop_request> {
  using collection_drop_request = couchbase::core::operations::management::collection_drop_request;

  static inline collection_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    collection_drop_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const collection_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collection_drop_response> {
  using collection_drop_response =
    couchbase::core::operations::management::collection_drop_response;

  static inline PyObject* to_py(const collection_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::uint64_t>(res->raw_result, "uid", cppObj.uid);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline collection_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// collection_update request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collection_update_request> {
  using collection_update_request =
    couchbase::core::operations::management::collection_update_request;

  static inline collection_update_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    collection_update_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<std::optional<std::int32_t>>(pyObj, "max_expiry", req.max_expiry);
    extract_field<std::optional<bool>>(pyObj, "history", req.history);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const collection_update_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collection_update_response> {
  using collection_update_response =
    couchbase::core::operations::management::collection_update_response;

  static inline PyObject* to_py(const collection_update_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::uint64_t>(res->raw_result, "uid", cppObj.uid);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline collection_update_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// collections_manifest_get request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collections_manifest_get_request> {
  using collections_manifest_get_request =
    couchbase::core::operations::management::collections_manifest_get_request;

  static inline collections_manifest_get_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    collections_manifest_get_request req;

    extract_field<std::uint16_t>(pyObj, "partition", req.partition);
    extract_field<std::uint32_t>(pyObj, "opaque", req.opaque);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // retries
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const collections_manifest_get_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::collections_manifest_get_response> {
  using collections_manifest_get_response =
    couchbase::core::operations::management::collections_manifest_get_response;

  static inline PyObject* to_py(const collections_manifest_get_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::topology::collections_manifest>(
      res->raw_result, "manifest", cppObj.manifest);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline collections_manifest_get_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// scope_create request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::scope_create_request> {
  using scope_create_request = couchbase::core::operations::management::scope_create_request;

  static inline scope_create_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    scope_create_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const scope_create_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::scope_create_response> {
  using scope_create_response = couchbase::core::operations::management::scope_create_response;

  static inline PyObject* to_py(const scope_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::uint64_t>(res->raw_result, "uid", cppObj.uid);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline scope_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// scope_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::scope_drop_request> {
  using scope_drop_request = couchbase::core::operations::management::scope_drop_request;

  static inline scope_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    scope_drop_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const scope_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::scope_drop_response> {
  using scope_drop_response = couchbase::core::operations::management::scope_drop_response;

  static inline PyObject* to_py(const scope_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::uint64_t>(res->raw_result, "uid", cppObj.uid);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline scope_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// scope_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::scope_get_all_request> {
  using scope_get_all_request = couchbase::core::operations::management::scope_get_all_request;

  static inline scope_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    scope_get_all_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const scope_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::scope_get_all_response> {
  using scope_get_all_response = couchbase::core::operations::management::scope_get_all_response;

  static inline PyObject* to_py(const scope_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::topology::collections_manifest>(
      res->raw_result, "manifest", cppObj.manifest);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline scope_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// EventingFunction Management Operations
// ==========================================================================================

// ==========================================================================================
// eventing_deploy_function request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_deploy_function_request> {
  using eventing_deploy_function_request =
    couchbase::core::operations::management::eventing_deploy_function_request;

  static inline eventing_deploy_function_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_deploy_function_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_deploy_function_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_deploy_function_response> {
  using eventing_deploy_function_response =
    couchbase::core::operations::management::eventing_deploy_function_response;

  static inline PyObject* to_py(const eventing_deploy_function_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_deploy_function_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_drop_function request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_drop_function_request> {
  using eventing_drop_function_request =
    couchbase::core::operations::management::eventing_drop_function_request;

  static inline eventing_drop_function_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_drop_function_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_drop_function_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_drop_function_response> {
  using eventing_drop_function_response =
    couchbase::core::operations::management::eventing_drop_function_response;

  static inline PyObject* to_py(const eventing_drop_function_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_drop_function_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_get_all_functions request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_get_all_functions_request> {
  using eventing_get_all_functions_request =
    couchbase::core::operations::management::eventing_get_all_functions_request;

  static inline eventing_get_all_functions_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_get_all_functions_request req;

    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_get_all_functions_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_get_all_functions_response> {
  using eventing_get_all_functions_response =
    couchbase::core::operations::management::eventing_get_all_functions_response;

  static inline PyObject* to_py(const eventing_get_all_functions_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<couchbase::core::management::eventing::function>>(
      res->raw_result, "functions", cppObj.functions);
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_get_all_functions_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_get_function request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_get_function_request> {
  using eventing_get_function_request =
    couchbase::core::operations::management::eventing_get_function_request;

  static inline eventing_get_function_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_get_function_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_get_function_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_get_function_response> {
  using eventing_get_function_response =
    couchbase::core::operations::management::eventing_get_function_response;

  static inline PyObject* to_py(const eventing_get_function_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::management::eventing::function>(
      res->raw_result, "function", cppObj.function);
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_get_function_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_get_status request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_get_status_request> {
  using eventing_get_status_request =
    couchbase::core::operations::management::eventing_get_status_request;

  static inline eventing_get_status_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_get_status_request req;

    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_get_status_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_get_status_response> {
  using eventing_get_status_response =
    couchbase::core::operations::management::eventing_get_status_response;

  static inline PyObject* to_py(const eventing_get_status_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::management::eventing::status>(
      res->raw_result, "status", cppObj.status);
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_get_status_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_pause_function request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_pause_function_request> {
  using eventing_pause_function_request =
    couchbase::core::operations::management::eventing_pause_function_request;

  static inline eventing_pause_function_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_pause_function_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_pause_function_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_pause_function_response> {
  using eventing_pause_function_response =
    couchbase::core::operations::management::eventing_pause_function_response;

  static inline PyObject* to_py(const eventing_pause_function_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_pause_function_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_resume_function request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_resume_function_request> {
  using eventing_resume_function_request =
    couchbase::core::operations::management::eventing_resume_function_request;

  static inline eventing_resume_function_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_resume_function_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_resume_function_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_resume_function_response> {
  using eventing_resume_function_response =
    couchbase::core::operations::management::eventing_resume_function_response;

  static inline PyObject* to_py(const eventing_resume_function_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_resume_function_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_undeploy_function request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_undeploy_function_request> {
  using eventing_undeploy_function_request =
    couchbase::core::operations::management::eventing_undeploy_function_request;

  static inline eventing_undeploy_function_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_undeploy_function_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_undeploy_function_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_undeploy_function_response> {
  using eventing_undeploy_function_response =
    couchbase::core::operations::management::eventing_undeploy_function_response;

  static inline PyObject* to_py(const eventing_undeploy_function_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_undeploy_function_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// eventing_upsert_function request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_upsert_function_request> {
  using eventing_upsert_function_request =
    couchbase::core::operations::management::eventing_upsert_function_request;

  static inline eventing_upsert_function_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    eventing_upsert_function_request req;

    extract_field<couchbase::core::management::eventing::function>(pyObj, "function", req.function);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const eventing_upsert_function_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_upsert_function_response> {
  using eventing_upsert_function_response =
    couchbase::core::operations::management::eventing_upsert_function_response;

  static inline PyObject* to_py(const eventing_upsert_function_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::optional<couchbase::core::operations::management::eventing_problem>>(
      res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline eventing_upsert_function_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// QueryIndex Management Operations
// ==========================================================================================

// ==========================================================================================
// query_index_build request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_build_request> {
  using query_index_build_request =
    couchbase::core::operations::management::query_index_build_request;

  static inline query_index_build_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    query_index_build_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<couchbase::core::query_context>(pyObj, "query_ctx", req.query_ctx);
    extract_field<std::vector<std::string>>(pyObj, "index_names", req.index_names);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const query_index_build_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_build_response> {
  using query_index_build_response =
    couchbase::core::operations::management::query_index_build_response;

  static inline PyObject* to_py(const query_index_build_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::query_index_build_response::query_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline query_index_build_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// query_index_build_deferred request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_build_deferred_request> {
  using query_index_build_deferred_request =
    couchbase::core::operations::management::query_index_build_deferred_request;

  static inline query_index_build_deferred_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    query_index_build_deferred_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "collection_name", req.collection_name);
    extract_field<couchbase::core::query_context>(pyObj, "query_ctx", req.query_ctx);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const query_index_build_deferred_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_build_deferred_response> {
  using query_index_build_deferred_response =
    couchbase::core::operations::management::query_index_build_deferred_response;

  static inline PyObject* to_py(const query_index_build_deferred_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::query_index_build_deferred_response::query_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline query_index_build_deferred_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// query_index_create request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_create_request> {
  using query_index_create_request =
    couchbase::core::operations::management::query_index_create_request;

  static inline query_index_create_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    query_index_create_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<std::vector<std::string>>(pyObj, "keys", req.keys);
    extract_field<couchbase::core::query_context>(pyObj, "query_ctx", req.query_ctx);
    extract_field<bool>(pyObj, "is_primary", req.is_primary);
    extract_field<bool>(pyObj, "ignore_if_exists", req.ignore_if_exists);
    extract_field<std::optional<std::string>>(pyObj, "condition", req.condition);
    extract_field<std::optional<bool>>(pyObj, "deferred", req.deferred);
    extract_field<std::optional<std::int32_t>>(pyObj, "num_replicas", req.num_replicas);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const query_index_create_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_create_response> {
  using query_index_create_response =
    couchbase::core::operations::management::query_index_create_response;

  static inline PyObject* to_py(const query_index_create_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::query_index_create_response::query_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline query_index_create_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// query_index_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_drop_request> {
  using query_index_drop_request =
    couchbase::core::operations::management::query_index_drop_request;

  static inline query_index_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    query_index_drop_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<couchbase::core::query_context>(pyObj, "query_ctx", req.query_ctx);
    extract_field<bool>(pyObj, "is_primary", req.is_primary);
    extract_field<bool>(pyObj, "ignore_if_does_not_exist", req.ignore_if_does_not_exist);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const query_index_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_drop_response> {
  using query_index_drop_response =
    couchbase::core::operations::management::query_index_drop_response;

  static inline PyObject* to_py(const query_index_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<
      couchbase::core::operations::management::query_index_drop_response::query_problem>>(
      res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline query_index_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// query_index_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_get_all_request> {
  using query_index_get_all_request =
    couchbase::core::operations::management::query_index_get_all_request;

  static inline query_index_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    query_index_get_all_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<couchbase::core::query_context>(pyObj, "query_ctx", req.query_ctx);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const query_index_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_get_all_response> {
  using query_index_get_all_response =
    couchbase::core::operations::management::query_index_get_all_response;

  static inline PyObject* to_py(const query_index_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<couchbase::management::query_index>>(
      res->raw_result, "indexes", cppObj.indexes);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline query_index_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// query_index_get_all_deferred request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::query_index_get_all_deferred_request> {
  using query_index_get_all_deferred_request =
    couchbase::core::operations::management::query_index_get_all_deferred_request;

  static inline query_index_get_all_deferred_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    query_index_get_all_deferred_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "scope_name", req.scope_name);
    extract_field<std::string>(pyObj, "collection_name", req.collection_name);
    extract_field<couchbase::core::query_context>(pyObj, "query_ctx", req.query_ctx);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const query_index_get_all_deferred_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::query_index_get_all_deferred_response> {
  using query_index_get_all_deferred_response =
    couchbase::core::operations::management::query_index_get_all_deferred_response;

  static inline PyObject* to_py(const query_index_get_all_deferred_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::vector<std::string>>(res->raw_result, "index_names", cppObj.index_names);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline query_index_get_all_deferred_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// SearchIndex Management Operations
// ==========================================================================================

// ==========================================================================================
// search_get_stats request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_get_stats_request> {
  using search_get_stats_request =
    couchbase::core::operations::management::search_get_stats_request;

  static inline search_get_stats_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_get_stats_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_get_stats_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_get_stats_response> {
  using search_get_stats_response =
    couchbase::core::operations::management::search_get_stats_response;

  static inline PyObject* to_py(const search_get_stats_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "stats", cppObj.stats);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_get_stats_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_analyze_document request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::search_index_analyze_document_request> {
  using search_index_analyze_document_request =
    couchbase::core::operations::management::search_index_analyze_document_request;

  static inline search_index_analyze_document_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_analyze_document_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<std::string>(pyObj, "encoded_document", req.encoded_document);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_analyze_document_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::search_index_analyze_document_response> {
  using search_index_analyze_document_response =
    couchbase::core::operations::management::search_index_analyze_document_response;

  static inline PyObject* to_py(const search_index_analyze_document_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    add_field<std::string>(res->raw_result, "analysis", cppObj.analysis);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_analyze_document_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_control_ingest request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_control_ingest_request> {
  using search_index_control_ingest_request =
    couchbase::core::operations::management::search_index_control_ingest_request;

  static inline search_index_control_ingest_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_control_ingest_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<bool>(pyObj, "pause", req.pause);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_control_ingest_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_control_ingest_response> {
  using search_index_control_ingest_response =
    couchbase::core::operations::management::search_index_control_ingest_response;

  static inline PyObject* to_py(const search_index_control_ingest_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_control_ingest_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_control_plan_freeze request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::search_index_control_plan_freeze_request> {
  using search_index_control_plan_freeze_request =
    couchbase::core::operations::management::search_index_control_plan_freeze_request;

  static inline search_index_control_plan_freeze_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_control_plan_freeze_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<bool>(pyObj, "freeze", req.freeze);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_control_plan_freeze_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::search_index_control_plan_freeze_response> {
  using search_index_control_plan_freeze_response =
    couchbase::core::operations::management::search_index_control_plan_freeze_response;

  static inline PyObject* to_py(const search_index_control_plan_freeze_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_control_plan_freeze_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_control_query request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_control_query_request> {
  using search_index_control_query_request =
    couchbase::core::operations::management::search_index_control_query_request;

  static inline search_index_control_query_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_control_query_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<bool>(pyObj, "allow", req.allow);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_control_query_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_control_query_response> {
  using search_index_control_query_response =
    couchbase::core::operations::management::search_index_control_query_response;

  static inline PyObject* to_py(const search_index_control_query_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_control_query_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_drop_request> {
  using search_index_drop_request =
    couchbase::core::operations::management::search_index_drop_request;

  static inline search_index_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_drop_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_drop_response> {
  using search_index_drop_response =
    couchbase::core::operations::management::search_index_drop_response;

  static inline PyObject* to_py(const search_index_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_get request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_get_request> {
  using search_index_get_request =
    couchbase::core::operations::management::search_index_get_request;

  static inline search_index_get_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_get_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_get_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_get_response> {
  using search_index_get_response =
    couchbase::core::operations::management::search_index_get_response;

  static inline PyObject* to_py(const search_index_get_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<couchbase::core::management::search::index>(res->raw_result, "index", cppObj.index);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_get_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_get_all_request> {
  using search_index_get_all_request =
    couchbase::core::operations::management::search_index_get_all_request;

  static inline search_index_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_get_all_request req;

    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_get_all_response> {
  using search_index_get_all_response =
    couchbase::core::operations::management::search_index_get_all_response;

  static inline PyObject* to_py(const search_index_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "impl_version", cppObj.impl_version);
    add_field<std::vector<couchbase::core::management::search::index>>(
      res->raw_result, "indexes", cppObj.indexes);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_get_documents_count request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::search_index_get_documents_count_request> {
  using search_index_get_documents_count_request =
    couchbase::core::operations::management::search_index_get_documents_count_request;

  static inline search_index_get_documents_count_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_get_documents_count_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_get_documents_count_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::search_index_get_documents_count_response> {
  using search_index_get_documents_count_response =
    couchbase::core::operations::management::search_index_get_documents_count_response;

  static inline PyObject* to_py(const search_index_get_documents_count_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::uint64_t>(res->raw_result, "count", cppObj.count);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_get_documents_count_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_get_stats request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_get_stats_request> {
  using search_index_get_stats_request =
    couchbase::core::operations::management::search_index_get_stats_request;

  static inline search_index_get_stats_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_get_stats_request req;

    extract_field<std::string>(pyObj, "index_name", req.index_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_get_stats_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_get_stats_response> {
  using search_index_get_stats_response =
    couchbase::core::operations::management::search_index_get_stats_response;

  static inline PyObject* to_py(const search_index_get_stats_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    add_field<std::string>(res->raw_result, "stats", cppObj.stats);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_get_stats_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// search_index_upsert request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_upsert_request> {
  using search_index_upsert_request =
    couchbase::core::operations::management::search_index_upsert_request;

  static inline search_index_upsert_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    search_index_upsert_request req;

    extract_field<couchbase::core::management::search::index>(pyObj, "index", req.index);
    extract_field<std::optional<std::string>>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::optional<std::string>>(pyObj, "scope_name", req.scope_name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const search_index_upsert_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::search_index_upsert_response> {
  using search_index_upsert_response =
    couchbase::core::operations::management::search_index_upsert_response;

  static inline PyObject* to_py(const search_index_upsert_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::string>(res->raw_result, "status", cppObj.status);
    add_field<std::string>(res->raw_result, "name", cppObj.name);
    add_field<std::string>(res->raw_result, "uuid", cppObj.uuid);
    add_field<std::string>(res->raw_result, "error", cppObj.error);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline search_index_upsert_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// User Management Operations
// ==========================================================================================

// ==========================================================================================
// change_password request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::change_password_request> {
  using change_password_request = couchbase::core::operations::management::change_password_request;

  static inline change_password_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    change_password_request req;

    extract_field<std::string>(pyObj, "newPassword", req.newPassword);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const change_password_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::change_password_response> {
  using change_password_response =
    couchbase::core::operations::management::change_password_response;

  static inline PyObject* to_py(const change_password_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline change_password_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// group_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_drop_request> {
  using group_drop_request = couchbase::core::operations::management::group_drop_request;

  static inline group_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    group_drop_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const group_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_drop_response> {
  using group_drop_response = couchbase::core::operations::management::group_drop_response;

  static inline PyObject* to_py(const group_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline group_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// group_get request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_get_request> {
  using group_get_request = couchbase::core::operations::management::group_get_request;

  static inline group_get_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    group_get_request req;

    extract_field<std::string>(pyObj, "name", req.name);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const group_get_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_get_response> {
  using group_get_response = couchbase::core::operations::management::group_get_response;

  static inline PyObject* to_py(const group_get_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::management::rbac::group>(res->raw_result, "group", cppObj.group);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline group_get_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// group_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_get_all_request> {
  using group_get_all_request = couchbase::core::operations::management::group_get_all_request;

  static inline group_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    group_get_all_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const group_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_get_all_response> {
  using group_get_all_response = couchbase::core::operations::management::group_get_all_response;

  static inline PyObject* to_py(const group_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<couchbase::core::management::rbac::group>>(
      res->raw_result, "groups", cppObj.groups);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline group_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// group_upsert request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_upsert_request> {
  using group_upsert_request = couchbase::core::operations::management::group_upsert_request;

  static inline group_upsert_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    group_upsert_request req;

    extract_field<couchbase::core::management::rbac::group>(pyObj, "group", req.group);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const group_upsert_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::group_upsert_response> {
  using group_upsert_response = couchbase::core::operations::management::group_upsert_response;

  static inline PyObject* to_py(const group_upsert_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<std::string>>(res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline group_upsert_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// role_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::role_get_all_request> {
  using role_get_all_request = couchbase::core::operations::management::role_get_all_request;

  static inline role_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    role_get_all_request req;

    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const role_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::role_get_all_response> {
  using role_get_all_response = couchbase::core::operations::management::role_get_all_response;

  static inline PyObject* to_py(const role_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<couchbase::core::management::rbac::role_and_description>>(
      res->raw_result, "roles", cppObj.roles);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline role_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// user_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_drop_request> {
  using user_drop_request = couchbase::core::operations::management::user_drop_request;

  static inline user_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    user_drop_request req;

    extract_field<std::string>(pyObj, "username", req.username);
    extract_field<couchbase::core::management::rbac::auth_domain>(pyObj, "domain", req.domain);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const user_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_drop_response> {
  using user_drop_response = couchbase::core::operations::management::user_drop_response;

  static inline PyObject* to_py(const user_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline user_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// user_get request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_get_request> {
  using user_get_request = couchbase::core::operations::management::user_get_request;

  static inline user_get_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    user_get_request req;

    extract_field<std::string>(pyObj, "username", req.username);
    extract_field<couchbase::core::management::rbac::auth_domain>(pyObj, "domain", req.domain);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const user_get_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_get_response> {
  using user_get_response = couchbase::core::operations::management::user_get_response;

  static inline PyObject* to_py(const user_get_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::management::rbac::user_and_metadata>(
      res->raw_result, "user", cppObj.user);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline user_get_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// user_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_get_all_request> {
  using user_get_all_request = couchbase::core::operations::management::user_get_all_request;

  static inline user_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    user_get_all_request req;

    extract_field<couchbase::core::management::rbac::auth_domain>(pyObj, "domain", req.domain);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const user_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_get_all_response> {
  using user_get_all_response = couchbase::core::operations::management::user_get_all_response;

  static inline PyObject* to_py(const user_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<couchbase::core::management::rbac::user_and_metadata>>(
      res->raw_result, "users", cppObj.users);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline user_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// user_upsert request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_upsert_request> {
  using user_upsert_request = couchbase::core::operations::management::user_upsert_request;

  static inline user_upsert_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    user_upsert_request req;

    extract_field<couchbase::core::management::rbac::auth_domain>(pyObj, "domain", req.domain);
    extract_field<couchbase::core::management::rbac::user>(pyObj, "user", req.user);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const user_upsert_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::user_upsert_response> {
  using user_upsert_response = couchbase::core::operations::management::user_upsert_response;

  static inline PyObject* to_py(const user_upsert_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<std::string>>(res->raw_result, "errors", cppObj.errors);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline user_upsert_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// ViewIndex Management Operations
// ==========================================================================================

// ==========================================================================================
// view_index_drop request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_drop_request> {
  using view_index_drop_request = couchbase::core::operations::management::view_index_drop_request;

  static inline view_index_drop_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    view_index_drop_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "document_name", req.document_name);
    extract_field<couchbase::core::design_document_namespace>(pyObj, "ns", req.ns);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const view_index_drop_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_drop_response> {
  using view_index_drop_response =
    couchbase::core::operations::management::view_index_drop_response;

  static inline PyObject* to_py(const view_index_drop_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline view_index_drop_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// view_index_get request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_get_request> {
  using view_index_get_request = couchbase::core::operations::management::view_index_get_request;

  static inline view_index_get_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    view_index_get_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<std::string>(pyObj, "document_name", req.document_name);
    extract_field<couchbase::core::design_document_namespace>(pyObj, "ns", req.ns);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const view_index_get_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_get_response> {
  using view_index_get_response = couchbase::core::operations::management::view_index_get_response;

  static inline PyObject* to_py(const view_index_get_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<couchbase::core::management::views::design_document>(
      res->raw_result, "document", cppObj.document);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline view_index_get_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// view_index_get_all request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_get_all_request> {
  using view_index_get_all_request =
    couchbase::core::operations::management::view_index_get_all_request;

  static inline view_index_get_all_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    view_index_get_all_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<couchbase::core::design_document_namespace>(pyObj, "ns", req.ns);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const view_index_get_all_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_get_all_response> {
  using view_index_get_all_response =
    couchbase::core::operations::management::view_index_get_all_response;

  static inline PyObject* to_py(const view_index_get_all_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    add_field<std::vector<couchbase::core::management::views::design_document>>(
      res->raw_result, "design_documents", cppObj.design_documents);
    return reinterpret_cast<PyObject*>(res);
  }

  static inline view_index_get_all_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// view_index_upsert request/response
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_upsert_request> {
  using view_index_upsert_request =
    couchbase::core::operations::management::view_index_upsert_request;

  static inline view_index_upsert_request from_py(
    PyObject* pyObj,
    std::shared_ptr<couchbase::core::tracing::wrapper_sdk_span> wrapper_span)
  {
    view_index_upsert_request req;

    extract_field<std::string>(pyObj, "bucket_name", req.bucket_name);
    extract_field<couchbase::core::management::views::design_document>(
      pyObj, "document", req.document);
    extract_field<std::optional<std::string>>(pyObj, "client_context_id", req.client_context_id);
    extract_field<std::optional<std::chrono::milliseconds>>(pyObj, "timeout", req.timeout);
    // TODO(PYCBC-1746): Update once legacy tracing logic is removed
    if (wrapper_span != nullptr) {
      req.parent_span = wrapper_span;
    } else {
      extract_legacy_span_field(pyObj, "parent_span", req.parent_span);
    }
    return req;
  }

  static inline PyObject* to_py(const view_index_upsert_request&)
  {
    Py_RETURN_NONE;
  }
};

template<>
struct py_to_cbpp_t<couchbase::core::operations::management::view_index_upsert_response> {
  using view_index_upsert_response =
    couchbase::core::operations::management::view_index_upsert_response;

  static inline PyObject* to_py(const view_index_upsert_response& cppObj)
  {
    PyObject* pyObj = create_pycbc_result();
    if (pyObj == nullptr) {
      return nullptr;
    }
    pycbc_result* res = reinterpret_cast<pycbc_result*>(pyObj);

    // ctx
    return reinterpret_cast<PyObject*>(res);
  }

  static inline view_index_upsert_response from_py(PyObject*)
  {
    return {};
  }
};

// ==========================================================================================
// Used by multi-op handler to distinguish mutation vs read operations
// ==========================================================================================

template<typename Request>
struct is_mutation_op : std::false_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::append_request> : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::append_request_with_legacy_durability>
  : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::insert_request> : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::insert_request_with_legacy_durability>
  : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::mutate_in_request> : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::mutate_in_request_with_legacy_durability>
  : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::prepend_request> : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::prepend_request_with_legacy_durability>
  : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::replace_request> : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::replace_request_with_legacy_durability>
  : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::upsert_request> : std::true_type {
};

template<>
struct is_mutation_op<couchbase::core::operations::upsert_request_with_legacy_durability>
  : std::true_type {
};

// ==========================================================================================
// Used when executing kv ops to distinguish streaming vs non-streaming ops
// ==========================================================================================

template<typename Request>
struct is_streaming_kv_op : std::false_type {
};

template<>
struct is_streaming_kv_op<couchbase::core::operations::get_all_replicas_request> : std::true_type {
};

template<>
struct is_streaming_kv_op<couchbase::core::operations::lookup_in_all_replicas_request>
  : std::true_type {
};

} // namespace pycbc

// ====================================================================================================
// AUTOGENERATED FILE END - DO NOT EDIT MANUALLY
// Generated-On: 2026-03-01 10:51:59
// ====================================================================================================
