示例#1
0
        /// <summary>
        /// Add a new pet to the store 
        /// </summary>
        /// <param name="body">Pet object that needs to be added to the store</param>
        /// <returns></returns>
        public void addPet(Pet body)
        {
            // create path and map variables
            var path = "/pet".Replace("{format}","json");

            // query params
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();

            // verify required params are set
            if (body == null ) {
               throw new ApiException(400, "missing required params");
            }
            string paramStr = null;
            try {
              var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
              if(response != null){
             return ;
              }
              else {
            return ;
              }
            } catch (ApiException ex) {
              if(ex.ErrorCode == 404) {
              	return ;
              }
              else {
            throw ex;
              }
            }
        }
示例#2
0
        /// <summary>
        /// partial updates to a pet 
        /// </summary>
        /// <param name="petId">ID of pet that needs to be fetched</param>
        /// <param name="body">Pet object that needs to be added to the store</param>
        /// <returns></returns>
        public List<Pet> partialUpdate(string petId, Pet body)
        {
            // create path and map variables
            var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));

            // query params
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();

            // verify required params are set
            if (petId == null || body == null ) {
               throw new ApiException(400, "missing required params");
            }
            string paramStr = null;
            try {
              var response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams);
              if(response != null){
             return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>));
              }
              else {
            return null;
              }
            } catch (ApiException ex) {
              if(ex.ErrorCode == 404) {
              	return null;
              }
              else {
            throw ex;
              }
            }
        }