Skip to content

Instantly share code, notes, and snippets.

@NielsGregers
Created January 24, 2021 16:38
Show Gist options
  • Save NielsGregers/493ea4426fac55a38311d54769c605b3 to your computer and use it in GitHub Desktop.
Save NielsGregers/493ea4426fac55a38311d54769c605b3 to your computer and use it in GitHub Desktop.
#***************************************
# Hexatown API Definition for WebFlow
#***************************************
function APIInstance (){
@{
_name = "Webflow"
_version = "1.0"
_root = "https://api.webflow.com/"
_headers = @{
Authorization = "Bearer $($ENV:WEBFLOW)"
}
sites = @{
getPath = { return "sites?api_version=1.0.0" }
onItemsRead = {
$instance._values.site = $items[0]
}
}
collections = @{
getPath = { $url = "sites/$($instance._values.site._id)/collections?api_version=1.0.0"
return $url }
}
items = @{
onItemsBeforeRead = {
$instance._values.offset = 0
}
getPath = { return "collections/$($subarea._id)/items?api_version=1.0.0&offset=$($instance._values.offset)" }
onItemsRead = {
$instance._values.offset += $items.count
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment