Open gio-vlasov opened 1 month ago
Hello,
Indeed, the current SDK version does not support Mirakl services APIs such as SOR11
you are talking about.
But your attempt is not so bad, I would have tried something like that instead:
use Mirakl\Core\Domain\Collection\MiraklCollection;
use Mirakl\Core\Request\AbstractRequest;
use Mirakl\Core\Request\SeekableTrait;
use Mirakl\Core\Response\Decorator\SeekableCollection;
class SOR11 extends AbstractRequest
{
use SeekableTrait;
/**
* @var string
*/
protected $endpoint = '/mms/orders';
/**
* @inheritdoc
*/
public function getResponseDecorator()
{
return new SeekableCollection(MiraklCollection::class, 'data');
}
}
The doc for this endpoint says it has token-based seek pagination available, but this library only allows offset-based pagination for
$client->getOrders()
.Is there a way to implement that? I tried something like this, by analogy with other endpoints:
but had no success.
My use case for this is fetching long order histories over extended period of time in separate processes, as such fetching can produce "429 Too many requests" so it will have to finish later, but store the point up until which it had already fetched the orders. Offset pagination doesn't seem to fit for that use case, as there seem to be no guarantees on the sorting order, so unfetched orders may change position during subsequent requests to lower offset if new orders are created. And token-based pagination is supposed to preserve ordering.