{
  "name": "trello-perso",
  "version": "1.0.0",
  "display_name": "My Trello (own app)",
  "description": "Example of a custom plugin plugged into the author's own Trello app: reads one board and adds cards, with an app key and a token.",
  "author": { "name": "Plugin author" },
  "user_config": {
    "api_key": {
      "type": "string",
      "title": "App key",
      "description": "On the Trello apps admin page: create an app, open its Trello Auth tab and generate an API key, then paste it here.",
      "sensitive": true,
      "required": true,
      "maxLength": 100,
      "helpUrl": "https://trello.com/apps/admin"
    },
    "token": {
      "type": "string",
      "title": "Token",
      "description": "On the same page, click the Token link next to your key, authorize access, then paste the token here.",
      "sensitive": true,
      "required": true,
      "maxLength": 300
    },
    "board": {
      "type": "string",
      "title": "Board",
      "description": "Open the board in Trello and copy the 8 characters after trello.com/b/ in the address.",
      "required": true,
      "format": "id",
      "maxLength": 64
    }
  },
  "_meta": {
    "com.desktopaicompanion": {
      "apiVersion": 1,
      "kind": "declarative",
      "slug": "trelloperso",
      "minAppVersion": "0.9.1",
      "permissions": { "network": { "hosts": ["api.trello.com"] } },
      "auth": [
        { "in": "query", "name": "key", "value": "{{secret.api_key}}" },
        { "in": "query", "name": "token", "value": "{{secret.token}}" }
      ],
      "data": { "cloudModels": "ask" },
      "ui": {
        "labels": {
          "fr": { "api_key": "Clé de l'app", "token": "Jeton", "board": "Tableau" }
        },
        "descriptions": {
          "fr": {
            "api_key": "Sur la page d'administration des apps Trello : créez une app, ouvrez son onglet Trello Auth, générez une clé d'API et collez-la ici.",
            "token": "Sur la même page, cliquez sur le lien Token à côté de la clé, autorisez l'accès, puis collez le jeton ici.",
            "board": "Ouvrez le tableau dans Trello et copiez les 8 caractères qui suivent trello.com/b/ dans l'adresse."
          }
        }
      },
      "tools": {
        "read_board": {
          "description": "List the open lists of the user's Trello board with their open cards (ids, names). Gives the list ids needed to add a card.",
          "hint": { "en": "read your Trello board", "fr": "lire votre tableau Trello" },
          "risk": "R1",
          "inputSchema": { "type": "object", "properties": {} },
          "request": {
            "method": "GET",
            "url": "https://api.trello.com/1/boards/{{config.board}}/lists",
            "query": { "filter": "open", "fields": "name", "cards": "open", "card_fields": "name" }
          },
          "response": { "maxChars": 8000 }
        },
        "add_card": {
          "description": "Add a card to a list of the user's Trello board. Needs the list id (24 characters) shown by the board view, not the list name.",
          "hint": { "en": "add a card to your Trello board", "fr": "ajouter une carte à votre tableau Trello" },
          "risk": "R2",
          "sideEffects": "reversible",
          "inputSchema": {
            "type": "object",
            "properties": {
              "list_id": { "type": "string", "description": "Id of the list (24 characters) from the board view, not its name", "maxLength": 40 },
              "name": { "type": "string", "description": "Title of the card", "maxLength": 300 }
            },
            "required": ["list_id", "name"]
          },
          "request": {
            "method": "POST",
            "url": "https://api.trello.com/1/cards",
            "body": { "idList": "{{list_id}}", "name": "{{name}}" }
          },
          "response": { "pick": ["id", "name", "idList"] }
        }
      }
    }
  }
}
