Skip to content

Commit

Permalink
fix(clients): remove all client side validation expect null check (ge…
Browse files Browse the repository at this point in the history
…nerated)

algolia/api-clients-automation#3936

Co-authored-by: algolia-bot <[email protected]>
  • Loading branch information
algolia-bot committed Oct 9, 2024
1 parent f321fc6 commit 8bc6526
Show file tree
Hide file tree
Showing 114 changed files with 23 additions and 4,299 deletions.
4 changes: 0 additions & 4 deletions lib/Api/AbtestingClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,6 @@ public function getABTest($id, $requestOptions = [])
*/
public function listABTests($offset = null, $limit = null, $indexPrefix = null, $indexSuffix = null, $requestOptions = [])
{
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AbtestingClient.listABTests, must be bigger than or equal to 0.');
}

$resourcePath = '/2/abtests';
$queryParameters = [];
$headers = [];
Expand Down
80 changes: 0 additions & 80 deletions lib/Api/AnalyticsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -759,16 +759,6 @@ public function getSearchesNoClicks($index, $startDate = null, $endDate = null,
'Parameter `index` is required when calling `getSearchesNoClicks`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getSearchesNoClicks, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getSearchesNoClicks, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getSearchesNoClicks, must be bigger than or equal to 0.');
}

$resourcePath = '/2/searches/noClicks';
$queryParameters = [];
Expand Down Expand Up @@ -826,16 +816,6 @@ public function getSearchesNoResults($index, $startDate = null, $endDate = null,
'Parameter `index` is required when calling `getSearchesNoResults`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getSearchesNoResults, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getSearchesNoResults, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getSearchesNoResults, must be bigger than or equal to 0.');
}

$resourcePath = '/2/searches/noResults';
$queryParameters = [];
Expand Down Expand Up @@ -925,16 +905,6 @@ public function getTopCountries($index, $startDate = null, $endDate = null, $lim
'Parameter `index` is required when calling `getTopCountries`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getTopCountries, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopCountries, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopCountries, must be bigger than or equal to 0.');
}

$resourcePath = '/2/countries';
$queryParameters = [];
Expand Down Expand Up @@ -993,16 +963,6 @@ public function getTopFilterAttributes($index, $search = null, $startDate = null
'Parameter `index` is required when calling `getTopFilterAttributes`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getTopFilterAttributes, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopFilterAttributes, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopFilterAttributes, must be bigger than or equal to 0.');
}

$resourcePath = '/2/filters';
$queryParameters = [];
Expand Down Expand Up @@ -1072,16 +1032,6 @@ public function getTopFilterForAttribute($attribute, $index, $search = null, $st
'Parameter `index` is required when calling `getTopFilterForAttribute`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getTopFilterForAttribute, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopFilterForAttribute, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopFilterForAttribute, must be bigger than or equal to 0.');
}

$resourcePath = '/2/filters/{attribute}';
$queryParameters = [];
Expand Down Expand Up @@ -1153,16 +1103,6 @@ public function getTopFiltersNoResults($index, $search = null, $startDate = null
'Parameter `index` is required when calling `getTopFiltersNoResults`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getTopFiltersNoResults, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopFiltersNoResults, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopFiltersNoResults, must be bigger than or equal to 0.');
}

$resourcePath = '/2/filters/noResults';
$queryParameters = [];
Expand Down Expand Up @@ -1227,16 +1167,6 @@ public function getTopHits($index, $search = null, $clickAnalytics = null, $reve
'Parameter `index` is required when calling `getTopHits`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getTopHits, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopHits, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopHits, must be bigger than or equal to 0.');
}

$resourcePath = '/2/hits';
$queryParameters = [];
Expand Down Expand Up @@ -1310,16 +1240,6 @@ public function getTopSearches($index, $clickAnalytics = null, $revenueAnalytics
'Parameter `index` is required when calling `getTopSearches`.'
);
}
if (null !== $limit && $limit > 1000) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling AnalyticsClient.getTopSearches, must be smaller than or equal to 1000.');
}

if (null !== $offset && $offset > 1000) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopSearches, must be smaller than or equal to 1000.');
}
if (null !== $offset && $offset < 0) {
throw new \InvalidArgumentException('invalid value for "$offset" when calling AnalyticsClient.getTopSearches, must be bigger than or equal to 0.');
}

$resourcePath = '/2/searches';
$queryParameters = [];
Expand Down
87 changes: 0 additions & 87 deletions lib/Api/IngestionClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,17 +1225,6 @@ public function getTransformation($transformationID, $requestOptions = [])
*/
public function listAuthentications($itemsPerPage = null, $page = null, $type = null, $platform = null, $sort = null, $order = null, $requestOptions = [])
{
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listAuthentications, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listAuthentications, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listAuthentications, must be bigger than or equal to 1.');
}

