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

12 KiB

IO.Swagger.IO.Swagger\API.UserApi

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

Method HTTP request Description
CreateUser POST /user Create user
CreateUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
CreateUsersWithListInput POST /user/createWithList Creates list of users with given input array
DeleteUser DELETE /user/{username} Delete user
GetUserByName GET /user/{username} Get user by user name
LoginUser GET /user/login Logs user into the system
LogoutUser GET /user/logout Logs out current logged in user session
UpdateUser PUT /user/{username} Updated user

CreateUser

void CreateUser (User body)

Create user

This can only be done by the logged in user.

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 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 Created user object

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]

CreateUsersWithArrayInput

void CreateUsersWithArrayInput (IO.Swagger.Model.User body)

Creates list of users with given input array

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 CreateUsersWithArrayInputExample
    {
        public void main()
        {
            var apiInstance = new UserApi();
            var body = new IO.Swagger.Model.User(); // IO.Swagger.Model.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 IO.Swagger.Model.User List of user object

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]

CreateUsersWithListInput

void CreateUsersWithListInput (IO.Swagger.Model.User body)

Creates list of users with given input array

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 CreateUsersWithListInputExample
    {
        public void main()
        {
            var apiInstance = new UserApi();
            var body = new IO.Swagger.Model.User(); // IO.Swagger.Model.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 IO.Swagger.Model.User List of user object

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]

DeleteUser

void DeleteUser (String username)

Delete user

This can only be done by the logged in user.

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

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

GetUserByName

IO.Swagger.Model.User GetUserByName (String username)

Get user by user name

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 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
                IO.Swagger.Model.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

IO.Swagger.Model.User

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]

LoginUser

String LoginUser (String username, String password)

Logs user into the system

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 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] [Back to Model list] [Back to README]

LogoutUser

void LogoutUser ()

Logs out current logged in user session

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

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

UpdateUser

void UpdateUser (String username, User body)

Updated user

This can only be done by the logged in user.

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 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 Updated user object

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]