Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions MADE.App.Networking/INetworkRequestManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="INetworkRequestManager.cs" company="MADE Apps">
// Copyright (c) MADE Apps.
// </copyright>
// <summary>
// Defines an interface for a network request manager.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace MADE.App.Networking
{
using System;
using System.Collections.Concurrent;

using MADE.App.Networking.Requests;

/// <summary>
/// Defines an interface for a network request manager.
/// </summary>
public interface INetworkRequestManager
{
/// <summary>
/// Gets the current queue of network requests.
/// </summary>
ConcurrentDictionary<string, NetworkRequestCallback> CurrentQueue { get; }

/// <summary>
/// Starts the manager processing the queue of network requests at a default time period of 1 minute.
/// </summary>
void Start();

/// <summary>
/// Starts the manager processing the queue of network requests.
/// </summary>
/// <param name="processPeriod">
/// The time period between each process of the queue.
/// </param>
void Start(TimeSpan processPeriod);

/// <summary>
/// Stops the processing of the network manager queues.
/// </summary>
void Stop();

/// <summary>
/// Adds or updates a network request in the queue.
/// </summary>
/// <typeparam name="TRequest">
/// The type of network request.
/// </typeparam>
/// <typeparam name="TResponse">
/// The expected response type.
/// </typeparam>
/// <param name="request">
/// The network request to execute.
/// </param>
/// <param name="successCallback">
/// The action to execute when receiving a successful response.
/// </param>
void AddOrUpdate<TRequest, TResponse>(TRequest request, Action<TResponse> successCallback)
where TRequest : NetworkRequest;

/// <summary>
/// Adds or updates a network request in the queue.
/// </summary>
/// <typeparam name="TRequest">
/// The type of network request.
/// </typeparam>
/// <typeparam name="TResponse">
/// The expected response type.
/// </typeparam>
/// <typeparam name="TErrorResponse">
/// The expected error response type.
/// </typeparam>
/// <param name="request">
/// The network request to execute.
/// </param>
/// <param name="successCallback">
/// The action to execute when receiving a successful response.
/// </param>
/// <param name="errorCallback">
/// The action to execute when receiving an error response.
/// </param>
void AddOrUpdate<TRequest, TResponse, TErrorResponse>(
TRequest request,
Action<TResponse> successCallback,
Action<TErrorResponse> errorCallback)
where TRequest : NetworkRequest;

/// <summary>
/// Processes the current queue of network requests.
/// </summary>
void ProcessCurrentQueue();
}
}
70 changes: 70 additions & 0 deletions MADE.App.Networking/MADE.App.Networking.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;uap10.0.16299</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netstandard2.0\MADE.App.Networking.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netstandard2.0\MADE.App.Networking.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<Compile Remove="api\**" />
<Compile Remove="articles\**" />
<Compile Remove="_site\**" />
<EmbeddedResource Remove="api\**" />
<EmbeddedResource Remove="articles\**" />
<EmbeddedResource Remove="_site\**" />
<None Remove="api\**" />
<None Remove="articles\**" />
<None Remove="_site\**" />
</ItemGroup>

<PropertyGroup>
<LogFile>Docfx-$(TargetFramework).log</LogFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>1.0.0.0</Version>
<Authors>MADE Apps</Authors>
<Company>MADE Apps</Company>
<Product>MADE App Networking Library</Product>
<Description>Making App Development Easier with a collection of easy to use APIs for working with networking requests for .NET projects across Windows, Android, and iOS.</Description>
<Copyright>Copyright (C) MADE Apps. All rights reserved.</Copyright>
<PackageLicenseUrl>https://github.com/MADE-Apps/MADE-App-Components/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/MADE-Apps/MADE-App-Components</PackageProjectUrl>
<RepositoryUrl>https://github.com/MADE-Apps/MADE-App-Components</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIconUrl>https://pbs.twimg.com/profile_images/927154020422160385/6HSRU36P_400x400.jpg</PackageIconUrl>
<PackageTags>MADE App Development View Networking HttpClient Windows Android iOS Xamarin</PackageTags>
</PropertyGroup>

<ItemGroup>
<None Remove=".gitignore" />
<None Remove="docfx.json" />
<None Remove="index.md" />
<None Remove="log.txt" />
<None Remove="toc.yml" />
<None Remove="Docfx-*.log" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="docfx.console" Version="2.36.0" PrivateAssets="All" />
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.5.4" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'uap10.0.16299' ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MADE.App\MADE.App.csproj" />
</ItemGroup>

<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />

</Project>
Loading