TypedRest for .NET 1.3.6
build type-safe fluent-style REST API clients
TypedRest.Endpoints.Generic.CollectionEndpointExtensions Class Reference

Provides extension methods for IIndexerEndpoint<TElementEndpoint> and ICollectionEndpoint<TEntity,TElementEndpoint>. More...

Static Public Member Functions

static Task< bool > ContainsAsync< TElementEndpoint > (this IIndexerEndpoint< TElementEndpoint > endpoint, string id, CancellationToken cancellationToken=default)
 Determines whether the collection contains a specific element. More...
 
static Task< bool > ContainsAsync< TEntity, TElementEndpoint > (this ICollectionEndpoint< TEntity, TElementEndpoint > endpoint, TEntity element, CancellationToken cancellationToken=default)
 Determines whether the collection contains a specific element. More...
 
static Task< TEntity?> SetAsync< TEntity, TElementEndpoint > (this ICollectionEndpoint< TEntity, TElementEndpoint > endpoint, TEntity element, CancellationToken cancellationToken=default)
 Sets/replaces an existing element in the collection. More...
 
static Task< TEntity?> MergeAsync< TEntity, TElementEndpoint > (this ICollectionEndpoint< TEntity, TElementEndpoint > endpoint, TEntity element, CancellationToken cancellationToken=default)
 Modifies an existing element in the collection by merging changes on the server-side. More...
 
static Task DeleteAsync< TElementEndpoint > (this IIndexerEndpoint< TElementEndpoint > endpoint, string id, CancellationToken cancellationToken=default)
 Deletes an existing element from the collection. More...
 
static Task DeleteAsync< TEntity, TElementEndpoint > (this ICollectionEndpoint< TEntity, TElementEndpoint > endpoint, TEntity element, CancellationToken cancellationToken=default)
 Deletes an existing element from the collection. More...
 

Detailed Description

Member Function Documentation

◆ ContainsAsync< TElementEndpoint >()

static Task< bool > TypedRest.Endpoints.Generic.CollectionEndpointExtensions.ContainsAsync< TElementEndpoint > ( this IIndexerEndpoint< TElementEndpoint >  endpoint,
string  id,
CancellationToken  cancellationToken = default 
)
static

Determines whether the collection contains a specific element.

Template Parameters
TElementEndpointThe type of IEndpoint to provide for individual entity.
Parameters
endpointThe collection endpoint containing the element.
idThe ID identifying the entity in the collection.
cancellationTokenUsed to cancel the request.
Exceptions
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
HttpRequestExceptionOther non-success status code.

This is a convenience method equivalent to combining IIndexerEndpoint<TElementEndpoint>.this[string] with IElementEndpoint.ExistsAsync.

Type Constraints
TElementEndpoint :IElementEndpoint 
TElementEndpoint :endpoint 
TElementEndpoint :id 
TElementEndpoint :ExistsAsync 
TElementEndpoint :cancellationToken 

◆ ContainsAsync< TEntity, TElementEndpoint >()

static Task< bool > TypedRest.Endpoints.Generic.CollectionEndpointExtensions.ContainsAsync< TEntity, TElementEndpoint > ( this ICollectionEndpoint< TEntity, TElementEndpoint >  endpoint,
TEntity  element,
CancellationToken  cancellationToken = default 
)
static

Determines whether the collection contains a specific element.

Template Parameters
TEntityThe type of individual elements in the collection.
TElementEndpointThe type of IEndpoint to provide for individual TEntity s.
Parameters
endpointThe collection endpoint containing the element.
elementThe element to be checked.
cancellationTokenUsed to cancel the request.
Exceptions
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
HttpRequestExceptionOther non-success status code.

This is a convenience method equivalent to combining ICollectionEndpoint<TEntity,TElementEndpoint>.this[TEntity] with IElementEndpoint.ExistsAsync.

Type Constraints
TEntity :class 
TElementEndpoint :IElementEndpoint<TEntity> 
TElementEndpoint :endpoint 
TElementEndpoint :element 
TElementEndpoint :ExistsAsync 
TElementEndpoint :cancellationToken 

◆ DeleteAsync< TElementEndpoint >()

static Task TypedRest.Endpoints.Generic.CollectionEndpointExtensions.DeleteAsync< TElementEndpoint > ( this IIndexerEndpoint< TElementEndpoint >  endpoint,
string  id,
CancellationToken  cancellationToken = default 
)
static

Deletes an existing element from the collection.

Template Parameters
TElementEndpointThe type of IEndpoint to provide for individual entities.
Parameters
endpointThe collection endpoint containing the element.
idThe ID identifying the entity in the collection.
cancellationTokenUsed to cancel the request.
Exceptions
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
KeyNotFoundExceptionHttpStatusCode.NotFound or HttpStatusCode.Gone
HttpRequestExceptionOther non-success status code.

