private void GetAgreementsOfCustomer()

in sdk/SdkSamples/Agreements/GetCustomerAgreements.cs [39:57]


        private void GetAgreementsOfCustomer(string selectedCustomerId, string agreementType)
        {
            var partnerOperations = this.Context.UserPartnerOperations;

            this.Context.ConsoleHelper.StartProgress(string.Equals(agreementType, "*") ? "Retrieving all agreements of the customer": $"Retrieving agreements of customer of type '{agreementType}'");

            var customerAgreements = partnerOperations.Customers.ById(selectedCustomerId).Agreements.ByAgreementType(agreementType).Get();

            this.Context.ConsoleHelper.StopProgress();

            if (!customerAgreements.Items.Any())
            {
                Console.WriteLine(string.Equals(agreementType, "*") ? "No agreements found for the given customer." : $"No agreements of type '{agreementType}' found for the given customer.");
            }
            else
            {
                this.Context.ConsoleHelper.WriteObject(customerAgreements, string.Equals(agreementType, "*") ? "Customer agreements:" : $"Customer agreements of type '{agreementType}':");
            }
        }