简体   繁体   English

如何获取基于 position 的 trello 卡

[英]How to get a trello card based on position

I'm trying to get the top Trello card in a specific list, but I'm unsure how to get a card from a list based on its position.我正在尝试获取特定列表中的顶级 Trello 卡,但我不确定如何从基于其 position 的列表中获取卡。 Any ideas?有任何想法吗? Also, I'm pretty knowledgeable with the Trello API already I just can't figure this out at all.此外,我对 Trello API 非常了解,我根本无法弄清楚这一点。

So far I have this, but I don't know how to get the top card.到目前为止我有这个,但我不知道如何获得顶级卡。

let listID = "5ec3fda8a26c384e44f063bb";

trello.getCardsOnListWithExtraParams(listID, "pos:top",
  function(error, trelloCard) {
    if (error) {
      console.log('An error occured with Trello card.' + error)
      message.channel.send({
        embed: {
          color: 0xff604d,
          description: "An error occured! Please try again later or use the support server link."
        }
      });
    } else {
      console.log('Found card:', trelloCard);
    }
  });

when I use your code and add [0] to the trelloCard that it logs, it works fine and gets the first one in the list.当我使用您的代码并将 [0] 添加到它记录的 trelloCard 时,它工作正常并获得列表中的第一个。

trello.getCardsOnListWithExtraParams(listID, "pos:top",
      function (error, trelloCard) {
          if (error) {
              console.log('An error occured with Trello card.' + error)
           //testing this in console so I removed the message.channel.send
          }
          else {
              console.log('Found card:', trelloCard[0]);
          }
        })

Outputs:输出:

...
name: 'two',
pos: 0.5,
...

which is first这是第一个

特雷罗截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM