Skip to content

Commit

Permalink
removed description of companyData.setCompanyKey
Browse files Browse the repository at this point in the history
  • Loading branch information
abelousov committed Feb 22, 2015
1 parent b68f117 commit 9cad4a3
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions guide/storing_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,26 @@ User data locally
* ``get(key)`` - gets previously stored value;
* ``delete(key)`` - deletes value

User data on server
-------------------
``taistApi.userData`` stores data linked to current addon user on server:
User and company data on server
-------------------------------t
Data can also be stored on Taist server:

* ``set(key, value, callback)`` - stores value
* ``get(key, callback)`` - gets previously stored value;
* ``delete(key, callback)`` - deletes value; throws an error if value doesn't exist in storage
* user-level data is processed via ``userData``
* company-level data (shared between all company members) is processed via ``companyData``

**params**:
* ``key``, ``value`` - scalar value or JSON-like object
* ``function callback(error, result)`` - ``result`` is set only for ``get`` method

.. _taistApi-companyData:
``userData`` and ``companyData`` have the same basic interface:

Company data on server
----------------------
``taistApi.companyData`` allows to store data shared between employees of one company, members of one team or participants of one project.

To define company members, open ``companyKey`` is used - it's a value that is got from target service and is equal for all company members.
For example, addon for some CRM can use company name or id, addon for Github can use repository name.

* ``setCompanyKey(companyKey)`` - sets ``companyKey``; should be called before any data access method;
* ``set(key, value, callback)`` - stores value;
* ``get(key, callback)`` - gets previously stored value;
* ``delete(key, callback)`` - deletes value; throws an error if value doesn't exist in storage
* ``set(key, value, callback)`` - stores ``value`` on Taist server
* ``get(key, callback)`` - gets previously stored data
* ``delete(key, callback)`` - deletes ``value``; throws an error if there is no data stored with given ``key``

**params**:

* ``companyKey``, ``key``, ``value`` - scalar value or JSON-like object
* ``key``, ``value`` - scalar value or JSON-like object
* ``function callback(error, result)`` - ``result`` is set only for ``get`` method

Working with parts of values
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``taistApi.companyData`` also allows to change or retrieve parts of data:
Company data: working with parts of values
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``companyData`` also allows to change or retrieve parts of data:

* ``getPart(key, partKey, callback)`` - gets field ``partKey`` of an object previously stored with key = ``key``
* ``setPart(key, partKey, value, callback)`` - sets field ``partKey`` of an object previously stored with key = ``key``
Expand Down

0 comments on commit 9cad4a3

Please sign in to comment.