Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericDataProvider" /> class.
        /// </summary>
        /// <param name="credentials">The credentials.</param>
        /// <param name="method">The method.</param>
        internal GenericDataProvider(SwiftCreadentials credentials, HttpMethod method)
        {
            this.Endpoint = credentials.Endpoint;

            this.HeaderParams = new Dictionary <string, string>();
            this.HeaderParams.Add("X-Auth-Token", credentials.Token);

            switch (method)
            {
            case HttpMethod.Delete:
                this.Method = "DELETE";
                break;

            case HttpMethod.Get:
                this.Method = "GET";
                break;

            case HttpMethod.Head:
                this.Method = "HEAD";
                break;

            case HttpMethod.Put:
                this.Method = "PUT";
                break;
            }

            this.QueryParams = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(credentials.Tenant) == false)
            {
                this.QueryParams.Add("tenant_id", credentials.Tenant);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericDataProvider" /> class.
        /// </summary>
        /// <param name="credentials">The credentials.</param>
        /// <param name="method">The method.</param>
        internal GenericDataProvider(SwiftCreadentials credentials, HttpMethod method)
        {
            this.Endpoint = credentials.Endpoint;

            this.HeaderParams = new Dictionary<string, string>();
            this.HeaderParams.Add("X-Auth-Token", credentials.Token);
            
            switch(method)
            {
                case HttpMethod.Delete:
                    this.Method = "DELETE";
                    break;
                case HttpMethod.Get:
                    this.Method = "GET";
                    break;
                case HttpMethod.Head:
                    this.Method = "HEAD";
                    break;
                case HttpMethod.Put:
                    this.Method = "PUT";
                    break;
            }
            
            this.QueryParams = new Dictionary<string, string>();

            if (string.IsNullOrEmpty(credentials.Tenant) == false)
            {
                this.QueryParams.Add("tenant_id", credentials.Tenant);
            }
        }