Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/i10416/wikipedia4s
[WIP] Media Wiki Client for Scala 3 using FP
https://github.com/i10416/wikipedia4s
scala wikipedia
Last synced: 3 days ago
JSON representation
[WIP] Media Wiki Client for Scala 3 using FP
- Host: GitHub
- URL: https://github.com/i10416/wikipedia4s
- Owner: i10416
- Created: 2021-07-22T08:28:37.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T10:13:01.000Z (over 2 years ago)
- Last Synced: 2024-11-13T13:51:07.531Z (2 months ago)
- Topics: scala, wikipedia
- Language: Scala
- Homepage:
- Size: 41 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Wikipedia(Media Wiki) Client for Scala 3 (and Functional Programming Libraries)
```scala
implicit val ctx: APIContext = APIContext("en")
val wiki = new Wikipedia4s {}
wiki.query(Query.Suggest("helloworld", 5)).unsafeRunSync() match {
case Right(result) => println(result)
case Left(fail) => println(fail)
}wiki.query(Query.Search("helloworld", 5)).unsafeRunSync() match {
case Right(result) => println(result)
case Left(fail) => println(fail)
}wiki.query(Query.GeoSearch((37.789, -122.4), 500, 10, Some("wikipedia"))).unsafeRunSync() match {
case Right(result) => println(result)
case Left(fail) => println(fail)
}wiki.query(Query.MetaInfo(SiteInfoProps.values.toSeq)).unsafeRunSync() match {
case Right(result) => println(result)
case Left(fail) => println(fail)
}
```Inspired by https://github.com/goldsmith/Wikipedia and https://github.com/intracer/scalawiki
### How to Develop```shell
git clone path/to/repo
cd repo
sbt
```Add openapi.yaml, update `src/main/scala/dev/110416/commands` and `src/main/scala/dev/110416/typeclass` typeclass.
On compilation, a client implementation and models are generated from protocol/openapi.yaml under the protocol directory.
### Supporting APIs
- Search
- GeoSearch
- Suggest
- SiteInfo