samples/composed/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/PetApi.cs
/// <summary>
/// Updates a pet in the store with form data 
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name"> (optional)</param>
/// <param name="status"> (optional)</param>
/// <returns>Task of ApiResponse</returns>
Updates a pet in the store with form data
Updates a pet in the store with form data
public async System.Threading.Tasks.Task<ApiResponse<Object>> UpdatePetWithFormAsyncWithHttpInfo (long? petId, string name = null, string status = null)
        {
            if (petId == null)
                throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm");
            var localVarPath = "/pet/{petId}";
            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;
            String[] localVarHttpContentTypes = new String[] {
                "application/x-www-form-urlencoded"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
            String[] localVarHttpHeaderAccepts = new String[] {
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); 
            if (name != null) localVarFormParams.Add("name", this.Configuration.ApiClient.ParameterToString(name)); 
            if (status != null) localVarFormParams.Add("status", this.Configuration.ApiClient.ParameterToString(status)); 
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);
            int localVarStatusCode = (int) localVarResponse.StatusCode;
            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("UpdatePetWithForm", localVarResponse);
                if (exception != null) throw exception;
            }
            return new ApiResponse<Object>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                null);
        }
public async System . Threading . Tasks . Task < ApiResponse < Object > > UpdatePetWithFormAsyncWithHttpInfo ( long ? petId , string name = null , string status = null ) { if ( petId == null ) throw new ApiException ( 400 , " " ) ; var localVarPath = " " ; 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 ; String [ ] localVarHttpContentTypes = new String [ ] { " " } ; String localVarHttpContentType = this . Configuration . ApiClient . SelectHeaderContentType ( localVarHttpContentTypes ) ; String [ ] localVarHttpHeaderAccepts = new String [ ] { } ; String localVarHttpHeaderAccept = this . Configuration . ApiClient . SelectHeaderAccept ( localVarHttpHeaderAccepts ) ; if ( localVarHttpHeaderAccept != null ) localVarHeaderParams . Add ( " " , localVarHttpHeaderAccept ) ; if ( petId != null ) localVarPathParams . Add ( " " , this . Configuration . ApiClient . ParameterToString ( petId ) ) ; if ( name != null ) localVarFormParams . Add ( " " , this . Configuration . ApiClient . ParameterToString ( name ) ) ; if ( status != null ) localVarFormParams . Add ( " " , this . Configuration . ApiClient . ParameterToString ( status ) ) ; if ( ! String . IsNullOrEmpty ( this . Configuration . AccessToken ) ) { localVarHeaderParams [ " " ] = " " + this . Configuration . AccessToken ; } IRestResponse localVarResponse = ( IRestResponse ) await this . Configuration . ApiClient . CallApiAsync ( localVarPath , Method . POST , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarFileParams , localVarPathParams , localVarHttpContentType ) ; int localVarStatusCode = ( int ) localVarResponse . StatusCode ; if ( ExceptionFactory != null ) { Exception exception = ExceptionFactory ( " " , localVarResponse ) ; if ( exception != null ) throw exception ; } return new ApiResponse < Object > ( localVarStatusCode , localVarResponse . Headers . ToDictionary ( x => x . Name , x => string . Join ( " " , x . Value ) ) , null ) ; }
Updates a pet in the store with form data
Updates a pet in the store with form data
// verify the required parameter 'petId' is set // to determine the Content-Type header // to determine the Accept header // path parameter // form parameter // form parameter // authentication (petstore_auth) required // oauth required // make the HTTP request
Task of ApiResponse
Task of ApiResponse
Thrown when fails to make API call
Thrown when fails to make API call
petId
long?
ID of pet that needs to be updated
ID of pet that needs to be updated
name
string
None
status
string
None