-
Notifications
You must be signed in to change notification settings - Fork 100
Conversation
Codecov Report
@@ Coverage Diff @@
## master #229 +/- ##
==========================================
+ Coverage 94.2% 94.26% +0.05%
==========================================
Files 75 76 +1
Lines 1157 1168 +11
Branches 11 12 +1
==========================================
+ Hits 1090 1101 +11
Misses 67 67
Continue to review full report at Codecov.
|
src/main/scala/com/danielasfregola/twitter4s/http/oauth/OAuth1Provider.scala
Show resolved
Hide resolved
src/main/scala/com/danielasfregola/twitter4s/entities/NewDM.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mitgard,
thanks for your PR!
I think we are almost there. Could you please:
- clarify the reason of the changes in
OAuth1Provider.scala
- rename class as per comment
- add return types to the public methods
- Could we please add a deprecation annotation to the methods linked to the methods that Twitter is deprecating? Something like
@deprecated("Twitter endpoint deprecated from 17th Sep 2018. Please use 'whatever' instead.")
.../danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClient.scala
Outdated
Show resolved
Hide resolved
.../danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClient.scala
Outdated
Show resolved
Hide resolved
.../danielasfregola/twitter4s/http/clients/rest/directmessages/TwitterDirectMessageClient.scala
Outdated
Show resolved
Hide resolved
This fixes #227 |
@DanielaSfregola What we do with tests for deprecated function? Exclude |
I would probably temporary remove the compiler flag, rather than removing the tests |
@@ -23,6 +65,7 @@ trait TwitterDirectMessageClient { | |||
* @param id : The ID of the direct message. | |||
* @return : The direct message. | |||
* */ | |||
@deprecated("Twitter endpoint deprecated from 17th Sep 2018. Please use 'eventShow' instead.", "twitter4s 5.6") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be released as part of twitter4s 6.0, so can you please change the since message of the deprecated annotation?
…, fix event class
…, fix event class
…, fix event class
build.sbt
Outdated
@@ -74,7 +74,6 @@ lazy val standardSettings = Seq( | |||
"UTF-8", | |||
"-Xlint", | |||
"-deprecation", | |||
"-Xfatal-warnings", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fatal-warnings
flag is too important to remove it.
If you cannot find a way to let the tests involving deprecation pass, I would rather delete them that removing the flag.
@DanielaSfregola It seems I've finished with that. Could you please check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good.
Before we can merge we need to:
-
use more specific types in the entity so that the API can be easier to use (e.g.: enums rather than string, time related types rather than string, etc).
-
[ME] double check that the changes on the token authentication don't break the other endpoints. We do have unit tests, but it is such a delicate part of the code that I'd like to do some manual testing that uses the actual Twitter API, just to be sure.
@@ -0,0 +1,18 @@ | |||
package com.danielasfregola.twitter4s.entities | |||
|
|||
final case class DirectMessageEvent(`type`: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type
should be an enum as we should know the set of possible values accepted by the Twitter API
id
s general are of type Long, any particular reason they are of type String here?
timestamp
s should have a type consistent to the other types of timestamp in the code. Also, we may want to add a default to "now", so that people can just create the entity without providing one explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
import com.danielasfregola.twitter4s.entities.streaming.UserStreamingMessage | ||
|
||
final case class DirectMessageEventList(events: List[DirectMessageEvent], | ||
apps: Option[Map[String, Apps]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why an Option[Map[.., ...]]
and not just a Map[..., ...]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed to just Map[..., ...]
unless there is a specific reason to keep the optional wrapper
|
||
private[twitter4s] final case class NewDirectMessageEvent(event: NewEvent) | ||
|
||
private[twitter4s] final case class NewEvent(`type`: String = "message_create", message_create: MessageCreate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type
should be an enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (cleanBody.nonEmpty) { | ||
if (cleanBody.nonEmpty && request.entity | ||
.getContentType() | ||
.mediaType == MediaTypes.`application/x-www-form-urlencoded`) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check this before merging, as this could break other endpoints' authentication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we return Map()
if we cannot calculate Map
id to Long timestamp to LocalDateTime
@DanielaSfregola, Could you please check. I fixed you comments. |
|
||
final case class DirectMessageEvent(`type`: TweetType.Value = TweetType.messageCreate, | ||
id: DirectMessageId, | ||
created_timestamp: LocalDateTime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created_timestamp
cannot be a local date as we need to consider timezones as well. I suggest to change it to Instant
and to add a default of Instant.now
.
Hi @mitgard,
I know you have been working on this PR for quite some time now, so I am happy to merge it as it and prepare a patch for it if you no longer have the time to work on it. Cheers, |
Hi @DanielaSfregola, sorry for my long time patch. I've fixed last comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…ssages #229 Minor changes and clean up
No description provided.