1 /*global $k*/
  2 
  3 /**
  4  * @class Abstract superclass of entities that are sent or received over the internet
  5 **/
  6 $k.NetEntity = function() { };
  7 
  8 /**
  9  * Attach a entity
 10  *
 11  * @function
 12  * @param {$k.NetEntity} attachment
 13  * @throws {$k.exception.TypeError} If the entity is not a valid attachment
 14 **/
 15 $k.NetEntity.prototype.attach = function(attachment) { };
 16 
 17 /**
 18  * Returns the attached entities
 19  *
 20  * @function
 21  * @returns {$k.NetEntity[]}
 22 **/
 23 $k.NetEntity.prototype.attachments = function() { };
 24 
 25 /**
 26  * Get the binay contents as base64-encoded string. Returns undefined if the contents is not binary
 27  *
 28  * @function
 29  * @returns {string}
 30 **/
 31 $k.NetEntity.prototype.base64String = function() { };
 32 
 33 /**
 34  * Returns the charset
 35  *
 36  * @function
 37  * @returns {string}
 38 **/
 39 $k.NetEntity.prototype.charset = function() { };
 40 
 41 /**
 42  * Returns the content disposition
 43  *
 44  * @function
 45  * @returns {string}
 46 **/
 47 $k.NetEntity.prototype.contentDisposition = function() { };
 48 
 49 /**
 50  * Returns the content length
 51  *
 52  * @function
 53  * @returns {number}
 54 **/
 55 $k.NetEntity.prototype.contentLength = function() { };
 56 
 57 /**
 58  * Returns the content type (only the media type part)
 59  *
 60  * @function
 61  * @returns {string}
 62 **/
 63 $k.NetEntity.prototype.contentType = function() { };
 64 
 65 /**
 66  * Returns the entity bytes as a data URL, or undefined if the entity is not binary
 67  *
 68  * @function
 69  * @returns {string}
 70  * @see http://dataurl.net/#about
 71 **/
 72 $k.NetEntity.prototype.dataUrl = function() { };
 73 
 74 /**
 75  * Prints the entity, except binary contents, for debugging purposes
 76  *
 77  * @function
 78  * @returns {string}
 79 **/
 80 $k.NetEntity.prototype.debugString = function() { };
 81 
 82 /**
 83  * Returns the filename part of the content disposition field
 84  *
 85  * @function
 86  * @returns {string}
 87 **/
 88 $k.NetEntity.prototype.filename = function() { };
 89 
 90 /**
 91  * Get all form fields (multipart/form-data or application/x-www-form-urlencoded).
 92  * The property names correspond to the field names.
 93  * The property values are either strings (if the form is of type application/x-www-form-urlencoded) or NetEntities (multipart/form-data)
 94  *
 95  * @function
 96  * @returns {object}
 97  * @see $k.NetEntity
 98 **/
 99 $k.NetEntity.prototype.formData = function() { };
100 
101 /**
102  * Get the unparsed value of the field of the request header. Returns undefined if the field does not exist
103  *
104  * @function
105  * @param {string} fieldName
106  * @returns {String} The field value
107 **/
108 $k.NetEntity.prototype.headerField = function(fieldName) { };
109 
110 /**
111  * Get all fields of the request header
112  *
113  * @function
114  * @returns {object}
115 **/
116 $k.NetEntity.prototype.headerFields = function() { };
117 
118 /**
119  * True if the entity has binary contents
120  *
121  * @function
122  * @returns {boolean}
123 **/
124 $k.NetEntity.prototype.isBinary = function() { };
125 
126 /**
127  * Set the charset
128  *
129  * @function
130  * @param {string} charset
131  * @throws {$k.exception.InvalidValue} If the charset is unknown
132 **/
133 $k.NetEntity.prototype.setCharset = function(charset) { };
134 
135 /**
136  * Set the content disposition
137  *
138  * @function
139  * @param {string} contentDisposition
140 **/
141 $k.NetEntity.prototype.setContentDisposition = function(contentDisposition) { };
142 
143 /**
144  * Set the content length
145  *
146  * @function
147  * @param {number} length
148 **/
149 $k.NetEntity.prototype.setContentLength = function(length) { };
150 
151 /**
152  * Set the contents of the entity. Also sets the content type and filename if known.
153  * The contents object can be a string, document ($k.TextDocument), a blob value ($k.Blob) or another NetEntity
154  *
155  * @function
156  * @param contents Contents object
157  * @see $k.Blob
158  * @see $k.TextDocument
159 **/
160 $k.NetEntity.prototype.setContents = function(contents) { };
161 
162 /**
163  * Set the content type
164  *
165  * @function
166  * @param {string} mediaType Media type of the contents
167  * @param {string} [charset] Charset of the contents
168 **/
169 $k.NetEntity.prototype.setContentType = function(mediaType, charset) { };
170 
171 /**
172  * Set the filename part of the content disposition field
173  *
174  * @function
175  * @param {string} filename
176 **/
177 $k.NetEntity.prototype.setFilename = function(filename) { };
178 
179 /**
180  * Set the value of the field of the request header
181  *
182  * @function
183  * @param {string} fieldName
184  * @param fieldValue
185  * @throws {$k.exception.TypeError} If the value does not match the type of the field
186 **/
187 $k.NetEntity.prototype.setHeaderField = function(fieldName, fieldValue) { };
188 
189 /**
190  * Set the text as the body
191  *
192  * @function
193  * @param {string} text
194 **/
195 $k.NetEntity.prototype.setText = function(text) { };
196 
197 /**
198  * Get the contents as string
199  *
200  * @function
201  * @param {string} charset Charset of the characters. Required for binary entities. Optional for text entities.
202  * @returns {string}
203 **/
204 $k.NetEntity.prototype.text = function(charset) { };
205 
206