Skip to content

Latest commit

 

History

History
192 lines (167 loc) · 14.9 KB

UPGRADE.md

File metadata and controls

192 lines (167 loc) · 14.9 KB

5.x

This release comes with breaking changes to what was previously known as "Compute scripts". The endpoints for compute scripts were historically only publicly visible in the official API specs for a short amount of time after which they became undocumented (exact timeline unknown).

With the announcement of "Edge Scripting" on November 7th (2024), it became apparent (in hindsight) that the new edge scripts are basically compute scripts (with some minor adaptations).

As edge scripts are now part of what is referred as the "Edge Scripting API" (even though it still uses the same domain of api.bunny.net), this release reflects (signature) changes in the BunnyNet-PHP library that refactors the previously known compute scripts from the BaseAPI to edge scripts in the EdgeScriptingAPI.

The 4.x branch will now no longer be maintained.

‼️ Breaking changes

The signature changes are displayed in the table below.

4.x 5.x 5.x signature notes
BaseAPI::listComputeScripts EdgeScriptingAPI::listEdgeScripts
BaseAPI::addComputeScript EdgeScriptingAPI::addEdgeScript
BaseAPI::getComputeScript EdgeScriptingAPI::getEdgeScript
- EdgeScriptingAPI::getEdgeScriptStatistics
BaseAPI::updateComputeScript EdgeScriptingAPI::updateEdgeScript
BaseAPI::deleteComputeScript EdgeScriptingAPI::deleteEdgeScript Added query argument.
BaseAPI::getComputeScriptCode EdgeScriptingAPI::getCode
BaseAPI::updateComputeScriptCode EdgeScriptingAPI::setCode
BaseAPI::listComputeScriptReleases EdgeScriptingAPI::getReleases
- EdgeScriptingAPI::getActiveRelease
BaseAPI::publishComputeScript EdgeScriptingAPI::publishRelease Removed query argument.
BaseAPI::publishComputeScriptByPathParameter EdgeScriptingAPI::publishReleaseByUuid
BaseAPI::getComputeScriptVariable EdgeScriptingAPI::getVariable
BaseAPI::addComputeScriptVariable EdgeScriptingAPI::addVariable
BaseAPI::updateComputeScriptVariable EdgeScriptingAPI::updateVariable
- EdgeScriptingAPI::upsertVariable
BaseAPI::deleteComputeScriptVariable EdgeScriptingAPI::deleteVariable
- EdgeScriptingAPI::listSecrets
- EdgeScriptingAPI::addSecret
- EdgeScriptingAPI::updateSecret
- EdgeScriptingAPI::upsertSecret
- EdgeScriptingAPI::deleteSecret

Further usage examples can be found in the documentation website: toshy.github.io/BunnyNet-PHP/edge-scripting-api.

🚀 Enhancements

Endpoint Action Method Notes
Base API ADD getGitHubIntegration Retrieves id that can be used as integrationId for EdgeScriptingAPI::addEdgeScript.

4.x

This release comes with breaking changes to a couple of methods regarding uploading of files. To allow for more flexibility when uploading file contents, instead of passing the path to the local file, you are now required to read in the file contents before passing it to these methods. This change grants users more freedom on how to read file contents/streams (e.g. external sources) as it will now allow any of the following types string|resource|StreamInterface|null as $body parameter (previously $localFilePath).

The 3.x branch will now no longer be maintained.

‼️ Breaking changes

  • File contents/stream should now be explicitly read before passing to the following methods. Examples in the documentation have been updated.
  • BodyContentHelper::openFileStream and FileDoesNotExistException::class have been removed.
    • While previously only used internally for the above-mentioned methods, the openFileStream was a public static method and could've theoretically been used by users, which is the reason for explicitly stating it here.

3.x

This release reworks (almost) the entire codebase, and therefore results in quite some breaking changes. Please read the following notes carefully before upgrading.

The 2.x branch will now no longer be maintained.

