C# 클래스 TradeMe.Api.Client.ConnectionMethods

The ConnectionMethods class contains the methods requried for connecting and making calls to the API.
파일 보기 프로젝트 열기: TradeMe/trade-me-api-wrapper 1 사용 예제들

공개 메소드들

메소드 설명
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