C# Class ForTheCommonGood.MorebitsDotNet

Mostrar archivo Open project: atlight/ForTheCommonGood Class Usage Examples

Public Properties

Property Type Description
LoginSessions LoginInfo>.Dictionary

Public Methods

Method Description
DefaultErrorHandler ( string message ) : void
DefaultErrorHandler ( string message, MessageBoxIcon icon ) : void
GetApi ( Wiki wiki, string queryString, object userToken, MorebitsDotNetGetSuccess onSuccess ) : void

Makes an HTTP GET request to the specified MediaWiki API endpoint.

GetDomain ( Wiki w ) : string
GetProtocol ( ) : string
LogIn ( Wiki wiki, string userName, string password, MorebitsDotNetLoginSuccess onSuccess, MorebitsDotNetError onError ) : void

Logs into the specified MediaWiki API endpoint.

PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess ) : void
PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void
PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError, string method ) : void

Makes an HTTP request to the specified MediaWiki API endpoint.

UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess ) : void
UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void

Uploads a file by making an HTTP POST request to the specified MediaWiki API endpoint.

Private Methods

Method Description
GetApiUri ( Wiki w ) : string
PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError, bool loggingIn, string method ) : void
TimeoutCallback ( object state, bool timedOut ) : void

Method Details

DefaultErrorHandler() public static method

public static DefaultErrorHandler ( string message ) : void
message string
return void

DefaultErrorHandler() public static method

public static DefaultErrorHandler ( string message, MessageBoxIcon icon ) : void
message string
icon MessageBoxIcon
return void

GetApi() public static method

Makes an HTTP GET request to the specified MediaWiki API endpoint.
public static GetApi ( Wiki wiki, string queryString, object userToken, MorebitsDotNetGetSuccess onSuccess ) : void
wiki Wiki The to contact.
queryString string The query string, to be appended to the URL after a "?" character. /// No escaping is performed.
userToken object A custom object that is passed on to the callback, for state tracking. /// Set to null if not required.
onSuccess MorebitsDotNetGetSuccess A function that will be called when the request is successful. /// The function is passed the string of response received, as well as the value of .
return void

GetDomain() public static method

public static GetDomain ( Wiki w ) : string
w Wiki
return string

GetProtocol() public static method

public static GetProtocol ( ) : string
return string

LogIn() public static method

Logs into the specified MediaWiki API endpoint.
public static LogIn ( Wiki wiki, string userName, string password, MorebitsDotNetLoginSuccess onSuccess, MorebitsDotNetError onError ) : void
wiki Wiki The to contact.
userName string The user name to use for the login attempt.
password string The password to use for the login attempt.
onSuccess MorebitsDotNetLoginSuccess A function that will be called when the login attempt is successful.
onError MorebitsDotNetError A function that will be called when the login attempt fails. /// The function is passed the error message string as its only parameter.
return void

PostApi() public static method

public static PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess ) : void
wiki Wiki
query System.Collections.Specialized.StringDictionary
onSuccess MorebitsDotNetPostSuccess
return void

PostApi() public static method

public static PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void
wiki Wiki
query System.Collections.Specialized.StringDictionary
onSuccess MorebitsDotNetPostSuccess
onError MorebitsDotNetError
return void

PostApi() public static method

Makes an HTTP request to the specified MediaWiki API endpoint.
public static PostApi ( Wiki wiki, StringDictionary query, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError, string method ) : void
wiki Wiki The to contact.
query System.Collections.Specialized.StringDictionary A dictionary of key-value pairs that represent the request parameters.
onSuccess MorebitsDotNetPostSuccess A function that will be called when the request is successful. /// The function is passed the XML response as its only parameter.
onError MorebitsDotNetError A function that will be called when the request fails. /// The function is passed the error message string as its only parameter.
method string The HTTP method to use. Use one of the constants in .
return void

UploadFile() public static method

public static UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess ) : void
wiki Wiki
query System.Collections.Specialized.StringDictionary
file byte
fileName string
fileParamName string
onSuccess MorebitsDotNetPostSuccess
return void

UploadFile() public static method

Uploads a file by making an HTTP POST request to the specified MediaWiki API endpoint.
public static UploadFile ( Wiki wiki, StringDictionary query, byte file, string fileName, string fileParamName, MorebitsDotNetPostSuccess onSuccess, MorebitsDotNetError onError ) : void
wiki Wiki The to contact.
query System.Collections.Specialized.StringDictionary A dictionary of key-value pairs that represent the request parameters.
file byte The file to upload, as a byte array of binary data.
fileName string The name of the file to upload.
fileParamName string The name (key) of the POST parameter whose value is the file data.
onSuccess MorebitsDotNetPostSuccess A function that will be called when the request is successful. /// The function is passed the XML response as its only parameter.
onError MorebitsDotNetError A function that will be called when the request fails. /// The function is passed the error message string as its only parameter.
return void

Property Details

LoginSessions public_oe static_oe property

public static Dictionary LoginSessions
return LoginInfo>.Dictionary