adlio / trello

Trello API wrapper for Go
MIT License
220 stars 71 forks source link

Revert "fix custom fields fetching #42" #44

Closed adlio closed 5 years ago

adlio commented 5 years ago

Reverts adlio/trello#43.

Oops... PR #43 broke support for dropdown custom fields, which don't include a value attribute. The earlier code only supported those kinds of fields, hence the confusion. Looks like we'll need a solution which addresses both.

Here's a card on a public board which has both types of fields.

Relevant API Calls

https://trello.com/1/boards/QB4oHV5k/customFields https://trello.com/1/cards/5cdc677dd4ee240932e119ca?customFieldItems=true https://trello.com/1/boards/QB4oHV5k/cards?customFieldItems=true

JSON Excerpt

The first item in the array below is a dropdown which corresponds to the choice Chooser Option 2. It doesn't include a value attribute... we have to extract it from the /boards/:id/customFields API call.

 "customFieldItems": [
    {
      "id": "5cdc678f79f3548c5ec2e371",
      "idValue": "5cdc6736f82ce051f2db8a82",
      "idCustomField": "5cdc672d83cbe31ba77ae615",
      "idModel": "5cdc677dd4ee240932e119ca",
      "modelType": "card"
    },
    {
      "id": "5cdc678db990c26c37f8ad6f",
      "value": {
        "checked": "true"
      },
      "idCustomField": "5cdc66c8833ecd0d7c4c3775",
      "idModel": "5cdc677dd4ee240932e119ca",
      "modelType": "card"
    },
    {
      "id": "5cdc678cccee0e2bab488863",
      "value": {
        "text": "This is a description of information."
      },
      "idCustomField": "5cdc66bf83867f4b7d7811be",
      "idModel": "5cdc677dd4ee240932e119ca",
      "modelType": "card"
    },
    {
      "id": "5cdc67858f1c98288d6479e2",
      "value": {
        "number": "57"
      },
      "idCustomField": "5cdc66b4807a523d8276b5d5",
      "idModel": "5cdc677dd4ee240932e119ca",
      "modelType": "card"
    }
  ],
AlmogBaku commented 5 years ago

hmm... that's really tricky. The solution I presented in #43 also using me for INSERTING data to trello, so that's two birds in a row. I have no idea how can we achieve that w/ dropdown :O (this API really suck)