Skip to content

Swift Create Media Support#412

Closed
jkmassel wants to merge 5 commits intotrunkfrom
jkmassel/create-media
Closed

Swift Create Media Support#412
jkmassel wants to merge 5 commits intotrunkfrom
jkmassel/create-media

Conversation

@jkmassel
Copy link
Contributor

No description provided.

@jkmassel jkmassel changed the title Jkmassel/create media Swift Create Media Support Nov 27, 2024
@jkmassel jkmassel force-pushed the jkmassel/create-media branch 2 times, most recently from 0e955f9 to 1e0eb05 Compare November 27, 2024 22:39
@jkmassel jkmassel mentioned this pull request Dec 2, 2024
Base automatically changed from create-media-2 to trunk December 2, 2024 22:43
@jkmassel jkmassel force-pushed the jkmassel/create-media branch from 1e0eb05 to 74d5023 Compare May 5, 2025 22:19
}
public func uploadMedia(mediaUploadRequest: MediaUploadRequest) async throws -> WpNetworkResponse {
let urlrequest = try await mediaUploadRequest.asUrlRequest()
let (_, response) = try await self.fetch(request: self.preflight(urlrequest))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URLSession.uploadTask is probably more appropriate for uploading media. We can choose to stream from a file or memory. Things may go wrong when users choose to upload a video if we always read the file content into memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not currently reading the file into memory – instead, we make a file that contains the entire request body then provide that as an InputStream on the URLRequest.

It might make sense to separate binary upload from the file metadata though, in which case we could definitely use an upload task

@jkmassel
Copy link
Contributor Author

Closing in favour of #717

@jkmassel jkmassel closed this May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants