Skip to content

Commit 85f8053

Browse files
committed
chore: update models and api types
1 parent 40a9d3d commit 85f8053

File tree

7 files changed

+87
-45
lines changed

7 files changed

+87
-45
lines changed

cryosparc/api.pyi

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import httpx
4646
from .dataset import Dataset
4747
from .models.api_request import AppSession, SHA256Password
4848
from .models.api_response import (
49-
BrowseFileResponse,
5049
GetFinalResultsResponse,
5150
Hello,
5251
WorkspaceAncestorUidsResponse,
@@ -60,6 +59,7 @@ from .models.diagnostics import RuntimeDiagnostics
6059
from .models.event import CheckpointEvent, Event, ImageEvent, InteractiveEvent, TextEvent
6160
from .models.exposure import Exposure
6261
from .models.external import ExternalOutputSpec
62+
from .models.file_browser import BrowseFileResponse, FileBrowserPrefixes
6363
from .models.job import Job, JobStatus
6464
from .models.job_register import JobRegister
6565
from .models.job_spec import Category, InputSpec, OutputResult, OutputSpec
@@ -102,8 +102,25 @@ class APINamespace:
102102

103103
class ConfigAPI(APINamespace):
104104
"""
105-
Functions available in ``api.config``, e.g., ``api.config.set_instance_banner(...)``
105+
Functions available in ``api.config``, e.g., ``api.config.get_file_browser_settings(...)``
106106
"""
107+
def get_file_browser_settings(self) -> FileBrowserPrefixes:
108+
"""
109+
Returns:
110+
FileBrowserPrefixes: Instance file browser settings
111+
112+
"""
113+
...
114+
def set_file_browser_settings(self, body: FileBrowserPrefixes) -> Any:
115+
"""
116+
Args:
117+
body (FileBrowserPrefixes):
118+
119+
Returns:
120+
Any: Successful Response
121+
122+
"""
123+
...
107124
def set_instance_banner(
108125
self, *, active: bool = False, title: Optional[str] = None, body: Optional[str] = None
109126
) -> Any:
@@ -304,8 +321,13 @@ class InstanceAPI(APINamespace):
304321
305322
"""
306323
...
307-
def audit_dump(self) -> Optional[str]:
324+
def audit_dump(self, *, timestamp: Union[float, str, None] = None) -> Optional[str]:
308325
"""
326+
Generate an audit dump file containing all audit logs since the given timestamp.
327+
328+
Args:
329+
timestamp (float | str, optional): Leave unspecified to dump all audit logs, set to "auto" to dump new logs since the last dump, or set to a UNIX timestamp to dump every log that occurred after it.. Defaults to None
330+
309331
Returns:
310332
str | None: Successful Response
311333
@@ -544,22 +566,6 @@ class UsersAPI(APINamespace):
544566
Returns:
545567
Any: Successful Response
546568
547-
"""
548-
...
549-
def set_allowed_prefix_dir(self, user_id: str, /, allowed_prefix: str) -> User:
550-
"""
551-
Sets directories that users are allowed to query from the file browser.
552-
``allowed_prefix`` is the path of the directory the user can query inside.
553-
(must start with "/", and must be an absolute path)
554-
Returns True if successful
555-
556-
Args:
557-
user_id (str): User ID or Email Address
558-
allowed_prefix (str):
559-
560-
Returns:
561-
User: Successful Response
562-
563569
"""
564570
...
565571
def get_state_var(self, user_id: str, key: str, /) -> Any:
@@ -629,6 +635,27 @@ class UsersAPI(APINamespace):
629635
630636
"""
631637
...
638+
def get_file_browser_settings(self, user_id: str, /) -> FileBrowserPrefixes:
639+
"""
640+
Args:
641+
user_id (str): User ID or Email Address
642+
643+
Returns:
644+
FileBrowserPrefixes: User file browser settings
645+
646+
"""
647+
...
648+
def set_file_browser_settings(self, user_id: str, /, body: FileBrowserPrefixes) -> User:
649+
"""
650+
Args:
651+
user_id (str): User ID or Email Address
652+
body (FileBrowserPrefixes):
653+
654+
Returns:
655+
User: Successful Response
656+
657+
"""
658+
...
632659

633660
class ResourcesAPI(APINamespace):
634661
"""
@@ -4971,7 +4998,7 @@ class DeveloperAPI(APINamespace):
49714998
class APIClient:
49724999
"""
49735000
Top-level API client class. e.g., ``api.read_root(...)``
4974-
or ``api.config.set_instance_banner(...)``
5001+
or ``api.config.get_file_browser_settings(...)``
49755002
"""
49765003

49775004
config: ConfigAPI

cryosparc/controllers/job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class JobController(Controller[Job]):
7070
Job model, e.g. ``("P3", "J42")``
7171
7272
Attributes:
73-
model (Workspace): All job data from the CryoSPARC database.
73+
model (Job): All job data from the CryoSPARC database.
7474
Contents may change over time, use :py:meth:`refresh` to update.
7575
7676
Examples:

cryosparc/model_registry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
event,
1212
exposure,
1313
external,
14+
file_browser,
1415
gpu,
1516
instance,
1617
job,
@@ -44,14 +45,15 @@
4445
register_model_module(api_request, include_literals=True)
4546
register_model_module(session, include_literals=True)
4647
register_model_module(user, include_literals=True)
47-
register_model_module(api_response, include_literals=True)
48+
register_model_module(file_browser, include_literals=True)
4849
register_model_module(job_spec, include_literals=True)
4950
register_model_module(exposure, include_literals=True)
5051
register_model_module(event, include_literals=True)
5152
register_model_module(preview, include_literals=True)
5253
register_model_module(session_params, include_literals=True)
5354
register_model_module(external, include_literals=True)
5455
register_model_module(project, include_literals=True)
56+
register_model_module(api_response, include_literals=True)
5557
register_model_module(asset, include_literals=True)
5658
register_model_module(signature, include_literals=True)
5759
register_model_module(instance, include_literals=True)

cryosparc/models/api_response.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
11
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT DIRECTLY
22
# SEE dev/api_generate_models.py
3-
from typing import List, Literal, Optional
3+
from typing import List
44

55
from pydantic import BaseModel
66

77

8-
class BrowseFile(BaseModel):
9-
file_name: str
10-
base_path: str
11-
is_hidden: bool
12-
path_abs: str
13-
is_link: bool = False
14-
mtime: Optional[float] = None
15-
size: Optional[int] = None
16-
type: Optional[Literal["dir", "file"]] = None
17-
link_path: Optional[str] = None
18-
errmesg: Optional[str] = None
19-
20-
21-
class BrowseFileResponse(BaseModel):
22-
back_path: str
23-
files: List[BrowseFile]
24-
type: str
25-
26-
278
class GetFinalResultsResponse(BaseModel):
289
final_results: List[str]
2910
"""

cryosparc/models/exposure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT DIRECTLY
22
# SEE dev/api_generate_models.py
33
import datetime
4-
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
4+
from typing import Any, Dict, List, Literal, Optional, Union
55

66
from pydantic import BaseModel, Field
77

@@ -45,7 +45,7 @@ class StatBlob(BaseModel):
4545
idx: int
4646
path: str
4747
psize_A: float
48-
shape: Tuple[int, int]
48+
shape: List[int]
4949

5050

5151
class GainRefBlob(BaseModel):

cryosparc/models/file_browser.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT DIRECTLY
2+
# SEE dev/api_generate_models.py
3+
from typing import List, Literal, Optional
4+
5+
from pydantic import BaseModel
6+
7+
8+
class BrowseFile(BaseModel):
9+
file_name: str
10+
base_path: str
11+
is_hidden: bool
12+
path_abs: str
13+
is_link: bool = False
14+
mtime: Optional[float] = None
15+
size: Optional[int] = None
16+
type: Optional[Literal["dir", "file"]] = None
17+
link_path: Optional[str] = None
18+
errmesg: Optional[str] = None
19+
20+
21+
class BrowseFileResponse(BaseModel):
22+
back_path: str
23+
files: List[BrowseFile]
24+
type: str
25+
26+
27+
class FileBrowserPrefixes(BaseModel):
28+
allowed_prefixes: Optional[List[str]] = None
29+
import_dir_default: Optional[str] = None
30+
project_dir_default: Optional[str] = None

cryosparc/models/user.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from pydantic import BaseModel, Field
77

8+
from .file_browser import FileBrowserPrefixes
9+
810

911
class Bookmark(BaseModel):
1012
id: str
@@ -105,5 +107,5 @@ class User(BaseModel):
105107
services: Services = Services()
106108
state: UserState = UserState()
107109
preferences: Dict[str, Any] = {}
108-
allowed_prefix_dir: str = "/"
110+
file_browser_settings: FileBrowserPrefixes = FileBrowserPrefixes()
109111
lanes: List[str] = []

0 commit comments

Comments
 (0)