Skip to content

(DOCSP-12596) JS Initialize Realm App #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions source/android/init-realmclient.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Initialize the Realm App Client
Overview
--------

The {+service-short+} {+app+} client is the interface to the {+backend+}
The {+app+} client is the interface to the {+backend+}
backend. It provides access to the :ref:`authentication functionality
<android-authenticate>`, :ref:`functions <android-call-a-function>`, and
:ref:`sync management <android-sync-data>`.
Expand All @@ -21,8 +21,9 @@ backend. It provides access to the :ref:`authentication functionality
Access the App Client
---------------------

Pass the {+app+} ID for your {+app+}, which you can find in the {+ui+}.

Pass the {+app+} ID for your {+app+}, which you can :ref:`find in the Realm
UI <find-your-app-id>`.

.. tabs-realm-languages::

.. tab::
Expand Down
8 changes: 4 additions & 4 deletions source/ios/init-realmclient.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Initialize the Realm App Client
Overview
--------

The {+service-short+} {+app+} client is the interface to the {+backend+}
The {+app+} client is the interface to the {+backend+}
backend. It provides access to the :ref:`authentication functionality
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
:ref:`sync management <ios-sync-data>`.
Expand All @@ -19,12 +19,12 @@ backend. It provides access to the :ref:`authentication functionality
Access the App Client
---------------------

Pass the {+app+} ID for your {+app+}, which you can find in the {+ui+}.
Pass the {+app+} ID for your {+app+}, which you can :ref:`find in the Realm
UI <find-your-app-id>`.

.. code-block:: swift

let app = App(id: "my-realm-app-id")

let app = App(id: "<Your App ID>") // replace this with your App ID

.. _ios-app-client-configuration:

Expand Down
1 change: 1 addition & 0 deletions source/node.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ To learn how to query for data in MongoDB with the Node.js SDK, see
:caption: Work with MongoDB Realm
:hidden:

Initialize the App Client </node/init-realmclient>
Authenticate a User </node/authenticate>
Manage Email/Password Users </node/manage-email-password-users>
Create & Manage User API Keys </node/create-manage-api-keys>
Expand Down
99 changes: 99 additions & 0 deletions source/node/init-realmclient.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.. _node-init-appclient:

===============================
Initialize the Realm App Client
===============================

.. default-domain:: mongodb

Overview
--------

The {+app+} client is the interface to the {+backend+}
backend. It provides access to the :ref:`authentication functionality
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
:ref:`sync management <ios-sync-data>`.


.. _node-access-the-app-client:

Access the App Client
---------------------

Pass the {+service+} App ID for your {+app+}, which you can :ref:`find in the Realm UI <find-your-app-id>`.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const id = "<Your App ID>"; // replace this with your App ID

.. tab::
:tabid: javascript

.. code-block:: javascript

const id = "<Your App ID>"; // replace this with your App ID

.. _node-app-client-configuration:

Configuration
-------------

To set up your {+app+} client, pass a configuration object to an instance
of ``Realm.App``.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const config = {
id,
};
const app: Realm.App = new Realm.App(config);

.. tab::
:tabid: javascript

.. code-block:: javascript

const config = {
id,
};
const app = new Realm.App(config);

.. note::

``id`` is a required field of the application configuration object. To see the full list of fields for the configuration object that ``Realm.App`` accepts as a parameter, view the :js-sdk:`App Configuration Type Definitions <Realm.App.html#~AppConfiguration>`.

.. _node-app-retrieve-client:

Retrieve an Instance of the App Client
--------------------------------------

To retrieve an instance of the App Client from anywhere in your application, call :js-sdk:`Realm.App.getApp() <Realm.App.html#getApp>` and pass in your ``App ID``.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const app: Realm.App = Realm.App.getApp("<Your App ID>"); // replace this with your App ID

.. tab::
:tabid: javascript

.. code-block:: javascript

const app = Realm.App.getApp("<Your App ID>"); // replace this with your App ID



