/docs/ja/00.md

https://github.com/eed3si9n/gigahorse · Markdown · 86 lines · 63 code · 23 blank · 0 comment · 0 complexity · 30e8896b3b4ca8fd8bfb2f9ab072a53a MD5 · raw file

  1. ---
  2. out: index.html
  3. ---
  4. [AHC]: https://github.com/AsyncHttpClient/async-http-client/tree/1.9.x
  5. [netty]: http://netty.io
  6. [okhttp]: http://square.github.io/okhttp/
  7. [sslconfig]: https://github.com/lightbend/ssl-config
  8. [config]: https://github.com/lightbend/config
  9. [ws]: https://www.playframework.com/documentation/2.5.x/ScalaWS
  10. [dispatch]: https://dispatchhttp.org/Dispatch.html
  11. [contraband]: http://www.scala-sbt.org/contraband/
  12. [akkahttp]: http://doc.akka.io/docs/akka-http/current/scala.html
  13. [@wsargent]: https://github.com/wsargent
  14. [@n8han]: https://github.com/n8han
  15. [@Duhemm]: https://github.com/Duhemm
  16. [@alexdupre]: https://github.com/alexdupre
  17. Gigahorse
  18. =========
  19. Gigahorse Scala のための HTTP クライアントで内部に [Square OkHttp][okhttp] [Async Http Client][AHC] [Akka HTTP][akkahttp] を使うことができる
  20. ### セットアップ
  21. Square OkHttp を使う場合:
  22. ```scala
  23. libraryDependencies += "com.eed3si9n" %% "gigahorse-okhttp" % "$gigahorse_version$"
  24. ```
  25. Async HTTP Client を使う場合:
  26. ```scala
  27. libraryDependencies += "com.eed3si9n" %% "gigahorse-asynchttpclient" % "$gigahorse_version$"
  28. ```
  29. Akka HTTP は現段階では実験的サポート:
  30. ```scala
  31. libraryDependencies += "com.eed3si9n" %% "gigahorse-akka-http" % "$gigahorse_version$"
  32. ```
  33. ### ライブラリ依存性
  34. Gigahorse-OkHttp Scala [Square OkHttp][okhttp] に依存する
  35. 他に [Lightbend SSL Config][sslconfig]そして [Lightbend Config][config] にも依存している
  36. Gigahorse-AsyncHttpClient Scala[AHC 2.0][AHC] (これは [Netty 4][netty] に依存している)
  37. Gigahorse-Akka-HTTP は現状では実験段階で実装されていない機能もある
  38. ### 謝辞
  39. - 実装の大半はAHC の呼び出し方や設定のデフォルト値なども含め [The Play WS API][ws] をベースとした
  40. 特に設定に関しては [Lightbend Config][config] [@wsargent][@wsargent] [SSL Config][sslconfig]
  41. を採用しておりよりセキュアなデフォルトになっている
  42. - API の設計に関しては [@n8han][@n8han] [Dispatch Reboot][dispatch] に強い影響を受けている
  43. - データ型の全ては [@Duhemm][@Duhemm] と僕が作った [Contraband][contraband] を使って自動生成されている
  44. - [@alexdupre][@alexdupre] AHC 2.0 へのマイグレーションと WebSocket サポートをコントリビュートしてくれた
  45. - 実際の HTTP の仕事をしている HTTP ライブラリにこの場を借りて感謝したい
  46. ### ライセンス
  47. Apache v2
  48. ### クイックスタート
  49. Gigahorse を使った簡単な GET 呼び出しの例をみてみよう:
  50. ```console
  51. scala> import gigahorse._, support.okhttp.Gigahorse
  52. scala> import scala.concurrent._, duration._
  53. scala> val http = Gigahorse.http(Gigahorse.config)
  54. scala> val r = Gigahorse.url("https://api.duckduckgo.com").get.
  55. addQueryString(
  56. "q" -> "1 + 1"
  57. )
  58. scala> val f = http.run(r, Gigahorse.asString andThen {_.take(60)})
  59. scala> Await.result(f, 120.seconds)
  60. scala> http.close()
  61. ```
  62. <div style="margin: 100px"></div>
  63. ![Gigahorse](../files/gigahorse.jpg)