Skip to content
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

docs: fix gh pages formatting #119

Merged
merged 1 commit into from
May 18, 2022
Merged
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
26 changes: 16 additions & 10 deletions docs/stream-cli_chat_imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ for processing.
To import data into your Stream app, you'll need to provide a valid import file. The file needs to be structured as a
list of JSON objects, representing each item to be imported.

<details>
<details markdown="1">
<summary>Here's an example of a valid import file</summary>

```json
[
{
Expand Down Expand Up @@ -86,8 +87,9 @@ list of JSON objects, representing each item to be imported.

Before processing this file, we'll need to ensure it is valid. We can do this by using the validate-import command.

<details>
<details markdown="1">
<summary>`validate-import` example</summary>

```shell
$ stream-cli chat validate-import my-data.json 9:33:17
{
Expand All @@ -112,7 +114,7 @@ reference errors.
Validation errors occur when items contain invalid data or are missing required fields.

| Error | Reason |
|----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `validation error: user.id required` | A required field is missing |
| `validation error: either channel.id or channel.member_ids required` | A channel needs either an id or a list of member ids (but not both) |
| `validation error: either message.channel_id or message.channel_member_ids required` | A channel reference needs to be either a channel id or a list of channel member ids (but not both) |
Expand All @@ -122,18 +124,18 @@ Validation errors occur when items contain invalid data or are missing required
| `validation error: message.type invalid ("regular", "deleted", "system" and "reply" allowed)` | A field can only be one of these values |
| `validation error: message.type "deleted" while message.deleted_at is null` | A message of type `deleted` must have `deleted_at` set |
| `validation error: distinct channel: ["userA" "userB"] is missing members: ["userB"]. Please include all members as separate member entries` | A distinct channel has been defined with a member `userB`, but has not been included as a separate member item |
| `validation error: duplicate user found "userA"` | An item occurs more than once in the import file |
| `validation error: duplicate user found "userA"` | An item occurs more than once in the import file |

#### Reference Errors

Every user, channel, or reference message needs to be included as a separate item in the import file. Additionally,
referenced user roles and channel types have to exist before importing.

| Error | Reason |
|-------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `reference error: user.role "admin" doesn't exist (user "userA")` | User role must exists before importing |
| `reference error: channel.type "livestream" doesn't exist (channel "livestream:chanelA")` | Channel type must exist before importing |
| `reference error: channel.created_by "john" doesn't exist (channel "messaging:channelA")` | User `john` must be included in the import file |
| `reference error: channel.created_by "john" doesn't exist (channel "messaging:channelA")` | User `john` must be included in the import file |
| `reference error: distinct channel with type "messaging" and members:["userA" "userB"] doesn't exist` | The distinct channel referenced with member userA and userB must be included in the import file |
| `reference error: user "userA" with teams ["teamA"] cannot be a member of channel messaging:channelB with team "teamB"` | The user is not a part of the team assigned to this channel |
| `reference error: user "userC" specified as channel member but not present in channel_members_ids: [userA userB]` | The member items must match the members in the distinct channel definition |
Expand All @@ -142,8 +144,9 @@ referenced user roles and channel types have to exist before importing.

Once the import file is valid, the file can be uploaded to be scheduled for import:

<details>
<details markdown="1">
<summary>`upload-import` example</summary>

```shell
$ stream-cli chat upload-import my-data.json 10:14:36
{
Expand All @@ -166,8 +169,9 @@ By default, the `mode` is set to `upsert`. This means that every item will be ei
the item as it appears in the import file. Uploads can be created with `mode` set to `insert`, to insert only and ignore
pre-existing items.

<details>
<details markdown="1">
<summary>import modes example</summary>

```shell
$ stream-cli chat upload-import valid-data.json --mode insert 11:02:44
{
Expand All @@ -194,8 +198,9 @@ Once an import has been created, you can monitor its status using the `get-impor

`get-import` accepts an option `--watch` flag, which will periodically poll the import status.

<details>
<details markdown="1">
<summary>`get-import` example</summary>

```shell
$ stream-cli chat get-import f0077dab-84f3-48f1-9292-2bf1b48fd6f0 --watch 13:50:09
{
Expand All @@ -221,8 +226,9 @@ $ stream-cli chat get-import f0077dab-84f3-48f1-9292-2bf1b48fd6f0 --watch

`list-imports` will return an imports list and accepts a `limit` and `offset` parameter.

<details>
<details markdown="1">
<summary>`list-imports` example</summary>

```shell
$ stream-cli chat list-imports 130 ↵ 13:51:07
[
Expand Down