C# Класс pokitdokcsharp.OauthApplicationClient

Oauth 2.0 Client implementing Client Credentials Grant Authorization http://tools.ietf.org/html/rfc6749#section-4.4
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
_accessTokenRenewer System.Threading.Timer

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

Authenticate() публичный Метод

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
Результат OauthAccessToken

CreateRequest() публичный Метод

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)
Результат System.Net.HttpWebRequest

DeAuthenticate() публичный Метод

Calls an endpoint on the PokitDok server to remove client access tokens.
public DeAuthenticate ( ) : OauthAccessToken
Результат OauthAccessToken

DeleteRequest() публичный Метод

Perform a DELETE request for the given resource
public DeleteRequest ( string requestPath ) : ResponseData
requestPath string Request path/resource
Результат ResponseData

GetRequest() публичный Метод

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.
Результат ResponseData

OauthApplicationClient() публичный Метод

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
Результат System

PostRequest() публичный Метод

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
Результат ResponseData

PostRequest() публичный Метод

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.
Результат ResponseData

PutRequest() публичный Метод

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.
Результат ResponseData

Описание свойств

_accessTokenRenewer публичное свойство

public Timer,System.Threading _accessTokenRenewer
Результат System.Threading.Timer