Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: introduce async method and wip inline types #100

Merged
merged 15 commits into from
Aug 21, 2024

Conversation

Orkuncakilkaya
Copy link
Contributor

No description provided.

@Orkuncakilkaya Orkuncakilkaya marked this pull request as draft July 30, 2024 18:09
@Orkuncakilkaya Orkuncakilkaya marked this pull request as ready for review August 5, 2024 09:53
Copy link
Contributor

@TheUnderScorer TheUnderScorer left a comment

Choose a reason for hiding this comment

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

$data = ObjectSerializer::deserialize(
$responseBody,
'\Fingerprint\ServerAPI\Model\EventResponse',
$response->getHeaders()
);
$e->setResponseObject($data);

Is this correct behavior? Here we set $data which is parsed response body, but $responseObject property in this class is ResponseInterface. We probably need to introduce another property that will store this data.

$response = $e->getResponseObject();
$responseBody = $response->getBody()->getContents();
$response->getBody()->rewind();

Let's move this part of code above the switch statement, so that it won't be repeated for every case
This applies to all error status codes.

src/Api/FingerprintApi.php Outdated Show resolved Hide resolved
src/Model/ASN.php Outdated Show resolved Hide resolved
@Orkuncakilkaya Orkuncakilkaya requested a review from ilfa August 9, 2024 16:10
Copy link
Contributor

@TheUnderScorer TheUnderScorer left a comment

Choose a reason for hiding this comment

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

Almost there @Orkuncakilkaya, thanks for these changes so far!

Pls also check ObjectSerializer and remove unused methods. I see that there are at least couple of them that are not used at all, such as toFormValue and toHeaderValue

src/Api/FingerprintApi.php Outdated Show resolved Hide resolved
src/Api/FingerprintApi.php Outdated Show resolved Hide resolved
run_checks.php Outdated Show resolved Hide resolved
@Orkuncakilkaya
Copy link
Contributor Author

I made the changes based on your comments. Please resolve all previous unresolved comments if you think they are resolved
@TheUnderScorer.

@ilfa
Copy link
Member

ilfa commented Aug 13, 2024

There is one more thing that you need to fix.

Sealed is not working actually. Maybe it was broken before, maybe stronger types highlighted the problem and finally broke it.

What you need to do:

  1. run sealed_results_example.php.
    1.1. getEnv will not work, you'll need to add
    $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
    $dotenv->safeLoad();
    1.2 you will get error PHP Fatal error: Uncaught TypeError: Fingerprint\ServerAPI\Model\EventResponse::getProducts(): Return value must be of type Fingerprint\ServerAPI\Model\ProductsResponse, array returned
  2. You will need to change the wrong deserialization (new EventResponse($data)) to the correct one (check how it done for API request) (I made it for python here)
  3. Add tests for it (be sure that the will fail with current code)

Copy link
Contributor

@TheUnderScorer TheUnderScorer left a comment

Choose a reason for hiding this comment

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

LGTM, I have just one question 🙂

scripts/generate.sh Show resolved Hide resolved
Copy link
Contributor

This PR will create a major release 🚀

5.0.0 (2024-08-21)

⚠ BREAKING CHANGES

  • API Methods now throws SerializationException
  • API Methods returns tuple instead of models
  • API Methods removed other than getModel
  • Upgraded minimum php version to 8.1
  • Request logic is rewritten, Upgraded minimum php version to 8.1

Features

  • add support for validating webhook signatures inter-768 (6a4cbd6)
  • change api to return tuple instead of serialized model (62e4ad3)
  • introduce rawResponse for getVisits and getEvent methods (9b01ba6)
  • introduce serialization exception (bfea23a)
  • only generate models and docs from swagger codegen (26e984f)
  • remove raw response and introduce with http info (ce2fedf)
  • rewrite request logic (0016822)
  • upgrade min php version to 8 (5698871)

Bug Fixes

  • serializaiton problem on sealed results (29cb26c)

@Orkuncakilkaya Orkuncakilkaya merged commit 2a8be2e into develop Aug 21, 2024
9 checks passed
@Orkuncakilkaya Orkuncakilkaya deleted the refactor/before-v5 branch August 21, 2024 10:54
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.

3 participants