/// <summary>
 /// Get pledge for provided client.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='clientId'>
 /// Id of the client we wanna get pledge for.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <GetPledgeResponse> GetPledgeAsync(this IPledgesAPI operations, string clientId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetPledgeWithHttpMessagesAsync(clientId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Checks service is alive
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> IsAliveAsync(this IPledgesAPI operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.IsAliveWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Пример #3
0
 public PledgesController(ILog log,
                          IPledgesClient pledgesClient,
                          IRequestContext requestContext,
                          IPledgesAPI pledgesApi)
 {
     _log            = log ?? throw new ArgumentException(nameof(log));
     _pledgesClient  = pledgesClient ?? throw new ArgumentException(nameof(pledgesClient));
     _requestContext = requestContext ?? throw new ArgumentNullException(nameof(requestContext));
     _pledgesApi     = pledgesApi ?? throw new ArgumentNullException(nameof(pledgesApi));
 }
 /// <summary>
 /// Create a new pledge.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='request'>
 /// </param>
 public static void CreatePledge(this IPledgesAPI operations, CreatePledgeRequest request = default(CreatePledgeRequest))
 {
     operations.CreatePledgeAsync(request).GetAwaiter().GetResult();
 }
 /// <summary>
 /// Update pledge details.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='request'>
 /// Pledge values we wanna change.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task UpdatePledgeAsync(this IPledgesAPI operations, UpdatePledgeRequest request = default(UpdatePledgeRequest), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.UpdatePledgeWithHttpMessagesAsync(request, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
 /// <summary>
 /// Checks service is alive
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static object IsAlive(this IPledgesAPI operations)
 {
     return(operations.IsAliveAsync().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Delete pledge
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='clientId'>
 /// Id of the pledge we wanna delete.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeletePledgeAsync(this IPledgesAPI operations, string clientId, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeletePledgeWithHttpMessagesAsync(clientId, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
 /// <summary>
 /// Delete pledge
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='clientId'>
 /// Id of the pledge we wanna delete.
 /// </param>
 public static void DeletePledge(this IPledgesAPI operations, string clientId)
 {
     operations.DeletePledgeAsync(clientId).GetAwaiter().GetResult();
 }
 /// <summary>
 /// Get pledge for provided client.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='clientId'>
 /// Id of the client we wanna get pledge for.
 /// </param>
 public static GetPledgeResponse GetPledge(this IPledgesAPI operations, string clientId)
 {
     return(operations.GetPledgeAsync(clientId).GetAwaiter().GetResult());
 }