objc2-cloud-kit 0.3.2

Bindings to the CloudKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksharingparticipantaccessoption?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CKSharingParticipantAccessOption(pub NSUInteger);
bitflags::bitflags! {
    impl CKSharingParticipantAccessOption: NSUInteger {
/// If specified, the system sharing UI will allow the user to share publicly i.e. anyone with the link has access.
        #[doc(alias = "CKSharingParticipantAccessOptionAnyoneWithLink")]
        const AnyoneWithLink = 1<<0;
/// If specified, the system sharing UI will allow the user to share privately to specified recipients.
        #[doc(alias = "CKSharingParticipantAccessOptionSpecifiedRecipientsOnly")]
        const SpecifiedRecipientsOnly = 1<<1;
/// Allow the user to configure the share with either access option.
        #[doc(alias = "CKSharingParticipantAccessOptionAny")]
        const Any = CKSharingParticipantAccessOption::AnyoneWithLink.0|CKSharingParticipantAccessOption::SpecifiedRecipientsOnly.0;
    }
}

unsafe impl Encode for CKSharingParticipantAccessOption {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for CKSharingParticipantAccessOption {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/cksharingparticipantpermissionoption?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CKSharingParticipantPermissionOption(pub NSUInteger);
bitflags::bitflags! {
    impl CKSharingParticipantPermissionOption: NSUInteger {
/// If specified, the system sharing UI will allow the user to grant participants read-only permissions.
        #[doc(alias = "CKSharingParticipantPermissionOptionReadOnly")]
        const ReadOnly = 1<<0;
/// If specified, the system sharing UI will allow the user to grant participants read/write permissions.
        #[doc(alias = "CKSharingParticipantPermissionOptionReadWrite")]
        const ReadWrite = 1<<1;
/// Allow the user to configure added share participants with either permission option.
        #[doc(alias = "CKSharingParticipantPermissionOptionAny")]
        const Any = CKSharingParticipantPermissionOption::ReadOnly.0|CKSharingParticipantPermissionOption::ReadWrite.0;
    }
}

unsafe impl Encode for CKSharingParticipantPermissionOption {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for CKSharingParticipantPermissionOption {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckallowedsharingoptions?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CKAllowedSharingOptions;
);

extern_conformance!(
    unsafe impl NSCoding for CKAllowedSharingOptions {}
);

extern_conformance!(
    unsafe impl NSCopying for CKAllowedSharingOptions {}
);

unsafe impl CopyingHelper for CKAllowedSharingOptions {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for CKAllowedSharingOptions {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for CKAllowedSharingOptions {}
);

impl CKAllowedSharingOptions {
    extern_methods!(
        #[unsafe(method(initWithAllowedParticipantPermissionOptions:allowedParticipantAccessOptions:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAllowedParticipantPermissionOptions_allowedParticipantAccessOptions(
            this: Allocated<Self>,
            allowed_participant_permission_options: CKSharingParticipantPermissionOption,
            allowed_participant_access_options: CKSharingParticipantAccessOption,
        ) -> Retained<Self>;

        #[unsafe(method(allowedParticipantPermissionOptions))]
        #[unsafe(method_family = none)]
        pub unsafe fn allowedParticipantPermissionOptions(
            &self,
        ) -> CKSharingParticipantPermissionOption;

        /// Setter for [`allowedParticipantPermissionOptions`][Self::allowedParticipantPermissionOptions].
        #[unsafe(method(setAllowedParticipantPermissionOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAllowedParticipantPermissionOptions(
            &self,
            allowed_participant_permission_options: CKSharingParticipantPermissionOption,
        );

        #[unsafe(method(allowedParticipantAccessOptions))]
        #[unsafe(method_family = none)]
        pub unsafe fn allowedParticipantAccessOptions(&self) -> CKSharingParticipantAccessOption;

        /// Setter for [`allowedParticipantAccessOptions`][Self::allowedParticipantAccessOptions].
        #[unsafe(method(setAllowedParticipantAccessOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAllowedParticipantAccessOptions(
            &self,
            allowed_participant_access_options: CKSharingParticipantAccessOption,
        );

        /// 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.
        /// Shares with ``CloudKit/CKShareParticipantRole/CKShareParticipantRoleAdministrator`` participants will be returned as read-only to devices running OS versions prior to this role being introduced.
        /// Administrator participants on these read-only shares will be returned as ``CloudKit/CKShareParticipantRole/CKShareParticipantRolePrivateUser``.
        #[unsafe(method(allowsParticipantsToInviteOthers))]
        #[unsafe(method_family = none)]
        pub unsafe fn allowsParticipantsToInviteOthers(&self) -> bool;

        /// Setter for [`allowsParticipantsToInviteOthers`][Self::allowsParticipantsToInviteOthers].
        #[unsafe(method(setAllowsParticipantsToInviteOthers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAllowsParticipantsToInviteOthers(
            &self,
            allows_participants_to_invite_others: bool,
        );

        /// Standard allowed options are most permissive i.e.
        /// `allowedParticipantPermissionOptions`=
        /// `CKSharingParticipantPermissionOptionAny`and
        /// `allowedParticipantAccessOptions`=
        /// `CKSharingParticipantAccessOptionAny`
        #[unsafe(method(standardOptions))]
        #[unsafe(method_family = none)]
        pub unsafe fn standardOptions() -> Retained<CKAllowedSharingOptions>;

        /// Default value is `NO`. If set, the system sharing UI will allow the user to configure whether access requests are enabled on the share.
        #[unsafe(method(allowsAccessRequests))]
        #[unsafe(method_family = none)]
        pub unsafe fn allowsAccessRequests(&self) -> bool;

        /// Setter for [`allowsAccessRequests`][Self::allowsAccessRequests].
        #[unsafe(method(setAllowsAccessRequests:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAllowsAccessRequests(&self, allows_access_requests: bool);
    );
}

/// Methods declared on superclass `NSObject`.
impl CKAllowedSharingOptions {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}