Skip to content

Commit

Permalink
Release version 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
infobip-ci committed Mar 2, 2023
1 parent e37bb61 commit 3af5779
Show file tree
Hide file tree
Showing 467 changed files with 83,744 additions and 54,542 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ All notable changes to the library will be documented in this file.

The format of the file is based on [Keep a Changelog](http://keepachangelog.com/) and this library adheres to [Semantic Versioning](http://semver.org/) as mentioned in the [README.md][readme] file.

## [ [5.0.0](https://github.com/infobip/infobip-api-php-client/releases/tag/5.0.0) ] - 2023-03-01

⚠️ **IMPORTANT NOTE:** This release contains breaking changes!

🎉 **NEW Major Version of `infobip-api-php-client`.**

### Added
* Support for [Infobip MMS API](https://www.infobip.com/docs/api/channels/mms).
* Support for [Infobip Voice API](https://www.infobip.com/docs/api/channels/voice).
* Support for [Infobip WebRTC API](https://www.infobip.com/docs/api/channels/webrtc).
* Support for [Infobip Viber API](https://www.infobip.com/docs/api/channels/viber).
* Most recent [Infobip SMS API](https://www.infobip.com/docs/api/channels/sms) feature set.
* Most recent [Email](https://www.infobip.com/docs/api/channels/email) feature set.
* Most recent [WhatsApp](https://www.infobip.com/docs/api/channels/whatsapp) feature set.

### Changed
- Fully refactored codebase using Symfony components

## [ [4.0.0](https://github.com/infobip/infobip-api-php-client/releases/tag/4.0.0) ] - 2022-10-21

⚠️ **IMPORTANT NOTE:** This release contains breaking changes!
Expand Down
93 changes: 93 additions & 0 deletions Infobip/Api/ApiTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

// phpcs:ignorefile

/**
*
* PHP version 8.0
*
* @category Trait
* @package Infobip
* @author Infobip Support
* @link https://www.infobip.com
*/

declare(strict_types=1);

/**
* Infobip Client API Libraries OpenAPI Specification
*
* OpenAPI specification containing public endpoints supported in client API libraries.
*
* Contact: support@infobip.com
*
* This class is auto generated from the Infobip OpenAPI specification through the OpenAPI Specification Client API libraries (Re)Generator (OSCAR), powered by the OpenAPI Generator (https://openapi-generator.tech).
*
* Do not edit manually. To learn how to raise an issue, see the CONTRIBUTING guide or contact us @ support@infobip.com.
*/

namespace Infobip\Api;

use Infobip\SplFileObjectNormalizer;
use Psr\Http\Message\StreamInterface;
use RuntimeException;
use SplFileObject;
use Symfony\Component\Validator\Constraints as Assert;

trait ApiTrait
{
/**
* @internal
*/
private function deserialize(mixed $response, string $type, array $responseHeaders = []): mixed
{
if ($response === null) {
return $response;
}

if (\in_array($type, ['bool', 'int', 'float', 'string', 'null'])) {
if ($response instanceof StreamInterface) {
$response = (string)$response;
}

return $response;
}

if (\in_array($type, [SplFileObject::class, '\SplFileObject'])) {
return $this
->objectSerializer
->denormalize(
$response,
SplFileObject::class,
[SplFileObjectNormalizer::HEADERS_KEY => $responseHeaders]
);
}

return $this->objectSerializer->deserialize((string)$response, $type, $responseHeaders);
}

private function addParamConstraints(array $paramConstraints, array &$validationConstraints): void
{
foreach ($paramConstraints as $key => $constraints) {
if (!empty($constraints)) {
$validationConstraints[$key] = new Assert\All($constraints);
}
}
}

/**
* @internal
*/
private function validateParams(array $allData, array $validationConstraints): void
{
if (!empty($validationConstraints)) {
$dataToValidate = [];

foreach (\array_keys($validationConstraints) as $constraintKey) {
$dataToValidate[$constraintKey] = $allData[$constraintKey];
}

$this->objectSerializer->validate($dataToValidate, $validationConstraints);
}
}
}
Loading

0 comments on commit 3af5779

Please sign in to comment.