wing328 e53b3a03aa [PowerShell] Add PowerShell API client generator (WIP) (#5789)
* 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
2017-06-20 22:20:05 +08:00

6.6 KiB

IO.Swagger.IO.Swagger\API.StoreApi

All URIs are relative to http://petstore.swagger.io/v2

Method HTTP request Description
DeleteOrder DELETE /store/order/{orderId} Delete purchase order by ID
GetInventory GET /store/inventory Returns pet inventories by status
GetOrderById GET /store/order/{orderId} Find purchase order by ID
PlaceOrder POST /store/order Place an order for a pet

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

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 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: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetInventory

{String, Int32} GetInventory ()

Returns pet inventories by status

Returns a map of status codes to quantities

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 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
                {String, Int32} 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

{String, Int32}

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetOrderById

IO.Swagger.Model.Order GetOrderById (Int64 orderId)

Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions

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 GetOrderByIdExample
    {
        public void main()
        {
            var apiInstance = new StoreApi();
            var orderId = 789;  // Int64 | ID of pet that needs to be fetched

            try
            {
                // Find purchase order by ID
                IO.Swagger.Model.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 Int64 ID of pet that needs to be fetched

Return type

IO.Swagger.Model.Order

Authorization

No authorization required

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]

PlaceOrder

IO.Swagger.Model.Order PlaceOrder (Order body)

Place an order for 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 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
                IO.Swagger.Model.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 placed for purchasing the pet

Return type

IO.Swagger.Model.Order

Authorization

No authorization required

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]