Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- IF YOU DONT KNOW HOW TO SCRIPT GET OUT YOU WONT KNOW HOW TO USE THIS!
- When something returns a table try running a recruisive loop to see what is inside the table
- If Private board then follow this
- -Instructions
- 1. Go to this link and click allow: https://trello.com/1/authorize?key=aded73d328dce4a0698a6744856b3326&name=Roblox+Api&expiration=never&response_type=token&scope=read,write
- 2. Copy the random numbers and letters in the page sent to you
- 3. Paste the random numbers and letters in the Value of Token
- 4. If anywhere an error occurs when in use with "Unauthorized" you didnt copy the full link!
- -Functions
- --------------
- GetBoardID([Board Name]) return Board ID
- --------------
- GetListID([List Name],[Board ID]) return List ID
- --------------
- GetCardID([Name],[Board ID]) returns Card ID
- --------------
- GetBoardInfo([Board ID]) returns a table like this except not JSON
- {
- "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"
- }]
- }
- --------------
- GetCardInfo([Card ID],[Board ID]) returns an table
- -----------
- GetLists([Board ID]) returns a table
- ------------
- AddCard([Name],[Decription],[List ID],Optional[AddUrl],Optional[Position **Valid Values: A position. top, bottom, or a positive number.**],Optional[Due*Default=null*],Optional[Label**Valid Values: all or a comma-separated list of: blue,green,orange,purple,red,yellow**],Optional[CardToCopyID]) returns a Table
- ------------
- AddList([Name],[Board ID],Optional[List to Copy],Optional[Position *Valid Values: position. top, bottom, or a positive number.*])
- ------------
- AddBoard([Name],[Description])
- ------------
- *DEPRICATED*AddLabelName([Board ID],[Name],[Color]) WILL BE REMOVED
- ------------
- AddCardAtt([Card ID],[Name],[File,URL],[Value])
- ------------
- AddLabel([Name],[Color],[Board ID]) returns Label ID
- ------------
- AddCardLabel([Card ID],[Label ID])
- ------------
- GetLabels([Board ID]) returns a table such as bellow except not in JSON
- [
- {"id":"559adc5e19ad3a5dc2b9c003","idBoard":"559adc5e9ad91e64b569a4d9","name":"","color":"green","uses":0},
- {"id":"559adc5e19ad3a5dc2b9c004","idBoard":"559adc5e9ad91e64b569a4d9","name":"","color":"yellow","uses":0},
- {"id":"559adc5e19ad3a5dc2b9c006","idBoard":"559adc5e9ad91e64b569a4d9","name":"","color":"red","uses":0},
- {"id":"559adc5e19ad3a5dc2b9c007","idBoard":"559adc5e9ad91e64b569a4d9","name":"","color":"purple","uses":0},
- {"id":"559adc5e19ad3a5dc2b9c008","idBoard":"559adc5e9ad91e64b569a4d9","name":"","color":"blue","uses":0},
- ]
- ------------
- GetCardsInList([List ID]) returns a table containing the cards tables
- ------------
- PostComment([Card ID],Text)
- ------------
- AddCheckList()
- ------------
- GetLabelID(LabelName,BoardID) OUCH MY BACK!
- ]]--
- local Private=true
- local addon
- local HS=game:GetService("HttpService")
- local IS=game:GetService("InsertService")
- local T = {}
- function getAddon()
- if script.Token.Value~="" then
- addon="?key=aded73d328dce4a0698a6744856b3326&token="..script.Token.Value
- else
- error([[-Instructions
- \n 1. Go to this link and click allow: https://trello.com/1/authorize?key=aded73d328dce4a0698a6744856b3326&name=Roblox+Api&expiration=30days&response_type=token&scope=read,write
- \n 2. Copy the token in the page sent to you
- \n 3. Paste the token in the Value of Token]])
- end
- 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": "4eea4ffc91e31d1746000046",
- "idLabels": [],
- "idList": "4eea4ffc91e31d174600004a",
- "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": "https://trello.com/c/XlG8S7ll",
- "subscribed": false,
- "url": "https://trello.com/c/XlG8S7ll/3-finish-my-awesome-application"
- }]
- --]]
- 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
- --[[
- 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/members/my/boards/"..boardid..addon
- else
- getAddon()
- url="https://api.trello.com/1/members/my/boards/"..boardid..addon
- 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/members/my/boards/"..boardid.."/lists"..addon
- else
- getAddon()
- url="https://api.trello.com/1/members/my/boards/"..boardid.."/lists"..addon
- end
- local re=HS:GetAsync(url,true)
- local data=HS:JSONDecode(re)
- return data
- end
- function T:GetBoardID(name)
- local url
- if Private then
- getAddon()
- url="https://api.trello.com/1/members/my/boards"..addon
- else
- getAddon()
- url="https://api.trello.com/1/members/my/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
- 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=HS:JSONEncode(dat)
- 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/[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
- return T
- -----------------------------------------[[
- REMEMBER TO MAKE THE TOKEN]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement