Skip to content

Commit

Permalink
Update dependencies && start updating APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
smaugfm committed Aug 10, 2024
1 parent 31f2a11 commit d556d48
Show file tree
Hide file tree
Showing 48 changed files with 545 additions and 271 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType

plugins {
kotlin("jvm") version "1.8.10"
kotlin("plugin.serialization") version "1.8.10"
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("org.jlleitschuh.gradle.ktlint") version "11.2.0"
id("io.gitlab.arturbosch.detekt") version "1.22.0"
id("org.jetbrains.dokka") version "1.8.10"
id("org.jetbrains.dokka") version "1.9.20"
id("com.github.breadmoirai.github-release") version "2.4.1"
signing
`maven-publish`
Expand All @@ -25,30 +25,30 @@ repositories {
mavenCentral()
}

val reactorCore = "3.5.2"
val reactorNetty = "1.1.2"
val reactor= "3.6.8"
val reactorNetty = "1.1.21"
val mockserver = "5.15.0"
val logback = "1.4.5"
val logback = "1.5.6"
val javaVersion = "11"
val resilience4jVersion = "1.7.0"

dependencies {
api("io.projectreactor:reactor-core:$reactorCore")
api("io.projectreactor:reactor-core:$reactor")
api("io.projectreactor.netty:reactor-netty-http:$reactorNetty")
api("io.projectreactor.netty:reactor-netty-core:$reactorNetty")
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
testImplementation("org.mock-server:mockserver-netty:$mockserver")
testImplementation("org.mock-server:mockserver-client-java:$mockserver")
testImplementation("io.github.resilience4j:resilience4j-retry:$resilience4jVersion")
testImplementation("io.github.resilience4j:resilience4j-reactor:$resilience4jVersion")
testImplementation("io.github.resilience4j:resilience4j-kotlin:$resilience4jVersion")
testImplementation("io.projectreactor:reactor-test:$reactorCore")
testImplementation("io.projectreactor:reactor-test:$reactor")
testImplementation("io.mockk:mockk:1.13.4")
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.25")
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.28.1")
testImplementation("ch.qos.logback:logback-core:$logback")
testImplementation("ch.qos.logback:logback-classic:$logback")
testImplementation("io.projectreactor:reactor-tools:3.5.7")
testImplementation("io.projectreactor:reactor-tools:$reactor")
testImplementation(kotlin("test"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.github.smaugfm.lunchmoney.api

import io.github.smaugfm.lunchmoney.model.LunchmoneyAsset
import io.github.smaugfm.lunchmoney.model.LunchmoneyBudget
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategoryMultiple
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategorySingle
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategory
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategoryOld
import io.github.smaugfm.lunchmoney.model.LunchmoneyCrypto
import io.github.smaugfm.lunchmoney.model.LunchmoneyInsertTransaction
import io.github.smaugfm.lunchmoney.model.LunchmoneyPlaidAccount
Expand Down Expand Up @@ -218,7 +218,7 @@ class LunchmoneyApi internal constructor(
groupId: Long,
categoryIds: List<Long>? = null,
newCategories: List<String>? = null
): Mono<LunchmoneyCategorySingle> = execute(
): Mono<LunchmoneyCategoryOld> = execute(
AddToCategoryGroupRequest(
groupId,
AddToCategoryGroupsParams(
Expand Down Expand Up @@ -266,7 +266,6 @@ class LunchmoneyApi internal constructor(
isIncome = isIncome,
excludeFromBudget = excludeFromBudget,
excludeFromTotals = excludeFromTotals,
categoryIds = categoryIds,
groupId = groupId
)
)
Expand All @@ -280,11 +279,11 @@ class LunchmoneyApi internal constructor(
ForceDeleteCategoryRequest(categoryId)
)

fun getAllCategories(): Mono<List<LunchmoneyCategoryMultiple>> = execute(
fun getAllCategories(): Mono<List<LunchmoneyCategory>> = execute(
GetAllCategoriesRequest()
).map { it.categories }

fun getSingleCategory(categoryId: Long): Mono<LunchmoneyCategorySingle> = execute(
fun getSingleCategory(categoryId: Long): Mono<LunchmoneyCategory> = execute(
GetSingleCategoryRequest(categoryId)
)

Expand All @@ -302,11 +301,10 @@ class LunchmoneyApi internal constructor(
categoryId,
CreateUpdateCategoryRequestParams(
name = name,
isIncome = isIncome,
description = description,
isIncome = isIncome,
excludeFromBudget = excludeFromBudget,
excludeFromTotals = excludeFromTotals,
categoryIds = categoryIds,
groupId = groupId
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ import kotlinx.serialization.UseSerializers
import java.time.Instant

@Serializable
data class LunchmoneyCategoryMultiple(
data class LunchmoneyCategory(
val id: Long,
val name: String,
val description: String? = null,
val isIncome: Boolean,
val excludeFromBudget: Boolean,
val excludeFromTotals: Boolean,
val updatedAt: Instant,
val createdAt: Instant,
val isGroup: Boolean,
val groupId: Long? = null
val archived: Boolean? = null,
val archivedOn: Instant? = null,
val updatedAt: Instant? = null,
val createdAt: Instant? = null,
val isGroup: Boolean? = null,
val groupCategoryName: String? = null,
val groupId: Long? = null,
val order: Long? = null,
val children: List<LunchmoneyCategoryChild>? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.github.smaugfm.lunchmoney.model
import kotlinx.serialization.Serializable

@Serializable
data class LunchmoneyCategorySingle(
data class LunchmoneyCategoryOld(
val id: Long,
val name: String,
val description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@
TransactionStatusSerializer::class,
LocalDateSerializer::class,
BigDecimalSerializer::class,
CurrencySerializer::class
CurrencySerializer::class,
InstantSerializer::class,
AssetStatusSerializer::class,
RecurringExpenseTypeSerializer::class,
TransactionSourceSerializer::class
)

package io.github.smaugfm.lunchmoney.model

import io.github.smaugfm.lunchmoney.model.enumeration.LunchmoneyAssetStatus
import io.github.smaugfm.lunchmoney.model.enumeration.LunchmoneyRecurringExpenseType
import io.github.smaugfm.lunchmoney.model.enumeration.LunchmoneyTransactionSource
import io.github.smaugfm.lunchmoney.model.enumeration.LunchmoneyTransactionStatus
import io.github.smaugfm.lunchmoney.serializer.AssetStatusSerializer
import io.github.smaugfm.lunchmoney.serializer.BigDecimalSerializer
import io.github.smaugfm.lunchmoney.serializer.CurrencySerializer
import io.github.smaugfm.lunchmoney.serializer.InstantSerializer
import io.github.smaugfm.lunchmoney.serializer.LocalDateSerializer
import io.github.smaugfm.lunchmoney.serializer.RecurringExpenseTypeSerializer
import io.github.smaugfm.lunchmoney.serializer.TransactionSourceSerializer
import io.github.smaugfm.lunchmoney.serializer.TransactionStatusSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import java.math.BigDecimal
import java.time.Instant
import java.time.LocalDate
import java.util.Currency

Expand All @@ -26,21 +38,47 @@ data class LunchmoneyTransaction(
val amount: BigDecimal,
val currency: Currency,
val toBase: Double,
val notes: String? = null,
val categoryId: Long? = null,
val assetId: Long? = null,
val categoryName: String? = null,
val categoryGroupId: Long? = null,
val categoryGroupName: String? = null,
val isIncome: Boolean,
val excludeFromBudget: Boolean,
val excludeFromTotals: Boolean,
val createdAt: Instant,
val updatedAt: Instant,
val status: LunchmoneyTransactionStatus? = null,
val isPending: Boolean,
val notes: String? = null,
val originalName: String? = null,
val recurringId: Long? = null,
val plaidAccountId: Long? = null,
val status: LunchmoneyTransactionStatus,
val recurringPayee: String? = null,
val recurringDescription: String? = null,
val recurringCadence: String? = null,
val recurringType: LunchmoneyRecurringExpenseType? = null,
val recurringAmount: BigDecimal? = null,
val recurringCurrency: Currency? = null,
val parentId: Long? = null,
val isGroup: Boolean,
val hasChildren: Boolean? = null,
val groupId: Long? = null,
val externalId: String? = null,
val isGroup: Boolean,
val assetId: Long? = null,
val assetInstitutionName: String? = null,
val assetName: String? = null,
val assetDisplayName: String? = null,
val assetStatus: LunchmoneyAssetStatus? = null,
val plaidAccountId: Long? = null,
val plaidAccountName: String? = null,
val plaidAccountMask: Long? = null,
val institutionName: String? = null,
val plaidAccountDisplayName: String? = null,
val plaidMetadata: String? = null,
val plaidCategory: String? = null,
val source: LunchmoneyTransactionSource? = null,
val displayName: String,
val displayNotes: String? = null,
val accountDisplayName: String,
val tags: List<LunchmoneyTransactionTag>? = null,
val originalName: String? = null,
val type: String? = null,
val subtype: String? = null,
val fees: String? = null,
val price: String? = null,
val quantity: String? = null
val children: List<LunchmoneyTransactionChild>? = null,
val externalId: String? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@file:UseSerializers(
LocalDateSerializer::class,
BigDecimalSerializer::class,
CurrencySerializer::class,
InstantSerializer::class,
)

package io.github.smaugfm.lunchmoney.model

import io.github.smaugfm.lunchmoney.serializer.BigDecimalSerializer
import io.github.smaugfm.lunchmoney.serializer.CurrencySerializer
import io.github.smaugfm.lunchmoney.serializer.InstantSerializer
import io.github.smaugfm.lunchmoney.serializer.LocalDateSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import java.math.BigDecimal
import java.time.LocalDate
import java.util.Currency

@Serializable
data class LunchmoneyTransactionChild(
val id: Long,
val date: LocalDate,
val payee: String,
val amount: BigDecimal,
val currency: Currency,
val formattedDate: LocalDate,
val notes: String? = null,
val assetId: Long? = null,
val plaidAccountId: Long? = null,
val toBase: Double
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import kotlinx.serialization.Serializable
data class LunchmoneyTransactionTag(
val id: Long,
val name: String,
val description: String? = null
val description: String? = null,
val archived: Boolean? = null,
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
@file:UseSerializers(
CurrencySerializer::class
)

package io.github.smaugfm.lunchmoney.model

import io.github.smaugfm.lunchmoney.serializer.CurrencySerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import java.util.Currency

@Serializable
data class LunchmoneyUser(
Expand All @@ -9,5 +16,6 @@ data class LunchmoneyUser(
val userEmail: String,
val accountId: Long,
val budgetName: String,
val primaryCurrency: Currency,
val apiKeyLabel: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.github.smaugfm.lunchmoney.model.enumeration

enum class LunchmoneyAssetStatus {
Active,
Closed
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package io.github.smaugfm.lunchmoney.model.enumeration

enum class LunchmoneyRecurringExpenseType {
CLEARED,
SUGGESTED
SUGGESTED,
DISMISSED
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.github.smaugfm.lunchmoney.model.enumeration

enum class LunchmoneyTransactionSource {
Api, Csv, Manual, Merge, Plaid, Recurring, Rule, User
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ package io.github.smaugfm.lunchmoney.model.enumeration
enum class LunchmoneyTransactionStatus {
CLEARED,
UNCLEARED,
RECURRING,
RECURRING_SUGGESTED,
PENDING
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.github.smaugfm.lunchmoney.request.category

import io.github.smaugfm.lunchmoney.helper.PathAndQuery
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategorySingle
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategoryOld
import io.github.smaugfm.lunchmoney.request.base.LunchmoneyAbstractPostRequest
import io.github.smaugfm.lunchmoney.request.category.params.AddToCategoryGroupsParams

internal class AddToCategoryGroupRequest(
groupId: Long,
params: AddToCategoryGroupsParams
) : LunchmoneyAbstractPostRequest<LunchmoneyCategorySingle, AddToCategoryGroupsParams>(
) : LunchmoneyAbstractPostRequest<LunchmoneyCategoryOld, AddToCategoryGroupsParams>(
PathAndQuery
.segment("categories")
.segment("group")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package io.github.smaugfm.lunchmoney.request.category

import io.github.smaugfm.lunchmoney.helper.PathAndQuery
import io.github.smaugfm.lunchmoney.request.base.LunchmoneyAbstractGetRequest
import io.github.smaugfm.lunchmoney.request.category.params.GetAllCategoriesParams
import io.github.smaugfm.lunchmoney.response.GetAllCategoriesResponse

internal class GetAllCategoriesRequest : LunchmoneyAbstractGetRequest<GetAllCategoriesResponse>(
PathAndQuery.segment("categories")
)
internal class GetAllCategoriesRequest(val params: GetAllCategoriesParams? = null) :
LunchmoneyAbstractGetRequest<GetAllCategoriesResponse>(
PathAndQuery.segment("categories").query(params)
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.smaugfm.lunchmoney.request.category

import io.github.smaugfm.lunchmoney.helper.PathAndQuery
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategorySingle
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategory
import io.github.smaugfm.lunchmoney.request.base.LunchmoneyAbstractGetRequest

internal class GetSingleCategoryRequest(
id: Long
) : LunchmoneyAbstractGetRequest<LunchmoneyCategorySingle>(
) : LunchmoneyAbstractGetRequest<LunchmoneyCategory>(
PathAndQuery.segment("categories").segment(id)
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import kotlinx.serialization.Serializable
@Serializable
internal class CreateUpdateCategoryRequestParams(
val name: String?,
val isIncome: Boolean,
val excludeFromBudget: Boolean,
val excludeFromTotals: Boolean,
val description: String?,
val categoryIds: List<Long>?,
val groupId: Long?
val description: String? = null,
val isIncome: Boolean? = null,
val excludeFromBudget: Boolean? = null,
val excludeFromTotals: Boolean? = null,
val archived: Boolean? = null,
val groupId: Long? = null
)
Loading

0 comments on commit d556d48

Please sign in to comment.