C# Class Systran.NlpClientLib.Client.ApiClient

API client is mainly responible for making the HTTP call to the API backend
显示文件 Open project: SYSTRAN/nlp-api-csharp-client Class Usage Examples

Public Methods

Method Description
AddDefaultHeader ( string key, string value ) : void

Add default header

ApiClient ( String basePath = "https://localhost:8202/" ) : System

Initializes a new instance of the ApiClient class.

Base64Encode ( string text ) : string

Encode string in base64 format

CallApi ( String Path, RestSharp Method, String>.Dictionary QueryParams, String PostBody, String>.Dictionary HeaderParams, String>.Dictionary FormParams, String>.Dictionary FileParams, String AuthSettings ) : Object
CallApiAsync ( String Path, RestSharp Method, String>.Dictionary QueryParams, String PostBody, String>.Dictionary HeaderParams, String>.Dictionary FormParams, String>.Dictionary FileParams, String AuthSettings ) : Task
Deserialize ( string content, Type type ) : object

Deserialize the JSON string into a proper object

EscapeString ( string str ) : string

escape string (url-encoded)

GetApiKeyWithPrefix ( string apiKey ) : string

Get the API key with prefix

GetDefaultHeader ( ) : String>.Dictionary

Get default header

ParameterToString ( object obj ) : string

if parameter is DateTime, output in ISO8601 format if parameter is a list of string, join the list with "," otherwise just return the string

Serialize ( object obj ) : string

Serialize an object into JSON string

UpdateParamsForAuth ( String>.Dictionary QueryParams, String>.Dictionary HeaderParams, string AuthSettings ) : void

Update parameters based on authentication

Method Details

AddDefaultHeader() public method

Add default header
public AddDefaultHeader ( string key, string value ) : void
key string
value string
return void

ApiClient() public method

Initializes a new instance of the ApiClient class.
public ApiClient ( String basePath = "https://localhost:8202/" ) : System
basePath String The base path.
return System

Base64Encode() public static method

Encode string in base64 format
public static Base64Encode ( string text ) : string
text string String to be encoded
return string

CallApi() public method

public CallApi ( String Path, RestSharp Method, String>.Dictionary QueryParams, String PostBody, String>.Dictionary HeaderParams, String>.Dictionary FormParams, String>.Dictionary FileParams, String AuthSettings ) : Object
Path String
Method RestSharp
QueryParams String>.Dictionary
PostBody String
HeaderParams String>.Dictionary
FormParams String>.Dictionary
FileParams String>.Dictionary
AuthSettings String
return Object

CallApiAsync() public method

public CallApiAsync ( String Path, RestSharp Method, String>.Dictionary QueryParams, String PostBody, String>.Dictionary HeaderParams, String>.Dictionary FormParams, String>.Dictionary FileParams, String AuthSettings ) : Task
Path String
Method RestSharp
QueryParams String>.Dictionary
PostBody String
HeaderParams String>.Dictionary
FormParams String>.Dictionary
FileParams String>.Dictionary
AuthSettings String
return Task

Deserialize() public method

Deserialize the JSON string into a proper object
public Deserialize ( string content, Type type ) : object
content string
type System.Type
return object

EscapeString() public method

escape string (url-encoded)
public EscapeString ( string str ) : string
str string
return string

GetApiKeyWithPrefix() public method

Get the API key with prefix
public GetApiKeyWithPrefix ( string apiKey ) : string
apiKey string
return string

GetDefaultHeader() public method

Get default header
public GetDefaultHeader ( ) : String>.Dictionary
return String>.Dictionary

ParameterToString() public method

if parameter is DateTime, output in ISO8601 format if parameter is a list of string, join the list with "," otherwise just return the string
public ParameterToString ( object obj ) : string
obj object
return string

Serialize() public method

Serialize an object into JSON string
public Serialize ( object obj ) : string
obj object
return string

UpdateParamsForAuth() public method

Update parameters based on authentication
public UpdateParamsForAuth ( String>.Dictionary QueryParams, String>.Dictionary HeaderParams, string AuthSettings ) : void
QueryParams String>.Dictionary Query parameters
HeaderParams String>.Dictionary Header parameters
AuthSettings string Authentication settings
return void