I’ve been working on a module to work with DokuWiki’s XML RPC API (GitHub / PSGallery), and have run into a few issues with where to go with it. I have created what is essentially a wrapper function for all the existing API methods, with some very basic logic for error handling etc. I started off just invoking the web request inside each function, which turned out to be a bit unwieldy, I have since moved to saving the WebSession (and associated cookies) to a variable along with some other info as it was the first solution I thought of.
I have since decided that it would be better to behave more like the MSOnline / VMWare modules and have a Connect-DokuWiki type function and have the rest of the functions use that. However I am a bit at a loss of how to implement that. I am currently just saving the same WebSession to a array variable in the module scope and plan to just access that from the other functions, so you don’t have to specify a connection object parameter for each function.
So my first question: is the above way of using an array with all the WebSessions (to various endpoints if necessary) sane or is there a better way I’m not thinking of??
I have also begun playing around with Pester and AppVeyor builds, and have run into a bit of a roadblock in how to test / mock responses from the API. I guess my second question is how can I manually make some valid XML in the format I need to test against?