Type Definitions

The following type definitions are available globally.

  • Callback to trigger when fetch resource success.

    Declaration

    Objective-C

    typedef void (^SCSDKUserDataSuccessCompletion)(SCSDKUserData *_Nullable,
                                                   NSError *_Nullable)

    Swift

    typealias SCSDKUserDataSuccessCompletion = (SCSDKUserData?, Error?) -> Void

    Parameters

    userData

    SCSDKUserData object that contains fetched user data

    partialError

    NSError containing any errors in the case of a partial success response

  • Callback to trigger when fetch resource failed.

    Declaration

    Objective-C

    typedef void (^SCSDKUserDataFailureCompletion)(NSError *_Nullable, BOOL)

    Swift

    typealias SCSDKUserDataFailureCompletion = (Error?, Bool) -> Void

    Parameters

    error

    Error responsible for user data fetching failure

    isUserLoggedOut

    Set to YES if the connection between 3PA and Snapchat is broken or user is not logged in to 3PA using Snapchat. Set to NO if other errors occur while fetching data from Snapchat

  • The completion handler to when getting a refreshed access token is complete. The access token returned, if present, is valid.

    Declaration

    Objective-C

    typedef void (^SCOAuth2RefreshAccessTokenCompletionBlock)(NSString *_Nullable,
                                                              NSError *_Nullable)

    Swift

    typealias SCOAuth2RefreshAccessTokenCompletionBlock = (String?, Error?) -> Void

    Parameters

    accessToken

    Refreshed access token

    error

    Error returned in case of a failure refreshing the access token.

  • The completion handler which SCFetchCodeVerifierBlock must invoke to report its result, either a code verifier or an error.

    Declaration

    Objective-C

    typedef void (^SCFetchCodeVerifierCompletionBlock)(NSString *_Nullable,
                                                       NSError *_Nullable)

    Swift

    typealias SCFetchCodeVerifierCompletionBlock = (String?, Error?) -> Void

    Parameters

    codeVerifier

    The code verifier

    error

    The error returned when the code verifier could not be fetched

  • A block which uses the state to fetch a code verifier and communicates this result via the completion block.

    Declaration

    Objective-C

    typedef void (^SCFetchCodeVerifierBlock)(
        NSString *_Nonnull, SCFetchCodeVerifierCompletionBlock _Nonnull)

    Swift

    typealias SCFetchCodeVerifierBlock = (String, @escaping SCFetchCodeVerifierCompletionBlock) -> Void

    Parameters

    state

    The oAuth2 state which is needed to fetch the code verifier

    completionBlock

    A block to be used to communicate the result of fetching the code verifier, whether it is the code verifier or an error.

  • Callback triggered when OAuth Authorization for Firebase Authentication is complete.

    Declaration

    Objective-C

    typedef void (^SCFirebaseAuthCompletionBlock)(NSString *_Nullable,
                                                  NSError *_Nullable)

    Swift

    typealias SCFirebaseAuthCompletionBlock = (String?, Error?) -> Void

    Parameters

    customToken

    that can be used to authentication with Firebase

    error

    indicating that something went wrong