diff --git a/.scalafmt.conf b/.scalafmt.conf
new file mode 100644
index 00000000..f0a9f376
--- /dev/null
+++ b/.scalafmt.conf
@@ -0,0 +1 @@
+maxColumn = 120
diff --git a/.travis.yml b/.travis.yml
index 4173519b..3e6d287e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,6 +15,7 @@ env:
- SBT_OPTS = -XX:MaxPermSize=1024M -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled
script:
+ - sbt scalafmt::test test:scalafmt::test sbt:scalafmt::test # check files are formatted correctly
- travis_retry sbt clean coverage test coverageReport
after_success:
diff --git a/build.sbt b/build.sbt
index 150e4f93..a5ec73e0 100755
--- a/build.sbt
+++ b/build.sbt
@@ -40,10 +40,10 @@ libraryDependencies ++= {
}
scalacOptions in ThisBuild ++= Seq("-language:postfixOps",
- "-language:implicitConversions",
- "-language:existentials",
- "-feature",
- "-deprecation")
+ "-language:implicitConversions",
+ "-language:existentials",
+ "-feature",
+ "-deprecation")
lazy val standardSettings = Seq(
organization := "com.danielasfregola",
@@ -96,6 +96,9 @@ lazy val coverageSettings = Seq(
coverageMinimum := 85
)
+scalafmtOnCompile in ThisBuild := true
+scalafmtTestOnCompile in ThisBuild := true
+
siteSubdirName in SiteScaladoc := version + "/api"
lazy val root = (project in file("."))
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 595cab8d..2542cfd2 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -16,4 +16,6 @@ addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
+addSbtPlugin("com.lucidchart" % "sbt-scalafmt-coursier" % "1.15")
+
parallelExecution in Test := false
diff --git a/src/main/scala/com/danielasfregola/twitter4s/TwitterAuthenticationClient.scala b/src/main/scala/com/danielasfregola/twitter4s/TwitterAuthenticationClient.scala
index 7673627b..79cb0b3a 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/TwitterAuthenticationClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/TwitterAuthenticationClient.scala
@@ -13,8 +13,7 @@ class TwitterAuthenticationClient(val consumerToken: ConsumerToken) extends Twit
}
-trait TwitterAuthClients
- extends TwitterOAuthClient
+trait TwitterAuthClients extends TwitterOAuthClient
object TwitterAuthenticationClient {
diff --git a/src/main/scala/com/danielasfregola/twitter4s/TwitterStreamingClient.scala b/src/main/scala/com/danielasfregola/twitter4s/TwitterStreamingClient.scala
index 31288bbd..7803c61c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/TwitterStreamingClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/TwitterStreamingClient.scala
@@ -15,10 +15,7 @@ class TwitterStreamingClient(val consumerToken: ConsumerToken, val accessToken:
}
-trait StreamingClients
- extends TwitterStatusClient
- with TwitterUserClient
- with TwitterSiteClient
+trait StreamingClients extends TwitterStatusClient with TwitterUserClient with TwitterSiteClient
object TwitterStreamingClient {
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Configuration.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Configuration.scala
index 12880f52..42f2459a 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Configuration.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Configuration.scala
@@ -1,10 +1,10 @@
package com.danielasfregola.twitter4s.entities
final case class Configuration(dm_text_character_limit: Long,
- characters_reserved_per_media: Int,
- max_media_per_upload: Int,
- non_username_paths: Seq[String] = Seq.empty,
- photo_size_limit: Long,
- photo_sizes: Map[String, Size] = Map.empty,
- short_url_length: Int,
- short_url_length_https: Int)
+ characters_reserved_per_media: Int,
+ max_media_per_upload: Int,
+ non_username_paths: Seq[String] = Seq.empty,
+ photo_size_limit: Long,
+ photo_sizes: Map[String, Size] = Map.empty,
+ short_url_length: Int,
+ short_url_length_https: Int)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/DirectMessage.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/DirectMessage.scala
index 983096d1..36607758 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/DirectMessage.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/DirectMessage.scala
@@ -5,22 +5,16 @@ import java.util.Date
import com.danielasfregola.twitter4s.entities.streaming.UserStreamingMessage
final case class DirectMessage(created_at: Date,
- entities: Option[Entities],
- id: Long,
- id_str: String,
- recipient: User,
- recipient_id: Long,
- recipient_id_str: String,
- recipient_screen_name: String,
- sender: User,
- sender_id: Long,
- sender_id_str: String,
- sender_screen_name: String,
- text: String) extends UserStreamingMessage
-
-
-
-
-
-
-
+ entities: Option[Entities],
+ id: Long,
+ id_str: String,
+ recipient: User,
+ recipient_id: Long,
+ recipient_id_str: String,
+ recipient_screen_name: String,
+ sender: User,
+ sender_id: Long,
+ sender_id_str: String,
+ sender_screen_name: String,
+ text: String)
+ extends UserStreamingMessage
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Entities.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Entities.scala
index 0094a1bc..6d7397dd 100755
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Entities.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Entities.scala
@@ -4,16 +4,13 @@ package com.danielasfregola.twitter4s.entities
// unfortunately Twitter is not consistent when representing this entity...
final case class Entities(hashtags: Seq[HashTag] = Seq.empty,
- media: Seq[Media] = Seq.empty,
- symbols: Seq[Symbol] = Seq.empty,
- url: Option[Urls] = None,
- urls: Seq[UrlDetails] = Seq.empty,
- user_mentions: Seq[UserMention] = Seq.empty,
- description: Option[Urls] = None)
+ media: Seq[Media] = Seq.empty,
+ symbols: Seq[Symbol] = Seq.empty,
+ url: Option[Urls] = None,
+ urls: Seq[UrlDetails] = Seq.empty,
+ user_mentions: Seq[UserMention] = Seq.empty,
+ description: Option[Urls] = None)
final case class Urls(urls: Seq[UrlDetails] = Seq.empty)
final case class UrlDetails(url: String, expanded_url: String, display_url: String, indices: Seq[Int])
-
-
-
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/GeoPlace.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/GeoPlace.scala
index 81e68041..146192a3 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/GeoPlace.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/GeoPlace.scala
@@ -1,15 +1,14 @@
package com.danielasfregola.twitter4s.entities
final case class GeoPlace(attributes: Map[String, String],
- bounding_box: Area,
- country: String,
- country_code: String,
- full_name: String,
- id: String,
- name: String,
- place_type: String,
- url: String,
- contained_within: Seq[GeoPlace],
- centroid: Seq[Double] = Seq.empty,
- polylines: Seq[String] = Seq.empty)
-
+ bounding_box: Area,
+ country: String,
+ country_code: String,
+ full_name: String,
+ id: String,
+ name: String,
+ place_type: String,
+ url: String,
+ contained_within: Seq[GeoPlace],
+ centroid: Seq[Double] = Seq.empty,
+ polylines: Seq[String] = Seq.empty)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/GeoSearch.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/GeoSearch.scala
index 5ae14411..0be8faa1 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/GeoSearch.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/GeoSearch.scala
@@ -7,9 +7,8 @@ final case class GeoQuery(params: GeoParams, `type`: String, url: String)
final case class GeoResult(places: Seq[GeoPlace] = Seq.empty)
final case class GeoParams(accuracy: String,
- granularity: String,
- coordinates: Option[Coordinates] = None,
- query: Option[String] = None,
- autocomplete: Boolean = false,
- trim_place: Boolean = false)
-
+ granularity: String,
+ coordinates: Option[Coordinates] = None,
+ query: Option[String] = None,
+ autocomplete: Boolean = false,
+ trim_place: Boolean = false)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Location.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Location.scala
index 517f3386..e36d222d 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Location.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Location.scala
@@ -1,9 +1,9 @@
package com.danielasfregola.twitter4s.entities
final case class Location(country: String,
- countryCode: Option[String],
- name: String,
- parentid: Long,
- placeType: PlaceType,
- url: String,
- woeid: Long)
+ countryCode: Option[String],
+ name: String,
+ parentid: Long,
+ placeType: PlaceType,
+ url: String,
+ woeid: Long)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/LocationTrends.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/LocationTrends.scala
index 10df75f7..bb8f0e8f 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/LocationTrends.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/LocationTrends.scala
@@ -1,11 +1,11 @@
package com.danielasfregola.twitter4s.entities
final case class LocationTrends(as_of: String, // TODO - convert to Date? Different date format here...
- created_at: String, // TODO - convert to Date? Different date format here...
- locations: Seq[LocationOverview] = Seq.empty,
- trends: Seq[Trend] = Seq.empty)
+ created_at: String, // TODO - convert to Date? Different date format here...
+ locations: Seq[LocationOverview] = Seq.empty,
+ trends: Seq[Trend] = Seq.empty)
final case class LocationOverview(name: String, woeid: Long)
// TODO - support 'promoted_content' and 'events'
-final case class Trend(name: String, query: String, url: String,tweet_volume:Option[Long])
+final case class Trend(name: String, query: String, url: String, tweet_volume: Option[Long])
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupEntities.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupEntities.scala
index 4d2dca0a..d9bcdf1f 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupEntities.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupEntities.scala
@@ -4,5 +4,4 @@ final case class LookupEntities(url: LookupUrls, description: LookupUrls)
final case class LookupUrls(urls: Seq[LookupUrl])
-final case class LookupUrl( url: String, expanded_url: String, display_url: String, indices: Seq[Int])
-
+final case class LookupUrl(url: String, expanded_url: String, display_url: String, indices: Seq[Int])
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupRelationship.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupRelationship.scala
index 4797e06a..bab18f25 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupRelationship.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupRelationship.scala
@@ -1,7 +1,7 @@
package com.danielasfregola.twitter4s.entities
final case class LookupRelationship(connections: Seq[String] = Seq.empty,
- id: Long,
- id_str: String,
- name: String,
- screen_name: String)
+ id: Long,
+ id_str: String,
+ name: String,
+ screen_name: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupTweet.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupTweet.scala
index 5f522b54..71f7b002 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupTweet.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupTweet.scala
@@ -3,30 +3,27 @@ package com.danielasfregola.twitter4s.entities
import java.util.Date
final case class LookupTweet(
- contributors: Seq[Contributor],
- coordinates: Seq[Seq[Seq[Double]]] = Seq.empty,
- created_at: Date,
- entities: Option[Entities],
- favorite_count: Int = 0,
- favorited: Boolean = false,
- id: Long,
- id_str: String,
- in_reply_to_screen_name: Option[String],
- in_reply_to_status_id: Option[Long],
- in_reply_to_status_id_str: Option[String],
- in_reply_to_user_id: Option[Long],
- in_reply_to_user_id_str: Option[String],
- is_quote_status: Boolean = false,
- lang: Option[String],
- place: Option[GeoPlace],
- possibly_sensitive: Boolean = false,
- retweet_count: Long = 0,
- retweeted: Boolean = false,
- source: String,
- text: String,
- truncated: Boolean = false,
- user: Option[LookupUser]
- )
-
-
-
+ contributors: Seq[Contributor],
+ coordinates: Seq[Seq[Seq[Double]]] = Seq.empty,
+ created_at: Date,
+ entities: Option[Entities],
+ favorite_count: Int = 0,
+ favorited: Boolean = false,
+ id: Long,
+ id_str: String,
+ in_reply_to_screen_name: Option[String],
+ in_reply_to_status_id: Option[Long],
+ in_reply_to_status_id_str: Option[String],
+ in_reply_to_user_id: Option[Long],
+ in_reply_to_user_id_str: Option[String],
+ is_quote_status: Boolean = false,
+ lang: Option[String],
+ place: Option[GeoPlace],
+ possibly_sensitive: Boolean = false,
+ retweet_count: Long = 0,
+ retweeted: Boolean = false,
+ source: String,
+ text: String,
+ truncated: Boolean = false,
+ user: Option[LookupUser]
+)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupUser.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupUser.scala
index 97876acc..cfad7031 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/LookupUser.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/LookupUser.scala
@@ -3,47 +3,47 @@ package com.danielasfregola.twitter4s.entities
import java.util.Date
final case class LookupUser(
- contributors_enabled: Boolean = false,
- created_at: Date,
- default_profile: Boolean = false,
- default_profile_image: Boolean = false,
- description: Option[String] = None,
- entities: Option[LookupEntities] = None,
- favourites_count: Int,
- follow_request_sent: Boolean = false,
- following: Boolean = false,
- followers_count: Int,
- friends_count: Int,
- geo_enabled: Boolean = false,
- has_extended_profile: Boolean = false,
- id: Long,
- id_str: String,
- is_translator: Boolean = false,
- is_translation_enabled: Boolean = false,
- lang: String,
- listed_count: Int,
- location: Option[String] = None,
- name: String,
- notifications: Boolean = false,
- profile_background_color: String,
- profile_background_image_url: String,
- profile_background_image_url_https: String,
- profile_background_tile: Boolean = false,
- profile_banner_url: Option[String] = None,
- profile_image_url: ProfileImage,
- profile_image_url_https: ProfileImage,
- profile_link_color: String,
- profile_sidebar_border_color: String,
- profile_sidebar_fill_color: String,
- profile_text_color: String,
- profile_use_background_image: Boolean = false,
- `protected`: Boolean = false,
- screen_name: String,
- statuses_count: Int,
- time_zone: Option[String] = None,
- url: Option[String] = None,
- utc_offset: Option[Int] = None,
- verified: Boolean = false,
- withheld_in_countries: Option[String] = None,
- withheld_scope: Option[String] = None
- )
+ contributors_enabled: Boolean = false,
+ created_at: Date,
+ default_profile: Boolean = false,
+ default_profile_image: Boolean = false,
+ description: Option[String] = None,
+ entities: Option[LookupEntities] = None,
+ favourites_count: Int,
+ follow_request_sent: Boolean = false,
+ following: Boolean = false,
+ followers_count: Int,
+ friends_count: Int,
+ geo_enabled: Boolean = false,
+ has_extended_profile: Boolean = false,
+ id: Long,
+ id_str: String,
+ is_translator: Boolean = false,
+ is_translation_enabled: Boolean = false,
+ lang: String,
+ listed_count: Int,
+ location: Option[String] = None,
+ name: String,
+ notifications: Boolean = false,
+ profile_background_color: String,
+ profile_background_image_url: String,
+ profile_background_image_url_https: String,
+ profile_background_tile: Boolean = false,
+ profile_banner_url: Option[String] = None,
+ profile_image_url: ProfileImage,
+ profile_image_url_https: ProfileImage,
+ profile_link_color: String,
+ profile_sidebar_border_color: String,
+ profile_sidebar_fill_color: String,
+ profile_text_color: String,
+ profile_use_background_image: Boolean = false,
+ `protected`: Boolean = false,
+ screen_name: String,
+ statuses_count: Int,
+ time_zone: Option[String] = None,
+ url: Option[String] = None,
+ utc_offset: Option[Int] = None,
+ verified: Boolean = false,
+ withheld_in_countries: Option[String] = None,
+ withheld_scope: Option[String] = None
+)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Media.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Media.scala
index a7faa938..d9380a75 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Media.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Media.scala
@@ -1,15 +1,15 @@
package com.danielasfregola.twitter4s.entities
final case class Media(display_url: String,
- expanded_url: String,
- id: Long,
- id_str: String,
- indices: Seq[Int],
- media_url: String,
- media_url_https: String,
- sizes: Map[String, Size],
- source_status_id: Option[Long],
- source_status_id_str: Option[String],
- `type`: String,
- url: String,
- video_info: Option[VideoInfo])
+ expanded_url: String,
+ id: Long,
+ id_str: String,
+ indices: Seq[Int],
+ media_url: String,
+ media_url_https: String,
+ sizes: Map[String, Size],
+ source_status_id: Option[Long],
+ source_status_id_str: Option[String],
+ `type`: String,
+ url: String,
+ video_info: Option[VideoInfo])
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/MediaDetails.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/MediaDetails.scala
index 272183c0..525d6ae7 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/MediaDetails.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/MediaDetails.scala
@@ -1,16 +1,16 @@
package com.danielasfregola.twitter4s.entities
final case class MediaDetails(media_id: Long,
- media_id_string: String,
- expires_after_secs: Int,
- size: Option[Long] = None,
- image: Option[Image] = None,
- video: Option[Video] = None,
- processing_info: Option[ProcessingInfo] = None)
+ media_id_string: String,
+ expires_after_secs: Int,
+ size: Option[Long] = None,
+ image: Option[Image] = None,
+ video: Option[Video] = None,
+ processing_info: Option[ProcessingInfo] = None)
final case class ProcessingInfo(state: String,
- progress_percent: Long,
- check_after_secs: Option[Int],
- error: ProcessingError)
+ progress_percent: Long,
+ check_after_secs: Option[Int],
+ error: ProcessingError)
final case class ProcessingError(code: Int, name: String, message: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/MediaUpload.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/MediaUpload.scala
index 6c2d33bc..1745e1db 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/MediaUpload.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/MediaUpload.scala
@@ -1,4 +1,3 @@
package com.danielasfregola.twitter4s.entities
-final case class MediaUpload(media: String,
- additional_owners: Option[String])
+final case class MediaUpload(media: String, additional_owners: Option[String])
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/OEmbedTweet.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/OEmbedTweet.scala
index e27507b3..b11157f8 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/OEmbedTweet.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/OEmbedTweet.scala
@@ -1,15 +1,14 @@
package com.danielasfregola.twitter4s.entities
final case class OEmbedTweet(author_name: Option[String],
- author_url: Option[String],
- cache_age: Option[String],
- height: Option[Int],
- html: String,
- provider_url: Option[String],
- provider_name: Option[String],
- title: Option[String],
- `type`: String,
- url: String,
- version: String,
- width: Option[Int])
-
+ author_url: Option[String],
+ cache_age: Option[String],
+ height: Option[Int],
+ html: String,
+ provider_url: Option[String],
+ provider_name: Option[String],
+ title: Option[String],
+ `type`: String,
+ url: String,
+ version: String,
+ width: Option[Int])
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/ProfileUpdate.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/ProfileUpdate.scala
index 9ff6f89c..941918ca 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/ProfileUpdate.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/ProfileUpdate.scala
@@ -1,9 +1,9 @@
package com.danielasfregola.twitter4s.entities
final case class ProfileUpdate(name: Option[String] = None,
- url: Option[String] = None,
- description: Option[String] = None,
- location: Option[String] = None,
- profile_link_color: Option[String] = None,
- include_entities: Boolean = true,
- skip_status: Boolean = false)
+ url: Option[String] = None,
+ description: Option[String] = None,
+ location: Option[String] = None,
+ profile_link_color: Option[String] = None,
+ include_entities: Boolean = true,
+ skip_status: Boolean = false)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/RateLimits.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/RateLimits.scala
index c0a94e5e..9cb526dc 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/RateLimits.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/RateLimits.scala
@@ -5,23 +5,23 @@ final case class RateLimits(rate_limit_context: RateLimitContext, resources: Res
final case class RateLimitContext(access_token: String)
final case class Resources(lists: Map[String, RateLimit] = Map.empty,
- application: Map[String, RateLimit] = Map.empty,
- mutes: Map[String, RateLimit] = Map.empty,
- friendships: Map[String, RateLimit] = Map.empty,
- blocks: Map[String, RateLimit] = Map.empty,
- geo: Map[String, RateLimit] = Map.empty,
- users: Map[String, RateLimit] = Map.empty,
- followers: Map[String, RateLimit] = Map.empty,
- collections: Map[String, RateLimit] = Map.empty,
- statuses: Map[String, RateLimit] = Map.empty,
- contacts: Map[String, RateLimit] = Map.empty,
- moments: Map[String, RateLimit] = Map.empty,
- help: Map[String, RateLimit] = Map.empty,
- friends: Map[String, RateLimit] = Map.empty,
- direct_messages: Map[String, RateLimit] = Map.empty,
- account: Map[String, RateLimit] = Map.empty,
- favorites: Map[String, RateLimit] = Map.empty,
- device: Map[String, RateLimit] = Map.empty,
- saved_searches: Map[String, RateLimit] = Map.empty,
- search: Map[String, RateLimit] = Map.empty,
- trends: Map[String, RateLimit] = Map.empty)
+ application: Map[String, RateLimit] = Map.empty,
+ mutes: Map[String, RateLimit] = Map.empty,
+ friendships: Map[String, RateLimit] = Map.empty,
+ blocks: Map[String, RateLimit] = Map.empty,
+ geo: Map[String, RateLimit] = Map.empty,
+ users: Map[String, RateLimit] = Map.empty,
+ followers: Map[String, RateLimit] = Map.empty,
+ collections: Map[String, RateLimit] = Map.empty,
+ statuses: Map[String, RateLimit] = Map.empty,
+ contacts: Map[String, RateLimit] = Map.empty,
+ moments: Map[String, RateLimit] = Map.empty,
+ help: Map[String, RateLimit] = Map.empty,
+ friends: Map[String, RateLimit] = Map.empty,
+ direct_messages: Map[String, RateLimit] = Map.empty,
+ account: Map[String, RateLimit] = Map.empty,
+ favorites: Map[String, RateLimit] = Map.empty,
+ device: Map[String, RateLimit] = Map.empty,
+ saved_searches: Map[String, RateLimit] = Map.empty,
+ search: Map[String, RateLimit] = Map.empty,
+ trends: Map[String, RateLimit] = Map.empty)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Relationship.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Relationship.scala
index a9bbbbe7..4483ed82 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Relationship.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Relationship.scala
@@ -5,26 +5,25 @@ final case class Relationship(relationship: RelationshipOverview)
final case class RelationshipOverview(source: RelationshipSource, target: RelationshipTarget)
final case class RelationshipSource(id: Long,
- id_str: String,
- screen_name: String,
- following: Boolean = false,
- followed_by: Boolean = false,
- following_received: Boolean = false,
- following_requested: Boolean = false,
- notifications_enabled: Boolean = false,
- can_dm: Boolean = false,
- blocking: Boolean = false,
- blocked_by: Boolean = false,
- muting: Boolean = false,
- want_retweets: Boolean = false,
- all_replies: Boolean = false,
- marked_spam: Boolean =false)
+ id_str: String,
+ screen_name: String,
+ following: Boolean = false,
+ followed_by: Boolean = false,
+ following_received: Boolean = false,
+ following_requested: Boolean = false,
+ notifications_enabled: Boolean = false,
+ can_dm: Boolean = false,
+ blocking: Boolean = false,
+ blocked_by: Boolean = false,
+ muting: Boolean = false,
+ want_retweets: Boolean = false,
+ all_replies: Boolean = false,
+ marked_spam: Boolean = false)
final case class RelationshipTarget(id: Long,
- id_str: String,
- screen_name: String,
- following: Boolean = false,
- followed_by: Boolean = false,
- following_received: Boolean = false,
- following_requested: Boolean = false)
-
+ id_str: String,
+ screen_name: String,
+ following: Boolean = false,
+ followed_by: Boolean = false,
+ following_received: Boolean = false,
+ following_requested: Boolean = false)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/SavedSearch.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/SavedSearch.scala
index 1d06c301..704bb8b4 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/SavedSearch.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/SavedSearch.scala
@@ -2,8 +2,4 @@ package com.danielasfregola.twitter4s.entities
import java.util.Date
-final case class SavedSearch(created_at: Date,
- id: Long,
- id_str: String,
- name: String,
- query: String)
+final case class SavedSearch(created_at: Date, id: Long, id_str: String, name: String, query: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Settings.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Settings.scala
index 03437e91..461ec758 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Settings.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Settings.scala
@@ -1,24 +1,22 @@
package com.danielasfregola.twitter4s.entities
final case class Settings(allow_contributor_request: String,
- allow_dm_groups_from: String,
- allow_dms_from: String,
- always_use_https: Boolean = false,
- discoverable_by_email: Boolean = false,
- discoverable_by_mobile_phone: Boolean = false,
- geo_enabled: Boolean = false,
- language: String,
- `protected`: Boolean = false,
- screen_name: String,
- sleep_time: SleepTime,
- show_all_inline_media: Boolean = false,
- use_cookie_personalization: Boolean = false,
- time_zone: Option[TimeZoneRecord] = None,
- trend_location: Seq[Location] = Seq.empty)
+ allow_dm_groups_from: String,
+ allow_dms_from: String,
+ always_use_https: Boolean = false,
+ discoverable_by_email: Boolean = false,
+ discoverable_by_mobile_phone: Boolean = false,
+ geo_enabled: Boolean = false,
+ language: String,
+ `protected`: Boolean = false,
+ screen_name: String,
+ sleep_time: SleepTime,
+ show_all_inline_media: Boolean = false,
+ use_cookie_personalization: Boolean = false,
+ time_zone: Option[TimeZoneRecord] = None,
+ trend_location: Seq[Location] = Seq.empty)
-final case class SleepTime(enabled: Boolean = false,
- end_time: Option[String] = None,
- start_time: Option[String] = None)
+final case class SleepTime(enabled: Boolean = false, end_time: Option[String] = None, start_time: Option[String] = None)
final case class TimeZoneRecord(name: String, tzinfo_name: String, utc_offset: Int)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/SettingsOptions.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/SettingsOptions.scala
index 2a938980..4ec850c8 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/SettingsOptions.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/SettingsOptions.scala
@@ -6,13 +6,12 @@ import com.danielasfregola.twitter4s.entities.enums.Language.Language
import com.danielasfregola.twitter4s.entities.enums.TimeZone.TimeZone
/**
- * woeid: "Where on Earth Identifiers, by Yahoo!! see http://woeid.rosselliot.co.nz/"
- * */
+ * woeid: "Where on Earth Identifiers, by Yahoo!! see http://woeid.rosselliot.co.nz/"
+ * */
final case class SettingsOptions(allow_contributor_request: Option[ContributorType] = None,
- sleep_time_enabled: Option[Boolean] = None,
- start_sleep_time: Option[Hour] = None,
- end_sleep_time: Option[Hour] = None,
- lang: Option[Language] = None,
- time_zone: Option[TimeZone] = None,
- trend_location_woeid: Option[Long] = None)
-
+ sleep_time_enabled: Option[Boolean] = None,
+ start_sleep_time: Option[Hour] = None,
+ end_sleep_time: Option[Hour] = None,
+ lang: Option[Language] = None,
+ time_zone: Option[TimeZone] = None,
+ trend_location_woeid: Option[Long] = None)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/StatusMediaDetails.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/StatusMediaDetails.scala
index 5ce19a01..80b103f6 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/StatusMediaDetails.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/StatusMediaDetails.scala
@@ -1,5 +1,3 @@
package com.danielasfregola.twitter4s.entities
-final case class StatusMediaDetails(media_id: Long,
- media_id_string: String,
- expires_after_secs: Int)
+final case class StatusMediaDetails(media_id: Long, media_id_string: String, expires_after_secs: Int)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Suggestions.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Suggestions.scala
index c2727c34..7ffe8e59 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Suggestions.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Suggestions.scala
@@ -1,6 +1,3 @@
package com.danielasfregola.twitter4s.entities
-final case class Suggestions(name: String,
- slug: String,
- size: Int,
- users: Seq[User] = Seq.empty)
+final case class Suggestions(name: String, slug: String, size: Int, users: Seq[User] = Seq.empty)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Tweet.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Tweet.scala
index 5ddcb80c..b22c0900 100755
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Tweet.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Tweet.scala
@@ -40,7 +40,5 @@ final case class Tweet(contributors: Seq[Contributor] = Seq.empty,
withheld_copyright: Boolean = false,
withheld_in_countries: Seq[String] = Seq.empty,
withheld_scope: Option[String] = None,
- metadata: Option[StatusMetadata] = None) extends CommonStreamingMessage
-
-
-
+ metadata: Option[StatusMetadata] = None)
+ extends CommonStreamingMessage
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/TweetSearch.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/TweetSearch.scala
index 4ba77657..8e2d0579 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/TweetSearch.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/TweetSearch.scala
@@ -3,13 +3,13 @@ package com.danielasfregola.twitter4s.entities
final case class StatusSearch(statuses: List[Tweet], search_metadata: SearchMetadata)
final case class SearchMetadata(completed_in: Double,
- max_id: Long,
- max_id_str: String,
- next_results: Option[String],
- query: String,
- refresh_url: String,
- count: Int,
- since_id: Long,
- since_id_str: String)
+ max_id: Long,
+ max_id_str: String,
+ next_results: Option[String],
+ query: String,
+ refresh_url: String,
+ count: Int,
+ since_id: Long,
+ since_id_str: String)
final case class StatusMetadata(iso_language_code: String, result_type: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/TweetUpdate.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/TweetUpdate.scala
index 408fb2b4..27113569 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/TweetUpdate.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/TweetUpdate.scala
@@ -1,11 +1,11 @@
package com.danielasfregola.twitter4s.entities
final case class TweetUpdate(status: String,
- in_reply_to_status_id: Option[Long] = None,
- possibly_sensitive: Boolean = false,
- lat: Option[Long] = None,
- long: Option[Long] = None,
- place_id: Option[String] = None,
- display_coordinates: Boolean = false,
- trim_user: Boolean = false,
- media_ids: Seq[Long] = Seq.empty)
+ in_reply_to_status_id: Option[Long] = None,
+ possibly_sensitive: Boolean = false,
+ lat: Option[Long] = None,
+ long: Option[Long] = None,
+ place_id: Option[String] = None,
+ display_coordinates: Boolean = false,
+ trim_user: Boolean = false,
+ media_ids: Seq[Long] = Seq.empty)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterList.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterList.scala
index 30adee27..ab7f12f6 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterList.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterList.scala
@@ -3,16 +3,15 @@ package com.danielasfregola.twitter4s.entities
import java.util.Date
final case class TwitterList(created_at: Date,
- description: String,
- following: Boolean,
- full_name: String,
- id: Long,
- id_str: String,
- name: String,
- subscriber_count: Int,
- uri: String,
- member_count: Int,
- mode: String,
- slug: String,
- user: User)
-
+ description: String,
+ following: Boolean,
+ full_name: String,
+ id: Long,
+ id_str: String,
+ name: String,
+ subscriber_count: Int,
+ uri: String,
+ member_count: Int,
+ mode: String,
+ slug: String,
+ user: User)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterListUpdate.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterListUpdate.scala
index f2b2c805..d0225d02 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterListUpdate.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/TwitterListUpdate.scala
@@ -3,5 +3,5 @@ package com.danielasfregola.twitter4s.entities
import com.danielasfregola.twitter4s.entities.enums.Mode.Mode
final case class TwitterListUpdate(description: Option[String] = None,
- mode: Option[Mode] = None,
- name: Option[String] = None)
+ mode: Option[Mode] = None,
+ name: Option[String] = None)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/UploadedMedia.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/UploadedMedia.scala
index f797c54a..ff1679e0 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/UploadedMedia.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/UploadedMedia.scala
@@ -1,7 +1,7 @@
package com.danielasfregola.twitter4s.entities
final case class UploadedMedia(media_id: Long,
- media_id_str: String,
- size: Int,
- image: Option[Image] = None,
- video: Option[Video] = None)
+ media_id_str: String,
+ size: Int,
+ image: Option[Image] = None,
+ video: Option[Video] = None)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/Url.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/Url.scala
index 03e6a519..69414542 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/Url.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/Url.scala
@@ -1,6 +1,3 @@
package com.danielasfregola.twitter4s.entities
-final case class Url(indices: Seq[Int] = Seq.empty,
- url: String,
- display_url: String,
- expanded_url: String)
+final case class Url(indices: Seq[Int] = Seq.empty, url: String, display_url: String, expanded_url: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/User.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/User.scala
index 3f3e094a..aa1615c4 100755
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/User.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/User.scala
@@ -3,53 +3,53 @@ package com.danielasfregola.twitter4s.entities
import java.util.Date
final case class User(blocked_by: Boolean = false,
- blocking: Boolean = false,
- contributors_enabled: Boolean = false,
- created_at: Date,
- default_profile: Boolean = false,
- default_profile_image: Boolean = false,
- description: Option[String] = None,
- email: Option[String] = None,
- entities: Option[Entities] = None,
- favourites_count: Int,
- follow_request_sent: Boolean = false,
- following: Boolean = false,
- followers_count: Int,
- friends_count: Int,
- geo_enabled: Boolean = false,
- has_extended_profile: Boolean = false,
- id: Long,
- id_str: String,
- is_translation_enabled: Boolean = false,
- is_translator: Boolean = false,
- lang: String,
- listed_count: Int,
- location: Option[String] = None,
- muting: Boolean = false,
- name: String,
- notifications: Boolean = false,
- profile_background_color: String,
- profile_background_image_url: String,
- profile_background_image_url_https: String,
- profile_background_tile: Boolean = false,
- profile_banner_url: Option[String] = None,
- profile_image_url: ProfileImage,
- profile_image_url_https: ProfileImage,
- profile_link_color: String,
- profile_location: Option[String],
- profile_sidebar_border_color: String,
- profile_sidebar_fill_color: String,
- profile_text_color: String,
- profile_use_background_image: Boolean = false,
- `protected`: Boolean = false,
- screen_name: String,
- show_all_inline_media: Boolean = false,
- status: Option[Tweet] = None,
- statuses_count: Int,
- time_zone: Option[String] = None,
- translator_type: Option[String] = None,
- url: Option[String] = None,
- utc_offset: Option[Int] = None,
- verified: Boolean = false,
- withheld_in_countries: Option[String] = None,
- withheld_scope: Option[String] = None)
+ blocking: Boolean = false,
+ contributors_enabled: Boolean = false,
+ created_at: Date,
+ default_profile: Boolean = false,
+ default_profile_image: Boolean = false,
+ description: Option[String] = None,
+ email: Option[String] = None,
+ entities: Option[Entities] = None,
+ favourites_count: Int,
+ follow_request_sent: Boolean = false,
+ following: Boolean = false,
+ followers_count: Int,
+ friends_count: Int,
+ geo_enabled: Boolean = false,
+ has_extended_profile: Boolean = false,
+ id: Long,
+ id_str: String,
+ is_translation_enabled: Boolean = false,
+ is_translator: Boolean = false,
+ lang: String,
+ listed_count: Int,
+ location: Option[String] = None,
+ muting: Boolean = false,
+ name: String,
+ notifications: Boolean = false,
+ profile_background_color: String,
+ profile_background_image_url: String,
+ profile_background_image_url_https: String,
+ profile_background_tile: Boolean = false,
+ profile_banner_url: Option[String] = None,
+ profile_image_url: ProfileImage,
+ profile_image_url_https: ProfileImage,
+ profile_link_color: String,
+ profile_location: Option[String],
+ profile_sidebar_border_color: String,
+ profile_sidebar_fill_color: String,
+ profile_text_color: String,
+ profile_use_background_image: Boolean = false,
+ `protected`: Boolean = false,
+ screen_name: String,
+ show_all_inline_media: Boolean = false,
+ status: Option[Tweet] = None,
+ statuses_count: Int,
+ time_zone: Option[String] = None,
+ translator_type: Option[String] = None,
+ url: Option[String] = None,
+ utc_offset: Option[Int] = None,
+ verified: Boolean = false,
+ withheld_in_countries: Option[String] = None,
+ withheld_scope: Option[String] = None)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/UserMention.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/UserMention.scala
index dff4a0c0..ed27f525 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/UserMention.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/UserMention.scala
@@ -1,7 +1,3 @@
package com.danielasfregola.twitter4s.entities
-final case class UserMention(id: Long,
- id_str: String,
- indices: Seq[Int] = Seq.empty,
- name: String,
- screen_name: String)
+final case class UserMention(id: Long, id_str: String, indices: Seq[Int] = Seq.empty, name: String, screen_name: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthAccessToken.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthAccessToken.scala
index 9dcf68d7..eef3c838 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthAccessToken.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthAccessToken.scala
@@ -9,11 +9,12 @@ object OAuthAccessToken {
implicit val oAuthAccessTokenFromMap = new FromMap[OAuthAccessToken] {
- def apply(m: Map[String, String]): Option[OAuthAccessToken] = for {
- key <- m.get("oauth_token")
- secret <- m.get("oauth_token_secret")
- userId <- m.get("user_id")
- screenName <- m.get("screen_name")
- } yield OAuthAccessToken(AccessToken(key, secret), userId.toLong, screenName)
+ def apply(m: Map[String, String]): Option[OAuthAccessToken] =
+ for {
+ key <- m.get("oauth_token")
+ secret <- m.get("oauth_token_secret")
+ userId <- m.get("user_id")
+ screenName <- m.get("screen_name")
+ } yield OAuthAccessToken(AccessToken(key, secret), userId.toLong, screenName)
}
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthRequestToken.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthRequestToken.scala
index 99492b9e..9df274a7 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthRequestToken.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/authentication/OAuthRequestToken.scala
@@ -10,10 +10,11 @@ object OAuthRequestToken {
implicit val oAuthRequestTokenFromMap = new FromMap[OAuthRequestToken] {
- def apply(m: Map[String, String]): Option[OAuthRequestToken] = for {
- key <- m.get("oauth_token")
- secret <- m.get("oauth_token_secret")
- callbackConfirmed <- m.get("oauth_callback_confirmed")
- } yield OAuthRequestToken(RequestToken(key, secret), toBoolean(callbackConfirmed))
+ def apply(m: Map[String, String]): Option[OAuthRequestToken] =
+ for {
+ key <- m.get("oauth_token")
+ secret <- m.get("oauth_token_secret")
+ callbackConfirmed <- m.get("oauth_callback_confirmed")
+ } yield OAuthRequestToken(RequestToken(key, secret), toBoolean(callbackConfirmed))
}
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/ContributorType.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/ContributorType.scala
index b5e220d2..bc7e420b 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/ContributorType.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/ContributorType.scala
@@ -1,9 +1,9 @@
package com.danielasfregola.twitter4s.entities.enums
object ContributorType extends Enumeration {
- type ContributorType = Value
+ type ContributorType = Value
- val All = Value("all")
- val Following = Value("following")
- val `None` = Value("none")
- }
+ val All = Value("all")
+ val Following = Value("following")
+ val `None` = Value("none")
+}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/EventCode.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/EventCode.scala
index 3a24b2f2..5054da65 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/EventCode.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/EventCode.scala
@@ -3,7 +3,7 @@ package com.danielasfregola.twitter4s.entities.enums
abstract class EventCode extends Enumeration
object SimpleEventCode extends EventCode {
- type SimpleEventCode = Value
+ type SimpleEventCode = Value
val AccessRevoked = Value("access_revoked")
val Block = Value("block")
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/Hour.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/Hour.scala
index de4b806e..4e66326a 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/Hour.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/Hour.scala
@@ -1,8 +1,8 @@
package com.danielasfregola.twitter4s.entities.enums
-object Hour extends Enumeration {
+object Hour extends Enumeration {
type Hour = Value
-
+
val MIDNIGHT = Value("00")
val ONE_AM = Value("01")
val TWO_AM = Value("02")
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/MediaType.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/MediaType.scala
index d9a86825..3ccfc8a1 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/MediaType.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/MediaType.scala
@@ -8,7 +8,6 @@ object MediaType extends Enumeration {
val GIF = Value("image/gif")
val WEBP = Value("image/webp")
-
val MP4 = Value("video/mp4")
val MOV = Value("video/quicktime")
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/TimeZone.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/TimeZone.scala
index bf1d35ef..718b755c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/enums/TimeZone.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/enums/TimeZone.scala
@@ -3,143 +3,142 @@ package com.danielasfregola.twitter4s.entities.enums
object TimeZone extends Enumeration {
type TimeZone = Value
- val Africa_Algiers = Value("Africa/Algiers")
- val Africa_Cairo = Value("Africa/Cairo")
- val Africa_Casablanca = Value("Africa/Casablanca")
- val Africa_Harare = Value("Africa/Harare")
- val Africa_Johannesburg = Value("Africa/Johannesburg")
- val Africa_Monrovia = Value("Africa/Monrovia")
- val Africa_Nairobi = Value("Africa/Nairobi")
+ val Africa_Algiers = Value("Africa/Algiers")
+ val Africa_Cairo = Value("Africa/Cairo")
+ val Africa_Casablanca = Value("Africa/Casablanca")
+ val Africa_Harare = Value("Africa/Harare")
+ val Africa_Johannesburg = Value("Africa/Johannesburg")
+ val Africa_Monrovia = Value("Africa/Monrovia")
+ val Africa_Nairobi = Value("Africa/Nairobi")
- val America_Argentina_Buenos_Aires = Value("America/Argentina_Buenos_Aires")
- val America_Bogota = Value("America/Bogota")
- val America_Caracas = Value("America/Caracas")
- val America_Chicago = Value("America/Chicago")
- val America_Chihuahua = Value("America/Chihuahua")
- val America_Denver = Value("America/Denver")
- val America_Godthab = Value("America/Godthab")
- val America_Guatemala = Value("America/Guatemala")
- val America_Guyana = Value("America/Guyana")
- val America_Halifax = Value("America/Halifax")
- val America_Indiana_Indianapolis = Value("America/Indiana_Indianapolis")
- val America_Juneau = Value("America/Juneau")
- val America_La_Paz = Value("America/La_Paz")
- val America_Lima = Value("America/Lima")
- val America_Los_Angeles = Value("America/Los_Angeles")
- val America_Mazatlan = Value("America/Mazatlan")
- val America_Mexico_City = Value("America/Mexico_City")
- val America_Monterrey = Value("America/Monterrey")
- val America_Montevideo = Value("America/Montevideo")
- val America_New_York = Value("America/New_York")
- val America_Phoenix = Value("America/Phoenix")
- val America_Regina = Value("America/Regina")
- val America_Santiago = Value("America/Santiago")
- val America_Sao_Paulo = Value("America/Sao_Paulo")
- val America_St_Johns = Value("America/St_Johns")
- val America_Tijuana = Value("America/Tijuana")
+ val America_Argentina_Buenos_Aires = Value("America/Argentina_Buenos_Aires")
+ val America_Bogota = Value("America/Bogota")
+ val America_Caracas = Value("America/Caracas")
+ val America_Chicago = Value("America/Chicago")
+ val America_Chihuahua = Value("America/Chihuahua")
+ val America_Denver = Value("America/Denver")
+ val America_Godthab = Value("America/Godthab")
+ val America_Guatemala = Value("America/Guatemala")
+ val America_Guyana = Value("America/Guyana")
+ val America_Halifax = Value("America/Halifax")
+ val America_Indiana_Indianapolis = Value("America/Indiana_Indianapolis")
+ val America_Juneau = Value("America/Juneau")
+ val America_La_Paz = Value("America/La_Paz")
+ val America_Lima = Value("America/Lima")
+ val America_Los_Angeles = Value("America/Los_Angeles")
+ val America_Mazatlan = Value("America/Mazatlan")
+ val America_Mexico_City = Value("America/Mexico_City")
+ val America_Monterrey = Value("America/Monterrey")
+ val America_Montevideo = Value("America/Montevideo")
+ val America_New_York = Value("America/New_York")
+ val America_Phoenix = Value("America/Phoenix")
+ val America_Regina = Value("America/Regina")
+ val America_Santiago = Value("America/Santiago")
+ val America_Sao_Paulo = Value("America/Sao_Paulo")
+ val America_St_Johns = Value("America/St_Johns")
+ val America_Tijuana = Value("America/Tijuana")
- val Asia_Almaty = Value("Asia/Almaty")
- val Asia_Baghdad = Value("Asia/Baghdad")
- val Asia_Baku = Value("Asia/Baku")
- val Asia_Bangkok = Value("Asia/Bangkok")
- val Asia_Chongqing = Value("Asia/Chongqing")
- val Asia_Colombo = Value("Asia/Colombo")
- val Asia_Dhaka = Value("Asia/Dhaka")
- val Asia_Hong_Kong = Value("Asia/Hong_Kong")
- val Asia_Irkutsk = Value("Asia/Irkutsk")
- val Asia_Jakarta = Value("Asia/Jakarta")
- val Asia_Jerusalem = Value("Asia/Jerusalem")
- val Asia_Kabul = Value("Asia/Kabul")
- val Asia_Kamchatka = Value("Asia/Kamchatka")
- val Asia_Karachi = Value("Asia/Karachi")
- val Asia_Kathmandu = Value("Asia/Kathmandu")
- val Asia_Kolkata = Value("Asia/Kolkata")
- val Asia_Krasnoyarsk = Value("Asia/Krasnoyarsk")
- val Asia_Kuala_Lumpur = Value("Asia/Kuala_Lumpur")
- val Asia_Kuwait = Value("Asia/Kuwait")
- val Asia_Magadan = Value("Asia/Magadan")
- val Asia_Muscat = Value("Asia/Muscat")
- val Asia_Novosibirsk = Value("Asia/Novosibirsk")
- val Asia_Rangoon = Value("Asia/Rangoon")
- val Asia_Riyadh = Value("Asia/Riyadh")
- val Asia_Seoul = Value("Asia/Seoul")
- val Asia_Shanghai = Value("Asia/Shanghai")
- val Asia_Singapore = Value("Asia/Singapore")
- val Asia_Srednekolymsk = Value("Asia/Srednekolymsk")
- val Asia_Taipei = Value("Asia/Taipei")
- val Asia_Tashkent = Value("Asia/Tashkent")
- val Asia_Tbilisi = Value("Asia/Tbilisi")
- val Asia_Tehran = Value("Asia/Tehran")
- val Asia_Tokyo = Value("Asia/Tokyo")
- val Asia_Ulaanbaatar = Value("Asia/Ulaanbaatar")
- val Asia_Urumqi = Value("Asia/Urumqi")
- val Asia_Vladivostok = Value("Asia/Vladivostok")
- val Asia_Yakutsk = Value("Asia/Yakutsk")
- val Asia_Yekaterinburg = Value("Asia/Yekaterinburg")
- val Asia_Yerevan = Value("Asia/Yerevan")
+ val Asia_Almaty = Value("Asia/Almaty")
+ val Asia_Baghdad = Value("Asia/Baghdad")
+ val Asia_Baku = Value("Asia/Baku")
+ val Asia_Bangkok = Value("Asia/Bangkok")
+ val Asia_Chongqing = Value("Asia/Chongqing")
+ val Asia_Colombo = Value("Asia/Colombo")
+ val Asia_Dhaka = Value("Asia/Dhaka")
+ val Asia_Hong_Kong = Value("Asia/Hong_Kong")
+ val Asia_Irkutsk = Value("Asia/Irkutsk")
+ val Asia_Jakarta = Value("Asia/Jakarta")
+ val Asia_Jerusalem = Value("Asia/Jerusalem")
+ val Asia_Kabul = Value("Asia/Kabul")
+ val Asia_Kamchatka = Value("Asia/Kamchatka")
+ val Asia_Karachi = Value("Asia/Karachi")
+ val Asia_Kathmandu = Value("Asia/Kathmandu")
+ val Asia_Kolkata = Value("Asia/Kolkata")
+ val Asia_Krasnoyarsk = Value("Asia/Krasnoyarsk")
+ val Asia_Kuala_Lumpur = Value("Asia/Kuala_Lumpur")
+ val Asia_Kuwait = Value("Asia/Kuwait")
+ val Asia_Magadan = Value("Asia/Magadan")
+ val Asia_Muscat = Value("Asia/Muscat")
+ val Asia_Novosibirsk = Value("Asia/Novosibirsk")
+ val Asia_Rangoon = Value("Asia/Rangoon")
+ val Asia_Riyadh = Value("Asia/Riyadh")
+ val Asia_Seoul = Value("Asia/Seoul")
+ val Asia_Shanghai = Value("Asia/Shanghai")
+ val Asia_Singapore = Value("Asia/Singapore")
+ val Asia_Srednekolymsk = Value("Asia/Srednekolymsk")
+ val Asia_Taipei = Value("Asia/Taipei")
+ val Asia_Tashkent = Value("Asia/Tashkent")
+ val Asia_Tbilisi = Value("Asia/Tbilisi")
+ val Asia_Tehran = Value("Asia/Tehran")
+ val Asia_Tokyo = Value("Asia/Tokyo")
+ val Asia_Ulaanbaatar = Value("Asia/Ulaanbaatar")
+ val Asia_Urumqi = Value("Asia/Urumqi")
+ val Asia_Vladivostok = Value("Asia/Vladivostok")
+ val Asia_Yakutsk = Value("Asia/Yakutsk")
+ val Asia_Yekaterinburg = Value("Asia/Yekaterinburg")
+ val Asia_Yerevan = Value("Asia/Yerevan")
- val Atlantic_Azores = Value("Atlantic/Azores")
- val Atlantic_Cape_Verde = Value("Atlantic/Cape_Verde")
- val Atlantic_South_Georgia = Value("Atlantic/South_Georgia")
- val Australia_Adelaide = Value("Australia_Adelaide")
- val Australia_Brisbane = Value("Australia_Brisbane")
- val Australia_Darwin = Value("Australia_Darwin")
- val Australia_Hobart = Value("Australia_Hobart")
- val Australia_Melbourne = Value("Australia_Melbourne")
- val Australia_Perth = Value("Australia_Perth")
- val Australia_Sydney = Value("Australia_Sydney")
+ val Atlantic_Azores = Value("Atlantic/Azores")
+ val Atlantic_Cape_Verde = Value("Atlantic/Cape_Verde")
+ val Atlantic_South_Georgia = Value("Atlantic/South_Georgia")
+ val Australia_Adelaide = Value("Australia_Adelaide")
+ val Australia_Brisbane = Value("Australia_Brisbane")
+ val Australia_Darwin = Value("Australia_Darwin")
+ val Australia_Hobart = Value("Australia_Hobart")
+ val Australia_Melbourne = Value("Australia_Melbourne")
+ val Australia_Perth = Value("Australia_Perth")
+ val Australia_Sydney = Value("Australia_Sydney")
- val Etc_UTC = Value("Etc_UTC")
+ val Etc_UTC = Value("Etc_UTC")
- val Europe_Amsterdam = Value("Europe/Amsterdam")
- val Europe_Athens = Value("Europe/Athens")
- val Europe_Belgrade = Value("Europe/Belgrade")
- val Europe_Berlin = Value("Europe/Berlin")
- val Europe_Bratislava = Value("Europe/Bratislava")
- val Europe_Brussels = Value("Europe/Brussels")
- val Europe_Bucharest = Value("Europe/Bucharest")
- val Europe_Budapest = Value("Europe/Budapest")
- val Europe_Copenhagen = Value("Europe/Copenhagen")
- val Europe_Dublin = Value("Europe/Dublin")
- val Europe_Helsinki = Value("Europe/Helsinki")
- val Europe_Istanbul = Value("Europe/Istanbul")
- val Europe_Kaliningrad = Value("Europe/Kaliningrad")
- val Europe_Kiev = Value("Europe/Kiev")
- val Europe_Lisbon = Value("Europe/Lisbon")
- val Europe_Ljubljana = Value("Europe/Ljubljana")
- val Europe_London = Value("Europe/London")
- val Europe_Madrid = Value("Europe/Madrid")
- val Europe_Minsk = Value("Europe/Minsk")
- val Europe_Moscow = Value("Europe/Moscow")
- val Europe_Paris = Value("Europe/Paris")
- val Europe_Prague = Value("Europe/Prague")
- val Europe_Riga = Value("Europe/Riga")
- val Europe_Rome = Value("Europe/Rome")
- val Europe_Samara = Value("Europe/Samara")
- val Europe_Sarajevo = Value("Europe/Sarajevo")
- val Europe_Skopje = Value("Europe/Skopje")
- val Europe_Sofia = Value("Europe/Sofia")
- val Europe_Stockholm = Value("Europe/Stockholm")
- val Europe_Tallinn = Value("Europe/Tallinn")
- val Europe_Vienna = Value("Europe/Vienna")
- val Europe_Vilnius = Value("Europe/Vilnius")
- val Europe_Volgograd = Value("Europe/Volgograd")
- val Europe_Warsaw = Value("Europe/Warsaw")
- val Europe_Zagreb = Value("Europe/Zagreb")
+ val Europe_Amsterdam = Value("Europe/Amsterdam")
+ val Europe_Athens = Value("Europe/Athens")
+ val Europe_Belgrade = Value("Europe/Belgrade")
+ val Europe_Berlin = Value("Europe/Berlin")
+ val Europe_Bratislava = Value("Europe/Bratislava")
+ val Europe_Brussels = Value("Europe/Brussels")
+ val Europe_Bucharest = Value("Europe/Bucharest")
+ val Europe_Budapest = Value("Europe/Budapest")
+ val Europe_Copenhagen = Value("Europe/Copenhagen")
+ val Europe_Dublin = Value("Europe/Dublin")
+ val Europe_Helsinki = Value("Europe/Helsinki")
+ val Europe_Istanbul = Value("Europe/Istanbul")
+ val Europe_Kaliningrad = Value("Europe/Kaliningrad")
+ val Europe_Kiev = Value("Europe/Kiev")
+ val Europe_Lisbon = Value("Europe/Lisbon")
+ val Europe_Ljubljana = Value("Europe/Ljubljana")
+ val Europe_London = Value("Europe/London")
+ val Europe_Madrid = Value("Europe/Madrid")
+ val Europe_Minsk = Value("Europe/Minsk")
+ val Europe_Moscow = Value("Europe/Moscow")
+ val Europe_Paris = Value("Europe/Paris")
+ val Europe_Prague = Value("Europe/Prague")
+ val Europe_Riga = Value("Europe/Riga")
+ val Europe_Rome = Value("Europe/Rome")
+ val Europe_Samara = Value("Europe/Samara")
+ val Europe_Sarajevo = Value("Europe/Sarajevo")
+ val Europe_Skopje = Value("Europe/Skopje")
+ val Europe_Sofia = Value("Europe/Sofia")
+ val Europe_Stockholm = Value("Europe/Stockholm")
+ val Europe_Tallinn = Value("Europe/Tallinn")
+ val Europe_Vienna = Value("Europe/Vienna")
+ val Europe_Vilnius = Value("Europe/Vilnius")
+ val Europe_Volgograd = Value("Europe/Volgograd")
+ val Europe_Warsaw = Value("Europe/Warsaw")
+ val Europe_Zagreb = Value("Europe/Zagreb")
- val Pacific_Apia = Value("Pacific/Apia")
- val Pacific_Auckland = Value("Pacific/Auckland")
- val Pacific_Chatham = Value("Pacific/Chatham")
- val Pacific_Fakaofo = Value("Pacific/Fakaofo")
- val Pacific_Fiji = Value("Pacific/Fiji")
- val Pacific_Guadalcanal = Value("Pacific/Guadalcanal")
- val Pacific_Guam = Value("Pacific/Guam")
+ val Pacific_Apia = Value("Pacific/Apia")
+ val Pacific_Auckland = Value("Pacific/Auckland")
+ val Pacific_Chatham = Value("Pacific/Chatham")
+ val Pacific_Fakaofo = Value("Pacific/Fakaofo")
+ val Pacific_Fiji = Value("Pacific/Fiji")
+ val Pacific_Guadalcanal = Value("Pacific/Guadalcanal")
+ val Pacific_Guam = Value("Pacific/Guam")
val Pacific_Honolulu = Value("Pacific/Honolulu")
- val Pacific_Majuro = Value("Pacific/Majuro")
+ val Pacific_Majuro = Value("Pacific/Majuro")
val Pacific_Midway = Value("Pacific/Midway")
- val Pacific_Noumea = Value("Pacific/Noumea")
+ val Pacific_Noumea = Value("Pacific/Noumea")
val Pacific_Pago_Pago = Value("Pacific/Pago_Pago")
- val Pacific_Port_Moresby = Value("Pacific/Port_Moresby")
- val Pacific_Tongatapu = Value("Pacific/Tongatapu")
- }
-
+ val Pacific_Port_Moresby = Value("Pacific/Port_Moresby")
+ val Pacific_Tongatapu = Value("Pacific/Tongatapu")
+}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/DisconnectMessage.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/DisconnectMessage.scala
index ff29968c..2f3f57cc 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/DisconnectMessage.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/DisconnectMessage.scala
@@ -13,6 +13,4 @@ import com.danielasfregola.twitter4s.entities.streaming.CommonStreamingMessage
*/
final case class DisconnectMessage(disconnect: DisconnectMessageInfo) extends CommonStreamingMessage
-final case class DisconnectMessageInfo(code: DisconnectionCode,
- stream_name: String,
- reason: String)
+final case class DisconnectMessageInfo(code: DisconnectionCode, stream_name: String, reason: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LimitNotice.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LimitNotice.scala
index f066e81c..72e309d3 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LimitNotice.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LimitNotice.scala
@@ -14,5 +14,3 @@ import com.danielasfregola.twitter4s.entities.streaming.CommonStreamingMessage
final case class LimitNotice(limit: LimitTrack) extends CommonStreamingMessage
final case class LimitTrack(track: Long)
-
-
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LocationDeletionNotice.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LocationDeletionNotice.scala
index 51739367..f5e43f8f 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LocationDeletionNotice.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/LocationDeletionNotice.scala
@@ -13,6 +13,6 @@ import com.danielasfregola.twitter4s.entities.streaming.CommonStreamingMessage
final case class LocationDeletionNotice(scrub_geo: LocationDeletionId) extends CommonStreamingMessage
final case class LocationDeletionId(user_id: Long,
- user_id_str: String,
- up_to_status_id: Long,
- up_to_status_id_str: String)
+ user_id_str: String,
+ up_to_status_id: Long,
+ up_to_status_id_str: String)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/StatusWithheldNotice.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/StatusWithheldNotice.scala
index 19da6d6d..592dd188 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/StatusWithheldNotice.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/StatusWithheldNotice.scala
@@ -10,7 +10,4 @@ import com.danielasfregola.twitter4s.entities.streaming.CommonStreamingMessage
*/
final case class StatusWithheldNotice(status_withheld: StatusWithheldId) extends CommonStreamingMessage
-final case class StatusWithheldId(id: Long,
- user_id: Long,
- withheld_in_countries: List[String])
-
+final case class StatusWithheldId(id: Long, user_id: Long, withheld_in_countries: List[String])
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/WarningMessage.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/WarningMessage.scala
index d8239941..1a0bcb9c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/WarningMessage.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/common/WarningMessage.scala
@@ -11,6 +11,6 @@ import com.danielasfregola.twitter4s.entities.streaming.CommonStreamingMessage
final case class WarningMessage(warning: WarningMessageInfo) extends CommonStreamingMessage
final case class WarningMessageInfo(code: String,
- message: String,
- percent_full: Option[Int] = None,
- user_id: Option[Long] = None)
+ message: String,
+ percent_full: Option[Int] = None,
+ user_id: Option[Long] = None)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/site/UserEnvelop.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/site/UserEnvelop.scala
index e1538f07..69c4bb18 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/site/UserEnvelop.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/site/UserEnvelop.scala
@@ -21,11 +21,13 @@ final case class UserEnvelopSimpleEvent(for_user: Long, message: SimpleEvent) ex
final case class UserEnvelopTweetEvent(for_user: Long, message: TweetEvent) extends UserEnvelop(for_user, message)
-final case class UserEnvelopTwitterListEvent(for_user: Long, message: TwitterListEvent) extends UserEnvelop(for_user, message)
+final case class UserEnvelopTwitterListEvent(for_user: Long, message: TwitterListEvent)
+ extends UserEnvelop(for_user, message)
final case class UserEnvelopFriendsLists(for_user: Long, message: FriendsLists) extends UserEnvelop(for_user, message)
-final case class UserEnvelopWarningMessage(for_user: Long, message: WarningMessage) extends UserEnvelop(for_user, message)
+final case class UserEnvelopWarningMessage(for_user: Long, message: WarningMessage)
+ extends UserEnvelop(for_user, message)
/** Site Streams are sent the same messages as User Streams (including friends lists in the preamble),
* but for multiple users instead of a single user.The same types of messages are streamed, but to identify the target of each message,
@@ -33,19 +35,26 @@ final case class UserEnvelopWarningMessage(for_user: Long, message: WarningMessa
* For more information see
* https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/streaming-message-types
*/
-abstract class UserEnvelopStringified[T <: StreamingMessage](for_user: String, message: StreamingMessage) extends SiteStreamingMessage
+abstract class UserEnvelopStringified[T <: StreamingMessage](for_user: String, message: StreamingMessage)
+ extends SiteStreamingMessage
-final case class UserEnvelopTweetStringified(for_user: String, message: Tweet) extends UserEnvelopStringified[Tweet](for_user, message)
+final case class UserEnvelopTweetStringified(for_user: String, message: Tweet)
+ extends UserEnvelopStringified[Tweet](for_user, message)
-final case class UserEnvelopDirectMessageStringified(for_user: String, message: DirectMessage) extends UserEnvelopStringified[DirectMessage](for_user, message)
+final case class UserEnvelopDirectMessageStringified(for_user: String, message: DirectMessage)
+ extends UserEnvelopStringified[DirectMessage](for_user, message)
-final case class UserEnvelopSimpleEventStringified(for_user: String, message: SimpleEvent) extends UserEnvelopStringified[SimpleEvent](for_user, message)
+final case class UserEnvelopSimpleEventStringified(for_user: String, message: SimpleEvent)
+ extends UserEnvelopStringified[SimpleEvent](for_user, message)
-final case class UserEnvelopTweetEventStringified(for_user: String, message: TweetEvent) extends UserEnvelopStringified[TweetEvent](for_user, message)
+final case class UserEnvelopTweetEventStringified(for_user: String, message: TweetEvent)
+ extends UserEnvelopStringified[TweetEvent](for_user, message)
-final case class UserEnvelopTwitterListEventStringified(for_user: String, message: TwitterListEvent) extends UserEnvelopStringified[TwitterListEvent](for_user, message)
+final case class UserEnvelopTwitterListEventStringified(for_user: String, message: TwitterListEvent)
+ extends UserEnvelopStringified[TwitterListEvent](for_user, message)
-final case class UserEnvelopFriendsListsStringified(for_user: String, message: FriendsLists) extends UserEnvelopStringified[FriendsLists](for_user, message)
-
-final case class UserEnvelopWarningMessageStringified(for_user: String, message: WarningMessage) extends UserEnvelopStringified[WarningMessage](for_user, message)
+final case class UserEnvelopFriendsListsStringified(for_user: String, message: FriendsLists)
+ extends UserEnvelopStringified[FriendsLists](for_user, message)
+final case class UserEnvelopWarningMessageStringified(for_user: String, message: WarningMessage)
+ extends UserEnvelopStringified[WarningMessage](for_user, message)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/Event.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/Event.scala
index 0013ce1b..f694f7db 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/Event.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/Event.scala
@@ -18,11 +18,19 @@ import com.danielasfregola.twitter4s.entities.{Tweet, TwitterList, User}
abstract class Event[T](created_at: Date, event: EventCode#Value, target: User, source: User, target_object: Option[T])
extends UserStreamingMessage
-final case class SimpleEvent(created_at: Date, event: SimpleEventCode, target: User, source: User, target_object: Option[String])
+final case class SimpleEvent(created_at: Date,
+ event: SimpleEventCode,
+ target: User,
+ source: User,
+ target_object: Option[String])
extends Event(created_at, event, target, source, target_object)
final case class TweetEvent(created_at: Date, event: TweetEventCode, target: User, source: User, target_object: Tweet)
extends Event(created_at, event, target, source, Some(target_object))
-final case class TwitterListEvent(created_at: Date, event: TwitterListEventCode, target: User, source: User, target_object: TwitterList)
+final case class TwitterListEvent(created_at: Date,
+ event: TwitterListEventCode,
+ target: User,
+ source: User,
+ target_object: TwitterList)
extends Event(created_at, event, target, source, Some(target_object))
diff --git a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/FriendsLists.scala b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/FriendsLists.scala
index cf8c4833..5e83ab16 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/FriendsLists.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/entities/streaming/user/FriendsLists.scala
@@ -15,5 +15,3 @@ final case class FriendsLists(friends: Seq[Long]) extends UserStreamingMessage
* https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/streaming-message-types
*/
final case class FriendsListsStringified(friends: Seq[String]) extends UserStreamingMessage
-
-
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/Client.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/Client.scala
index 0cfb72f9..22400af1 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/Client.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/Client.scala
@@ -15,18 +15,19 @@ trait Client extends OAuthClient {
def oauthProvider: OAuth2Provider
- protected def sendAndReceive[T](request: HttpRequest, f: HttpResponse => Future[T])
- (implicit system: ActorSystem, materializer: Materializer): Future[T] = {
+ protected def sendAndReceive[T](request: HttpRequest, f: HttpResponse => Future[T])(
+ implicit system: ActorSystem,
+ materializer: Materializer): Future[T] = {
implicit val _ = request
val requestStartTime = System.currentTimeMillis
if (withLogRequest) logRequest
Source
- .single(request)
- .via(connection)
- .mapAsync(1)(implicit response => unmarshal(requestStartTime, f))
- .runWith(Sink.head)
+ .single(request)
+ .via(connection)
+ .mapAsync(1)(implicit response => unmarshal(requestStartTime, f))
+ .runWith(Sink.head)
}
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/CommonClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/CommonClient.scala
index 2a1131ba..634ab2d0 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/CommonClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/CommonClient.scala
@@ -26,8 +26,9 @@ private[twitter4s] trait CommonClient extends JsonSupport with LazyLogging {
else Http().outgoingConnection(host, port)
}
- protected def unmarshal[T](requestStartTime: Long, f: HttpResponse => Future[T])
- (implicit request: HttpRequest, response: HttpResponse, materializer: Materializer) = {
+ protected def unmarshal[T](requestStartTime: Long, f: HttpResponse => Future[T])(implicit request: HttpRequest,
+ response: HttpResponse,
+ materializer: Materializer) = {
implicit val ec = materializer.executionContext
if (withLogRequestResponse) logRequestResponse(requestStartTime)
@@ -58,7 +59,8 @@ private[twitter4s] trait CommonClient extends JsonSupport with LazyLogging {
request
}
- def logRequestResponse(requestStartTime: Long)(implicit request: HttpRequest, materializer: Materializer): HttpResponse => HttpResponse = {
+ def logRequestResponse(requestStartTime: Long)(implicit request: HttpRequest,
+ materializer: Materializer): HttpResponse => HttpResponse = {
response =>
implicit val ec = materializer.executionContext
val elapsed = System.currentTimeMillis - requestStartTime
@@ -66,7 +68,9 @@ private[twitter4s] trait CommonClient extends JsonSupport with LazyLogging {
if (logger.underlying.isDebugEnabled) {
for {
responseBody <- toBody(response.entity)
- } yield logger.debug(s"${request.method.value} ${request.uri} (${response.status}) | ${response.headers.mkString(", ")} | $responseBody")
+ } yield
+ logger.debug(
+ s"${request.method.value} ${request.uri} (${response.status}) | ${response.headers.mkString(", ")} | $responseBody")
}
response
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/OAuthClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/OAuthClient.scala
index 8db88666..9549f17c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/OAuthClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/OAuthClient.scala
@@ -13,18 +13,20 @@ private[twitter4s] trait OAuthClient extends CommonClient with RequestBuilding {
def oauthProvider: OAuth2Provider
- def withOAuthHeader(callback: Option[String])(implicit materializer: Materializer): HttpRequest => Future[HttpRequest] = { request =>
+ def withOAuthHeader(callback: Option[String])(
+ implicit materializer: Materializer): HttpRequest => Future[HttpRequest] = { request =>
implicit val ec = materializer.executionContext
for {
authorizationHeader <- oauthProvider.oauth2Header(callback)(request, materializer)
- } yield request.withHeaders( request.headers :+ authorizationHeader )
+ } yield request.withHeaders(request.headers :+ authorizationHeader)
}
- def withSimpleOAuthHeader(callback: Option[String])(implicit materializer: Materializer): HttpRequest => Future[HttpRequest] = { request =>
+ def withSimpleOAuthHeader(callback: Option[String])(
+ implicit materializer: Materializer): HttpRequest => Future[HttpRequest] = { request =>
implicit val ec = materializer.executionContext
for {
authorizationHeader <- oauthProvider.oauth2Header(callback)(request.withEntity(HttpEntity.Empty), materializer)
- } yield request.withHeaders( request.headers :+ authorizationHeader )
+ } yield request.withHeaders(request.headers :+ authorizationHeader)
}
override val Get = new OAuthRequestBuilder(GET)
@@ -60,5 +62,3 @@ private[twitter4s] trait OAuthClient extends CommonClient with RequestBuilding {
}
}
-
-
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/AuthenticationClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/AuthenticationClient.scala
index b8af883c..cbbe43e5 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/AuthenticationClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/AuthenticationClient.scala
@@ -33,7 +33,9 @@ private[twitter4s] class AuthenticationClient(val consumerToken: ConsumerToken)
}
}
- def sendReceiveAs[T: Manifest](httpRequest: HttpRequest)(implicit system: ActorSystem, materializer: Materializer, fromMap: FromMap[T]): Future[T] = {
+ def sendReceiveAs[T: Manifest](httpRequest: HttpRequest)(implicit system: ActorSystem,
+ materializer: Materializer,
+ fromMap: FromMap[T]): Future[T] = {
sendAndReceive(httpRequest, response => FormSupport.unmarshallText(response))
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClient.scala
index 7bbb95b7..5f3759df 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClient.scala
@@ -4,7 +4,10 @@ package clients.authentication.oauth
import com.danielasfregola.twitter4s.entities.authentication.{OAuthAccessToken, OAuthRequestToken, RequestToken}
import com.danielasfregola.twitter4s.entities.enums.AccessType.AccessType
import com.danielasfregola.twitter4s.http.clients.authentication.AuthenticationClient
-import com.danielasfregola.twitter4s.http.clients.authentication.oauth.parameters.{AccessTokenParameters, RequestTokenParameters}
+import com.danielasfregola.twitter4s.http.clients.authentication.oauth.parameters.{
+ AccessTokenParameters,
+ RequestTokenParameters
+}
import com.danielasfregola.twitter4s.util.Configurations._
import scala.concurrent.Future
@@ -37,7 +40,8 @@ trait TwitterOAuthClient {
* read only access when appropriate.
* @return : The authentication request token.
* */
- def requestToken(oauth_callback: Option[String] = None, x_auth_access_type: Option[AccessType] = None): Future[OAuthRequestToken] = {
+ def requestToken(oauth_callback: Option[String] = None,
+ x_auth_access_type: Option[AccessType] = None): Future[OAuthRequestToken] = {
import authenticationClient._
val parameters = RequestTokenParameters(x_auth_access_type)
Post(s"$oauthUrl/request_token", parameters).respondAs[OAuthRequestToken](oauth_callback)
@@ -85,12 +89,13 @@ trait TwitterOAuthClient {
def authorizeUrl(token: RequestToken, force_login: Boolean = false, screen_name: Option[String] = None): String =
genericOAuthUrl("authorize")(token, force_login, screen_name)
- private def genericOAuthUrl(path: String)(token: RequestToken, force_login: Boolean, screen_name: Option[String]): String = {
+ private def genericOAuthUrl(
+ path: String)(token: RequestToken, force_login: Boolean, screen_name: Option[String]): String = {
val params = {
val queryParams = List(Some("oauth_token" -> token.key),
- Some("force_login" -> force_login),
- screen_name.map(n => "screen_name" -> n))
- queryParams.flatten.map { case (key, value) => s"$key=$value"}.mkString("&")
+ Some("force_login" -> force_login),
+ screen_name.map(n => "screen_name" -> n))
+ queryParams.flatten.map { case (key, value) => s"$key=$value" }.mkString("&")
}
s"$oauthUrl/$path?$params"
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/parameters/AccessTokenParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/parameters/AccessTokenParameters.scala
index bc2805aa..7aefc320 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/parameters/AccessTokenParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/parameters/AccessTokenParameters.scala
@@ -3,7 +3,8 @@ package com.danielasfregola.twitter4s.http.clients.authentication.oauth.paramete
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class AccessTokenParameters(x_auth_username: Option[String] = None,
- x_auth_password: Option[String] = None,
- x_auth_mode: Option[String] = None,
- oauth_verifier: Option[String] = None,
- oauth_token: Option[String] = None) extends Parameters
+ x_auth_password: Option[String] = None,
+ x_auth_mode: Option[String] = None,
+ oauth_verifier: Option[String] = None,
+ oauth_token: Option[String] = None)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClient.scala
index b8df671e..1b956d6b 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClient.scala
@@ -55,20 +55,20 @@ private[twitter4s] class RestClient(val consumerToken: ConsumerToken, val access
}
}
- def sendIgnoreResponse(httpRequest: HttpRequest)
- (implicit system: ActorSystem, materializer: Materializer): Future[Unit] = {
+ def sendIgnoreResponse(httpRequest: HttpRequest)(implicit system: ActorSystem,
+ materializer: Materializer): Future[Unit] = {
sendAndReceive(httpRequest, _ => Future.successful((): Unit))
}
- def sendReceiveAs[T: Manifest](httpRequest: HttpRequest)
- (implicit system: ActorSystem, materializer: Materializer): Future[T] = {
+ def sendReceiveAs[T: Manifest](httpRequest: HttpRequest)(implicit system: ActorSystem,
+ materializer: Materializer): Future[T] = {
implicit val ec = materializer.executionContext
implicit val jsonSerialization = serialization
sendAndReceive(httpRequest, response => Unmarshal(response.entity).to[T])
}
- def sendReceiveAsRated[T: Manifest](httpRequest: HttpRequest)
- (implicit system: ActorSystem, materializer: Materializer): Future[RatedData[T]] = {
+ def sendReceiveAsRated[T: Manifest](httpRequest: HttpRequest)(implicit system: ActorSystem,
+ materializer: Materializer): Future[RatedData[T]] = {
implicit val ec = materializer.executionContext
implicit val jsonSerialization = serialization
val unmarshallRated: HttpResponse => Future[RatedData[T]] = { response =>
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClient.scala
index d47588ec..5b5d3fe4 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClient.scala
@@ -66,7 +66,13 @@ trait TwitterAccountClient {
lang: Option[Language] = None,
time_zone: Option[TimeZone] = None,
trend_location_woeid: Option[Long] = None): Future[Settings] = {
- val options = SettingsOptions(allow_contributor_request, sleep_time_enabled, start_sleep_time, end_sleep_time, lang, time_zone, trend_location_woeid)
+ val options = SettingsOptions(allow_contributor_request,
+ sleep_time_enabled,
+ start_sleep_time,
+ end_sleep_time,
+ lang,
+ time_zone,
+ trend_location_woeid)
updateSettings(options)
}
@@ -118,9 +124,7 @@ trait TwitterAccountClient {
* When set to either `true` statuses will not be included in the returned user object.
* @return : The user representation.
* */
- def updateProfileName(name: String,
- include_entities: Boolean = true,
- skip_status: Boolean = false): Future[User] = {
+ def updateProfileName(name: String, include_entities: Boolean = true, skip_status: Boolean = false): Future[User] = {
val update = ProfileUpdate(name = Some(name), include_entities = include_entities, skip_status = skip_status)
updateProfile(update)
}
@@ -138,9 +142,7 @@ trait TwitterAccountClient {
* When set to either `true` statuses will not be included in the returned user object.
* @return : The user representation.
* */
- def updateProfileUrl(url: String,
- include_entities: Boolean = true,
- skip_status: Boolean = false): Future[User] = {
+ def updateProfileUrl(url: String, include_entities: Boolean = true, skip_status: Boolean = false): Future[User] = {
val update = ProfileUpdate(url = Some(url), include_entities = include_entities, skip_status = skip_status)
updateProfile(update)
}
@@ -161,7 +163,8 @@ trait TwitterAccountClient {
def updateProfileLocation(location: String,
include_entities: Boolean = true,
skip_status: Boolean = false): Future[User] = {
- val update = ProfileUpdate(location = Some(location), include_entities = include_entities, skip_status = skip_status)
+ val update =
+ ProfileUpdate(location = Some(location), include_entities = include_entities, skip_status = skip_status)
updateProfile(update)
}
@@ -180,7 +183,8 @@ trait TwitterAccountClient {
def updateProfileDescription(description: String,
include_entities: Boolean = true,
skip_status: Boolean = false): Future[User] = {
- val update = ProfileUpdate(description = Some(description), include_entities = include_entities, skip_status = skip_status)
+ val update =
+ ProfileUpdate(description = Some(description), include_entities = include_entities, skip_status = skip_status)
updateProfile(update)
}
@@ -200,7 +204,9 @@ trait TwitterAccountClient {
def updateProfileLinkColor(link_color: String,
include_entities: Boolean = true,
skip_status: Boolean = false): Future[User] = {
- val update = ProfileUpdate(profile_link_color = Some(link_color), include_entities = include_entities, skip_status = skip_status)
+ val update = ProfileUpdate(profile_link_color = Some(link_color),
+ include_entities = include_entities,
+ skip_status = skip_status)
updateProfile(update)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/parameters/CredentialsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/parameters/CredentialsParameters.scala
index 1a66cff5..c36a0c27 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/parameters/CredentialsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/account/parameters/CredentialsParameters.scala
@@ -3,5 +3,6 @@ package com.danielasfregola.twitter4s.http.clients.rest.account.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class CredentialsParameters(include_entities: Boolean,
- skip_status: Boolean,
- include_email: Boolean) extends Parameters
+ skip_status: Boolean,
+ include_email: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClient.scala
index 4f7b7d2a..2194fc61 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClient.scala
@@ -2,7 +2,11 @@ package com.danielasfregola.twitter4s.http.clients.rest.blocks
import com.danielasfregola.twitter4s.entities._
import com.danielasfregola.twitter4s.http.clients.rest.RestClient
-import com.danielasfregola.twitter4s.http.clients.rest.blocks.parameters.{BlockParameters, BlockedUserIdsParameters, BlockedUsersParameters}
+import com.danielasfregola.twitter4s.http.clients.rest.blocks.parameters.{
+ BlockParameters,
+ BlockedUserIdsParameters,
+ BlockedUsersParameters
+}
import com.danielasfregola.twitter4s.util.Configurations._
import scala.concurrent.Future
@@ -87,9 +91,7 @@ trait TwitterBlockClient {
* When set to either `true` statuses will not be included in the returned user object.
* @return : The representation of the blocked user.
*/
- def blockUser(screen_name: String,
- include_entities: Boolean = true,
- skip_status: Boolean = false): Future[User] = {
+ def blockUser(screen_name: String, include_entities: Boolean = true, skip_status: Boolean = false): Future[User] = {
val parameters = BlockParameters(user_id = None, Some(screen_name), include_entities, skip_status)
genericBlock(parameters)
}
@@ -109,9 +111,7 @@ trait TwitterBlockClient {
* When set to either `true` statuses will not be included in the returned user object.
* @return : The representation of the blocked user.
*/
- def blockUserId(user_id: Long,
- include_entities: Boolean = true,
- skip_status: Boolean = false): Future[User] = {
+ def blockUserId(user_id: Long, include_entities: Boolean = true, skip_status: Boolean = false): Future[User] = {
val parameters = BlockParameters(Some(user_id), screen_name = None, include_entities, skip_status)
genericBlock(parameters)
}
@@ -136,9 +136,7 @@ trait TwitterBlockClient {
* When set to either `true` statuses will not be included in the returned user object.
* @return : The representation of the unblocked user.
*/
- def unblockUser(screen_name: String,
- include_entities: Boolean = true,
- skip_status: Boolean = false): Future[User] = {
+ def unblockUser(screen_name: String, include_entities: Boolean = true, skip_status: Boolean = false): Future[User] = {
val parameters = BlockParameters(user_id = None, Some(screen_name), include_entities, skip_status)
genericUnblock(parameters)
}
@@ -158,9 +156,7 @@ trait TwitterBlockClient {
* When set to either `true` statuses will not be included in the returned user object.
* @return : The representation of the unblocked user.
*/
- def unblockUserId(user_id: Long,
- include_entities: Boolean = true,
- skip_status: Boolean = false): Future[User] = {
+ def unblockUserId(user_id: Long, include_entities: Boolean = true, skip_status: Boolean = false): Future[User] = {
val parameters = BlockParameters(Some(user_id), screen_name = None, include_entities, skip_status)
genericUnblock(parameters)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockParameters.scala
index bcf52003..9650d3fe 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockParameters.scala
@@ -3,6 +3,7 @@ package com.danielasfregola.twitter4s.http.clients.rest.blocks.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class BlockParameters(user_id: Option[Long],
- screen_name: Option[String],
- include_entities: Boolean,
- skip_status: Boolean) extends Parameters
+ screen_name: Option[String],
+ include_entities: Boolean,
+ skip_status: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockedUsersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockedUsersParameters.scala
index 257fea29..ba8d059e 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockedUsersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/parameters/BlockedUsersParameters.scala
@@ -3,5 +3,6 @@ package com.danielasfregola.twitter4s.http.clients.rest.blocks.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class BlockedUsersParameters(include_entities: Boolean,
- skip_status: Boolean,
- cursor: Long) extends Parameters
+ skip_status: Boolean,
+ cursor: Long)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClient.scala
index 43054496..298d7987 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClient.scala
@@ -40,9 +40,8 @@ trait TwitterDirectMessageClient {
* and keep the message under 140 characters.
* @return : The sent direct message.
* */
- def createDirectMessage(user_id: Long,
- text: String): Future[DirectMessage] = {
- val parameters = CreateParameters(user_id = Some(user_id),text = text)
+ def createDirectMessage(user_id: Long, text: String): Future[DirectMessage] = {
+ val parameters = CreateParameters(user_id = Some(user_id), text = text)
genericCreateDirectMessage(parameters)
}
@@ -57,9 +56,8 @@ trait TwitterDirectMessageClient {
* and keep the message under 140 characters.
* @return : The sent direct message.
* */
- def createDirectMessage(screen_name: String,
- text: String): Future[DirectMessage] = {
- val parameters = CreateParameters(screen_name = Some(screen_name),text = text)
+ def createDirectMessage(screen_name: String, text: String): Future[DirectMessage] = {
+ val parameters = CreateParameters(screen_name = Some(screen_name), text = text)
genericCreateDirectMessage(parameters)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/CreateParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/CreateParameters.scala
index f8a70bfd..7c626118 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/CreateParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/CreateParameters.scala
@@ -3,5 +3,6 @@ package com.danielasfregola.twitter4s.http.clients.rest.directmessages.parameter
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class CreateParameters(user_id: Option[Long] = None,
- screen_name: Option[String] = None,
- text: String) extends Parameters
+ screen_name: Option[String] = None,
+ text: String)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/ReceivedParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/ReceivedParameters.scala
index bd99f47c..97bface7 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/ReceivedParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/ReceivedParameters.scala
@@ -3,7 +3,8 @@ package com.danielasfregola.twitter4s.http.clients.rest.directmessages.parameter
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class ReceivedParameters(since_id: Option[Long],
- max_id: Option[Long],
- count: Int,
- include_entities: Boolean,
- skip_status: Boolean) extends Parameters
+ max_id: Option[Long],
+ count: Int,
+ include_entities: Boolean,
+ skip_status: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/SentParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/SentParameters.scala
index e2ba612c..e770f2c7 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/SentParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/parameters/SentParameters.scala
@@ -3,7 +3,8 @@ package com.danielasfregola.twitter4s.http.clients.rest.directmessages.parameter
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class SentParameters(since_id: Option[Long],
- max_id: Option[Long],
- count: Int,
- include_entities: Boolean,
- page: Int) extends Parameters
+ max_id: Option[Long],
+ count: Int,
+ include_entities: Boolean,
+ page: Int)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/parameters/FavoritesParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/parameters/FavoritesParameters.scala
index 10102715..29769093 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/parameters/FavoritesParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/parameters/FavoritesParameters.scala
@@ -3,8 +3,9 @@ package com.danielasfregola.twitter4s.http.clients.rest.favorites.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class FavoritesParameters(user_id: Option[Long],
- screen_name: Option[String],
- count: Int,
- since_id: Option[Long],
- max_id: Option[Long],
- include_entities: Boolean) extends Parameters
+ screen_name: Option[String],
+ count: Int,
+ since_id: Option[Long],
+ max_id: Option[Long],
+ include_entities: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClient.scala
index 353a2006..b266331c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClient.scala
@@ -79,7 +79,9 @@ trait TwitterFollowerClient {
* Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return : The cursored representation of the users stringified ids following the specified user.
* */
- def followerStringifiedIdsForUserId(user_id: Long, cursor: Long = -1, count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
+ def followerStringifiedIdsForUserId(user_id: Long,
+ cursor: Long = -1,
+ count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
val parameters = FollowingParameters(Some(user_id), screen_name = None, cursor, count, stringify_ids = true)
genericFollowerIds[UserStringifiedIds](parameters)
}
@@ -102,7 +104,9 @@ trait TwitterFollowerClient {
* Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return : The cursored representation of the users stringified ids following the specified user.
* */
- def followersStringifiedIdsForUser(screen_name: String, cursor: Long = -1, count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
+ def followersStringifiedIdsForUser(screen_name: String,
+ cursor: Long = -1,
+ count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
val parameters = FollowingParameters(user_id = None, Some(screen_name), cursor, count, stringify_ids = true)
genericFollowerIds[UserStringifiedIds](parameters)
}
@@ -136,7 +140,12 @@ trait TwitterFollowerClient {
count: Int = 20,
skip_status: Boolean = false,
include_user_entities: Boolean = true): Future[RatedData[Users]] = {
- val parameters = FollowersParameters(user_id = None, screen_name = Some(screen_name), cursor, count, skip_status, include_user_entities)
+ val parameters = FollowersParameters(user_id = None,
+ screen_name = Some(screen_name),
+ cursor,
+ count,
+ skip_status,
+ include_user_entities)
genericGetFollowers(parameters)
}
@@ -164,7 +173,12 @@ trait TwitterFollowerClient {
count: Int = 20,
skip_status: Boolean = false,
include_user_entities: Boolean = true): Future[RatedData[Users]] = {
- val parameters = FollowersParameters(user_id = Some(user_id), screen_name = None, cursor, count, skip_status, include_user_entities)
+ val parameters = FollowersParameters(user_id = Some(user_id),
+ screen_name = None,
+ cursor,
+ count,
+ skip_status,
+ include_user_entities)
genericGetFollowers(parameters)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowersParameters.scala
index 1cac3b6a..abcffa8e 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowersParameters.scala
@@ -3,8 +3,9 @@ package com.danielasfregola.twitter4s.http.clients.rest.followers.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class FollowersParameters(user_id: Option[Long],
- screen_name: Option[String],
- cursor: Long,
- count: Int,
- skip_status: Boolean,
- include_user_entities: Boolean) extends Parameters
+ screen_name: Option[String],
+ cursor: Long,
+ count: Int,
+ skip_status: Boolean,
+ include_user_entities: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowingParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowingParameters.scala
index 5cc6e171..9502699b 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowingParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/parameters/FollowingParameters.scala
@@ -3,7 +3,8 @@ package com.danielasfregola.twitter4s.http.clients.rest.followers.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class FollowingParameters(user_id: Option[Long],
- screen_name: Option[String],
- cursor: Long,
- count: Int,
- stringify_ids: Boolean) extends Parameters
+ screen_name: Option[String],
+ cursor: Long,
+ count: Int,
+ stringify_ids: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClient.scala
index 5e1bd362..5c817ac4 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClient.scala
@@ -79,7 +79,9 @@ trait TwitterFriendClient {
* Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return : The cursored representation of the user stringified ids the specified user id is following.
* */
- def friendStringifiedIdsForUserId(user_id: Long, cursor: Long = -1, count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
+ def friendStringifiedIdsForUserId(user_id: Long,
+ cursor: Long = -1,
+ count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
val parameters = FriendParameters(Some(user_id), screen_name = None, cursor, count, stringify_ids = true)
genericGetFriendIds[UserStringifiedIds](parameters)
}
@@ -102,7 +104,9 @@ trait TwitterFriendClient {
* Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.
* @return : The cursored representation of the user stringified ids the specified user is following.
* */
- def friendStringifiedIdsForUser(screen_name: String, cursor: Long = -1, count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
+ def friendStringifiedIdsForUser(screen_name: String,
+ cursor: Long = -1,
+ count: Int = 5000): Future[RatedData[UserStringifiedIds]] = {
val parameters = FriendParameters(user_id = None, Some(screen_name), cursor, count, stringify_ids = true)
genericGetFriendIds[UserStringifiedIds](parameters)
}
@@ -136,7 +140,8 @@ trait TwitterFriendClient {
count: Int = 20,
skip_status: Boolean = false,
include_user_entities: Boolean = true): Future[RatedData[Users]] = {
- val parameters = FriendsParameters(user_id = None, Some(screen_name), cursor, count, skip_status, include_user_entities)
+ val parameters =
+ FriendsParameters(user_id = None, Some(screen_name), cursor, count, skip_status, include_user_entities)
genericGetFriends(parameters)
}
@@ -164,7 +169,8 @@ trait TwitterFriendClient {
count: Int = 20,
skip_status: Boolean = false,
include_user_entities: Boolean = true): Future[RatedData[Users]] = {
- val parameters = FriendsParameters(Some(user_id), screen_name = None, cursor, count, skip_status, include_user_entities)
+ val parameters =
+ FriendsParameters(Some(user_id), screen_name = None, cursor, count, skip_status, include_user_entities)
genericGetFriends(parameters)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendParameters.scala
index 981e3d1c..0dfcede3 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendParameters.scala
@@ -3,7 +3,8 @@ package com.danielasfregola.twitter4s.http.clients.rest.friends.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class FriendParameters(user_id: Option[Long],
- screen_name: Option[String],
- cursor: Long,
- count: Int,
- stringify_ids: Boolean) extends Parameters
+ screen_name: Option[String],
+ cursor: Long,
+ count: Int,
+ stringify_ids: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendsParameters.scala
index d774d1e8..3255052c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/parameters/FriendsParameters.scala
@@ -3,8 +3,9 @@ package com.danielasfregola.twitter4s.http.clients.rest.friends.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class FriendsParameters(user_id: Option[Long],
- screen_name: Option[String],
- cursor: Long,
- count: Int,
- skip_status: Boolean,
- include_user_entities: Boolean) extends Parameters
+ screen_name: Option[String],
+ cursor: Long,
+ count: Int,
+ skip_status: Boolean,
+ include_user_entities: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClient.scala
index 6080bade..d511d7b8 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClient.scala
@@ -324,7 +324,8 @@ trait TwitterFriendshipClient {
* @param target_screen_name : The screen name of the target user.
* @return : The representation of the relationship between the two users.
* */
- def relationshipBetweenUsers(source_screen_name: String, target_screen_name: String): Future[RatedData[Relationship]] = {
+ def relationshipBetweenUsers(source_screen_name: String,
+ target_screen_name: String): Future[RatedData[Relationship]] = {
val parameters = RelationshipParametersByNames(source_screen_name, target_screen_name)
genericGetRelationship(parameters)
}
@@ -368,7 +369,8 @@ trait TwitterFriendshipClient {
genericGetRelationships(parameters)
}
- private def genericGetRelationships(parameters: RelationshipsParameters): Future[RatedData[Seq[LookupRelationship]]] = {
+ private def genericGetRelationships(
+ parameters: RelationshipsParameters): Future[RatedData[Seq[LookupRelationship]]] = {
import restClient._
Get(s"$friendshipsUrl/lookup.json", parameters).respondAsRated[Seq[LookupRelationship]]
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/FollowParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/FollowParameters.scala
index a3749273..10e8dac4 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/FollowParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/FollowParameters.scala
@@ -3,5 +3,6 @@ package com.danielasfregola.twitter4s.http.clients.rest.friendships.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class FollowParameters(user_id: Option[Long],
- screen_name: Option[String],
- follow: Boolean) extends Parameters
+ screen_name: Option[String],
+ follow: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/NotificationParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/NotificationParameters.scala
index a41815e5..88b9e806 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/NotificationParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/NotificationParameters.scala
@@ -5,9 +5,11 @@ import com.danielasfregola.twitter4s.http.marshalling.Parameters
abstract class NotificationParameters extends Parameters
private[twitter4s] final case class RetweetNotificationParameters(user_id: Option[Long],
- screen_name: Option[String],
- retweets: Boolean) extends NotificationParameters
+ screen_name: Option[String],
+ retweets: Boolean)
+ extends NotificationParameters
private[twitter4s] final case class DeviceNotificationParameters(user_id: Option[Long],
- screen_name: Option[String],
- device: Boolean) extends NotificationParameters
+ screen_name: Option[String],
+ device: Boolean)
+ extends NotificationParameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipParameters.scala
index 182ff578..ba7ccf90 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipParameters.scala
@@ -4,8 +4,9 @@ import com.danielasfregola.twitter4s.http.marshalling.Parameters
abstract class RelationshipParameters extends Parameters
-private[twitter4s] final case class RelationshipParametersByIds(source_id: Long,
- target_id: Long) extends RelationshipParameters
+private[twitter4s] final case class RelationshipParametersByIds(source_id: Long, target_id: Long)
+ extends RelationshipParameters
private[twitter4s] final case class RelationshipParametersByNames(source_screen_name: String,
- target_screen_name: String) extends RelationshipParameters
+ target_screen_name: String)
+ extends RelationshipParameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipsParameters.scala
index 8fd83328..58527577 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/RelationshipsParameters.scala
@@ -2,5 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.friendships.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class RelationshipsParameters(user_id: Option[String],
- screen_name: Option[String]) extends Parameters
+private[twitter4s] final case class RelationshipsParameters(user_id: Option[String], screen_name: Option[String])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/UnfollowParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/UnfollowParameters.scala
index c3087f08..48442703 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/UnfollowParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/parameters/UnfollowParameters.scala
@@ -2,5 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.friendships.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class UnfollowParameters(user_id: Option[Long],
- screen_name: Option[String]) extends Parameters
+private[twitter4s] final case class UnfollowParameters(user_id: Option[Long], screen_name: Option[String])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClient.scala
index 3dc7b32c..9b41d101 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClient.scala
@@ -35,8 +35,8 @@ trait TwitterGeoClient {
*
* https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode.
*
- * @param latitude : The latitude to search around.
- * This parameter will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive.
+ * @param latitude : The latitude to search around.
+ * This parameter will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive.
* It will also be ignored if there isn’t a corresponding long parameter.
* @param longitude : The longitude to search around.
* The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive.
@@ -122,12 +122,21 @@ trait TwitterGeoClient {
street_address: Option[String] = None,
callback: Option[String] = None): Future[RatedData[GeoSearch]] = {
import restClient._
- require(latitude.isDefined || longitude.isDefined || ip.isDefined || query.isDefined,
- "please, provide at least one of the following: 'latitude', 'longitude', 'query', 'ip'")
- val parameters = GeoSearchParameters(latitude, longitude, query, ip, granularity, accuracy, max_results, contained_within, street_address, callback)
+ require(
+ latitude.isDefined || longitude.isDefined || ip.isDefined || query.isDefined,
+ "please, provide at least one of the following: 'latitude', 'longitude', 'query', 'ip'"
+ )
+ val parameters = GeoSearchParameters(latitude,
+ longitude,
+ query,
+ ip,
+ granularity,
+ accuracy,
+ max_results,
+ contained_within,
+ street_address,
+ callback)
Get(s"$geoUrl/search.json", parameters).respondAsRated[GeoSearch]
}
-
-
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/GeoSearchParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/GeoSearchParameters.scala
index dbdbffdb..7d6434f4 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/GeoSearchParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/GeoSearchParameters.scala
@@ -5,12 +5,13 @@ import com.danielasfregola.twitter4s.entities.enums.Granularity._
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class GeoSearchParameters(lat: Option[Double],
- long: Option[Double],
- query: Option[String],
- ip: Option[String],
- granularity: Option[Granularity],
- accuracy: Option[Accuracy],
- max_results: Option[Int],
- contained_within: Option[String],
- `attribute:street_address`: Option[String],
- callback: Option[String]) extends Parameters
+ long: Option[Double],
+ query: Option[String],
+ ip: Option[String],
+ granularity: Option[Granularity],
+ accuracy: Option[Accuracy],
+ max_results: Option[Int],
+ contained_within: Option[String],
+ `attribute:street_address`: Option[String],
+ callback: Option[String])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/ReverseGeoCodeParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/ReverseGeoCodeParameters.scala
index d053a3d1..2f448cfe 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/ReverseGeoCodeParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/parameters/ReverseGeoCodeParameters.scala
@@ -5,8 +5,9 @@ import com.danielasfregola.twitter4s.entities.enums.Granularity.Granularity
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class ReverseGeoCodeParameters(lat: Double,
- long: Double,
- accuracy: Accuracy,
- granularity: Granularity,
- max_results: Option[Int],
- callback: Option[String]) extends Parameters
+ long: Double,
+ accuracy: Accuracy,
+ granularity: Granularity,
+ max_results: Option[Int],
+ callback: Option[String])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClient.scala
index 5507d515..938730a2 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClient.scala
@@ -57,7 +57,7 @@ trait TwitterHelpClient {
* https://developer.twitter.com/en/docs/developer-utilities/terms-of-service/api-reference/get-help-tos.
*
* @return : the Twitter Terms of Service.
- * */
+ * */
def termsOfService(): Future[RatedData[TermsOfService]] = {
import restClient._
Get(s"$helpUrl/tos.json").respondAsRated[TermsOfService]
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClient.scala
index 5228759f..3c382074 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClient.scala
@@ -88,8 +88,15 @@ trait TwitterListClient {
include_rts: Boolean = false,
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
val parameters = ListTimelineParameters(
- slug = Some(slug), owner_id = Some(owner_id), count = count, since_id = since_id,
- max_id = max_id, include_entities = include_entities, include_rts = include_rts, tweet_mode = tweet_mode)
+ slug = Some(slug),
+ owner_id = Some(owner_id),
+ count = count,
+ since_id = since_id,
+ max_id = max_id,
+ include_entities = include_entities,
+ include_rts = include_rts,
+ tweet_mode = tweet_mode
+ )
genericGetListTimeline(parameters)
}
@@ -126,8 +133,15 @@ trait TwitterListClient {
include_rts: Boolean = false,
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
val parameters = ListTimelineParameters(
- slug = Some(slug), owner_screen_name = Some(owner_screen_name), count = count, since_id = since_id,
- max_id = max_id, include_entities = include_entities, include_rts = include_rts, tweet_mode = tweet_mode)
+ slug = Some(slug),
+ owner_screen_name = Some(owner_screen_name),
+ count = count,
+ since_id = since_id,
+ max_id = max_id,
+ include_entities = include_entities,
+ include_rts = include_rts,
+ tweet_mode = tweet_mode
+ )
genericGetListTimeline(parameters)
}
@@ -161,9 +175,13 @@ trait TwitterListClient {
include_entities: Boolean = true,
include_rts: Boolean = false,
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
- val parameters = ListTimelineParameters(
- list_id = Some(list_id), count = count, since_id = since_id,
- max_id = max_id, include_entities = include_entities, include_rts = include_rts, tweet_mode = tweet_mode)
+ val parameters = ListTimelineParameters(list_id = Some(list_id),
+ count = count,
+ since_id = since_id,
+ max_id = max_id,
+ include_entities = include_entities,
+ include_rts = include_rts,
+ tweet_mode = tweet_mode)
genericGetListTimeline(parameters)
}
@@ -196,10 +214,12 @@ trait TwitterListClient {
* @param member_screen_name : The screen name of the user for whom to remove from the list.
* Helpful for disambiguating when a valid screen name is also a user ID.
*/
- def removeListMemberBySlugAndOwnerName(slug: String, owner_screen_name: String, member_screen_name: String): Future[Unit] = {
+ def removeListMemberBySlugAndOwnerName(slug: String,
+ owner_screen_name: String,
+ member_screen_name: String): Future[Unit] = {
val parameters = RemoveMemberParameters(slug = Some(slug),
- owner_screen_name = Some(owner_screen_name),
- screen_name = Some(member_screen_name))
+ owner_screen_name = Some(owner_screen_name),
+ screen_name = Some(member_screen_name))
genericRemoveListMember(parameters)
}
@@ -214,9 +234,8 @@ trait TwitterListClient {
* Helpful for disambiguating when a valid screen name is also a user ID.
*/
def removeListMemberBySlugAndOwnerId(slug: String, owner_id: Long, member_screen_name: String): Future[Unit] = {
- val parameters = RemoveMemberParameters(slug = Some(slug),
- owner_id = Some(owner_id),
- screen_name = Some(member_screen_name))
+ val parameters =
+ RemoveMemberParameters(slug = Some(slug), owner_id = Some(owner_id), screen_name = Some(member_screen_name))
genericRemoveListMember(parameters)
}
@@ -245,9 +264,8 @@ trait TwitterListClient {
* Helpful for disambiguating when a valid user ID is also a valid screen name.
*/
def removeListMemberIdBySlugAndOwnerName(slug: String, owner_screen_name: String, member_id: Long): Future[Unit] = {
- val parameters = RemoveMemberParameters(slug = Some(slug),
- owner_screen_name = Some(owner_screen_name),
- user_id = Some(member_id))
+ val parameters =
+ RemoveMemberParameters(slug = Some(slug), owner_screen_name = Some(owner_screen_name), user_id = Some(member_id))
genericRemoveListMember(parameters)
}
@@ -262,9 +280,7 @@ trait TwitterListClient {
* Helpful for disambiguating when a valid user ID is also a valid screen name.
*/
def removeListMemberIdBySlugAndOwnerId(slug: String, owner_id: Long, member_id: Long): Future[Unit] = {
- val parameters = RemoveMemberParameters(slug = Some(slug),
- owner_id = Some(owner_id),
- user_id = Some(member_id))
+ val parameters = RemoveMemberParameters(slug = Some(slug), owner_id = Some(owner_id), user_id = Some(member_id))
genericRemoveListMember(parameters)
}
@@ -357,7 +373,9 @@ trait TwitterListClient {
*/
def addListMemberIdsBySlugAndOwnerName(slug: String, owner_screen_name: String, user_ids: Seq[Long]): Future[Unit] = {
require(user_ids.nonEmpty, "please, provide at least one user id")
- val parameters = MembersParameters(slug = Some(slug), owner_screen_name = Some(owner_screen_name), user_id = Some(user_ids.mkString(",")))
+ val parameters = MembersParameters(slug = Some(slug),
+ owner_screen_name = Some(owner_screen_name),
+ user_id = Some(user_ids.mkString(",")))
genericAddListMembers(parameters)
}
@@ -375,7 +393,8 @@ trait TwitterListClient {
*/
def addListMemberIdsBySlugAndOwnerId(slug: String, owner_id: Long, user_ids: Seq[Long]): Future[Unit] = {
require(user_ids.nonEmpty, "please, provide at least one user id")
- val parameters = MembersParameters(slug = Some(slug), owner_id = Some(owner_id), user_id = Some(user_ids.mkString(",")))
+ val parameters =
+ MembersParameters(slug = Some(slug), owner_id = Some(owner_id), user_id = Some(user_ids.mkString(",")))
genericAddListMembers(parameters)
}
@@ -408,9 +427,13 @@ trait TwitterListClient {
* @param owner_screen_name : The screen name of the user who owns the list being requested by a `slug`.
* @param screen_names : The list of user screen names to add, up to 100 are allowed in a single request.
*/
- def addListMembersBySlugAndOwnerName(slug: String, owner_screen_name: String, screen_names: Seq[String]): Future[Unit] = {
+ def addListMembersBySlugAndOwnerName(slug: String,
+ owner_screen_name: String,
+ screen_names: Seq[String]): Future[Unit] = {
require(screen_names.nonEmpty, "please, provide at least one screen name")
- val parameters = MembersParameters(slug = Some(slug), owner_screen_name = Some(owner_screen_name), screen_name = Some(screen_names.mkString(",")))
+ val parameters = MembersParameters(slug = Some(slug),
+ owner_screen_name = Some(owner_screen_name),
+ screen_name = Some(screen_names.mkString(",")))
genericAddListMembers(parameters)
}
@@ -428,7 +451,8 @@ trait TwitterListClient {
*/
def addListMembersBySlugAndOwnerId(slug: String, owner_id: Long, screen_names: Seq[String]): Future[Unit] = {
require(screen_names.nonEmpty, "please, provide at least one screen name")
- val parameters = MembersParameters(slug = Some(slug), owner_id = Some(owner_id), screen_name = Some(screen_names.mkString(",")))
+ val parameters =
+ MembersParameters(slug = Some(slug), owner_id = Some(owner_id), screen_name = Some(screen_names.mkString(",")))
genericAddListMembers(parameters)
}
@@ -458,9 +482,9 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[User]] = {
val parameters = MemberParameters(list_id = Some(list_id),
- user_id = Some(user_id),
- include_entities = include_entities,
- skip_status = skip_status)
+ user_id = Some(user_id),
+ include_entities = include_entities,
+ skip_status = skip_status)
genericCheckListMember(parameters)
}
@@ -487,10 +511,10 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[User]] = {
val parameters = MemberParameters(slug = Some(slug),
- owner_screen_name = Some(owner_screen_name),
- user_id = Some(user_id),
- include_entities = include_entities,
- skip_status = skip_status)
+ owner_screen_name = Some(owner_screen_name),
+ user_id = Some(user_id),
+ include_entities = include_entities,
+ skip_status = skip_status)
genericCheckListMember(parameters)
}
@@ -517,10 +541,10 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[User]] = {
val parameters = MemberParameters(slug = Some(slug),
- owner_id = Some(owner_id),
- user_id = Some(user_id),
- include_entities = include_entities,
- skip_status = skip_status)
+ owner_id = Some(owner_id),
+ user_id = Some(user_id),
+ include_entities = include_entities,
+ skip_status = skip_status)
genericCheckListMember(parameters)
}
@@ -545,9 +569,9 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[User]] = {
val parameters = MemberParameters(list_id = Some(list_id),
- screen_name = Some(screen_name),
- include_entities = include_entities,
- skip_status = skip_status)
+ screen_name = Some(screen_name),
+ include_entities = include_entities,
+ skip_status = skip_status)
genericCheckListMember(parameters)
}
@@ -574,10 +598,10 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[User]] = {
val parameters = MemberParameters(slug = Some(slug),
- owner_screen_name = Some(owner_screen_name),
- screen_name = Some(screen_name),
- include_entities = include_entities,
- skip_status = skip_status)
+ owner_screen_name = Some(owner_screen_name),
+ screen_name = Some(screen_name),
+ include_entities = include_entities,
+ skip_status = skip_status)
genericCheckListMember(parameters)
}
@@ -604,10 +628,10 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[User]] = {
val parameters = MemberParameters(slug = Some(slug),
- owner_id = Some(owner_id),
- screen_name = Some(screen_name),
- include_entities = include_entities,
- skip_status = skip_status)
+ owner_id = Some(owner_id),
+ screen_name = Some(screen_name),
+ include_entities = include_entities,
+ skip_status = skip_status)
genericCheckListMember(parameters)
}
@@ -640,10 +664,10 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[Users]] = {
val parameters = ListMembersParameters(list_id = Some(list_id),
- count = count,
- cursor = cursor,
- include_entities = include_entities,
- skip_status = skip_status)
+ count = count,
+ cursor = cursor,
+ include_entities = include_entities,
+ skip_status = skip_status)
genericGetListMembers(parameters)
}
@@ -673,11 +697,11 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[Users]] = {
val parameters = ListMembersParameters(slug = Some(slug),
- owner_screen_name = Some(owner_screen_name),
- count = count,
- cursor = cursor,
- include_entities = include_entities,
- skip_status = skip_status)
+ owner_screen_name = Some(owner_screen_name),
+ count = count,
+ cursor = cursor,
+ include_entities = include_entities,
+ skip_status = skip_status)
genericGetListMembers(parameters)
}
@@ -707,11 +731,11 @@ trait TwitterListClient {
include_entities: Boolean = true,
skip_status: Boolean = false): Future[RatedData[Users]] = {
val parameters = ListMembersParameters(slug = Some(slug),
- owner_id = Some(owner_id),
- count = count,
- cursor = cursor,
- include_entities = include_entities,
- skip_status = skip_status)
+ owner_id = Some(owner_id),
+ count = count,
+ cursor = cursor,
+ include_entities = include_entities,
+ skip_status = skip_status)
genericGetListMembers(parameters)
}
@@ -747,11 +771,11 @@ trait TwitterListClient {
* Helpful for disambiguating when a valid user ID is also a valid screen name.
*/
def addListMemberIdBySlugAndOwnerName(slug: String, owner_screen_name: String, user_id: Long): Future[Unit] = {
- val parameters = AddMemberParameters(slug = Some(slug), owner_screen_name = Some(owner_screen_name), user_id = Some(user_id))
+ val parameters =
+ AddMemberParameters(slug = Some(slug), owner_screen_name = Some(owner_screen_name), user_id = Some(user_id))
genericAddListMember(parameters)
}
-
/** Add a member to a list. The authenticated user must own the list to be able to add members to it.
* Note that lists cannot have more than 5,000 members.
* For more information see
@@ -795,7 +819,9 @@ trait TwitterListClient {
* Helpful for disambiguating when a valid screen name is also a user ID.
*/
def addListMemberBySlugAndOwnerName(slug: String, owner_screen_name: String, screen_name: String): Future[Unit] = {
- val parameters = AddMemberParameters(slug = Some(slug), owner_screen_name = Some(owner_screen_name), screen_name = Some(screen_name))
+ val parameters = AddMemberParameters(slug = Some(slug),
+ owner_screen_name = Some(owner_screen_name),
+ screen_name = Some(screen_name))
genericAddListMember(parameters)
}
@@ -977,7 +1003,9 @@ trait TwitterListClient {
* @param owner_screen_name : The screen name of the user who owns the list being requested by a `slug`.
* @param description : The description to give the list.
*/
- def updateListDescriptionBySlugAndOwnerName(slug: String, owner_screen_name: String, description: String): Future[Unit] = {
+ def updateListDescriptionBySlugAndOwnerName(slug: String,
+ owner_screen_name: String,
+ description: String): Future[Unit] = {
val parameters = ListParameters(slug = Some(slug), owner_screen_name = Some(owner_screen_name))
val update = TwitterListUpdate(description = Some(description))
genericUpdateList(parameters, update)
@@ -1048,7 +1076,8 @@ trait TwitterListClient {
owner_id = parameters.owner_id,
description = update.description,
name = update.name,
- mode = update.mode)
+ mode = update.mode
+ )
Post(s"$listsUrl/update.json", listUpdate).respondAs[Unit]
}
@@ -1132,9 +1161,7 @@ trait TwitterListClient {
* Breaks the results into pages. Provide values as returned in the response body’s `next_cursor` and `previous_cursor` attributes to page back and forth in the list.
* @return : The Twitter lists the specified user is subscribed to.
*/
- def listSubscriptions(screen_name: String,
- count: Int = 20,
- cursor: Long = -1): Future[RatedData[TwitterLists]] = {
+ def listSubscriptions(screen_name: String, count: Int = 20, cursor: Long = -1): Future[RatedData[TwitterLists]] = {
val parameters = SubscriptionsParameters(user_id = None, Some(screen_name), count, cursor)
genericListSubscriptions(parameters)
}
@@ -1154,9 +1181,7 @@ trait TwitterListClient {
* Breaks the results into pages. Provide values as returned in the response body’s `next_cursor` and `previous_cursor` attributes to page back and forth in the list.
* @return : The Twitter lists the specified user is subscribed to.
*/
- def listSubscriptionsByUserId(user_id: Long,
- count: Int = 20,
- cursor: Long = -1): Future[RatedData[TwitterLists]] = {
+ def listSubscriptionsByUserId(user_id: Long, count: Int = 20, cursor: Long = -1): Future[RatedData[TwitterLists]] = {
val parameters = SubscriptionsParameters(Some(user_id), screen_name = None, count, cursor)
genericListSubscriptions(parameters)
}
@@ -1178,7 +1203,8 @@ trait TwitterListClient {
*/
def removeListMembers(list_id: Long, members_screen_names: Seq[String]): Future[Unit] = {
require(members_screen_names.nonEmpty, "please, provide at least one screen name")
- val parameters = RemoveMembersParameters(list_id = Some(list_id), screen_name = Some(members_screen_names.mkString(",")))
+ val parameters =
+ RemoveMembersParameters(list_id = Some(list_id), screen_name = Some(members_screen_names.mkString(",")))
genericRemoveMembers(parameters)
}
@@ -1193,11 +1219,13 @@ trait TwitterListClient {
* @param owner_screen_name : The screen name of the user who owns the list being requested by a `slug`.
* @param members_screen_names : A sequence of screen names to remove from the list, up to 100 are allowed in a single request.
*/
- def removeListMembersBySlugAndOwnerName(slug: String, owner_screen_name: String, members_screen_names: Seq[String]): Future[Unit] = {
+ def removeListMembersBySlugAndOwnerName(slug: String,
+ owner_screen_name: String,
+ members_screen_names: Seq[String]): Future[Unit] = {
require(members_screen_names.nonEmpty, "please, provide at least one screen name")
val parameters = RemoveMembersParameters(slug = Some(slug),
- owner_screen_name = Some(owner_screen_name),
- screen_name = Some(members_screen_names.mkString(",")))
+ owner_screen_name = Some(owner_screen_name),
+ screen_name = Some(members_screen_names.mkString(",")))
genericRemoveMembers(parameters)
}
@@ -1212,11 +1240,13 @@ trait TwitterListClient {
* @param owner_id : The user ID of the user who owns the list being requested by a `slug`.
* @param members_screen_names : A sequence of screen names to remove from the list, up to 100 are allowed in a single request.
*/
- def removeListMembersBySlugAndOwnerId(slug: String, owner_id: Long, members_screen_names: Seq[String]): Future[Unit] = {
+ def removeListMembersBySlugAndOwnerId(slug: String,
+ owner_id: Long,
+ members_screen_names: Seq[String]): Future[Unit] = {
require(members_screen_names.nonEmpty, "please, provide at least one screen name")
val parameters = RemoveMembersParameters(slug = Some(slug),
- owner_id = Some(owner_id),
- screen_name = Some(members_screen_names.mkString(",")))
+ owner_id = Some(owner_id),
+ screen_name = Some(members_screen_names.mkString(",")))
genericRemoveMembers(parameters)
}
@@ -1247,11 +1277,13 @@ trait TwitterListClient {
* @param owner_screen_name : The screen name of the user who owns the list being requested by a `slug`.
* @param members_ids : A sequence of user ids to remove from the list, up to 100 are allowed in a single request.
*/
- def removeListMembersIdsBySlugAndOwnerName(slug: String, owner_screen_name: String, members_ids: Seq[Long]): Future[Unit] = {
+ def removeListMembersIdsBySlugAndOwnerName(slug: String,
+ owner_screen_name: String,
+ members_ids: Seq[Long]): Future[Unit] = {
require(members_ids.nonEmpty, "please, provide at least one user id")
val parameters = RemoveMembersParameters(slug = Some(slug),
- owner_screen_name = Some(owner_screen_name),
- user_id = Some(members_ids.mkString(",")))
+ owner_screen_name = Some(owner_screen_name),
+ user_id = Some(members_ids.mkString(",")))
genericRemoveMembers(parameters)
}
@@ -1268,9 +1300,8 @@ trait TwitterListClient {
*/
def removeListMembersIdsBySlugAndOwnerId(slug: String, owner_id: Long, members_ids: Seq[Long]): Future[Unit] = {
require(members_ids.nonEmpty, "please, provide at least one user id")
- val parameters = RemoveMembersParameters(slug = Some(slug),
- owner_id = Some(owner_id),
- user_id = Some(members_ids.mkString(",")))
+ val parameters =
+ RemoveMembersParameters(slug = Some(slug), owner_id = Some(owner_id), user_id = Some(members_ids.mkString(",")))
genericRemoveMembers(parameters)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/AddMemberParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/AddMemberParameters.scala
index 8ecfda5d..737fb3d3 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/AddMemberParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/AddMemberParameters.scala
@@ -3,8 +3,9 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class AddMemberParameters(list_id: Option[Long] = None,
- slug: Option[String] = None,
- user_id: Option[Long] = None,
- screen_name: Option[String] = None,
- owner_screen_name: Option[String] = None,
- owner_id: Option[Long] = None) extends Parameters
+ slug: Option[String] = None,
+ user_id: Option[Long] = None,
+ screen_name: Option[String] = None,
+ owner_screen_name: Option[String] = None,
+ owner_id: Option[Long] = None)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/CreateListParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/CreateListParameters.scala
index 43401f17..cfafa570 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/CreateListParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/CreateListParameters.scala
@@ -3,6 +3,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.entities.enums.Mode.Mode
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class CreateListParameters(name: String,
- mode: Mode,
- description: Option[String]) extends Parameters
+private[twitter4s] final case class CreateListParameters(name: String, mode: Mode, description: Option[String])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListMembersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListMembersParameters.scala
index 7f4914a1..8ad86fc8 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListMembersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListMembersParameters.scala
@@ -3,10 +3,11 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class ListMembersParameters(list_id: Option[Long] = None,
- slug: Option[String] = None,
- owner_screen_name: Option[String] = None,
- owner_id: Option[Long] = None,
- count: Int,
- cursor: Long,
- include_entities: Boolean,
- skip_status: Boolean) extends Parameters
+ slug: Option[String] = None,
+ owner_screen_name: Option[String] = None,
+ owner_id: Option[Long] = None,
+ count: Int,
+ cursor: Long,
+ include_entities: Boolean,
+ skip_status: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListParameters.scala
index 7e6e6544..4ec3760c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListParameters.scala
@@ -3,6 +3,7 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class ListParameters(list_id: Option[Long] = None,
- slug: Option[String] = None,
- owner_screen_name: Option[String] = None,
- owner_id: Option[Long] = None) extends Parameters
+ slug: Option[String] = None,
+ owner_screen_name: Option[String] = None,
+ owner_id: Option[Long] = None)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListTimelineParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListTimelineParameters.scala
index dbecf97d..4c6088ba 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListTimelineParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListTimelineParameters.scala
@@ -12,4 +12,5 @@ private[twitter4s] final case class ListTimelineParameters(list_id: Option[Long]
max_id: Option[Long] = None,
include_entities: Boolean,
include_rts: Boolean,
- tweet_mode: TweetMode) extends Parameters
+ tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListsParameters.scala
index ba578d95..97750a4a 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/ListsParameters.scala
@@ -3,5 +3,6 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class ListsParameters(user_id: Option[Long],
- screen_name: Option[String],
- reverse: Boolean) extends Parameters
+ screen_name: Option[String],
+ reverse: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MemberParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MemberParameters.scala
index d20117c7..d5ca7870 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MemberParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MemberParameters.scala
@@ -3,10 +3,11 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class MemberParameters(list_id: Option[Long] = None,
- slug: Option[String] = None,
- user_id: Option[Long] = None,
- screen_name: Option[String] = None,
- owner_screen_name: Option[String] = None,
- owner_id: Option[Long] = None,
- include_entities: Boolean,
- skip_status: Boolean) extends Parameters
+ slug: Option[String] = None,
+ user_id: Option[Long] = None,
+ screen_name: Option[String] = None,
+ owner_screen_name: Option[String] = None,
+ owner_id: Option[Long] = None,
+ include_entities: Boolean,
+ skip_status: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembersParameters.scala
index fdcdf578..11daaa3c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembersParameters.scala
@@ -3,8 +3,9 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class MembersParameters(list_id: Option[Long] = None,
- slug: Option[String] = None,
- user_id: Option[String] = None,
- screen_name: Option[String] = None,
- owner_screen_name: Option[String] = None,
- owner_id: Option[Long] = None) extends Parameters
+ slug: Option[String] = None,
+ user_id: Option[String] = None,
+ screen_name: Option[String] = None,
+ owner_screen_name: Option[String] = None,
+ owner_id: Option[Long] = None)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembershipsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembershipsParameters.scala
index 1ee87b05..c8cb851b 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembershipsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/MembershipsParameters.scala
@@ -3,7 +3,8 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class MembershipsParameters(user_id: Option[Long],
- screen_name: Option[String],
- count: Int,
- cursor: Long,
- filter_to_owned_lists: Boolean) extends Parameters
+ screen_name: Option[String],
+ count: Int,
+ cursor: Long,
+ filter_to_owned_lists: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/OwnershipsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/OwnershipsParameters.scala
index e64e06b9..1c4a6f01 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/OwnershipsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/OwnershipsParameters.scala
@@ -3,6 +3,7 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class OwnershipsParameters(user_id: Option[Long],
- screen_name: Option[String],
- count: Int,
- cursor: Long) extends Parameters
+ screen_name: Option[String],
+ count: Int,
+ cursor: Long)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMemberParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMemberParameters.scala
index 75cf2412..04aba0d5 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMemberParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMemberParameters.scala
@@ -3,8 +3,9 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class RemoveMemberParameters(list_id: Option[Long] = None,
- slug: Option[String] = None,
- user_id: Option[Long] = None,
- screen_name: Option[String] = None,
- owner_screen_name: Option[String] = None,
- owner_id: Option[Long] = None) extends Parameters
+ slug: Option[String] = None,
+ user_id: Option[Long] = None,
+ screen_name: Option[String] = None,
+ owner_screen_name: Option[String] = None,
+ owner_id: Option[Long] = None)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMembersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMembersParameters.scala
index 199211b0..a10d0dfa 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMembersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/RemoveMembersParameters.scala
@@ -3,8 +3,9 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class RemoveMembersParameters(list_id: Option[Long] = None,
- slug: Option[String] = None,
- user_id: Option[String] = None,
- screen_name: Option[String] = None,
- owner_screen_name: Option[String] = None,
- owner_id: Option[Long] = None) extends Parameters
+ slug: Option[String] = None,
+ user_id: Option[String] = None,
+ screen_name: Option[String] = None,
+ owner_screen_name: Option[String] = None,
+ owner_id: Option[Long] = None)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscribersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscribersParameters.scala
index 4eea97fd..049d8c81 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscribersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscribersParameters.scala
@@ -3,10 +3,11 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class SubscribersParameters(list_id: Option[Long],
- slug: Option[String],
- owner_screen_name: Option[String],
- owner_id: Option[Long],
- count: Int,
- cursor: Long,
- include_entities: Boolean,
- skip_status: Boolean) extends Parameters
+ slug: Option[String],
+ owner_screen_name: Option[String],
+ owner_id: Option[Long],
+ count: Int,
+ cursor: Long,
+ include_entities: Boolean,
+ skip_status: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscriptionsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscriptionsParameters.scala
index 903b5fdd..aaa8866d 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscriptionsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/SubscriptionsParameters.scala
@@ -3,6 +3,7 @@ package com.danielasfregola.twitter4s.http.clients.rest.lists.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class SubscriptionsParameters(user_id: Option[Long],
- screen_name: Option[String],
- count: Int,
- cursor: Long) extends Parameters
+ screen_name: Option[String],
+ count: Int,
+ cursor: Long)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/UpdateListParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/UpdateListParameters.scala
index f38d1467..e187699b 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/UpdateListParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/parameters/UpdateListParameters.scala
@@ -4,9 +4,10 @@ import com.danielasfregola.twitter4s.entities.enums.Mode.Mode
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class UpdateListParameters(list_id: Option[Long],
- slug: Option[String],
- owner_screen_name: Option[String],
- owner_id: Option[Long],
- description: Option[String],
- name: Option[String],
- mode: Option[Mode]) extends Parameters
+ slug: Option[String],
+ owner_screen_name: Option[String],
+ owner_id: Option[Long],
+ description: Option[String],
+ name: Option[String],
+ mode: Option[Mode])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClient.scala
index e2fb52ac..622a7bb2 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClient.scala
@@ -26,7 +26,7 @@ trait TwitterMediaClient {
private val mediaUrl = s"$mediaTwitterUrl/$twitterVersion/media"
- private val chunkSize = 5 * 1024 * 1024 // 5 MB
+ private val chunkSize = 5 * 1024 * 1024 // 5 MB
private val mediaReader = new MediaReader(chunkSize)
/** Uploads media asynchronously from an absolute file path.
@@ -81,10 +81,18 @@ trait TwitterMediaClient {
* Up to 100 additional owners may be specified.
* @return : The media details
* */
- def uploadMediaFromInputStream(inputStream: InputStream, size: Long, media_type: MediaType, filename: Option[String] = None, additional_owners: Seq[Long] = Seq.empty): Future[MediaDetails] =
+ def uploadMediaFromInputStream(inputStream: InputStream,
+ size: Long,
+ media_type: MediaType,
+ filename: Option[String] = None,
+ additional_owners: Seq[Long] = Seq.empty): Future[MediaDetails] =
uploadMediaFromInputStream(inputStream, size, media_type.value, filename, additional_owners)
- private def uploadMediaFromInputStream(inputStream: InputStream, size: Long, media_type: String, filename: Option[String], additional_owners: Seq[Long]): Future[MediaDetails] = {
+ private def uploadMediaFromInputStream(inputStream: InputStream,
+ size: Long,
+ media_type: String,
+ filename: Option[String],
+ additional_owners: Seq[Long]): Future[MediaDetails] = {
def filenameBuilder(mediaId: Long) = {
val extension = media_type.split("/", 2)
filename.getOrElse(s"twitter4s-$mediaId.$extension")
@@ -102,30 +110,29 @@ trait TwitterMediaClient {
response
}
- private def initMedia(size: Long,
- media_type: String,
- additional_owners: Seq[Long]): Future[MediaDetails] = {
+ private def initMedia(size: Long, media_type: String, additional_owners: Seq[Long]): Future[MediaDetails] = {
import restClient._
val parameters = MediaInitParameters(size, media_type.toAscii, Some(additional_owners.mkString(",")))
Post(s"$mediaUrl/upload.json", parameters).respondAs[MediaDetails]
}
- private def appendMedia(mediaId: Long, inputStream: InputStream, filename: String)
- (implicit ec: ExecutionContext): Future[Seq[Unit]] = {
- val appendMediaById = appendMediaChunk(mediaId, filename)_
+ private def appendMedia(mediaId: Long, inputStream: InputStream, filename: String)(
+ implicit ec: ExecutionContext): Future[Seq[Unit]] = {
+ val appendMediaById = appendMediaChunk(mediaId, filename) _
Future.sequence(mediaReader.processAsChunks(inputStream, appendMediaById))
}
- private def appendMediaChunk(mediaId: Long, filename: String)(chunk: Chunk, idx: Int)
- (implicit ec: ExecutionContext): Future[Unit] = {
+ private def appendMediaChunk(mediaId: Long, filename: String)(chunk: Chunk, idx: Int)(
+ implicit ec: ExecutionContext): Future[Unit] = {
import restClient._
val formData: FormData = FormData(
- Source(List(
- FormData.BodyPart.Strict("command", "APPEND"),
- FormData.BodyPart.Strict("media_id", mediaId.toString),
- FormData.BodyPart.Strict("segment_index", idx.toString),
- FormData.BodyPart.Strict("media_data", chunk.base64Data.mkString)
- )))
+ Source(
+ List(
+ FormData.BodyPart.Strict("command", "APPEND"),
+ FormData.BodyPart.Strict("media_id", mediaId.toString),
+ FormData.BodyPart.Strict("segment_index", idx.toString),
+ FormData.BodyPart.Strict("media_data", chunk.base64Data.mkString)
+ )))
Post(s"$mediaUrl/upload.json", formData).sendAsFormData
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaAppendParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaAppendParameters.scala
index 525bca46..0cc5a884 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaAppendParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaAppendParameters.scala
@@ -3,6 +3,7 @@ package com.danielasfregola.twitter4s.http.clients.rest.media.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class MediaAppendParameters(media_id: Long,
- segment_index: Int,
- media: String,
- command: String = "APPEND") extends Parameters
+ segment_index: Int,
+ media: String,
+ command: String = "APPEND")
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaFinalizeParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaFinalizeParameters.scala
index 87acbb39..243a82ba 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaFinalizeParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaFinalizeParameters.scala
@@ -2,4 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.media.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class MediaFinalizeParameters(media_id: Long, command: String = "FINALIZE") extends Parameters
+private[twitter4s] final case class MediaFinalizeParameters(media_id: Long, command: String = "FINALIZE")
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaInitParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaInitParameters.scala
index 2d954c68..eca36a11 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaInitParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/media/parameters/MediaInitParameters.scala
@@ -3,6 +3,7 @@ package com.danielasfregola.twitter4s.http.clients.rest.media.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class MediaInitParameters(total_bytes: Long,
- media_type: String,
- additional_owners: Option[String],
- command: String = "INIT") extends Parameters
+ media_type: String,
+ additional_owners: Option[String],
+ command: String = "INIT")
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClient.scala
index fc74b3b2..268cee67 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClient.scala
@@ -2,7 +2,11 @@ package com.danielasfregola.twitter4s.http.clients.rest.mutes
import com.danielasfregola.twitter4s.entities.{RatedData, User, UserIds, Users}
import com.danielasfregola.twitter4s.http.clients.rest.RestClient
-import com.danielasfregola.twitter4s.http.clients.rest.mutes.parameters.{MuteParameters, MutedUsersIdsParameters, MutedUsersParameters}
+import com.danielasfregola.twitter4s.http.clients.rest.mutes.parameters.{
+ MuteParameters,
+ MutedUsersIdsParameters,
+ MutedUsersParameters
+}
import com.danielasfregola.twitter4s.util.Configurations._
import scala.concurrent.Future
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MuteParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MuteParameters.scala
index f5613aab..e3319f98 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MuteParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MuteParameters.scala
@@ -2,5 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.mutes.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class MuteParameters(user_id: Option[Long],
- screen_name: Option[String]) extends Parameters
+private[twitter4s] final case class MuteParameters(user_id: Option[Long], screen_name: Option[String])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MutedUsersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MutedUsersParameters.scala
index 5442efcd..0c53c33f 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MutedUsersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/parameters/MutedUsersParameters.scala
@@ -2,6 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.mutes.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class MutedUsersParameters(cursor: Long,
- include_entities: Boolean,
- skip_status: Boolean) extends Parameters
+private[twitter4s] final case class MutedUsersParameters(cursor: Long, include_entities: Boolean, skip_status: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClient.scala
index 25b85c56..3e33d466 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClient.scala
@@ -67,5 +67,5 @@ trait TwitterSavedSearchClient {
import restClient._
Get(s"$savedSearchUrl/show/$id.json").respondAsRated[SavedSearch]
}
-
+
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClient.scala
index 1a5bec22..f7a5a1f1 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClient.scala
@@ -81,8 +81,18 @@ trait TwitterSearchClient {
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[StatusSearch]] = {
import restClient._
val parameters = TweetSearchParameters(
- query.escapeSpecialChars, count, include_entities, result_type, geocode,
- language, locale, until, since_id, max_id, callback, tweet_mode
+ query.escapeSpecialChars,
+ count,
+ include_entities,
+ result_type,
+ geocode,
+ language,
+ locale,
+ until,
+ since_id,
+ max_id,
+ callback,
+ tweet_mode
)
Get(s"$searchUrl/tweets.json", parameters).respondAsRated[StatusSearch]
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/parameters/TweetSearchParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/parameters/TweetSearchParameters.scala
index 8ab4bff3..215570ab 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/parameters/TweetSearchParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/search/parameters/TweetSearchParameters.scala
@@ -19,4 +19,5 @@ private[twitter4s] final case class TweetSearchParameters(q: String,
since_id: Option[Long],
max_id: Option[Long],
callback: Option[String],
- tweet_mode: TweetMode) extends Parameters
+ tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClient.scala
index 12580867..91f1eb16 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClient.scala
@@ -56,7 +56,8 @@ trait TwitterStatusClient {
include_entities: Boolean = true,
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
import restClient._
- val parameters = MentionsParameters(count, since_id, max_id, trim_user, contributor_details, include_entities, tweet_mode)
+ val parameters =
+ MentionsParameters(count, since_id, max_id, trim_user, contributor_details, include_entities, tweet_mode)
Get(s"$statusesUrl/mentions_timeline.json", parameters).respondAsRated[Seq[Tweet]]
}
@@ -107,8 +108,16 @@ trait TwitterStatusClient {
include_rts: Boolean = true,
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
val parameters = UserTimelineParameters(
- user_id = None, Some(screen_name), since_id, count, max_id, trim_user,
- exclude_replies, contributor_details, include_rts, tweet_mode
+ user_id = None,
+ Some(screen_name),
+ since_id,
+ count,
+ max_id,
+ trim_user,
+ exclude_replies,
+ contributor_details,
+ include_rts,
+ tweet_mode
)
genericGetUserTimeline(parameters)
}
@@ -160,8 +169,16 @@ trait TwitterStatusClient {
include_rts: Boolean = true,
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
val parameters = UserTimelineParameters(
- Some(user_id), None, since_id, count, max_id, trim_user,
- exclude_replies, contributor_details, include_rts, tweet_mode
+ Some(user_id),
+ None,
+ since_id,
+ count,
+ max_id,
+ trim_user,
+ exclude_replies,
+ contributor_details,
+ include_rts,
+ tweet_mode
)
genericGetUserTimeline(parameters)
}
@@ -213,8 +230,14 @@ trait TwitterStatusClient {
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
import restClient._
val parameters = HomeTimelineParameters(
- count, since_id, max_id, trim_user, exclude_replies,
- contributor_details, include_entities, tweet_mode
+ count,
+ since_id,
+ max_id,
+ trim_user,
+ exclude_replies,
+ contributor_details,
+ include_entities,
+ tweet_mode
)
Get(s"$statusesUrl/home_timeline.json", parameters).respondAsRated[Seq[Tweet]]
}
@@ -257,8 +280,14 @@ trait TwitterStatusClient {
tweet_mode: TweetMode = TweetMode.Classic): Future[RatedData[Seq[Tweet]]] = {
import restClient._
val parameters = RetweetsOfMeParameters(
- count, since_id, max_id, trim_user, exclude_replies,
- contributor_details, include_entities, tweet_mode
+ count,
+ since_id,
+ max_id,
+ trim_user,
+ exclude_replies,
+ contributor_details,
+ include_entities,
+ tweet_mode
)
Get(s"$statusesUrl/retweets_of_me.json", parameters).respondAsRated[Seq[Tweet]]
}
@@ -314,7 +343,6 @@ trait TwitterStatusClient {
Get(s"$statusesUrl/show.json", parameters).respondAsRated[Tweet]
}
-
/** Destroys the status specified by the required ID parameter.
* The authenticating user must be the author of the specified status.
* Returns the destroyed status if successful.
@@ -330,9 +358,7 @@ trait TwitterStatusClient {
* When set to `Extended` prevents tweet text truncating, see https://developer.twitter.com/en/docs/tweets/tweet-updates
* @return : The representation of the deleted tweet.
*/
- def deleteTweet(id: Long,
- trim_user: Boolean = false,
- tweet_mode: TweetMode = TweetMode.Classic): Future[Tweet] = {
+ def deleteTweet(id: Long, trim_user: Boolean = false, tweet_mode: TweetMode = TweetMode.Classic): Future[Tweet] = {
import restClient._
val parameters = PostParameters(trim_user, tweet_mode)
Post(s"$statusesUrl/destroy/$id.json", parameters).respondAs[Tweet]
@@ -383,7 +409,15 @@ trait TwitterStatusClient {
trim_user: Boolean = false,
media_ids: Seq[Long] = Seq.empty): Future[Tweet] = {
import restClient._
- val entity = TweetUpdate(status, in_reply_to_status_id, possibly_sensitive, latitude, longitude, place_id, display_coordinates, trim_user, media_ids)
+ val entity = TweetUpdate(status,
+ in_reply_to_status_id,
+ possibly_sensitive,
+ latitude,
+ longitude,
+ place_id,
+ display_coordinates,
+ trim_user,
+ media_ids)
Post(s"$statusesUrl/update.json", entity).respondAs[Tweet]
}
@@ -431,7 +465,15 @@ trait TwitterStatusClient {
trim_user: Boolean = false,
media_ids: Seq[Long] = Seq.empty): Future[Tweet] = {
val directMessage = s"D $screen_name $message"
- createTweet(directMessage, in_reply_to_status_id, possibly_sensitive, latitude, longitude, place_id, display_coordinates, trim_user, media_ids)
+ createTweet(directMessage,
+ in_reply_to_status_id,
+ possibly_sensitive,
+ latitude,
+ longitude,
+ place_id,
+ display_coordinates,
+ trim_user,
+ media_ids)
}
/** Retweets a tweet. Returns the original tweet with retweet details embedded.
@@ -447,9 +489,7 @@ trait TwitterStatusClient {
* When set to `Extended` prevents tweet text truncating, see https://developer.twitter.com/en/docs/tweets/tweet-updates
* @return : The representation of the original tweet with retweet details embedded.
*/
- def retweet(id: Long,
- trim_user: Boolean = false,
- tweet_mode: TweetMode = TweetMode.Classic): Future[Tweet] = {
+ def retweet(id: Long, trim_user: Boolean = false, tweet_mode: TweetMode = TweetMode.Classic): Future[Tweet] = {
import restClient._
val parameters = PostParameters(trim_user, tweet_mode)
Post(s"$statusesUrl/retweet/$id.json", parameters).respondAs[Tweet]
@@ -501,7 +541,17 @@ trait TwitterStatusClient {
related: Seq[String] = Seq.empty,
language: Language = Language.English,
widget_type: Option[WidgetType] = None): Future[RatedData[OEmbedTweet]] = {
- val parameters = OEmbedParameters(Some(id), url = None, max_width, hide_media, hide_thread, omit_script, alignment, related, language, widget_type, hide_tweet)
+ val parameters = OEmbedParameters(Some(id),
+ url = None,
+ max_width,
+ hide_media,
+ hide_thread,
+ omit_script,
+ alignment,
+ related,
+ language,
+ widget_type,
+ hide_tweet)
genericGetOembeddedTweet(parameters)
}
@@ -551,7 +601,17 @@ trait TwitterStatusClient {
related: Seq[String] = Seq.empty,
language: Language = Language.English,
widget_type: Option[WidgetType] = None): Future[RatedData[OEmbedTweet]] = {
- val parameters = OEmbedParameters(id = None, Some(url), max_width, hide_media, hide_thread, omit_script, alignment, related, language, widget_type, hide_tweet)
+ val parameters = OEmbedParameters(id = None,
+ Some(url),
+ max_width,
+ hide_media,
+ hide_thread,
+ omit_script,
+ alignment,
+ related,
+ language,
+ widget_type,
+ hide_tweet)
genericGetOembeddedTweet(parameters)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParameters.scala
index 4e5fd438..44ee609c 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParameters.scala
@@ -10,4 +10,5 @@ private[twitter4s] final case class HomeTimelineParameters(count: Int,
exclude_replies: Boolean,
contributor_details: Boolean,
include_entities: Boolean,
- tweet_mode: TweetMode) extends Parameters
+ tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/LookupParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/LookupParameters.scala
index 8f1e9400..cee17594 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/LookupParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/LookupParameters.scala
@@ -3,6 +3,7 @@ package com.danielasfregola.twitter4s.http.clients.rest.statuses.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class LookupParameters(id: String,
- include_entities: Boolean,
- trim_user: Boolean,
- map: Boolean) extends Parameters
+ include_entities: Boolean,
+ trim_user: Boolean,
+ map: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParameters.scala
index d1524822..86a40f5a 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParameters.scala
@@ -9,4 +9,5 @@ private[twitter4s] final case class MentionsParameters(count: Int,
trim_user: Boolean,
contributor_details: Boolean,
include_entities: Boolean,
- tweet_mode: TweetMode) extends Parameters
+ tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/OEmbedParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/OEmbedParameters.scala
index 063c2584..d4a1e662 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/OEmbedParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/OEmbedParameters.scala
@@ -6,13 +6,14 @@ import com.danielasfregola.twitter4s.entities.enums.WidgetType.WidgetType
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class OEmbedParameters(id: Option[Long],
- url: Option[String],
- maxwidth: Option[Int],
- hide_media: Boolean,
- hide_thread: Boolean,
- omit_script: Boolean,
- align: Alignment,
- related: Seq[String],
- lang: Language,
- widget_type: Option[WidgetType],
- hide_tweet: Boolean = false) extends Parameters
+ url: Option[String],
+ maxwidth: Option[Int],
+ hide_media: Boolean,
+ hide_thread: Boolean,
+ omit_script: Boolean,
+ align: Alignment,
+ related: Seq[String],
+ lang: Language,
+ widget_type: Option[WidgetType],
+ hide_tweet: Boolean = false)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParameters.scala
index bcf3812b..474239b0 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParameters.scala
@@ -3,5 +3,4 @@ package com.danielasfregola.twitter4s.http.clients.rest.statuses.parameters
import com.danielasfregola.twitter4s.entities.enums.TweetMode.TweetMode
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class PostParameters(trim_user: Boolean,
- tweet_mode: TweetMode) extends Parameters
+private[twitter4s] final case class PostParameters(trim_user: Boolean, tweet_mode: TweetMode) extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetersIdsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetersIdsParameters.scala
index ef69acbf..f74112c5 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetersIdsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetersIdsParameters.scala
@@ -2,7 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.statuses.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class RetweetersIdsParameters(id: Long,
- count: Int,
- cursor: Long,
- stringify_ids: Boolean) extends Parameters
+private[twitter4s] final case class RetweetersIdsParameters(id: Long, count: Int, cursor: Long, stringify_ids: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParameters.scala
index 39497a4e..ae185ae7 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParameters.scala
@@ -10,4 +10,5 @@ private[twitter4s] final case class RetweetsOfMeParameters(count: Int,
exclude_replies: Boolean,
contributor_details: Boolean,
include_entities: Boolean,
- tweet_mode: TweetMode) extends Parameters
+ tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParameters.scala
index eea7a518..28ea8068 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParameters.scala
@@ -3,6 +3,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.statuses.parameters
import com.danielasfregola.twitter4s.entities.enums.TweetMode.TweetMode
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class RetweetsParameters(count: Int,
- trim_user: Boolean,
- tweet_mode: TweetMode) extends Parameters
+private[twitter4s] final case class RetweetsParameters(count: Int, trim_user: Boolean, tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParameters.scala
index 4d80f08e..f3998462 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParameters.scala
@@ -7,4 +7,5 @@ private[twitter4s] final case class ShowParameters(id: Long,
trim_user: Boolean,
include_my_retweet: Boolean,
include_entities: Boolean,
- tweet_mode: TweetMode) extends Parameters
+ tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParameters.scala
index 3990bee9..b1549553 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParameters.scala
@@ -12,4 +12,5 @@ private[twitter4s] final case class UserTimelineParameters(user_id: Option[Long]
exclude_replies: Boolean,
contributor_details: Boolean,
include_rts: Boolean,
- tweet_mode: TweetMode) extends Parameters
+ tweet_mode: TweetMode)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClient.scala
index cf9764c7..a5c1c6f3 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClient.scala
@@ -28,7 +28,7 @@ trait TwitterSuggestionClient {
* Restricts the suggested categories to the requested language.
* @return : The representation of the user suggestions.
*/
- def suggestions(slug: String, language: Language = Language.English): Future[RatedData[Suggestions]]= {
+ def suggestions(slug: String, language: Language = Language.English): Future[RatedData[Suggestions]] = {
import restClient._
val parameters = SuggestionsParameters(language)
Get(s"$suggestionsUrl/$slug.json", parameters).respondAsRated[Suggestions]
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClient.scala
index 4dda8798..6e0a3752 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClient.scala
@@ -26,7 +26,8 @@ trait TwitterTrendClient {
* Setting this to `true` will remove all hashtags from the trends list.
* @return : The representation of the location trends.
*/
- def globalTrends(exclude_hashtags: Boolean = false): Future[RatedData[Seq[LocationTrends]]] = trends(1, exclude_hashtags)
+ def globalTrends(exclude_hashtags: Boolean = false): Future[RatedData[Seq[LocationTrends]]] =
+ trends(1, exclude_hashtags)
/** Returns the top 10 trending topics for a specific WOEID, if trending information is available for it.
* The response is an array of “trend” objects that encode the name of the trending topic, the query parameter that can be used to search for the topic on Twitter Search, and the Twitter Search URL.
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClient.scala
index 5a08f0f7..dbc8223b 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClient.scala
@@ -2,7 +2,12 @@ package com.danielasfregola.twitter4s.http.clients.rest.users
import com.danielasfregola.twitter4s.entities.{Banners, RatedData, User}
import com.danielasfregola.twitter4s.http.clients.rest.RestClient
-import com.danielasfregola.twitter4s.http.clients.rest.users.parameters.{BannersParameters, UserParameters, UserSearchParameters, UsersParameters}
+import com.danielasfregola.twitter4s.http.clients.rest.users.parameters.{
+ BannersParameters,
+ UserParameters,
+ UserSearchParameters,
+ UsersParameters
+}
import com.danielasfregola.twitter4s.util.Configurations._
import scala.concurrent.Future
@@ -35,8 +40,7 @@ trait TwitterUserClient {
* The parameters node that may appear within embedded statuses will be disincluded when set to `false`.
* @return : The sequence of user representations.
*/
- def users(screen_names: Seq[String],
- include_entities: Boolean = true): Future[RatedData[Seq[User]]] = {
+ def users(screen_names: Seq[String], include_entities: Boolean = true): Future[RatedData[Seq[User]]] = {
require(screen_names.nonEmpty, "please, provide at least one screen name")
val parameters = UsersParameters(user_id = None, Some(screen_names.mkString(",")), include_entities)
genericGetUsers(parameters)
@@ -62,8 +66,7 @@ trait TwitterUserClient {
* The parameters node that may appear within embedded statuses will be disincluded when set to `false`.
* @return : The sequence of user representations.
*/
- def usersByIds(ids: Seq[Long],
- include_entities: Boolean = true): Future[RatedData[Seq[User]]] = {
+ def usersByIds(ids: Seq[Long], include_entities: Boolean = true): Future[RatedData[Seq[User]]] = {
require(ids.nonEmpty, "please, provide at least one user id")
val parameters = UsersParameters(Some(ids.mkString(",")), screen_name = None, include_entities)
genericGetUsers(parameters)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/BannersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/BannersParameters.scala
index 160624db..5a6cfcdb 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/BannersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/BannersParameters.scala
@@ -2,5 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.users.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class BannersParameters(user_id: Option[Long],
- screen_name: Option[String]) extends Parameters
+private[twitter4s] final case class BannersParameters(user_id: Option[Long], screen_name: Option[String])
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserParameters.scala
index 525cb77b..a8f78ba8 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserParameters.scala
@@ -3,5 +3,6 @@ package com.danielasfregola.twitter4s.http.clients.rest.users.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class UserParameters(user_id: Option[Long],
- screen_name: Option[String],
- include_entities: Boolean) extends Parameters
+ screen_name: Option[String],
+ include_entities: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserSearchParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserSearchParameters.scala
index 5482382f..8a020b83 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserSearchParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UserSearchParameters.scala
@@ -2,7 +2,5 @@ package com.danielasfregola.twitter4s.http.clients.rest.users.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
-private[twitter4s] final case class UserSearchParameters(q: String,
- page: Int,
- count: Int,
- include_entities: Boolean) extends Parameters
+private[twitter4s] final case class UserSearchParameters(q: String, page: Int, count: Int, include_entities: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UsersParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UsersParameters.scala
index 216c5e1b..6da4c90a 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UsersParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/rest/users/parameters/UsersParameters.scala
@@ -3,5 +3,6 @@ package com.danielasfregola.twitter4s.http.clients.rest.users.parameters
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class UsersParameters(user_id: Option[String],
- screen_name: Option[String],
- include_entities: Boolean) extends Parameters
+ screen_name: Option[String],
+ include_entities: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClient.scala
index 08aa826e..7b70cf43 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClient.scala
@@ -17,7 +17,8 @@ import org.json4s.native.Serialization
import scala.concurrent.Future
import scala.util.{Failure, Success, Try}
-private[twitter4s] class StreamingClient(val consumerToken: ConsumerToken, val accessToken: AccessToken) extends OAuthClient {
+private[twitter4s] class StreamingClient(val consumerToken: ConsumerToken, val accessToken: AccessToken)
+ extends OAuthClient {
val withLogRequest = true
val withLogRequestResponse = false
@@ -28,7 +29,7 @@ private[twitter4s] class StreamingClient(val consumerToken: ConsumerToken, val a
private[twitter4s] implicit class RichStreamingHttpRequest(val request: HttpRequest) {
- def processStream[T <: StreamingMessage : Manifest](f: PartialFunction[T, Unit]): Future[TwitterStream] = {
+ def processStream[T <: StreamingMessage: Manifest](f: PartialFunction[T, Unit]): Future[TwitterStream] = {
implicit val system = ActorSystem(s"twitter4s-streaming-${UUID.randomUUID}")
implicit val materializer = ActorMaterializer()
implicit val ec = materializer.executionContext
@@ -42,8 +43,9 @@ private[twitter4s] class StreamingClient(val consumerToken: ConsumerToken, val a
private val maxConnectionTimeMillis = 1000
// TODO - can we do better?
- private def processOrFailStreamRequest[T <: StreamingMessage: Manifest](request: HttpRequest)(f: PartialFunction[T, Unit])
- (implicit system: ActorSystem, materializer: Materializer): Future[SharedKillSwitch] = {
+ private def processOrFailStreamRequest[T <: StreamingMessage: Manifest](request: HttpRequest)(
+ f: PartialFunction[T, Unit])(implicit system: ActorSystem,
+ materializer: Materializer): Future[SharedKillSwitch] = {
implicit val ec = materializer.executionContext
val killSwitch = KillSwitches.shared(s"twitter4s-${UUID.randomUUID}")
val processing = processStreamRequest(request, killSwitch)(f)
@@ -51,14 +53,17 @@ private[twitter4s] class StreamingClient(val consumerToken: ConsumerToken, val a
Future.firstCompletedOf(Seq(processing, switch))
}
- protected def processStreamRequest[T <: StreamingMessage: Manifest](request: HttpRequest, killSwitch: SharedKillSwitch)
- (f: PartialFunction[T, Unit])
- (implicit system: ActorSystem, materializer: Materializer): Future[SharedKillSwitch] = {
+ protected def processStreamRequest[T <: StreamingMessage: Manifest](
+ request: HttpRequest,
+ killSwitch: SharedKillSwitch)(f: PartialFunction[T, Unit])(
+ implicit system: ActorSystem,
+ materializer: Materializer): Future[SharedKillSwitch] = {
implicit val ec = materializer.executionContext
implicit val rqt = request
if (withLogRequest) logRequest
- Source.single(request)
+ Source
+ .single(request)
.via(connection)
.flatMapConcat {
case response if response.status.isSuccess =>
@@ -74,9 +79,8 @@ private[twitter4s] class StreamingClient(val consumerToken: ConsumerToken, val a
.map(_ => killSwitch)
}
- def processBody[T: Manifest](response: HttpResponse, killSwitch: SharedKillSwitch)
- (f: PartialFunction[T, Unit])
- (implicit request: HttpRequest, materializer: Materializer): Unit =
+ def processBody[T: Manifest](response: HttpResponse, killSwitch: SharedKillSwitch)(
+ f: PartialFunction[T, Unit])(implicit request: HttpRequest, materializer: Materializer): Unit =
response.entity.withoutSizeLimit.dataBytes
.via(Framing.delimiter(ByteString("\r\n"), Int.MaxValue).async)
.filter(_.nonEmpty)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStream.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStream.scala
index c1fb9235..8eb88e45 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStream.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStream.scala
@@ -12,10 +12,12 @@ import scala.concurrent.{ExecutionContext, Future}
/** Represents a twitter stream operation. It can be used to close the stream on demand
* or to replace the current stream with another twitter stream.
*/
-final case class TwitterStream(consumerToken: ConsumerToken, accessToken: AccessToken)
- (private val killSwitch: KillSwitch,
- private val request: HttpRequest,
- private val system: ActorSystem) extends StreamingClients with LazyLogging {
+final case class TwitterStream(consumerToken: ConsumerToken, accessToken: AccessToken)(
+ private val killSwitch: KillSwitch,
+ private val request: HttpRequest,
+ private val system: ActorSystem)
+ extends StreamingClients
+ with LazyLogging {
implicit private val ec: ExecutionContext = system.dispatcher
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClient.scala
index 27edeff9..563aa581 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClient.scala
@@ -46,12 +46,13 @@ trait TwitterSiteClient {
* @param stall_warnings : Default to false. Specifies whether stall warnings (`WarningMessage`) should be delivered as part of the updates.
* @param f : Function that defines how to process the received messages.
*/
- def siteEvents(follow: Seq[Long] = Seq.empty,
- `with`: WithFilter = WithFilter.User,
- replies: Option[Boolean] = None,
- stringify_friend_ids: Boolean = false,
- languages: Seq[Language] = Seq.empty,
- stall_warnings: Boolean = false)(f: PartialFunction[SiteStreamingMessage, Unit]): Future[TwitterStream] = {
+ def siteEvents(
+ follow: Seq[Long] = Seq.empty,
+ `with`: WithFilter = WithFilter.User,
+ replies: Option[Boolean] = None,
+ stringify_friend_ids: Boolean = false,
+ languages: Seq[Language] = Seq.empty,
+ stall_warnings: Boolean = false)(f: PartialFunction[SiteStreamingMessage, Unit]): Future[TwitterStream] = {
import streamingClient._
val repliesAll = replies.flatMap(x => if (x) Some("all") else None)
val parameters = SiteParameters(follow, `with`, repliesAll, stringify_friend_ids, languages, stall_warnings)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/parameters/SiteParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/parameters/SiteParameters.scala
index 02f6c43e..fb863b92 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/parameters/SiteParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/parameters/SiteParameters.scala
@@ -5,8 +5,9 @@ import com.danielasfregola.twitter4s.entities.enums.WithFilter.WithFilter
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class SiteParameters(follow: Seq[Long],
- `with`: WithFilter,
- replies: Option[String],
- stringify_friend_ids: Boolean,
- language: Seq[Language],
- stall_warnings: Boolean) extends Parameters
+ `with`: WithFilter,
+ replies: Option[String],
+ stringify_friend_ids: Boolean,
+ language: Seq[Language],
+ stall_warnings: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClient.scala
index 927fee7d..5a2ab05f 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClient.scala
@@ -51,9 +51,11 @@ trait TwitterStatusClient {
locations: Seq[Double] = Seq.empty,
languages: Seq[Language] = Seq.empty,
stall_warnings: Boolean = false,
- filter_level: FilterLevel = FilterLevel.None)(f: PartialFunction[CommonStreamingMessage, Unit]): Future[TwitterStream] = {
+ filter_level: FilterLevel = FilterLevel.None)(
+ f: PartialFunction[CommonStreamingMessage, Unit]): Future[TwitterStream] = {
import streamingClient._
- require(follow.nonEmpty || tracks.nonEmpty || locations.nonEmpty, "At least one of 'follow', 'tracks' or 'locations' needs to be non empty")
+ require(follow.nonEmpty || tracks.nonEmpty || locations.nonEmpty,
+ "At least one of 'follow', 'tracks' or 'locations' needs to be non empty")
val filters = StatusFilters(follow, tracks, locations, languages, stall_warnings, filter_level)
preProcessing()
Post(s"$statusUrl/filter.json", filters).processStream(f)
@@ -84,8 +86,8 @@ trait TwitterStatusClient {
def sampleStatuses(languages: Seq[Language] = Seq.empty,
stall_warnings: Boolean = false,
tracks: Seq[String] = Seq.empty,
- filter_level: FilterLevel = FilterLevel.None)
- (f: PartialFunction[CommonStreamingMessage, Unit]): Future[TwitterStream] = {
+ filter_level: FilterLevel = FilterLevel.None)(
+ f: PartialFunction[CommonStreamingMessage, Unit]): Future[TwitterStream] = {
import streamingClient._
val parameters = StatusSampleParameters(languages, stall_warnings, tracks, filter_level)
preProcessing()
@@ -111,10 +113,10 @@ trait TwitterStatusClient {
* @param stall_warnings : Default to false. Specifies whether stall warnings (`WarningMessage`) should be delivered as part of the updates.
* @param f : Function that defines how to process the received messages.
*/
- def firehoseStatuses(count: Option[Int] = None,
- languages: Seq[Language] = Seq.empty,
- stall_warnings: Boolean = false)
- (f: PartialFunction[CommonStreamingMessage, Unit]): Future[TwitterStream] = {
+ def firehoseStatuses(
+ count: Option[Int] = None,
+ languages: Seq[Language] = Seq.empty,
+ stall_warnings: Boolean = false)(f: PartialFunction[CommonStreamingMessage, Unit]): Future[TwitterStream] = {
import streamingClient._
val maxCount = 150000
require(Math.abs(count.getOrElse(0)) <= maxCount, s"count must be between -$maxCount and +$maxCount")
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFilters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFilters.scala
index 36af0029..157c9e92 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFilters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFilters.scala
@@ -4,8 +4,8 @@ import com.danielasfregola.twitter4s.entities.enums.FilterLevel.FilterLevel
import com.danielasfregola.twitter4s.entities.enums.Language.Language
private[twitter4s] final case class StatusFilters(follow: Seq[Long],
- track: Seq[String],
- locations: Seq[Double],
- language: Seq[Language],
- stall_warnings: Boolean,
- filter_level: FilterLevel)
+ track: Seq[String],
+ locations: Seq[Double],
+ language: Seq[Language],
+ stall_warnings: Boolean,
+ filter_level: FilterLevel)
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFirehoseParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFirehoseParameters.scala
index 9c89133f..8bedeedd 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFirehoseParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusFirehoseParameters.scala
@@ -4,5 +4,6 @@ import com.danielasfregola.twitter4s.entities.enums.Language.Language
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class StatusFirehoseParameters(language: Seq[Language],
- count: Option[Int],
- stall_warnings: Boolean) extends Parameters
+ count: Option[Int],
+ stall_warnings: Boolean)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusSampleParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusSampleParameters.scala
index 5551385c..4483b0ca 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusSampleParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/parameters/StatusSampleParameters.scala
@@ -5,6 +5,7 @@ import com.danielasfregola.twitter4s.entities.enums.Language.Language
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class StatusSampleParameters(language: Seq[Language],
- stall_warnings: Boolean,
- tracks: Seq[String],
- filter_level: FilterLevel) extends Parameters
+ stall_warnings: Boolean,
+ tracks: Seq[String],
+ filter_level: FilterLevel)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClient.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClient.scala
index 748ca3c0..d5f29a06 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClient.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClient.scala
@@ -59,10 +59,18 @@ trait TwitterUserClient {
stringify_friend_ids: Boolean = false,
languages: Seq[Language] = Seq.empty,
stall_warnings: Boolean = false,
- filter_level: FilterLevel = FilterLevel.None)(f: PartialFunction[UserStreamingMessage, Unit]): Future[TwitterStream] = {
+ filter_level: FilterLevel = FilterLevel.None)(
+ f: PartialFunction[UserStreamingMessage, Unit]): Future[TwitterStream] = {
import streamingClient._
val repliesAll = replies.flatMap(x => if (x) Some("all") else None)
- val parameters = UserParameters(`with`, repliesAll, tracks, locations, stringify_friend_ids, languages, stall_warnings, filter_level)
+ val parameters = UserParameters(`with`,
+ repliesAll,
+ tracks,
+ locations,
+ stringify_friend_ids,
+ languages,
+ stall_warnings,
+ filter_level)
preProcessing()
Get(s"$userUrl/user.json", parameters).processStream(f)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/parameters/UserParameters.scala b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/parameters/UserParameters.scala
index f4346129..1ccb5035 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/parameters/UserParameters.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/parameters/UserParameters.scala
@@ -6,10 +6,11 @@ import com.danielasfregola.twitter4s.entities.enums.WithFilter.WithFilter
import com.danielasfregola.twitter4s.http.marshalling.Parameters
private[twitter4s] final case class UserParameters(`with`: WithFilter,
- replies: Option[String],
- track: Seq[String],
- locations: Seq[Double],
- stringify_friend_ids: Boolean,
- language: Seq[Language],
- stall_warnings: Boolean,
- filter_level: FilterLevel) extends Parameters
+ replies: Option[String],
+ track: Seq[String],
+ locations: Seq[Double],
+ stringify_friend_ids: Boolean,
+ language: Seq[Language],
+ stall_warnings: Boolean,
+ filter_level: FilterLevel)
+ extends Parameters
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoder.scala b/src/main/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoder.scala
index 31914af8..31fe6e79 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoder.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoder.scala
@@ -4,30 +4,40 @@ package marshalling
trait BodyEncoder {
def toBodyAsParams(cc: Product): String =
- toBodyAsMap(cc).map{ case (k, v) =>
- val key = k.replace("$colon", ":")
- s"$key=$v"
- }.toList.sorted.mkString("&")
+ toBodyAsMap(cc)
+ .map {
+ case (k, v) =>
+ val key = k.replace("$colon", ":")
+ s"$key=$v"
+ }
+ .toList
+ .sorted
+ .mkString("&")
def toBodyAsEncodedParams(cc: Product): String =
- toBodyAsMap(cc).map { case (k, v) =>
- val key = k.replace("$colon", ":")
- s"$key=${v.urlEncoded}"
- }.toList.sorted.mkString("&")
+ toBodyAsMap(cc)
+ .map {
+ case (k, v) =>
+ val key = k.replace("$colon", ":")
+ s"$key=${v.urlEncoded}"
+ }
+ .toList
+ .sorted
+ .mkString("&")
private def toBodyAsMap(cc: Product): Map[String, String] =
asMap(cc).flatMap {
- case (k, head :: tail) => Some(k -> (head +: tail).mkString(","))
- case (_, Nil) => None
- case (_, None) => None
+ case (k, head :: tail) => Some(k -> (head +: tail).mkString(","))
+ case (_, Nil) => None
+ case (_, None) => None
case (_, Some(v)) if v.toString.isEmpty => None
- case (k, Some(v)) => Some(k -> v.toString)
- case (k, v) if v.toString.isEmpty => None
- case (k, v) => Some(k -> v.toString)
+ case (k, Some(v)) => Some(k -> v.toString)
+ case (k, v) if v.toString.isEmpty => None
+ case (k, v) => Some(k -> v.toString)
}
// TODO - improve performance with Macros?
private def asMap(cc: Product): Map[String, Any] =
- cc.getClass.getDeclaredFields.map( _.getName ).zip( cc.productIterator.to ).toMap
+ cc.getClass.getDeclaredFields.map(_.getName).zip(cc.productIterator.to).toMap
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2Provider.scala b/src/main/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2Provider.scala
index aadb3b54..23a662cc 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2Provider.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2Provider.scala
@@ -11,9 +11,12 @@ import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util.Random
-private[twitter4s] class OAuth2Provider(consumerToken: ConsumerToken, accessToken: Option[AccessToken]) extends Encoder with UriHelpers {
+private[twitter4s] class OAuth2Provider(consumerToken: ConsumerToken, accessToken: Option[AccessToken])
+ extends Encoder
+ with UriHelpers {
- def oauth2Header(callback: Option[String])(implicit request: HttpRequest, materializer: Materializer): Future[HttpHeader] = {
+ def oauth2Header(callback: Option[String])(implicit request: HttpRequest,
+ materializer: Materializer): Future[HttpHeader] = {
implicit val ec = materializer.executionContext
oauth2Params(callback).map { params =>
val authorizationValue = params.map { case (k, v) => s"""$k="$v"""" }.toList.sorted.mkString(", ")
@@ -21,7 +24,8 @@ private[twitter4s] class OAuth2Provider(consumerToken: ConsumerToken, accessToke
}
}
- def oauth2Params(callback: Option[String])(implicit request: HttpRequest, materializer: Materializer): Future[Map[String, String]] = {
+ def oauth2Params(callback: Option[String])(implicit request: HttpRequest,
+ materializer: Materializer): Future[Map[String, String]] = {
implicit val ec = materializer.executionContext
val params = basicOAuth2Params(callback)
for {
@@ -62,9 +66,10 @@ private[twitter4s] class OAuth2Provider(consumerToken: ConsumerToken, accessToke
bodyParams.map { bdParams =>
val method = request.method.name.toAscii
val baseUrl = request.uri.endpoint.toAscii
- val oauthParams = oauth2Params.map { case (k,v) =>
- if (k == "oauth_callback") k -> v.toAscii
- else k -> v
+ val oauthParams = oauth2Params.map {
+ case (k, v) =>
+ if (k == "oauth_callback") k -> v.toAscii
+ else k -> v
}
val encodedParams = encodeParams(queryParams ++ oauthParams ++ bdParams).toAscii
s"$method&$baseUrl&$encodedParams"
@@ -90,7 +95,8 @@ private[twitter4s] class OAuth2Provider(consumerToken: ConsumerToken, accessToke
.map { key =>
val value = params(key)
s"$key=$value"
- }.mkString("&")
+ }
+ .mkString("&")
private def extractRequestBody(implicit request: HttpRequest, materializer: Materializer): Future[String] = {
implicit val ec = materializer.executionContext
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/CustomFormats.scala b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/CustomFormats.scala
index 8871f742..97531c9d 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/CustomFormats.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/CustomFormats.scala
@@ -15,30 +15,33 @@ object CustomFormats extends FormatsComposer {
}
-case object LocalDateSerializer extends CustomSerializer[LocalDate](format =>
- ( {
- case JString(dateString) =>
- dateString.split("-") match {
- case Array(year, month, date) => LocalDate.of(year.toInt, month.toInt, date.toInt)
- case _ => null
- }
- case JNull => null
- }, {
- case date: LocalDate => JString(date.toString)
- }))
-
-case object DisconnectionCodeSerializer extends CustomSerializer[DisconnectionCode](format =>
- ( {
- case JInt(n) => DisconnectionCode(n.toInt)
- case JNull => null
- }, {
- case code: DisconnectionCode => JInt(code.id)
- }))
-
-case object ProfileImageSerializer extends CustomSerializer[ProfileImage](format =>
- ( {
- case JString(n) => ProfileImage(n)
- case JNull => null
- }, {
- case img: ProfileImage => JString(img.normal)
- }))
+case object LocalDateSerializer
+ extends CustomSerializer[LocalDate](format =>
+ ({
+ case JString(dateString) =>
+ dateString.split("-") match {
+ case Array(year, month, date) => LocalDate.of(year.toInt, month.toInt, date.toInt)
+ case _ => null
+ }
+ case JNull => null
+ }, {
+ case date: LocalDate => JString(date.toString)
+ }))
+
+case object DisconnectionCodeSerializer
+ extends CustomSerializer[DisconnectionCode](format =>
+ ({
+ case JInt(n) => DisconnectionCode(n.toInt)
+ case JNull => null
+ }, {
+ case code: DisconnectionCode => JInt(code.id)
+ }))
+
+case object ProfileImageSerializer
+ extends CustomSerializer[ProfileImage](format =>
+ ({
+ case JString(n) => ProfileImage(n)
+ case JNull => null
+ }, {
+ case img: ProfileImage => JString(img.normal)
+ }))
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/EnumFormats.scala b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/EnumFormats.scala
index 79ddfa64..3a9bc4eb 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/EnumFormats.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/EnumFormats.scala
@@ -6,21 +6,22 @@ import org.json4s.ext.EnumNameSerializer
object EnumFormats extends FormatsComposer {
- override def compose(f: Formats): Formats = f +
- new EnumNameSerializer(Alignment) +
- new EnumNameSerializer(ContributorType) +
- new EnumNameSerializer(DisconnectionCode) +
- new EnumNameSerializer(SimpleEventCode) +
- new EnumNameSerializer(TweetEventCode) +
- new EnumNameSerializer(TwitterListEventCode) +
- new EnumNameSerializer(Granularity) +
- new EnumNameSerializer(Hour) +
- new EnumNameSerializer(Language) +
- new EnumNameSerializer(Measure) +
- new EnumNameSerializer(Mode) +
- new EnumNameSerializer(Resource) +
- new EnumNameSerializer(ResultType) +
- new EnumNameSerializer(TimeZone) +
- new EnumNameSerializer(WidgetType) +
- new EnumNameSerializer(WithFilter)
+ override def compose(f: Formats): Formats =
+ f +
+ new EnumNameSerializer(Alignment) +
+ new EnumNameSerializer(ContributorType) +
+ new EnumNameSerializer(DisconnectionCode) +
+ new EnumNameSerializer(SimpleEventCode) +
+ new EnumNameSerializer(TweetEventCode) +
+ new EnumNameSerializer(TwitterListEventCode) +
+ new EnumNameSerializer(Granularity) +
+ new EnumNameSerializer(Hour) +
+ new EnumNameSerializer(Language) +
+ new EnumNameSerializer(Measure) +
+ new EnumNameSerializer(Mode) +
+ new EnumNameSerializer(Resource) +
+ new EnumNameSerializer(ResultType) +
+ new EnumNameSerializer(TimeZone) +
+ new EnumNameSerializer(WidgetType) +
+ new EnumNameSerializer(WithFilter)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/FormSupport.scala b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/FormSupport.scala
index 94e2cd0f..537d9f87 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/FormSupport.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/FormSupport.scala
@@ -24,10 +24,13 @@ private[twitter4s] object FormSupport {
}
private def asMap(body: String): Map[String, String] =
- body.split("&").map { fields =>
- val tokens = fields.split("=", 2)
- tokens.head -> tokens.tail.mkString.trim
- }.toMap
+ body
+ .split("&")
+ .map { fields =>
+ val tokens = fields.split("=", 2)
+ tokens.head -> tokens.tail.mkString.trim
+ }
+ .toMap
private def unmarshallError[T: Manifest](body: String): TwitterException = {
val errorMsg =
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/JsonSupport.scala b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/JsonSupport.scala
index efd7a279..e1162d0d 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/JsonSupport.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/JsonSupport.scala
@@ -10,7 +10,7 @@ trait JsonSupport extends Json4sSupport {
val serialization: Serialization = native.Serialization
- private implicit class FormatsLifter(f: Formats){
+ private implicit class FormatsLifter(f: Formats) {
def +(fc: FormatsComposer): Formats =
fc.compose(f)
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/StreamingMessageFormats.scala b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/StreamingMessageFormats.scala
index 1698a8cc..76612c5d 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/http/serializers/StreamingMessageFormats.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/http/serializers/StreamingMessageFormats.scala
@@ -3,7 +3,12 @@ package com.danielasfregola.twitter4s.http.serializers
import com.danielasfregola.twitter4s.entities.streaming.common._
import com.danielasfregola.twitter4s.entities.streaming.site._
import com.danielasfregola.twitter4s.entities.streaming.user._
-import com.danielasfregola.twitter4s.entities.streaming.{CommonStreamingMessage, SiteStreamingMessage, StreamingMessage, UserStreamingMessage}
+import com.danielasfregola.twitter4s.entities.streaming.{
+ CommonStreamingMessage,
+ SiteStreamingMessage,
+ StreamingMessage,
+ UserStreamingMessage
+}
import com.danielasfregola.twitter4s.entities.{DirectMessage, Tweet}
import org.json4s.JsonAST.JValue
import org.json4s.{CustomSerializer, Extraction, FieldSerializer, Formats, MappingException}
@@ -15,13 +20,13 @@ object StreamingMessageFormats extends FormatsComposer {
private val tweetUnmarshaller = FieldSerializer[Tweet](deserializer = FieldSerializer.renameFrom("full_text", "text"))
- private def withCustomUnmarshaller[T <: StreamingMessage : Manifest](json: JValue, formatter: Formats): Option[T] = {
- implicit val _ : Formats = formatter
+ private def withCustomUnmarshaller[T <: StreamingMessage: Manifest](json: JValue, formatter: Formats): Option[T] = {
+ implicit val _: Formats = formatter
Extraction.extractOpt[T](json)
}
- def findOrExplode[T <: StreamingMessage : Manifest](json: JValue)(ops: Stream[() => Option[T]])(
- implicit formats: Formats): T = {
+ def findOrExplode[T <: StreamingMessage: Manifest](json: JValue)(ops: Stream[() => Option[T]])(
+ implicit formats: Formats): T = {
val maybeT = ops.map(f => f()).filter(opt => opt.isDefined).head
maybeT match {
case Some(t) => t
@@ -31,38 +36,47 @@ object StreamingMessageFormats extends FormatsComposer {
}
}
- object StreamingMessageSerializer extends CustomSerializer[StreamingMessage](implicit format =>
- ( {
- case json => findOrExplode(json)(streamingMessageStream(json)(format + tweetUnmarshaller))
- }, {
- case disconnectMsg: DisconnectMessage => Extraction.decompose(disconnectMsg)
- case limitNotice: LimitNotice => Extraction.decompose(limitNotice)
- case locationDeletionNotice: LocationDeletionNotice => Extraction.decompose(locationDeletionNotice)
- case statusDeletionNotice: StatusDeletionNotice => Extraction.decompose(statusDeletionNotice)
- case statusWithheldNotice: StatusWithheldNotice => Extraction.decompose(statusWithheldNotice)
- case userWithheldNotice: UserWithheldNotice => Extraction.decompose(userWithheldNotice)
- case warningMessage: WarningMessage => Extraction.decompose(warningMessage)
- case twitterListEvent: TwitterListEvent => Extraction.decompose(twitterListEvent)
- case tweetEvent: TweetEvent => Extraction.decompose(tweetEvent)
- case simpleEvent: SimpleEvent => Extraction.decompose(simpleEvent)
- case controlMessage: ControlMessage => Extraction.decompose(controlMessage)
- case userEnvelopTweet: UserEnvelopTweet => Extraction.decompose(userEnvelopTweet)
- case userEnvelopDirectMessage: UserEnvelopDirectMessage => Extraction.decompose(userEnvelopDirectMessage)
- case userEnvelopTwitterListEvent: UserEnvelopTwitterListEvent => Extraction.decompose(userEnvelopTwitterListEvent)
- case userEnvelopTweetEvent: UserEnvelopTweetEvent => Extraction.decompose(userEnvelopTweetEvent)
- case userEnvelopSimpleEvent: UserEnvelopSimpleEvent => Extraction.decompose(userEnvelopSimpleEvent)
- case userEnvelopWarningMessage: UserEnvelopWarningMessage => Extraction.decompose(userEnvelopWarningMessage)
- case userEnvelopTweetStringified: UserEnvelopTweetStringified => Extraction.decompose(userEnvelopTweetStringified)
- case userEnvelopDirectMessageStringified: UserEnvelopDirectMessageStringified => Extraction.decompose(userEnvelopDirectMessageStringified)
- case userEnvelopTwitterListEventStringified: UserEnvelopTwitterListEventStringified => Extraction.decompose(userEnvelopTwitterListEventStringified)
- case userEnvelopTweetEventStringified: UserEnvelopTweetEventStringified => Extraction.decompose(userEnvelopTweetEventStringified)
- case userEnvelopSimpleEventStringified: UserEnvelopSimpleEventStringified => Extraction.decompose(userEnvelopSimpleEventStringified)
- case userEnvelopWarningMessageStringified: UserEnvelopWarningMessageStringified => Extraction.decompose(userEnvelopWarningMessageStringified)
- case userEnvelopFriendsLists: UserEnvelopFriendsLists => Extraction.decompose(userEnvelopFriendsLists)
- case userEnvelopFriendsListsStringified: UserEnvelopFriendsListsStringified => Extraction.decompose(userEnvelopFriendsListsStringified)
- case friendsLists: FriendsLists => Extraction.decompose(friendsLists)
- case friendsListsStringified: FriendsListsStringified => Extraction.decompose(friendsListsStringified)
- }))
+ object StreamingMessageSerializer
+ extends CustomSerializer[StreamingMessage](implicit format =>
+ ({
+ case json => findOrExplode(json)(streamingMessageStream(json)(format + tweetUnmarshaller))
+ }, {
+ case disconnectMsg: DisconnectMessage => Extraction.decompose(disconnectMsg)
+ case limitNotice: LimitNotice => Extraction.decompose(limitNotice)
+ case locationDeletionNotice: LocationDeletionNotice => Extraction.decompose(locationDeletionNotice)
+ case statusDeletionNotice: StatusDeletionNotice => Extraction.decompose(statusDeletionNotice)
+ case statusWithheldNotice: StatusWithheldNotice => Extraction.decompose(statusWithheldNotice)
+ case userWithheldNotice: UserWithheldNotice => Extraction.decompose(userWithheldNotice)
+ case warningMessage: WarningMessage => Extraction.decompose(warningMessage)
+ case twitterListEvent: TwitterListEvent => Extraction.decompose(twitterListEvent)
+ case tweetEvent: TweetEvent => Extraction.decompose(tweetEvent)
+ case simpleEvent: SimpleEvent => Extraction.decompose(simpleEvent)
+ case controlMessage: ControlMessage => Extraction.decompose(controlMessage)
+ case userEnvelopTweet: UserEnvelopTweet => Extraction.decompose(userEnvelopTweet)
+ case userEnvelopDirectMessage: UserEnvelopDirectMessage => Extraction.decompose(userEnvelopDirectMessage)
+ case userEnvelopTwitterListEvent: UserEnvelopTwitterListEvent =>
+ Extraction.decompose(userEnvelopTwitterListEvent)
+ case userEnvelopTweetEvent: UserEnvelopTweetEvent => Extraction.decompose(userEnvelopTweetEvent)
+ case userEnvelopSimpleEvent: UserEnvelopSimpleEvent => Extraction.decompose(userEnvelopSimpleEvent)
+ case userEnvelopWarningMessage: UserEnvelopWarningMessage => Extraction.decompose(userEnvelopWarningMessage)
+ case userEnvelopTweetStringified: UserEnvelopTweetStringified =>
+ Extraction.decompose(userEnvelopTweetStringified)
+ case userEnvelopDirectMessageStringified: UserEnvelopDirectMessageStringified =>
+ Extraction.decompose(userEnvelopDirectMessageStringified)
+ case userEnvelopTwitterListEventStringified: UserEnvelopTwitterListEventStringified =>
+ Extraction.decompose(userEnvelopTwitterListEventStringified)
+ case userEnvelopTweetEventStringified: UserEnvelopTweetEventStringified =>
+ Extraction.decompose(userEnvelopTweetEventStringified)
+ case userEnvelopSimpleEventStringified: UserEnvelopSimpleEventStringified =>
+ Extraction.decompose(userEnvelopSimpleEventStringified)
+ case userEnvelopWarningMessageStringified: UserEnvelopWarningMessageStringified =>
+ Extraction.decompose(userEnvelopWarningMessageStringified)
+ case userEnvelopFriendsLists: UserEnvelopFriendsLists => Extraction.decompose(userEnvelopFriendsLists)
+ case userEnvelopFriendsListsStringified: UserEnvelopFriendsListsStringified =>
+ Extraction.decompose(userEnvelopFriendsListsStringified)
+ case friendsLists: FriendsLists => Extraction.decompose(friendsLists)
+ case friendsListsStringified: FriendsListsStringified => Extraction.decompose(friendsListsStringified)
+ }))
def streamingMessageStream(json: JValue)(implicit formats: Formats): Stream[() => Option[StreamingMessage]] = {
commonStreamingMessageStream(json) ++
@@ -76,7 +90,8 @@ object StreamingMessageFormats extends FormatsComposer {
)
}
- private def commonStreamingMessageStream(json: JValue)(implicit formats: Formats): Stream[() => Option[CommonStreamingMessage]] =
+ private def commonStreamingMessageStream(json: JValue)(
+ implicit formats: Formats): Stream[() => Option[CommonStreamingMessage]] =
Stream(
() => withCustomUnmarshaller[Tweet](json, formats + tweetUnmarshaller),
() => Extraction.extractOpt[DisconnectMessage](json),
@@ -88,7 +103,8 @@ object StreamingMessageFormats extends FormatsComposer {
() => Extraction.extractOpt[WarningMessage](json)
)
- private def userStreamingMessageStream(json: JValue)(implicit formats: Formats): Stream[() => Option[UserStreamingMessage]] =
+ private def userStreamingMessageStream(json: JValue)(
+ implicit formats: Formats): Stream[() => Option[UserStreamingMessage]] =
Stream(
() => Extraction.extractOpt[DirectMessage](json),
() => Extraction.extractOpt[TwitterListEvent](json),
@@ -96,7 +112,8 @@ object StreamingMessageFormats extends FormatsComposer {
() => Extraction.extractOpt[SimpleEvent](json)
)
- private def siteStreamingMessageStream(json: JValue)(implicit formats: Formats): Stream[() => Option[SiteStreamingMessage]] =
+ private def siteStreamingMessageStream(json: JValue)(
+ implicit formats: Formats): Stream[() => Option[SiteStreamingMessage]] =
Stream(
() => Extraction.extractOpt[ControlMessage](json),
() => Extraction.extractOpt[UserEnvelopTweet](json),
diff --git a/src/main/scala/com/danielasfregola/twitter4s/providers/ExecutionContextProvider.scala b/src/main/scala/com/danielasfregola/twitter4s/providers/ExecutionContextProvider.scala
index 1f2d0918..a57b4aa1 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/providers/ExecutionContextProvider.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/providers/ExecutionContextProvider.scala
@@ -3,6 +3,6 @@ package com.danielasfregola.twitter4s.providers
import scala.concurrent.ExecutionContext
private[twitter4s] trait ExecutionContextProvider {
-
+
implicit def executionContext: ExecutionContext
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/util/Configurations.scala b/src/main/scala/com/danielasfregola/twitter4s/util/Configurations.scala
index 56136fbc..291ae407 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/util/Configurations.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/util/Configurations.scala
@@ -32,7 +32,8 @@ trait ConfigurationDetector {
environmentVariable(envVar) getOrElse configuration(configName)
} catch {
case _: Throwable =>
- val msg = s"[twitter4s] configuration missing: Environment variable $envVar or configuration $configName not found."
+ val msg =
+ s"[twitter4s] configuration missing: Environment variable $envVar or configuration $configName not found."
throw new RuntimeException(msg)
}
@@ -41,5 +42,3 @@ trait ConfigurationDetector {
protected def configuration(path: String): String = config.getString(path)
}
-
-
diff --git a/src/main/scala/com/danielasfregola/twitter4s/util/Encoder.scala b/src/main/scala/com/danielasfregola/twitter4s/util/Encoder.scala
index cd6a6239..e3b7e160 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/util/Encoder.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/util/Encoder.scala
@@ -28,8 +28,7 @@ private[twitter4s] trait Encoder {
val stringBuffer = new StringBuffer
bytes.foreach { byte =>
- stringBuffer.append(
- Integer.toString((byte & 0xff) + 0x100, 16).substring(1))
+ stringBuffer.append(Integer.toString((byte & 0xff) + 0x100, 16).substring(1))
}
stringBuffer.toString
}
diff --git a/src/main/scala/com/danielasfregola/twitter4s/util/MediaReader.scala b/src/main/scala/com/danielasfregola/twitter4s/util/MediaReader.scala
index c2e91806..5eaabee3 100644
--- a/src/main/scala/com/danielasfregola/twitter4s/util/MediaReader.scala
+++ b/src/main/scala/com/danielasfregola/twitter4s/util/MediaReader.scala
@@ -8,7 +8,7 @@ private[twitter4s] class MediaReader(val chunkSize: Int) extends Encoder {
def processAsChunks[T](inputStream: InputStream, f: (Chunk, Int) => T): Seq[T] = {
val chunks = readChunks(inputStream).zipWithIndex
- chunks.map{ case (chunk, idx) => f(chunk, idx) }
+ chunks.map { case (chunk, idx) => f(chunk, idx) }
}
private def readChunks(inputStream: InputStream): Stream[Chunk] = {
diff --git a/src/test/scala/com/danielasfregola/twitter4s/entities/DeserializationRoundtripSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/entities/DeserializationRoundtripSpec.scala
index f0285abe..724e4733 100755
--- a/src/test/scala/com/danielasfregola/twitter4s/entities/DeserializationRoundtripSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/entities/DeserializationRoundtripSpec.scala
@@ -12,24 +12,24 @@ import scala.reflect._
class DeserializationRoundtripSpec extends Specification with FixturesSupport with JsonDiffSupport {
- "JSON deserialization" should {
+ "JSON deserialization" should {
- def roundtripTest[T <: AnyRef : Manifest](jsonFile: String): Fragment = {
+ def roundtripTest[T <: AnyRef: Manifest](jsonFile: String): Fragment = {
- val className = classTag[T].runtimeClass.getSimpleName
+ val className = classTag[T].runtimeClass.getSimpleName
- s"round-trip successfully for $className in $jsonFile" in {
- val originalJson = load(jsonFile)
+ s"round-trip successfully for $className in $jsonFile" in {
+ val originalJson = load(jsonFile)
- val deserializedEntity = Serialization.read[T](originalJson)
+ val deserializedEntity = Serialization.read[T](originalJson)
- val serializedJson = Serialization.writePretty[T](deserializedEntity)
+ val serializedJson = Serialization.writePretty[T](deserializedEntity)
- originalJson must beASubsetOfJson(serializedJson)
- }
- }
+ originalJson must beASubsetOfJson(serializedJson)
+ }
+ }
- roundtripTest[User]("/twitter/rest/users/user.json")
+ roundtripTest[User]("/twitter/rest/users/user.json")
}
def beASubsetOfJson(otherJson: String): Matcher[String] = new Matcher[String] {
@@ -40,21 +40,19 @@ class DeserializationRoundtripSpec extends Specification with FixturesSupport wi
jsonDiff(alpha, beta) match {
case diff @ JsonDiff(JNothing, _, JNothing) =>
- success(
- s"""${t.value}
+ success(s"""${t.value}
|is a subset of
|$otherJson
|${renderDiff(diff)}
""".stripMargin,
- t)
+ t)
case diff =>
- failure(
- s"""${t.value}
+ failure(s"""${t.value}
|is not a subset of
|$otherJson
|${renderDiff(diff)}
""".stripMargin,
- t)
+ t)
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/entities/RateLimitSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/entities/RateLimitSpec.scala
index 40deeed9..fb34ceff 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/entities/RateLimitSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/entities/RateLimitSpec.scala
@@ -12,14 +12,12 @@ class RateLimitSpec extends Specification {
"RateLimit" should {
"be created from http headers" in {
- val headers = Seq(
- RawHeader("x-rate-limit-limit", "15"),
- RawHeader("x-rate-limit-remaining", "14"),
- RawHeader("x-rate-limit-reset", "1445181993"))
+ val headers = Seq(RawHeader("x-rate-limit-limit", "15"),
+ RawHeader("x-rate-limit-remaining", "14"),
+ RawHeader("x-rate-limit-reset", "1445181993"))
val rateLimit = RateLimit(headers)
-
val expectedDate = {
val dateFormatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss ZZZZ yyyy", Locale.ENGLISH)
dateFormatter.parse("Sun Oct 18 15:26:33 +0000 2015")
diff --git a/src/test/scala/com/danielasfregola/twitter4s/entities/SerializationRoundtripSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/entities/SerializationRoundtripSpec.scala
index b586d5e5..e9c4541b 100755
--- a/src/test/scala/com/danielasfregola/twitter4s/entities/SerializationRoundtripSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/entities/SerializationRoundtripSpec.scala
@@ -16,7 +16,7 @@ class SerializationRoundtripSpec extends Specification with RandomDataGenerator
"JSON serialization" should {
- def roundtripTest[T <: AnyRef : Manifest : Arbitrary]: Fragment = {
+ def roundtripTest[T <: AnyRef: Manifest: Arbitrary]: Fragment = {
val className = classTag[T].runtimeClass.getSimpleName
diff --git a/src/test/scala/com/danielasfregola/twitter4s/helpers/ClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/helpers/ClientSpec.scala
index b0be6d35..02e03f5d 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/helpers/ClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/helpers/ClientSpec.scala
@@ -22,8 +22,9 @@ trait ClientSpec extends Spec {
protected val authenticationClient = new AuthenticationClient(consumerToken) {
- override def sendAndReceive[T](request: HttpRequest, f: HttpResponse => Future[T])
- (implicit system: ActorSystem, materializer: Materializer): Future[T] = {
+ override def sendAndReceive[T](request: HttpRequest, f: HttpResponse => Future[T])(
+ implicit system: ActorSystem,
+ materializer: Materializer): Future[T] = {
implicit val ec = materializer.executionContext
implicit val timeout: Timeout = DurationInt(20) seconds
val requestStartTime = System.currentTimeMillis
@@ -40,8 +41,9 @@ trait ClientSpec extends Spec {
protected val restClient = new RestClient(consumerToken, accessToken) {
- override def sendAndReceive[T](request: HttpRequest, f: HttpResponse => Future[T])
- (implicit system: ActorSystem, materializer: Materializer): Future[T] = {
+ override def sendAndReceive[T](request: HttpRequest, f: HttpResponse => Future[T])(
+ implicit system: ActorSystem,
+ materializer: Materializer): Future[T] = {
implicit val ec = materializer.executionContext
implicit val timeout: Timeout = DurationInt(20) seconds
val requestStartTime = System.currentTimeMillis
@@ -62,9 +64,11 @@ trait ClientSpec extends Spec {
protected val streamingClient = new StreamingClient(consumerToken, accessToken) {
- override def processStreamRequest[T <: StreamingMessage : Manifest](request: HttpRequest, killSwitch: SharedKillSwitch)
- (f: PartialFunction[T, Unit])
- (implicit system: ActorSystem, materializer: Materializer): Future[SharedKillSwitch] = {
+ override def processStreamRequest[T <: StreamingMessage: Manifest](
+ request: HttpRequest,
+ killSwitch: SharedKillSwitch)(f: PartialFunction[T, Unit])(
+ implicit system: ActorSystem,
+ materializer: Materializer): Future[SharedKillSwitch] = {
implicit val ec = materializer.executionContext
implicit val timeout: Timeout = DurationInt(20) seconds
val responseR: Future[HttpResponse] = (transport.ref ? request).map(_.asInstanceOf[HttpResponse])
diff --git a/src/test/scala/com/danielasfregola/twitter4s/helpers/FixturesSupport.scala b/src/test/scala/com/danielasfregola/twitter4s/helpers/FixturesSupport.scala
index f761afdb..ac6e0eeb 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/helpers/FixturesSupport.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/helpers/FixturesSupport.scala
@@ -13,4 +13,3 @@ trait FixturesSupport extends JsonSupport {
def readJsonAs[T: Manifest](json: String): T = Serialization.read[T](json)
def printAsJson[T <: AnyRef](value: T): Unit = println(Serialization.writePretty(value))
}
-
diff --git a/src/test/scala/com/danielasfregola/twitter4s/helpers/JsonDiffSupport.scala b/src/test/scala/com/danielasfregola/twitter4s/helpers/JsonDiffSupport.scala
index f2bfd5ff..4bf999f5 100755
--- a/src/test/scala/com/danielasfregola/twitter4s/helpers/JsonDiffSupport.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/helpers/JsonDiffSupport.scala
@@ -7,24 +7,24 @@ import org.json4s.JsonAST._
import org.json4s.{JField, JNothing, JObject}
/**
- * This is a copy of [[org.json4s.Diff]], with modifications to make it
- * treat equivalent dates in different timezones as equal, and empty arrays
- * as equal to nulls.
- */
+ * This is a copy of [[org.json4s.Diff]], with modifications to make it
+ * treat equivalent dates in different timezones as equal, and empty arrays
+ * as equal to nulls.
+ */
trait JsonDiffSupport { this: JsonSupport =>
/** A difference between two JSONs (j1 diff j2).
- *
- * @param changed what has changed from j1 to j2
- * @param added what has been added to j2
- * @param deleted what has been deleted from j1
- */
+ *
+ * @param changed what has changed from j1 to j2
+ * @param added what has been added to j2
+ * @param deleted what has been deleted from j1
+ */
case class JsonDiff(changed: JValue, added: JValue, deleted: JValue) {
private[helpers] def toField(name: String): JsonDiff = {
def applyTo(x: JValue) = x match {
case JNothing => JNothing
- case _ => JObject((name, x))
+ case _ => JObject((name, x))
}
JsonDiff(applyTo(changed), applyTo(added), applyTo(deleted))
@@ -32,37 +32,39 @@ trait JsonDiffSupport { this: JsonSupport =>
}
def jsonDiff(val1: JValue, val2: JValue): JsonDiff = (val1, val2) match {
- case (x, y) if x == y => JsonDiff(JNothing, JNothing, JNothing)
+ case (x, y) if x == y => JsonDiff(JNothing, JNothing, JNothing)
case (JObject(xs), JObject(ys)) => diffFields(xs, ys)
// treat empty collections as equal to nulls
case (JArray(Nil), JNothing | JNull) | (JNothing | JNull, JArray(Nil)) => JsonDiff(JNothing, JNothing, JNothing)
- case (JArray(xs), JArray(ys)) => diffVals(xs, ys)
+ case (JArray(xs), JArray(ys)) => diffVals(xs, ys)
// unlike diff of JArrays, order of elements is ignored in diff of JSets
- case (JSet(x), JSet(y)) if JSet(x) != JSet(y) => JsonDiff(JNothing, JSet(y).difference(JSet(x)), JSet(x).difference(JSet(y)))
- case (JInt(x), JInt(y)) if x != y => JsonDiff(JInt(y), JNothing, JNothing)
- case (JDouble(x), JDouble(y)) if x != y => JsonDiff(JDouble(y), JNothing, JNothing)
+ case (JSet(x), JSet(y)) if JSet(x) != JSet(y) =>
+ JsonDiff(JNothing, JSet(y).difference(JSet(x)), JSet(x).difference(JSet(y)))
+ case (JInt(x), JInt(y)) if x != y => JsonDiff(JInt(y), JNothing, JNothing)
+ case (JDouble(x), JDouble(y)) if x != y => JsonDiff(JDouble(y), JNothing, JNothing)
case (JDecimal(x), JDecimal(y)) if x != y => JsonDiff(JDecimal(y), JNothing, JNothing)
// if two strings can be parsed as dates, check equality for the dates
- case (JDate(x), JDate(y)) if x == y => JsonDiff(JNothing, JNothing, JNothing)
+ case (JDate(x), JDate(y)) if x == y => JsonDiff(JNothing, JNothing, JNothing)
case (JString(x), JString(y)) if x != y => JsonDiff(JString(y), JNothing, JNothing)
- case (JBool(x), JBool(y)) if x != y => JsonDiff(JBool(y), JNothing, JNothing)
- case (JNothing, x) => JsonDiff(JNothing, x, JNothing)
- case (x, JNothing) => JsonDiff(JNothing, JNothing, x)
- case (x, y) => JsonDiff(y, JNothing, JNothing)
+ case (JBool(x), JBool(y)) if x != y => JsonDiff(JBool(y), JNothing, JNothing)
+ case (JNothing, x) => JsonDiff(JNothing, x, JNothing)
+ case (x, JNothing) => JsonDiff(JNothing, JNothing, x)
+ case (x, y) => JsonDiff(y, JNothing, JNothing)
}
private def diffFields(vs1: List[JField], vs2: List[JField]) = {
def diffRec(xleft: List[JField], yleft: List[JField]): JsonDiff = xleft match {
case Nil => JsonDiff(JNothing, if (yleft.isEmpty) JNothing else JObject(yleft), JNothing)
- case x :: xs => yleft find (_._1 == x._1) match {
- case Some(y) =>
- val JsonDiff(c1, a1, d1) = jsonDiff(x._2, y._2).toField(y._1)
- val JsonDiff(c2, a2, d2) = diffRec(xs, yleft filterNot (_ == y))
- JsonDiff(c1 merge c2, a1 merge a2, d1 merge d2)
- case None =>
- val JsonDiff(c, a, d) = diffRec(xs, yleft)
- JsonDiff(c, a, JObject(x :: Nil) merge d)
- }
+ case x :: xs =>
+ yleft find (_._1 == x._1) match {
+ case Some(y) =>
+ val JsonDiff(c1, a1, d1) = jsonDiff(x._2, y._2).toField(y._1)
+ val JsonDiff(c2, a2, d2) = diffRec(xs, yleft filterNot (_ == y))
+ JsonDiff(c1 merge c2, a1 merge a2, d1 merge d2)
+ case None =>
+ val JsonDiff(c, a, d) = diffRec(xs, yleft)
+ JsonDiff(c, a, JObject(x :: Nil) merge d)
+ }
}
diffRec(vs1, vs2)
diff --git a/src/test/scala/com/danielasfregola/twitter4s/helpers/RequestDSL.scala b/src/test/scala/com/danielasfregola/twitter4s/helpers/RequestDSL.scala
index 23a9a916..227dd435 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/helpers/RequestDSL.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/helpers/RequestDSL.scala
@@ -58,10 +58,14 @@ abstract class RequestDSL extends TestActorSystem with FixturesSupport with Afte
respondWith(HttpResponse(StatusCodes.OK, entity = HttpEntity(MediaTypes.`application/json`, load(resourcePath))))
def respondWithRated(resourcePath: String): Await[T] =
- respondWith(HttpResponse(StatusCodes.OK, headers = headers, entity = HttpEntity(MediaTypes.`application/json`, load(resourcePath))))
+ respondWith(
+ HttpResponse(StatusCodes.OK,
+ headers = headers,
+ entity = HttpEntity(MediaTypes.`application/json`, load(resourcePath))))
def respondWithOk: Await[Unit] = {
- val response = HttpResponse(StatusCodes.OK, entity = HttpEntity(MediaTypes.`application/json`, """{"code": "OK"}"""))
+ val response =
+ HttpResponse(StatusCodes.OK, entity = HttpEntity(MediaTypes.`application/json`, """{"code": "OK"}"""))
transport.reply(response)
new Await(Future.successful((): Unit))
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClientSpec.scala
index 6e00c379..a6508edf 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/authentication/oauth/TwitterOAuthClientSpec.scala
@@ -61,7 +61,8 @@ class TwitterOAuthClientSpec extends ClientSpec {
.expectRequest { request =>
request.method === HttpMethods.POST
request.uri.endpoint === "https://api.twitter.com/oauth/access_token"
- request.uri.queryString() === Some("x_auth_mode=client_auth&x_auth_password=my-secret-password&x_auth_username=twitterapi")
+ request.uri.queryString() === Some(
+ "x_auth_mode=client_auth&x_auth_password=my-secret-password&x_auth_username=twitterapi")
}
.respondWith("/twitter/authentication/access_token.txt")
.await
@@ -76,16 +77,16 @@ class TwitterOAuthClientSpec extends ClientSpec {
"request an access token for oauth authentication" in new TwitterOAuthClientSpecContext {
val result: OAuthAccessToken = when(accessToken(token = token, oauth_verifier = "my-token-verifier"))
- .expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/oauth/access_token"
- request.uri.queryString() === Some("oauth_token=my-oauth-token&oauth_verifier=my-token-verifier")
- }
- .respondWith("/twitter/authentication/access_token.txt")
- .await
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/oauth/access_token"
+ request.uri.queryString() === Some("oauth_token=my-oauth-token&oauth_verifier=my-token-verifier")
+ }
+ .respondWith("/twitter/authentication/access_token.txt")
+ .await
val expectedResult = OAuthAccessToken(
accessToken = AccessToken(key = "6253282-eWudHldSbIaelX7swmsiHImEL4KinwaGloHANdrY",
- secret = "2EEfA6BG3ly3sR3RjE0IBSnlQu4ZrUzPiYKmrkVU"),
+ secret = "2EEfA6BG3ly3sR3RjE0IBSnlQu4ZrUzPiYKmrkVU"),
user_id = 6253282,
screen_name = "twitterapi"
)
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClientSpec.scala
index d074e532..48c50172 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/RestClientSpec.scala
@@ -23,7 +23,8 @@ class RestClientSpec extends ClientSpec {
}
val result = when(exampleRequest).expectRequest(identity(_)).respondWith(response)
val expectedTwitterException = TwitterException(code = StatusCodes.NotFound,
- errors = Errors(TwitterError("Sorry, that page does not exist", 34)))
+ errors =
+ Errors(TwitterError("Sorry, that page does not exist", 34)))
result.await should throwAn(expectedTwitterException)
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClientSpec.scala
index 113c221e..96ec97b5 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/account/TwitterAccountClientSpec.scala
@@ -12,105 +12,138 @@ class TwitterAccountClientSpec extends ClientSpec {
"Twitter Account Client" should {
"retrieve account settings" in new TwitterAccountClientSpecContext {
- val result: RatedData[Settings] = when(settings).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/account/settings.json"
- }.respondWithRated("/twitter/rest/account/settings.json").await
+ val result: RatedData[Settings] = when(settings)
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/settings.json"
+ }
+ .respondWithRated("/twitter/rest/account/settings.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Settings]("/fixtures/rest/account/settings.json")
}
"verify credentials" in new TwitterAccountClientSpecContext {
- val result: RatedData[User] = when(verifyCredentials(include_email = true)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/account/verify_credentials.json"
- }.respondWithRated("/twitter/rest/account/user.json").await
+ val result: RatedData[User] = when(verifyCredentials(include_email = true))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/verify_credentials.json"
+ }
+ .respondWithRated("/twitter/rest/account/user.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/account/user.json")
}
"update account settings" in new TwitterAccountClientSpecContext {
val result: Settings = when(
- updateSettings(allow_contributor_request = Some(ContributorType.All),
- sleep_time_enabled = Some(true),
- start_sleep_time = Some(Hour.TEN_PM),
- end_sleep_time = Some(Hour.SIX_AM),
- time_zone = Some(TimeZone.Europe_London))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/settings.json"
- request.entity === HttpEntity(
- `application/x-www-form-urlencoded`,
- "allow_contributor_request=all&end_sleep_time=06&sleep_time_enabled=true&start_sleep_time=22&time_zone=Europe%2FLondon")
- }.respondWith("/twitter/rest/account/settings.json").await
+ updateSettings(
+ allow_contributor_request = Some(ContributorType.All),
+ sleep_time_enabled = Some(true),
+ start_sleep_time = Some(Hour.TEN_PM),
+ end_sleep_time = Some(Hour.SIX_AM),
+ time_zone = Some(TimeZone.Europe_London)
+ ))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/settings.json"
+ request.entity === HttpEntity(
+ `application/x-www-form-urlencoded`,
+ "allow_contributor_request=all&end_sleep_time=06&sleep_time_enabled=true&start_sleep_time=22&time_zone=Europe%2FLondon"
+ )
+ }
+ .respondWith("/twitter/rest/account/settings.json")
+ .await
result === loadJsonAs[Settings]("/fixtures/rest/account/settings.json")
}
"update a profile name" in new TwitterAccountClientSpecContext {
- val result: User = when(updateProfileName("Daniela Sfregola")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
- request.entity === HttpEntity(`application/x-www-form-urlencoded`,
- "include_entities=true&name=Daniela+Sfregola&skip_status=false")
- }.respondWith("/twitter/rest/account/user.json").await
+ val result: User = when(updateProfileName("Daniela Sfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
+ request.entity === HttpEntity(`application/x-www-form-urlencoded`,
+ "include_entities=true&name=Daniela+Sfregola&skip_status=false")
+ }
+ .respondWith("/twitter/rest/account/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/account/user.json")
}
"update a profile url" in new TwitterAccountClientSpecContext {
- val result: User = when(updateProfileUrl("http://danielasfregola.com")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
- request.entity === HttpEntity(`application/x-www-form-urlencoded`,
- "include_entities=true&skip_status=false&url=http%3A%2F%2Fdanielasfregola.com")
- }.respondWith("/twitter/rest/account/user.json").await
+ val result: User = when(updateProfileUrl("http://danielasfregola.com"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
+ request.entity === HttpEntity(`application/x-www-form-urlencoded`,
+ "include_entities=true&skip_status=false&url=http%3A%2F%2Fdanielasfregola.com")
+ }
+ .respondWith("/twitter/rest/account/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/account/user.json")
}
"update a profile description" in new TwitterAccountClientSpecContext {
- val result: User = when(updateProfileDescription("Nice description here")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
- request.entity === HttpEntity(`application/x-www-form-urlencoded`,
- "description=Nice+description+here&include_entities=true&skip_status=false")
- }.respondWith("/twitter/rest/account/user.json").await
+ val result: User = when(updateProfileDescription("Nice description here"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
+ request.entity === HttpEntity(`application/x-www-form-urlencoded`,
+ "description=Nice+description+here&include_entities=true&skip_status=false")
+ }
+ .respondWith("/twitter/rest/account/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/account/user.json")
}
"update a profile location" in new TwitterAccountClientSpecContext {
- val result: User = when(updateProfileLocation("London, UK")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
- request.entity === HttpEntity(`application/x-www-form-urlencoded`,
- "include_entities=true&location=London%2C+UK&skip_status=false")
- }.respondWith("/twitter/rest/account/user.json").await
+ val result: User = when(updateProfileLocation("London, UK"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
+ request.entity === HttpEntity(`application/x-www-form-urlencoded`,
+ "include_entities=true&location=London%2C+UK&skip_status=false")
+ }
+ .respondWith("/twitter/rest/account/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/account/user.json")
}
"update a profile link color" in new TwitterAccountClientSpecContext {
- val result: User = when(updateProfileLinkColor("0000FF")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
- request.entity === HttpEntity(`application/x-www-form-urlencoded`,
- "include_entities=true&profile_link_color=0000FF&skip_status=false")
- }.respondWith("/twitter/rest/account/user.json").await
+ val result: User = when(updateProfileLinkColor("0000FF"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
+ request.entity === HttpEntity(`application/x-www-form-urlencoded`,
+ "include_entities=true&profile_link_color=0000FF&skip_status=false")
+ }
+ .respondWith("/twitter/rest/account/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/account/user.json")
}
"update a profile" in new TwitterAccountClientSpecContext {
val profile = ProfileUpdate(url = Some("http://danielasfregola.com"))
- val result: User = when(updateProfile(profile)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
- request.entity === HttpEntity(`application/x-www-form-urlencoded`,
- "include_entities=true&skip_status=false&url=http%3A%2F%2Fdanielasfregola.com")
- }.respondWith("/twitter/rest/account/user.json").await
+ val result: User = when(updateProfile(profile))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/update_profile.json"
+ request.entity === HttpEntity(`application/x-www-form-urlencoded`,
+ "include_entities=true&skip_status=false&url=http%3A%2F%2Fdanielasfregola.com")
+ }
+ .respondWith("/twitter/rest/account/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/account/user.json")
}
"remove a profile banner" in new TwitterAccountClientSpecContext {
- val result: Unit = when(removeProfileBanner).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/account/remove_profile_banner.json"
- }.respondWithOk.await
+ val result: Unit = when(removeProfileBanner)
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/account/remove_profile_banner.json"
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/application/TwitterApplicationClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/application/TwitterApplicationClientSpec.scala
index 36addf14..f268efc6 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/application/TwitterApplicationClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/application/TwitterApplicationClientSpec.scala
@@ -1,6 +1,5 @@
package com.danielasfregola.twitter4s.http.clients.rest.application
-
import akka.http.scaladsl.model.HttpMethods
import com.danielasfregola.twitter4s.entities.enums.Resource
import com.danielasfregola.twitter4s.entities.{RateLimits, RatedData}
@@ -13,21 +12,27 @@ class TwitterApplicationClientSpec extends ClientSpec {
"Twitter Application Client" should {
"get application rate limits for some resources" in new TwitterApplicationClientSpecContext {
- val result: RatedData[RateLimits] = when(rateLimits(Resource.Account, Resource.Statuses)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/application/rate_limit_status.json"
- request.uri.queryString() === Some("resources=account,statuses")
- }.respondWithRated("/twitter/rest/application/rate_limits.json").await
+ val result: RatedData[RateLimits] = when(rateLimits(Resource.Account, Resource.Statuses))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/application/rate_limit_status.json"
+ request.uri.queryString() === Some("resources=account,statuses")
+ }
+ .respondWithRated("/twitter/rest/application/rate_limits.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[RateLimits]("/fixtures/rest/application/rate_limits.json")
}
"get application rate limits for all the resources" in new TwitterApplicationClientSpecContext {
- val result: RatedData[RateLimits] = when(rateLimits()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/application/rate_limit_status.json"
- request.uri.queryString() === None
- }.respondWithRated("/twitter/rest/application/rate_limits.json").await
+ val result: RatedData[RateLimits] = when(rateLimits())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/application/rate_limit_status.json"
+ request.uri.queryString() === None
+ }
+ .respondWithRated("/twitter/rest/application/rate_limits.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[RateLimits]("/fixtures/rest/application/rate_limits.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClientSpec.scala
index 404a4d89..60272962 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/blocks/TwitterBlockClientSpec.scala
@@ -11,70 +11,90 @@ class TwitterBlockClientSpec extends ClientSpec {
"Twitter Block Client" should {
"get blocked users" in new TwitterBlockClientSpecContext {
- val result: RatedData[Users] = when(blockedUsers()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/blocks/list.json"
- }.respondWithRated("/twitter/rest/blocks/blocked_users.json").await
+ val result: RatedData[Users] = when(blockedUsers())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/blocks/list.json"
+ }
+ .respondWithRated("/twitter/rest/blocks/blocked_users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/blocks/blocked_users.json")
}
"get blocked user ids" in new TwitterBlockClientSpecContext {
- val result: RatedData[UserIds] = when(blockedUserIds()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/blocks/ids.json"
- request.uri.queryString() === Some("cursor=-1&stringify_ids=false")
- }.respondWithRated("/twitter/rest/blocks/ids.json").await
+ val result: RatedData[UserIds] = when(blockedUserIds())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/blocks/ids.json"
+ request.uri.queryString() === Some("cursor=-1&stringify_ids=false")
+ }
+ .respondWithRated("/twitter/rest/blocks/ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/blocks/ids.json")
}
"get blocked user stringified ids" in new TwitterBlockClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(blockedUserStringifiedIds()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/blocks/ids.json"
- request.uri.queryString() === Some("cursor=-1&stringify_ids=true")
- }.respondWithRated("/twitter/rest/blocks/stringified_ids.json").await
+ val result: RatedData[UserStringifiedIds] = when(blockedUserStringifiedIds())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/blocks/ids.json"
+ request.uri.queryString() === Some("cursor=-1&stringify_ids=true")
+ }
+ .respondWithRated("/twitter/rest/blocks/stringified_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/blocks/stringified_ids.json")
}
- "block user" in new TwitterBlockClientSpecContext {
- val result: User = when(blockUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/blocks/create.json"
- request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini&skip_status=false")
- }.respondWith("/twitter/rest/blocks/user.json").await
+ "block user" in new TwitterBlockClientSpecContext {
+ val result: User = when(blockUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/blocks/create.json"
+ request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini&skip_status=false")
+ }
+ .respondWith("/twitter/rest/blocks/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/blocks/user.json")
}
- "block user by user id" in new TwitterBlockClientSpecContext {
- val result: User = when(blockUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/blocks/create.json"
- request.uri.queryString() === Some("include_entities=true&skip_status=false&user_id=19018614")
- }.respondWith("/twitter/rest/blocks/user.json").await
+ "block user by user id" in new TwitterBlockClientSpecContext {
+ val result: User = when(blockUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/blocks/create.json"
+ request.uri.queryString() === Some("include_entities=true&skip_status=false&user_id=19018614")
+ }
+ .respondWith("/twitter/rest/blocks/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/blocks/user.json")
}
- "unblock user" in new TwitterBlockClientSpecContext {
- val result: User = when(unblockUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/blocks/destroy.json"
- request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini&skip_status=false")
- }.respondWith("/twitter/rest/blocks/user.json").await
+ "unblock user" in new TwitterBlockClientSpecContext {
+ val result: User = when(unblockUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/blocks/destroy.json"
+ request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini&skip_status=false")
+ }
+ .respondWith("/twitter/rest/blocks/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/blocks/user.json")
}
- "unblock user by user id" in new TwitterBlockClientSpecContext {
- val result: User = when(unblockUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/blocks/destroy.json"
- request.uri.queryString() === Some("include_entities=true&skip_status=false&user_id=19018614")
- }.respondWith("/twitter/rest/blocks/user.json").await
+ "unblock user by user id" in new TwitterBlockClientSpecContext {
+ val result: User = when(unblockUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/blocks/destroy.json"
+ request.uri.queryString() === Some("include_entities=true&skip_status=false&user_id=19018614")
+ }
+ .respondWith("/twitter/rest/blocks/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/blocks/user.json")
}
}
-
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClientSpec.scala
index 38f5f8cf..5bc5e142 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClientSpec.scala
@@ -1,6 +1,5 @@
package com.danielasfregola.twitter4s.http.clients.rest.directmessages
-
import akka.http.scaladsl.model.HttpMethods
import com.danielasfregola.twitter4s.entities.{DirectMessage, RatedData}
import com.danielasfregola.twitter4s.helpers.ClientSpec
@@ -12,65 +11,82 @@ class TwitterDirectMessageClientSpec extends ClientSpec {
"Twitter Direct Message Client" should {
"retrieve a specific direct message" in new TwitterDirectMessageClientSpecContext {
- val result: RatedData[DirectMessage] = when(directMessage(649298254383980547L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/show.json"
- request.uri.queryString() === Some("id=649298254383980547")
- }.respondWithRated("/twitter/rest/directmessages/show.json").await
+ val result: RatedData[DirectMessage] = when(directMessage(649298254383980547L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/show.json"
+ request.uri.queryString() === Some("id=649298254383980547")
+ }
+ .respondWithRated("/twitter/rest/directmessages/show.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[DirectMessage]("/fixtures/rest/directmessages/show.json")
}
"get sent direct messages" in new TwitterDirectMessageClientSpecContext {
- val result: RatedData[Seq[DirectMessage]] = when(sentDirectMessages(count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/sent.json"
- request.uri.queryString() === Some("count=10&include_entities=true&page=-1")
- }.respondWithRated("/twitter/rest/directmessages/sent.json").await
+ val result: RatedData[Seq[DirectMessage]] = when(sentDirectMessages(count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/sent.json"
+ request.uri.queryString() === Some("count=10&include_entities=true&page=-1")
+ }
+ .respondWithRated("/twitter/rest/directmessages/sent.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[DirectMessage]]("/fixtures/rest/directmessages/sent.json")
}
"get received direct messages" in new TwitterDirectMessageClientSpecContext {
- val result: RatedData[Seq[DirectMessage]] = when(receivedDirectMessages(count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages.json"
- request.uri.queryString() === Some("count=10&include_entities=true&skip_status=false")
- }.respondWithRated("/twitter/rest/directmessages/received.json").await
+ val result: RatedData[Seq[DirectMessage]] = when(receivedDirectMessages(count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages.json"
+ request.uri.queryString() === Some("count=10&include_entities=true&skip_status=false")
+ }
+ .respondWithRated("/twitter/rest/directmessages/received.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[DirectMessage]]("/fixtures/rest/directmessages/received.json")
}
"destroy a direct message" in new TwitterDirectMessageClientSpecContext {
- val result: DirectMessage = when(deleteDirectMessage(649298254383980547L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/destroy.json"
- request.uri.queryString() === Some("id=649298254383980547&include_entities=true")
- }.respondWith("/twitter/rest/directmessages/destroy.json").await
+ val result: DirectMessage = when(deleteDirectMessage(649298254383980547L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/destroy.json"
+ request.uri.queryString() === Some("id=649298254383980547&include_entities=true")
+ }
+ .respondWith("/twitter/rest/directmessages/destroy.json")
+ .await
result === loadJsonAs[DirectMessage]("/fixtures/rest/directmessages/destroy.json")
}
"create a direct message by user_id" in new TwitterDirectMessageClientSpecContext {
val text = "FUNZIONAAAAAAAAAA :D"
- val result: DirectMessage = when(createDirectMessage(2911461333L, text)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/new.json"
- request.uri.queryString() === Some("text=FUNZIONAAAAAAAAAA+:D&user_id=2911461333")
- }.respondWith("/twitter/rest/directmessages/new.json").await
+ val result: DirectMessage = when(createDirectMessage(2911461333L, text))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/new.json"
+ request.uri.queryString() === Some("text=FUNZIONAAAAAAAAAA+:D&user_id=2911461333")
+ }
+ .respondWith("/twitter/rest/directmessages/new.json")
+ .await
result === loadJsonAs[DirectMessage]("/fixtures/rest/directmessages/new.json")
}
"create a direct message by screen_name" in new TwitterDirectMessageClientSpecContext {
val text = "FUNZIONAAAAAAAAAA :D"
- val result: DirectMessage = when(createDirectMessage("marcobonzanini", text)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/new.json"
- request.uri.queryString() === Some("screen_name=marcobonzanini&text=FUNZIONAAAAAAAAAA+:D")
- }.respondWith("/twitter/rest/directmessages/new.json").await
+ val result: DirectMessage = when(createDirectMessage("marcobonzanini", text))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/direct_messages/new.json"
+ request.uri.queryString() === Some("screen_name=marcobonzanini&text=FUNZIONAAAAAAAAAA+:D")
+ }
+ .respondWith("/twitter/rest/directmessages/new.json")
+ .await
result === loadJsonAs[DirectMessage]("/fixtures/rest/directmessages/new.json")
}
}
-
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/TwitterFavoriteClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/TwitterFavoriteClientSpec.scala
index a841da4b..d4879df3 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/TwitterFavoriteClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/favorites/TwitterFavoriteClientSpec.scala
@@ -1,6 +1,5 @@
package com.danielasfregola.twitter4s.http.clients.rest.favorites
-
import akka.http.scaladsl.model.HttpMethods
import com.danielasfregola.twitter4s.entities.{RatedData, Tweet}
import com.danielasfregola.twitter4s.helpers.ClientSpec
@@ -12,40 +11,52 @@ class TwitterFavoriteClientSpec extends ClientSpec {
"Twitter Favorite Client" should {
"get favorites" in new TwitterFavoriteClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(favoriteStatusesForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/favorites/list.json"
- request.uri.queryString() === Some("count=20&include_entities=true&screen_name=DanielaSfregola")
- }.respondWithRated("/twitter/rest/favorites/favorites.json").await
+ val result: RatedData[Seq[Tweet]] = when(favoriteStatusesForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/favorites/list.json"
+ request.uri.queryString() === Some("count=20&include_entities=true&screen_name=DanielaSfregola")
+ }
+ .respondWithRated("/twitter/rest/favorites/favorites.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/favorites/favorites.json")
}
"get favorites per user id" in new TwitterFavoriteClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(favoriteStatusesForUserId(19018614)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/favorites/list.json"
- request.uri.queryString() === Some("count=20&include_entities=true&user_id=19018614")
- }.respondWithRated("/twitter/rest/favorites/favorites.json").await
+ val result: RatedData[Seq[Tweet]] = when(favoriteStatusesForUserId(19018614))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/favorites/list.json"
+ request.uri.queryString() === Some("count=20&include_entities=true&user_id=19018614")
+ }
+ .respondWithRated("/twitter/rest/favorites/favorites.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/favorites/favorites.json")
}
"favorite a tweet" in new TwitterFavoriteClientSpecContext {
- val result: Tweet = when(favoriteStatus(243138128959913986L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/favorites/create.json"
- request.uri.queryString() === Some("id=243138128959913986&include_entities=true")
- }.respondWith("/twitter/rest/favorites/favorite.json").await
+ val result: Tweet = when(favoriteStatus(243138128959913986L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/favorites/create.json"
+ request.uri.queryString() === Some("id=243138128959913986&include_entities=true")
+ }
+ .respondWith("/twitter/rest/favorites/favorite.json")
+ .await
result === loadJsonAs[Tweet]("/fixtures/rest/favorites/favorite.json")
}
"unfavorite a tweet" in new TwitterFavoriteClientSpecContext {
- val result: Tweet = when(unfavoriteStatus(243138128959913986L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/favorites/destroy.json"
- request.uri.queryString() === Some("id=243138128959913986&include_entities=true")
- }.respondWith("/twitter/rest/favorites/unfavorite.json").await
+ val result: Tweet = when(unfavoriteStatus(243138128959913986L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/favorites/destroy.json"
+ request.uri.queryString() === Some("id=243138128959913986&include_entities=true")
+ }
+ .respondWith("/twitter/rest/favorites/unfavorite.json")
+ .await
result === loadJsonAs[Tweet]("/fixtures/rest/favorites/unfavorite.json")
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClientSpec.scala
index 27a04645..71b85505 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/followers/TwitterFollowerClientSpec.scala
@@ -1,6 +1,5 @@
package com.danielasfregola.twitter4s.http.clients.rest.followers
-
import akka.http.scaladsl.model.HttpMethods
import com.danielasfregola.twitter4s.entities.{RatedData, UserIds, UserStringifiedIds, Users}
import com.danielasfregola.twitter4s.helpers.ClientSpec
@@ -12,62 +11,81 @@ class TwitterFollowerClientSpec extends ClientSpec {
"Twitter Follower Client" should {
"get followers ids of a specific user by id" in new TwitterFollowerClientSpecContext {
- val result: RatedData[UserIds] = when(followerIdsForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=false&user_id=2911461333")
- }.respondWithRated("/twitter/rest/followers/followers_ids.json").await
+ val result: RatedData[UserIds] = when(followerIdsForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=false&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/followers/followers_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/followers/followers_ids.json")
}
"get followers ids of a specific user by name" in new TwitterFollowerClientSpecContext {
- val result: RatedData[UserIds] = when(followerIdsForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=false")
- }.respondWithRated("/twitter/rest/followers/followers_ids.json").await
+ val result: RatedData[UserIds] = when(followerIdsForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=false")
+ }
+ .respondWithRated("/twitter/rest/followers/followers_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/followers/followers_ids.json")
}
-
"get followers stringified ids of a specific user by id" in new TwitterFollowerClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(followerStringifiedIdsForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=true&user_id=2911461333")
- }.respondWithRated("/twitter/rest/followers/followers_ids_stringified.json").await
+ val result: RatedData[UserStringifiedIds] = when(followerStringifiedIdsForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=true&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/followers/followers_ids_stringified.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/followers/followers_ids_stringified.json")
}
"get followers stringified ids of a specific user by name" in new TwitterFollowerClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(followersStringifiedIdsForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=true")
- }.respondWithRated("/twitter/rest/followers/followers_ids_stringified.json").await
+ val result: RatedData[UserStringifiedIds] = when(followersStringifiedIdsForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/followers/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=true")
+ }
+ .respondWithRated("/twitter/rest/followers/followers_ids_stringified.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/followers/followers_ids_stringified.json")
}
"get followers of a specific user" in new TwitterFollowerClientSpecContext {
- val result: RatedData[Users] = when(followersForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/followers/list.json"
- request.uri.queryString() === Some("count=20&cursor=-1&include_user_entities=true&screen_name=DanielaSfregola&skip_status=false")
- }.respondWithRated("/twitter/rest/followers/followers.json").await
+ val result: RatedData[Users] = when(followersForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/followers/list.json"
+ request.uri.queryString() === Some(
+ "count=20&cursor=-1&include_user_entities=true&screen_name=DanielaSfregola&skip_status=false")
+ }
+ .respondWithRated("/twitter/rest/followers/followers.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/followers/followers.json")
}
"get followers of a specific user by user id" in new TwitterFollowerClientSpecContext {
- val result: RatedData[Users] = when(followersForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/followers/list.json"
- request.uri.queryString() === Some("count=20&cursor=-1&include_user_entities=true&skip_status=false&user_id=2911461333")
- }.respondWithRated("/twitter/rest/followers/followers.json").await
+ val result: RatedData[Users] = when(followersForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/followers/list.json"
+ request.uri.queryString() === Some(
+ "count=20&cursor=-1&include_user_entities=true&skip_status=false&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/followers/followers.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/followers/followers.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClientSpec.scala
index 2af1c535..3579dafd 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friends/TwitterFriendClientSpec.scala
@@ -1,6 +1,5 @@
package com.danielasfregola.twitter4s.http.clients.rest.friends
-
import akka.http.scaladsl.model.HttpMethods
import com.danielasfregola.twitter4s.entities.{RatedData, UserIds, UserStringifiedIds, Users}
import com.danielasfregola.twitter4s.helpers.ClientSpec
@@ -12,61 +11,81 @@ class TwitterFriendClientSpec extends ClientSpec {
"Twitter Friend Client" should {
"get friends ids of a specific user by id" in new TwitterFriendClientSpecContext {
- val result: RatedData[UserIds] = when(friendIdsForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=false&user_id=2911461333")
- }.respondWithRated("/twitter/rest/friends/friends_ids.json").await
+ val result: RatedData[UserIds] = when(friendIdsForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=false&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/friends/friends_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/friends/friends_ids.json")
}
"get friends ids of a specific user by name" in new TwitterFriendClientSpecContext {
- val result: RatedData[UserIds] = when(friendIdsForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=false")
- }.respondWithRated("/twitter/rest/friends/friends_ids.json").await
+ val result: RatedData[UserIds] = when(friendIdsForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=false")
+ }
+ .respondWithRated("/twitter/rest/friends/friends_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/friends/friends_ids.json")
}
"get friends stringified ids of a specific user by id" in new TwitterFriendClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(friendStringifiedIdsForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=true&user_id=2911461333")
- }.respondWithRated("/twitter/rest/friends/friends_ids_stringified.json").await
+ val result: RatedData[UserStringifiedIds] = when(friendStringifiedIdsForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&stringify_ids=true&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/friends/friends_ids_stringified.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/friends/friends_ids_stringified.json")
}
"get friends stringified ids of a specific user by name" in new TwitterFriendClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(friendStringifiedIdsForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
- request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=true")
- }.respondWithRated("/twitter/rest/friends/friends_ids_stringified.json").await
+ val result: RatedData[UserStringifiedIds] = when(friendStringifiedIdsForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friends/ids.json"
+ request.uri.queryString() === Some("count=5000&cursor=-1&screen_name=DanielaSfregola&stringify_ids=true")
+ }
+ .respondWithRated("/twitter/rest/friends/friends_ids_stringified.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/friends/friends_ids_stringified.json")
}
"get friends of a user" in new TwitterFriendClientSpecContext {
- val result: RatedData[Users] = when(friendsForUser("DanielaSfregola", count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friends/list.json"
- request.uri.queryString() === Some("count=10&cursor=-1&include_user_entities=true&screen_name=DanielaSfregola&skip_status=false")
- }.respondWithRated("/twitter/rest/friends/users.json").await
+ val result: RatedData[Users] = when(friendsForUser("DanielaSfregola", count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friends/list.json"
+ request.uri.queryString() === Some(
+ "count=10&cursor=-1&include_user_entities=true&screen_name=DanielaSfregola&skip_status=false")
+ }
+ .respondWithRated("/twitter/rest/friends/users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/friends/users.json")
}
"get friends of a user by user id" in new TwitterFriendClientSpecContext {
- val result: RatedData[Users] = when(friendsForUserId(2911461333L, count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friends/list.json"
- request.uri.queryString() === Some("count=10&cursor=-1&include_user_entities=true&skip_status=false&user_id=2911461333")
- }.respondWithRated("/twitter/rest/friends/users.json").await
+ val result: RatedData[Users] = when(friendsForUserId(2911461333L, count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friends/list.json"
+ request.uri.queryString() === Some(
+ "count=10&cursor=-1&include_user_entities=true&skip_status=false&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/friends/users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/friends/users.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClientSpec.scala
index 496ccc9e..f6b10f55 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/friendships/TwitterFriendshipClientSpec.scala
@@ -1,6 +1,5 @@
package com.danielasfregola.twitter4s.http.clients.rest.friendships
-
import akka.http.scaladsl.model.HttpMethods
import com.danielasfregola.twitter4s.entities._
import com.danielasfregola.twitter4s.helpers.ClientSpec
@@ -12,219 +11,289 @@ class TwitterFriendshipClientSpec extends ClientSpec {
"Twitter Friendship Client" should {
"get all blocked users" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[Seq[Long]] = when(noRetweetsUserIds).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/no_retweets/ids.json"
- request.uri.queryString() === Some("stringify_ids=false")
- }.respondWithRated("/twitter/rest/friendships/blocked_users.json").await
+ val result: RatedData[Seq[Long]] = when(noRetweetsUserIds)
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/no_retweets/ids.json"
+ request.uri.queryString() === Some("stringify_ids=false")
+ }
+ .respondWithRated("/twitter/rest/friendships/blocked_users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Long]]("/fixtures/rest/friendships/blocked_users.json")
}
"get all blocked users stringified" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[Seq[String]] = when(noRetweetsUserStringifiedIds).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/no_retweets/ids.json"
- request.uri.queryString() === Some("stringify_ids=true")
- }.respondWithRated("/twitter/rest/friendships/blocked_users_stringified.json").await
+ val result: RatedData[Seq[String]] = when(noRetweetsUserStringifiedIds)
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/no_retweets/ids.json"
+ request.uri.queryString() === Some("stringify_ids=true")
+ }
+ .respondWithRated("/twitter/rest/friendships/blocked_users_stringified.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[String]]("/fixtures/rest/friendships/blocked_users_stringified.json")
}
"get incoming friendships" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[UserIds] = when(incomingFriendshipIds()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/incoming.json"
- request.uri.queryString() === Some("cursor=-1&stringify_ids=false")
- }.respondWithRated("/twitter/rest/friendships/incoming_friendships_ids.json").await
+ val result: RatedData[UserIds] = when(incomingFriendshipIds())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/incoming.json"
+ request.uri.queryString() === Some("cursor=-1&stringify_ids=false")
+ }
+ .respondWithRated("/twitter/rest/friendships/incoming_friendships_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/friendships/incoming_friendships_ids.json")
}
"get incoming friendships stringified" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(incomingFriendshipStringifiedIds()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/incoming.json"
- request.uri.queryString() === Some("cursor=-1&stringify_ids=true")
- }.respondWithRated("/twitter/rest/friendships/incoming_friendships_ids_stringified.json").await
+ val result: RatedData[UserStringifiedIds] = when(incomingFriendshipStringifiedIds())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/incoming.json"
+ request.uri.queryString() === Some("cursor=-1&stringify_ids=true")
+ }
+ .respondWithRated("/twitter/rest/friendships/incoming_friendships_ids_stringified.json")
+ .await
result.rate_limit === rateLimit
- result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/friendships/incoming_friendships_ids_stringified.json")
+ result.data === loadJsonAs[UserStringifiedIds](
+ "/fixtures/rest/friendships/incoming_friendships_ids_stringified.json")
}
"get outgoing friendships" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[UserIds] = when(outgoingFriendshipIds()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/outgoing.json"
- request.uri.queryString() === Some("cursor=-1&stringify_ids=false")
- }.respondWithRated("/twitter/rest/friendships/outgoing_friendships_ids.json").await
+ val result: RatedData[UserIds] = when(outgoingFriendshipIds())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/outgoing.json"
+ request.uri.queryString() === Some("cursor=-1&stringify_ids=false")
+ }
+ .respondWithRated("/twitter/rest/friendships/outgoing_friendships_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/friendships/outgoing_friendships_ids.json")
}
"get outgoing friendships stringified" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(outgoingFriendshipStringifiedIds()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/outgoing.json"
- request.uri.queryString() === Some("cursor=-1&stringify_ids=true")
- }.respondWithRated("/twitter/rest/friendships/outgoing_friendships_ids_stringified.json").await
+ val result: RatedData[UserStringifiedIds] = when(outgoingFriendshipStringifiedIds())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/outgoing.json"
+ request.uri.queryString() === Some("cursor=-1&stringify_ids=true")
+ }
+ .respondWithRated("/twitter/rest/friendships/outgoing_friendships_ids_stringified.json")
+ .await
result.rate_limit === rateLimit
- result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/friendships/outgoing_friendships_ids_stringified.json")
+ result.data === loadJsonAs[UserStringifiedIds](
+ "/fixtures/rest/friendships/outgoing_friendships_ids_stringified.json")
}
"follow a user" in new TwitterFriendshipClientSpecContext {
- val result: User = when(followUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/create.json"
- request.uri.queryString() === Some("follow=true&screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/friendships/follow.json").await
+ val result: User = when(followUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/create.json"
+ request.uri.queryString() === Some("follow=true&screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/friendships/follow.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/friendships/follow.json")
}
"follow a user by user id" in new TwitterFriendshipClientSpecContext {
- val result: User = when(followUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/create.json"
- request.uri.queryString() === Some("follow=true&user_id=19018614")
- }.respondWith("/twitter/rest/friendships/follow.json").await
+ val result: User = when(followUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/create.json"
+ request.uri.queryString() === Some("follow=true&user_id=19018614")
+ }
+ .respondWith("/twitter/rest/friendships/follow.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/friendships/follow.json")
}
"unfollow a user" in new TwitterFriendshipClientSpecContext {
- val result: User = when(unfollowUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/destroy.json"
- request.uri.queryString() === Some("screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/friendships/unfollow.json").await
+ val result: User = when(unfollowUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/destroy.json"
+ request.uri.queryString() === Some("screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/friendships/unfollow.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/friendships/unfollow.json")
}
"unfollow a user by user id" in new TwitterFriendshipClientSpecContext {
- val result: User = when(unfollowUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/destroy.json"
- request.uri.queryString() === Some("user_id=19018614")
- }.respondWith("/twitter/rest/friendships/unfollow.json").await
+ val result: User = when(unfollowUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/destroy.json"
+ request.uri.queryString() === Some("user_id=19018614")
+ }
+ .respondWith("/twitter/rest/friendships/unfollow.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/friendships/unfollow.json")
}
-
+
"enable retweets notifications for a user" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(enableRetweetsNotificationsForUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("retweets=true&screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(enableRetweetsNotificationsForUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("retweets=true&screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
"enable retweets notifications for a user by user id" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(enableRetweetsNotificationsForUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("retweets=true&user_id=19018614")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(enableRetweetsNotificationsForUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("retweets=true&user_id=19018614")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
"disable retweets notifications for a user" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(disableRetweetsNotificationsForUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("retweets=false&screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(disableRetweetsNotificationsForUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("retweets=false&screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
"disable retweets notifications for a user by user id" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(disableRetweetsNotificationsForUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("retweets=false&user_id=19018614")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(disableRetweetsNotificationsForUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("retweets=false&user_id=19018614")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
"enable device notifications for a user" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(enableDeviceNotificationsForUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("device=true&screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(enableDeviceNotificationsForUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("device=true&screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
"enable device notifications for a user by user id" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(enableDeviceNotificationsForUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("device=true&user_id=19018614")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(enableDeviceNotificationsForUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("device=true&user_id=19018614")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
"disable device notifications for a user" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(disableDeviceNotificationsForUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("device=false&screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(disableDeviceNotificationsForUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("device=false&screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
"disable device notifications for a user by user id" in new TwitterFriendshipClientSpecContext {
- val result: Relationship = when(disableDeviceNotificationsForUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
- request.uri.queryString() === Some("device=false&user_id=19018614")
- }.respondWith("/twitter/rest/friendships/update.json").await
+ val result: Relationship = when(disableDeviceNotificationsForUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/update.json"
+ request.uri.queryString() === Some("device=false&user_id=19018614")
+ }
+ .respondWith("/twitter/rest/friendships/update.json")
+ .await
result === loadJsonAs[Relationship]("/fixtures/rest/friendships/update.json")
}
-
+
"get a relationship by ids" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[Relationship] = when(relationshipBetweenUserIds(2911461333L, 19018614L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/show.json"
- request.uri.queryString() === Some("source_id=2911461333&target_id=19018614")
- }.respondWithRated("/twitter/rest/friendships/relationship.json").await
+ val result: RatedData[Relationship] = when(relationshipBetweenUserIds(2911461333L, 19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/show.json"
+ request.uri.queryString() === Some("source_id=2911461333&target_id=19018614")
+ }
+ .respondWithRated("/twitter/rest/friendships/relationship.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Relationship]("/fixtures/rest/friendships/relationship.json")
}
-
+
"get a relationship by screen names" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[Relationship] = when(relationshipBetweenUsers("DanielaSfregola", "marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/show.json"
- request.uri.queryString() === Some("source_screen_name=DanielaSfregola&target_screen_name=marcobonzanini")
- }.respondWithRated("/twitter/rest/friendships/relationship.json").await
+ val result: RatedData[Relationship] = when(relationshipBetweenUsers("DanielaSfregola", "marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/show.json"
+ request.uri.queryString() === Some("source_screen_name=DanielaSfregola&target_screen_name=marcobonzanini")
+ }
+ .respondWithRated("/twitter/rest/friendships/relationship.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Relationship]("/fixtures/rest/friendships/relationship.json")
}
"get relationships with a list of users" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[Seq[LookupRelationship]] = when(relationshipsWithUsers("marcobonzanini", "odersky")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/lookup.json"
- request.uri.queryString() === Some("screen_name=marcobonzanini,odersky")
- }.respondWithRated("/twitter/rest/friendships/relationships.json").await
+ val result: RatedData[Seq[LookupRelationship]] = when(relationshipsWithUsers("marcobonzanini", "odersky"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/lookup.json"
+ request.uri.queryString() === Some("screen_name=marcobonzanini,odersky")
+ }
+ .respondWithRated("/twitter/rest/friendships/relationships.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[LookupRelationship]]("/fixtures/rest/friendships/relationships.json")
}
"reject request if no ids have been provided for the lookup" in new TwitterFriendshipClientSpecContext {
- relationshipsWithUsers() must throwA[IllegalArgumentException]("requirement failed: please, provide at least one screen name")
+ relationshipsWithUsers() must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one screen name")
}
"get relationships with a list of users by user id" in new TwitterFriendshipClientSpecContext {
- val result: RatedData[Seq[LookupRelationship]] = when(relationshipsWithUserIds(2911461333L, 2911461334L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/friendships/lookup.json"
- request.uri.queryString() === Some("user_id=2911461333,2911461334")
- }.respondWithRated("/twitter/rest/friendships/relationships.json").await
+ val result: RatedData[Seq[LookupRelationship]] = when(relationshipsWithUserIds(2911461333L, 2911461334L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/friendships/lookup.json"
+ request.uri.queryString() === Some("user_id=2911461333,2911461334")
+ }
+ .respondWithRated("/twitter/rest/friendships/relationships.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[LookupRelationship]]("/fixtures/rest/friendships/relationships.json")
}
"reject request if no ids have been provided for the lookup" in new TwitterFriendshipClientSpecContext {
- relationshipsWithUserIds() must throwA[IllegalArgumentException]("requirement failed: please, provide at least one user id")
+ relationshipsWithUserIds() must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one user id")
}
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClientSpec.scala
index f80b2f33..7f808e00 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/geo/TwitterGeoClientSpec.scala
@@ -12,46 +12,60 @@ class TwitterGeoClientSpec extends ClientSpec {
"get a geo place by id" in new TwitterGeoClientSpecContext {
val placeId = "df51dec6f4ee2b2c"
- val result: RatedData[GeoPlace] = when(geoPlace(placeId)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/geo/id/$placeId.json"
- }.respondWithRated("/twitter/rest/geo/geo_place.json").await
+ val result: RatedData[GeoPlace] = when(geoPlace(placeId))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/geo/id/$placeId.json"
+ }
+ .respondWithRated("/twitter/rest/geo/geo_place.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[GeoPlace]("/fixtures/rest/geo/geo_place.json")
}
"perform a reverse geocode search" in new TwitterGeoClientSpecContext {
- val result: RatedData[GeoSearch] = when(reverseGeocode(-122.42284884, 37.76893497)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/geo/reverse_geocode.json"
- request.uri.queryString() === Some("accuracy=0m&granularity=neighborhood&lat=-122.42284884&long=37.76893497")
- }.respondWithRated("/twitter/rest/geo/reverse_geocode.json").await
+ val result: RatedData[GeoSearch] = when(reverseGeocode(-122.42284884, 37.76893497))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/geo/reverse_geocode.json"
+ request.uri.queryString() === Some("accuracy=0m&granularity=neighborhood&lat=-122.42284884&long=37.76893497")
+ }
+ .respondWithRated("/twitter/rest/geo/reverse_geocode.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[GeoSearch]("/fixtures/rest/geo/reverse_geocode.json")
}
"search a geo place" in new TwitterGeoClientSpecContext {
- val result: RatedData[GeoSearch] = when(searchGeoPlace("Creazzo")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/geo/search.json"
- request.uri.queryString() === Some("query=Creazzo")
- }.respondWithRated("/twitter/rest/geo/search.json").await
+ val result: RatedData[GeoSearch] = when(searchGeoPlace("Creazzo"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/geo/search.json"
+ request.uri.queryString() === Some("query=Creazzo")
+ }
+ .respondWithRated("/twitter/rest/geo/search.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[GeoSearch]("/fixtures/rest/geo/search.json")
}
"perform an advanced search of a geo place" in new TwitterGeoClientSpecContext {
- val result: RatedData[GeoSearch] = when(advancedSearchGeoPlace(query = Some("Creazzo"), street_address = Some("Via Giotto 15"))).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/geo/search.json"
- request.uri.queryString() === Some("attribute:street_address=Via+Giotto+15&query=Creazzo")
- }.respondWithRated("/twitter/rest/geo/advanced_search.json").await
+ val result: RatedData[GeoSearch] =
+ when(advancedSearchGeoPlace(query = Some("Creazzo"), street_address = Some("Via Giotto 15")))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/geo/search.json"
+ request.uri.queryString() === Some("attribute:street_address=Via+Giotto+15&query=Creazzo")
+ }
+ .respondWithRated("/twitter/rest/geo/advanced_search.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[GeoSearch]("/fixtures/rest/geo/advanced_search.json")
}
"reject advanced search if no latitude or longitude or ip or query have been provided" in new TwitterGeoClientSpecContext {
- val msg = "requirement failed: please, provide at least one of the following: 'latitude', 'longitude', 'query', 'ip'"
+ val msg =
+ "requirement failed: please, provide at least one of the following: 'latitude', 'longitude', 'query', 'ip'"
advancedSearchGeoPlace(street_address = Some("Via Giotto 15")) must throwA[IllegalArgumentException](msg)
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClientSpec.scala
index 3174f07a..2dfe524e 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/help/TwitterHelpClientSpec.scala
@@ -11,37 +11,49 @@ class TwitterHelpClientSpec extends ClientSpec {
"Twitter Help Client" should {
"get twitter configuration" in new TwitterHelpClientSpecContext {
- val result: RatedData[Configuration] = when(configuration()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/help/configuration.json"
- }.respondWithRated("/twitter/rest/help/configuration.json").await
+ val result: RatedData[Configuration] = when(configuration())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/help/configuration.json"
+ }
+ .respondWithRated("/twitter/rest/help/configuration.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Configuration]("/fixtures/rest/help/configuration.json")
}
"get supported languages" in new TwitterHelpClientSpecContext {
- val result: RatedData[Seq[LanguageDetails]] = when(supportedLanguages()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/help/languages.json"
- }.respondWithRated("/twitter/rest/help/languages.json").await
+ val result: RatedData[Seq[LanguageDetails]] = when(supportedLanguages())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/help/languages.json"
+ }
+ .respondWithRated("/twitter/rest/help/languages.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[LanguageDetails]]("/fixtures/rest/help/languages.json")
}
-
+
"get twitter privacy policy" in new TwitterHelpClientSpecContext {
- val result: RatedData[PrivacyPolicy] = when(privacyPolicy()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/help/privacy.json"
- }.respondWithRated("/twitter/rest/help/privacy.json").await
+ val result: RatedData[PrivacyPolicy] = when(privacyPolicy())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/help/privacy.json"
+ }
+ .respondWithRated("/twitter/rest/help/privacy.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[PrivacyPolicy]("/fixtures/rest/help/privacy.json")
}
"get twitter terms of service" in new TwitterHelpClientSpecContext {
- val result: RatedData[TermsOfService] = when(termsOfService()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/help/tos.json"
- }.respondWithRated("/twitter/rest/help/tos.json").await
+ val result: RatedData[TermsOfService] = when(termsOfService())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/help/tos.json"
+ }
+ .respondWithRated("/twitter/rest/help/tos.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TermsOfService]("/fixtures/rest/help/tos.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClientSpec.scala
index be3bdb6e..353ab15d 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/lists/TwitterListClientSpec.scala
@@ -12,642 +12,877 @@ class TwitterListClientSpec extends ClientSpec {
"Twitter List Client" should {
"get lists for a user" in new TwitterListClientSpecContext {
- val result: RatedData[Seq[TwitterList]] = when(listsForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/list.json"
- request.uri.queryString() === Some("reverse=false&screen_name=DanielaSfregola")
- }.respondWithRated("/twitter/rest/lists/lists.json").await
+ val result: RatedData[Seq[TwitterList]] = when(listsForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/list.json"
+ request.uri.queryString() === Some("reverse=false&screen_name=DanielaSfregola")
+ }
+ .respondWithRated("/twitter/rest/lists/lists.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[TwitterList]]("/fixtures/rest/lists/lists.json")
}
"get lists for a user by id" in new TwitterListClientSpecContext {
- val result: RatedData[Seq[TwitterList]] = when(listsForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/list.json"
- request.uri.queryString() === Some("reverse=false&user_id=2911461333")
- }.respondWithRated("/twitter/rest/lists/lists.json").await
+ val result: RatedData[Seq[TwitterList]] = when(listsForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/list.json"
+ request.uri.queryString() === Some("reverse=false&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/lists/lists.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[TwitterList]]("/fixtures/rest/lists/lists.json")
}
"get a list timeline by id" in new TwitterListClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(listTimelineByListId(8044403)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/statuses.json"
- request.uri.queryString() === Some("count=20&include_entities=true&include_rts=false&list_id=8044403")
- }.respondWithRated("/twitter/rest/lists/timeline.json").await
+ val result: RatedData[Seq[Tweet]] = when(listTimelineByListId(8044403))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/statuses.json"
+ request.uri.queryString() === Some("count=20&include_entities=true&include_rts=false&list_id=8044403")
+ }
+ .respondWithRated("/twitter/rest/lists/timeline.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/lists/timeline.json")
}
"get a list timeline by slug and owner" in new TwitterListClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(listTimelineBySlugAndOwnerName("meetup-20100301", "twitterapi")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/statuses.json"
- request.uri.queryString() === Some("count=20&include_entities=true&include_rts=false&owner_screen_name=twitterapi&slug=meetup-20100301")
- }.respondWithRated("/twitter/rest/lists/timeline.json").await
+ val result: RatedData[Seq[Tweet]] = when(listTimelineBySlugAndOwnerName("meetup-20100301", "twitterapi"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/statuses.json"
+ request.uri.queryString() === Some(
+ "count=20&include_entities=true&include_rts=false&owner_screen_name=twitterapi&slug=meetup-20100301")
+ }
+ .respondWithRated("/twitter/rest/lists/timeline.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/lists/timeline.json")
}
"get a list timeline by slug and owner id" in new TwitterListClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(listTimelineBySlugAndOwnerId("meetup-20100301", 6253282)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/statuses.json"
- request.uri.queryString() === Some("count=20&include_entities=true&include_rts=false&owner_id=6253282&slug=meetup-20100301")
- }.respondWithRated("/twitter/rest/lists/timeline.json").await
+ val result: RatedData[Seq[Tweet]] = when(listTimelineBySlugAndOwnerId("meetup-20100301", 6253282))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/statuses.json"
+ request.uri.queryString() === Some(
+ "count=20&include_entities=true&include_rts=false&owner_id=6253282&slug=meetup-20100301")
+ }
+ .respondWithRated("/twitter/rest/lists/timeline.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/lists/timeline.json")
}
"remove list member by list id and user" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMemberByListId(8044403, "DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
- request.uri.queryString() === Some("list_id=8044403&screen_name=DanielaSfregola")
- }.respondWithOk.await
+ val result: Unit = when(removeListMemberByListId(8044403, "DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
+ request.uri.queryString() === Some("list_id=8044403&screen_name=DanielaSfregola")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove list member by slug and owner and user" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMemberBySlugAndOwnerName("meetup-20100301", "twitterapi", "DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
- request.uri.queryString() === Some("owner_screen_name=twitterapi&screen_name=DanielaSfregola&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(removeListMemberBySlugAndOwnerName("meetup-20100301", "twitterapi", "DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
+ request.uri.queryString() === Some(
+ "owner_screen_name=twitterapi&screen_name=DanielaSfregola&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove list member by slug and owner id and user" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMemberBySlugAndOwnerId("meetup-20100301", 6253282, "DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
- request.uri.queryString() === Some("owner_id=6253282&screen_name=DanielaSfregola&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(removeListMemberBySlugAndOwnerId("meetup-20100301", 6253282, "DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
+ request.uri.queryString() === Some("owner_id=6253282&screen_name=DanielaSfregola&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove list member by list id and user id" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMemberIdByListId(8044403, 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
- request.uri.queryString() === Some("list_id=8044403&user_id=2911461333")
- }.respondWithOk.await
+ val result: Unit = when(removeListMemberIdByListId(8044403, 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
+ request.uri.queryString() === Some("list_id=8044403&user_id=2911461333")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove list member by slug and owner and user id" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMemberIdBySlugAndOwnerName("meetup-20100301", "twitterapi", 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
- request.uri.queryString() === Some("owner_screen_name=twitterapi&slug=meetup-20100301&user_id=2911461333")
- }.respondWithOk.await
+ val result: Unit = when(removeListMemberIdBySlugAndOwnerName("meetup-20100301", "twitterapi", 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
+ request.uri.queryString() === Some("owner_screen_name=twitterapi&slug=meetup-20100301&user_id=2911461333")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove list member by slug and owner id and user id" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMemberIdBySlugAndOwnerId("meetup-20100301", 6253282, 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
- request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301&user_id=2911461333")
- }.respondWithOk.await
+ val result: Unit = when(removeListMemberIdBySlugAndOwnerId("meetup-20100301", 6253282, 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy.json"
+ request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301&user_id=2911461333")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"get list memberships per user" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterLists] = when(listMembershipsForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/memberships.json"
- request.uri.queryString() === Some("count=20&cursor=-1&filter_to_owned_lists=false&screen_name=DanielaSfregola")
- }.respondWithRated("/twitter/rest/lists/memberships.json").await
+ val result: RatedData[TwitterLists] = when(listMembershipsForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/memberships.json"
+ request.uri.queryString() === Some(
+ "count=20&cursor=-1&filter_to_owned_lists=false&screen_name=DanielaSfregola")
+ }
+ .respondWithRated("/twitter/rest/lists/memberships.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterLists]("/fixtures/rest/lists/memberships.json")
}
"get list memberships per user id" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterLists] = when(listMembershipsForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/memberships.json"
- request.uri.queryString() === Some("count=20&cursor=-1&filter_to_owned_lists=false&user_id=2911461333")
- }.respondWithRated("/twitter/rest/lists/memberships.json").await
+ val result: RatedData[TwitterLists] = when(listMembershipsForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/memberships.json"
+ request.uri.queryString() === Some("count=20&cursor=-1&filter_to_owned_lists=false&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/lists/memberships.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterLists]("/fixtures/rest/lists/memberships.json")
}
"add members ids per list id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberIdsByListId(8044403, Seq(2911461333L, 2911461334L))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
- request.uri.queryString() === Some("list_id=8044403&user_id=2911461333,2911461334")
- }.respondWithOk.await
+ val result: Unit = when(addListMemberIdsByListId(8044403, Seq(2911461333L, 2911461334L)))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
+ request.uri.queryString() === Some("list_id=8044403&user_id=2911461333,2911461334")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add members ids per slug and owner" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberIdsBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq(2911461333L, 2911461334L))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
- request.uri.queryString() === Some("owner_screen_name=twitterapi&slug=meetup-20100301&user_id=2911461333,2911461334")
- }.respondWithOk.await
+ val result: Unit =
+ when(addListMemberIdsBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq(2911461333L, 2911461334L)))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
+ request.uri.queryString() === Some(
+ "owner_screen_name=twitterapi&slug=meetup-20100301&user_id=2911461333,2911461334")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add members ids per slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberIdsBySlugAndOwnerId("meetup-20100301", 6253282, Seq(2911461333L, 2911461334L))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
- request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301&user_id=2911461333,2911461334")
- }.respondWithOk.await
+ val result: Unit =
+ when(addListMemberIdsBySlugAndOwnerId("meetup-20100301", 6253282, Seq(2911461333L, 2911461334L)))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
+ request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301&user_id=2911461333,2911461334")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add members per list id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMembersByListId(8044403, Seq("marcobonzanini", "odersky"))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
- request.uri.queryString() === Some("list_id=8044403&screen_name=marcobonzanini,odersky")
- }.respondWithOk.await
+ val result: Unit = when(addListMembersByListId(8044403, Seq("marcobonzanini", "odersky")))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
+ request.uri.queryString() === Some("list_id=8044403&screen_name=marcobonzanini,odersky")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add members per slug and owner" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMembersBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq("marcobonzanini", "odersky"))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
- request.uri.queryString() === Some("owner_screen_name=twitterapi&screen_name=marcobonzanini,odersky&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit =
+ when(addListMembersBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq("marcobonzanini", "odersky")))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
+ request.uri.queryString() === Some(
+ "owner_screen_name=twitterapi&screen_name=marcobonzanini,odersky&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add members per slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMembersBySlugAndOwnerId("meetup-20100301", 6253282, Seq("marcobonzanini", "odersky"))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
- request.uri.queryString() === Some("owner_id=6253282&screen_name=marcobonzanini,odersky&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit =
+ when(addListMembersBySlugAndOwnerId("meetup-20100301", 6253282, Seq("marcobonzanini", "odersky")))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create_all.json"
+ request.uri.queryString() === Some(
+ "owner_id=6253282&screen_name=marcobonzanini,odersky&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"reject 'addListMembersIds' if no ids are provided" in new TwitterListClientSpecContext {
- addListMemberIdsByListId(8044403, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one user id")
+ addListMemberIdsByListId(8044403, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one user id")
}
"reject 'addListMembersIdsBySlugAndOwnerName' if no ids are provided" in new TwitterListClientSpecContext {
- addListMemberIdsBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one user id")
+ addListMemberIdsBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq.empty) must throwA[
+ IllegalArgumentException]("requirement failed: please, provide at least one user id")
}
"reject 'addListMembersIdsBySlugAndOwnerId' if no ids are provided" in new TwitterListClientSpecContext {
- addListMemberIdsBySlugAndOwnerId("meetup-20100301", 6253282, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one user id")
+ addListMemberIdsBySlugAndOwnerId("meetup-20100301", 6253282, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one user id")
}
"reject 'addListMembers' if no screen names are provided" in new TwitterListClientSpecContext {
- addListMembersByListId(8044403, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one screen name")
+ addListMembersByListId(8044403, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one screen name")
}
"reject 'addListMembersBySlugAndOwnerName' if no screen names are provided" in new TwitterListClientSpecContext {
- addListMembersBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one screen name")
+ addListMembersBySlugAndOwnerName("meetup-20100301", "twitterapi", Seq.empty) must throwA[
+ IllegalArgumentException]("requirement failed: please, provide at least one screen name")
}
"reject 'addListMembersBySlugAndOwnerId' if no screen names are provided" in new TwitterListClientSpecContext {
- addListMembersBySlugAndOwnerId("meetup-20100301", 6253282, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one screen name")
+ addListMembersBySlugAndOwnerId("meetup-20100301", 6253282, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one screen name")
}
"get member by id per list id" in new TwitterListClientSpecContext {
- val result: RatedData[User] = when(checkListMemberByUserIdAndListId(8044403, 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
- request.uri.queryString() === Some("include_entities=true&list_id=8044403&skip_status=false&user_id=2911461333")
- }.respondWithRated("/twitter/rest/lists/member.json").await
+ val result: RatedData[User] = when(checkListMemberByUserIdAndListId(8044403, 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
+ request.uri.queryString() === Some(
+ "include_entities=true&list_id=8044403&skip_status=false&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/lists/member.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/lists/member.json")
}
"get member by id per slug and owner" in new TwitterListClientSpecContext {
- val result: RatedData[User] = when(checkListMemberByUserIdSlugAndOwnerName("meetup-20100301", "twitterapi", 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
- request.uri.queryString() === Some("include_entities=true&owner_screen_name=twitterapi&skip_status=false&slug=meetup-20100301&user_id=2911461333")
- }.respondWithRated("/twitter/rest/lists/member.json").await
+ val result: RatedData[User] =
+ when(checkListMemberByUserIdSlugAndOwnerName("meetup-20100301", "twitterapi", 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
+ request.uri.queryString() === Some(
+ "include_entities=true&owner_screen_name=twitterapi&skip_status=false&slug=meetup-20100301&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/lists/member.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/lists/member.json")
}
"get member by id per slug and owner id" in new TwitterListClientSpecContext {
- val result: RatedData[User] = when(checkListMemberByUserIdSlugAndOwnerId("meetup-20100301", 6253282, 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
- request.uri.queryString() === Some("include_entities=true&owner_id=6253282&skip_status=false&slug=meetup-20100301&user_id=2911461333")
- }.respondWithRated("/twitter/rest/lists/member.json").await
+ val result: RatedData[User] = when(checkListMemberByUserIdSlugAndOwnerId("meetup-20100301", 6253282, 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
+ request.uri.queryString() === Some(
+ "include_entities=true&owner_id=6253282&skip_status=false&slug=meetup-20100301&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/lists/member.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/lists/member.json")
}
"get member per list id" in new TwitterListClientSpecContext {
- val result: RatedData[User] = when(checkListMemberByUserAndListId(8044403, "DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
- request.uri.queryString() === Some("include_entities=true&list_id=8044403&screen_name=DanielaSfregola&skip_status=false")
- }.respondWithRated("/twitter/rest/lists/member.json").await
+ val result: RatedData[User] = when(checkListMemberByUserAndListId(8044403, "DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
+ request.uri.queryString() === Some(
+ "include_entities=true&list_id=8044403&screen_name=DanielaSfregola&skip_status=false")
+ }
+ .respondWithRated("/twitter/rest/lists/member.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/lists/member.json")
}
"get member per slug and owner" in new TwitterListClientSpecContext {
- val result: RatedData[User] = when(checkListMemberByUserSlugAndOwnerName("meetup-20100301", "twitterapi", "DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
- request.uri.queryString() === Some("include_entities=true&owner_screen_name=twitterapi&screen_name=DanielaSfregola&skip_status=false&slug=meetup-20100301")
- }.respondWithRated("/twitter/rest/lists/member.json").await
+ val result: RatedData[User] =
+ when(checkListMemberByUserSlugAndOwnerName("meetup-20100301", "twitterapi", "DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
+ request.uri.queryString() === Some(
+ "include_entities=true&owner_screen_name=twitterapi&screen_name=DanielaSfregola&skip_status=false&slug=meetup-20100301")
+ }
+ .respondWithRated("/twitter/rest/lists/member.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/lists/member.json")
}
"get member per slug and owner id" in new TwitterListClientSpecContext {
- val result: RatedData[User] = when(checkListMemberByUserSlugAndOwnerId("meetup-20100301", 6253282, "DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
- request.uri.queryString() === Some("include_entities=true&owner_id=6253282&screen_name=DanielaSfregola&skip_status=false&slug=meetup-20100301")
- }.respondWithRated("/twitter/rest/lists/member.json").await
+ val result: RatedData[User] =
+ when(checkListMemberByUserSlugAndOwnerId("meetup-20100301", 6253282, "DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/show.json"
+ request.uri.queryString() === Some(
+ "include_entities=true&owner_id=6253282&screen_name=DanielaSfregola&skip_status=false&slug=meetup-20100301")
+ }
+ .respondWithRated("/twitter/rest/lists/member.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/lists/member.json")
}
"get members of list per list id" in new TwitterListClientSpecContext {
- val result: RatedData[Users] = when(listMembersByListId(8044403)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members.json"
- request.uri.queryString() === Some("count=20&cursor=-1&include_entities=true&list_id=8044403&skip_status=false")
- }.respondWithRated("/twitter/rest/lists/members.json").await
+ val result: RatedData[Users] = when(listMembersByListId(8044403))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members.json"
+ request.uri.queryString() === Some(
+ "count=20&cursor=-1&include_entities=true&list_id=8044403&skip_status=false")
+ }
+ .respondWithRated("/twitter/rest/lists/members.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/lists/members.json")
}
"get members of list per slug and owner" in new TwitterListClientSpecContext {
- val result: RatedData[Users] = when(listMembersBySlugAndOwnerName("meetup-20100301", "twitterapi")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members.json"
- request.uri.queryString() === Some("count=20&cursor=-1&include_entities=true&owner_screen_name=twitterapi&skip_status=false&slug=meetup-20100301")
- }.respondWithRated("/twitter/rest/lists/members.json").await
+ val result: RatedData[Users] = when(listMembersBySlugAndOwnerName("meetup-20100301", "twitterapi"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members.json"
+ request.uri.queryString() === Some(
+ "count=20&cursor=-1&include_entities=true&owner_screen_name=twitterapi&skip_status=false&slug=meetup-20100301")
+ }
+ .respondWithRated("/twitter/rest/lists/members.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/lists/members.json")
}
"get members of list per slug and owner id" in new TwitterListClientSpecContext {
- val result: RatedData[Users] = when(listMembersBySlugAndOwnerId("meetup-20100301", 6253282)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members.json"
- request.uri.queryString() === Some("count=20&cursor=-1&include_entities=true&owner_id=6253282&skip_status=false&slug=meetup-20100301")
- }.respondWithRated("/twitter/rest/lists/members.json").await
+ val result: RatedData[Users] = when(listMembersBySlugAndOwnerId("meetup-20100301", 6253282))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members.json"
+ request.uri.queryString() === Some(
+ "count=20&cursor=-1&include_entities=true&owner_id=6253282&skip_status=false&slug=meetup-20100301")
+ }
+ .respondWithRated("/twitter/rest/lists/members.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/lists/members.json")
}
"add member id to list id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberIdByListId(8044403, 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
- request.uri.queryString() === Some("list_id=8044403&user_id=2911461333")
- }.respondWithOk.await
+ val result: Unit = when(addListMemberIdByListId(8044403, 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
+ request.uri.queryString() === Some("list_id=8044403&user_id=2911461333")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add member id to slug and owner" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberIdBySlugAndOwnerName("meetup-20100301", "twitterapi", 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
- request.uri.queryString() === Some("owner_screen_name=twitterapi&slug=meetup-20100301&user_id=2911461333")
- }.respondWithOk.await
+ val result: Unit = when(addListMemberIdBySlugAndOwnerName("meetup-20100301", "twitterapi", 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
+ request.uri.queryString() === Some("owner_screen_name=twitterapi&slug=meetup-20100301&user_id=2911461333")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add member id to slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberIdBySlugAndOwnerId("meetup-20100301", 6253282, 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
- request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301&user_id=2911461333")
- }.respondWithOk.await
+ val result: Unit = when(addListMemberIdBySlugAndOwnerId("meetup-20100301", 6253282, 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
+ request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301&user_id=2911461333")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add member per list id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberByListId(8044403, "marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
- request.uri.queryString() === Some("list_id=8044403&screen_name=marcobonzanini")
- }.respondWithOk.await
+ val result: Unit = when(addListMemberByListId(8044403, "marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
+ request.uri.queryString() === Some("list_id=8044403&screen_name=marcobonzanini")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add member per slug and owner" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberBySlugAndOwnerName("meetup-20100301", "twitterapi", "marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
- request.uri.queryString() === Some("owner_screen_name=twitterapi&screen_name=marcobonzanini&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(addListMemberBySlugAndOwnerName("meetup-20100301", "twitterapi", "marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
+ request.uri.queryString() === Some(
+ "owner_screen_name=twitterapi&screen_name=marcobonzanini&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"add member per slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(addListMemberBySlugAndOwnerId("meetup-20100301", 6253282, "marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
- request.uri.queryString() === Some("owner_id=6253282&screen_name=marcobonzanini&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(addListMemberBySlugAndOwnerId("meetup-20100301", 6253282, "marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/create.json"
+ request.uri.queryString() === Some("owner_id=6253282&screen_name=marcobonzanini&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"delete a list by id" in new TwitterListClientSpecContext {
- val result: TwitterList = when(deleteListById(8044403)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/destroy.json"
- request.uri.queryString() === Some("list_id=8044403")
- }.respondWith("/twitter/rest/lists/destroy.json").await
+ val result: TwitterList = when(deleteListById(8044403))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/destroy.json"
+ request.uri.queryString() === Some("list_id=8044403")
+ }
+ .respondWith("/twitter/rest/lists/destroy.json")
+ .await
result === loadJsonAs[TwitterList]("/fixtures/rest/lists/destroy.json")
}
"delete a list by slug and owner id" in new TwitterListClientSpecContext {
- val result: TwitterList = when(deleteListBySlugAndOwnerId("meetup-20100301", 6253282)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/destroy.json"
- request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301")
- }.respondWith("/twitter/rest/lists/destroy.json").await
+ val result: TwitterList = when(deleteListBySlugAndOwnerId("meetup-20100301", 6253282))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/destroy.json"
+ request.uri.queryString() === Some("owner_id=6253282&slug=meetup-20100301")
+ }
+ .respondWith("/twitter/rest/lists/destroy.json")
+ .await
result === loadJsonAs[TwitterList]("/fixtures/rest/lists/destroy.json")
}
"delete a list by slug and owner" in new TwitterListClientSpecContext {
- val result: TwitterList = when(deleteListBySlugAndOwnerName("meetup-20100301", "twitterapi")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/destroy.json"
- request.uri.queryString() === Some("owner_screen_name=twitterapi&slug=meetup-20100301")
- }.respondWith("/twitter/rest/lists/destroy.json").await
+ val result: TwitterList = when(deleteListBySlugAndOwnerName("meetup-20100301", "twitterapi"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/destroy.json"
+ request.uri.queryString() === Some("owner_screen_name=twitterapi&slug=meetup-20100301")
+ }
+ .respondWith("/twitter/rest/lists/destroy.json")
+ .await
result === loadJsonAs[TwitterList]("/fixtures/rest/lists/destroy.json")
}
"update list mode by id" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListMode(8044403, Mode.Private)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("list_id=8044403&mode=private")
- }.respondWithOk.await
+ val result: Unit = when(updateListMode(8044403, Mode.Private))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("list_id=8044403&mode=private")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list mode by slug and owner name" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListModeBySlugAndOwnerName("meetup-20100301", "twitterapi", Mode.Private)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("mode=private&owner_screen_name=twitterapi&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(updateListModeBySlugAndOwnerName("meetup-20100301", "twitterapi", Mode.Private))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("mode=private&owner_screen_name=twitterapi&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list mode by slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListModeBySlugAndOwnerId("meetup-20100301", 6253282, Mode.Private)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("mode=private&owner_id=6253282&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(updateListModeBySlugAndOwnerId("meetup-20100301", 6253282, Mode.Private))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("mode=private&owner_id=6253282&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list name by id" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListName(8044403, "new name")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("list_id=8044403&name=new+name")
- }.respondWithOk.await
+ val result: Unit = when(updateListName(8044403, "new name"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("list_id=8044403&name=new+name")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list name by slug and owner name" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListNameBySlugAndOwnerName("meetup-20100301", "twitterapi", "new name")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("name=new+name&owner_screen_name=twitterapi&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(updateListNameBySlugAndOwnerName("meetup-20100301", "twitterapi", "new name"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("name=new+name&owner_screen_name=twitterapi&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list name by slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListNameBySlugAndOwnerId("meetup-20100301", 6253282, "new name")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("name=new+name&owner_id=6253282&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(updateListNameBySlugAndOwnerId("meetup-20100301", 6253282, "new name"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("name=new+name&owner_id=6253282&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list description by id" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListDescription(8044403, "cool description")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("description=cool+description&list_id=8044403")
- }.respondWithOk.await
+ val result: Unit = when(updateListDescription(8044403, "cool description"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("description=cool+description&list_id=8044403")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list description by slug and owner name" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListDescriptionBySlugAndOwnerName("meetup-20100301", "twitterapi", "cool description")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("description=cool+description&owner_screen_name=twitterapi&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit =
+ when(updateListDescriptionBySlugAndOwnerName("meetup-20100301", "twitterapi", "cool description"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some(
+ "description=cool+description&owner_screen_name=twitterapi&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list description by slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(updateListDescriptionBySlugAndOwnerId("meetup-20100301", 6253282, "cool description")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("description=cool+description&owner_id=6253282&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(updateListDescriptionBySlugAndOwnerId("meetup-20100301", 6253282, "cool description"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("description=cool+description&owner_id=6253282&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list by id" in new TwitterListClientSpecContext {
val update = TwitterListUpdate(mode = Some(Mode.Private), description = Some("cool description"))
- val result: Unit = when(updateList(8044403, update)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("description=cool+description&list_id=8044403&mode=private")
- }.respondWithOk.await
+ val result: Unit = when(updateList(8044403, update))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some("description=cool+description&list_id=8044403&mode=private")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list by slug and owner name" in new TwitterListClientSpecContext {
val update = TwitterListUpdate(mode = Some(Mode.Private), description = Some("cool description"))
- val result: Unit = when(updateListBySlugAndOwnerName("meetup-20100301", "twitterapi", update)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("description=cool+description&mode=private&owner_screen_name=twitterapi&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(updateListBySlugAndOwnerName("meetup-20100301", "twitterapi", update))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some(
+ "description=cool+description&mode=private&owner_screen_name=twitterapi&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"update list by slug and owner id" in new TwitterListClientSpecContext {
val update = TwitterListUpdate(mode = Some(Mode.Private), description = Some("cool description"))
- val result: Unit = when(updateListBySlugAndOwnerId("meetup-20100301", 6253282, update)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
- request.uri.queryString() === Some("description=cool+description&mode=private&owner_id=6253282&slug=meetup-20100301")
- }.respondWithOk.await
+ val result: Unit = when(updateListBySlugAndOwnerId("meetup-20100301", 6253282, update))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/update.json"
+ request.uri.queryString() === Some(
+ "description=cool+description&mode=private&owner_id=6253282&slug=meetup-20100301")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"create a list" in new TwitterListClientSpecContext {
- val result: TwitterList = when(createList("my-list", Mode.Private, Some("a nice description"))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/create.json"
- request.uri.queryString() === Some("description=a+nice+description&mode=private&name=my-list")
- }.respondWith("/twitter/rest/lists/create.json").await
+ val result: TwitterList = when(createList("my-list", Mode.Private, Some("a nice description")))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/create.json"
+ request.uri.queryString() === Some("description=a+nice+description&mode=private&name=my-list")
+ }
+ .respondWith("/twitter/rest/lists/create.json")
+ .await
result === loadJsonAs[TwitterList]("/fixtures/rest/lists/create.json")
}
"get list by id" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterList] = when(listById(222669735)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/show.json"
- request.uri.queryString() === Some("list_id=222669735")
- }.respondWithRated("/twitter/rest/lists/show.json").await
+ val result: RatedData[TwitterList] = when(listById(222669735))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/show.json"
+ request.uri.queryString() === Some("list_id=222669735")
+ }
+ .respondWithRated("/twitter/rest/lists/show.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterList]("/fixtures/rest/lists/show.json")
}
"get list by slug and owner name" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterList] = when(listBySlugAndOwnerName("my-list", "Daniela Sfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/show.json"
- request.uri.queryString() === Some("owner_screen_name=Daniela+Sfregola&slug=my-list")
- }.respondWithRated("/twitter/rest/lists/show.json").await
+ val result: RatedData[TwitterList] = when(listBySlugAndOwnerName("my-list", "Daniela Sfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/show.json"
+ request.uri.queryString() === Some("owner_screen_name=Daniela+Sfregola&slug=my-list")
+ }
+ .respondWithRated("/twitter/rest/lists/show.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterList]("/fixtures/rest/lists/show.json")
}
"get list by slug and owner id" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterList] = when(listBySlugAndOwnerId("my-list", 2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/show.json"
- request.uri.queryString() === Some("owner_id=2911461333&slug=my-list")
- }.respondWithRated("/twitter/rest/lists/show.json").await
+ val result: RatedData[TwitterList] = when(listBySlugAndOwnerId("my-list", 2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/show.json"
+ request.uri.queryString() === Some("owner_id=2911461333&slug=my-list")
+ }
+ .respondWithRated("/twitter/rest/lists/show.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterList]("/fixtures/rest/lists/show.json")
}
"get list subscriptions" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterLists] = when(listSubscriptions("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/subscriptions.json"
- request.uri.queryString() === Some("count=20&cursor=-1&screen_name=DanielaSfregola")
- }.respondWithRated("/twitter/rest/lists/subscriptions.json").await
+ val result: RatedData[TwitterLists] = when(listSubscriptions("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/subscriptions.json"
+ request.uri.queryString() === Some("count=20&cursor=-1&screen_name=DanielaSfregola")
+ }
+ .respondWithRated("/twitter/rest/lists/subscriptions.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterLists]("/fixtures/rest/lists/subscriptions.json")
}
"get list subscriptions by user id" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterLists] = when(listSubscriptionsByUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/subscriptions.json"
- request.uri.queryString() === Some("count=20&cursor=-1&user_id=2911461333")
- }.respondWithRated("/twitter/rest/lists/subscriptions.json").await
+ val result: RatedData[TwitterLists] = when(listSubscriptionsByUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/subscriptions.json"
+ request.uri.queryString() === Some("count=20&cursor=-1&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/lists/subscriptions.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterLists]("/fixtures/rest/lists/subscriptions.json")
}
"remove members from list" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMembers(222669735, Seq("marcobonzanini", "odersky"))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
- request.uri.queryString() === Some("list_id=222669735&screen_name=marcobonzanini,odersky")
- }.respondWithOk.await
+ val result: Unit = when(removeListMembers(222669735, Seq("marcobonzanini", "odersky")))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
+ request.uri.queryString() === Some("list_id=222669735&screen_name=marcobonzanini,odersky")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove members from list by slug and owner name" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMembersBySlugAndOwnerName("my-list", "DanielaSfregola", Seq("marcobonzanini", "odersky"))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
- request.uri.queryString() === Some("owner_screen_name=DanielaSfregola&screen_name=marcobonzanini,odersky&slug=my-list")
- }.respondWithOk.await
+ val result: Unit =
+ when(removeListMembersBySlugAndOwnerName("my-list", "DanielaSfregola", Seq("marcobonzanini", "odersky")))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
+ request.uri.queryString() === Some(
+ "owner_screen_name=DanielaSfregola&screen_name=marcobonzanini,odersky&slug=my-list")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove members from list by slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMembersBySlugAndOwnerId("my-list", 2911461333L, Seq("marcobonzanini", "odersky"))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
- request.uri.queryString() === Some("owner_id=2911461333&screen_name=marcobonzanini,odersky&slug=my-list")
- }.respondWithOk.await
+ val result: Unit =
+ when(removeListMembersBySlugAndOwnerId("my-list", 2911461333L, Seq("marcobonzanini", "odersky")))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
+ request.uri.queryString() === Some("owner_id=2911461333&screen_name=marcobonzanini,odersky&slug=my-list")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove members ids from list" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMembersIds(222669735, Seq(2911461333L, 2911461334L))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
- request.uri.queryString() === Some("list_id=222669735&user_id=2911461333,2911461334")
- }.respondWithOk.await
+ val result: Unit = when(removeListMembersIds(222669735, Seq(2911461333L, 2911461334L)))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
+ request.uri.queryString() === Some("list_id=222669735&user_id=2911461333,2911461334")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove members ids from list by slug and owner name" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMembersIdsBySlugAndOwnerName("my-list", "DanielaSfregola", Seq(2911461333L, 2911461334L))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
- request.uri.queryString() === Some("owner_screen_name=DanielaSfregola&slug=my-list&user_id=2911461333,2911461334")
- }.respondWithOk.await
+ val result: Unit =
+ when(removeListMembersIdsBySlugAndOwnerName("my-list", "DanielaSfregola", Seq(2911461333L, 2911461334L)))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
+ request.uri.queryString() === Some(
+ "owner_screen_name=DanielaSfregola&slug=my-list&user_id=2911461333,2911461334")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"remove members ids from list by slug and owner id" in new TwitterListClientSpecContext {
- val result: Unit = when(removeListMembersIdsBySlugAndOwnerId("my-list", 2911461333L, Seq(2911461333L, 2911461334L))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
- request.uri.queryString() === Some("owner_id=2911461333&slug=my-list&user_id=2911461333,2911461334")
- }.respondWithOk.await
+ val result: Unit =
+ when(removeListMembersIdsBySlugAndOwnerId("my-list", 2911461333L, Seq(2911461333L, 2911461334L)))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/members/destroy_all.json"
+ request.uri.queryString() === Some("owner_id=2911461333&slug=my-list&user_id=2911461333,2911461334")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
"reject 'removeListMembers' if no screen names are provided" in new TwitterListClientSpecContext {
- removeListMembers(222669735, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one screen name")
+ removeListMembers(222669735, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one screen name")
}
"reject 'removeListMembersBySlugAndOwnerName' if no screen names are provided" in new TwitterListClientSpecContext {
- removeListMembersBySlugAndOwnerName("my-list", "DanielaSfregola", Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one screen name")
+ removeListMembersBySlugAndOwnerName("my-list", "DanielaSfregola", Seq.empty) must throwA[
+ IllegalArgumentException]("requirement failed: please, provide at least one screen name")
}
"reject 'removeListMembersBySlugAndOwnerId' if no screen names are provided" in new TwitterListClientSpecContext {
- removeListMembersBySlugAndOwnerId("my-list", 2911461333L, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one screen name")
+ removeListMembersBySlugAndOwnerId("my-list", 2911461333L, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one screen name")
}
"reject 'removeListMembersIds' if no ids are provided" in new TwitterListClientSpecContext {
- removeListMembersIds(222669735, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one user id")
+ removeListMembersIds(222669735, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one user id")
}
"reject 'removeListMembersIdsBySlugAndOwnerName' if no ids are provided" in new TwitterListClientSpecContext {
- removeListMembersIdsBySlugAndOwnerName("my-list", "DanielaSfregola", Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one user id")
+ removeListMembersIdsBySlugAndOwnerName("my-list", "DanielaSfregola", Seq.empty) must throwA[
+ IllegalArgumentException]("requirement failed: please, provide at least one user id")
}
"reject 'addListMembersIds' if no ids are provided" in new TwitterListClientSpecContext {
- removeListMembersIdsBySlugAndOwnerId("my-list", 2911461333L, Seq.empty) must throwA[IllegalArgumentException]("requirement failed: please, provide at least one user id")
+ removeListMembersIdsBySlugAndOwnerId("my-list", 2911461333L, Seq.empty) must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one user id")
}
"get ownerships for user" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterLists] = when(listOwnerships("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/ownerships.json"
- request.uri.queryString() === Some("count=20&cursor=-1&screen_name=DanielaSfregola")
- }.respondWithRated("/twitter/rest/lists/ownerships.json").await
+ val result: RatedData[TwitterLists] = when(listOwnerships("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/ownerships.json"
+ request.uri.queryString() === Some("count=20&cursor=-1&screen_name=DanielaSfregola")
+ }
+ .respondWithRated("/twitter/rest/lists/ownerships.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterLists]("/fixtures/rest/lists/ownerships.json")
}
"get ownerships for user by id" in new TwitterListClientSpecContext {
- val result: RatedData[TwitterLists] = when(listOwnershipsForUserId(2911461333L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/lists/ownerships.json"
- request.uri.queryString() === Some("count=20&cursor=-1&user_id=2911461333")
- }.respondWithRated("/twitter/rest/lists/ownerships.json").await
+ val result: RatedData[TwitterLists] = when(listOwnershipsForUserId(2911461333L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/lists/ownerships.json"
+ request.uri.queryString() === Some("count=20&cursor=-1&user_id=2911461333")
+ }
+ .respondWithRated("/twitter/rest/lists/ownerships.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[TwitterLists]("/fixtures/rest/lists/ownerships.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClientSpec.scala
index acb4072e..3d3ebe87 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/media/TwitterMediaClientSpec.scala
@@ -12,7 +12,8 @@ class TwitterMediaClientSpec extends ClientSpec {
"upload a media" in new TwitterMediaClientSpecContext {
val initMediaResponse = {
- val json = """{"media_id":925706675478151168,"media_id_string":"925706675478151168","expires_after_secs":86400}"""
+ val json =
+ """{"media_id":925706675478151168,"media_id_string":"925706675478151168","expires_after_secs":86400}"""
HttpResponse(StatusCodes.OK, entity = HttpEntity(MediaTypes.`application/json`, json))
}
val imgPath = getClass.getResource("/imgs/twitter.png").getPath
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClientSpec.scala
index 4c0acbe3..afe6dff7 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/mutes/TwitterMuteClientSpec.scala
@@ -11,57 +11,75 @@ class TwitterMuteClientSpec extends ClientSpec {
"Twitter Mute Client" should {
"mute a user" in new TwitterMuteClientSpecContext {
- val result: User = when(muteUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/create.json"
- request.uri.queryString() === Some("screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/mutes/user.json").await
+ val result: User = when(muteUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/create.json"
+ request.uri.queryString() === Some("screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/mutes/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/mutes/user.json")
}
"mute a user by id" in new TwitterMuteClientSpecContext {
- val result: User = when(muteUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/create.json"
- request.uri.queryString() === Some("user_id=19018614")
- }.respondWith("/twitter/rest/mutes/user.json").await
+ val result: User = when(muteUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/create.json"
+ request.uri.queryString() === Some("user_id=19018614")
+ }
+ .respondWith("/twitter/rest/mutes/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/mutes/user.json")
}
"unmute a user" in new TwitterMuteClientSpecContext {
- val result: User = when(unmuteUser("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/destroy.json"
- request.uri.queryString() === Some("screen_name=marcobonzanini")
- }.respondWith("/twitter/rest/mutes/user.json").await
+ val result: User = when(unmuteUser("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/destroy.json"
+ request.uri.queryString() === Some("screen_name=marcobonzanini")
+ }
+ .respondWith("/twitter/rest/mutes/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/mutes/user.json")
}
"unmute a user by id" in new TwitterMuteClientSpecContext {
- val result: User = when(unmuteUserId(19018614L)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/destroy.json"
- request.uri.queryString() === Some("user_id=19018614")
- }.respondWith("/twitter/rest/mutes/user.json").await
+ val result: User = when(unmuteUserId(19018614L))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/destroy.json"
+ request.uri.queryString() === Some("user_id=19018614")
+ }
+ .respondWith("/twitter/rest/mutes/user.json")
+ .await
result === loadJsonAs[User]("/fixtures/rest/mutes/user.json")
}
"get muted users ids" in new TwitterMuteClientSpecContext {
- val result: RatedData[UserIds] = when(mutedUserIds()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/ids.json"
- request.uri.queryString() === Some("cursor=-1")
- }.respondWithRated("/twitter/rest/mutes/muted_users_ids.json").await
+ val result: RatedData[UserIds] = when(mutedUserIds())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/ids.json"
+ request.uri.queryString() === Some("cursor=-1")
+ }
+ .respondWithRated("/twitter/rest/mutes/muted_users_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/mutes/muted_users_ids.json")
}
"get muted users" in new TwitterMuteClientSpecContext {
- val result: RatedData[Users] = when(mutedUsers()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/list.json"
- request.uri.queryString() === Some("cursor=-1&include_entities=true&skip_status=false")
- }.respondWithRated("/twitter/rest/mutes/users.json").await
+ val result: RatedData[Users] = when(mutedUsers())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/mutes/users/list.json"
+ request.uri.queryString() === Some("cursor=-1&include_entities=true&skip_status=false")
+ }
+ .respondWithRated("/twitter/rest/mutes/users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Users]("/fixtures/rest/mutes/users.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClientSpec.scala
index e8aa66a1..d5b8d143 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/savedsearches/TwitterSavedSearchClientSpec.scala
@@ -11,38 +11,50 @@ class TwitterSavedSearchClientSpec extends ClientSpec {
"Twitter Saved Search Client" should {
"get saved searches" in new TwitterSavedSearchClientSpecContext {
- val result: RatedData[Seq[SavedSearch]] = when(savedSearches).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/saved_searches/list.json"
- }.respondWithRated("/twitter/rest/savedsearches/list.json").await
+ val result: RatedData[Seq[SavedSearch]] = when(savedSearches)
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/saved_searches/list.json"
+ }
+ .respondWithRated("/twitter/rest/savedsearches/list.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[SavedSearch]]("/fixtures/rest/savedsearches/list.json")
}
"save a search" in new TwitterSavedSearchClientSpecContext {
- val result: SavedSearch = when(saveSearch("#scala")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/saved_searches/create.json"
- request.uri.queryString() === Some("query=#scala")
- }.respondWith("/twitter/rest/savedsearches/create.json").await
+ val result: SavedSearch = when(saveSearch("#scala"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/saved_searches/create.json"
+ request.uri.queryString() === Some("query=#scala")
+ }
+ .respondWith("/twitter/rest/savedsearches/create.json")
+ .await
result === loadJsonAs[SavedSearch]("/fixtures/rest/savedsearches/create.json")
}
"delete a saved search" in new TwitterSavedSearchClientSpecContext {
val id = 9569704
- val result: SavedSearch = when(deleteSavedSearch(id)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === s"https://api.twitter.com/1.1/saved_searches/destroy/$id.json"
- }.respondWith("/twitter/rest/savedsearches/destroy.json").await
+ val result: SavedSearch = when(deleteSavedSearch(id))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === s"https://api.twitter.com/1.1/saved_searches/destroy/$id.json"
+ }
+ .respondWith("/twitter/rest/savedsearches/destroy.json")
+ .await
result === loadJsonAs[SavedSearch]("/fixtures/rest/savedsearches/destroy.json")
}
"get saved search by id" in new TwitterSavedSearchClientSpecContext {
val id = 9569704
- val result: RatedData[SavedSearch] = when(savedSearch(id)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/saved_searches/show/$id.json"
- }.respondWithRated("/twitter/rest/savedsearches/show.json").await
+ val result: RatedData[SavedSearch] = when(savedSearch(id))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/saved_searches/show/$id.json"
+ }
+ .respondWithRated("/twitter/rest/savedsearches/show.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[SavedSearch]("/fixtures/rest/savedsearches/show.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClientSpec.scala
index 0b0836dd..cae940f3 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/search/TwitterSearchClientSpec.scala
@@ -11,11 +11,14 @@ class TwitterSearchClientSpec extends ClientSpec {
"Twitter Search Client" should {
"search for tweets" in new TwitterSearchClientSpecContext {
- val result: RatedData[StatusSearch] = when(searchTweet("#scala")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/search/tweets.json"
- request.uri.queryString() === Some("count=15&include_entities=true&q=%23scala&result_type=mixed")
- }.respondWithRated("/twitter/rest/search/tweets.json").await
+ val result: RatedData[StatusSearch] = when(searchTweet("#scala"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/search/tweets.json"
+ request.uri.queryString() === Some("count=15&include_entities=true&q=%23scala&result_type=mixed")
+ }
+ .respondWithRated("/twitter/rest/search/tweets.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[StatusSearch]("/fixtures/rest/search/tweets.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClientSpec.scala
index 050bf774..299d87c7 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/TwitterStatusClientSpec.scala
@@ -11,193 +11,257 @@ class TwitterStatusClientSpec extends ClientSpec {
"Twitter Status Client" should {
"perform a mentions timeline request" in new TwitterStatusClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(mentionsTimeline(count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/mentions_timeline.json"
- request.uri.queryString() === Some("contributor_details=false&count=10&include_entities=true&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/mentions_timeline.json").await
+ val result: RatedData[Seq[Tweet]] = when(mentionsTimeline(count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/mentions_timeline.json"
+ request.uri.queryString() === Some("contributor_details=false&count=10&include_entities=true&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/mentions_timeline.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/statuses/mentions_timeline.json")
}
"perform a user timeline request by screen name" in new TwitterStatusClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(userTimelineForUser(screen_name = "DanielaSfregola", count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/user_timeline.json"
- request.uri.queryString() === Some("contributor_details=false&count=10&exclude_replies=false&include_rts=true&screen_name=DanielaSfregola&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/user_timeline.json").await
+ val result: RatedData[Seq[Tweet]] = when(userTimelineForUser(screen_name = "DanielaSfregola", count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/user_timeline.json"
+ request.uri.queryString() === Some(
+ "contributor_details=false&count=10&exclude_replies=false&include_rts=true&screen_name=DanielaSfregola&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/user_timeline.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/statuses/user_timeline.json")
}
"perform a user timeline request by user id" in new TwitterStatusClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(userTimelineForUserId(user_id = 123456L , count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/user_timeline.json"
- request.uri.queryString() === Some("contributor_details=false&count=10&exclude_replies=false&include_rts=true&trim_user=false&user_id=123456")
- }.respondWithRated("/twitter/rest/statuses/user_timeline.json").await
+ val result: RatedData[Seq[Tweet]] = when(userTimelineForUserId(user_id = 123456L, count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/user_timeline.json"
+ request.uri.queryString() === Some(
+ "contributor_details=false&count=10&exclude_replies=false&include_rts=true&trim_user=false&user_id=123456")
+ }
+ .respondWithRated("/twitter/rest/statuses/user_timeline.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/statuses/user_timeline.json")
}
"perform a home timeline request" in new TwitterStatusClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(homeTimeline(count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/home_timeline.json"
- request.uri.queryString() === Some("contributor_details=false&count=10&exclude_replies=false&include_entities=true&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/home_timeline.json").await
+ val result: RatedData[Seq[Tweet]] = when(homeTimeline(count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/home_timeline.json"
+ request.uri.queryString() === Some(
+ "contributor_details=false&count=10&exclude_replies=false&include_entities=true&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/home_timeline.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/statuses/home_timeline.json")
}
"perform a retweets of me request" in new TwitterStatusClientSpecContext {
- val result: RatedData[Seq[Tweet]] = when(retweetsOfMe(count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/retweets_of_me.json"
- request.uri.queryString() === Some("contributor_details=false&count=10&exclude_replies=false&include_entities=true&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/retweets_of_me.json").await
+ val result: RatedData[Seq[Tweet]] = when(retweetsOfMe(count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/retweets_of_me.json"
+ request.uri.queryString() === Some(
+ "contributor_details=false&count=10&exclude_replies=false&include_entities=true&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/retweets_of_me.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/statuses/retweets_of_me.json")
}
"perform a retweets request" in new TwitterStatusClientSpecContext {
val id = 648866645855879168L
- val result: RatedData[Seq[Tweet]] = when(retweets(id, count = 10)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/statuses/retweets/$id.json"
- request.uri.queryString() === Some("count=10&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/retweets.json").await
+ val result: RatedData[Seq[Tweet]] = when(retweets(id, count = 10))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/statuses/retweets/$id.json"
+ request.uri.queryString() === Some("count=10&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/retweets.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Tweet]]("/fixtures/rest/statuses/retweets.json")
}
"perform a show tweet request" in new TwitterStatusClientSpecContext {
- val result: RatedData[Tweet] = when(getTweet(648866645855879168L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/show.json"
- request.uri.queryString() === Some("id=648866645855879168&include_entities=true&include_my_retweet=false&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/show.json").await
+ val result: RatedData[Tweet] = when(getTweet(648866645855879168L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/show.json"
+ request.uri.queryString() === Some(
+ "id=648866645855879168&include_entities=true&include_my_retweet=false&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/show.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Tweet]("/fixtures/rest/statuses/show.json")
}
"send a status update" in new TwitterStatusClientSpecContext {
- val result: Tweet = when(createTweet("This is a test")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/update.json"
- request.entity === HttpEntity(
- `application/x-www-form-urlencoded`,
- "display_coordinates=false&possibly_sensitive=false&status=This+is+a+test&trim_user=false")
- }.respondWith("/twitter/rest/statuses/update.json").await
+ val result: Tweet = when(createTweet("This is a test"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/update.json"
+ request.entity === HttpEntity(
+ `application/x-www-form-urlencoded`,
+ "display_coordinates=false&possibly_sensitive=false&status=This+is+a+test&trim_user=false")
+ }
+ .respondWith("/twitter/rest/statuses/update.json")
+ .await
result === loadJsonAs[Tweet]("/fixtures/rest/statuses/update.json")
}
"send a status update with some media" in new TwitterStatusClientSpecContext {
- val result: Tweet = when(createTweet("This is a test", media_ids = Seq(1L, 2L))).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/update.json"
- request.entity === HttpEntity(
- `application/x-www-form-urlencoded`,
- "display_coordinates=false&media_ids=1%2C2&possibly_sensitive=false&status=This+is+a+test&trim_user=false")
- }.respondWith("/twitter/rest/statuses/update.json").await
+ val result: Tweet = when(createTweet("This is a test", media_ids = Seq(1L, 2L)))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/update.json"
+ request.entity === HttpEntity(
+ `application/x-www-form-urlencoded`,
+ "display_coordinates=false&media_ids=1%2C2&possibly_sensitive=false&status=This+is+a+test&trim_user=false")
+ }
+ .respondWith("/twitter/rest/statuses/update.json")
+ .await
result === loadJsonAs[Tweet]("/fixtures/rest/statuses/update.json")
}
"send direct message as tweet" in new TwitterStatusClientSpecContext {
- val result: Tweet = when(createDirectMessageAsTweet("This is a test for a direct message", "DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/update.json"
- request.entity === HttpEntity(
- `application/x-www-form-urlencoded`,
- "display_coordinates=false&possibly_sensitive=false&status=D+DanielaSfregola+This+is+a+test+for+a+direct+message&trim_user=false")
- }.respondWith("/twitter/rest/statuses/direct_message.json").await
+ val result: Tweet = when(createDirectMessageAsTweet("This is a test for a direct message", "DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/update.json"
+ request.entity === HttpEntity(
+ `application/x-www-form-urlencoded`,
+ "display_coordinates=false&possibly_sensitive=false&status=D+DanielaSfregola+This+is+a+test+for+a+direct+message&trim_user=false"
+ )
+ }
+ .respondWith("/twitter/rest/statuses/direct_message.json")
+ .await
result === loadJsonAs[Tweet]("/fixtures/rest/statuses/direct_message.json")
}
"delete an existing tweet" in new TwitterStatusClientSpecContext {
val id = 648866645855879168L
- val result: Tweet = when(deleteTweet(id)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === s"https://api.twitter.com/1.1/statuses/destroy/$id.json"
- request.uri.queryString() === Some("trim_user=false")
- }.respondWith("/twitter/rest/statuses/destroy.json").await
+ val result: Tweet = when(deleteTweet(id))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === s"https://api.twitter.com/1.1/statuses/destroy/$id.json"
+ request.uri.queryString() === Some("trim_user=false")
+ }
+ .respondWith("/twitter/rest/statuses/destroy.json")
+ .await
result === loadJsonAs[Tweet]("/fixtures/rest/statuses/destroy.json")
}
"retweet a tweet" in new TwitterStatusClientSpecContext {
val id = 648866645855879168L
- val result: Tweet = when(retweet(id)).expectRequest { request =>
- request.method === HttpMethods.POST
- request.uri.endpoint === s"https://api.twitter.com/1.1/statuses/retweet/$id.json"
- request.uri.queryString() === Some("trim_user=false")
- }.respondWith("/twitter/rest/statuses/retweet.json").await
+ val result: Tweet = when(retweet(id))
+ .expectRequest { request =>
+ request.method === HttpMethods.POST
+ request.uri.endpoint === s"https://api.twitter.com/1.1/statuses/retweet/$id.json"
+ request.uri.queryString() === Some("trim_user=false")
+ }
+ .respondWith("/twitter/rest/statuses/retweet.json")
+ .await
result === loadJsonAs[Tweet]("/fixtures/rest/statuses/retweet.json")
}
"get a tweet by id in oembed format " in new TwitterStatusClientSpecContext {
- val result: RatedData[OEmbedTweet] = when(oembedTweetById(648866645855879168L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/oembed.json"
- request.uri.queryString() === Some("align=none&hide_media=false&hide_thread=false&hide_tweet=false&id=648866645855879168&lang=en&omit_script=false")
- }.respondWithRated("/twitter/rest/statuses/oembed.json").await
+ val result: RatedData[OEmbedTweet] = when(oembedTweetById(648866645855879168L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/oembed.json"
+ request.uri.queryString() === Some(
+ "align=none&hide_media=false&hide_thread=false&hide_tweet=false&id=648866645855879168&lang=en&omit_script=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/oembed.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[OEmbedTweet]("/fixtures/rest/statuses/oembed.json")
}
"get a tweet by url in oembed format " in new TwitterStatusClientSpecContext {
val url = s"https://twitter.com/Interior/status/648866645855879168"
- val result: RatedData[OEmbedTweet] = when(oembedTweetByUrl(url)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/oembed.json"
- request.uri.queryString() === Some("align=none&hide_media=false&hide_thread=false&hide_tweet=false&lang=en&omit_script=false&url=https://twitter.com/Interior/status/648866645855879168")
- }.respondWithRated("/twitter/rest/statuses/oembed.json").await
+ val result: RatedData[OEmbedTweet] = when(oembedTweetByUrl(url))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/oembed.json"
+ request.uri.queryString() === Some(
+ "align=none&hide_media=false&hide_thread=false&hide_tweet=false&lang=en&omit_script=false&url=https://twitter.com/Interior/status/648866645855879168")
+ }
+ .respondWithRated("/twitter/rest/statuses/oembed.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[OEmbedTweet]("/fixtures/rest/statuses/oembed.json")
}
"get retweeters ids" in new TwitterStatusClientSpecContext {
- val result: RatedData[UserIds] = when(retweeterIds(327473909412814850L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/retweeters/ids.json"
- request.uri.queryString() === Some("count=100&cursor=-1&id=327473909412814850&stringify_ids=false")
- }.respondWithRated("/twitter/rest/statuses/retweeters_ids.json").await
+ val result: RatedData[UserIds] = when(retweeterIds(327473909412814850L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/retweeters/ids.json"
+ request.uri.queryString() === Some("count=100&cursor=-1&id=327473909412814850&stringify_ids=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/retweeters_ids.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserIds]("/fixtures/rest/statuses/retweeters_ids.json")
}
"get retweeters ids stringified" in new TwitterStatusClientSpecContext {
- val result: RatedData[UserStringifiedIds] = when(retweeterStringifiedIds(327473909412814850L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/retweeters/ids.json"
- request.uri.queryString() === Some("count=100&cursor=-1&id=327473909412814850&stringify_ids=true")
- }.respondWithRated("/twitter/rest/statuses/retweeters_ids_stringified.json").await
+ val result: RatedData[UserStringifiedIds] = when(retweeterStringifiedIds(327473909412814850L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/retweeters/ids.json"
+ request.uri.queryString() === Some("count=100&cursor=-1&id=327473909412814850&stringify_ids=true")
+ }
+ .respondWithRated("/twitter/rest/statuses/retweeters_ids_stringified.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[UserStringifiedIds]("/fixtures/rest/statuses/retweeters_ids_stringified.json")
}
"perform a lookup" in new TwitterStatusClientSpecContext {
- val result: RatedData[Seq[LookupTweet]] = when(tweetLookup(327473909412814850L, 327473909412814851L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/lookup.json"
- request.uri.queryString() === Some("id=327473909412814850,327473909412814851&include_entities=true&map=false&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/lookup.json").await
+ val result: RatedData[Seq[LookupTweet]] = when(tweetLookup(327473909412814850L, 327473909412814851L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/lookup.json"
+ request.uri.queryString() === Some(
+ "id=327473909412814850,327473909412814851&include_entities=true&map=false&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/lookup.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[LookupTweet]]("/fixtures/rest/statuses/lookup.json")
}
"reject request if no ids have been provided for the lookup" in new TwitterStatusClientSpecContext {
- tweetLookup() must throwA[IllegalArgumentException]("requirement failed: please, provide at least one status id to lookup")
+ tweetLookup() must throwA[IllegalArgumentException](
+ "requirement failed: please, provide at least one status id to lookup")
}
"perform a mapped lookup" in new TwitterStatusClientSpecContext {
- val result: RatedData[LookupMapped] = when(tweetLookupMapped(327473909412814850L, 327473909412814851L)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/statuses/lookup.json"
- request.uri.queryString() === Some("id=327473909412814850,327473909412814851&include_entities=true&map=true&trim_user=false")
- }.respondWithRated("/twitter/rest/statuses/lookup_mapped.json").await
+ val result: RatedData[LookupMapped] = when(tweetLookupMapped(327473909412814850L, 327473909412814851L))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/statuses/lookup.json"
+ request.uri.queryString() === Some(
+ "id=327473909412814850,327473909412814851&include_entities=true&map=true&trim_user=false")
+ }
+ .respondWithRated("/twitter/rest/statuses/lookup_mapped.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[LookupMapped]("/fixtures/rest/statuses/lookup_mapped.json")
}
}
}
-
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParametersSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParametersSpec.scala
index 85035106..16d40a42 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParametersSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/HomeTimelineParametersSpec.scala
@@ -8,8 +8,14 @@ class HomeTimelineParametersSpec extends SpecificationLike {
"HomeTimelineParameters" should {
"correctly represents each field as the respective request parameter" in {
HomeTimelineParameters(
- count = 20, since_id = Some(100L), max_id = Some(200L), trim_user = true, exclude_replies = true,
- contributor_details = true, include_entities = true, tweet_mode = TweetMode.Extended
+ count = 20,
+ since_id = Some(100L),
+ max_id = Some(200L),
+ trim_user = true,
+ exclude_replies = true,
+ contributor_details = true,
+ include_entities = true,
+ tweet_mode = TweetMode.Extended
).toString shouldEqual
"""contributor_details=true&
|count=20&
@@ -22,8 +28,14 @@ class HomeTimelineParametersSpec extends SpecificationLike {
}
"doesn't provide request parameter if the respective field is empty (tweet_mode is classic)" in {
HomeTimelineParameters(
- count = 20, since_id = None, max_id = None, trim_user = false, exclude_replies = false,
- contributor_details = false, include_entities = false, tweet_mode = TweetMode.Classic
+ count = 20,
+ since_id = None,
+ max_id = None,
+ trim_user = false,
+ exclude_replies = false,
+ contributor_details = false,
+ include_entities = false,
+ tweet_mode = TweetMode.Classic
).toString shouldEqual
"""contributor_details=false&
|count=20&
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParametersSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParametersSpec.scala
index 02c8119b..f2d32a10 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParametersSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/MentionsParametersSpec.scala
@@ -8,8 +8,13 @@ class MentionsParametersSpec extends SpecificationLike {
"MentionsParameters" should {
"correctly represents each field as the respective request parameter" in {
MentionsParameters(
- count = 20, since_id = Some(100L), max_id = Some(200L), trim_user = true, contributor_details = true,
- include_entities = true, tweet_mode = TweetMode.Extended
+ count = 20,
+ since_id = Some(100L),
+ max_id = Some(200L),
+ trim_user = true,
+ contributor_details = true,
+ include_entities = true,
+ tweet_mode = TweetMode.Extended
).toString shouldEqual
"""contributor_details=true&
|count=20&
@@ -21,8 +26,13 @@ class MentionsParametersSpec extends SpecificationLike {
}
"doesn't provide request parameter if the respective field is empty (tweet_mode is classic)" in {
MentionsParameters(
- count = 20, since_id = None, max_id = None, trim_user = false, contributor_details = false,
- include_entities = false, tweet_mode = TweetMode.Classic
+ count = 20,
+ since_id = None,
+ max_id = None,
+ trim_user = false,
+ contributor_details = false,
+ include_entities = false,
+ tweet_mode = TweetMode.Classic
).toString shouldEqual
"""contributor_details=false&
|count=20&
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParametersSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParametersSpec.scala
index 562be2dc..547cf73b 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParametersSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/PostParametersSpec.scala
@@ -8,12 +8,14 @@ class PostParametersSpec extends SpecificationLike {
"PostParameters" should {
"correctly represents each field as the respective request parameter" in {
PostParameters(
- trim_user = true, tweet_mode = TweetMode.Extended
+ trim_user = true,
+ tweet_mode = TweetMode.Extended
).toString shouldEqual "trim_user=true&tweet_mode=extended"
}
"doesn't provide request parameter if the respective field is empty (tweet_mode is classic)" in {
PostParameters(
- trim_user = false, tweet_mode = TweetMode.Classic
+ trim_user = false,
+ tweet_mode = TweetMode.Classic
).toString shouldEqual "trim_user=false"
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParametersSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParametersSpec.scala
index 63c7f91f..909cfec7 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParametersSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsOfMeParametersSpec.scala
@@ -8,8 +8,14 @@ class RetweetsOfMeParametersSpec extends SpecificationLike {
"RetweetsOfMeParameters" should {
"correctly represents each field as the respective request parameter" in {
RetweetsOfMeParameters(
- count = 20, since_id = Some(100L), max_id = Some(200L), trim_user = true, exclude_replies = true,
- contributor_details = true, include_entities = true, tweet_mode = TweetMode.Extended
+ count = 20,
+ since_id = Some(100L),
+ max_id = Some(200L),
+ trim_user = true,
+ exclude_replies = true,
+ contributor_details = true,
+ include_entities = true,
+ tweet_mode = TweetMode.Extended
).toString shouldEqual
"""contributor_details=true&
|count=20&
@@ -22,8 +28,14 @@ class RetweetsOfMeParametersSpec extends SpecificationLike {
}
"doesn't provide request parameter if the respective field is empty (tweet_mode is classic)" in {
RetweetsOfMeParameters(
- count = 20, since_id = None, max_id = None, trim_user = false, exclude_replies = false,
- contributor_details = false, include_entities = false, tweet_mode = TweetMode.Classic
+ count = 20,
+ since_id = None,
+ max_id = None,
+ trim_user = false,
+ exclude_replies = false,
+ contributor_details = false,
+ include_entities = false,
+ tweet_mode = TweetMode.Classic
).toString shouldEqual
"""contributor_details=false&
|count=20&
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParametersSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParametersSpec.scala
index ae9de4cb..cf7526d9 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParametersSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/RetweetsParametersSpec.scala
@@ -8,12 +8,16 @@ class RetweetsParametersSpec extends SpecificationLike {
"RetweetsParameters" should {
"correctly represents each field as the respective request parameter" in {
RetweetsParameters(
- count = 20, trim_user = true, tweet_mode = TweetMode.Extended
+ count = 20,
+ trim_user = true,
+ tweet_mode = TweetMode.Extended
).toString shouldEqual "count=20&trim_user=true&tweet_mode=extended"
}
"doesn't provide request parameter if the respective field is empty (tweet_mode is classic)" in {
RetweetsParameters(
- count = 20, trim_user = false, tweet_mode = TweetMode.Classic
+ count = 20,
+ trim_user = false,
+ tweet_mode = TweetMode.Classic
).toString shouldEqual "count=20&trim_user=false"
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParametersSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParametersSpec.scala
index fa55b605..8822cb33 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParametersSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/ShowParametersSpec.scala
@@ -8,8 +8,11 @@ class ShowParametersSpec extends SpecificationLike {
"ShowParameters" should {
"correctly represents each field as the respective request parameter" in {
ShowParameters(
- id = 10L, trim_user = true, include_my_retweet = true,
- include_entities = true, tweet_mode = TweetMode.Extended
+ id = 10L,
+ trim_user = true,
+ include_my_retweet = true,
+ include_entities = true,
+ tweet_mode = TweetMode.Extended
).toString shouldEqual
"""id=10&
|include_entities=true&
@@ -19,8 +22,11 @@ class ShowParametersSpec extends SpecificationLike {
}
"doesn't provide request parameter if the respective field is empty (tweet_mode is classic)" in {
ShowParameters(
- id = 10L, trim_user = false, include_my_retweet = false,
- include_entities = false, tweet_mode = TweetMode.Classic
+ id = 10L,
+ trim_user = false,
+ include_my_retweet = false,
+ include_entities = false,
+ tweet_mode = TweetMode.Classic
).toString shouldEqual
"""id=10&
|include_entities=false&
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParametersSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParametersSpec.scala
index d7a17f7b..d606cb97 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParametersSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/statuses/parameters/UserTimelineParametersSpec.scala
@@ -8,9 +8,16 @@ class UserTimelineParametersSpec extends SpecificationLike {
"UserTimelineParameters" should {
"correctly represents each field as the respective request parameter" in {
UserTimelineParameters(
- user_id = Some(10L), screen_name = Some("NaMe"), count = 20, since_id = Some(100L), max_id = Some(200L),
- trim_user = true, exclude_replies = true, contributor_details = true,
- include_rts = true, tweet_mode = TweetMode.Extended
+ user_id = Some(10L),
+ screen_name = Some("NaMe"),
+ count = 20,
+ since_id = Some(100L),
+ max_id = Some(200L),
+ trim_user = true,
+ exclude_replies = true,
+ contributor_details = true,
+ include_rts = true,
+ tweet_mode = TweetMode.Extended
).toString shouldEqual
"""contributor_details=true&
|count=20&
@@ -25,9 +32,16 @@ class UserTimelineParametersSpec extends SpecificationLike {
}
"doesn't provide request parameter if the respective field is empty (tweet_mode is classic)" in {
UserTimelineParameters(
- user_id = None, screen_name = None, count = 20, since_id = None, max_id = None,
- trim_user = false, exclude_replies = false, contributor_details = false,
- include_rts = false, tweet_mode = TweetMode.Classic
+ user_id = None,
+ screen_name = None,
+ count = 20,
+ since_id = None,
+ max_id = None,
+ trim_user = false,
+ exclude_replies = false,
+ contributor_details = false,
+ include_rts = false,
+ tweet_mode = TweetMode.Classic
).toString shouldEqual
"""contributor_details=false&
|count=20&
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClientSpec.scala
index 45c7b96b..f7acfae0 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/suggestions/TwitterSuggestionClientSpec.scala
@@ -12,31 +12,40 @@ class TwitterSuggestionClientSpec extends ClientSpec {
"get suggestions of a category" in new TwitterSuggestionClientSpecContext {
val slug = "twitter"
- val result: RatedData[Suggestions] = when(suggestions(slug)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/users/suggestions/$slug.json"
- request.uri.queryString() === Some("lang=en")
- }.respondWithRated("/twitter/rest/suggestions/slug_suggestions.json").await
+ val result: RatedData[Suggestions] = when(suggestions(slug))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/users/suggestions/$slug.json"
+ request.uri.queryString() === Some("lang=en")
+ }
+ .respondWithRated("/twitter/rest/suggestions/slug_suggestions.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Suggestions]("/fixtures/rest/suggestions/slug_suggestions.json")
}
"get suggested categories" in new TwitterSuggestionClientSpecContext {
- val result: RatedData[Seq[Category]] = when(suggestedCategories()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/suggestions.json"
- request.uri.queryString() === Some("lang=en")
- }.respondWithRated("/twitter/rest/suggestions/categories.json").await
+ val result: RatedData[Seq[Category]] = when(suggestedCategories())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/suggestions.json"
+ request.uri.queryString() === Some("lang=en")
+ }
+ .respondWithRated("/twitter/rest/suggestions/categories.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Category]]("/fixtures/rest/suggestions/categories.json")
}
"get suggestions members" in new TwitterSuggestionClientSpecContext {
val slug = "twitter"
- val result: RatedData[Seq[User]] = when(suggestionsMembers(slug)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === s"https://api.twitter.com/1.1/users/suggestions/$slug/members.json"
- }.respondWithRated("/twitter/rest/suggestions/suggestions_members.json").await
+ val result: RatedData[Seq[User]] = when(suggestionsMembers(slug))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === s"https://api.twitter.com/1.1/users/suggestions/$slug/members.json"
+ }
+ .respondWithRated("/twitter/rest/suggestions/suggestions_members.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[User]]("/fixtures/rest/suggestions/suggestions_members.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClientSpec.scala
index b3912418..e2e1e99e 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/trends/TwitterTrendClientSpec.scala
@@ -4,56 +4,71 @@ import akka.http.scaladsl.model.HttpMethods
import com.danielasfregola.twitter4s.entities.{Location, LocationTrends, RatedData}
import com.danielasfregola.twitter4s.helpers.ClientSpec
-class TwitterTrendClientSpec extends ClientSpec {
+class TwitterTrendClientSpec extends ClientSpec {
class TwitterTrendClientSpecContext extends RestClientSpecContext with TwitterTrendClient
"Twitter Trend Client" should {
"get global trends" in new TwitterTrendClientSpecContext {
- val result: RatedData[Seq[LocationTrends]] = when(globalTrends()).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/trends/place.json"
- request.uri.queryString() === Some("id=1")
- }.respondWithRated("/twitter/rest/trends/trends.json").await
+ val result: RatedData[Seq[LocationTrends]] = when(globalTrends())
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/trends/place.json"
+ request.uri.queryString() === Some("id=1")
+ }
+ .respondWithRated("/twitter/rest/trends/trends.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[LocationTrends]]("/fixtures/rest/trends/trends.json")
}
"get trends for a location" in new TwitterTrendClientSpecContext {
- val result: RatedData[Seq[LocationTrends]] = when(trends(1)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/trends/place.json"
- request.uri.queryString() === Some("id=1")
- }.respondWithRated("/twitter/rest/trends/trends.json").await
+ val result: RatedData[Seq[LocationTrends]] = when(trends(1))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/trends/place.json"
+ request.uri.queryString() === Some("id=1")
+ }
+ .respondWithRated("/twitter/rest/trends/trends.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[LocationTrends]]("/fixtures/rest/trends/trends.json")
}
"get trends for a location without hashtags" in new TwitterTrendClientSpecContext {
- val result: RatedData[Seq[LocationTrends]] = when(trends(1, true)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/trends/place.json"
- request.uri.queryString() === Some("exclude=hashtags&id=1")
- }.respondWithRated("/twitter/rest/trends/trends.json").await
+ val result: RatedData[Seq[LocationTrends]] = when(trends(1, true))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/trends/place.json"
+ request.uri.queryString() === Some("exclude=hashtags&id=1")
+ }
+ .respondWithRated("/twitter/rest/trends/trends.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[LocationTrends]]("/fixtures/rest/trends/trends.json")
}
"get locations with available trends" in new TwitterTrendClientSpecContext {
- val result: RatedData[Seq[Location]] = when(locationTrends).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/trends/available.json"
- }.respondWithRated("/twitter/rest/trends/available_locations.json").await
+ val result: RatedData[Seq[Location]] = when(locationTrends)
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/trends/available.json"
+ }
+ .respondWithRated("/twitter/rest/trends/available_locations.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Location]]("/fixtures/rest/trends/available_locations.json")
}
"get closest location trends" in new TwitterTrendClientSpecContext {
- val result: RatedData[Seq[Location]] = when(closestLocationTrends(37.781157, -122.400612831116)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/trends/closest.json"
- }.respondWithRated("/twitter/rest/trends/closest_locations.json").await
+ val result: RatedData[Seq[Location]] = when(closestLocationTrends(37.781157, -122.400612831116))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/trends/closest.json"
+ }
+ .respondWithRated("/twitter/rest/trends/closest_locations.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[Location]]("/fixtures/rest/trends/closest_locations.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClientSpec.scala
index 88ef7c64..ad3143b4 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/rest/users/TwitterUserClientSpec.scala
@@ -6,16 +6,19 @@ import com.danielasfregola.twitter4s.helpers.ClientSpec
class TwitterUserClientSpec extends ClientSpec {
-class TwitterUserClientSpecContext extends RestClientSpecContext with TwitterUserClient
+ class TwitterUserClientSpecContext extends RestClientSpecContext with TwitterUserClient
"Twitter User Client" should {
"retrieve users" in new TwitterUserClientSpecContext {
- val result: RatedData[Seq[User]] = when(users("marcobonzanini", "odersky")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/lookup.json"
- request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini,odersky")
- }.respondWithRated("/twitter/rest/users/users.json").await
+ val result: RatedData[Seq[User]] = when(users("marcobonzanini", "odersky"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/lookup.json"
+ request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini,odersky")
+ }
+ .respondWithRated("/twitter/rest/users/users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[User]]("/fixtures/rest/users/users.json")
}
@@ -25,11 +28,14 @@ class TwitterUserClientSpecContext extends RestClientSpecContext with TwitterUse
}
"retrieve users by user ids" in new TwitterUserClientSpecContext {
- val result: RatedData[Seq[User]] = when(usersByIds(19018614, 17765013)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/lookup.json"
- request.uri.queryString() === Some("include_entities=true&user_id=19018614,17765013")
- }.respondWithRated("/twitter/rest/users/users.json").await
+ val result: RatedData[Seq[User]] = when(usersByIds(19018614, 17765013))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/lookup.json"
+ request.uri.queryString() === Some("include_entities=true&user_id=19018614,17765013")
+ }
+ .respondWithRated("/twitter/rest/users/users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[User]]("/fixtures/rest/users/users.json")
}
@@ -39,51 +45,66 @@ class TwitterUserClientSpecContext extends RestClientSpecContext with TwitterUse
}
"retrieve user" in new TwitterUserClientSpecContext {
- val result: RatedData[User] = when(user("marcobonzanini")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/show.json"
- request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini")
- }.respondWithRated("/twitter/rest/users/user.json").await
+ val result: RatedData[User] = when(user("marcobonzanini"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/show.json"
+ request.uri.queryString() === Some("include_entities=true&screen_name=marcobonzanini")
+ }
+ .respondWithRated("/twitter/rest/users/user.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/users/user.json")
}
"retrieve user by id" in new TwitterUserClientSpecContext {
- val result: RatedData[User] = when(userById(19018614)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/show.json"
- request.uri.queryString() === Some("include_entities=true&user_id=19018614")
- }.respondWithRated("/twitter/rest/users/user.json").await
+ val result: RatedData[User] = when(userById(19018614))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/show.json"
+ request.uri.queryString() === Some("include_entities=true&user_id=19018614")
+ }
+ .respondWithRated("/twitter/rest/users/user.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[User]("/fixtures/rest/users/user.json")
}
- "get the profile banners of a user" in new TwitterUserClientSpecContext {
- val result: RatedData[Banners] = when(profileBannersForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/profile_banner.json"
- request.uri.queryString() === Some("screen_name=DanielaSfregola")
- }.respondWithRated("/twitter/rest/users/profile_banner.json").await
+ "get the profile banners of a user" in new TwitterUserClientSpecContext {
+ val result: RatedData[Banners] = when(profileBannersForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/profile_banner.json"
+ request.uri.queryString() === Some("screen_name=DanielaSfregola")
+ }
+ .respondWithRated("/twitter/rest/users/profile_banner.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Banners]("/fixtures/rest/users/profile_banner.json")
}
- "get the profile banners of a user by id" in new TwitterUserClientSpecContext {
- val result: RatedData[Banners] = when(profileBannersForUserId(19018614)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/profile_banner.json"
- request.uri.queryString() === Some("user_id=19018614")
- }.respondWithRated("/twitter/rest/users/profile_banner.json").await
+ "get the profile banners of a user by id" in new TwitterUserClientSpecContext {
+ val result: RatedData[Banners] = when(profileBannersForUserId(19018614))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/profile_banner.json"
+ request.uri.queryString() === Some("user_id=19018614")
+ }
+ .respondWithRated("/twitter/rest/users/profile_banner.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Banners]("/fixtures/rest/users/profile_banner.json")
}
"search for a user" in new TwitterUserClientSpecContext {
- val result: RatedData[Seq[User]] = when(searchForUser("DanielaSfregola")).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://api.twitter.com/1.1/users/search.json"
- request.uri.queryString() === Some("count=20&include_entities=true&page=-1&q=DanielaSfregola")
- }.respondWithRated("/twitter/rest/users/users.json").await
+ val result: RatedData[Seq[User]] = when(searchForUser("DanielaSfregola"))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://api.twitter.com/1.1/users/search.json"
+ request.uri.queryString() === Some("count=20&include_entities=true&page=-1&q=DanielaSfregola")
+ }
+ .respondWithRated("/twitter/rest/users/users.json")
+ .await
result.rate_limit === rateLimit
result.data === loadJsonAs[Seq[User]]("/fixtures/rest/users/users.json")
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClientSpec.scala
index 33f8382f..ee8e485d 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/StreamingClientSpec.scala
@@ -90,7 +90,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/user/friends_lists_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[FriendsListsStringified]("/fixtures/streaming/user/friends_lists_stringified.json")
+ val messages =
+ readStreamUpdatesAs[FriendsListsStringified]("/fixtures/streaming/user/friends_lists_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -106,7 +107,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/common/location_deletion_notices.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[LocationDeletionNotice]("/fixtures/streaming/common/location_deletion_notices.json")
+ val messages =
+ readStreamUpdatesAs[LocationDeletionNotice]("/fixtures/streaming/common/location_deletion_notices.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -114,7 +116,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/common/status_deletion_notices.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[StatusDeletionNotice]("/fixtures/streaming/common/status_deletion_notices.json")
+ val messages =
+ readStreamUpdatesAs[StatusDeletionNotice]("/fixtures/streaming/common/status_deletion_notices.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -122,7 +125,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/common/status_withheld_notices.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[StatusWithheldNotice]("/fixtures/streaming/common/status_withheld_notices.json")
+ val messages =
+ readStreamUpdatesAs[StatusWithheldNotice]("/fixtures/streaming/common/status_withheld_notices.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -146,7 +150,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelops_friends_list.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopFriendsLists]("/fixtures/streaming/site/user_envelops_friends_list.json")
+ val messages =
+ readStreamUpdatesAs[UserEnvelopFriendsLists]("/fixtures/streaming/site/user_envelops_friends_list.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -154,7 +159,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelops_friends_list_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopFriendsListsStringified]("/fixtures/streaming/site/user_envelops_friends_list_stringified.json")
+ val messages = readStreamUpdatesAs[UserEnvelopFriendsListsStringified](
+ "/fixtures/streaming/site/user_envelops_friends_list_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -162,7 +168,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_direct_message.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopDirectMessage]("/fixtures/streaming/site/user_envelop_direct_message.json")
+ val messages =
+ readStreamUpdatesAs[UserEnvelopDirectMessage]("/fixtures/streaming/site/user_envelop_direct_message.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -170,7 +177,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_twitter_list_event.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopTwitterListEvent]("/fixtures/streaming/site/user_envelop_twitter_list_event.json")
+ val messages = readStreamUpdatesAs[UserEnvelopTwitterListEvent](
+ "/fixtures/streaming/site/user_envelop_twitter_list_event.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -178,7 +186,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_tweet_event.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopTweetEvent]("/fixtures/streaming/site/user_envelop_tweet_event.json")
+ val messages =
+ readStreamUpdatesAs[UserEnvelopTweetEvent]("/fixtures/streaming/site/user_envelop_tweet_event.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -186,7 +195,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_simple_event.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopSimpleEvent]("/fixtures/streaming/site/user_envelop_simple_event.json")
+ val messages =
+ readStreamUpdatesAs[UserEnvelopSimpleEvent]("/fixtures/streaming/site/user_envelop_simple_event.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -194,7 +204,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_warning_message.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopWarningMessage]("/fixtures/streaming/site/user_envelop_warning_message.json")
+ val messages =
+ readStreamUpdatesAs[UserEnvelopWarningMessage]("/fixtures/streaming/site/user_envelop_warning_message.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -202,7 +213,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_tweet_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopTweetStringified]("/fixtures/streaming/site/user_envelop_tweet_stringified.json")
+ val messages = readStreamUpdatesAs[UserEnvelopTweetStringified](
+ "/fixtures/streaming/site/user_envelop_tweet_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -210,7 +222,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_direct_message_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopDirectMessageStringified]("/fixtures/streaming/site/user_envelop_direct_message_stringified.json")
+ val messages = readStreamUpdatesAs[UserEnvelopDirectMessageStringified](
+ "/fixtures/streaming/site/user_envelop_direct_message_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -218,7 +231,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_twitter_list_event_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopTwitterListEventStringified]("/fixtures/streaming/site/user_envelop_twitter_list_event_stringified.json")
+ val messages = readStreamUpdatesAs[UserEnvelopTwitterListEventStringified](
+ "/fixtures/streaming/site/user_envelop_twitter_list_event_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -226,7 +240,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_tweet_event_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopTweetEventStringified]("/fixtures/streaming/site/user_envelop_tweet_event_stringified.json")
+ val messages = readStreamUpdatesAs[UserEnvelopTweetEventStringified](
+ "/fixtures/streaming/site/user_envelop_tweet_event_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -234,7 +249,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_simple_event_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopSimpleEventStringified]("/fixtures/streaming/site/user_envelop_simple_event_stringified.json")
+ val messages = readStreamUpdatesAs[UserEnvelopSimpleEventStringified](
+ "/fixtures/streaming/site/user_envelop_simple_event_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
@@ -242,7 +258,8 @@ class StreamingClientSpec extends TestActorSystem with ClientSpec {
val response = buildResponse("/twitter/streaming/site/user_envelop_warning_message_stringified.json")
streamingClient.processBody(response, killSwitch)(redirectMessages)
- val messages = readStreamUpdatesAs[UserEnvelopWarningMessageStringified]("/fixtures/streaming/site/user_envelop_warning_message_stringified.json")
+ val messages = readStreamUpdatesAs[UserEnvelopWarningMessageStringified](
+ "/fixtures/streaming/site/user_envelop_warning_message_stringified.json")
transport.expectMsgAllOf(messages: _*)
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStreamSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStreamSpec.scala
index 277c6642..8881804f 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStreamSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/TwitterStreamSpec.scala
@@ -8,10 +8,10 @@ import org.specs2.mock.Mockito
class TwitterStreamSpec extends ClientSpec with Mockito {
class TwitterStreamSpecContext extends StreamingClientSpecContext {
- val switch = mock[KillSwitch]
- val request = HttpRequest()
- doNothing when switch shutdown
- val stream = new TwitterStream(consumerToken, accessToken)(switch, request, system)
+ val switch = mock[KillSwitch]
+ val request = HttpRequest()
+ doNothing when switch shutdown
+ val stream = new TwitterStream(consumerToken, accessToken)(switch, request, system)
}
"Twitter Stream" should {
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClientSpec.scala
index c54465f9..570c9003 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/sites/TwitterSiteClientSpec.scala
@@ -12,11 +12,14 @@ class TwitterSiteClientSpec extends ClientSpec {
"start a filtered site stream" in new TwitterSiteClientSpecContext {
val result: Unit =
- when(siteEvents(languages = Seq(Language.Italian))(dummyProcessing)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://sitestream.twitter.com/1.1/site.json"
- request.uri.queryString() === Some("language=it&stall_warnings=false&stringify_friend_ids=false&with=user")
- }.respondWithOk.await
+ when(siteEvents(languages = Seq(Language.Italian))(dummyProcessing))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://sitestream.twitter.com/1.1/site.json"
+ request.uri.queryString() === Some("language=it&stall_warnings=false&stringify_friend_ids=false&with=user")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClientSpec.scala
index 386ccaa2..27d33dc9 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/statuses/TwitterStatusClientSpec.scala
@@ -12,14 +12,16 @@ class TwitterStatusClientSpec extends ClientSpec {
"start a filtered status stream" in new TwitterStatusClientSpecContext {
val result: Unit =
- when(filterStatuses(follow = Seq(1L, 2L, 3L),
- tracks = Seq("trending", "other"),
- languages = Seq(Language.Hungarian, Language.Bengali))(dummyProcessing))
+ when(
+ filterStatuses(follow = Seq(1L, 2L, 3L),
+ tracks = Seq("trending", "other"),
+ languages = Seq(Language.Hungarian, Language.Bengali))(dummyProcessing))
.expectRequest { request =>
request.method === HttpMethods.POST
request.uri.endpoint === "https://stream.twitter.com/1.1/statuses/filter.json"
- request.entity === HttpEntity(`application/x-www-form-urlencoded`,
- "filter_level=none&follow=1%2C2%2C3&language=hu%2Cbn&stall_warnings=false&track=trending%2Cother")
+ request.entity === HttpEntity(
+ `application/x-www-form-urlencoded`,
+ "filter_level=none&follow=1%2C2%2C3&language=hu%2Cbn&stall_warnings=false&track=trending%2Cother")
}
.respondWithOk
.await
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClientSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClientSpec.scala
index eff2303a..277e2b0d 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClientSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/clients/streaming/users/TwitterUserClientSpec.scala
@@ -12,11 +12,15 @@ class TwitterUserClientSpec extends ClientSpec {
"start a filtered user stream" in new TwitterUserClientSpecContext {
val result: Unit =
- when(userEvents(tracks = Seq("trending"), languages = Seq(Language.English))(dummyProcessing)).expectRequest { request =>
- request.method === HttpMethods.GET
- request.uri.endpoint === "https://userstream.twitter.com/1.1/user.json"
- request.uri.queryString() === Some("filter_level=none&language=en&stall_warnings=false&stringify_friend_ids=false&track=trending&with=followings")
- }.respondWithOk.await
+ when(userEvents(tracks = Seq("trending"), languages = Seq(Language.English))(dummyProcessing))
+ .expectRequest { request =>
+ request.method === HttpMethods.GET
+ request.uri.endpoint === "https://userstream.twitter.com/1.1/user.json"
+ request.uri.queryString() === Some(
+ "filter_level=none&language=en&stall_warnings=false&stringify_friend_ids=false&track=trending&with=followings")
+ }
+ .respondWithOk
+ .await
result.isInstanceOf[Unit] should beTrue
}
}
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoderSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoderSpec.scala
index 20e6270d..91349a73 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoderSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/marshalling/BodyEncoderSpec.scala
@@ -9,7 +9,7 @@ class BodyEncoderSpec extends Specification with BodyEncoder {
"encode a case class to a body with encoded params" in {
case class TestData(d: Seq[Long], c: String, b: Option[Boolean], a: Int)
- val test = TestData(Seq(1,2,3),"Hello Ladies + Gentlemen, a signed OAuth request!", None, 5)
+ val test = TestData(Seq(1, 2, 3), "Hello Ladies + Gentlemen, a signed OAuth request!", None, 5)
val result = toBodyAsEncodedParams(test)
result === "a=5&c=Hello+Ladies+%2B+Gentlemen%2C+a+signed+OAuth+request%21&d=1%2C2%2C3"
}
@@ -17,7 +17,7 @@ class BodyEncoderSpec extends Specification with BodyEncoder {
"encode a case class to a body with params" in {
case class TestData(d: Seq[Long], c: String, b: Option[Boolean], a: Int)
- val test = TestData(Seq(1,2,3),"Hello Ladies + Gentlemen, a signed OAuth request!", None, 5)
+ val test = TestData(Seq(1, 2, 3), "Hello Ladies + Gentlemen, a signed OAuth request!", None, 5)
val result = toBodyAsParams(test)
result === "a=5&c=Hello Ladies + Gentlemen, a signed OAuth request!&d=1,2,3"
}
@@ -25,4 +25,3 @@ class BodyEncoderSpec extends Specification with BodyEncoder {
}
}
-
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2ProviderSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2ProviderSpec.scala
index e353e105..121647c1 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2ProviderSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/oauth/OAuth2ProviderSpec.scala
@@ -8,11 +8,7 @@ import com.danielasfregola.twitter4s.helpers.{AwaitableFuture, TestActorSystem,
import org.specs2.matcher.Scope
import org.specs2.mutable.SpecificationLike
-class OAuth2ProviderSpec
- extends TestActorSystem
- with SpecificationLike
- with AwaitableFuture
- with TestExecutionContext {
+class OAuth2ProviderSpec extends TestActorSystem with SpecificationLike with AwaitableFuture with TestExecutionContext {
val consumerToken = ConsumerToken("xvz1evFS4wEEPTGEFPHBog", "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw")
@@ -29,7 +25,8 @@ class OAuth2ProviderSpec
}
abstract class OAuthWithAccessToken extends Scope {
- implicit val accessToken = AccessToken("370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", "LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE")
+ implicit val accessToken =
+ AccessToken("370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", "LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE")
val provider = providerBuilder(Some(accessToken))
}
@@ -82,7 +79,8 @@ class OAuth2ProviderSpec
}
"generate the signing key as expected" in new OAuthWithAccessToken {
- val expectedSigningKey = "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE"
+ val expectedSigningKey =
+ "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE"
provider.signingKey === expectedSigningKey
}
@@ -154,7 +152,8 @@ class OAuth2ProviderSpec
"with access token" in {
- "provide an Authorization token according to the OAuth standards" in new OAuthWithAccessToken with WithCallback {
+ "provide an Authorization token according to the OAuth standards" in new OAuthWithAccessToken
+ with WithCallback {
val oauthHeader = provider.oauth2Header(callback)(request, materializer).await
val expectedAuthorization =
"""OAuth oauth_callback="http%3A%2F%2Fmy.example%2Fauth", oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog", oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg", oauth_signature="qiHvwU1c%2Bi7rCRk8rnVGOHXXTBI%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1318622958", oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", oauth_version="1.0""""
@@ -191,7 +190,8 @@ class OAuth2ProviderSpec
}
"generate the signing key as expected" in new OAuthWithAccessToken with WithCallback {
- val expectedSigningKey = "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE"
+ val expectedSigningKey =
+ "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE"
provider.signingKey === expectedSigningKey
}
@@ -200,7 +200,8 @@ class OAuth2ProviderSpec
bodyParams === Map("status" -> "Hello%20Ladies%20%2B%20Gentlemen%2C%20a%20signed%20OAuth%20request%21")
}
- "extract body parameters from a request without body as expected" in new OAuthWithAccessToken with WithCallback {
+ "extract body parameters from a request without body as expected" in new OAuthWithAccessToken
+ with WithCallback {
val requestWithoutBody = request.withEntity(HttpEntity.Empty)
val bodyParams = provider.bodyParams(requestWithoutBody, materializer).await
bodyParams === Map()
@@ -209,7 +210,8 @@ class OAuth2ProviderSpec
"with no access token" in {
- "provide an Authorization token according to the OAuth standards" in new OAuthWithNoAccessToken with WithCallback {
+ "provide an Authorization token according to the OAuth standards" in new OAuthWithNoAccessToken
+ with WithCallback {
val oauthHeader = provider.oauth2Header(callback)(request, materializer).await
val expectedAuthorization =
"""OAuth oauth_callback="http%3A%2F%2Fmy.example%2Fauth", oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog", oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg", oauth_signature="Nb7%2FehS1ddvtYCbI9VU1AJyBKS8%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1318622958", oauth_version="1.0""""
@@ -253,7 +255,8 @@ class OAuth2ProviderSpec
bodyParams === Map("status" -> "Hello%20Ladies%20%2B%20Gentlemen%2C%20a%20signed%20OAuth%20request%21")
}
- "extract body parameters from a request without body as expected" in new OAuthWithNoAccessToken with WithCallback {
+ "extract body parameters from a request without body as expected" in new OAuthWithNoAccessToken
+ with WithCallback {
val requestWithoutBody = request.withEntity(HttpEntity.Empty)
val bodyParams = provider.bodyParams(requestWithoutBody, materializer).await
bodyParams === Map()
diff --git a/src/test/scala/com/danielasfregola/twitter4s/http/serializers/FormSupportSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/http/serializers/FormSupportSpec.scala
index 2fbf26bd..bd1aa701 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/http/serializers/FormSupportSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/http/serializers/FormSupportSpec.scala
@@ -8,22 +8,18 @@ import org.specs2.specification.Scope
import scala.concurrent.Future
-
-class FormSupportSpec
- extends TestActorSystem
- with SpecificationLike
- with AwaitableFuture
- with TestExecutionContext {
+class FormSupportSpec extends TestActorSystem with SpecificationLike with AwaitableFuture with TestExecutionContext {
case class MyTest(a: String, b: String, c: String, d: Boolean)
implicit object MyTestFromMap extends FromMap[MyTest] {
- def apply(m: Map[String, String]) = for {
- a <- m.get("a")
- b <- m.get("b")
- c <- m.get("c")
- d <- m.get("d")
- } yield MyTest(a, b, c, toBoolean(d))
+ def apply(m: Map[String, String]) =
+ for {
+ a <- m.get("a")
+ b <- m.get("b")
+ c <- m.get("c")
+ d <- m.get("d")
+ } yield MyTest(a, b, c, toBoolean(d))
}
abstract class FormSupportContext extends Scope
@@ -36,7 +32,7 @@ class FormSupportSpec
"unmarshall a well-formed text into a case class" in new FormSupportContext {
val text = "a=hello&c=test&b=foobar&d=true"
val result: Future[MyTest] = FormSupport.unmarshallText[MyTest](buildResponse(text))
- result.await === MyTest(a = "hello", b = "foobar", c = "test", d = true)
+ result.await === MyTest(a = "hello", b = "foobar", c = "test", d = true)
}
"throw TwitterException if text is not well formed" in new FormSupportContext {
diff --git a/src/test/scala/com/danielasfregola/twitter4s/util/EncoderSpec.scala b/src/test/scala/com/danielasfregola/twitter4s/util/EncoderSpec.scala
index 3a96827a..e35a7fe5 100644
--- a/src/test/scala/com/danielasfregola/twitter4s/util/EncoderSpec.scala
+++ b/src/test/scala/com/danielasfregola/twitter4s/util/EncoderSpec.scala
@@ -8,28 +8,28 @@ class EncoderSpec extends Specification with Encoder {
"encode a base and secret as expected" in {
val base = "POST&" +
- "https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.json&" +
- "include_entities%3Dtrue%26" +
- "oauth_consumer_key%3Dxvz1evFS4wEEPTGEFPHBog%26" +
- "oauth_nonce%3DkYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg%26" +
- "oauth_signature_method%3DHMAC-SHA1%26" +
- "oauth_timestamp%3D1318622958%26" +
- "oauth_token%3D370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb%26" +
- "oauth_version%3D1.0%26" +
- "status%3DHello%2520Ladies%2520%252B%2520Gentlemen%252C%2520a%2520signed%2520OAuth%2520request%2521"
+ "https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.json&" +
+ "include_entities%3Dtrue%26" +
+ "oauth_consumer_key%3Dxvz1evFS4wEEPTGEFPHBog%26" +
+ "oauth_nonce%3DkYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg%26" +
+ "oauth_signature_method%3DHMAC-SHA1%26" +
+ "oauth_timestamp%3D1318622958%26" +
+ "oauth_token%3D370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb%26" +
+ "oauth_version%3D1.0%26" +
+ "status%3DHello%2520Ladies%2520%252B%2520Gentlemen%252C%2520a%2520signed%2520OAuth%2520request%2521"
val secret = "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE"
toHmacSha1(base, secret) === "tnnArxj06cWHq44gCs1OSKk/jLY="
}
"encode a base and secret as expected with callback" in {
val base = "POST&" +
- "https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&" +
- "oauth_callback%3Dhttp%253A%252F%252Flocalhost%252Fsign-in-with-twitter%252F%26" +
- "oauth_consumer_key%3DcChZNFj6T5R0TigYB9yd1w%26" +
- "oauth_nonce%3Dea9ec8429b68d6b77cd5600adbbb0456%26" +
- "oauth_signature_method%3DHMAC-SHA1%26" +
- "oauth_timestamp%3D1318467427%26" +
- "oauth_version%3D1.0"
+ "https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&" +
+ "oauth_callback%3Dhttp%253A%252F%252Flocalhost%252Fsign-in-with-twitter%252F%26" +
+ "oauth_consumer_key%3DcChZNFj6T5R0TigYB9yd1w%26" +
+ "oauth_nonce%3Dea9ec8429b68d6b77cd5600adbbb0456%26" +
+ "oauth_signature_method%3DHMAC-SHA1%26" +
+ "oauth_timestamp%3D1318467427%26" +
+ "oauth_version%3D1.0"
val secret = "L8qq9PZyRg6ieKGEKhZolGC0vJWLw8iEJ88DRdyOg&"
toHmacSha1(base, secret) === "F1Li3tvehgcraF8DMJ7OyxO4w9Y="
}