Introduce better config of Gateway API URL & implement image sending via FileMessage
UPDATED: Adjusted to reflect additional commits.
Allow configuration of custom Gateway API URL endpoint as part of creating Connection
While it is currently possible to configure a custom Gateway API URL via environment variables as a mock for the gateway client, this change adds the option to set it directly when creating a Connection and updates the gateway client to enable setting via command line .
This approach offers several benefits:
- Keeps endpoint configuration alongside other connection settings in the script.
- Simplifies switching between environments (e.g., PRD/TST) without modifying environment variables.
- Improves portability and maintainability of scripts consuming the Gateway API.
8705e46fa526163a90bdab2960f85bf80ebcc301 e58f7911efd0b5375508bd7f21575fa203790abe
Implement image sending via FileMessage (and deprecate ImageMessage)
As described in #53, Threema has moved away from the old image message and video message format towards one that is based on the file message with additional metadata. Now, the library is updated to support this incl. backwards compatibility.
2d6b817e9ff860d8e44b88bae256123681ad8d6a
Thanks. Considering a more advanced setup may need to provide the service to multiple servers, it would be a good addition. But it does need to work more in tandem with the environment-based override.
I.e., the URL writer should take the base URL from the environment variable if provided. And if there's a conflict, the API should throw an error.
@threema-lenny , thanks! At the moment, the library actually does not support environment variables (I wasn't precise in my initial message).
The test client currently mocks the URL when an environment variable is set. I can change the test client to use the connection base parameter now.
Or do you suggest to update this to also check for environment variable?
self._base_url = (base_url or _DEFAULT_BASE_URL).rstrip('/')
Shouldn't the env variable be used on consumption of the library by the implementation?
Updated PR to reflect both implementations:
- File Handling
- Gateway API URL