C# 클래스 DocRaptor.Client.ApiClient

API client is mainly responible for making the HTTP call to the API backend.
파일 보기 프로젝트 열기: DocRaptor/docraptor-csharp 1 사용 예제들

공개 메소드들

메소드 설명
ApiClient ( ) : System

Initializes a new instance of the ApiClient class with default configuration and base path (https://docraptor.com/).

ApiClient ( Configuration config = null ) : System

Initializes a new instance of the ApiClient class with default base path (https://docraptor.com/).

ApiClient ( String basePath = "https://docraptor.com/" ) : System

Initializes a new instance of the ApiClient class with default configuration.

Base64Encode ( string text ) : string

Encode string in base64 format.

CallApi ( String path, RestSharp method, String>.Dictionary queryParams, Object postBody, String>.Dictionary headerParams, String>.Dictionary formParams, FileParameter>.Dictionary fileParams, String>.Dictionary pathParams, String contentType ) : Object

Makes the HTTP request (Sync).

CallApiAsync ( String path, RestSharp method, String>.Dictionary queryParams, Object postBody, String>.Dictionary headerParams, String>.Dictionary formParams, FileParameter>.Dictionary fileParams, String>.Dictionary pathParams, String contentType ) : System.Threading.Tasks.Task

Makes the asynchronous HTTP request.

ConvertType ( dynamic source, Type dest ) : dynamic

Dynamically cast the object into target type. Ref: http://stackoverflow.com/questions/4925718/c-dynamic-runtime-cast

Deserialize ( IRestResponse response, Type type ) : object

Deserialize the JSON string into a proper object.

EscapeString ( string str ) : string

Escape string (url-encoded).

ParameterToFile ( string name, Stream stream ) : FileParameter

Create FileParameter based on Stream.

ParameterToString ( object obj ) : string

If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. If parameter is a list, join the list with ",". Otherwise just return the string.

ReadAsBytes ( Stream input ) : byte[]

Convert stream to byte array Credit/Ref: http://stackoverflow.com/a/221941/677735

SanitizeFilename ( string filename ) : string

Sanitize filename by removing the path

SelectHeaderAccept ( String accepts ) : String

Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; otherwise use all of them (joining into a string)

SelectHeaderContentType ( String contentTypes ) : String

Select the Content-Type header's value from the given content-type array: if JSON exists in the given array, use it; otherwise use the first one defined in 'consumes'

Serialize ( object obj ) : String

Serialize an input (model) into JSON string

UrlEncode ( string input ) : string

URL encode a string Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50

비공개 메소드들

메소드 설명
PrepareRequest ( String path, RestSharp method, String>.Dictionary queryParams, Object postBody, String>.Dictionary headerParams, String>.Dictionary formParams, FileParameter>.Dictionary fileParams, String>.Dictionary pathParams, String contentType ) : RestRequest

메소드 상세

ApiClient() 공개 메소드

Initializes a new instance of the ApiClient class with default configuration and base path (https://docraptor.com/).
public ApiClient ( ) : System
리턴 System

ApiClient() 공개 메소드

Initializes a new instance of the ApiClient class with default base path (https://docraptor.com/).
public ApiClient ( Configuration config = null ) : System
config Configuration An instance of Configuration.
리턴 System

ApiClient() 공개 메소드

Initializes a new instance of the ApiClient class with default configuration.
public ApiClient ( String basePath = "https://docraptor.com/" ) : System
basePath String The base path.
리턴 System

Base64Encode() 공개 정적인 메소드

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

CallApi() 공개 메소드

Makes the HTTP request (Sync).
public CallApi ( String path, RestSharp method, String>.Dictionary queryParams, Object postBody, String>.Dictionary headerParams, String>.Dictionary formParams, FileParameter>.Dictionary fileParams, String>.Dictionary pathParams, String contentType ) : Object
path String URL path.
method RestSharp HTTP method.
queryParams String>.Dictionary Query parameters.
postBody Object HTTP body (POST request).
headerParams String>.Dictionary Header parameters.
formParams String>.Dictionary Form parameters.
fileParams FileParameter>.Dictionary File parameters.
pathParams String>.Dictionary Path parameters.
contentType String Content Type of the request
리턴 Object

CallApiAsync() 공개 메소드

Makes the asynchronous HTTP request.
public CallApiAsync ( String path, RestSharp method, String>.Dictionary queryParams, Object postBody, String>.Dictionary headerParams, String>.Dictionary formParams, FileParameter>.Dictionary fileParams, String>.Dictionary pathParams, String contentType ) : System.Threading.Tasks.Task
path String URL path.
method RestSharp HTTP method.
queryParams String>.Dictionary Query parameters.
postBody Object HTTP body (POST request).
headerParams String>.Dictionary Header parameters.
formParams String>.Dictionary Form parameters.
fileParams FileParameter>.Dictionary File parameters.
pathParams String>.Dictionary Path parameters.
contentType String Content type.
리턴 System.Threading.Tasks.Task

ConvertType() 공개 정적인 메소드

Dynamically cast the object into target type. Ref: http://stackoverflow.com/questions/4925718/c-dynamic-runtime-cast
public static ConvertType ( dynamic source, Type dest ) : dynamic
source dynamic Object to be casted
dest System.Type Target type
리턴 dynamic

Deserialize() 공개 메소드

Deserialize the JSON string into a proper object.
public Deserialize ( IRestResponse response, Type type ) : object
response IRestResponse The HTTP response.
type System.Type Object type.
리턴 object

EscapeString() 공개 메소드

Escape string (url-encoded).
public EscapeString ( string str ) : string
str string String to be escaped.
리턴 string

ParameterToFile() 공개 메소드

Create FileParameter based on Stream.
public ParameterToFile ( string name, Stream stream ) : FileParameter
name string Parameter name.
stream Stream Input stream.
리턴 RestSharp.FileParameter

ParameterToString() 공개 메소드

If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. If parameter is a list, join the list with ",". Otherwise just return the string.
public ParameterToString ( object obj ) : string
obj object The parameter (header, path, query, form).
리턴 string

ReadAsBytes() 공개 정적인 메소드

Convert stream to byte array Credit/Ref: http://stackoverflow.com/a/221941/677735
public static ReadAsBytes ( Stream input ) : byte[]
input Stream Input stream to be converted
리턴 byte[]

SanitizeFilename() 공개 정적인 메소드

Sanitize filename by removing the path
public static SanitizeFilename ( string filename ) : string
filename string Filename
리턴 string

SelectHeaderAccept() 공개 메소드

Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; otherwise use all of them (joining into a string)
public SelectHeaderAccept ( String accepts ) : String
accepts String The accepts array to select from.
리턴 String

SelectHeaderContentType() 공개 메소드

Select the Content-Type header's value from the given content-type array: if JSON exists in the given array, use it; otherwise use the first one defined in 'consumes'
public SelectHeaderContentType ( String contentTypes ) : String
contentTypes String The Content-Type array to select from.
리턴 String

Serialize() 공개 메소드

Serialize an input (model) into JSON string
public Serialize ( object obj ) : String
obj object Object.
리턴 String

UrlEncode() 공개 정적인 메소드

URL encode a string Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50
public static UrlEncode ( string input ) : string
input string String to be URL encoded
리턴 string