From 8b96bc6c12a7eedcae21283bc230d01c4e5dc3fe Mon Sep 17 00:00:00 2001 From: akp111 Date: Thu, 5 Oct 2023 17:48:37 +0530 Subject: [PATCH] docs: added links to the function --- packages/restapi/README.md | 75 +++++++++++++++---- .../tests/lib/pushNotification/alias.test.ts | 2 +- 2 files changed, 60 insertions(+), 17 deletions(-) diff --git a/packages/restapi/README.md b/packages/restapi/README.md index 744021e0c..2a668f33f 100644 --- a/packages/restapi/README.md +++ b/packages/restapi/README.md @@ -78,10 +78,22 @@ This package gives access to Push Protocol (Push Nodes) APIs. Visit [Developer D - [Fetch Encryption Info](#fetch-encryption-info) - [Update Encryption](#update-encryption) - [PushNotification Class](#pushnotification-class) - - [Fetch Inbox /Spam notifications](#fetch-inbox/spam-notifications) + - [Fetch Inbox Or Spam notifications](#fetch-inbox-or-spam-notifications) - [Fetch user subscriptions](#fetch-user-subscriptions) - [Subscribe to a channel](#subscribe-to-a-channel) - - [Unsubscribe to a channel] + - [Unsubscribe to a channel](#unsubscribe-to-a-channel) + - [Channel information](#channel-information) + - [Search Channels](#search-channels) + - [Get Subscribers Of A Channel](#get-subscribers-of-a-channel) + - [Send a notification](#send-a-notification) + - [Create a channel](#create-a-channel) + - [Update channel information](#update-channel-information) + - [Verify a channel](#verify-a-channel) + - [Create channel Setting (WIP)](#create-channel-setting-(wip)) + - [Get delegators information](#get-delegators-information) + - [Add delegator to a channel or alias](#add-delegator-to-a-channel-or-alias) + - [Remove delegator from a channel or alias](#remove-delegator-from-a-channel-or-alias) + - [Alias Information](#alias-information) # How to use in your app? @@ -4988,7 +5000,7 @@ const aliceUpdateEncryption = await userAlice.encryption.update( ## PushNotification Class -### **Fetch Inbox /Spam notifications** +### **Fetch Inbox Or Spam notifications** ```tsx // lists feeds @@ -5180,6 +5192,7 @@ const aliceInfo = await userAlice.notification.list(); ``` + --- ### **Fetch user subscriptions** @@ -5189,6 +5202,19 @@ const aliceInfo = await userAlice.notification.list(); const subscriptions = await userAlice.notification.subscriptions(); ``` + + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| options* | object | - | An object containing additional options for subscriptions. | +| options.account* | string | - | Account in CAIP . | +| options.page* | number | - | page of results to retrieve. | +| options.limit* | number | - | represents the maximum number of subscriptions to retrieve per page. | + +\* - Optional +
Expected response (Fetching user opted in channels / subscriptions) @@ -5230,17 +5256,6 @@ const subscriptions = await userAlice.notification.subscriptions();
-**Parameters:** - -| Parameter | Type | Default | Description | -| --- | --- | --- | --- | -| options* | object | - | An object containing additional options for subscriptions. | -| options.account* | string | - | Account in CAIP . | -| options.page* | number | - | page of results to retrieve. | -| options.limit* | number | - | represents the maximum number of subscriptions to retrieve per page. | - -\* - Optional - --- ### **Subscribe to a channel** @@ -5350,6 +5365,7 @@ const channelInfo = await userAlice.channel.info(pushChannelInCAIP) } ``` + --- ### **Search Channels** @@ -5948,6 +5964,7 @@ const createChannelRes = await userAlice.channel.create({name: channelName, desc ``` + --- ### **Update a channel's information** @@ -5981,6 +5998,7 @@ const updateChannelRes = await userAlice.channel.update({name: newChannelName, d } ``` + --- ### **Verify a channel** @@ -6004,6 +6022,7 @@ const verifyChannelRes = await userAlice.channel.verify(channelToBeVerified) } ``` + --- ### **Create channel Setting (WIP)** @@ -6084,13 +6103,14 @@ const addDelegatorRes = userAlice.channel.delegate.add(delegatorAddressInCAIP) | Note: Support for contract interaction via viem is coming soon | | | |
- Expected response (Create Channel Setting) + Expected response (Add Delegate) ```typescript { transactionHash: "0xee8055ffb8ce35268900c64a57ae28fa5f7ab56879311bb467640c0e7af79d4a" } ```
+ --- ### **Remove delegator from a channel/alias** @@ -6108,6 +6128,15 @@ const removeDelegatorRes = userAlice.channel.delegate.remove(delegatorAddressInC | delegate | string | - | delegator address in CAIP | | Note: Support for contract interaction via viem is coming soon | | | | +
+ Expected response (Remove Delegate) + +```typescript + { transactionHash: "0xee8055ffb8ce35268900c64a57ae28fa5f7ab56879311bb467640c0e7af79d4a" + } +``` +
+ --- ### **Alias Information** @@ -6122,4 +6151,18 @@ const aliasInfo = userAlice.channel.alias.info({alias: '0xABC', aliasChain:'POLY | --- | --- | --- | --- | | options | AliasOptions | - | Configuration options for retrieving alias information. | | options.alias | string | - | The alias address | -| options.aliasChain | ALIAS_CHAIN | - | The name of the alias chain, which can be 'POLYGON' or 'BSC' or 'OPTIMISM' or 'POLYGONZKEVM' | \ No newline at end of file +| options.aliasChain | ALIAS_CHAIN | - | The name of the alias chain, which can be 'POLYGON' or 'BSC' or 'OPTIMISM' or 'POLYGONZKEVM' | + +
+ Expected response (Alias Info) + +```typescript +{ + channel: '0x0A087Fb5CC25F156115c8193Ef8116b77B9421F7', + alias_address: '0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + is_alias_verified: 1, + blocked: 0, + activation_status: 1 +} +``` +
\ No newline at end of file diff --git a/packages/restapi/tests/lib/pushNotification/alias.test.ts b/packages/restapi/tests/lib/pushNotification/alias.test.ts index ae62cf864..3df9e39bc 100644 --- a/packages/restapi/tests/lib/pushNotification/alias.test.ts +++ b/packages/restapi/tests/lib/pushNotification/alias.test.ts @@ -46,7 +46,7 @@ describe('PushAPI.alias functionality', () => { alias: '0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', aliasChain: 'POLYGON', }); - // console.log(res) + console.log(res) expect(res).not.null; }); });