Module utils

Module utils 

Source
Expand description

Utility functions for the Qobuz API Rust library.

This module provides various utility functions used throughout the library including MD5 hashing, query string building, timestamp generation, credential management, filename sanitization, and HTTP response handling. These utilities support the core API functionality and provide common operations needed for working with the Qobuz API.

Functions§

capitalize_first_letter
Helper function to capitalize the first letter of a string.
deserialize_response
Deserializes an HTTP response to the expected type.
download_image
Downloads an image from a URL asynchronously.
get_current_timestamp
Gets the current Unix timestamp as a string.
get_md5_hash
Computes the MD5 hash of the input string.
get_web_player_app_id
Extracts the app ID from Qobuz Web Player’s bundle.js file.
get_web_player_app_secret
Extracts the app secret from Qobuz Web Player’s bundle.js file.
read_app_credentials_from_env
Reads app credentials from a .env file.
sanitize_filename
Sanitizes a string to be used as a filename by removing or replacing invalid characters.
timestamp_to_date_and_year
Converts a Unix timestamp to a “YYYY-MM-DD” string and extracts the year.
to_query_string
Builds a query string from a collection of key-value pairs.
write_app_credentials_to_env
Writes app credentials to a .env file.