subscribeflow 1.8.2__tar.gz → 1.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: subscribeflow
3
- Version: 1.8.2
3
+ Version: 1.9.0
4
4
  Summary: Python SDK for SubscribeFlow API - Email subscription management
5
5
  Project-URL: Homepage, https://subscribeflow.net
6
6
  Project-URL: Documentation, https://docs.subscribeflow.net/guides/sdk-setup
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "subscribeflow"
3
- version = "1.8.2"
3
+ version = "1.9.0"
4
4
  description = "Python SDK for SubscribeFlow API - Email subscription management"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -47,7 +47,7 @@ from subscribeflow.models import (
47
47
  WebhookEndpoint,
48
48
  )
49
49
 
50
- __version__ = "1.8.1"
50
+ __version__ = "1.8.3"
51
51
 
52
52
  __all__ = [
53
53
  # Client
@@ -11,6 +11,7 @@ Environment Variables:
11
11
  from __future__ import annotations
12
12
 
13
13
  import asyncio
14
+ import json
14
15
  import logging
15
16
  import os
16
17
  from contextvars import ContextVar
@@ -148,6 +149,20 @@ def _format_template(template: Any) -> str:
148
149
  )
149
150
 
150
151
 
152
+ def _format_template_detail(template: Any) -> str:
153
+ """Format a single template including its MJML and variables schema.
154
+
155
+ Kept out of ``_format_template`` so list output stays compact; the full
156
+ body is only needed when an agent inspects one template before updating it.
157
+ """
158
+ if template.variables_schema is None:
159
+ schema = "Variables schema: none"
160
+ else:
161
+ rendered = json.dumps(template.variables_schema, indent=2, ensure_ascii=False)
162
+ schema = f"Variables schema:\n{rendered}"
163
+ return f"{_format_template(template)}\n\n{schema}\n\nMJML content:\n{template.mjml_content}"
164
+
165
+
151
166
  def _format_campaign(campaign: Any) -> str:
152
167
  """Format a campaign for text output."""
153
168
  stats = ""
@@ -741,23 +756,32 @@ async def _execute_tool(client: SubscribeFlowClient, name: str, args: dict[str,
741
756
 
742
757
  if name == "get_template":
743
758
  template = await client.templates.get(args["slug"])
744
- return f"Template details:\n\n{_format_template(template)}"
759
+ return f"Template details:\n\n{_format_template_detail(template)}"
745
760
 
746
761
  if name == "create_template":
747
762
  template = await client.templates.create(
748
763
  name=args["name"],
749
764
  subject=args["subject"],
750
765
  mjml_content=args["mjml_content"],
766
+ variables_schema=args.get("variables_schema"),
751
767
  category=args.get("category", "transactional"),
752
768
  )
753
769
  return f"Created template:\n\n{_format_template(template)}"
754
770
 
755
771
  if name == "update_template":
772
+ # The SDK drops None from the request body, so an explicit null would
773
+ # silently leave the stored schema in place.
774
+ if "variables_schema" in args and args["variables_schema"] is None:
775
+ return (
776
+ "Clearing variables_schema is not supported. "
777
+ "Omit the field to keep the current schema, or pass a new schema object."
778
+ )
756
779
  template = await client.templates.update(
757
780
  slug=args["slug"],
758
781
  name=args.get("name"),
759
782
  subject=args.get("subject"),
760
783
  mjml_content=args.get("mjml_content"),
784
+ variables_schema=args.get("variables_schema"),
761
785
  category=args.get("category"),
762
786
  )
763
787
  return f"Updated template:\n\n{_format_template(template)}"
@@ -392,7 +392,7 @@ TEMPLATE_TOOLS = [
392
392
  ),
393
393
  Tool(
394
394
  name="get_template",
395
- description="Get an email template by its slug",
395
+ description="Get an email template by its slug, including MJML and variables schema",
396
396
  inputSchema={
397
397
  "type": "object",
398
398
  "properties": {
@@ -422,6 +422,10 @@ TEMPLATE_TOOLS = [
422
422
  "type": "string",
423
423
  "description": "MJML template content",
424
424
  },
425
+ "variables_schema": {
426
+ "type": "object",
427
+ "description": "JSON Schema describing the template variables",
428
+ },
425
429
  "category": {
426
430
  "type": "string",
427
431
  "enum": ["transactional", "marketing"],
@@ -454,6 +458,14 @@ TEMPLATE_TOOLS = [
454
458
  "type": "string",
455
459
  "description": "New MJML template content",
456
460
  },
461
+ "variables_schema": {
462
+ "type": "object",
463
+ "description": (
464
+ "New JSON Schema describing the template variables. "
465
+ "Replaces the stored schema; omit to leave it unchanged. "
466
+ "Clearing it (null) is not supported."
467
+ ),
468
+ },
457
469
  "category": {
458
470
  "type": "string",
459
471
  "enum": ["transactional", "marketing"],
File without changes
File without changes