build_query_string: Given a list of filters return a url query string

View source: R/build_query_string.R

build_query_stringR Documentation

Given a list of filters return a url query string

Description

Given a list of filters (key-value pairs), this functions returns a url query string that can be applied to an api endpoint. Multiple list elements are separated by a '&' and list elements with multiple values are returned as comma separated values.

Usage

build_query_string(filters)

Arguments

filters

list

Value

A formatted string that matches the url search parameters

Author(s)

Adam Cottrill adam.cottrill@ontario.ca

Examples

# return "?size=sm"
build_query_string(list(size = "sm"))
# return "?colour=red,blue"
build_query_string(list(colours = c("red", "blue")))
# return "?size=sm&colour=red,blue"
build_query_string(list(size = "sm", colours = c("red", "blue")))

AdamCottrill/glfishr documentation built on Aug. 9, 2024, 5:47 p.m.