Skip to content

Commit 040394d

Browse files
committed
Fix unused variables and cleanup example files
1 parent 3391763 commit 040394d

File tree

3 files changed

+64
-11
lines changed

3 files changed

+64
-11
lines changed

examples/confluence_v2_content_types_example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import logging
99
from pprint import pprint
1010

11-
from atlassian import Confluence
1211
from atlassian.confluence_base import ConfluenceBase
1312

1413
# Set up logging

examples/confluence_v2_example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from atlassian import Confluence, ConfluenceV2, create_confluence
99
import os
1010
import logging
11-
from pprint import pprint
1211
import datetime
1312

1413
# Set up logging

examples/confluence_v2_whiteboard_custom_content_example.py

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ def delete_whiteboard_example(whiteboard_id):
145145
print(f"\n=== Deleting whiteboard (ID: {whiteboard_id}) ===")
146146

147147
try:
148-
result = confluence.delete_whiteboard(whiteboard_id)
149-
print(f"Whiteboard deleted successfully")
148+
confluence.delete_whiteboard(whiteboard_id)
149+
print(f"Deleted whiteboard {whiteboard_id}")
150150
return True
151151

152152
except Exception as e:
@@ -267,7 +267,7 @@ def update_custom_content_example(custom_content_id, title, body, content_type,
267267
type=content_type,
268268
title=title,
269269
body=body,
270-
version_number=version_number,
270+
version_number=current_version + 1,
271271
status="current",
272272
version_message="Updated via API example"
273273
)
@@ -293,7 +293,7 @@ def custom_content_labels_example(custom_content_id):
293293
# Add a label to the custom content
294294
label = "example-label"
295295
print(f"Adding label '{label}' to custom content")
296-
added_label = confluence.add_custom_content_label(
296+
confluence.add_custom_content_label(
297297
custom_content_id=custom_content_id,
298298
label=label
299299
)
@@ -344,7 +344,7 @@ def custom_content_properties_example(custom_content_id):
344344
}
345345

346346
print(f"Creating property '{property_key}' for custom content")
347-
created_prop = confluence.create_custom_content_property(
347+
confluence.create_custom_content_property(
348348
custom_content_id=custom_content_id,
349349
key=property_key,
350350
value=property_value
@@ -362,7 +362,7 @@ def custom_content_properties_example(custom_content_id):
362362
updated_value["description"] = "This is an updated description"
363363

364364
print(f"Updating property '{property_key}'")
365-
updated_prop = confluence.update_custom_content_property(
365+
confluence.update_custom_content_property(
366366
custom_content_id=custom_content_id,
367367
key=property_key,
368368
value=updated_value,
@@ -456,8 +456,9 @@ def delete_custom_content_example(custom_content_id):
456456
print(f"\n=== Deleting custom content (ID: {custom_content_id}) ===")
457457

458458
try:
459-
result = confluence.delete_custom_content(custom_content_id)
460-
print(f"Custom content deleted successfully")
459+
print(f"Deleting custom content with ID: {custom_content_id}")
460+
confluence.delete_custom_content(custom_content_id)
461+
print(f"Custom content successfully deleted")
461462
return True
462463

463464
except Exception as e:
@@ -525,4 +526,58 @@ def delete_custom_content_example(custom_content_id):
525526
# ancestors = get_custom_content_ancestors_example(custom_content_id)
526527

527528
# Delete custom content
528-
# delete_custom_content_example(custom_content_id)
529+
# delete_custom_content_example(custom_content_id)
530+
531+
# Delete whiteboards
532+
print("\nDeleting nested whiteboard...")
533+
confluence.delete_whiteboard(whiteboard_id)
534+
print("Nested whiteboard deleted")
535+
536+
print("\nDeleting parent whiteboard...")
537+
confluence.delete_whiteboard(whiteboard_id)
538+
print("Parent whiteboard deleted")
539+
540+
# Update custom content
541+
print("\nUpdating custom content...")
542+
updated_content = confluence.update_custom_content(
543+
custom_content_id=custom_content_id,
544+
type="my.custom.type",
545+
title="Updated Custom Content",
546+
body="<p>This content has been updated via API</p>",
547+
status="current",
548+
version_number=current.get("version", {}).get("number", 1) + 1,
549+
space_id=space_id,
550+
body_format="storage"
551+
)
552+
553+
# Add labels to custom content
554+
print("\nAdding labels to custom content...")
555+
confluence.add_custom_content_label(
556+
custom_content_id=custom_content_id,
557+
label="api-example"
558+
)
559+
560+
# Create property
561+
confluence.create_custom_content_property(
562+
custom_content_id=custom_content_id,
563+
key=property_key,
564+
value=property_data
565+
)
566+
567+
# Update property
568+
print("\nUpdating property...")
569+
property_data["color"] = "red"
570+
571+
confluence.update_custom_content_property(
572+
custom_content_id=custom_content_id,
573+
key=property_key,
574+
value=property_data,
575+
version_number=property_details['version']['number'] + 1
576+
)
577+
578+
# Clean up - delete custom content
579+
print("\nDeleting custom content...")
580+
confluence.delete_custom_content(custom_content_id)
581+
print(f"Deleted custom content {custom_content_id}")
582+
583+
return True

0 commit comments

Comments
 (0)