示例#1
0
        /// <summary>
        /// update a todo item Update a todo to the system
        /// </summary>
        /// <exception cref="Todos.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The todo item id</param>
        /// <param name="updateTodoItem">Inventory todo to update (optional)</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public Todos.Client.ApiResponse <Object> UpdateTodoWithHttpInfo(decimal id, UpdateTodoItem updateTodoItem = null)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new Todos.Client.ApiException(400, "Missing required parameter 'id' when calling TodosApi->UpdateTodo");
            }

            Todos.Client.RequestOptions requestOptions = new Todos.Client.RequestOptions();

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

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

            var localVarContentType = Todos.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

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

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

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

            if (id != null)
            {
                requestOptions.PathParameters.Add("id", Todos.Client.ClientUtils.ParameterToString(id)); // path parameter
            }
            requestOptions.Data = updateTodoItem;


            // make the HTTP request

            var response = this.Client.Put <Object>("/api/todos/{id}", requestOptions, this.Configuration);

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

            return(response);
        }
示例#2
0
        /// <summary>
        /// update a todo item Update a todo to the system
        /// </summary>
        /// <exception cref="Todos.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The todo item id</param>
        /// <param name="updateTodoItem">Inventory todo to update (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <Todos.Client.ApiResponse <Object> > UpdateTodoAsyncWithHttpInfo(decimal id, UpdateTodoItem updateTodoItem = null)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new Todos.Client.ApiException(400, "Missing required parameter 'id' when calling TodosApi->UpdateTodo");
            }


            Todos.Client.RequestOptions requestOptions = new Todos.Client.RequestOptions();

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

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

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

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

            if (id != null)
            {
                requestOptions.PathParameters.Add("id", Todos.Client.ClientUtils.ParameterToString(id)); // path parameter
            }
            requestOptions.Data = updateTodoItem;


            // make the HTTP request

            var response = await this.AsynchronousClient.PutAsync <Object>("/api/todos/{id}", requestOptions, this.Configuration);

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

            return(response);
        }
示例#3
0
        /// <summary>
        /// adds a todo item Adds a todo to the system
        /// </summary>
        /// <exception cref="Todos.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="updateTodoItem">Inventory todo to add (optional)</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public Todos.Client.ApiResponse <Object> AddTodoWithHttpInfo(UpdateTodoItem updateTodoItem = null)
        {
            Todos.Client.RequestOptions requestOptions = new Todos.Client.RequestOptions();

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

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

            var localVarContentType = Todos.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

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

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

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

            requestOptions.Data = updateTodoItem;


            // make the HTTP request

            var response = this.Client.Post <Object>("/api/todos", requestOptions, this.Configuration);

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

            return(response);
        }
示例#4
0
        /// <summary>
        /// adds a todo item Adds a todo to the system
        /// </summary>
        /// <exception cref="Todos.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="updateTodoItem">Inventory todo to add (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <Todos.Client.ApiResponse <Object> > AddTodoAsyncWithHttpInfo(UpdateTodoItem updateTodoItem = null)
        {
            Todos.Client.RequestOptions requestOptions = new Todos.Client.RequestOptions();

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

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

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

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

            requestOptions.Data = updateTodoItem;


            // make the HTTP request

            var response = await this.AsynchronousClient.PostAsync <Object>("/api/todos", requestOptions, this.Configuration);

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

            return(response);
        }
示例#5
0
        /// <summary>
        /// searches inventory By passing in the appropriate options, you can search for available inventory in the system
        /// </summary>
        /// <exception cref="Todos.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">pass an optional search string for looking up todos (optional)</param>
        /// <param name="skip">number of records to skip for pagination (optional)</param>
        /// <param name="limit">maximum number of records to return (optional)</param>
        /// <returns>Task of ApiResponse (List&lt;TodoItem&gt;)</returns>
        public async System.Threading.Tasks.Task <Todos.Client.ApiResponse <List <TodoItem> > > SearchInventoryAsyncWithHttpInfo(string q = null, int?skip = null, int?limit = null)
        {
            Todos.Client.RequestOptions requestOptions = new Todos.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

            // 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);
            }

            if (q != null)
            {
                foreach (var kvp in Todos.Client.ClientUtils.ParameterToMultiMap("", "q", q))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }
            if (skip != null)
            {
                foreach (var kvp in Todos.Client.ClientUtils.ParameterToMultiMap("", "skip", skip))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }
            if (limit != null)
            {
                foreach (var kvp in Todos.Client.ClientUtils.ParameterToMultiMap("", "limit", limit))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }


            // make the HTTP request

            var response = await this.AsynchronousClient.GetAsync <List <TodoItem> >("/api/todos", requestOptions, this.Configuration);

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

            return(response);
        }
示例#6
0
        /// <summary>
        /// searches inventory By passing in the appropriate options, you can search for available inventory in the system
        /// </summary>
        /// <exception cref="Todos.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">pass an optional search string for looking up todos (optional)</param>
        /// <param name="skip">number of records to skip for pagination (optional)</param>
        /// <param name="limit">maximum number of records to return (optional)</param>
        /// <returns>ApiResponse of List&lt;TodoItem&gt;</returns>
        public Todos.Client.ApiResponse <List <TodoItem> > SearchInventoryWithHttpInfo(string q = null, int?skip = null, int?limit = null)
        {
            Todos.Client.RequestOptions requestOptions = new Todos.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

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

            var localVarContentType = Todos.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

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

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

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

            if (q != null)
            {
                foreach (var kvp in Todos.Client.ClientUtils.ParameterToMultiMap("", "q", q))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }
            if (skip != null)
            {
                foreach (var kvp in Todos.Client.ClientUtils.ParameterToMultiMap("", "skip", skip))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }
            if (limit != null)
            {
                foreach (var kvp in Todos.Client.ClientUtils.ParameterToMultiMap("", "limit", limit))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }


            // make the HTTP request

            var response = this.Client.Get <List <TodoItem> >("/api/todos", requestOptions, this.Configuration);

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

            return(response);
        }