1
1
/*
2
2
* Swagger Petstore
3
3
*
4
- * 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
+ * This is a sample 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/).
5
5
*
6
6
* OpenAPI spec version: 1.0.0
7
7
8
8
* Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
*/
10
10
using System ;
11
11
using System . Collections . Generic ;
12
- using System . Linq ;
13
- using System . Net ;
14
- using System . Threading . Tasks ;
15
- using Microsoft . AspNetCore . Http ;
16
12
using Microsoft . AspNetCore . Mvc ;
17
- using Microsoft . AspNetCore . WebUtilities ;
18
- using Microsoft . Extensions . Logging ;
19
- using Microsoft . Extensions . Primitives ;
13
+ using Swashbuckle . AspNetCore . Annotations ;
20
14
using Swashbuckle . AspNetCore . SwaggerGen ;
21
15
using Newtonsoft . Json ;
22
16
using System . ComponentModel . DataAnnotations ;
23
17
using IO . Swagger . Attributes ;
18
+ using IO . Swagger . Security ;
19
+ using Microsoft . AspNetCore . Authorization ;
24
20
using IO . Swagger . Models ;
25
21
26
22
namespace IO . Swagger . Controllers
27
23
{
28
24
/// <summary>
29
25
///
30
26
/// </summary>
31
- public class PetApiController : Controller
27
+ [ ApiController ]
28
+ public class PetApiController : ControllerBase
32
29
{
33
30
/// <summary>
34
31
/// Add a new pet to the store
35
32
/// </summary>
36
-
37
33
/// <param name="body">Pet object that needs to be added to the store</param>
38
34
/// <response code="405">Invalid input</response>
39
35
[ HttpPost ]
40
- [ Route ( "/v2/ pet" ) ]
36
+ [ Route ( "/pet" ) ]
41
37
[ ValidateModelState ]
42
38
[ SwaggerOperation ( "AddPet" ) ]
43
39
public virtual IActionResult AddPet ( [ FromBody ] Pet body )
@@ -51,19 +47,22 @@ public virtual IActionResult AddPet([FromBody]Pet body)
51
47
/// <summary>
52
48
/// Deletes a pet
53
49
/// </summary>
54
-
55
50
/// <param name="petId">Pet id to delete</param>
56
51
/// <param name="apiKey"></param>
57
- /// <response code="400">Invalid pet value</response>
52
+ /// <response code="400">Invalid ID supplied</response>
53
+ /// <response code="404">Pet not found</response>
58
54
[ HttpDelete ]
59
- [ Route ( "/v2/ pet/{petId}" ) ]
55
+ [ Route ( "/pet/{petId}" ) ]
60
56
[ ValidateModelState ]
61
57
[ SwaggerOperation ( "DeletePet" ) ]
62
- public virtual IActionResult DeletePet ( [ FromRoute ] [ Required ] int ? petId , [ FromHeader ] string apiKey )
58
+ public virtual IActionResult DeletePet ( [ FromRoute ] [ Required ] long ? petId , [ FromHeader ] string apiKey )
63
59
{
64
60
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
65
61
// return StatusCode(400);
66
62
63
+ //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
64
+ // return StatusCode(404);
65
+
67
66
throw new NotImplementedException ( ) ;
68
67
}
69
68
@@ -75,7 +74,7 @@ public virtual IActionResult DeletePet([FromRoute][Required]int? petId, [FromHea
75
74
/// <response code="200">successful operation</response>
76
75
/// <response code="400">Invalid status value</response>
77
76
[ HttpGet ]
78
- [ Route ( "/v2/ pet/findByStatus" ) ]
77
+ [ Route ( "/pet/findByStatus" ) ]
79
78
[ ValidateModelState ]
80
79
[ SwaggerOperation ( "FindPetsByStatus" ) ]
81
80
[ SwaggerResponse ( statusCode : 200 , type : typeof ( List < Pet > ) , description : "successful operation" ) ]
@@ -87,6 +86,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List<string
87
86
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
88
87
// return StatusCode(400);
89
88
string exampleJson = null ;
89
+ exampleJson = "[ {\n \" photoUrls\" : [ \" photoUrls\" , \" photoUrls\" ],\n \" name\" : \" doggie\" ,\n \" id\" : 0,\n \" category\" : {\n \" name\" : \" name\" ,\n \" id\" : 6\n },\n \" tags\" : [ {\n \" name\" : \" name\" ,\n \" id\" : 1\n }, {\n \" name\" : \" name\" ,\n \" id\" : 1\n } ],\n \" status\" : \" available\" \n }, {\n \" photoUrls\" : [ \" photoUrls\" , \" photoUrls\" ],\n \" name\" : \" doggie\" ,\n \" id\" : 0,\n \" category\" : {\n \" name\" : \" name\" ,\n \" id\" : 6\n },\n \" tags\" : [ {\n \" name\" : \" name\" ,\n \" id\" : 1\n }, {\n \" name\" : \" name\" ,\n \" id\" : 1\n } ],\n \" status\" : \" available\" \n } ]" ;
90
90
91
91
var example = exampleJson != null
92
92
? JsonConvert . DeserializeObject < List < Pet > > ( exampleJson )
@@ -97,12 +97,12 @@ public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List<string
97
97
/// <summary>
98
98
/// Finds Pets by tags
99
99
/// </summary>
100
- /// <remarks>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</remarks>
100
+ /// <remarks>Muliple tags can be provided with comma separated strings. Use\\ \\ tag1, tag2, tag3 for testing.</remarks>
101
101
/// <param name="tags">Tags to filter by</param>
102
102
/// <response code="200">successful operation</response>
103
103
/// <response code="400">Invalid tag value</response>
104
104
[ HttpGet ]
105
- [ Route ( "/v2/ pet/findByTags" ) ]
105
+ [ Route ( "/pet/findByTags" ) ]
106
106
[ ValidateModelState ]
107
107
[ SwaggerOperation ( "FindPetsByTags" ) ]
108
108
[ SwaggerResponse ( statusCode : 200 , type : typeof ( List < Pet > ) , description : "successful operation" ) ]
@@ -114,6 +114,7 @@ public virtual IActionResult FindPetsByTags([FromQuery][Required()]List<string>
114
114
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
115
115
// return StatusCode(400);
116
116
string exampleJson = null ;
117
+ exampleJson = "[ {\n \" photoUrls\" : [ \" photoUrls\" , \" photoUrls\" ],\n \" name\" : \" doggie\" ,\n \" id\" : 0,\n \" category\" : {\n \" name\" : \" name\" ,\n \" id\" : 6\n },\n \" tags\" : [ {\n \" name\" : \" name\" ,\n \" id\" : 1\n }, {\n \" name\" : \" name\" ,\n \" id\" : 1\n } ],\n \" status\" : \" available\" \n }, {\n \" photoUrls\" : [ \" photoUrls\" , \" photoUrls\" ],\n \" name\" : \" doggie\" ,\n \" id\" : 0,\n \" category\" : {\n \" name\" : \" name\" ,\n \" id\" : 6\n },\n \" tags\" : [ {\n \" name\" : \" name\" ,\n \" id\" : 1\n }, {\n \" name\" : \" name\" ,\n \" id\" : 1\n } ],\n \" status\" : \" available\" \n } ]" ;
117
118
118
119
var example = exampleJson != null
119
120
? JsonConvert . DeserializeObject < List < Pet > > ( exampleJson )
@@ -130,11 +131,12 @@ public virtual IActionResult FindPetsByTags([FromQuery][Required()]List<string>
130
131
/// <response code="400">Invalid ID supplied</response>
131
132
/// <response code="404">Pet not found</response>
132
133
[ HttpGet ]
133
- [ Route ( "/v2/pet/{petId}" ) ]
134
+ [ Route ( "/pet/{petId}" ) ]
135
+ [ Authorize ( AuthenticationSchemes = ApiKeyAuthenticationHandler . SchemeName ) ]
134
136
[ ValidateModelState ]
135
137
[ SwaggerOperation ( "GetPetById" ) ]
136
138
[ SwaggerResponse ( statusCode : 200 , type : typeof ( Pet ) , description : "successful operation" ) ]
137
- public virtual IActionResult GetPetById ( [ FromRoute ] [ Required ] int ? petId )
139
+ public virtual IActionResult GetPetById ( [ FromRoute ] [ Required ] long ? petId )
138
140
{
139
141
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
140
142
// return StatusCode(200, default(Pet));
@@ -145,6 +147,7 @@ public virtual IActionResult GetPetById([FromRoute][Required]int? petId)
145
147
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
146
148
// return StatusCode(404);
147
149
string exampleJson = null ;
150
+ exampleJson = "{\n \" photoUrls\" : [ \" photoUrls\" , \" photoUrls\" ],\n \" name\" : \" doggie\" ,\n \" id\" : 0,\n \" category\" : {\n \" name\" : \" name\" ,\n \" id\" : 6\n },\n \" tags\" : [ {\n \" name\" : \" name\" ,\n \" id\" : 1\n }, {\n \" name\" : \" name\" ,\n \" id\" : 1\n } ],\n \" status\" : \" available\" \n }" ;
148
151
149
152
var example = exampleJson != null
150
153
? JsonConvert . DeserializeObject < Pet > ( exampleJson )
@@ -155,13 +158,12 @@ public virtual IActionResult GetPetById([FromRoute][Required]int? petId)
155
158
/// <summary>
156
159
/// Update an existing pet
157
160
/// </summary>
158
-
159
161
/// <param name="body">Pet object that needs to be added to the store</param>
160
162
/// <response code="400">Invalid ID supplied</response>
161
163
/// <response code="404">Pet not found</response>
162
164
/// <response code="405">Validation exception</response>
163
165
[ HttpPut ]
164
- [ Route ( "/v2/ pet" ) ]
166
+ [ Route ( "/pet" ) ]
165
167
[ ValidateModelState ]
166
168
[ SwaggerOperation ( "UpdatePet" ) ]
167
169
public virtual IActionResult UpdatePet ( [ FromBody ] Pet body )
@@ -181,16 +183,15 @@ public virtual IActionResult UpdatePet([FromBody]Pet body)
181
183
/// <summary>
182
184
/// Updates a pet in the store with form data
183
185
/// </summary>
184
-
185
186
/// <param name="petId">ID of pet that needs to be updated</param>
186
187
/// <param name="name"></param>
187
188
/// <param name="status"></param>
188
189
/// <response code="405">Invalid input</response>
189
190
[ HttpPost ]
190
- [ Route ( "/v2/ pet/{petId}" ) ]
191
+ [ Route ( "/pet/{petId}" ) ]
191
192
[ ValidateModelState ]
192
193
[ SwaggerOperation ( "UpdatePetWithForm" ) ]
193
- public virtual IActionResult UpdatePetWithForm ( [ FromRoute ] [ Required ] int ? petId , [ FromForm ] string name , [ FromForm ] string status )
194
+ public virtual IActionResult UpdatePetWithForm ( [ FromRoute ] [ Required ] long ? petId , [ FromForm ] string name , [ FromForm ] string status )
194
195
{
195
196
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
196
197
// return StatusCode(405);
@@ -201,21 +202,20 @@ public virtual IActionResult UpdatePetWithForm([FromRoute][Required]int? petId,
201
202
/// <summary>
202
203
/// uploads an image
203
204
/// </summary>
204
-
205
205
/// <param name="petId">ID of pet to update</param>
206
- /// <param name="additionalMetadata"></param>
207
- /// <param name="file"></param>
206
+ /// <param name="body"></param>
208
207
/// <response code="200">successful operation</response>
209
208
[ HttpPost ]
210
- [ Route ( "/v2/ pet/{petId}/uploadImage" ) ]
209
+ [ Route ( "/pet/{petId}/uploadImage" ) ]
211
210
[ ValidateModelState ]
212
211
[ SwaggerOperation ( "UploadFile" ) ]
213
212
[ SwaggerResponse ( statusCode : 200 , type : typeof ( ApiResponse ) , description : "successful operation" ) ]
214
- public virtual IActionResult UploadFile ( [ FromRoute ] [ Required ] int ? petId , [ FromForm ] string additionalMetadata , [ FromForm ] System . IO . Stream file )
213
+ public virtual IActionResult UploadFile ( [ FromRoute ] [ Required ] long ? petId , [ FromBody ] Object body )
215
214
{
216
215
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
217
216
// return StatusCode(200, default(ApiResponse));
218
217
string exampleJson = null ;
218
+ exampleJson = "{\n \" code\" : 0,\n \" type\" : \" type\" ,\n \" message\" : \" message\" \n }" ;
219
219
220
220
var example = exampleJson != null
221
221
? JsonConvert . DeserializeObject < ApiResponse > ( exampleJson )
0 commit comments