I wrote a code generator using NSwag for Epicor services. I was wondering if the community would be interested in the code to generate their own REST clients. The generator handles security and connection through a shared resource. I could create a GUI to make it a seamless application for client generation.
Currently the generator creates cs files and adds them to a project for all services however this can be filtered by selecting only the services you wish to utilize.
If the community is open I can post on Github with an MIT license.
I would add a GUI and some additional functionality, mostly configurable.
Where do you want to place username and password? I use single sign on for the service user to generate the code and to run the client. What step do you wish to have credentials, both require you to change my code for your environment.
In the service class you can change the getWebClient method to generate a WebClient with your credentials, this is used to generate the client code.
In the ClientBase class I have added code samples for the different types of authentication. SSO, Bearer Token, User credentials. This is used by the generated code to create the HttpClient
I made a significant change in terms of adding username and password, I also gave a UI component to edit the client base. I did do some significant clean up effort to the code structure, so it is easier for others to dive in if they want.
When I use the tool, I get an internal server error (error 500). I also get the error in the browser when I browse to the URL displayed in the “API’s URL” field. https://myServer/myApp/api/swagger/v1/odata/
I’m able to make the REST calls manually with no problem. Maybe there’s an issue with my app server configuration?