Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add DSL overloads to paginator methods #591

Merged
merged 2 commits into from
Feb 16, 2022
Merged

Conversation

ianbotsf
Copy link
Contributor

Issue #

(none)

Description of changes

This change adds DSL overloads to paginator methods. Previously, the only way to call paginators was with explicit request objects:

val client = SomeClient(…)
val initialRequest = ListItemsRequest {
    foo = …
    bar = …
}
val result = client.listItemsPaginated(initialRequest)

With this new change, paginators can now be called using DSL overloads that create request objects internally:

val client = SomeClient(…)
val result = client.listItemsPaginated {
    foo = …
    bar = …
}

This brings parity with the invocation options available for regular service operations, waiters, config, etc.

A minor change alongside this is an update to the KDoc formatting done in codegen. Previously, all blank lines were removed. Now, only leading, trailing, and consecutive blank lines are removed. This allows KDocs to contain empty lines which denote paragraph breaks.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ianbotsf ianbotsf requested a review from aajtodd February 15, 2022 22:36
@ianbotsf ianbotsf requested a review from a team as a code owner February 15, 2022 22:36
$docReturn
""".trimIndent())
.withBlock(
"fun #T.#LPaginated(block: #T.Builder.() -> Unit): #T<#T> =",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KotlinTypes.Unit is available as well and we may want that to be fully qualified since there is a model with Unit as a shape IIRC

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ianbotsf ianbotsf merged commit 5a1a921 into main Feb 16, 2022
@ianbotsf ianbotsf deleted the feat-dsl-paginators branch February 16, 2022 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants