lokalise / php-lokalise-api

Lokalise API v2 PHP library.
https://app.lokalise.com/api2docs/curl/
MIT License
16 stars 11 forks source link

Support for fetchAll() to have query arguments #18

Open zogot opened 3 years ago

zogot commented 3 years ago

Upon upgrading to the APIv2 it has become clear that there are 2 implementations of fetchAll that reference API Endpoints that support query arguments, but not available as an option in their function.

ureimers commented 3 years ago

We're facing the same problem. As our customer has larger projects, we could easily reach the 5000 item limit of Translations::list().

The fix should be simple. Just change:

public function fetchAll($projectId)
{
    return $this->requestAll(
        'GET',
        "projects/$projectId/translations",
        [],
        [],
        'translations'
    );
}

to

public function fetchAll($projectId, $queryParams = [])
{
    return $this->requestAll(
        'GET',
        "projects/$projectId/translations",
        $queryParams,
        [],
        'translations'
    );
}

in Translations.php and Files.php. Just like it is in all other endpoint classes.