objc2_home_kit/generated/
HMAddAccessoryRequest.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/homekit/hmaddaccessoryrequest?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct HMAddAccessoryRequest;
14);
15
16extern_conformance!(
17    unsafe impl NSObjectProtocol for HMAddAccessoryRequest {}
18);
19
20impl HMAddAccessoryRequest {
21    extern_methods!(
22        #[cfg(feature = "HMHome")]
23        /// Home that the accessory is to be added to.
24        #[unsafe(method(home))]
25        #[unsafe(method_family = none)]
26        pub unsafe fn home(&self) -> Retained<HMHome>;
27
28        /// Name of the accessory to be added.
29        #[unsafe(method(accessoryName))]
30        #[unsafe(method_family = none)]
31        pub unsafe fn accessoryName(&self) -> Retained<NSString>;
32
33        #[cfg(feature = "HMAccessoryCategory")]
34        /// The category of the accessory to be added.
35        #[unsafe(method(accessoryCategory))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn accessoryCategory(&self) -> Retained<HMAccessoryCategory>;
38
39        /// Indication if the setup URL needs to be updated for this request. If this is true,
40        /// payloadWithURL:ownershipToken: must be used to create the HMAccessorySetupPayload.
41        #[unsafe(method(requiresSetupPayloadURL))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn requiresSetupPayloadURL(&self) -> bool;
44
45        /// Indication if the ownership token needs to be updated for this request.
46        #[deprecated = "No longer supported"]
47        #[unsafe(method(requiresOwnershipToken))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn requiresOwnershipToken(&self) -> bool;
50
51        #[cfg(feature = "HMAccessorySetupPayload")]
52        /// Creates an accessory setup payload with ownership token
53        ///
54        ///
55        /// Parameter `ownershipToken`: The token proving ownership of the accessory being added to the home.
56        ///
57        ///
58        /// Returns: Returns an accessory setup payload object if successful or nil on error.
59        ///
60        ///
61        /// This method may fail if this request requires a setup payload URL.
62        #[unsafe(method(payloadWithOwnershipToken:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn payloadWithOwnershipToken(
65            &self,
66            ownership_token: &HMAccessoryOwnershipToken,
67        ) -> Option<Retained<HMAccessorySetupPayload>>;
68
69        #[cfg(feature = "HMAccessorySetupPayload")]
70        /// Creates an accessory setup payload with URL and ownership token
71        ///
72        ///
73        /// Parameter `setupPayloadURL`: The HomeKit setup payload for the accessory being added to the home.
74        ///
75        ///
76        /// Parameter `ownershipToken`: The token proving ownership of the accessory being added to the home.
77        ///
78        ///
79        /// Returns: Returns an accessory setup payload object if successful or nil on error.
80        ///
81        ///
82        /// This method may fail if the setup payload URL is not a valid payload URL.
83        #[unsafe(method(payloadWithURL:ownershipToken:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn payloadWithURL_ownershipToken(
86            &self,
87            setup_payload_url: &NSURL,
88            ownership_token: &HMAccessoryOwnershipToken,
89        ) -> Option<Retained<HMAccessorySetupPayload>>;
90
91        #[deprecated = "HMAddAccessoryRequest objects are created by their associated objects. Directly creating them is not supported."]
92        #[unsafe(method(init))]
93        #[unsafe(method_family = init)]
94        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95    );
96}
97
98/// Methods declared on superclass `NSObject`.
99impl HMAddAccessoryRequest {
100    extern_methods!(
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub unsafe fn new() -> Retained<Self>;
104    );
105}