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