objc2_screen_time/generated/
STWebHistory.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/// An identifier representing a web history profile.
11///
12/// Profiles allow you to keep your web history separate for topics like work, personal, or school.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/screentime/stwebhistoryprofileidentifier?language=objc)
15// NS_TYPED_EXTENSIBLE_ENUM
16pub type STWebHistoryProfileIdentifier = NSString;
17
18extern_class!(
19    /// The object you use to delete web-usage data.
20    ///
21    /// This class provides an easy way for you to delete web history, including:
22    ///
23    /// - All history
24    /// - History associated to a specific URL
25    /// - History during a specific time interval
26    ///
27    /// See also [Apple's documentation](https://developer.apple.com/documentation/screentime/stwebhistory?language=objc)
28    #[unsafe(super(NSObject))]
29    #[derive(Debug, PartialEq, Eq, Hash)]
30    pub struct STWebHistory;
31);
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for STWebHistory {}
35);
36
37impl STWebHistory {
38    extern_methods!(
39        /// Creates a web history instance to delete web-usage data associated to the
40        /// bundle identifier and profile identifier you specify.
41        ///
42        /// The default value for `bundleIdentifier` is `Bundle.main.bundleIdentifier`.
43        /// This is the recommended identifier to use, except for example, if a helper
44        /// process is presenting web UI and you want to group that web-usage under the
45        /// main app’s bundle identifier.
46        ///
47        /// The default value for `profileIdentifier` is `nil`. This identifier can be used to delete
48        /// browsing history for a specific profile. Using `nil` will only delete web history reported
49        /// without a profile identifier.
50        ///
51        /// - Parameters:
52        /// - bundleIdentifier: The bundle identifier.
53        /// - profileIdentifier: The identifier of the current browsing profile.
54        /// - error: Any error that occurred while changing the bundle identifier.
55        #[unsafe(method(initWithBundleIdentifier:profileIdentifier:error:_))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn initWithBundleIdentifier_profileIdentifier_error(
58            this: Allocated<Self>,
59            bundle_identifier: &NSString,
60            profile_identifier: Option<&STWebHistoryProfileIdentifier>,
61        ) -> Result<Retained<Self>, Retained<NSError>>;
62
63        /// Creates a web history instance to delete web-usage data associated to the
64        /// profile identifier you specify.
65        ///
66        /// The default value for `profileIdentifier` is `nil`. This identifier can be used to delete
67        /// browsing history for a specific profile. Using `nil` will only delete web history reported
68        /// without a profile identifier.
69        ///
70        /// - Parameters:
71        /// - profileIdentifier: The identifier of the current browsing profile.
72        #[unsafe(method(initWithProfileIdentifier:))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn initWithProfileIdentifier(
75            this: Allocated<Self>,
76            profile_identifier: Option<&STWebHistoryProfileIdentifier>,
77        ) -> Retained<Self>;
78
79        /// Creates a web history instance to delete web-usage data associated to the
80        /// bundle identifier you specify.
81        ///
82        /// The default value for `bundleIdentifier` is `Bundle.main.bundleIdentifier`.
83        /// This is the recommended identifier to use, except for example, if a helper
84        /// process is presenting web UI and you want to group that web-usage under the
85        /// main app’s bundle identifier.
86        ///
87        /// - Parameters:
88        /// - bundleIdentifier: The bundle identifier.
89        /// - error: Any error that occurred while changing the bundle identifier.
90        #[unsafe(method(initWithBundleIdentifier:error:_))]
91        #[unsafe(method_family = init)]
92        pub unsafe fn initWithBundleIdentifier_error(
93            this: Allocated<Self>,
94            bundle_identifier: &NSString,
95        ) -> Result<Retained<Self>, Retained<NSError>>;
96
97        #[cfg(feature = "block2")]
98        /// Fetches web history that occurred during the date interval you specify.
99        ///
100        /// - Parameters:
101        /// - interval: The date interval of web history you want to fetch.
102        #[unsafe(method(fetchHistoryDuringInterval:completionHandler:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn fetchHistoryDuringInterval_completionHandler(
105            &self,
106            interval: &NSDateInterval,
107            completion_handler: &block2::DynBlock<dyn Fn(*mut NSSet<NSURL>, *mut NSError)>,
108        );
109
110        #[cfg(feature = "block2")]
111        /// Fetches all web history associated with the bundle identifier and profile identifier
112        /// you specified during initialization.
113        #[unsafe(method(fetchAllHistoryWithCompletionHandler:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn fetchAllHistoryWithCompletionHandler(
116            &self,
117            completion_handler: &block2::DynBlock<dyn Fn(*mut NSSet<NSURL>, *mut NSError)>,
118        );
119
120        /// Deletes all the web history for the URL you specify.
121        ///
122        /// The framework references the entire URL to determine which web-usage data to
123        /// delete.
124        ///
125        /// - Parameters:
126        /// - url: The URL associated with the web history to delete.
127        #[unsafe(method(deleteHistoryForURL:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn deleteHistoryForURL(&self, url: &NSURL);
130
131        /// Deletes web history that occurred during the date interval you specify.
132        ///
133        /// - Parameters:
134        /// - interval: The date interval of web history you want to delete.
135        #[unsafe(method(deleteHistoryDuringInterval:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn deleteHistoryDuringInterval(&self, interval: &NSDateInterval);
138
139        /// Deletes all web history associated with the bundle identifier you specified
140        /// during initialization.
141        #[unsafe(method(deleteAllHistory))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn deleteAllHistory(&self);
144    );
145}
146
147/// Methods declared on superclass `NSObject`.
148impl STWebHistory {
149    extern_methods!(
150        #[unsafe(method(init))]
151        #[unsafe(method_family = init)]
152        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
153
154        #[unsafe(method(new))]
155        #[unsafe(method_family = new)]
156        pub unsafe fn new() -> Retained<Self>;
157    );
158}