///
/// HybridReactNativeBundleUpdateSpec_cxx.swift
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2026 Marc Rousavy @ Margelo
///

import Foundation
import NitroModules

/**
 * A class implementation that bridges HybridReactNativeBundleUpdateSpec over to C++.
 * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
 *
 * Also, some Swift types need to be bridged with special handling:
 * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
 * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
 * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
 */
open class HybridReactNativeBundleUpdateSpec_cxx {
  /**
   * The Swift <> C++ bridge's namespace (`margelo::nitro::reactnativebundleupdate::bridge::swift`)
   * from `ReactNativeBundleUpdate-Swift-Cxx-Bridge.hpp`.
   * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
   */
  public typealias bridge = margelo.nitro.reactnativebundleupdate.bridge.swift

  /**
   * Holds an instance of the `HybridReactNativeBundleUpdateSpec` Swift protocol.
   */
  private var __implementation: any HybridReactNativeBundleUpdateSpec

  /**
   * Holds a weak pointer to the C++ class that wraps the Swift class.
   */
  private var __cxxPart: bridge.std__weak_ptr_HybridReactNativeBundleUpdateSpec_

  /**
   * Create a new `HybridReactNativeBundleUpdateSpec_cxx` that wraps the given `HybridReactNativeBundleUpdateSpec`.
   * All properties and methods bridge to C++ types.
   */
  public init(_ implementation: any HybridReactNativeBundleUpdateSpec) {
    self.__implementation = implementation
    self.__cxxPart = .init()
    /* no base class */
  }

  /**
   * Get the actual `HybridReactNativeBundleUpdateSpec` instance this class wraps.
   */
  @inline(__always)
  public func getHybridReactNativeBundleUpdateSpec() -> any HybridReactNativeBundleUpdateSpec {
    return __implementation
  }

  /**
   * Casts this instance to a retained unsafe raw pointer.
   * This acquires one additional strong reference on the object!
   */
  public func toUnsafe() -> UnsafeMutableRawPointer {
    return Unmanaged.passRetained(self).toOpaque()
  }

  /**
   * Casts an unsafe pointer to a `HybridReactNativeBundleUpdateSpec_cxx`.
   * The pointer has to be a retained opaque `Unmanaged<HybridReactNativeBundleUpdateSpec_cxx>`.
   * This removes one strong reference from the object!
   */
  public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridReactNativeBundleUpdateSpec_cxx {
    return Unmanaged<HybridReactNativeBundleUpdateSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
  }

  /**
   * Gets (or creates) the C++ part of this Hybrid Object.
   * The C++ part is a `std::shared_ptr<HybridReactNativeBundleUpdateSpec>`.
   */
  public func getCxxPart() -> bridge.std__shared_ptr_HybridReactNativeBundleUpdateSpec_ {
    let cachedCxxPart = self.__cxxPart.lock()
    if Bool(fromCxx: cachedCxxPart) {
      return cachedCxxPart
    } else {
      let newCxxPart = bridge.create_std__shared_ptr_HybridReactNativeBundleUpdateSpec_(self.toUnsafe())
      __cxxPart = bridge.weakify_std__shared_ptr_HybridReactNativeBundleUpdateSpec_(newCxxPart)
      return newCxxPart
    }
  }

  

  /**
   * Get the memory size of the Swift class (plus size of any other allocations)
   * so the JS VM can properly track it and garbage-collect the JS object if needed.
   */
  @inline(__always)
  public var memorySize: Int {
    return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
  }

  /**
   * Call dispose() on the Swift class.
   * This _may_ be called manually from JS.
   */
  @inline(__always)
  public func dispose() {
    self.__implementation.dispose()
  }

  /**
   * Call toString() on the Swift class.
   */
  @inline(__always)
  public func toString() -> String {
    return self.__implementation.toString()
  }

  // Properties
  

