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
referrer
IEndpointThe endpoint used to navigate to this one.
relativeUri
stringThe URI of this endpoint relative to the
referrer
's.formField
stringThe name of the form field to place the uploaded data into; leave
null
to 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
referrer
IEndpointThe endpoint used to navigate to this one.
relativeUri
UriThe URI of this endpoint relative to the
referrer
's.formField
stringThe name of the form field to place the uploaded data into; leave
null
to 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
stream
StreamThe stream to read the upload data from.
fileName
stringThe name of the uploaded file.
mimeType
stringThe MIME type of the data to upload.
cancellationToken
CancellationTokenUsed to cancel the request.
Returns
Exceptions
- InvalidDataException
- AuthenticationException
- UnauthorizedAccessException
- KeyNotFoundException
- HttpRequestException
Other non-success status code.