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

Add the ability to run raw queries or add custom endpoints #70

Closed
max-petrovich opened this issue Sep 21, 2023 · 10 comments
Closed

Add the ability to run raw queries or add custom endpoints #70

max-petrovich opened this issue Sep 21, 2023 · 10 comments
Assignees

Comments

@max-petrovich
Copy link

My use case:
I added custom APIs to Keycloak, and through your library I can’t access them (without forking)

@fschmtt
Copy link
Owner

fschmtt commented Sep 24, 2023

Hey, I haven't been around for a few days, so sorry for not replying earlier.

If you already have a fork and implemented endpoint(s) yourself, you can open a PR to my repo and I'll happily review it.

Shouldn't be a big deal to get it merged - this way everybody profits!

@fschmtt
Copy link
Owner

fschmtt commented Oct 16, 2023

I created a draft PR: #71

Happy to hear your feedback on it - does it look utilizable for your use case? 😄

@max-petrovich
Copy link
Author

I can also suggest an option:

  1. The end user creates his own package, adding your client as a dependency
  2. Adds its methods to its package

The application already connects its own package and uses custom methods, as if they were originally in the client

@fschmtt
Copy link
Owner

fschmtt commented Oct 23, 2023

Not sure if I get you right - you want to have explicit APIs to register custom endpoints, e.g.

$keycloak = new Keycloak(...);
$keycloak->registerCustomEndpoint(
    path: '/custom/api/endpoint/{param1}',
    returnType: MyCustomRepresentation::class
);

Did I get this right?

@fschmtt
Copy link
Owner

fschmtt commented Dec 7, 2023

Hey @max-petrovich did you have a change to check out the changes in the mentioned PR?

Happy to get your feedback! 😄

@max-petrovich
Copy link
Author

Your option is not bad, but I rather meant something else - I create a separate repository with my custom methods, I included your SDK in my package. Then I use my “modified” library and have code completion, etc.

@fschmtt
Copy link
Owner

fschmtt commented Dec 17, 2023

I think what you are describing is exactly what I would be doing by simply forking this library and modifying it to your needs by adding new resources.

I started prototyping something that lets you add custom resources but this will end up in offering general methods that then (might) kill the auto-completion (at least without additional annotating and proper IDE support), e.g.:

$keycloak = new Keycloak(...);

$myCustomResource = $keycloak->getResource(MyCustomResource::class);

I'd actually want try to avoid having too much generality because I built this library with easy use and proper code completion in mind. But maybe I'm finding a solution that I'm satisfied with 😄

fschmtt added a commit that referenced this issue Dec 17, 2023
@fschmtt
Copy link
Owner

fschmtt commented Dec 17, 2023

I opened a new draft PR: #80

@fschmtt
Copy link
Owner

fschmtt commented Dec 22, 2023

@max-petrovich would be glad to hear your feedback on #80 😄

fschmtt added a commit that referenced this issue Dec 31, 2023
fschmtt added a commit that referenced this issue Dec 31, 2023
fschmtt added a commit that referenced this issue Dec 31, 2023
fschmtt added a commit that referenced this issue Jan 12, 2024
fschmtt added a commit that referenced this issue Jan 12, 2024
fschmtt added a commit that referenced this issue Jan 12, 2024
@fschmtt
Copy link
Owner

fschmtt commented Jan 12, 2024

I merged #80 and think it covers your use case.

Feel free to re-open this issue if it doesn't 🙂

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

No branches or pull requests

2 participants