C# Class pokitdokcsharp.OauthApplicationClient

Oauth 2.0 Client implementing Client Credentials Grant Authorization http://tools.ietf.org/html/rfc6749#section-4.4
Afficher le fichier Open project: pokitdok/pokitdok-csharp

Méthodes publiques

Свойство Type Description
_accessTokenRenewer System.Threading.Timer

Méthodes publiques

Méthode Description
Authenticate ( ) : OauthAccessToken

Get an access token and setup a timer to refresh the token

CreateRequest ( object>.Dictionary data, string url, string method, string content_type = "application/json" ) : HttpWebRequest

Forms the HttpWebRequest

DeAuthenticate ( ) : OauthAccessToken

Calls an endpoint on the PokitDok server to remove client access tokens.

DeleteRequest ( string requestPath ) : ResponseData

Perform a DELETE request for the given resource

GetRequest ( string requestPath, string>.Dictionary parameters = null ) : ResponseData

Perform a GET request given the http request path and a dictionary of query parameters.

OauthApplicationClient ( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string scope = null, string authCode = null ) : System

Initializes a new instance of the pokitdokcsharp.OauthApplicationClient class.

PostRequest ( string requestPath, object>.Dictionary postData ) : ResponseData

Perform a POST request given the http request path and a dictionary representing the JSON post body.

PostRequest ( string requestPath, string postFilePath, string postFileContentDispositionName, string postFileContentType, string>.Dictionary parameters = null ) : ResponseData

Perform a POST request given the http request path and a file to post with optional form field parameters.

PutRequest ( string requestPath, object>.Dictionary putData ) : ResponseData

Perform a PUT request given the uri and put data form fields

Private Methods

Méthode Description
AuthenticateAuthorizationCode ( ) : OauthAccessToken
AuthenticateClientCredentials ( ) : OauthAccessToken
AuthenticateRefreshToken ( ) : OauthAccessToken
AuthenticateRequest ( WebRequest webRequest, byte request_bytes ) : OauthAccessToken
GetPostStream ( string filePath, string fileContentType, string fileContentDispositionName, NameValueCollection formData, string boundary ) : Stream

Builds a Stream of multipart form data from file and form fields.

OnTokenExpiredCallback ( object stateInfo ) : void

Raises the token expired callback event.

ProcessResponse ( HttpWebResponse response ) : ResponseData

Processes the http response into a pokitdokcsharp.ResponseData object.

isAccessTokenExpired ( ) : bool

Check if the access token is expired

Method Details

Authenticate() public méthode

Get an access token and setup a timer to refresh the token
Thrown when authentication fails or /// when some unknown system error occurs.
public Authenticate ( ) : OauthAccessToken
Résultat OauthAccessToken

CreateRequest() public méthode

Forms the HttpWebRequest
public CreateRequest ( object>.Dictionary data, string url, string method, string content_type = "application/json" ) : HttpWebRequest
data object>.Dictionary data to be converted to JSON. Need to know the length
url string URL
method string post, put, delete, get
content_type string should always be application/json (default)
Résultat System.Net.HttpWebRequest

DeAuthenticate() public méthode

Calls an endpoint on the PokitDok server to remove client access tokens.
public DeAuthenticate ( ) : OauthAccessToken
Résultat OauthAccessToken

DeleteRequest() public méthode

Perform a DELETE request for the given resource
public DeleteRequest ( string requestPath ) : ResponseData
requestPath string Request path/resource
Résultat ResponseData

GetRequest() public méthode

Perform a GET request given the http request path and a dictionary of query parameters.
Thrown when unknown system error occurs.
public GetRequest ( string requestPath, string>.Dictionary parameters = null ) : ResponseData
requestPath string Request path.
parameters string>.Dictionary Dictionary of query parameters.
Résultat ResponseData

OauthApplicationClient() public méthode

Initializes a new instance of the pokitdokcsharp.OauthApplicationClient class.
public OauthApplicationClient ( string clientId, string clientSecret, int requestTimeout = DEFAULT_TIMEOUT, OauthAccessToken accessToken = null, Uri redirectUrl = null, TokenRefreshDelegate tokenRefresh = null, string scope = null, string authCode = null ) : System
clientId string Client identifier.
clientSecret string Client secret.
requestTimeout int Request timeout.
accessToken OauthAccessToken Access token.
redirectUrl System.Uri The Platform App redirect url.
tokenRefresh TokenRefreshDelegate Invoked when access token is refreshed.
scope string The requested scopes
authCode string The authorization code recieved by the scope grant of the Platform App
Résultat System

PostRequest() public méthode

Perform a POST request given the http request path and a dictionary representing the JSON post body.
Thrown when unknown system error occurs.
public PostRequest ( string requestPath, object>.Dictionary postData ) : ResponseData
requestPath string Request path.
postData object>.Dictionary Post data: dictionary representing JSON data
Résultat ResponseData

PostRequest() public méthode

Perform a POST request given the http request path and a file to post with optional form field parameters.
Thrown when unknown system error occurs.
public PostRequest ( string requestPath, string postFilePath, string postFileContentDispositionName, string postFileContentType, string>.Dictionary parameters = null ) : ResponseData
requestPath string Request path.
postFilePath string File system path of file data to be posted.
postFileContentDispositionName string Post file content disposition name.
postFileContentType string Post file content type.
parameters string>.Dictionary Dictionary of form data parameters.
Résultat ResponseData

PutRequest() public méthode

Perform a PUT request given the uri and put data form fields
public PutRequest ( string requestPath, object>.Dictionary putData ) : ResponseData
requestPath string Request path.
putData object>.Dictionary Put data: dictionary representing JSON data.
Résultat ResponseData

Property Details

_accessTokenRenewer public_oe property

public Timer,System.Threading _accessTokenRenewer
Résultat System.Threading.Timer