Пример #1
0
        /// <summary>
        /// Lists the contacts in the account according to the options sent.
        /// </summary>
        /// <param name="accountId">The account ID</param>
        /// <param name="options">Options passed to the list (sorting and
        /// pagination).</param>
        /// <returns>The list of contacts in the account.</returns>
        /// <see cref="ContactsListOptions"/>
        /// <see>https://developer.dnsimple.com/v2/contacts/#listContacts</see>
        public PaginatedResponse <Contact> ListContacts(long accountId,
                                                        ContactsListOptions options = null)
        {
            var builder = BuildRequestForPath(ContactsPath(accountId));

            AddListOptionsToRequest(options, ref builder);

            return(new PaginatedResponse <Contact>(Execute(builder.Request)));
        }
Пример #2
0
        public void ListContactsWitSorting(long accountId, string expectedUrl)
        {
            var client  = new MockDnsimpleClient(ListContactsFixture);
            var options = new ContactsListOptions
            {
                Pagination = new Pagination
                {
                    PerPage = 42,
                    Page    = 7
                }
            }.SortById(Order.asc).SortByLabel(Order.desc)
            .SortByEmail(Order.asc);

            client.Contacts.ListContacts(accountId, options);

            Assert.AreEqual(expectedUrl, client.RequestSentTo());
        }