From 1451b90d898668542f285cf59dc49bdfafb4bc17 Mon Sep 17 00:00:00 2001 From: mattdonnelly Date: Sat, 21 Jun 2014 19:38:40 +0100 Subject: [PATCH] Updated README --- README.md | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 276ae3e0..34c7efbd 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ If you're using Xcode 6, Swifter can be installed by simply dragging the Swifter ###Usage +Swifter can be used with the 3 different kinds of authentication protocols Twitter allows. You can specify which protocol to use as show below. + Instantiation with ACAccount: `let swifter = Swifter(account: twitterAccount)` @@ -18,6 +20,12 @@ Instantiation with OAuth: `let swifter = Swifter(consumerKey: "", consumerSecret: "")` +Instantiation with App Only Auth: + +`let swifter = Swifter(consumerKey: "", consumerSecret: "", appOnly: true)` + +###Example Requests + OAuth Authorization: swifter.authorizeWithCallbackURL(callbackURL, success: { @@ -35,13 +43,14 @@ OAuth Authorization: Get Home Timeline: swifter.getStatusesHomeTimelineWithCount(20, sinceID: nil, maxID: nil, trimUser: true, contributorDetails: false, includeEntities: true, success: { - statuses, response in + (statuses: Dictionary[]?) in // ... }, failure: { + (error: NSError) in - // ... + // ... }) @@ -49,28 +58,39 @@ Get Home Timeline: Streaming API: swifter.getStatusesSampleDelimited(nil, stallWarnings: nil, progress: { - statuses, response in + (status: Dictionary?) in // ... - }, failure: { + }, stallWarnings: { + (code: String?, message: String?, percentFull: Int?) in - // ... + // ... + + }, failure: { + (error: NSError) in + + // ... }) Status Update: swifter.postStatusUpdate("Hello, world", inReplyToStatusID: nil, lat: nil, long: nil, placeID: nil, displayCoordinates: nil, trimUser: nil, success: { - json, response in + (status: Dictionary?) in - // ... + // ... - }, failure: { + }, failure: { + (error: NSError) in - // ... + // ... - }) + }) + +##OAuth Consumer Tokens + +In Twitter REST API v1.1, each client application must authenticate itself with consumer key and consumer secret tokens. You can request consumer tokens for your app on Twitter's website: https://dev.twitter.com/apps. #License