C# Class Facebook.FacebookClient

显示文件 Open project: liquidboy/X Class Usage Examples

Private Properties

Property Type Description
Base64UrlDecode byte[]
BatchAsync void
BatchAsync void
BatchAsync void
BuildHttpQuery string
ComputeHmacSha1Hash byte[]
ComputeHmacSha256Hash byte[]
FacebookClient System
GetException System.Exception
ParseDialogCallbackUrl object
ParseOAuthCallbackUrl FacebookOAuthResult
ParseSignedRequest object
ParseUrlQueryString string
ParseUrlQueryString string
PrepareBatchRequest object
PrepareRequest HttpHelper
ProcessBatchResponse object
ProcessResponse object
SerializeParameters void
SetDefaultJsonSerializers void
SetJsonSerializers void
ToDictionary object>.IDictionary
TryParseOAuthCallbackUrl bool
TryParseSignedRequest bool
TryParseSignedRequest bool

Public Methods

Method Description
Batch ( ) : object

Makes a batch request to the Facebook server.

Batch ( FacebookBatchParameter batchParameters, object parameters ) : object

Makes a batch request to the Facebook server.

BatchTaskAsync ( ) : Task

Makes an asynchronous batch request to the Facebook server.

BatchTaskAsync ( FacebookBatchParameter batchParameters, object userToken, CancellationToken cancellationToken ) : Task
BatchTaskAsync ( FacebookBatchParameter batchParameters, object userState, CancellationToken cancellationToken, System uploadProgress ) : Task

Makes an asynchronous batch request to the Facebook server.

BatchTaskAsync ( FacebookBatchParameter batchParameters, object userToken, object parameters, CancellationToken cancellationToken ) : Task
BatchTaskAsync ( FacebookBatchParameter batchParameters, object userState, object parameters, CancellationToken cancellationToken, System uploadProgress ) : Task

Makes an asynchronous batch request to the Facebook server.

FacebookClient ( string accessToken ) : System

Initializes a new instance of the FacebookClient class.

GetDialogUrl ( string dialog, object parameters ) : Uri

Gets the Facebook dialog url.

GetLoginUrl ( object parameters ) : Uri

Gets the Facebook OAuth login url.

GetLogoutUrl ( object parameters ) : Uri

Gets the Facebook OAuth logout url.

ParseSignedRequest ( string signedRequestValue ) : object

Parse the facebook signed_request.

SetDefaultHttpWebRequestFactory ( HttpWebRequestWrapper>.Func httpWebRequestFactory ) : void

Sets the default http web request factory.

SetHttpWebRequestFactory ( HttpWebRequestWrapper>.Func httpWebRequestFactory ) : void

Sets the http web request factory for the current instance of FacebookClient.

VerifyGetSubscription ( string requestHubMode, string requestVerifyToken, string requestHubChallenge ) : void

Verify HTTP_X_HUB_SIGNATURE for HTTP GET.

VerifyGetSubscription ( string requestHubMode, string requestVerifyToken, string requestHubChallenge, string verifyToken ) : void

Verify HTTP_X_HUB_SIGNATURE for HTTP GET.

VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody ) : object

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.

VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody, Type resultType ) : object

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.

VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody, Type resultType, string appSecret ) : object

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.

VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody, string appSecret ) : object

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.

Private Methods

Method Description
Base64UrlDecode ( string base64UrlSafeString ) : byte[]

Base64 Url decode.

BatchAsync ( FacebookBatchParameter batchParameters ) : void
BatchAsync ( FacebookBatchParameter batchParameters, object userState ) : void
BatchAsync ( FacebookBatchParameter batchParameters, object userState, object parameters ) : void
BuildHttpQuery ( object parameter, string>.Func encode ) : string
ComputeHmacSha1Hash ( byte data, byte key ) : byte[]
ComputeHmacSha256Hash ( byte data, byte key ) : byte[]

Computes the Hmac Sha 256 Hash.

FacebookClient ( ) : System

Initializes a new instance of the FacebookClient class.

GetException ( HttpHelper httpHelper, object result ) : Exception
ParseDialogCallbackUrl ( Uri uri ) : object
ParseOAuthCallbackUrl ( Uri uri ) : FacebookOAuthResult
ParseSignedRequest ( string appSecret, string signedRequestValue ) : object
ParseUrlQueryString ( string path, object>.IDictionary parameters, bool forceParseAllUrls ) : string
ParseUrlQueryString ( string path, object>.IDictionary parameters, bool forceParseAllUrls, Uri &uri, bool &isLegacyRestApi, bool &isAbsolutePath ) : string
PrepareBatchRequest ( FacebookBatchParameter batchParameters, object parameters ) : object
PrepareRequest ( HttpMethod httpMethod, string path, object parameters, Type resultType, Stream &input, bool &containsEtag, IList &batchEtags ) : HttpHelper
ProcessBatchResponse ( object result, IList batchEtags ) : object
ProcessResponse ( HttpHelper httpHelper, string responseString, Type resultType, bool containsEtag, IList batchEtags ) : object
SerializeParameters ( object>.IDictionary parameters ) : void
SetDefaultJsonSerializers ( string>.Func jsonSerializer, Func jsonDeserializer ) : void
SetJsonSerializers ( string>.Func jsonSerializer, Func jsonDeserializer ) : void
ToDictionary ( object parameters, FacebookMediaObject>.IDictionary &mediaObjects, FacebookMediaStream>.IDictionary &mediaStreams ) : object>.IDictionary

Converts the parameters to IDictionary<string,object>

