use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKDownload;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKDownload {}
);
extern_conformance!(
unsafe impl NSProgressReporting for WKDownload {}
);
impl WKDownload {
extern_methods!(
#[unsafe(method(originalRequest))]
#[unsafe(method_family = none)]
pub unsafe fn originalRequest(&self) -> Option<Retained<NSURLRequest>>;
#[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
#[unsafe(method(webView))]
#[unsafe(method_family = none)]
pub unsafe fn webView(&self) -> Option<Retained<WKWebView>>;
#[cfg(feature = "WKDownloadDelegate")]
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn WKDownloadDelegate>>>;
#[cfg(feature = "WKDownloadDelegate")]
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn WKDownloadDelegate>>);
#[unsafe(method(isUserInitiated))]
#[unsafe(method_family = none)]
pub unsafe fn isUserInitiated(&self) -> bool;
#[cfg(feature = "WKFrameInfo")]
#[unsafe(method(originatingFrame))]
#[unsafe(method_family = none)]
pub unsafe fn originatingFrame(&self) -> Retained<WKFrameInfo>;
#[cfg(feature = "block2")]
#[unsafe(method(cancel:))]
#[unsafe(method_family = none)]
pub unsafe fn cancel(
&self,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSData)>>,
);
);
}
impl WKDownload {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}