mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
169 lines
7.5 KiB
C#
169 lines
7.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
|
using TINK.Model.Device;
|
|
using TINK.Repository.Request;
|
|
using TINK.Repository.Response;
|
|
|
|
namespace TINK.Repository
|
|
{
|
|
/// <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(
|
|
string bikeId,
|
|
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(
|
|
string bikeId,
|
|
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(
|
|
string bikeId,
|
|
Uri operatorUri);
|
|
|
|
/// <summary> Notifies COPRI about start of returning sequence. </summary>
|
|
/// <remarks> Operator specific call.</remarks>
|
|
/// <param name="bikeId">Id of the bike to return.</param>+
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
/// <returns>Response on notification about start of returning sequence.</returns>
|
|
Task<ResponseBase> StartReturningBike(
|
|
string bikeId,
|
|
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(
|
|
string bikeId,
|
|
lock_state state,
|
|
Uri operatorUri,
|
|
LocationDto location = null,
|
|
double batteryPercentage = double.NaN,
|
|
IVersionInfo versionInfo = null);
|
|
|
|
/// <summary> Books a bluetooth 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(
|
|
string bikeId,
|
|
Guid guid,
|
|
double batteryPercentage,
|
|
Uri operatorUri);
|
|
|
|
/// <summary> Books a bike and starts opening bike. </summary>
|
|
/// <param name="bikeId">Id of the bike to book.</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> BookAvailableAndStartOpeningAsync(
|
|
string bikeId,
|
|
Uri operatorUri);
|
|
|
|
/// <summary> Books a bike and starts opening bike. </summary>
|
|
/// <param name="bikeId">Id of the bike to book.</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> BookReservedAndStartOpeningAsync(
|
|
string bikeId,
|
|
Uri operatorUri);
|
|
|
|
/// <summary> Returns a bike. </summary>
|
|
/// <param name="bikeId">Id of the bike to return.</param>
|
|
/// <param name="location">Geolocation of lock.</param>
|
|
/// <param name="smartDevice">Provides info about hard and software.</param>
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
/// <returns>Response on returning request.</returns>
|
|
Task<DoReturnResponse> DoReturn(
|
|
string bikeId,
|
|
LocationDto location,
|
|
ISmartDevice smartDevice,
|
|
Uri operatorUri);
|
|
|
|
/// <summary> Returns a bike and starts closing. </summary>
|
|
/// <param name="bikeId">Id of the bike to return.</param>
|
|
/// <param name="smartDevice">Provides info about hard and software.</param>
|
|
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
|
/// <returns>Response on returning request.</returns>
|
|
Task<DoReturnResponse> ReturnAndStartClosingAsync(
|
|
string bikeId,
|
|
ISmartDevice smartDevice,
|
|
Uri operatorUri);
|
|
|
|
/// <summary>
|
|
/// Submits feedback to copri server.
|
|
/// </summary>
|
|
/// <param name="bikeId">Id of the bike to submit feedback for.</param>
|
|
/// <param name="currentChargeBars">Null if bike has no engine or charge is unknown. Otherwise the charge filling level of the drive battery.</param>
|
|
/// <param name="isBikeBroken">True if bike is broken.</param>
|
|
/// <param name="message">General purpose message or error description.</param>
|
|
Task<SubmitFeedbackResponse> DoSubmitFeedback(
|
|
string bikeId,
|
|
int? currentChargeBars,
|
|
string message,
|
|
bool isBikeBroken,
|
|
Uri operatorUri);
|
|
|
|
/// <summary> Submits mini survey to copri server. </summary>
|
|
/// <param name="answers">Collection of answers.</param>
|
|
Task<ResponseBase> DoSubmitMiniSurvey(IDictionary<string, string> answers);
|
|
|
|
/// <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>
|
|
Task<StationsAvailableResponse> GetStationsAsync();
|
|
|
|
/// <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();
|
|
}
|
|
}
|