C# Класс TradeMe.Api.Client.ConnectionMethods

The ConnectionMethods class contains the methods requried for connecting and making calls to the API.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

AuthenticateWithVerificationCode() публичный Метод

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.
Результат void

AuthenticatedQuery() публичный Метод

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.
Результат IConsumerRequest

ConnectionMethods() публичный Метод

Initializes a new instance of the ConnectionMethods class.
public ConnectionMethods ( ) : System
Результат System

ConnectionMethods() публичный Метод

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.
Результат System

ConnectionMethods() публичный Метод

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.
Результат System

ConnectionMethods() публичный Метод

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.
Результат System

GetVerificationCode() публичный Метод

Performs the first step in the authorisation handshake. It requests a verification code from the TradeMeApi.
public GetVerificationCode ( ) : string
Результат string

Post() публичный Метод

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.
Результат System.Xml.Linq.XDocument

Post() публичный Метод

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.
Результат System.Xml.Linq.XDocument

UnauthenticatedConnection() публичный Метод

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.
Результат IConsumerRequest