Systran.MultimodalClientLib.Client.ApiClient.CallApiAsync C# (CSharp) Method

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
    public async Task<Object> CallApiAsync(String Path, RestSharp.Method Method, Dictionary<String, String> QueryParams, String PostBody,
      Dictionary<String, String> HeaderParams, Dictionary<String, String> FormParams, Dictionary<String, String> FileParams, String[] AuthSettings) {
      var request = new RestRequest(Path, Method);

      UpdateParamsForAuth(QueryParams, HeaderParams, AuthSettings);

      // add default header, if any
      foreach(KeyValuePair<string, string> defaultHeader in this.defaultHeaderMap)
        request.AddHeader(defaultHeader.Key, defaultHeader.Value);

      // add header parameter, if any
      foreach(KeyValuePair<string, string> param in HeaderParams)
        request.AddHeader(param.Key, param.Value);
     
      // add query parameter, if any
      foreach(KeyValuePair<string, string> param in QueryParams)
        request.AddQueryParameter(param.Key, param.Value);

        // add form parameter, if any
        foreach (KeyValuePair<string, string> param in FormParams)
            request.AddParameter(param.Key, param.Value);

        // add file parameter, if any
        foreach (KeyValuePair<string, string> param in FileParams)
            {
                request.AddFile(param.Key, param.Value);
                request.Method = Method.POST;
            }
            if (PostBody != null) {
                request.AddParameter("application/json", PostBody, ParameterType.RequestBody); // http body (model) parameter

            }
            return (Object) await restClient.ExecuteTaskAsync(request);

    }