objc2_shazam_kit/generated/SHError.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use objc2::__framework_prelude::*;
4use objc2_foundation::*;
5
6use crate::*;
7
8extern "C" {
9 /// The error domain for specific errors for ShazamKit.
10 ///
11 /// See also [Apple's documentation](https://developer.apple.com/documentation/shazamkit/sherrordomain?language=objc)
12 pub static SHErrorDomain: Option<&'static NSErrorDomain>;
13}
14
15/// An error type that you create, or the system creates, to indicate problems with a catalog, match attempt, or signature, or when saving to a user's Shazam library.
16///
17/// See also [Apple's documentation](https://developer.apple.com/documentation/shazamkit/sherrorcode?language=objc)
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct SHErrorCode(pub NSInteger);
21impl SHErrorCode {
22 /// The error code to indicate an unsupported audio format.
23 ///
24 /// For the list of the supported audio formats, see ``SHSignatureGenerator/append(_:at:)``.
25 #[doc(alias = "SHErrorCodeInvalidAudioFormat")]
26 pub const InvalidAudioFormat: Self = Self(100);
27 /// The error code to indicate the use of noncontiguous audio to request a match.
28 #[doc(alias = "SHErrorCodeAudioDiscontinuity")]
29 pub const AudioDiscontinuity: Self = Self(101);
30 /// The error code to indicate that the system is unable to generate a signature from the audio.
31 ///
32 /// The most common cause of this error is silent audio input.
33 #[doc(alias = "SHErrorCodeSignatureInvalid")]
34 pub const SignatureInvalid: Self = Self(200);
35 /// The error code to indicate that the length of the generated signature is too long or too short to make a match in the catalog.
36 ///
37 /// This error occurs when the length of the generated signature is less than ``SHCatalog/minimumQuerySignatureDuration`` or greater than ``SHCatalog/maximumQuerySignatureDuration`` for the session ``SHSession/catalog``.
38 #[doc(alias = "SHErrorCodeSignatureDurationInvalid")]
39 pub const SignatureDurationInvalid: Self = Self(201);
40 /// The error code to indicate when a Shazam Music catalog server issue prevents finding a match.
41 #[doc(alias = "SHErrorCodeMatchAttemptFailed")]
42 pub const MatchAttemptFailed: Self = Self(202);
43 /// The error code to indicate when the custom catalog fails to load due to an invalid format.
44 #[doc(alias = "SHErrorCodeCustomCatalogInvalid")]
45 pub const CustomCatalogInvalid: Self = Self(300);
46 /// The error code to indicate that the format for the custom catalog URL is invalid.
47 #[doc(alias = "SHErrorCodeCustomCatalogInvalidURL")]
48 pub const CustomCatalogInvalidURL: Self = Self(301);
49 /// The error code that indicates when the system fails to add media items to or remove items from the user's Shazam library.
50 #[doc(alias = "SHErrorCodeMediaLibrarySyncFailed")]
51 pub const MediaLibrarySyncFailed: Self = Self(400);
52 /// The error code to indicate a generic framework error.
53 #[doc(alias = "SHErrorCodeInternalError")]
54 pub const InternalError: Self = Self(500);
55 /// The error code to indicate when the system fails to fetch one or more media items.
56 #[doc(alias = "SHErrorCodeMediaItemFetchFailed")]
57 pub const MediaItemFetchFailed: Self = Self(600);
58}
59
60unsafe impl Encode for SHErrorCode {
61 const ENCODING: Encoding = NSInteger::ENCODING;
62}
63
64unsafe impl RefEncode for SHErrorCode {
65 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
66}