Class UploadEndpoint
Endpoint that accepts binary uploads using multi-part form encoding or raw bodies.
public class UploadEndpoint : EndpointBase, IUploadEndpoint, IEndpoint
- Inheritance
-
UploadEndpoint
- Implements
- Inherited Members
- Extension Methods
Constructors
UploadEndpoint(IEndpoint, string, string?)
Creates a new upload endpoint using multi-part form encoding.
public UploadEndpoint(IEndpoint referrer, string relativeUri, string? formField = null)
Parameters
referrerIEndpointThe endpoint used to navigate to this one.
relativeUristringThe URI of this endpoint relative to the
referrer's.formFieldstringThe name of the form field to place the uploaded data into; leave
nullto use raw bodies instead of a multi-part forms.
UploadEndpoint(IEndpoint, Uri, string?)
Endpoint that accepts binary uploads using multi-part form encoding or raw bodies.
public UploadEndpoint(IEndpoint referrer, Uri relativeUri, string? formField = null)
Parameters
referrerIEndpointThe endpoint used to navigate to this one.
relativeUriUriThe URI of this endpoint relative to the
referrer's.formFieldstringThe name of the form field to place the uploaded data into; leave
nullto use raw bodies instead of a multi-part forms.
Methods
UploadFromAsync(Stream, string?, string?, CancellationToken)
Uploads data to the endpoint from a stream.
public Task UploadFromAsync(Stream stream, string? fileName = null, string? mimeType = null, CancellationToken cancellationToken = default)
Parameters
streamStreamThe stream to read the upload data from.
fileNamestringThe name of the uploaded file.
mimeTypestringThe MIME type of the data to upload.
cancellationTokenCancellationTokenUsed to cancel the request.
Returns
Exceptions
- InvalidDataException
- AuthenticationException
- UnauthorizedAccessException
- KeyNotFoundException
- HttpRequestException
Other non-success status code.