XeroAPI.Net icon indicating copy to clipboard operation
XeroAPI.Net copied to clipboard

Adding example of string constants to pass parameters with ease

Open amhed opened this issue 11 years ago • 4 comments

Mentioned on issue #35

amhed avatar Jul 18 '13 17:07 amhed

Hi Ahmed,

I'm interested in this kind of patch, but I'm wondering why you chose string constants instead of creating this as an Enum?

Regards, Matthew

MatthewSteeples avatar Aug 31 '13 12:08 MatthewSteeples

Honestly, I don't know :smiley:

I can refactor it, and add all the cases where this happens that I can think of. Just wanted to check with you guys if it's a good idea before actually coding it!

amhed avatar Aug 31 '13 13:08 amhed

I should probably make it clear that I don't work for Xero or represent them in any way, we're just a heavy user of the API. I'm reasonably confident that the API can be modified to use Enums for these fields instead of strings and it still work with serializing for over-the-web communication. I think it would make use of the library easier.

MatthewSteeples avatar Aug 31 '13 13:08 MatthewSteeples

Cool.

I remember now why I went with the strings. Depending on your serializer provider and settings you're using it will either serialize as a string or as an int. So I thought using the strings was a sure way to never get any errors

amhed avatar Aug 31 '13 13:08 amhed