teference / zoho-dotnet

Zoho API .NET SDK
MIT License
7 stars 11 forks source link

ZsCustomField is missing label property #7

Closed ultimaustin closed 6 years ago

ultimaustin commented 6 years ago

Hi,

The ZsCustomField is missing the label property. I see that this exists on the extending class ZsCustomFieldEx. Can it be moved to the parent?

When I pull a customer via the API the label I get this snippet of json for the custom fields: "custom_fields":[{ "customfield_id":"1111", "is_active":true, "show_in_all_pdf":false, "value_formatted":"Test ABC", "data_type":"string", "index":1, "label":"Custom Field Name", "show_on_pdf":false, "placeholder":"cf_customfieldname", "value":"Test ABC" }]

It would be really helpful if the custom field ID and the label could be included in the model so that they are deserialized correctly in the response form the API.

Adding the following snippet to the ZsCustomField class (and removing the Label from the ZsCustomFieldEx class) seems to do the job:

    [JsonProperty("label")]
    public string Label { get; set; }

    [JsonProperty("customfield_id")]
    public string CustomfieldId { get; set; }
jsinh commented 6 years ago

Sorry for the late response @ultimaustin

I see your point, as I do not keep track of API changes from Zoho these days, thanks for point this out. Also above snippet was helpful :)

I made some changes as you suggest and pushed NuGet. To be honest, I haven't got time to test this yet but if something is broken it might be in Subscription related endpoint response which would return customfield data because I am now using ZsCustomField instead of ZsCustomFieldEx (removed)

Hope that makes sense and is helpful, let me know if you face any issues further! -Jsinh

VitaliiN commented 6 years ago

@jsinh Looks like you did a typo for ZsCustomField, now it has bool ValueFormatted property :

    [JsonProperty("value_formatted")]
    public bool ValueFormatted { get; set; }

But it should be a string

    [JsonProperty("value_formatted")]
    public string ValueFormatted { get; set; }

Could you please fix it, this results to exception due to conversion issue.

jsinh commented 6 years ago

@VitaliiN - Thanks for pointing it out, Fixed - pushed new NuGet for it 0.6.19, cheers!