Cogniac / cogniac-sdk-py

Python SDK for Cogniac Public API
Apache License 2.0
5 stars 6 forks source link

Move API version out of URL prefix in core requests wrapper to enable per-endpoint versioning. #99

Closed ah-cog closed 3 years ago

ah-cog commented 3 years ago

The intent here is to enable per-endpoint API versioning so service APIs can be introduced incrementally (e.g., pending services with API version /21/).

No endpoints were introduced with new versions. This PR just places the version for APIs in endpoint calls.

These changes are being made such that the COG_URL_PREFIX environment variable no longer requires the API version in the string. For example, where the API base URL and version were previously set (e.g., export COG_URL_PREFIX=https://api.cogniac.io/1/), now only the base API URL would need to be set (e.g., export COG_URL_PREFIX=https://api.cogniac.io/). The SDK will detect if the version is specified and strip it from the COG_URL_PREFIX if present.

If COG_URL_PREFIX includes the version, it will be stripped.

Summary of changes

ah-cog commented 3 years ago

@sergii-bond NP. Yes, modifications will be needed to use those functions.