C# Class Socrata.ApiBase

Base class under which all Socrata classes inherit.
Show file Open project: socrata-archive/socrata-csharp-deprecated

Protected Properties

Property Type Description
_log log4net.ILog
appToken string
batchQueue List
credentials System.Net.NetworkCredential
httpBase string

Public Methods

Method Description
ApiBase ( ) : System
sendBatchRequest ( ) : void

Processess any batch requests saved up in the queue

Protected Methods

Method Description
GetRequest ( String url ) : JsonPayload

Performs a generic GET request on the API server

MapToJson ( string>.Dictionary data ) : Newtonsoft.Json.Linq.JObject
PostRequest ( String url, String parameters ) : JsonPayload

Performs a generice POST request on the API server

UploadFile ( String url, String file ) : JsonPayload

For uploading a file and returning JSON response.

genericWebRequest ( String url, String parameters, String method ) : JsonPayload
getAuthorization ( ) : string
responseIsClean ( JsonPayload response ) : bool

Checks response object to see if any errors are present

Method Details

ApiBase() public method

public ApiBase ( ) : System
return System

GetRequest() protected method

Performs a generic GET request on the API server
protected GetRequest ( String url ) : JsonPayload
url String The URL to request from
return JsonPayload

MapToJson() protected static method

protected static MapToJson ( string>.Dictionary data ) : Newtonsoft.Json.Linq.JObject
data string>.Dictionary
return Newtonsoft.Json.Linq.JObject

PostRequest() protected method

Performs a generice POST request on the API server
protected PostRequest ( String url, String parameters ) : JsonPayload
url String Where to send the post request
parameters String The data to accompany the post request
return JsonPayload

UploadFile() protected method

For uploading a file and returning JSON response.
protected UploadFile ( String url, String file ) : JsonPayload
url String Where to upload the file
file String The file location on disk
return JsonPayload

genericWebRequest() protected method

protected genericWebRequest ( String url, String parameters, String method ) : JsonPayload
url String
parameters String
method String
return JsonPayload

getAuthorization() protected method

protected getAuthorization ( ) : string
return string

responseIsClean() protected method

Checks response object to see if any errors are present
protected responseIsClean ( JsonPayload response ) : bool
response JsonPayload The JSON response returned from the server
return bool

sendBatchRequest() public method

Processess any batch requests saved up in the queue
public sendBatchRequest ( ) : void
return void

Property Details

_log protected static property

protected static ILog,log4net _log
return log4net.ILog

appToken protected property

protected string appToken
return string

batchQueue protected property

protected List batchQueue
return List

credentials protected property

protected NetworkCredential,System.Net credentials
return System.Net.NetworkCredential

httpBase protected property

protected string httpBase
return string