1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSHTTPCookiePropertyKey = NSString;

// NS_TYPED_ENUM
#[cfg(feature = "NSString")]
pub type NSHTTPCookieStringPolicy = NSString;

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieName: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieValue: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieOriginURL: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieVersion: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieDomain: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookiePath: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieSecure: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieExpires: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieComment: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieCommentURL: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieDiscard: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieMaximumAge: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookiePort: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieSameSitePolicy: &'static NSHTTPCookiePropertyKey;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieSameSiteLax: &'static NSHTTPCookieStringPolicy;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSHTTPCookieSameSiteStrict: &'static NSHTTPCookieStringPolicy;
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSHTTPCookie;

    unsafe impl ClassType for NSHTTPCookie {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for NSHTTPCookie {}

unsafe impl Sync for NSHTTPCookie {}

unsafe impl NSObjectProtocol for NSHTTPCookie {}

extern_methods!(
    unsafe impl NSHTTPCookie {
        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[method_id(@__retain_semantics Init initWithProperties:)]
        pub unsafe fn initWithProperties(
            this: Allocated<Self>,
            properties: &NSDictionary<NSHTTPCookiePropertyKey, AnyObject>,
        ) -> Option<Retained<Self>>;

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[method_id(@__retain_semantics Other cookieWithProperties:)]
        pub unsafe fn cookieWithProperties(
            properties: &NSDictionary<NSHTTPCookiePropertyKey, AnyObject>,
        ) -> Option<Retained<NSHTTPCookie>>;

        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
        #[method_id(@__retain_semantics Other requestHeaderFieldsWithCookies:)]
        pub unsafe fn requestHeaderFieldsWithCookies(
            cookies: &NSArray<NSHTTPCookie>,
        ) -> Retained<NSDictionary<NSString, NSString>>;

        #[cfg(all(
            feature = "NSArray",
            feature = "NSDictionary",
            feature = "NSString",
            feature = "NSURL"
        ))]
        #[method_id(@__retain_semantics Other cookiesWithResponseHeaderFields:forURL:)]
        pub unsafe fn cookiesWithResponseHeaderFields_forURL(
            header_fields: &NSDictionary<NSString, NSString>,
            url: &NSURL,
        ) -> Retained<NSArray<NSHTTPCookie>>;

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[method_id(@__retain_semantics Other properties)]
        pub unsafe fn properties(
            &self,
        ) -> Option<Retained<NSDictionary<NSHTTPCookiePropertyKey, AnyObject>>>;

        #[method(version)]
        pub unsafe fn version(&self) -> NSUInteger;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other name)]
        pub unsafe fn name(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other value)]
        pub unsafe fn value(&self) -> Retained<NSString>;

        #[cfg(feature = "NSDate")]
        #[method_id(@__retain_semantics Other expiresDate)]
        pub unsafe fn expiresDate(&self) -> Option<Retained<NSDate>>;

        #[method(isSessionOnly)]
        pub unsafe fn isSessionOnly(&self) -> bool;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other domain)]
        pub unsafe fn domain(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other path)]
        pub unsafe fn path(&self) -> Retained<NSString>;

        #[method(isSecure)]
        pub unsafe fn isSecure(&self) -> bool;

        #[method(isHTTPOnly)]
        pub unsafe fn isHTTPOnly(&self) -> bool;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other comment)]
        pub unsafe fn comment(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other commentURL)]
        pub unsafe fn commentURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(all(feature = "NSArray", feature = "NSValue"))]
        #[method_id(@__retain_semantics Other portList)]
        pub unsafe fn portList(&self) -> Option<Retained<NSArray<NSNumber>>>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other sameSitePolicy)]
        pub unsafe fn sameSitePolicy(&self) -> Option<Retained<NSHTTPCookieStringPolicy>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSHTTPCookie {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);