Skip to content

Commit 8bb1ad9

Browse files
committed
added csharp dotnet2 sample.
1 parent c59ffe3 commit 8bb1ad9

File tree

26 files changed

+3481
-1
lines changed

26 files changed

+3481
-1
lines changed

bin/csharp-dotnet2-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ fi
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
2929
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l csharp-dotnet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient --additional-properties hideGenerationTimestamp=true"
3030

31-
# java $JAVA_OPTS -jar $executable $ags
31+
java $JAVA_OPTS -jar $executable $ags
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.3-SNAPSHOT
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# IO.Swagger - the C# library for the Swagger Petstore
2+
3+
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
4+
5+
This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
6+
7+
- API version: 1.0.0
8+
- SDK version: 1.0.0
9+
- Build package: io.swagger.codegen.v3.generators.dotnet.CsharpDotNet2ClientCodegen
10+
11+
<a name="frameworks-supported"></a>
12+
## Frameworks supported
13+
- .NET 2.0
14+
15+
<a name="dependencies"></a>
16+
## Dependencies
17+
- Mono compiler
18+
- Newtonsoft.Json.7.0.1
19+
- RestSharp.Net2.1.1.11
20+
21+
Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator
22+
23+
<a name="installation"></a>
24+
## Installation
25+
Run the following command to generate the DLL
26+
- [Mac/Linux] `/bin/sh compile-mono.sh`
27+
- [Windows] TODO
28+
29+
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
30+
```csharp
31+
using IO.Swagger.Api;
32+
using IO.Swagger.Client;
33+
using IO.Swagger.Model;
34+
```
35+
<a name="getting-started"></a>
36+
## Getting Started
37+
38+
```csharp
39+
using System;
40+
using System.Diagnostics;
41+
using IO.Swagger.Api;
42+
using IO.Swagger.Client;
43+
using IO.Swagger.Model;
44+
45+
namespace Example
46+
{
47+
public class Example
48+
{
49+
public void main()
50+
{
51+
52+
// Configure OAuth2 access token for authorization: petstore_auth
53+
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
54+
55+
var apiInstance = new PetApi();
56+
var body = new Pet(); // Pet | Pet object that needs to be added to the store
57+
58+
try
59+
{
60+
// Add a new pet to the store
61+
apiInstance.AddPet(body);
62+
}
63+
catch (Exception e)
64+
{
65+
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
66+
}
67+
}
68+
}
69+
}
70+
```
71+
72+
<a name="documentation-for-api-endpoints"></a>
73+
## Documentation for API Endpoints
74+
75+
All URIs are relative to *http://petstore.swagger.io/v2*
76+
77+
Class | Method | HTTP request | Description
78+
------------ | ------------- | ------------- | -------------
79+
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
80+
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
81+
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
82+
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
83+
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
84+
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
85+
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
86+
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
87+
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
88+
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
89+
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
90+
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
91+
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
92+
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
93+
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
94+
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
95+
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
96+
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
97+
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
98+
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
99+
100+
<a name="documentation-for-models"></a>
101+
## Documentation for Models
102+
103+
- [IO.Swagger.Model.ApiResponse](docs/ApiResponse.md)
104+
- [IO.Swagger.Model.Category](docs/Category.md)
105+
- [IO.Swagger.Model.Order](docs/Order.md)
106+
- [IO.Swagger.Model.Pet](docs/Pet.md)
107+
- [IO.Swagger.Model.Tag](docs/Tag.md)
108+
- [IO.Swagger.Model.User](docs/User.md)
109+
110+
<a name="documentation-for-authorization"></a>
111+
## Documentation for Authorization
112+
113+
<a name="api_key"></a>
114+
### api_key
115+
116+
- **Type**: API key
117+
- **API key parameter name**: api_key
118+
- **Location**: HTTP header
119+
120+
<a name="petstore_auth"></a>
121+
### petstore_auth
122+
123+
- **Type**: OAuth
124+
- **Flow**: implicit
125+
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
126+
- **Scopes**:
127+
- :
128+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
2+
mozroots --import --sync
3+
mono nuget.exe install vendor/packages.config -o vendor;
4+
mkdir -p bin;
5+
mcs -sdk:2 -r:vendor/Newtonsoft.Json.7.0.1/lib/net20/Newtonsoft.Json.dll,\
6+
vendor/RestSharp.Net2.1.1.11/lib/net20/RestSharp.Net2.dll,\
7+
System.Runtime.Serialization.dll \
8+
-target:library \
9+
-out:bin/IO.Swagger.dll \
10+
-recurse:'src/*.cs' \
11+
-doc:bin/IO.Swagger.xml \
12+
-platform:anycpu
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# IO.Swagger.Model.ApiResponse
2+
## Properties
3+
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**Code** | **int?** | | [optional]
7+
**Type** | **string** | | [optional]
8+
**Message** | **string** | | [optional]
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# IO.Swagger.Model.Category
2+
## Properties
3+
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**Id** | **long?** | | [optional]
7+
**Name** | **string** | | [optional]
8+
9+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# IO.Swagger.Model.Order
2+
## Properties
3+
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**Id** | **long?** | | [optional]
7+
**PetId** | **long?** | | [optional]
8+
**Quantity** | **int?** | | [optional]
9+
**ShipDate** | **DateTime?** | | [optional]
10+
**Status** | **string** | Order Status | [optional]
11+
**Complete** | **bool?** | | [optional] [default to false]
12+
13+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
14+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# IO.Swagger.Model.Pet
2+
## Properties
3+
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**Id** | **long?** | | [optional]
7+
**Category** | [**Category**](Category.md) | | [optional]
8+
**Name** | **string** | |
9+
**PhotoUrls** | **List&lt;string&gt;** | |
10+
**Tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional]
11+
**Status** | **string** | pet status in the store | [optional]
12+
13+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
14+

0 commit comments

Comments
 (0)