openapi-generator/samples/client/petstore/csharp/SwaggerClient
2016-06-23 12:14:32 +08:00
..
docs add array and map of enum support for C# 2016-06-23 12:14:32 +08:00
src add array and map of enum support for C# 2016-06-23 12:14:32 +08:00
.gitignore Update C# client structure using common standards 2016-05-01 20:03:45 -04:00
.swagger-codegen-ignore fix test cases, fix warning in exceptionfactory, update 2016-06-12 12:41:35 +08:00
.travis.yml add travis file for C# client 2016-06-12 16:45:49 +08:00
build.bat fix test cases, fix warning in exceptionfactory, update 2016-06-12 12:41:35 +08:00
build.sh fix test cases, fix warning in exceptionfactory, update 2016-06-12 12:41:35 +08:00
git_push.sh [csharp] Regenerate sample client 2016-05-01 20:28:50 -04:00
IO.Swagger.sln add array and map of enum support for C# 2016-06-23 12:14:32 +08:00
LICENSE add apache v2 license to csharp api client 2016-05-25 14:41:17 +08:00
mono_nunit_test.sh add travis file for C# client 2016-06-12 16:45:49 +08:00
README.md add array and map of enum support for C# 2016-06-23 12:14:32 +08:00

IO.Swagger - the C# library for the Swagger Petstore

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \

This C# SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • SDK version: 1.0.0
  • Build date: 2016-06-23T12:09:14.609+08:00
  • Build package: class io.swagger.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

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

Getting Started

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

namespace Example
{
    public class Example
    {
        public void main()
        {
            
            var apiInstance = new FakeApi();
            var number = 3.4;  // decimal? | None
            var _double = 1.2;  // double? | None
            var _string = _string_example;  // string | None
            var _byte = B;  // byte[] | None
            var integer = 56;  // int? | None (optional) 
            var int32 = 56;  // int? | None (optional) 
            var int64 = 789;  // long? | None (optional) 
            var _float = 3.4;  // float? | None (optional) 
            var binary = B;  // byte[] | None (optional) 
            var date = 2013-10-20;  // DateTime? | None (optional) 
            var dateTime = 2013-10-20T19:20:30+01:00;  // DateTime? | None (optional) 
            var password = password_example;  // string | None (optional) 

            try
            {
                // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 
                apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message );
            }
        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
FakeApi TestEndpointParameters POST /fake Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
FakeApi TestEnumQueryParameters GET /fake To test enum query parameters
PetApi AddPet POST /pet Add a new pet to the store
PetApi DeletePet DELETE /pet/{petId} Deletes a pet
PetApi FindPetsByStatus GET /pet/findByStatus Finds Pets by status
PetApi FindPetsByTags GET /pet/findByTags Finds Pets by tags
PetApi GetPetById GET /pet/{petId} Find pet by ID
PetApi UpdatePet PUT /pet Update an existing pet
PetApi UpdatePetWithForm POST /pet/{petId} Updates a pet in the store with form data
PetApi UploadFile POST /pet/{petId}/uploadImage uploads an image
StoreApi DeleteOrder DELETE /store/order/{orderId} Delete purchase order by ID
StoreApi GetInventory GET /store/inventory Returns pet inventories by status
StoreApi GetOrderById GET /store/order/{orderId} Find purchase order by ID
StoreApi PlaceOrder POST /store/order Place an order for a pet
UserApi CreateUser POST /user Create user
UserApi CreateUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
UserApi CreateUsersWithListInput POST /user/createWithList Creates list of users with given input array
UserApi DeleteUser DELETE /user/{username} Delete user
UserApi GetUserByName GET /user/{username} Get user by user name
UserApi LoginUser GET /user/login Logs user into the system
UserApi LogoutUser GET /user/logout Logs out current logged in user session
UserApi UpdateUser PUT /user/{username} Updated user

Documentation for Models

Documentation for Authorization

api_key

  • Type: API key
  • API key parameter name: api_key
  • Location: HTTP header

petstore_auth