kscale 0.0.9__tar.gz → 0.0.11__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {kscale-0.0.9/kscale.egg-info → kscale-0.0.11}/PKG-INFO +1 -1
- {kscale-0.0.9 → kscale-0.0.11}/kscale/__init__.py +1 -1
- kscale-0.0.11/kscale/store/api.py +64 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/gen/api.py +98 -2
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/utils.py +1 -1
- {kscale-0.0.9 → kscale-0.0.11/kscale.egg-info}/PKG-INFO +1 -1
- kscale-0.0.9/kscale/store/api.py +0 -24
- {kscale-0.0.9 → kscale-0.0.11}/LICENSE +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/MANIFEST.in +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/README.md +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/api.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/artifacts/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/artifacts/plane.obj +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/artifacts/plane.urdf +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/conf.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/py.typed +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/requirements-dev.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/requirements.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/cli.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/client.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/gen/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/pybullet.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/store/urdf.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/utils/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale/utils/api_base.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale.egg-info/SOURCES.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale.egg-info/dependency_links.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale.egg-info/entry_points.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale.egg-info/not-zip-safe +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale.egg-info/requires.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/kscale.egg-info/top_level.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/pyproject.toml +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/setup.cfg +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/setup.py +0 -0
- {kscale-0.0.9 → kscale-0.0.11}/tests/test_dummy.py +0 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
"""Defines a common interface for the K-Scale Store API."""
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import overload
|
5
|
+
|
6
|
+
from kscale.store.gen.api import UploadArtifactResponse
|
7
|
+
from kscale.store.urdf import download_urdf, upload_urdf
|
8
|
+
from kscale.utils.api_base import APIBase
|
9
|
+
|
10
|
+
|
11
|
+
class StoreAPI(APIBase):
|
12
|
+
def __init__(
|
13
|
+
self,
|
14
|
+
*,
|
15
|
+
api_key: str | None = None,
|
16
|
+
) -> None:
|
17
|
+
super().__init__()
|
18
|
+
|
19
|
+
self.api_key = api_key
|
20
|
+
|
21
|
+
async def artifact_root(self, artifact_id: str) -> Path:
|
22
|
+
return await download_urdf(artifact_id)
|
23
|
+
|
24
|
+
@overload
|
25
|
+
async def urdf_path(self, artifact_id: str) -> Path: ...
|
26
|
+
|
27
|
+
@overload
|
28
|
+
async def urdf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
|
29
|
+
|
30
|
+
async def urdf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
|
31
|
+
root_dir = await self.artifact_root(artifact_id)
|
32
|
+
urdf_path = next(root_dir.glob("*.urdf"), None)
|
33
|
+
if urdf_path is None and throw_if_missing:
|
34
|
+
raise FileNotFoundError(f"No URDF found for artifact {artifact_id}")
|
35
|
+
return urdf_path
|
36
|
+
|
37
|
+
@overload
|
38
|
+
async def mjcf_path(self, artifact_id: str) -> Path: ...
|
39
|
+
|
40
|
+
@overload
|
41
|
+
async def mjcf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
|
42
|
+
|
43
|
+
async def mjcf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
|
44
|
+
root_dir = await self.artifact_root(artifact_id)
|
45
|
+
mjcf_path = next(root_dir.glob("*.mjcf"), None)
|
46
|
+
if mjcf_path is None and throw_if_missing:
|
47
|
+
raise FileNotFoundError(f"No MJCF found for artifact {artifact_id}")
|
48
|
+
return mjcf_path
|
49
|
+
|
50
|
+
@overload
|
51
|
+
async def xml_path(self, artifact_id: str) -> Path: ...
|
52
|
+
|
53
|
+
@overload
|
54
|
+
async def xml_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
|
55
|
+
|
56
|
+
async def xml_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
|
57
|
+
root_dir = await self.artifact_root(artifact_id)
|
58
|
+
xml_path = next(root_dir.glob("*.xml"), None)
|
59
|
+
if xml_path is None and throw_if_missing:
|
60
|
+
raise FileNotFoundError(f"No XML found for artifact {artifact_id}")
|
61
|
+
return xml_path
|
62
|
+
|
63
|
+
async def upload_urdf(self, listing_id: str, root_dir: Path) -> UploadArtifactResponse:
|
64
|
+
return await upload_urdf(listing_id, root_dir)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# generated by datamodel-codegen:
|
4
4
|
# filename: openapi.json
|
5
|
-
# timestamp: 2024-
|
5
|
+
# timestamp: 2024-10-23T08:09:02+00:00
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
@@ -34,6 +34,15 @@ class ClientIdResponse(BaseModel):
|
|
34
34
|
client_id: str = Field(..., title="Client Id")
|
35
35
|
|
36
36
|
|
37
|
+
class CreateCheckoutSessionRequest(BaseModel):
|
38
|
+
product_id: str = Field(..., title="Product Id")
|
39
|
+
cancel_url: str = Field(..., title="Cancel Url")
|
40
|
+
|
41
|
+
|
42
|
+
class CreateCheckoutSessionResponse(BaseModel):
|
43
|
+
session_id: str = Field(..., title="Session Id")
|
44
|
+
|
45
|
+
|
37
46
|
class DeleteTokenResponse(BaseModel):
|
38
47
|
message: str = Field(..., title="Message")
|
39
48
|
|
@@ -59,6 +68,7 @@ class GetListingResponse(BaseModel):
|
|
59
68
|
score: int = Field(..., title="Score")
|
60
69
|
user_vote: Optional[bool] = Field(..., title="User Vote")
|
61
70
|
creator_id: str = Field(..., title="Creator Id")
|
71
|
+
creator_name: Optional[str] = Field(..., title="Creator Name")
|
62
72
|
|
63
73
|
|
64
74
|
class GetTokenResponse(BaseModel):
|
@@ -78,6 +88,26 @@ class GoogleLogin(BaseModel):
|
|
78
88
|
token: str = Field(..., title="Token")
|
79
89
|
|
80
90
|
|
91
|
+
class KernelImageResponse(BaseModel):
|
92
|
+
id: str = Field(..., title="Id")
|
93
|
+
user_id: str = Field(..., title="User Id")
|
94
|
+
name: str = Field(..., title="Name")
|
95
|
+
description: Optional[str] = Field(..., title="Description")
|
96
|
+
size: int = Field(..., title="Size")
|
97
|
+
timestamp: int = Field(..., title="Timestamp")
|
98
|
+
is_public: bool = Field(..., title="Is Public")
|
99
|
+
is_official: bool = Field(..., title="Is Official")
|
100
|
+
downloads: int = Field(..., title="Downloads")
|
101
|
+
|
102
|
+
|
103
|
+
class KernelImageUploadRequest(BaseModel):
|
104
|
+
name: str = Field(..., title="Name")
|
105
|
+
file: str = Field(..., title="File")
|
106
|
+
is_public: bool = Field(..., title="Is Public")
|
107
|
+
is_official: bool = Field(..., title="Is Official")
|
108
|
+
description: Optional[str] = Field(None, title="Description")
|
109
|
+
|
110
|
+
|
81
111
|
class Permission(Enum):
|
82
112
|
read = "read"
|
83
113
|
write = "write"
|
@@ -138,6 +168,7 @@ class LoginResponse(BaseModel):
|
|
138
168
|
|
139
169
|
class Permission1(Enum):
|
140
170
|
is_admin = "is_admin"
|
171
|
+
is_mod = "is_mod"
|
141
172
|
|
142
173
|
|
143
174
|
class MyUserInfoResponse(BaseModel):
|
@@ -171,6 +202,47 @@ class NewListingResponse(BaseModel):
|
|
171
202
|
listing_id: str = Field(..., title="Listing Id")
|
172
203
|
|
173
204
|
|
205
|
+
class Status(Enum):
|
206
|
+
processing = "processing"
|
207
|
+
in_development = "in_development"
|
208
|
+
being_assembled = "being_assembled"
|
209
|
+
shipped = "shipped"
|
210
|
+
delivered = "delivered"
|
211
|
+
cancelled = "cancelled"
|
212
|
+
refunded = "refunded"
|
213
|
+
failed = "failed"
|
214
|
+
|
215
|
+
|
216
|
+
class Order(BaseModel):
|
217
|
+
id: str = Field(..., title="Id")
|
218
|
+
user_id: str = Field(..., title="User Id")
|
219
|
+
user_email: str = Field(..., title="User Email")
|
220
|
+
stripe_checkout_session_id: str = Field(..., title="Stripe Checkout Session Id")
|
221
|
+
stripe_payment_intent_id: str = Field(..., title="Stripe Payment Intent Id")
|
222
|
+
created_at: int = Field(..., title="Created At")
|
223
|
+
updated_at: int = Field(..., title="Updated At")
|
224
|
+
status: Status = Field(..., title="Status")
|
225
|
+
amount: int = Field(..., title="Amount")
|
226
|
+
currency: str = Field(..., title="Currency")
|
227
|
+
quantity: int = Field(..., title="Quantity")
|
228
|
+
product_id: Optional[str] = Field(None, title="Product Id")
|
229
|
+
shipping_name: Optional[str] = Field(None, title="Shipping Name")
|
230
|
+
shipping_address_line1: Optional[str] = Field(None, title="Shipping Address Line1")
|
231
|
+
shipping_address_line2: Optional[str] = Field(None, title="Shipping Address Line2")
|
232
|
+
shipping_city: Optional[str] = Field(None, title="Shipping City")
|
233
|
+
shipping_state: Optional[str] = Field(None, title="Shipping State")
|
234
|
+
shipping_postal_code: Optional[str] = Field(None, title="Shipping Postal Code")
|
235
|
+
shipping_country: Optional[str] = Field(None, title="Shipping Country")
|
236
|
+
|
237
|
+
|
238
|
+
class ProductInfo(BaseModel):
|
239
|
+
id: str = Field(..., title="Id")
|
240
|
+
name: str = Field(..., title="Name")
|
241
|
+
description: Optional[str] = Field(..., title="Description")
|
242
|
+
images: List[str] = Field(..., title="Images")
|
243
|
+
metadata: Dict[str, str] = Field(..., title="Metadata")
|
244
|
+
|
245
|
+
|
174
246
|
class PublicUserInfoResponseItem(BaseModel):
|
175
247
|
id: str = Field(..., title="Id")
|
176
248
|
email: str = Field(..., title="Email")
|
@@ -187,6 +259,11 @@ class PublicUsersInfoResponse(BaseModel):
|
|
187
259
|
users: List[PublicUserInfoResponseItem] = Field(..., title="Users")
|
188
260
|
|
189
261
|
|
262
|
+
class SetModeratorRequest(BaseModel):
|
263
|
+
user_id: str = Field(..., title="User Id")
|
264
|
+
is_mod: bool = Field(..., title="Is Mod")
|
265
|
+
|
266
|
+
|
190
267
|
class SetRequest(BaseModel):
|
191
268
|
onshape_url: Optional[str] = Field(..., title="Onshape Url")
|
192
269
|
|
@@ -220,7 +297,6 @@ class SingleArtifactResponse(BaseModel):
|
|
220
297
|
description: Optional[str] = Field(..., title="Description")
|
221
298
|
timestamp: int = Field(..., title="Timestamp")
|
222
299
|
urls: ArtifactUrls
|
223
|
-
is_new: Optional[bool] = Field(None, title="Is New")
|
224
300
|
|
225
301
|
|
226
302
|
class SortOption(Enum):
|
@@ -241,6 +317,16 @@ class UpdateListingRequest(BaseModel):
|
|
241
317
|
tags: Optional[List[str]] = Field(None, title="Tags")
|
242
318
|
|
243
319
|
|
320
|
+
class UpdateOrderAddressRequest(BaseModel):
|
321
|
+
shipping_name: str = Field(..., title="Shipping Name")
|
322
|
+
shipping_address_line1: str = Field(..., title="Shipping Address Line1")
|
323
|
+
shipping_address_line2: Optional[str] = Field(..., title="Shipping Address Line2")
|
324
|
+
shipping_city: str = Field(..., title="Shipping City")
|
325
|
+
shipping_state: str = Field(..., title="Shipping State")
|
326
|
+
shipping_postal_code: str = Field(..., title="Shipping Postal Code")
|
327
|
+
shipping_country: str = Field(..., title="Shipping Country")
|
328
|
+
|
329
|
+
|
244
330
|
class UpdateUserRequest(BaseModel):
|
245
331
|
email: Optional[str] = Field(None, title="Email")
|
246
332
|
password: Optional[str] = Field(None, title="Password")
|
@@ -256,6 +342,11 @@ class UploadArtifactResponse(BaseModel):
|
|
256
342
|
artifacts: List[SingleArtifactResponse] = Field(..., title="Artifacts")
|
257
343
|
|
258
344
|
|
345
|
+
class UpvotedListingsResponse(BaseModel):
|
346
|
+
upvoted_listing_ids: List[str] = Field(..., title="Upvoted Listing Ids")
|
347
|
+
has_more: bool = Field(..., title="Has More")
|
348
|
+
|
349
|
+
|
259
350
|
class UserInfoResponseItem(BaseModel):
|
260
351
|
id: str = Field(..., title="Id")
|
261
352
|
email: str = Field(..., title="Email")
|
@@ -299,3 +390,8 @@ class HTTPValidationError(BaseModel):
|
|
299
390
|
|
300
391
|
class ListArtifactsResponse(BaseModel):
|
301
392
|
artifacts: List[SingleArtifactResponse] = Field(..., title="Artifacts")
|
393
|
+
|
394
|
+
|
395
|
+
class OrderWithProduct(BaseModel):
|
396
|
+
order: Order
|
397
|
+
product: ProductInfo
|
kscale-0.0.9/kscale/store/api.py
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
"""Defines a common interface for the K-Scale Store API."""
|
2
|
-
|
3
|
-
from pathlib import Path
|
4
|
-
|
5
|
-
from kscale.store.gen.api import UploadArtifactResponse
|
6
|
-
from kscale.store.urdf import download_urdf, upload_urdf
|
7
|
-
from kscale.utils.api_base import APIBase
|
8
|
-
|
9
|
-
|
10
|
-
class StoreAPI(APIBase):
|
11
|
-
def __init__(
|
12
|
-
self,
|
13
|
-
*,
|
14
|
-
api_key: str | None = None,
|
15
|
-
) -> None:
|
16
|
-
super().__init__()
|
17
|
-
|
18
|
-
self.api_key = api_key
|
19
|
-
|
20
|
-
async def urdf(self, artifact_id: str) -> Path:
|
21
|
-
return await download_urdf(artifact_id)
|
22
|
-
|
23
|
-
async def upload_urdf(self, listing_id: str, root_dir: Path) -> UploadArtifactResponse:
|
24
|
-
return await upload_urdf(listing_id, root_dir)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|