samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
/// <summary>
/// Find pet by ID Returns a single pet
/// </summary>
/// <param name="petId">ID of pet to return</param>
/// <returns>Pet</returns>
Find pet by ID Returns a single pet
Find pet by ID Returns a single pet
public Pet GetPetById (long? petId)
        {
            if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById");
            var path = "/pet/{petId}";
            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            String postBody = null;
            String[] authSettings = new String[] { "api_key" };
            IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
            if (((int)response.StatusCode) >= 400)
                throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
            else if (((int)response.StatusCode) == 0)
                throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage);
            return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers);
        }
public Pet GetPetById ( long ? petId ) { if ( petId == null ) throw new ApiException ( 400 , " " ) ; var path = " " ; path = path . Replace ( " " , " " ) ; path = path . Replace ( " " + " " + " " , ApiClient . ParameterToString ( petId ) ) ; var queryParams = new Dictionary < String , String > ( ) ; var headerParams = new Dictionary < String , String > ( ) ; var formParams = new Dictionary < String , String > ( ) ; var fileParams = new Dictionary < String , FileParameter > ( ) ; String postBody = null ; String [ ] authSettings = new String [ ] { " " } ; IRestResponse response = ( IRestResponse ) ApiClient . CallApi ( path , Method . GET , queryParams , postBody , headerParams , formParams , fileParams , authSettings ) ; if ( ( ( int ) response . StatusCode ) >= 400 ) throw new ApiException ( ( int ) response . StatusCode , " " + response . Content , response . Content ) ; else if ( ( ( int ) response . StatusCode ) == 0 ) throw new ApiException ( ( int ) response . StatusCode , " " + response . ErrorMessage , response . ErrorMessage ) ; return ( Pet ) ApiClient . Deserialize ( response . Content , typeof ( Pet ) , response . Headers ) ; }
Find pet by ID Returns a single pet
Find pet by ID Returns a single pet
// verify the required parameter 'petId' is set // authentication setting, if any // make the HTTP request
None
petId
long?
ID of pet to return
ID of pet to return