Ejemplo n.º 1
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <LinkModel> RegisterLinkAsync(this IAffiliateAPI operations, RegisterLinkModel model = default(RegisterLinkModel), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RegisterLinkWithHttpMessagesAsync(model, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 2
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='clientId'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <LinkModel> > GetLinksAsync(this IAffiliateAPI operations, string clientId = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetLinksWithHttpMessagesAsync(clientId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 3
0
 /// <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 IAffiliateAPI operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.IsAliveWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 4
0
        public AffiliateClient(string serviceUrl)
        {
            if (string.IsNullOrWhiteSpace(serviceUrl))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(serviceUrl));
            }

            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <ClientAutomapperProfile>();
            });

            _mapper = config.CreateMapper();

            _affiliateApi = new AffiliateAPI(new Uri(serviceUrl));
        }
Ejemplo n.º 5
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 public static LinkModel RegisterLink(this IAffiliateAPI operations, RegisterLinkModel model = default(RegisterLinkModel))
 {
     return(operations.RegisterLinkAsync(model).GetAwaiter().GetResult());
 }
Ejemplo n.º 6
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='clientId'>
 /// </param>
 public static IList <LinkModel> GetLinks(this IAffiliateAPI operations, string clientId = default(string))
 {
     return(operations.GetLinksAsync(clientId).GetAwaiter().GetResult());
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Checks service is alive
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static object IsAlive(this IAffiliateAPI operations)
 {
     return(operations.IsAliveAsync().GetAwaiter().GetResult());
 }