vikunja-python 0.1.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.
- vikunja_python/__init__.py +0 -0
- vikunja_python/cli/__init__.py +0 -0
- vikunja_python/cli/main.py +264 -0
- vikunja_python/core/__init__.py +0 -0
- vikunja_python/core/client.py +106 -0
- vikunja_python/core/models/__init__.py +377 -0
- vikunja_python/core/models/api_token.py +131 -0
- vikunja_python/core/models/auth.py +34 -0
- vikunja_python/core/models/base.py +193 -0
- vikunja_python/core/models/bulk_assignees.py +98 -0
- vikunja_python/core/models/filter.py +134 -0
- vikunja_python/core/models/label.py +230 -0
- vikunja_python/core/models/link_sharing.py +138 -0
- vikunja_python/core/models/migration.py +404 -0
- vikunja_python/core/models/phase6_medium.py +74 -0
- vikunja_python/core/models/project.py +217 -0
- vikunja_python/core/models/relation.py +199 -0
- vikunja_python/core/models/task.py +261 -0
- vikunja_python/core/models/task_expansion.py +252 -0
- vikunja_python/core/models/user.py +838 -0
- vikunja_python/core/models/webhook.py +270 -0
- vikunja_python/mcp/__init__.py +0 -0
- vikunja_python/mcp/server.py +678 -0
- vikunja_python-0.1.0.dist-info/METADATA +16 -0
- vikunja_python-0.1.0.dist-info/RECORD +28 -0
- vikunja_python-0.1.0.dist-info/WHEEL +5 -0
- vikunja_python-0.1.0.dist-info/entry_points.txt +3 -0
- vikunja_python-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Vikunja Pydantic Models - Package Exports
|
|
3
|
+
|
|
4
|
+
This package provides Pydantic v2 models for the Vikunja API (v2.3.0).
|
|
5
|
+
Models are the source of truth for all API interactions.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from vikunja_python.models import Task, Project, TaskCreateRequest
|
|
9
|
+
|
|
10
|
+
# Create a task
|
|
11
|
+
task = TaskCreateRequest(title="My Task", priority=3)
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
# Base configuration and shared models
|
|
15
|
+
from .base import (
|
|
16
|
+
VikunjaBaseModel,
|
|
17
|
+
User,
|
|
18
|
+
ErrorDetail,
|
|
19
|
+
Message,
|
|
20
|
+
Token,
|
|
21
|
+
PaginationInfo,
|
|
22
|
+
ListResponse,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
# Task models
|
|
26
|
+
from .task import (
|
|
27
|
+
Task,
|
|
28
|
+
TaskCreateRequest,
|
|
29
|
+
TaskUpdateRequest,
|
|
30
|
+
TaskListRequest,
|
|
31
|
+
TaskListResponse,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# Project models
|
|
35
|
+
from .project import (
|
|
36
|
+
Project,
|
|
37
|
+
ProjectCreateRequest,
|
|
38
|
+
ProjectUpdateRequest,
|
|
39
|
+
ProjectListRequest,
|
|
40
|
+
ProjectListResponse,
|
|
41
|
+
ProjectView,
|
|
42
|
+
ViewFilter,
|
|
43
|
+
BucketConfiguration,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Filter models
|
|
47
|
+
from .filter import (
|
|
48
|
+
SavedFilter,
|
|
49
|
+
SavedFilterCreateRequest,
|
|
50
|
+
SavedFilterUpdateRequest,
|
|
51
|
+
SavedFilterListResponse,
|
|
52
|
+
SavedFilterGetResponse,
|
|
53
|
+
TaskCollection,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Label models
|
|
57
|
+
from .label import (
|
|
58
|
+
Label,
|
|
59
|
+
LabelCreateRequest,
|
|
60
|
+
LabelUpdateRequest,
|
|
61
|
+
LabelListResponse,
|
|
62
|
+
LabelGetResponse,
|
|
63
|
+
LabelCreateResponse,
|
|
64
|
+
LabelUpdateResponse,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Task expansion models (comments, attachments, reminders)
|
|
68
|
+
from .task_expansion import (
|
|
69
|
+
TaskComment,
|
|
70
|
+
TaskAttachment,
|
|
71
|
+
TaskReminder,
|
|
72
|
+
ReminderRelation,
|
|
73
|
+
TaskCommentsResponse,
|
|
74
|
+
TaskAttachmentsResponse,
|
|
75
|
+
TaskRemindersResponse,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Relationship models
|
|
79
|
+
from .relation import (
|
|
80
|
+
RelationKind,
|
|
81
|
+
RELATION_KIND_DESCRIPTIONS,
|
|
82
|
+
TaskRelation,
|
|
83
|
+
TaskRelationCreateRequest,
|
|
84
|
+
TaskRelationUpdateRequest,
|
|
85
|
+
TaskRelationListResponse,
|
|
86
|
+
TaskRelationGetResponse,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# User and Team models
|
|
90
|
+
from .user import (
|
|
91
|
+
# Core user models
|
|
92
|
+
User,
|
|
93
|
+
UserSettings,
|
|
94
|
+
UserWithSettings,
|
|
95
|
+
|
|
96
|
+
# Permission enum
|
|
97
|
+
Permission,
|
|
98
|
+
PERMISSION_DESCRIPTIONS,
|
|
99
|
+
|
|
100
|
+
# Auth request models
|
|
101
|
+
LoginRequest,
|
|
102
|
+
RegisterRequest,
|
|
103
|
+
EmailUpdateRequest,
|
|
104
|
+
PasswordResetRequest,
|
|
105
|
+
|
|
106
|
+
# TOTP models
|
|
107
|
+
TOTPSetupResponse,
|
|
108
|
+
TOTPPasscodeRequest,
|
|
109
|
+
|
|
110
|
+
# Project user models
|
|
111
|
+
ProjectUser,
|
|
112
|
+
ProjectUserCreateRequest,
|
|
113
|
+
ProjectUserUpdateRequest,
|
|
114
|
+
|
|
115
|
+
# Team models
|
|
116
|
+
TeamUser,
|
|
117
|
+
TeamMember,
|
|
118
|
+
Team,
|
|
119
|
+
TeamCreateRequest,
|
|
120
|
+
TeamUpdateRequest,
|
|
121
|
+
TeamWithPermission,
|
|
122
|
+
TeamProject,
|
|
123
|
+
|
|
124
|
+
# Response models
|
|
125
|
+
UserGetResponse,
|
|
126
|
+
LoginResponse,
|
|
127
|
+
TeamListResponse,
|
|
128
|
+
TeamGetResponse,
|
|
129
|
+
ProjectUserListResponse,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# CSV Import and Migration models
|
|
133
|
+
from .migration import (
|
|
134
|
+
# CSV Task Attribute enum
|
|
135
|
+
TaskAttribute,
|
|
136
|
+
AttrTitle,
|
|
137
|
+
AttrDescription,
|
|
138
|
+
AttrDueDate,
|
|
139
|
+
AttrStartDate,
|
|
140
|
+
AttrEndDate,
|
|
141
|
+
AttrDone,
|
|
142
|
+
AttrPriority,
|
|
143
|
+
AttrLabels,
|
|
144
|
+
AttrProject,
|
|
145
|
+
AttrReminder,
|
|
146
|
+
AttrIgnore,
|
|
147
|
+
|
|
148
|
+
# CSV Import models
|
|
149
|
+
ColumnMapping,
|
|
150
|
+
DetectionResult,
|
|
151
|
+
PreviewTask,
|
|
152
|
+
PreviewResult,
|
|
153
|
+
|
|
154
|
+
# Migration models
|
|
155
|
+
MigrationStatus,
|
|
156
|
+
MicrosoftTodoMigrationRequest,
|
|
157
|
+
TodoistMigrationRequest,
|
|
158
|
+
TrelloMigrationRequest,
|
|
159
|
+
|
|
160
|
+
# Response models
|
|
161
|
+
CSVImportResponse,
|
|
162
|
+
MigrationResponse,
|
|
163
|
+
MigrationStatusResponse,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
# Webhook models
|
|
167
|
+
from .webhook import (
|
|
168
|
+
# Webhook Event types
|
|
169
|
+
WebhookEvent,
|
|
170
|
+
TaskCreated,
|
|
171
|
+
TaskUpdated,
|
|
172
|
+
TaskDeleted,
|
|
173
|
+
TaskCompleted,
|
|
174
|
+
TaskUncompleted,
|
|
175
|
+
CommentCreated,
|
|
176
|
+
CommentUpdated,
|
|
177
|
+
CommentDeleted,
|
|
178
|
+
|
|
179
|
+
# Webhook models
|
|
180
|
+
Webhook,
|
|
181
|
+
WebhookCreateRequest,
|
|
182
|
+
WebhookUpdateRequest,
|
|
183
|
+
|
|
184
|
+
# Response models
|
|
185
|
+
WebhookListResponse,
|
|
186
|
+
WebhookGetResponse,
|
|
187
|
+
WebhookCreateResponse,
|
|
188
|
+
WebhookDeleteResponse,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# API Token models (Phase 5 - High Priority)
|
|
192
|
+
from .api_token import (
|
|
193
|
+
# Enums
|
|
194
|
+
Permission as APIPermission,
|
|
195
|
+
SharingType as APISharingType,
|
|
196
|
+
|
|
197
|
+
# Core models
|
|
198
|
+
RouteDetail,
|
|
199
|
+
APITokenRoute,
|
|
200
|
+
APIToken,
|
|
201
|
+
|
|
202
|
+
# Request models
|
|
203
|
+
APITokenCreateRequest,
|
|
204
|
+
APITokenUpdateRequest,
|
|
205
|
+
|
|
206
|
+
# Response models
|
|
207
|
+
APITokenListResponse,
|
|
208
|
+
APITokenGetResponse,
|
|
209
|
+
APITokenCreateResponse,
|
|
210
|
+
APITokenDeleteResponse,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
# Bulk Assignment models (Phase 5 - High Priority)
|
|
214
|
+
from .bulk_assignees import (
|
|
215
|
+
User as BulkUser,
|
|
216
|
+
BulkAssignees,
|
|
217
|
+
BulkAssigneesCreateRequest,
|
|
218
|
+
BulkAssigneesResponse,
|
|
219
|
+
BulkTask,
|
|
220
|
+
BulkTaskResponse,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
# Link Sharing models (Phase 5 - High Priority)
|
|
224
|
+
from .link_sharing import (
|
|
225
|
+
# Enums
|
|
226
|
+
SharingType,
|
|
227
|
+
Permission as LinkPermission,
|
|
228
|
+
|
|
229
|
+
# Core models
|
|
230
|
+
LinkSharing,
|
|
231
|
+
|
|
232
|
+
# Request models
|
|
233
|
+
LinkSharingCreateRequest,
|
|
234
|
+
LinkSharingUpdateRequest,
|
|
235
|
+
|
|
236
|
+
# Response models
|
|
237
|
+
LinkSharingListResponse,
|
|
238
|
+
LinkSharingGetResponse,
|
|
239
|
+
LinkSharingCreateResponse,
|
|
240
|
+
LinkSharingDeleteResponse,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
__all__ = [
|
|
244
|
+
# Base models
|
|
245
|
+
"VikunjaBaseModel",
|
|
246
|
+
"User",
|
|
247
|
+
"ErrorDetail",
|
|
248
|
+
"Message",
|
|
249
|
+
"Token",
|
|
250
|
+
"PaginationInfo",
|
|
251
|
+
"ListResponse",
|
|
252
|
+
|
|
253
|
+
# Task models
|
|
254
|
+
"Task",
|
|
255
|
+
"TaskCreateRequest",
|
|
256
|
+
"TaskUpdateRequest",
|
|
257
|
+
"TaskListRequest",
|
|
258
|
+
"TaskListResponse",
|
|
259
|
+
|
|
260
|
+
# Project models
|
|
261
|
+
"Project",
|
|
262
|
+
"ProjectCreateRequest",
|
|
263
|
+
"ProjectUpdateRequest",
|
|
264
|
+
"ProjectListRequest",
|
|
265
|
+
"ProjectListResponse",
|
|
266
|
+
"ProjectView",
|
|
267
|
+
"ViewFilter",
|
|
268
|
+
"BucketConfiguration",
|
|
269
|
+
|
|
270
|
+
# Filter models
|
|
271
|
+
"SavedFilter",
|
|
272
|
+
"SavedFilterCreateRequest",
|
|
273
|
+
"SavedFilterUpdateRequest",
|
|
274
|
+
"SavedFilterListResponse",
|
|
275
|
+
"SavedFilterGetResponse",
|
|
276
|
+
"TaskCollection",
|
|
277
|
+
|
|
278
|
+
# Label models
|
|
279
|
+
"Label",
|
|
280
|
+
"LabelCreateRequest",
|
|
281
|
+
"LabelUpdateRequest",
|
|
282
|
+
"LabelListResponse",
|
|
283
|
+
"LabelGetResponse",
|
|
284
|
+
"LabelCreateResponse",
|
|
285
|
+
"LabelUpdateResponse",
|
|
286
|
+
|
|
287
|
+
# Task expansion models (comments, attachments, reminders)
|
|
288
|
+
"TaskComment",
|
|
289
|
+
"TaskAttachment",
|
|
290
|
+
"TaskReminder",
|
|
291
|
+
"ReminderRelation",
|
|
292
|
+
"TaskCommentsResponse",
|
|
293
|
+
"TaskAttachmentsResponse",
|
|
294
|
+
"TaskRemindersResponse",
|
|
295
|
+
|
|
296
|
+
# Relationship models
|
|
297
|
+
"RelationKind",
|
|
298
|
+
"RELATION_KIND_DESCRIPTIONS",
|
|
299
|
+
"TaskRelation",
|
|
300
|
+
"TaskRelationCreateRequest",
|
|
301
|
+
"TaskRelationUpdateRequest",
|
|
302
|
+
"TaskRelationListResponse",
|
|
303
|
+
"TaskRelationGetResponse",
|
|
304
|
+
|
|
305
|
+
# User and Team models
|
|
306
|
+
"User",
|
|
307
|
+
"UserSettings",
|
|
308
|
+
"UserWithSettings",
|
|
309
|
+
"Permission",
|
|
310
|
+
"PERMISSION_DESCRIPTIONS",
|
|
311
|
+
"LoginRequest",
|
|
312
|
+
"RegisterRequest",
|
|
313
|
+
"EmailUpdateRequest",
|
|
314
|
+
"PasswordResetRequest",
|
|
315
|
+
"TOTPSetupResponse",
|
|
316
|
+
"TOTPPasscodeRequest",
|
|
317
|
+
"ProjectUser",
|
|
318
|
+
"ProjectUserCreateRequest",
|
|
319
|
+
"ProjectUserUpdateRequest",
|
|
320
|
+
"TeamUser",
|
|
321
|
+
"TeamMember",
|
|
322
|
+
"Team",
|
|
323
|
+
"TeamCreateRequest",
|
|
324
|
+
"TeamUpdateRequest",
|
|
325
|
+
"TeamWithPermission",
|
|
326
|
+
"TeamProject",
|
|
327
|
+
"UserGetResponse",
|
|
328
|
+
"LoginResponse",
|
|
329
|
+
"TeamListResponse",
|
|
330
|
+
"TeamGetResponse",
|
|
331
|
+
"ProjectUserListResponse",
|
|
332
|
+
|
|
333
|
+
# CSV Import and Migration models
|
|
334
|
+
"TaskAttribute",
|
|
335
|
+
"AttrTitle",
|
|
336
|
+
"AttrDescription",
|
|
337
|
+
"AttrDueDate",
|
|
338
|
+
"AttrStartDate",
|
|
339
|
+
"AttrEndDate",
|
|
340
|
+
"AttrDone",
|
|
341
|
+
"AttrPriority",
|
|
342
|
+
"AttrLabels",
|
|
343
|
+
"AttrProject",
|
|
344
|
+
"AttrReminder",
|
|
345
|
+
"AttrIgnore",
|
|
346
|
+
"ColumnMapping",
|
|
347
|
+
"DetectionResult",
|
|
348
|
+
"PreviewTask",
|
|
349
|
+
"PreviewResult",
|
|
350
|
+
"MigrationStatus",
|
|
351
|
+
"MicrosoftTodoMigrationRequest",
|
|
352
|
+
"TodoistMigrationRequest",
|
|
353
|
+
"TrelloMigrationRequest",
|
|
354
|
+
"CSVImportResponse",
|
|
355
|
+
"MigrationResponse",
|
|
356
|
+
"MigrationStatusResponse",
|
|
357
|
+
|
|
358
|
+
# Webhook models
|
|
359
|
+
"WebhookEvent",
|
|
360
|
+
"TaskCreated",
|
|
361
|
+
"TaskUpdated",
|
|
362
|
+
"TaskDeleted",
|
|
363
|
+
"TaskCompleted",
|
|
364
|
+
"TaskUncompleted",
|
|
365
|
+
"CommentCreated",
|
|
366
|
+
"CommentUpdated",
|
|
367
|
+
"CommentDeleted",
|
|
368
|
+
"Webhook",
|
|
369
|
+
"WebhookCreateRequest",
|
|
370
|
+
"WebhookUpdateRequest",
|
|
371
|
+
"WebhookListResponse",
|
|
372
|
+
"WebhookGetResponse",
|
|
373
|
+
"WebhookCreateResponse",
|
|
374
|
+
"WebhookDeleteResponse",
|
|
375
|
+
]
|
|
376
|
+
|
|
377
|
+
__version__ = "0.6.0"
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""
|
|
2
|
+
API Token Management Models
|
|
3
|
+
|
|
4
|
+
Models for managing Vikunja API tokens, including creation, listing, and permission details.
|
|
5
|
+
Based on Vikunja API v2.3.0 specification.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from datetime import datetime
|
|
11
|
+
from enum import IntEnum
|
|
12
|
+
from typing import Dict, List, Optional
|
|
13
|
+
|
|
14
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Permission(IntEnum):
|
|
18
|
+
"""Permission levels for API tokens and project sharing."""
|
|
19
|
+
|
|
20
|
+
READ_ONLY = 0
|
|
21
|
+
"""Read-only access - can view but not modify"""
|
|
22
|
+
|
|
23
|
+
READ_WRITE = 1
|
|
24
|
+
"""Write access - can create, update, delete own items"""
|
|
25
|
+
|
|
26
|
+
ADMIN = 2
|
|
27
|
+
"""Admin access - full control including member management"""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SharingType(IntEnum):
|
|
31
|
+
"""Types of link sharing for projects."""
|
|
32
|
+
|
|
33
|
+
UNDEFINED = 0
|
|
34
|
+
"""Undefined sharing type"""
|
|
35
|
+
|
|
36
|
+
WITHOUT_PASSWORD = 1
|
|
37
|
+
"""Shared without password protection"""
|
|
38
|
+
|
|
39
|
+
WITH_PASSWORD = 2
|
|
40
|
+
"""Shared with password protection"""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class RouteDetail(BaseModel):
|
|
44
|
+
"""API route detail for token permissions."""
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(extra='ignore')
|
|
47
|
+
|
|
48
|
+
method: str = Field(..., description="HTTP method (GET, POST, PUT, DELETE)")
|
|
49
|
+
path: str = Field(..., description="API path pattern")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class APITokenRoute(BaseModel):
|
|
53
|
+
"""API token route definition."""
|
|
54
|
+
|
|
55
|
+
model_config = ConfigDict(extra='ignore')
|
|
56
|
+
|
|
57
|
+
# Note: API spec shows empty object - may be populated with route details
|
|
58
|
+
# Placeholder for future expansion when /routes endpoint is fully documented
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class APIToken(BaseModel):
|
|
63
|
+
"""API token representation.
|
|
64
|
+
|
|
65
|
+
Represents an API key that can be used to authenticate requests to the Vikunja API.
|
|
66
|
+
The actual token value is only visible immediately after creation.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
model_config = ConfigDict(extra='ignore')
|
|
70
|
+
|
|
71
|
+
id: int = Field(..., description="The unique, numeric id of this api key")
|
|
72
|
+
title: str = Field(..., max_length=255, description="A human-readable name for this token")
|
|
73
|
+
created: datetime = Field(..., description="A timestamp when this api key was created. You cannot change this value.")
|
|
74
|
+
expires_at: Optional[datetime] = Field(None, description="The date when this key expires. Null means no expiration.")
|
|
75
|
+
permissions: dict = Field(default_factory=dict, description="The permissions this token has. Possible values are available via the /routes endpoint and consist of HTTP method + path combinations.")
|
|
76
|
+
|
|
77
|
+
# The actual token value - only visible after creation
|
|
78
|
+
# This field is typically set only on create response
|
|
79
|
+
token: Optional[str] = Field(None, description="The actual api key. Only visible after creation. Store this securely!")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class APITokenCreateRequest(BaseModel):
|
|
83
|
+
"""Request to create a new API token."""
|
|
84
|
+
|
|
85
|
+
model_config = ConfigDict(extra='ignore')
|
|
86
|
+
|
|
87
|
+
title: str = Field(..., max_length=255, description="A human-readable name for this token")
|
|
88
|
+
expires_at: Optional[datetime] = Field(None, description="The date when this key expires. Null means no expiration.")
|
|
89
|
+
permissions: Optional[Dict[str, List[str]]] = Field(None, description="Map of resource names to lists of allowed actions (e.g., {'projects': ['create', 'read_all']}). If null, grants all permissions.")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class APITokenUpdateRequest(BaseModel):
|
|
93
|
+
"""Request to update an API token."""
|
|
94
|
+
|
|
95
|
+
model_config = ConfigDict(extra='ignore')
|
|
96
|
+
|
|
97
|
+
title: Optional[str] = Field(None, max_length=255, description="A human-readable name for this token")
|
|
98
|
+
expires_at: Optional[datetime] = Field(None, description="The date when this key expires. Null means no expiration.")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class APITokenListResponse(BaseModel):
|
|
102
|
+
"""Response containing a list of API tokens."""
|
|
103
|
+
|
|
104
|
+
model_config = ConfigDict(extra='ignore')
|
|
105
|
+
|
|
106
|
+
tokens: list[APIToken] = Field(default_factory=list, description="List of API tokens")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class APITokenGetResponse(BaseModel):
|
|
110
|
+
"""Response containing a single API token (with sensitive data)."""
|
|
111
|
+
|
|
112
|
+
model_config = ConfigDict(extra='ignore')
|
|
113
|
+
|
|
114
|
+
token: APIToken = Field(..., description="The API token details")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class APITokenCreateResponse(BaseModel):
|
|
118
|
+
"""Response from creating an API token (includes the actual token value)."""
|
|
119
|
+
|
|
120
|
+
model_config = ConfigDict(extra='ignore')
|
|
121
|
+
|
|
122
|
+
token: APIToken = Field(..., description="The created API token with the actual token value")
|
|
123
|
+
warning: Optional[str] = Field(None, description="Warning message about storing the token securely")
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class APITokenDeleteResponse(BaseModel):
|
|
127
|
+
"""Response from deleting an API token."""
|
|
128
|
+
|
|
129
|
+
model_config = ConfigDict(extra='ignore')
|
|
130
|
+
|
|
131
|
+
success: bool = Field(..., description="Whether the deletion was successful")
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import Dict, List, Optional
|
|
5
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class APIPermissions(BaseModel):
|
|
9
|
+
model_config = ConfigDict(extra='ignore')
|
|
10
|
+
|
|
11
|
+
# Using a dict of lists to represent the structure discovered in the PUT request
|
|
12
|
+
# e.g., {"projects": ["create", "delete"], "tasks": ["read_all"]}
|
|
13
|
+
# We'll use a generic Dict for the actual implementation to handle the vast array of keys.
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class APIToken(BaseModel):
|
|
18
|
+
model_config = ConfigDict(extra='ignore')
|
|
19
|
+
|
|
20
|
+
id: int
|
|
21
|
+
title: str
|
|
22
|
+
token: str
|
|
23
|
+
permissions: Dict[str, List[str]]
|
|
24
|
+
expires_at: Optional[datetime] = None
|
|
25
|
+
created: datetime
|
|
26
|
+
updated: Optional[datetime] = None
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class APITokenCreateRequest(BaseModel):
|
|
30
|
+
model_config = ConfigDict(extra='ignore')
|
|
31
|
+
|
|
32
|
+
title: str
|
|
33
|
+
permissions: Dict[str, List[str]]
|
|
34
|
+
expires_at: Optional[datetime] = None
|