Skip to content

v1.0.2

Choose a tag to compare

@hosseinhezami hosseinhezami released this 23 Oct 20:30
· 7 commits to master since this release
ba1935c

What's Changed

  • Add dynamic API key setting and improve file/HTTP handling by @hosseinhezami in #3

Overview

This PR introduces dynamic API key configuration via a new setApiKey() method and refactors file handling (CRUD operations) for better consistency. It also enhances the HttpClient class to support runtime API key and base URI settings, improving flexibility without breaking existing functionality.

Changes

  • Feat: Dynamic API Key Setting

    • Added Gemini::setApiKey('custom-key') method to allow runtime override of API key (falls back to .env/config if not set).
    • Updated Gemini, ProviderFactory, BaseProvider, and HttpClient to propagate the custom key.
    • Ensures priority for manual set over .env.
  • Refactor: File CRUD Improvements

    • Optimized methods for upload, list, get, and delete files in GeminiProvider and BaseProvider.
    • Switched to consistent use of injected HttpClient for all file operations, removing raw HTTP calls.
    • Fixed inconsistencies in HTTP usage for file-related endpoints.
  • Refactor: HttpClient Enhancements

    • Modified HttpClient to accept optional apiKey and baseUrl in constructor for dynamic configuration.
    • Added chainable methods like withHeaders() and withBody() to support resumable uploads and other requests.

Rationale

These changes make the package more flexible for multi-tenant apps or dynamic environments, while cleaning up code for maintainability. No breaking changes; backward compatibility preserved.

Contributors

Full Changelog: v1.0.1...v1.0.2