66
77namespace CouchDB . Driver . Types
88{
9+ /// <summary>
10+ /// Represents an attachment for a document.
11+ /// </summary>
912 public sealed class CouchAttachment
1013 {
1114 [ JsonIgnore ]
@@ -26,25 +29,78 @@ public sealed class CouchAttachment
2629 [ JsonIgnore ]
2730 public Uri Uri { get ; internal set ; }
2831
32+ /// <summary>
33+ /// Gets whether the attachment object contains stub info and no content.
34+ /// </summary>
2935 [ DataMember ]
3036 [ JsonProperty ( "stub" ) ]
3137 public bool Stub { get ; set ; }
3238
39+ /// <summary>
40+ /// Gets the attachment MIME type.
41+ /// </summary>
3342 [ DataMember ]
3443 [ JsonProperty ( "content_type" ) ]
3544 public string ContentType { get ; set ; }
3645
46+ /// <summary>
47+ /// Gets the content hash digest. It starts with prefix which announce hash type (md5-) and continues with
48+ /// Base64-encoded hash digest.
49+ /// </summary>
3750 [ DataMember ]
3851 [ JsonProperty ( "digest" ) ]
3952 public string Digest { get ; private set ; }
4053
54+ /// <summary>
55+ /// Gets the real attachment size in bytes. Not available if attachment content requested.
56+ /// </summary>
4157 [ DataMember ]
4258 [ JsonProperty ( "length" ) ]
43- public int ? Length { get ; private set ; }
59+ public long ? Length { get ; private set ; }
4460
61+ /// <summary>
62+ /// Gets the revision number when attachment was added.
63+ /// </summary>
4564 [ DataMember ]
4665 [ JsonProperty ( "revpos" ) ]
4766 public int ? RevPos { get ; private set ; }
67+
68+ /// <summary>
69+ /// Gets the compressed attachment size in bytes.
70+ /// </summary>
71+ /// <remarks>
72+ /// Available if content_type is in list of compressible types when the attachment was added and the following query
73+ /// parameters are specified:
74+ /// <list type="bullet">
75+ /// <item>
76+ /// <description>att_encoding_info=true when querying a document</description>
77+ /// </item>
78+ /// <item>
79+ /// <description>att_encoding_info=true&include_docs=true when querying a changes feed or a view</description>
80+ /// </item>
81+ /// </list>
82+ /// </remarks>
83+ [ DataMember ]
84+ [ JsonProperty ( "encoded_length" ) ]
85+ public long ? EncodedLength { get ; private set ; }
86+
87+ /// <summary>
88+ /// Gets the Base64-encoded content. Only populated if queried for and <see cref="Stub"/> is false.
89+ /// </summary>
90+ /// <remarks>
91+ /// Base64-encoded content. Available if attachment content is requested by using the following query parameters:
92+ /// <list type="bullet">
93+ /// <item>
94+ /// <description>attachments=true when querying a document</description>
95+ /// </item>
96+ /// <item>
97+ /// <description>attachments=true&include_docs=true when querying a changes feed or a view</description>
98+ /// </item>
99+ /// </list>
100+ /// </remarks>
101+ [ DataMember ]
102+ [ JsonProperty ( "data" ) ]
103+ public string Data { get ; private set ; }
48104 }
49105}
50106#nullable restore
0 commit comments