async attachmentToCard()

in src/Worker.ts [492:517]


  async attachmentToCard() {
    const client = await this.kintoneClientCreator.createKintoneClient([
      this.apps.cards.token,
    ]);

    const attachmentName = this.trelloAction.data.attachment.name;

    if (this.setting !== undefined) {
      const checkDuplicate = new RegExp(
        this.setting.getPrefixRecordId() + "-\\d+"
      );
      const find = attachmentName.match(checkDuplicate);
      if (find !== null)
        return `Skip attachmentToCard because ${attachmentName}`;
    }

    const cardInfo = await this.getRecordIdAndAttachmentIdsFromCard();

    return ApiExecutor.attachmentToCard(
      client,
      this.apps.cards.id,
      this.trelloAction.data,
      cardInfo.recordId,
      cardInfo.attachmentsTableIds
    );
  }