TypedRest for .NET 1.3.6
build type-safe fluent-style REST API clients
TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint > Interface Template Reference

Endpoint for a collection of TEntity s addressable as TElementEndpoint s. More...

Inheritance diagram for TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >:
TypedRest.Endpoints.Generic.IIndexerEndpoint< TElementEndpoint >

Public Member Functions

Task< List< TEntity > > ReadAllAsync (CancellationToken cancellationToken=default)
 Returns all TEntity s in the collection. More...
 
Task< PartialResponse< TEntity > > ReadRangeAsync (RangeItemHeaderValue range, CancellationToken cancellationToken=default)
 Returns all TEntity s within a specific range of the collection. More...
 
ITask< TElementEndpoint?> CreateAsync (TEntity entity, CancellationToken cancellationToken=default)
 Adds a TEntity as a new element to the collection. More...
 
Task CreateAllAsync (IEnumerable< TEntity > entities, CancellationToken cancellationToken=default)
 Adds (or updates) multiple TEntity s as elements in the collection. More...
 
Task SetAllAsync (IEnumerable< TEntity > entities, CancellationToken cancellationToken=default)
 Replaces the entire content of the collection with new TEntity s. More...
 

Properties

TElementEndpoint this[TEntity entity] [get]
 Returns an ElementEndpoint<TEntity> for a specific child element. More...
 
bool? ReadAllAllowed [get]
 Shows whether the server has indicated that ReadAllAsync is currently allowed. More...
 
bool? ReadRangeAllowed [get]
 Shows whether the server has indicated that ReadRangeAsync is allowed. More...
 
bool? CreateAllowed [get]
 Shows whether the server has indicated that CreateAsync(TEntity,CancellationToken) is currently allowed. More...
 
bool? CreateAllAllowed [get]
 Shows whether the server has indicated that CreateAllAllowed is currently allowed. More...
 
bool? SetAllAllowed [get]
 Shows whether the server has indicated that SetAllAllowed is currently allowed. More...
 
- Properties inherited from TypedRest.Endpoints.Generic.IIndexerEndpoint< TElementEndpoint >
TElementEndpoint this[string id] [get]
 Returns a TElementEndpoint for a specific child element. More...
 

Detailed Description

Endpoint for a collection of TEntity s addressable as TElementEndpoint s.

Use the more constrained ICollectionEndpoint<TEntity> when possible.

Template Parameters
TEntityThe type of individual elements in the collection.
TElementEndpointThe type of IElementEndpoint<TEntity> to provide for individual TEntity s.
Type Constraints
TEntity :class 
TElementEndpoint :IElementEndpoint<TEntity> 

Member Function Documentation

◆ CreateAllAsync()

Task TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.CreateAllAsync ( IEnumerable< TEntity >  entities,
CancellationToken  cancellationToken = default 
)

Adds (or updates) multiple TEntity s as elements in the collection.

Parameters
entitiesThe TEntity s to create or modify.
cancellationTokenUsed to cancel the request.
Exceptions
InvalidDataExceptionHttpStatusCode.BadRequest
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
InvalidOperationExceptionHttpStatusCode.Conflict
HttpRequestExceptionOther non-success status code.

Uses a link with the relation type bulk to determine the URI to POST to. Defaults to the relative URI bulk.

◆ CreateAsync()

ITask< TElementEndpoint?> TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.CreateAsync ( TEntity  entity,
CancellationToken  cancellationToken = default 
)

Adds a TEntity as a new element to the collection.

Parameters
entityThe new TEntity .
cancellationTokenUsed to cancel the request.
Returns
An endpoint for the newly created entity; null if the server returned neither a "Location" header nor an entity with an ID in the response body.
Exceptions
InvalidDataExceptionHttpStatusCode.BadRequest
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
InvalidOperationExceptionHttpStatusCode.Conflict
HttpRequestExceptionOther non-success status code.

◆ ReadAllAsync()

Task< List< TEntity > > TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.ReadAllAsync ( CancellationToken  cancellationToken = default)

Returns all TEntity s in the collection.

Parameters
cancellationTokenUsed to cancel the request.
Exceptions
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
KeyNotFoundExceptionHttpStatusCode.NotFound or HttpStatusCode.Gone
HttpRequestExceptionOther non-success status code.

◆ ReadRangeAsync()

Task< PartialResponse< TEntity > > TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.ReadRangeAsync ( RangeItemHeaderValue  range,
CancellationToken  cancellationToken = default 
)

Returns all TEntity s within a specific range of the collection.

Parameters
rangeThe range of entities to retrieve.
cancellationTokenUsed to cancel the request.
Returns
A subset of the entities and the range they come from. May not exactly match the request range .
Exceptions
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
KeyNotFoundExceptionHttpStatusCode.NotFound or HttpStatusCode.Gone
InvalidOperationExceptionThe requested range is not satisfiable.
HttpRequestExceptionOther non-success status code.

◆ SetAllAsync()

Task TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.SetAllAsync ( IEnumerable< TEntity >  entities,
CancellationToken  cancellationToken = default 
)

Replaces the entire content of the collection with new TEntity s.

Parameters
entitiesThe new set of TEntity s the collection shall contain.
cancellationTokenUsed to cancel the request.
Exceptions
InvalidDataExceptionHttpStatusCode.BadRequest
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
InvalidOperationExceptionThe entities have changed since they were last retrieved with ICollectionEndpoint<TEntity,TElementEndpoint>.ReadAllAsync. Your changes were rejected to prevent a lost update.
HttpRequestExceptionOther non-success status code.

Property Documentation

◆ CreateAllAllowed

bool? TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.CreateAllAllowed
get

Shows whether the server has indicated that CreateAllAllowed is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the verb is allowed. If no request has been sent yet or the server did not specify allowed verbs null is returned.

◆ CreateAllowed

bool? TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.CreateAllowed
get

Shows whether the server has indicated that CreateAsync(TEntity,CancellationToken) is currently allowed.

Uses cached data from last response.

Returns
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.

◆ ReadAllAllowed

bool? TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.ReadAllAllowed
get

Shows whether the server has indicated that ReadAllAsync is currently allowed.

Uses cached data from last response.

Returns
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.

◆ ReadRangeAllowed

bool? TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.ReadRangeAllowed
get

Shows whether the server has indicated that ReadRangeAsync is allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet.

◆ SetAllAllowed

bool? TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.SetAllAllowed
get

Shows whether the server has indicated that SetAllAllowed is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the verb is allowed. If no request has been sent yet or the server did not specify allowed verbs null is returned.

◆ this[TEntity entity]

TElementEndpoint TypedRest.Endpoints.Generic.ICollectionEndpoint< TEntity, out out TElementEndpoint >.this[TEntity entity]
get

Returns an ElementEndpoint<TEntity> for a specific child element.

Parameters
entityAn existing entity to extract the ID from.

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