TryParseOAuthCallbackUrl ( Uri url, FacebookOAuthResult &facebookOAuthResult ) : bool
TryParseSignedRequest ( string signedRequestValue, object &signedRequest ) : bool
TryParseSignedRequest ( string appSecret, string signedRequestValue, object &signedRequest ) : bool

Method Details

Batch() public method

Makes a batch request to the Facebook server.
public Batch ( ) : object
return object

Batch() public method

Makes a batch request to the Facebook server.
public Batch ( FacebookBatchParameter batchParameters, object parameters ) : object
batchParameters FacebookBatchParameter List of batch parameters.
parameters object The parameters
return object

BatchTaskAsync() public method

Makes an asynchronous batch request to the Facebook server.
public BatchTaskAsync ( ) : Task
return Task

BatchTaskAsync() public method

public BatchTaskAsync ( FacebookBatchParameter batchParameters, object userToken, CancellationToken cancellationToken ) : Task
batchParameters FacebookBatchParameter
userToken object
cancellationToken CancellationToken
return Task

BatchTaskAsync() public method

Makes an asynchronous batch request to the Facebook server.
public BatchTaskAsync ( FacebookBatchParameter batchParameters, object userState, CancellationToken cancellationToken, System uploadProgress ) : Task
batchParameters FacebookBatchParameter /// List of batch parameters. ///
userState object /// The user state. ///
cancellationToken CancellationToken /// The cancellation token. ///
uploadProgress System
return Task

BatchTaskAsync() public method

public BatchTaskAsync ( FacebookBatchParameter batchParameters, object userToken, object parameters, CancellationToken cancellationToken ) : Task
batchParameters FacebookBatchParameter
userToken object
parameters object
cancellationToken CancellationToken
return Task

BatchTaskAsync() public method

Makes an asynchronous batch request to the Facebook server.
public BatchTaskAsync ( FacebookBatchParameter batchParameters, object userState, object parameters, CancellationToken cancellationToken, System uploadProgress ) : Task
batchParameters FacebookBatchParameter /// List of batch parameters. ///
userState object /// The user state. ///
parameters object /// The parameters. ///
cancellationToken CancellationToken /// The cancellation token. ///
uploadProgress System
return Task

FacebookClient() public method

Initializes a new instance of the FacebookClient class.
Access token in null or empty.
public FacebookClient ( string accessToken ) : System
accessToken string The facebook access_token.
return System

GetDialogUrl() public method

Gets the Facebook dialog url.
/// If dialog or parameters is null. ///
public GetDialogUrl ( string dialog, object parameters ) : Uri
dialog string /// The dialog name. Values can be oauth, feed, pagetab, friends, pay, apprequests, and send. ///
parameters object /// The parameters. ///
return System.Uri

GetLoginUrl() public method

Gets the Facebook OAuth login url.
/// If parameters is null. ///
public GetLoginUrl ( object parameters ) : Uri
parameters object /// The parameters. ///
return System.Uri

GetLogoutUrl() public method

Gets the Facebook OAuth logout url.
public GetLogoutUrl ( object parameters ) : Uri
parameters object /// The parameters. ///
return System.Uri

ParseSignedRequest() public method

Parse the facebook signed_request.
Throws if appSecret or signedRequestValue is null or empty. If the signedRequestValue is an invalid signed_request.
public ParseSignedRequest ( string signedRequestValue ) : object
signedRequestValue string The signed_request value.
return object

SetDefaultHttpWebRequestFactory() public static method

Sets the default http web request factory.
public static SetDefaultHttpWebRequestFactory ( HttpWebRequestWrapper>.Func httpWebRequestFactory ) : void
httpWebRequestFactory HttpWebRequestWrapper>.Func
return void

SetHttpWebRequestFactory() public method

Sets the http web request factory for the current instance of FacebookClient.
public SetHttpWebRequestFactory ( HttpWebRequestWrapper>.Func httpWebRequestFactory ) : void
httpWebRequestFactory HttpWebRequestWrapper>.Func
return void

VerifyGetSubscription() public method

Verify HTTP_X_HUB_SIGNATURE for HTTP GET.
public VerifyGetSubscription ( string requestHubMode, string requestVerifyToken, string requestHubChallenge ) : void
requestHubMode string The request hub.mode
requestVerifyToken string The request hub.verify_token
requestHubChallenge string The request hub.challenge
return void

VerifyGetSubscription() public method

Verify HTTP_X_HUB_SIGNATURE for HTTP GET.
public VerifyGetSubscription ( string requestHubMode, string requestVerifyToken, string requestHubChallenge, string verifyToken ) : void
requestHubMode string The request hub.mode
requestVerifyToken string The request hub.verify_token
requestHubChallenge string The request hub.challenge
verifyToken string Expected verify token.
return void

VerifyPostSubscription() public method

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.
public VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody ) : object
requestHttpXHubSignature string The request HTTP_X_HUB_SIGNATURE
requestBody string The request body.
return object

VerifyPostSubscription() public method

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.
public VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody, Type resultType ) : object
requestHttpXHubSignature string The request HTTP_X_HUB_SIGNATURE
requestBody string The request body.
resultType Type The result type.
return object

VerifyPostSubscription() public method

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.
public VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody, Type resultType, string appSecret ) : object
requestHttpXHubSignature string The request HTTP_X_HUB_SIGNATURE
requestBody string The request body.
resultType Type The result type.
appSecret string The App secret.
return object

VerifyPostSubscription() public method

Verify HTTP_X_HUB_SIGNATURE for HTTP POST.
public VerifyPostSubscription ( string requestHttpXHubSignature, string requestBody, string appSecret ) : object
requestHttpXHubSignature string The request HTTP_X_HUB_SIGNATURE
requestBody string The request body.
appSecret string The App secret.
return object