-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
672 additions
and
242 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
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
53 changes: 1 addition & 52 deletions
53
src/main/kotlin/io/github/smaugfm/lunchmoney/exception/LunchmoneyApiResponseException.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,54 +1,3 @@ | ||
package io.github.smaugfm.lunchmoney.exception | ||
|
||
import io.github.smaugfm.lunchmoney.response.ApiErrorResponse | ||
import io.netty.handler.codec.http.HttpResponseStatus | ||
|
||
@Suppress("MemberVisibilityCanBePrivate") | ||
class LunchmoneyApiResponseException : LunchmoneyApiException { | ||
val apiErrorResponse: ApiErrorResponse? | ||
val statusCode: Int | ||
val body: String | ||
|
||
constructor( | ||
body: String, | ||
cause: ApiErrorResponse, | ||
statusCode: Int | ||
) : super(errorMessage(cause)) { | ||
this.body = body | ||
this.apiErrorResponse = cause | ||
this.statusCode = statusCode | ||
} | ||
|
||
constructor( | ||
body: String, | ||
cause: Throwable, | ||
statusCode: Int | ||
) : super(cause) { | ||
this.body = body | ||
this.apiErrorResponse = null | ||
this.statusCode = statusCode | ||
} | ||
|
||
constructor( | ||
statusCode: Int | ||
) : super( | ||
"Response body is empty but status is $statusCode " + | ||
HttpResponseStatus.valueOf(statusCode).reasonPhrase() | ||
) { | ||
this.body = "" | ||
this.apiErrorResponse = null | ||
this.statusCode = statusCode | ||
} | ||
|
||
companion object { | ||
private fun errorMessage(apiErrorResponse: ApiErrorResponse): String { | ||
val msg = apiErrorResponse.message | ||
if (msg != null) { | ||
return msg | ||
} | ||
|
||
return apiErrorResponse.error?.joinToString(", ") | ||
?: "Received erroneous response from Lunchmoney API" | ||
} | ||
} | ||
} | ||
class LunchmoneyApiResponseException(message: String) : LunchmoneyApiException(message) |
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
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/io/github/smaugfm/lunchmoney/model/LunchmoneyBudgetRecurringItem.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,21 @@ | ||
@file:UseSerializers( | ||
BigDecimalSerializer::class, | ||
CurrencySerializer::class | ||
) | ||
|
||
package io.github.smaugfm.lunchmoney.model | ||
|
||
import io.github.smaugfm.lunchmoney.serializer.BigDecimalSerializer | ||
import io.github.smaugfm.lunchmoney.serializer.CurrencySerializer | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.UseSerializers | ||
import java.math.BigDecimal | ||
import java.util.Currency | ||
|
||
@Serializable | ||
data class LunchmoneyBudgetRecurringItem( | ||
val payee: String, | ||
val amount: BigDecimal, | ||
val currency: Currency, | ||
val toBase: Double | ||
) |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/io/github/smaugfm/lunchmoney/model/LunchmoneyBudgetRecurringItemList.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,8 @@ | ||
package io.github.smaugfm.lunchmoney.model | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class LunchmoneyBudgetRecurringItemList( | ||
val list: List<LunchmoneyBudgetRecurringItem> | ||
) |
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: 0 additions & 17 deletions
17
src/main/kotlin/io/github/smaugfm/lunchmoney/model/LunchmoneyCategoryOld.kt
This file was deleted.
Oops, something went wrong.
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
4 changes: 2 additions & 2 deletions
4
src/main/kotlin/io/github/smaugfm/lunchmoney/request/category/AddToCategoryGroupRequest.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
Oops, something went wrong.