Exemple #1
0
        /// <summary>
        /// Add Attachment to card.
        /// </summary>
        /// <param name="cardId"></param>
        /// <param name="filePath"></param>
        public TrelloAttachment UploadAttachmentToCard(TrelloAttachment attachment)
        {
            WWWForm post = new WWWForm();

            post.AddField("key", key);
            post.AddField("token", token);

            post.AddField("mimeType", attachment.mimeType);
            //post.AddField("file", attachment.file);
            post.AddField("url", attachment.url);
            post.AddBinaryData("file", File.ReadAllBytes(attachment.file));
            post.AddField("name", attachment.name);

            //WWW www = new WWW(cardBaseUrl + currentCardId + "/attachments" + "?" + "key=" + key + "&token=" + token, post);
            WWW www = new WWW(cardBaseUrl + currentCardId + "/attachments", post);

            // Wait for request to return
            while (!www.isDone)
            {
                checkWwwStatus("Could not upload attachement to Trello card", www);
            }

            return(attachment);
        }
Exemple #2
0
        /// <summary>
        /// Retrieve a new Trello card attachment object.
        /// </summary>
        /// <returns></returns>
        public TrelloAttachment newAttachment()
        {
            var attachment = new TrelloAttachment();

            return(attachment);
        }