This is a convenience method equivalent to combining IIndexerEndpoint<TElementEndpoint>.this[string] with IElementEndpoint.DeleteAsync.

Type Constraints
TElementEndpoint :IElementEndpoint 
TElementEndpoint :endpoint 
TElementEndpoint :id 
TElementEndpoint :DeleteAsync 
TElementEndpoint :cancellationToken 

◆ DeleteAsync< TEntity, TElementEndpoint >()

static Task TypedRest.Endpoints.Generic.CollectionEndpointExtensions.DeleteAsync< TEntity, TElementEndpoint > ( this ICollectionEndpoint< TEntity, TElementEndpoint >  endpoint,
TEntity  element,
CancellationToken  cancellationToken = default 
)
static

Deletes an existing element from the collection.

Template Parameters
TEntityThe type of individual elements in the collection.
TElementEndpointThe type of IEndpoint to provide for individual TEntity s.
Parameters
endpointThe collection endpoint containing the element.
elementThe element to be deleted.
cancellationTokenUsed to cancel the request.
Exceptions
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
KeyNotFoundExceptionHttpStatusCode.NotFound or HttpStatusCode.Gone
HttpRequestExceptionOther non-success status code.

This is a convenience method equivalent to combining ICollectionEndpoint<TEntity,TElementEndpoint>.this[TEntity] with IElementEndpoint.DeleteAsync.

Type Constraints
TEntity :class 
TElementEndpoint :IElementEndpoint<TEntity> 
TElementEndpoint :endpoint 
TElementEndpoint :element 
TElementEndpoint :DeleteAsync 
TElementEndpoint :cancellationToken 

◆ MergeAsync< TEntity, TElementEndpoint >()

static Task< TEntity?> TypedRest.Endpoints.Generic.CollectionEndpointExtensions.MergeAsync< TEntity, TElementEndpoint > ( this ICollectionEndpoint< TEntity, TElementEndpoint >  endpoint,
TEntity  element,
CancellationToken  cancellationToken = default 
)
static

Modifies an existing element in the collection by merging changes on the server-side.

Template Parameters
TEntityThe type of individual elements in the collection.
TElementEndpointThe type of IEndpoint to provide for individual TEntity s.
Parameters
endpointThe collection endpoint containing the element.
elementThe TEntity data to merge with the existing element.
cancellationTokenUsed to cancel the request.
Returns
The TEntity as returned by the server, possibly with additional fields set. null if the server does not respond with a result entity.
Exceptions
InvalidDataExceptionHttpStatusCode.BadRequest
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
KeyNotFoundExceptionHttpStatusCode.NotFound or HttpStatusCode.Gone
HttpRequestExceptionOther non-success status code.

This is a convenience method equivalent to combining ICollectionEndpoint<TEntity,TElementEndpoint>.this[TEntity] with IElementEndpoint<TEntity>.SetAsync.

Type Constraints
TEntity :class 
TElementEndpoint :IElementEndpoint<TEntity> 
TElementEndpoint :endpoint 
TElementEndpoint :element 
TElementEndpoint :MergeAsync 
TElementEndpoint :element 
TElementEndpoint :cancellationToken 

◆ SetAsync< TEntity, TElementEndpoint >()

static Task< TEntity?> TypedRest.Endpoints.Generic.CollectionEndpointExtensions.SetAsync< TEntity, TElementEndpoint > ( this ICollectionEndpoint< TEntity, TElementEndpoint >  endpoint,
TEntity  element,
CancellationToken  cancellationToken = default 
)
static

Sets/replaces an existing element in the collection.

Template Parameters
TEntityThe type of individual elements in the collection.
TElementEndpointThe type of IEndpoint to provide for individual TEntity s.
Parameters
endpointThe collection endpoint containing the element.
elementThe new state of the element.
cancellationTokenUsed to cancel the request.
Returns
The TEntity as returned by the server, possibly with additional fields set. null if the server does not respond with a result entity.
Exceptions
InvalidDataExceptionHttpStatusCode.BadRequest
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
KeyNotFoundExceptionHttpStatusCode.NotFound or HttpStatusCode.Gone
HttpRequestExceptionOther non-success status code.

This is a convenience method equivalent to combining ICollectionEndpoint<TEntity,TElementEndpoint>.this[TEntity] with IElementEndpoint<TEntity>.SetAsync.

Type Constraints
TEntity :class 
TElementEndpoint :IElementEndpoint<TEntity> 
TElementEndpoint :endpoint 
TElementEndpoint :element 
TElementEndpoint :SetAsync 
TElementEndpoint :element 
TElementEndpoint :cancellationToken 

The documentation for this class was generated from the following file: