<|start_filename|>Catamaran/Logic/SocialNetworks/Linkedin/CATLinkedInAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATLinkedInAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/ViewController/CATOAuthController.h<|end_filename|>
#import <UIKit/UIKit.h>
#import "CATSocialOAuth.h"
#import "CATOAuthCredential.h"

typedef void (^OAuthControllerCompletionBlock)(CATOAuthCredential *credential, NSString *errorString, __weak UIViewController *weakOAuthController);
typedef void (^OAuthControllerActionEventBlock)(__weak UIViewController *weakOAuthController);

@interface CATOAuthController : UIViewController

@property(nonatomic, strong, readonly) CATSocialOAuth *socialOAuth;

@property(nonatomic, copy) OAuthControllerCompletionBlock completionBlock;
@property(nonatomic, copy) OAuthControllerActionEventBlock onCancelButtonTap;

- (instancetype)initWithSocialOAuth:(CATSocialOAuth *)socialOAuth;

- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil NS_UNAVAILABLE;

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/MailRu/CATMailRuAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATMailRuAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Facebook/CATFacebookOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATFacebookOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Foursquare/CATFoursquareAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATFoursquareAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Yandex/CATYanexAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATYanexAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Yandex/CATYandexOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATYandexOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/OK/CATOKAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATOKAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/GitHub/CATGitHubOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATGitHubOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Foursquare/CATFoursquareOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATFoursquareOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/View/CATOAuthView.h<|end_filename|>
#import <UIKit/UIKit.h>

@class CATOAuthAppearance;
@interface CATOAuthView : UIView

@property(nonatomic, strong, readonly) UIWebView *webView;
@property(nonatomic, strong, readonly) UIActivityIndicatorView *activityIndicatorView;

- (void)configureWithAppearance:(CATOAuthAppearance *)appearance navigationBar:(UINavigationBar *)navigationBar;

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/VK/CATVKOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATVKOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Facebook/CATFacebookAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATFacebookAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/VK/CATVKAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATVKAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Google/CATGoogleAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATGoogleAppearance : CATOAuthAppearance

@end


<|start_filename|>Demo/CatamaranDemo/CatamaranDemo/CATDOAuthsController.h<|end_filename|>
//
//  CATDOAuthsController.h
//  CatamaranDemo
//
//  Created by Alexandr on 16.04.16.
//  Copyright © 2016 Orangesoft LLC. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CATDOAuthsController : UITableViewController

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/OK/CATOKOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATOKOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/CATOAuthCredential.h<|end_filename|>
#import <Foundation/Foundation.h>

@interface CATOAuthCredential : NSObject
<
    NSCoding
>

@property(nonatomic, copy, readonly) NSString *accessToken;
@property(nonatomic, copy, readonly) NSString *tokenType;
@property(nonatomic, copy, readonly) NSString *refreshToken;

@property(nonatomic, assign, getter = isExpired, readonly) BOOL expired;

+ (instancetype)credentialWithOAuthToken:(NSString *)token tokenType:(NSString *)type;
- (instancetype)initWithOAuthToken:(NSString *)token tokenType:(NSString *)type;
- (instancetype)init NS_UNAVAILABLE;

- (void)setRefreshToken:(NSString *)refreshToken;
- (void)setExpiration:(NSDate *)expiration;

- (void)setRefreshToken:(NSString *)refreshToken expiration:(NSDate *)expiration;

@end

<|start_filename|>Catamaran/Logic/SocialNetworks/MailRu/CATMailRuOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATMailRuOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/CATOAuthManager.h<|end_filename|>
#import <Foundation/Foundation.h>
#import "CATSocialOAuth.h"
#import "CATOAuthCredential.h"

typedef void (^OAuthManagerCompletionBlock)(NSDictionary *response, NSString *errorString);

@interface CATOAuthManager : NSObject

+ (CATOAuthManager *)manager;

- (void)authenticateUsingSocialOAuth:(CATSocialOAuth *)socialOAuth code:(NSString *)code completionBlock:(OAuthManagerCompletionBlock)completionBlock;

- (CATOAuthCredential *)credentialByResponse:(NSDictionary *)response;

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Google/CATGoogleOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATGoogleOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/CATOAuthConfigurator.h<|end_filename|>
#import <Foundation/Foundation.h>

@protocol CATOAuthConfigurator <NSObject>

@required
- (NSURL *)redirectURI;

@optional
- (NSString *)facebookApplicationID;
- (NSString *)facebookScope; // permissions in format — permission1,permission2..permissionN

- (NSString *)instagramApplicationID;
- (NSString *)instagramScope; // scope in format — scope1+scope2+..+scopeN

- (NSString *)okApplicationID;
- (NSString *)okApplicationSecret;
- (NSString *)okScope; // scope in format — scope1;scope2..scopeN

- (NSString *)vkApplicationID;
- (NSString *)vkScope; // scope in format — scope1,scope2..scopeN

- (NSString *)googleApplicationID;
- (NSString *)googleScope; // scope in format — scope1+scope2+..+scopeN

- (NSString *)linkedInApplicationID;
- (NSString *)linkedInApplicationSecret;
- (NSString *)linkedInScope; // scope in format — scope1+scope2..scopeN

- (NSString *)foursquareApplicationID;
- (NSString *)foursquareScope;

- (NSString *)yandexApplicationID;
- (NSString *)yandexScope;

- (NSString *)mailRuApplicationID;
- (NSString *)mailRuScope;

- (NSString *)gitHubApplicationID;
- (NSString *)gitHubApplicationSecret;
- (NSString *)gitHubScope;

@end


