Open elstamey opened 8 years ago
would love feedback here @PSchwisow @svpernova09 @vreemt
I'm getting ready to post the notes about suggested implementation
There are several APIs that hold CFP lists. Presumably there would be duplicates between them, so the requests must be made to each API then collecting the list and returning selected results.
elazar elstamey: I'm thinking the plugin could have an adapter interface and take one or an array of multiple adapter implementations via configuration, so it would have the potential to aggregate data from multiple sources.
elstamey i'm not sure how to implement that within phergie, but I look forward to learning PSchwisow elstamey: an example of the pattern: https://github.com/PSchwisow/phergie-irc-plugin-react-url-shorten elazar So, I'd tend to suggest having a value object class that includes the first three attributes, and then have your adapters deal with arrays or some other type of collection containing instances of that value object class. elazar And https://github.com/phergie/phergie-irc-plugin-react-command for parsing commands.
I understand the Adapter examples that @PSchwisow shared. Will the curl call happen inside those since each adapter will call a different API?
I think a decorator would collate the list of CFPs and filter out duplicates.
I could really use some feedback, or a video chat to discuss/plan. This could even be after Halloween, since I'm making costumes. I would like a loose design before I begin.
I'd also suggest using @Wyrihaximus' Http plugin for making non-blocking HTTP requests to APIs.
FYI That plugin moved to https://github.com/phergie/plugin-http
@elstamey Yes, I think the adapters should make their own calls. I don't think anything outside the adapter needs to know how the adapter gets the data. There is nothing to say you can't have an adapter that uses some other way of getting data. In fact, you might want to create a "static adapter" that returns "canned data" without contacting any external services so you can test the main plugin code in isolation from the real adapters.
But I'd second elazar's suggestion to use HTTP plugin rather than directly using curl. It already fits nicely into the event system so you can avoid blocking on the HTTP requests.
:+1: Thank you all! I will probably start trying to spec something over the weekend. :)
I'm not sure if I need to use $event and $queue instead of $deferred more like https://github.com/phergie/phergie-irc-plugin-react-bofh/blob/master/src/Plugin.php#L83-L113
But I have made a start using the url shortening adaptors. I may need a nudge in the right direction here.
These were the ideas @elazar mentioned in chat for commands