|
2 | 2 |
|
3 | 3 | # Account |
4 | 4 |
|
5 | | -Instances of the `Account` class denote TriplyDB accounts. Accounts can be either organizations ([`Organization`](../organization/index.md#organization)) or users ([`User`](../user/index.md#user)). |
| 5 | +Instances of the `Account` class denote TriplyDB accounts. Accounts can be either groups ([`Group`](../group/index.md#group)) or users ([`User`](../user/index.md#user)). |
6 | 6 |
|
7 | 7 | Account objects are obtained by calling the following method: |
8 | 8 |
|
@@ -39,7 +39,7 @@ The `metadata` argument optionally specifies the access level and other importan |
39 | 39 | <p>The access level of the dataset. The following values are supported:</p> |
40 | 40 | <dl> |
41 | 41 | <dt><code>'private'</code> (default)</dt> |
42 | | - <dd>The dataset can only be accessed by organization members.</dd> |
| 42 | + <dd>The dataset can only be accessed by group members.</dd> |
43 | 43 | <dt><code>'internal'</code> </dt> |
44 | 44 | <dd>The dataset can only be accessed by users that are logged into the TriplyDB server.</dd> |
45 | 45 | <dt><code>'public'</code></dt> |
@@ -309,36 +309,37 @@ const newStory = await user.addStory('name-of-story', { |
309 | 309 | ``` |
310 | 310 |
|
311 | 311 |
|
312 | | -## Account.asOrganization() |
| 312 | +<a id="accountasorganization"></a> |
| 313 | +## Account.asGroup() |
313 | 314 |
|
314 | | -Casts the TriplyDB account object to its corresponding organization object. |
| 315 | +Casts the TriplyDB account object to its corresponding group object. |
315 | 316 |
|
316 | | -Class [Organization](../organization/index.md#organization) is a specialization of class [Account](#account). |
| 317 | +Class [Group](../group/index.md#group) is a specialization of class [Account](#account). |
317 | 318 |
|
318 | | -Calling this method on an `Organization` object does nothing. |
| 319 | +Calling this method on a `Group` object does nothing. |
319 | 320 |
|
320 | 321 | ### Examples |
321 | 322 |
|
322 | | -The following snippet retrieves the account named `'Triply'` and casts it to an organization: |
| 323 | +The following snippet retrieves the account named `'Triply'` and casts it to a group: |
323 | 324 |
|
324 | 325 | ```ts |
325 | 326 | const account = await triply.getAccount('Triply') |
326 | | -const organization = account.asOrganization() |
| 327 | +const group = account.asGroup() |
327 | 328 | ``` |
328 | 329 |
|
329 | 330 | ### Alternatives |
330 | 331 |
|
331 | | -This method is not needed if the organization is directly retrieved with the specialization method [`App.getOrganization(name: string)`](../app/index.md#appgetorganizationname-string). |
| 332 | +This method is not needed if the group is directly retrieved with the specialization method [`App.getGroup(name: string)`](../app/index.md#appgetgroupname-string). |
332 | 333 |
|
333 | 334 | The following snippet returns the same result as the above example, but in a more direct way: |
334 | 335 |
|
335 | 336 | ```ts |
336 | | -const organization = await triply.getOrganization('Triply') |
| 337 | +const group = await triply.getGroup('Triply') |
337 | 338 | ``` |
338 | 339 |
|
339 | 340 | ### See also |
340 | 341 |
|
341 | | -This method returns an organization object. See class [Organization](../organization/index.md#organization) for an overview of the methods that can be called on such objects. |
| 342 | +This method returns a group object. See class [Group](../group/index.md#group) for an overview of the methods that can be called on such objects. |
342 | 343 |
|
343 | 344 |
|
344 | 345 | ## Account.asUser() |
@@ -370,7 +371,7 @@ const user = await triply.getUser() |
370 | 371 |
|
371 | 372 | ### See also |
372 | 373 |
|
373 | | -This method returns an organization object. See class [Organization](../organization/index.md#organization) for an overview of the methods that can be called on such objects. |
| 374 | +This method returns a user object. See class [User](../user/index.md#user) for an overview of the methods that can be called on such objects. |
374 | 375 |
|
375 | 376 |
|
376 | 377 | ## Account.ensureDataset(name: string, metadata?: object) |
@@ -490,13 +491,13 @@ The information object for accounts includes the following keys: |
490 | 491 | <dd>An array containing the pinned items (datasets, stories and queries) for the account.</dd> |
491 | 492 |
|
492 | 493 | <dt><code>type</code></dt> |
493 | | - <dd>The account type: either <code>organization</code> or <code>user</code>.</dd> |
| 494 | + <dd>The account type: either <code>org</code> (for a group) or <code>user</code>. The <code>org</code> value is preserved for backwards compatibility — groups were previously called organizations.</dd> |
494 | 495 |
|
495 | 496 | <dt><code>role</code></dt> |
496 | 497 | <dd>The role of the account</dd> |
497 | 498 |
|
498 | 499 | <dt><code>orgs</code></dt> |
499 | | - <dd>An array of organizations of which the account is a member.</dd> |
| 500 | + <dd>An array of groups of which the account is a member.</dd> |
500 | 501 |
|
501 | 502 | <dt><code>Email address</code></dt> |
502 | 503 | <dd>The email address of the account.</dd> |
@@ -549,7 +550,7 @@ A pinned item is an item that is displayed in a prominent way on the account web |
549 | 550 |
|
550 | 551 | ### Order considerations |
551 | 552 |
|
552 | | -The order in which the pinned datasets are returned reflects the order in which they appear on the organization homepage (from top-left to bottom-right). |
| 553 | +The order in which the pinned datasets are returned reflects the order in which they appear on the group homepage (from top-left to bottom-right). |
553 | 554 |
|
554 | 555 | ### Examples |
555 | 556 |
|
@@ -939,8 +940,8 @@ async (ctx) => { |
939 | 940 | // Specify the environment variable, if necessary |
940 | 941 | const _dataset = |
941 | 942 | process.env['MODE'] === 'Production' |
942 | | - ? (await app.triplyDb.getOrganization(organization)).getDataset(dataset) |
943 | | - : (await app.triplyDb.getUser()).getDataset(organization + '-' + dataset) |
| 943 | + ? (await app.triplyDb.getGroup(group)).getDataset(dataset) |
| 944 | + : (await app.triplyDb.getUser()).getDataset(group + '-' + dataset) |
944 | 945 |
|
945 | 946 | // Update the display name |
946 | 947 | if (displayName) await (await _dataset).update({ displayName }) |
|
0 commit comments