Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PS][Experimental] use prepare instead of new #5773

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ private String constructExampleCode(CodegenModel codegenModel, HashMap<String, C
processedModelMap.put(model, 1);
}

example = "(New-" + codegenModel.name;
example = "(Prepare-" + codegenModel.name;
List<String> propertyExamples = new ArrayList<>();
for (CodegenProperty codegenProperty : codegenModel.vars) {
propertyExamples.add(" -" + codegenProperty.name + " " + constructExampleCode(codegenProperty, modelMaps, processedModelMap));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{{{classname}}}<PSCustomObject>
#>

function New-{{{apiNamePrefix}}}{{{classname}}} {
function Prepare-{{{apiNamePrefix}}}{{{classname}}} {
[CmdletBinding()]
Param (
{{#vars}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-{{{packageName}}}{{{classname}}} {{#vars}} -{{name}} {{example}}{{#hasMore}} `
Prepare-{{{packageName}}}{{{classname}}} {{#vars}} -{{name}} {{example}}{{#hasMore}} `
{{/hasMore}}
{{/vars}}

```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
${{className}} | Convert-ToJSON
```


[[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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstoreApiResponse -Code null `
Prepare-PSPetstoreApiResponse -Code null `
-Type null `
-Message null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstoreCategory -Id null `
Prepare-PSPetstoreCategory -Id null `
-Name null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstoreInlineObject -Name null `
Prepare-PSPetstoreInlineObject -Name null `
-Status null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstoreInlineObject1 -AdditionalMetadata null `
Prepare-PSPetstoreInlineObject1 -AdditionalMetadata null `
-File null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

7 changes: 3 additions & 4 deletions samples/client/petstore/powershell-experimental/docs/Order.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstoreOrder -Id null `
Prepare-PSPetstoreOrder -Id null `
-PetId null `
-Quantity null `
-ShipDate null `
-Status null `
-Complete null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";

$Pet = (New-Pet -Id 123 -Category (New-Category -Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((New-Tag -Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store
$Pet = (Prepare-Pet -Id 123 -Category (Prepare-Category -Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Prepare-Tag -Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store

# Add a new pet to the store
try {
Expand Down Expand Up @@ -275,7 +275,7 @@ $Configuration = Get-PSPetstoreConfiguration
# Configure OAuth2 access token for authorization: petstore_auth
$Configuration["AccessToken"] = "YOUR_ACCESS_TOKEN";

$Pet = (New-Pet -Id 123 -Category (New-Category -Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((New-Tag -Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store
$Pet = (Prepare-Pet -Id 123 -Category (Prepare-Category -Id 123 -Name "Name_example") -Name "Name_example" -PhotoUrls @("PhotoUrls_example") -Tags @((Prepare-Tag -Id 123 -Name "Name_example")) -Status "Status_example") # Pet | Pet object that needs to be added to the store

# Update an existing pet
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Place an order for a pet
```powershell
Import-Module -Name PSPetstore

$Order = (New-Order -Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "Status_example" -Complete $false) # Order | order placed for purchasing the pet
$Order = (Prepare-Order -Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "Status_example" -Complete $false) # Order | order placed for purchasing the pet

# Place an order for a pet
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"

$User = (New-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123) # User | Created user object
$User = (Prepare-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123) # User | Created user object

# Create user
try {
Expand Down Expand Up @@ -82,7 +82,7 @@ $Configuration["ApiKey"]["AUTH_KEY"] = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration["ApiKeyPrefix"]["AUTH_KEY"] = "Bearer"

$User = @((New-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123)) # User[] | List of user object
$User = @((Prepare-User -Id 123 -Username "Username_example" -FirstName "FirstName_example" -LastName "LastName_example" -Email "Email_example" -Password "Password_example" -Phone "Phone_example" -UserStatus 123)) # User[] | List of user object

# Creates list of users with given input array
try {
Expand Down
7 changes: 3 additions & 4 deletions samples/client/petstore/powershell-experimental/docs/Pet.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstorePet -Id null `
Prepare-PSPetstorePet -Id null `
-Category null `
-Name doggie `
-PhotoUrls null `
-Tags null `
-Status null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

7 changes: 3 additions & 4 deletions samples/client/petstore/powershell-experimental/docs/Tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstoreTag -Id null `
Prepare-PSPetstoreTag -Id null `
-Name null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

7 changes: 3 additions & 4 deletions samples/client/petstore/powershell-experimental/docs/User.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Name | Type | Description | Notes

## Examples

- Create a new object
- Prepare the resource
```powershell
New-PSPetstoreUser -Id null `
Prepare-PSPetstoreUser -Id null `
-Username null `
-FirstName null `
-LastName null `
Expand All @@ -26,11 +26,10 @@ New-PSPetstoreUser -Id null `
-UserStatus null
```

- Convert the object to JSON
- Convert the resource to JSON
```powershell
$ | Convert-ToJSON
```


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ No description available.
ApiResponse<PSCustomObject>
#>

function New-PSApiResponse {
function Prepare-PSApiResponse {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ No description available.
Category<PSCustomObject>
#>

function New-PSCategory {
function Prepare-PSCategory {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Updated status of the pet
InlineObject<PSCustomObject>
#>

function New-PSInlineObject {
function Prepare-PSInlineObject {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ file to upload
InlineObject1<PSCustomObject>
#>

function New-PSInlineObject1 {
function Prepare-PSInlineObject1 {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ No description available.
Order<PSCustomObject>
#>

function New-PSOrder {
function Prepare-PSOrder {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pet status in the store
Pet<PSCustomObject>
#>

function New-PSPet {
function Prepare-PSPet {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ No description available.
Tag<PSCustomObject>
#>

function New-PSTag {
function Prepare-PSTag {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ User Status
User<PSCustomObject>
#>

function New-PSUser {
function Prepare-PSUser {
[CmdletBinding()]
Param (
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: OpenAPI Generator Team
#
# Generated on: 3/31/20
# Generated on: 4/1/20
#

@{
Expand Down Expand Up @@ -75,11 +75,12 @@ FunctionsToExport = 'Add-PSPet', 'Remove-Pet', 'Find-PSPetsByStatus', 'Find-PSPe
'Get-PSOrderById', 'Invoke-PSPlaceOrder', 'New-PSUser',
'New-PSUsersWithArrayInput', 'New-PSUsersWithListInput',
'Remove-PSUser', 'Get-PSUserByName', 'Invoke-PSLoginUser',
'Invoke-PSLogoutUser', 'Update-PSUser', 'New-PSApiResponse',
'New-PSCategory', 'New-PSInlineObject', 'New-PSInlineObject1',
'New-PSOrder', 'New-PSPet', 'New-PSTag', 'New-PSUser',
'Get-PSConfiguration', 'Set-PSConfiguration',
'Set-PSConfigurationApiKey', 'Set-PSConfigurationApiKeyPrefix',
'Invoke-PSLogoutUser', 'Update-PSUser', 'Prepare-PSApiResponse',
'Prepare-PSCategory', 'Prepare-PSInlineObject',
'Prepare-PSInlineObject1', 'Prepare-PSOrder', 'Prepare-PSPet',
'Prepare-PSTag', 'Prepare-PSUser', 'Get-PSConfiguration',
'Set-PSConfiguration', 'Set-PSConfigurationApiKey',
'Set-PSConfigurationApiKeyPrefix',
'Set-PSConfigurationDefaultHeader', 'Get-PSHostSettings',
'Get-PSUrlFromHostSettings'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#

Describe -tag 'PSPetstore' -name 'PSStoreApi' {
Context 'Invoke-PSDeleteOrder' {
It 'Test Invoke-PSDeleteOrder' {
Context 'Remove-PSOrder' {
It 'Test Remove-PSOrder' {
#$TestResult = Invoke-PetApiGetPetById -OrderId "TEST_VALUE"
#$TestResult | Should BeOfType TODO
#$TestResult.property | Should Be 0
Expand Down
Loading