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

Add Bandada docs inside apps folder #427

Merged
merged 10 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ build
npm-debug.log*
yarn-debug.log*
yarn-error.log*

!apps/docs
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,8 @@ typechain
!.yarn/sdks
!.yarn/versions

*.db
*.db

# Docusaurus generated files
.docusaurus
.cache-loader
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ artifacts
typechain
typechain-types
hardhat-dependency-compiler

# Docusaurus cache and generated files
.docusaurus
.cache-loader

!apps/docs
41 changes: 41 additions & 0 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions apps/docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")]
}
4 changes: 4 additions & 0 deletions apps/docs/docs/api/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "API",
"position": 2
}
7 changes: 7 additions & 0 deletions apps/docs/docs/api/api-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_position: 1
---

# API Docs

Read the documentation of the API and try it out: [Bandada API Docs](https://api.bandada.pse.dev/).
211 changes: 211 additions & 0 deletions apps/docs/docs/api/api-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
---
sidebar_position: 2
---

import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

# API SDK

[The API SDK JavaScript package](https://github.com/privacy-scaling-explorations/bandada/tree/main/libs/api-sdk) provides a list of functions to make it easier to work with the Bandada API.

Example of project using the API SDK library: [bandada-api-sdk-demo](https://github.com/bandada-infra/bandada-sdk-demo).

## Install library

<Tabs
defaultValue="npm"
groupId="package-managers"
values={[
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
{label: 'pnpm', value: 'pnpm'}
]}>
<TabItem value="npm">

```bash
npm install @bandada/api-sdk
```

</TabItem>
<TabItem value="yarn">

```bash
yarn add @bandada/api-sdk
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm add @bandada/api-sdk
```

</TabItem>
</Tabs>

## Create a new instance

\# **new ApiSdk**(url: SupportedUrl | string, config?: object): _ApiSdk_

Creates a new instance of ApiSdk using the API URL and the [config](https://axios-http.com/docs/req_config).

- Creates a new instance using the production Bandada API URL and the default config.

This is what you need if you are using the production Bandada API.

```ts
import { ApiSdk } from "@bandada/api-sdk"

const apiSdk = new ApiSdk()
```

- Creates a new instance using a [Supported URL](https://github.com/privacy-scaling-explorations/bandada/blob/main/libs/api-sdk/src/types/index.ts#L43).

This is useful when working with the development environment.

```ts
import { ApiSdk, SupportedUrl } from "@bandada/api-sdk"

const apiSdk = new ApiSdk(SupportedUrl.DEV)
```

- Creates a new instance using a custom API URL.

```ts
import { ApiSdk } from "@bandada/api-sdk"

const apiSdk = new ApiSdk("https://example.com/api")
```

- Creates a new instance using a custom API URL and config.

```ts
import { ApiSdk } from "@bandada/api-sdk"

const url = "https://example.com/api"
const config = {
headers: {
"Content-Type": "text/html"
}
}
const apiSdk = new ApiSdk(url, config)
```

## Get groups

\# **getGroups**(): _Promise\<GroupResponse[]>_

Returns the list of groups.

```ts
const groups = await apiSdk.getGroups()
```

## Get group

\# **getGroup**(): _Promise\<GroupResponse>_

Returns a specific group.

```ts
const groupId = "10402173435763029700781503965100"

const group = await apiSdk.getGroup(groupId)
```

## Is group member

\# **isGroupMember**(): _Promise\<boolean>_

Returns true if the member is in the group and false otherwise.

```ts
const groupId = "10402173435763029700781503965100"
const memberId = "1"

const isMember = await apiSdk.isGroupMember(groupId, memberId)
```

## Generate merkle proof

\# **generateMerkleProof**(): _Promise\<string>_

Returns the Merkle Proof for a member in a group.

```ts
const groupId = "10402173435763029700781503965100"
const memberId = "1"

const proof = await apiSdk.generateMerkleProof(groupId, memberId)
```

## Add member using an API Key

\# **addMemberByApiKey**(): _Promise\<void>_

Adds a member to a group using an API Key.

```ts
const groupId = "10402173435763029700781503965100"
const memberId = "1"
const apiKey = "70f07d0d-6aa2-4fe1-b4b9-06c271a641dc"

await apiSdk.addMemberByApiKey(groupId, memberId, apiKey)
```

## Add members using an API Key

\# **addMembersByApiKey**(): _Promise\<void>_

Adds multiple members to a group using an API Key.

```ts
const groupId = "10402173435763029700781503965100"
const memberIds = ["1", "2", "3"]
const apiKey = "70f07d0d-6aa2-4fe1-b4b9-06c271a641dc"

await apiSdk.addMembersByApiKey(groupId, memberIds, apiKey)
```

## Add member using an invite code

\# **addMemberByInviteCode**(): _Promise\<void>_

Adds a member to a group using an Invite Code.

```ts
const groupId = "10402173435763029700781503965100"
const memberId = "1"
const inviteCode = "MQYS4UR5"

await apiSdk.addMemberByInviteCode(groupId, memberId, inviteCode)
```

## Remove member using an API Key

\# **removeMemberByApiKey**(): _Promise\<void>_

Removes a member from a group using an API Key.

```ts
const groupId = "10402173435763029700781503965100"
const memberId = "1"
const apiKey = "70f07d0d-6aa2-4fe1-b4b9-06c271a641dc"

await apiSdk.removeMemberByApiKey(groupId, memberId, apiKey)
```

## Remove members using an API Key

\# **removeMembersByApiKey**(): _Promise\<void>_

Removes multiple members from a group using an API Key.

```ts
const groupId = "10402173435763029700781503965100"
const memberIds = ["1", "2", "3"]
const apiKey = "70f07d0d-6aa2-4fe1-b4b9-06c271a641dc"

await apiSdk.removeMembersByApiKey(groupId, memberIds, apiKey)
```
5 changes: 5 additions & 0 deletions apps/docs/docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 3
---

# FAQ
7 changes: 7 additions & 0 deletions apps/docs/docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_position: 1
slug: /
---

# What is Bandada?

16 changes: 16 additions & 0 deletions apps/docs/docs/resources.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
sidebar_position: 4
---

import RenderArticles from "../src/components/RenderArticles"
import RenderVideos from "../src/components/RenderVideos"

# Resources

## Articles

<RenderArticles/>

## Videos

<RenderVideos/>
Loading
Loading