Gronsak 580745ef43 [C#] Adding support for generating .NET Standard 1.3 client library (#4955)
* [CsharpNetStandard] Added C# .NET Standard Client Generation

Added language CsharpNetStandard.
Everything copied from csharp Client Generator.
Dependancies switched from Restsharp to Restsharp.Portable.
Changes made where nececary to replicate Restsharp functionallity.
Project type changed to .NET Standard protable library.

* [CsharpNetStandard] Removed client prop validation due to incompability

* [CsharpNetStandard] Minor fixes

Changed leftover RestSharp.Method to Method
Changed to .Net Standard 1.3 for compability reasons
Changed excludeTests to default to true due to tests not being implemented yet

Removed unnecessary targetFramework property
Removed leftover UWP stuff

* [CsharpNetStandard] More fixes

Added correct dependencies to Readme
Added correct supported frameworks to Readme
Added slightly better placeholder for installation instructions in Readme

Removed leftover dependencies from project.json
Removed leftover SupportsAsync stuff
Removed references to build.bat/-.sh since they're not yet being generated

Todo implement test generation

* [CsharpNetStandard] Added forgoten git_push.sh

* [C#-netstandard] Renamed option to csharp-netstandard

Also added .bat file for test generation

* [C# Net Standard] fixed path in .bat file

* [C# NET Standard] fixes to enum generation

Fixed issues with enum generation due to tired programmer

* [C# NET Standard] Generated sample client library

Sample library generated

Fixes:
Class actually works again
.bat - minor inconsistency fixed

* [C# NET Standard] Error corrected in how timeout is set

Configuration Timeout property changed to TimeSpan type and code corrected around that

* [C#] Merged .NET Standard generator into csharp generator

Functionallity of csharp-netstarndard generator has been moved into standard csharp generator under the targetFramework option as "v5.0"
2017-03-20 17:21:44 +08:00

14 KiB

IO.Swagger.Api.PetApi

All URIs are relative to http://petstore.swagger.io/v2

Method HTTP request Description
AddPet POST /pet Add a new pet to the store
DeletePet DELETE /pet/{petId} Deletes a pet
FindPetsByStatus GET /pet/findByStatus Finds Pets by status
FindPetsByTags GET /pet/findByTags Finds Pets by tags
GetPetById GET /pet/{petId} Find pet by ID
UpdatePet PUT /pet Update an existing pet
UpdatePetWithForm POST /pet/{petId} Updates a pet in the store with form data
UploadFile POST /pet/{petId}/uploadImage uploads an image

AddPet

void AddPet (Pet body)

Add a new pet to the store

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class AddPetExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new PetApi();
            var body = new Pet(); // Pet | Pet object that needs to be added to the store

            try
            {
                // Add a new pet to the store
                apiInstance.AddPet(body);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
body Pet Pet object that needs to be added to the store

Return type

void (empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeletePet

void DeletePet (long? petId, string apiKey = null)

Deletes a pet

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class DeletePetExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new PetApi();
            var petId = 789;  // long? | Pet id to delete
            var apiKey = apiKey_example;  // string |  (optional) 

            try
            {
                // Deletes a pet
                apiInstance.DeletePet(petId, apiKey);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
petId long? Pet id to delete
apiKey string [optional]

Return type

void (empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

FindPetsByStatus

List FindPetsByStatus (List status)

Finds Pets by status

Multiple status values can be provided with comma separated strings

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class FindPetsByStatusExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new PetApi();
            var status = new List<string>(); // List<string> | Status values that need to be considered for filter

            try
            {
                // Finds Pets by status
                List&lt;Pet&gt; result = apiInstance.FindPetsByStatus(status);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
status List<string> Status values that need to be considered for filter

Return type

List

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

FindPetsByTags

List FindPetsByTags (List tags)

Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class FindPetsByTagsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new PetApi();
            var tags = new List<string>(); // List<string> | Tags to filter by

            try
            {
                // Finds Pets by tags
                List&lt;Pet&gt; result = apiInstance.FindPetsByTags(tags);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
tags List<string> Tags to filter by

Return type

List

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPetById

Pet GetPetById (long? petId)

Find pet by ID

Returns a single pet

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class GetPetByIdExample
    {
        public void main()
        {
            
            // Configure API key authorization: api_key
            Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");

            var apiInstance = new PetApi();
            var petId = 789;  // long? | ID of pet to return

            try
            {
                // Find pet by ID
                Pet result = apiInstance.GetPetById(petId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
petId long? ID of pet to return

Return type

Pet

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdatePet

void UpdatePet (Pet body)

Update an existing pet

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class UpdatePetExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new PetApi();
            var body = new Pet(); // Pet | Pet object that needs to be added to the store

            try
            {
                // Update an existing pet
                apiInstance.UpdatePet(body);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
body Pet Pet object that needs to be added to the store

Return type

void (empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdatePetWithForm

void UpdatePetWithForm (long? petId, string name = null, string status = null)

Updates a pet in the store with form data

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class UpdatePetWithFormExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new PetApi();
            var petId = 789;  // long? | ID of pet that needs to be updated
            var name = name_example;  // string | Updated name of the pet (optional) 
            var status = status_example;  // string | Updated status of the pet (optional) 

            try
            {
                // Updates a pet in the store with form data
                apiInstance.UpdatePetWithForm(petId, name, status);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
petId long? ID of pet that needs to be updated
name string Updated name of the pet [optional]
status string Updated status of the pet [optional]

Return type

void (empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UploadFile

ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null)

uploads an image

Example

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class UploadFileExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: petstore_auth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new PetApi();
            var petId = 789;  // long? | ID of pet to update
            var additionalMetadata = additionalMetadata_example;  // string | Additional data to pass to server (optional) 
            var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional) 

            try
            {
                // uploads an image
                ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message );
            }
        }
    }
}

Parameters

Name Type Description Notes
petId long? ID of pet to update
additionalMetadata string Additional data to pass to server [optional]
file System.IO.Stream file to upload [optional]

Return type

ApiResponse

Authorization

petstore_auth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]