ducpy.builders.state_builders¶
Helper functions for creating DUC state-related objects with a user-friendly API. Follows the same hierarchical builder pattern as element_builders.py. Only types from types.rs / duc.sql are supported.
Classes¶
Functions¶
|
Current Unix timestamp in milliseconds. |
|
|
|
|
|
|
|
|
Module Contents¶
- ducpy.builders.state_builders.now_ms() int¶
Current Unix timestamp in milliseconds.
- class ducpy.builders.state_builders.BaseStateParams¶
- id: str | None = None¶
- name: str = ''¶
- description: str = ''¶
- version: str = '1.0'¶
- readonly: bool = False¶
- class ducpy.builders.state_builders.StateBuilder¶
- base¶
- extra¶
- with_id(id: str)¶
- with_name(name: str)¶
- with_description(description: str)¶
- with_version(version: str)¶
- with_readonly(readonly: bool)¶
- with_extra(**kwargs)¶
- build_global_state()¶
- build_local_state()¶
- build_group()¶
- build_layer()¶
- build_region()¶
- build_version_graph()¶
- build_checkpoint()¶
- build_delta()¶
- build_external_file()¶
- build_stack_base()¶
- build_charter()¶
- build_issue()¶
- class ducpy.builders.state_builders.StateSpecificBuilder(base: BaseStateParams, extra: dict)¶
- base¶
- extra¶
- class ducpy.builders.state_builders.GlobalStateBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_name(name: str)¶
- with_view_background_color(color: str)¶
- with_main_scope(scope: str)¶
- with_scope_exponent_threshold(threshold: int)¶
- class ducpy.builders.state_builders.LocalStateBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_scope(scope: str)¶
- with_scroll_x(scroll_x: float)¶
- with_scroll_y(scroll_y: float)¶
- with_zoom(zoom: float)¶
- with_is_binding_enabled(enabled: bool)¶
- with_pen_mode(pen_mode: bool)¶
- with_view_mode_enabled(enabled: bool)¶
- with_objects_snap_mode_enabled(enabled: bool)¶
- with_grid_mode_enabled(enabled: bool)¶
- with_outline_mode_enabled(enabled: bool)¶
- with_manual_save_mode(enabled: bool)¶
- with_decimal_places(places: int)¶
- with_current_item_opacity(opacity: float)¶
- with_current_item_font_family(font_family: str)¶
- with_current_item_font_size(font_size: float)¶
- with_current_item_text_align(text_align: ducpy.enums.TEXT_ALIGN)¶
- with_current_item_roundness(roundness: float)¶
- class ducpy.builders.state_builders.GroupBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_label(label: str)¶
- with_is_collapsed(is_collapsed: bool)¶
- with_is_plot(is_plot: bool)¶
- with_is_visible(is_visible: bool)¶
- with_locked(locked: bool)¶
- with_opacity(opacity: float)¶
- with_id(id: str)¶
- class ducpy.builders.state_builders.LayerBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_label(label: str)¶
- with_readonly(readonly: bool)¶
- with_is_collapsed(is_collapsed: bool)¶
- with_is_plot(is_plot: bool)¶
- with_is_visible(is_visible: bool)¶
- with_locked(locked: bool)¶
- with_opacity(opacity: float)¶
- with_stroke_color(color: str)¶
- with_background_color(color: str)¶
- with_id(id: str)¶
- class ducpy.builders.state_builders.RegionBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_label(label: str)¶
- with_boolean_operation(operation: ducpy.enums.BOOLEAN_OPERATION)¶
- with_is_collapsed(is_collapsed: bool)¶
- with_is_plot(is_plot: bool)¶
- with_is_visible(is_visible: bool)¶
- with_locked(locked: bool)¶
- with_opacity(opacity: float)¶
- with_id(id: str)¶
- class ducpy.builders.state_builders.VersionGraphBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_checkpoints(checkpoints: List[ducpy.classes.DataStateClass.Checkpoint])¶
- with_deltas(deltas: List[ducpy.classes.DataStateClass.Delta])¶
- with_user_checkpoint_version_id(version_id: str)¶
- with_latest_version_id(version_id: str)¶
- class ducpy.builders.state_builders.CheckpointBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_id(id: str)¶
- with_parent_id(parent_id: str)¶
- with_is_manual_save(is_manual: bool)¶
- with_data(data: bytes)¶
- with_description(description: str)¶
- class ducpy.builders.state_builders.DeltaBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_id(id: str)¶
- with_payload(payload: bytes)¶
- with_parent_id(parent_id: str)¶
- with_is_manual_save(is_manual: bool)¶
- with_description(description: str)¶
- class ducpy.builders.state_builders.ExternalFileBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_key(key: str)¶
- with_mime_type(mime_type: str)¶
- with_data(data: bytes)¶
- with_last_retrieved(last_retrieved: int)¶
- class ducpy.builders.state_builders.StackBaseBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- with_label(label: str)¶
- with_is_collapsed(is_collapsed: bool)¶
- with_is_plot(is_plot: bool)¶
- with_is_visible(is_visible: bool)¶
- with_locked(locked: bool)¶
- with_styles(styles: ducpy.classes.ElementsClass.DucStackLikeStyles)¶
- ducpy.builders.state_builders.create_global_state_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.DucGlobalState¶
- ducpy.builders.state_builders.create_local_state_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.DucLocalState¶
- ducpy.builders.state_builders.create_group_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucGroup¶
- ducpy.builders.state_builders.create_layer_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucLayer¶
- ducpy.builders.state_builders.create_region_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucRegion¶
- ducpy.builders.state_builders.create_version_graph_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.VersionGraph¶
- ducpy.builders.state_builders.create_checkpoint_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.Checkpoint¶
- ducpy.builders.state_builders.create_delta_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.Delta¶
- ducpy.builders.state_builders.create_external_file_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.DucExternalFile¶
- ducpy.builders.state_builders.create_stack_base_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucStackBase¶
- class ducpy.builders.state_builders.CharterBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- requirements: List[ducpy.classes.DataStateClass.DucCharterRequirement] = []¶
- constraints: List[ducpy.classes.DataStateClass.DucCharterConstraint] = []¶
- decisions: List[ducpy.classes.DataStateClass.DucCharterDecision] = []¶
- stakeholders: List[ducpy.classes.DataStateClass.DucCharterStakeholder] = []¶
- with_title(title: str)¶
- with_description(description: str)¶
- with_objective(objective: str)¶
- with_phase(phase: str)¶
- with_closed_reason(reason: str)¶
- with_updated_at(updated_at: int)¶
- add_requirement(statement: str, must: bool = True, *, id: str | None = None, acceptance_criteria: List[str] | None = None)¶
- add_constraint(statement: str, hard: bool = True, *, id: str | None = None)¶
- add_decision(decision: str, rationale: str, accepted: bool = True, *, id: str | None = None, issue_ids: List[str] | None = None, decided_at: int | None = None)¶
- add_stakeholder(identifier: str, role: str, *, name: str | None = None)¶
- class ducpy.builders.state_builders.IssueBuilder(base: BaseStateParams, extra: dict)¶
Bases:
StateSpecificBuilder- messages: List[ducpy.classes.DataStateClass.DucIssueMessage] = []¶
- assignees: List[str] = []¶
- followers: List[str] = []¶
- with_local_id(local_id: int)¶
- with_title(title: str)¶
- with_status(status: str)¶
- with_author_id(author_id: str)¶
- with_dismissed_reason(reason: str)¶
- with_due_date(due_date: int)¶
- with_created_at(created_at: int)¶
- with_updated_at(updated_at: int)¶
- with_deleted_at(deleted_at: int)¶
- add_assignee(actor_identifier: str)¶
- add_follower(actor_identifier: str)¶
- add_message(author_id: str, content: str, *, name: str | None = None, reply_to_id: str | None = None, reactions: Dict[str, List[str]] | None = None, created_at: int | None = None, edited_at: int | None = None, deleted_at: int | None = None)¶
- with_canvas_anchor(x: float, y: float, *, scope: str | None = None)¶
- with_element_anchor(element_id: str, *, anchor_x: float | None = None, anchor_y: float | None = None)¶
- with_model_anchor(element_id: str, point: List[float], *, normal: List[float] | None = None, viewer_state: ducpy.classes.ElementsClass.Viewer3DState | None = None, topology_id: str | None = None)¶
- ducpy.builders.state_builders.create_actor(identifier: str, name: str | None = None) ducpy.classes.DataStateClass.Actor¶
- ducpy.builders.state_builders.create_viewer3d_grid_uniform(value: bool = True) Dict[str, Any]¶
- ducpy.builders.state_builders.create_viewer3d_grid_per_plane(xy: bool = True, xz: bool = False, yz: bool = False) Dict[str, Any]¶
- ducpy.builders.state_builders.create_block(id: str, label: str, elements: List[ducpy.classes.ElementsClass.ElementWrapper] | None = None, description: str | None = None) ducpy.classes.ElementsClass.DucBlock¶
- ducpy.builders.state_builders.create_string_value_entry(key: str, value: str) ducpy.classes.ElementsClass.StringValueEntry¶