Table of Contents

Class BlobEndpoint

Namespace
TypedRest.Endpoints.Raw
Assembly
TypedRest.dll

Endpoint for a binary blob that can be downloaded or uploaded.

public class BlobEndpoint : EndpointBase, IBlobEndpoint, IEndpoint
Inheritance
BlobEndpoint
Implements
Inherited Members
Extension Methods

Constructors

BlobEndpoint(IEndpoint, string)

Creates a new blob endpoint.

public BlobEndpoint(IEndpoint referrer, string relativeUri)

Parameters

referrer IEndpoint

The endpoint used to navigate to this one.

relativeUri string

The URI of this endpoint relative to the referrer's. Add a ./ prefix here to imply a trailing slash referrer's URI.

BlobEndpoint(IEndpoint, Uri)

Endpoint for a binary blob that can be downloaded or uploaded.

public BlobEndpoint(IEndpoint referrer, Uri relativeUri)

Parameters

referrer IEndpoint

The endpoint used to navigate to this one.

relativeUri Uri

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

Properties

DeleteAllowed

Indicates whether the server has specified DeleteAsync(CancellationToken) is currently allowed.

public bool? DeleteAllowed { get; }

Property Value

bool?

true if the method is allowed, false if the method is not allowed, null If no request has been sent yet or the server did not specify allowed methods.

Remarks

Uses cached data from last response.

DownloadAllowed

Indicates whether the server has specified DownloadAsync(CancellationToken) is currently allowed.

public bool? DownloadAllowed { get; }

Property Value

bool?

true if the method is allowed, false if the method is not allowed, null If no request has been sent yet or the server did not specify allowed methods.

Remarks

Uses cached data from last response.

UploadAllowed

Indicates whether the server has specified UploadFromAsync(Stream, string?, CancellationToken) is currently allowed.

public bool? UploadAllowed { get; }

Property Value

bool?

true if the method is allowed, false if the method is not allowed, null If no request has been sent yet or the server did not specify allowed methods.

Remarks

Uses cached data from last response.

Methods

DeleteAsync(CancellationToken)

Deletes the blob from the server.

public Task DeleteAsync(CancellationToken cancellationToken = default)

Parameters

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.

DownloadAsync(CancellationToken)

Downloads the blob's content to a stream.

public Task<Stream> DownloadAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Used to cancel the request.

Returns

Task<Stream>

A stream with the blob's content.

Exceptions

AuthenticationException

Unauthorized

UnauthorizedAccessException

Forbidden

KeyNotFoundException

NotFound or Gone

HttpRequestException

Other non-success status code.

ProbeAsync(CancellationToken)

Queries the server about capabilities of the endpoint without performing any action.

public Task ProbeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Used to cancel the request.

Returns

Task

Exceptions

AuthenticationException

Unauthorized

UnauthorizedAccessException

Forbidden

KeyNotFoundException

NotFound or Gone

HttpRequestException

Other non-success status code.

UploadFromAsync(Stream, string?, CancellationToken)

Uploads data as the blob's content from a stream.

public Task UploadFromAsync(Stream stream, string? mimeType = null, CancellationToken cancellationToken = default)

Parameters

stream Stream

The stream to read the upload data from.

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

HttpRequestException

Other non-success status code.