Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Api/BaseApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class BaseApiClient
HttpStatusCode::FORBIDDEN => NotAllowed::class,
HttpStatusCode::NOT_FOUND => NotFound::class,
HttpStatusCode::CONFLICT => AlreadyExists::class,
HttpStatusCode::ENHANCE_YOUR_CALM => RateLimited::class, // RFC6585::TOO_MANY_REQUESTS
HttpStatusCode::ENHANCE_YOUR_CALM => RateLimited::class,
HttpStatusCode::TOO_MANY_REQUESTS => RateLimited::class,
HttpStatusCode::INTERNAL_SERVER_ERROR => GeneralError::class,
];

Expand Down
10 changes: 10 additions & 0 deletions src/Api/Utils/HttpStatusCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ class HttpStatusCode
*/
public const ENHANCE_YOUR_CALM = 420;

/**
* The 429 (Too Many Requests) status code indicates the user has sent too
* many requests in a given amount of time ("rate limiting").
*
* @link https://datatracker.ietf.org/doc/html/rfc6585#section-4
*
* @var int
*/
public const TOO_MANY_REQUESTS = 429;

/**
* The 500 (Internal Server Error) status code indicates that the server
* encountered an unexpected condition that prevented it from fulfilling the
Expand Down
19 changes: 0 additions & 19 deletions tests/Integration/Search/SearchApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,25 +281,6 @@ public function testFindAssetsByGeneralExpression()
self::assertValidAsset($result['resources'][0]);
}

/**
* Find assets without limiting expression to certain fields but with an underscore in the expression
* Shows results containing the entire expression in any string field
* Shows results containing the entire expression or a part of it (parts are separated by underscore) in public_id
*
* @throws ApiError
*/
public function testFindAssetsByGeneralExpressionWithUnderscore()
{
$result = $this->search
->expression(self::$MULTI_STRING)
->maxResults(2)
->execute();

self::assertEquals(2, $result['total_count']);
self::assertCount(2, $result['resources']);
self::assertValidAsset($result['resources'][0]);
}

/**
* Find assets with an expression limiting the search expression to certain fields
* Shows results containing given text in tags field
Expand Down