public async Task <ProfilePictureResult> GetProfilePictureAsync(string userAccessToken, string id = "me", UserProfilePictureOptions profilePictureOptions = null) { var url = FacebookUrl.GetUrl(FacebookUrl.UserPictureUrl, FacebookApiVersion.Version5, id); List <KeyValuePair <string, string> > options; if (profilePictureOptions != null) { options = ModelHelper.GetOptionsAsKeyValue(profilePictureOptions).ToList(); } else { options = new List <KeyValuePair <string, string> >(); } // By default the picture edge will return a picture instead of a JSON response. // If you want the picture edge to return JSON that describes the image set redirect=0 when you make the request. options.Add(new KeyValuePair <string, string>("redirect", "0")); var request = GraphApiRequestBuilder .BuildRequestTo(url) .WithMethod(HttpMethod.Get) .WithUrlParameters(options) .WithUrlPatameter("fields", string.Join(",", ModelHelper.GetAllModelFields <ProfilePictureResult>())) .WithAccessToken(userAccessToken) .WithAppSecretProof(facebookClient.AppSecret, userAccessToken) .GetHttpRequestMessage(); return((await facebookClient.SendRequestAsync <DataWrapper <ProfilePictureResult> >(request)).Data); }
public async Task <DebugTokenResult> DebugTokenAsync(string inputToken) { var debugTokenUrl = FacebookUrl.GetUrl(FacebookUrl.DebugTokenUrl, facebookApiVersion); return((await facebookClient.SendRequestAsync <DataWrapper <DebugTokenResult> >( GraphApiRequestBuilder .BuildRequestTo(debugTokenUrl) .WithMethod(HttpMethod.Get) .WithUrlPatameter("input_token", inputToken) .WithAccessToken(await facebookClient.GetApplicationAccessTokenAsync()) .GetHttpRequestMessage())).Data); }
public async Task <IEnumerable <TestUserResult> > GetTestUsers() { var url = FacebookUrl.GetUrl(FacebookUrl.TestUserUrl, FacebookApiVersion.Version5, this.facebookClient.AppId); var request = GraphApiRequestBuilder .BuildRequestTo(url) .WithMethod(HttpMethod.Get) .WithAccessToken(await facebookClient.GetApplicationAccessTokenAsync()) .GetHttpRequestMessage(); return((await facebookClient.SendRequestAsync <DataWrapper <IEnumerable <TestUserResult> > >(request)).Data); }
public async Task <UserAccessTokenResult> GetLongLivedUserAccessToken(string userAccessToken) { return(await facebookClient.SendRequestAsync <UserAccessTokenResult>( GetAccessTokenRequest(FacebookGrantType.ExchangeToken, userAccessToken))); }