Closed kylelondonuk closed 5 years ago
Ok so in the official specification I see this:
On the messages I see a "file" but no "files":
There is no "files" in the specification, but as you found, there is one on the API. That's something we can fix via patches.
The "storage" you saw is a standard PHP ArrayObject, so you can access files via $response['files']
. So even data not mapped to real objects can be read.
Hi thanks Damien. Yes I read the bit on items missing from the spec and patches, so I thought this must be that. However, I tried accessing the files array, but it comes back as a private PHP ArrayObject, so I can't. Do I have to access it in the response before the PHP object normalization occurs?
Thanks for your patience here.
I'm not able to reproduce, could you show a full var_dump of the resource you got?
Could you call getArrayCopy()
on the ObjsMessage?
Have you check ArrayObject documentation? https://www.php.net/manual/en/class.arrayobject.php Because from where I stand you should be able to get that data.
Hi Damien, I actually decided to just use cURL to access the API directly, because our requirements were very simple (just 2 endpoints). So I don't have the PHP api installed on the site anymore, and it's gone live so I can't add it back to help you test, I'm sorry.
If it helps: the raw responses from the API are definitely fine, just something happened in normalization or conversion to PHP, which made the files array a private array I couldn't access. My assumption was that any "extra data" that comes back from the API (which wasn't explicitly defined in the auto-generated Jane files), got marked private as a kind of safety, because it didn't know what to do with that data?
Ok, glad you didn't got stuck :grimacing:
I'm keeping this issue open:
Cheers
Great - hope I helped :)
Just so you know, this has been fixed :tada: and the "files" property is now mapped to DTO.
I also added documentation about how to get not mapped data: https://github.com/jolicode/slack-php-api#missing-data-in-the-dto
Hi,
When I load messages from a channel using:
the array I get back has a private 'storage' array with the 'files' array inside it, instead of just having a 'files' array. When I use the API tester here it's all fine: https://api.slack.com/methods/channels.history/test
So i think it's something to do with the normalizer or PHP conversion?