2021-05-13 20:03:07 +02:00
|
|
|
|
using System;
|
2021-08-01 17:24:15 +02:00
|
|
|
|
using System.Collections.Generic;
|
2021-05-13 20:03:07 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2021-06-26 20:57:55 +02:00
|
|
|
|
using TINK.Model.Device;
|
|
|
|
|
using TINK.Repository.Request;
|
2021-05-13 20:03:07 +02:00
|
|
|
|
using TINK.Repository.Response;
|
|
|
|
|
|
2021-06-26 20:57:55 +02:00
|
|
|
|
namespace TINK.Repository
|
2021-05-13 20:03:07 +02:00
|
|
|
|
{
|
|
|
|
|
/// <summary> Interface to communicate with copri server.</summary>
|
|
|
|
|
public interface ICopriServerBase
|
|
|
|
|
{
|
|
|
|
|
/// <summary> Logs user in. </summary>
|
|
|
|
|
/// <param name="mailAddress">Mailaddress of user to log in.</param>
|
|
|
|
|
/// <param name="password">Password to log in.</param>
|
|
|
|
|
/// <param name="deviceId">Id specifying user and hardware.</param>
|
|
|
|
|
/// <remarks>Response which holds auth cookie <see cref="ResponseBase.authcookie"/></remarks>
|
|
|
|
|
Task<AuthorizationResponse> DoAuthorizationAsync(
|
|
|
|
|
string mailAddress,
|
|
|
|
|
string password,
|
|
|
|
|
string deviceId);
|
|
|
|
|
|
|
|
|
|
/// <summary> Logs user out. </summary>
|
|
|
|
|
/// <remarks>Response which holds auth cookie <see cref="ResponseBase.authcookie"/></remarks>
|
|
|
|
|
Task<AuthorizationoutResponse> DoAuthoutAsync();
|
|
|
|
|
|
|
|
|
|
/// <summary> Reserves bike. </summary>
|
|
|
|
|
/// <param name="bikeId">Id of the bike to reserve.</param>
|
|
|
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
|
|
|
/// <returns>Response on reserving request.</returns>
|
|
|
|
|
Task<ReservationBookingResponse> DoReserveAsync(
|
2021-06-26 20:57:55 +02:00
|
|
|
|
string bikeId,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
Uri operatorUri);
|
|
|
|
|
|
|
|
|
|
/// <summary> Cancels reservation of bik. </summary>
|
|
|
|
|
/// <param name="bikeId">Id of the bike to reserve.</param>
|
|
|
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
|
|
|
/// <returns>Response on cancel reservation request.</returns>
|
|
|
|
|
Task<ReservationCancelReturnResponse> DoCancelReservationAsync(
|
2021-06-26 20:57:55 +02:00
|
|
|
|
string bikeId,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
Uri operatorUri);
|
|
|
|
|
|
|
|
|
|
/// <summary> Get authentication keys. </summary>
|
|
|
|
|
/// <param name="bikeId">Id of the bike to get keys for.</param>
|
|
|
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
|
|
|
/// <returns>Response holding authentication keys.</returns>
|
|
|
|
|
Task<ReservationBookingResponse> CalculateAuthKeysAsync(
|
2021-06-26 20:57:55 +02:00
|
|
|
|
string bikeId,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
Uri operatorUri);
|
|
|
|
|
|
|
|
|
|
/// <summary> Updates COPRI lock state for a booked bike. </summary>
|
|
|
|
|
/// <param name="bikeId">Id of the bike to update locking state for.</param>
|
|
|
|
|
/// <param name="location">Geolocation of lock.</param>
|
|
|
|
|
/// <param name="state">New locking state.</param>
|
|
|
|
|
/// <param name="batteryPercentage">Holds the filling level percentage of the battery.</param>
|
|
|
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
|
|
|
/// <returns>Response on updating locking state.</returns>
|
|
|
|
|
Task<ReservationBookingResponse> UpdateLockingStateAsync(
|
2021-06-26 20:57:55 +02:00
|
|
|
|
string bikeId,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
LocationDto location,
|
|
|
|
|
lock_state state,
|
|
|
|
|
double batteryPercentage,
|
|
|
|
|
Uri operatorUri);
|
|
|
|
|
|
|
|
|
|
/// <summary> Books a bike. </summary>
|
|
|
|
|
/// <param name="bikeId">Id of the bike to book.</param>
|
|
|
|
|
/// <param name="guid">Used to publish GUID from app to copri. Used for initial setup of bike in copri.</param>
|
|
|
|
|
/// <param name="batteryPercentage">Holds the filling level percentage of the battery.</param>
|
|
|
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
|
|
|
/// <returns>Response on booking request.</returns>
|
|
|
|
|
Task<ReservationBookingResponse> DoBookAsync(
|
2021-06-26 20:57:55 +02:00
|
|
|
|
string bikeId,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
Guid guid,
|
|
|
|
|
double batteryPercentage,
|
|
|
|
|
Uri operatorUri);
|
|
|
|
|
|
|
|
|
|
/// <summary> Returns a bike. </summary>
|
|
|
|
|
/// <param name="bikeId">Id of the bike to return.</param>
|
|
|
|
|
/// <param name="location">Geolocation of lock.</param>
|
2021-06-26 20:57:55 +02:00
|
|
|
|
/// <param name="smartDevice">Provides info about hard and software.</param>
|
2021-05-13 20:03:07 +02:00
|
|
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
|
|
|
/// <returns>Response on returning request.</returns>
|
2021-12-08 17:57:30 +01:00
|
|
|
|
Task<DoReturnResponse> DoReturn(
|
2021-06-26 20:57:55 +02:00
|
|
|
|
string bikeId,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
LocationDto location,
|
2021-06-26 20:57:55 +02:00
|
|
|
|
ISmartDevice smartDevice,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
Uri operatorUri);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Submits feedback to copri server.
|
|
|
|
|
/// </summary>
|
2021-06-26 20:57:55 +02:00
|
|
|
|
/// <param name="bikeId">Id of the bike to submit feedback for.</param>
|
2021-05-13 20:03:07 +02:00
|
|
|
|
/// <param name="isBikeBroken">True if bike is broken.</param>
|
|
|
|
|
/// <param name="message">General purpose message or error description.</param>
|
|
|
|
|
Task<SubmitFeedbackResponse> DoSubmitFeedback(
|
2021-06-26 20:57:55 +02:00
|
|
|
|
string bikeId,
|
2021-05-13 20:03:07 +02:00
|
|
|
|
string message,
|
|
|
|
|
bool isBikeBroken,
|
|
|
|
|
Uri operatorUri);
|
|
|
|
|
|
2021-08-01 17:24:15 +02:00
|
|
|
|
/// <summary> Submits mini survey to copri server. </summary>
|
|
|
|
|
/// <param name="answers">Collection of answers.</param>
|
|
|
|
|
Task<ResponseBase> DoSubmitMiniSurvey(IDictionary<string, string> answers);
|
|
|
|
|
|
2021-05-13 20:03:07 +02:00
|
|
|
|
/// <summary> True if connector has access to copri server, false if cached values are used. </summary>
|
|
|
|
|
bool IsConnected { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary> Gets the session cookie if user is logged in, an empty string otherwise. </summary>
|
|
|
|
|
string SessionCookie { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary> Holds the id of the merchant. </summary>
|
|
|
|
|
string MerchantId { get; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary> Interface to communicate with copri server.</summary>
|
|
|
|
|
public interface ICopriServer : ICopriServerBase
|
|
|
|
|
{
|
|
|
|
|
/// <summary> Get list of stations. </summary>
|
|
|
|
|
/// <returns>List of all stations.</returns>
|
2021-07-20 23:06:09 +02:00
|
|
|
|
Task<StationsAvailableResponse> GetStationsAsync();
|
2021-05-13 20:03:07 +02:00
|
|
|
|
|
|
|
|
|
/// <summary> Gets a list of bikes from Copri. </summary>
|
|
|
|
|
/// <returns>Response holding list of bikes.</returns>
|
|
|
|
|
Task<BikesAvailableResponse> GetBikesAvailableAsync();
|
|
|
|
|
|
|
|
|
|
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
|
|
|
|
|
/// <returns>Response holding list of bikes.</returns>
|
|
|
|
|
Task<BikesReservedOccupiedResponse> GetBikesOccupiedAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|