upload(mediaData_mimeType_category_progress_) - daneden/Twift GitHub Wiki

upload(mediaData:mimeType:category:progress:)

Uploads media data and returns an ID string that can be used to attach media to Tweets

@available(*, deprecated, message: "Media methods currently depend on OAuth 1.0a authentication, which will be deprecated in a future version of Twift. These media methods may be removed or replaced in the future.")
  public func upload(mediaData: Data, mimeType: String, category: MediaCategory, progress: UnsafeMutablePointer<Progress>? = nil)

Parameters

  • mediaData: The media data to upload
  • mimeType: The type of media you're uploading
  • category: The category for the media you're uploading. Defaults to tweetImage; this will cause gif and video uploads to error unless the category is set appropriately.
  • progress: An optional pointer to a Progress instance, used to track the progress of the upload task. The progress is based on the number of base64 chunks the data is split into; each chunk will be approximately 2mb in size.

Returns

A MediaUploadResponse object containing information about the uploaded media, including its mediaIdString, which is used to attach media to Tweets

⚠️ **GitHub.com Fallback** ⚠️