objc2_cloud_kit/generated/
CKShareParticipant.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipantacceptancestatus?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct CKShareParticipantAcceptanceStatus(pub NSInteger);
15impl CKShareParticipantAcceptanceStatus {
16    #[doc(alias = "CKShareParticipantAcceptanceStatusUnknown")]
17    pub const Unknown: Self = Self(0);
18    #[doc(alias = "CKShareParticipantAcceptanceStatusPending")]
19    pub const Pending: Self = Self(1);
20    #[doc(alias = "CKShareParticipantAcceptanceStatusAccepted")]
21    pub const Accepted: Self = Self(2);
22    #[doc(alias = "CKShareParticipantAcceptanceStatusRemoved")]
23    pub const Removed: Self = Self(3);
24}
25
26unsafe impl Encode for CKShareParticipantAcceptanceStatus {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for CKShareParticipantAcceptanceStatus {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// These permissions determine what share participants can do with records inside that share
35///
36/// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipantpermission?language=objc)
37// NS_ENUM
38#[repr(transparent)]
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
40pub struct CKShareParticipantPermission(pub NSInteger);
41impl CKShareParticipantPermission {
42    #[doc(alias = "CKShareParticipantPermissionUnknown")]
43    pub const Unknown: Self = Self(0);
44    #[doc(alias = "CKShareParticipantPermissionNone")]
45    pub const None: Self = Self(1);
46    #[doc(alias = "CKShareParticipantPermissionReadOnly")]
47    pub const ReadOnly: Self = Self(2);
48    #[doc(alias = "CKShareParticipantPermissionReadWrite")]
49    pub const ReadWrite: Self = Self(3);
50}
51
52unsafe impl Encode for CKShareParticipantPermission {
53    const ENCODING: Encoding = NSInteger::ENCODING;
54}
55
56unsafe impl RefEncode for CKShareParticipantPermission {
57    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
58}
59
60/// Defines the participant role in a share:
61/// - `owner`: Can add private users.
62/// - `privateUser`: Can access the share.
63/// - `publicUser`: Self-added when accessing the share URL (owners cannot add public users).
64/// - `administrator`: Can add and remove participants and change their permissions.
65///
66/// Shares with ``CloudKit/CKShareParticipantRole/CKShareParticipantRoleAdministrator`` participants will be returned as read-only to devices running OS versions prior to this role being introduced.
67/// Administrator participants on these read-only shares will be returned as ``CloudKit/CKShareParticipantRole/CKShareParticipantRolePrivateUser``.
68///
69/// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipantrole?language=objc)
70// NS_ENUM
71#[repr(transparent)]
72#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
73pub struct CKShareParticipantRole(pub NSInteger);
74impl CKShareParticipantRole {
75    #[doc(alias = "CKShareParticipantRoleUnknown")]
76    pub const Unknown: Self = Self(0);
77    #[doc(alias = "CKShareParticipantRoleOwner")]
78    pub const Owner: Self = Self(1);
79    #[doc(alias = "CKShareParticipantRolePrivateUser")]
80    pub const PrivateUser: Self = Self(3);
81    #[doc(alias = "CKShareParticipantRolePublicUser")]
82    pub const PublicUser: Self = Self(4);
83    #[doc(alias = "CKShareParticipantRoleAdministrator")]
84    pub const Administrator: Self = Self(2);
85}
86
87unsafe impl Encode for CKShareParticipantRole {
88    const ENCODING: Encoding = NSInteger::ENCODING;
89}
90
91unsafe impl RefEncode for CKShareParticipantRole {
92    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
93}
94
95/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipanttype?language=objc)
96// NS_ENUM
97#[deprecated]
98#[repr(transparent)]
99#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
100pub struct CKShareParticipantType(pub NSInteger);
101impl CKShareParticipantType {
102    #[doc(alias = "CKShareParticipantTypeUnknown")]
103    #[deprecated]
104    pub const Unknown: Self = Self(0);
105    #[doc(alias = "CKShareParticipantTypeOwner")]
106    #[deprecated]
107    pub const Owner: Self = Self(1);
108    #[doc(alias = "CKShareParticipantTypePrivateUser")]
109    #[deprecated]
110    pub const PrivateUser: Self = Self(3);
111    #[doc(alias = "CKShareParticipantTypePublicUser")]
112    #[deprecated]
113    pub const PublicUser: Self = Self(4);
114}
115
116unsafe impl Encode for CKShareParticipantType {
117    const ENCODING: Encoding = NSInteger::ENCODING;
118}
119
120unsafe impl RefEncode for CKShareParticipantType {
121    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
122}
123
124extern_class!(
125    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipant?language=objc)
126    #[unsafe(super(NSObject))]
127    #[derive(Debug, PartialEq, Eq, Hash)]
128    pub struct CKShareParticipant;
129);
130
131extern_conformance!(
132    unsafe impl NSCoding for CKShareParticipant {}
133);
134
135extern_conformance!(
136    unsafe impl NSCopying for CKShareParticipant {}
137);
138
139unsafe impl CopyingHelper for CKShareParticipant {
140    type Result = Self;
141}
142
143extern_conformance!(
144    unsafe impl NSObjectProtocol for CKShareParticipant {}
145);
146
147extern_conformance!(
148    unsafe impl NSSecureCoding for CKShareParticipant {}
149);
150
151impl CKShareParticipant {
152    extern_methods!(
153        /// Use
154        /// `CKFetchShareParticipantsOperation`to create a
155        /// `CKShareParticipant`object
156        #[unsafe(method(init))]
157        #[unsafe(method_family = init)]
158        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
159
160        #[unsafe(method(new))]
161        #[unsafe(method_family = new)]
162        pub unsafe fn new() -> Retained<Self>;
163
164        #[cfg(feature = "CKUserIdentity")]
165        #[unsafe(method(userIdentity))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn userIdentity(&self) -> Retained<CKUserIdentity>;
168
169        /// The default participant role is
170        /// `CKShareParticipantRolePrivateUser.`
171        #[unsafe(method(role))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn role(&self) -> CKShareParticipantRole;
174
175        /// Setter for [`role`][Self::role].
176        #[unsafe(method(setRole:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn setRole(&self, role: CKShareParticipantRole);
179
180        /// The default participant type is ``CloudKit/CKShareParticipantType/CKShareParticipantTypePrivateUser``.
181        #[deprecated]
182        #[unsafe(method(type))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn r#type(&self) -> CKShareParticipantType;
185
186        /// Setter for [`type`][Self::type].
187        #[deprecated]
188        #[unsafe(method(setType:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setType(&self, r#type: CKShareParticipantType);
191
192        #[unsafe(method(acceptanceStatus))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn acceptanceStatus(&self) -> CKShareParticipantAcceptanceStatus;
195
196        /// The default permission for a new participant is
197        /// `CKShareParticipantPermissionReadOnly.`
198        #[unsafe(method(permission))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn permission(&self) -> CKShareParticipantPermission;
201
202        /// Setter for [`permission`][Self::permission].
203        #[unsafe(method(setPermission:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setPermission(&self, permission: CKShareParticipantPermission);
206
207        /// A unique identifier for this participant.
208        #[unsafe(method(participantID))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn participantID(&self) -> Retained<NSString>;
211
212        /// Indicates whether the participant was originally a requester who was approved to join the share.
213        #[unsafe(method(isApprovedRequester))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn isApprovedRequester(&self) -> bool;
216
217        /// The date and time when the participant was added to the share.
218        ///
219        /// This timestamp is set when the share is successfully saved to the server.
220        #[unsafe(method(dateAddedToShare))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn dateAddedToShare(&self) -> Option<Retained<NSDate>>;
223
224        /// Generate a unique URL for inviting a participant without knowing their handle
225        ///
226        /// When a participant's email address / phone number / userRecordID isn't known up-front, a ``CKShareParticipant/oneTimeURLParticipant`` can be added
227        /// to the share. Once the share is saved, a custom invitation link or one-time URL is available for the added participant via ``CKShare/oneTimeURLForParticipantID:``.
228        /// This custom link can be used by any recipient user to fetch share metadata and accept the share.
229        ///
230        /// Note that a one-time URL participant in the ``ParticipantAcceptanceStatus/pending`` state has empty ``CKUserIdentity/nameComponents``
231        /// and a nil ``CKUserIdentity/lookupInfo``.
232        #[unsafe(method(oneTimeURLParticipant))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn oneTimeURLParticipant() -> Retained<Self>;
235    );
236}