*/ private const KNOWN_KEYS = ['_meta', 'nextCursor']; /** * An opaque token representing the pagination position after the last returned result. * If present, there may be more results available. * * @since 2024-11-05 * * @var string|null */ protected ?string $nextCursor; /** * @param array|null $_meta @since 2024-11-05 * @param string|null $nextCursor @since 2024-11-05 * @param array|null $additionalProperties */ public function __construct( ?array $_meta = null, ?string $nextCursor = null, ?array $additionalProperties = null ) { parent::__construct($_meta, $additionalProperties); $this->nextCursor = $nextCursor; } /** * Creates an instance from an array. * * @param array{ * _meta?: array|null, * nextCursor?: string|null * } $data * @phpstan-param array $data * @return self */ public static function fromArray(array $data): self { return new self( self::asArrayOrNull($data['_meta'] ?? null), self::asStringOrNull($data['nextCursor'] ?? null), self::additionalFields($data, self::KNOWN_KEYS) ); } /** * Converts the instance to an array. * * @return array */ public function toArray(): array { $result = parent::toArray(); if ($this->nextCursor !== null) { $result['nextCursor'] = $this->nextCursor; } return $result; } /** * @return string|null */ public function getNextCursor(): ?string { return $this->nextCursor; } }