local suc,err=pcall(function()
if game.Players.LocalPlayer~=nil then
warn("It is unsafe to have the api in a local enviorment pleasae move it to ServerScriptService and ONLY use it from Server Scripts!")
end
end)
if not script:IsDescendantOf(game.ServerScriptService) then
warn("It is unsafe to have the api in a local enviorment pleasae move it to ServerScriptService and ONLY use it from Server Scripts!")
end
local Private=true
local addon
local HS={}
function UrlEncode_Not_Like_Roblox(tab)
local ret=""
local c=0
for i,v in next,tab do
ret=ret.."&"..(tostring(i)).."="..(tostring(v));
end
return ret
end
function HS:PostAsync(url,jsonData)
local rhs=game:GetService("HttpService");
local data
local thread=coroutine.create(function(u,j)
local suc,msg=false,"";
repeat
suc,msg=pcall(function()
data=rhs:PostAsync(u,j)
end)
--print(err)
wait(3)
until suc
coroutine.yield(data)
end)
local status,d=coroutine.resume(thread,url,jsonData);
while data==nil do
wait()
end
return data
end
function HS:GetAsync(url,cache)
local rhs=game:GetService("HttpService");
local data
local thread=coroutine.create(function(u,j)
local suc,msg=false,"";
repeat
suc,msg=pcall(function()
data=rhs:GetAsync(u,j)
end)
--print(data)
wait(3)
until suc
coroutine.yield(data)
end)
local status,d=coroutine.resume(thread,url,cache);
while data==nil do
wait()
end
return data
end
function HS:JSONEncode(tab)
local rhs=game:GetService("HttpService");
return rhs:JSONEncode(tab)
end
function HS:JSONDecode(tab)
local rhs=game:GetService("HttpService");
return rhs:JSONDecode(tab)
end
local IS=game:GetService("InsertService")
local T = {}
if script:FindFirstChild("Token")==nil and key=="Here!" and getfenv(0).token==nil then
error("No token or API-KEY available please set one using this link and putting the random numbers and letters into "..script:GetFullName().." or put it in a global variable in the script calling the TrelloAPI named 'token' (ignore the warning you get when creating a script if you do this) \nhttps://trello.com/1/authorize?key=[Your api key is at https://trello.com/app-key]&name=Roblox+Api&expiration=never&response_type=token&scope=read,write")
end --Thanks to iRexBot for Pointing out my Typo!
while script:FindFirstChild("Token")==nil and getfenv(0).token==nil do
wait()
end
local token=script.Token.Value..""
script.Token:Destroy()
function getAddon()
if token~="" then
addon="?key="..key.."&token="..token
elseif getfenv(0).token~=nil then
local val=getfenv(0).token
addon="?key="..key.."&token="..val
else
error([[-Instructions.
1. Go to this link and click allow: https://trello.com/1/authorize?key=[Your api key is at https://trello.com/app-key]&name=Roblox+Api&expiration=never&response_type=token&scope=read,write
2. Copy the token in the page sent to you
3. Paste the token in the Value of Token]])
end
return "&key="..key.."&token="..token
end
--[[
POST /1/cards/[card id or shortlink]/actions/comments
Required permissions: comments
Arguments
text (required)
Valid Values: a string with a length from 1 to 16384
--]]--]]
function T:PostComment(cid,t)
local url
if Private then
getAddon()
url="https://api.trello.com/1/cards/"..tostring(cid).."/actions/comments"..addon
else
url="https://api.trello.com/1/cards/"..tostring(cid).."/actions/comments"..addon
end
local dat={
text=t
}
local data=HS:JSONEncode(dat)
local re=HS:PostAsync(url,data)
local red=HS:JSONDecode(re)
return red
end
--/1/lists/[idList]/cards
--[[
[{
"id": "4eea503791e31d1746000080",
"checkItemStates": [],
"closed": false,
"dateLastActivity": "2011-12-15T19:53:27.228Z",
"desc": "",
"descData": null,
"email": null,
"idAttachmentCover": null,
"idBoard": "",
"idLabels": [],
"idList": "",
"idMembersVoted": [],
"idShort": 3,
"manualCoverAttachment": false,
"name": "Finish my awesome application",
"pos": 65536,
"shortLink": "XlG8S7ll",
"badges": {
"votes": 0,
"viewingMemberVoted": false,
"subscribed": false,
"fogbugz": "",
"checkItems": 0,
"checkItemsChecked": 0,
"comments": 0,
"attachments": 0,
"description": false,
"due": null
},
"due": null,
"idChecklists": [],
"idMembers": [],
"labels": [],
"shortUrl": "",
"subscribed": false,
"url": ""
}
]]--]]--]]--]]
function T:GetCardsInList(lid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/lists/"..tostring(lid).."/cards"..addon
else
getAddon()
url="https://api.trello.com/1/lists/"..tostring(lid).."/cards"..addon
end
local re=HS:GetAsync(url,true)
local dat=HS:JSONDecode(re)
return dat
end
--[[
POST /1/labels
Required permissions: write
Arguments
name (required)
Valid Values: a string with a length from 0 to 16384
color (required)
Valid Values: A valid label color or null
idBoard (required)
Valid Values: An id
--]]--]]
function T:AddLabel(nae,col,boardid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/labels"..addon
else
url="https://api.trello.com/1/labels"..addon
end
local dat={
name=nae,
color=col,
idBoard=boardid
}
local data=HS:JSONEncode(dat)
local re=HS:PostAsync(url,data)
--print(re)
return (HS:JSONDecode(re)).id
end
--[[
GET /1/boards/[board_id]
Required permissions: read
Arguments Show
Examples
https://api.trello.com/1/boards/4eea4ffc91e31d1746000046?lists=open&list_fields=name&fields=name,desc&key=[application_key]&token=[optional_auth_token]
{
"id": "4eea4ffc91e31d1746000046",
"name": "Example Board",
"desc": "This board is used in the API examples",
"lists": [{
"id": "4eea4ffc91e31d174600004a",
"name": "To Do Soon"
}, {
"id": "4eea4ffc91e31d174600004b",
"name": "Doing"
}, {
"id": "4eea4ffc91e31d174600004c",
"name": "Done"
}]
}
--]]--]]
function T:GetBoardNameFromId(id)
getAddon()
local ret=HS:GetAsync("https://api.trello.com/1/boards/"..id..addon,true)
local data=HS:JSONDecode(ret)
return data["name"]
end
--[[
GET /1/tokens/[token]/member
Required permissions: read
Arguments Show]]--]]--
function T:GetAllBoards()
getAddon()
local dat=HS:GetAsync("https://api.trello.com/1/tokens/"..token.."/member"..addon,true)
local data=HS:JSONDecode(dat)
return data["idBoards"]
end
--[[
POST /1/cards/[card id or shortlink]/idLabels
Required permissions: write
Arguments
value (required)
Valid Values: The id of the label to add
--]]--]]
function T:AddCardLabel(card,lid)
local url
local cardi=tostring(card)
if Private then
getAddon()
url="https://api.trello.com/1/cards/"..cardi.."/idLabels"..addon
else
url="https://api.trello.com/1/cards/"..cardi.."/idLabels"..addon
end
--print(card,"IS THE CARD ID \n",lid,"IS THE LABEL ID")
local da={
value=lid
}
local dat=HS:JSONEncode(da)
local data=HS:PostAsync(url,dat)
--print(data)
return HS:JSONDecode(data)
end
--[[
POST /1/boards
Required permissions: write
Arguments
name (required)
Valid Values: a string with a length from 1 to 16384
desc (optional)
Valid Values: a string with a length from 0 to 16384
idOrganization (optional)
Valid Values: The id or name of the organization to add the board to.
idBoardSource (optional)
Valid Values: The id of the board to copy into the new board
keepFromSource (optional)
Default: all
Valid Values: Components of the source board to copy.
powerUps (optional)
Valid Values: all or a comma-separated list of:
calendar
cardAging
recap
voting
prefs_permissionLevel (optional)
Default: private
Valid Values: One of:
org
private
public
prefs_voting (optional)
Default: disabled
Valid Values: One of:
disabled
members
observers
org
public
prefs_comments (optional)
Default: members
Valid Values: One of:
disabled
members
observers
org
public
prefs_invitations (optional)
Default: members
Valid Values: One of:
admins
members
prefs_selfJoin (optional)
Default: true
Valid Values:
true
false
prefs_cardCovers (optional)
Default: true
Valid Values:
true
false
prefs_background (optional)
Default: blue
Valid Values: a string with a length from 0 to 16384
prefs_cardAging (optional)
Default: regular
Valid Values: One of:
pirate
regular
--]]--]]
function T:AddBoard(nae,dec)
local url
if Private then
getAddon()
url="https://api.trello.com/1/boards"..addon
else
getAddon()
url="https://api.trello.com/1/boards"..addon
end
local dat={
name=nae,
desc=dec
}
local data=HS:JSONEncode(dat)
local re=HS:PostAsync(url,data)
local red=HS:JSONDecode(re)
return red
end
function T:GetCardID(name,boardid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/cards"..addon
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/cards"..addon
end
local tab=HS:GetAsync(url,true)
local tabl=HS:JSONDecode(tab)
for k,ta in pairs(tabl) do
for p,t in pairs(ta) do
if p=="name" and t==name then
return ta.id
end
end
end
end
function T:GetCardInfo(cardid)
--/1/boards/[board_id]/cards/[idCard]
local url
if Private then
getAddon()
url="https://api.trello.com/1/cards/"..cardid..""..addon
else
getAddon()
url="https://api.trello.com/1/cards/"..cardid..""..addon
end
local re=HS:GetAsync(url,true)
local tab=HS:JSONDecode(re)
return tab
end
function T:GetBoardInfo(boardid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."?lists=all&cards=all&card_checklists=all&labels=all&memberships=all&members=all&membersInvited=all&checklists=all&organization_memberships=all&fields=all"..getAddon()
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."?lists=all&cards=all&card_checklists=all&labels=all&memberships=all&members=all&membersInvited=all&checklists=all&organization_memberships=all&fields=all"..getAddon()
end
local re=HS:GetAsync(url,true)
local data=HS:JSONDecode(re)
return data
end
function T:GetLists(boardid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/lists"..addon
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/lists"..addon
end
local re=HS:GetAsync(url,true)
local data=HS:JSONDecode(re)
return data
end
function T:GetMemberBoards(name)
local url
if Private then
getAddon()
url="https://api.trello.com/1/members/"..name.."/boards"..addon
else
getAddon()
url="https://api.trello.com/1/members/"..name.."/boards"..addon
end
local re=HS:GetAsync(url,true)
local data=HS:JSONDecode(re)
return data
end
function T:GetBoardMembers(boardid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/members"..addon
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/members"..addon
end
local re=HS:GetAsync(url,true)
local data=HS:JSONDecode(re)
return data
end
--[[
POST /1/boards
Required permissions: write
Arguments Hide
name (required)
Valid Values: a string with a length from 1 to 16384
desc (optional)
Valid Values: a string with a length from 0 to 16384
idOrganization (optional)
Valid Values: The id or name of the organization to add the board to.
idBoardSource (optional)
Valid Values: The id of the board to copy into the new board
keepFromSource (optional)
Default: all
Valid Values: Components of the source board to copy.
powerUps (optional)
Valid Values: all or a comma-separated list of:
calendar
cardAging
recap
voting
prefs_permissionLevel (optional)
Default: private
Valid Values: One of:
org
private
public
prefs_voting (optional)
Default: disabled
Valid Values: One of:
disabled
members
observers
org
public
prefs_comments (optional)
Default: members
Valid Values: One of:
disabled
members
observers
org
public
prefs_invitations (optional)
Default: members
Valid Values: One of:
admins
members
prefs_selfJoin (optional)
Default: true
Valid Values:
true
false
prefs_cardCovers (optional)
Default: true
Valid Values:
true
false
prefs_background (optional)
Default: blue
Valid Values: a string with a length from 0 to 16384
prefs_cardAging (optional)
Default: regular
Valid Values: One of:
pirate
regular
]]--]]
function T:CreateBoard(nam,...)
local opt={...}
local tab={
name=nam
}
for i,v in next,opt do
local arg="none"
if i==1 then
tab["desc"]=v
elseif i==2 then
tab["prefs_permissionLevel"]=v
end
end
local tabl=HS:JSONEncode(tab)
local ret=HS:PostAsync("https://api.trello.com/1/boards",tabl)
return HS:JSONDecode(ret)
end
function T:GetBoardID(name)
local url
if Private then
getAddon()
url="https://api.trello.com/1/members/me/boards"..addon
else
getAddon()
url="https://api.trello.com/1/members/me/boards"..addon
end
local tball=HS:GetAsync(url,true)
local dt=HS:JSONDecode(tball)
for _,tab in pairs(dt) do
for p,it in pairs(tab) do
if p=="name" and it==name then
return tab.id
end
end
end
error(name.." not found!")
return nil
end
--[[
POST /1/cards
Required permissions: write
Arguments
name (optional)
Valid Values: The name of the new card. It isn't required if the name is being copied from provided by a URL, file or card that is being copied.
desc (optional)
Valid Values: a string with a length from 0 to 16384
pos (optional)
Default: bottom
Valid Values: A position. top, bottom, or a positive number.
due (required)
Valid Values: A date, or null
labels (optional)
Valid Values: all or a comma-separated list of:
blue
green
orange
purple
red
yellow
idList (required)
Valid Values: id of the list that the card should be added to
idMembers (optional)
Valid Values: A comma-separated list of objectIds, 24-character hex strings
idLabels (optional)
Valid Values: A comma-separated list of objectIds, 24-character hex strings
urlSource (required)
Valid Values: A URL starting with http:// or https:// or null
fileSource (optional)
Valid Values: A file
idCardSource (optional)
Valid Values: The id of the card to copy into a new card.
keepFromSource (optional)
Default: all
Valid Values: Properties of the card to copy over from the source.
--]]--]]
function T:AddCard(...)
local url
local args={...}
local dat=nil
if #args==3 then
local nam,des,lid=args[1],args[2],args[3]
dat={
name=nam,
desc=des.."",
idList=lid,
urlSource=nil,
due=nil
}
elseif #args==4 then
local nam,des,lid,url=args[1],args[2],args[3],args[4]
dat={
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
due=nil
}
elseif #args==5 then
local nam,des,lid,url,po=args[1],args[2],args[3],args[4],args[5]
dat={
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=nil
}
elseif #args==6 then
local nam,des,lid,url,po,de=args[1],args[2],args[3],args[4],args[5],args[6]
dat={
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=de
}
elseif #args==7 then
local nam,des,lid,url,po,de,label=args[1],args[2],args[3],args[4],args[5],args[6],args[7]
dat={
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=de,
labels=label
}
elseif #args==8 then
local nam,des,lid,url,po,de,label,cc=args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]
dat={
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=de,
labels=label,
idCardSource=cc
}
end
local data
if dat~= nil then
data=HS:JSONEncode(dat)
else
error("No Parameters Found!")
return false
end
if Private then
getAddon()
url="https://api.trello.com/1/cards"..addon
else
getAddon()
url="https://api.trello.com/1/cards"..addon
end
local re=HS:PostAsync(url,data)
return HS:JSONDecode(re)
end
--[[
POST /1/cards
Required permissions: write
Arguments
name (optional)
Valid Values: The name of the new card. It isn't required if the name is being copied from provided by a URL, file or card that is being copied.
desc (optional)
Valid Values: a string with a length from 0 to 16384
pos (optional)
Default: bottom
Valid Values: A position. top, bottom, or a positive number.
due (required)
Valid Values: A date, or null
labels (optional)
Valid Values: all or a comma-separated list of:
blue
green
orange
purple
red
yellow
idList (required)
Valid Values: id of the list that the card should be added to
idMembers (optional)
Valid Values: A comma-separated list of objectIds, 24-character hex strings
idLabels (optional)
Valid Values: A comma-separated list of objectIds, 24-character hex strings
urlSource (required)
Valid Values: A URL starting with http:// or https:// or null
fileSource (optional)
Valid Values: A file
idCardSource (optional)
Valid Values: The id of the card to copy into a new card.
keepFromSource (optional)
Default: all
Valid Values: Properties of the card to copy over from the source.
--]]--]]
function AddCustomCard(array, ListID)
if array["due"]==nil then
array["due"]=nil
end
if array["urlSource"]==nil then
array["urlSource"]=nil
end
array["idList"]=ListID
getAddon()
local ret=HS:PostAsync("https://api.trello.com/1/cards"..addon, HS:JSONEncode(array))
local data=HS:JSONDecode(ret)
return data
end
--[[
POST /1/cards/[card id or shortlink]/attachments
Required permissions: write
Arguments
file (optional)
Valid Values: A file
url (optional)
Valid Values: A URL starting with http:// or https:// or null
name (optional)
Valid Values: a string with a length from 0 to 256
mimeType (optional)
Valid Values: a string with a length from 0 to 256
--]]--]]
function T:AddCardAtt(cardid,nae,type,value)
local url
local dat
if string.lower(type)=="file" then
dat={
name=nae,
file=value
}
elseif string.lower(type)=="url" then
dat={
name=nae,
url=value
}
elseif string.lower(type)=="mime" then
dat={
name=nae,
mimeType=value
}
end
local cardi=tostring(cardid)
if Private then
getAddon()
url="https://api.trello.com/1/cards/"..cardi.."/attachments"..addon
else
getAddon()
url="https://api.trello.com/1/cards/"..cardi.."/attachments"..addon
end
local data=HS:JSONEncode(dat)
local re=HS:PostAsync(url,data)
return re
end
--[[
GET /1/boards/[board_id]/labels
Required permissions: read
Arguments
fields (optional)
Default: all
Valid Values: all or a comma-separated list of:
color
idBoard
name
uses
limit (optional)
Default: 50
Valid Values: a number from 0 to 1000
--]]--]]
function T:GetLabels(boardid)
local url
local dat
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/labels"..addon
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/labels"..addon
end
local re=HS:GetAsync(url,true)
--print(re)
local dat=HS:JSONDecode(re)
return dat
end
--[[
GET /1/boards/[board_id]/labels
Required permissions: read
Arguments
fields (optional)
Default: all
Valid Values: all or a comma-separated list of:
color
idBoard
name
uses
limit (optional)
Default: 50
Valid Values: a number from 0 to 1000
--]]--]]
function T:GetLabelID(LabelName,boardid)
local url
local dat
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/labels"..addon
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/labels"..addon
end
local re=HS:GetAsync(url,true)
--print(re)
local dat=HS:JSONDecode(re)
local id
for i,v in next,dat do
if v.name==LabelName then
id=v.id
break
end
end
return id
end
--[[
GET /1/boards/[board_id]/lists
Required permissions: read
Arguments
cards (optional)
Default: none
Valid Values: One of:
all
closed
none
open
visible
card_fields (optional)
Default: all
Valid Values: all or a comma-separated list of:
badges
checkItemStates
closed
dateLastActivity
desc
descData
due
email
idAttachmentCover
idBoard
idChecklists
idLabels
idList
idMembers
idMembersVoted
idShort
labels
manualCoverAttachment
name
pos
shortLink
shortUrl
subscribed
url
filter (optional)
Default: open
Valid Values: One of:
all
closed
none
open
fields (optional)
Default: all
Valid Values: all or a comma-separated list of:
closed
idBoard
name
pos
subscribed
--]]--]]
function T:GetListID(name,boardid)
local url
if Private then
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/lists"..addon
else
getAddon()
url="https://api.trello.com/1/boards/"..boardid.."/lists"..addon
end
local tab=HS:GetAsync(url,true)
local tabl=HS:JSONDecode(tab)
for k,ta in pairs(tabl) do
for p,t in pairs(ta) do
if p=="name" and t==name then
return ta.id
end
end
end
end
--[[
POST /1/lists
Required permissions: write
Arguments
name (required)
Valid Values: a string with a length from 1 to 16384
idBoard (required)
Valid Values: id of the board that the list should be added to
idListSource (optional)
Valid Values: The id of the list to copy into a new list.
pos (optional)
Default: top
Valid Values: A position. top, bottom, or a positive number.
--]]--]]
function T:AddList(...)
local args={...}
local nam,boid,idsource,po
local url
local dat
if #args==2 then
nam,boid=args[1],args[2]
dat={name=nam,idBoard=boid}
elseif #args==3 then
nam,boid,idsource=args[1],args[2],args[3]
dat={name=nam,idBoard=boid,idListSource=idsource}
elseif #args==4 then
nam,boid,idsource,po=args[1],args[2],args[3],args[4]
dat={name=nam,idBoard=boid,idListSource=idsource,pos=po}
else
error("Invalid arguments: "..table.concat(args,","))
end
--
if Private then
getAddon()
url="https://api.trello.com/1/lists"..addon
else
getAddon()
url="https://api.trello.com/1/lists"..addon
end
local data=HS:JSONEncode(dat)
local re=HS:PostAsync(url,data)
return re.id
end
--[[
EXAMPLE:
function cardAdded(card)
print(card.name)
end
local api=require(script.Parent.TrelloAPI)
local boardid=api:GetBoardID("TestBoard")--The board id is different from the link you see when you go to a board
local listid=api:GetListID("Testing",boardid)
api.CardAdded(listid):connect(cardAdded)
--]]
function T.CardAdded(ListID,RefreshTimeInSecs,initialIteration)
if RefreshTimeInSecs==nil or RefreshTimeInSecs<30 then
RefreshTimeInSecs=30
end
if initialIteration==nil then
initialIteration=false
end
local Hook={}
local callbackEnded=false
local previousTable={}
if not initialIteration then
previousTable=T:GetCardsInList(ListID)
end
local function refreshCallback(callback)
local newTable=T:GetCardsInList(ListID)
if (#newTable>#previousTable) then
for _,i in next,newTable do
local found=false
for _,v in next,previousTable do
if (v.id==i.id) then
found=true
end
end
if (not found) then
callback(i,ListID)
end
end
end
previousTable=newTable
end
local thread=nil
function Hook:connect(callback)
thread=coroutine.wrap(function(callbackEndedNested,callbackNested)
while ((not callbackEndedNested)) do
local suc,msg = false,""
repeat
suc,msg=pcall(refreshCallback,callbackNested)
until suc
wait(RefreshTimeInSecs)
end
end)
thread(callbackEnded,callback)
end
function Hook:disconnect()
callbackEnded=true
thread(callbackEnded,function()end)
end
return Hook
end
--[[
function cardRemoved(card)
print(card.name)
end
local api=require(script.Parent.TrelloAPI)
local boardid=api:GetBoardID("TestBoard")--The board id is different from the link you see when you go to a board
local listid=api:GetListID("Testing",boardid)
api.CardRemoved(listid):connect(cardRemoved)
--]]
function T.CardRemoved(ListID,RefreshTimeInSecs,initialIteration)
if RefreshTimeInSecs==nil or RefreshTimeInSecs<30 then
RefreshTimeInSecs=30
end
if initialIteration==nil then
initialIteration=false
end
local Hook={}
local callbackEnded=false
local previousTable={}
if not initialIteration then
previousTable=T:GetCardsInList(ListID)
end
local function refreshCallback(callback)
local newTable=T:GetCardsInList(ListID)
if (#newTable<#previousTable) then
for _,i in next,newTable do
local found=false
for _,v in next,previousTable do
if (v.id==i.id) then
found=true
end
end
if (not found) then
callback(i,ListID)
end
end
end
previousTable=newTable
end
local thread=nil
function Hook:connect(callback)
thread=coroutine.wrap(function(callbackEndedNested,callbackNested)
while ((not callbackEndedNested)) do
local suc,msg = false,""
repeat
suc,msg=pcall(refreshCallback,callbackNested)
until suc
wait(RefreshTimeInSecs)
end
end)
thread(callbackEnded,callback)
end
function Hook:disconnect()
callbackEnded=true
thread(callbackEnded,function()end)
end
return Hook
end
--[[
GET: DeleteCard
PARAMS: cardid, app, token
CREDITS TO: sloss2003 (https://github.com/mwalden2004)
--]]
function T:DeleteCard(cid)
local thing
local cardid = "";
if type(cid)=="table" then
cardid=cid.id;
thing = "?cardid="..cid.id.."&token="..token.."&key="..key
else
cardid=cid;
thing = "?cardid="..cid.."&token="..token.."&key="..key
end
print(thing)
local send = game:GetService("HttpService"):RequestAsync({Url = "https://api.trello.com/1/cards/"..cardid..thing, Method="DELETE"})
print(send.Body)
return(send)
end
--[[
GET: EditCard
PARAMS: cardid token app name desc
CREDITS TO: sloss2003 (https://github.com/mwalden2004)
--]]
function T:EditCard(...)
local url
local args={...}
local dat=nil;
local cid = args[1];
if #args==3 then
local cid,nam,des,lid=args[1],args[2],args[3]
dat={
cardid=cid,
name=nam,
desc=des.."",
idList=lid,
urlSource=nil,
due=nil
}
elseif #args==4 then
local cid,nam,des,lid,url=args[1],args[2],args[3],args[4]
dat={
cardid=cid,
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
due=nil
}
elseif #args==5 then
local cid,nam,des,lid,url,po=args[1],args[2],args[3],args[4],args[5]
dat={
cardid=cid,
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=nil
}
elseif #args==6 then
local cid,nam,des,lid,url,po,de=args[1],args[2],args[3],args[4],args[5],args[6]
dat={
cardid=cid,
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=de
}
elseif #args==7 then
local cid,nam,des,lid,url,po,de,label=args[1],args[2],args[3],args[4],args[5],args[6],args[7]
dat={
cardid=cid,
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=de,
labels=label
}
elseif #args==8 then
local cid,nam,des,lid,url,po,de,label,cc=args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]
dat={
cardid=cid,
name=nam,
desc=""..des,
idList=lid,
urlSource=url,
pos=po,
due=de,
labels=label,
idCardSource=cc
}
end
local data
if dat~= nil then
data=UrlEncode_Not_Like_Roblox(dat)
else
error("No Parameters Found!")
return false
end
if typeof(cid) == "table" then
cid=cid.id;
end
if Private then
getAddon()
url="https://api.trello.com/1/cards/"..cid.."?key="..key.."&token="..token..data
else
getAddon()
url="https://api.trello.com/1/cards/"..cid..addon..data
end
local re=game:GetService("HttpService"):RequestAsync({Url = url, Method="PUT"})
return HS:JSONDecode(re.Body)
end
return T