public ZoneCollectionFacts()
 {
     _zonesEndpoint = Client.Servers["localhost"].Zones;
 }
Example #2
0
 /// <summary>
 /// Modifies an existing element in the collection by merging changes.
 /// </summary>
 /// <typeparam name="TEntity">The type of individual elements in the collection.</typeparam>
 /// <typeparam name="TElementEndpoint">The type of <see cref="IEndpoint"/> to provide for individual <typeparamref name="TEntity"/>s.</typeparam>
 /// <param name="endpoint">The collection endpoint containing the element.</param>
 /// <param name="element">The <typeparamref name="TEntity"/> data to merge with the existing element.</param>
 /// <param name="cancellationToken">Used to cancel the request.</param>
 /// <returns>The <typeparamref name="TEntity"/> as returned by the server, possibly with additional fields set. <c>null</c> if the server does not respond with a result entity.</returns>
 /// <exception cref="InvalidDataException"><see cref="HttpStatusCode.BadRequest"/></exception>
 /// <exception cref="AuthenticationException"><see cref="HttpStatusCode.Unauthorized"/></exception>
 /// <exception cref="UnauthorizedAccessException"><see cref="HttpStatusCode.Forbidden"/></exception>
 /// <exception cref="KeyNotFoundException"><see cref="HttpStatusCode.NotFound"/> or <see cref="HttpStatusCode.Gone"/></exception>
 /// <exception cref="InvalidOperationException">The entity has changed since it was last retrieved with <see cref="IElementEndpoint{TEntity}.ReadAsync"/>. Your changes were rejected to prevent a lost update.</exception>
 /// <exception cref="HttpRequestException">Other non-success status code.</exception>
 /// <remarks>This is a convenience method equivalent to combining <see cref="ICollectionEndpoint{TEntity,TElementEndpoint}.this[TEntity]"/> with <see cref="IElementEndpoint{TEntity}.SetAsync"/>.</remarks>
 public static Task <TEntity> MergeAsync <TEntity, TElementEndpoint>(this ICollectionEndpoint <TEntity, TElementEndpoint> endpoint, TEntity element, CancellationToken cancellationToken = default)
     where TElementEndpoint : class, IElementEndpoint <TEntity> => endpoint[element].MergeAsync(element, cancellationToken);
 /// <summary>
 /// Creates a new REST collection command.
 /// </summary>
 /// <param name="endpoint">The endpoint this command operates on.</param>
 public CollectionCommand(ICollectionEndpoint <TEntity, TElementEndpoint> endpoint)
     : base(endpoint)
 {
 }
Example #4
0
 /// <summary>
 /// Determines whether the collection contains a specific element.
 /// </summary>
 /// <typeparam name="TEntity">The type of individual elements in the collection.</typeparam>
 /// <typeparam name="TElementEndpoint">The type of <see cref="IEndpoint"/> to provide for individual <typeparamref name="TEntity"/>s.</typeparam>
 /// <param name="endpoint">The collection endpoint containing the element.</param>
 /// <param name="element">The element to be checked.</param>
 /// <param name="cancellationToken">Used to cancel the request.</param>
 /// <exception cref="AuthenticationException"><see cref="HttpStatusCode.Unauthorized"/></exception>
 /// <exception cref="UnauthorizedAccessException"><see cref="HttpStatusCode.Forbidden"/></exception>
 /// <exception cref="HttpRequestException">Other non-success status code.</exception>
 /// <remarks>This is a convenience method equivalent to combining <see cref="ICollectionEndpoint{TEntity,TElementEndpoint}.this[TEntity]"/> with <see cref="IElementEndpoint.ExistsAsync"/>.</remarks>
 public static Task <bool> ContainsAsync <TEntity, TElementEndpoint>(this ICollectionEndpoint <TEntity, TElementEndpoint> endpoint, TEntity element, CancellationToken cancellationToken = default)
     where TElementEndpoint : class, IElementEndpoint => endpoint[element].ExistsAsync(cancellationToken);