コード例 #1
0
ファイル: Domains.cs プロジェクト: exira/dnsimple-csharp
        /// <summary>
        /// Lists the domains in the account.
        /// </summary>
        /// <param name="accountId">The account ID</param>
        /// <param name="options">Options passed to the list (sorting, filtering, pagination)</param>
        /// <returns>A <c>DomainResponse</c> containing a list of domains.</returns>
        /// <see cref="DomainListOptions"/>
        /// <see>https://developer.dnsimple.com/v2/domains/#listDomains</see>
        public PaginatedResponse <Domain> ListDomains(long accountId, ListOptionsWithFiltering options = null)
        {
            var builder = BuildRequestForPath(DomainsPath(accountId));

            AddListOptionsToRequest(options, ref builder);

            return(new PaginatedResponse <Domain>(Execute(builder.Request)));
        }
コード例 #2
0
        /// <summary>
        /// Lists the domains in the account.
        /// </summary>
        /// <param name="accountId">The account ID</param>
        /// <param name="options">Options passed to the list (sorting, filtering, pagination)</param>
        /// <returns>A <c>DomainResponse</c> containing a list of domains.</returns>
        /// <see cref="DomainListOptions"/>
        /// <see>https://developer.dnsimple.com/v2/domains/#listDomains</see>
        public DomainsResponse ListDomains(long accountId, ListOptionsWithFiltering options)
        {
            var requestBuilder =
                Client.Http.RequestBuilder(DomainsPath(accountId));

            requestBuilder.AddParameter(options.UnpackSorting());
            requestBuilder.AddParameters(options.UnpackFilters());

            if (!options.Pagination.IsDefault())
            {
                requestBuilder.AddParameters(options.UnpackPagination());
            }


            return(new DomainsResponse(
                       Client.Http.Execute(requestBuilder.Request)));
        }