Skip to content

Commit

Permalink
Improve docs (#373)
Browse files Browse the repository at this point in the history
* docs: improve

* fix: add .env on .gitignore

* docs: update rest api docs

* docs: update

* docs: add new response type to user functions

* docs: simplify tables
  • Loading branch information
strykerin authored May 10, 2023
1 parent c7b4f72 commit 8f7d3f3
Showing 1 changed file with 176 additions and 51 deletions.
227 changes: 176 additions & 51 deletions packages/restapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1592,18 +1592,61 @@ const user = await PushAPI.user.create({
})
```

| Param | Type | Default | Remarks |
|----------------|----------|---------------------------------|---------------------------------------------------------------|
| env | string | 'prod' | API env - 'prod', 'staging', 'dev' |
| account | string | - | Account address |
| signer | - | - | ethers.js signer |
| version | string | 'eip191-aes256-gcm-hkdf-sha256' | 'x25519-xsalsa20-poly1305' or 'eip191-aes256-gcm-hkdf-sha256' |
| additionalMeta | object | - | Additional meta data for user |
| progressHook | function | - | Progress hook |
| Param | Remarks |
|----------------|---------------------------------------------------------------|
| env | API env - 'prod', 'staging', 'dev' |
| account | Account address |
| signer | ethers.js signer |
| version | 'x25519-xsalsa20-poly1305' or 'eip191-aes256-gcm-hkdf-sha256' |
| additionalMeta | Additional meta data for user |
| progressHook | Progress hook |

<details>
<summary><b>Expected response (Create Chat User)</b></summary>

**Version 1.2.x**

```typescript
export interface IUser {
did: string;
wallets: string;
profilePicture: string | null;
publicKey: string;
encryptedPrivateKey: string;
encryptionType: string;
signature: string;
sigType: string;
about: string | null;
name: string | null;
encryptedPassword: string | null;
nftOwner: string | null;
numMsg: number;
allowedNumMsg: number;
linkedListHash?: string | null;
nfts?: [] | null;
}
```

| Parameter | Description |
| --- | --- |
| `did` | user decentralized identity |
| `wallets` | all wallets associated to the did |
| `profilePicture` | user chat profile picture. As of now i cannot be changed |
| `publicKey` | PGP public key |
| `encryptedPrivateKey` | encrypted private PGP key |
| `encryptionType` | encryption type used to encrypt the private key |
| `signature` | user payload signature used when creating a user |
| `sigType` | signature type used when creating a user |
| `about` | short user description |
| `name` | user name |
| `encryptedPassword` | encrypted password used to encrypt the private key for NFT chat |
| `nftOwner` | NFT owner address |
| `numMsg` | number of messages sent by the user |
| `allowedNumMsg` | number of messages allowed to be sent by the user |
| `linkedListHash` | cid from all messages this user has sent |
| `nfts` | array of NFTs owned by the user |

Example response:
```typescript
// PushAPI_user_get | Response - 200 OK
{
Expand Down Expand Up @@ -1655,24 +1698,44 @@ const user = await PushAPI.user.create({
}
```

| Parameter | Type | Description |
| --- | --- | --- |
| `did` | `string` | user decentralized identity |
| `wallets` | `string` | all wallets associated to the did |
| `profilePicture` | `string` | user chat profile picture. As of now i cannot be changed |
| `publicKey` | `string` | PGP public key |
| `encryptedPrivateKey` | `string` | encrypted private PGP key |
| `encryptionType` | `string` | encryption type used to encrypt the private key |
| `signature` | `string` | user payload signature used when creating a user |
| `sigType` | `string` | signature type used when creating a user |
| `about` | `string` | short user description |
| `name` | `string` | user name |
| `encryptedPassword` | `string` | encrypted password used to encrypt the private key for NFT chat |
| `nftOwner` | `string` | NFT owner address |
| `numMsg` | `number` | number of messages sent by the user |
| `allowedNumMsg` | `number` | number of messages allowed to be sent by the user |
| `linkedListHash` | `string` | cid from all messages this user has sent |
| `nfts` | `string[]` | array of NFTs owned by the user |
**Version 1.3.x**

```typescript
export interface IUser {
msgSent: number;
maxMsgPersisted : number;

did: string;
wallets: string;

profile: {
name: string | null;
desc: string | null;
profilePicture: string | null;
}

encryptedPrivateKey: string;
publicKey: string;
nftOwner: string;

verificationProof: string;
}
```

| Parameter | Description |
| --- | --- |
| `msgSent` | number of messages sent by the user |
| `maxMsgPersisted` | number of messages allowed to be sent by the user |
| `did` | user decentralized identity |
| `wallets` | all wallets associated to the did |
| `name` | user name |
| `desc` | short user description |
| `profilePicture` | user chat profile picture. As of now i cannot be changed |
| `encryptedPrivateKey` | encrypted private PGP key |
| `publicKey` | PGP public key |
| `nftOwner` | NFT owner address |
| `verificationProof` | verification proof |

</details>

-----
Expand All @@ -1685,15 +1748,57 @@ const user = await PushAPI.user.get({
});
```

Allowed Options (params with * are mandatory)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| account* | string | - | Account address |
| env | string | 'prod' | API env - 'prod', 'staging', 'dev'|
| Param | Remarks |
|----------|---------|
| account | Account address |
| env | API env - 'prod', 'staging', 'dev'|

<details>
<summary><b>Expected response (Get Push Chat User)</b></summary>
<details>
<summary><b>Expected response (Get Push Chat User)</b></summary>

**Version 1.2.x**

```typescript
export interface IUser {
did: string;
wallets: string;
profilePicture: string | null;
publicKey: string;
encryptedPrivateKey: string;
encryptionType: string;
signature: string;
sigType: string;
about: string | null;
name: string | null;
encryptedPassword: string | null;
nftOwner: string | null;
numMsg: number;
allowedNumMsg: number;
linkedListHash?: string | null;
nfts?: [] | null;
}
```

| Parameter | Description |
| --- | --- |
| `did` | user decentralized identity |
| `wallets` | all wallets associated to the did |
| `profilePicture` | user chat profile picture. As of now i cannot be changed |
| `publicKey` | PGP public key |
| `encryptedPrivateKey` | encrypted private PGP key |
| `encryptionType` | encryption type used to encrypt the private key |
| `signature` | user payload signature used when creating a user |
| `sigType` | signature type used when creating a user |
| `about` | short user description |
| `name` | user name |
| `encryptedPassword` | encrypted password used to encrypt the private key for NFT chat |
| `nftOwner` | NFT owner address |
| `numMsg` | number of messages sent by the user |
| `allowedNumMsg` | number of messages allowed to be sent by the user |
| `linkedListHash` | cid from all messages this user has sent |
| `nfts` | array of NFTs owned by the user |

Example response:
```typescript
// PushAPI_user_get | Response - 200 OK
{
Expand Down Expand Up @@ -1745,24 +1850,44 @@ Allowed Options (params with * are mandatory)
}
```

| Parameter | Type | Description |
| --- | --- | --- |
| `did` | `string` | user decentralized identity |
| `wallets` | `string` | all wallets associated to the did |
| `profilePicture` | `string` | user chat profile picture. As of now i cannot be changed |
| `publicKey` | `string` | PGP public key |
| `encryptedPrivateKey` | `string` | encrypted private PGP key |
| `encryptionType` | `string` | encryption type used to encrypt the private key |
| `signature` | `string` | user payload signature used when creating a user |
| `sigType` | `string` | signature type used when creating a user |
| `about` | `string` | short user description |
| `name` | `string` | user name |
| `encryptedPassword` | `string` | encrypted password used to encrypt the private key for NFT chat |
| `nftOwner` | `string` | NFT owner address |
| `numMsg` | `number` | number of messages sent by the user |
| `allowedNumMsg` | `number` | number of messages allowed to be sent by the user |
| `linkedListHash` | `string` | cid from all messages this user has sent |
| `nfts` | `string[]` | array of NFTs owned by the user |
**Version 1.3.x**

```typescript
export interface IUser {
msgSent: number;
maxMsgPersisted : number;

did: string;
wallets: string;

profile: {
name: string | null;
desc: string | null;
profilePicture: string | null;
}

encryptedPrivateKey: string;
publicKey: string;
nftOwner: string;

verificationProof: string;
}
```

| Parameter | Description |
| --- | --- |
| `msgSent` | number of messages sent by the user |
| `maxMsgPersisted` | number of messages allowed to be sent by the user |
| `did` | user decentralized identity |
| `wallets` | all wallets associated to the did |
| `name` | user name |
| `desc` | short user description |
| `profilePicture` | user chat profile picture. As of now i cannot be changed |
| `encryptedPrivateKey` | encrypted private PGP key |
| `publicKey` | PGP public key |
| `nftOwner` | NFT owner address |
| `verificationProof` | verification proof |

</details>

-----
Expand Down

0 comments on commit 8f7d3f3

Please sign in to comment.