diff --git a/artifacts/autocomplete-types.ts b/artifacts/autocomplete-types.ts index cf72e8d..1659739 100644 --- a/artifacts/autocomplete-types.ts +++ b/artifacts/autocomplete-types.ts @@ -1,6 +1,6 @@ // This file is auto-generated by the datamaker-py SDK // DO NOT EDIT MANUALLY -// Generated from version 0.8.1 +// Generated from version 0.9.0 // Monaco Editor CompletionItemKind enum values // Reference: https://microsoft.github.io/monaco-editor/api/enums/monaco.languages.CompletionItemKind.html @@ -49,7 +49,7 @@ export interface DataMakerFieldType { documentation?: string; } -export const SDK_VERSION = "0.8.1"; +export const SDK_VERSION = "0.9.0"; export const METHOD_SUGGESTIONS: DataMakerMethod[] = [ { @@ -764,6 +764,78 @@ export const METHOD_SUGGESTIONS: DataMakerMethod[] = [ detail: "Method: delete_keymap", sortText: "delete_keymap", }, + { + label: "get_plans", + kind: CompletionItemKind.Method, + insertText: "get_plans()", + documentation: "List the plans in the caller's active project. Returns: A list of plan dictionaries.", + detail: "Method: get_plans", + sortText: "get_plans", + }, + { + label: "get_plan", + kind: CompletionItemKind.Method, + insertText: "get_plan(${1:plan_id}: str)", + documentation: "Get a single plan by ID, including its full spec and history. Args: plan_id: The unique identifier of the plan. Returns: The plan dictionary.", + detail: "Method: get_plan", + sortText: "get_plan", + }, + { + label: "update_plan", + kind: CompletionItemKind.Method, + insertText: "update_plan(${1:plan_id}: str)", + documentation: "Update a plan. Args: plan_id: The unique identifier of the plan. **fields: Fields to change, e.g. title, summary, status. Returns: The updated plan dictionary.", + detail: "Method: update_plan", + sortText: "update_plan", + }, + { + label: "delete_plan", + kind: CompletionItemKind.Method, + insertText: "delete_plan(${1:plan_id}: str)", + documentation: "Delete a plan. Args: plan_id: The unique identifier of the plan. Returns: ``{\"success\": True}``. Note this differs from the other resources, which answer ``{\"message\": ...}``.", + detail: "Method: delete_plan", + sortText: "delete_plan", + }, + { + label: "get_masking_policies", + kind: CompletionItemKind.Method, + insertText: "get_masking_policies(${1:project_id}: Optional[str])", + documentation: "Get the masking policies in the caller's project/team scope. Args: project_id: Optional project ID to scope the listing to. Falls back to the DATAMAKER_PROJECT_ID env var. Returns: A list of masking policy dictionaries.", + detail: "Method: get_masking_policies", + sortText: "get_masking_policies", + }, + { + label: "get_masking_policy", + kind: CompletionItemKind.Method, + insertText: "get_masking_policy(${1:policy_id}: str)", + documentation: "Get a single masking policy by ID. Args: policy_id: The unique identifier of the policy. Returns: The masking policy dictionary.", + detail: "Method: get_masking_policy", + sortText: "get_masking_policy", + }, + { + label: "create_masking_policy", + kind: CompletionItemKind.Method, + insertText: "create_masking_policy(${1:name}: str, ${2:fields}: any, ${3:description}: Optional[str], ${4:consistent}: Optional[bool], ${5:reversible}: Optional[bool], ${6:key_map_name}: Optional[str], ${7:project_id}: Optional[str])", + documentation: "Create a masking policy. Args: name: The policy name. fields: The field rule list. description: Optional description. consistent: Same input masks to the same output. Omit to take the API's default. reversible: Record the mapping so masking can be reversed. Needs key_map_name to be useful. key_map_name: The KeyMap a reversible policy mints mappings into. project_id: Project to create it in. Falls back to DATAMAKER_PROJECT_ID. Returns: The created masking policy dictionary.", + detail: "Method: create_masking_policy", + sortText: "create_masking_policy", + }, + { + label: "update_masking_policy", + kind: CompletionItemKind.Method, + insertText: "update_masking_policy(${1:policy_id}: str)", + documentation: "Update a masking policy. Args: policy_id: The unique identifier of the policy. **fields: Fields to change. Use API spellings, e.g. keyMapName. Returns: The updated masking policy dictionary.", + detail: "Method: update_masking_policy", + sortText: "update_masking_policy", + }, + { + label: "delete_masking_policy", + kind: CompletionItemKind.Method, + insertText: "delete_masking_policy(${1:policy_id}: str)", + documentation: "Delete a masking policy. Args: policy_id: The unique identifier of the policy. Returns: ``{\"message\": \"Masking policy deleted\"}``.", + detail: "Method: delete_masking_policy", + sortText: "delete_masking_policy", + }, ]; export const FIELD_TYPE_SUGGESTIONS: DataMakerFieldType[] = [ diff --git a/pyproject.toml b/pyproject.toml index 76b692b..3081931 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "datamaker-py" -version = "0.8.1" +version = "0.9.0" description = "The official Python library for the Automators DataMaker API." readme = "README.md" requires-python = ">=3.11" diff --git a/src/datamaker/main.py b/src/datamaker/main.py index 7f567d8..1664367 100644 --- a/src/datamaker/main.py +++ b/src/datamaker/main.py @@ -938,6 +938,135 @@ def delete_keymap( # =================== PROPERTY ACCESS TO CLIENTS =================== # For advanced users who want direct access to specific clients + + # =================== PLAN METHODS =================== + def get_plans(self): + """List the plans in the caller's active project. + + Returns: + A list of plan dictionaries. + """ + return self._plans.get_plans() + + def get_plan(self, plan_id: str): + """Get a single plan by ID, including its full spec and history. + + Args: + plan_id: The unique identifier of the plan. + + Returns: + The plan dictionary. + """ + return self._plans.get_plan(plan_id) + + def update_plan(self, plan_id: str, **fields): + """Update a plan. + + Args: + plan_id: The unique identifier of the plan. + **fields: Fields to change, e.g. title, summary, status. + + Returns: + The updated plan dictionary. + """ + return self._plans.update_plan(plan_id, **fields) + + def delete_plan(self, plan_id: str): + """Delete a plan. + + Args: + plan_id: The unique identifier of the plan. + + Returns: + ``{"success": True}``. Note this differs from the other resources, + which answer ``{"message": ...}``. + """ + return self._plans.delete_plan(plan_id) + + # =================== MASKING POLICY METHODS =================== + def get_masking_policies(self, project_id: Optional[str] = None): + """Get the masking policies in the caller's project/team scope. + + Args: + project_id: Optional project ID to scope the listing to. Falls back + to the DATAMAKER_PROJECT_ID env var. + + Returns: + A list of masking policy dictionaries. + """ + return self._masking_policies.get_masking_policies(project_id) + + def get_masking_policy(self, policy_id: str): + """Get a single masking policy by ID. + + Args: + policy_id: The unique identifier of the policy. + + Returns: + The masking policy dictionary. + """ + return self._masking_policies.get_masking_policy(policy_id) + + def create_masking_policy( + self, + name: str, + fields, + description: Optional[str] = None, + consistent: Optional[bool] = None, + reversible: Optional[bool] = None, + key_map_name: Optional[str] = None, + project_id: Optional[str] = None, + ): + """Create a masking policy. + + Args: + name: The policy name. + fields: The field rule list. + description: Optional description. + consistent: Same input masks to the same output. Omit to take the + API's default. + reversible: Record the mapping so masking can be reversed. Needs + key_map_name to be useful. + key_map_name: The KeyMap a reversible policy mints mappings into. + project_id: Project to create it in. Falls back to + DATAMAKER_PROJECT_ID. + + Returns: + The created masking policy dictionary. + """ + return self._masking_policies.create_masking_policy( + name=name, + fields=fields, + description=description, + consistent=consistent, + reversible=reversible, + key_map_name=key_map_name, + project_id=project_id, + ) + + def update_masking_policy(self, policy_id: str, **fields): + """Update a masking policy. + + Args: + policy_id: The unique identifier of the policy. + **fields: Fields to change. Use API spellings, e.g. keyMapName. + + Returns: + The updated masking policy dictionary. + """ + return self._masking_policies.update_masking_policy(policy_id, **fields) + + def delete_masking_policy(self, policy_id: str): + """Delete a masking policy. + + Args: + policy_id: The unique identifier of the policy. + + Returns: + ``{"message": "Masking policy deleted"}``. + """ + return self._masking_policies.delete_masking_policy(policy_id) + @property def generation(self): """Access to generation client.""" diff --git a/uv.lock b/uv.lock index 4708481..df4cc8b 100644 --- a/uv.lock +++ b/uv.lock @@ -52,7 +52,7 @@ wheels = [ [[package]] name = "datamaker-py" -version = "0.8.1" +version = "0.9.0" source = { editable = "." } dependencies = [ { name = "python-dotenv" },