Skip to content

f2 api client#2

Open
rimi-itk wants to merge 36 commits into
mainfrom
f2-api-client
Open

f2 api client#2
rimi-itk wants to merge 36 commits into
mainfrom
f2-api-client

Conversation

@rimi-itk

@rimi-itk rimi-itk commented May 18, 2026

Copy link
Copy Markdown
Contributor

F2 API client for PHP

@rimi-itk rimi-itk force-pushed the f2-api-client branch 4 times, most recently from af50995 to 317d224 Compare May 19, 2026 12:58
@rimi-itk rimi-itk force-pushed the f2-api-client branch 2 times, most recently from 95d30fd to 93e95c1 Compare May 19, 2026 14:22
@rimi-itk rimi-itk marked this pull request as ready for review July 7, 2026 13:53
@rimi-itk rimi-itk requested a review from jekuaitk July 7, 2026 13:53
Comment thread src/Model/CaseFile.php
$this->closed = 'true' === (string) $sxe->Closed;
$this->journalPlan = JournalPlan::fromSimpleXMLElement($sxe->JournalPlan);
$this->processInstruction = ProcessInstruction::fromSimpleXMLElement($sxe->ProcessInstruction);
$this->deadline = $this->createDateTime($sxe->Deadline);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would deadline not be set to now if nothing is provided here?

public ?\DateTimeImmutable $deadline = null;

Makes me think it may be null.

The same would go for other uses of createDateTime.

Comment thread composer.json Outdated
"symfony/options-resolver": "^6.4 || ^7.4 || ^8.1"
},
"require-dev": {
"php": "^8.3",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not belong in require rather than require-dev?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sure does: a7095cf

Comment thread src/ApiClient.php Outdated
Comment thread src/Command/F2ApiClientCommand.php Outdated
Comment on lines +30 to +31
#[Option(description: 'Path to to cache directory. If not specified, no requests will be cached.')]
?string $cacheDirectory = null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what i can see leaving out --cache-directory ends up with FilesystemAdapter just using a default directory? I.e. it is still cached?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. The behaviour actually depends on the context the console command is run in …

If the command run like shown in the documentation, e.g. like docker compose run --quiet --rm phpfpm php bin/f2-api-client getServiceIndex, then no caching will be in effect since the container is removed after completing the command. In this case, setting the cache directory path to a path on the host will enable caching between calls.

Running the command in a running docker compose setup, will make the cache always active.

I've updated the description to make a little more sense in da58440

Comment thread src/ApiClient.php Outdated
protected function getAccessToken(): array
{
$cache = $this->getCache();
$cacheKey = sha1(__METHOD__);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this involve credentials used? Looks me like a switch of credentials would not result in a new access token issued and cached.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're very clever: 8303f37

rimi-itk and others added 2 commits July 10, 2026 15:03
Co-authored-by: Jeppe Kuhlmann Andersen <78410897+jekuaitk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants