Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jad committed Sep 18, 2011
0 parents commit 38e9db8
Show file tree
Hide file tree
Showing 22 changed files with 1,948 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
.DS_Store

project.xcworkspace
xcuserdata
318 changes: 318 additions & 0 deletions TwitterKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions TwitterKit/TKRequestMethod.h
@@ -0,0 +1,22 @@
//
// TRRequestMethod.h
// Twitbit
//
// Created by John Debay on 7/18/11.
// Copyright 2011 High Order Bit. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum {
TKRequestMethodGET,
TKRequestMethodPOST,
TKRequestMethodDELETE
} TKRequestMethod;


@interface NSString (TRRequestMethodHelpers)

+ (id)stringForRequestMethod:(TKRequestMethod)requestMethod;

@end
32 changes: 32 additions & 0 deletions TwitterKit/TKRequestMethod.m
@@ -0,0 +1,32 @@
//
// TRRequestMethod.m
// Twitbit
//
// Created by John Debay on 7/18/11.
// Copyright 2011 High Order Bit. All rights reserved.
//

#import "TKRequestMethod.h"

@implementation NSString (TKRequestMethodHelpers)

+ (id)stringForRequestMethod:(TKRequestMethod)requestMethod
{
NSString *s = nil;

switch (requestMethod) {
case TKRequestMethodGET:
s = @"GET";
break;
case TKRequestMethodPOST:
s = @"POST";
break;
case TKRequestMethodDELETE:
s = @"DELETE";
break;
}

return s;
}

@end
41 changes: 41 additions & 0 deletions TwitterKit/TKTwitterOAuthAuthenticator.h
@@ -0,0 +1,41 @@
//
// TwitterOAuthService.h
// Twitbit
//
// Created by John Debay on 7/16/11.
// Copyright 2011 High Order Bit. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^TKTokenCompletion)(NSString *urlQueryString, NSError *error);
typedef void(^TKCredentialsCompletion)(NSDictionary *creds, NSError *error);

@interface TKTwitterOAuthAuthenticator : NSObject

@property (nonatomic, copy, readonly) NSString *consumerKey;
@property (nonatomic, copy, readonly) NSString *consumerSecret;

#pragma mark - Initialization

- (id)initWithConsumerKey:(NSString *)key consumerSecret:(NSString *)secret;

#pragma mark - Fetching the token

- (void)fetchTwitterTokenWithCallbackURL:(NSURL *)callbackURL
completion:(TKTokenCompletion)completion;

#pragma mark - Authorizing the token

- (void)authenticateTwitterToken:(NSString *)token
withVerifier:(NSString *)verifier
completion:(TKCredentialsCompletion)completion;

#pragma mark - URLs

+ (NSURL *)twitterTokenURL;
+ (NSURL *)authenticationURLForOAuthToken:(NSString *)token;

+ (NSURL *)twitterAuthorizationURL;

@end

0 comments on commit 38e9db8

Please sign in to comment.