Upload a media file (convenience wrapper)
upload_media.RdHandles the full three-step media upload flow:
Call
initiate_post_media_upload()to obtain an upload URL.PUT the file contents to the upload URL.
Poll
get_post_media_status()until processing completes or fails.
Usage
upload_media(
client,
file_path,
media_type = "TYPE_IMAGE",
content_type = NULL,
description = NULL,
poll_interval = 1,
max_wait = 300
)Arguments
- client
A
mixi2_clientobject created bymixi2_client().- file_path
Path to the local file to upload.
- media_type
"TYPE_IMAGE"(default) or"TYPE_VIDEO".- content_type
MIME type. If
NULL(default), it is guessed from the file extension.- description
Optional description string.
- poll_interval
Polling interval in seconds (default
1).- max_wait
Maximum seconds to wait for processing to complete (default
300).
Value
The media_id string, ready to be passed to create_post() or
send_chat_message().
Examples
if (FALSE) { # \dontrun{
client <- mixi2_client()
media_id <- upload_media(client, "photo.jpg")
create_post(client, "Check this out!", media_id_list = media_id)
} # }