Exemple #1
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.MaxBufferSize = int.MaxValue;
            ModelClient mc = new ModelClient(binding, new EndpointAddress(new Uri(Application.Current.Host.Source, "../Silverlight/Model.svc")));

            //通过id获取详细信息    
            mc.GetModelByIDAsync(ID);
            mc.GetModelByIDCompleted += new EventHandler<GetModelByIDCompletedEventArgs>(sc_GetModelByIDCompleted);
        }
Exemple #2
0
        private void btn_Del_Click(object sender, RoutedEventArgs e)
        {
            Button b = sender as Button;
            string t = b.Tag.ToString();

            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.MaxBufferSize = int.MaxValue;
            ModelClient mc = new ModelClient(binding, new EndpointAddress(new Uri(Application.Current.Host.Source, "../Silverlight/Model.svc")));

            //通过id获取详细信息    
            mc.DelModelByIDAsync(long.Parse(t));
            mc.DelModelByIDCompleted += new EventHandler<DelModelByIDCompletedEventArgs>(sc_DelModelByIDCompleted);
        }
        /// <summary>
        /// To test special tags To test special tags and operation ID starting with number
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of ModelClient</returns>
        public Org.OpenAPITools.Client.ApiResponse <ModelClient> Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0)
        {
            // verify the required parameter 'modelClient' is set
            if (modelClient == null)
            {
                throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags");
            }

            Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = modelClient;

            localVarRequestOptions.Operation      = "AnotherFakeApi.Call123TestSpecialTags";
            localVarRequestOptions.OperationIndex = operationIndex;


            // make the HTTP request
            var localVarResponse = this.Client.Patch <ModelClient>("/another-fake/dummy", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #4
0
 public ModelsController(ManufacturerClient manufacturers, ModelClient models, IMapper mapper)
 {
     _manufacturers = manufacturers;
     _models        = models;
     _mapper        = mapper;
 }
Exemple #5
0
 private void btn_AddNewUser_Click(object sender, RoutedEventArgs e)
 {
     if (String.IsNullOrEmpty(txt_Name.Text))
     {
         txt_Name.Focus();
     }
     else if (String.IsNullOrEmpty(txt_SurName.Text))
     {
         txt_SurName.Focus();
     }
     else if (String.IsNullOrEmpty(txt_Login.Text))
     {
         txt_Login.Focus();
     }
     else if (String.IsNullOrEmpty(txt_Password.Text))
     {
         txt_Password.Focus();
     }
     else if (String.IsNullOrEmpty(txt_Email.Text))
     {
         txt_Email.Focus();
     }
     else if (String.IsNullOrEmpty(txt_Phone.Text))
     {
         txt_Phone.Focus();
     }
     else if (String.IsNullOrEmpty(txt_Country.Text))
     {
         txt_Country.Focus();
     }
     else if (String.IsNullOrEmpty(txt_City.Text))
     {
         txt_City.Focus();
     }
     else if (String.IsNullOrEmpty(txt_Street.Text))
     {
         txt_Street.Focus();
     }
     else
     {
         ModelClient client = new ModelClient();
         client.Name     = txt_Name.Text;
         client.SurName  = txt_SurName.Text;
         client.Login    = txt_Login.Text;
         client.Password = txt_Password.Text;
         client.Email    = txt_Email.Text;
         client.Phone    = txt_Phone.Text;
         using (Service1Client service1Client = new Service1Client())
         {
             bool Chak = service1Client.ChakLoginAddNewClient(txt_Login.Text);
             if (Chak == false)
             {
                 service1Client.AddClient(client, txt_City.Text, txt_Street.Text, txt_Country.Text);
                 Close();
             }
             else
             {
                 MessageBox.Show("Даний логін уже занятий", "Увага");
             }
         }
     }
 }
Exemple #6
0
        /// <summary>
        /// To test \&quot;client\&quot; model 
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>Task of ApiResponse (ModelClient)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientModelAsyncWithHttpInfo (ModelClient body)
        {
            // verify the required parameter 'body' is set
            if (body == null)
                throw new ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestClientModel");

            var localVarPath = "/fake";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new Dictionary<String, String>();
            var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("TestClientModel", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<ModelClient>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
            
        }
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task <ModelClient> TestClassnameAsync(ModelClient body)
        {
            Org.OpenAPITools.Client.ApiResponse <ModelClient> localVarResponse = await TestClassnameAsyncWithHttpInfo(body);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// To test special tags To test special tags and operation ID starting with number
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>ModelClient</returns>
        public ModelClient Call123TestSpecialTags(ModelClient body)
        {
            ApiResponse <ModelClient> localVarResponse = Call123TestSpecialTagsWithHttpInfo(body);

            return(localVarResponse.Data);
        }
Exemple #9
0
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task <ModelClient> TestClassnameAsync(ModelClient body, CancellationToken cancellationToken = default(CancellationToken))
        {
            ApiResponse <ModelClient> localVarResponse = await TestClassnameAsyncWithHttpInfo(body, cancellationToken);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (ModelClient)</returns>
        public async System.Threading.Tasks.Task <Org.OpenAPITools.Client.ApiResponse <ModelClient> > TestClassnameWithHttpInfoAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'modelClient' is set
            if (modelClient == null)
            {
                throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname");
            }


            Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };


            var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = modelClient;

            // authentication (api_key_query) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query")))
            {
                localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query")));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PatchAsync <ModelClient>("/fake_classname_test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #11
0
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <returns>ModelClient</returns>
        public ModelClient TestClassname(ModelClient modelClient)
        {
            ApiResponse <ModelClient> localVarResponse = TestClassnameWithHttpInfo(modelClient);

            return(localVarResponse.Data);
        }
Exemple #12
0
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task <ModelClient> TestClassnameAsync(ModelClient modelClient)
        {
            ApiResponse <ModelClient> localVarResponse = await TestClassnameAsyncWithHttpInfo(modelClient);

            return(localVarResponse.Data);
        }
Exemple #13
0
        /// <summary>
        /// To test special tags To test special tags and operation ID starting with number
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (ModelClient)</returns>
        public async System.Threading.Tasks.Task <Org.OpenAPITools.Client.ApiResponse <ModelClient> > Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'modelClient' is set
            if (modelClient == null)
            {
                throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags");
            }


            Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };


            var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = modelClient;


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PatchAsync <ModelClient>("/another-fake/dummy", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #14
0
 /// <summary>
 /// To test special tags To test special tags and operation ID starting with number
 /// </summary>
 /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="modelClient">client model</param>
 /// <returns>ModelClient</returns>
 public ModelClient Call123TestSpecialTags(ModelClient modelClient)
 {
     Org.OpenAPITools.Client.ApiResponse <ModelClient> localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient);
     return(localVarResponse.Data);
 }
Exemple #15
0
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>ApiResponse of ModelClient</returns>
        public Org.OpenAPITools.Client.ApiResponse <ModelClient> TestClassnameWithHttpInfo(ModelClient body)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname");
            }

            Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = body;

            // authentication (api_key_query) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query")))
            {
                localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query")));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Patch <ModelClient>("/fake_classname_test", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #16
0
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <returns>ApiResponse of ModelClient</returns>
        public Org.OpenAPITools.Client.ApiResponse <ModelClient> TestClassnameWithHttpInfo(ModelClient modelClient)
        {
            // verify the required parameter 'modelClient' is set
            if (modelClient == null)
            {
                throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname");
            }

            Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions();

            String[] @contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

            if (localVarConentType != null)
            {
                requestOptions.HeaderParameters.Add("Content-Type", localVarConentType);
            }

            var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts);

            if (localVarAccept != null)
            {
                requestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            requestOptions.Data = modelClient;

            // authentication (api_key_query) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query")))
            {
                foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query")))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            // make the HTTP request

            var response = this.Client.Patch <ModelClient>("/fake_classname_test", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("TestClassname", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
        /// <summary>
        /// To test special tags To test special tags
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task <ModelClient> TestSpecialTagsAsync(ModelClient body)
        {
            ApiResponse <ModelClient> localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(body);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task <ModelClient> TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Org.OpenAPITools.Client.ApiResponse <ModelClient> localVarResponse = await TestClassnameWithHttpInfoAsync(modelClient, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
Exemple #19
0
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>Task of ApiResponse (ModelClient)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <ModelClient> > TestClassnameAsyncWithHttpInfo(ModelClient body)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname");
            }

            var    localVarPath         = "./fake_classname_test";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }

            // authentication (api_key_query) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query")))
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query")));
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("TestClassname", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <ModelClient>(localVarStatusCode,
                                                 localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
                                                 (ModelClient)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))));
        }
 /// <summary>
 /// To test class name in snake case To test class name in snake case
 /// </summary>
 /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="body">client model</param>
 /// <returns>ModelClient</returns>
 public ModelClient TestClassname(ModelClient body)
 {
     Org.OpenAPITools.Client.ApiResponse <ModelClient> localVarResponse = TestClassnameWithHttpInfo(body);
     return(localVarResponse.Data);
 }
Exemple #21
0
        void sc_DelModelByIDCompleted(object sender, DelModelByIDCompletedEventArgs e)
        {
            if (e.Result < 0)
            {
                MessageBox.Show("删除失败!");

                return;
            }

            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.MaxBufferSize = int.MaxValue;
            ModelClient mc = new ModelClient(binding, new EndpointAddress(new Uri(Application.Current.Host.Source, "../Silverlight/Model.svc")));

            //通过id获取详细信息    
            mc.GetModelAsync(UserID, PlayTypeID, TypeName);
            mc.GetModelCompleted += new EventHandler<GetModelCompletedEventArgs>(sc_GetModelCompleted);
        }
        /// <summary>
        /// To test class name in snake case To test class name in snake case
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>Task of ApiResponse (ModelClient)</returns>
        public async System.Threading.Tasks.Task <Org.OpenAPITools.Client.ApiResponse <ModelClient> > TestClassnameAsyncWithHttpInfo(ModelClient body)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname");
            }


            Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions();

            String[] @contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] @accepts = new String[] {
                "application/json"
            };

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            requestOptions.Data = body;

            // authentication (api_key_query) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query")))
            {
                foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query")))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            // make the HTTP request

            var response = await this.AsynchronousClient.PatchAsync <ModelClient>("/fake_classname_test", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("TestClassname", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
Exemple #23
0
 /// <summary>
 /// To test \&quot;client\&quot; model 
 /// </summary>
 /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="body">client model</param>
 /// <returns>ModelClient</returns>
 public ModelClient TestClientModel (ModelClient body)
 {
      ApiResponse<ModelClient> localVarResponse = TestClientModelWithHttpInfo(body);
      return localVarResponse.Data;
 }
Exemple #24
0
        public async Task <ApiResponse <ModelClient?> > Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, System.Threading.CancellationToken?cancellationToken = null)
        {
            try
            {
                #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'

                if (modelClient == null)
                {
                    throw new ArgumentNullException(nameof(modelClient));
                }

                #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'

                using (HttpRequestMessage request = new HttpRequestMessage())
                {
                    UriBuilder uriBuilder = new UriBuilder();
                    uriBuilder.Host   = HttpClient.BaseAddress !.Host;
                    uriBuilder.Scheme = ClientUtils.SCHEME;
                    uriBuilder.Path   = ClientUtils.CONTEXT_PATH + "/another-fake/dummy";

                    if ((modelClient as object) is System.IO.Stream stream)
                    {
                        request.Content = new StreamContent(stream);
                    }
                    else
                    {
                        // request.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(modelClient, ClientUtils.JsonSerializerSettings));
                        request.Content = new StringContent(System.Text.Json.JsonSerializer.Serialize(modelClient, ClientUtils.JsonSerializerOptions));
                    }

                    request.RequestUri = uriBuilder.Uri;

                    string[] contentTypes = new string[] {
                        "application/json"
                    };

                    string?contentType = ClientUtils.SelectHeaderContentType(contentTypes);

                    if (contentType != null)
                    {
                        request.Content.Headers.Add("ContentType", contentType);
                    }

                    string[] accepts = new string[] {
                        "application/json"
                    };

                    string?accept = ClientUtils.SelectHeaderAccept(accepts);

                    if (accept != null)
                    {
                        request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
                    }

                    request.Method = HttpMethod.Patch;

                    using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
                    {
                        DateTime requestedAt = DateTime.UtcNow;

                        string responseContent = await responseMessage.Content.ReadAsStringAsync(cancellationToken.GetValueOrDefault()).ConfigureAwait(false);

                        if (ApiResponded != null)
                        {
                            try
                            {
                                ApiResponded.Invoke(this, new ApiResponseEventArgs(requestedAt, DateTime.UtcNow, responseMessage.StatusCode, "/another-fake/dummy"));
                            }
                            catch (Exception e)
                            {
                                Logger.LogError(e, "An error occured while invoking ApiResponded.");
                            }
                        }

                        ApiResponse <ModelClient?> apiResponse = new ApiResponse <ModelClient?>(responseMessage, responseContent);

                        if (apiResponse.IsSuccessStatusCode)
                        {
                            apiResponse.Content = System.Text.Json.JsonSerializer.Deserialize <ModelClient>(apiResponse.RawContent, ClientUtils.JsonSerializerOptions);
                        }

                        return(apiResponse);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.LogError(e, "An error occured while sending the request to the server.");
                throw;
            }
        }
        /// <summary>
        /// To test special tags To test special tags and operation ID starting with number
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task <ModelClient> Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Org.OpenAPITools.Client.ApiResponse <ModelClient> localVarResponse = await Call123TestSpecialTagsWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
Exemple #26
0
        //确定按钮
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(ModleName.Text))
            {
                MessageBox.Show("请输入模型名字!");
                return;
            }

            if (string.IsNullOrEmpty(ModleContent.Text))
            {
                MessageBox.Show("请输入模型描述内容!");
                return;
            }

            if (ModleName.Text.Trim().Length > 400)
            {
                MessageBox.Show("输入模型名字字数太长,请重新输入!");
                return;
            }

            if (ModleName.Text.Trim().Length > 3000)
            {
                MessageBox.Show("模型描述内容字数太长,请重新输入!");
                return;
            }


            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.MaxBufferSize = int.MaxValue;
            ModelClient mc = new ModelClient(binding, new EndpointAddress(new Uri(Application.Current.Host.Source, "../Silverlight/Model.svc")));

            //通过id获取详细信息
            mc.InsertModelAsync(UserID, PlayType, ModleName.Text.Trim(), strContent, ModleContent.Text.Trim(), TypeName);
            mc.InsertModelCompleted += new EventHandler<InsertModelCompletedEventArgs>(mc_InsertModelCompleted);

            this.DialogResult = true;
        }
Exemple #27
0
        /// <summary>
        /// To test special tags To test special tags and operation ID starting with number
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task <ModelClient> Call123TestSpecialTagsAsync(ModelClient modelClient)
        {
            ApiResponse <ModelClient> localVarResponse = await Call123TestSpecialTagsAsyncWithHttpInfo(modelClient);

            return(localVarResponse.Data);
        }
Exemple #28
0
        /// <summary>
        /// To test \&quot;client\&quot; model 
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">client model</param>
        /// <returns>Task of ModelClient</returns>
        public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (ModelClient body)
        {
             ApiResponse<ModelClient> localVarResponse = await TestClientModelAsyncWithHttpInfo(body);
             return localVarResponse.Data;

        }
Exemple #29
0
        /// <summary>
        /// To test special tags To test special tags and operation ID starting with number
        /// </summary>
        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="modelClient">client model</param>
        /// <returns>Task of ApiResponse (ModelClient)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <ModelClient> > Call123TestSpecialTagsAsyncWithHttpInfo(ModelClient modelClient)
        {
            // verify the required parameter 'modelClient' is set
            if (modelClient == null)
            {
                throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags");
            }

            var    localVarPath         = "/another-fake/dummy";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (modelClient != null && modelClient.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(modelClient); // http body (model) parameter
            }
            else
            {
                localVarPostBody = modelClient; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <ModelClient>(localVarStatusCode,
                                                 localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                                 (ModelClient)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))));
        }
 public override void Process(ModelClient model)
 {
     model.ListGrenade = grenadesInfo;
 }
        public async Task <ApiResponse <ModelClient?> > TestClassnameWithHttpInfoAsync(ModelClient modelClient, System.Threading.CancellationToken?cancellationToken = null)
        {
            try
            {
                #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'

                if (modelClient == null)
                {
                    throw new ArgumentNullException(nameof(modelClient));
                }

                #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'

                using (HttpRequestMessage request = new HttpRequestMessage())
                {
                    UriBuilder uriBuilder = new UriBuilder();
                    uriBuilder.Host   = HttpClient.BaseAddress !.Host;
                    uriBuilder.Scheme = ClientUtils.SCHEME;
                    uriBuilder.Path   = ClientUtils.CONTEXT_PATH + "/fake_classname_test";

                    System.Collections.Specialized.NameValueCollection parseQueryString = System.Web.HttpUtility.ParseQueryString(string.Empty);

                    request.Content       = (modelClient as object) is System.IO.Stream stream
                        ? request.Content = new StreamContent(stream)
                        : request.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));

                    List <TokenBase> tokens = new List <TokenBase>();

                    ApiKeyToken apiKey = (ApiKeyToken)await ApiKeyProvider.GetAsync(cancellationToken).ConfigureAwait(false);

                    tokens.Add(apiKey);

                    apiKey.UseInQuery(request, uriBuilder, parseQueryString, "api_key_query");

                    uriBuilder.Query = parseQueryString.ToString();

                    request.RequestUri = uriBuilder.Uri;

                    string[] contentTypes = new string[] {
                        "application/json"
                    };

                    string?contentType = ClientUtils.SelectHeaderContentType(contentTypes);

                    if (contentType != null)
                    {
                        request.Content.Headers.Add("ContentType", contentType);
                    }

                    string[] accepts = new string[] {
                        "application/json"
                    };

                    string?accept = ClientUtils.SelectHeaderAccept(accepts);

                    if (accept != null)
                    {
                        request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept));
                    }

                    request.Method = HttpMethod.Patch;

                    using (HttpResponseMessage responseMessage = await HttpClient.SendAsync(request, cancellationToken.GetValueOrDefault()).ConfigureAwait(false))
                    {
                        DateTime requestedAt = DateTime.UtcNow;

                        string responseContent = await responseMessage.Content.ReadAsStringAsync(cancellationToken.GetValueOrDefault()).ConfigureAwait(false);

                        if (ApiResponded != null)
                        {
                            try
                            {
                                ApiResponded.Invoke(this, new ApiResponseEventArgs(requestedAt, DateTime.UtcNow, responseMessage.StatusCode, "/fake_classname_test"));
                            }
                            catch (Exception e)
                            {
                                Logger.LogError(e, "An error occured while invoking ApiResponded.");
                            }
                        }

                        ApiResponse <ModelClient?> apiResponse = new ApiResponse <ModelClient?>(responseMessage, responseContent);

                        if (apiResponse.IsSuccessStatusCode)
                        {
                            apiResponse.Content = JsonSerializer.Deserialize <ModelClient>(apiResponse.RawContent, _jsonSerializerOptions);
                        }
                        else if (apiResponse.StatusCode == (HttpStatusCode)429)
                        {
                            foreach (TokenBase token in tokens)
                            {
                                token.BeginRateLimit();
                            }
                        }

                        return(apiResponse);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.LogError(e, "An error occured while sending the request to the server.");
                throw;
            }
        }