$resourcePath = '/1/authentications';
$queryParameters = [];
$headers = [];
Expand Down Expand Up @@ -1295,17 +1284,6 @@ public function listAuthentications($itemsPerPage = null, $page = null, $type =
*/
public function listDestinations($itemsPerPage = null, $page = null, $type = null, $authenticationID = null, $transformationID = null, $sort = null, $order = null, $requestOptions = [])
{
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listDestinations, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listDestinations, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listDestinations, must be bigger than or equal to 1.');
}

$resourcePath = '/1/destinations';
$queryParameters = [];
$headers = [];
Expand Down Expand Up @@ -1380,16 +1358,6 @@ public function listEvents($runID, $itemsPerPage = null, $page = null, $status =
'Parameter `runID` is required when calling `listEvents`.'
);
}
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listEvents, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listEvents, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listEvents, must be bigger than or equal to 1.');
}

$resourcePath = '/1/runs/{runID}/events';
$queryParameters = [];
Expand Down Expand Up @@ -1463,17 +1431,6 @@ public function listEvents($runID, $itemsPerPage = null, $page = null, $status =
*/
public function listRuns($itemsPerPage = null, $page = null, $status = null, $type = null, $taskID = null, $sort = null, $order = null, $startDate = null, $endDate = null, $requestOptions = [])
{
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listRuns, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listRuns, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listRuns, must be bigger than or equal to 1.');
}

$resourcePath = '/1/runs';
$queryParameters = [];
$headers = [];
Expand Down Expand Up @@ -1538,17 +1495,6 @@ public function listRuns($itemsPerPage = null, $page = null, $status = null, $ty
*/
public function listSources($itemsPerPage = null, $page = null, $type = null, $authenticationID = null, $sort = null, $order = null, $requestOptions = [])
{
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listSources, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listSources, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listSources, must be bigger than or equal to 1.');
}

$resourcePath = '/1/sources';
$queryParameters = [];
$headers = [];
Expand Down Expand Up @@ -1610,17 +1556,6 @@ public function listSources($itemsPerPage = null, $page = null, $type = null, $a
*/
public function listTasks($itemsPerPage = null, $page = null, $action = null, $enabled = null, $sourceID = null, $destinationID = null, $triggerType = null, $sort = null, $order = null, $requestOptions = [])
{
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listTasks, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listTasks, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listTasks, must be bigger than or equal to 1.');
}

$resourcePath = '/2/tasks';
$queryParameters = [];
$headers = [];
Expand Down Expand Up @@ -1700,17 +1635,6 @@ public function listTasks($itemsPerPage = null, $page = null, $action = null, $e
*/
public function listTasksV1($itemsPerPage = null, $page = null, $action = null, $enabled = null, $sourceID = null, $destinationID = null, $triggerType = null, $sort = null, $order = null, $requestOptions = [])
{
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listTasksV1, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listTasksV1, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listTasksV1, must be bigger than or equal to 1.');
}

$resourcePath = '/1/tasks';
$queryParameters = [];
$headers = [];
Expand Down Expand Up @@ -1785,17 +1709,6 @@ public function listTasksV1($itemsPerPage = null, $page = null, $action = null,
*/
public function listTransformations($itemsPerPage = null, $page = null, $sort = null, $order = null, $requestOptions = [])
{
if (null !== $itemsPerPage && $itemsPerPage > 100) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listTransformations, must be smaller than or equal to 100.');
}
if (null !== $itemsPerPage && $itemsPerPage < 1) {
throw new \InvalidArgumentException('invalid value for "$itemsPerPage" when calling IngestionClient.listTransformations, must be bigger than or equal to 1.');
}

if (null !== $page && $page < 1) {
throw new \InvalidArgumentException('invalid value for "$page" when calling IngestionClient.listTransformations, must be bigger than or equal to 1.');
}

$resourcePath = '/1/transformations';
$queryParameters = [];
$headers = [];
Expand Down
9 changes: 0 additions & 9 deletions lib/Api/InsightsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,6 @@ public function deleteUserToken($userToken, $requestOptions = [])
'Parameter `userToken` is required when calling `deleteUserToken`.'
);
}
if (strlen($userToken) > 129) {
throw new \InvalidArgumentException('invalid length for "$userToken" when calling InsightsClient.deleteUserToken, must be smaller than or equal to 129.');
}
if (strlen($userToken) < 1) {
throw new \InvalidArgumentException('invalid length for "$userToken" when calling InsightsClient.deleteUserToken, must be bigger than or equal to 1.');
}
if (!preg_match('/[a-zA-Z0-9_=\\/+-]{1,129}/', $userToken)) {
throw new \InvalidArgumentException('invalid value for "userToken" when calling InsightsClient.deleteUserToken, must conform to the pattern /[a-zA-Z0-9_=\\/+-]{1,129}/.');
}

$resourcePath = '/1/usertokens/{userToken}';
$queryParameters = [];
Expand Down
Loading

0 comments on commit 8bc6526

Please sign in to comment.