use crate::common::*;
use crate::Foundation::*;
ns_enum!(
#[underlying(NSUInteger)]
pub enum NSHTTPCookieAcceptPolicy {
NSHTTPCookieAcceptPolicyAlways = 0,
NSHTTPCookieAcceptPolicyNever = 1,
NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2,
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSHTTPCookieStorage;
unsafe impl ClassType for NSHTTPCookieStorage {
type Super = NSObject;
}
);
extern_methods!(
unsafe impl NSHTTPCookieStorage {
#[method_id(@__retain_semantics Other sharedHTTPCookieStorage)]
pub unsafe fn sharedHTTPCookieStorage() -> Id<NSHTTPCookieStorage, Shared>;
#[method_id(@__retain_semantics Other sharedCookieStorageForGroupContainerIdentifier:)]
pub unsafe fn sharedCookieStorageForGroupContainerIdentifier(
identifier: &NSString,
) -> Id<NSHTTPCookieStorage, Shared>;
#[method_id(@__retain_semantics Other cookies)]
pub unsafe fn cookies(&self) -> Option<Id<NSArray<NSHTTPCookie>, Shared>>;
#[method(setCookie:)]
pub unsafe fn setCookie(&self, cookie: &NSHTTPCookie);
#[method(deleteCookie:)]
pub unsafe fn deleteCookie(&self, cookie: &NSHTTPCookie);
#[method(removeCookiesSinceDate:)]
pub unsafe fn removeCookiesSinceDate(&self, date: &NSDate);
#[method_id(@__retain_semantics Other cookiesForURL:)]
pub unsafe fn cookiesForURL(
&self,
URL: &NSURL,
) -> Option<Id<NSArray<NSHTTPCookie>, Shared>>;
#[method(setCookies:forURL:mainDocumentURL:)]
pub unsafe fn setCookies_forURL_mainDocumentURL(
&self,
cookies: &NSArray<NSHTTPCookie>,
URL: Option<&NSURL>,
mainDocumentURL: Option<&NSURL>,
);
#[method(cookieAcceptPolicy)]
pub unsafe fn cookieAcceptPolicy(&self) -> NSHTTPCookieAcceptPolicy;
#[method(setCookieAcceptPolicy:)]
pub unsafe fn setCookieAcceptPolicy(&self, cookieAcceptPolicy: NSHTTPCookieAcceptPolicy);
#[method_id(@__retain_semantics Other sortedCookiesUsingDescriptors:)]
pub unsafe fn sortedCookiesUsingDescriptors(
&self,
sortOrder: &NSArray<NSSortDescriptor>,
) -> Id<NSArray<NSHTTPCookie>, Shared>;
}
);
extern_methods!(
unsafe impl NSHTTPCookieStorage {
#[method(storeCookies:forTask:)]
pub unsafe fn storeCookies_forTask(
&self,
cookies: &NSArray<NSHTTPCookie>,
task: &NSURLSessionTask,
);
#[method(getCookiesForTask:completionHandler:)]
pub unsafe fn getCookiesForTask_completionHandler(
&self,
task: &NSURLSessionTask,
completionHandler: &Block<(*mut NSArray<NSHTTPCookie>,), ()>,
);
}
);
extern_static!(NSHTTPCookieManagerAcceptPolicyChangedNotification: &'static NSNotificationName);
extern_static!(NSHTTPCookieManagerCookiesChangedNotification: &'static NSNotificationName);