Current section
Files
Jump to
Current section
Files
campaign_flow
CHANGELOG.md
CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0] - 2025-12-17
### Added
- **Shared Token Manager Architecture**: OAuth2 tokens are now managed by dedicated GenServer processes and shared across all processes
- `CampaignFlow.Application` - OTP Application module with supervision tree
- `CampaignFlow.Client.TokenManager` - GenServer for centralized token management
- Multi-environment support: Configure and use both `:prod` and `:test` environments simultaneously
- Named TokenManager processes (e.g., `CampaignFlow.TokenManager.Prod`, `CampaignFlow.TokenManager.Test`)
- Automatic token refresh coordination: Only one refresh occurs when token expires, even with concurrent requests
- Application-level configuration via `config :campaign_flow, :environments`
- Example configuration file at `config/config.exs.example`
### Changed
- **BREAKING**: API functions now return `response` directly instead of `{response, updated_client}` tuple
- **BREAKING**: `Client.new/1` now requires `:environment` parameter instead of `:client_id` and `:client_secret`
- **BREAKING**: Credentials are now configured globally in application config, not passed to `Client.new/1`
- **BREAKING**: Client struct simplified - removed `client_id`, `client_secret`, `access_token`, and `token_expires_at` fields
- **BREAKING**: Added `environment` and `token_manager` fields to Client struct
- All resource module function specs updated to reflect new return types
- `Client.test/1` now accepts no required arguments (credentials from config)
- Updated documentation to reflect new architecture
### Removed
- **BREAKING**: `Client.authenticate/1` - authentication now handled automatically by TokenManager
- **BREAKING**: `Client.token_valid?/1` - token validation now handled by TokenManager
### Migration Guide
To migrate from v0.1.0 to v2.0.0:
1. **Update configuration** - Move credentials from runtime to config:
```elixir
# Before (v0.1.0)
client = CampaignFlow.Client.new(
client_id: "...",
client_secret: "..."
)
# After (v2.0.0)
# In config/config.exs:
config :campaign_flow,
environments: [
prod: [
base_url: "https://app.campaignflow.com.au/api/v2",
client_id: System.get_env("CAMPAIGNFLOW_PROD_CLIENT_ID"),
client_secret: System.get_env("CAMPAIGNFLOW_PROD_CLIENT_SECRET")
]
]
# In your code:
client = CampaignFlow.Client.new(environment: :prod)
```
2. **Update API calls** - Remove client tuple destructuring:
```elixir
# Before (v0.1.0)
{{:ok, campaigns}, client} = CampaignFlow.Client.Campaigns.list(client)
{{:ok, campaign}, client} = CampaignFlow.Client.Campaigns.get(client, 123)
# After (v2.0.0)
{:ok, campaigns} = CampaignFlow.Client.Campaigns.list(client)
{:ok, campaign} = CampaignFlow.Client.Campaigns.get(client, 123)
```
3. **Remove manual authentication** - No longer needed:
```elixir
# Before (v0.1.0)
{:ok, client} = CampaignFlow.Client.authenticate(client)
# After (v2.0.0)
# Authentication happens automatically - remove this code
```
### Benefits
- Eliminated race conditions on token refresh
- Reduced memory usage (one token per environment, not per client instance)
- Improved security (credentials never stored in client structs)
- Simpler API (no need to thread updated client through code)
- Better scalability for high-concurrency applications
- Support for multiple environments simultaneously
## [0.1.0] - 2025-11-24
### Added
- Initial release of the CampaignFlow API client
- OAuth2 client credentials authentication with automatic token management
- Full API coverage for all Campaign Flow endpoints:
- Campaigns (list, get, create, update, add comment, set status, send approved email)
- Campaign Vendors (list, get, add, update, remove, send campaign, verify contact)
- Agencies (list, get)
- Invoices (list, get, create, update)
- Campaign Budgets (list, get, create, update, finance options, finance quotes)
- Finance Applications (list, get, set status, submit)
- Users (list, get)
- Tenants (list, get)
- Properties (list, get)
- Referrals (list, get)
- Signatories (list, get)
- Comprehensive error handling with structured error types
- Support for both production and test environments
- Configurable via application config or runtime options
- Type-safe function signatures with @spec
- Built with the Req HTTP client library
- Complete documentation and usage examples
[0.1.0]: https://github.com/challengr-apps/campaign_flow/releases/tag/v0.1.0