This commit is contained in:
Benoit Marty 2020-08-03 14:54:53 +02:00 committed by Benoit Marty
parent 64d000ec53
commit 18c0f53764
10 changed files with 49 additions and 23 deletions

View file

@ -67,13 +67,15 @@ internal interface AuthAPI {
* https://github.com/matrix-org/matrix-doc/pull/2290
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "register/{threePid}/requestToken")
fun add3Pid(@Path("threePid") threePid: String, @Body params: AddThreePidRegistrationParams): Call<AddThreePidRegistrationResponse>
fun add3Pid(@Path("threePid") threePid: String,
@Body params: AddThreePidRegistrationParams): Call<AddThreePidRegistrationResponse>
/**
* Validate 3pid
*/
@POST
fun validate3Pid(@Url url: String, @Body params: ValidationCodeBody): Call<SuccessResult>
fun validate3Pid(@Url url: String,
@Body params: ValidationCodeBody): Call<SuccessResult>
/**
* Get the supported login flow

View file

@ -119,7 +119,9 @@ internal interface CryptoApi {
* @param body the body
*/
@PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "sendToDevice/{eventType}/{txnId}")
fun sendToDevice(@Path("eventType") eventType: String, @Path("txnId") transactionId: String, @Body body: SendToDeviceBody): Call<Unit>
fun sendToDevice(@Path("eventType") eventType: String,
@Path("txnId") transactionId: String,
@Body body: SendToDeviceBody): Call<Unit>
/**
* Delete a device.
@ -129,7 +131,8 @@ internal interface CryptoApi {
* @param params the deletion parameters
*/
@HTTP(path = NetworkConstants.URI_API_PREFIX_PATH_R0 + "devices/{device_id}", method = "DELETE", hasBody = true)
fun deleteDevice(@Path("device_id") deviceId: String, @Body params: DeleteDeviceParams): Call<Unit>
fun deleteDevice(@Path("device_id") deviceId: String,
@Body params: DeleteDeviceParams): Call<Unit>
/**
* Update the device information.
@ -139,7 +142,8 @@ internal interface CryptoApi {
* @param params the params
*/
@PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "devices/{device_id}")
fun updateDeviceInfo(@Path("device_id") deviceId: String, @Body params: UpdateDeviceInfoBody): Call<Unit>
fun updateDeviceInfo(@Path("device_id") deviceId: String,
@Body params: UpdateDeviceInfoBody): Call<Unit>
/**
* Get the update devices list from two sync token.
@ -149,5 +153,6 @@ internal interface CryptoApi {
* @param newToken the up-to token.
*/
@GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "keys/changes")
fun getKeyChanges(@Query("from") oldToken: String, @Query("to") newToken: String): Call<KeyChangesResponse>
fun getKeyChanges(@Query("from") oldToken: String,
@Query("to") newToken: String): Call<KeyChangesResponse>
}

View file

@ -32,7 +32,8 @@ internal interface FilterApi {
* @param body the Json representation of a FilterBody object
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/filter")
fun uploadFilter(@Path("userId") userId: String, @Body body: Filter): Call<FilterResponse>
fun uploadFilter(@Path("userId") userId: String,
@Body body: Filter): Call<FilterResponse>
/**
* Gets a filter with a given filterId from the homeserver
@ -42,5 +43,6 @@ internal interface FilterApi {
* @return Filter
*/
@GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/filter/{filterId}")
fun getFilterById(@Path("userId") userId: String, @Path("filterId") filterId: String): Call<Filter>
fun getFilterById(@Path("userId") userId: String,
@Path("filterId") filterId: String): Call<Filter>
}

View file

@ -94,5 +94,6 @@ internal interface IdentityAPI {
* - https://matrix.org/docs/spec/identity_service/latest#post-matrix-identity-v2-validate-email-submittoken
*/
@POST(NetworkConstants.URI_IDENTITY_PATH_V2 + "validate/{medium}/submitToken")
fun submitToken(@Path("medium") medium: String, @Body body: IdentityRequestOwnershipParams): Call<SuccessResult>
fun submitToken(@Path("medium") medium: String,
@Body body: IdentityRequestOwnershipParams): Call<SuccessResult>
}

View file

@ -34,5 +34,6 @@ internal interface OpenIdAPI {
* @param userId the user id
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/openid/request_token")
fun openIdToken(@Path("userId") userId: String, @Body body: JsonDict = emptyMap()): Call<RequestOpenIdTokenResponse>
fun openIdToken(@Path("userId") userId: String,
@Body body: JsonDict = emptyMap()): Call<RequestOpenIdTokenResponse>
}

View file

