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

How to handle server plugins #45

Closed
mehmetbilgin opened this issue Apr 24, 2015 · 9 comments
Closed

How to handle server plugins #45

mehmetbilgin opened this issue Apr 24, 2015 · 9 comments

Comments

@mehmetbilgin
Copy link

Hi Christophe,

I wrote a server plugin and I want to call this new plugin using your bundle.
Is it possible? Do I need to create a new command (that extends AbstractCommand)?

@ikwattro
Copy link
Member

Hi @mehmetbilgin ,

The best way to do it is to write a neoclient extension. I need definitely to write a blog post about how to do it and link it into the doc.

In the meantime, you may want to look how I created extensions for spatial and timetree :

https://github.com/neoxygen/neoclient-spatial-extension

https://github.com/graphaware/neoclient-timetree-extension

@mehmetbilgin
Copy link
Author

I managed to write the extension looking at the examples you gave, but my unchecked extension returning json stream. Looks like setting header option "Accept: application/json" (in GuzzleHttpClient.php) causing error with the request.

@ikwattro
Copy link
Member

Hello @mehmetbilgin ,

Thanks for your feedback. You mark a good point, the client is made to send only json http requests.
And I'm aware now that somebody may have the need to send anything else than json.

I will try to find a "temporary fix" for the 2.x version of the client. Thanks for using the library and to report here.

@ikwattro
Copy link
Member

@mehmetbilgin

I have pushed a new branch "custom-headers", if you would like to see if it fit your needs it would be cool.

How it works ?

In the execute method of your new Command you can now pass a last parameter to the ->process() method call :

public function execute()
    {
        return $this->process(self::METHOD, self::PATH, $this->prepareBody(), $this->connection, null, $this->queryMode, $headers);
    }

$headers has to be an array of headers where keys are the header name and value the header value, it will override default headers the GuzzleHttpClient has.

e.g. :

$headers = ['Content-Type' => 'application/text'];

@mehmetbilgin
Copy link
Author

Thanks for the quick fix. I will be able to try it tomorrow and let you know the outcome.

@ikwattro
Copy link
Member

Thank you.

@mehmetbilgin
Copy link
Author

Sorry for delayed response.
I've tested it and it works.
Are you planning to merge it back to 2.x branch?

@ikwattro
Copy link
Member

Cool. Yes I will merge it in 2.x

@ikwattro
Copy link
Member

This has been merged into master, and released with 2.1.14 tag

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