Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 2.31 KB

UPGRADE.md

File metadata and controls

58 lines (42 loc) · 2.31 KB

Upgrade guide

v0.1.2

  • Moved WrkFlow\ApiSdkBuilder\ApiFactory to WrkFlow\ApiSdkBuilder\Factories\ApiFactory.
  • Moved WrkFlow\ApiSdkBuilder\Response namespace to WrkFlow\ApiSdkBuilder\Factories\Responses namespace.
  • WrkFlow\ApiSdkBuilder\Contracts\OptionsContract has new signature for toBody(AbstractEnvironment $environment).
  • WrkFlow\ApiSdkBuilder\Options\AbstractJsonOptions has new signature for toArray(AbstractEnvironment $environment).
  • WrkFlow\ApiSdkBuilder\Contracts\SDKContainerFactoryContract has new signature mixed $body parameter for makeResponse(string $class, ResponseInterface $response, mixed $body): AbstractResponse;
  • WrkFlow\ApiSdkBuilder\Factories\GuzzleLaravelApiFactory removed in favor of LaravelServiceProvider provider with HTTP auto discovery.
  • WrkFlow\ApiSdkBuilder\Factories\LaravelApiFactory removed in favor of LaravelServiceProvider provider with HTTP auto discovery.

Response classes

Response classes that extends AbstractJsonResponse/AbstractJsonItemsResponse requires new parameter array $body in __construct.

It is important that name of the parameters is $body.

Also parseJson function is removed. Transfer your parsing code within constructor.

  • json returns GetValue instance.
  • xml returns GetValue instance. Docs.

WorksWithJson / WorksWithXml / Transformers

Both traits were removed in favor of GetValue package that makes accessing data easier.

Endpoint

makeResponse has been removed. Update your endpoints to new usage:

public function paginate(
    GetUnitsOptions $options = null,
    PageInfoOptions $page = new PageInfoOptions()
): UnitsResponse {
    $result = $this->api->post($this->uri(), new MergedJsonOptions([$options, $page]));

    return $this->makeResponse(UnitsResponse::class, $result);
} 

to

public function paginate(
    GetUnitsOptions $options = null,
    PageInfoOptions $page = new PageInfoOptions()
): UnitsResponse {
    return $this->api->post(
        responseClass: UnitsResponse::class,
        uri: $this->uri(), 
        body: new MergedJsonOptions([$options, $page]),
    );
} 

__construct signature has been changed - MakeBodyFromResponseAction $makeBodyFromResponseAction removed.