kscale 0.0.9__py3-none-any.whl → 0.0.11__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- kscale/__init__.py +1 -1
- kscale/store/api.py +41 -1
- kscale/store/gen/api.py +98 -2
- kscale/store/utils.py +1 -1
- {kscale-0.0.9.dist-info → kscale-0.0.11.dist-info}/METADATA +1 -1
- {kscale-0.0.9.dist-info → kscale-0.0.11.dist-info}/RECORD +10 -10
- {kscale-0.0.9.dist-info → kscale-0.0.11.dist-info}/WHEEL +1 -1
- {kscale-0.0.9.dist-info → kscale-0.0.11.dist-info}/LICENSE +0 -0
- {kscale-0.0.9.dist-info → kscale-0.0.11.dist-info}/entry_points.txt +0 -0
- {kscale-0.0.9.dist-info → kscale-0.0.11.dist-info}/top_level.txt +0 -0
kscale/__init__.py
CHANGED
kscale/store/api.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"""Defines a common interface for the K-Scale Store API."""
|
2
2
|
|
3
3
|
from pathlib import Path
|
4
|
+
from typing import overload
|
4
5
|
|
5
6
|
from kscale.store.gen.api import UploadArtifactResponse
|
6
7
|
from kscale.store.urdf import download_urdf, upload_urdf
|
@@ -17,8 +18,47 @@ class StoreAPI(APIBase):
|
|
17
18
|
|
18
19
|
self.api_key = api_key
|
19
20
|
|
20
|
-
async def
|
21
|
+
async def artifact_root(self, artifact_id: str) -> Path:
|
21
22
|
return await download_urdf(artifact_id)
|
22
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
|
+
|
23
63
|
async def upload_urdf(self, listing_id: str, root_dir: Path) -> UploadArtifactResponse:
|
24
64
|
return await upload_urdf(listing_id, root_dir)
|
kscale/store/gen/api.py
CHANGED
@@ -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/store/utils.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
kscale/__init__.py,sha256=
|
1
|
+
kscale/__init__.py,sha256=4m3jAZmGYlh2S1MiGDtND17NHYndlo25f3NsHy6M3RI,178
|
2
2
|
kscale/api.py,sha256=xBtKj8rgZ400r1Xx9LRY0AzSgIIttoXdejmhHhdVGS0,333
|
3
3
|
kscale/conf.py,sha256=9fShFaYTbnrm_eiGjmy8ZtC4Q4m6PQkWPyoF3eNyov8,1424
|
4
4
|
kscale/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -8,19 +8,19 @@ kscale/artifacts/__init__.py,sha256=RK8wdybtCJPgdLLJ8R8-YMi1Ph5ojqAKVJZowHONtgo,
|
|
8
8
|
kscale/artifacts/plane.obj,sha256=x59-IIrWpLjhotChiqT2Ul6U8s0RcHkaEeUZb4KXL1c,348
|
9
9
|
kscale/artifacts/plane.urdf,sha256=LCiTk14AyTHjkZ1jvsb0hNaEaJUxDb8Z1JjsgpXu3YM,819
|
10
10
|
kscale/store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
kscale/store/api.py,sha256=
|
11
|
+
kscale/store/api.py,sha256=JBp4h6yz_ESSdB-2FpkD_1-hdI8_iEKh9svzkyy3jhs,2386
|
12
12
|
kscale/store/cli.py,sha256=8ygg_1tZzOOHJotEIgSN9pfumcriPmA31sI_FCFQiTo,859
|
13
13
|
kscale/store/client.py,sha256=R1IDnf2J4ojAcP8nmUUHfXhcHUt4zP0-mxtVI7MIC5U,2664
|
14
14
|
kscale/store/pybullet.py,sha256=zoeATQStuRWgmPhku65xjfgvE3Y8ReheUIAkZnDr2C0,7614
|
15
15
|
kscale/store/urdf.py,sha256=5x8tK2BYv901S_yYWYPWEnHv-3T0ALBQMdDwb70EZFw,6395
|
16
|
-
kscale/store/utils.py,sha256=
|
16
|
+
kscale/store/utils.py,sha256=euePSkUllLgbJa4RXrCAhB65-BFJOhEImH0ipDs265w,904
|
17
17
|
kscale/store/gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
kscale/store/gen/api.py,sha256=
|
18
|
+
kscale/store/gen/api.py,sha256=GnNTEfFPXVkr0GuZDCCTx3HZ6VD2Yg1ImWpYV-QfmlM,13323
|
19
19
|
kscale/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
kscale/utils/api_base.py,sha256=Kk_WtRDdJHmOg6NtHmVxVrcfARSUkhfr29ypLch_pO0,112
|
21
|
-
kscale-0.0.
|
22
|
-
kscale-0.0.
|
23
|
-
kscale-0.0.
|
24
|
-
kscale-0.0.
|
25
|
-
kscale-0.0.
|
26
|
-
kscale-0.0.
|
21
|
+
kscale-0.0.11.dist-info/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
|
22
|
+
kscale-0.0.11.dist-info/METADATA,sha256=-BE86Y4RVRIVbvfakjSFbU6QcELc3cFQYofVB01_NkE,2505
|
23
|
+
kscale-0.0.11.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
24
|
+
kscale-0.0.11.dist-info/entry_points.txt,sha256=PaVs1ivqB0BBdGUsiFkxGUYjGLz05VqagxwRVwi4yV4,54
|
25
|
+
kscale-0.0.11.dist-info/top_level.txt,sha256=C2ynjYwopg6YjgttnI2dJjasyq3EKNmYp-IfQg9Xms4,7
|
26
|
+
kscale-0.0.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|