omniphx / forrest

A Laravel library for Salesforce
https://omniphx.github.io/forrest/
MIT License
259 stars 120 forks source link

Return Headers with CSV Formatter #337

Closed zack-carlson closed 3 months ago

zack-carlson commented 10 months ago

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!

omniphx commented 8 months ago

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

zack-carlson commented 8 months ago

Updated! Let me know.