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/// The participant type determines whether a participant can modify the list of participants on a share.
61///
62///
63/// - Owners can add private users
64/// - Private users can access the share
65/// - Public users are "self-added" when the participant accesses the shareURL.  Owners cannot add public users.
66///
67/// See also [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipantrole?language=objc)
68// NS_ENUM
69#[repr(transparent)]
70#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
71pub struct CKShareParticipantRole(pub NSInteger);
72impl CKShareParticipantRole {
73    #[doc(alias = "CKShareParticipantRoleUnknown")]
74    pub const Unknown: Self = Self(0);
75    #[doc(alias = "CKShareParticipantRoleOwner")]
76    pub const Owner: Self = Self(1);
77    #[doc(alias = "CKShareParticipantRolePrivateUser")]
78    pub const PrivateUser: Self = Self(3);
79    #[doc(alias = "CKShareParticipantRolePublicUser")]
80    pub const PublicUser: Self = Self(4);
81}
82
83unsafe impl Encode for CKShareParticipantRole {
84    const ENCODING: Encoding = NSInteger::ENCODING;
85}
86
87unsafe impl RefEncode for CKShareParticipantRole {
88    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
89}
90
91/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipanttype?language=objc)
92// NS_ENUM
93#[deprecated]
94#[repr(transparent)]
95#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
96pub struct CKShareParticipantType(pub NSInteger);
97impl CKShareParticipantType {
98    #[doc(alias = "CKShareParticipantTypeUnknown")]
99    #[deprecated]
100    pub const Unknown: Self = Self(0);
101    #[doc(alias = "CKShareParticipantTypeOwner")]
102    #[deprecated]
103    pub const Owner: Self = Self(1);
104    #[doc(alias = "CKShareParticipantTypePrivateUser")]
105    #[deprecated]
106    pub const PrivateUser: Self = Self(3);
107    #[doc(alias = "CKShareParticipantTypePublicUser")]
108    #[deprecated]
109    pub const PublicUser: Self = Self(4);
110}
111
112unsafe impl Encode for CKShareParticipantType {
113    const ENCODING: Encoding = NSInteger::ENCODING;
114}
115
116unsafe impl RefEncode for CKShareParticipantType {
117    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
118}
119
120extern_class!(
121    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckshareparticipant?language=objc)
122    #[unsafe(super(NSObject))]
123    #[derive(Debug, PartialEq, Eq, Hash)]
124    pub struct CKShareParticipant;
125);
126
127extern_conformance!(
128    unsafe impl NSCoding for CKShareParticipant {}
129);
130
131extern_conformance!(
132    unsafe impl NSCopying for CKShareParticipant {}
133);
134
135unsafe impl CopyingHelper for CKShareParticipant {
136    type Result = Self;
137}
138
139extern_conformance!(
140    unsafe impl NSObjectProtocol for CKShareParticipant {}
141);
142
143extern_conformance!(
144    unsafe impl NSSecureCoding for CKShareParticipant {}
145);
146
147impl CKShareParticipant {
148    extern_methods!(
149        /// Use
150        /// `CKFetchShareParticipantsOperation`to create a
151        /// `CKShareParticipant`object
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159
160        #[cfg(feature = "CKUserIdentity")]
161        #[unsafe(method(userIdentity))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn userIdentity(&self) -> Retained<CKUserIdentity>;
164
165        /// The default participant role is
166        /// `CKShareParticipantRolePrivateUser.`
167        #[unsafe(method(role))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn role(&self) -> CKShareParticipantRole;
170
171        /// Setter for [`role`][Self::role].
172        #[unsafe(method(setRole:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn setRole(&self, role: CKShareParticipantRole);
175
176        /// The default participant type is
177        /// `CKShareParticipantTypePrivateUser.`
178        #[deprecated]
179        #[unsafe(method(type))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn r#type(&self) -> CKShareParticipantType;
182
183        /// Setter for [`type`][Self::type].
184        #[deprecated]
185        #[unsafe(method(setType:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setType(&self, r#type: CKShareParticipantType);
188
189        #[unsafe(method(acceptanceStatus))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn acceptanceStatus(&self) -> CKShareParticipantAcceptanceStatus;
192
193        /// The default permission for a new participant is
194        /// `CKShareParticipantPermissionReadOnly.`
195        #[unsafe(method(permission))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn permission(&self) -> CKShareParticipantPermission;
198
199        /// Setter for [`permission`][Self::permission].
200        #[unsafe(method(setPermission:))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn setPermission(&self, permission: CKShareParticipantPermission);
203
204        /// A unique identifier for this participant.
205        #[unsafe(method(participantID))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn participantID(&self) -> Retained<NSString>;
208    );
209}