objc2_cloud_kit/generated/
CKAllowedSharingOptions.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/cksharingparticipantaccessoption?language=objc)
11// NS_OPTIONS
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct CKSharingParticipantAccessOption(pub NSUInteger);
15bitflags::bitflags! {
16    impl CKSharingParticipantAccessOption: NSUInteger {
17/// If specified, the system sharing UI will allow the user to share publicly i.e. anyone with the link has access.
18        #[doc(alias = "CKSharingParticipantAccessOptionAnyoneWithLink")]
19        const AnyoneWithLink = 1<<0;
20/// If specified, the system sharing UI will allow the user to share privately to specified recipients.
21        #[doc(alias = "CKSharingParticipantAccessOptionSpecifiedRecipientsOnly")]
22        const SpecifiedRecipientsOnly = 1<<1;
23/// Allow the user to configure the share with either access option.
24        #[doc(alias = "CKSharingParticipantAccessOptionAny")]
25        const Any = CKSharingParticipantAccessOption::AnyoneWithLink.0|CKSharingParticipantAccessOption::SpecifiedRecipientsOnly.0;
26    }
27}
28
29unsafe impl Encode for CKSharingParticipantAccessOption {
30    const ENCODING: Encoding = NSUInteger::ENCODING;
31}
32
33unsafe impl RefEncode for CKSharingParticipantAccessOption {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksharingparticipantpermissionoption?language=objc)
38// NS_OPTIONS
39#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct CKSharingParticipantPermissionOption(pub NSUInteger);
42bitflags::bitflags! {
43    impl CKSharingParticipantPermissionOption: NSUInteger {
44/// If specified, the system sharing UI will allow the user to grant participants read-only permissions.
45        #[doc(alias = "CKSharingParticipantPermissionOptionReadOnly")]
46        const ReadOnly = 1<<0;
47/// If specified, the system sharing UI will allow the user to grant participants read/write permissions.
48        #[doc(alias = "CKSharingParticipantPermissionOptionReadWrite")]
49        const ReadWrite = 1<<1;
50/// Allow the user to configure added share participants with either permission option.
51        #[doc(alias = "CKSharingParticipantPermissionOptionAny")]
52        const Any = CKSharingParticipantPermissionOption::ReadOnly.0|CKSharingParticipantPermissionOption::ReadWrite.0;
53    }
54}
55
56unsafe impl Encode for CKSharingParticipantPermissionOption {
57    const ENCODING: Encoding = NSUInteger::ENCODING;
58}
59
60unsafe impl RefEncode for CKSharingParticipantPermissionOption {
61    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64extern_class!(
65    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckallowedsharingoptions?language=objc)
66    #[unsafe(super(NSObject))]
67    #[derive(Debug, PartialEq, Eq, Hash)]
68    pub struct CKAllowedSharingOptions;
69);
70
71extern_conformance!(
72    unsafe impl NSCoding for CKAllowedSharingOptions {}
73);
74
75extern_conformance!(
76    unsafe impl NSCopying for CKAllowedSharingOptions {}
77);
78
79unsafe impl CopyingHelper for CKAllowedSharingOptions {
80    type Result = Self;
81}
82
83extern_conformance!(
84    unsafe impl NSObjectProtocol for CKAllowedSharingOptions {}
85);
86
87extern_conformance!(
88    unsafe impl NSSecureCoding for CKAllowedSharingOptions {}
89);
90
91impl CKAllowedSharingOptions {
92    extern_methods!(
93        #[unsafe(method(initWithAllowedParticipantPermissionOptions:allowedParticipantAccessOptions:))]
94        #[unsafe(method_family = init)]
95        pub unsafe fn initWithAllowedParticipantPermissionOptions_allowedParticipantAccessOptions(
96            this: Allocated<Self>,
97            allowed_participant_permission_options: CKSharingParticipantPermissionOption,
98            allowed_participant_access_options: CKSharingParticipantAccessOption,
99        ) -> Retained<Self>;
100
101        #[unsafe(method(allowedParticipantPermissionOptions))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn allowedParticipantPermissionOptions(
104            &self,
105        ) -> CKSharingParticipantPermissionOption;
106
107        /// Setter for [`allowedParticipantPermissionOptions`][Self::allowedParticipantPermissionOptions].
108        #[unsafe(method(setAllowedParticipantPermissionOptions:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setAllowedParticipantPermissionOptions(
111            &self,
112            allowed_participant_permission_options: CKSharingParticipantPermissionOption,
113        );
114
115        #[unsafe(method(allowedParticipantAccessOptions))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn allowedParticipantAccessOptions(&self) -> CKSharingParticipantAccessOption;
118
119        /// Setter for [`allowedParticipantAccessOptions`][Self::allowedParticipantAccessOptions].
120        #[unsafe(method(setAllowedParticipantAccessOptions:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setAllowedParticipantAccessOptions(
123            &self,
124            allowed_participant_access_options: CKSharingParticipantAccessOption,
125        );
126
127        /// Default value is `NO`. If set, the system sharing UI will allow the user to choose whether added participants can invite others to the share.
128        /// Shares with ``CloudKit/CKShareParticipantRole/CKShareParticipantRoleAdministrator`` participants will be returned as read-only to devices running OS versions prior to this role being introduced.
129        /// Administrator participants on these read-only shares will be returned as ``CloudKit/CKShareParticipantRole/CKShareParticipantRolePrivateUser``.
130        #[unsafe(method(allowsParticipantsToInviteOthers))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn allowsParticipantsToInviteOthers(&self) -> bool;
133
134        /// Setter for [`allowsParticipantsToInviteOthers`][Self::allowsParticipantsToInviteOthers].
135        #[unsafe(method(setAllowsParticipantsToInviteOthers:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setAllowsParticipantsToInviteOthers(
138            &self,
139            allows_participants_to_invite_others: bool,
140        );
141
142        /// Standard allowed options are most permissive i.e.
143        /// `allowedParticipantPermissionOptions`=
144        /// `CKSharingParticipantPermissionOptionAny`and
145        /// `allowedParticipantAccessOptions`=
146        /// `CKSharingParticipantAccessOptionAny`
147        #[unsafe(method(standardOptions))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn standardOptions() -> Retained<CKAllowedSharingOptions>;
150
151        /// Default value is `NO`. If set, the system sharing UI will allow the user to configure whether access requests are enabled on the share.
152        #[unsafe(method(allowsAccessRequests))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn allowsAccessRequests(&self) -> bool;
155
156        /// Setter for [`allowsAccessRequests`][Self::allowsAccessRequests].
157        #[unsafe(method(setAllowsAccessRequests:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setAllowsAccessRequests(&self, allows_access_requests: bool);
160    );
161}
162
163/// Methods declared on superclass `NSObject`.
164impl CKAllowedSharingOptions {
165    extern_methods!(
166        #[unsafe(method(init))]
167        #[unsafe(method_family = init)]
168        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
169
170        #[unsafe(method(new))]
171        #[unsafe(method_family = new)]
172        pub unsafe fn new() -> Retained<Self>;
173    );
174}