adlio / trello

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

Attachment Not Working #45

Open baturorkun opened 5 years ago

baturorkun commented 5 years ago

Hi all Thanks for this good working but examples are missing. I am trying to add a card with attachment. I did it without any error but no attachment on Trello.

var attachs []*trello.Attachment attachs = append(attachs, &trello.Attachment{URL:"https://www.belightsoft.com/products/imagetricks/img/core-image-filters@2x.jpg", Name:"test"})

card := &trello.Card{ Name: "Batur Orkun", Desc: "Card description", Attachments: attachs, } err = list.AddCard(card, trello.Defaults())

baturorkun commented 5 years ago

I could have added by using AddFILEAttachment() method after adding a Card. But there is another problem is getting ID of Card I added. Because I need this ID for adding an attachment after.

card := &trello.Card{ ID: "aaaaa" .....} . command does not work

adlio commented 5 years ago

Thanks for the report. I'll take a look this week.

KaziSadmanAhmed commented 4 years ago

Having the same issue. Any update?

adlio commented 4 years ago

I was able to investigate. The list.AddCard() method is a pass through to the POST .../cards API call, which doesn't accept attachments at the time of card creation. It looks like that method could be modified to make a second API call if the incoming struct has attachments (I'd want to preserve the exact current functionality for structs that don't have attachments). Please submit a PR if you'd like to add this feature. I'll leave this as an open feature request and try to get to it, but it might not be fast.

konsalex commented 2 years ago

@adlio great work with the trello client 🙌

Do you think this issue is the same with labelIDs and AddCard?

I stumbled across the same problem when I use list.AddCard(&card) and the labels are included in the trello.Card struct. When I execute this, there are 0 tags included in the card created, while when I create the card and then call the AddIDLabel it works as expected.

This is a bummer because with this approach adding multiple labels will require multiple requests (greater chance of a failure), but definitely not a roadblock.