@@ -15,29 +15,29 @@ class PaginatorGeneratorTest {
1515 val context = setupTests(" pagination.smithy" , " com.test#Lambda" )
1616 val contents = getFileContents(context.manifest, " /Test/Paginators.swift" )
1717 val expected = """
18- /// Paginate over `[ListFunctions2OutputResponse]` results.
19- ///
20- /// When this operation is called, an `AsyncSequence` is created. AsyncSequences are lazy so no service
21- /// calls are made until the sequence is iterated over. This also means there is no guarantee that the request is valid
22- /// until then. If there are errors in your request, you will see the failures only after you start iterating.
23- /// - Parameters:
24- /// - input: A `[ListFunctions2Input]` to start pagination
25- /// - Returns: An `AsyncSequence` that can iterate over `ListFunctions2OutputResponse`
26- extension TestClient {
27- public func listFunctions2Paginated (input: ListFunctions2Input ) -> ClientRuntime.PaginatorSequence<ListFunctions2Input, ListFunctions2OutputResponse > {
28- return ClientRuntime.PaginatorSequence<ListFunctions2Input, ListFunctions2OutputResponse >(input: input, inputKey: \ListFunctions2Input .marker, outputKey: \ListFunctions2OutputResponse .nextMarker, paginationFunction: self.listFunctions2 (input:))
29- }
30- }
18+ extension TestClient {
19+ /// Paginate over `[ListFunctionsOutputResponse]` results.
20+ ///
21+ /// When this operation is called, an `AsyncSequence` is created. AsyncSequences are lazy so no service
22+ /// calls are made until the sequence is iterated over. This also means there is no guarantee that the request is valid
23+ /// until then. If there are errors in your request, you will see the failures only after you start iterating.
24+ /// - Parameters:
25+ /// - input: A `[ListFunctionsInput]` to start pagination
26+ /// - Returns: An `AsyncSequence` that can iterate over `ListFunctionsOutputResponse`
27+ public func listFunctionsPaginated (input: ListFunctionsInput ) -> ClientRuntime.PaginatorSequence<ListFunctionsInput, ListFunctionsOutputResponse > {
28+ return ClientRuntime.PaginatorSequence<ListFunctionsInput, ListFunctionsOutputResponse >(input: input, inputKey: \ListFunctionsInput .marker, outputKey: \ListFunctionsOutputResponse .nextMarker, paginationFunction: self.listFunctions (input:))
29+ }
30+ }
3131
32- extension ListFunctions2Input : ClientRuntime.PaginateToken {
33- public func usingPaginationToken(_ token: Swift.String) -> ListFunctions2Input {
34- return ListFunctions2Input (
35- functionVersion: self.functionVersion,
36- marker: token,
37- masterRegion: self.masterRegion,
38- maxItems: self.maxItems
39- )}
40- }
32+ extension ListFunctionsInput : ClientRuntime.PaginateToken {
33+ public func usingPaginationToken(_ token: Swift.String) -> ListFunctionsInput {
34+ return ListFunctionsInput (
35+ functionVersion: self.functionVersion,
36+ marker: token,
37+ masterRegion: self.masterRegion,
38+ maxItems: self.maxItems
39+ )}
40+ }
4141 """ .trimIndent()
4242
4343 contents.shouldContainOnlyOnce(expected)
@@ -48,15 +48,15 @@ class PaginatorGeneratorTest {
4848 val context = setupTests(" pagination.smithy" , " com.test#Lambda" )
4949 val contents = getFileContents(context.manifest, " /Test/Paginators.swift" )
5050 val expectedCode = """
51- /// Paginate over `[ListFunctionsOutputResponse]` results.
52- ///
53- /// When this operation is called, an `AsyncSequence` is created. AsyncSequences are lazy so no service
54- /// calls are made until the sequence is iterated over. This also means there is no guarantee that the request is valid
55- /// until then. If there are errors in your request, you will see the failures only after you start iterating.
56- /// - Parameters:
57- /// - input: A `[ListFunctionsInput]` to start pagination
58- /// - Returns: An `AsyncSequence` that can iterate over `ListFunctionsOutputResponse`
5951 extension TestClient {
52+ /// Paginate over `[ListFunctionsOutputResponse]` results.
53+ ///
54+ /// When this operation is called, an `AsyncSequence` is created. AsyncSequences are lazy so no service
55+ /// calls are made until the sequence is iterated over. This also means there is no guarantee that the request is valid
56+ /// until then. If there are errors in your request, you will see the failures only after you start iterating.
57+ /// - Parameters:
58+ /// - input: A `[ListFunctionsInput]` to start pagination
59+ /// - Returns: An `AsyncSequence` that can iterate over `ListFunctionsOutputResponse`
6060 public func listFunctionsPaginated(input: ListFunctionsInput) -> ClientRuntime.PaginatorSequence<ListFunctionsInput, ListFunctionsOutputResponse> {
6161 return ClientRuntime.PaginatorSequence<ListFunctionsInput, ListFunctionsOutputResponse>(input: input, inputKey: \ListFunctionsInput.marker, outputKey: \ListFunctionsOutputResponse.nextMarker, paginationFunction: self.listFunctions(input:))
6262 }
@@ -72,10 +72,10 @@ class PaginatorGeneratorTest {
7272 )}
7373 }
7474
75- /// This paginator transforms the `AsyncSequence` returned by `listFunctionsPaginated`
76- /// to access the nested member `[TestClientTypes.FunctionConfiguration]`
77- /// - Returns: `[TestClientTypes.FunctionConfiguration]`
7875 extension PaginatorSequence where Input == ListFunctionsInput, Output == ListFunctionsOutputResponse {
76+ /// This paginator transforms the `AsyncSequence` returned by `listFunctionsPaginated`
77+ /// to access the nested member `[TestClientTypes.FunctionConfiguration]`
78+ /// - Returns: `[TestClientTypes.FunctionConfiguration]`
7979 public func functions() async throws -> [TestClientTypes.FunctionConfiguration] {
8080 return try await self.asyncCompactMap { item in item.functions }
8181 }
@@ -90,15 +90,15 @@ class PaginatorGeneratorTest {
9090 val context = setupTests(" pagination-map.smithy" , " com.test#TestService" )
9191 val contents = getFileContents(context.manifest, " /Test/Paginators.swift" )
9292 val expectedCode = """
93- /// Paginate over `[PaginatedMapOutputResponse]` results.
94- ///
95- /// When this operation is called, an `AsyncSequence` is created. AsyncSequences are lazy so no service
96- /// calls are made until the sequence is iterated over. This also means there is no guarantee that the request is valid
97- /// until then. If there are errors in your request, you will see the failures only after you start iterating.
98- /// - Parameters:
99- /// - input: A `[PaginatedMapInput]` to start pagination
100- /// - Returns: An `AsyncSequence` that can iterate over `PaginatedMapOutputResponse`
10193 extension TestClient {
94+ /// Paginate over `[PaginatedMapOutputResponse]` results.
95+ ///
96+ /// When this operation is called, an `AsyncSequence` is created. AsyncSequences are lazy so no service
97+ /// calls are made until the sequence is iterated over. This also means there is no guarantee that the request is valid
98+ /// until then. If there are errors in your request, you will see the failures only after you start iterating.
99+ /// - Parameters:
100+ /// - input: A `[PaginatedMapInput]` to start pagination
101+ /// - Returns: An `AsyncSequence` that can iterate over `PaginatedMapOutputResponse`
102102 public func paginatedMapPaginated(input: PaginatedMapInput) -> ClientRuntime.PaginatorSequence<PaginatedMapInput, PaginatedMapOutputResponse> {
103103 return ClientRuntime.PaginatorSequence<PaginatedMapInput, PaginatedMapOutputResponse>(input: input, inputKey: \PaginatedMapInput.nextToken, outputKey: \PaginatedMapOutputResponse.inner?.token, paginationFunction: self.paginatedMap(input:))
104104 }
@@ -112,10 +112,10 @@ class PaginatorGeneratorTest {
112112 )}
113113 }
114114
115- /// This paginator transforms the `AsyncSequence` returned by `paginatedMapPaginated`
116- /// to access the nested member `[(String, Swift.Int)]`
117- /// - Returns: `[(String, Swift.Int)]`
118115 extension PaginatorSequence where Input == PaginatedMapInput, Output == PaginatedMapOutputResponse {
116+ /// This paginator transforms the `AsyncSequence` returned by `paginatedMapPaginated`
117+ /// to access the nested member `[(String, Swift.Int)]`
118+ /// - Returns: `[(String, Swift.Int)]`
119119 public func mapItems() async throws -> [(String, Swift.Int)] {
120120 return try await self.asyncCompactMap { item in item.inner?.mapItems?.map { (${' $' } 0, ${' $' } 1) } }
121121 }
0 commit comments