Exemples
Exemple 1 : Créer une carte personnalisée et l'utiliser dans un workflow
Étape 1 : Créer la carte
{
"app_manifest": {
"id": "com.example.invoice-tools",
"name": "Invoice Tools",
"version": "1.0.0",
"partner": {
"id": "example-partner",
"name": "Example Corp"
}
},
"card_manifest": {
"id": "high-value-check",
"title": {"en": "High Value Invoice Check"},
"entry_point": "src/high_value.py",
"class_name": "HighValueCheck",
"args": [
{
"id": "threshold",
"title": {"en": "Amount Threshold"},
"type": "number",
"required": true
}
]
},
"card_type": "condition",
"source_code": "from api.sdk.base import PartnerCard\nfrom api.sdk.result import CardResult, CardStatus\n\nclass HighValueCheck(PartnerCard):\n def execute(self, context):\n threshold = float(self.variables.get('threshold', 1000))\n total = float(context.document_fields.get('total_amount', 0))\n if total > threshold:\n return CardResult(status=CardStatus.SUCCESS, message=f'High value: {total}')\n return CardResult(status=CardStatus.FAILURE, message=f'Below threshold: {total}')",
"test_code": "def test_high_value():\n assert True # Basic test"
}Étape 2 : Valider la carte
Étape 3 : Tester la carte
Étape 4 : Approuver la carte
Étape 5 : Construire un workflow avec la carte
Étape 6 : Tester le workflow
Exemple 2 : Construire un workflow avec des cartes intégrées
Étape 1 : Découvrir les cartes disponibles
Étape 2 : Créer le workflow
Exemple 3 : Importer des cartes depuis GitHub
Last updated