· 6 years ago · Apr 11, 2020, 10:58 PM
1local _b="bd7db9f44a77d386f2cb31ee1f8d35d4"
2local ab,bb=pcall(function()
3if
4game.Players.LocalPlayer~=nil then
5warn("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)
6if
7not script:IsDescendantOf(game.ServerScriptService)then
8warn("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 cb=true;local db;local _c={}
9function UrlEncode_Not_Like_Roblox(dc)local _d=""local ad=0;for bd,cd in next,dc do
10_d=_d.."&".. (tostring(bd)).."="..
11(tostring(cd))end;return _d end
12function _c:PostAsync(dc,_d)local ad=game:GetService("HttpService")local bd
13local cd=coroutine.create(function(a_a,b_a)
14local c_a,d_a=false,""repeat
15c_a,d_a=pcall(function()bd=ad:PostAsync(a_a,b_a)end)wait(3)until c_a
16coroutine.yield(bd)end)local dd,__a=coroutine.resume(cd,dc,_d)while bd==nil do wait()end;return
17bd end
18function _c:GetAsync(dc,_d)local ad=game:GetService("HttpService")local bd
19local cd=coroutine.create(function(a_a,b_a)
20local c_a,d_a=false,""repeat
21c_a,d_a=pcall(function()bd=ad:GetAsync(a_a,b_a)end)wait(3)until c_a
22coroutine.yield(bd)end)local dd,__a=coroutine.resume(cd,dc,_d)while bd==nil do wait()end;return
23bd end;function _c:JSONEncode(dc)local _d=game:GetService("HttpService")
24return _d:JSONEncode(dc)end
25function _c:JSONDecode(dc)
26local _d=game:GetService("HttpService")return _d:JSONDecode(dc)end;local ac=game:GetService("InsertService")local bc={}
27local cc="d06eea0a9d426a1ccdfbc660353646d7778a3a9eaf7e236b64da05dff551295d"
28function getAddon()
29if cc~=""then db="?key=".._b.."&token="..cc elseif
30getfenv(0).token~=nil then local dc=getfenv(0).token
31db="?key=".._b.."&token="..dc else
32error([[-Instructions.
33 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
34 2. Copy the token in the page sent to you
35 3. Paste the token in the Value of Token]])end;return"&key=".._b.."&token="..cc end
36function bc:PostComment(dc,_d)local ad
37if cb then getAddon()
38ad="https://api.trello.com/1/cards/"..tostring(dc)..
39"/actions/comments"..db else
40ad="https://api.trello.com/1/cards/"..tostring(dc).."/actions/comments"..db end;local bd={text=_d}local cd=_c:JSONEncode(bd)
41local dd=_c:PostAsync(ad,cd)local __a=_c:JSONDecode(dd)return __a end
42function bc:GetCardsInList(dc)local _d
43if cb then getAddon()_d="https://api.trello.com/1/lists/"..
44tostring(dc).."/cards"..db else
45getAddon()
46_d="https://api.trello.com/1/lists/"..tostring(dc).."/cards"..db end;local ad=_c:GetAsync(_d,true)local bd=_c:JSONDecode(ad)return bd end
47function bc:AddLabel(dc,_d,ad)local bd
48if cb then getAddon()
49bd="https://api.trello.com/1/labels"..db else bd="https://api.trello.com/1/labels"..db end;local cd={name=dc,color=_d,idBoard=ad}local dd=_c:JSONEncode(cd)
50local __a=_c:PostAsync(bd,dd)return(_c:JSONDecode(__a)).id end
51function bc:GetBoardNameFromId(dc)getAddon()
52local _d=_c:GetAsync("https://api.trello.com/1/boards/"..dc..db,true)local ad=_c:JSONDecode(_d)return ad["name"]end
53function bc:GetAllBoards()getAddon()
54local dc=_c:GetAsync("https://api.trello.com/1/tokens/"..cc.."/member"..db,true)local _d=_c:JSONDecode(dc)return _d["idBoards"]end
55function bc:AddCardLabel(dc,_d)local ad;local bd=tostring(dc)if cb then getAddon()ad="https://api.trello.com/1/cards/"..bd..
56"/idLabels"..db else
57ad=
58"https://api.trello.com/1/cards/"..bd.."/idLabels"..db end
59local cd={value=_d}local dd=_c:JSONEncode(cd)local __a=_c:PostAsync(ad,dd)return
60_c:JSONDecode(__a)end
61function bc:AddBoard(dc,_d)local ad
62if cb then getAddon()
63ad="https://api.trello.com/1/boards"..db else getAddon()ad="https://api.trello.com/1/boards"..db end;local bd={name=dc,desc=_d}local cd=_c:JSONEncode(bd)
64local dd=_c:PostAsync(ad,cd)local __a=_c:JSONDecode(dd)return __a end
65function bc:GetCardID(dc,_d)local ad
66if cb then getAddon()
67ad="https://api.trello.com/1/boards/".._d.."/cards"..db else getAddon()
68ad="https://api.trello.com/1/boards/".._d.."/cards"..db end;local bd=_c:GetAsync(ad,true)local cd=_c:JSONDecode(bd)for dd,__a in pairs(cd)do
69for a_a,b_a in
70pairs(__a)do if a_a=="name"and b_a==dc then return __a.id end end end end
71function bc:GetCardInfo(dc)local _d;if cb then getAddon()
72_d="https://api.trello.com/1/cards/"..dc..""..db else getAddon()
73_d="https://api.trello.com/1/cards/"..dc..""..db end
74local ad=_c:GetAsync(_d,true)local bd=_c:JSONDecode(ad)return bd end
75function bc:GetBoardInfo(dc)local _d
76if cb then getAddon()
77_d="https://api.trello.com/1/boards/"..
78dc..
79
80"?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()
81_d="https://api.trello.com/1/boards/"..
82dc..
83
84"?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 ad=_c:GetAsync(_d,true)local bd=_c:JSONDecode(ad)return bd end
85function bc:GetLists(dc)local _d
86if cb then getAddon()
87_d="https://api.trello.com/1/boards/"..dc.."/lists"..db else getAddon()
88_d="https://api.trello.com/1/boards/"..dc.."/lists"..db end;local ad=_c:GetAsync(_d,true)local bd=_c:JSONDecode(ad)return bd end
89function bc:GetMemberBoards(dc)local _d
90if cb then getAddon()
91_d="https://api.trello.com/1/members/"..dc.."/boards"..db else getAddon()
92_d="https://api.trello.com/1/members/"..dc.."/boards"..db end;local ad=_c:GetAsync(_d,true)local bd=_c:JSONDecode(ad)return bd end
93function bc:GetBoardMembers(dc)local _d
94if cb then getAddon()
95_d="https://api.trello.com/1/boards/"..dc.."/members"..db else getAddon()
96_d="https://api.trello.com/1/boards/"..dc.."/members"..db end;local ad=_c:GetAsync(_d,true)local bd=_c:JSONDecode(ad)return bd end
97function bc:CreateBoard(dc,...)local _d={...}local ad={name=dc}
98for dd,__a in next,_d do local a_a="none"if dd==1 then ad["desc"]=__a elseif dd==2 then
99ad["prefs_permissionLevel"]=__a end end;local bd=_c:JSONEncode(ad)
100local cd=_c:PostAsync("https://api.trello.com/1/boards",bd)return _c:JSONDecode(cd)end
101function bc:GetBoardID(dc)local _d;if cb then getAddon()
102_d="https://api.trello.com/1/members/me/boards"..db else getAddon()
103_d="https://api.trello.com/1/members/me/boards"..db end
104local ad=_c:GetAsync(_d,true)local bd=_c:JSONDecode(ad)
105for cd,dd in pairs(bd)do for __a,a_a in pairs(dd)do if __a=="name"and a_a==dc then return
106dd.id end end end;error(dc.." not found!")return nil end
107function bc:AddCard(...)local dc;local _d={...}local ad=nil
108if#_d==3 then local dd,__a,a_a=_d[1],_d[2],_d[3]
109ad={name=dd,desc=__a.."",idList=a_a,urlSource=nil,due=nil}elseif#_d==4 then local dd,__a,a_a,b_a=_d[1],_d[2],_d[3],_d[4]
110ad={name=dd,desc=""..__a,idList=a_a,urlSource=b_a,due=nil}elseif#_d==5 then local dd,__a,a_a,b_a,c_a=_d[1],_d[2],_d[3],_d[4],_d[5]
111ad={name=dd,desc=""..__a,idList=a_a,urlSource=b_a,pos=c_a,due=nil}elseif#_d==6 then local dd,__a,a_a,b_a,c_a,d_a=_d[1],_d[2],_d[3],_d[4],_d[5],_d[6]
112ad={name=dd,desc=""..__a,idList=a_a,urlSource=b_a,pos=c_a,due=d_a}elseif#_d==7 then local dd,__a,a_a,b_a,c_a,d_a,_aa=_d[1],_d[2],_d[3],_d[4],_d[5],_d[6],_d[7]
113ad={name=dd,desc=""..
114__a,idList=a_a,urlSource=b_a,pos=c_a,due=d_a,labels=_aa}elseif#_d==8 then
115local dd,__a,a_a,b_a,c_a,d_a,_aa,aaa=_d[1],_d[2],_d[3],_d[4],_d[5],_d[6],_d[7],_d[8]
116ad={name=dd,desc=""..__a,idList=a_a,urlSource=b_a,pos=c_a,due=d_a,labels=_aa,idCardSource=aaa}end;local bd;if ad~=nil then bd=_c:JSONEncode(ad)else
117error("No Parameters Found!")return false end;if cb then getAddon()dc=
118"https://api.trello.com/1/cards"..db else getAddon()
119dc="https://api.trello.com/1/cards"..db end
120local cd=_c:PostAsync(dc,bd)return _c:JSONDecode(cd)end
121function AddCustomCard(dc,_d)if dc["due"]==nil then dc["due"]=nil end;if
122dc["urlSource"]==nil then dc["urlSource"]=nil end;dc["idList"]=_d
123getAddon()
124local ad=_c:PostAsync("https://api.trello.com/1/cards"..db,_c:JSONEncode(dc))local bd=_c:JSONDecode(ad)return bd end
125function bc:AddCardAtt(dc,_d,ad,bd)local cd;local dd
126if string.lower(ad)=="file"then dd={name=_d,file=bd}elseif
127string.lower(ad)=="url"then dd={name=_d,url=bd}elseif string.lower(ad)=="mime"then
128dd={name=_d,mimeType=bd}end;local __a=tostring(dc)
129if cb then getAddon()cd="https://api.trello.com/1/cards/"..
130__a.."/attachments"..db else getAddon()
131cd=
132"https://api.trello.com/1/cards/"..__a.."/attachments"..db end;local a_a=_c:JSONEncode(dd)local b_a=_c:PostAsync(cd,a_a)return b_a end
133function bc:GetLabels(dc)local _d;local ad
134if cb then getAddon()
135_d="https://api.trello.com/1/boards/"..dc.."/labels"..db else getAddon()
136_d="https://api.trello.com/1/boards/"..dc.."/labels"..db end;local bd=_c:GetAsync(_d,true)local cd=_c:JSONDecode(bd)return cd end
137function bc:GetLabelID(dc,_d)local ad;local bd
138if cb then getAddon()
139ad="https://api.trello.com/1/boards/".._d.."/labels"..db else getAddon()
140ad="https://api.trello.com/1/boards/".._d.."/labels"..db end;local cd=_c:GetAsync(ad,true)local dd=_c:JSONDecode(cd)local __a
141for a_a,b_a in next,dd do if
142b_a.name==dc then __a=b_a.id;break end end;return __a end
143function bc:GetListID(dc,_d)local ad
144if cb then getAddon()
145ad="https://api.trello.com/1/boards/".._d.."/lists"..db else getAddon()
146ad="https://api.trello.com/1/boards/".._d.."/lists"..db end;local bd=_c:GetAsync(ad,true)local cd=_c:JSONDecode(bd)for dd,__a in pairs(cd)do
147for a_a,b_a in
148pairs(__a)do if a_a=="name"and b_a==dc then return __a.id end end end end
149function bc:AddList(...)local dc={...}local _d,ad,bd,cd;local dd;local __a
150if#dc==2 then _d,ad=dc[1],dc[2]
151__a={name=_d,idBoard=ad}elseif#dc==3 then _d,ad,bd=dc[1],dc[2],dc[3]
152__a={name=_d,idBoard=ad,idListSource=bd}elseif#dc==4 then _d,ad,bd,cd=dc[1],dc[2],dc[3],dc[4]
153__a={name=_d,idBoard=ad,idListSource=bd,pos=cd}else
154error("Invalid arguments: "..table.concat(dc,","))end
155if cb then getAddon()dd="https://api.trello.com/1/lists"..db else
156getAddon()dd="https://api.trello.com/1/lists"..db end;local a_a=_c:JSONEncode(__a)local b_a=_c:PostAsync(dd,a_a)
157return b_a.id end
158function bc.CardAdded(dc,_d,ad)if _d==nil or _d<30 then _d=30 end;if ad==nil then ad=false end
159local bd={}local cd=false;local dd={}if not ad then dd=bc:GetCardsInList(dc)end
160local function __a(b_a)
161local c_a=bc:GetCardsInList(dc)
162if(#c_a>#dd)then
163for d_a,_aa in next,c_a do local aaa=false
164for baa,caa in next,dd do if(caa.id==_aa.id)then aaa=true end end;if(not aaa)then b_a(_aa,dc)end end end;dd=c_a end;local a_a=nil
165function bd:connect(b_a)
166a_a=coroutine.wrap(function(c_a,d_a)
167while((not c_a))do local _aa,aaa=false,""repeat _aa,aaa=pcall(__a,d_a)until
168_aa;wait(_d)end end)a_a(cd,b_a)end;function bd:disconnect()cd=true;a_a(cd,function()end)end
169return bd end
170function bc.CardRemoved(dc,_d,ad)if _d==nil or _d<30 then _d=30 end
171if ad==nil then ad=false end;local bd={}local cd=false;local dd={}
172if not ad then dd=bc:GetCardsInList(dc)end
173local function __a(b_a)local c_a=bc:GetCardsInList(dc)
174if(#c_a<#dd)then
175for d_a,_aa in next,c_a do local aaa=false;for baa,caa in next,dd do if
176(caa.id==_aa.id)then aaa=true end end;if(not aaa)then
177b_a(_aa,dc)end end end;dd=c_a end;local a_a=nil
178function bd:connect(b_a)
179a_a=coroutine.wrap(function(c_a,d_a)
180while((not c_a))do local _aa,aaa=false,""repeat _aa,aaa=pcall(__a,d_a)until
181_aa;wait(_d)end end)a_a(cd,b_a)end;function bd:disconnect()cd=true;a_a(cd,function()end)end
182return bd end
183function bc:DeleteCard(dc)local _d;local ad=""if type(dc)=="table"then ad=dc.id
184_d="?cardid="..dc.id.."&token="..
185cc.."&key=".._b else ad=dc
186_d="?cardid="..dc.."&token="..cc.."&key=".._b end
187print(_d)
188local bd=game:GetService("HttpService"):RequestAsync({Url="https://api.trello.com/1/cards/"..ad.._d,Method="DELETE"})print(bd.Body)return(bd)end
189function bc:EditCard(...)local dc;local _d={...}local ad=nil;local bd=_d[1]
190if#_d==3 then
191local __a,a_a,b_a,c_a=_d[1],_d[2],_d[3]
192ad={cardid=__a,name=a_a,desc=b_a.."",idList=c_a,urlSource=nil,due=nil}elseif#_d==4 then local __a,a_a,b_a,c_a,d_a=_d[1],_d[2],_d[3],_d[4]
193ad={cardid=__a,name=a_a,desc=""..b_a,idList=c_a,urlSource=d_a,due=nil}elseif#_d==5 then local __a,a_a,b_a,c_a,d_a,_aa=_d[1],_d[2],_d[3],_d[4],_d[5]
194ad={cardid=__a,name=a_a,desc=""..b_a,idList=c_a,urlSource=d_a,pos=_aa,due=nil}elseif#_d==6 then local __a,a_a,b_a,c_a,d_a,_aa,aaa=_d[1],_d[2],_d[3],_d[4],_d[5],_d[6]
195ad={cardid=__a,name=a_a,desc=""..b_a,idList=c_a,urlSource=d_a,pos=_aa,due=aaa}elseif#_d==7 then local __a,a_a,b_a,c_a,d_a,_aa,aaa,baa=_d[1],_d[2],_d[3],_d[4],_d[5],_d[6],_d[7]
196ad={cardid=__a,name=a_a,desc=
197""..b_a,idList=c_a,urlSource=d_a,pos=_aa,due=aaa,labels=baa}elseif#_d==8 then
198local __a,a_a,b_a,c_a,d_a,_aa,aaa,baa,caa=_d[1],_d[2],_d[3],_d[4],_d[5],_d[6],_d[7],_d[8]
199ad={cardid=__a,name=a_a,desc=""..b_a,idList=c_a,urlSource=d_a,pos=_aa,due=aaa,labels=baa,idCardSource=caa}end;local cd;if ad~=nil then cd=UrlEncode_Not_Like_Roblox(ad)else
200error("No Parameters Found!")return false end;if
201typeof(bd)=="table"then bd=bd.id end
202if cb then getAddon()
203dc="https://api.trello.com/1/cards/"..bd.."?key=".._b.."&token="..
204cc..cd else getAddon()
205dc="https://api.trello.com/1/cards/"..bd..db..cd end
206local dd=game:GetService("HttpService"):RequestAsync({Url=dc,Method="PUT"})return _c:JSONDecode(dd.Body)end;return bc