objc2_ad_services/generated/
AAAttribution.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 "C" {
10    /// The framework attribution error domain.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/adservices/aaattributionerrordomain?language=objc)
13    pub static AAAttributionErrorDomain: &'static NSErrorDomain;
14}
15
16/// The error codes that may be returned by AAAttribution.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/adservices/aaattributionerrorcode?language=objc)
19// NS_ERROR_ENUM
20#[repr(transparent)]
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
22pub struct AAAttributionErrorCode(pub NSInteger);
23impl AAAttributionErrorCode {
24    /// attributionTokenWithError: is unable to provide a token because the internet isn’t available.
25    ///
26    /// To receive an attribution token, you must have unimpeded internet access. Make sure
27    /// you’re not using a simulator when generating a token.
28    #[doc(alias = "AAAttributionErrorCodeNetworkError")]
29    pub const NetworkError: Self = Self(1);
30    /// attributionTokenWithError: is unable to provide a token because of an internal error.
31    #[doc(alias = "AAAttributionErrorCodeInternalError")]
32    pub const InternalError: Self = Self(2);
33    /// attributionTokenWithError: is unable to provide a token because of an unsupported operating system.
34    #[doc(alias = "AAAttributionErrorCodePlatformNotSupported")]
35    pub const PlatformNotSupported: Self = Self(3);
36}
37
38unsafe impl Encode for AAAttributionErrorCode {
39    const ENCODING: Encoding = NSInteger::ENCODING;
40}
41
42unsafe impl RefEncode for AAAttributionErrorCode {
43    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
44}
45
46extern_class!(
47    /// The parent class that the framework uses to request a token.
48    ///
49    /// See also [Apple's documentation](https://developer.apple.com/documentation/adservices/aaattribution?language=objc)
50    #[unsafe(super(NSObject))]
51    #[derive(Debug, PartialEq, Eq, Hash)]
52    pub struct AAAttribution;
53);
54
55extern_conformance!(
56    unsafe impl NSObjectProtocol for AAAttribution {}
57);
58
59impl AAAttribution {
60    extern_methods!(
61        /// Generates a token.
62        #[unsafe(method(attributionTokenWithError:_))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn attributionTokenWithError() -> Result<Retained<NSString>, Retained<NSError>>;
65    );
66}
67
68/// Methods declared on superclass `NSObject`.
69impl AAAttribution {
70    extern_methods!(
71        #[unsafe(method(init))]
72        #[unsafe(method_family = init)]
73        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
74
75        #[unsafe(method(new))]
76        #[unsafe(method_family = new)]
77        pub unsafe fn new() -> Retained<Self>;
78    );
79}