-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from AlbertImKr/refactor-rest-api
[Refactor] JSON으로 전환
- Loading branch information
Showing
9 changed files
with
78 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
### Origin URL 저장 | ||
POST {{baseUrl}}/shorten-url/create | ||
Content-Type: text/plain | ||
Content-Type: application/json | ||
|
||
https://www.naver.com | ||
{ | ||
"originUrl": "https://www.naver.com" | ||
} | ||
|
||
### 짧은 키워드로 Origin URL 조회 | ||
POST {{baseUrl}}/shorten-url/search | ||
Content-Type: text/plain | ||
Content-Type: application/json | ||
|
||
1 | ||
{ | ||
"shortenUrl": "1" | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/community/whatever/onembackendkotlin/Requests.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,5 @@ | ||
package community.whatever.onembackendkotlin | ||
|
||
data class ShortenUrlCreateRequest(val originUrl: String) | ||
|
||
data class ShortenUrlSearchRequest(val shortenUrl: String) |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/community/whatever/onembackendkotlin/Responses.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,5 @@ | ||
package community.whatever.onembackendkotlin | ||
|
||
data class ShortenedUrlResponse(val shortenedUrl: String) | ||
|
||
data class OriginUrlResponse(val originUrl: String) |
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: 2 additions & 15 deletions
17
src/main/kotlin/community/whatever/onembackendkotlin/UrlShortenService.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 |
---|---|---|
@@ -1,20 +1,7 @@ | ||
package community.whatever.onembackendkotlin | ||
|
||
interface UrlShortenService { | ||
/** | ||
* 아이디를 통해 원본 URL을 찾는다. | ||
* | ||
* @param id ShortenedUrl의 id이다. | ||
* @return ShortenedUrl의 id | ||
* @throws UrlNotFoundException ShortenedUrl의 id에 해당하는 ShortenedUrl이 존재하지 않으면 발생한다. | ||
*/ | ||
fun getOriginUrl(id: String): String | ||
|
||
/** | ||
* URL이 존재하면 저장된 URL의 id를 반환하고 존재하지 않으면 새롭게 URL을 저장하고 id를 반환한다. | ||
* | ||
* @param originUrl 단축할 URL이다. | ||
* @return 저장된 URL의 id이다. | ||
*/ | ||
fun saveShortenUrl(originUrl: String): String | ||
fun getOriginUrl(request: ShortenUrlSearchRequest): OriginUrlResponse | ||
fun saveShortenUrl(request: ShortenUrlCreateRequest): ShortenedUrlResponse | ||
} |
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