# Wijmo_Cloud.Firestore

## Content

<div class="content__tsd">
						<div style="display:flex;justify-content:space-between;align-items:center">
							<h1>
								Firestore Class
							</h1>
						</div>
						<section class="tsd-comment">
							<div class="tsd-comment">
								<div class="lead">
									<p>Represents a Firestore database with one or more collections.</p>
								</div>
								<p>Each collection is represented by a <a href="wijmo_cloud.collection.html">Collection</a> object that
									exposes the data on the collection as a <a href="wijmo.collectionview.html">CollectionView</a> object
								which can be used as a data source for any Wijmo control.</p>
								<p>In addition to full CRUD support you get all the <a href="wijmo.collectionview.html">CollectionView</a>
								features including sorting, filtering, paging, and grouping.</p>
								<p>The sorting, filtering, and paging functions may be performed on the
									server or on the client, depending on the setting of the
									<a href="wijmo_cloud.collection.html#sortonserver">Collection.sortOnServer</a>, <a href="wijmo_cloud.collection.html#filteronserver">Collection.filterOnServer</a>,
								and <a href="wijmo_cloud.collection.html#pageonserver">Collection.pageOnServer</a> properties.</p>
								<p>The code below shows how you can instantiate a <a href="wijmo_cloud.firestore.html">Firestore</a>
								object that loads data from three collections:</p>
								<pre><code class="language-typescript"><span class="hljs-keyword">import</span> { Firestore } <span class="hljs-keyword">from</span> <span class="hljs-string">'@mescius/wijmo.cloud'</span>;
