Interface ICollectionEndpoint<TEntity, TElementEndpoint>
Endpoint for a collection of TEntitys addressable as TElementEndpoints.
public interface ICollectionEndpoint<TEntity, out TElementEndpoint> : IIndexerEndpoint<TElementEndpoint>, IEndpoint where TEntity : class where TElementEndpoint : IElementEndpoint<TEntity>
Type Parameters
TEntityThe type of individual elements in the collection.
TElementEndpointThe type of IElementEndpoint<TEntity> to provide for individual
TEntitys.
- Inherited Members
- Extension Methods
Remarks
Use the more constrained ICollectionEndpoint<TEntity> when possible.
Properties
CreateAllAllowed
Indicates whether the server has specified CreateAllAllowed is currently allowed.
bool? CreateAllAllowed { get; }
Property Value
- bool?
An indicator whether the verb is allowed. If no request has been sent yet or the server did not specify allowed verbs
nullis returned.
Remarks
Uses cached data from last response.
CreateAllowed
Indicates whether the server has specified CreateAsync(TEntity, CancellationToken) is currently allowed.
bool? CreateAllowed { get; }
Property Value
- bool?
trueif the method is allowed,falseif the method is not allowed,nullIf no request has been sent yet or the server did not specify allowed methods.
Remarks
Uses cached data from last response.
this[TEntity]
Returns an ElementEndpoint<TEntity> for a specific child element.
TElementEndpoint this[TEntity entity] { get; }
Parameters
entityTEntityAn existing entity to extract the ID from.
Property Value
- TElementEndpoint
ReadAllAllowed
Indicates whether the server has specified ReadAllAsync(CancellationToken) is currently allowed.
bool? ReadAllAllowed { get; }
Property Value
- bool?
trueif the method is allowed,falseif the method is not allowed,nullIf no request has been sent yet or the server did not specify allowed methods.
Remarks
Uses cached data from last response.
ReadRangeAllowed
Indicates whether the server has specified ReadRangeAsync(RangeItemHeaderValue, CancellationToken) is allowed.
bool? ReadRangeAllowed { get; }
Property Value
- bool?
An indicator whether the method is allowed. If no request has been sent yet.
Remarks
Uses cached data from last response.
SetAllAllowed
Indicates whether the server has specified SetAllAllowed is currently allowed.
bool? SetAllAllowed { get; }
Property Value
- bool?
An indicator whether the verb is allowed. If no request has been sent yet or the server did not specify allowed verbs
nullis returned.
Remarks
Uses cached data from last response.
Methods
CreateAllAsync(IEnumerable<TEntity>, CancellationToken)
Adds (or updates) multiple entities as elements in the collection.
Task CreateAllAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default)
Parameters
entitiesIEnumerable<TEntity>The entities to create or modify.
cancellationTokenCancellationTokenUsed to cancel the request.
Returns
Remarks
Uses a link with the relation type bulk to determine the URI to POST to. Defaults to the relative URI bulk.
Exceptions
- InvalidDataException
- AuthenticationException
- UnauthorizedAccessException
- InvalidOperationException
- HttpRequestException
Other non-success status code.
CreateAsync(TEntity, CancellationToken)
Adds a entity as a new element to the collection.
ITask<out TElementEndpoint?> CreateAsync(TEntity entity, CancellationToken cancellationToken = default)
Parameters
entityTEntityThe new entity.
cancellationTokenCancellationTokenUsed to cancel the request.
Returns
- ITask<TElementEndpoint>
An endpoint for the newly created entity;
nullif the server returned neither a "Location" header nor an entity with an ID in the response body.
Exceptions
- InvalidDataException
- AuthenticationException
- UnauthorizedAccessException
- InvalidOperationException
- HttpRequestException
Other non-success status code.
ReadAllAsync(CancellationToken)
Returns all entities in the collection.
Task<List<TEntity>> ReadAllAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenUsed to cancel the request.
Returns
Exceptions
- AuthenticationException
- UnauthorizedAccessException
- KeyNotFoundException
- HttpRequestException
Other non-success status code.
ReadRangeAsync(RangeItemHeaderValue, CancellationToken)
Returns all entities within a specific range of the collection.
Task<PartialResponse<TEntity>> ReadRangeAsync(RangeItemHeaderValue range, CancellationToken cancellationToken = default)
Parameters
rangeRangeItemHeaderValueThe range of entities to retrieve.
cancellationTokenCancellationTokenUsed to cancel the request.
Returns
- Task<PartialResponse<TEntity>>
A subset of the entities and the range they come from. May not exactly match the request
range.
Exceptions
- AuthenticationException
- UnauthorizedAccessException
- KeyNotFoundException
- InvalidOperationException
The requested range is not satisfiable.
- HttpRequestException
Other non-success status code.
SetAllAsync(IEnumerable<TEntity>, CancellationToken)
Replaces the entire content of the collection with new entities.
Task SetAllAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default)
Parameters
entitiesIEnumerable<TEntity>The new set of entities the collection shall contain.
cancellationTokenCancellationTokenUsed to cancel the request.
Returns
Exceptions
- InvalidDataException
- AuthenticationException
- UnauthorizedAccessException
- InvalidOperationException
The entities have changed since they were last retrieved with ReadAllAsync(CancellationToken). Your changes were rejected to prevent a lost update.
- HttpRequestException
Other non-success status code.