Skip to content

Commit

Permalink
feat(api): add get spend_limits endpoints to cards and accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Nov 28, 2023
1 parent 6edf142 commit b72eee5
Show file tree
Hide file tree
Showing 19 changed files with 1,156 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 104
configured_endpoints: 106
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// File generated from our OpenAPI spec by Stainless.

package com.lithic.api.models

import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import com.lithic.api.models.*
import java.util.Objects

class AccountRetrieveSpendLimitsParams
constructor(
private val accountToken: String,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
) {

fun accountToken(): String = accountToken

internal fun getQueryParams(): Map<String, List<String>> = additionalQueryParams

internal fun getHeaders(): Map<String, List<String>> = additionalHeaders

fun getPathParam(index: Int): String {
return when (index) {
0 -> accountToken
else -> ""
}
}

fun _additionalQueryParams(): Map<String, List<String>> = additionalQueryParams

fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is AccountRetrieveSpendLimitsParams &&
this.accountToken == other.accountToken &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders
}

override fun hashCode(): Int {
return Objects.hash(
accountToken,
additionalQueryParams,
additionalHeaders,
)
}

override fun toString() =
"AccountRetrieveSpendLimitsParams{accountToken=$accountToken, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"

fun toBuilder() = Builder().from(this)

companion object {

fun builder() = Builder()
}

@NoAutoDetect
class Builder {

private var accountToken: String? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()

internal fun from(accountRetrieveSpendLimitsParams: AccountRetrieveSpendLimitsParams) =
apply {
this.accountToken = accountRetrieveSpendLimitsParams.accountToken
additionalQueryParams(accountRetrieveSpendLimitsParams.additionalQueryParams)
additionalHeaders(accountRetrieveSpendLimitsParams.additionalHeaders)
}

fun accountToken(accountToken: String) = apply { this.accountToken = accountToken }

fun additionalQueryParams(additionalQueryParams: Map<String, List<String>>) = apply {
this.additionalQueryParams.clear()
putAllQueryParams(additionalQueryParams)
}

fun putQueryParam(name: String, value: String) = apply {
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value)
}

fun putQueryParams(name: String, values: Iterable<String>) = apply {
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values)
}

fun putAllQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
additionalQueryParams.forEach(this::putQueryParams)
}

fun removeQueryParam(name: String) = apply {
this.additionalQueryParams.put(name, mutableListOf())
}

fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
this.additionalHeaders.clear()
putAllHeaders(additionalHeaders)
}

fun putHeader(name: String, value: String) = apply {
this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value)
}

fun putHeaders(name: String, values: Iterable<String>) = apply {
this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values)
}

fun putAllHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
additionalHeaders.forEach(this::putHeaders)
}

fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

fun build(): AccountRetrieveSpendLimitsParams =
AccountRetrieveSpendLimitsParams(
checkNotNull(accountToken) { "`accountToken` is required but was not set" },
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
)
}
}
Loading

0 comments on commit b72eee5

Please sign in to comment.