Coder Social home page Coder Social logo

csharp-generated's Introduction

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

This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at http://swagger.io. In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. Some useful links: - The Pet Store repository - The source API definition for the Pet Store

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

  • API version: 1.0.19
  • SDK version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.plus.dotnet.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 recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

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 IO.Swagger.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out IO.Swagger.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

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

namespace Example
{
    public class Example
    {
        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 | Create a new pet in the store
            var id = 789;  // long? | 
            var name = name_example;  // string | 
            var category = new Category(); // Category | 
            var photoUrls = new List<string>(); // List<string> | 
            var tags = new List<Tag>(); // List<Tag> | 
            var status = status_example;  // string | 

            try
            {
                // Add a new pet to the store
                Pet result = apiInstance.AddPet(body, id, name, category, photoUrls, tags, status);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
            }
        }
    }
}

Documentation for API Endpoints

All URIs are relative to /api/v3

Class Method HTTP request Description
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 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} Update user

Documentation for Models

Documentation for Authorization

api_key

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

petstore_auth

csharp-generated's People

Contributors

frankkilcommins avatar frantuma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.