<|start_filename|>Catamaran/Logic/CATOAuthResponseParser.h<|end_filename|>
#import <Foundation/Foundation.h>

@interface CATOAuthResponseParser : NSObject

+ (NSDictionary *)parseResponseURL:(NSURL *)responseURL;

@end


<|start_filename|>Catamaran/Logic/CATSocialOAuthFactory.h<|end_filename|>
#import <Foundation/Foundation.h>
#import "CATOAuthConfigurator.h"

typedef NS_ENUM(NSUInteger, OSOAuthType)
{
    OSOAuthTypeFacebook,
    OSOAuthTypeInstagram,
    OSOAuthTypeVK,
    OSOAuthTypeOK,
    OSOAuthTypeGoogle,
    OSOAuthTypeLinkedIn,
    OSOAuthTypeFoursquare,
    OSOAuthTypeYandex,
    OSOAuthTypeMailRu,
    OSOAuthTypeGitHub
};

@class CATSocialOAuth;
@interface CATSocialOAuthFactory : NSObject

- (CATSocialOAuth *)OAuthByType:(OSOAuthType)type;

- (instancetype)initWithConfigurator:(id <CATOAuthConfigurator>)configurator;
- (instancetype)init NS_UNAVAILABLE;

@end


<|start_filename|>Demo/CatamaranDemo/CatamaranDemo/CATDConfigurator.h<|end_filename|>
//
//  CATDConfigurator.h
//  CatamaranDemo
//
//  Created by Alexandr on 16.04.16.
//  Copyright © 2016 Orangesoft LLC. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CATOAuthConfigurator.h"

@interface CATDConfigurator : NSObject
<
    CATOAuthConfigurator
>

@end


<|start_filename|>Demo/CatamaranDemo/CatamaranDemo/CATDAppDelegate.h<|end_filename|>
//
//  CATDAppDelegate.h
//  CatamaranDemo
//
//  Created by Alexandr on 16.04.16.
//  Copyright © 2016 Orangesoft LLC. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CATDAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end



<|start_filename|>Catamaran/Logic/SocialNetworks/Base/CATSocialOAuth.h<|end_filename|>
#import <Foundation/Foundation.h>
#import "CATOAuthAppearance.h"
#import "CATOAuthCredential.h"

typedef void (^SocialOAuthAuthorizeHandler)(void);
typedef void (^SocialOAuthAuthorizeCompletionBlock)(CATOAuthCredential *credential, NSString *errorString);

@interface CATSocialOAuth : NSObject

@property(nonatomic, strong, readonly) NSString *baseURL;
@property(nonatomic, strong, readonly) NSString *authPath;
@property(nonatomic, strong, readonly) NSString *clientID;
@property(nonatomic, strong, readonly) NSString *clientSecret;
@property(nonatomic, strong, readonly) NSString *responseType;
@property(nonatomic, strong, readonly) NSURL *redirectURI;

@property(nonatomic, copy) SocialOAuthAuthorizeHandler authorizeHandler;
@property(nonatomic, copy) SocialOAuthAuthorizeCompletionBlock authorizeCompletionBlock;

@property(nonatomic, strong) CATOAuthAppearance *appearance;

- (void)authorize;
- (void)didHandleRedirectURL:(NSURL *)URL;

- (NSURL *)OAuthURL;
- (NSURL *)OAuthAccessTokenByCode:(NSString *)code;

- (NSDictionary *)OAuthURLAdditionalParameters;

+ (instancetype)OAuth;
+ (instancetype)OAuthWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret responseType:(NSString *)responseType redirectURI:(NSURL *)redirectURI scope:(NSString *)scope;
- (instancetype)initWithBaseURL:(NSString *)baseURL authPath:(NSString *)authPath clientID:(NSString *)clientID clientSecret:(NSString *)clientSecret responseType:(NSString *)responseType redirectURI:(NSURL *)redirectURI scope:(NSString *)scope;

- (instancetype)init NS_UNAVAILABLE;

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Linkedin/CATLinkedInOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATLinkedInOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Intagram/CATInstagramAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATInstagramAppearance : CATOAuthAppearance

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/CATOAuths.h<|end_filename|>
#import "CATFacebookOAuth.h"
#import "CATGoogleOAuth.h"
#import "CATInstagramOAuth.h"
#import "CATOKOAuth.h"
#import "CATVKOAuth.h"
#import "CATYandexOAuth.h"
#import "CATMailRuOAuth.h"
#import "CATLinkedInOAuth.h"
#import "CATFoursquareOAuth.h"
#import "CATGitHubOAuth.h"


<|start_filename|>Catamaran/Logic/SocialNetworks/Intagram/CATInstagramOAuth.h<|end_filename|>
#import "CATSocialOAuth.h"

@interface CATInstagramOAuth : CATSocialOAuth

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/Base/CATOAuthAppearance.h<|end_filename|>
#import <UIKit/UIKit.h>

@interface CATOAuthAppearance : NSObject

@property(nonatomic, strong) NSString *title;
@property(nonatomic, strong) NSAttributedString *attributedString;

@property(nonatomic, strong) UIColor *tintColor;
@property(nonatomic, strong) UIColor *mainColor;
@property(nonatomic, strong) UIColor *backgroundColor;

@property(nonatomic, assign) UIStatusBarStyle statusBarStyle;
@property(nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorStyle;

+ (instancetype)appearance;

@end


<|start_filename|>Catamaran/Logic/SocialNetworks/GitHub/CATGitHubAppearance.h<|end_filename|>
#import "CATOAuthAppearance.h"

@interface CATGitHubAppearance : CATOAuthAppearance

@end
