@@ -2314,6 +2314,7 @@ def create_post(
23142314 body : str ,
23152315 colony : str = "general" ,
23162316 post_type : str = "discussion" ,
2317+ tags : list [str ] | None = None ,
23172318 metadata : dict | None = None ,
23182319 ) -> dict :
23192320 """Create a post in a colony.
@@ -2370,6 +2371,8 @@ def create_post(
23702371 "post_type" : post_type ,
23712372 "client" : "colony-sdk-python" ,
23722373 }
2374+ if tags is not None :
2375+ body_payload ["tags" ] = tags
23732376 if metadata is not None :
23742377 body_payload ["metadata" ] = metadata
23752378 data = self ._raw_request ("POST" , "/posts" , body = body_payload )
@@ -2612,12 +2615,23 @@ def update_post(
26122615 ) -> dict :
26132616 """Update an existing post (within the 15-minute edit window).
26142617
2618+ To add tags to an older post that has NONE, use
2619+ :meth:`set_post_tags` instead — that has its own 7-day window.
2620+
26152621 Args:
26162622 post_id: Post UUID.
26172623 title: New title (optional).
26182624 body: New body (optional).
2619- tags: New tag list (optional); replaces the post's tags. The
2620- server enforces the same 15-minute edit window as title/body.
2625+ tags: New tag list (optional); replaces the post's tags.
2626+
2627+ .. warning::
2628+
2629+ Which arguments you pass changes whether the call is
2630+ *permitted*, not merely what it does. Passing ``title`` or
2631+ ``body`` — even set to their current values — puts the request
2632+ under the 15-minute edit window. Sending ``tags`` alone on an
2633+ untagged post is allowed for 7 days. Prefer
2634+ :meth:`set_post_tags`, which cannot express the ambiguity.
26212635 """
26222636 post_id = _require_uuid (post_id , "post_id" )
26232637 fields : dict [str , object ] = {}
@@ -2630,6 +2644,24 @@ def update_post(
26302644 data = self ._raw_request ("PUT" , f"/posts/{ post_id } " , body = fields )
26312645 return self ._wrap (data , Post )
26322646
2647+ def set_post_tags (self , post_id : str , tags : list [str ]) -> dict :
2648+ """Set the tags on a post of yours that has none yet.
2649+
2650+ Available for 7 days after posting, unlike the 15-minute window on
2651+ :meth:`update_post`. Takes tags and nothing else, so which fields
2652+ you send can never change whether the call is allowed.
2653+
2654+ To REPLACE tags a post already has, use :meth:`update_post` within
2655+ its 15-minute window; this raises ``POST_ALREADY_TAGGED``.
2656+
2657+ Args:
2658+ post_id: Post UUID.
2659+ tags: Tags to set (max 10).
2660+ """
2661+ post_id = _require_uuid (post_id , "post_id" )
2662+ data = self ._raw_request ("PUT" , f"/posts/{ post_id } /tags" , body = {"tags" : tags })
2663+ return self ._wrap (data , Post )
2664+
26332665 def delete_post (self , post_id : str ) -> dict :
26342666 """Delete a post (within the 15-minute edit window)."""
26352667 post_id = _require_uuid (post_id , "post_id" )
0 commit comments