Decommission csharp-dotnet2 client generator (#14911)

* decommission csharp-dotnet2 client generator

* update doc
This commit is contained in:
William Cheng 2023-03-10 14:30:32 +08:00 committed by GitHub
parent cda42b9e7b
commit c4b404dc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 1 additions and 8028 deletions

View File

@ -1,6 +0,0 @@
generatorName: csharp-dotnet2
outputDir: samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-dotnet2
additionalProperties:
hideGenerationTimestamp: "true"

View File

@ -19,7 +19,6 @@ The following generators are available:
* [cpp-ue4 (beta)](generators/cpp-ue4.md)
* [crystal (beta)](generators/crystal.md)
* [csharp](generators/csharp.md)
* [csharp-dotnet2 (deprecated)](generators/csharp-dotnet2.md)
* [csharp-netcore](generators/csharp-netcore.md)
* [dart](generators/dart.md)
* [dart-dio](generators/dart-dio.md)

View File

@ -1,293 +0,0 @@
---
title: Documentation for the csharp-dotnet2 Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | csharp-dotnet2 | pass this to the generate command after -g |
| generator stability | DEPRECATED | |
| generator type | CLIENT | |
| generator language | C# | |
| generator default templating engine | mustache | |
| helpTxt | Generates a C# .Net 2.0 client library (beta). | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|clientPackage|C# client package name (convention: Camel.Case).| |Org.OpenAPITools.Client|
|packageName|C# package name (convention: Camel.Case).| |Org.OpenAPITools|
|packageVersion|C# package version.| |1.0.0|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|List|
|list|List|
|map|Dictionary|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Boolean</li>
<li>Collection</li>
<li>DateTime</li>
<li>DateTime?</li>
<li>DateTimeOffset</li>
<li>DateTimeOffset?</li>
<li>Decimal</li>
<li>Dictionary</li>
<li>Double</li>
<li>Float</li>
<li>Guid</li>
<li>Guid?</li>
<li>ICollection</li>
<li>Int32</li>
<li>Int64</li>
<li>List</li>
<li>Object</li>
<li>String</li>
<li>System.IO.Stream</li>
<li>bool</li>
<li>bool?</li>
<li>byte[]</li>
<li>decimal</li>
<li>decimal?</li>
<li>double</li>
<li>double?</li>
<li>float</li>
<li>float?</li>
<li>int</li>
<li>int?</li>
<li>long</li>
<li>long?</li>
<li>string</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Client</li>
<li>Configuration</li>
<li>Version</li>
<li>abstract</li>
<li>as</li>
<li>base</li>
<li>bool</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>checked</li>
<li>class</li>
<li>client</li>
<li>const</li>
<li>continue</li>
<li>decimal</li>
<li>default</li>
<li>delegate</li>
<li>do</li>
<li>double</li>
<li>else</li>
<li>enum</li>
<li>event</li>
<li>explicit</li>
<li>extern</li>
<li>false</li>
<li>finally</li>
<li>fixed</li>
<li>float</li>
<li>for</li>
<li>foreach</li>
<li>goto</li>
<li>if</li>
<li>implicit</li>
<li>in</li>
<li>int</li>
<li>interface</li>
<li>internal</li>
<li>is</li>
<li>localVarFileParams</li>
<li>localVarFormParams</li>
<li>localVarHeaderParams</li>
<li>localVarHttpContentType</li>
<li>localVarHttpContentTypes</li>
<li>localVarHttpHeaderAccept</li>
<li>localVarHttpHeaderAccepts</li>
<li>localVarPath</li>
<li>localVarPathParams</li>
<li>localVarPostBody</li>
<li>localVarQueryParams</li>
<li>localVarResponse</li>
<li>localVarStatusCode</li>
<li>lock</li>
<li>long</li>
<li>namespace</li>
<li>new</li>
<li>null</li>
<li>object</li>
<li>operator</li>
<li>out</li>
<li>override</li>
<li>parameter</li>
<li>params</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>readonly</li>
<li>ref</li>
<li>return</li>
<li>sbyte</li>
<li>sealed</li>
<li>short</li>
<li>sizeof</li>
<li>stackalloc</li>
<li>static</li>
<li>string</li>
<li>struct</li>
<li>switch</li>
<li>this</li>
<li>throw</li>
<li>true</li>
<li>try</li>
<li>typeof</li>
<li>uint</li>
<li>ulong</li>
<li>unchecked</li>
<li>unsafe</li>
<li>ushort</li>
<li>using</li>
<li>virtual</li>
<li>void</li>
<li>volatile</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✓|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✓|OAS2,OAS3
|OAuth2_ClientCredentials|✓|OAS2,OAS3
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@ -1,160 +0,0 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
public class CSharpDotNet2ClientCodegen extends AbstractCSharpCodegen {
private final Logger LOGGER = LoggerFactory.getLogger(CSharpDotNet2ClientCodegen.class);
public static final String CLIENT_PACKAGE = "clientPackage";
protected String clientPackage = "Org.OpenAPITools.Client";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
public CSharpDotNet2ClientCodegen() {
super();
modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme));
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.DEPRECATED)
.build();
// clear import mapping (from default generator) as C# (2.0) does not use it
// at the moment
importMapping.clear();
modelTemplateFiles.put("model.mustache", ".cs");
apiTemplateFiles.put("api.mustache", ".cs");
setApiPackage(packageName + ".Api");
setModelPackage(packageName + ".Model");
setClientPackage(packageName + ".Client");
setSourceFolder("src" + File.separator + "main" + File.separator + "CsharpDotNet2");
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
cliOptions.clear();
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME,
"C# package name (convention: Camel.Case).")
.defaultValue(packageName));
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION,
"C# package version.")
.defaultValue(packageVersion));
cliOptions.add(new CliOption(CLIENT_PACKAGE,
"C# client package name (convention: Camel.Case).")
.defaultValue(clientPackage));
}
@Override
public void processOpts() {
LOGGER.warn("Per Microsoft Product Lifecycle (https://support.microsoft.com/en-us/lifecycle/search?sort=PN&alpha=.NET%20Framework&Filter=FilterNO), support for .NET Framework 2.0 ended in 2011 so there may be security issues using the auto-generated C# 2.0 source code.");
super.processOpts();
if (additionalProperties.containsKey(CLIENT_PACKAGE)) {
setClientPackage((String) additionalProperties.get(CLIENT_PACKAGE));
} else {
additionalProperties.put(CLIENT_PACKAGE, getClientPackage());
}
final String clientPackage = getClientPackage();
final String clientPackagePath = clientPackage.replace(".", java.io.File.separator);
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath);
supportingFiles.add(new SupportingFile("Configuration.mustache",
sourceFolder + File.separator + clientPackagePath, "Configuration.cs"));
supportingFiles.add(new SupportingFile("ApiClient.mustache",
sourceFolder + File.separator + clientPackagePath, "ApiClient.cs"));
supportingFiles.add(new SupportingFile("ApiException.mustache",
sourceFolder + File.separator + clientPackagePath, "ApiException.cs"));
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor", "packages.config"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
}
@Override
public String apiPackage() {
return packageName + ".Api";
}
@Override
public String modelPackage() {
return packageName + ".Model";
}
public String getClientPackage() {
return clientPackage;
}
public void setClientPackage(String clientPackage) {
this.clientPackage = clientPackage;
}
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;
}
@Override
public String getName() {
return "csharp-dotnet2";
}
@Override
public String getHelp() {
return "Generates a C# .Net 2.0 client library (beta).";
}
@Override
public String apiFileFolder() {
return outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar);
}
@Override
public String modelFileFolder() {
return outputFolder + File.separator + sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar);
}
@Override
public String apiDocFileFolder() {
return outputFolder + File.separator + apiDocPath.replace('/', File.separatorChar);
}
@Override
public String modelDocFileFolder() {
return outputFolder + File.separator + modelDocPath.replace('/', File.separatorChar);
}
}

View File

@ -22,7 +22,6 @@ org.openapitools.codegen.languages.CppTizenClientCodegen
org.openapitools.codegen.languages.CppUE4ClientCodegen
org.openapitools.codegen.languages.CSharpClientCodegen
org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen
org.openapitools.codegen.languages.CsharpNetcoreFunctionsServerCodegen
org.openapitools.codegen.languages.DartClientCodegen
org.openapitools.codegen.languages.DartDioClientCodegen
@ -140,4 +139,4 @@ org.openapitools.codegen.languages.TypeScriptNestjsClientCodegen
org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen
org.openapitools.codegen.languages.WsdlSchemaCodegen
org.openapitools.codegen.languages.WsdlSchemaCodegen

View File

@ -1,362 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

View File

@ -1,23 +0,0 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -1,25 +0,0 @@
.gitignore
README.md
compile-mono.sh
docs/ApiResponse.md
docs/Category.md
docs/Order.md
docs/Pet.md
docs/PetApi.md
docs/StoreApi.md
docs/Tag.md
docs/User.md
docs/UserApi.md
src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Api/UserApi.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiClient.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Client/Configuration.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Model/ApiResponse.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Model/Category.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Model/Order.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Model/Pet.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Model/Tag.cs
src/main/CsharpDotNet2/Org/OpenAPITools/Model/User.cs
vendor/packages.config