1 change: 1 addition & 0 deletions source/react-native.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ MongoDB Data Access <react-native-mongodb-data-access>`.
:caption: Work with MongoDB Realm
:hidden:

Initialize the Realm App Client </react-native/init-realmclient>
Authenticate a User </react-native/authenticate>
Manage Email/Password Users </react-native/manage-email-password-users>
Create & Manage User API Keys </node/create-manage-api-keys>
Expand Down
100 changes: 100 additions & 0 deletions source/react-native/init-realmclient.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
.. _react-native-init-appclient:

===============================
Initialize the Realm App Client
===============================

.. default-domain:: mongodb

Overview
--------

The {+app+} client is the interface to the {+backend+}
backend. It provides access to the :ref:`authentication functionality
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
:ref:`sync management <ios-sync-data>`.


.. _react-native-access-the-app-client:

Access the App Client
---------------------

Pass the {+service+} App ID for your {+app+}, which you can :ref:`find in the Realm UI <find-your-app-id>`.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const id = "<Your App ID>"; // replace this with your App ID

.. tab::
:tabid: javascript

.. code-block:: javascript

const id = "<Your App ID>"; // replace this with your App ID

.. _react-native-client-configurations:

Configuration
-------------

To set up your {+app+} client, pass a configuration object to an instance
of ``Realm.App``.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const config = {
id,
};
const app: Realm.App = new Realm.App(config);

.. tab::
:tabid: javascript

.. code-block:: javascript

const config = {
id,
};
const app = new Realm.App(config);

.. note::

``id`` is a required field of the application configuration object. To see the full list of fields for the configuration object that ``Realm.App`` accepts as a parameter, view the :js-sdk:`App Configuration Type Definitions <Realm.App.html#~AppConfiguration>`.


.. _react-native-app-retrieve-client:

Retrieve an Instance of the App Client
--------------------------------------

To retrieve an instance of the App Client from anywhere in your application, call :js-sdk:`Realm.App.getApp() <Realm.App.html#getApp>` and pass in your ``App ID``.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const app: Realm.App = Realm.App.getApp("<Your App ID>"); // replace this with your App ID

.. tab::
:tabid: javascript

.. code-block:: javascript

const app = Realm.App.getApp("<Your App ID>"); // replace this with your App ID



1 change: 1 addition & 0 deletions source/web.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ TypeScript applications.
:caption: Work with MongoDB Realm
:hidden:

Initialize the Realm App Client </web/init-realmclient>
Authenticate a User </web/authenticate>
Manage Email/Password Users </web/manage-email-password-users>
Create & Manage User API Keys </node/create-manage-api-keys>
Expand Down
100 changes: 100 additions & 0 deletions source/web/init-realmclient.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
.. _web-init-appclient:

===============================
Initialize the Realm App Client
===============================

.. default-domain:: mongodb

Overview
--------

The {+app+} client is the interface to the {+backend+}
backend. It provides access to the :ref:`authentication functionality
<ios-authenticate>`, :ref:`functions <ios-call-a-function>`, and
:ref:`sync management <ios-sync-data>`.


.. _web-access-the-app-client:

Access the App Client
---------------------

Pass the {+service+} App ID for your {+app+}, which you can :ref:`find in the Realm UI <find-your-app-id>`.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const id = "<Your App ID>"; // replace this with your App ID

.. tab::
:tabid: javascript

.. code-block:: javascript

const id = "<Your App ID>"; // replace this with your App ID

.. _web-client-configurations:

Configuration
-------------

To set up your {+app+} client, pass a configuration object to an instance
of ``Realm.App``.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const config = {
id,
};
const app: Realm.App = new Realm.App(config);

.. tab::
:tabid: javascript

.. code-block:: javascript

const config = {
id,
};
const app = new Realm.App(config);

.. note::

``id`` is a required field of the application configuration object. To see the full list of fields for the configuration object that ``Realm.App`` accepts as a parameter, view the :js-sdk:`App Configuration Type Definitions <Realm.App.html#~AppConfiguration>`.


.. _web-app-retrieve-client:

Retrieve an Instance of the App Client
--------------------------------------

To retrieve an instance of the App Client from anywhere in your application, call :js-sdk:`Realm.App.getApp() <Realm.App.html#getApp>` and pass in your ``App ID``.

.. tabs-realm-languages::

.. tab::
:tabid: typescript

.. code-block:: typescript

const app: Realm.App = Realm.getApp("<Your App ID>"); // replace this with your App ID

.. tab::
:tabid: javascript

.. code-block:: javascript

const app = Realm.getApp("<Your App ID>"); // replace this with your App ID