Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdonnelly committed Jun 21, 2014
1 parent 13b43a7 commit 1451b90
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand All @@ -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: {
Expand All @@ -35,42 +43,54 @@ OAuth Authorization:
Get Home Timeline:

swifter.getStatusesHomeTimelineWithCount(20, sinceID: nil, maxID: nil, trimUser: true, contributorDetails: false, includeEntities: true, success: {
statuses, response in
(statuses: Dictionary<String, AnyObject>[]?) in

// ...

}, failure: {
(error: NSError) in

// ...
// ...

})


Streaming API:

swifter.getStatusesSampleDelimited(nil, stallWarnings: nil, progress: {
statuses, response in
(status: Dictionary<String, AnyObject>?) 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<String, AnyObject>?) 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

Expand Down

0 comments on commit 1451b90

Please sign in to comment.