Skip to content

Commit

Permalink
Add max jobs per request
Browse files Browse the repository at this point in the history
  • Loading branch information
marekskopal committed Apr 29, 2024
1 parent 7ad2f84 commit b431a02
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ private function addHeaders(RequestInterface $request): RequestInterface

return $request;
}

public function getMaxJobsPerRequest(): int
{
return $this->config->apiKey !== null ? 100 : 10;
}
}
5 changes: 5 additions & 0 deletions src/OpenFigi.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ public function mapping(array $mappingJobs,): array
$mappingResults,
);
}

public function getMaxJobsPerRequest(): int
{
return $this->client->getMaxJobsPerRequest();
}
}
11 changes: 11 additions & 0 deletions tests/OpenFigiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,15 @@ public function testMapping(): void

$this->assertInstanceOf(FigiResult::class, $openFigi->mapping([$mappingJob])[0][0]);
}

public function testGetMaxJobsPerRequest(): void
{
$openFigi = new OpenFigi(new Config());

$this->assertEquals(10, $openFigi->getMaxJobsPerRequest());

$openFigi = new OpenFigi(new Config('abc'));

$this->assertEquals(100, $openFigi->getMaxJobsPerRequest());
}
}

0 comments on commit b431a02

Please sign in to comment.