Skip to content

Commit

Permalink
Add http_list_pagination mod (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkumbha authored Dec 5, 2023
1 parent 1ff5a14 commit 069a7cc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions simple/http_list_pagination/README.md
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'
20 changes: 20 additions & 0 deletions simple/http_list_pagination/http_list_pagination.fp
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])
}

}
4 changes: 4 additions & 0 deletions simple/http_list_pagination/mod.fp
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."
}

0 comments on commit 069a7cc

Please sign in to comment.