devrev-Python-SDK 2.7.0__py3-none-any.whl → 2.8.1__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.
- devrev/client.py +15 -2
- devrev/models/__init__.py +33 -0
- devrev/models/articles.py +209 -1
- devrev/models/artifacts.py +127 -0
- devrev/services/articles.py +747 -10
- devrev/services/artifacts.py +401 -0
- devrev/services/base.py +11 -2
- devrev/utils/__init__.py +2 -0
- devrev/utils/content_converter.py +358 -0
- devrev_mcp/tools/articles.py +32 -17
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.1.dist-info}/METADATA +31 -12
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.1.dist-info}/RECORD +14 -11
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.1.dist-info}/WHEEL +0 -0
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.1.dist-info}/entry_points.txt +0 -0
devrev/client.py
CHANGED
|
@@ -9,6 +9,7 @@ from devrev.config import APIVersion, DevRevConfig, get_config
|
|
|
9
9
|
from devrev.exceptions import BetaAPIRequiredError
|
|
10
10
|
from devrev.services.accounts import AccountsService, AsyncAccountsService
|
|
11
11
|
from devrev.services.articles import ArticlesService, AsyncArticlesService
|
|
12
|
+
from devrev.services.artifacts import ArtifactsService, AsyncArtifactsService
|
|
12
13
|
from devrev.services.brands import AsyncBrandsService, BrandsService
|
|
13
14
|
from devrev.services.code_changes import AsyncCodeChangesService, CodeChangesService
|
|
14
15
|
from devrev.services.conversations import (
|
|
@@ -151,7 +152,8 @@ class DevRevClient:
|
|
|
151
152
|
|
|
152
153
|
# Initialize services
|
|
153
154
|
self._accounts = AccountsService(self._http)
|
|
154
|
-
self._articles = ArticlesService(self._http)
|
|
155
|
+
self._articles = ArticlesService(self._http, parent_client=self)
|
|
156
|
+
self._artifacts = ArtifactsService(self._http)
|
|
155
157
|
self._code_changes = CodeChangesService(self._http)
|
|
156
158
|
self._conversations = ConversationsService(self._http)
|
|
157
159
|
self._dev_users = DevUsersService(self._http)
|
|
@@ -205,6 +207,11 @@ class DevRevClient:
|
|
|
205
207
|
"""Access the Articles service."""
|
|
206
208
|
return self._articles
|
|
207
209
|
|
|
210
|
+
@property
|
|
211
|
+
def artifacts(self) -> ArtifactsService:
|
|
212
|
+
"""Access the Artifacts service."""
|
|
213
|
+
return self._artifacts
|
|
214
|
+
|
|
208
215
|
@property
|
|
209
216
|
def code_changes(self) -> CodeChangesService:
|
|
210
217
|
"""Access the Code Changes service."""
|
|
@@ -467,7 +474,8 @@ class AsyncDevRevClient:
|
|
|
467
474
|
|
|
468
475
|
# Initialize async services
|
|
469
476
|
self._accounts = AsyncAccountsService(self._http)
|
|
470
|
-
self._articles = AsyncArticlesService(self._http)
|
|
477
|
+
self._articles = AsyncArticlesService(self._http, parent_client=self)
|
|
478
|
+
self._artifacts = AsyncArtifactsService(self._http)
|
|
471
479
|
self._code_changes = AsyncCodeChangesService(self._http)
|
|
472
480
|
self._conversations = AsyncConversationsService(self._http)
|
|
473
481
|
self._dev_users = AsyncDevUsersService(self._http)
|
|
@@ -521,6 +529,11 @@ class AsyncDevRevClient:
|
|
|
521
529
|
"""Access the Articles service."""
|
|
522
530
|
return self._articles
|
|
523
531
|
|
|
532
|
+
@property
|
|
533
|
+
def artifacts(self) -> AsyncArtifactsService:
|
|
534
|
+
"""Access the Artifacts service."""
|
|
535
|
+
return self._artifacts
|
|
536
|
+
|
|
524
537
|
@property
|
|
525
538
|
def code_changes(self) -> AsyncCodeChangesService:
|
|
526
539
|
"""Access the Code Changes service."""
|
devrev/models/__init__.py
CHANGED
|
@@ -38,6 +38,23 @@ from devrev.models.articles import (
|
|
|
38
38
|
ArticleSummary,
|
|
39
39
|
ArticlesUpdateRequest,
|
|
40
40
|
ArticlesUpdateResponse,
|
|
41
|
+
ArticleWithContent,
|
|
42
|
+
)
|
|
43
|
+
from devrev.models.artifacts import (
|
|
44
|
+
Artifact,
|
|
45
|
+
ArtifactGetRequest,
|
|
46
|
+
ArtifactGetResponse,
|
|
47
|
+
ArtifactListRequest,
|
|
48
|
+
ArtifactListResponse,
|
|
49
|
+
ArtifactLocateRequest,
|
|
50
|
+
ArtifactLocateResponse,
|
|
51
|
+
ArtifactPrepareFormData,
|
|
52
|
+
ArtifactPrepareRequest,
|
|
53
|
+
ArtifactPrepareResponse,
|
|
54
|
+
ArtifactVersionsDeleteRequest,
|
|
55
|
+
ArtifactVersionsDeleteResponse,
|
|
56
|
+
ArtifactVersionsPrepareRequest,
|
|
57
|
+
ArtifactVersionsPrepareResponse,
|
|
41
58
|
)
|
|
42
59
|
from devrev.models.base import (
|
|
43
60
|
CustomSchemaSpec,
|
|
@@ -473,8 +490,24 @@ __all__ = [
|
|
|
473
490
|
"Article",
|
|
474
491
|
"ArticleSummary",
|
|
475
492
|
"ArticleStatus",
|
|
493
|
+
"ArticleWithContent",
|
|
476
494
|
"ArticlesCountRequest",
|
|
477
495
|
"ArticlesCountResponse",
|
|
496
|
+
# Artifacts
|
|
497
|
+
"Artifact",
|
|
498
|
+
"ArtifactPrepareFormData",
|
|
499
|
+
"ArtifactPrepareRequest",
|
|
500
|
+
"ArtifactPrepareResponse",
|
|
501
|
+
"ArtifactGetRequest",
|
|
502
|
+
"ArtifactGetResponse",
|
|
503
|
+
"ArtifactListRequest",
|
|
504
|
+
"ArtifactListResponse",
|
|
505
|
+
"ArtifactLocateRequest",
|
|
506
|
+
"ArtifactLocateResponse",
|
|
507
|
+
"ArtifactVersionsPrepareRequest",
|
|
508
|
+
"ArtifactVersionsPrepareResponse",
|
|
509
|
+
"ArtifactVersionsDeleteRequest",
|
|
510
|
+
"ArtifactVersionsDeleteResponse",
|
|
478
511
|
"ArticlesCreateRequest",
|
|
479
512
|
"ArticlesCreateResponse",
|
|
480
513
|
"ArticlesGetRequest",
|
devrev/models/articles.py
CHANGED
|
@@ -9,9 +9,11 @@ from typing import Any
|
|
|
9
9
|
from pydantic import Field
|
|
10
10
|
|
|
11
11
|
from devrev.models.base import (
|
|
12
|
+
CustomSchemaSpec,
|
|
12
13
|
DevRevBaseModel,
|
|
13
14
|
DevRevResponseModel,
|
|
14
15
|
PaginatedResponse,
|
|
16
|
+
SetTagWithValue,
|
|
15
17
|
UserSummary,
|
|
16
18
|
)
|
|
17
19
|
|
|
@@ -22,6 +24,74 @@ class ArticleStatus(StrEnum):
|
|
|
22
24
|
DRAFT = "draft"
|
|
23
25
|
PUBLISHED = "published"
|
|
24
26
|
ARCHIVED = "archived"
|
|
27
|
+
REVIEW_NEEDED = "review_needed"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ArticleAccessLevel(StrEnum):
|
|
31
|
+
"""Article access level enumeration."""
|
|
32
|
+
|
|
33
|
+
EXTERNAL = "external"
|
|
34
|
+
INTERNAL = "internal"
|
|
35
|
+
PRIVATE = "private"
|
|
36
|
+
PUBLIC = "public"
|
|
37
|
+
RESTRICTED = "restricted"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ArticleType(StrEnum):
|
|
41
|
+
"""Article type enumeration."""
|
|
42
|
+
|
|
43
|
+
ARTICLE = "article"
|
|
44
|
+
CONTENT_BLOCK = "content_block"
|
|
45
|
+
PAGE = "page"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ArticleContentFormat(StrEnum):
|
|
49
|
+
"""Article content format enumeration."""
|
|
50
|
+
|
|
51
|
+
DRDFV2 = "drdfv2"
|
|
52
|
+
RT = "rt"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class CursorMode(StrEnum):
|
|
56
|
+
"""Cursor pagination direction."""
|
|
57
|
+
|
|
58
|
+
AFTER = "after"
|
|
59
|
+
BEFORE = "before"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class ArticleScope(DevRevResponseModel):
|
|
63
|
+
"""Scope/visibility level of an article.
|
|
64
|
+
|
|
65
|
+
Values observed from the API:
|
|
66
|
+
- ``{"id": 1, "label": "internal", "ordinal": 1}``
|
|
67
|
+
- ``{"id": 2, "label": "external", "ordinal": 2}``
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
id: int = Field(..., description="Scope numeric ID (1=internal, 2=external)")
|
|
71
|
+
label: str | None = Field(default=None, description="Human-readable label")
|
|
72
|
+
ordinal: int | None = Field(default=None, description="Sort ordinal")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class ArticleTagSummary(DevRevResponseModel):
|
|
76
|
+
"""Tag summary as returned within an article's ``tags`` array."""
|
|
77
|
+
|
|
78
|
+
id: str = Field(..., description="Tag DON ID")
|
|
79
|
+
name: str | None = Field(default=None, description="Tag name")
|
|
80
|
+
display_id: str | None = Field(default=None, description="Tag display ID")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class ArticleTagWithValue(DevRevResponseModel):
|
|
84
|
+
"""Tag entry on an article, wrapping the tag summary with an optional value."""
|
|
85
|
+
|
|
86
|
+
tag: ArticleTagSummary = Field(..., description="Tag details")
|
|
87
|
+
value: str | None = Field(default=None, description="Optional tag value")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class ArticleParentSummary(DevRevResponseModel):
|
|
91
|
+
"""Summary of a parent directory (collection) for an article."""
|
|
92
|
+
|
|
93
|
+
id: str = Field(..., description="Directory DON ID")
|
|
94
|
+
display_id: str | None = Field(default=None, description="Display ID")
|
|
25
95
|
|
|
26
96
|
|
|
27
97
|
class Article(DevRevResponseModel):
|
|
@@ -36,12 +106,29 @@ class Article(DevRevResponseModel):
|
|
|
36
106
|
title: str = Field(..., description="Article title")
|
|
37
107
|
description: str | None = Field(default=None, description="Article description/body")
|
|
38
108
|
status: ArticleStatus | None = Field(default=None, description="Article status")
|
|
109
|
+
article_type: str | None = Field(default=None, description="Article type (article, page, etc.)")
|
|
39
110
|
authored_by: list[UserSummary] | None = Field(
|
|
40
111
|
default=None, description="Authors of the article (API returns array, not single object)"
|
|
41
112
|
)
|
|
42
113
|
owned_by: list[UserSummary] | None = Field(default=None, description="Owners of the article")
|
|
43
114
|
created_date: datetime | None = Field(default=None, description="Creation date")
|
|
44
115
|
modified_date: datetime | None = Field(default=None, description="Last modified")
|
|
116
|
+
resource: dict[str, Any] | None = Field(
|
|
117
|
+
default=None, description="Resource configuration including artifact references"
|
|
118
|
+
)
|
|
119
|
+
applies_to_parts: list[dict[str, Any]] | None = Field(
|
|
120
|
+
default=None, description="Parts this article applies to"
|
|
121
|
+
)
|
|
122
|
+
scope: ArticleScope | None = Field(
|
|
123
|
+
default=None, description="Visibility scope (internal/external)"
|
|
124
|
+
)
|
|
125
|
+
tags: list[ArticleTagWithValue] | None = Field(
|
|
126
|
+
default=None, description="Tags applied to the article"
|
|
127
|
+
)
|
|
128
|
+
parent: ArticleParentSummary | None = Field(
|
|
129
|
+
default=None, description="Parent directory/collection"
|
|
130
|
+
)
|
|
131
|
+
language: str | None = Field(default=None, description="Language code (e.g., 'en')")
|
|
45
132
|
|
|
46
133
|
|
|
47
134
|
class ArticleSummary(DevRevResponseModel):
|
|
@@ -51,8 +138,32 @@ class ArticleSummary(DevRevResponseModel):
|
|
|
51
138
|
title: str | None = Field(default=None, description="Article title")
|
|
52
139
|
|
|
53
140
|
|
|
141
|
+
class ArticleWithContent(DevRevResponseModel):
|
|
142
|
+
"""Article with its content loaded.
|
|
143
|
+
|
|
144
|
+
This model combines article metadata with the actual article body content,
|
|
145
|
+
which is stored separately as an artifact in the DevRev system.
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
article: Article = Field(..., description="Article metadata")
|
|
149
|
+
content: str = Field(..., description="Article body content")
|
|
150
|
+
content_format: str = Field(default="text/plain", description="Content MIME type")
|
|
151
|
+
content_version: str | None = Field(default=None, description="Artifact version")
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class SetSharedWithMembership(DevRevBaseModel):
|
|
155
|
+
"""Shared-with membership for articles."""
|
|
156
|
+
|
|
157
|
+
member: str = Field(..., description="Member ID")
|
|
158
|
+
role: str | None = Field(default=None, description="Role")
|
|
159
|
+
|
|
160
|
+
|
|
54
161
|
class ArticlesCreateRequest(DevRevBaseModel):
|
|
55
|
-
"""Request to create an article.
|
|
162
|
+
"""Request to create an article.
|
|
163
|
+
|
|
164
|
+
Supports associating the article with parts, a parent collection (directory),
|
|
165
|
+
scope (internal/external), and tags at creation time.
|
|
166
|
+
"""
|
|
56
167
|
|
|
57
168
|
title: str = Field(..., description="Article title")
|
|
58
169
|
description: str | None = Field(default=None, description="Article description/body")
|
|
@@ -61,6 +172,17 @@ class ArticlesCreateRequest(DevRevBaseModel):
|
|
|
61
172
|
resource: dict[str, Any] = Field(
|
|
62
173
|
default_factory=dict, description="Resource configuration for the article"
|
|
63
174
|
)
|
|
175
|
+
applies_to_parts: list[str] | None = Field(
|
|
176
|
+
default=None, description="List of part IDs this article applies to"
|
|
177
|
+
)
|
|
178
|
+
scope: int | None = Field(default=None, description="Visibility scope: 1=internal, 2=external")
|
|
179
|
+
tags: list[SetTagWithValue] | None = Field(
|
|
180
|
+
default=None, description="Tags to apply (list of {'id': 'tag_id', 'value': ...})"
|
|
181
|
+
)
|
|
182
|
+
parent: str | None = Field(default=None, description="Parent directory/collection DON ID")
|
|
183
|
+
article_type: str | None = Field(
|
|
184
|
+
default=None, description="Article type: 'article' (default), 'page', 'content_block'"
|
|
185
|
+
)
|
|
64
186
|
|
|
65
187
|
|
|
66
188
|
class ArticlesGetRequest(DevRevBaseModel):
|
|
@@ -75,11 +197,65 @@ class ArticlesDeleteRequest(DevRevBaseModel):
|
|
|
75
197
|
id: str = Field(..., description="Article ID to delete")
|
|
76
198
|
|
|
77
199
|
|
|
200
|
+
class ArticlesListRequestSharedWith(DevRevBaseModel):
|
|
201
|
+
"""Shared-with filter for listing articles."""
|
|
202
|
+
|
|
203
|
+
member: str | None = Field(default=None, description="Member ID filter")
|
|
204
|
+
role: str | None = Field(default=None, description="Role filter")
|
|
205
|
+
|
|
206
|
+
|
|
78
207
|
class ArticlesListRequest(DevRevBaseModel):
|
|
79
208
|
"""Request to list articles."""
|
|
80
209
|
|
|
81
210
|
cursor: str | None = Field(default=None, description="Pagination cursor")
|
|
82
211
|
limit: int | None = Field(default=None, ge=1, le=100, description="Max results")
|
|
212
|
+
applies_to_parts: list[str] | None = Field(default=None, description="Filter by part IDs")
|
|
213
|
+
article_type: list[ArticleType] | None = Field(
|
|
214
|
+
default=None, description="Filter by article types"
|
|
215
|
+
)
|
|
216
|
+
authored_by: list[str] | None = Field(default=None, description="Filter by author user IDs")
|
|
217
|
+
brands: list[str] | None = Field(default=None, description="Filter by brand IDs")
|
|
218
|
+
created_by: list[str] | None = Field(default=None, description="Filter by creator user IDs")
|
|
219
|
+
mode: CursorMode | None = Field(default=None, description="Cursor pagination direction")
|
|
220
|
+
modified_by: list[str] | None = Field(default=None, description="Filter by modifier user IDs")
|
|
221
|
+
owned_by: list[str] | None = Field(default=None, description="Filter by owner user IDs")
|
|
222
|
+
parent: list[str] | None = Field(default=None, description="Filter by parent article IDs")
|
|
223
|
+
scope: list[int] | None = Field(default=None, description="Filter by scope values")
|
|
224
|
+
shared_with: ArticlesListRequestSharedWith | None = Field(
|
|
225
|
+
default=None, description="Filter by shared-with membership"
|
|
226
|
+
)
|
|
227
|
+
status: list[ArticleStatus] | None = Field(default=None, description="Filter by article status")
|
|
228
|
+
tags: list[str] | None = Field(default=None, description="Filter by tag IDs")
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
class ArticlesUpdateRequestOwnedBy(DevRevBaseModel):
|
|
232
|
+
"""Owned-by update for articles."""
|
|
233
|
+
|
|
234
|
+
set: list[str] | None = Field(default=None, description="Set owner IDs")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class ArticlesUpdateRequestAuthoredBy(DevRevBaseModel):
|
|
238
|
+
"""Authored-by update for articles."""
|
|
239
|
+
|
|
240
|
+
set: list[str] | None = Field(default=None, description="Set author IDs")
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class ArticlesUpdateRequestAliases(DevRevBaseModel):
|
|
244
|
+
"""Aliases update for articles."""
|
|
245
|
+
|
|
246
|
+
set: list[str] | None = Field(default=None, description="Set aliases")
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class ArticlesUpdateRequestAppliesToParts(DevRevBaseModel):
|
|
250
|
+
"""Applies-to-parts update for articles."""
|
|
251
|
+
|
|
252
|
+
set: list[str] | None = Field(default=None, description="Set part IDs")
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class ArticlesUpdateRequestTags(DevRevBaseModel):
|
|
256
|
+
"""Tags update for articles."""
|
|
257
|
+
|
|
258
|
+
set: list[SetTagWithValue] | None = Field(default=None, description="Set tags")
|
|
83
259
|
|
|
84
260
|
|
|
85
261
|
class ArticlesUpdateRequest(DevRevBaseModel):
|
|
@@ -89,6 +265,38 @@ class ArticlesUpdateRequest(DevRevBaseModel):
|
|
|
89
265
|
title: str | None = Field(default=None, description="New title")
|
|
90
266
|
description: str | None = Field(default=None, description="New description/body")
|
|
91
267
|
status: ArticleStatus | None = Field(default=None, description="New status")
|
|
268
|
+
access_level: ArticleAccessLevel | None = Field(default=None, description="New access level")
|
|
269
|
+
aliases: ArticlesUpdateRequestAliases | None = Field(default=None, description="New aliases")
|
|
270
|
+
applies_to_parts: ArticlesUpdateRequestAppliesToParts | None = Field(
|
|
271
|
+
default=None, description="New applies-to-parts"
|
|
272
|
+
)
|
|
273
|
+
authored_by: ArticlesUpdateRequestAuthoredBy | None = Field(
|
|
274
|
+
default=None, description="New authored-by"
|
|
275
|
+
)
|
|
276
|
+
brand: str | None = Field(default=None, description="New brand ID")
|
|
277
|
+
content_format: ArticleContentFormat | None = Field(
|
|
278
|
+
default=None, description="New content format"
|
|
279
|
+
)
|
|
280
|
+
custom_fields: dict[str, Any] | None = Field(default=None, description="Custom fields")
|
|
281
|
+
custom_schema_spec: CustomSchemaSpec | None = Field(
|
|
282
|
+
default=None, description="Custom schema spec"
|
|
283
|
+
)
|
|
284
|
+
language: str | None = Field(default=None, description="New language code")
|
|
285
|
+
notify: bool | None = Field(default=None, description="Send notifications")
|
|
286
|
+
owned_by: ArticlesUpdateRequestOwnedBy | None = Field(default=None, description="New owned-by")
|
|
287
|
+
parent: str | None = Field(default=None, description="New parent article ID")
|
|
288
|
+
published_version: str | None = Field(default=None, description="Published version")
|
|
289
|
+
release_notes: str | None = Field(default=None, description="New release notes")
|
|
290
|
+
artifacts: dict[str, Any] | None = Field(
|
|
291
|
+
default=None,
|
|
292
|
+
description="Artifacts update using set wrapper, e.g. {'set': ['artifact_id']}",
|
|
293
|
+
)
|
|
294
|
+
resource: dict[str, Any] | None = Field(
|
|
295
|
+
default=None,
|
|
296
|
+
description="Resource configuration (read-only on updates, use artifacts instead)",
|
|
297
|
+
)
|
|
298
|
+
tags: ArticlesUpdateRequestTags | None = Field(default=None, description="New tags")
|
|
299
|
+
url: str | None = Field(default=None, description="Article URL")
|
|
92
300
|
|
|
93
301
|
|
|
94
302
|
class ArticlesCreateResponse(DevRevResponseModel):
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Artifact models for DevRev SDK."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from pydantic import Field
|
|
9
|
+
|
|
10
|
+
from devrev.models.base import DevRevBaseModel, DevRevResponseModel, PaginatedResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Artifact(DevRevResponseModel):
|
|
14
|
+
"""DevRev Artifact model."""
|
|
15
|
+
|
|
16
|
+
id: str = Field(..., description="Artifact ID")
|
|
17
|
+
created_by: dict[str, Any] | str | None = Field(
|
|
18
|
+
default=None,
|
|
19
|
+
description="Creator - may be a user ID string or a user object dict",
|
|
20
|
+
)
|
|
21
|
+
created_date: datetime | None = Field(default=None, description="Creation timestamp")
|
|
22
|
+
file_name: str | None = Field(default=None, description="Original file name")
|
|
23
|
+
file_type: str | None = Field(default=None, description="MIME type of the file")
|
|
24
|
+
file_size: int | None = Field(default=None, description="File size in bytes")
|
|
25
|
+
version: str | None = Field(default=None, description="Artifact version")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ArtifactPrepareFormData(DevRevResponseModel):
|
|
29
|
+
"""Form data field for artifact upload."""
|
|
30
|
+
|
|
31
|
+
key: str = Field(..., description="Form field key")
|
|
32
|
+
value: str = Field(..., description="Form field value")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ArtifactPrepareRequest(DevRevBaseModel):
|
|
36
|
+
"""Request to prepare an artifact for upload."""
|
|
37
|
+
|
|
38
|
+
file_name: str = Field(..., description="Name of file being uploaded")
|
|
39
|
+
file_type: str | None = Field(default=None, description="MIME type of the file")
|
|
40
|
+
configuration_set: str | None = Field(
|
|
41
|
+
default=None,
|
|
42
|
+
description=(
|
|
43
|
+
"Configuration set for the artifact. "
|
|
44
|
+
"Use 'article_media' for article content. "
|
|
45
|
+
"Valid values: article_media, default, email_media, job_data, "
|
|
46
|
+
"marketplace_listing_icon, marketplace_media, org_logo, plug_css, "
|
|
47
|
+
"plug_setting, plug_setting_banner_card, portal_css, "
|
|
48
|
+
"snap_in_functions_code, snap_widget, user_profile_picture, work"
|
|
49
|
+
),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ArtifactPrepareResponse(DevRevResponseModel):
|
|
54
|
+
"""Response from preparing an artifact upload."""
|
|
55
|
+
|
|
56
|
+
id: str = Field(..., description="Generated artifact ID")
|
|
57
|
+
url: str = Field(..., description="URL to upload file data to")
|
|
58
|
+
form_data: list[ArtifactPrepareFormData] = Field(
|
|
59
|
+
..., description="POST policy form data for upload"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class ArtifactGetRequest(DevRevBaseModel):
|
|
64
|
+
"""Request to get an artifact."""
|
|
65
|
+
|
|
66
|
+
id: str = Field(..., description="Artifact ID")
|
|
67
|
+
version: str | None = Field(default=None, description="Specific version to fetch")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class ArtifactGetResponse(DevRevResponseModel):
|
|
71
|
+
"""Response from getting an artifact."""
|
|
72
|
+
|
|
73
|
+
artifact: Artifact = Field(..., description="Retrieved artifact")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ArtifactListRequest(DevRevBaseModel):
|
|
77
|
+
"""Request to list artifacts."""
|
|
78
|
+
|
|
79
|
+
parent_id: str | None = Field(default=None, description="Filter artifacts by parent object ID")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ArtifactListResponse(PaginatedResponse):
|
|
83
|
+
"""Response from listing artifacts."""
|
|
84
|
+
|
|
85
|
+
artifacts: list[Artifact] = Field(default_factory=list, description="List of artifacts")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ArtifactLocateRequest(DevRevBaseModel):
|
|
89
|
+
"""Request to get artifact download URL."""
|
|
90
|
+
|
|
91
|
+
id: str = Field(..., description="Artifact ID")
|
|
92
|
+
version: str | None = Field(default=None, description="Specific version to locate")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class ArtifactLocateResponse(DevRevResponseModel):
|
|
96
|
+
"""Response with artifact download URL."""
|
|
97
|
+
|
|
98
|
+
url: str = Field(..., description="Download URL for the artifact")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class ArtifactVersionsPrepareRequest(DevRevBaseModel):
|
|
102
|
+
"""Request to prepare a new version of an artifact."""
|
|
103
|
+
|
|
104
|
+
id: str = Field(..., description="Artifact ID to create new version for")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class ArtifactVersionsPrepareResponse(DevRevResponseModel):
|
|
108
|
+
"""Response from preparing a new artifact version."""
|
|
109
|
+
|
|
110
|
+
id: str = Field(..., description="Artifact ID")
|
|
111
|
+
url: str = Field(..., description="URL to upload new version data to")
|
|
112
|
+
form_data: list[ArtifactPrepareFormData] = Field(
|
|
113
|
+
..., description="POST policy form data for upload"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class ArtifactVersionsDeleteRequest(DevRevBaseModel):
|
|
118
|
+
"""Request to delete an artifact version."""
|
|
119
|
+
|
|
120
|
+
id: str = Field(..., description="Artifact ID")
|
|
121
|
+
version: str = Field(..., description="Version to delete")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class ArtifactVersionsDeleteResponse(DevRevResponseModel):
|
|
125
|
+
"""Response from deleting an artifact version."""
|
|
126
|
+
|
|
127
|
+
pass
|