objc2_home_kit/generated/
HMActionSet.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
10extern_class!(
11    /// This class represents a collection of action objects that can be executed.
12    /// The order of execution of these actions is undefined.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionset?language=objc)
15    #[unsafe(super(NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct HMActionSet;
18);
19
20unsafe impl Send for HMActionSet {}
21
22unsafe impl Sync for HMActionSet {}
23
24extern_conformance!(
25    unsafe impl NSObjectProtocol for HMActionSet {}
26);
27
28impl HMActionSet {
29    extern_methods!(
30        #[unsafe(method(init))]
31        #[unsafe(method_family = init)]
32        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
33
34        /// The name of the action set.
35        #[unsafe(method(name))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn name(&self) -> Retained<NSString>;
38
39        #[cfg(feature = "HMAction")]
40        /// Set of HMAction objects that represent the individual items of the action set.
41        #[unsafe(method(actions))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn actions(&self) -> Retained<NSSet<HMAction>>;
44
45        /// Specifies whether the action set is currently executing or not.
46        #[unsafe(method(isExecuting))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn isExecuting(&self) -> bool;
49
50        /// Specifies the action set type - user-defined, trigger-owned or one of the builtin types.
51        /// Builtin action sets cannot be removed from the home. trigger-owned action sets cannot
52        /// be executed, renamed or associated with another trigger.
53        #[unsafe(method(actionSetType))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn actionSetType(&self) -> Retained<NSString>;
56
57        /// A unique identifier for the action set.
58        #[unsafe(method(uniqueIdentifier))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn uniqueIdentifier(&self) -> Retained<NSUUID>;
61
62        /// Specifies the last execution date for the action set.
63        #[unsafe(method(lastExecutionDate))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn lastExecutionDate(&self) -> Option<Retained<NSDate>>;
66
67        #[cfg(all(feature = "HMDefines", feature = "block2"))]
68        /// This method is used to change the name of the action set.
69        ///
70        ///
71        /// Parameter `name`: New name for the action set.
72        ///
73        ///
74        /// Parameter `completion`: Block that is invoked once the request is processed.
75        /// The NSError provides more information on the status of the request, error
76        /// will be nil on success.
77        #[unsafe(method(updateName:completionHandler:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn updateName_completionHandler(
80            &self,
81            name: &NSString,
82            completion: HMErrorBlock,
83        );
84
85        #[cfg(all(feature = "HMAction", feature = "HMDefines", feature = "block2"))]
86        /// Adds an action to the action set.
87        ///
88        ///
89        /// Parameter `action`: Action object to add to the action set.
90        ///
91        ///
92        /// Parameter `completion`: Block that is invoked once the request is processed.
93        /// The NSError provides more information on the status of the request, error
94        /// will be nil on success.
95        #[unsafe(method(addAction:completionHandler:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn addAction_completionHandler(
98            &self,
99            action: &HMAction,
100            completion: HMErrorBlock,
101        );
102
103        #[cfg(all(feature = "HMAction", feature = "HMDefines", feature = "block2"))]
104        /// Removes an existing action from the action set.
105        ///
106        ///
107        /// Parameter `action`: Action object to remove from the action set.
108        ///
109        ///
110        /// Parameter `completion`: Block that is invoked once the request is processed.
111        /// The NSError provides more information on the status of the request, error
112        /// will be nil on success.
113        #[unsafe(method(removeAction:completionHandler:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn removeAction_completionHandler(
116            &self,
117            action: &HMAction,
118            completion: HMErrorBlock,
119        );
120    );
121}
122
123/// Methods declared on superclass `NSObject`.
124impl HMActionSet {
125    extern_methods!(
126        #[unsafe(method(new))]
127        #[unsafe(method_family = new)]
128        pub unsafe fn new() -> Retained<Self>;
129    );
130}
131
132extern "C" {
133    /// Builtin action set type for WakeUp.
134    ///
135    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypewakeup?language=objc)
136    pub static HMActionSetTypeWakeUp: &'static NSString;
137}
138
139extern "C" {
140    /// Type for builtin action set Sleep.
141    ///
142    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypesleep?language=objc)
143    pub static HMActionSetTypeSleep: &'static NSString;
144}
145
146extern "C" {
147    /// Type for builtin action set HomeDeparture.
148    ///
149    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypehomedeparture?language=objc)
150    pub static HMActionSetTypeHomeDeparture: &'static NSString;
151}
152
153extern "C" {
154    /// Type for builtin action set HomeArrival.
155    ///
156    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypehomearrival?language=objc)
157    pub static HMActionSetTypeHomeArrival: &'static NSString;
158}
159
160extern "C" {
161    /// Type for user-defined action sets.
162    ///
163    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypeuserdefined?language=objc)
164    pub static HMActionSetTypeUserDefined: &'static NSString;
165}
166
167extern "C" {
168    /// Type for trigger-owned action sets.
169    ///
170    ///
171    /// An action set of this type is owned by a trigger and is not listed
172    /// as part of the home. An action set of this type cannot be executed,
173    /// renamed, or associated with a different trigger.
174    ///
175    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypetriggerowned?language=objc)
176    pub static HMActionSetTypeTriggerOwned: &'static NSString;
177}