Closed gregveres closed 3 years ago
I submitted PR #23 for this issue.
During the pull request review, @NeVeSpl requested that this not be a seperate function, but instead be an argument on the existing Parameters action method. That is coming in a new pull request shortly.
An updated pull request has been submitted that solves this and is merged with your latest changes.
When I am generating a services class, I like to have two functions per end point. I like to have one function that returns the url given all the parameters and the other function that actually calls the url.
I like to have the url function because I use it in unit testing all the time to ensure that I have setup my class under test properly so that it is calling the end point properly. That way my unit tests don't change if the end point url changes.
Here is a sample end point set of functions in a service class:
To be able to create this with NTypewriter, I need to call method.Parameters and method.BodyParameter and then I have to remove BodyParameter from the Parameters list. However, I can't seem to do this in Scriban, because once I use the Array methods on the Parameter list, I no longer have the ability to use an Action method that expects an IEnumerable because the parameter list has been converted into something called a range by Scriban.
So I would like to have an Action.UrlParameters that returns the Parameter list that is required for the creation of the Url.
BTW, this would be an improvement over what I had when using Typescript. All of my url methods included the body parameter, which made unit testing awkward because I would have to create an instance of the body parameter to be able to call the url function. The above output would be much better.