Skip to content

Commit

Permalink
feat(lib): generate code from braze-specification
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Feb 1, 2024
1 parent d4066d3 commit 4056339
Show file tree
Hide file tree
Showing 111 changed files with 15,885 additions and 6,825 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,83 +13,157 @@
use Braze\Runtime\Normalizer\CheckArray;
use Braze\Runtime\Normalizer\ValidatorTrait;
use Jane\Component\JsonSchemaRuntime\Reference;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class CampaignsTriggerScheduleCreatePostBodyAudienceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use CheckArray;
use ValidatorTrait;

public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) {
class CampaignsTriggerScheduleCreatePostBodyAudienceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
return $type === 'Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience';
}

public function supportsNormalization($data, $format = null, array $context = []): bool
{
return is_object($data) && get_class($data) === 'Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience';
}
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use CheckArray;
use ValidatorTrait;

public function denormalize($data, $class, $format = null, array $context = [])
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
{
return $type === 'Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience';
}
if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);

public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
{
return is_object($data) && get_class($data) === 'Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience';
}
$object = new \Braze\Model\CampaignsTriggerScheduleCreatePostBodyAudience();
if (null === $data || false === \is_array($data)) {

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}
if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \Braze\Model\CampaignsTriggerScheduleCreatePostBodyAudience();
if (null === $data || false === \is_array($data)) {
return $object;
}
if (\array_key_exists('AND', $data)) {
$values = [];
foreach ($data['AND'] as $value) {
$values[] = $value;
}
$object->setAND($values);
unset($data['AND']);
}
foreach ($data as $key => $value_1) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value_1;
}
}

return $object;
}
if (\array_key_exists('AND', $data)) {
$values = [];
foreach ($data['AND'] as $value) {
$values[] = $value;

public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$data = [];
if ($object->isInitialized('aND') && null !== $object->getAND()) {
$values = [];
foreach ($object->getAND() as $value) {
$values[] = $value;
}
$data['AND'] = $values;
}
$object->setAND($values);
unset($data['AND']);
}
foreach ($data as $key => $value_1) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value_1;
foreach ($object as $key => $value_1) {
if (preg_match('/.*/', (string) $key)) {
$data[$key] = $value_1;
}
}

return $data;
}

return $object;
public function getSupportedTypes(string $format = null): array
{
return ['Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience' => false];
}
}

/**
* @return array|string|int|float|bool|\ArrayObject|null
*/
public function normalize($object, $format = null, array $context = [])
} else {
class CampaignsTriggerScheduleCreatePostBodyAudienceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface
{
$data = [];
if ($object->isInitialized('aND') && null !== $object->getAND()) {
$values = [];
foreach ($object->getAND() as $value) {
$values[] = $value;
}
$data['AND'] = $values;
use DenormalizerAwareTrait;
use NormalizerAwareTrait;
use CheckArray;
use ValidatorTrait;

public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool
{
return $type === 'Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience';
}
foreach ($object as $key => $value_1) {
if (preg_match('/.*/', (string) $key)) {
$data[$key] = $value_1;

public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
{
return is_object($data) && get_class($data) === 'Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience';
}

public function denormalize($data, $type, $format = null, array $context = [])
{
if (isset($data['$ref'])) {
return new Reference($data['$ref'], $context['document-origin']);
}
if (isset($data['$recursiveRef'])) {
return new Reference($data['$recursiveRef'], $context['document-origin']);
}
$object = new \Braze\Model\CampaignsTriggerScheduleCreatePostBodyAudience();
if (null === $data || false === \is_array($data)) {
return $object;
}
if (\array_key_exists('AND', $data)) {
$values = [];
foreach ($data['AND'] as $value) {
$values[] = $value;
}
$object->setAND($values);
unset($data['AND']);
}
foreach ($data as $key => $value_1) {
if (preg_match('/.*/', (string) $key)) {
$object[$key] = $value_1;
}
}

return $object;
}

return $data;
}
/**
* @return array|string|int|float|bool|\ArrayObject|null
*/
public function normalize($object, $format = null, array $context = [])
{
$data = [];
if ($object->isInitialized('aND') && null !== $object->getAND()) {
$values = [];
foreach ($object->getAND() as $value) {
$values[] = $value;
}
$data['AND'] = $values;
}
foreach ($object as $key => $value_1) {
if (preg_match('/.*/', (string) $key)) {
$data[$key] = $value_1;
}
}

public function getSupportedTypes(string $format = null): array
{
return ['Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience' => false];
return $data;
}

public function getSupportedTypes(string $format = null): array
{
return ['Braze\\Model\\CampaignsTriggerScheduleCreatePostBodyAudience' => false];
}
}
}
Loading

0 comments on commit 4056339

Please sign in to comment.