devrev-Python-SDK 2.7.0__py3-none-any.whl → 2.8.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.
- devrev/client.py +15 -2
- devrev/models/__init__.py +33 -0
- devrev/models/articles.py +16 -0
- devrev/models/artifacts.py +125 -0
- devrev/services/articles.py +563 -0
- devrev/services/artifacts.py +403 -0
- devrev/services/base.py +13 -2
- devrev_mcp/tools/articles.py +32 -17
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.0.dist-info}/METADATA +28 -12
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.0.dist-info}/RECORD +12 -10
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.0.dist-info}/WHEEL +0 -0
- {devrev_python_sdk-2.7.0.dist-info → devrev_python_sdk-2.8.0.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
|
@@ -42,6 +42,9 @@ class Article(DevRevResponseModel):
|
|
|
42
42
|
owned_by: list[UserSummary] | None = Field(default=None, description="Owners of the article")
|
|
43
43
|
created_date: datetime | None = Field(default=None, description="Creation date")
|
|
44
44
|
modified_date: datetime | None = Field(default=None, description="Last modified")
|
|
45
|
+
resource: dict[str, Any] | None = Field(
|
|
46
|
+
default=None, description="Resource configuration including artifact references"
|
|
47
|
+
)
|
|
45
48
|
|
|
46
49
|
|
|
47
50
|
class ArticleSummary(DevRevResponseModel):
|
|
@@ -51,6 +54,19 @@ class ArticleSummary(DevRevResponseModel):
|
|
|
51
54
|
title: str | None = Field(default=None, description="Article title")
|
|
52
55
|
|
|
53
56
|
|
|
57
|
+
class ArticleWithContent(DevRevResponseModel):
|
|
58
|
+
"""Article with its content loaded.
|
|
59
|
+
|
|
60
|
+
This model combines article metadata with the actual article body content,
|
|
61
|
+
which is stored separately as an artifact in the DevRev system.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
article: Article = Field(..., description="Article metadata")
|
|
65
|
+
content: str = Field(..., description="Article body content")
|
|
66
|
+
content_format: str = Field(default="text/plain", description="Content MIME type")
|
|
67
|
+
content_version: str | None = Field(default=None, description="Artifact version")
|
|
68
|
+
|
|
69
|
+
|
|
54
70
|
class ArticlesCreateRequest(DevRevBaseModel):
|
|
55
71
|
"""Request to create an article."""
|
|
56
72
|
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""Artifact models for DevRev SDK."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
|
|
7
|
+
from pydantic import Field
|
|
8
|
+
|
|
9
|
+
from devrev.models.base import DevRevBaseModel, DevRevResponseModel, PaginatedResponse
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Artifact(DevRevResponseModel):
|
|
13
|
+
"""DevRev Artifact model."""
|
|
14
|
+
|
|
15
|
+
id: str = Field(..., description="Artifact ID")
|
|
16
|
+
created_by: str | None = Field(default=None, description="Creator user ID")
|
|
17
|
+
created_date: datetime | None = Field(default=None, description="Creation timestamp")
|
|
18
|
+
file_name: str | None = Field(default=None, description="Original file name")
|
|
19
|
+
file_type: str | None = Field(default=None, description="MIME type of the file")
|
|
20
|
+
file_size: int | None = Field(default=None, description="File size in bytes")
|
|
21
|
+
version: str | None = Field(default=None, description="Artifact version")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ArtifactPrepareFormData(DevRevResponseModel):
|
|
25
|
+
"""Form data field for artifact upload."""
|
|
26
|
+
|
|
27
|
+
key: str = Field(..., description="Form field key")
|
|
28
|
+
value: str = Field(..., description="Form field value")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ArtifactPrepareRequest(DevRevBaseModel):
|
|
32
|
+
"""Request to prepare an artifact for upload."""
|
|
33
|
+
|
|
34
|
+
file_name: str = Field(..., description="Name of file being uploaded")
|
|
35
|
+
file_type: str | None = Field(default=None, description="MIME type of the file")
|
|
36
|
+
configuration_set: str | None = Field(
|
|
37
|
+
default=None,
|
|
38
|
+
description=(
|
|
39
|
+
"Configuration set for the artifact. "
|
|
40
|
+
"Use 'article_media' for article content. "
|
|
41
|
+
"Valid values: article_media, default, email_media, job_data, "
|
|
42
|
+
"marketplace_listing_icon, marketplace_media, org_logo, plug_css, "
|
|
43
|
+
"plug_setting, plug_setting_banner_card, portal_css, "
|
|
44
|
+
"snap_in_functions_code, snap_widget, user_profile_picture, work"
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class ArtifactPrepareResponse(DevRevResponseModel):
|
|
50
|
+
"""Response from preparing an artifact upload."""
|
|
51
|
+
|
|
52
|
+
id: str = Field(..., description="Generated artifact ID")
|
|
53
|
+
url: str = Field(..., description="URL to upload file data to")
|
|
54
|
+
form_data: list[ArtifactPrepareFormData] = Field(
|
|
55
|
+
..., description="POST policy form data for upload"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ArtifactGetRequest(DevRevBaseModel):
|
|
60
|
+
"""Request to get an artifact."""
|
|
61
|
+
|
|
62
|
+
id: str = Field(..., description="Artifact ID")
|
|
63
|
+
version: str | None = Field(default=None, description="Specific version to fetch")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ArtifactGetResponse(DevRevResponseModel):
|
|
67
|
+
"""Response from getting an artifact."""
|
|
68
|
+
|
|
69
|
+
artifact: Artifact = Field(..., description="Retrieved artifact")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class ArtifactListRequest(DevRevBaseModel):
|
|
73
|
+
"""Request to list artifacts."""
|
|
74
|
+
|
|
75
|
+
parent_id: str | None = Field(
|
|
76
|
+
default=None, description="Filter artifacts by parent object ID"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ArtifactListResponse(PaginatedResponse):
|
|
81
|
+
"""Response from listing artifacts."""
|
|
82
|
+
|
|
83
|
+
artifacts: list[Artifact] = Field(default_factory=list, description="List of artifacts")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ArtifactLocateRequest(DevRevBaseModel):
|
|
87
|
+
"""Request to get artifact download URL."""
|
|
88
|
+
|
|
89
|
+
id: str = Field(..., description="Artifact ID")
|
|
90
|
+
version: str | None = Field(default=None, description="Specific version to locate")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ArtifactLocateResponse(DevRevResponseModel):
|
|
94
|
+
"""Response with artifact download URL."""
|
|
95
|
+
|
|
96
|
+
url: str = Field(..., description="Download URL for the artifact")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class ArtifactVersionsPrepareRequest(DevRevBaseModel):
|
|
100
|
+
"""Request to prepare a new version of an artifact."""
|
|
101
|
+
|
|
102
|
+
id: str = Field(..., description="Artifact ID to create new version for")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class ArtifactVersionsPrepareResponse(DevRevResponseModel):
|
|
106
|
+
"""Response from preparing a new artifact version."""
|
|
107
|
+
|
|
108
|
+
id: str = Field(..., description="Artifact ID")
|
|
109
|
+
url: str = Field(..., description="URL to upload new version data to")
|
|
110
|
+
form_data: list[ArtifactPrepareFormData] = Field(
|
|
111
|
+
..., description="POST policy form data for upload"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class ArtifactVersionsDeleteRequest(DevRevBaseModel):
|
|
116
|
+
"""Request to delete an artifact version."""
|
|
117
|
+
|
|
118
|
+
id: str = Field(..., description="Artifact ID")
|
|
119
|
+
version: str = Field(..., description="Version to delete")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class ArtifactVersionsDeleteResponse(DevRevResponseModel):
|
|
123
|
+
"""Response from deleting an artifact version."""
|
|
124
|
+
|
|
125
|
+
pass
|