DBOAuthResult

Objective-C

@interface DBOAuthResult : NSObject

Swift

class DBOAuthResult : NSObject

Union result type from OAuth linking attempt.

Instance variables

  • tag

    Represents the DBOAuthResult object’s current tag state.

    Declaration

    Objective-C

    @property (nonatomic, readonly) DBOAuthResultTag tag;

    Swift

    var tag: DBOAuthResultTag { get }
  • The access token that is retrieved in the event of a successful OAuth authorization.

    Note

    Ensure the isSuccess method returns true before accessing, otherwise a runtime exception will be raised.

    Declaration

    Objective-C

    @property (nonatomic, readonly) DBAccessToken *_Nonnull accessToken;

    Swift

    var accessToken: DBAccessToken { get }
  • The type of OAuth error that is returned in the event of an unsuccessful OAuth authorization.

    Note

    Ensure the isError method returns true before accessing, otherwise a runtime exception will be raised.

    Declaration

    Objective-C

    @property (nonatomic, readonly) DBOAuthErrorType errorType;

    Swift

    var errorType: DBOAuthErrorType { get }
  • The error description string associated with the DBAuthErrorType that is returned in the event of an unsuccessful OAuth authorization.

    Note

    Ensure the isError method returns true before accessing, otherwise a runtime exception will be raised.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull errorDescription;

    Swift

    var errorDescription: String { get }
  • The NSError form of the error result.

    Note

    Ensure the isError method returns true before accessing, otherwise a runtime exception will be raised.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSError *_Nonnull nsError;

    Swift

    var nsError: Error { get }

Constructors

  • Initializes union class with tag state of “success”.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSuccess:(nonnull DBAccessToken *)accessToken;

    Swift

    init(success accessToken: DBAccessToken)

    Parameters

    accessToken

    The DBAccessToken (account_id / team_id and OAuth token pair) retrieved from the authorization flow.

    Return Value

    An initialized DBOAuthResult instance.

  • Initializes union class with tag state of “error”.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithError:(nonnull NSString *)errorType
                         errorDescription:(nullable NSString *)errorDescription;

    Swift

    init(error errorType: String, errorDescription: String?)

    Parameters

    errorType

    The string identifier of the OAuth error type (lookup performed in errorTypeLookup dict).

    errorDescription

    A short description of the error that occured during the authorization flow.

    Return Value

    An initialized DBOAuthResult instance.

  • Initializes union class with tag state of “cancel”.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithCancel;

    Swift

    init(cancel: ())

    Return Value

    An initialized DBOAuthResult instance.

  • Factory method to create union class with tag state of “error” and unknown error type.

    Declaration

    Objective-C

    + (nonnull DBOAuthResult *)unknownErrorWithErrorDescription:
        (nullable NSString *)errorDescription;

    Swift

    class func unknownErrorWithErrorDescription(_ errorDescription: String?) -> DBOAuthResult

    Parameters

    errorDescription

    A short description of the error that occured during the authorization flow.

    Return Value

    An initialized DBOAuthResult instance.

Tag state methods

  • Retrieves whether the union’s current tag state has value “success”.

    Declaration

    Objective-C

    - (BOOL)isSuccess;

    Swift

    func isSuccess() -> Bool

    Return Value

    Whether the union’s current tag state has value “success”.

  • Retrieves whether the union’s current tag state has value “error”.

    Declaration

    Objective-C

    - (BOOL)isError;

    Swift

    func isError() -> Bool

    Return Value

    Whether the union’s current tag state has value “error”.

  • Retrieves whether the union’s current tag state has value “cancel”.

    Declaration

    Objective-C

    - (BOOL)isCancel;

    Swift

    func isCancel() -> Bool

    Return Value

    Whether the union’s current tag state has value “cancel”.

Tag name method

  • Retrieves string value of union’s current tag state.

    Declaration

    Objective-C

    - (nonnull NSString *)tagName;

    Swift

    func tagName() -> String

    Return Value

    A human-readable string representing the union’s current tag state.

Description method

  • Description method.

    Declaration

    Objective-C

    - (nonnull NSString *)description;

    Swift

    func description() -> String

    Return Value

    A human-readable representation of the current object.