First Initial
This commit is contained in:
93
Services/WebAPIClient/IWebAPIClient.cs
Normal file
93
Services/WebAPIClient/IWebAPIClient.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace STAFF_API.Services
|
||||
{
|
||||
public interface IWebAPIClient
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Specify base address to use on http client
|
||||
/// </summary>
|
||||
string BaseAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Access token to call web api
|
||||
/// </summary>
|
||||
string AccessToken { get; set; }
|
||||
|
||||
Dictionary<string, string> Headers { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
/// <summary>
|
||||
/// Call web api with HTTP GET method
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="actionPart">The part of the web api serevice.
|
||||
/// For example: BookingPromotion/GetPromotion?promotionId=49
|
||||
/// </param>
|
||||
/// <returns>Return as generic class</returns>
|
||||
Task<T> GetAsync<T>(string actionPart);
|
||||
|
||||
/// <summary>
|
||||
/// Call web api with HTTP POST method
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="actionPart">The part of the web api serevice.
|
||||
/// For example: BookingPromotion/AddNewGeneralPromotion
|
||||
/// </param>
|
||||
/// <param name="inputModel">Input to call web api</param>
|
||||
/// <returns>Return as generic class</returns>
|
||||
Task<T> PostAsync<T>(string actionPart, object inputModel);
|
||||
|
||||
/// <summary>
|
||||
/// Call web api with HTTP POST method with file uploading
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="actionPart">The part of the web api serevice.
|
||||
/// For example: BookingPromotion/AddNewGeneralPromotion
|
||||
///</param>
|
||||
/// <param name="formData">Multipart Form Data Content</param>
|
||||
/// <returns>Return as generic class</returns>
|
||||
Task<T> PostFileAsync<T>(string actionPart, MultipartFormDataContent formData);
|
||||
|
||||
/// <summary>
|
||||
/// Call web api with HTTP POST method with file uploading
|
||||
/// </summary>
|
||||
/// <param name="actionPart">The part of the web api serevice.
|
||||
/// For example: BookingPromotion/AddNewGeneralPromotion
|
||||
///</param>
|
||||
/// <param name="inputModel">Input to call web api</param>
|
||||
/// <param name="returnPhysicalFilePath">Expected file downloaded path</param>
|
||||
/// <returns>Return file download path</returns>
|
||||
Task<string> PostDownloadAsync(string actionPart, object inputModel, string returnPhysicalFilePath);
|
||||
|
||||
/// <summary>
|
||||
/// Call web api with HTTP Put method
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="actionPart">The part of the web api serevice.
|
||||
/// For example: BookingPromotion/UpdateGeneralPromotion?promotionId=49
|
||||
/// </param>
|
||||
/// <param name="inputModel">Input to call web api</param>
|
||||
/// <returns>Return as generic class</returns>
|
||||
Task<T> PutAsync<T>(string actionPart, object inputModel);
|
||||
|
||||
/// <summary>
|
||||
/// Call web api with HTTP Delete method
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="actionPart">The part of the web api serevice.
|
||||
/// For example: BookingPromotion/DeleteGeneralPromotion?promotionId=49
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<T> DeleteAsync<T>(string actionPart);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user