Created
October 27, 2022 18:48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class MultipartFormBuilder | |
{ | |
private MultipartFormDataContent _form = new(); | |
public MultipartFormBuilder() | |
{ | |
} | |
internal MultipartFormBuilder AddDocument(Document document) | |
{ | |
var fileContent = new ByteArrayContent(document.Data); | |
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(document.Format); | |
_form.Add(fileContent, "documents", document.Name); | |
return this; | |
} | |
internal MultipartFormDataContent Build() | |
{ | |
return _form; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment