trello icon indicating copy to clipboard operation
trello copied to clipboard

Attachment Not Working

Open baturorkun opened this issue 5 years ago • 5 comments

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/[email protected]", Name:"test"})

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

baturorkun avatar Jul 04 '19 07:07 baturorkun

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

baturorkun avatar Jul 05 '19 07:07 baturorkun

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

adlio avatar Jul 07 '19 18:07 adlio

Having the same issue. Any update?

KaziSadmanAhmed avatar Oct 06 '19 06:10 KaziSadmanAhmed

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.

adlio avatar Oct 09 '19 20:10 adlio

@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.

konsalex avatar Feb 08 '22 15:02 konsalex