mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-17 08:51:30 +00:00
Fixed errors
This commit is contained in:
parent
4f67f21b33
commit
4cbb167e5c
2 changed files with 8 additions and 4 deletions
|
|
@ -50,6 +50,8 @@ class GenericWebProvider implements InfoProviderInterface
|
||||||
|
|
||||||
use FixAndValidateUrlTrait;
|
use FixAndValidateUrlTrait;
|
||||||
|
|
||||||
|
public const OPTION_CHECK_FOR_DELEGATION = 'check_for_delegation';
|
||||||
|
|
||||||
public const DISTRIBUTOR_NAME = 'Website';
|
public const DISTRIBUTOR_NAME = 'Website';
|
||||||
|
|
||||||
private readonly HttpClientInterface $httpClient;
|
private readonly HttpClientInterface $httpClient;
|
||||||
|
|
@ -99,7 +101,7 @@ class GenericWebProvider implements InfoProviderInterface
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return [
|
return [
|
||||||
$this->getDetails($keyword, false) //We already tried delegation
|
$this->getDetails($keyword, [self::OPTION_CHECK_FOR_DELEGATION => false]) //We already tried delegation
|
||||||
]; } catch (ProviderIDNotSupportedException $e) {
|
]; } catch (ProviderIDNotSupportedException $e) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
@ -312,8 +314,10 @@ class GenericWebProvider implements InfoProviderInterface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getDetails(string $id, bool $check_for_delegation = true): PartDetailDTO
|
public function getDetails(string $id, array $options = []): PartDetailDTO
|
||||||
{
|
{
|
||||||
|
//We check for delegation by default
|
||||||
|
$check_for_delegation = $options[self::OPTION_CHECK_FOR_DELEGATION] ?? true;
|
||||||
$url = $this->fixAndValidateURL($id);
|
$url = $this->fixAndValidateURL($id);
|
||||||
|
|
||||||
if ($check_for_delegation) {
|
if ($check_for_delegation) {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class MouserProvider implements InfoProviderInterface
|
||||||
return $this->settings->apiKey !== '' && $this->settings->apiKey !== null;
|
return $this->settings->apiKey !== '' && $this->settings->apiKey !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function searchByKeyword(string $keyword): array
|
public function searchByKeyword(string $keyword, array $options = []): array
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
SearchByKeywordRequest description:
|
SearchByKeywordRequest description:
|
||||||
|
|
@ -144,7 +144,7 @@ class MouserProvider implements InfoProviderInterface
|
||||||
return $this->responseToDTOArray($response);
|
return $this->responseToDTOArray($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDetails(string $id): PartDetailDTO
|
public function getDetails(string $id, array $options = []): PartDetailDTO
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
SearchByPartRequest description:
|
SearchByPartRequest description:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue