C# Class RingCentral.Platform

ファイルを表示 Open project: ringcentral/ringcentral-csharp Class Usage Examples

Public Methods

Method Description
Authenticate ( string authCode, string redirectUri ) : ApiResponse

Do authentication with the authorization code returned from server

AuthorizeUri ( string redirectUri, string state = "" ) : string

When your application needs to authentiate an user, redirect the user to RingCentral API server for authentication. This method helps you to build the URI. Later you can redirect user to this URI.

Delete ( Request request ) : ApiResponse
Get ( Request request ) : ApiResponse
LoggedIn ( ) : bool

Determines if Access is valid and returns the boolean result. If access is not valid but refresh token is valid then a refresh is issued.

Login ( string username, string extension, string password, bool remember ) : ApiResponse

Method to generate Access Token to establish an authenticated session

Logout ( ) : ApiResponse

Revokes the already granted access to stop application activity

Platform ( string appKey, string appSecret, string serverUrl, string appName = "", string appVersion = "" ) : System
Post ( Request request ) : ApiResponse
Put ( Request request ) : ApiResponse
Refresh ( ) : ApiResponse

Refreshes expired Access token during valid lifetime of Refresh Token

Send ( HttpMethod httpMethod, Request request ) : ApiResponse

Private Methods

Method Description
AuthCall ( Request request ) : ApiResponse

Authentication, Refresh and Revoke requests all require an Authentication Header Value of "Basic". This is a special method to handle those requests.

GenerateAuthToken ( ) : string

Generates auth token by encoding appKey and appSecret then converting it to base64

SetUserAgentHeader ( string appName, string appVersion ) : void

You also may supply custom AppName:AppVersion in the form of a header with your application codename and version. These parameters are optional but they will help a lot to identify your application in API logs and speed up any potential troubleshooting. Allowed characters for AppName:AppVersion are- letters, digits, hyphen, dot and underscore.

Method Details

Authenticate() public method

Do authentication with the authorization code returned from server
public Authenticate ( string authCode, string redirectUri ) : ApiResponse
authCode string The authorization code returned from server
redirectUri string The same redirectUri when you were obtaining the authCode in previous step
return RingCentral.Http.ApiResponse

AuthorizeUri() public method

When your application needs to authentiate an user, redirect the user to RingCentral API server for authentication. This method helps you to build the URI. Later you can redirect user to this URI.
public AuthorizeUri ( string redirectUri, string state = "" ) : string
redirectUri string This is a callback URI which determines where the response will be sent to. The value of this parameter must exactly match one of the URIs you have provided for your app upon registration. This URI can be HTTP/HTTPS address for web applications or custom scheme URI for mobile or desktop applications.
state string Optional, recommended. An opaque value used by the client to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client. The parameter should be used for preventing cross-site request forgery
return string

Delete() public method

public Delete ( Request request ) : ApiResponse
request RingCentral.Http.Request
return RingCentral.Http.ApiResponse

Get() public method

public Get ( Request request ) : ApiResponse
request RingCentral.Http.Request
return RingCentral.Http.ApiResponse

LoggedIn() public method

Determines if Access is valid and returns the boolean result. If access is not valid but refresh token is valid then a refresh is issued.
public LoggedIn ( ) : bool
return bool

Login() public method

Method to generate Access Token to establish an authenticated session
public Login ( string username, string extension, string password, bool remember ) : ApiResponse
username string Username of RingCentral user
extension string Optional: Extension number to login
password string Password of the RingCentral User
remember bool If set to true, refresh token TTL will be one week, otherwise it's 10 hours
return RingCentral.Http.ApiResponse

Logout() public method

Revokes the already granted access to stop application activity
public Logout ( ) : ApiResponse
return RingCentral.Http.ApiResponse

Platform() public method

public Platform ( string appKey, string appSecret, string serverUrl, string appName = "", string appVersion = "" ) : System
appKey string
appSecret string
serverUrl string
appName string
appVersion string
return System

Post() public method

public Post ( Request request ) : ApiResponse
request RingCentral.Http.Request
return RingCentral.Http.ApiResponse

Put() public method

public Put ( Request request ) : ApiResponse
request RingCentral.Http.Request
return RingCentral.Http.ApiResponse

Refresh() public method

Refreshes expired Access token during valid lifetime of Refresh Token
public Refresh ( ) : ApiResponse
return RingCentral.Http.ApiResponse

Send() public method

public Send ( HttpMethod httpMethod, Request request ) : ApiResponse
httpMethod HttpMethod
request RingCentral.Http.Request
return RingCentral.Http.ApiResponse