objc2_file_provider/generated/
NSFileProviderService.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_protocol!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/fileprovider/nsfileproviderservicesource?language=objc)
12    pub unsafe trait NSFileProviderServiceSource {
13        /// The service name that uniquely identifies the service (using reverse domain
14        /// name notation for you service name is recommended).
15        #[unsafe(method(serviceName))]
16        #[unsafe(method_family = none)]
17        unsafe fn serviceName(&self) -> Retained<NSFileProviderServiceName>;
18
19        /// Return an endpoint object to allow the client application to connect to the
20        /// file provider.
21        /// The endpoint is retrieved from an anonymous
22        /// `NSXPCListener`that the file
23        /// provider creates. The file provider is in charge of accepting incoming
24        /// `NSXPCConnection's`via
25        /// `-[NSXPCListenerDelegate`listener:shouldAcceptNewConnection:],
26        /// and setting up properties on the new connection, like its exported object and
27        /// interfaces (that both the file provider and the client application have agreed
28        /// on).
29        #[unsafe(method(makeListenerEndpointAndReturnError:_))]
30        #[unsafe(method_family = none)]
31        unsafe fn makeListenerEndpointAndReturnError(
32            &self,
33        ) -> Result<Retained<NSXPCListenerEndpoint>, Retained<NSError>>;
34
35        /// Indicates whether access to the service is restricted.
36        ///
37        /// A restricted service can only be accessed by processes that can manage the domain the service is attached to. It is only accessible
38        /// through `-[NSFileProviderManager getServiceWithName:itemIdentifier:completionHandler:]`
39        #[optional]
40        #[unsafe(method(isRestricted))]
41        #[unsafe(method_family = none)]
42        unsafe fn isRestricted(&self) -> bool;
43    }
44);
45
46/// NSFileProviderService.
47/// A file provider can override the method in this category to return service
48/// sources that provide custom communication channels to client applications.
49/// The service sources must be tied to the item identified by
50/// `itemIdentifier.`Client applications can retrieve the list of supported services by calling
51/// `-[NSFileManager`getFileProviderServicesForItemAtURL:] for a specific item URL.
52#[cfg(feature = "Extension")]
53impl NSFileProviderExtension {
54    extern_methods!(
55        #[cfg(feature = "NSFileProviderItem")]
56        #[unsafe(method(supportedServiceSourcesForItemIdentifier:error:_))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn supportedServiceSourcesForItemIdentifier_error(
59            &self,
60            item_identifier: &NSFileProviderItemIdentifier,
61        ) -> Result<
62            Retained<NSArray<ProtocolObject<dyn NSFileProviderServiceSource>>>,
63            Retained<NSError>,
64        >;
65    );
66}
67
68/// NSFileProviderService.
69#[cfg(feature = "Extension")]
70impl NSFileProviderManager {
71    extern_methods!(
72        #[cfg(all(feature = "NSFileProviderItem", feature = "block2"))]
73        /// Retrieve the service with the specified named for the specified item.
74        #[unsafe(method(getServiceWithName:itemIdentifier:completionHandler:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn getServiceWithName_itemIdentifier_completionHandler(
77            &self,
78            service_name: &NSFileProviderServiceName,
79            item_identifier: &NSFileProviderItemIdentifier,
80            completion_handler: &block2::DynBlock<dyn Fn(*mut NSFileProviderService, *mut NSError)>,
81        );
82    );
83}