C# Class Speech_App1, API-Platform

Speech_App1 class
Inheritance: System.Web.UI.Page
Mostrar archivo Open project: attdevsupport/API-Platform

Protected Methods

Method Description
BtnSubmit_Click ( object sender, EventArgs e ) : void

Method that calls SpeechToText api when user clicked on submit button

Page_Load ( object sender, EventArgs e ) : void

This function is called when the application page is loaded into the web browser. This function reads the web.config file and gets the values of the attributes

Private Methods

Method Description
BypassCertificateError ( ) : void

Neglect the ssl handshake error with authentication server

ConvertToSpeech ( ) : void

This function invokes api SpeechToText to convert the given wav amr file and displays the result.

DisplayResult ( SpeechResponse, speechResponse ) : void

Displays the result onto the page

DrawPanelForFailure ( Panel panelParam, string message ) : void

Displays error message

DrawPanelForSuccess ( Panel panelParam, string message ) : void

Display success message

GetAccessToken ( AccessType type ) : bool

Get the access token based on Access Type

IsTokenValid ( ) : string

This function validates the expiry of the access token and refresh token. function compares the current time with the refresh token taken time, if current time is greater then returns INVALID_REFRESH_TOKEN function compares the difference of last access token taken time and the current time with the expiry seconds, if its more, returns INVALID_ACCESS_TOKEN otherwise returns VALID_ACCESS_TOKEN

IsValidFile ( string file ) : bool

Verifies whether the given file satisfies the criteria for speech api

MapContentTypeFromExtension ( string extension ) : string

Content type based on the file extension.

ReadAccessTokenFile ( ) : bool

This function reads the Access Token File and stores the values of access token, expiry seconds refresh token, last access token time and refresh token expiry time

ReadAndGetAccessToken ( ) : bool

Read access token file and validate the access token

ReadConfigFile ( ) : bool

Read parameters from configuraton file

Method Details

BtnSubmit_Click() protected method

Method that calls SpeechToText api when user clicked on submit button
protected BtnSubmit_Click ( object sender, EventArgs e ) : void
sender object sender that invoked this event
e EventArgs eventargs of the button
return void

Page_Load() protected method

This function is called when the application page is loaded into the web browser. This function reads the web.config file and gets the values of the attributes
protected Page_Load ( object sender, EventArgs e ) : void
sender object Button that caused this event
e EventArgs Event that invoked this function
return void