-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(chat): Added metadata definition for chat.postMessage and history (…
- Loading branch information
Showing
12 changed files
with
479 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of JoliCode's Slack PHP API project. | ||
* | ||
* (c) JoliCode <coucou@jolicode.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace JoliCode\Slack\Api\Model; | ||
|
||
class ObjsMetadata | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $initialized = []; | ||
/** | ||
* @var mixed|null | ||
*/ | ||
protected $eventPayload; | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $eventType; | ||
|
||
public function isInitialized($property): bool | ||
{ | ||
return \array_key_exists($property, $this->initialized); | ||
} | ||
|
||
public function getEventPayload() | ||
{ | ||
return $this->eventPayload; | ||
} | ||
|
||
public function setEventPayload($eventPayload): self | ||
{ | ||
$this->initialized['eventPayload'] = true; | ||
$this->eventPayload = $eventPayload; | ||
|
||
return $this; | ||
} | ||
|
||
public function getEventType(): ?string | ||
{ | ||
return $this->eventType; | ||
} | ||
|
||
public function setEventType(?string $eventType): self | ||
{ | ||
$this->initialized['eventType'] = true; | ||
$this->eventType = $eventType; | ||
|
||
return $this; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of JoliCode's Slack PHP API project. | ||
* | ||
* (c) JoliCode <coucou@jolicode.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace JoliCode\Slack\Api\Normalizer; | ||
|
||
use Jane\Component\JsonSchemaRuntime\Reference; | ||
use JoliCode\Slack\Api\Runtime\Normalizer\CheckArray; | ||
use JoliCode\Slack\Api\Runtime\Normalizer\ValidatorTrait; | ||
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 ObjsMetadataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface | ||
{ | ||
use CheckArray; | ||
use DenormalizerAwareTrait; | ||
use NormalizerAwareTrait; | ||
use ValidatorTrait; | ||
|
||
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool | ||
{ | ||
return 'JoliCode\\Slack\\Api\\Model\\ObjsMetadata' === $type; | ||
} | ||
|
||
public function supportsNormalization($data, $format = null, array $context = []): bool | ||
{ | ||
return \is_object($data) && 'JoliCode\\Slack\\Api\\Model\\ObjsMetadata' === \get_class($data); | ||
} | ||
|
||
public function denormalize($data, $class, $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 \JoliCode\Slack\Api\Model\ObjsMetadata(); | ||
if (null === $data || false === \is_array($data)) { | ||
return $object; | ||
} | ||
if (\array_key_exists('event_payload', $data) && null !== $data['event_payload']) { | ||
$object->setEventPayload($data['event_payload']); | ||
} elseif (\array_key_exists('event_payload', $data) && null === $data['event_payload']) { | ||
$object->setEventPayload(null); | ||
} | ||
if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { | ||
$object->setEventType($data['event_type']); | ||
} elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { | ||
$object->setEventType(null); | ||
} | ||
|
||
return $object; | ||
} | ||
|
||
/** | ||
* @return array|string|int|float|bool|\ArrayObject|null | ||
*/ | ||
public function normalize($object, $format = null, array $context = []) | ||
{ | ||
$data = []; | ||
$data['event_payload'] = $object->getEventPayload(); | ||
$data['event_type'] = $object->getEventType(); | ||
|
||
return $data; | ||
} | ||
|
||
public function getSupportedTypes(string $format = null): array | ||
{ | ||
return ['JoliCode\\Slack\\Api\\Model\\ObjsMetadata' => false]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26892,4 +26892,4 @@ | |
}, | ||
"swagger": "2.0", | ||
"tags": [] | ||
} | ||
} |
Oops, something went wrong.