C# Class Systran.NlpClientLib.Client.ApiClient

API client is mainly responible for making the HTTP call to the API backend
Afficher le fichier Open project: SYSTRAN/nlp-api-csharp-client Class Usage Examples

Méthodes publiques

Méthode 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 méthode

Add default header
public AddDefaultHeader ( string key, string value ) : void
key string
value string
Résultat void

ApiClient() public méthode

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

Base64Encode() public static méthode

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

CallApi() public méthode

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
Résultat Object

CallApiAsync() public méthode

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
Résultat Task

Deserialize() public méthode

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

EscapeString() public méthode

escape string (url-encoded)
public EscapeString ( string str ) : string
str string
Résultat string

GetApiKeyWithPrefix() public méthode

Get the API key with prefix
public GetApiKeyWithPrefix ( string apiKey ) : string
apiKey string
Résultat string

GetDefaultHeader() public méthode

Get default header
public GetDefaultHeader ( ) : String>.Dictionary
Résultat String>.Dictionary

ParameterToString() public méthode

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
Résultat string

Serialize() public méthode

Serialize an object into JSON string
public Serialize ( object obj ) : string
obj object
Résultat string

UpdateParamsForAuth() public méthode

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
Résultat void