-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Paginate HTTP List Call Response | ||
|
||
Paginate the response from HTTP list call. | ||
|
||
## Usage | ||
|
||
- This mod does not require any authentication/tokens. | ||
- Run the pipeline using, `flowpipe pipeline run http_list_pagination' |
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,20 @@ | ||
pipeline "http_list_pagination" { | ||
title = "HTTP List Pagination" | ||
description = "Paginate the response from HTTP list call." | ||
|
||
step "http" "http_list_pagination" { | ||
method = "get" | ||
url = "https://pokeapi.co/api/v2/berry?limit=25" | ||
|
||
loop { | ||
until = result.response_body.next == null | ||
url = result.response_body.next | ||
} | ||
} | ||
|
||
output "berries" { | ||
description = "The list of berries consumed by Pokemon." | ||
value = flatten([for page, berries in step.http.http_list_pagination : berries.response_body.results]) | ||
} | ||
|
||
} |
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,4 @@ | ||
mod "http_list_pagination" { | ||
title = "HTTP List Pagination" | ||
description = "Paginate the response from HTTP list call." | ||
} |