https://github.com/hiragram/somen
https://github.com/hiragram/somen
rxswift swift twitter twitter-streaming-api
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hiragram/somen
- Owner: hiragram
- Created: 2017-03-06T14:07:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-09T03:48:27.000Z (about 9 years ago)
- Last Synced: 2025-08-02T09:38:34.231Z (11 months ago)
- Topics: rxswift, swift, twitter, twitter-streaming-api
- Language: Swift
- Size: 53.7 KB
- Stars: 5
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Somen
Somen provides a way to receive data from streaming API of Twitter with RxSwift observable.
__NOTICE: This library is still version 0 and under development. I do not recommend to use this library in production environment until version 1 release.__
## Example
1. Initialize Somen instance with your authorization tokens.
```swift
var somen = Somen.init(consumerKey: "YOUR_CONSUMER_KEY",
consumerSecret: "YOUR_CONSUMER_SECRET",
accessToken: "YOUR_ACCESS_TOKEN",
accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET")
```
2. Subscribe UserStream API
```swift
somen.home().subscribe(onNext: { (event) in
switch event {
case .newStatus(rawEvent: let e):
// process new status event
break
case .favorite(rawEvent: let e):
// process favorite event
break
default:
break
}
})
```
## Supported streams and events
Curently Somen supports [User streams](https://dev.twitter.com/streaming/userstreams). And following types of events are supported.
- newStatus
- deleteStatus
- deleteLocation
- limitNotice
- statusWithheld
- userWithheld
- stallWarning
- userUpdate
- friends
- directMessage
- block
- unblock
- favorite
- unfavorite
- follow
- unfollow
- listCreated
- listDestroyed
- listUpdated
- listMemberAdded
- listMemberRemoved
- listUserSubscribed
- listUserUnsubscribed
- quotedTweet
If unsupported event was received, the event is processed as `unsupportedEvent` and it has raw event dictionary as the associated value.
## Installation
Using Carthage:
Write as follows in Cartfile
```
github "hiragram/Somen"
```
then
```sh
$ carthage update
```