Skip to content

Commit

Permalink
Get Page Information implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
geralexgr committed Oct 29, 2017
1 parent 83788b0 commit ca2d23f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 6 deletions.
51 changes: 51 additions & 0 deletions src/Net.Facebook.Graph/Models/Page.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace Net.Facebook.Graph.Models
{
public class Page
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("link")]
public string Url { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("about")]
public string Description { get; set; }

[JsonProperty("category")]
public string Category { get; set; }
public string Address { get; set; }

[JsonProperty("picture")]
public ProfilePicture Picture { get; set; }


public class ProfilePicture
{
[JsonProperty("data")]
public PictureData Data { get; set; }
}

public class PictureData
{
[JsonProperty("height")]
public int Height { get; set; }

[JsonProperty("is_silhouette")]
public bool IsSilhouette { get; set; }

[JsonProperty("url")]
public string Url { get; set; }

[JsonProperty("width")]
public int Width { get; set; }
}
}
}
15 changes: 14 additions & 1 deletion src/Net.Facebook.Graph/NetGraphRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Net.Facebook.Graph
public static class NetGraphRequest
{

public async static Task<Token> GetToken(string id, string secret)
public static async Task<Token> GetToken(string id, string secret)
{
try
{
Expand All @@ -34,5 +34,18 @@ public static string CreateTokenUrl(string id, string secret)
return url;
}

public static async Task<Page> GetPageInfo(string url)
{
try
{
var client = new HttpClient();
var response = await client.GetAsync(url);
var result = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<Page>(result);
}

catch (Exception) { return null; }
}

}
}
10 changes: 5 additions & 5 deletions src/Package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>Net.Facebook.Graph</id>
<version>1.0.5</version>
<version>1.0.7</version>
<authors>GeralexGR</authors>
<owners>GeralexGR</owners>
<licenseUrl>https://github.com/jerrak0s/Net.Facebook.Graph/blob/master/LICENSE</licenseUrl>
Expand All @@ -23,20 +23,20 @@



<file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" />
<!-- <file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" /> -->
<file src="Net.Facebook.Graph\bin\Release\netstandard1.6\Net.Facebook.Graph.dll" target="lib" />


<!--NetStandard/PCL-->
<file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" />
<!-- <file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" /> -->
<file src="Net.Facebook.Graph\bin\Release\netstandard1.6\Net.Facebook.Graph.dll" target="lib\netstandard1.6" />

<!--UWP-->
<file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" />
<!-- <file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" /> -->
<file src="Net.Facebook.Graph\bin\Release\netstandard1.6\Net.Facebook.Graph.dll" target="lib\UAP10" />

<!--Net 45-->
<file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" />
<!-- <file src="Net.Facebook.Graph\Models\Token.cs" target="content\Models\Token.cs" /> -->
<file src="Net.Facebook.Graph\bin\Release\netstandard1.6\Net.Facebook.Graph.dll" target="lib\net45" />


Expand Down

0 comments on commit ca2d23f

Please sign in to comment.