C# Class FlickrNet.Twitter

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

Private Properties

Property Type Description
CalculateAuthSignature string
CheckApiKey void
CheckRequiresAuthentication void
CheckSigned void
ConvertNonSeekableStreamToByteArray byte[]
CreateUploadData byte[]

Public Methods

Method Description
CalculateUri ( string>.Dictionary parameters, bool includeSignature ) : Uri

Calculates the Flickr method cal URL based on the passed in parameters, and also generates the signature if required.

FlushCache ( ) : void

Clears the cache completely.

FlushCache ( Uri url ) : void

Clears the cache for a particular URL.

The URL can either be an image URL for a downloaded picture, or a request URL (see LastRequest for getting the last URL).

FlushCache ( string url ) : void

Clears the cache for a particular URL.

The URL can either be an image URL for a downloaded picture, or a request URL (see LastRequest for getting the last URL).

OAuthCalculateAuthorizationUrl ( string requestToken, AuthLevel perms ) : string

Returns the authorization URL for OAuth authorization, based off the request token and permissions provided.

OAuthCalculateSignature ( string method, string url, string>.Dictionary parameters, string tokenSecret ) : string

Calculates the signature for an OAuth call.

OAuthCalculateSignatureForCalls ( string method, string url, string>.Dictionary parameters, string tokenSecret ) : string
OAuthGetAccessTokenAsync ( OAuthRequestToken requestToken, string verifier ) : Task>

Returns an access token for the given request token, secret and authorization verifier.

OAuthGetAccessTokenAsync ( string requestToken, string requestTokenSecret, string verifier ) : Task>

For a given request token and verifier string return an access token.

OAuthGetBasicParameters ( ) : string>.Dictionary

Returns a new dictionary containing the basic OAuth parameters.

OAuthGetBasicParameters ( string>.Dictionary parameters ) : void

Populates the given dictionary with the basic OAuth parameters, oauth_timestamp, oauth_noonce etc.

OAuthGetRequestTokenAsync ( string callbackUrl ) : Task>

Get an OAuthRequestToken for the given callback URL.

Specify 'oob' as the callback url for no callback to be performed.

Twitter ( ) : System

Constructor loads configuration settings from app.config or web.config file if they exist.

Twitter ( string apiKey ) : System

Create a new instance of the Flickr class with no authentication.

Twitter ( string apiKey, string sharedSecret ) : System

Creates a new instance of the Flickr class with an API key and a Shared Secret. This is only useful really useful for calling the Auth functions as all other authenticationed methods also require the API Token.

Twitter ( string apiKey, string sharedSecret, string token ) : System

Create a new instance of the Flickr class with the email address and password given

Private Methods

Method Description
CalculateAuthSignature ( string>.Dictionary parameters ) : string
CheckApiKey ( ) : void
CheckRequiresAuthentication ( ) : void
CheckSigned ( ) : void
ConvertNonSeekableStreamToByteArray ( Stream nonSeekableStream ) : byte[]
CreateUploadData ( Stream imageStream, string fileName, string>.Dictionary parameters, string boundary ) : byte[]

Method Details

CalculateUri() public method

Calculates the Flickr method cal URL based on the passed in parameters, and also generates the signature if required.
public CalculateUri ( string>.Dictionary parameters, bool includeSignature ) : Uri
parameters string>.Dictionary A Dictionary containing a list of parameters to add to the method call.
includeSignature bool Boolean use to decide whether to generate the api call signature as well.
return System.Uri

FlushCache() public static method

Clears the cache completely.
public static FlushCache ( ) : void
return void

FlushCache() public static method

Clears the cache for a particular URL.
The URL can either be an image URL for a downloaded picture, or a request URL (see LastRequest for getting the last URL).
public static FlushCache ( Uri url ) : void
url System.Uri The URL to remove from the cache.
return void

FlushCache() public static method

Clears the cache for a particular URL.
The URL can either be an image URL for a downloaded picture, or a request URL (see LastRequest for getting the last URL).
public static FlushCache ( string url ) : void
url string The URL to remove from the cache.
return void

OAuthCalculateAuthorizationUrl() public method

Returns the authorization URL for OAuth authorization, based off the request token and permissions provided.
public OAuthCalculateAuthorizationUrl ( string requestToken, AuthLevel perms ) : string
requestToken string The request token to include in the authorization url.
perms AuthLevel The permissions being requested.
return string

OAuthCalculateSignature() public method

Calculates the signature for an OAuth call.
public OAuthCalculateSignature ( string method, string url, string>.Dictionary parameters, string tokenSecret ) : string
method string POST or GET method.
url string The URL the request will be sent to.
parameters string>.Dictionary Parameters to be added to the signature.
tokenSecret string The token secret (either request or access) for generating the SHA-1 key.
return string

OAuthCalculateSignatureForCalls() public method

public OAuthCalculateSignatureForCalls ( string method, string url, string>.Dictionary parameters, string tokenSecret ) : string
method string
url string
parameters string>.Dictionary
tokenSecret string
return string

OAuthGetAccessTokenAsync() public method

Returns an access token for the given request token, secret and authorization verifier.
public OAuthGetAccessTokenAsync ( OAuthRequestToken requestToken, string verifier ) : Task>
requestToken OAuthRequestToken
verifier string
return Task>

OAuthGetAccessTokenAsync() public method

For a given request token and verifier string return an access token.
public OAuthGetAccessTokenAsync ( string requestToken, string requestTokenSecret, string verifier ) : Task>
requestToken string
requestTokenSecret string
verifier string
return Task>

OAuthGetBasicParameters() public method

Returns a new dictionary containing the basic OAuth parameters.
public OAuthGetBasicParameters ( ) : string>.Dictionary
return string>.Dictionary

OAuthGetBasicParameters() public method

Populates the given dictionary with the basic OAuth parameters, oauth_timestamp, oauth_noonce etc.
public OAuthGetBasicParameters ( string>.Dictionary parameters ) : void
parameters string>.Dictionary Dictionary to be populated with the OAuth parameters.
return void

OAuthGetRequestTokenAsync() public method

Get an OAuthRequestToken for the given callback URL.
Specify 'oob' as the callback url for no callback to be performed.
public OAuthGetRequestTokenAsync ( string callbackUrl ) : Task>
callbackUrl string The callback Uri, or 'oob' if no callback is to be performed.
return Task>

Twitter() public method

Constructor loads configuration settings from app.config or web.config file if they exist.
public Twitter ( ) : System
return System

Twitter() public method

Create a new instance of the Flickr class with no authentication.
public Twitter ( string apiKey ) : System
apiKey string Your Flickr API Key.
return System

Twitter() public method

Creates a new instance of the Flickr class with an API key and a Shared Secret. This is only useful really useful for calling the Auth functions as all other authenticationed methods also require the API Token.
public Twitter ( string apiKey, string sharedSecret ) : System
apiKey string Your Flickr API Key.
sharedSecret string Your Flickr Shared Secret.
return System

Twitter() public method

Create a new instance of the Flickr class with the email address and password given
public Twitter ( string apiKey, string sharedSecret, string token ) : System
apiKey string Your Flickr API Key
sharedSecret string Your FLickr Shared Secret.
token string The token for the user who has been authenticated.
return System