Trello+ Datastore
I’ve been looking at Trello lately, and there aren’t a lot of updated modules for it, hence I did some rush work and whipped up a Trello module in a day. I will be making regular updates.
The reason why I made this module is due to the other Trello modules not incorporating Object-Oriented Programming or are using deprecated/unrecommended functions.
Documentation
Module:
– Methods –
TrelloPlus.Connect(string : Key, string : Token) - returns your Trello, fully authorized.
Trello
– Methods –
Trello:GetBoard(string : NameOrID) - Retrieves the matching board instance from your Trello.
Board
– Methods –
Board:GetList(string : NameOrID) - Retrieves the matching List instance from your Board.
Board:CreateList(string : Name) - Creates a new list instance and returns it
List
– Methods –
List:RetrieveCards() - Returns the names of every card as a table.
List:GetCard(string : NameOrID) - Retrieve the matching Card from your board
List:CreateCard(string : Name) - Creates a Card Instance and returns it
– Properties –
Name - Name of List
ID - ID of List
– Events –
List.CardAdded - Fires when a card has been added
List.CardRemoved - Fires when a card has been removed
Note
These events are not reliable, I will be optimizing them soon.
Card
– Methods –
Card:Destroy() - Archives the card
Card:Clone() - Clones the card.
– Properties –
Name - Name of Card
ID - ID of Card
Value - Card Value (Aka description, but encoded)
Description - Card Description (Deprecated, use Card.Value for description)
Code Sample
-- Requires the module --
local TrelloPlus = require(6048117360)
-- [ Trello Part ] --
-- Connect to your Trello --
--[[
How to get your Token and Key.
Key:
Load this into a broswer of your choice - https://trello.com/app-key
You should see a container like "Key: [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]"
Copy your key and paste it into the Connect function below, so it would look like:
TrelloPlus.Connect("KEY HERE", "")
Token:
Return to the previous link - https://trello.com/app-key
Below the key area, ththere should be something like:
"Token:
Most developers will need to ask each user to authorize your application.
If you are looking to build an application for yourself, or are doing local testing,
you can manually generate a Token."
If you look carefully, the word 'Token' at the end is a link. Click it.
You should find yourself in a new webpage. Scroll to the bottom and click "Allow" on the right. Which will redirect you.
Now, you should see a container with red text, Copy it.
Paste the text into the Connect again:
TrelloPlus.Connect("KEY HERE", "TOKEN")
]]
local Trello = TrelloPlus.Connect("", "")
-- Getting the Board --
--[[
Instructions:
You have to create a board with your Trello account first.
You can either use the Name, or its ID.
It will look like this:
local Board = Trello:GetBoard("NAME_OR_ID")
]]
local Board = Trello:GetBoard("")
-- Getting a list --
--[[
Instructions:
If you opened your board on Trello, you'd notice little containers called "Lists". They are like Mini Tables.
Each List has a different Name or ID. You can customize the name.
It will look like this:
local List = Board:GetList("NAME_OR_ID")
By the way, you can change the list name by doing:
List.name = "NAME"
Bonus: You can create a List!
Create it like this:
local List = Board:CreateList("List Name")
]]
local List = Board:GetList("")
-- Getting a card --
--[[
Instructions:
In every list, there are little 'entries' called Cards
Each Card has a different Name or ID. You can customize the name.
It will look like this:
local Card = List:GetCard("NAME_OR_ID")
You can also use "local Names, CardIDs = List:RetrieveCards" to retrieve all card names and IDs in a table (Tuple).
By the way, you can change the list name or description by doing:
Card.name = "NAME"
Card.desc = "Woaaah"
Bonus: You can create a Card!
Create it like this:
local Card = Board:CreateCard("CardName")
]]
local Card = List:GetCard("")
-- By the way, the Card has multiple things you can do. --
--[[
Card:Clone() Clones the card.
Card:Destroy() Removes/Archives the card.
Card.Name Card Name, you can change it by doing: Card.Name = "NewName" because this module uses metatables to detect the new index
Card.id Card id, you can technically change it, but I won't suggest you to try.
Card.Value The value of the card, kinda like a value instance in roblox. You can set it as well.
Card.Description Deprecated. Card Value uses description and automatically encodes the entry for you
]]
Module: