-
-
Notifications
You must be signed in to change notification settings - Fork 5
TrelloClient
This is the Main Client to communicate with the Trello API (aka everything is done via this)
In order to instantiate the client you need to provide:
| Option | Description |
|---|---|
ApiKey (Required) |
The Trello API Key you get on https://trello.com/power-ups/admin/ |
Token (Required) |
Your Authorization Token you generate get on https://trello.com/power-ups/admin/ |
Options (Optional) |
Various options for the client (if null default options will be used) See below for details |
HttpClient (Optional) |
Optional HTTP Client if you wish to specify it on your own (else an internal static HttpClient will be used for re-use) |
Example
//Create the Trello Client
TrelloClient _trelloClient = new TrelloClient("APIKey", "TOKEN"); //IMPORTANT: Remember to not leave Key and Token in clear text!
//Get a board
Board board = await client.GetBoardAsync("<boardId>");
//Get Lists on a board
List<List> lists = await client.GetCardsOnBoardAsync("<boardId>");
//Get a card
Card card = await client.GetCardAsync("<cardId>");
//Get Cards on Board
List<Card> cardsOnBoard = await trelloClient.GetCardsOnBoardAsync("<boardId>");
//Get Cards in List
List<Card> cardsInList = await trelloClient.GetCardsInListAsync("<listId>");
//Add a card
var input = new Card("<listId>", "My Card", "My Card description");
//todo - add more about the card
var newCard = await client.AddCardAsync(input);
//Add a Checklist to a card
var checklistItems = new List<ChecklistItem>
{
new("ItemA"),
new("ItemB"),
new("ItemC")
};
var newChecklist = new Checklist("Sample Checklist", checklistItems);
var addedChecklist = await client.AddChecklistAsync("<cardId>", newChecklist);
The TrelloClientOptions can be passed optionally to the TrelloClient Constructor with the following options:
| Option | Description |
|---|---|
ApiCallExceptionOption |
Control level of URL Details are shown in Exceptions from calls to the API |
AllowDeleteOfBoards |
Controls if it is allowed to delete Boards (secondary confirmation) |
IncludeCustomFieldsInCardGetMethods |
Control if cards should retrieve Custom Fields when retrieving cards (WARNING: Non-Get-Methods returning Card will NOT include Custom fields) |
IncludeAttachmentsInCardGetMethods |
Control if cards should retrieve Attachments when retrieving cards (WARNING: Non-Get-Methods returning Card will NOT include Attachments) |
AllowDeleteOfOrganizations |
Controls if it is allowed to delete Organizations (secondary confirmation) |
- Action Features
- Attachment Features
- Board Features
- Card Features
- Checklist Features
- Comments Features
- Cover Features
- Custom Field Features
- Generic Features
- Label Features
- List Features
- Member Features
- Membership Features
- Organisation Features
- Sticker Features
- Webhook Features
Actions in Trello are the 'things' the Members do on a Board... There are common things like 'Create a Card' or 'Add a Label to a Card', and more obscure things like example 'Accept Enterprise Join Request'. In total, there are over 75 different types of Actions. You can retrieve these events via the API to example get a list of things that happened on a specific card.
Tip: There is a list of different events in struct
TrelloDotNet.Model.Webhook.WebhookActionTypesfor you to consume.
NB: You can max get the last 1000 Actions that have happened.
| Feature | Description |
|---|---|
| GetActionsOfBoardAsync | Get the most recent Actions (Changelog Events) of a board |
| GetActionsOnCardAsync | Get the most recent Actions (Changelog Events) on a Card |
| GetActionsForListAsync | Get the most recent Actions (Changelog Events) for a List |
| GetActionsForMemberAsync | Get the most recent Actions (Changelog Events) for a Member |
| GetActionsForOrganizationsAsync | Get the most recent Actions (Changelog Events) for an Organization |
Cards can have Attachments of various types (Links and Files) and these methods allow you to add, get and delete the attachments.
| Feature | Description |
|---|---|
| AddAttachmentToCardAsync | Add an Attachment to a Card |
| GetAttachmentsOnCardAsync | Get Attachments on a card |
| DeleteAttachmentOnCardAsync | Delete an Attachments on a card |
Boards are where you have your Lists (and Cards on those lists). The API gives standard CRUD features (good if you programmatically wish to spin up template Boards in large organizations). A Board's 'parent' is an Organization (Workspace)
| Feature | Description |
|---|---|
| AddBoardAsync | Add a new Board |
| GetBoardAsync | Get a Board by its Id |
| GetBoardsForMemberAsync | Get the Boards that the specified member has access to |
| GetBoardsCurrentTokenCanAccessAsync | Get the Boards that the token provided to the TrelloClient can Access |
| GetBoardsInOrganization | Get the Boards in an Organization |
| UpdateBoardAsync | Update a Board |
| CloseBoardAsync | Close (Archive) a Board |
| ReOpenBoardAsync | ReOpen a Board |
| DeleteBoardAsync | Delete an entire board |
Cards are the main feature of any Trello Board. There are associated with a List and have various core fields (Name, Description, Dates) and Links to other Trello artifacts (Labels, Members, Checklists, Attachments, Stickers, and Covers). Via the API you can do standard CRUD operations and link/unlink the other artifacts.
| Feature | Description |
|---|---|
| AddCardAsync | Add a Card |
| GetCardAsync | Get Card by its Id |
| GetCardsOnBoardAsync | Get all open cards on un-archived lists |
| GetCardsOnBoardFilteredAsync | Get the cards on board based on their status regardless if they are on archived lists |
| GetCardsInListAsync | Get all open cards on a specific list |
| GetCardsForMemberAsync | Get all Cards a Member is on (across multiple boards) |
| UpdateCardAsync | Update a Card |
| ArchiveCardAsync | Archive (Close) a Card |
| ReOpenCardAsync | ReOpen (Send back to board) a Card |
| ArchiveAllCardsInListAsync | Archive all cards on in a List |
| MoveAllCardsInListAsync | Move all cards of a list to another list |
| DeleteCardAsync | Delete a Card |
| SetDueDateOnCardAsync | Set Due Date on a card |
| SetStartDateOnCardAsync | Set Due Date on a card |
| SetStartDateAndDueDateOnCardAsync | Set Start and Due Date on a card |
On a Card, you can have one or more Checklists that are essential 'SubTasks' for the card. If you are a free user they are simple checklists, while on a premium account, you can also assign members and due dates to each Check-item. Via the API you can do standard CRUD operations.
| Feature | Description |
|---|---|
| AddChecklistAsync | Add a Checklist to the card or Add a Checklist to the card based on an existing checklist (as a copy) |
| GetChecklistAsync | Get a Checklist with a specific Id |
| GetChecklistsOnBoardAsync | Get a list of Checklists that are used on cards on a specific Board |
| GetChecklistsOnCardAsync | Get a list of Checklists that are used on a specific card |
| UpdateChecklistItemAsync | Update a Check-item on a Card |
| DeleteChecklistAsync | Delete a Checklist |
On a Card, the Members of a Board can add Comments (Comments in Trello are essentially special Actions so they will also appear there). Via the API you can do standard CRUD operations.
| Feature | Description |
|---|---|
| AddCommentAsync | Add a new Comment on a Card |
| GetAllCommentsOnCardAsync | Get All Comments on a Card |
| GetPagedCommentsOnCardAsync | Get Paged Comments on a Card |
| UpdateCommentActionAsync | Update a comment Action (aka only way to update comments as they are not seen as their own objects) |
| DeleteCommentActionAsync | Delete a Comment |
Covers are a special visual feature on Cards that can help the card stand out (color at, the top, the full coloring of the card, or have an image at the top of the card). Via the API you can do standard CRUD operations for covers.
| Feature | Description |
|---|---|
| AddCoverToCardAsync | Add a Cover to a card. Tip: It is also possible to update the cover via UpdateCardAsync |
| UpdateCoverOnCardAsync | Update a Cover to a card (this is equivalent to AddCoverToCardAsync, but here for discover-ability. Tip: It is also possible to update the cover via UpdateCardAsync) |
| RemoveCoverFromCardAsync | Remove a cover from a Card |
NB: Custom Fields are a Premium Trello Feature only :-/
Custom Fields are as the name says, fields that you can make yourself in order to add custom values to Cards. As an example, Trello does not have a default Priority field, but with a custom field, you could make one.
| Feature | Description |
|---|---|
| GetCustomFieldsOnBoardAsync | Get Custom Fields of a Board |
| UpdateCustomFieldValueOnCardAsync | Update a Custom field on a Card |
| ClearCustomFieldValueOnCardAsync | Clear a Custom field on a Card |
| GetCustomFieldItemsForCardAsync | Get Custom Fields for a Card (Tip: Use Extension methods GetCustomFieldValueAsXYZ for a handy way to get values) |
This API does not cover every single little or obscure feature the Trello API has to offer, but it could be that you wish to use something that is not exposed anyway. For that reason, Generic Post, Put, Get, and Delete methods exist in the API where you can provide the endpoint, parameters and the API will take care of all the core stuff of the call
Tip: If you feel it should be in the product then submit it on the Issues page).
| Feature | Description |
|---|---|
| PostAsync | Custom Post Method to be used on unexposed features of the API |
| GetAsync | Custom Get Method to be used on unexposed features of the API |
| PutAsync | Custom Put Method to be used on unexposed features of the API |
| DeleteAsync | Custom Delete Method to be used on unexposed features of the API |
Labels (or Tags as they are called in other systems) can be assigned to Cards to categorize them. The API provides both CRUD operations for the management of Labels (they belong to a board) and the add/removal of labels on Cards.
| Feature | Description |
|---|---|
| AddLabelsToCardAsync | Add a Label to a Card |
| RemoveLabelsFromCardAsync | Remove a Label of a Card |
| RemoveAllLabelsFromCardAsync | Remove all Labels of a Card |
| GetLabelsOfBoardAsync | Get List of Labels defined for a board |
| AddLabelAsync | Add a new label to the Board (Not to be confused with AddLabelsToCardAsync that assign labels to cards) |
| UpdateLabelAsync | Update the definition of a label (Name and Color) |
| DeleteLabelAsync | Delete a Label from the board and remove it from all cards it was added to |
Lists are the 'Columns' you see on your Board and hold your Cards. They are pretty simple structures with just an Id and a Name. Via the API you can do standard CRUD operations.
| Feature | Description |
|---|---|
| AddListAsync | Add a List to a Board |
| GetListAsync | Get a specific List (Column) based on its Id |
| GetListsOnBoardAsync | Get Lists (Columns) on a Board |
| GetListsOnBoardFilteredAsync | Get Lists on board based on their status |
| UpdateListAsync | Update a List |
| MoveListToBoardAsync | Move an entire list to another board |
| ArchiveListAsync | Archive a List |
| ReOpenListAsync | Reopen a List (Send back to the board) |
Members are the users of Trello, and via the API you can manage invites and access to Boards and Organizations, as well as the assignment of them to Cards
| Feature | Description |
|---|---|
| AddMembersToCardAsync | Add one or more Members to a Card |
| AddMemberToBoardAsync | Add a Member to a board (aka give them access) |
| GetMemberAsync | Get a Member with a specific Id |
| GetMembersOfCardAsync | Get the Members (users) of a Card |
| GetMembersOfBoardAsync | Get the Members (users) of a board |
| GetMembersOfOrganizationAsync | Get the Members (users) of an Organization |
| RemoveMembersFromCardAsync | Remove a Member of a Card |
| RemoveAllMembersFromCardAsync | Remove all Members of a Card |
| RemoveMemberFromBoardAsync | Remove a Member from a board (aka revoke access) |
| InviteMemberToBoardViaEmailAsync | Invite a Member to a board via email (aka give them access) |
| GetTokenMemberAsync | Get information about the Member that owns the token used by this TrelloClient |
Memberships are information about a Member access to a thing (Example: if the Member is Admin or Normal User on a Board). Via the API you can get and update the memberships
| Feature | Description |
|---|---|
| GetMembershipsOfBoardAsync | The Membership Information for a board (aka if Users are Admin, Normal, or Observer) |
| UpdateMembershipTypeOfMemberOnBoardAsync | Change the membership type of a member Member on a board (Example make them Admin) |
Organizations are in Trello called Workspaces but in the API the Organization name is kept to better align with official documentation. The API provides basic CRUD operations
| Feature | Description |
|---|---|
| AddOrganizationAsync | Create a new Organization (Workspace) |
| GetOrganizationAsync | Get an Organization (also known as Workspace) |
| UpdateOrganizationAsync | Update an Organization (Workspace) |
| DeleteOrganizationAsync | Delete a entire Organization including all Boards it contains |
Stickers are visuals you can 'attach' at the top of Cards to indicate something special (for example a warning sticker about something is wrong with the card) or someone did a good/bad job with a thumbs-up/thumbs-down sticker. The API provides operations to add and remove stickers to cards.
| Feature | Description |
|---|---|
| AddStickerToCardAsync | Add a sticker to a card |
| GetStickerAsync | Get a Stickers with a specific Id |
| GetStickersOnCardAsync | Get List of Stickers on a card |
| UpdateStickerAsync | Update a sticker |
| DeleteStickerAsync | Delete a sticker |
Trello has the option to create Webhooks that can, on each Action event you users do on a board, send the information to a Callback URL. The raw API provides CRUD operations for managing these Webhook subscriptions. For the reaction of event see the AutomationEngine system [recommended] and/or the WebhookDataReceiver
| Feature | Description |
|---|---|
| AddWebhookAsync | Add a new Webhook |
| GetWebhooksForCurrentTokenAsync | Get Webhooks linked with the current Token used to authenticate with the API |
| GetWebhookAsync | Get a Webhook from its Id |
| UpdateWebhookAsync | Update a webhook |
| UpdateWebhookByCallbackUrlAsync | Replace callback URL for one or more Webhooks |
| DeleteWebhookAsync | Delete a Webhook |
| DeleteWebhooksByCallbackUrlAsync | Delete Webhooks using indicated Callback URL |
| DeleteWebhooksByTargetModelIdAsync | Delete Webhooks using indicated target ModelId |
If you are looking for info on a specific method in TrelloDotNet then expand the Pages above and input the 'MethodName' (Example: 'AddCardAsync')