Skip to content

Commit

Permalink
add node and rn code samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaaaa committed Jul 10, 2024
1 parent ecee511 commit 76a2e60
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 17 deletions.
76 changes: 63 additions & 13 deletions docs/build/group-chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,9 @@ try group.listAdmins()
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
const admins = conversation.admins;
```
</TabItem>
Expand Down Expand Up @@ -979,7 +981,9 @@ try group.listSuperAdmins()
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
const superAdmins = conversation.superAdmins;
```
</TabItem>
Expand Down Expand Up @@ -1012,7 +1016,9 @@ try await group.addAdmin(inboxid: inboxID)
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
await conversation.addAdmin(inboxId);
```
</TabItem>
Expand Down Expand Up @@ -1045,7 +1051,9 @@ try await group.addSuperAdmin(inboxid: inboxID)
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
await conversation.addSuperAdmin(inboxId);
```
</TabItem>
Expand Down Expand Up @@ -1078,7 +1086,9 @@ try await group.removeAdmin(inboxid: inboxid)
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
await conversation.removeAdmin(inboxId);
```
</TabItem>
Expand Down Expand Up @@ -1111,7 +1121,9 @@ try await group.removeSuperAdmin(inboxid: inboxID)
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
await conversation.removeSuperAdmin(inboxId);
```
</TabItem>
Expand Down Expand Up @@ -1296,7 +1308,9 @@ try await client.inboxIdFromAddress(address: peerAddress)
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
const memberInboxIds = conversation.members.map(member => member.inboxId);
```
</TabItem>
Expand Down Expand Up @@ -1431,7 +1445,13 @@ try await contacts.deny(addresses: [walletAddress])
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
// Allow contacts
await client.contacts.allow(walletAddresses);
// Deny contacts
await client.contacts.deny(walletAddresses);
```
</TabItem>
Expand All @@ -1444,10 +1464,10 @@ Code sample coming soon
```jsx
// Allow
await contact.allowGroup([groupId]);
await contacts.allowInboxes([inboxId1, inboxId2, ...])
// Deny
await contact.denyGroup([groupId]);
await contacts.denyInboxes([inboxId1, inboxId2, ...])
```
</TabItem>
Expand Down Expand Up @@ -1476,6 +1496,15 @@ try await contact.denyInboxes(inboxIds: [inboxID])
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
// Ry I can't seem to find a method for this by inbox Id, but it did offer me this by wallet address:
// this API is experimental and may change in the future
// Allow
// await client.contacts.allow([walletAddress]);
// Deny
//await client.contacts.deny([walletAddress]);
Code sample coming soon
```
Expand Down Expand Up @@ -1521,7 +1550,13 @@ try await contacts.denyGroups(groupIds: [groupId])
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
// Allow
await client.contacts.allowGroup(groupId);
// Deny
await client.contacts.denyGroup(groupId);
```
</TabItem>
Expand Down Expand Up @@ -1569,6 +1604,15 @@ try await client.contacts.denyInboxes(inboxIds: [client.inboxID])
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
// Ry I can't seem to find a method for this by inbox ID, but it did offer me this by wallet address, which is the same as it gave me for Allow or deny contact by inbox ID in group chat
// this API is experimental and may change in the future
// Allow
// await client.contacts.allow([walletAddress]);
// Deny
//await client.contacts.deny([walletAddress]);
Code sample coming soon
```
Expand Down Expand Up @@ -1608,6 +1652,7 @@ await contact.isGroupAllowed(groupId: groupID)
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
// Ry I can't seem to find a method for this - it is telling me that "permissions in the mls-client are typically managed at the individual wallet address level, not at the group chat level."
Code sample coming soon
```
Expand Down Expand Up @@ -1643,6 +1688,7 @@ await contact.isInboxAllowed(inboxId: client.inboxID)
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
// Ry I can't seem to find a method for this for inbox ID - correct? But it offered me this by wallet address: const isAllowed = client.contacts.isAllowed(address);
Code sample coming soon
```
Expand Down Expand Up @@ -1750,7 +1796,9 @@ try group.groupImageUrlSquare()
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
const imageUrl = conversation.imageUrl;
```
</TabItem>
Expand Down Expand Up @@ -1783,7 +1831,9 @@ try await group.updateGroupImageUrlSquare(imageUrlSquare: "newurl.com")
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>
```tsx
Code sample coming soon
// this API is experimental and may change in the future
await conversation.updateImageUrl(newImageUrl);
```
</TabItem>
Expand Down
17 changes: 13 additions & 4 deletions docs/build/message-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ When your app creates a new client, specify the location where the client should
<TabItem value="rn" label="React Native" attributes={{className: "rn_tab"}}>

```jsx
Code sample coming soon
const clientOptions = {
env: 'production' as const,
enableV3: true,
appVersion: 'YourApp/1.0.0',
// Add the history sync URL option
historySyncUrl: 'SYNC_URL'
}
```

</TabItem>
Expand Down Expand Up @@ -63,7 +69,10 @@ let options = ClientOptions(
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>

```tsx
Code sample coming soon
// Ry, this might be totallly off...
const client = await Client.create('0x1234...', {
apiUrl: 'SYNC_URL'
});
```

</TabItem>
Expand Down Expand Up @@ -95,7 +104,7 @@ Downloading message history may involve a large amount of data. To help users av
<TabItem value="rn" label="React Native" attributes={{className: "rn_tab"}}>

```jsx
Code sample coming soon
await client.requestMessageHistorySync()
```

</TabItem>
Expand All @@ -116,7 +125,7 @@ try await client.requestMessageHistorySync()
<TabItem value="node" label="Node" attributes={{className: "node_tab"}}>

```tsx
Code sample coming soon
await client.requestHistorySync();
```

</TabItem>
Expand Down

0 comments on commit 76a2e60

Please sign in to comment.