File tree 4 files changed +50
-8
lines changed
packages/firestore/src/lite-api 4 files changed +50
-8
lines changed Original file line number Diff line number Diff line change @@ -101,15 +101,25 @@ export class Bytes {
101
101
bytes : property ( 'string' )
102
102
} ;
103
103
104
- /** Returns a JSON-serializable representation of this `Bytes` instance. */
104
+ /**
105
+ * Returns a JSON-serializable representation of this `Bytes` instance.
106
+ *
107
+ * @returns a JSON representation of this object.
108
+ */
105
109
toJSON ( ) : object {
106
110
return {
107
111
type : Bytes . _jsonSchemaVersion ,
108
112
bytes : this . toBase64 ( )
109
113
} ;
110
114
}
111
115
112
- /** Builds a `Bytes` instance from a JSON serialized version of `Bytes`. */
116
+ /**
117
+ * Builds a `Byes` instance from a JSON object created by {@link Bytes.toJSON}.
118
+ *
119
+ * @param json a JSON object represention of a `Bytes` instance
120
+ * @returns an instance of {@link Bytes} if the JSON object could be parsed. Throws a
121
+ * {@link FirestoreError} if an error occurs.
122
+ */
113
123
static fromJSON ( json : object ) : Bytes {
114
124
if ( validateJSON ( json , Bytes . _jsonSchema ) ) {
115
125
return Bytes . fromBase64String ( json . bytes ) ;
Original file line number Diff line number Diff line change @@ -100,7 +100,11 @@ export class GeoPoint {
100
100
longitude : property ( 'number' )
101
101
} ;
102
102
103
- /** Returns a JSON-serializable representation of this GeoPoint. */
103
+ /**
104
+ * Returns a JSON-serializable representation of this `GeoPoint` instance.
105
+ *
106
+ * @returns a JSON representation of this object.
107
+ */
104
108
toJSON ( ) : { latitude : number ; longitude : number ; type : string } {
105
109
return {
106
110
latitude : this . _lat ,
@@ -109,7 +113,13 @@ export class GeoPoint {
109
113
} ;
110
114
}
111
115
112
- /** Builds a `Timestamp` instance from a JSON serialized version of `Bytes`. */
116
+ /**
117
+ * Builds a `GeoPoint` instance from a JSON object created by {@link GeoPoint.toJSON}.
118
+ *
119
+ * @param json a JSON object represention of a `GeoPoint` instance
120
+ * @returns an instance of {@link GeoPoint} if the JSON object could be parsed. Throws a
121
+ * {@link FirestoreError} if an error occurs.
122
+ */
113
123
static fromJSON ( json : object ) : GeoPoint {
114
124
if ( validateJSON ( json , GeoPoint . _jsonSchema ) ) {
115
125
return new GeoPoint ( json . latitude , json . longitude ) ;
Original file line number Diff line number Diff line change @@ -288,15 +288,26 @@ export class DocumentReference<
288
288
referencePath : property ( 'string' )
289
289
} ;
290
290
291
- /** Returns a JSON-serializable representation of this DocumentReference. */
291
+ /**
292
+ * Returns a JSON-serializable representation of this `DocumentReference` instance.
293
+ *
294
+ * @returns a JSON representation of this object.
295
+ */
292
296
toJSON ( ) : object {
293
297
return {
294
298
type : DocumentReference . _jsonSchemaVersion ,
295
299
referencePath : this . _key . toString ( )
296
300
} ;
297
301
}
298
302
299
- /** Builds a `DocumentReference` instance from a JSON serialized version of `DocumentReference`. */
303
+ /**
304
+ * Builds a `DocumentReference` instance from a JSON object created by
305
+ * {@link DocumentReference.toJSON}.
306
+ *
307
+ * @param json a JSON object represention of a `DocumentReference` instance
308
+ * @returns an instance of {@link DocumentReference} if the JSON object could be parsed. Throws a
309
+ * {@link FirestoreError} if an error occurs.
310
+ */
300
311
static fromJSON <
301
312
NewAppModelType = DocumentData ,
302
313
NewDbModelType extends DocumentData = DocumentData
Original file line number Diff line number Diff line change @@ -59,14 +59,25 @@ export class VectorValue {
59
59
vectorValues : property ( 'object' )
60
60
} ;
61
61
62
- /** Returns a JSON-serializable representation of this `VectorValue` instance. */
62
+ /**
63
+ * Returns a JSON-serializable representation of this `VectorValue` instance.
64
+ *
65
+ * @returns a JSON representation of this object.
66
+ */
63
67
toJSON ( ) : object {
64
68
return {
65
69
type : VectorValue . _jsonSchemaVersion ,
66
70
vectorValues : this . _values
67
71
} ;
68
72
}
69
- /** Builds a `Bytes` instance from a JSON serialized version of `Bytes`. */
73
+
74
+ /**
75
+ * Builds a `VectorValue` instance from a JSON object created by {@link VectorValue.toJSON}.
76
+ *
77
+ * @param json a JSON object represention of a `VectorValue` instance
78
+ * @returns an instance of {@link VectorValue} if the JSON object could be parsed. Throws a
79
+ * {@link FirestoreError} if an error occurs.
80
+ */
70
81
static fromJSON ( json : object ) : VectorValue {
71
82
if ( validateJSON ( json , VectorValue . _jsonSchema ) ) {
72
83
if (
You can’t perform that action at this time.
0 commit comments