forked from commons-app/apps-android-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert wikidata/mwapi to kotlin (part 4) (commons-app#6010)
* Convert ImageDetails to kotlin * Convert MwException/MwServiceError to kotlin * Convert ListUserResponse to kotlin * Convert MwPostResponse to kotlin * Convert MwQueryResponse to kotlin * Convert MwQueryResult to kotlin * Convert MwQueryPage to kotlin --------- Co-authored-by: Nicolas Raoul <[email protected]>
- Loading branch information
1 parent
56ada36
commit 7331197
Showing
28 changed files
with
474 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/ImageDetails.java
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/ImageDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package fr.free.nrw.commons.wikidata.mwapi | ||
|
||
class ImageDetails { | ||
val name: String? = null | ||
val title: String? = null | ||
} |
26 changes: 0 additions & 26 deletions
26
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/ListUserResponse.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/ListUserResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package fr.free.nrw.commons.wikidata.mwapi | ||
|
||
class ListUserResponse { | ||
private val name: String? = null | ||
private val userid: Long = 0 | ||
private val groups: List<String>? = null | ||
|
||
fun name(): String? = name | ||
|
||
fun getGroups(): Set<String> = | ||
groups?.toSet() ?: emptySet() | ||
} |
44 changes: 0 additions & 44 deletions
44
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/MwException.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/MwException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package fr.free.nrw.commons.wikidata.mwapi | ||
|
||
class MwException( | ||
val error: MwServiceError?, | ||
private val errors: List<MwServiceError>? | ||
) : RuntimeException() { | ||
val errorCode: String? | ||
get() = error?.code ?: errors?.get(0)?.code | ||
|
||
val title: String? | ||
get() = error?.title ?: errors?.get(0)?.title | ||
|
||
override val message: String? | ||
get() = error?.details ?: errors?.get(0)?.details | ||
} |
16 changes: 0 additions & 16 deletions
16
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/MwPostResponse.java
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
app/src/main/java/fr/free/nrw/commons/wikidata/mwapi/MwPostResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package fr.free.nrw.commons.wikidata.mwapi | ||
|
||
open class MwPostResponse : MwResponse() { | ||
val successVal: Int = 0 | ||
|
||
fun success(result: String?): Boolean = | ||
"success" == result | ||
} | ||
|
Oops, something went wrong.