mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 22:03:55 +01:00
Consistent api interfaces (#5530)
* Converted CategoryInterface to kotlin * Converted DepictsInterface to kotlin * Convert the MediaDetailInterface to kotlin * Convert MediaInterface to kotlin * Convert ReviewInterface to kotlin * Convert the UserInterface to kotlin * Convert the WikiBaseInterface to kotlin * Convert WikidataInterface to kotlin * Convert WikidataMediaInterface to kotlin * Convert UploadInterface to kotlin
This commit is contained in:
parent
c6cb97e199
commit
f9090b0c2c
20 changed files with 535 additions and 524 deletions
|
|
@ -1,31 +0,0 @@
|
|||
package fr.free.nrw.commons.mwapi;
|
||||
|
||||
import fr.free.nrw.commons.wikidata.mwapi.MwQueryResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
import static fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX;
|
||||
|
||||
public interface UserInterface {
|
||||
|
||||
/**
|
||||
* Gets the log events of user
|
||||
* @param user name of user without prefix
|
||||
* @param continuation continuation params returned in previous query
|
||||
* @return query response
|
||||
*/
|
||||
|
||||
@GET(MW_API_PREFIX + "action=query&list=logevents&letype=upload&leprop=title|timestamp|ids&lelimit=500")
|
||||
Observable<MwQueryResponse> getUserLogEvents(@Query("leuser") String user, @QueryMap Map<String, String> continuation);
|
||||
|
||||
/**
|
||||
* Checks to see if a user is currently blocked from Commons
|
||||
*/
|
||||
@GET(MW_API_PREFIX + "action=query&meta=userinfo&uiprop=blockinfo")
|
||||
Observable<MwQueryResponse> getUserBlockInfo();
|
||||
}
|
||||
28
app/src/main/java/fr/free/nrw/commons/mwapi/UserInterface.kt
Normal file
28
app/src/main/java/fr/free/nrw/commons/mwapi/UserInterface.kt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package fr.free.nrw.commons.mwapi
|
||||
|
||||
import fr.free.nrw.commons.wikidata.WikidataConstants
|
||||
import fr.free.nrw.commons.wikidata.mwapi.MwQueryResponse
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Query
|
||||
import retrofit2.http.QueryMap
|
||||
|
||||
interface UserInterface {
|
||||
/**
|
||||
* Gets the log events of user
|
||||
* @param user name of user without prefix
|
||||
* @param continuation continuation params returned in previous query
|
||||
* @return query response
|
||||
*/
|
||||
@GET(WikidataConstants.MW_API_PREFIX + "action=query&list=logevents&letype=upload&leprop=title|timestamp|ids&lelimit=500")
|
||||
fun getUserLogEvents(
|
||||
@Query("leuser") user: String?,
|
||||
@QueryMap continuation: Map<String?, String?>?
|
||||
): Observable<MwQueryResponse>
|
||||
|
||||
/**
|
||||
* Checks to see if a user is currently blocked from Commons
|
||||
*/
|
||||
@GET(WikidataConstants.MW_API_PREFIX + "action=query&meta=userinfo&uiprop=blockinfo")
|
||||
fun getUserBlockInfo(): Observable<MwQueryResponse>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue