1 | // Copyright (c) 2018, 2022, Oracle and/or its affiliates.
|
2 |
|
3 | //-----------------------------------------------------------------------------
|
4 | //
|
5 | // This software is dual-licensed to you under the Universal Permissive License
|
6 | // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
7 | // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
|
8 | // either license.
|
9 | //
|
10 | // If you elect to accept the software under the Apache License, Version 2.0,
|
11 | // the following applies:
|
12 | //
|
13 | // Licensed under the Apache License, Version 2.0 (the "License");
|
14 | // you may not use this file except in compliance with the License.
|
15 | // You may obtain a copy of the License at
|
16 | //
|
17 | // https://www.apache.org/licenses/LICENSE-2.0
|
18 | //
|
19 | // Unless required by applicable law or agreed to in writing, software
|
20 | // distributed under the License is distributed on an "AS IS" BASIS,
|
21 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22 | // See the License for the specific language governing permissions and
|
23 | // limitations under the License.
|
24 | //
|
25 | //-----------------------------------------------------------------------------
|
26 |
|
27 | ;
|
28 |
|
29 | class SodaDocument {
|
30 |
|
31 | //---------------------------------------------------------------------------
|
32 | // createdOn
|
33 | //
|
34 | // Property for the created date of the document.
|
35 | //---------------------------------------------------------------------------
|
36 | get createdOn() {
|
37 | return this._impl.getCreatedOn();
|
38 | }
|
39 |
|
40 | //---------------------------------------------------------------------------
|
41 | // getContent()
|
42 | //
|
43 | // Returns the document content as a Javascript object.
|
44 | //---------------------------------------------------------------------------
|
45 | getContent() {
|
46 | return JSON.parse(this._impl.getContentAsString());
|
47 | }
|
48 |
|
49 | //---------------------------------------------------------------------------
|
50 | // getContentAsBuffer()
|
51 | //
|
52 | // Returns the document content as a buffer.
|
53 | //---------------------------------------------------------------------------
|
54 | getContentAsBuffer() {
|
55 | return this._impl.getContentAsBuffer();
|
56 | }
|
57 |
|
58 | //---------------------------------------------------------------------------
|
59 | // getContentAsString()
|
60 | //
|
61 | // Returns the document content as a string.
|
62 | //---------------------------------------------------------------------------
|
63 | getContentAsString() {
|
64 | return this._impl.getContentAsString();
|
65 | }
|
66 |
|
67 | //---------------------------------------------------------------------------
|
68 | // key
|
69 | //
|
70 | // Property for the key of the document.
|
71 | //---------------------------------------------------------------------------
|
72 | get key() {
|
73 | return this._impl.getKey();
|
74 | }
|
75 |
|
76 | //---------------------------------------------------------------------------
|
77 | // lastModified
|
78 | //
|
79 | // Property for the last modified date of the document.
|
80 | //---------------------------------------------------------------------------
|
81 | get lastModified() {
|
82 | return this._impl.getLastModified();
|
83 | }
|
84 |
|
85 | //---------------------------------------------------------------------------
|
86 | // mediaType
|
87 | //
|
88 | // Property for the media type of the document.
|
89 | //---------------------------------------------------------------------------
|
90 | get mediaType() {
|
91 | return this._impl.getMediaType();
|
92 | }
|
93 |
|
94 | //---------------------------------------------------------------------------
|
95 | // verison
|
96 | //
|
97 | // Property for the version of the document.
|
98 | //---------------------------------------------------------------------------
|
99 | get version() {
|
100 | return this._impl.getVersion();
|
101 | }
|
102 |
|
103 | }
|
104 |
|
105 | SodaDocument.prototype._sodaDocumentMarker = true;
|
106 |
|
107 | module.exports = SodaDocument;
|