Skip to content

Commit

Permalink
Improve typings and add uploadMedia.returnFullMediadata to the docume…
Browse files Browse the repository at this point in the history
…ntation

Following #509 and related to #506
  • Loading branch information
PLhery committed Jan 19, 2024
1 parent a5f13c7 commit 414ba71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ you **must** specify the file type using `options.type`.
- `options.shared` Specify `true` here if you want to use this media in Welcome Direct Messages.
- `options.additionalOwners` List of user IDs (except you) allowed to use the new media ID.
- `options.maxConcurrentUploads` Number of concurrent chunk uploads allowed to be sent. Defaults to `3`.
- `returnFullMediadata` If set to true, returns the whole media information instead of just the media_id.

**Returns**: `string`: Media ID to give to tweets/DMs

Expand Down
2 changes: 2 additions & 0 deletions src/v1/client.v1.write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ export default class TwitterApiv1ReadWrite extends TwitterApiv1ReadOnly {
*
* @param returnFullMediaData If set to true, returns the whole media information instead of just the media_id
*/
public async uploadMedia(file: TUploadableMedia, options: Partial<UploadMediaV1Params>, returnFullMediaData: true): Promise<MediaStatusV1Result>;
public async uploadMedia(file: TUploadableMedia, options?: Partial<UploadMediaV1Params>): Promise<string>;
public async uploadMedia(file: TUploadableMedia, options: Partial<UploadMediaV1Params> = {}, returnFullMediaData = false) {
const chunkLength = options.chunkLength ?? (1024 * 1024);

Expand Down

0 comments on commit 414ba71

Please sign in to comment.