* add powershell generator (wip) * minor fix to api template * rename model files * Powershell generator fix (#11) * Fix typo pacakge -> package * Add missing `petstore` subfolder to $ClientPath * Resolve $ClientPath to absolute path Start-Process needs WorkingDirectory to be absolute * Fix spaces in variable name ${ somevar } is a vairable that literally has spaces in name. We need to temporarily redifine mustache delimiters so we can generate var. names without spaces. * Fix typo Remove stray `r` * Fix *.ps1 import in module Directory structure has changed + we should export functions using manifest. * Remove erroneous file * various fixes and enhancements * remove nullable for string * change function name based on feedback by beatcracker * set index to start at 0 * fix file type * Powershell generator fix 1 (#12) * Add closing curly brace * Fix duplicated '[' * Get FunctionsToExport using AST Discussion: swagger-api/swagger-codegen#5789 * add guid option to powershell generator * add test files, remove docs * fix array of items * clean up powershell comment, update model/api test files
14 KiB
IO.Swagger.IO.Swagger\API.PetApi
All URIs are relative to http://petstore.swagger.io/v2
Method | HTTP request | Description |
---|---|---|
AddPet | POST /pet | Add a new pet to the store |
DeletePet | DELETE /pet/{petId} | Deletes a pet |
FindPetsByStatus | GET /pet/findByStatus | Finds Pets by status |
FindPetsByTags | GET /pet/findByTags | Finds Pets by tags |
GetPetById | GET /pet/{petId} | Find pet by ID |
UpdatePet | PUT /pet | Update an existing pet |
UpdatePetWithForm | POST /pet/{petId} | Updates a pet in the store with form data |
UploadFile | POST /pet/{petId}/uploadImage | uploads an image |
AddPet
void AddPet (Pet body)
Add a new pet to the store
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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 object that needs to be added to the store |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeletePet
void DeletePet (Int64 petId, String apiKey)
Deletes a pet
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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; // Int64 | 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 | Int64 | Pet id to delete | |
apiKey | String | [optional] |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FindPetsByStatus
IO.Swagger.Model.Pet FindPetsByStatus (String status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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 = new String(); // String | Status values that need to be considered for filter
try
{
// Finds Pets by status
IO.Swagger.Model.Pet 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 | String | Status values that need to be considered for filter |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FindPetsByTags
IO.Swagger.Model.Pet FindPetsByTags (String tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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 String(); // String | Tags to filter by
try
{
// Finds Pets by tags
IO.Swagger.Model.Pet 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 | String | Tags to filter by |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetPetById
IO.Swagger.Model.Pet GetPetById (Int64 petId)
Find pet by ID
Returns a single pet
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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; // Int64 | ID of pet to return
try
{
// Find pet by ID
IO.Swagger.Model.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 | Int64 | ID of pet to return |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdatePet
void UpdatePet (Pet body)
Update an existing pet
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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 object that needs to be added to the store |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdatePetWithForm
void UpdatePetWithForm (Int64 petId, String name, String status)
Updates a pet in the store with form data
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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; // Int64 | 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 | Int64 | 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
HTTP request headers
- Content-Type: application/x-www-form-urlencoded
- Accept: application/xml, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UploadFile
IO.Swagger.Model.ApiResponse UploadFile (Int64 petId, String additionalMetadata, String file)
uploads an image
Example
using System;
using System.Diagnostics;
using IO.Swagger.IO.Swagger\API;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger\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; // Int64 | ID of pet to update
var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server (optional)
var file = new String(); // String | file to upload (optional)
try
{
// uploads an image
IO.Swagger.Model.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 | Int64 | ID of pet to update | |
additionalMetadata | String | Additional data to pass to server | [optional] |
file | String | file to upload | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]