<span class="hljs-keyword">const</span> PROJECT_ID = <span class="hljs-string">'XXXX-YYYY'</span>;
<span class="hljs-keyword">const</span> API_KEY = <span class="hljs-string">'ZZZZ'</span>;
<span class="hljs-keyword">let</span> fsNWind = <span class="hljs-keyword">new</span> Firestore(PROJECT_ID, API_KEY, {
    collections: [ <span class="hljs-string">'Products'</span>, <span class="hljs-string">'Categories'</span>, <span class="hljs-string">'Suppliers'</span> ]
});</code></pre>
								<p>This class does not use or require the use of the Firestore
								client libraries.</p>
							</div>
						</section>
						<section class="tsd-hierarchy">
							<h3>Heirarchy</h3>
							<ul class="tsd-hierarchy">
								<li>
									<span class="target">Firestore</span>
								</li>
							</ul>
						</section>
						<section class="tsd-index-group">
							<section class="tsd-index-panel">
								<div class="tsd-index-content">
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Constructors
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#constructor" class="tsd-kind-icon">constructor</a></li>
										</ul>
									</section>
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Properties
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-property tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#accesstoken" class="tsd-kind-icon">access<wbr>Token</a></li>
											<li class="tsd-kind-property tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#apikey" class="tsd-kind-icon">api<wbr>Key</a></li>
											<li class="tsd-kind-property tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#collections" class="tsd-kind-icon">collections</a></li>
											<li class="tsd-kind-property tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#idtoken" class="tsd-kind-icon">id<wbr>Token</a></li>
											<li class="tsd-kind-property tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#projectid" class="tsd-kind-icon">project<wbr>Id</a></li>
										</ul>
									</section>
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Methods
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-method tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#getcollection" class="tsd-kind-icon">get<wbr>Collection</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#onaccesstokenchanged" class="tsd-kind-icon">on<wbr>Access<wbr>Token<wbr>Changed</a></li>
										</ul>
									</section>
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Events
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-event tsd-parent-kind-class"><a href="wijmo_cloud.firestore.html#accesstokenchanged" class="tsd-kind-icon">access<wbr>Token<wbr>Changed</a></li>
										</ul>
									</section>
								</div>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Constructors</h2>
							<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
								<a name="constructor" class="tsd-anchor"></a>
								<h3>constructor</h3>
								<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
									<li class="tsd-signature tsd-kind-icon">new <wbr>Firestore<span class="tsd-signature-symbol">(</span>projectId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, apiKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="wijmo_cloud.firestore.html" class="tsd-signature-type">Firestore</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Initializes a new instance of the <a href="wijmo_cloud.firestore.html">Firestore</a> class.</p>
											</div>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5>projectId: <span class="tsd-signature-type">string</span></h5>
												<div class="tsd-comment">
													<div class="lead">
														<p>ID of the Firebase app that contains the database.</p>
													</div>
												</div>
											</li>
											<li>
												<h5>apiKey: <span class="tsd-signature-type">string</span></h5>
												<div class="tsd-comment">
													<div class="lead">
														<p>Unique identifier used to authenticate requests associated with the app.
														To generate API keys, please go to <a href="https://console.cloud.google.com/">https://console.cloud.google.com/</a>.</p>
													</div>
												</div>
											</li>
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <span class="tsd-signature-type">any</span></h5>
												<div class="tsd-comment">
													<div class="lead">
														<p>JavaScript object containing initialization data (property values
														and event handlers) for this <a href="wijmo_cloud.firestore.html">Firestore</a>.</p>
													</div>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="wijmo_cloud.firestore.html" class="tsd-signature-type">Firestore</a></h4>
									</li>
								</ul>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Properties</h2>
							<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
								<a name="accesstoken" class="tsd-anchor"></a>
								<h3>accessToken</h3>
								<div class="tsd-signature tsd-kind-icon">access<wbr>Token<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Gets or sets an OAuth 2.0 access token used to access the database.</p>
									</div>
									<p>You can use the <a href="wijmo_cloud.oauth2.html">OAuth2</a> class to allow users to log in and
									to obtain the <a href="wijmo_cloud.firestore.html#accesstoken">accessToken</a> string.</p>
									<p>If you choose this authentication method, Firestore Security Rules
										will not be applied. Firestore will use Cloud Identity and Access
									Management (IAM) instead.</p>
									<p>See also the <a href="wijmo_cloud.firestore.html#idtoken">idToken</a> property, which does integrate with
									Firestore Security Rules.</p>
								</div>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
								<a name="apikey" class="tsd-anchor"></a>
								<h3>apiKey</h3>
								<div class="tsd-signature tsd-kind-icon">api<wbr>Key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Gets the API key used to create this <a href="wijmo_cloud.firestore.html">Firestore</a>.</p>
									</div>
								</div>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
								<a name="collections" class="tsd-anchor"></a>
								<h3>collections</h3>
								<div class="tsd-signature tsd-kind-icon">collections<span class="tsd-signature-symbol">:</span> <a href="wijmo.observablearray.html" class="tsd-signature-type">ObservableArray</a><span class="tsd-signature-symbol">&lt;</span><a href="wijmo_cloud.collection.html" class="tsd-signature-type">Collection</a><span class="tsd-signature-symbol">&gt;</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Gets the list of <a href="wijmo_cloud.collection.html">Collection</a> objects in this <a href="wijmo_cloud.firestore.html">Firestore</a>.</p>
									</div>
								</div>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
								<a name="idtoken" class="tsd-anchor"></a>
								<h3>idToken</h3>
								<div class="tsd-signature tsd-kind-icon">id<wbr>Token<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Gets or sets a OAuth 2.0 id token used to access the database.</p>
									</div>
									<p>You can use the <a href="wijmo_cloud.oauth2.html">OAuth2</a> class to allow users to log in and
									to obtain the <a href="wijmo_cloud.firestore.html#idtoken">idToken</a> string.</p>
									<p>If you choose this authentication method, Firestore Security Rules
										will be applied as usual to determine which users can read and write
									to the database.</p>
									<p>See also the <a href="wijmo_cloud.firestore.html#accesstoken">accessToken</a> property, which bypasses Firestore
										Security Rules and uses Cloud Identity and Access Management (IAM)
									instead.</p>
								</div>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
								<a name="projectid" class="tsd-anchor"></a>
								<h3>projectId</h3>
								<div class="tsd-signature tsd-kind-icon">project<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Gets the ID of the Firebase app that contains the database.</p>
									</div>
								</div>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Methods</h2>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
								<a name="getcollection" class="tsd-anchor"></a>
								<h3>getCollection</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
									<li class="tsd-signature tsd-kind-icon">get<wbr>Collection<span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="wijmo_cloud.collection.html" class="tsd-signature-type">Collection</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Gets a <a href="wijmo_cloud.collection.html">Collection</a> by its <a href="wijmo_cloud.collection.html#name">Collection.name</a>.</p>
											</div>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5>name: <span class="tsd-signature-type">string</span></h5>
												<div class="tsd-comment">
													<p>Name of the <a href="wijmo_cloud.collection.html">Collection</a> to look for.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="wijmo_cloud.collection.html" class="tsd-signature-type">Collection</a></h4>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
								<a name="onaccesstokenchanged" class="tsd-anchor"></a>
								<h3>onAccessTokenChanged</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
									<li class="tsd-signature tsd-kind-icon">on<wbr>Access<wbr>Token<wbr>Changed<span class="tsd-signature-symbol">(</span>e<span class="tsd-signature-symbol">?: </span><a href="wijmo.eventargs.html" class="tsd-signature-type">EventArgs</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Raises the <a href="wijmo_cloud.firestore.html#accesstokenchanged">accessTokenChanged</a> event.</p>
											</div>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> e: <a href="wijmo.eventargs.html" class="tsd-signature-type">EventArgs</a></h5>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
									</li>
								</ul>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Events</h2>
							<section class="tsd-panel tsd-member tsd-kind-event tsd-parent-kind-class">
								<a name="accesstokenchanged" class="tsd-anchor"></a>
								<h3>accessTokenChanged</h3>
								<div class="tsd-signature tsd-kind-icon">access<wbr>Token<wbr>Changed<span class="tsd-signature-symbol">:</span> <a href="wijmo.event.html" class="tsd-signature-type">Event</a><span class="tsd-signature-symbol">&lt;</span><a href="wijmo_cloud.firestore.html" class="tsd-signature-type">Firestore</a><span class="tsd-signature-symbol">, </span><a href="wijmo.eventargs.html" class="tsd-signature-type">EventArgs</a><span class="tsd-signature-symbol">&gt;</span></div>
								<aside class="tsd-sources">
								</aside>
								<div class="tsd-comment">
									<div class="lead">
										<p>Occurs when the value of the <a href="wijmo_cloud.firestore.html#accesstoken">accessToken</a> property changes.</p>
									</div>
								</div>
							</section>
						</section>
					</div>