-
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.
feat(api): adds endpoint for migrating auth rules from v1 to V2. mark…
…s v1 auth rules as deprecated (#309)
- Loading branch information
1 parent
949046b
commit d1f02bf
Showing
12 changed files
with
2,693 additions
and
30 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 +1 @@ | ||
configured_endpoints: 146 | ||
configured_endpoints: 147 |
152 changes: 152 additions & 0 deletions
152
lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2Params.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,152 @@ | ||
// File generated from our OpenAPI spec by Stainless. | ||
|
||
package com.lithic.api.models | ||
|
||
import com.lithic.api.core.JsonValue | ||
import com.lithic.api.core.NoAutoDetect | ||
import com.lithic.api.core.toUnmodifiable | ||
import com.lithic.api.models.* | ||
import java.util.Objects | ||
|
||
class AuthRuleMigrateV1ToV2Params | ||
constructor( | ||
private val authRuleToken: String, | ||
private val additionalQueryParams: Map<String, List<String>>, | ||
private val additionalHeaders: Map<String, List<String>>, | ||
private val additionalBodyProperties: Map<String, JsonValue>, | ||
) { | ||
|
||
fun authRuleToken(): String = authRuleToken | ||
|
||
internal fun getBody(): Map<String, JsonValue>? { | ||
return additionalBodyProperties.ifEmpty { null } | ||
} | ||
|
||
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 -> authRuleToken | ||
else -> "" | ||
} | ||
} | ||
|
||
fun _additionalQueryParams(): Map<String, List<String>> = additionalQueryParams | ||
|
||
fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders | ||
|
||
fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) { | ||
return true | ||
} | ||
|
||
return other is AuthRuleMigrateV1ToV2Params && | ||
this.authRuleToken == other.authRuleToken && | ||
this.additionalQueryParams == other.additionalQueryParams && | ||
this.additionalHeaders == other.additionalHeaders && | ||
this.additionalBodyProperties == other.additionalBodyProperties | ||
} | ||
|
||
override fun hashCode(): Int { | ||
return Objects.hash( | ||
authRuleToken, | ||
additionalQueryParams, | ||
additionalHeaders, | ||
additionalBodyProperties, | ||
) | ||
} | ||
|
||
override fun toString() = | ||
"AuthRuleMigrateV1ToV2Params{authRuleToken=$authRuleToken, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" | ||
|
||
fun toBuilder() = Builder().from(this) | ||
|
||
companion object { | ||
|
||
fun builder() = Builder() | ||
} | ||
|
||
@NoAutoDetect | ||
class Builder { | ||
|
||
private var authRuleToken: String? = null | ||
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf() | ||
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf() | ||
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf() | ||
|
||
internal fun from(authRuleMigrateV1ToV2Params: AuthRuleMigrateV1ToV2Params) = apply { | ||
this.authRuleToken = authRuleMigrateV1ToV2Params.authRuleToken | ||
additionalQueryParams(authRuleMigrateV1ToV2Params.additionalQueryParams) | ||
additionalHeaders(authRuleMigrateV1ToV2Params.additionalHeaders) | ||
additionalBodyProperties(authRuleMigrateV1ToV2Params.additionalBodyProperties) | ||
} | ||
|
||
fun authRuleToken(authRuleToken: String) = apply { this.authRuleToken = authRuleToken } | ||
|
||
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 additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply { | ||
this.additionalBodyProperties.clear() | ||
this.additionalBodyProperties.putAll(additionalBodyProperties) | ||
} | ||
|
||
fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { | ||
this.additionalBodyProperties.put(key, value) | ||
} | ||
|
||
fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = | ||
apply { | ||
this.additionalBodyProperties.putAll(additionalBodyProperties) | ||
} | ||
|
||
fun build(): AuthRuleMigrateV1ToV2Params = | ||
AuthRuleMigrateV1ToV2Params( | ||
checkNotNull(authRuleToken) { "`authRuleToken` is required but was not set" }, | ||
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), | ||
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), | ||
additionalBodyProperties.toUnmodifiable(), | ||
) | ||
} | ||
} |
Oops, something went wrong.