Add optional operationId to Get Subscription Transitions. (#124)

* add optional operation id

* add example

* spacing

* updates

* add to project

* Update GetSubscriptionTransitions.cs

* Update GetSubscriptionTransitionsByOperationId.cs
This commit is contained in:
jonahlytleMSFT 2023-03-27 11:11:44 -07:00 коммит произвёл GitHub
Родитель 8f5dc73721
Коммит d9d0d46cfe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 45 добавлений и 0 удалений

Просмотреть файл

@ -378,6 +378,7 @@ namespace Microsoft.Store.PartnerCenter.Samples
new ActivateSandboxThirdPartySubscription(context),
new TransitionSubscription(context),
new GetSubscriptionTransitions(context),
new GetSubscriptionTransitionsByOperationId(context),
new UpdateOverage(context),
new GetAzureEntitlement(context),
new CancelAzureEntitlement(context),

Просмотреть файл

@ -286,6 +286,7 @@
<Compile Include="RatedUsage\GetSubscriptionUsageRecords.cs" />
<Compile Include="RatedUsage\GetSubscriptionUsageSummary.cs" />
<Compile Include="Subscriptions\GetSubscriptionSupportContact.cs" />
<Compile Include="Subscriptions\GetSubscriptionTransitionsByOperationId.cs" />
<Compile Include="Subscriptions\ToggleSubscriptionAutoRenew.cs" />
<Compile Include="Subscriptions\UpdateOverage.cs" />
<Compile Include="Subscriptions\UpdateSubscriptionSupportContact.cs" />

Просмотреть файл

@ -0,0 +1,43 @@
// -----------------------------------------------------------------------
// <copyright file="GetSubscriptionTransitionsByOperationId.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
namespace Microsoft.Store.PartnerCenter.Samples.Subscriptions
{
/// <summary>
/// A scenario that retrieves a customer subscription transitions by operation ID.
/// </summary>
public class GetSubscriptionTransitionsByOperationId : BasePartnerScenario
{
/// <summary>
/// Initializes a new instance of the <see cref="GetSubscriptionTransitionsByOperationId"/> class.
/// </summary>
/// <param name="context">The scenario context.</param>
public GetSubscriptionTransitionsByOperationId(IScenarioContext context) : base("Get customer subscription transitions by operation ID", context)
{
}
/// <summary>
/// Executes the scenario.
/// </summary>
protected override void RunScenario()
{
var partnerOperations = this.Context.UserPartnerOperations;
string customerId = this.ObtainCustomerId("Enter the ID of the customer whom to retrieve their subscriptions");
string subscriptionId = this.ObtainSubscriptionId(customerId, "Enter the ID of the subscription to find transitions for");
string operationId = this.Context.ConsoleHelper.ReadNonEmptyString("Enter the operation ID of the transition");
var subscriptionOperations = partnerOperations.Customers.ById(customerId).Subscriptions.ById(subscriptionId);
this.Context.ConsoleHelper.StartProgress("Retrieving customer subscription transitions by operation ID");
var transitions = subscriptionOperations.Transitions.Get(operationId);
this.Context.ConsoleHelper.StopProgress();
this.Context.ConsoleHelper.WriteObject(transitions, "Customer subscription transitions by operation ID");
}
}
}