DBOAuthResult
Objective-C
@interface DBOAuthResult : NSObject
Swift
class DBOAuthResult : NSObject
Union result type from OAuth linking attempt.
-
Represents the
DBOAuthResultobject’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 theisSuccessmethod 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 theisErrormethod 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
DBAuthErrorTypethat is returned in the event of an unsuccessful OAuth authorization.Note
Ensure theisErrormethod 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
NSErrorform of the error result.Note
Ensure theisErrormethod 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 }
-
Initializes union class with tag state of “success”.
Declaration
Objective-C
- (nonnull instancetype)initWithSuccess:(nonnull DBAccessToken *)accessToken;Swift
init(success accessToken: DBAccessToken)Parameters
accessTokenThe
DBAccessToken(account_id/team_idand OAuth token pair) retrieved from the authorization flow.Return Value
An initialized
DBOAuthResultinstance. -
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
errorTypeThe string identifier of the OAuth error type (lookup performed in errorTypeLookup dict).
errorDescriptionA short description of the error that occured during the authorization flow.
Return Value
An initialized
DBOAuthResultinstance. -
Initializes union class with tag state of “cancel”.
Declaration
Objective-C
- (nonnull instancetype)initWithCancel;Swift
init(cancel: ())Return Value
An initialized
DBOAuthResultinstance. -
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?) -> DBOAuthResultParameters
errorDescriptionA short description of the error that occured during the authorization flow.
Return Value
An initialized
DBOAuthResultinstance.
-
Retrieves whether the union’s current tag state has value “success”.
Declaration
Objective-C
- (BOOL)isSuccess;Swift
func isSuccess() -> BoolReturn 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() -> BoolReturn 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() -> BoolReturn Value
Whether the union’s current tag state has value “cancel”.
-
Retrieves string value of union’s current tag state.
Declaration
Objective-C
- (nonnull NSString *)tagName;Swift
func tagName() -> StringReturn Value
A human-readable string representing the union’s current tag state.
-
Description method.
Declaration
Objective-C
- (nonnull NSString *)description;Swift
func description() -> StringReturn Value
A human-readable representation of the current object.
View on GitHub
DBOAuthResult Class Reference