C# Class ShipStationAccess.V2.Services.WebRequestServices

ファイルを表示 Open project: skuvault/shipStationAccess

Public Methods

Method Description
CanSkipException ( WebException e ) : bool
GetApiKey ( ) : string
GetResponse ( ShipStationCommand command, string commandParams, CancellationToken token, int? operationTimeout = null ) : T

Get response from ShipStation's endpoint

GetResponseAsync ( ShipStationCommand command, string commandParams, CancellationToken token, int? operationTimeout = null ) : Task

Get response from ShipStation's endpoint async

PostData ( ShipStationCommand command, string jsonContent, CancellationToken token, int? operationTimeout = null ) : void

Post data to ShipStation's endpoint

PostDataAndGetResponse ( ShipStationCommand command, string jsonContent, CancellationToken token, bool shouldGetExceptionMessage = false, int? operationTimeout = null ) : T

Post data to ShipStation's endpoint and read response

PostDataAndGetResponseAsync ( ShipStationCommand command, string jsonContent, CancellationToken token, bool shouldGetExceptionMessage = false, int? operationTimeout = null ) : Task

Post data to ShipStation's endpoint and read response async

PostDataAndGetResponseWithShipstationHeader ( ShipStationCommand command, string jsonContent, CancellationToken token, bool shouldGetExceptionMessage = false, int? operationTimeout = null ) : T

Post data to ShipStation's endpoint with specific partner header value

PostDataAsync ( ShipStationCommand command, string jsonContent, CancellationToken token, int? operationTimeout = null ) : Task

Post data to ShipStation's endpoint async

WebRequestServices ( ShipStationCredentials credentials ) : System

Private Methods

Method Description
CreateAuthenticationHeader ( ) : string
GetExceptionMessageFromResponse ( WebException ex, string responseString ) : string
GetRawResponseAsync ( string url, CancellationToken token, int? operationTimeout = null ) : Task

Get data from ShipStation's endpoint async

InitSecurityProtocol ( ) : void
IsRequestThrottled ( HttpResponseMessage responseMessage, string responseContent, int &rateResetInSeconds ) : bool
LogPostError ( string apiKey, string url, HttpStatusCode statusCode, string jsonContent, WebException x ) : void
LogPostError ( string apiKey, string url, HttpStatusCode statusCode, string jsonContent, string responseString, int? operationTimeout ) : void
LogPostInfo ( string apiKey, string url, string jsonContent, int? operationTimeout ) : void
LogUpdateInfo ( string apiKey, string url, HttpStatusCode statusCode, string jsonContent, int? operationTimeout ) : void
ParseResponse ( string jsonData ) : T
PostRawDataAsync ( string url, string payload, CancellationToken token, bool shouldGetExceptionMessage = false, int? operationTimeout = null, bool useShipStationPartnerHeader = false ) : Task

Post data to ShipStation's API endpoint async

RefreshLastNetworkActivityTime ( ) : void

This method is used to update service's last network activity time. It's called every time before making API request to server or after handling the response.

SetAuthorizationHeader ( bool useShipStationPartnerHeader = false ) : void
ThrowIfError ( string url, HttpResponseMessage responseMessage, string responseContent ) : void

Method Details

CanSkipException() public method

public CanSkipException ( WebException e ) : bool
e WebException
return bool

GetApiKey() public method

public GetApiKey ( ) : string
return string

GetResponse() public method

Get response from ShipStation's endpoint
public GetResponse ( ShipStationCommand command, string commandParams, CancellationToken token, int? operationTimeout = null ) : T
command ShipStationCommand
commandParams string
token CancellationToken
operationTimeout int?
return T

GetResponseAsync() public method

Get response from ShipStation's endpoint async
public GetResponseAsync ( ShipStationCommand command, string commandParams, CancellationToken token, int? operationTimeout = null ) : Task
command ShipStationCommand
commandParams string
token CancellationToken
operationTimeout int?
return Task

PostData() public method

Post data to ShipStation's endpoint
public PostData ( ShipStationCommand command, string jsonContent, CancellationToken token, int? operationTimeout = null ) : void
command ShipStationCommand
jsonContent string
token CancellationToken
operationTimeout int?
return void

PostDataAndGetResponse() public method

Post data to ShipStation's endpoint and read response
public PostDataAndGetResponse ( ShipStationCommand command, string jsonContent, CancellationToken token, bool shouldGetExceptionMessage = false, int? operationTimeout = null ) : T
command ShipStationCommand
jsonContent string
token CancellationToken
shouldGetExceptionMessage bool
operationTimeout int?
return T

PostDataAndGetResponseAsync() public method

Post data to ShipStation's endpoint and read response async
public PostDataAndGetResponseAsync ( ShipStationCommand command, string jsonContent, CancellationToken token, bool shouldGetExceptionMessage = false, int? operationTimeout = null ) : Task
command ShipStationCommand
jsonContent string
token CancellationToken
shouldGetExceptionMessage bool
operationTimeout int?
return Task

PostDataAndGetResponseWithShipstationHeader() public method

Post data to ShipStation's endpoint with specific partner header value
public PostDataAndGetResponseWithShipstationHeader ( ShipStationCommand command, string jsonContent, CancellationToken token, bool shouldGetExceptionMessage = false, int? operationTimeout = null ) : T
command ShipStationCommand
jsonContent string
token CancellationToken
shouldGetExceptionMessage bool
operationTimeout int?
return T

PostDataAsync() public method

Post data to ShipStation's endpoint async
public PostDataAsync ( ShipStationCommand command, string jsonContent, CancellationToken token, int? operationTimeout = null ) : Task
command ShipStationCommand
jsonContent string
token CancellationToken
operationTimeout int?
return Task

WebRequestServices() public method

public WebRequestServices ( ShipStationCredentials credentials ) : System
credentials ShipStationCredentials
return System