### Load API Credentials from Environment Variables with Python-Dotenv Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 This Python function demonstrates how to retrieve API credentials from environment variables. It uses the `python-dotenv` library to load variables from a `.env` file, ensuring sensitive information like API keys are not hardcoded. The function checks for the 'HYDRUS_API_KEY' environment variable and raises a `RuntimeError` if it's not set, guiding the user to configure their `.env` file. ```Python def get_api_credentials() -> tuple[str, str]: load_dotenv(override=False) if not (api_key := os.getenv("HYDRUS_API_KEY")): raise RuntimeError("HYDRUS_API_KEY environment variable must be set (see .env file)") ``` -------------------------------- ### Hydrus API Client: Get File Method Definition Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8 Defines the `get_file` method in the Hydrus API client. This method allows retrieving a file by its hash or ID, with an optional boolean to trigger direct download. It returns a `requests.Response` object. ```Python def get_file( self, hash_: T.Optional[str] = None, file_id: T.Optional[int] = None, download: T.Optional[bool] = None ) -> requests.Response: ``` -------------------------------- ### Define platformdirs Package Configuration with Extras Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Configuration details for the `platformdirs` package, including its updated version, description, Python compatibility, and specific dependencies for `docs` and `test` extras, plus a new `type` extra. ```TOML [[package]] name = "platformdirs" version = "4.2.2" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" files = [ {file = "platformdirs-4.2.2-py3-none-any.whl", hash = "sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee"}, {file = "platformdirs-4.2.2.tar.gz", hash = "sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3"} ] [package.extras] docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] type = ["mypy (>=1.8)"] ``` -------------------------------- ### Define pluggy Package Configuration with Extras Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Configuration details for the `pluggy` package, including its updated version, description, Python compatibility, and specific dependencies for its `testing` extra. ```TOML [[package]] name = "pluggy" version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" files = [ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"} ] [package.extras] testing = ["pytest", "pytest-benchmark"] ``` -------------------------------- ### Define packaging Package Configuration Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Configuration details for the `packaging` package, including its updated version, description, and Python compatibility. ```TOML [[package]] name = "packaging" version = "24.1" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"} ] ``` -------------------------------- ### Define pyperclip Package Configuration Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Configuration details for the `pyperclip` package, including its updated version, description, and Python compatibility. ```TOML [[package]] name = "pyperclip" version = "1.9.0" description = "A cross-platform clipboard module for Python. (Only handles plain text for now.)" optional = false python-versions = "*" files = [ {file = "pyperclip-1.9.0.tar.gz", hash = "sha256:b7de0142ddc81bfc5c7507eea19da920b92252b548b96186caf94a5e2527d310"} ] ``` -------------------------------- ### Define mypy-extensions Package Configuration Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Configuration details for the `mypy-extensions` package, specifying its version, description, and Python compatibility. ```TOML [[package]] name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." optional = false python-versions = ">=3.5" files = [ ] ``` -------------------------------- ### Hydrus API Key Permissions for Tests Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Documents the specific read-only API permissions required for the Hydrus API key used in tests. It also advises against committing keys and suggests loading them from environment variables or a `.env` file. ```APIDOC # These environment variables are used solely by the tests # Add your key (and URL, if necessary) here, but don't commit them # Alternatively, you can have them already set in your environment before running pytest # Your key needs the following permissions for the tests (which are all read-only) to work: # * search for and fetch files # * edit file tags # * import and edit urls # * manage cookies and headers # * manage database (for viewing mr bones) # * manage pages HYDRUS_API_KEY="" #HYDRUS_API_URL="http://127.0.0.1:45869/" ``` -------------------------------- ### Project-Level Python Dependency and Extra Configuration Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 This snippet outlines the main project dependencies and global extra feature groups. It reflects updated minimum versions for `mypy-extensions`, `tomli`, and `typing-extensions`, and includes `mypyc` as a new extra. ```TOML [package.dependencies] mypy-extensions = ">=1.0.0" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typing-extensions = ">=4.6.0" [package.extras] dmypy = ["psutil (>=4.0)"] install-types = ["pip"] mypyc = ["setuptools (>=50)"] reports = ["lxml"] ``` -------------------------------- ### Parameters for delete_files() API method Source: https://gitlab.com/cryzed/hydrus-api/-/commit/ca81cb69dcaab4211799d4878857a0c822c4eb9b This snippet lists the parameters that were added to the `delete_files()` function/API method. These parameters are essential for specifying which files to delete, the service associated with them, and the reason for deletion, ensuring proper context for the operation. ```APIDOC file_ids, file_service_name, file_service_key, reason ``` -------------------------------- ### Configure iniconfig Dependency Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Defines the configuration for the 'iniconfig' Python package, specifying its version (2.0.0), description, Python version compatibility (>=3.7), and associated file hashes for distribution. ```TOML [[package]] name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" optional = false python-versions = ">=3.7" files = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:88796e959689531580173669147d848719543442111494056262b9015926598c"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:7739506692997103a850117865c6978432320496155910360a17387391942475"} ] ``` -------------------------------- ### Configure mypy Dependency Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Defines the configuration for the 'mypy' Python package, specifying its updated version (1.11.2), description, Python version compatibility (>=3.8), and a comprehensive list of associated file hashes for various distributions. ```TOML [[package]] name = "mypy" version = "1.11.2" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ {file = "mypy-1.11.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:71a808334d3f41ef011faa5a5cd819a0c442c0b56de5b2e89566c8093a0c9a"}, {file = "mypy-1.11.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:920169f0184215eef19294fa86ea49ffd4635dedfdea2b57e45cb4ee85d5ccaf"}, {file = "mypy-1.11.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27a0f74a298769d9fdc8498fcb4f2beb86f0564bcdb1a37b58cbbe78e55cf8c0"}, {file = "mypy-1.11.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:65b122a993d9c81ea0bfde7689b3365318a88bde952e4dfa1b3a8b4ac05d168b"}, {file = "mypy-1.11.2-cp310-cp310-win_amd64.whl", hash = "sha256:5deb252fd42a77add936b463033a59b8e48eb2eaec2976d76b6878d031933fe4"}, {file = "mypy-1.11.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2013226d17f20468f34feddd6aae4635a55f79626549099354ce641bc7d40262"}, {file = "mypy-1.11.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:48525aec92b47baed9b3380371ab8ab6e63a5aab317347dfe9e55e02aaad22e8"}, {file = "mypy-1.11.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c96b8a0c019fe29040d520d9257d8c8f122a7343a8307bf8d6d4a43f5c5bfcc8"}, {file = "mypy-1.11.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:448de661536d270ce04f2d7dddaa49b2fdba6e3bd8a83212164d4174ff43aa65"}, {file = "mypy-1.11.2-cp311-cp311-win_amd64.whl", hash = "sha256:d42a98e76070a365a1d1c220fcac8aa4ada12ae0db679cb4d910fabefc88b994"}, {file = "mypy-1.11.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e64f48c6176e243ad015e995de05af7f22bbe370dbb5b32bd6988438ec873919"}, {file = "mypy-1.11.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fdd63e4f50e3538617887e9aee918553 ``` -------------------------------- ### Define pathspec Package Configuration Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Configuration details for the `pathspec` package, including its updated version, description, and Python compatibility. ```TOML [[package]] name = "pathspec" version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." optional = false python-versions = ">=3.8" files = [ {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"} ] ``` -------------------------------- ### Configure idna Dependency Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Defines the configuration for the 'idna' Python package, specifying its updated version (3.8), description, Python version compatibility (>=3.6), and associated file hashes for distribution. ```TOML [[package]] name = "idna" version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.6" files = [ {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"} ] ``` -------------------------------- ### Configure pytest Python Testing Framework Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Defines the pytest dependency, a simple and powerful testing framework for Python. Specifies version 7.4.4, Python compatibility (>=3.7), and its internal dependencies (colorama, exceptiongroup, iniconfig, packaging, pluggy, tomli) and testing extras (argcomplete, attrs, hypothesis, mock, nose, pygments, requests, setuptools, xmlschema). ```TOML [[package]] name = "pytest" version = "7.4.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.7" files = [ {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"} ] [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = ">=20.0" pluggy = ">=0.12,<2.0" tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] ``` -------------------------------- ### Configure exceptiongroup Dependency Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Defines the configuration for the 'exceptiongroup' Python package, specifying its updated version (1.2.2), description, Python version compatibility (>=3.7), and associated file hashes for distribution. ```TOML [[package]] name = "exceptiongroup" version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"} ] ``` -------------------------------- ### Hydrus API Client: Post File IDs for Time Setting Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8 This Python snippet demonstrates how the Hydrus API client prepares parameters and makes a POST request to the `_SET_TIME_PATH` endpoint. It includes `file_ids` in the request body to update file timestamps. ```Python params["file_ids"] = file_ids return self._api_request("POST", self._SET_TIME_PATH, params=params).json() ``` -------------------------------- ### New API Functions for Hydrus API Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3 Documentation for newly implemented functions within the Hydrus API, including their paths and names. ```APIDOC /add_tags/search_tags: search_tags() /add_notes/set_notes: set_notes() /add_notes/delete_notes: delete_notes() ``` -------------------------------- ### Configure python-dotenv Environment Variable Loader Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Defines the python-dotenv dependency, used for reading key-value pairs from .env files and setting them as environment variables. Specifies version 1.0.1, Python compatibility (>=3.8), and its CLI extra (click). ```TOML [[package]] name = "python-dotenv" version = "1.0.1" description = "Read key-value pairs from a .env file and set them as environment variables" optional = false python-versions = ">=3.8" files = [ {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d ``` -------------------------------- ### New Permission Added to Hydrus API Permission Class Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/pipelines A new permission, `ADD_NOTES`, has been added to the `Permission` class. This permission, identified by `7`, is required for `set_notes()` and `delete_notes()` functions and was previously missing from the API documentation. ```APIDOC Permission Class Update: - ADD_NOTES: Identifier 7 (Required for set_notes() and delete_notes()) ``` -------------------------------- ### New API Functions Implemented Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/diffs Details new functions added to the Hydrus API, including their respective paths and names. These additions enhance the API's capabilities for searching tags and managing notes. ```APIDOC /add_tags/search_tags: search_tags() /add_notes/set_notes: set_notes() /add_notes/delete_notes: delete_notes() ``` -------------------------------- ### Updated Default Arguments for add_files_to_page() Function Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/pipelines The `add_files_to_page()` function has been updated to set `None` as default arguments for `file_ids` and `hashes`. This change aligns its behavior with other functions that accept these arguments. ```APIDOC Function Argument Defaults Update: - add_files_to_page(): file_ids=None, hashes=None ``` -------------------------------- ### Default Arguments for add_files_to_page() API Function Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/diffs Describes the update to the `add_files_to_page()` function in the Hydrus API. This change introduces `None` as default arguments for `file_ids` and `hashes`, aligning its behavior with other API functions that accept these parameters. ```APIDOC add_files_to_page(): file_ids: None (default argument) hashes: None (default argument) ``` -------------------------------- ### Default Arguments for add_files_to_page() Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/commits Update to the `add_files_to_page()` function, setting default arguments for `file_ids` and `hashes` to `None`. This change aligns its behavior with other API functions that accept similar arguments, improving consistency. ```APIDOC add_files_to_page(): file_ids: None (default) hashes: None (default) ``` -------------------------------- ### New Hydrus API Functions Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/commits Documentation for newly implemented functions in the Hydrus API, including their paths and names. These functions expand the API's capabilities for managing tags and notes. ```APIDOC /add_tags/search_tags: search_tags() /add_notes/set_notes: set_notes() /add_notes/delete_notes: delete_notes() ``` -------------------------------- ### New Permission: ADD_NOTES in Hydrus API Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3 Documentation for the newly added ADD_NOTES permission within the Permission class, including its identifier and functions that require it. ```APIDOC Permission Class: ADD_NOTES: Identifier: 7 Description: Allows adding notes to files. Required for: set_notes(), delete_notes() ``` -------------------------------- ### Hydrus API Changes (v59-v61) Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8/diffs Details the API modifications across Hydrus API versions 59, 60, and 61, specifically the addition of the 'include_milliseconds' parameter for file metadata and the new '/edit_times/set_time' method, along with notes on added fields to existing methods. ```APIDOC API Version 61: - Added parameter 'include_milliseconds' to file metadata retrieval. - Added fields to returned values of existing methods (client-side handling not required since v5.0.0). API Version 59: - New method: /edit_times/set_time API Version 60: - Refined behavior of /edit_times/set_time method. API Version 58: - Added fields to returned values of existing methods (client-side handling not required since v5.0.0). ``` -------------------------------- ### Update Gitignore for Pyenv Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/6 Modifies the `.gitignore` file to explicitly ignore `.python-version` for `pyenv` environments, removing previous comments that suggested checking it in for libraries/packages. ```Git # pyenv .python-version ``` -------------------------------- ### Updated Hydrus API Function Parameters Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/commits Documentation for parameters added to existing Hydrus API functions, detailing which parameters were added to which functions. These additions provide more granular control and flexibility for file management and metadata retrieval operations. ```APIDOC delete_files(): file_ids file_service_name file_service_key reason undelete_files(): file_ids file_service_name file_service_key archive_files(): file_ids unarchive_files(): file_ids add_tags(): file_ids associate_url(): file_ids get_file_metadata(): create_new_file_ids only_return_basic_information include_notes ``` -------------------------------- ### Parameters Added to Existing API Functions Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/diffs Lists existing Hydrus API functions that have received new parameters, expanding their functionality. These updates provide more control over file operations, tag management, URL associations, and file metadata retrieval. ```APIDOC delete_files(): file_ids, file_service_name, file_service_key, reason undelete_files(): file_ids, file_service_name, file_service_key archive_files(): file_ids unarchive_files(): file_ids add_tags(): file_ids associate_url(): file_ids get_file_metadata(): create_new_file_ids, only_return_basic_information, include_notes ``` -------------------------------- ### Implemented New Hydrus API Functions Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/pipelines New functions have been implemented for specific API paths, expanding the capabilities of the Hydrus API. These functions are `search_tags()`, `set_notes()`, and `delete_notes()`. ```APIDOC New Functions Implemented: - /add_tags/search_tags: search_tags() - /add_notes/set_notes: set_notes() - /add_notes/delete_notes: delete_notes() ``` -------------------------------- ### Default Argument Updates for add_files_to_page() in Hydrus API Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3 Update to the add_files_to_page() function, setting file_ids and hashes parameters to None by default for consistency. ```APIDOC add_files_to_page(): Parameters: file_ids: default=None hashes: default=None ``` -------------------------------- ### New Hydrus API Permission: ADD_NOTES Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/commits Documentation for the newly added 'ADD_NOTES' permission in the Hydrus API's Permission class. This permission is essential for operations related to adding or deleting notes and has a specific identifier. ```APIDOC Permission class: ADD_NOTES: Identifier: 7 Description: Required for set_notes() and delete_notes() ``` -------------------------------- ### Hydrus API v63 and v62 Changelog Source: https://gitlab.com/cryzed/hydrus-api/-/commit/ee37642ebea4772bf2225842ab7091a92e29b993 This section outlines the specific changes implemented in Hydrus API versions 63 and 62. Version 63 introduces a new endpoint for clearing file deletion records, modifies the return structure of URL information, and updates file undeletion behavior. Version 62 primarily adds new keys to client options. ```APIDOC v63 added the new `/add_files/clear_file_deletion_record` path, added an extra key to the return value of `/add_urls/get_url_info` and updated the behavior of `/add_files/undelete_files` without changing its interface. So, we only need to implement the new path. More info here: https://github.com/hydrusnetwork/hydrus/releases/tag/v568 v62 simply added new keys to the return value of `/manage_database/get_client_options`, so that doesn't need its own commit. ``` -------------------------------- ### Implement set_time Method for Editing File Times (Python) Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8 This method allows setting or clearing various timestamps associated with files or domains in the Hydrus API. It requires a `timestamp_ms` (integer or `None` for deletion) and a `timestamp_type`. Optional parameters include `file_service_key`, `canvas_type`, `domain`, `hashes`, and `file_ids` to specify the target of the operation. Note that `timestamp_ms` is preferred over `timestamp` to avoid floating-point issues. ```Python def set_time( self, timestamp_ms: T.Union[int, None], timestamp_type: T.Union[int, TimestampType], file_service_key: T.Optional[str] = None, canvas_type: T.Optional[T.Union[int, CanvasType]] = None, domain: T.Optional[str] = None, hashes: T.Optional[abc.Iterable[str]] = None, file_ids: T.Optional[abc.Iterable[int]] = None, ) -> dict[str, T.Any]: params: dict[str, T.Any] = {"timestamp_ms": timestamp_ms, "timestamp_type": timestamp_type} if file_service_key is not None: params["file_service_key"] = file_service_key if canvas_type is not None: params["canvas_type"] = canvas_type if domain is not None: params["domain"] = domain if hashes is not None: params["hashes"] = hashes if file_ids is not None: params["file_ids"] = file_ids response = self._api_request("POST", self._SET_TIME_PATH, params=params) return response.json() ``` ```APIDOC Method: set_time Description: Sets or clears various timestamps for files or domains. Parameters: timestamp_ms: Type: Union[int, None] Description: The timestamp in milliseconds (integer). Use None to clear the timestamp. Required: Yes timestamp_type: Type: Union[int, TimestampType] Description: The type of timestamp to set (e.g., MODIFIED_DOMAIN, IMPORTED). Required: Yes file_service_key: Type: Optional[str] Description: The key of the file service to apply the timestamp to. Required: No canvas_type: Type: Optional[Union[int, CanvasType]] Description: The type of canvas associated with the timestamp (e.g., MEDIA_VIEWER). Required: No domain: Type: Optional[str] Description: The domain to apply the timestamp to. Required: No hashes: Type: Optional[Iterable[str]] Description: A list of file hashes to apply the timestamp to. Required: No file_ids: Type: Optional[Iterable[int]] Description: A list of file IDs to apply the timestamp to. Required: No Returns: Type: dict[str, Any] Description: A dictionary containing the API response. ``` -------------------------------- ### Added Parameters to Existing Hydrus API Functions Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/pipelines Several existing Hydrus API functions have been updated with new parameters to provide more control and flexibility. This includes parameters for file identification, service names, and reasons for actions. ```APIDOC Parameters Added to Existing Functions: - delete_files(): file_ids, file_service_name, file_service_key, reason - undelete_files(): file_ids, file_service_name, file_service_key - archive_files(): file_ids - unarchive_files(): file_ids - add_tags(): file_ids - associate_url(): file_ids - get_file_metadata(): create_new_file_ids, only_return_basic_information, include_notes ``` -------------------------------- ### Parameter Additions to Existing Hydrus API Functions Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3 Details on new parameters added to various existing Hydrus API functions, specifying which parameters were added to which function. ```APIDOC delete_files(): Parameters: file_ids, file_service_name, file_service_key, reason undelete_files(): Parameters: file_ids, file_service_name, file_service_key archive_files(): Parameters: file_ids unarchive_files(): Parameters: file_ids add_tags(): Parameters: file_ids associate_url(): Parameters: file_ids get_file_metadata(): Parameters: create_new_file_ids, only_return_basic_information, include_notes ``` -------------------------------- ### New Permission 'ADD_NOTES' in API Permission Class Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/3/diffs Documents the addition of the 'ADD_NOTES' permission to the Hydrus API's 'Permission' class. This new permission, identified by '7', is essential for executing the `set_notes()` and `delete_notes()` functions. ```APIDOC Permission class: ADD_NOTES: 7 (identifier) Required for: set_notes(), delete_notes() ``` -------------------------------- ### Hydrus API Client: API Version Endpoint Path Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8 Defines the internal constant `_GET_API_VERSION_PATH` which specifies the API endpoint for retrieving the Hydrus API server's version information. ```Python _GET_API_VERSION_PATH = "/api_version" ``` -------------------------------- ### Add include_milliseconds Parameter to get_file_metadata (Python) Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8 This snippet shows the addition of the `include_milliseconds` optional boolean parameter to the `get_file_metadata` method. When set to `True`, it requests timestamps with millisecond precision from the Hydrus API. The parameter is serialized to JSON before being sent in the request. ```Python include_blurhash: T.Optional[bool] = None, include_milliseconds: T.Optional[bool] = None, ) -> dict[str, T.Any]: if hashes is None and file_ids is None: raise ValueError("At least one of hashes, file_ids is required") # ... (other params handling) if include_blurhash is not None: params["include_blurhash"] = json.dumps(include_blurhash) if include_milliseconds is not None: params["include_milliseconds"] = json.dumps(include_milliseconds) response = self._api_request("GET", self._GET_FILE_METADATA_PATH, params=params) return response.json() ``` -------------------------------- ### Hydrus API Client: Update Internal API Version Constant Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8 This snippet shows the update of the `VERSION` constant within the `Client` class from 57 to 61. This change signifies the client's compatibility with Hydrus API version 61. ```Python class Client: VERSION = 61 ``` -------------------------------- ### Define TimestampType and CanvasType Enums (Python) Source: https://gitlab.com/cryzed/hydrus-api/-/merge_requests/8 These enums define the types of timestamps that can be edited or queried, and the types of canvases associated with file views in the Hydrus API. `TimestampType` specifies various modification and viewing timestamps, while `CanvasType` differentiates between media and preview viewers. ```Python @enum.unique class TimestampType(_StringableIntEnum): MODIFIED_DOMAIN = 0 MODIFIED_FILE = 1 MODIFIED_AGGREGATE = 2 IMPORTED = 3 DELETED = 4 ARCHIVED = 5 LAST_VIEWED = 6 PREVIOUSLY_VIEWED = 7 @enum.unique class CanvasType(_StringableIntEnum): MEDIA_VIEWER = 0 PREVIEW_VIEWER = 1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.