Contact page shows operator specific info

This commit is contained in:
Oliver Hauff 2021-07-20 23:06:09 +02:00
parent e436e83c1d
commit a58c33f005
51 changed files with 948 additions and 221 deletions

View file

@ -106,7 +106,7 @@ namespace TINK.Repository
/// <summary> Get list of stations. </summary>
/// <returns>List of files.</returns>
public async Task<StationsAllResponse> GetStationsAsync()
public async Task<StationsAvailableResponse> GetStationsAsync()
{
var stations = await GetStationsAsync(m_oCopriHost.AbsoluteUri, requestBuilder.GetStations(), UserAgent);
return stations;
@ -316,7 +316,7 @@ namespace TINK.Repository
/// <param name="p_strCopriHost">URL of the copri host to connect to.</param>
/// <param name="p_oCommand">Command to get stations.</param>
/// <returns>List of files.</returns>
public static async Task<StationsAllResponse> GetStationsAsync(
public static async Task<StationsAvailableResponse> GetStationsAsync(
string p_strCopriHost,
string p_oCommand,
string userAgent = null)

View file

@ -120,6 +120,284 @@ namespace TINK.Repository
}
}";
/// <summary></summary>
public const string STATIONS_AVAILABLE_LOGGEDIN_20210720 = @"
{
""shareejson"": {
""lang"": ""DE"",
""impress_html"": ""site/impress.html"",
""tariff_info_html"": ""site/tariff_info_1.html"",
""debuglevel"": ""1"",
""user_tour"": [
null,
""""
],
""response"": ""stations_available"",
""user_id"": ""ohauff@posteo.de"",
""stations"": {
""LV_3"": {
""service_tour"": ""LV_1"",
""uri_operator"": ""https://shareeapp-lv.copri.eu"",
""authed"": ""1"",
""station"": ""LV_3"",
""gps"": {
""latitude"": ""47.9973"",
""longitude"": ""7.8585""
},
""gps_radius"": ""100"",
""description"": ""Katholische Akademie"",
""state"": ""available"",
""operator_data"": {
""operator_color"": ""#006269"",
""operator_hours"": """",
""operator_name"": ""LastenVelo Freiburg"",
""operator_email"": ""info@lastenvelofreiburg.de"",
""operator_phone"": """"
},
""station_group"": [
""LV_300005""
]
},
""LV_1"": {
""uri_operator"": ""https://shareeapp-lv.copri.eu"",
""station"": ""LV_1"",
""gps"": {
""latitude"": ""47.9848"",
""longitude"": ""7.848666""
},
""authed"": ""1"",
""service_tour"": ""LV_1"",
""operator_data"": {
""operator_hours"": """",
""operator_email"": ""info@lastenvelofreiburg.de"",
""operator_name"": ""LastenVelo Freiburg"",
""operator_color"": ""#006269"",
""operator_phone"": """"
},
""state"": ""available"",
""description"": ""Parkplatz Feuerwehr Wiehre"",
""station_group"": [
""LV_300005""
],
""gps_radius"": ""100""
},
""FR_105"": {
""gps_radius"": ""50"",
""station_group"": [
""FR_300029""
],
""state"": ""available"",
""description"": ""Contributor-Station Rainer"",
""operator_data"": {
""operator_phone"": ""+49 761 45370097"",
""operator_hours"": ""B<EFBFBD>rozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
""operator_name"": ""sharee.bike | TeilRad GmbH"",
""operator_email"": ""hotline@sharee.bike"",
""operator_color"": ""#009699""
},
""service_tour"": ""FR_1"",
""authed"": ""1"",
""station"": ""FR_105"",
""gps"": {
""longitude"": "" 7.973855"",
""latitude"": ""47.927738""
},
""uri_operator"": ""https://shareeapp-fr01.copri.eu""
},
""FR_104"": {
""gps_radius"": ""50"",
""operator_data"": {
""operator_phone"": ""+49 761 45370097"",
""operator_color"": ""#009699"",
""operator_email"": ""hotline@sharee.bike"",
""operator_name"": ""sharee.bike | TeilRad GmbH"",
""operator_hours"": ""B<EFBFBD>rozeiten: Montag, Mittwoch, Freitag 9-12 Uhr""
},
""description"": ""Contributor-Station fahrradspezialitäten"",
""state"": ""available"",
""station_group"": [
""FR_300029""
],
""service_tour"": ""FR_1"",
""uri_operator"": ""https://shareeapp-fr01.copri.eu"",
""gps"": {
""latitude"": ""47.989807"",
""longitude"": "" 7.837621""
},
""station"": ""FR_104"",
""authed"": ""1""
},
""FR_103"": {
""uri_operator"": ""https://shareeapp-fr01.copri.eu"",
""authed"": ""1"",
""gps"": {
""longitude"": "" 7.785428"",
""latitude"": ""47.997930""
},
""station"": ""FR_103"",
""service_tour"": ""FR_1"",
""description"": ""Contributor-Station Oliver"",
""state"": ""available"",
""operator_data"": {
""operator_phone"": ""+49 761 45370097"",
""operator_hours"": ""B<EFBFBD>rozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
""operator_name"": ""sharee.bike | TeilRad GmbH"",
""operator_email"": ""hotline@sharee.bike"",
""operator_color"": ""#009699""
},
""station_group"": [
""FR_300029""
],
""gps_radius"": ""50""
},
""LV_88"": {
""station_group"": [
""LV_300005""
],
""state"": ""available"",
""description"": ""TINK Test KN"",
""operator_data"": {
""operator_name"": ""LastenVelo Freiburg"",
""operator_email"": ""info@lastenvelofreiburg.de"",
""operator_hours"": """",
""operator_color"": ""#006269"",
""operator_phone"": """"
},
""gps_radius"": ""50"",
""authed"": ""1"",
""gps"": {
""latitude"": ""47.65934079179006"",
""longitude"": "" 9.166126178863573""
},
""station"": ""LV_88"",
""uri_operator"": ""https://shareeapp-lv.copri.eu"",
""service_tour"": ""LV_2""
},
""LV_4"": {
""uri_operator"": ""https://shareeapp-lv.copri.eu"",
""authed"": ""1"",
""station"": ""LV_4"",
""gps"": {
""latitude"": ""48.01095"",
""longitude"": ""7.8553""
},
""service_tour"": ""LV_1"",
""state"": ""available"",
""description"": ""Fabrik Habsburger Straße"",
""operator_data"": {
""operator_phone"": """",
""operator_hours"": """",
""operator_email"": ""info@lastenvelofreiburg.de"",
""operator_name"": ""LastenVelo Freiburg"",
""operator_color"": ""#006269""
},
""station_group"": [
""LV_300005""
],
""gps_radius"": ""100""
},
""LV_2"": {
""uri_operator"": ""https://shareeapp-lv.copri.eu"",
""authed"": ""1"",
""gps"": {
""longitude"": ""7.84795"",
""latitude"": ""47.99762""
},
""station"": ""LV_2"",
""service_tour"": ""LV_1"",
""description"": ""Predigertor ADAC"",
""state"": ""available"",
""operator_data"": {
""operator_phone"": """",
""operator_name"": ""LastenVelo Freiburg"",
""operator_email"": ""info@lastenvelofreiburg.de"",
""operator_hours"": """",
""operator_color"": ""#006269""
},
""station_group"": [
""LV_300005""
],
""gps_radius"": ""100""
},
""FR_102"": {
""description"": ""Contributor-Station Dieter"",
""state"": ""available"",
""operator_data"": {
""operator_phone"": ""+49 761 45370097"",
""operator_hours"": ""B<EFBFBD>rozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
""operator_email"": ""hotline@sharee.bike"",
""operator_name"": ""sharee.bike | TeilRad GmbH"",
""operator_color"": ""#009699""
},
""station_group"": [
""FR_300029""
],
""gps_radius"": ""50"",
""uri_operator"": ""https://shareeapp-fr01.copri.eu"",
""authed"": ""1"",
""station"": ""FR_102"",
""gps"": {
""longitude"": "" 7.835669"",
""latitude"": ""47.994371""
},
""service_tour"": ""FR_1""
},
""FR_101"": {
""station_group"": [
""FR_300001""
],
""state"": ""available"",
""description"": ""Villaban sharee Station"",
""operator_data"": {
""operator_color"": ""#009699"",
""operator_email"": ""hotline@sharee.bike"",
""operator_name"": ""sharee.bike | TeilRad GmbH"",
""operator_hours"": ""B<EFBFBD>rozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
""operator_phone"": ""+49 761 45370097""
},
""gps_radius"": ""50"",
""authed"": ""1"",
""gps"": {
""longitude"": "" 7.825490"",
""latitude"": ""47.976634""
},
""station"": ""FR_101"",
""uri_operator"": ""https://shareeapp-fr01.copri.eu"",
""service_tour"": ""FR_1""
}
},
""response_state"": ""OK, nothing todo"",
""agb_checked"": ""1"",
""agb_html"": ""site/agb.html"",
""authcookie"": ""5781_f172cf59108fe53e7524c841847fee69_oiF2kahH"",
""Ilockit_admin"": ""1"",
""copri_version"": ""4.1.0.0"",
""bike_info_html"": ""site/bike_info.html"",
""uri_operator_array"": [
""https://shareeapp-lv.copri.eu"",
""https://shareeapp-fr01.copri.eu""
],
""uri_primary"": ""https://shareeapp-primary.copri.eu"",
""apiserver"": ""https://shareeapp-primary.copri.eu"",
""last_used_operator"": {
""operator_phone"": ""+49 761 45370097"",
""operator_color"": ""#009699"",
""operator_email"": ""hotline@sharee.bike"",
""operator_name"": ""sharee.bike | TeilRad GmbH"",
""operator_hours"": ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr""
},
""clearing_cache"": ""0"",
""user_group"": [
""LV_300005"",
""FR_300029"",
""FR_300001""
],
""privacy_html"": ""site/privacy.html"",
""new_authcoo"": ""0""
}
}
";
const string BOOKING_REQUEST_SET02_001_FILE = @"
{
""shareejson"" : {
@ -1065,7 +1343,7 @@ namespace TINK.Repository
/// </summary>
/// <param name="p_strCookie">Auto cookie of user if user is logged in.</param>
/// <returns>List of files.</returns>
public async Task<StationsAllResponse> GetStationsAsync()
public async Task<StationsAvailableResponse> GetStationsAsync()
{
return await Task.Run(() => GetStationsAll(null, SessionCookie, ActiveSampleSet, ActiveStageIndex));
}
@ -1256,7 +1534,7 @@ namespace TINK.Repository
/// <param name="p_eSampleSet"></param>
/// <param name="p_lStageIndex"></param>
/// <returns></returns>
public static StationsAllResponse GetStationsAll(
public static StationsAvailableResponse GetStationsAll(
string p_strMerchantId,
string p_strCookie = null,
SampleSets p_eSampleSet = DEFAULT_SAMPLE_SET,
@ -1268,7 +1546,7 @@ namespace TINK.Repository
switch (p_lStageIndex)
{
case 1:
return JsonConvertRethrow.DeserializeObject<ResponseContainer<StationsAllResponse>>(STATIONS_SET02_001_FILE).shareejson;
return JsonConvertRethrow.DeserializeObject<ResponseContainer<StationsAvailableResponse>>(STATIONS_SET02_001_FILE).shareejson;
default:
return null;

View file

@ -95,8 +95,8 @@ namespace TINK.Repository
/// <summary> Gets an empty response. </summary>
/// <param name="copriVersion">Version of empty response.</param>
/// <returns>Response.</returns>
public static StationsAllResponse GetEmptyStationsAllResponse(string copriVersion)
=> JsonConvertRethrow.DeserializeObject<StationsAllResponse>(STATIONSALL.Replace("4.1.0.0", copriVersion));
public static StationsAvailableResponse GetEmptyStationsAllResponse(string copriVersion)
=> JsonConvertRethrow.DeserializeObject<StationsAvailableResponse>(STATIONSALL.Replace("4.1.0.0", copriVersion));
/// <summary>
/// Holds the seconds after which station and bikes info is considered to be invalid.
@ -141,7 +141,7 @@ namespace TINK.Repository
if (!Barrel.Current.Exists(requestBuilder.GetStations()))
{
AddToCache(JsonConvertRethrow.DeserializeObject<StationsAllResponse>(STATIONSALL), new TimeSpan(0));
AddToCache(JsonConvertRethrow.DeserializeObject<StationsAvailableResponse>(STATIONSALL), new TimeSpan(0));
}
}
@ -224,12 +224,12 @@ namespace TINK.Repository
}
}
public async Task<StationsAllResponse> GetStationsAsync()
public async Task<StationsAvailableResponse> GetStationsAsync()
{
var l_oStationsAllTask = new TaskCompletionSource<StationsAllResponse>();
var l_oStationsAllTask = new TaskCompletionSource<StationsAvailableResponse>();
lock (monkeyLock)
{
l_oStationsAllTask.SetResult(Barrel.Current.Get<StationsAllResponse>(requestBuilder.GetStations()));
l_oStationsAllTask.SetResult(Barrel.Current.Get<StationsAvailableResponse>(requestBuilder.GetStations()));
}
return await l_oStationsAllTask.Task;
}
@ -248,7 +248,7 @@ namespace TINK.Repository
/// <summary> Adds a stations all response to cache.</summary>
/// <param name="stations">Stations to add.</param>
public void AddToCache(StationsAllResponse stations)
public void AddToCache(StationsAvailableResponse stations)
{
AddToCache(stations, ExpiresAfter);
}
@ -256,7 +256,7 @@ namespace TINK.Repository
/// <summary> Adds a stations all response to cache.</summary>
/// <param name="stations">Stations to add.</param>
/// <param name="expiresAfter">Time after which anser is considered to be expired.</param>
private void AddToCache(StationsAllResponse stations, TimeSpan expiresAfter)
private void AddToCache(StationsAvailableResponse stations, TimeSpan expiresAfter)
{
lock (monkeyLock)
{

View file

@ -112,7 +112,7 @@ namespace TINK.Repository
{
/// <summary> Get list of stations. </summary>
/// <returns>List of all stations.</returns>
Task<StationsAllResponse> GetStationsAsync();
Task<StationsAvailableResponse> GetStationsAsync();
/// <summary> Gets a list of bikes from Copri. </summary>
/// <returns>Response holding list of bikes.</returns>

View file

@ -7,14 +7,37 @@ namespace TINK.Repository.Response
/// Holds the information about all stations and is used for deserialization of copri answer.
/// </summary>
[DataContract]
public class StationsAllResponse : ResponseBase
public class StationsAvailableResponse : ResponseBase
{
/// <summary>
/// <summary>
/// Holds info about a single station.
/// </summary>
[DataContract]
public class StationInfo
{
/// <summary>
/// Holds info about opertor data.
/// </summary>
[DataContract]
public class OperatorData
{
[DataMember]
public string operator_name { get; private set; }
[DataMember]
public string operator_phone { get; private set; }
[DataMember]
public string operator_hours { get; private set; }
[DataMember]
public string operator_email { get; private set; }
[DataMember]
public string operator_color { get; private set; }
}
/// <summary>
/// Unique id of the station.
/// </summary>
@ -32,6 +55,9 @@ namespace TINK.Repository.Response
/// </summary>
[DataMember]
public GpsInfo gps { get; private set; }
[DataMember]
public OperatorData operator_data { get; private set; }
}
/// <summary>