  // Methods
  @inline(__always)
  public final func downloadBundle(params: BundleDownloadParams) -> bridge.Result_std__shared_ptr_Promise_BundleDownloadResult___ {
    do {
      let __result = try self.__implementation.downloadBundle(params: params)
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_BundleDownloadResult__ in
        let __promise = bridge.create_std__shared_ptr_Promise_BundleDownloadResult__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_BundleDownloadResult__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_BundleDownloadResult___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_BundleDownloadResult___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func verifyBundle(params: BundleVerifyParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
    do {
      let __result = try self.__implementation.verifyBundle(params: params)
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
        let __promise = bridge.create_std__shared_ptr_Promise_void__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve() })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func verifyBundleASC(params: BundleVerifyASCParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
    do {
      let __result = try self.__implementation.verifyBundleASC(params: params)
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
        let __promise = bridge.create_std__shared_ptr_Promise_void__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve() })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func downloadBundleASC(params: BundleDownloadASCParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
    do {
      let __result = try self.__implementation.downloadBundleASC(params: params)
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
        let __promise = bridge.create_std__shared_ptr_Promise_void__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve() })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func installBundle(params: BundleInstallParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
    do {
      let __result = try self.__implementation.installBundle(params: params)
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
        let __promise = bridge.create_std__shared_ptr_Promise_void__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve() })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func clearBundle() -> bridge.Result_std__shared_ptr_Promise_void___ {
    do {
      let __result = try self.__implementation.clearBundle()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
        let __promise = bridge.create_std__shared_ptr_Promise_void__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve() })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func clearAllJSBundleData() -> bridge.Result_std__shared_ptr_Promise_TestResult___ {
    do {
      let __result = try self.__implementation.clearAllJSBundleData()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_TestResult__ in
        let __promise = bridge.create_std__shared_ptr_Promise_TestResult__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_TestResult__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func getFallbackUpdateBundleData() -> bridge.Result_std__shared_ptr_Promise_std__vector_FallbackBundleInfo____ {
    do {
      let __result = try self.__implementation.getFallbackUpdateBundleData()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_FallbackBundleInfo___ in
        let __promise = bridge.create_std__shared_ptr_Promise_std__vector_FallbackBundleInfo___()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_FallbackBundleInfo___(__promise)
        __result
          .then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_FallbackBundleInfo_ in
              var __vector = bridge.create_std__vector_FallbackBundleInfo_(__result.count)
              for __item in __result {
                __vector.push_back(__item)
              }
              return __vector
            }()) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_std__vector_FallbackBundleInfo____(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_std__vector_FallbackBundleInfo____(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func setCurrentUpdateBundleData(params: BundleSwitchParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
    do {
      let __result = try self.__implementation.setCurrentUpdateBundleData(params: params)
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
        let __promise = bridge.create_std__shared_ptr_Promise_void__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve() })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func getWebEmbedPath() -> bridge.Result_std__string_ {
    do {
      let __result = try self.__implementation.getWebEmbedPath()
      let __resultCpp = std.string(__result)
      return bridge.create_Result_std__string_(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__string_(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func getWebEmbedPathAsync() -> bridge.Result_std__shared_ptr_Promise_std__string___ {
    do {
      let __result = try self.__implementation.getWebEmbedPathAsync()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
        let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(std.string(__result)) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func getJsBundlePath() -> bridge.Result_std__shared_ptr_Promise_std__string___ {
    do {
      let __result = try self.__implementation.getJsBundlePath()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
        let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(std.string(__result)) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func getNativeAppVersion() -> bridge.Result_std__shared_ptr_Promise_std__string___ {
    do {
      let __result = try self.__implementation.getNativeAppVersion()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
        let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(std.string(__result)) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func testVerification() -> bridge.Result_std__shared_ptr_Promise_bool___ {
    do {
      let __result = try self.__implementation.testVerification()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
        let __promise = bridge.create_std__shared_ptr_Promise_bool__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func isBundleExists(appVersion: std.string, bundleVersion: std.string) -> bridge.Result_std__shared_ptr_Promise_bool___ {
    do {
      let __result = try self.__implementation.isBundleExists(appVersion: String(appVersion), bundleVersion: String(bundleVersion))
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
        let __promise = bridge.create_std__shared_ptr_Promise_bool__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func verifyExtractedBundle(appVersion: std.string, bundleVersion: std.string) -> bridge.Result_std__shared_ptr_Promise_void___ {
    do {
      let __result = try self.__implementation.verifyExtractedBundle(appVersion: String(appVersion), bundleVersion: String(bundleVersion))
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
        let __promise = bridge.create_std__shared_ptr_Promise_void__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve() })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func listLocalBundles() -> bridge.Result_std__shared_ptr_Promise_std__vector_LocalBundleInfo____ {
    do {
      let __result = try self.__implementation.listLocalBundles()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_LocalBundleInfo___ in
        let __promise = bridge.create_std__shared_ptr_Promise_std__vector_LocalBundleInfo___()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_LocalBundleInfo___(__promise)
        __result
          .then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_LocalBundleInfo_ in
              var __vector = bridge.create_std__vector_LocalBundleInfo_(__result.count)
              for __item in __result {
                __vector.push_back(__item)
              }
              return __vector
            }()) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_std__vector_LocalBundleInfo____(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_std__vector_LocalBundleInfo____(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func listAscFiles() -> bridge.Result_std__shared_ptr_Promise_std__vector_AscFileInfo____ {
    do {
      let __result = try self.__implementation.listAscFiles()
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_AscFileInfo___ in
        let __promise = bridge.create_std__shared_ptr_Promise_std__vector_AscFileInfo___()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_AscFileInfo___(__promise)
        __result
          .then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_AscFileInfo_ in
              var __vector = bridge.create_std__vector_AscFileInfo_(__result.count)
              for __item in __result {
                __vector.push_back(__item)
              }
              return __vector
            }()) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_std__vector_AscFileInfo____(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_std__vector_AscFileInfo____(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func getSha256FromFilePath(filePath: std.string) -> bridge.Result_std__shared_ptr_Promise_std__string___ {
    do {
      let __result = try self.__implementation.getSha256FromFilePath(filePath: String(filePath))
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
        let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(std.string(__result)) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func testDeleteJsBundle(appVersion: std.string, bundleVersion: std.string) -> bridge.Result_std__shared_ptr_Promise_TestResult___ {
    do {
      let __result = try self.__implementation.testDeleteJsBundle(appVersion: String(appVersion), bundleVersion: String(bundleVersion))
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_TestResult__ in
        let __promise = bridge.create_std__shared_ptr_Promise_TestResult__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_TestResult__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func testDeleteJsRuntimeDir(appVersion: std.string, bundleVersion: std.string) -> bridge.Result_std__shared_ptr_Promise_TestResult___ {
    do {
      let __result = try self.__implementation.testDeleteJsRuntimeDir(appVersion: String(appVersion), bundleVersion: String(bundleVersion))
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_TestResult__ in
        let __promise = bridge.create_std__shared_ptr_Promise_TestResult__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_TestResult__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func testDeleteMetadataJson(appVersion: std.string, bundleVersion: std.string) -> bridge.Result_std__shared_ptr_Promise_TestResult___ {
    do {
      let __result = try self.__implementation.testDeleteMetadataJson(appVersion: String(appVersion), bundleVersion: String(bundleVersion))
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_TestResult__ in
        let __promise = bridge.create_std__shared_ptr_Promise_TestResult__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_TestResult__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func testWriteEmptyMetadataJson(appVersion: std.string, bundleVersion: std.string) -> bridge.Result_std__shared_ptr_Promise_TestResult___ {
    do {
      let __result = try self.__implementation.testWriteEmptyMetadataJson(appVersion: String(appVersion), bundleVersion: String(bundleVersion))
      let __resultCpp = { () -> bridge.std__shared_ptr_Promise_TestResult__ in
        let __promise = bridge.create_std__shared_ptr_Promise_TestResult__()
        let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_TestResult__(__promise)
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
        return __promise
      }()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_std__shared_ptr_Promise_TestResult___(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func addDownloadListener(callback: bridge.Func_void_BundleDownloadEvent) -> bridge.Result_double_ {
    do {
      let __result = try self.__implementation.addDownloadListener(callback: { () -> (BundleDownloadEvent) -> Void in
        let __wrappedFunction = bridge.wrap_Func_void_BundleDownloadEvent(callback)
        return { (__event: BundleDownloadEvent) -> Void in
          __wrappedFunction.call(__event)
        }
      }())
      let __resultCpp = __result
      return bridge.create_Result_double_(__resultCpp)
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_double_(__exceptionPtr)
    }
  }
  
  @inline(__always)
  public final func removeDownloadListener(id: Double) -> bridge.Result_void_ {
    do {
      try self.__implementation.removeDownloadListener(id: id)
      return bridge.create_Result_void_()
    } catch (let __error) {
      let __exceptionPtr = __error.toCpp()
      return bridge.create_Result_void_(__exceptionPtr)
    }
  }
}
