forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
adedaf6adc
31
bin/powershell-petstore.sh
Executable file
31
bin/powershell-petstore.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/swagger-codegen/src/main/resources/powershell -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l powershell -o samples/client/petstore/powershell_test --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5 $@"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
10
bin/windows/powershell-petsstore.bat
Normal file
10
bin/windows/powershell-petsstore.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l powershell -o samples\client\petstore\powershell
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -0,0 +1,392 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.Property;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.UUID.randomUUID;
|
||||
|
||||
public class PowerShellClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
static Logger LOGGER = LoggerFactory.getLogger(PowerShellClientCodegen.class);
|
||||
|
||||
private String packageGuid = "{" + randomUUID().toString().toUpperCase() + "}";
|
||||
|
||||
protected String sourceFolder = "src";
|
||||
protected String packageName = "IO.Swagger";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
/**
|
||||
* Constructs an instance of `PowerShellClientCodegen`.
|
||||
*/
|
||||
public PowerShellClientCodegen() {
|
||||
super();
|
||||
|
||||
outputFolder = "generated-code" + File.separator + "powershell";
|
||||
modelTemplateFiles.put("model.mustache", ".ps1");
|
||||
apiTemplateFiles.put("api.mustache", ".ps1");
|
||||
modelTestTemplateFiles.put("model_test.mustache", ".ps1");
|
||||
apiTestTemplateFiles.put("api_test.mustache", ".ps1");
|
||||
modelDocTemplateFiles.clear();
|
||||
apiDocTemplateFiles.clear();
|
||||
embeddedTemplateDir = templateDir = "powershell";
|
||||
apiPackage = packageName + File.separator + "API";
|
||||
modelPackage = packageName + File.separator + "Model";
|
||||
|
||||
// https://blogs.msdn.microsoft.com/powershell/2010/01/07/how-objects-are-sent-to-and-from-remote-sessions/
|
||||
languageSpecificPrimitives = new HashSet<String>(Arrays.asList(
|
||||
"Byte",
|
||||
"SByte",
|
||||
"Byte[]",
|
||||
"Int16",
|
||||
"Int32",
|
||||
"Int64",
|
||||
"UInt16",
|
||||
"UInt32",
|
||||
"UInt64",
|
||||
"Decimal",
|
||||
"Single",
|
||||
"Double",
|
||||
"TimeSpan",
|
||||
"System.DateTime",
|
||||
"ProgressRecord",
|
||||
"Char",
|
||||
"String",
|
||||
"XmlDocument",
|
||||
"SecureString",
|
||||
"Boolean",
|
||||
"Guid",
|
||||
"Uri",
|
||||
"Version"
|
||||
));
|
||||
|
||||
// https://richardspowershellblog.wordpress.com/2009/05/02/powershell-reserved-words/
|
||||
reservedWords = new HashSet<String>(Arrays.asList(
|
||||
"Begin",
|
||||
"Break",
|
||||
"Catch",
|
||||
"Continue",
|
||||
"Data",
|
||||
"Do",
|
||||
"Dynamicparam",
|
||||
"Else",
|
||||
"Elseif",
|
||||
"End",
|
||||
"Exit",
|
||||
"Filter",
|
||||
"Finally",
|
||||
"For",
|
||||
"Foreach",
|
||||
"From",
|
||||
"Function",
|
||||
"If",
|
||||
"In",
|
||||
"Param",
|
||||
"Process",
|
||||
"Return",
|
||||
"Switch",
|
||||
"Throw",
|
||||
"Trap",
|
||||
"Try",
|
||||
"Until",
|
||||
"While",
|
||||
"Local",
|
||||
"Private",
|
||||
"Where"
|
||||
));
|
||||
|
||||
|
||||
defaultIncludes = new HashSet<String>(Arrays.asList(
|
||||
"Byte",
|
||||
"SByte",
|
||||
"Byte[]",
|
||||
"Int16",
|
||||
"Int32",
|
||||
"Int64",
|
||||
"UInt16",
|
||||
"UInt32",
|
||||
"UInt64",
|
||||
"Decimal",
|
||||
"Single",
|
||||
"Double",
|
||||
"TimeSpan",
|
||||
"System.DateTime",
|
||||
"ProgressRecord",
|
||||
"Char",
|
||||
"String",
|
||||
"XmlDocument",
|
||||
"SecureString",
|
||||
"Boolean",
|
||||
"Guid",
|
||||
"Uri",
|
||||
"Version"
|
||||
));
|
||||
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("string", "String");
|
||||
typeMapping.put("boolean", "Boolean");
|
||||
typeMapping.put("integer", "Int32");
|
||||
typeMapping.put("float", "Double");
|
||||
typeMapping.put("long", "Int64");
|
||||
typeMapping.put("double", "Double");
|
||||
typeMapping.put("number", "Decimal");
|
||||
typeMapping.put("date-time", "System.DateTime");
|
||||
typeMapping.put("date", "System.DateTime");
|
||||
typeMapping.put("file", "String");
|
||||
typeMapping.put("object", "String");
|
||||
typeMapping.put("binary", "String");
|
||||
typeMapping.put("Date", "System.DateTime");
|
||||
typeMapping.put("DateTime", "System.DateTime");
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Client package name (e.g. io.swagger.client).").defaultValue(this.packageName));
|
||||
cliOptions.add(new CliOption(CodegenConstants.OPTIONAL_PROJECT_GUID, "GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default."));
|
||||
}
|
||||
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "powershell";
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return "Generates a PowerShell API client (beta).";
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public void setPackageGuid(String packageGuid) {
|
||||
this.packageGuid = packageGuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_GUID)) {
|
||||
setPackageGuid((String) additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_GUID));
|
||||
}
|
||||
additionalProperties.put("packageGuid", packageGuid);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
|
||||
this.setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||
LOGGER.warn(CodegenConstants.MODEL_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported.");
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
||||
LOGGER.warn(CodegenConstants.API_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported.");
|
||||
}
|
||||
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage());
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage());
|
||||
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("Build.ps1.mustache", "", "Build.ps1"));
|
||||
|
||||
final String infrastructureFolder = (sourceFolder + File.separator + packageName + File.separator);
|
||||
|
||||
supportingFiles.add(new SupportingFile("IO.Swagger.psm1.mustache", infrastructureFolder, packageName + ".psm1"));
|
||||
|
||||
// private
|
||||
supportingFiles.add(new SupportingFile("Get-CommonParameters.ps1", infrastructureFolder + File.separator + "Private" + File.separator, "Get-CommonParameters.ps1"));
|
||||
supportingFiles.add(new SupportingFile("Out-DebugParameter.ps1", infrastructureFolder + File.separator + "Private" + File.separator, "Out-DebugParameter.ps1"));
|
||||
|
||||
// en-US
|
||||
supportingFiles.add(new SupportingFile("about_IO.Swagger.help.txt.mustache", infrastructureFolder + File.separator + "en-US" + File.separator + "about_" + packageName + ".help.txt"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("#>", "#_>").replace("<#", "<_#");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove " to avoid code injection
|
||||
return input.replace("\"", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return (outputFolder + "/test").replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder + File.separator + apiPackage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelTestFileFolder() {
|
||||
return (outputFolder + "/test").replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder + File.separator + modelPackage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
return "_" + name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the proper model name (capitalized).
|
||||
* In case the name belongs to the TypeSystem it won't be renamed.
|
||||
*
|
||||
* @param name the name of the model
|
||||
* @return capitalized model name
|
||||
*/
|
||||
@Override
|
||||
public String toModelName(String name) {
|
||||
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||
name = modelNamePrefix + "_" + name;
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(modelNameSuffix)) {
|
||||
name = name + "_" + modelNameSuffix;
|
||||
}
|
||||
|
||||
name = sanitizeName(name);
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
// camelize the model name
|
||||
// phone_number => PhoneNumber
|
||||
return camelize(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelFilename(String name) {
|
||||
// should be the same as the model name
|
||||
return "New-" + toModelName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the swagger type for the property
|
||||
*
|
||||
* @param p Swagger property object
|
||||
* @return string presentation of the type
|
||||
**/
|
||||
@Override
|
||||
public String getSwaggerType(Property p) {
|
||||
String swaggerType = super.getSwaggerType(p);
|
||||
String type;
|
||||
|
||||
// This maps, for example, long -> Long based on hashes in this type's constructor
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if (languageSpecificPrimitives.contains(type)) {
|
||||
return type;
|
||||
}
|
||||
} else {
|
||||
type = swaggerType;
|
||||
}
|
||||
|
||||
// model/object
|
||||
return toModelName(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the type declaration of the property
|
||||
*
|
||||
* @param p Swagger Property object
|
||||
* @return a string presentation of the property type
|
||||
*/
|
||||
@Override
|
||||
public String getTypeDeclaration(Property p) {
|
||||
if (p instanceof ArrayProperty) {
|
||||
ArrayProperty ap = (ArrayProperty) p;
|
||||
Property inner = ap.getItems();
|
||||
return getTypeDeclaration(inner) + "[]";
|
||||
} else if (p instanceof MapProperty) {
|
||||
MapProperty mp = (MapProperty) p;
|
||||
Property inner = mp.getAdditionalProperties();
|
||||
// TODO not sure if the following map/hash declaration is correct
|
||||
return "{String, " + getTypeDeclaration(inner) + "}";
|
||||
} else if (!languageSpecificPrimitives.contains(getSwaggerType(p))) {
|
||||
return packageName + ".Model." + super.getTypeDeclaration(p);
|
||||
}
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// throw exception if method name is empty (should not occur as an auto-generated method name will be used)
|
||||
if (StringUtils.isEmpty(operationId)) {
|
||||
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||
}
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
return camelize(sanitizeName(operationId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
int index = 0;
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
p.vendorExtensions.put("x-index", index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ io.swagger.codegen.languages.NodeJSServerCodegen
|
||||
io.swagger.codegen.languages.ObjcClientCodegen
|
||||
io.swagger.codegen.languages.PerlClientCodegen
|
||||
io.swagger.codegen.languages.PhpClientCodegen
|
||||
io.swagger.codegen.languages.PowerShellClientCodegen
|
||||
io.swagger.codegen.languages.PistacheServerCodegen
|
||||
io.swagger.codegen.languages.PythonClientCodegen
|
||||
io.swagger.codegen.languages.Qt5CPPGenerator
|
||||
|
@ -0,0 +1,86 @@
|
||||
function Get-FunctionsToExport {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('FullName')]
|
||||
$Path
|
||||
)
|
||||
|
||||
Process {
|
||||
$Token = $null
|
||||
$ParserErr = $null
|
||||
|
||||
$Ast = [System.Management.Automation.Language.Parser]::ParseFile(
|
||||
$Path,
|
||||
[ref]$Token,
|
||||
[ref]$ParserErr
|
||||
)
|
||||
|
||||
if ($ParserErr) {
|
||||
throw $ParserErr
|
||||
} else {
|
||||
foreach ($name in 'Begin', 'Process', 'End') {
|
||||
foreach ($Statement in $Ast."${name}Block".Statements) {
|
||||
if (
|
||||
[String]::IsNullOrWhiteSpace($Statement.Name) -or
|
||||
$Statement.Extent.ToString() -notmatch
|
||||
('function\W+{0}' -f $Statement.Name)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
$Statement.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||
$ClientPath = ("$ScriptDir\..\..\petstore\csharp\SwaggerClient" | Resolve-Path).ProviderPath
|
||||
$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\{{{packageName}}}\" $_}
|
||||
$BinPath = "$ScriptDir\src\{{{packageName}}}\Bin"
|
||||
|
||||
Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow
|
||||
|
||||
if (!(Test-Path "$ScriptDir\src\{{{packageName}}}\Bin" -PathType Container)) {
|
||||
New-Item "$ScriptDir\src\{{{packageName}}}\Bin" -ItemType Directory > $null
|
||||
}
|
||||
|
||||
Copy-Item "$ClientPath\bin\*.dll" $BinPath
|
||||
|
||||
$Manifest = @{
|
||||
Path = "$ScriptDir\src\{{{packageName}}}\{{{packageName}}}.psd1"
|
||||
|
||||
Author = 'Swagger Codegen Team'
|
||||
CompanyName = 'swagger.io'
|
||||
Description = '{{{packageName}}} - the PowerShell module for {{{appName}}}'
|
||||
|
||||
RootModule = '{{{packageName}}}.psm1'
|
||||
Guid = '{{packageGuid}}' # Has to be static, otherwise each new build will be considered different module
|
||||
|
||||
PowerShellVersion = '3.0'
|
||||
|
||||
RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object {
|
||||
Join-Path $_.Directory.Name $_.Name
|
||||
}
|
||||
|
||||
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport
|
||||
|
||||
VariablesToExport = @()
|
||||
AliasesToExport = @()
|
||||
CmdletsToExport = @()
|
||||
|
||||
# Should we use prefix to prevent command name collisions?
|
||||
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/
|
||||
#
|
||||
# Kirk Munro recommends against it:
|
||||
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820
|
||||
#
|
||||
# If not, we'd need to generate functions name with prefix.
|
||||
#
|
||||
# DefaultCommandPrefix = 'PetStore'
|
||||
}
|
||||
|
||||
New-ModuleManifest @Manifest
|
@ -0,0 +1,14 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Helper function to get common parameters (Verbose, Debug, etc.)
|
||||
.Example
|
||||
Get-CommonParameters
|
||||
#>
|
||||
function Get-CommonParameters {
|
||||
function tmp {
|
||||
[CmdletBinding()]
|
||||
Param ()
|
||||
}
|
||||
|
||||
(Get-Command -Name tmp -CommandType Function).Parameters.Keys
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
#region Import functions
|
||||
|
||||
'API', 'Model', 'Private' | Get-ChildItem -Path {
|
||||
Join-Path $PSScriptRoot $_
|
||||
} -Filter '*.ps1' | ForEach-Object {
|
||||
Write-Verbose "Importing file: $($_.BaseName)"
|
||||
try {
|
||||
. $_.FullName
|
||||
} catch {
|
||||
Write-Verbose "Can't import function!"
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Initialize APIs
|
||||
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{#-first}}
|
||||
'Creating object: {{{packageName}}}.Api.{{{classname}}}' | Write-Verbose
|
||||
$Script:{{{classname}}}= New-Object -TypeName {{{packageName}}}.Api.{{{classname}}} -ArgumentList @($null)
|
||||
|
||||
{{/-first}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
|
||||
#endregion
|
@ -0,0 +1,37 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Helper function to format debug parameter output.
|
||||
.Example
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
#>
|
||||
function Out-DebugParameter {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
|
||||
[AllowEmptyCollection()]
|
||||
$InputObject
|
||||
)
|
||||
|
||||
Begin {
|
||||
$CommonParameters = Get-CommonParameters
|
||||
}
|
||||
|
||||
Process {
|
||||
$InputObject.GetEnumerator() | Where-Object {
|
||||
$CommonParameters -notcontains $_.Key
|
||||
} | Format-Table -AutoSize -Property (
|
||||
@{
|
||||
Name = 'Parameter'
|
||||
Expression = {$_.Key}
|
||||
},
|
||||
@{
|
||||
Name = 'Value'
|
||||
Expression = {$_.Value}
|
||||
}
|
||||
) | Out-String -Stream | ForEach-Object {
|
||||
if ($_.Trim()) {
|
||||
$_
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
# {{packageName}} - the PowerShell module for the {{appName}}
|
||||
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
|
||||
This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
- SDK version: {{packageVersion}}
|
||||
{{^hideGenerationTimestamp}}
|
||||
- Build date: {{generatedDate}}
|
||||
{{/hideGenerationTimestamp}}
|
||||
- Build package: {{generatorClass}}
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
<a name="frameworks-supported"></a>
|
||||
## Frameworks supported
|
||||
- .NET 4.0 or later
|
||||
- PowerShell 3.0 or later
|
||||
|
||||
<a name="dependencies"></a>
|
||||
## Dependencies
|
||||
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
|
||||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
|
||||
|
||||
The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
||||
```
|
||||
Install-Package RestSharp
|
||||
Install-Package Newtonsoft.Json
|
||||
```
|
||||
|
||||
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
|
||||
|
||||
<a name="installation"></a>
|
||||
## Installation
|
||||
Run the following command to generate the DLL
|
||||
- [Windows] `Build.ps1`
|
||||
|
||||
Then import module from the .\src\{{{packageName}}} folder:
|
||||
```powershell
|
||||
using {{packageName}}.{{apiPackage}};
|
||||
using {{packageName}}.Client;
|
||||
using {{packageName}}.{{modelPackage}};
|
||||
```
|
||||
|
||||
<a name="documentation-for-api-endpoints"></a>
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{{basePath}}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
<a name="documentation-for-models"></a>
|
||||
## Documentation for Models
|
||||
|
||||
{{#modelPackage}}
|
||||
{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
|
||||
{{/model}}{{/models}}
|
||||
{{/modelPackage}}
|
||||
{{^modelPackage}}
|
||||
No model defined in this package
|
||||
{{/modelPackage}}
|
||||
|
||||
<a name="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
{{^authMethods}}
|
||||
All endpoints do not require authorization.
|
||||
{{/authMethods}}
|
||||
{{#authMethods}}
|
||||
{{#last}}
|
||||
Authentication schemes defined for the API:
|
||||
{{/last}}
|
||||
{{/authMethods}}
|
||||
{{#authMethods}}
|
||||
<a name="{{name}}"></a>
|
||||
### {{name}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
- **API key parameter name**: {{keyParamName}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}- **Type**: OAuth
|
||||
- **Flow**: {{flow}}
|
||||
- **Authorization URL**: {{authorizationUrl}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - {{scope}}: {{description}}
|
||||
{{/scopes}}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
@ -0,0 +1,27 @@
|
||||
PSTOPIC
|
||||
about_{{{packageName}}}
|
||||
|
||||
SHORT DESCRIPTION
|
||||
{{{packageName}}} - the PowerShell module for the {{{appName}}}
|
||||
|
||||
LONG DESCRIPTION
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
|
||||
{{/appDescription}}
|
||||
This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
- SDK version: {{packageVersion}}
|
||||
{{^hideGenerationTimestamp}}
|
||||
- Build date: {{generatedDate}}
|
||||
{{/hideGenerationTimestamp}}
|
||||
- Build package: {{{generatorClass}}}
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
Frameworks supported:
|
||||
|
||||
* PowerShell 3.0+
|
||||
* .NET 4.0 or later
|
@ -0,0 +1,30 @@
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
function Invoke-{{{classname}}}{{{operationId}}} {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
{{#allParams}}
|
||||
[Parameter(Position = {{vendorExtensions.x-index}}, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = {{#required}}$true{{/required}}{{^required}}$false{{/required}})]
|
||||
[{{^isContainer}}{{^isPrimitiveType}}{{^isFile}}{{{packageName}}}.Model.{{/isFile}}{{/isPrimitiveType}}{{/isContainer}}{{{dataType}}}]
|
||||
{{=<% %>=}}
|
||||
${<%paramName%>}<%^-last%>,<%/-last%>
|
||||
<%={{ }}=%>
|
||||
{{/allParams}}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: {{{classname}}}-{{{operationId}}}' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:{{{classname}}}.{{{operationId}}}(
|
||||
{{#allParams}}
|
||||
{{=<% %>=}}
|
||||
${<%paramName%>}<%^-last%>,<%/-last%>
|
||||
<%={{ }}=%>
|
||||
{{/allParams}}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
@ -0,0 +1,105 @@
|
||||
# {{packageName}}.{{apiPackage}}.{{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{{basePath}}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
<a name="{{{operationIdLowerCase}}}"></a>
|
||||
# **{{{operationId}}}**
|
||||
> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
|
||||
{{{summary}}}{{#notes}}
|
||||
|
||||
{{{notes}}}{{/notes}}
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using {{packageName}}.{{apiPackage}};
|
||||
using {{packageName}}.Client;
|
||||
using {{packageName}}.{{modelPackage}};
|
||||
|
||||
namespace Example
|
||||
{
|
||||
public class {{operationId}}Example
|
||||
{
|
||||
public void main()
|
||||
{
|
||||
{{#hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
Configuration.Default.Username = "YOUR_USERNAME";
|
||||
Configuration.Default.Password = "YOUR_PASSWORD";
|
||||
{{/isBasic}}
|
||||
{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");
|
||||
{{/isApiKey}}
|
||||
{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
|
||||
{{/hasAuthMethods}}
|
||||
var apiInstance = new {{classname}}();
|
||||
{{#allParams}}
|
||||
{{#isPrimitiveType}}
|
||||
var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/allParams}}
|
||||
|
||||
try
|
||||
{
|
||||
{{#summary}}
|
||||
// {{{.}}}
|
||||
{{/summary}}
|
||||
{{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||
Debug.WriteLine(result);{{/returnType}}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{#isContainer}}{{baseType}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
@ -0,0 +1,17 @@
|
||||
# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
|
||||
# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function
|
||||
|
||||
Describe '{{{packageName}}} {{{classname}}}' {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
Context '{{{classname}}}' {
|
||||
It 'Invoke-{{{classname}}}{{{operationId}}}' {
|
||||
$ret = Invoke-PetApiGetPetById{{#allParams}} -{{{paramName}}} "TEST_VALUE"{{/allParams}}
|
||||
#$ret | Should BeOfType {{{packageName}}}.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
function New-{{{classname}}} {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
{{#vars}}
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true{{#required}}, Mandatory = $true{{/required}})]
|
||||
[{{#isString}}{{{datatype}}}{{/isString}}{{^isString}}{{^required}}System.Nullable[{{/required}}{{datatype}}{{^required}}]{{/required}}{{/isString}}]
|
||||
{{=<% %>=}}
|
||||
${<%name%>}<%^-last%>,<%/-last%>
|
||||
<%={{ }}=%>
|
||||
{{/vars}}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: {{{packageName}}}.Model.{{{classname}}}' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName {{{packageName}}}.Model.{{{classname}}} -ArgumentList @(
|
||||
{{#vars}}
|
||||
{{=<% %>=}}
|
||||
${<%name%>}<%^-last%>,<%/-last%>
|
||||
<%={{ }}=%>
|
||||
{{/vars}}
|
||||
)
|
||||
}
|
||||
}
|
||||
{{/model}}
|
||||
{{/models}}
|
@ -0,0 +1,14 @@
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
# {{{packageName}}}.{{modelPackage}}.{{{classname}}}
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
|
||||
{{/vars}}
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
{{/model}}
|
||||
{{/models}}
|
@ -0,0 +1,6 @@
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
## TODO we need to update the template to test the model files
|
||||
|
||||
{{/model}}
|
||||
{{/models}}
|
23
samples/client/petstore/powershell/.swagger-codegen-ignore
Normal file
23
samples/client/petstore/powershell/.swagger-codegen-ignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
86
samples/client/petstore/powershell/Build.ps1
Normal file
86
samples/client/petstore/powershell/Build.ps1
Normal file
@ -0,0 +1,86 @@
|
||||
function Get-FunctionsToExport {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('FullName')]
|
||||
$Path
|
||||
)
|
||||
|
||||
Process {
|
||||
$Token = $null
|
||||
$ParserErr = $null
|
||||
|
||||
$Ast = [System.Management.Automation.Language.Parser]::ParseFile(
|
||||
$Path,
|
||||
[ref]$Token,
|
||||
[ref]$ParserErr
|
||||
)
|
||||
|
||||
if ($ParserErr) {
|
||||
throw $ParserErr
|
||||
} else {
|
||||
foreach ($name in 'Begin', 'Process', 'End') {
|
||||
foreach ($Statement in $Ast."${name}Block".Statements) {
|
||||
if (
|
||||
[String]::IsNullOrWhiteSpace($Statement.Name) -or
|
||||
$Statement.Extent.ToString() -notmatch
|
||||
('function\W+{0}' -f $Statement.Name)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
$Statement.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||
$ClientPath = ("$ScriptDir\..\..\petstore\csharp\SwaggerClient" | Resolve-Path).ProviderPath
|
||||
$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\IO.Swagger\" $_}
|
||||
$BinPath = "$ScriptDir\src\IO.Swagger\Bin"
|
||||
|
||||
Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow
|
||||
|
||||
if (!(Test-Path "$ScriptDir\src\IO.Swagger\Bin" -PathType Container)) {
|
||||
New-Item "$ScriptDir\src\IO.Swagger\Bin" -ItemType Directory > $null
|
||||
}
|
||||
|
||||
Copy-Item "$ClientPath\bin\*.dll" $BinPath
|
||||
|
||||
$Manifest = @{
|
||||
Path = "$ScriptDir\src\IO.Swagger\IO.Swagger.psd1"
|
||||
|
||||
Author = 'Swagger Codegen Team'
|
||||
CompanyName = 'swagger.io'
|
||||
Description = 'IO.Swagger - the PowerShell module for Swagger Petstore'
|
||||
|
||||
RootModule = 'IO.Swagger.psm1'
|
||||
Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module
|
||||
|
||||
PowerShellVersion = '3.0'
|
||||
|
||||
RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object {
|
||||
Join-Path $_.Directory.Name $_.Name
|
||||
}
|
||||
|
||||
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport
|
||||
|
||||
VariablesToExport = @()
|
||||
AliasesToExport = @()
|
||||
CmdletsToExport = @()
|
||||
|
||||
# Should we use prefix to prevent command name collisions?
|
||||
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/
|
||||
#
|
||||
# Kirk Munro recommends against it:
|
||||
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820
|
||||
#
|
||||
# If not, we'd need to generate functions name with prefix.
|
||||
#
|
||||
# DefaultCommandPrefix = 'PetStore'
|
||||
}
|
||||
|
||||
New-ModuleManifest @Manifest
|
101
samples/client/petstore/powershell/README.md
Normal file
101
samples/client/petstore/powershell/README.md
Normal file
@ -0,0 +1,101 @@
|
||||
# IO.Swagger - the PowerShell module for the Swagger Petstore
|
||||
|
||||
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.
|
||||
|
||||
This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- SDK version:
|
||||
- Build date: 2017-06-09T17:28:25.415+04:00
|
||||
- Build package: io.swagger.codegen.languages.PowerShellClientCodegen
|
||||
|
||||
<a name="frameworks-supported"></a>
|
||||
## Frameworks supported
|
||||
- .NET 4.0 or later
|
||||
- PowerShell 3.0 or later
|
||||
|
||||
<a name="dependencies"></a>
|
||||
## Dependencies
|
||||
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
|
||||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
|
||||
|
||||
The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
||||
```
|
||||
Install-Package RestSharp
|
||||
Install-Package Newtonsoft.Json
|
||||
```
|
||||
|
||||
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
|
||||
|
||||
<a name="installation"></a>
|
||||
## Installation
|
||||
Run the following command to generate the DLL
|
||||
- [Windows] `Build.ps1`
|
||||
|
||||
Then import module from the .\src\IO.Swagger folder:
|
||||
```powershell
|
||||
using IO.Swagger.IO.Swagger\API;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.IO.Swagger\Model;
|
||||
```
|
||||
|
||||
<a name="documentation-for-api-endpoints"></a>
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
|
||||
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
||||
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
<a name="documentation-for-models"></a>
|
||||
## Documentation for Models
|
||||
|
||||
- [IO.Swagger\Model.ApiResponse](docs/ApiResponse.md)
|
||||
- [IO.Swagger\Model.Category](docs/Category.md)
|
||||
- [IO.Swagger\Model.Order](docs/Order.md)
|
||||
- [IO.Swagger\Model.Pet](docs/Pet.md)
|
||||
- [IO.Swagger\Model.Tag](docs/Tag.md)
|
||||
- [IO.Swagger\Model.User](docs/User.md)
|
||||
|
||||
|
||||
<a name="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
<a name="api_key"></a>
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
<a name="petstore_auth"></a>
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
11
samples/client/petstore/powershell/docs/ApiResponse.md
Normal file
11
samples/client/petstore/powershell/docs/ApiResponse.md
Normal file
@ -0,0 +1,11 @@
|
||||
# IO.Swagger.IO.Swagger\Model.ApiResponse
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **Int32** | | [optional] [default to null]
|
||||
**type** | **String** | | [optional] [default to null]
|
||||
**message** | **String** | | [optional] [default to null]
|
||||
|
||||
[[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
samples/client/petstore/powershell/docs/Category.md
Normal file
10
samples/client/petstore/powershell/docs/Category.md
Normal file
@ -0,0 +1,10 @@
|
||||
# IO.Swagger.IO.Swagger\Model.Category
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Int64** | | [optional] [default to null]
|
||||
**name** | **String** | | [optional] [default to null]
|
||||
|
||||
[[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
samples/client/petstore/powershell/docs/Order.md
Normal file
14
samples/client/petstore/powershell/docs/Order.md
Normal file
@ -0,0 +1,14 @@
|
||||
# IO.Swagger.IO.Swagger\Model.Order
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Int64** | | [optional] [default to null]
|
||||
**petId** | **Int64** | | [optional] [default to null]
|
||||
**quantity** | **Int32** | | [optional] [default to null]
|
||||
**shipDate** | **System.DateTime** | | [optional] [default to null]
|
||||
**status** | **String** | Order Status | [optional] [default to null]
|
||||
**complete** | **Boolean** | | [optional] [default to null]
|
||||
|
||||
[[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
samples/client/petstore/powershell/docs/Pet.md
Normal file
14
samples/client/petstore/powershell/docs/Pet.md
Normal file
@ -0,0 +1,14 @@
|
||||
# IO.Swagger.IO.Swagger\Model.Pet
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Int64** | | [optional] [default to null]
|
||||
**category** | [**IO.Swagger.Model.Category**](Category.md) | | [optional] [default to null]
|
||||
**name** | **String** | | [default to null]
|
||||
**photoUrls** | **String** | | [default to null]
|
||||
**tags** | [**IO.Swagger.Model.Tag**](Tag.md) | | [optional] [default to null]
|
||||
**status** | **String** | pet status in the store | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
536
samples/client/petstore/powershell/docs/PetApi.md
Normal file
536
samples/client/petstore/powershell/docs/PetApi.md
Normal file
@ -0,0 +1,536 @@
|
||||
# IO.Swagger.IO.Swagger\API.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
<a name="addpet"></a>
|
||||
# **AddPet**
|
||||
> void AddPet (Pet body)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="deletepet"></a>
|
||||
# **DeletePet**
|
||||
> void DeletePet (Int64 petId, String apiKey)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="findpetsbystatus"></a>
|
||||
# **FindPetsByStatus**
|
||||
> IO.Swagger.Model.Pet FindPetsByStatus (String status)
|
||||
|
||||
Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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**](String.md)| Status values that need to be considered for filter |
|
||||
|
||||
### Return type
|
||||
|
||||
[**IO.Swagger.Model.Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="findpetsbytags"></a>
|
||||
# **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
|
||||
```csharp
|
||||
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**](String.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
|
||||
[**IO.Swagger.Model.Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="getpetbyid"></a>
|
||||
# **GetPetById**
|
||||
> IO.Swagger.Model.Pet GetPetById (Int64 petId)
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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
|
||||
|
||||
[**IO.Swagger.Model.Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="updatepet"></a>
|
||||
# **UpdatePet**
|
||||
> void UpdatePet (Pet body)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="updatepetwithform"></a>
|
||||
# **UpdatePetWithForm**
|
||||
> void UpdatePetWithForm (Int64 petId, String name, String status)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="uploadfile"></a>
|
||||
# **UploadFile**
|
||||
> IO.Swagger.Model.ApiResponse UploadFile (Int64 petId, String additionalMetadata, String file)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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
|
||||
|
||||
[**IO.Swagger.Model.ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
256
samples/client/petstore/powershell/docs/StoreApi.md
Normal file
256
samples/client/petstore/powershell/docs/StoreApi.md
Normal file
@ -0,0 +1,256 @@
|
||||
# IO.Swagger.IO.Swagger\API.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
<a name="deleteorder"></a>
|
||||
# **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
|
||||
```csharp
|
||||
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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="getinventory"></a>
|
||||
# **GetInventory**
|
||||
> {String, Int32} GetInventory ()
|
||||
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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}**](Map.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="getorderbyid"></a>
|
||||
# **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
|
||||
```csharp
|
||||
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**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="placeorder"></a>
|
||||
# **PlaceOrder**
|
||||
> IO.Swagger.Model.Order PlaceOrder (Order body)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
[**IO.Swagger.Model.Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
10
samples/client/petstore/powershell/docs/Tag.md
Normal file
10
samples/client/petstore/powershell/docs/Tag.md
Normal file
@ -0,0 +1,10 @@
|
||||
# IO.Swagger.IO.Swagger\Model.Tag
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Int64** | | [optional] [default to null]
|
||||
**name** | **String** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
16
samples/client/petstore/powershell/docs/User.md
Normal file
16
samples/client/petstore/powershell/docs/User.md
Normal file
@ -0,0 +1,16 @@
|
||||
# IO.Swagger.IO.Swagger\Model.User
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Int64** | | [optional] [default to null]
|
||||
**username** | **String** | | [optional] [default to null]
|
||||
**firstName** | **String** | | [optional] [default to null]
|
||||
**lastName** | **String** | | [optional] [default to null]
|
||||
**email** | **String** | | [optional] [default to null]
|
||||
**password** | **String** | | [optional] [default to null]
|
||||
**phone** | **String** | | [optional] [default to null]
|
||||
**userStatus** | **Int32** | User Status | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
498
samples/client/petstore/powershell/docs/UserApi.md
Normal file
498
samples/client/petstore/powershell/docs/UserApi.md
Normal file
@ -0,0 +1,498 @@
|
||||
# IO.Swagger.IO.Swagger\API.UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user
|
||||
[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
||||
[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
||||
[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
||||
[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
<a name="createuser"></a>
|
||||
# **CreateUser**
|
||||
> void CreateUser (User body)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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**](User.md)| 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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="createuserswitharrayinput"></a>
|
||||
# **CreateUsersWithArrayInput**
|
||||
> void CreateUsersWithArrayInput (IO.Swagger.Model.User body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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**](User.md)| 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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="createuserswithlistinput"></a>
|
||||
# **CreateUsersWithListInput**
|
||||
> void CreateUsersWithListInput (IO.Swagger.Model.User body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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**](User.md)| 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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="deleteuser"></a>
|
||||
# **DeleteUser**
|
||||
> void DeleteUser (String username)
|
||||
|
||||
Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="getuserbyname"></a>
|
||||
# **GetUserByName**
|
||||
> IO.Swagger.Model.User GetUserByName (String username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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**](User.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="loginuser"></a>
|
||||
# **LoginUser**
|
||||
> String LoginUser (String username, String password)
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="logoutuser"></a>
|
||||
# **LogoutUser**
|
||||
> void LogoutUser ()
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
<a name="updateuser"></a>
|
||||
# **UpdateUser**
|
||||
> void UpdateUser (String username, User body)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
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**](User.md)| 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]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
164
samples/client/petstore/powershell/src/IO.Swagger/API/PetApi.ps1
Normal file
164
samples/client/petstore/powershell/src/IO.Swagger/API/PetApi.ps1
Normal file
@ -0,0 +1,164 @@
|
||||
function Invoke-PetApiAddPet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.Pet]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-AddPet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.AddPet(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiDeletePet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId},
|
||||
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${apiKey}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-DeletePet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.DeletePet(
|
||||
${petId},
|
||||
${apiKey}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiFindPetsByStatus {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${status}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-FindPetsByStatus' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.FindPetsByStatus(
|
||||
${status}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiFindPetsByTags {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${tags}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-FindPetsByTags' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.FindPetsByTags(
|
||||
${tags}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiGetPetById {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-GetPetById' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.GetPetById(
|
||||
${petId}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiUpdatePet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.Pet]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-UpdatePet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.UpdatePet(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiUpdatePetWithForm {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId},
|
||||
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${name},
|
||||
[Parameter(Position = 3, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${status}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-UpdatePetWithForm' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.UpdatePetWithForm(
|
||||
${petId},
|
||||
${name},
|
||||
${status}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiUploadFile {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId},
|
||||
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${additionalMetadata},
|
||||
[Parameter(Position = 3, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[IO.Swagger.Model.String]
|
||||
${file}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-UploadFile' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.UploadFile(
|
||||
${petId},
|
||||
${additionalMetadata},
|
||||
${file}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
function Invoke-StoreApiDeleteOrder {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${orderId}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-DeleteOrder' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.DeleteOrder(
|
||||
${orderId}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-StoreApiGetInventory {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-GetInventory' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.GetInventory(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-StoreApiGetOrderById {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${orderId}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-GetOrderById' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.GetOrderById(
|
||||
${orderId}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-StoreApiPlaceOrder {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.Order]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-PlaceOrder' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.PlaceOrder(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,148 @@
|
||||
function Invoke-UserApiCreateUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-CreateUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.CreateUser(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiCreateUsersWithArrayInput {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-CreateUsersWithArrayInput' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.CreateUsersWithArrayInput(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiCreateUsersWithListInput {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-CreateUsersWithListInput' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.CreateUsersWithListInput(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiDeleteUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-DeleteUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.DeleteUser(
|
||||
${username}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiGetUserByName {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-GetUserByName' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.GetUserByName(
|
||||
${username}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiLoginUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username},
|
||||
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${password}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-LoginUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.LoginUser(
|
||||
${username},
|
||||
${password}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiLogoutUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-LogoutUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.LogoutUser(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiUpdateUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username},
|
||||
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-UpdateUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.UpdateUser(
|
||||
${username},
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,29 @@
|
||||
#region Import functions
|
||||
|
||||
'API', 'Model', 'Private' | Get-ChildItem -Path {
|
||||
Join-Path $PSScriptRoot $_
|
||||
} -Filter '*.ps1' | ForEach-Object {
|
||||
Write-Verbose "Importing file: $($_.BaseName)"
|
||||
try {
|
||||
. $_.FullName
|
||||
} catch {
|
||||
Write-Verbose "Can't import function!"
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Initialize APIs
|
||||
|
||||
'Creating object: IO.Swagger.Api.PetApi' | Write-Verbose
|
||||
$Script:PetApi= New-Object -TypeName IO.Swagger.Api.PetApi -ArgumentList @($null)
|
||||
|
||||
'Creating object: IO.Swagger.Api.StoreApi' | Write-Verbose
|
||||
$Script:StoreApi= New-Object -TypeName IO.Swagger.Api.StoreApi -ArgumentList @($null)
|
||||
|
||||
'Creating object: IO.Swagger.Api.UserApi' | Write-Verbose
|
||||
$Script:UserApi= New-Object -TypeName IO.Swagger.Api.UserApi -ArgumentList @($null)
|
||||
|
||||
|
||||
#endregion
|
@ -0,0 +1,25 @@
|
||||
function New-ApiResponse {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int32]]
|
||||
${code},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${type},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${message}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.ApiResponse' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.ApiResponse -ArgumentList @(
|
||||
${code},
|
||||
${type},
|
||||
${message}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
function New-Category {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${name}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Category' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Category -ArgumentList @(
|
||||
${id},
|
||||
${name}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
function New-Order {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${petId},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int32]]
|
||||
${quantity},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[System.DateTime]]
|
||||
${shipDate},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${status},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Boolean]]
|
||||
${complete}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Order' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Order -ArgumentList @(
|
||||
${id},
|
||||
${petId},
|
||||
${quantity},
|
||||
${shipDate},
|
||||
${status},
|
||||
${complete}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
function New-Pet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[IO.Swagger.Model.Category]]
|
||||
${category},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${name},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[[String]]
|
||||
${photoUrls},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[IO.Swagger.Model.Tag]]
|
||||
${tags},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${status}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Pet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Pet -ArgumentList @(
|
||||
${id},
|
||||
${category},
|
||||
${name},
|
||||
${photoUrls},
|
||||
${tags},
|
||||
${status}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
function New-Tag {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${name}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Tag' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Tag -ArgumentList @(
|
||||
${id},
|
||||
${name}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
function New-User {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${username},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${firstName},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${lastName},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${email},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${password},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${phone},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int32]]
|
||||
${userStatus}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.User' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.User -ArgumentList @(
|
||||
${id},
|
||||
${username},
|
||||
${firstName},
|
||||
${lastName},
|
||||
${email},
|
||||
${password},
|
||||
${phone},
|
||||
${userStatus}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Helper function to get common parameters (Verbose, Debug, etc.)
|
||||
.Example
|
||||
Get-CommonParameters
|
||||
#>
|
||||
function Get-CommonParameters {
|
||||
function tmp {
|
||||
[CmdletBinding()]
|
||||
Param ()
|
||||
}
|
||||
|
||||
(Get-Command -Name tmp -CommandType Function).Parameters.Keys
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Helper function to format debug parameter output.
|
||||
.Example
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
#>
|
||||
function Out-DebugParameter {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
|
||||
[AllowEmptyCollection()]
|
||||
$InputObject
|
||||
)
|
||||
|
||||
Begin {
|
||||
$CommonParameters = Get-CommonParameters
|
||||
}
|
||||
|
||||
Process {
|
||||
$InputObject.GetEnumerator() | Where-Object {
|
||||
$CommonParameters -notcontains $_.Key
|
||||
} | Format-Table -AutoSize -Property (
|
||||
@{
|
||||
Name = 'Parameter'
|
||||
Expression = {$_.Key}
|
||||
},
|
||||
@{
|
||||
Name = 'Value'
|
||||
Expression = {$_.Value}
|
||||
}
|
||||
) | Out-String -Stream | ForEach-Object {
|
||||
if ($_.Trim()) {
|
||||
$_
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
PSTOPIC
|
||||
about_IO.Swagger
|
||||
|
||||
SHORT DESCRIPTION
|
||||
IO.Swagger - the PowerShell module for the Swagger Petstore
|
||||
|
||||
LONG DESCRIPTION
|
||||
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.
|
||||
|
||||
This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- SDK version:
|
||||
- Build date: 2017-06-09T17:28:25.415+04:00
|
||||
- Build package: io.swagger.codegen.languages.PowerShellClientCodegen
|
||||
|
||||
Frameworks supported:
|
||||
|
||||
* PowerShell 3.0+
|
||||
* .NET 4.0 or later
|
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
86
samples/client/petstore/powershell_test/Build.ps1
Normal file
86
samples/client/petstore/powershell_test/Build.ps1
Normal file
@ -0,0 +1,86 @@
|
||||
function Get-FunctionsToExport {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias('FullName')]
|
||||
$Path
|
||||
)
|
||||
|
||||
Process {
|
||||
$Token = $null
|
||||
$ParserErr = $null
|
||||
|
||||
$Ast = [System.Management.Automation.Language.Parser]::ParseFile(
|
||||
$Path,
|
||||
[ref]$Token,
|
||||
[ref]$ParserErr
|
||||
)
|
||||
|
||||
if ($ParserErr) {
|
||||
throw $ParserErr
|
||||
} else {
|
||||
foreach ($name in 'Begin', 'Process', 'End') {
|
||||
foreach ($Statement in $Ast."${name}Block".Statements) {
|
||||
if (
|
||||
[String]::IsNullOrWhiteSpace($Statement.Name) -or
|
||||
$Statement.Extent.ToString() -notmatch
|
||||
('function\W+{0}' -f $Statement.Name)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
$Statement.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||
$ClientPath = ("$ScriptDir\..\..\petstore\csharp\SwaggerClient" | Resolve-Path).ProviderPath
|
||||
$FunctionPath = 'API', 'Model' | ForEach-Object {Join-Path "$ScriptDir\src\IO.Swagger\" $_}
|
||||
$BinPath = "$ScriptDir\src\IO.Swagger\Bin"
|
||||
|
||||
Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow
|
||||
|
||||
if (!(Test-Path "$ScriptDir\src\IO.Swagger\Bin" -PathType Container)) {
|
||||
New-Item "$ScriptDir\src\IO.Swagger\Bin" -ItemType Directory > $null
|
||||
}
|
||||
|
||||
Copy-Item "$ClientPath\bin\*.dll" $BinPath
|
||||
|
||||
$Manifest = @{
|
||||
Path = "$ScriptDir\src\IO.Swagger\IO.Swagger.psd1"
|
||||
|
||||
Author = 'Swagger Codegen Team'
|
||||
CompanyName = 'swagger.io'
|
||||
Description = 'IO.Swagger - the PowerShell module for Swagger Petstore'
|
||||
|
||||
RootModule = 'IO.Swagger.psm1'
|
||||
Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module
|
||||
|
||||
PowerShellVersion = '3.0'
|
||||
|
||||
RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object {
|
||||
Join-Path $_.Directory.Name $_.Name
|
||||
}
|
||||
|
||||
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport
|
||||
|
||||
VariablesToExport = @()
|
||||
AliasesToExport = @()
|
||||
CmdletsToExport = @()
|
||||
|
||||
# Should we use prefix to prevent command name collisions?
|
||||
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/
|
||||
#
|
||||
# Kirk Munro recommends against it:
|
||||
# https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820
|
||||
#
|
||||
# If not, we'd need to generate functions name with prefix.
|
||||
#
|
||||
# DefaultCommandPrefix = 'PetStore'
|
||||
}
|
||||
|
||||
New-ModuleManifest @Manifest
|
101
samples/client/petstore/powershell_test/README.md
Normal file
101
samples/client/petstore/powershell_test/README.md
Normal file
@ -0,0 +1,101 @@
|
||||
# IO.Swagger - the PowerShell module for the Swagger Petstore
|
||||
|
||||
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.
|
||||
|
||||
This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- SDK version:
|
||||
- Build date: 2017-06-20T16:12:54.727+08:00
|
||||
- Build package: io.swagger.codegen.languages.PowerShellClientCodegen
|
||||
|
||||
<a name="frameworks-supported"></a>
|
||||
## Frameworks supported
|
||||
- .NET 4.0 or later
|
||||
- PowerShell 3.0 or later
|
||||
|
||||
<a name="dependencies"></a>
|
||||
## Dependencies
|
||||
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
|
||||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
|
||||
|
||||
The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
||||
```
|
||||
Install-Package RestSharp
|
||||
Install-Package Newtonsoft.Json
|
||||
```
|
||||
|
||||
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
|
||||
|
||||
<a name="installation"></a>
|
||||
## Installation
|
||||
Run the following command to generate the DLL
|
||||
- [Windows] `Build.ps1`
|
||||
|
||||
Then import module from the .\src\IO.Swagger folder:
|
||||
```powershell
|
||||
using IO.Swagger.IO.Swagger/API;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.IO.Swagger/Model;
|
||||
```
|
||||
|
||||
<a name="documentation-for-api-endpoints"></a>
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
|
||||
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
||||
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
<a name="documentation-for-models"></a>
|
||||
## Documentation for Models
|
||||
|
||||
- [IO.Swagger/Model.ApiResponse](docs/ApiResponse.md)
|
||||
- [IO.Swagger/Model.Category](docs/Category.md)
|
||||
- [IO.Swagger/Model.Order](docs/Order.md)
|
||||
- [IO.Swagger/Model.Pet](docs/Pet.md)
|
||||
- [IO.Swagger/Model.Tag](docs/Tag.md)
|
||||
- [IO.Swagger/Model.User](docs/User.md)
|
||||
|
||||
|
||||
<a name="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
<a name="api_key"></a>
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
<a name="petstore_auth"></a>
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
@ -0,0 +1,164 @@
|
||||
function Invoke-PetApiAddPet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.Pet]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-AddPet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.AddPet(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiDeletePet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId},
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${apiKey}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-DeletePet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.DeletePet(
|
||||
${petId},
|
||||
${apiKey}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiFindPetsByStatus {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String[]]
|
||||
${status}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-FindPetsByStatus' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.FindPetsByStatus(
|
||||
${status}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiFindPetsByTags {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String[]]
|
||||
${tags}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-FindPetsByTags' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.FindPetsByTags(
|
||||
${tags}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiGetPetById {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-GetPetById' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.GetPetById(
|
||||
${petId}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiUpdatePet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.Pet]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-UpdatePet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.UpdatePet(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiUpdatePetWithForm {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId},
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${name},
|
||||
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${status}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-UpdatePetWithForm' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.UpdatePetWithForm(
|
||||
${petId},
|
||||
${name},
|
||||
${status}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-PetApiUploadFile {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${petId},
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${additionalMetadata},
|
||||
[Parameter(Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
|
||||
[String]
|
||||
${file}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: PetApi-UploadFile' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:PetApi.UploadFile(
|
||||
${petId},
|
||||
${additionalMetadata},
|
||||
${file}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
function Invoke-StoreApiDeleteOrder {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${orderId}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-DeleteOrder' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.DeleteOrder(
|
||||
${orderId}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-StoreApiGetInventory {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-GetInventory' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.GetInventory(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-StoreApiGetOrderById {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[Int64]
|
||||
${orderId}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-GetOrderById' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.GetOrderById(
|
||||
${orderId}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-StoreApiPlaceOrder {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.Order]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: StoreApi-PlaceOrder' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:StoreApi.PlaceOrder(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,148 @@
|
||||
function Invoke-UserApiCreateUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-CreateUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.CreateUser(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiCreateUsersWithArrayInput {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User[]]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-CreateUsersWithArrayInput' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.CreateUsersWithArrayInput(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiCreateUsersWithListInput {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User[]]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-CreateUsersWithListInput' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.CreateUsersWithListInput(
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiDeleteUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-DeleteUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.DeleteUser(
|
||||
${username}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiGetUserByName {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-GetUserByName' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.GetUserByName(
|
||||
${username}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiLoginUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username},
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${password}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-LoginUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.LoginUser(
|
||||
${username},
|
||||
${password}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiLogoutUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-LogoutUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.LogoutUser(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-UserApiUpdateUser {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${username},
|
||||
[Parameter(Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[IO.Swagger.Model.User]
|
||||
${body}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Calling method: UserApi-UpdateUser' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$Script:UserApi.UpdateUser(
|
||||
${username},
|
||||
${body}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
#region Import functions
|
||||
|
||||
'API', 'Model', 'Private' | Get-ChildItem -Path {
|
||||
Join-Path $PSScriptRoot $_
|
||||
} -Filter '*.ps1' | ForEach-Object {
|
||||
Write-Verbose "Importing file: $($_.BaseName)"
|
||||
try {
|
||||
. $_.FullName
|
||||
} catch {
|
||||
Write-Verbose "Can't import function!"
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Initialize APIs
|
||||
|
||||
'Creating object: IO.Swagger.Api.PetApi' | Write-Verbose
|
||||
$Script:PetApi= New-Object -TypeName IO.Swagger.Api.PetApi -ArgumentList @($null)
|
||||
|
||||
'Creating object: IO.Swagger.Api.StoreApi' | Write-Verbose
|
||||
$Script:StoreApi= New-Object -TypeName IO.Swagger.Api.StoreApi -ArgumentList @($null)
|
||||
|
||||
'Creating object: IO.Swagger.Api.UserApi' | Write-Verbose
|
||||
$Script:UserApi= New-Object -TypeName IO.Swagger.Api.UserApi -ArgumentList @($null)
|
||||
|
||||
|
||||
#endregion
|
@ -0,0 +1,25 @@
|
||||
function New-ApiResponse {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int32]]
|
||||
${code},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${type},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${message}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.ApiResponse' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.ApiResponse -ArgumentList @(
|
||||
${code},
|
||||
${type},
|
||||
${message}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
function New-Category {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${name}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Category' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Category -ArgumentList @(
|
||||
${id},
|
||||
${name}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
function New-Order {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${petId},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int32]]
|
||||
${quantity},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[System.DateTime]]
|
||||
${shipDate},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${status},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Boolean]]
|
||||
${complete}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Order' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Order -ArgumentList @(
|
||||
${id},
|
||||
${petId},
|
||||
${quantity},
|
||||
${shipDate},
|
||||
${status},
|
||||
${complete}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
function New-Pet {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[IO.Swagger.Model.Category]]
|
||||
${category},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String]
|
||||
${name},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)]
|
||||
[String[]]
|
||||
${photoUrls},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[IO.Swagger.Model.Tag[]]]
|
||||
${tags},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${status}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Pet' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Pet -ArgumentList @(
|
||||
${id},
|
||||
${category},
|
||||
${name},
|
||||
${photoUrls},
|
||||
${tags},
|
||||
${status}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
function New-Tag {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${name}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.Tag' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.Tag -ArgumentList @(
|
||||
${id},
|
||||
${name}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
function New-User {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int64]]
|
||||
${id},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${username},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${firstName},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${lastName},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${email},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${password},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]
|
||||
${phone},
|
||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
||||
[System.Nullable[Int32]]
|
||||
${userStatus}
|
||||
)
|
||||
|
||||
Process {
|
||||
'Creating object: IO.Swagger.Model.User' | Write-Verbose
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
New-Object -TypeName IO.Swagger.Model.User -ArgumentList @(
|
||||
${id},
|
||||
${username},
|
||||
${firstName},
|
||||
${lastName},
|
||||
${email},
|
||||
${password},
|
||||
${phone},
|
||||
${userStatus}
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Helper function to get common parameters (Verbose, Debug, etc.)
|
||||
.Example
|
||||
Get-CommonParameters
|
||||
#>
|
||||
function Get-CommonParameters {
|
||||
function tmp {
|
||||
[CmdletBinding()]
|
||||
Param ()
|
||||
}
|
||||
|
||||
(Get-Command -Name tmp -CommandType Function).Parameters.Keys
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Helper function to format debug parameter output.
|
||||
.Example
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
#>
|
||||
function Out-DebugParameter {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
|
||||
[AllowEmptyCollection()]
|
||||
$InputObject
|
||||
)
|
||||
|
||||
Begin {
|
||||
$CommonParameters = Get-CommonParameters
|
||||
}
|
||||
|
||||
Process {
|
||||
$InputObject.GetEnumerator() | Where-Object {
|
||||
$CommonParameters -notcontains $_.Key
|
||||
} | Format-Table -AutoSize -Property (
|
||||
@{
|
||||
Name = 'Parameter'
|
||||
Expression = {$_.Key}
|
||||
},
|
||||
@{
|
||||
Name = 'Value'
|
||||
Expression = {$_.Value}
|
||||
}
|
||||
) | Out-String -Stream | ForEach-Object {
|
||||
if ($_.Trim()) {
|
||||
$_
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
PSTOPIC
|
||||
about_IO.Swagger
|
||||
|
||||
SHORT DESCRIPTION
|
||||
IO.Swagger - the PowerShell module for the Swagger Petstore
|
||||
|
||||
LONG DESCRIPTION
|
||||
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.
|
||||
|
||||
This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- SDK version:
|
||||
- Build date: 2017-06-20T16:12:54.727+08:00
|
||||
- Build package: io.swagger.codegen.languages.PowerShellClientCodegen
|
||||
|
||||
Frameworks supported:
|
||||
|
||||
* PowerShell 3.0+
|
||||
* .NET 4.0 or later
|
@ -0,0 +1,2 @@
|
||||
## TODO we need to update the template to test the model files
|
||||
|
@ -0,0 +1,2 @@
|
||||
## TODO we need to update the template to test the model files
|
||||
|
@ -0,0 +1,2 @@
|
||||
## TODO we need to update the template to test the model files
|
||||
|
69
samples/client/petstore/powershell_test/test/PetApiTest.ps1
Normal file
69
samples/client/petstore/powershell_test/test/PetApiTest.ps1
Normal file
@ -0,0 +1,69 @@
|
||||
# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
|
||||
# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function
|
||||
|
||||
Describe 'IO.Swagger PetApi' {
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiAddPet' {
|
||||
$ret = Invoke-PetApiGetPetById -body "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiDeletePet' {
|
||||
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -apiKey "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiFindPetsByStatus' {
|
||||
$ret = Invoke-PetApiGetPetById -status "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiFindPetsByTags' {
|
||||
$ret = Invoke-PetApiGetPetById -tags "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiGetPetById' {
|
||||
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiUpdatePet' {
|
||||
$ret = Invoke-PetApiGetPetById -body "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiUpdatePetWithForm' {
|
||||
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -name "TEST_VALUE" -status "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'PetApi' {
|
||||
It 'Invoke-PetApiUploadFile' {
|
||||
$ret = Invoke-PetApiGetPetById -petId "TEST_VALUE" -additionalMetadata "TEST_VALUE" -file "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
2
samples/client/petstore/powershell_test/test/PetTest.ps1
Normal file
2
samples/client/petstore/powershell_test/test/PetTest.ps1
Normal file
@ -0,0 +1,2 @@
|
||||
## TODO we need to update the template to test the model files
|
||||
|
@ -0,0 +1,37 @@
|
||||
# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
|
||||
# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function
|
||||
|
||||
Describe 'IO.Swagger StoreApi' {
|
||||
Context 'StoreApi' {
|
||||
It 'Invoke-StoreApiDeleteOrder' {
|
||||
$ret = Invoke-PetApiGetPetById -orderId "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'StoreApi' {
|
||||
It 'Invoke-StoreApiGetInventory' {
|
||||
$ret = Invoke-PetApiGetPetById
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'StoreApi' {
|
||||
It 'Invoke-StoreApiGetOrderById' {
|
||||
$ret = Invoke-PetApiGetPetById -orderId "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'StoreApi' {
|
||||
It 'Invoke-StoreApiPlaceOrder' {
|
||||
$ret = Invoke-PetApiGetPetById -body "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
2
samples/client/petstore/powershell_test/test/TagTest.ps1
Normal file
2
samples/client/petstore/powershell_test/test/TagTest.ps1
Normal file
@ -0,0 +1,2 @@
|
||||
## TODO we need to update the template to test the model files
|
||||
|
69
samples/client/petstore/powershell_test/test/UserApiTest.ps1
Normal file
69
samples/client/petstore/powershell_test/test/UserApiTest.ps1
Normal file
@ -0,0 +1,69 @@
|
||||
# This file is auto-generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
|
||||
# Please replace "TEST_VALUE" with a proper value and uncomment the code for testing the function
|
||||
|
||||
Describe 'IO.Swagger UserApi' {
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiCreateUser' {
|
||||
$ret = Invoke-PetApiGetPetById -body "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiCreateUsersWithArrayInput' {
|
||||
$ret = Invoke-PetApiGetPetById -body "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiCreateUsersWithListInput' {
|
||||
$ret = Invoke-PetApiGetPetById -body "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiDeleteUser' {
|
||||
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiGetUserByName' {
|
||||
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiLoginUser' {
|
||||
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE" -password "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiLogoutUser' {
|
||||
$ret = Invoke-PetApiGetPetById
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'UserApi' {
|
||||
It 'Invoke-UserApiUpdateUser' {
|
||||
$ret = Invoke-PetApiGetPetById -username "TEST_VALUE" -body "TEST_VALUE"
|
||||
#$ret | Should BeOfType IO.Swagger.Model.ModelNameHere
|
||||
#$ret.property | Should Be 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
## TODO we need to update the template to test the model files
|
||||
|
Loading…
x
Reference in New Issue
Block a user