raksul / go-clickup

Clickup go client
MIT License
39 stars 24 forks source link

JSON Marshalling Issue #37

Closed graza-io closed 1 year ago

graza-io commented 1 year ago

Hi,

It looks like in many places the property Orderindex is incorrectly typed as an int examples: https://github.com/raksul/go-clickup/blob/18cac46eab8c3327cf55d70b5e3f9092ab7449e3/clickup/checklists.go#L30 https://github.com/raksul/go-clickup/blob/18cac46eab8c3327cf55d70b5e3f9092ab7449e3/clickup/checklists.go#L39

This leads to errors such as json: cannot unmarshal number 2.5 into Go struct field Item.tasks.checklists.items.orderindex of type int (SQLSTATE HV000) when attempting to obtain data where the orderindex isn't an exact integer.

graza-io commented 1 year ago

Also on this the PercentCompleted in the goals.go file should also be of type float not int https://github.com/raksul/go-clickup/blob/18cac46eab8c3327cf55d70b5e3f9092ab7449e3/clickup/goals.go#L94

a-thug commented 1 year ago

@graza-io Thanks for your report! We will check into the matter.

graza-io commented 1 year ago

Hey @a-thug glad to hear, I did find another also - below you can see folder_access is marshalling to string https://github.com/raksul/go-clickup/blob/18cac46eab8c3327cf55d70b5e3f9092ab7449e3/clickup/goals.go#L88

However it's actually a bool in the API response:

"folder_id": "05921253-7737-44af-a1aa-36fd11244e6f",
"folder_access": true,
"pinned": false,

Giving json: cannot unmarshal bool into Go struct field Goal.folders.goals.folder_access of type string

graza-io commented 1 year ago

@a-thug hey, just wondering if there's any progress on addressing these?

a-thug commented 1 year ago

@graza-io We hope to have something done by the end of November. The type of the following fields might be changed like this

Is there any problem?

graza-io commented 1 year ago

That looks about right.