files tree made better.
This commit is contained in:
parent
ffbf032480
commit
ccc91bbf19
1630 changed files with 18209 additions and 41860 deletions
84
src/Yavsc.Server/Services/GoogleApis/MapTracks.cs
Normal file
84
src/Yavsc.Server/Services/GoogleApis/MapTracks.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
//
|
||||
// MapTracks.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 Paul Schneider
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System.Threading.Tasks;
|
||||
using Yavsc.Models.Google;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.GoogleApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Google Map tracks Api client.
|
||||
/// </summary>
|
||||
public class MapTracks {
|
||||
protected static string scopeTracks = "https://www.googleapis.com/auth/tracks";
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Helpers.Google.Api.MapTracks"/> class.
|
||||
/// </summary>
|
||||
/// <param name="authType">Auth type.</param>
|
||||
/// <param name="redirectUri">Redirect URI.</param>
|
||||
public MapTracks()
|
||||
{}
|
||||
/// <summary>
|
||||
/// The google map tracks path (uri of the service).
|
||||
/// </summary>
|
||||
protected static string googleMapTracksPath = "https://www.googleapis.com/tracks/v1/";
|
||||
// entities/[create|list|delete]
|
||||
// collections/[list|create|[add|remove]entities|delete]
|
||||
// crumbs/[record|getrecent|gethistory|report|summarize|getlocationinfo|delete
|
||||
|
||||
|
||||
// entities/[create|list|delete]
|
||||
// collections/[list|create|[add|remove]entities|delete]
|
||||
// crumbs/[record|getrecent|gethistory|report|summarize|getlocationinfo|delete
|
||||
|
||||
/// <summary>
|
||||
/// Creates the entity.
|
||||
/// </summary>
|
||||
/// <returns>The entity.</returns>
|
||||
/// <param name="entities">Entities.</param>
|
||||
public static async Task<string []> CreateEntity( Entity[] entities ) {
|
||||
string [] ans = null;
|
||||
|
||||
using (SimpleJsonPostMethod wr =
|
||||
new SimpleJsonPostMethod (googleMapTracksPath + "entities/create"))
|
||||
{
|
||||
ans = await wr.Invoke<string[]> (entities);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists the entities.
|
||||
/// </summary>
|
||||
/// <returns>The entities.</returns>
|
||||
/// <param name="eq">Eq.</param>
|
||||
static async Task <Entity[]> ListEntities (EntityQuery eq)
|
||||
{
|
||||
Entity [] ans = null;
|
||||
using (SimpleJsonPostMethod wr =
|
||||
new SimpleJsonPostMethod (googleMapTracksPath + "entities/create"))
|
||||
{
|
||||
ans = await wr.Invoke <Entity[]> (eq);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
}
|
||||
}
|
||||
79
src/Yavsc.Server/Services/GoogleApis/PeopleApi.cs
Normal file
79
src/Yavsc.Server/Services/GoogleApis/PeopleApi.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// PeopleApi.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paul@pschneider.fr>
|
||||
//
|
||||
// Copyright (c) 2015 GNU GPL
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Yavsc.Models.Google;
|
||||
|
||||
namespace Yavsc.GoogleApis
|
||||
{
|
||||
/// <summary>
|
||||
/// Google People API.
|
||||
/// </summary>
|
||||
public class PeopleApi
|
||||
{
|
||||
/// <summary>
|
||||
/// The get people URI.
|
||||
/// </summary>
|
||||
protected static string getPeopleUri = "https://www.googleapis.com/plus/v1/people";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Helpers.Google.Api.PeopleApi"/> class.
|
||||
/// </summary>
|
||||
/// <param name="authType">Auth type.</param>
|
||||
/// <param name="redirectUri">Redirect URI.</param>
|
||||
public PeopleApi()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the People object associated to the given Google Access Token
|
||||
/// </summary>
|
||||
/// <returns>The me.</returns>
|
||||
/// <param name="gat">The Google Access Token object <see cref="AuthToken"/> class.</param>
|
||||
public People GetMe(AuthToken gat)
|
||||
{
|
||||
People me;
|
||||
|
||||
HttpWebRequest webreppro = WebRequest.CreateHttp(getPeopleUri + "/me");
|
||||
webreppro.ContentType = "application/http";
|
||||
webreppro.Headers.Add(HttpRequestHeader.Authorization, gat.token_type + " " + gat.access_token);
|
||||
webreppro.Method = "GET";
|
||||
using (WebResponse proresp = webreppro.GetResponse())
|
||||
{
|
||||
using (Stream prresponseStream = proresp.GetResponseStream())
|
||||
{
|
||||
using (StreamReader rdr = new StreamReader(prresponseStream))
|
||||
{
|
||||
me = JsonConvert.DeserializeObject<People>(rdr.ReadToEnd());
|
||||
prresponseStream.Close();
|
||||
}
|
||||
proresp.Close();
|
||||
}
|
||||
webreppro.Abort();
|
||||
return me;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
7
src/Yavsc.Server/Services/TranslationService.cs
Normal file
7
src/Yavsc.Server/Services/TranslationService.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
namespace Yavsc.Server.Services
|
||||
{
|
||||
public class TranslationService
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue