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    #[deprecated]
99    #[doc(alias = "CKShareParticipantTypeUnknown")]
100    pub const Unknown: Self = Self(0);
101    #[deprecated]
102    #[doc(alias = "CKShareParticipantTypeOwner")]
103    pub const Owner: Self = Self(1);
104    #[deprecated]
105    #[doc(alias = "CKShareParticipantTypePrivateUser")]
106    pub const PrivateUser: Self = Self(3);
107    #[deprecated]
108    #[doc(alias = "CKShareParticipantTypePublicUser")]
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
127unsafe impl NSCoding for CKShareParticipant {}
128
129unsafe impl NSCopying for CKShareParticipant {}
130
131unsafe impl CopyingHelper for CKShareParticipant {
132    type Result = Self;
133}
134
135unsafe impl NSObjectProtocol for CKShareParticipant {}
136
137unsafe impl NSSecureCoding for CKShareParticipant {}
138
139impl CKShareParticipant {
140    extern_methods!(
141        /// Use
142        /// `CKFetchShareParticipantsOperation`to create a
143        /// `CKShareParticipant`object
144        #[unsafe(method(init))]
145        #[unsafe(method_family = init)]
146        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
147
148        #[unsafe(method(new))]
149        #[unsafe(method_family = new)]
150        pub unsafe fn new() -> Retained<Self>;
151
152        #[cfg(feature = "CKUserIdentity")]
153        #[unsafe(method(userIdentity))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn userIdentity(&self) -> Retained<CKUserIdentity>;
156
157        /// The default participant role is
158        /// `CKShareParticipantRolePrivateUser.`
159        #[unsafe(method(role))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn role(&self) -> CKShareParticipantRole;
162
163        /// Setter for [`role`][Self::role].
164        #[unsafe(method(setRole:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn setRole(&self, role: CKShareParticipantRole);
167
168        /// The default participant type is
169        /// `CKShareParticipantTypePrivateUser.`
170        #[deprecated]
171        #[unsafe(method(type))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn r#type(&self) -> CKShareParticipantType;
174
175        /// Setter for [`type`][Self::type].
176        #[deprecated]
177        #[unsafe(method(setType:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setType(&self, r#type: CKShareParticipantType);
180
181        #[unsafe(method(acceptanceStatus))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn acceptanceStatus(&self) -> CKShareParticipantAcceptanceStatus;
184
185        /// The default permission for a new participant is
186        /// `CKShareParticipantPermissionReadOnly.`
187        #[unsafe(method(permission))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn permission(&self) -> CKShareParticipantPermission;
190
191        /// Setter for [`permission`][Self::permission].
192        #[unsafe(method(setPermission:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn setPermission(&self, permission: CKShareParticipantPermission);
195
196        /// A unique identifier for this participant.
197        #[unsafe(method(participantID))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn participantID(&self) -> Retained<NSString>;
200    );
201}