objc2_shazam_kit/generated/SHCustomCatalog.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// An object for storing the reference signatures for custom audio recordings and their associated metadata.
11 ///
12 /// Create a custom catalog by adding reference signatures that you generate from audio that you provide. You also add the associated metadata for each signature. Save your custom catalog and share it with others. You can also load a saved catalog.
13 ///
14 /// See also [Apple's documentation](https://developer.apple.com/documentation/shazamkit/shcustomcatalog?language=objc)
15 #[unsafe(super(SHCatalog, NSObject))]
16 #[derive(Debug, PartialEq, Eq, Hash)]
17 #[cfg(feature = "SHCatalog")]
18 pub struct SHCustomCatalog;
19);
20
21#[cfg(feature = "SHCatalog")]
22extern_conformance!(
23 unsafe impl NSObjectProtocol for SHCustomCatalog {}
24);
25
26#[cfg(feature = "SHCatalog")]
27impl SHCustomCatalog {
28 extern_methods!(
29 /// The data representation of this file, it can be written to disk
30 #[unsafe(method(dataRepresentation))]
31 #[unsafe(method_family = none)]
32 pub unsafe fn dataRepresentation(&self) -> Retained<NSData>;
33
34 #[cfg(all(feature = "SHMediaItem", feature = "SHSignature"))]
35 /// Adds a reference signature and its associated metadata to a catalog.
36 ///
37 /// > Note:
38 /// > This system ignores calls to `addReferenceSignature(_:representing:)` after adding the catalog to an `SHSession`.
39 ///
40 /// - Parameters:
41 /// - signature: The reference signature for the audio recording.
42 /// - mediaItems: The metadata for the recording.
43 #[unsafe(method(addReferenceSignature:representingMediaItems:error:_))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn addReferenceSignature_representingMediaItems_error(
46 &self,
47 signature: &SHSignature,
48 media_items: &NSArray<SHMediaItem>,
49 ) -> Result<(), Retained<NSError>>;
50
51 /// Loads a saved custom catalog from a file.
52 ///
53 /// - Parameters:
54 /// - customCatalogURL: The file URL for a custom catalog.
55 /// - error: An output value in Objective-C that indicates the type of error; otherwise, `nil`.
56 #[unsafe(method(addCustomCatalogFromURL:error:_))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn addCustomCatalogFromURL_error(
59 &self,
60 custom_catalog_url: &NSURL,
61 ) -> Result<(), Retained<NSError>>;
62
63 /// Saves the custom catalog to a local file.
64 ///
65 /// If `destinationURL` is a directory, the system creates a `Signatures.shazamcatalog` file.
66 ///
67 /// - Parameters:
68 /// - destinationURL: A URL for the saved custom catalog file.
69 /// - error: An output value in Objective-C that indicates the type of error; otherwise, `nil`.
70 ///
71 /// - Returns: `YES` if the catalog writes to the file; otherwise, `NO`.
72 #[deprecated = "Use dataRepresentation"]
73 #[unsafe(method(writeToURL:error:_))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn writeToURL_error(
76 &self,
77 destination_url: &NSURL,
78 ) -> Result<(), Retained<NSError>>;
79
80 /// Creates a new custom catalog object for storing reference audio signatures and their associated metadata.
81 ///
82 /// - Returns: A new custom catalog for storing processed reference audio recordings and their associated metadata.
83 #[unsafe(method(new))]
84 #[unsafe(method_family = new)]
85 pub unsafe fn new() -> Retained<Self>;
86
87 /// Creates a new custom catalog object for storing reference audio signatures and their associated metadata.
88 #[unsafe(method(init))]
89 #[unsafe(method_family = init)]
90 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
91
92 /// Load a
93 /// `SHCustomCatalog`from data
94 ///
95 /// Parameter `dataRepresentation`: The data representation of the
96 /// `SHCustomCatalog`
97 /// Parameter `error`: Error populated if not a valid data representation
98 #[unsafe(method(initWithDataRepresentation:error:_))]
99 #[unsafe(method_family = init)]
100 pub unsafe fn initWithDataRepresentation_error(
101 this: Allocated<Self>,
102 data_representation: &NSData,
103 ) -> Result<Retained<Self>, Retained<NSError>>;
104 );
105}