Skip to content

Commit 4c8e431

Browse files
committed
update docs
1 parent 41b82e9 commit 4c8e431

File tree

4 files changed

+50
-8
lines changed

4 files changed

+50
-8
lines changed

packages/firestore/src/lite-api/bytes.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,25 @@ export class Bytes {
101101
bytes: property('string')
102102
};
103103

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+
*/
105109
toJSON(): object {
106110
return {
107111
type: Bytes._jsonSchemaVersion,
108112
bytes: this.toBase64()
109113
};
110114
}
111115

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+
*/
113123
static fromJSON(json: object): Bytes {
114124
if (validateJSON(json, Bytes._jsonSchema)) {
115125
return Bytes.fromBase64String(json.bytes);

packages/firestore/src/lite-api/geo_point.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ export class GeoPoint {
100100
longitude: property('number')
101101
};
102102

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+
*/
104108
toJSON(): { latitude: number; longitude: number; type: string } {
105109
return {
106110
latitude: this._lat,
@@ -109,7 +113,13 @@ export class GeoPoint {
109113
};
110114
}
111115

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+
*/
113123
static fromJSON(json: object): GeoPoint {
114124
if (validateJSON(json, GeoPoint._jsonSchema)) {
115125
return new GeoPoint(json.latitude, json.longitude);

packages/firestore/src/lite-api/reference.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,26 @@ export class DocumentReference<
288288
referencePath: property('string')
289289
};
290290

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+
*/
292296
toJSON(): object {
293297
return {
294298
type: DocumentReference._jsonSchemaVersion,
295299
referencePath: this._key.toString()
296300
};
297301
}
298302

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+
*/
300311
static fromJSON<
301312
NewAppModelType = DocumentData,
302313
NewDbModelType extends DocumentData = DocumentData

packages/firestore/src/lite-api/vector_value.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,25 @@ export class VectorValue {
5959
vectorValues: property('object')
6060
};
6161

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+
*/
6367
toJSON(): object {
6468
return {
6569
type: VectorValue._jsonSchemaVersion,
6670
vectorValues: this._values
6771
};
6872
}
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+
*/
7081
static fromJSON(json: object): VectorValue {
7182
if (validateJSON(json, VectorValue._jsonSchema)) {
7283
if (

0 commit comments

Comments
 (0)