/// <summary>
        /// Creates a email forward for the domain
        /// </summary>
        /// <param name="accountId">The account id</param>
        /// <param name="domainIdentifier">The domain name or id</param>
        /// <param name="record">The email forward to be added</param>
        /// <returns>The newly created email forward for the domain</returns>
        /// <see>https://developer.dnsimple.com/v2/domains/email-forwards/#createEmailForward</see>
        public EmailForwardResponse CreateEmailForward(long accountId,
                                                       string domainIdentifier, EmailForward record)
        {
            var request =
                Client.Http.RequestBuilder(
                    EmailForwardsPath(accountId, domainIdentifier));

            request.Method(Method.POST);
            request.AddJsonPayload(record);

            return(new EmailForwardResponse(
                       Client.Http.Execute(request.Request)));
        }
예제 #2
0
        /// <summary>
        /// Creates a new email forward for the domain.
        /// </summary>
        /// <param name="accountId">The account ID</param>
        /// <param name="domainIdentifier">The domain name or ID</param>
        /// <param name="record">The email forward to be added</param>
        /// <returns>The newly created email forward for the domain</returns>
        /// <see>https://developer.dnsimple.com/v2/domains/email-forwards/#createEmailForward</see>
        public SimpleResponse <EmailForward> CreateEmailForward(long accountId, string domainIdentifier, EmailForward record)
        {
            var builder = BuildRequestForPath(EmailForwardsPath(accountId, domainIdentifier));

            builder.Method(Method.POST);
            builder.AddJsonPayload(record);

            if (record.To.Trim().Equals("") || record.From.Trim().Equals(""))
            {
                throw new ArgumentException("From or To cannot be blank");
            }

            return(new SimpleResponse <EmailForward>(Execute(builder.Request)));
        }