View File

@ -1,132 +0,0 @@
# Org.OpenAPITools - the C# library for the OpenAPI Petstore
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported
- .NET 2.0
<a name="dependencies"></a>
## Dependencies
- Mono compiler
- Newtonsoft.Json.7.0.1
- RestSharp.Net2.1.1.11
Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator
<a name="installation"></a>
## Installation
Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh compile-mono.sh`
- [Windows] TODO
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
```
<a name="getting-started"></a>
## Getting Started
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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 | 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 );
}
}
}
}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="documentation-for-models"></a>
## Documentation for Models
- [Org.OpenAPITools.Model.ApiResponse](docs/ApiResponse.md)
- [Org.OpenAPITools.Model.Category](docs/Category.md)
- [Org.OpenAPITools.Model.Order](docs/Order.md)
- [Org.OpenAPITools.Model.Pet](docs/Pet.md)
- [Org.OpenAPITools.Model.Tag](docs/Tag.md)
- [Org.OpenAPITools.Model.User](docs/User.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
Authentication schemes defined for the API:
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
<a name="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets

View File

@ -1,12 +0,0 @@
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install vendor/packages.config -o vendor;
mkdir -p bin;
mcs -sdk:2 -r:vendor/Newtonsoft.Json.7.0.1/lib/net20/Newtonsoft.Json.dll,\
vendor/RestSharp.Net2.1.1.11/lib/net20/RestSharp.Net2.dll,\
System.Runtime.Serialization.dll \
-target:library \
-out:bin/Org.OpenAPITools.dll \
-recurse:'src/*.cs' \
-doc:bin/Org.OpenAPITools.xml \
-platform:anycpu

View File

@ -1,11 +0,0 @@
# Org.OpenAPITools.Model.ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **int?** | | [optional]
**Type** | **string** | | [optional]
**Message** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# Org.OpenAPITools.Model.Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# Org.OpenAPITools.Model.InlineObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | Updated name of the pet | [optional]
**Status** | **string** | Updated status of the pet | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# Org.OpenAPITools.Model.InlineObject1
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**AdditionalMetadata** | **string** | Additional data to pass to server | [optional]
**File** | **System.IO.Stream** | file to upload | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# Org.OpenAPITools.Model.Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**PetId** | **long?** | | [optional]
**Quantity** | **int?** | | [optional]
**ShipDate** | **DateTime?** | | [optional]
**Status** | **string** | Order Status | [optional]
**Complete** | **bool?** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# Org.OpenAPITools.Model.Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Category** | [**Category**](Category.md) | | [optional]
**Name** | **string** | |
**PhotoUrls** | **List<string>** | |
**Tags** | [**List<Tag>**](Tag.md) | | [optional]
**Status** | **string** | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,526 +0,0 @@
# Org.OpenAPITools.Api.PetApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
<a name="addpet"></a>
# **AddPet**
> void AddPet (Pet body)
Add a new pet to the store
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deletepet"></a>
# **DeletePet**
> void DeletePet (long? petId, string apiKey)
Deletes a pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbystatus"></a>
# **FindPetsByStatus**
> List<Pet> FindPetsByStatus (List<string> status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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 = status_example; // 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<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbytags"></a>
# **FindPetsByTags**
> List<Pet> FindPetsByTags (List<string> tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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>**](string.md)| Tags to filter by |
### Return type
[**List<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getpetbyid"></a>
# **GetPetById**
> Pet GetPetById (long? petId)
Find pet by ID
Returns a single pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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**](Pet.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepet"></a>
# **UpdatePet**
> void UpdatePet (Pet body)
Update an existing pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepetwithform"></a>
# **UpdatePetWithForm**
> void UpdatePetWithForm (long? petId, string name, string status)
Updates a pet in the store with form data
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="uploadfile"></a>
# **UploadFile**
> ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file)
uploads an image
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,254 +0,0 @@
# Org.OpenAPITools.Api.StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
<a name="deleteorder"></a>
# **DeleteOrder**
> void DeleteOrder (string orderId)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class DeleteOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = orderId_example; // string | ID of the order that needs to be deleted
try
{
// Delete purchase order by ID
apiInstance.DeleteOrder(orderId);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **string**| ID of the order that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getinventory"></a>
# **GetInventory**
> Dictionary<string, int?> GetInventory ()
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetInventoryExample
{
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 StoreApi();
try
{
// Returns pet inventories by status
Dictionary&lt;string, int?&gt; result = apiInstance.GetInventory();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
**Dictionary<string, int?>**
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getorderbyid"></a>
# **GetOrderById**
> Order GetOrderById (long? orderId)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetOrderByIdExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = 789; // long? | ID of pet that needs to be fetched
try
{
// Find purchase order by ID
Order result = apiInstance.GetOrderById(orderId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **long?**| ID of pet that needs to be fetched |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="placeorder"></a>
# **PlaceOrder**
> Order PlaceOrder (Order body)
Place an order for a pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class PlaceOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var body = new Order(); // Order | order placed for purchasing the pet
try
{
// Place an order for a pet
Order result = apiInstance.PlaceOrder(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# Org.OpenAPITools.Model.Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,16 +0,0 @@
# Org.OpenAPITools.Model.User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Username** | **string** | | [optional]
**FirstName** | **string** | | [optional]
**LastName** | **string** | | [optional]
**Email** | **string** | | [optional]
**Password** | **string** | | [optional]
**Phone** | **string** | | [optional]
**UserStatus** | **int?** | User Status | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,488 +0,0 @@
# Org.OpenAPITools.Api.UserApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user
[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="createuser"></a>
# **CreateUser**
> void CreateUser (User body)
Create user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class CreateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new User(); // User | Created user object
try
{
// Create user
apiInstance.CreateUser(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswitharrayinput"></a>
# **CreateUsersWithArrayInput**
> void CreateUsersWithArrayInput (List<User> body)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class CreateUsersWithArrayInputExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithArrayInput(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List<User>**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswithlistinput"></a>
# **CreateUsersWithListInput**
> void CreateUsersWithListInput (List<User> body)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class CreateUsersWithListInputExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithListInput(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List<User>**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deleteuser"></a>
# **DeleteUser**
> void DeleteUser (string username)
Delete user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class DeleteUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be deleted
try
{
// Delete user
apiInstance.DeleteUser(username);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getuserbyname"></a>
# **GetUserByName**
> User GetUserByName (string username)
Get user by user name
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetUserByNameExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be fetched. Use user1 for testing.
try
{
// Get user by user name
User result = apiInstance.GetUserByName(username);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
### Return type
[**User**](User.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="loginuser"></a>
# **LoginUser**
> string LoginUser (string username, string password)
Logs user into the system
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class LoginUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The user name for login
var password = password_example; // string | The password for login in clear text
try
{
// Logs user into the system
string result = apiInstance.LoginUser(username, password);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The user name for login |
**password** | **string**| The password for login in clear text |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="logoutuser"></a>
# **LogoutUser**
> void LogoutUser ()
Logs out current logged in user session
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class LogoutUserExample
{
public void main()
{
var apiInstance = new UserApi();
try
{
// Logs out current logged in user session
apiInstance.LogoutUser();
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updateuser"></a>
# **UpdateUser**
> void UpdateUser (string username, User body)
Updated user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class UpdateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | name that need to be deleted
var body = new User(); // User | Updated user object
try
{
// Updated user
apiInstance.UpdateUser(username, body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,431 +0,0 @@
using System;
using System.Collections.Generic;
using RestSharp;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IPetApi
{
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns></returns>
void AddPet (Pet body);
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns>
void DeletePet (long? petId, string apiKey);
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma separated strings
/// </summary>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>List&lt;Pet&gt;</returns>
List<Pet> FindPetsByStatus (List<string> status);
/// <summary>
/// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
/// <param name="tags">Tags to filter by</param>
/// <returns>List&lt;Pet&gt;</returns>
[Obsolete]
List<Pet> FindPetsByTags (List<string> tags);
/// <summary>
/// Find pet by ID Returns a single pet
/// </summary>
/// <param name="petId">ID of pet to return</param>
/// <returns>Pet</returns>
Pet GetPetById (long? petId);
/// <summary>
/// Update an existing pet
/// </summary>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns></returns>
void UpdatePet (Pet body);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns></returns>
void UpdatePetWithForm (long? petId, string name, string status);
/// <summary>
/// uploads an image
/// </summary>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns>ApiResponse</returns>
ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class PetApi : IPetApi
{
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
/// <returns></returns>
public PetApi(ApiClient apiClient = null)
{
if (apiClient == null) // use the default one in Configuration
this.ApiClient = Configuration.DefaultApiClient;
else
this.ApiClient = apiClient;
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <returns></returns>
public PetApi(String basePath)
{
this.ApiClient = new ApiClient(basePath);
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public void SetBasePath(String basePath)
{
this.ApiClient.BasePath = basePath;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public String GetBasePath(String basePath)
{
return this.ApiClient.BasePath;
}
/// <summary>
/// Gets or sets the API client.
/// </summary>
/// <value>An instance of the ApiClient</value>
public ApiClient ApiClient {get; set;}
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns></returns>
public void AddPet (Pet body)
{
// verify the required parameter 'body' is set
if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling AddPet");
var path = "/pet";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns>
public void DeletePet (long? petId, string apiKey)
{
// verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet");
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;
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma separated strings
/// </summary>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>List&lt;Pet&gt;</returns>
public List<Pet> FindPetsByStatus (List<string> status)
{
// verify the required parameter 'status' is set
if (status == null) throw new ApiException(400, "Missing required parameter 'status' when calling FindPetsByStatus");
var path = "/pet/findByStatus";
path = path.Replace("{format}", "json");
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;
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
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 FindPetsByStatus: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
}
/// <summary>
/// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
/// <param name="tags">Tags to filter by</param>
/// <returns>List&lt;Pet&gt;</returns>
[Obsolete]
public List<Pet> FindPetsByTags (List<string> tags)
{
// verify the required parameter 'tags' is set
if (tags == null) throw new ApiException(400, "Missing required parameter 'tags' when calling FindPetsByTags");
var path = "/pet/findByTags";
path = path.Replace("{format}", "json");
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;
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
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 FindPetsByTags: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
}
/// <summary>
/// Find pet by ID Returns a single pet
/// </summary>
/// <param name="petId">ID of pet to return</param>
/// <returns>Pet</returns>
public Pet GetPetById (long? petId)
{
// verify the required parameter 'petId' is set
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;
// authentication setting, if any
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
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);
}
/// <summary>
/// Update an existing pet
/// </summary>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns></returns>
public void UpdatePet (Pet body)
{
// verify the required parameter 'body' is set
if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling UpdatePet");
var path = "/pet";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns></returns>
public void UpdatePetWithForm (long? petId, string name, string status)
{
// verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm");
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;
if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// uploads an image
/// </summary>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns>ApiResponse</returns>
public ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file)
{
// verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UploadFile");
var path = "/pet/{petId}/uploadImage";
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;
if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter
if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file));
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage);
return (ApiResponse) ApiClient.Deserialize(response.Content, typeof(ApiResponse), response.Headers);
}
}
}

View File

@ -1,236 +0,0 @@
using System;
using System.Collections.Generic;
using RestSharp;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IStoreApi
{
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
void DeleteOrder (string orderId);
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary&lt;string, int?&gt;</returns>
Dictionary<string, int?> GetInventory ();
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
/// </summary>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
Order GetOrderById (long? orderId);
/// <summary>
/// Place an order for a pet
/// </summary>
/// <param name="body">order placed for purchasing the pet</param>
/// <returns>Order</returns>
Order PlaceOrder (Order body);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class StoreApi : IStoreApi
{
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
/// <returns></returns>
public StoreApi(ApiClient apiClient = null)
{
if (apiClient == null) // use the default one in Configuration
this.ApiClient = Configuration.DefaultApiClient;
else
this.ApiClient = apiClient;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <returns></returns>
public StoreApi(String basePath)
{
this.ApiClient = new ApiClient(basePath);
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public void SetBasePath(String basePath)
{
this.ApiClient.BasePath = basePath;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public String GetBasePath(String basePath)
{
return this.ApiClient.BasePath;
}
/// <summary>
/// Gets or sets the API client.
/// </summary>
/// <value>An instance of the ApiClient</value>
public ApiClient ApiClient {get; set;}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
public void DeleteOrder (string orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling DeleteOrder");
var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary&lt;string, int?&gt;</returns>
public Dictionary<string, int?> GetInventory ()
{
var path = "/store/inventory";
path = path.Replace("{format}", "json");
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;
// authentication setting, if any
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
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 GetInventory: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage);
return (Dictionary<string, int?>) ApiClient.Deserialize(response.Content, typeof(Dictionary<string, int?>), response.Headers);
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
/// </summary>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
public Order GetOrderById (long? orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById");
var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 GetOrderById: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
}
/// <summary>
/// Place an order for a pet
/// </summary>
/// <param name="body">order placed for purchasing the pet</param>
/// <returns>Order</returns>
public Order PlaceOrder (Order body)
{
// verify the required parameter 'body' is set
if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling PlaceOrder");
var path = "/store/order";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
}
}
}

View File

@ -1,420 +0,0 @@
using System;
using System.Collections.Generic;
using RestSharp;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IUserApi
{
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
/// <param name="body">Created user object</param>
/// <returns></returns>
void CreateUser (User body);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="body">List of user object</param>
/// <returns></returns>
void CreateUsersWithArrayInput (List<User> body);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="body">List of user object</param>
/// <returns></returns>
void CreateUsersWithListInput (List<User> body);
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
/// <param name="username">The name that needs to be deleted</param>
/// <returns></returns>
void DeleteUser (string username);
/// <summary>
/// Get user by user name
/// </summary>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>User</returns>
User GetUserByName (string username);
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>string</returns>
string LoginUser (string username, string password);
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
void LogoutUser ();
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="username">name that need to be deleted</param>
/// <param name="body">Updated user object</param>
/// <returns></returns>
void UpdateUser (string username, User body);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class UserApi : IUserApi
{
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
/// <returns></returns>
public UserApi(ApiClient apiClient = null)
{
if (apiClient == null) // use the default one in Configuration
this.ApiClient = Configuration.DefaultApiClient;
else
this.ApiClient = apiClient;
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <returns></returns>
public UserApi(String basePath)
{
this.ApiClient = new ApiClient(basePath);
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public void SetBasePath(String basePath)
{
this.ApiClient.BasePath = basePath;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public String GetBasePath(String basePath)
{
return this.ApiClient.BasePath;
}
/// <summary>
/// Gets or sets the API client.
/// </summary>
/// <value>An instance of the ApiClient</value>
public ApiClient ApiClient {get; set;}
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
/// <param name="body">Created user object</param>
/// <returns></returns>
public void CreateUser (User body)
{
// verify the required parameter 'body' is set
if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUser");
var path = "/user";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="body">List of user object</param>
/// <returns></returns>
public void CreateUsersWithArrayInput (List<User> body)
{
// verify the required parameter 'body' is set
if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUsersWithArrayInput");
var path = "/user/createWithArray";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="body">List of user object</param>
/// <returns></returns>
public void CreateUsersWithListInput (List<User> body)
{
// verify the required parameter 'body' is set
if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUsersWithListInput");
var path = "/user/createWithList";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
/// <param name="username">The name that needs to be deleted</param>
/// <returns></returns>
public void DeleteUser (string username)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling DeleteUser");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Get user by user name
/// </summary>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>User</returns>
public User GetUserByName (string username)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 GetUserByName: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage);
return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers);
}
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>string</returns>
public string LoginUser (string username, string password)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling LoginUser");
// verify the required parameter 'password' is set
if (password == null) throw new ApiException(400, "Missing required parameter 'password' when calling LoginUser");
var path = "/user/login";
path = path.Replace("{format}", "json");
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;
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 LoginUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage);
return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers);
}
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
public void LogoutUser ()
{
var path = "/user/logout";
path = path.Replace("{format}", "json");
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 LogoutUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="username">name that need to be deleted</param>
/// <param name="body">Updated user object</param>
/// <returns></returns>
public void UpdateUser (string username, User body)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser");
// verify the required parameter 'body' is set
if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling UpdateUser");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
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;
postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
}
}

View File

@ -1,297 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Linq;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Extensions;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// API client is mainly responsible for making the HTTP call to the API backend.
/// </summary>
public class ApiClient
{
private readonly Dictionary<String, String> _defaultHeaderMap = new Dictionary<String, String>();
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" /> class.
/// </summary>
/// <param name="basePath">The base path.</param>
public ApiClient(String basePath="http://petstore.swagger.io/v2")
{
BasePath = basePath;
RestClient = new RestClient(BasePath);
}
/// <summary>
/// Gets or sets the base path.
/// </summary>
/// <value>The base path</value>
public string BasePath { get; set; }
/// <summary>
/// Gets or sets the RestClient.
/// </summary>
/// <value>An instance of the RestClient</value>
public RestClient RestClient { get; set; }
/// <summary>
/// Gets the default header.
/// </summary>
public Dictionary<String, String> DefaultHeader
{
get { return _defaultHeaderMap; }
}
/// <summary>
/// Makes the HTTP request (Sync).
/// </summary>
/// <param name="path">URL path.</param>
/// <param name="method">HTTP method.</param>
/// <param name="queryParams">Query parameters.</param>
/// <param name="postBody">HTTP body (POST request).</param>
/// <param name="headerParams">Header parameters.</param>
/// <param name="formParams">Form parameters.</param>
/// <param name="fileParams">File parameters.</param>
/// <param name="authSettings">Authentication settings.</param>
/// <returns>Object</returns>
public Object CallApi(String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, String[] authSettings)
{
var request = new RestRequest(path, method);
UpdateParamsForAuth(queryParams, headerParams, authSettings);
// add default header, if any
foreach(var defaultHeader in _defaultHeaderMap)
request.AddHeader(defaultHeader.Key, defaultHeader.Value);
// add header parameter, if any
foreach(var param in headerParams)
request.AddHeader(param.Key, param.Value);
// add query parameter, if any
foreach(var param in queryParams)
request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
// add form parameter, if any
foreach(var param in formParams)
request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
// add file parameter, if any
foreach(var param in fileParams)
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
if (postBody != null) // http body (model) parameter
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
return (Object)RestClient.Execute(request);
}
/// <summary>
/// Add default header.
/// </summary>
/// <param name="key">Header field name.</param>
/// <param name="value">Header field value.</param>
/// <returns></returns>
public void AddDefaultHeader(string key, string value)
{
_defaultHeaderMap.Add(key, value);
}
/// <summary>
/// Escape string (url-encoded).
/// </summary>
/// <param name="str">String to be escaped.</param>
/// <returns>Escaped string.</returns>
public string EscapeString(string str)
{
return RestSharp.Contrib.HttpUtility.UrlEncode(str);
}
/// <summary>
/// Create FileParameter based on Stream.
/// </summary>
/// <param name="name">Parameter name.</param>
/// <param name="stream">Input stream.</param>
/// <returns>FileParameter.</returns>
public FileParameter ParameterToFile(string name, Stream stream)
{
if (stream is FileStream)
return FileParameter.Create(name, stream.ReadAsBytes(), Path.GetFileName(((FileStream)stream).Name));
else
return FileParameter.Create(name, stream.ReadAsBytes(), "no_file_name_provided");
}
/// <summary>
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list of string, join the list with ",".
/// Otherwise just return the string.
/// </summary>
/// <param name="obj">The parameter (header, path, query, form).</param>
/// <returns>Formatted string.</returns>
public string ParameterToString(object obj)
{
if (obj is DateTime)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return ((DateTime)obj).ToString (Configuration.DateTimeFormat);
else if (obj is bool)
return (bool)obj ? "true" : "false";
else if (obj is List<string>)
return String.Join(",", (obj as List<string>).ToArray());
else
return Convert.ToString (obj);
}
/// <summary>
/// Deserialize the JSON string into a proper object.
/// </summary>
/// <param name="content">HTTP body (e.g. string, JSON).</param>
/// <param name="type">Object type.</param>
/// <param name="headers">HTTP headers.</param>
/// <returns>Object representation of the JSON string.</returns>
public object Deserialize(string content, Type type, IList<Parameter> headers=null)
{
if (type == typeof(Object)) // return an object
{
return content;
}
if (type == typeof(Stream))
{
var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath)
? Path.GetTempPath()
: Configuration.TempFolderPath;
var fileName = filePath + Guid.NewGuid();
if (headers != null)
{
var regex = new Regex(@"Content-Disposition:.*filename=['""]?([^'""\s]+)['""]?$");
var match = regex.Match(headers.ToString());
if (match.Success)
fileName = filePath + match.Value.Replace("\"", "").Replace("'", "");
}
File.WriteAllText(fileName, content);
return new FileStream(fileName, FileMode.Open);
}
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
{
return DateTime.Parse(content, null, System.Globalization.DateTimeStyles.RoundtripKind);
}
if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
{
return ConvertType(content, type);
}
// at this point, it must be a model (json)
try
{
return JsonConvert.DeserializeObject(content, type);
}
catch (IOException e)
{
throw new ApiException(500, e.Message);
}
}
/// <summary>
/// Serialize an object into JSON string.
/// </summary>
/// <param name="obj">Object.</param>
/// <returns>JSON string.</returns>
public string Serialize(object obj)
{
try
{
return obj != null ? JsonConvert.SerializeObject(obj) : null;
}
catch (Exception e)
{
throw new ApiException(500, e.Message);
}
}
/// <summary>
/// Get the API key with prefix.
/// </summary>
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
/// <returns>API key with prefix.</returns>
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
{
var apiKeyValue = "";
Configuration.ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
var apiKeyPrefix = "";
if (Configuration.ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
return apiKeyPrefix + " " + apiKeyValue;
else
return apiKeyValue;
}
/// <summary>
/// Update parameters based on authentication.
/// </summary>
/// <param name="queryParams">Query parameters.</param>
/// <param name="headerParams">Header parameters.</param>
/// <param name="authSettings">Authentication settings.</param>
public void UpdateParamsForAuth(Dictionary<String, String> queryParams, Dictionary<String, String> headerParams, string[] authSettings)
{
if (authSettings == null || authSettings.Length == 0)
return;
foreach (string auth in authSettings)
{
// determine which one to use
switch(auth)
{
case "api_key":
headerParams["api_key"] = GetApiKeyWithPrefix("api_key");
break;
case "petstore_auth":
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
break;
default:
//TODO show warning about security definition not found
break;
}
}
}
/// <summary>
/// Encode string in base64 format.
/// </summary>
/// <param name="text">String to be encoded.</param>
/// <returns>Encoded string.</returns>
public static string Base64Encode(string text)
{
var textByte = System.Text.Encoding.UTF8.GetBytes(text);
return System.Convert.ToBase64String(textByte);
}
/// <summary>
/// Dynamically cast the object into target type.
/// </summary>
/// <param name="fromObject">Object to be casted</param>
/// <param name="toObject">Target type</param>
/// <returns>Casted object</returns>
public static Object ConvertType(Object fromObject, Type toObject) {
return Convert.ChangeType(fromObject, toObject);
}
}
}

View File

@ -1,47 +0,0 @@
using System;
namespace Org.OpenAPITools.Client {
/// <summary>
/// API Exception
/// </summary>
public class ApiException : Exception {
/// <summary>
/// Gets or sets the error code (HTTP status code)
/// </summary>
/// <value>The error code (HTTP status code).</value>
public int ErrorCode { get; set; }
/// <summary>
/// Gets or sets the error content (body json object)
/// </summary>
/// <value>The error content (Http response body).</value>
public Object ErrorContent { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
public ApiException() {}
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
public ApiException(int errorCode, string message) : base(message) {
this.ErrorCode = errorCode;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
/// <param name="errorContent">Error content.</param>
public ApiException(int errorCode, string message, Object errorContent = null) : base(message) {
this.ErrorCode = errorCode;
this.ErrorContent = errorContent;
}
}
}

View File

@ -1,138 +0,0 @@
using System;
using System.Reflection;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Represents a set of configuration settings
/// </summary>
public class Configuration
{
/// <summary>
/// Version of the package.
/// </summary>
/// <value>Version of the package.</value>
public const string Version = "1.0.0";
/// <summary>
/// Gets or sets the default API client for making HTTP calls.
/// </summary>
/// <value>The API client.</value>
public static ApiClient DefaultApiClient = new ApiClient();
/// <summary>
/// Gets or sets the username (HTTP basic authentication).
/// </summary>
/// <value>The username.</value>
public static String Username { get; set; }
/// <summary>
/// Gets or sets the password (HTTP basic authentication).
/// </summary>
/// <value>The password.</value>
public static String Password { get; set; }
/// <summary>
/// Gets or sets the access token (Bearer/OAuth authentication).
/// </summary>
/// <value>The access token.</value>
public static String AccessToken { get; set; }
/// <summary>
/// Gets or sets the API key based on the authentication name.
/// </summary>
/// <value>The API key.</value>
public static Dictionary<String, String> ApiKey = new Dictionary<String, String>();
/// <summary>
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
/// </summary>
/// <value>The prefix of the API key.</value>
public static Dictionary<String, String> ApiKeyPrefix = new Dictionary<String, String>();
private static string _tempFolderPath = Path.GetTempPath();
/// <summary>
/// Gets or sets the temporary folder path to store the files downloaded from the server.
/// </summary>
/// <value>Folder path.</value>
public static String TempFolderPath
{
get { return _tempFolderPath; }
set
{
if (String.IsNullOrEmpty(value))
{
_tempFolderPath = value;
return;
}
// create the directory if it does not exist
if (!Directory.Exists(value))
Directory.CreateDirectory(value);
// check if the path contains directory separator at the end
if (value[value.Length - 1] == Path.DirectorySeparatorChar)
_tempFolderPath = value;
else
_tempFolderPath = value + Path.DirectorySeparatorChar;
}
}
private const string ISO8601_DATETIME_FORMAT = "o";
private static string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
/// <summary>
/// Gets or sets the date time format used when serializing in the ApiClient
/// By default, it's set to ISO 8601 - "o", for others see:
/// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
/// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
/// No validation is done to ensure that the string you're providing is valid
/// </summary>
/// <value>The DateTimeFormat string</value>
public static String DateTimeFormat
{
get
{
return _dateTimeFormat;
}
set
{
if (string.IsNullOrEmpty(value))
{
// Never allow a blank or null string, go back to the default
_dateTimeFormat = ISO8601_DATETIME_FORMAT;
return;
}
// Caution, no validation when you choose date time format other than ISO 8601
// Take a look at the above links
_dateTimeFormat = value;
}
}
/// <summary>
/// Returns a string with essential information for debugging.
/// </summary>
public static String ToDebugReport()
{
String report = "C# SDK (Org.OpenAPITools) Debug Report:\n";
report += " OS: " + Environment.OSVersion + "\n";
report += " .NET Framework Version: " + Assembly
.GetExecutingAssembly()
.GetReferencedAssemblies()
.Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
report += " Version of the API: 1.0.0\n";
report += " SDK Package Version: 1.0.0\n";
return report;
}
}
}

View File

@ -1,60 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// Describes the result of uploading an image resource
/// </summary>
[DataContract]
public class ApiResponse {
/// <summary>
/// Gets or Sets Code
/// </summary>
[DataMember(Name="code", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "code")]
public int? Code { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name="type", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "type")]
public string Type { get; set; }
/// <summary>
/// Gets or Sets Message
/// </summary>
[DataMember(Name="message", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class ApiResponse {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,52 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A category for a pet
/// </summary>
[DataContract]
public class Category {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Category {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,54 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
///
/// </summary>
[DataContract]
public class InlineObject {
/// <summary>
/// Updated name of the pet
/// </summary>
/// <value>Updated name of the pet</value>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Updated status of the pet
/// </summary>
/// <value>Updated status of the pet</value>
[DataMember(Name="status", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "status")]
public string Status { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class InlineObject {\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,54 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
///
/// </summary>
[DataContract]
public class InlineObject1 {
/// <summary>
/// Additional data to pass to server
/// </summary>
/// <value>Additional data to pass to server</value>
[DataMember(Name="additionalMetadata", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "additionalMetadata")]
public string AdditionalMetadata { get; set; }
/// <summary>
/// file to upload
/// </summary>
/// <value>file to upload</value>
[DataMember(Name="file", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "file")]
public System.IO.Stream File { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class InlineObject1 {\n");
sb.Append(" AdditionalMetadata: ").Append(AdditionalMetadata).Append("\n");
sb.Append(" File: ").Append(File).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,85 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// An order for a pets from the pet store
/// </summary>
[DataContract]
public class Order {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets PetId
/// </summary>
[DataMember(Name="petId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "petId")]
public long? PetId { get; set; }
/// <summary>
/// Gets or Sets Quantity
/// </summary>
[DataMember(Name="quantity", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "quantity")]
public int? Quantity { get; set; }
/// <summary>
/// Gets or Sets ShipDate
/// </summary>
[DataMember(Name="shipDate", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "shipDate")]
public DateTime? ShipDate { get; set; }
/// <summary>
/// Order Status
/// </summary>
/// <value>Order Status</value>
[DataMember(Name="status", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "status")]
public string Status { get; set; }
/// <summary>
/// Gets or Sets Complete
/// </summary>
[DataMember(Name="complete", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "complete")]
public bool? Complete { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Order {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" PetId: ").Append(PetId).Append("\n");
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append(" Complete: ").Append(Complete).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,85 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A pet for sale in the pet store
/// </summary>
[DataContract]
public class Pet {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Category
/// </summary>
[DataMember(Name="category", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "category")]
public Category Category { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or Sets PhotoUrls
/// </summary>
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "photoUrls")]
public List<string> PhotoUrls { get; set; }
/// <summary>
/// Gets or Sets Tags
/// </summary>
[DataMember(Name="tags", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "tags")]
public List<Tag> Tags { get; set; }
/// <summary>
/// pet status in the store
/// </summary>
/// <value>pet status in the store</value>
[DataMember(Name="status", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "status")]
public string Status { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Pet {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Category: ").Append(Category).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
sb.Append(" Tags: ").Append(Tags).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,52 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A tag for a pet
/// </summary>
[DataContract]
public class Tag {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Tag {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,101 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A User who is purchasing from the pet store
/// </summary>
[DataContract]
public class User {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Username
/// </summary>
[DataMember(Name="username", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "username")]
public string Username { get; set; }
/// <summary>
/// Gets or Sets FirstName
/// </summary>
[DataMember(Name="firstName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "firstName")]
public string FirstName { get; set; }
/// <summary>
/// Gets or Sets LastName
/// </summary>
[DataMember(Name="lastName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "lastName")]
public string LastName { get; set; }
/// <summary>
/// Gets or Sets Email
/// </summary>
[DataMember(Name="email", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "email")]
public string Email { get; set; }
/// <summary>
/// Gets or Sets Password
/// </summary>
[DataMember(Name="password", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "password")]
public string Password { get; set; }
/// <summary>
/// Gets or Sets Phone
/// </summary>
[DataMember(Name="phone", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "phone")]
public string Phone { get; set; }
/// <summary>
/// User Status
/// </summary>
/// <value>User Status</value>
[DataMember(Name="userStatus", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "userStatus")]
public int? UserStatus { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class User {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Username: ").Append(Username).Append("\n");
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
sb.Append(" LastName: ").Append(LastName).Append("\n");
sb.Append(" Email: ").Append(Email).Append("\n");
sb.Append(" Password: ").Append(Password).Append("\n");
sb.Append(" Phone: ").Append(Phone).Append("\n");
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp.Net2" version="1.1.11" targetFramework="net20" developmentDependency="true" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net20" developmentDependency="true" />
</packages>

View File

@ -1,23 +0,0 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -1,131 +0,0 @@
# Org.OpenAPITools - the C# library for the OpenAPI Petstore
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported
- .NET 2.0
<a name="dependencies"></a>
## Dependencies
- Mono compiler
- Newtonsoft.Json.7.0.1
- RestSharp.Net2.1.1.11
Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator
<a name="installation"></a>
## Installation
Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh compile-mono.sh`
- [Windows] TODO
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
```
<a name="getting-started"></a>
## Getting Started
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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 pet = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Add a new pet to the store
apiInstance.AddPet(pet);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
}
}
}
}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="documentation-for-models"></a>
## Documentation for Models
- [Org.OpenAPITools.Model.ApiResponse](docs/ApiResponse.md)
- [Org.OpenAPITools.Model.Category](docs/Category.md)
- [Org.OpenAPITools.Model.Order](docs/Order.md)
- [Org.OpenAPITools.Model.Pet](docs/Pet.md)
- [Org.OpenAPITools.Model.Tag](docs/Tag.md)
- [Org.OpenAPITools.Model.User](docs/User.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
<a name="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets

View File

@ -1,12 +0,0 @@
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install vendor/packages.config -o vendor;
mkdir -p bin;
mcs -sdk:2 -r:vendor/Newtonsoft.Json.7.0.1/lib/net20/Newtonsoft.Json.dll,\
vendor/RestSharp.Net2.1.1.11/lib/net20/RestSharp.Net2.dll,\
System.Runtime.Serialization.dll \
-target:library \
-out:bin/Org.OpenAPITools.dll \
-recurse:'src/*.cs' \
-doc:bin/Org.OpenAPITools.xml \
-platform:anycpu

View File

@ -1,11 +0,0 @@
# Org.OpenAPITools.Model.ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **int?** | | [optional]
**Type** | **string** | | [optional]
**Message** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# Org.OpenAPITools.Model.Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# Org.OpenAPITools.Model.Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**PetId** | **long?** | | [optional]
**Quantity** | **int?** | | [optional]
**ShipDate** | **DateTime?** | | [optional]
**Status** | **string** | Order Status | [optional]
**Complete** | **bool?** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# Org.OpenAPITools.Model.Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Category** | [**Category**](Category.md) | | [optional]
**Name** | **string** | |
**PhotoUrls** | **List<string>** | |
**Tags** | [**List<Tag>**](Tag.md) | | [optional]
**Status** | **string** | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,534 +0,0 @@
# Org.OpenAPITools.Api.PetApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
<a name="addpet"></a>
# **AddPet**
> void AddPet (Pet pet)
Add a new pet to the store
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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 pet = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Add a new pet to the store
apiInstance.AddPet(pet);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deletepet"></a>
# **DeletePet**
> void DeletePet (long? petId, string apiKey)
Deletes a pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbystatus"></a>
# **FindPetsByStatus**
> List<Pet> FindPetsByStatus (List<string> status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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 = status_example; // 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<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbytags"></a>
# **FindPetsByTags**
> List<Pet> FindPetsByTags (List<string> tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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>**](string.md)| Tags to filter by |
### Return type
[**List<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getpetbyid"></a>
# **GetPetById**
> Pet GetPetById (long? petId)
Find pet by ID
Returns a single pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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**](Pet.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepet"></a>
# **UpdatePet**
> void UpdatePet (Pet pet)
Update an existing pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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 pet = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Update an existing pet
apiInstance.UpdatePet(pet);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepetwithform"></a>
# **UpdatePetWithForm**
> void UpdatePetWithForm (long? petId, string name, string status)
Updates a pet in the store with form data
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="uploadfile"></a>
# **UploadFile**
> ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file)
uploads an image
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.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**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,258 +0,0 @@
# Org.OpenAPITools.Api.StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
<a name="deleteorder"></a>
# **DeleteOrder**
> void DeleteOrder (string orderId)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class DeleteOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = orderId_example; // string | ID of the order that needs to be deleted
try
{
// Delete purchase order by ID
apiInstance.DeleteOrder(orderId);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **string**| ID of the order that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getinventory"></a>
# **GetInventory**
> Dictionary<string, int?> GetInventory ()
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetInventoryExample
{
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 StoreApi();
try
{
// Returns pet inventories by status
Dictionary&lt;string, int?&gt; result = apiInstance.GetInventory();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
**Dictionary<string, int?>**
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getorderbyid"></a>
# **GetOrderById**
> Order GetOrderById (long? orderId)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetOrderByIdExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = 789; // long? | ID of pet that needs to be fetched
try
{
// Find purchase order by ID
Order result = apiInstance.GetOrderById(orderId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **long?**| ID of pet that needs to be fetched |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="placeorder"></a>
# **PlaceOrder**
> Order PlaceOrder (Order order)
Place an order for a pet
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class PlaceOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var order = new Order(); // Order | order placed for purchasing the pet
try
{
// Place an order for a pet
Order result = apiInstance.PlaceOrder(order);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# Org.OpenAPITools.Model.Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,16 +0,0 @@
# Org.OpenAPITools.Model.User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Username** | **string** | | [optional]
**FirstName** | **string** | | [optional]
**LastName** | **string** | | [optional]
**Email** | **string** | | [optional]
**Password** | **string** | | [optional]
**Phone** | **string** | | [optional]
**UserStatus** | **int?** | User Status | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,496 +0,0 @@
# Org.OpenAPITools.Api.UserApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user
[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="createuser"></a>
# **CreateUser**
> void CreateUser (User user)
Create user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class CreateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var user = new User(); // User | Created user object
try
{
// Create user
apiInstance.CreateUser(user);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**User**](User.md)| Created user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswitharrayinput"></a>
# **CreateUsersWithArrayInput**
> void CreateUsersWithArrayInput (List<User> user)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class CreateUsersWithArrayInputExample
{
public void main()
{
var apiInstance = new UserApi();
var user = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithArrayInput(user);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List<User>**](List.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswithlistinput"></a>
# **CreateUsersWithListInput**
> void CreateUsersWithListInput (List<User> user)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class CreateUsersWithListInputExample
{
public void main()
{
var apiInstance = new UserApi();
var user = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithListInput(user);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List<User>**](List.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deleteuser"></a>
# **DeleteUser**
> void DeleteUser (string username)
Delete user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class DeleteUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be deleted
try
{
// Delete user
apiInstance.DeleteUser(username);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getuserbyname"></a>
# **GetUserByName**
> User GetUserByName (string username)
Get user by user name
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class GetUserByNameExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be fetched. Use user1 for testing.
try
{
// Get user by user name
User result = apiInstance.GetUserByName(username);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
### Return type
[**User**](User.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="loginuser"></a>
# **LoginUser**
> string LoginUser (string username, string password)
Logs user into the system
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class LoginUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The user name for login
var password = password_example; // string | The password for login in clear text
try
{
// Logs user into the system
string result = apiInstance.LoginUser(username, password);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The user name for login |
**password** | **string**| The password for login in clear text |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="logoutuser"></a>
# **LogoutUser**
> void LogoutUser ()
Logs out current logged in user session
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class LogoutUserExample
{
public void main()
{
var apiInstance = new UserApi();
try
{
// Logs out current logged in user session
apiInstance.LogoutUser();
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updateuser"></a>
# **UpdateUser**
> void UpdateUser (string username, User user)
Updated user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class UpdateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | name that need to be deleted
var user = new User(); // User | Updated user object
try
{
// Updated user
apiInstance.UpdateUser(username, user);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| name that need to be deleted |
**user** | [**User**](User.md)| Updated user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,429 +0,0 @@
using System;
using System.Collections.Generic;
using RestSharp;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IPetApi
{
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <param name="pet">Pet object that needs to be added to the store</param>
/// <returns></returns>
void AddPet (Pet pet);
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns>
void DeletePet (long? petId, string apiKey);
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma separated strings
/// </summary>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>List&lt;Pet&gt;</returns>
List<Pet> FindPetsByStatus (List<string> status);
/// <summary>
/// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
/// <param name="tags">Tags to filter by</param>
/// <returns>List&lt;Pet&gt;</returns>
List<Pet> FindPetsByTags (List<string> tags);
/// <summary>
/// Find pet by ID Returns a single pet
/// </summary>
/// <param name="petId">ID of pet to return</param>
/// <returns>Pet</returns>
Pet GetPetById (long? petId);
/// <summary>
/// Update an existing pet
/// </summary>
/// <param name="pet">Pet object that needs to be added to the store</param>
/// <returns></returns>
void UpdatePet (Pet pet);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns></returns>
void UpdatePetWithForm (long? petId, string name, string status);
/// <summary>
/// uploads an image
/// </summary>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns>ApiResponse</returns>
ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class PetApi : IPetApi
{
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
/// <returns></returns>
public PetApi(ApiClient apiClient = null)
{
if (apiClient == null) // use the default one in Configuration
this.ApiClient = Configuration.DefaultApiClient;
else
this.ApiClient = apiClient;
}
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
/// <returns></returns>
public PetApi(String basePath)
{
this.ApiClient = new ApiClient(basePath);
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public void SetBasePath(String basePath)
{
this.ApiClient.BasePath = basePath;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public String GetBasePath(String basePath)
{
return this.ApiClient.BasePath;
}
/// <summary>
/// Gets or sets the API client.
/// </summary>
/// <value>An instance of the ApiClient</value>
public ApiClient ApiClient {get; set;}
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <param name="pet">Pet object that needs to be added to the store</param>
/// <returns></returns>
public void AddPet (Pet pet)
{
// verify the required parameter 'pet' is set
if (pet == null) throw new ApiException(400, "Missing required parameter 'pet' when calling AddPet");
var path = "/pet";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(pet); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns>
public void DeletePet (long? petId, string apiKey)
{
// verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet");
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;
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma separated strings
/// </summary>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>List&lt;Pet&gt;</returns>
public List<Pet> FindPetsByStatus (List<string> status)
{
// verify the required parameter 'status' is set
if (status == null) throw new ApiException(400, "Missing required parameter 'status' when calling FindPetsByStatus");
var path = "/pet/findByStatus";
path = path.Replace("{format}", "json");
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;
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
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 FindPetsByStatus: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
}
/// <summary>
/// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
/// <param name="tags">Tags to filter by</param>
/// <returns>List&lt;Pet&gt;</returns>
public List<Pet> FindPetsByTags (List<string> tags)
{
// verify the required parameter 'tags' is set
if (tags == null) throw new ApiException(400, "Missing required parameter 'tags' when calling FindPetsByTags");
var path = "/pet/findByTags";
path = path.Replace("{format}", "json");
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;
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
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 FindPetsByTags: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
}
/// <summary>
/// Find pet by ID Returns a single pet
/// </summary>
/// <param name="petId">ID of pet to return</param>
/// <returns>Pet</returns>
public Pet GetPetById (long? petId)
{
// verify the required parameter 'petId' is set
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;
// authentication setting, if any
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
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);
}
/// <summary>
/// Update an existing pet
/// </summary>
/// <param name="pet">Pet object that needs to be added to the store</param>
/// <returns></returns>
public void UpdatePet (Pet pet)
{
// verify the required parameter 'pet' is set
if (pet == null) throw new ApiException(400, "Missing required parameter 'pet' when calling UpdatePet");
var path = "/pet";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(pet); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns></returns>
public void UpdatePetWithForm (long? petId, string name, string status)
{
// verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm");
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;
if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// uploads an image
/// </summary>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns>ApiResponse</returns>
public ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file)
{
// verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UploadFile");
var path = "/pet/{petId}/uploadImage";
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;
if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter
if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file));
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage);
return (ApiResponse) ApiClient.Deserialize(response.Content, typeof(ApiResponse), response.Headers);
}
}
}

View File

@ -1,236 +0,0 @@
using System;
using System.Collections.Generic;
using RestSharp;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IStoreApi
{
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
void DeleteOrder (string orderId);
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary&lt;string, int?&gt;</returns>
Dictionary<string, int?> GetInventory ();
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
/// </summary>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
Order GetOrderById (long? orderId);
/// <summary>
/// Place an order for a pet
/// </summary>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Order</returns>
Order PlaceOrder (Order order);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class StoreApi : IStoreApi
{
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
/// <returns></returns>
public StoreApi(ApiClient apiClient = null)
{
if (apiClient == null) // use the default one in Configuration
this.ApiClient = Configuration.DefaultApiClient;
else
this.ApiClient = apiClient;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <returns></returns>
public StoreApi(String basePath)
{
this.ApiClient = new ApiClient(basePath);
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public void SetBasePath(String basePath)
{
this.ApiClient.BasePath = basePath;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public String GetBasePath(String basePath)
{
return this.ApiClient.BasePath;
}
/// <summary>
/// Gets or sets the API client.
/// </summary>
/// <value>An instance of the ApiClient</value>
public ApiClient ApiClient {get; set;}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
public void DeleteOrder (string orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling DeleteOrder");
var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary&lt;string, int?&gt;</returns>
public Dictionary<string, int?> GetInventory ()
{
var path = "/store/inventory";
path = path.Replace("{format}", "json");
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;
// authentication setting, if any
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
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 GetInventory: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage);
return (Dictionary<string, int?>) ApiClient.Deserialize(response.Content, typeof(Dictionary<string, int?>), response.Headers);
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
/// </summary>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
public Order GetOrderById (long? orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById");
var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 GetOrderById: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
}
/// <summary>
/// Place an order for a pet
/// </summary>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Order</returns>
public Order PlaceOrder (Order order)
{
// verify the required parameter 'order' is set
if (order == null) throw new ApiException(400, "Missing required parameter 'order' when calling PlaceOrder");
var path = "/store/order";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(order); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
}
}
}

View File

@ -1,420 +0,0 @@
using System;
using System.Collections.Generic;
using RestSharp;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IUserApi
{
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
/// <param name="user">Created user object</param>
/// <returns></returns>
void CreateUser (User user);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="user">List of user object</param>
/// <returns></returns>
void CreateUsersWithArrayInput (List<User> user);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="user">List of user object</param>
/// <returns></returns>
void CreateUsersWithListInput (List<User> user);
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
/// <param name="username">The name that needs to be deleted</param>
/// <returns></returns>
void DeleteUser (string username);
/// <summary>
/// Get user by user name
/// </summary>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>User</returns>
User GetUserByName (string username);
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>string</returns>
string LoginUser (string username, string password);
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
void LogoutUser ();
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="username">name that need to be deleted</param>
/// <param name="user">Updated user object</param>
/// <returns></returns>
void UpdateUser (string username, User user);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class UserApi : IUserApi
{
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
/// <returns></returns>
public UserApi(ApiClient apiClient = null)
{
if (apiClient == null) // use the default one in Configuration
this.ApiClient = Configuration.DefaultApiClient;
else
this.ApiClient = apiClient;
}
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
/// <returns></returns>
public UserApi(String basePath)
{
this.ApiClient = new ApiClient(basePath);
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public void SetBasePath(String basePath)
{
this.ApiClient.BasePath = basePath;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <param name="basePath">The base path</param>
/// <value>The base path</value>
public String GetBasePath(String basePath)
{
return this.ApiClient.BasePath;
}
/// <summary>
/// Gets or sets the API client.
/// </summary>
/// <value>An instance of the ApiClient</value>
public ApiClient ApiClient {get; set;}
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
/// <param name="user">Created user object</param>
/// <returns></returns>
public void CreateUser (User user)
{
// verify the required parameter 'user' is set
if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling CreateUser");
var path = "/user";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(user); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="user">List of user object</param>
/// <returns></returns>
public void CreateUsersWithArrayInput (List<User> user)
{
// verify the required parameter 'user' is set
if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling CreateUsersWithArrayInput");
var path = "/user/createWithArray";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(user); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="user">List of user object</param>
/// <returns></returns>
public void CreateUsersWithListInput (List<User> user)
{
// verify the required parameter 'user' is set
if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling CreateUsersWithListInput");
var path = "/user/createWithList";
path = path.Replace("{format}", "json");
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;
postBody = ApiClient.Serialize(user); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
/// <param name="username">The name that needs to be deleted</param>
/// <returns></returns>
public void DeleteUser (string username)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling DeleteUser");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Get user by user name
/// </summary>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>User</returns>
public User GetUserByName (string username)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 GetUserByName: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage);
return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers);
}
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>string</returns>
public string LoginUser (string username, string password)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling LoginUser");
// verify the required parameter 'password' is set
if (password == null) throw new ApiException(400, "Missing required parameter 'password' when calling LoginUser");
var path = "/user/login";
path = path.Replace("{format}", "json");
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;
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 LoginUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage);
return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers);
}
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
public void LogoutUser ()
{
var path = "/user/logout";
path = path.Replace("{format}", "json");
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;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
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 LogoutUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="username">name that need to be deleted</param>
/// <param name="user">Updated user object</param>
/// <returns></returns>
public void UpdateUser (string username, User user)
{
// verify the required parameter 'username' is set
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser");
// verify the required parameter 'user' is set
if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling UpdateUser");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
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;
postBody = ApiClient.Serialize(user); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage);
return;
}
}
}

View File

@ -1,297 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Linq;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Extensions;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// API client is mainly responsible for making the HTTP call to the API backend.
/// </summary>
public class ApiClient
{
private readonly Dictionary<String, String> _defaultHeaderMap = new Dictionary<String, String>();
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" /> class.
/// </summary>
/// <param name="basePath">The base path.</param>
public ApiClient(String basePath="http://petstore.swagger.io/v2")
{
BasePath = basePath;
RestClient = new RestClient(BasePath);
}
/// <summary>
/// Gets or sets the base path.
/// </summary>
/// <value>The base path</value>
public string BasePath { get; set; }
/// <summary>
/// Gets or sets the RestClient.
/// </summary>
/// <value>An instance of the RestClient</value>
public RestClient RestClient { get; set; }
/// <summary>
/// Gets the default header.
/// </summary>
public Dictionary<String, String> DefaultHeader
{
get { return _defaultHeaderMap; }
}
/// <summary>
/// Makes the HTTP request (Sync).
/// </summary>
/// <param name="path">URL path.</param>
/// <param name="method">HTTP method.</param>
/// <param name="queryParams">Query parameters.</param>
/// <param name="postBody">HTTP body (POST request).</param>
/// <param name="headerParams">Header parameters.</param>
/// <param name="formParams">Form parameters.</param>
/// <param name="fileParams">File parameters.</param>
/// <param name="authSettings">Authentication settings.</param>
/// <returns>Object</returns>
public Object CallApi(String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, String[] authSettings)
{
var request = new RestRequest(path, method);
UpdateParamsForAuth(queryParams, headerParams, authSettings);
// add default header, if any
foreach(var defaultHeader in _defaultHeaderMap)
request.AddHeader(defaultHeader.Key, defaultHeader.Value);
// add header parameter, if any
foreach(var param in headerParams)
request.AddHeader(param.Key, param.Value);
// add query parameter, if any
foreach(var param in queryParams)
request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
// add form parameter, if any
foreach(var param in formParams)
request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
// add file parameter, if any
foreach(var param in fileParams)
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
if (postBody != null) // http body (model) parameter
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
return (Object)RestClient.Execute(request);
}
/// <summary>
/// Add default header.
/// </summary>
/// <param name="key">Header field name.</param>
/// <param name="value">Header field value.</param>
/// <returns></returns>
public void AddDefaultHeader(string key, string value)
{
_defaultHeaderMap.Add(key, value);
}
/// <summary>
/// Escape string (url-encoded).
/// </summary>
/// <param name="str">String to be escaped.</param>
/// <returns>Escaped string.</returns>
public string EscapeString(string str)
{
return RestSharp.Contrib.HttpUtility.UrlEncode(str);
}
/// <summary>
/// Create FileParameter based on Stream.
/// </summary>
/// <param name="name">Parameter name.</param>
/// <param name="stream">Input stream.</param>
/// <returns>FileParameter.</returns>
public FileParameter ParameterToFile(string name, Stream stream)
{
if (stream is FileStream)
return FileParameter.Create(name, stream.ReadAsBytes(), Path.GetFileName(((FileStream)stream).Name));
else
return FileParameter.Create(name, stream.ReadAsBytes(), "no_file_name_provided");
}
/// <summary>
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list of string, join the list with ",".
/// Otherwise just return the string.
/// </summary>
/// <param name="obj">The parameter (header, path, query, form).</param>
/// <returns>Formatted string.</returns>
public string ParameterToString(object obj)
{
if (obj is DateTime)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return ((DateTime)obj).ToString (Configuration.DateTimeFormat);
else if (obj is List<string>)
return String.Join(",", (obj as List<string>).ToArray());
else
return Convert.ToString (obj);
}
/// <summary>
/// Deserialize the JSON string into a proper object.
/// </summary>
/// <param name="content">HTTP body (e.g. string, JSON).</param>
/// <param name="type">Object type.</param>
/// <param name="headers">HTTP headers.</param>
/// <returns>Object representation of the JSON string.</returns>
public object Deserialize(string content, Type type, IList<Parameter> headers=null)
{
if (type == typeof(Object)) // return an object
{
return content;
}
if (type == typeof(Stream))
{
var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath)
? Path.GetTempPath()
: Configuration.TempFolderPath;
var fileName = filePath + Guid.NewGuid();
if (headers != null)
{
var regex = new Regex(@"Content-Disposition:.*filename=['""]?([^'""\s]+)['""]?$");
var match = regex.Match(headers.ToString());
if (match.Success)
fileName = filePath + match.Value.Replace("\"", "").Replace("'", "");
}
File.WriteAllText(fileName, content);
return new FileStream(fileName, FileMode.Open);
}
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
{
return DateTime.Parse(content, null, System.Globalization.DateTimeStyles.RoundtripKind);
}
if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
{
return ConvertType(content, type);
}
// at this point, it must be a model (json)
try
{
return JsonConvert.DeserializeObject(content, type);
}
catch (IOException e)
{
throw new ApiException(500, e.Message);
}
}
/// <summary>
/// Serialize an object into JSON string.
/// </summary>
/// <param name="obj">Object.</param>
/// <returns>JSON string.</returns>
public string Serialize(object obj)
{
try
{
return obj != null ? JsonConvert.SerializeObject(obj) : null;
}
catch (Exception e)
{
throw new ApiException(500, e.Message);
}
}
/// <summary>
/// Get the API key with prefix.
/// </summary>
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
/// <returns>API key with prefix.</returns>
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
{
var apiKeyValue = "";
Configuration.ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
var apiKeyPrefix = "";
if (Configuration.ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
return apiKeyPrefix + " " + apiKeyValue;
else
return apiKeyValue;
}
/// <summary>
/// Update parameters based on authentication.
/// </summary>
/// <param name="queryParams">Query parameters.</param>
/// <param name="headerParams">Header parameters.</param>
/// <param name="authSettings">Authentication settings.</param>
public void UpdateParamsForAuth(Dictionary<String, String> queryParams, Dictionary<String, String> headerParams, string[] authSettings)
{
if (authSettings == null || authSettings.Length == 0)
return;
foreach (string auth in authSettings)
{
// determine which one to use
switch(auth)
{
case "api_key":
headerParams["api_key"] = GetApiKeyWithPrefix("api_key");
break;
case "petstore_auth":
//TODO support oauth
break;
default:
//TODO show warning about security definition not found
break;
}
}
}
/// <summary>
/// Encode string in base64 format.
/// </summary>
/// <param name="text">String to be encoded.</param>
/// <returns>Encoded string.</returns>
public static string Base64Encode(string text)
{
var textByte = System.Text.Encoding.UTF8.GetBytes(text);
return System.Convert.ToBase64String(textByte);
}
/// <summary>
/// Dynamically cast the object into target type.
/// </summary>
/// <param name="fromObject">Object to be casted</param>
/// <param name="toObject">Target type</param>
/// <returns>Casted object</returns>
public static Object ConvertType(Object fromObject, Type toObject) {
return Convert.ChangeType(fromObject, toObject);
}
}
}

View File

@ -1,47 +0,0 @@
using System;
namespace Org.OpenAPITools.Client {
/// <summary>
/// API Exception
/// </summary>
public class ApiException : Exception {
/// <summary>
/// Gets or sets the error code (HTTP status code)
/// </summary>
/// <value>The error code (HTTP status code).</value>
public int ErrorCode { get; set; }
/// <summary>
/// Gets or sets the error content (body json object)
/// </summary>
/// <value>The error content (Http response body).</value>
public Object ErrorContent { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
public ApiException() {}
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
public ApiException(int errorCode, string message) : base(message) {
this.ErrorCode = errorCode;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
/// <param name="errorContent">Error content.</param>
public ApiException(int errorCode, string message, Object errorContent = null) : base(message) {
this.ErrorCode = errorCode;
this.ErrorContent = errorContent;
}
}
}

View File

@ -1,132 +0,0 @@
using System;
using System.Reflection;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Org.OpenAPITools.Client
{
/// <summary>
/// Represents a set of configuration settings
/// </summary>
public class Configuration
{
/// <summary>
/// Version of the package.
/// </summary>
/// <value>Version of the package.</value>
public const string Version = "1.0.0";
/// <summary>
/// Gets or sets the default API client for making HTTP calls.
/// </summary>
/// <value>The API client.</value>
public static ApiClient DefaultApiClient = new ApiClient();
/// <summary>
/// Gets or sets the username (HTTP basic authentication).
/// </summary>
/// <value>The username.</value>
public static String Username { get; set; }
/// <summary>
/// Gets or sets the password (HTTP basic authentication).
/// </summary>
/// <value>The password.</value>
public static String Password { get; set; }
/// <summary>
/// Gets or sets the API key based on the authentication name.
/// </summary>
/// <value>The API key.</value>
public static Dictionary<String, String> ApiKey = new Dictionary<String, String>();
/// <summary>
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
/// </summary>
/// <value>The prefix of the API key.</value>
public static Dictionary<String, String> ApiKeyPrefix = new Dictionary<String, String>();
private static string _tempFolderPath = Path.GetTempPath();
/// <summary>
/// Gets or sets the temporary folder path to store the files downloaded from the server.
/// </summary>
/// <value>Folder path.</value>
public static String TempFolderPath
{
get { return _tempFolderPath; }
set
{
if (String.IsNullOrEmpty(value))
{
_tempFolderPath = value;
return;
}
// create the directory if it does not exist
if (!Directory.Exists(value))
Directory.CreateDirectory(value);
// check if the path contains directory separator at the end
if (value[value.Length - 1] == Path.DirectorySeparatorChar)
_tempFolderPath = value;
else
_tempFolderPath = value + Path.DirectorySeparatorChar;
}
}
private const string ISO8601_DATETIME_FORMAT = "o";
private static string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
/// <summary>
/// Gets or sets the date time format used when serializing in the ApiClient
/// By default, it's set to ISO 8601 - "o", for others see:
/// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
/// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
/// No validation is done to ensure that the string you're providing is valid
/// </summary>
/// <value>The DateTimeFormat string</value>
public static String DateTimeFormat
{
get
{
return _dateTimeFormat;
}
set
{
if (string.IsNullOrEmpty(value))
{
// Never allow a blank or null string, go back to the default
_dateTimeFormat = ISO8601_DATETIME_FORMAT;
return;
}
// Caution, no validation when you choose date time format other than ISO 8601
// Take a look at the above links
_dateTimeFormat = value;
}
}
/// <summary>
/// Returns a string with essential information for debugging.
/// </summary>
public static String ToDebugReport()
{
String report = "C# SDK (Org.OpenAPITools) Debug Report:\n";
report += " OS: " + Environment.OSVersion + "\n";
report += " .NET Framework Version: " + Assembly
.GetExecutingAssembly()
.GetReferencedAssemblies()
.Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
report += " Version of the API: 1.0.0\n";
report += " SDK Package Version: 1.0.0\n";
return report;
}
}
}

View File

@ -1,60 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// Describes the result of uploading an image resource
/// </summary>
[DataContract]
public class ApiResponse {
/// <summary>
/// Gets or Sets Code
/// </summary>
[DataMember(Name="code", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "code")]
public int? Code { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name="type", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "type")]
public string Type { get; set; }
/// <summary>
/// Gets or Sets Message
/// </summary>
[DataMember(Name="message", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class ApiResponse {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,52 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A category for a pet
/// </summary>
[DataContract]
public class Category {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Category {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,85 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// An order for a pets from the pet store
/// </summary>
[DataContract]
public class Order {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets PetId
/// </summary>
[DataMember(Name="petId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "petId")]
public long? PetId { get; set; }
/// <summary>
/// Gets or Sets Quantity
/// </summary>
[DataMember(Name="quantity", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "quantity")]
public int? Quantity { get; set; }
/// <summary>
/// Gets or Sets ShipDate
/// </summary>
[DataMember(Name="shipDate", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "shipDate")]
public DateTime? ShipDate { get; set; }
/// <summary>
/// Order Status
/// </summary>
/// <value>Order Status</value>
[DataMember(Name="status", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "status")]
public string Status { get; set; }
/// <summary>
/// Gets or Sets Complete
/// </summary>
[DataMember(Name="complete", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "complete")]
public bool? Complete { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Order {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" PetId: ").Append(PetId).Append("\n");
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append(" Complete: ").Append(Complete).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,85 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A pet for sale in the pet store
/// </summary>
[DataContract]
public class Pet {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Category
/// </summary>
[DataMember(Name="category", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "category")]
public Category Category { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or Sets PhotoUrls
/// </summary>
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "photoUrls")]
public List<string> PhotoUrls { get; set; }
/// <summary>
/// Gets or Sets Tags
/// </summary>
[DataMember(Name="tags", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "tags")]
public List<Tag> Tags { get; set; }
/// <summary>
/// pet status in the store
/// </summary>
/// <value>pet status in the store</value>
[DataMember(Name="status", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "status")]
public string Status { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Pet {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Category: ").Append(Category).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
sb.Append(" Tags: ").Append(Tags).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,52 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A tag for a pet
/// </summary>
[DataContract]
public class Tag {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class Tag {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,101 +0,0 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Model {
/// <summary>
/// A User who is purchasing from the pet store
/// </summary>
[DataContract]
public class User {
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Username
/// </summary>
[DataMember(Name="username", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "username")]
public string Username { get; set; }
/// <summary>
/// Gets or Sets FirstName
/// </summary>
[DataMember(Name="firstName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "firstName")]
public string FirstName { get; set; }
/// <summary>
/// Gets or Sets LastName
/// </summary>
[DataMember(Name="lastName", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "lastName")]
public string LastName { get; set; }
/// <summary>
/// Gets or Sets Email
/// </summary>
[DataMember(Name="email", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "email")]
public string Email { get; set; }
/// <summary>
/// Gets or Sets Password
/// </summary>
[DataMember(Name="password", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "password")]
public string Password { get; set; }
/// <summary>
/// Gets or Sets Phone
/// </summary>
[DataMember(Name="phone", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "phone")]
public string Phone { get; set; }
/// <summary>
/// User Status
/// </summary>
/// <value>User Status</value>
[DataMember(Name="userStatus", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "userStatus")]
public int? UserStatus { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class User {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Username: ").Append(Username).Append("\n");
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
sb.Append(" LastName: ").Append(LastName).Append("\n");
sb.Append(" Email: ").Append(Email).Append("\n");
sb.Append(" Password: ").Append(Password).Append("\n");
sb.Append(" Phone: ").Append(Phone).Append("\n");
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp.Net2" version="1.1.11" targetFramework="net20" developmentDependency="true" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net20" developmentDependency="true" />
</packages>