confluence-as 1.0.0__py3-none-any.whl
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.
- confluence_as/__init__.py +330 -0
- confluence_as/adf_helper.py +577 -0
- confluence_as/autocomplete_cache.py +321 -0
- confluence_as/cli/__init__.py +5 -0
- confluence_as/cli/cli_utils.py +358 -0
- confluence_as/cli/commands/__init__.py +1 -0
- confluence_as/cli/commands/admin_cmds.py +1114 -0
- confluence_as/cli/commands/analytics_cmds.py +462 -0
- confluence_as/cli/commands/attachment_cmds.py +391 -0
- confluence_as/cli/commands/bulk_cmds.py +1023 -0
- confluence_as/cli/commands/comment_cmds.py +487 -0
- confluence_as/cli/commands/hierarchy_cmds.py +530 -0
- confluence_as/cli/commands/jira_cmds.py +794 -0
- confluence_as/cli/commands/label_cmds.py +423 -0
- confluence_as/cli/commands/ops_cmds.py +875 -0
- confluence_as/cli/commands/page_cmds.py +828 -0
- confluence_as/cli/commands/permission_cmds.py +628 -0
- confluence_as/cli/commands/property_cmds.py +460 -0
- confluence_as/cli/commands/search_cmds.py +1023 -0
- confluence_as/cli/commands/space_cmds.py +478 -0
- confluence_as/cli/commands/template_cmds.py +613 -0
- confluence_as/cli/commands/watch_cmds.py +352 -0
- confluence_as/cli/helpers.py +78 -0
- confluence_as/cli/main.py +100 -0
- confluence_as/config_manager.py +123 -0
- confluence_as/confluence_client.py +683 -0
- confluence_as/credential_manager.py +328 -0
- confluence_as/error_handler.py +303 -0
- confluence_as/formatters.py +303 -0
- confluence_as/markdown_parser.py +200 -0
- confluence_as/mock/__init__.py +45 -0
- confluence_as/mock/base.py +254 -0
- confluence_as/mock/client.py +41 -0
- confluence_as/mock/mixins/__init__.py +11 -0
- confluence_as/mock/mixins/content.py +243 -0
- confluence_as/mock/mixins/page.py +268 -0
- confluence_as/mock/mixins/space.py +106 -0
- confluence_as/space_context.py +447 -0
- confluence_as/validators.py +444 -0
- confluence_as/xhtml_helper.py +529 -0
- confluence_as-1.0.0.dist-info/METADATA +331 -0
- confluence_as-1.0.0.dist-info/RECORD +45 -0
- confluence_as-1.0.0.dist-info/WHEEL +4 -0
- confluence_as-1.0.0.dist-info/entry_points.txt +2 -0
- confluence_as-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Confluence AS
|
|
3
|
+
|
|
4
|
+
Python library for Confluence Cloud REST API - shared utilities for Confluence automation.
|
|
5
|
+
|
|
6
|
+
This module provides common utilities for all Confluence skills:
|
|
7
|
+
- ConfluenceClient: HTTP client with retry logic
|
|
8
|
+
- ConfigManager: Environment variable configuration
|
|
9
|
+
- Error handling: Exception hierarchy and decorators
|
|
10
|
+
- Validators: Input validation utilities
|
|
11
|
+
- Formatters: Output formatting utilities
|
|
12
|
+
- ADF Helper: Atlassian Document Format utilities
|
|
13
|
+
- XHTML Helper: Legacy storage format utilities
|
|
14
|
+
- Cache: Response caching
|
|
15
|
+
|
|
16
|
+
Required Environment Variables:
|
|
17
|
+
CONFLUENCE_SITE_URL - Confluence Cloud URL (e.g., https://your-site.atlassian.net)
|
|
18
|
+
CONFLUENCE_EMAIL - Email address for authentication
|
|
19
|
+
CONFLUENCE_API_TOKEN - API token for authentication
|
|
20
|
+
|
|
21
|
+
Usage:
|
|
22
|
+
from confluence_as import (
|
|
23
|
+
ConfluenceClient,
|
|
24
|
+
get_confluence_client,
|
|
25
|
+
handle_errors,
|
|
26
|
+
ValidationError,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Get a configured client (uses environment variables)
|
|
30
|
+
client = get_confluence_client()
|
|
31
|
+
|
|
32
|
+
# Or create directly
|
|
33
|
+
client = ConfluenceClient(
|
|
34
|
+
base_url="https://your-site.atlassian.net",
|
|
35
|
+
email="your-email@example.com",
|
|
36
|
+
api_token="your-api-token"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Get a page
|
|
40
|
+
page = client.get("/api/v2/pages/12345")
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
__version__ = "1.0.0"
|
|
44
|
+
|
|
45
|
+
# Client
|
|
46
|
+
# Batch processing (from base library)
|
|
47
|
+
from assistant_skills_lib.batch_processor import (
|
|
48
|
+
BatchConfig,
|
|
49
|
+
BatchProcessor,
|
|
50
|
+
BatchProgress,
|
|
51
|
+
CheckpointManager,
|
|
52
|
+
generate_operation_id,
|
|
53
|
+
get_recommended_batch_size,
|
|
54
|
+
list_pending_checkpoints,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Cache (from base library)
|
|
58
|
+
from assistant_skills_lib.cache import (
|
|
59
|
+
Cache,
|
|
60
|
+
cached,
|
|
61
|
+
get_cache,
|
|
62
|
+
invalidate,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Request Batcher (from base library)
|
|
66
|
+
from assistant_skills_lib.request_batcher import (
|
|
67
|
+
BatchError,
|
|
68
|
+
BatchResult,
|
|
69
|
+
RequestBatcher,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# ADF Helper
|
|
73
|
+
from .adf_helper import (
|
|
74
|
+
adf_to_markdown,
|
|
75
|
+
adf_to_text,
|
|
76
|
+
create_adf_doc,
|
|
77
|
+
create_blockquote,
|
|
78
|
+
create_bullet_list,
|
|
79
|
+
create_code_block,
|
|
80
|
+
create_heading,
|
|
81
|
+
create_link,
|
|
82
|
+
create_ordered_list,
|
|
83
|
+
create_paragraph,
|
|
84
|
+
create_rule,
|
|
85
|
+
create_table,
|
|
86
|
+
create_text,
|
|
87
|
+
is_markdown_block_start, # Re-exported alias for backward compatibility
|
|
88
|
+
markdown_to_adf,
|
|
89
|
+
text_to_adf,
|
|
90
|
+
validate_adf,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# Autocomplete Cache
|
|
94
|
+
from .autocomplete_cache import (
|
|
95
|
+
AutocompleteCache,
|
|
96
|
+
get_autocomplete_cache,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# Config
|
|
100
|
+
from .config_manager import (
|
|
101
|
+
ConfigManager,
|
|
102
|
+
get_confluence_client,
|
|
103
|
+
)
|
|
104
|
+
from .confluence_client import ConfluenceClient, create_client
|
|
105
|
+
|
|
106
|
+
# Credential Manager
|
|
107
|
+
from .credential_manager import (
|
|
108
|
+
ConfluenceCredentialManager,
|
|
109
|
+
CredentialBackend,
|
|
110
|
+
CredentialNotFoundError,
|
|
111
|
+
get_credential_manager,
|
|
112
|
+
get_credentials,
|
|
113
|
+
is_keychain_available,
|
|
114
|
+
store_credentials,
|
|
115
|
+
validate_credentials,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Errors
|
|
119
|
+
from .error_handler import (
|
|
120
|
+
AuthenticationError,
|
|
121
|
+
ConflictError,
|
|
122
|
+
ConfluenceError,
|
|
123
|
+
ErrorContext,
|
|
124
|
+
NotFoundError,
|
|
125
|
+
PermissionError,
|
|
126
|
+
RateLimitError,
|
|
127
|
+
ServerError,
|
|
128
|
+
ValidationError,
|
|
129
|
+
extract_error_message,
|
|
130
|
+
handle_confluence_error,
|
|
131
|
+
handle_errors,
|
|
132
|
+
print_error,
|
|
133
|
+
sanitize_error_message,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
# Formatters
|
|
137
|
+
from .formatters import (
|
|
138
|
+
Colors,
|
|
139
|
+
export_csv,
|
|
140
|
+
format_attachment,
|
|
141
|
+
format_blogpost,
|
|
142
|
+
format_comment,
|
|
143
|
+
format_comments,
|
|
144
|
+
format_json,
|
|
145
|
+
format_label,
|
|
146
|
+
format_page,
|
|
147
|
+
format_search_results,
|
|
148
|
+
format_space,
|
|
149
|
+
format_table,
|
|
150
|
+
format_timestamp,
|
|
151
|
+
format_version,
|
|
152
|
+
print_info,
|
|
153
|
+
print_success,
|
|
154
|
+
print_warning,
|
|
155
|
+
strip_html_tags,
|
|
156
|
+
truncate,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
# Markdown Parser (shared)
|
|
160
|
+
from .markdown_parser import (
|
|
161
|
+
is_block_start,
|
|
162
|
+
parse_markdown,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
# Space Context
|
|
166
|
+
from .space_context import (
|
|
167
|
+
SpaceContext,
|
|
168
|
+
clear_context_cache,
|
|
169
|
+
format_context_summary,
|
|
170
|
+
get_common_labels,
|
|
171
|
+
get_page_defaults,
|
|
172
|
+
get_space_context,
|
|
173
|
+
get_top_contributors,
|
|
174
|
+
has_space_context,
|
|
175
|
+
suggest_parent_page,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# Validators
|
|
179
|
+
from .validators import (
|
|
180
|
+
validate_content_type,
|
|
181
|
+
validate_cql,
|
|
182
|
+
validate_email,
|
|
183
|
+
validate_file_path,
|
|
184
|
+
validate_issue_key,
|
|
185
|
+
validate_jql_query,
|
|
186
|
+
validate_label,
|
|
187
|
+
validate_limit,
|
|
188
|
+
validate_page_id,
|
|
189
|
+
validate_space_key,
|
|
190
|
+
validate_title,
|
|
191
|
+
validate_url,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
# XHTML Helper
|
|
195
|
+
from .xhtml_helper import (
|
|
196
|
+
adf_to_xhtml,
|
|
197
|
+
extract_text_from_xhtml,
|
|
198
|
+
markdown_to_xhtml,
|
|
199
|
+
validate_xhtml,
|
|
200
|
+
wrap_in_storage_format,
|
|
201
|
+
xhtml_to_adf,
|
|
202
|
+
xhtml_to_markdown,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
__all__ = [
|
|
206
|
+
# Version
|
|
207
|
+
"__version__",
|
|
208
|
+
# Batch Processing
|
|
209
|
+
"BatchConfig",
|
|
210
|
+
"BatchProcessor",
|
|
211
|
+
"BatchProgress",
|
|
212
|
+
"CheckpointManager",
|
|
213
|
+
"generate_operation_id",
|
|
214
|
+
"get_recommended_batch_size",
|
|
215
|
+
"list_pending_checkpoints",
|
|
216
|
+
# Request Batcher
|
|
217
|
+
"BatchError",
|
|
218
|
+
"BatchResult",
|
|
219
|
+
"RequestBatcher",
|
|
220
|
+
# Client
|
|
221
|
+
"ConfluenceClient",
|
|
222
|
+
"create_client",
|
|
223
|
+
# Config
|
|
224
|
+
"ConfigManager",
|
|
225
|
+
"get_confluence_client",
|
|
226
|
+
# Credential Manager
|
|
227
|
+
"ConfluenceCredentialManager",
|
|
228
|
+
"CredentialBackend",
|
|
229
|
+
"CredentialNotFoundError",
|
|
230
|
+
"get_credential_manager",
|
|
231
|
+
"get_credentials",
|
|
232
|
+
"is_keychain_available",
|
|
233
|
+
"store_credentials",
|
|
234
|
+
"validate_credentials",
|
|
235
|
+
# Errors
|
|
236
|
+
"ConfluenceError",
|
|
237
|
+
"AuthenticationError",
|
|
238
|
+
"PermissionError",
|
|
239
|
+
"ValidationError",
|
|
240
|
+
"NotFoundError",
|
|
241
|
+
"RateLimitError",
|
|
242
|
+
"ConflictError",
|
|
243
|
+
"ServerError",
|
|
244
|
+
"handle_confluence_error",
|
|
245
|
+
"handle_errors",
|
|
246
|
+
"print_error",
|
|
247
|
+
"sanitize_error_message",
|
|
248
|
+
"extract_error_message",
|
|
249
|
+
"ErrorContext",
|
|
250
|
+
# Validators
|
|
251
|
+
"validate_page_id",
|
|
252
|
+
"validate_space_key",
|
|
253
|
+
"validate_cql",
|
|
254
|
+
"validate_content_type",
|
|
255
|
+
"validate_file_path",
|
|
256
|
+
"validate_url",
|
|
257
|
+
"validate_email",
|
|
258
|
+
"validate_title",
|
|
259
|
+
"validate_label",
|
|
260
|
+
"validate_limit",
|
|
261
|
+
"validate_issue_key",
|
|
262
|
+
"validate_jql_query",
|
|
263
|
+
# Formatters
|
|
264
|
+
"Colors",
|
|
265
|
+
"format_page",
|
|
266
|
+
"format_blogpost",
|
|
267
|
+
"format_space",
|
|
268
|
+
"format_comment",
|
|
269
|
+
"format_comments",
|
|
270
|
+
"format_search_results",
|
|
271
|
+
"format_table",
|
|
272
|
+
"format_json",
|
|
273
|
+
"format_timestamp",
|
|
274
|
+
"format_attachment",
|
|
275
|
+
"format_label",
|
|
276
|
+
"format_version",
|
|
277
|
+
"export_csv",
|
|
278
|
+
"print_success",
|
|
279
|
+
"print_warning",
|
|
280
|
+
"print_info",
|
|
281
|
+
"truncate",
|
|
282
|
+
"strip_html_tags",
|
|
283
|
+
# Markdown Parser
|
|
284
|
+
"parse_markdown",
|
|
285
|
+
"is_block_start",
|
|
286
|
+
# ADF Helper
|
|
287
|
+
"create_adf_doc",
|
|
288
|
+
"create_paragraph",
|
|
289
|
+
"create_text",
|
|
290
|
+
"create_heading",
|
|
291
|
+
"create_bullet_list",
|
|
292
|
+
"create_ordered_list",
|
|
293
|
+
"create_code_block",
|
|
294
|
+
"create_blockquote",
|
|
295
|
+
"create_rule",
|
|
296
|
+
"create_table",
|
|
297
|
+
"create_link",
|
|
298
|
+
"text_to_adf",
|
|
299
|
+
"markdown_to_adf",
|
|
300
|
+
"adf_to_text",
|
|
301
|
+
"adf_to_markdown",
|
|
302
|
+
"validate_adf",
|
|
303
|
+
"is_markdown_block_start",
|
|
304
|
+
# XHTML Helper
|
|
305
|
+
"xhtml_to_markdown",
|
|
306
|
+
"markdown_to_xhtml",
|
|
307
|
+
"xhtml_to_adf",
|
|
308
|
+
"adf_to_xhtml",
|
|
309
|
+
"extract_text_from_xhtml",
|
|
310
|
+
"wrap_in_storage_format",
|
|
311
|
+
"validate_xhtml",
|
|
312
|
+
# Cache
|
|
313
|
+
"Cache",
|
|
314
|
+
"get_cache",
|
|
315
|
+
"cached",
|
|
316
|
+
"invalidate",
|
|
317
|
+
# Autocomplete Cache
|
|
318
|
+
"AutocompleteCache",
|
|
319
|
+
"get_autocomplete_cache",
|
|
320
|
+
# Space Context
|
|
321
|
+
"SpaceContext",
|
|
322
|
+
"get_space_context",
|
|
323
|
+
"clear_context_cache",
|
|
324
|
+
"has_space_context",
|
|
325
|
+
"get_page_defaults",
|
|
326
|
+
"get_common_labels",
|
|
327
|
+
"get_top_contributors",
|
|
328
|
+
"suggest_parent_page",
|
|
329
|
+
"format_context_summary",
|
|
330
|
+
]
|