/*
* Service Collaborateur API
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Linq;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using RestSharp;
namespace IO.Swagger.ClientCollaborateur
{
///
/// API client is mainly responsible for making the HTTP call to the API backend.
///
public partial class ApiClient
{
private JsonSerializerSettings serializerSettings = new JsonSerializerSettings
{
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
};
///
/// Allows for extending request processing for generated code.
///
/// The RestSharp request object
partial void InterceptRequest(IRestRequest request);
///
/// Allows for extending response processing for generated code.
///
/// The RestSharp request object
/// The RestSharp response object
partial void InterceptResponse(IRestRequest request, IRestResponse response);
///
/// Initializes a new instance of the class
/// with default configuration.
///
public ApiClient()
{
Configuration = IO.Swagger.ClientCollaborateur.Configuration.Default;
RestClient = new RestClient("https://virtserver.swaggerhub.com/LilianG/Service-Collaborateur/1.1.1");
}
///
/// Initializes a new instance of the class
/// with default base path (https://virtserver.swaggerhub.com/LilianG/Service-Collaborateur/1.1.1).
///
/// An instance of Configuration.
public ApiClient(Configuration config)
{
Configuration = config ?? IO.Swagger.ClientCollaborateur.Configuration.Default;
RestClient = new RestClient(Configuration.BasePath);
}
///
/// Initializes a new instance of the class
/// with default configuration.
///
/// The base path.
public ApiClient(String basePath = "https://localhost:3000")
{
if (String.IsNullOrEmpty(basePath))
throw new ArgumentException("basePath cannot be empty");
RestClient = new RestClient(basePath);
Configuration = ClientCollaborateur.Configuration.Default;
}
///
/// Gets or sets the default API client for making HTTP calls.
///
/// The default API client.
[Obsolete("ApiClient.Default is deprecated, please use 'Configuration.Default.ApiClient' instead.")]
public static ApiClient Default;
///
/// Gets or sets an instance of the IReadableConfiguration.
///
/// An instance of the IReadableConfiguration.
///
/// helps us to avoid modifying possibly global
/// configuration values from within a given client. It does not guarantee thread-safety
/// of the instance in any way.
///
public IReadableConfiguration Configuration { get; set; }
///
/// Gets or sets the RestClient.
///
/// An instance of the RestClient
public RestClient RestClient { get; set; }
// Creates and sets up a RestRequest prior to a call.
private RestRequest PrepareRequest(
String path, RestSharp.Method method, List> queryParams, Object postBody,
Dictionary headerParams, Dictionary formParams,
Dictionary fileParams, Dictionary pathParams,
String contentType)
{
var request = new RestRequest(path, method);
// add path parameter, if any
foreach(var param in pathParams)
request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment);
// add header parameter, if any
foreach(var param in headerParams)
request.AddHeader(param.Key, param.Value);
// add query parameter, if any
foreach(var param in queryParams)
request.AddQueryParameter(param.Key, param.Value);
// add form parameter, if any
foreach(var param in formParams)
request.AddParameter(param.Key, param.Value);
// add file parameter, if any
foreach(var param in fileParams)
{
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentLength, param.Value.ContentType);
}
if (postBody != null) // http body (model or byte[]) parameter
{
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
}
return request;
}
///
/// Makes the HTTP request (Sync).
///
/// URL path.
/// HTTP method.
/// Query parameters.
/// HTTP body (POST request).
/// Header parameters.
/// Form parameters.
/// File parameters.
/// Path parameters.
/// Content Type of the request
/// Object
public Object CallApi(
String path, RestSharp.Method method, List> queryParams, Object postBody,
Dictionary headerParams, Dictionary formParams,
Dictionary fileParams, Dictionary pathParams,
String contentType)
{
var request = PrepareRequest(
path, method, queryParams, postBody, headerParams, formParams, fileParams,
pathParams, contentType);
// set timeout
RestClient.Timeout = Configuration.Timeout;
// set user agent
RestClient.UserAgent = Configuration.UserAgent;
InterceptRequest(request);
var response = RestClient.Execute(request);
InterceptResponse(request, response);
return (Object) response;
}
///
/// Makes the asynchronous HTTP request.
///
/// URL path.
/// HTTP method.
/// Query parameters.
/// HTTP body (POST request).
/// Header parameters.
/// Form parameters.
/// File parameters.
/// Path parameters.
/// Content type.
/// The Task instance.
public async System.Threading.Tasks.Task