Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gonzalezreal/gig
A great Twitter API client for Objective-C
https://github.com/gonzalezreal/gig
Last synced: 5 days ago
JSON representation
A great Twitter API client for Objective-C
- Host: GitHub
- URL: https://github.com/gonzalezreal/gig
- Owner: gonzalezreal
- License: other
- Created: 2013-09-10T06:48:33.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-09-12T15:44:51.000Z (over 11 years ago)
- Last Synced: 2025-02-02T18:52:14.364Z (19 days ago)
- Language: Objective-C
- Size: 863 KB
- Stars: 19
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gig
**Gig** provides an asynchronous block-based Objective-C wrapper for the Twitter 1.1 API. It makes use of [Mantle](https://github.com/github/Mantle) to model Twitter Platform objects and [AFNetworking](https://github.com/AFNetworking/AFNetworking) to perform the API requests.
## Status
Gig is very much work in progress. Models for Tweets, Users, Entities and Places are fully implemented. As for the API, Gig currently implements timeline and tweet related methods. The remaining methods will be implemented over time (pull requests are welcome!).
## Sample code
### Authentication
Gig uses the [Accounts Framework](https://developer.apple.com/library/ios/documentation/Accounts/Reference/AccountsFrameworkRef/_index.html) to authenticate API requests. Simply initialize your client with an `ACAccount` object and all the requests will be signed with that account.
```objc
GIGClient *client = [[GIGClient alloc] initWithAccount:account];
```### Timelines
Use the `-fetchTimeline:parameters:completion` method to fetch tweets from a Twitter timeline.
```objc
// Fetch the two most recent tweets in my home timeline
[client fetchTimeline:GIGTimelineHome parameters:@{
GIGCountKey : @2
} completion:^(NSArray *tweets, NSError *error) {
for (GIGTweet *tweet in tweets) {
NSLog(@"%@: %@", tweet.user.screenName, tweet.text);
}
}];
```### Tweets
```objc
// Update status[client updateStatusWithText:@"Hello world!!!" parameters:nil completion:^(GIGTweet *tweet, NSError *error) {
NSLog(@"statusID: %@", tweet.statusID);
}];
``````objc
// Update status with mediaNSData *data = UIImageJPEGRepresentation(picture, 1.0);
[client updateStatusWithText:@"Hello world!!!" media:data parameters:nil completion:^(GIGTweet *tweet, NSError *error) {
GIGMedia *media = tweet.entities.media[0];
NSLog(@"statusID: %@, mediaID: %@", tweet.statusID, media.mediaID);
}];
```## Contact
[Guillermo Gonzalez](http://github.com/gonzalezreal)
[@gonzalezreal](https://twitter.com/gonzalezreal)## License
Gig is released under the MIT license. See [LICENSE.md](https://github.com/gonzalezreal/Gig/blob/master/LICENSE).