Table of Contents

Class UploadEndpoint

Namespace
TypedRest.Endpoints.Raw
Assembly
TypedRest.dll

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 IEndpoint

The endpoint used to navigate to this one.

relativeUri string

The URI of this endpoint relative to the referrer's.

formField string

The 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?)

Creates a new upload endpoint.

public UploadEndpoint(IEndpoint referrer, Uri relativeUri, string? formField = null)

Parameters

referrer IEndpoint

The endpoint used to navigate to this one.

relativeUri Uri

The URI of this endpoint relative to the referrer's.

formField string

The 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 Stream

The stream to read the upload data from.

fileName string

The name of the uploaded file.

mimeType string

The MIME type of the data to upload.

cancellationToken CancellationToken

Used to cancel the request.

Returns

Task

Exceptions

InvalidDataException

BadRequest

AuthenticationException

Unauthorized

UnauthorizedAccessException

Forbidden

KeyNotFoundException

NotFound or Gone

HttpRequestException

Other non-success status code.