Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite in Kotlin + Dropping Apache HTTP Client #14

Merged
merged 147 commits into from
Jan 23, 2018
Merged

Conversation

SirWellington
Copy link
Owner

Rewrites the entire Library in Kotlin, and drops usage of the Apache HTTP Client, in favor of the native HTTPURLConnection interface.
This makes the code compatible with the Android platform as well as the native JDK.

Copy link
Owner Author

@SirWellington SirWellington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a list of refinements that need to be made before merging.

Happy Coding,
Wellington

pom.xml Outdated
</parent>

<artifactId>alchemy-http</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.1-kotlin</version>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously, drop the -kotlin monicker

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -57,8 +58,8 @@
<properties>

<!--Java Compiler Properties-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice

*
* @return
*/
static AlchemyHttp newDefaultInstance()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By-bye java 😢

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup. Won't be missed.

*/
fun go(): AlchemyRequest.Step1

companion object
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name the companion object Factory, since it better encapsulates what this is for

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{

/**
* Creates a new [AlchemyHttp] using the default settings for the [Apache HTTP Client][HttpClient]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the doc, since the library no longer uses Apache HTTP Client

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


/**
*
* @author SirWellington
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bruh, add some java docs here

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


val newParam = Pair(name, value)

val queryParams = request.queryParams?.plus(newParam) ?: mapOf(newParam)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
You probably don't need the empty line above it.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

override fun toString(): String
{
var string = super.toString()
if (hasResponse())
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably replace with null-check and Elvis operator

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

*/
@RunWith(AlchemyTestRunner::class)
@IntegrationTest
class DomainsDBTest
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love these tests. Maybe throw some repetitions in there, like 5

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

*/
@RunWith(AlchemyTestRunner.class)
@IntegrationTest
public class WordnikAPITest
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really dope!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SirWellington
Copy link
Owner Author

Looks good! Approved.

@SirWellington
Copy link
Owner Author

bitmoji

@SirWellington SirWellington merged commit ec287d2 into develop Jan 23, 2018
@SirWellington SirWellington deleted the http-url branch January 23, 2018 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant