Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Doc" /> class.
 /// </summary>
 /// <param name="name">A name for identifying your document. (required).</param>
 /// <param name="documentType">The type of document being created. (required).</param>
 /// <param name="documentContent">The HTML data to be transformed into a document. You must supply content using document_content or document_url.  (required).</param>
 /// <param name="documentUrl">The URL to fetch the HTML data to be transformed into a document. You must supply content using document_content or document_url. .</param>
 /// <param name="test">Enable test mode for this document. Test documents are not charged for but include a watermark. (default to true).</param>
 /// <param name="pipeline">Specify a specific version of the DocRaptor Pipeline to use.</param>
 /// <param name="strict">Force strict HTML validation..</param>
 /// <param name="ignoreResourceErrors">Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop. (default to true).</param>
 /// <param name="ignoreConsoleMessages">Prevent console.log from stopping document rendering during JavaScript execution. (default to false).</param>
 /// <param name="tag">A field for storing a small amount of metadata with this document.</param>
 /// <param name="help">Request support help with this request if it succeeds. (default to false).</param>
 /// <param name="javascript">Enable DocRaptor JavaScript parsing. PrinceXML JavaScript parsing is also available elsewhere. (default to false).</param>
 /// <param name="referrer">Set HTTP referrer when generating this document..</param>
 /// <param name="callbackUrl">A URL that will receive a POST request after successfully completing an asynchronous document. The POST data will include download_url and download_id similar to status API responses. WARNING: this only works on asynchronous documents. .</param>
 /// <param name="hostedDownloadLimit">The number of times a hosted document can be downloaded.  If no limit is specified, the document will be available for an unlimited number of downloads..</param>
 /// <param name="hostedExpiresAt">The date and time at which a hosted document will be removed and no longer available. Must be a properly formatted ISO 8601 datetime, like 1981-01-23T08:02:30-05:00..</param>
 /// <param name="princeOptions">princeOptions.</param>
 public Doc(string name, DocumentTypeEnum documentType, string documentContent, string documentUrl = default(string), bool?test = true, string pipeline = default(string), StrictEnum?strict = default(StrictEnum?), bool?ignoreResourceErrors = true, bool?ignoreConsoleMessages = false, string tag = default(string), bool?help = false, bool?javascript = false, string referrer = default(string), string callbackUrl = default(string), int?hostedDownloadLimit = default(int?), string hostedExpiresAt = default(string), PrinceOptions princeOptions = default(PrinceOptions))
 {
     Name                  = name ?? throw new ArgumentNullException(nameof(name), "name is a required property for Doc and cannot be null");
     DocumentType          = documentType;
     DocumentContent       = documentContent ?? throw new ArgumentNullException(nameof(DocumentContent), "documentContent is a required property for Doc and cannot be null");
     DocumentUrl           = documentUrl;
     Test                  = test ?? true;
     Pipeline              = pipeline;
     Strict                = strict;
     IgnoreResourceErrors  = ignoreResourceErrors ?? true;
     IgnoreConsoleMessages = ignoreConsoleMessages ?? false;
     Tag                 = tag;
     Help                = help ?? false;
     Javascript          = javascript ?? false;
     Referrer            = referrer;
     CallbackUrl         = callbackUrl;
     HostedDownloadLimit = hostedDownloadLimit;
     HostedExpiresAt     = hostedExpiresAt;
     PrinceOptions       = princeOptions;
 }
Example #2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // ReSharper disable NonReadonlyMemberInGetHashCode
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         hashCode = hashCode * 59 + DocumentType.GetHashCode();
         if (DocumentContent != null)
         {
             hashCode = hashCode * 59 + DocumentContent.GetHashCode();
         }
         if (DocumentUrl != null)
         {
             hashCode = hashCode * 59 + DocumentUrl.GetHashCode();
         }
         if (Test != null)
         {
             hashCode = hashCode * 59 + Test.GetHashCode();
         }
         if (Pipeline != null)
         {
             hashCode = hashCode * 59 + Pipeline.GetHashCode();
         }
         if (Strict != null)
         {
             hashCode = hashCode * 59 + Strict.GetHashCode();
         }
         if (IgnoreResourceErrors != null)
         {
             hashCode = hashCode * 59 + IgnoreResourceErrors.GetHashCode();
         }
         if (IgnoreConsoleMessages != null)
         {
             hashCode = hashCode * 59 + IgnoreConsoleMessages.GetHashCode();
         }
         if (Tag != null)
         {
             hashCode = hashCode * 59 + Tag.GetHashCode();
         }
         if (Help != null)
         {
             hashCode = hashCode * 59 + Help.GetHashCode();
         }
         if (Javascript != null)
         {
             hashCode = hashCode * 59 + Javascript.GetHashCode();
         }
         if (Referrer != null)
         {
             hashCode = hashCode * 59 + Referrer.GetHashCode();
         }
         if (CallbackUrl != null)
         {
             hashCode = hashCode * 59 + CallbackUrl.GetHashCode();
         }
         if (HostedDownloadLimit != null)
         {
             hashCode = hashCode * 59 + HostedDownloadLimit.GetHashCode();
         }
         if (HostedExpiresAt != null)
         {
             hashCode = hashCode * 59 + HostedExpiresAt.GetHashCode();
         }
         if (PrinceOptions != null)
         {
             hashCode = hashCode * 59 + PrinceOptions.GetHashCode();
         }
         // ReSharper restore NonReadonlyMemberInGetHashCode
         return(hashCode);
     }
 }
Example #3
0
        /// <summary>
        /// Returns true if Doc instances are equal
        /// </summary>
        /// <param name="input">Instance of Doc to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Doc input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                     ) &&
                 (
                     DocumentType == input.DocumentType ||
                     (DocumentType.Equals(input.DocumentType))
                 ) &&
                 (
                     DocumentContent == input.DocumentContent ||
                     (DocumentContent != null &&
                      DocumentContent.Equals(input.DocumentContent))
                 ) &&
                 (
                     DocumentUrl == input.DocumentUrl ||
                     (DocumentUrl != null &&
                      DocumentUrl.Equals(input.DocumentUrl))
                 ) &&
                 (
                     Test == input.Test ||
                     (Test != null &&
                      Test.Equals(input.Test))
                 ) &&
                 (
                     Pipeline == input.Pipeline ||
                     (Pipeline != null &&
                      Pipeline.Equals(input.Pipeline))
                 ) &&
                 (
                     Strict == input.Strict ||
                     (Strict != null &&
                      Strict.Equals(input.Strict))
                 ) &&
                 (
                     IgnoreResourceErrors == input.IgnoreResourceErrors ||
                     (IgnoreResourceErrors != null &&
                      IgnoreResourceErrors.Equals(input.IgnoreResourceErrors))
                 ) &&
                 (
                     IgnoreConsoleMessages == input.IgnoreConsoleMessages ||
                     (IgnoreConsoleMessages != null &&
                      IgnoreConsoleMessages.Equals(input.IgnoreConsoleMessages))
                 ) &&
                 (
                     Tag == input.Tag ||
                     (Tag != null &&
                      Tag.Equals(input.Tag))
                 ) &&
                 (
                     Help == input.Help ||
                     (Help != null &&
                      Help.Equals(input.Help))
                 ) &&
                 (
                     Javascript == input.Javascript ||
                     (Javascript != null &&
                      Javascript.Equals(input.Javascript))
                 ) &&
                 (
                     Referrer == input.Referrer ||
                     (Referrer != null &&
                      Referrer.Equals(input.Referrer))
                 ) &&
                 (
                     CallbackUrl == input.CallbackUrl ||
                     (CallbackUrl != null &&
                      CallbackUrl.Equals(input.CallbackUrl))
                 ) &&
                 (
                     HostedDownloadLimit == input.HostedDownloadLimit ||
                     (HostedDownloadLimit != null &&
                      HostedDownloadLimit.Equals(input.HostedDownloadLimit))
                 ) &&
                 (
                     HostedExpiresAt == input.HostedExpiresAt ||
                     (HostedExpiresAt != null &&
                      HostedExpiresAt.Equals(input.HostedExpiresAt))
                 ) &&
                 (
                     ReferenceEquals(PrinceOptions, input.PrinceOptions) ||
                     (PrinceOptions != null &&
                      PrinceOptions.Equals(input.PrinceOptions))
                 ));
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Doc" /> class.
        /// Initializes a new instance of the <see cref="Doc" />class.
        /// </summary>
        /// <param name="Pipeline">Specify a specific verison of the DocRaptor Pipeline to use..</param>
        /// <param name="Name">A name for identifying your document. (required).</param>
        /// <param name="DocumentType">The type of document being created. (required).</param>
        /// <param name="DocumentContent">The HTML data to be transformed into a document. You must supply content using document_content or document_url. (required).</param>
        /// <param name="DocumentUrl">The URL to fetch the HTML data to be transformed into a document. You must supply content using document_content or document_url..</param>
        /// <param name="Test">Enable test mode for this document. Test documents are not charged for but include a watermark. (default to true).</param>
        /// <param name="Strict">Force strict HTML validation. (default to StrictEnum.None).</param>
        /// <param name="IgnoreResourceErrors">Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop. (default to true).</param>
        /// <param name="Tag">A field for storing a small amount of metadata with this document..</param>
        /// <param name="Help">Request support help with this request if it succeeds. (default to false).</param>
        /// <param name="Javascript">Enable DocRaptor JavaScript parsing. PrinceXML JavaScript parsing is also available elsewhere. (default to false).</param>
        /// <param name="Referrer">Set HTTP referrer when generating this document..</param>
        /// <param name="CallbackUrl">A URL that will receive a POST request after successfully completing an asynchronous document. The POST data will include download_url and download_id similar to status api responses. WARNING: this only works on asynchronous documents..</param>
        /// <param name="PrinceOptions">PrinceOptions.</param>

        public Doc(string Pipeline = null, string Name = null, DocumentTypeEnum?DocumentType = null, string DocumentContent = null, string DocumentUrl = null, bool?Test = null, StrictEnum?Strict = null, bool?IgnoreResourceErrors = null, string Tag = null, bool?Help = null, bool?Javascript = null, string Referrer = null, string CallbackUrl = null, PrinceOptions PrinceOptions = null)
        {
            // to ensure "Name" is required (not null)
            if (Name == null)
            {
                throw new InvalidDataException("Name is a required property for Doc and cannot be null");
            }
            else
            {
                this.Name = Name;
            }
            // to ensure "DocumentType" is required (not null)
            if (DocumentType == null)
            {
                throw new InvalidDataException("DocumentType is a required property for Doc and cannot be null");
            }
            else
            {
                this.DocumentType = DocumentType;
            }
            // to ensure "DocumentContent" is required (not null)
            if (DocumentContent == null)
            {
                throw new InvalidDataException("DocumentContent is a required property for Doc and cannot be null");
            }
            else
            {
                this.DocumentContent = DocumentContent;
            }
            this.Pipeline    = Pipeline;
            this.DocumentUrl = DocumentUrl;
            // use default value if no "Test" provided
            if (Test == null)
            {
                this.Test = true;
            }
            else
            {
                this.Test = Test;
            }
            // use default value if no "Strict" provided
            if (Strict == null)
            {
                this.Strict = StrictEnum.None;
            }
            else
            {
                this.Strict = Strict;
            }
            // use default value if no "IgnoreResourceErrors" provided
            if (IgnoreResourceErrors == null)
            {
                this.IgnoreResourceErrors = true;
            }
            else
            {
                this.IgnoreResourceErrors = IgnoreResourceErrors;
            }
            this.Tag = Tag;
            // use default value if no "Help" provided
            if (Help == null)
            {
                this.Help = false;
            }
            else
            {
                this.Help = Help;
            }
            // use default value if no "Javascript" provided
            if (Javascript == null)
            {
                this.Javascript = false;
            }
            else
            {
                this.Javascript = Javascript;
            }
            this.Referrer      = Referrer;
            this.CallbackUrl   = CallbackUrl;
            this.PrinceOptions = PrinceOptions;
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Doc" /> class.
 /// </summary>
 /// <param name="name">A name for identifying your document. (required).</param>
 /// <param name="documentType">The type of document being created. (required).</param>
 /// <param name="documentContent">The HTML data to be transformed into a document. You must supply content using document_content or document_url.  (required).</param>
 /// <param name="documentUrl">The URL to fetch the HTML data to be transformed into a document. You must supply content using document_content or document_url. .</param>
 /// <param name="test">Enable test mode for this document. Test documents are not charged for but include a watermark. (default to true).</param>
 /// <param name="pipeline">Specify a specific verison of the DocRaptor Pipeline to use..</param>
 /// <param name="strict">Force strict HTML validation..</param>
 /// <param name="ignoreResourceErrors">Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop. (default to true).</param>
 /// <param name="ignoreConsoleMessages">Prevent console.log from stopping document rendering during JavaScript execution. (default to false).</param>
 /// <param name="tag">A field for storing a small amount of metadata with this document..</param>
 /// <param name="help">Request support help with this request if it succeeds. (default to false).</param>
 /// <param name="javascript">Enable DocRaptor JavaScript parsing. PrinceXML JavaScript parsing is also available elsewhere. (default to false).</param>
 /// <param name="referrer">Set HTTP referrer when generating this document..</param>
 /// <param name="callbackUrl">A URL that will receive a POST request after successfully completing an asynchronous document. The POST data will include download_url and download_id similar to status API responses. WARNING: this only works on asynchronous documents. .</param>
 /// <param name="hostedDownloadLimit">The number of times a hosted document can be downloaded.  If no limit is specified, the document will be available for an unlimited number of downloads..</param>
 /// <param name="hostedExpiresAt">The date and time at which a hosted document will be removed and no longer available. Must be a properly formatted ISO 8601 datetime, like 1981-01-23T08:02:30-05:00..</param>
 /// <param name="princeOptions">princeOptions.</param>
 public Doc(string name = default(string), DocumentTypeEnum documentType = default(DocumentTypeEnum), string documentContent = default(string), string documentUrl = default(string), bool?test = true, string pipeline = default(string), StrictEnum?strict = default(StrictEnum?), bool?ignoreResourceErrors = true, bool?ignoreConsoleMessages = false, string tag = default(string), bool?help = false, bool?javascript = false, string referrer = default(string), string callbackUrl = default(string), int?hostedDownloadLimit = default(int?), string hostedExpiresAt = default(string), PrinceOptions princeOptions = default(PrinceOptions))
 {
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for Doc and cannot be null");
     }
     else
     {
         this.Name = name;
     }
     // to ensure "documentType" is required (not null)
     if (documentType == null)
     {
         throw new InvalidDataException("documentType is a required property for Doc and cannot be null");
     }
     else
     {
         this.DocumentType = documentType;
     }
     // to ensure "documentContent" is required (not null)
     if (documentContent == null)
     {
         throw new InvalidDataException("documentContent is a required property for Doc and cannot be null");
     }
     else
     {
         this.DocumentContent = documentContent;
     }
     this.DocumentUrl = documentUrl;
     // use default value if no "test" provided
     if (test == null)
     {
         this.Test = true;
     }
     else
     {
         this.Test = test;
     }
     this.Pipeline = pipeline;
     this.Strict   = strict;
     // use default value if no "ignoreResourceErrors" provided
     if (ignoreResourceErrors == null)
     {
         this.IgnoreResourceErrors = true;
     }
     else
     {
         this.IgnoreResourceErrors = ignoreResourceErrors;
     }
     // use default value if no "ignoreConsoleMessages" provided
     if (ignoreConsoleMessages == null)
     {
         this.IgnoreConsoleMessages = false;
     }
     else
     {
         this.IgnoreConsoleMessages = ignoreConsoleMessages;
     }
     this.Tag = tag;
     // use default value if no "help" provided
     if (help == null)
     {
         this.Help = false;
     }
     else
     {
         this.Help = help;
     }
     // use default value if no "javascript" provided
     if (javascript == null)
     {
         this.Javascript = false;
     }
     else
     {
         this.Javascript = javascript;
     }
     this.Referrer            = referrer;
     this.CallbackUrl         = callbackUrl;
     this.HostedDownloadLimit = hostedDownloadLimit;
     this.HostedExpiresAt     = hostedExpiresAt;
     this.PrinceOptions       = princeOptions;
 }