Typescript Client to get CSV format?

is there a “clienty” way to get a CSV file from a service? I know how the core api works and the format query parameter, but it would nice to not to have to hand craft the HTTP request url for the same type of client call when we want to download the results to the browser instead of the TS client.

No, the @servicestack/client package only contains a JsonServiceClient for calling APIs.

Constructing the URL and download with fetch should be easy enough:

import { nameOf, appendQueryString } from "@servicestack/client"

const url = appendQueryString(`/api/${nameOf(request)}.csv`, request)
const csv = await (await fetch(url)).text()
1 Like

that’ll work, thank you.