Skip to content

Commit

Permalink
updated documentation and library
Browse files Browse the repository at this point in the history
  • Loading branch information
geralexgr committed Oct 29, 2017
1 parent e83bb51 commit 8a7865d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ Basic examples of package functionality.

* CreateTokenUrl
* GetToken
* GetPageInfo
* CreatePageRequestUrl





## Code

#### Get A token
#### GetToken() - Get a Token


```
Expand All @@ -21,3 +25,15 @@ using Net.Facebook.Graph.Models;
Token token = await NetGraphRequest.GetToken("APPID", "APPSECRET");
```

#### GetPageInfo() - Get Page Information

> USERNAME should be either the nickname or the ID of the page.
```
using Net.Facebook.Graph;
using Net.Facebook.Graph.Models;
var url = CreatePageRequestUrl("APPID", "APPSECRET","USERNAME");
Page page = await NetGraphRequest.GetPageInfo(url);
```
17 changes: 17 additions & 0 deletions src/Net.Facebook.Graph/NetGraphRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ public static string CreateTokenUrl(string id, string secret)
return url;
}

public static async Task<string> CreatePageRequestUrl(string id, string secret,string page)
{
Token token = await GetToken(id,secret);
if (token != null)
{
var url = "https://graph.facebook.com/" + page +
"?fields=id,link,name,about,category,single_line_address,picture.width(600).height(600)" + "&access_token="
+ token.AccessToken;
return url;
}
else
{
return String.Empty;
}

}

public static async Task<Page> GetPageInfo(string url)
{
try
Expand Down

0 comments on commit 8a7865d

Please sign in to comment.