‼️ Breaking changes

  • Request (PSR-18)
    • Addition of Psr\Http\Client\ClientInterface requires the user to construct a BunnyClient, and supply the BunnyClient to the API classes. Examples can be found in the documentation website.
  • Response
    • Return type for public API methods changed from array to ToshY\BunnyNet\Model\Client\BunnyClientResponse:
      • Change from $response['content'] to $response->getContents()
      • Change from $response['headers'] to $response->getHeaders()
      • Change from $response['status']['code'] to $response->getStatusCode()
      • Change from $response['status']['info'] to $response->getReasonPhrase()
      • A new method getBody() was added.
  • Endpoints
    • The following public classes have been renamed:
      • The class BaseRequest was renamed to BaseAPI.
      • The class EdgeStorageRequest was renamed to EdgeStorageAPI.
      • The class PullZoneLogRequest was renamed to LoggingAPI.
      • The class VideoStreamRequest was renamed to StreamAPI.
      • The class SecureUrlGenerator was renamed to TokenAuthentication.
        • The method generate was renamed to sign.
      • The class ImageOptimizer was renamed to ImageProcessor.
        • The argument $optimizationCollection was renamed to $optimization.
      • The class PricingCalculator was removed.
    • The following public methods have been renamed:
      • The method listStorageZone was renamed to listStorageZones.
      • The method resetStorageZonePasswordByPath was renamed to resetStorageZonePassword.
      • The method getCollectionList was renamed to listCollections.
      • The method purgeCache was renamed to purgePullZoneCache.
      • The method addCustomCertificate was renamed to addCertificate.
      • The method(s) having the in the name have been renamed.
        • closeTheAccount => closeAccount
      • The method(s) having lowercase abbreviations have been renamed to uppercase abbreviations.
        • getDpaDetails => getDPADetails
    • The following public methods have been changed:
      • The method fetchVideoToCollection was renamed to fetchVideo, therefore removing the original fetchVideo method.
        • The new fetchVideo method has the same arguments fetchVideoToCollection used to have.
    • Base API
      • The argument $accountApiKey was renamed to $apiKey.
    • Logging API
      • The argument $accountApiKey was renamed to $apiKey.
    • Edge Storage API
      • The argument $hostCode was changed to $region and now only accepts a Region case.
        • Example: For the Falkenstein region (previously 'FS' code) this would now be Region::FS (default).
        • For a complete list of available Region cases, see the example in the documentation website.

Note: Please take in consideration that due to the impact of this release I cannot fully guarantee this list of breaking changes is complete. Thank you for your understanding.

General Updates

  • Styleguide
    • Regarding PHP RFC: Class Naming, class names with initialism, e.g. API, will be uppercase for the initialism part.
      • Variable names for instances of these classes will follow the camelCase naming convention.
        • E.g. $baseApi for the BaseAPI class.
      • Method names including an initialism will (still) follow the camelCase naming convention.
        • Example: get DPA details => getDpaDetails.
        • Example: get DNS zone => getDnsZone.
  • Base API
    • Notes:
      • Updating to the latest API specifications.
  • Edge Storage API
    • Notes:
      • Updating to the latest API specifications.
    • Changes:
      • Manage Files
        • Updated:
          • Download File
            • The arguments $path and $fileName switched order to $fileName and $path; The $path argument now has a default value '', denoting the root directory.
          • Upload File
            • The arguments $path, $fileName and $localFilePath switched order to $fileName, $path and $localFilePath; The $path argument now has a default value '', denoting the root directory.
            • Additional headers argument added (e.g SHA256).
          • Download File
            • The arguments $path and $fileName switched order to $fileName and $path; The $path argument now has a default value '', denoting the root directory.
  • Stream API
    • Notes:
      • Updating to the latest API specifications.
    • Changes:
      • Manage Videos
        • Added:
          • Get Video Heatmap
          • Get Video Statistics
        • Updated:
          • Update Video
            • Body parameters
          • Upload Video
            • Query parameters
          • Fetch Video
            • Input arguments
          • Add Caption
            • Body parameters
        • Deleted:
          • Fetch Video (to Collection)
  • Token Authentication
    • Notes:
      • Added optional argument $speedLimit. Limits download speed in kB/s.
  • Image Processor
    • Notes:
      • Bug fix when supplying boolean values (e.g. flip/flop) were converted to integers.

Noteworthy

  • Migration to PHP 8.1.
    • Addition of (backed) enum types.
    • Internal usage of named arguments.
    • Transforming from old "enum" classes to more explicit endpoint specific classes.
      • Internal changes of array for query/body parameter templates to AbstractParameter class.
  • Decided on composition over inheritance when implementing PSR feature.
  • Added issue templates for creating bug/feature reports.
  • Updated/added phpmd, phpcs, phpstan, phpunit for contributions and in pipelines.
  • Added documentation website to GitHub pages with the help of mkdocs (material).