Skip to content

Commit

Permalink
ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
lauzadis committed Sep 14, 2023
1 parent 245559f commit 7c43ce9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ data class KotlinSettings(
PackageSettings(packageName, version, desc),
sdkId,
BuildSettings.fromNode(build),
ApiSettings.fromNode(api)
ApiSettings.fromNode(api),
)
}
}
Expand Down Expand Up @@ -197,10 +197,10 @@ class UnresolvableProtocolException(message: String) : CodegenException(message)

private fun <T> Optional<T>.orNull(): T? = if (isPresent) get() else null


enum class Visibility(val value: String) {
PUBLIC("public"),
INTERNAL("internal");
INTERNAL("internal"),
;

companion object {
public fun fromValue(value: String): Visibility = when (value.toLowerCase()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ class ServiceClientGenerator(private val ctx: RenderingContext<ServiceShape>) {

writer.renderDocumentation(service)
writer.renderAnnotations(service)
writer.openBlock("#L interface ${serviceSymbol.name} : #T {",
writer.openBlock(
"#L interface ${serviceSymbol.name} : #T {",
ctx.settings.api.visibility.value,
RuntimeTypes.SmithyClient.SdkClient
RuntimeTypes.SmithyClient.SdkClient,
)
.call {
// allow access to client's Config
Expand Down Expand Up @@ -201,9 +202,11 @@ class ServiceClientGenerator(private val ctx: RenderingContext<ServiceShape>) {
write("Any resources created on your behalf will be shared between clients, and will only be closed when ALL clients using them are closed.")
write("If you provide a resource (e.g. [HttpClientEngine]) to the SDK, you are responsible for managing the lifetime of that resource.")
}
writer.withBlock("#1L fun #2T.withConfig(block: #2T.Config.Builder.() -> Unit): #2T {", "}",
writer.withBlock(
"#1L fun #2T.withConfig(block: #2T.Config.Builder.() -> Unit): #2T {",
"}",
ctx.settings.api.visibility.value,
serviceSymbol
serviceSymbol,
) {
write("val newConfig = config.toBuilder().apply(block).build()")
write("return Default#L(newConfig)", serviceSymbol.name)
Expand Down

0 comments on commit 7c43ce9

Please sign in to comment.