Skip to content

Commit

Permalink
Merge branch 'kolaente-feature/card-attachments'
Browse files Browse the repository at this point in the history
* kolaente-feature/card-attachments:
  Add method to get all card attachments
  • Loading branch information
adlio committed Mar 28, 2022
2 parents 0bbe792 + ba11223 commit 02f26cf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion card.go
Expand Up @@ -369,6 +369,13 @@ func (c *Card) AddURLAttachment(attachment *Attachment, extraArgs ...Arguments)

}

// GetAttachments returns all attachments for a card
func (c *Card) GetAttachments(args Arguments) (attachments []*Attachment, err error) {
path := fmt.Sprintf("cards/%s/attachments", c.ID)
c.client.Get(path, args, &attachments)
return
}

// AddFileAttachment takes an Attachment, filename with io.Reader and adds it to the card.
func (c *Card) AddFileAttachment(attachment *Attachment, filename string, file io.Reader, extraArgs ...Arguments) error {
path := fmt.Sprintf("cards/%s/attachments", c.ID)
Expand All @@ -381,7 +388,6 @@ func (c *Card) AddFileAttachment(attachment *Attachment, filename string, file i
err = errors.Wrapf(err, "Error adding attachment to card %s", c.ID)
}
return err

}

// GetParentCard retrieves the originating Card if the Card was created
Expand Down

0 comments on commit 02f26cf

Please sign in to comment.