API client is mainly responible for making the HTTP call to the API backend.
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthenticationMethodsApi"/> class.
 /// </summary>
 /// <param name="apiClient"> an instance of ApiClient (optional)</param>
 /// <returns></returns>
 public AuthenticationMethodsApi(ApiClient apiClient = null)
 {
     if (apiClient == null) // use the default one in Configuration
         this.ApiClient = Configuration.DefaultApiClient; 
     else
         this.ApiClient = apiClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="VariableUserSourceApi"/> class.
 /// </summary>
 /// <param name="apiClient"> an instance of ApiClient (optional)</param>
 /// <returns></returns>
 public VariableUserSourceApi(ApiClient apiClient = null)
 {
     if (apiClient == null) // use the default one in Configuration
         this.ApiClient = Configuration.DefaultApiClient;
     else
         this.ApiClient = apiClient;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StoreApi"/> class.
 /// </summary>
 /// <param name="apiClient"> an instance of ApiClient (optional)</param>
 /// <returns></returns>
 public StoreApi(ApiClient apiClient = null)
 {
     if (apiClient == null) // use the default one in Configuration
         this.ApiClient = Configuration.DefaultApiClient; 
     else
         this.ApiClient = apiClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConversionApi"/> class.
 /// </summary>
 /// <param name="apiClient"> an instance of ApiClient (optional)
 /// <returns></returns>
 public ConversionApi(ApiClient apiClient = null) {
   if (apiClient == null) { // use the default one in Configuration
     this.apiClient = Configuration.apiClient; 
   } else {
     this.apiClient = apiClient;
   }
 }
        /// <summary>
        /// Initializes a new instance of the Configuration class with different settings
        /// </summary>
        /// <param name="apiClient">Api client</param>
        /// <param name="defaultHeader">Dictionary of default HTTP header</param>
        /// <param name="username">Username</param>
        /// <param name="password">Password</param>
        /// <param name="accessToken">accessToken</param>
        /// <param name="apiKey">Dictionary of API key</param>
        /// <param name="apiKeyPrefix">Dictionary of API key prefix</param>
        /// <param name="tempFolderPath">Temp folder path</param>
        /// <param name="dateTimeFormat">DateTime format string</param>
        /// <param name="timeout">HTTP connection timeout (in milliseconds)</param>
        /// <param name="userAgent">HTTP user agent</param>
        public Configuration(ApiClient apiClient = null,
                             Dictionary<String, String> defaultHeader = null,
                             string username = null,
                             string password = null,
                             string accessToken = null,
                             Dictionary<String, String> apiKey = null,
                             Dictionary<String, String> apiKeyPrefix = null,
                             string tempFolderPath = null,
                             string dateTimeFormat = null,
                             int timeout = 100000,
                             string userAgent = "Swagger-Codegen/1.0.0/csharp"
                            )
        {
            setApiClientUsingDefault(apiClient);

            Username = username;
            Password = password;
            AccessToken = accessToken;
            UserAgent = userAgent;

            if (defaultHeader != null)
                DefaultHeader = defaultHeader;
            if (apiKey != null)
                ApiKey = apiKey;
            if (apiKeyPrefix != null)
                ApiKeyPrefix = apiKeyPrefix;

            TempFolderPath = tempFolderPath;
            DateTimeFormat = dateTimeFormat;
            Timeout = timeout;
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the Configuration class with different settings
        /// </summary>
        /// <param name="apiClient">Api client</param>
        /// <param name="defaultHeader">Dictionary of default HTTP header</param>
        /// <param name="username">Username</param>
        /// <param name="password">Password</param>
        /// <param name="accessToken">accessToken</param>
        /// <param name="apiKey">Dictionary of API key</param>
        /// <param name="apiKeyPrefix">Dictionary of API key prefix</param>
        /// <param name="tempFolderPath">Temp folder path</param>
        /// <param name="dateTimeFormat">DateTime format string</param>
        /// <param name="timeout">HTTP connection timeout (in milliseconds)</param>
        public Configuration(ApiClient apiClient = null,
                             Dictionary<String, String> defaultHeader = null,
                             string username = null,
                             string password = null,
                             string accessToken = null,
                             Dictionary<String, String> apiKey = null,
                             Dictionary<String, String> apiKeyPrefix = null,
                             string tempFolderPath = null,
                             string dateTimeFormat = null,
                             int timeout = 100000
                            )
        {
            if (apiClient == null)
                ApiClient = ApiClient.Default;
            else 
                ApiClient = apiClient;

            Username = username;
            Password = password;
            AccessToken = accessToken;

            if (defaultHeader != null)
                DefaultHeader = defaultHeader;
            if (apiKey != null)
                ApiKey = apiKey;
            if (apiKeyPrefix != null)
                ApiKeyPrefix = apiKeyPrefix;

            TempFolderPath = tempFolderPath;
            DateTimeFormat = dateTimeFormat;
            Timeout = timeout;
        }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the Configuration class.
 /// </summary>
 /// <param name="apiClient">Api client.</param>
 public Configuration(ApiClient apiClient)
 {
     if (apiClient == null)
         ApiClient = ApiClient.Default;
     else 
         ApiClient = apiClient;
 }
Пример #8
0
		public void TestParameterToStringWithTimeZoneForDateTime ()
		{
			ApiClient api = new ApiClient ();
			// test datetime with a time zone
			DateTimeOffset dateWithTz = DateTimeOffset.Parse("2008-04-10T13:30:00.0000000-04:00", null, System.Globalization.DateTimeStyles.RoundtripKind);
			Assert.AreEqual("2008-04-10T13:30:00.0000000-04:00", api.ParameterToString(dateWithTz));
		}
Пример #9
0
        static void Main(string[] args)
        {
            Configuration.ApiKey.Add("_apikey", "ef0eaa14199a40acb6d21099a5ef6b5e5fe650c545317c92eb31cd5cc33ada7112e337c68d642d3e336a19ac2bbf8eb008adceda71366d9fcf91b48cb13b1c8796dce23c3edaa03a415326818b9b0cf2");

            ApiClient client = new ApiClient();

            MagicMethodsApi mc = new MagicMethodsApi(client);
            var result= mc.Magic("http://vashmagazin.ua/nerukhomist/kvartyry/", true, 1, "");
        }
Пример #10
0
        public void TestParameterToString_DateTime_WithCustomFormat()
        {
            // Setup the DateTimeFormat across all of the calls
            Configuration.DateTimeFormat = "dd/MM/yy HH:mm:ss";
            ApiClient api = new ApiClient();

            // test datetime
            DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind);
            Assert.AreEqual("15/06/09 20:45:30", api.ParameterToString(dateUtc));
        }
        public AssetServerTests()
        {
            client = new ApiClient(Resource.Base);
            client.AddDefaultHeader("Cache-Control", "no-cache");
            api = new AssetServersApi(client);

            httpClient = new HttpClient();
            httpClient.BaseAddress = new Uri(Resource.Base);
            httpClient.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
        }
Пример #12
0
		public void TestParameterToStringForDateTimeWithUFormat ()
		{
			// Setup the DateTimeFormat across all of the calls
			Configuration.Default.DateTimeFormat = "u";
			ApiClient api = new ApiClient();

			// test datetime
			DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind);
			Assert.AreEqual("2009-06-15 20:45:30Z", api.ParameterToString(dateUtc));
		}
Пример #13
0
		public void TestSelectHeaderContentType ()
		{	
			ApiClient api = new ApiClient ();
			String[] contentTypes = new String[] { "application/json", "application/xml" };
			Assert.AreEqual("application/json", api.SelectHeaderContentType (contentTypes));

			contentTypes = new String[] { "application/xml" };
			Assert.AreEqual("application/xml", api.SelectHeaderContentType (contentTypes));

			contentTypes = new String[] {};
			Assert.IsNull(api.SelectHeaderContentType (contentTypes));	
		}
Пример #14
0
		public void TestParameterToString ()
		{	
			ApiClient api = new ApiClient ();

			// test array of string
			List<string> statusList = new List<String>(new String[] {"available", "sold"});
			Assert.AreEqual("available,sold", api.ParameterToString (statusList));

			// test array of int
			List<int> numList = new List<int>(new int[] {1, 37});
			Assert.AreEqual("1,37", api.ParameterToString (numList));
		}
Пример #15
0
		public void TestParameterToStringForDateTime ()
		{
			ApiClient api = new ApiClient ();

			// test datetime
			DateTime dateUtc = DateTime.Parse ("2008-04-10T13:30:00.0000000z", null, System.Globalization.DateTimeStyles.RoundtripKind);
			Assert.AreEqual ("2008-04-10T13:30:00.0000000Z", api.ParameterToString (dateUtc));

			// test datetime with no timezone
			DateTime dateWithNoTz = DateTime.Parse ("2008-04-10T13:30:00.000", null, System.Globalization.DateTimeStyles.RoundtripKind);
			Assert.AreEqual ("2008-04-10T13:30:00.0000000", api.ParameterToString (dateWithNoTz));
		}
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FeatureApi"/> class.
 /// </summary>
 /// <param name="apiClient"> an instance of ApiClient (optional)</param>
 /// <returns></returns>
 public FeatureApi(ApiClient apiClient = null)
 {
     ApiClient = apiClient ?? Configuration.DefaultApiClient;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AssetDatabasesApi"/> class.
 /// </summary>
 /// <param name="apiClient"> an instance of ApiClient (optional)</param>
 /// <returns></returns>
 public AssetDatabasesApi(ApiClient apiClient = null)
 {
     if (apiClient == null) // use the default one in Configuration
         this.ApiClient = Configuration.DefaultApiClient; 
     else
         this.ApiClient = apiClient;
 }
Пример #18
0
		public void TestApiClientInstance ()
		{
			PetApi p1 = new PetApi ();
			PetApi p2 = new PetApi ();

			Configuration c1 = new Configuration (); // using default ApiClient
			PetApi p3 = new PetApi (c1);

			ApiClient a1 = new ApiClient();
			Configuration c2 = new Configuration (a1); // using "a1" as the ApiClient
			PetApi p4 = new PetApi (c2);


			// ensure both using the same default ApiClient
			Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient);
			Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient);

			// ensure both using the same default ApiClient
			Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient);
			Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient);

			// ensure it's not using the default ApiClient
			Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient);
			Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient);

		}
 /// <summary>
 /// Initializes a new instance of the Configuration class.
 /// </summary>
 /// <param name="apiClient">Api client.</param>
 public Configuration(ApiClient apiClient)
 {
     setApiClientUsingDefault(apiClient);
 }
        /// <summary>
        /// Set the ApiClient using Default or ApiClient instance.
        /// </summary>
        /// <param name="apiClient">An instance of ApiClient.</param>
        /// <returns></returns>
        public void setApiClientUsingDefault (ApiClient apiClient = null)
        {
            if (apiClient == null)
            {
                if (Default != null && Default.ApiClient == null)
                    Default.ApiClient = new ApiClient();

                ApiClient = Default != null ? Default.ApiClient : new ApiClient();
            }
            else
            {
                if (Default != null && Default.ApiClient == null)
                    Default.ApiClient = apiClient;

                ApiClient = apiClient;
            }
        }
		public void TestUsage ()
		{
			// basic use case using default base URL
			PetApi p1 = new PetApi (); 
			Assert.AreSame (p1.Configuration, Configuration.Default, "PetApi should use default configuration");

			// using a different base URL
			PetApi p2 = new PetApi ("http://new-base-url.com/");
			Assert.AreEqual (p2.Configuration.ApiClient.RestClient.BaseUrl.ToString(), "http://new-base-url.com/");

			// using a different configuration
			Configuration c1 = new Configuration ();
			PetApi p3 = new PetApi (c1);
			Assert.AreSame (p3.Configuration, c1);

			// using a different base URL via a new ApiClient
			ApiClient a1 = new ApiClient ("http://new-api-client.com");
			Configuration c2 = new Configuration (a1);
			PetApi p4 = new PetApi (c2);
			Assert.AreSame (p4.Configuration.ApiClient, a1);
		}
Пример #22
0
 public void Init(string server)
 {
     this.subscriptions = new Dictionary<string, Subscription>();
     this.server = server;
     client = new ApiClient(server + "/api");            
     layers = new LayerApi(client);
     features = new FeatureApi(client); 
     resources = new ResourceApi(client);           
     InitSocketConnection();
     //TestApis();
     
 }
Пример #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FeatureApi"/> class.
 /// </summary>
 /// <returns></returns>
 public FeatureApi(string basePath)
 {
     ApiClient = new ApiClient(basePath);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AggregatedCorrelationApi"/> class.
 /// </summary>
 /// <param name="apiClient"> an instance of ApiClient (optional)</param>
 /// <returns></returns>
 public AggregatedCorrelationApi(ApiClient apiClient = null)
 {
     if (apiClient == null) // use the default one in Configuration
         this.ApiClient = Configuration.DefaultApiClient;
     else
         this.ApiClient = apiClient;
 }