/// <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); } }
/// <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); } }
/// <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); } }
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)); }
/// <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()); }
/// <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()); }
/// <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()); }