objc2_shazam_kit/generated/
SHMediaLibrary.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    /// An object that represents the user's Shazam library.
12    ///
13    /// Use `SHMediaLibrary` to add matched songs from the Shazam catalog to the user's Shazam library.
14    ///
15    /// > Note:
16    /// > There's no system permission necessary to write to the user's Shazam library. Consider requesting permission from the user before adding songs to the library.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/shazamkit/shmedialibrary?language=objc)
19    #[unsafe(super(NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[deprecated = "Use SHLibrary instead"]
22    pub struct SHMediaLibrary;
23);
24
25extern_conformance!(
26    unsafe impl NSObjectProtocol for SHMediaLibrary {}
27);
28
29impl SHMediaLibrary {
30    extern_methods!(
31        /// An instance of the user's default Shazam library.
32        #[deprecated = "Use SHLibrary instead"]
33        #[unsafe(method(defaultLibrary))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn defaultLibrary() -> Retained<SHMediaLibrary>;
36
37        #[cfg(all(feature = "SHMediaItem", feature = "block2"))]
38        /// Adds an array of songs to the user's Shazam library.
39        ///
40        /// > Important:
41        /// > You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
42        /// >
43        /// > ```swift
44        /// > func add(_ mediaItems: [SHMediaItem]) async throws
45        /// > ```
46        /// >
47        /// > For information about concurrency and asynchronous code in Swift, see
48        /// <doc
49        /// ://com.apple.documentation/documentation/swift/calling-objective-c-apis-asynchronously>.
50        ///
51        /// Saving a song to the user's Shazam library also saves the following media item properties and their associated values:
52        ///
53        /// - ``SHMediaItemProperty/shazamID``
54        /// - ``SHMediaItemProperty/title``
55        /// - ``SHMediaItemProperty/subtitle``, or ``SHMediaItemProperty/artist`` if the subtitle is unavailable
56        ///
57        /// > Note:
58        /// > Saving to the user's Shazam library works only for songs with a valid ``SHMediaItemProperty/shazamID``.
59        ///
60        /// - Parameters:
61        /// - mediaItems: An array of media items that represents the songs to add to the library.
62        /// - completionHandler: The system calls this completion block after adding the media items to the library.
63        ///
64        /// This block takes the following parameters:
65        ///
66        /// - term `error`: An error object if a problem occurs when adding any item; otherwise, `nil`.
67        ///
68        /// # Safety
69        ///
70        /// `completion_handler` block must be sendable.
71        #[deprecated = "Use SHLibrary instead"]
72        #[unsafe(method(addMediaItems:completionHandler:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn addMediaItems_completionHandler(
75            &self,
76            media_items: &NSArray<SHMediaItem>,
77            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
78        );
79
80        #[deprecated = "Use SHLibrary instead"]
81        #[unsafe(method(init))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
84
85        #[deprecated = "Use SHLibrary instead"]
86        #[unsafe(method(new))]
87        #[unsafe(method_family = new)]
88        pub unsafe fn new() -> Retained<Self>;
89    );
90}