Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
Add new URLs delete function
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Jul 15, 2022
1 parent 74fc878 commit 70e2e56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/kotlin/com/cyb3rko/m3okotlin/data/URLs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package com.cyb3rko.m3okotlin.data

import kotlinx.serialization.Serializable

@Serializable
internal data class URLsDeleteRequest(val shortURL: String)

@Serializable
internal data class URLsListRequest(val shortURL: String)

Expand Down
10 changes: 10 additions & 0 deletions src/main/kotlin/com/cyb3rko/m3okotlin/services/URLsService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ private const val SERVICE = "url"
*/
object URLsService {

/**
* Delete a URL
* @since 0.2.2
*/
suspend fun delete(shortURL: String) {
return M3O.ktorHttpClient.post(M3O.getUrl(SERVICE, "Delete")) {
body = URLsDeleteRequest(shortURL)
}
}

/**
* List all the shortened URLs
* @since 0.1.0
Expand Down

0 comments on commit 70e2e56

Please sign in to comment.