Skip to content

Commit

Permalink
feat(#68): added support parameters in delete requests
Browse files Browse the repository at this point in the history
  • Loading branch information
y9Kap committed Apr 11, 2024
1 parent 4673093 commit 80f4055
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import app.meetacy.sdk.types.serializable.paging.PagingIdSerializable
import app.meetacy.sdk.types.serializable.paging.PagingResponseSerializable
import app.meetacy.sdk.types.serializable.paging.serializable
import app.meetacy.sdk.types.serializable.paging.type
import app.meetacy.sdk.types.serializable.user.*
import app.meetacy.sdk.types.serializable.user.UserIdSerializable
import app.meetacy.sdk.types.serializable.user.UserSerializable
import app.meetacy.sdk.types.serializable.user.serializable
import app.meetacy.sdk.types.serializable.user.type
import app.meetacy.sdk.types.url.Url
import app.meetacy.sdk.types.user.RegularUser
import app.meetacy.sdk.types.user.UserLocationSnapshot
Expand Down Expand Up @@ -73,17 +76,12 @@ internal class FriendsEngine(
}.body<StatusTrueResponse>()
}

@Serializable
private data class DeleteFriendBody(val friendId: UserIdSerializable)
private fun DeleteFriendRequest.toBody() = DeleteFriendBody(friendId.serializable())

suspend fun delete(request: DeleteFriendRequest) {
val url = baseUrl / "delete"
val body = request.toBody()
httpClient.delete(url.string) {
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
parameter("friendId", request.friendId.string)
}.body<StatusTrueResponse>()
}

Expand Down

0 comments on commit 80f4055

Please sign in to comment.