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///
48/// A file provider can override the method in this category to return service
49/// sources that provide custom communication channels to client applications.
50/// The service sources must be tied to the item identified by
51/// `itemIdentifier.`Client applications can retrieve the list of supported services by calling
52/// `-[NSFileManager`getFileProviderServicesForItemAtURL:] for a specific item URL.
53#[cfg(feature = "Extension")]
54impl NSFileProviderExtension {
55    extern_methods!(
56        #[cfg(feature = "NSFileProviderItem")]
57        #[unsafe(method(supportedServiceSourcesForItemIdentifier:error:_))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn supportedServiceSourcesForItemIdentifier_error(
60            &self,
61            item_identifier: &NSFileProviderItemIdentifier,
62        ) -> Result<
63            Retained<NSArray<ProtocolObject<dyn NSFileProviderServiceSource>>>,
64            Retained<NSError>,
65        >;
66    );
67}
68
69/// NSFileProviderService.
70#[cfg(feature = "Extension")]
71impl NSFileProviderManager {
72    extern_methods!(
73        #[cfg(all(feature = "NSFileProviderItem", feature = "block2"))]
74        /// Retrieve the service with the specified named for the specified item.
75        #[unsafe(method(getServiceWithName:itemIdentifier:completionHandler:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn getServiceWithName_itemIdentifier_completionHandler(
78            &self,
79            service_name: &NSFileProviderServiceName,
80            item_identifier: &NSFileProviderItemIdentifier,
81            completion_handler: &block2::DynBlock<dyn Fn(*mut NSFileProviderService, *mut NSError)>,
82        );
83    );
84}