/// <summary> /// This is the default constructor. /// </summary> public ApiProviderAsyncV2(Uri rootUri , IKeyMapper <K> keyMapper = null , TransportSerializer <E> primaryTransport = null , IEnumerable <IApiProviderAuthBase> authHandlers = null , bool useDefaultJsonSerializer = true) : this(keyMapper, primaryTransport, authHandlers, useDefaultJsonSerializer) { if (rootUri == null) { throw new ArgumentNullException("You must set rootUri for the API"); } mUriMapper = CreateUriMapper(rootUri); }
/// <summary> /// This is the default constructor. /// </summary> public ApiProviderAsyncV2(TransportUriMapper <K> uriMapper = null , IKeyMapper <K> keyMapper = null , TransportSerializer <E> primaryTransport = null , IEnumerable <IApiProviderAuthBase> authHandlers = null , bool useDefaultJsonSerializer = true) : this(keyMapper, primaryTransport, authHandlers, useDefaultJsonSerializer) { if (uriMapper == null) { throw new ArgumentNullException("You must set uriMapper"); } mUriMapper = uriMapper; }
/// <summary> /// This is the default constructor. /// </summary> public ApiProviderAsyncBase(TransportUriMapper <K> uriMapper = null , bool useHttps = true, string entityName = null , IKeyMapper <K> keyMapper = null , TransportSerializer <E> primaryTransport = null) { // Get the types assembly version to add to the request headers mAssemblyVersion = GetType().Assembly.GetName().Version.ToString(); mKeyMapper = keyMapper ?? ResolveKeyMapper(); mUriMapper = uriMapper ?? ResolveUriMapper(uriMapper, entityName); if (entityName != null) { EntityName = entityName; } mPrimaryTransport = primaryTransport ?? ResolveSerializer(); UseHttps = useHttps; }
/// <summary> /// This method resolves the appropriate transport uri mapper for the request. /// </summary> /// <param name="uriMapper">The mapper passed through the constructor.</param> protected virtual TransportUriMapper <K> ResolveUriMapper(TransportUriMapper <K> uriMapper, string entityName) { return(new TransportUriMapper <K>(mKeyMapper)); }