-
Notifications
You must be signed in to change notification settings - Fork 4
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
More complex parameters structure #2
Comments
I have chosen the enum approach as a standard for the API. It's not that difficult to create a call that accepts an object instead of an enum and then use the json of that object instead of the enum. Which API call(s) accept an object instead of a parameter list? |
@evermeer Alamofire does allow it using |
Ah, but it would not be that hard to implement a notGenericCall function based on the existing code. The genericCall code looks like this:
I even think this is all that it takes.
Maybe I can do some tests this weekend and add it to EVWordpressAPI |
Excellent - new method can solve such issue. |
I tried to use this great example to work with some Wordpress plugins.
But there can be situations when POST parameters should generate certain JSON structure.
E.g.
{ "title":"aaa", "post":23, "seo": { "keywords":"bmw,audi", "rating":"10", "optimize":"true" } }
Current approach to use enums won't work to generate such structure.
public enum basicParameters: EVAssociated { case title(String) case post(Number) case seo([seoParameters]) } public enum seoParameters: EVAssociated { case keywords(String) case rating(Number) case optimize(Bool) }
So possibly I'm doing it wrong though I didn't want to change anything in "EVWordPressAPI".
I would appreciate if you can suggest correct way to generate required JSON structure as it will allow to use "EVWordPressAPI" with some plugins too.
The text was updated successfully, but these errors were encountered: