C# Class TradeMe.Api.Client.ConnectionMethods

The ConnectionMethods class contains the methods requried for connecting and making calls to the API.
Afficher le fichier Open project: TradeMe/trade-me-api-wrapper Class Usage Examples

Méthodes publiques

Méthode Description
AuthenticateWithVerificationCode ( string code ) : void

This is the second and final step in the authorisation process. It uses the verification code (retrieved in public string GetVerificationCode()).

It exchanges the verification code for an access token.

Once this step has been performed the user will be enabled to perform authenticated requests.

AuthenticatedQuery ( string query ) : IConsumerRequest

Performs the query specified in the "query" string to perform a request that requires authorization.

This method requires that either an accessToken has been set manually or that the GetVerificationCode() and AuthenticateWithVerificationCode(string code) methods have been called previously.

It returns the IConsumerRequest fully enabled to make the request specified in the "query" string.

ConnectionMethods ( ) : System

Initializes a new instance of the ConnectionMethods class.

ConnectionMethods ( string consumerKey, string consumerSecret ) : System

Initializes a new instance of the ConnectionMethods class.

ConnectionMethods ( string consumerKey, string consumerSecret, IToken accessToken ) : System

Initializes a new instance of the ConnectionMethods class.

ConnectionMethods ( string consumerKey, string consumerSecret, string scopeOfRequest ) : System

Initializes a new instance of the ConnectionMethods class.

GetVerificationCode ( ) : string

Performs the first step in the authorisation handshake. It requests a verification code from the TradeMeApi.

Post ( object toSend, string to ) : System.Xml.Linq.XDocument

It serializes the toSend object into xml and sends the post message specified in the "to" string using an authorized connection. It returns the response from the server as an XDocument.

REQUIRES AUTHENTICATION.

Post ( object toSend, string to, bool delete ) : System.Xml.Linq.XDocument

It serializes the toSend object into xml and sends the post message specified in the "to" string using an authorized connection. It returns the response from the server as an XDocument.

REQUIRES AUTHENTICATION.

UnauthenticatedConnection ( string query ) : IConsumerRequest

Creates a connection with no authorization headers - used for requests that don't require authentication. This method does not actually perform the request - it returns the object to make the request with.

Method Details

AuthenticateWithVerificationCode() public méthode

This is the second and final step in the authorisation process. It uses the verification code (retrieved in public string GetVerificationCode()).

It exchanges the verification code for an access token.

Once this step has been performed the user will be enabled to perform authenticated requests.

public AuthenticateWithVerificationCode ( string code ) : void
code string The verification code.
Résultat void

AuthenticatedQuery() public méthode

Performs the query specified in the "query" string to perform a request that requires authorization.

This method requires that either an accessToken has been set manually or that the GetVerificationCode() and AuthenticateWithVerificationCode(string code) methods have been called previously.

It returns the IConsumerRequest fully enabled to make the request specified in the "query" string.

public AuthenticatedQuery ( string query ) : IConsumerRequest
query string The query string that will be added to the url and used to connect to the API with.
Résultat IConsumerRequest

ConnectionMethods() public méthode

Initializes a new instance of the ConnectionMethods class.
public ConnectionMethods ( ) : System
Résultat System

ConnectionMethods() public méthode

Initializes a new instance of the ConnectionMethods class.
public ConnectionMethods ( string consumerKey, string consumerSecret ) : System
consumerKey string The consumer key.
consumerSecret string The consumer secret.
Résultat System

ConnectionMethods() public méthode

Initializes a new instance of the ConnectionMethods class.
public ConnectionMethods ( string consumerKey, string consumerSecret, IToken accessToken ) : System
consumerKey string The consumer key.
consumerSecret string The consumer secret.
accessToken IToken The access token.
Résultat System

ConnectionMethods() public méthode

Initializes a new instance of the ConnectionMethods class.
public ConnectionMethods ( string consumerKey, string consumerSecret, string scopeOfRequest ) : System
consumerKey string The consumer key.
consumerSecret string The consumer secret.
scopeOfRequest string The scope of the requests that can be made.
Résultat System

GetVerificationCode() public méthode

Performs the first step in the authorisation handshake. It requests a verification code from the TradeMeApi.
public GetVerificationCode ( ) : string
Résultat string

Post() public méthode

It serializes the toSend object into xml and sends the post message specified in the "to" string using an authorized connection. It returns the response from the server as an XDocument.

REQUIRES AUTHENTICATION.
public Post ( object toSend, string to ) : System.Xml.Linq.XDocument
toSend object The object that will be serialized into xml and sent.
to string The url the post message will be sent to.
Résultat System.Xml.Linq.XDocument

Post() public méthode

It serializes the toSend object into xml and sends the post message specified in the "to" string using an authorized connection. It returns the response from the server as an XDocument.

REQUIRES AUTHENTICATION.
public Post ( object toSend, string to, bool delete ) : System.Xml.Linq.XDocument
toSend object The object that will be serialized into xml and then sent in the post message.
to string The query string that will be added to the base url and used to connect to the API.
delete bool True if you want the request to be of the method DELETE instead of POST.
Résultat System.Xml.Linq.XDocument

UnauthenticatedConnection() public méthode

Creates a connection with no authorization headers - used for requests that don't require authentication. This method does not actually perform the request - it returns the object to make the request with.
public UnauthenticatedConnection ( string query ) : IConsumerRequest
query string The url to connect to.
Résultat IConsumerRequest