PLhery / node-twitter-api-v2

Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.
https://www.npmjs.com/package/twitter-api-v2
Apache License 2.0
1.31k stars 181 forks source link

Returning the whole media information when uploading #506

Closed HapLifeMan closed 9 months ago

HapLifeMan commented 11 months ago

Hello, I know this library is not in active development anymore, but I'd like to know if it was possible to update the .uploadMedia wrapper in order to return the full media information instead of the media_id.

https://github.com/PLhery/node-twitter-api-v2/blob/38f87ecc8d58cf8da92798be408fecd632e54219/src/v1/client.v1.write.ts#L382

Of course, a workaround is to use the .mediaInfo wrapper, but if we can save a request for an information we have when uploading a media, that would be nice. Another solution is to fork this repo, make the change and use my forked version, but it would be easier to have it here. It would be a breaking change so probably a major version change.

I'm looking for the media_key and expires_after_secs values. Any reason to return the media_id instead of whole object?

Thank you!

PLhery commented 11 months ago

Fair point ; to avoid a breaking change, we could add a parameter "returnFullMediaData = false" to decide whether to return the id or the full object

alkihis commented 11 months ago

What's the excepted behaviour when media processing fails? Throw an error or return the .mediaInfo data with the error payload?

HapLifeMan commented 11 months ago

@PLhery Adding a parameter with default behavior to current would be perfect to prevent major version change. @alkihis I don't know, something that will be consistent with other POST endpoints will be fine!

PLhery commented 9 months ago

Feature available in v1.16.0