forrest icon indicating copy to clipboard operation
forrest copied to clipboard

Return Headers with CSV Formatter

Open zack-carlson opened this issue 2 years ago • 2 comments

The CSV Formatter could be used with Bulk Imports that will return more data than a single request can handle.

Rather that only including the $request->getBody() the interface allows for returning an array.

If this is not a viable option because of its potential to break other implementations that expect the I'm happy to create a new formatter

$data = Forrest::get(
                    "/services/data/v59.0/jobs/query/" . $bulkJob["id"] . "/results?locator=" . $locator_id . "",
                    [],
                    [
                        "format" => "csv",
                        "Accept" => "text/csv"
                    ]
                );
                
                // $data['header']['Sforce-Locator'] is set if the bulk job requires multiple requests to download results.

Thanks!

zack-carlson avatar Jan 22 '24 17:01 zack-carlson

Hi @zack-carlson, since this would be a breaking change would you mind creating a new formatter for this? Maybe something called CsvFormatterWithHeaderes? In the next major version bump, I can deprecate it and combine them into a single formatter

omniphx avatar Mar 13 '24 21:03 omniphx

Updated! Let me know.

zack-carlson avatar Mar 22 '24 18:03 zack-carlson