File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
app/src/main/java/org/wikipedia/dataclient Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -581,6 +581,11 @@ interface Service {
581581 @Query(" pageids" ) pageIds : String? = null
582582 ): MwQueryResponse
583583
584+ @GET(MW_API_PREFIX + " action=paraminfo" )
585+ suspend fun getParamInfo (
586+ @Query(" modules" ) modules : String
587+ ): ParamInfoResponse
588+
584589 companion object {
585590 const val WIKIPEDIA_URL = " https://wikipedia.org/"
586591 const val WIKIDATA_URL = " https://www.wikidata.org/"
Original file line number Diff line number Diff line change 1+ package org.wikipedia.dataclient.mwapi
2+
3+ import kotlinx.serialization.Serializable
4+ import kotlinx.serialization.json.JsonElement
5+ import kotlinx.serialization.json.jsonArray
6+ import kotlinx.serialization.json.jsonPrimitive
7+
8+ @Suppress(" unused" )
9+ @Serializable
10+ class ParamInfoResponse : MwResponse () {
11+
12+ val paraminfo: ParamInfo ? = null
13+
14+ @Serializable
15+ class ParamInfo {
16+ val modules: List <Module > = emptyList()
17+ }
18+
19+ @Serializable
20+ class Module {
21+ val name = " "
22+ val classname = " "
23+ val path = " "
24+ val source = " "
25+ val parameters: List <Parameter > = emptyList()
26+ }
27+
28+ @Serializable
29+ class Parameter {
30+ val index = 0
31+ val name = " "
32+ val required = false
33+ val multi = false
34+ val type: JsonElement ? = null
35+
36+ val typeAsString get() = type?.jsonPrimitive?.content.orEmpty()
37+ val typeAsEnum get() = type?.jsonArray?.map { it.jsonPrimitive.content } ? : emptyList()
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments