objc2_intents/generated/
INRelevantShortcut.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/// The role of the relevant shortcut.
11///
12/// Provides a hint to Siri about the expected user experience.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/intents/inrelevantshortcutrole?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct INRelevantShortcutRole(pub NSInteger);
19impl INRelevantShortcutRole {
20    /// The relevant shortcut represents an action that the user may want to perform using your app.
21    #[doc(alias = "INRelevantShortcutRoleAction")]
22    pub const Action: Self = Self(0);
23    /// The relevant shortcut represents information that the user may want to glance at.
24    #[doc(alias = "INRelevantShortcutRoleInformation")]
25    pub const Information: Self = Self(1);
26}
27
28unsafe impl Encode for INRelevantShortcutRole {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for INRelevantShortcutRole {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37    /// Lets you provide relevant shortcut to Siri, for display on the Siri Watch Face.
38    ///
39    /// Including relevance information allows Siri to make suggestions for shortcuts that the user might be interested in but has not previously performed.
40    ///
41    /// See also [Apple's documentation](https://developer.apple.com/documentation/intents/inrelevantshortcut?language=objc)
42    #[unsafe(super(NSObject))]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    pub struct INRelevantShortcut;
45);
46
47extern_conformance!(
48    unsafe impl NSCoding for INRelevantShortcut {}
49);
50
51extern_conformance!(
52    unsafe impl NSCopying for INRelevantShortcut {}
53);
54
55unsafe impl CopyingHelper for INRelevantShortcut {
56    type Result = Self;
57}
58
59extern_conformance!(
60    unsafe impl NSObjectProtocol for INRelevantShortcut {}
61);
62
63extern_conformance!(
64    unsafe impl NSSecureCoding for INRelevantShortcut {}
65);
66
67impl INRelevantShortcut {
68    extern_methods!(
69        #[cfg(feature = "INRelevanceProvider")]
70        /// A collection of relevance information that is attached to the relevant shortcuts.
71        ///
72        /// Providing additional relevance information allows Siri to suggest a shortcut that the user is interested in but has not previously performed.
73        ///
74        /// See also: INRelevanceProvider
75        #[unsafe(method(relevanceProviders))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn relevanceProviders(&self) -> Retained<NSArray<INRelevanceProvider>>;
78
79        #[cfg(feature = "INRelevanceProvider")]
80        /// Setter for [`relevanceProviders`][Self::relevanceProviders].
81        ///
82        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
83        #[unsafe(method(setRelevanceProviders:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setRelevanceProviders(
86            &self,
87            relevance_providers: &NSArray<INRelevanceProvider>,
88        );
89
90        #[cfg(feature = "INDefaultCardTemplate")]
91        /// Customizes the display of the relevant shortcut on the Siri watch face.
92        ///
93        /// By default, the UI for the relevant shortcut can be derivied from the information provided in the
94        /// `INShortcut.`In certain situations, it may be desirable to override this behavior and provide a custom template.
95        ///
96        /// See also: INDefaultCardTemplate
97        #[unsafe(method(watchTemplate))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn watchTemplate(&self) -> Option<Retained<INDefaultCardTemplate>>;
100
101        #[cfg(feature = "INDefaultCardTemplate")]
102        /// Setter for [`watchTemplate`][Self::watchTemplate].
103        ///
104        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
105        #[unsafe(method(setWatchTemplate:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setWatchTemplate(&self, watch_template: Option<&INDefaultCardTemplate>);
108
109        /// Links the relevant shortcut to a specific WidgetKit widget kind.
110        ///
111        /// When a relevant shortcut is linked to a WidgetKit widget, it hints to the system when to show the widget in a stack.
112        #[unsafe(method(widgetKind))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn widgetKind(&self) -> Option<Retained<NSString>>;
115
116        /// Setter for [`widgetKind`][Self::widgetKind].
117        ///
118        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
119        #[unsafe(method(setWidgetKind:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setWidgetKind(&self, widget_kind: Option<&NSString>);
122
123        /// The role of the relevant shortcut.
124        ///
125        /// Provides a hint to Siri about the expected user experience. The default is
126        /// `INRelevantShortcutRoleAction.`
127        /// See also: INRelevantShortcutRole
128        #[unsafe(method(shortcutRole))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn shortcutRole(&self) -> INRelevantShortcutRole;
131
132        /// Setter for [`shortcutRole`][Self::shortcutRole].
133        #[unsafe(method(setShortcutRole:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setShortcutRole(&self, shortcut_role: INRelevantShortcutRole);
136
137        #[cfg(feature = "INShortcut")]
138        /// The shortcut that will be performed when this relevant shortcut is invoked.
139        ///
140        /// See also: INShortcut
141        #[unsafe(method(shortcut))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn shortcut(&self) -> Retained<INShortcut>;
144
145        #[cfg(feature = "INShortcut")]
146        /// Creates a relevant shortcut for the given shortcut.
147        #[unsafe(method(initWithShortcut:))]
148        #[unsafe(method_family = init)]
149        pub unsafe fn initWithShortcut(
150            this: Allocated<Self>,
151            shortcut: &INShortcut,
152        ) -> Retained<Self>;
153    );
154}
155
156/// Methods declared on superclass `NSObject`.
157impl INRelevantShortcut {
158    extern_methods!(
159        #[unsafe(method(init))]
160        #[unsafe(method_family = init)]
161        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
162
163        #[unsafe(method(new))]
164        #[unsafe(method_family = new)]
165        pub unsafe fn new() -> Retained<Self>;
166    );
167}