Skip to content

Commit

Permalink
new function
Browse files Browse the repository at this point in the history
  • Loading branch information
HypheX authored Feb 7, 2019
1 parent f367a02 commit d7771a7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Trello/Constructors/Card.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local Card = {}
local HTTP = game:GetService("HttpService")
local auth = require(script.Parent.Parent.auth)

Card.new = function(data, BoardCon, ListCon, CardCon)
Card.new = function(data, BoardCon, ListCon, CardCon, LabelCon)
local Ret
if data.id == nil then
local purl = "https://api.trello.com/1/cards/"..auth
Expand All @@ -27,10 +27,10 @@ Card.new = function(data, BoardCon, ListCon, CardCon)
return FixedId
end

function NewCard:GetData()
function NewCard:GetData(suff)
local JSON
pcall(function()
JSON = HTTP:GetAsync("https://api.trello.com/1/cards/"..self:GetId()..auth)
JSON = HTTP:GetAsync("https://api.trello.com/1/cards/"..self:GetId()..(suff or "")..auth)
end)
return (HTTP:JSONDecode(JSON))
end
Expand All @@ -40,11 +40,19 @@ Card.new = function(data, BoardCon, ListCon, CardCon)
end

function NewCard:GetBoard()
return (BoardCon.new({id = self:GetData().idBoard}))
return (BoardCon.new({id = self:GetData().idBoard}, BoardCon, ListCon, CardCon, LabelCon))
end

function NewCard:GetList()
return (ListCon.new({id = self:GetData().idList}))
return (ListCon.new({id = self:GetData().idList}, BoardCon, ListCon, CardCon, LabelCon))
end

function NewCard:GetLabels()
local listData, obTab = self:GetData("/labels"),{}
for _,v in pairs (listData) do
table.insert(obTab, LabelCon.new({id = v.id}, BoardCon, ListCon, CardCon, LabelCon))
end
return obTab
end

function NewCard:isSubscribed()
Expand Down

0 comments on commit d7771a7

Please # to comment.