@ -47,13 +47,15 @@ internal interface ProfileAPI {
* Change user display name
*/
@PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "profile/{userId}/displayname")
fun setDisplayName(@Path("userId") userId: String, @Body body: SetDisplayNameBody): Call<Unit>
fun setDisplayName(@Path("userId") userId: String,
@Body body: SetDisplayNameBody): Call<Unit>
/**
* Change user avatar url.
*/
@PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "profile/{userId}/avatar_url")
fun setAvatarUrl(@Path("userId") userId: String, @Body body: SetAvatarUrlBody): Call<Unit>
fun setAvatarUrl(@Path("userId") userId: String,
@Body body: SetAvatarUrlBody): Call<Unit>
/**
* Bind a threePid

View file

@ -165,7 +165,8 @@ internal interface RoomAPI {
* @param eventId the event Id
*/
@GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/event/{eventId}")
fun getEvent(@Path("roomId") roomId: String, @Path("eventId") eventId: String): Call<Event>
fun getEvent(@Path("roomId") roomId: String,
@Path("eventId") eventId: String): Call<Event>
/**
* Send read markers.
@ -174,7 +175,8 @@ internal interface RoomAPI {
* @param markers the read markers
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/read_markers")
fun sendReadMarker(@Path("roomId") roomId: String, @Body markers: Map<String, String>): Call<Unit>
fun sendReadMarker(@Path("roomId") roomId: String,
@Body markers: Map<String, String>): Call<Unit>
/**
* Invite a user to the given room.
@ -184,7 +186,8 @@ internal interface RoomAPI {
* @param body a object that just contains a user id
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/invite")
fun invite(@Path("roomId") roomId: String, @Body body: InviteBody): Call<Unit>
fun invite(@Path("roomId") roomId: String,
@Body body: InviteBody): Call<Unit>
/**
* Invite a user to a room, using a ThreePid
@ -192,7 +195,8 @@ internal interface RoomAPI {
* @param roomId Required. The room identifier (not alias) to which to invite the user.
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/invite")
fun invite3pid(@Path("roomId") roomId: String, @Body body: ThreePidInviteBody): Call<Unit>
fun invite3pid(@Path("roomId") roomId: String,
@Body body: ThreePidInviteBody): Call<Unit>
/**
* Send a generic state events
@ -278,7 +282,8 @@ internal interface RoomAPI {
* @param userIdAndReason the banned user object (userId and reason for ban)
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/ban")
fun ban(@Path("roomId") roomId: String, @Body userIdAndReason: UserIdAndReason): Call<Unit>
fun ban(@Path("roomId") roomId: String,
@Body userIdAndReason: UserIdAndReason): Call<Unit>
/**
* unban a user from the given room.
@ -287,7 +292,8 @@ internal interface RoomAPI {
* @param userIdAndReason the unbanned user object (userId and reason for unban)
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/unban")
fun unban(@Path("roomId") roomId: String, @Body userIdAndReason: UserIdAndReason): Call<Unit>
fun unban(@Path("roomId") roomId: String,
@Body userIdAndReason: UserIdAndReason): Call<Unit>
/**
* Kick a user from the given room.
@ -296,7 +302,8 @@ internal interface RoomAPI {
* @param userIdAndReason the kicked user object (userId and reason for kicking)
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/kick")
fun kick(@Path("roomId") roomId: String, @Body userIdAndReason: UserIdAndReason): Call<Unit>
fun kick(@Path("roomId") roomId: String,
@Body userIdAndReason: UserIdAndReason): Call<Unit>
/**
* Strips all information out of an event which isn't critical to the integrity of the server-side representation of the room.

View file

@ -35,5 +35,7 @@ internal interface TermsAPI {
* This request requires authentication
*/
@POST
fun agreeToTerms(@Url url: String, @Body params: AcceptTermsBody, @Header(HttpHeaders.Authorization) token: String): Call<Unit>
fun agreeToTerms(@Url url: String,
@Body params: AcceptTermsBody,
@Header(HttpHeaders.Authorization) token: String): Call<Unit>
}

View file

@ -32,5 +32,7 @@ interface AccountDataAPI {
* @param params the put params
*/
@PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/account_data/{type}")
fun setAccountData(@Path("userId") userId: String, @Path("type") type: String, @Body params: Any): Call<Unit>
fun setAccountData(@Path("userId") userId: String,
@Path("type") type: String,
@Body params: Any): Call<Unit>
}

View file

@ -30,8 +30,10 @@ internal interface WidgetsAPI {
* @param body the body content (Ref: https://github.com/matrix-org/matrix-doc/pull/1961)
*/
@POST("register")
fun register(@Body body: RequestOpenIdTokenResponse, @Query("v") version: String?): Call<RegisterWidgetResponse>
fun register(@Body body: RequestOpenIdTokenResponse,
@Query("v") version: String?): Call<RegisterWidgetResponse>
@GET("account")
fun validateToken(@Query("scalar_token") scalarToken: String?, @Query("v") version: String?): Call<Unit>
fun validateToken(@Query("scalar_token") scalarToken: String?,
@Query("v") version: String?): Call<Unit>
}