### Kick off and manage procedures Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Initiate procedures using kick_off, kickoff, or start. Check if a procedure is a run using the is_run property. List company procedures or all client procedures. ```python myprocedure.kick_off() myprocedure.kickoff() myprocedure.start() myprocedure.is_run #bool property companyprocedures = mycompany.list_procedures() procedures = client.procedures.list() myprocedure = client.procedures.create(payload={"name": "asdf", "company_id": 1}) myprocedure.add_task(name="newtask", auto_kickoff=True) client.procedure_task.create(name="newtask", procedure_id=myprocedure.id) # One procedure only — not on .list() results proc = client.procedures.get(id=1) proc.add_task(name="Step 1", auto_kickoff=True) someprocedure.list_tasks() someotherprocedure.tasks sometask.assign_to(mypersonaluser) ``` -------------------------------- ### Start Export with Format and Company ID Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Starts a new export, aliased from client.Exports.new(). Specify the desired format (CSV or PDF) and the company ID. ```python csvexport = client.exports.start(format="csv",company_id=mycompany.id) pdfexport = client.exports.start(format="pdf",company_id=mycompany.id) ``` -------------------------------- ### Get Verbose Help for Hudu Assets Resource Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Call the `help()` method on resources like `client.assets` for more verbose information. This can detail available methods and parameters. ```python client.assets.help() ``` -------------------------------- ### Start CSV or PDF Export with Options Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Initiates a new export in CSV or PDF format. Allows detailed inclusion of archived items and specific asset layouts. Defaults are provided for inclusion flags. ```python newexport = client.exports.start(format="pdf", company_id=1, asset_layout_ids=[2], include_passwords= True, include_websites= True, include_articles= True, include_archived_articles= True, include_archived_passwords= True, include_archived_websites= True, include_archived_assets= True, ) ``` -------------------------------- ### Export Operations Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Methods for starting, checking status, and downloading exports. ```APIDOC ## Exports ### Starting an Export Initiates a new export of data in CSV or PDF format. #### Method ```python newexport = client.exports.start(format="pdf", company_id=1, asset_layout_ids=[2], include_passwords= True, include_websites= True, include_articles= True, include_archived_articles= True, include_archived_passwords= True, include_archived_websites= True, include_archived_assets= True, ) ``` Aliases: `client.Exports.new()` is aliased to `client.Exports.start()` #### Examples ```python csvexport = client.exports.start(format="csv",company_id=mycompany.id) pdfexport = client.exports.start(format="pdf",company_id=mycompany.id) ``` #### Friendly Defaults The `include_*` options default to `True` if not provided. The `asset_layout_ids` array defaults to all layouts found via `HuduClient.asset_layouts.list`. ### Checking Export Status Blocks execution until an export is downloadable. #### Method ```python ready = client.exports.wait_until_downloadable(newexport, interval=2.0, timeout=3600) someexport.wait_until_downloadable(interval=5.0, timeout=600) ``` ### Downloading Exports Downloads the generated export file. #### Method ```python download = client.exports.download(newexport.id, "/home/myoutputfolder") download = client.exports.download(otherexportobject) # download to current working dir someexportobject.download() # download to current working dir myexportobject.download("/home/myoutputfolder") ``` ``` -------------------------------- ### Install hudu-magic Package Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Installs the hudu-magic Python package using pip. This is the standard method for adding the library to your Python environment. ```bash pip install hudu-magic ``` -------------------------------- ### Describe Hudu Assets Resource Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Call the `describe()` method on resources like `client.assets` to get information about them. This provides a summary of the resource. ```python client.assets.describe() ``` -------------------------------- ### Get Help Information for Hudu Object Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Call the `help()` method on class members to retrieve associated information from Hudu's API spec. This is useful for understanding object details. ```python huduobject.help() ``` -------------------------------- ### List Company Entities Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Lists various entities associated with a company object. No specific setup required beyond having a company object. ```python mycompany.list_assets() mycompany.list_articles() mycompany.list_passwords() mycompany.list_procedures() mycompany.list_websites() mycompany.list_folders() mycompany.list_password_folders() ``` -------------------------------- ### Initialize Hudu Client and Perform CRUD Operations Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Demonstrates how to initialize the HuduClient with API key and instance URL, and then perform create, update, and delete operations on companies and assets. Ensure you replace placeholders with your actual API key, instance URL, and a valid asset_layout_id. ```python from hudu_magic import HuduClient client = HuduClient( api_key="your_api_key", instance_url="https://yourinstance.huducloud.com" ) company = client.companies.create(name="Test Company") # Use a real asset_layout_id from your Hudu instance (e.g. from client.asset_layouts.list()). asset = client.assets.create( company_id=company.id, name="Router", asset_layout_id=1, ) asset.name = "Updated Router" asset.save() asset.delete() ``` -------------------------------- ### Create Asset using kwargs Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Use kwargs for a recommended and straightforward way to create new assets. ```python client.assets.create(name="Router", company_id=1, asset_layout_id=10) ``` -------------------------------- ### Run Tests Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Execute tests for the Hudu SDK, including options for integration tests. ```bash ./build.sh --test ``` ```bash pytest ``` -------------------------------- ### Create Asset Layout from Scratch Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Creates a new asset layout by wrapping a draft dictionary in `AssetLayout`. Omitting `position` applies defaults. Requires a real `list_id` for `ListSelect` fields. ```python from hudu_magic.endpoints import HuduEndpoint from hudu_magic.models import AssetLayout draft = AssetLayout( client, HuduEndpoint.ASSET_LAYOUTS, { "name": "Docking stations", "fields": [ {"label": "Asset tag", "field_type": "Text"}, {"label": "Room", "field_type": "Text"}, ], }, ) payload = draft.to_create_payload() layout = client.asset_layouts.create(payload=payload) ``` -------------------------------- ### Generate Hudu Builds Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Instructions for generating builds for Hudu versions using the OpenAPI spec and build scripts. ```bash python generate_endpoints.py ``` ```bash ./build.sh ``` -------------------------------- ### Create Asset using dict payload Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Alternatively, create new assets by providing a dictionary payload. ```python client.assets.create(payload={"name": "Router", "company_id": 1, "asset_layout_id": 10}) ``` -------------------------------- ### Save, Delete, and Refresh Asset Instance Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Demonstrates instance-level operations for a single asset object, including saving changes, deleting the asset, and refreshing its data from the server. These methods are called directly on an asset model instance. ```python asset.save() asset.delete() ``` -------------------------------- ### Create New Asset Layout from Existing Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Clones an existing asset layout and updates its name. Use `to_create_payload()` when you have an `AssetLayout` instance. ```python mylayout = client.asset_layouts.get(2) payload = mylayout.to_create_payload() payload["name"] = "Updated New Layout" newlayout = client.asset_layouts.create(payload=payload) print(f"created new layout: {newlayout.name}") ``` -------------------------------- ### Relate Asset to Website Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Establish a relation between an asset and a website object. ```python asset.relate_to(website) ``` -------------------------------- ### Add Photo to Asset Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Add a photo to an asset and retrieve a list of all photos. ```python asset.add_photo("image.png") photos = asset.list_photos() ``` -------------------------------- ### Upload File to Asset Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Upload a file to an asset and list all associated uploads. ```python asset.upload_to("file.zip") uploads = asset.list_uploads() ``` -------------------------------- ### List Assets using Hudu Client Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Retrieves a list of all assets associated with the Hudu instance using the HuduClient. This is a common operation for fetching data. ```python client.assets.list() ``` -------------------------------- ### Assign tasks to users Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Assign a task to a user directly from a User instance or by fetching a task and then assigning it. This updates the 'assigned_users' field on the run task. ```python myuser.assign_task(thistask) myotheruser.assign_task(client.procedure_tasks.get(56)) ``` -------------------------------- ### Asset Layout Operations Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Methods for managing asset layouts, including creation and cloning. ```APIDOC **`AssetLayout.to_create_payload()`** builds the same JSON body as **`normalize_layout_for_create`** on that layout’s underlying data. Prefer `to_create_payload` whenever you already have (or can wrap) an **`AssetLayout`**. Use **`normalize_layout_for_create`** only when you have a plain **`dict`** and no instance yet (for example after `json.load`). ### Cloning an Existing Layout Clones an existing layout, normalizing GET-shaped data for a POST request. #### Method ```python mylayout = client.asset_layouts.get(2) payload = mylayout.to_create_payload() payload["name"] = "Updated New Layout" newlayout = client.asset_layouts.create(payload=payload) print(f"created new layout: {newlayout.name}") ``` ### Creating a Layout from Scratch Creates a new asset layout by wrapping a draft dictionary in `AssetLayout` and calling `to_create_payload`. `position` can be omitted on fields; contiguous positions and icon/include defaults are applied automatically. For `ListSelect` fields, a real `list_id` from your instance is required. #### Method ```python from hudu_magic.endpoints import HuduEndpoint from hudu_magic.models import AssetLayout draft = AssetLayout( client, HuduEndpoint.ASSET_LAYOUTS, { "name": "Docking stations", "fields": [ {"label": "Asset tag", "field_type": "Text"}, {"label": "Room", "field_type": "Text"}, ], }, ) payload = draft.to_create_payload() layout = client.asset_layouts.create(payload=payload) ``` ### Creating a Layout from a Dictionary Creates a layout payload from a dictionary when an `AssetLayout` instance is not yet available. #### Method ```python from hudu_magic import normalize_layout_for_create layout_dict = {"name": "Docking stations", "fields": [{"label": "x", "field_type": "Text"}]} payload = normalize_layout_for_create(layout_dict) # pass `payload` to client.asset_layouts.create(payload=payload) when you have a client ``` ``` -------------------------------- ### Save, Delete, and Archive Assets in a Collection Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Shows instance-level operations for assets within a collection, including saving changes, deleting the asset, and archiving it. These methods are called on an individual asset object obtained from a collection. ```python assetsforcompany.save() assetsforcompany.delete() assetsforcompany.archive() ``` -------------------------------- ### Asset Photos Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Methods to add photos to an asset. ```APIDOC ## Assets ### add_public_photo Adds a public photo to an asset. #### Method ```python someasset.add_public_photo("smile.png") ``` ### add_photo Adds a photo to an asset. #### Method ```python someasset.add_photo("dogslaughing.jpeg") ``` ``` -------------------------------- ### Normalize Layout Dictionary for Creation Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Converts a plain dictionary representing a layout into the payload format required for creation. Use this when you do not yet have an `AssetLayout` instance. ```python from hudu_magic import normalize_layout_for_create layout_dict = {"name": "Docking stations", "fields": [{"label": "x", "field_type": "Text"}]} payload = normalize_layout_for_create(layout_dict) # pass `payload` to client.asset_layouts.create(payload=payload) when you have a client ``` -------------------------------- ### Update Asset using update method Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Use the update method for a concise way to modify asset properties. ```python asset.update(name="New Name") ``` -------------------------------- ### Add Photos to Asset Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Adds public or private photos to an asset object. Ensure the photo file exists. ```python someasset.add_public_photo("smile.png") someasset.add_photo("dogslaughing.jpeg") ``` -------------------------------- ### Create Company Entities Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Creates various entities that can be attributed to a company object. Ensure the company object is valid. ```python mycompany.create_website() mycompany.create_password() mycompany.create_procedure() mycompany.create_article() mycompany.create_asset() ``` -------------------------------- ### Download Export Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Downloads an export to a specified directory or the current working directory. Can use export ID or an export object. ```python download = client.exports.download(newexport.id, "/home/myoutputfolder") download = client.exports.download(otherexportobject) # download to current working dir someexportobject.download() # download to current working dir myexportobject.download("/home/myoutputfolder") ``` -------------------------------- ### Wait for Export to be Downloadable Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Blocks execution until an export is ready for download. Allows specifying an interval for status checks and a total timeout. ```python ready = client.exports.wait_until_downloadable(newexport, interval=2.0, timeout=3600) someexport.wait_until_downloadable(interval=5.0, timeout=600) ``` -------------------------------- ### Create Relation between Objects Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Manually create a relation between two specified objects using the relations client. ```python client.relations.create(from_obj=asset, to_obj=website) ``` -------------------------------- ### Company Object Methods Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Methods available on a company object to list and create related entities. ```APIDOC ## Companies ### List Methods Lists various entities associated with a company. #### Methods ```python mycompany.list_assets() mycompany.list_articles() mycompany.list_passwords() mycompany.list_procedures() mycompany.list_websites() mycompany.list_folders() mycompany.list_password_folders() ``` ### Create Methods Creates new entities associated with a company. #### Methods ```python mycompany.create_website() mycompany.create_password() mycompany.create_procedure() mycompany.create_article() mycompany.create_asset() ``` ``` -------------------------------- ### Transfer Asset Data Between Hudu Clients Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Use multiple client instances to transfer data between Hudu environments, such as from a development to a production instance. Note that this may not be fully tested for objects dependent on companies. ```python client2.assets.create( **client1.assets.get(6).to_dict() ) ``` -------------------------------- ### Update Asset Name Source: https://github.com/hudu-technologies-inc/hudu-magic/blob/main/README.md Modify an existing asset's name directly and save the changes. ```python asset.name = "New Name" asset.save() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.