Feeds and Reports
Generating a report
$marketplace = Marketplace::firstWhere('country_code', 'US');
$report = Report::create([
'type' => 'GET_FLAT_FILE_OPEN_LISTINGS_DATA',
'credentials_id' => $credentials->id,
'data_start_date' => now()->subDays(30)->toDateString(),
'data_end_date' => now()->toDateString(),
]);
$report->marketplaces()->attach($marketplace);
$report->generate([MyReportProcessor::class, 'processReport']);Uploading a feed
$feed = Feed::create([
'type' => 'POST_FLAT_FILE_INVLOADER_DATA',
'credentials_id' => $credentials->id,
]);
$feedContents = '...';
$feed->setContents($feedContents)
$marketplace = Marketplace::firstWhere('country_code', 'US');
$feed->marketplaces()->attach($marketplace);
// The optional callback parameter is used to process the feed result document once it has been downloaded.
// It can be omitted if you just want to save the feed result document to the database.
$feed->submit([MyFeedProcessor::class, 'processFeed']);Last updated