Skip to content

Commit

Permalink
Merge pull request #5 from defactor-com/feat/api-docs
Browse files Browse the repository at this point in the history
Created api docs first version
  • Loading branch information
xavier506 committed Dec 13, 2023
2 parents d5cbc02 + ec1ada0 commit 0963b4c
Show file tree
Hide file tree
Showing 20 changed files with 330 additions and 80 deletions.
8 changes: 8 additions & 0 deletions docs/api/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "API",
"position": 1,
"link": {
"type": "generated-index",
"description": "Discover the power of Defactor’s API. Our robust and user-friendly API allows you to integrate Defactor into your own applications and services. With detailed documentation and code examples, we help you get started quickly. Explore our guides and resources to make the most of Defactor’s API."
}
}
24 changes: 24 additions & 0 deletions docs/api/addKycWallet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
sidebar_position: 8
---

# Add Kyc Wallet

**Endpoint**: `/addKycWallet`

**HTTP Method**: `POST`

**Params**:
``` json
{
"id": "id",
"wallet": "0xd198...ce351",
"signature": "signature"
}
```

## Description

This endpoint allows you to add a KYC (Know Your Customer) wallet.

## Response
17 changes: 17 additions & 0 deletions docs/api/circulatingSupply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_position: 6
---

# Circulating Supply

**Endpoint**: `/circulatingSupply`

**HTTP Method**: `GET`

## Description

This endpoint makes an HTTP GET request to retrieve the circulating supply. The request does not include a request body.

## Response

Upon the last execution, the server responded with a status code of 200 and the circulating supply value of 111083061.0.
25 changes: 25 additions & 0 deletions docs/api/getKyc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sidebar_position: 4
---

# Get Kyc

**Endpoint**: `/getKyc`

**HTTP Method**: `GET`

**Params**: `wallet=0xd198...ce351`

## Description

This endpoint makes an HTTP GET request to retrieve Know Your Customer (KYC) information for a specific wallet. The wallet parameter in the query string should be provided to specify the wallet for which the KYC information is being requested.

## Response

Upon a successful execution, the endpoint returns a status code of 200 along with an empty JSON response.

``` json
{
"wallet": ""
}
```
33 changes: 33 additions & 0 deletions docs/api/getProposalDetails.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
sidebar_position: 3
---

# Get Proposal Details

**Endpoint**: `/getProposalDetails/{proposalID}`

**HTTP Method**: `GET`

## Description

This endpoint retrieves the details of a specific proposal identified by its unique ID.
The request does not require a request body.

## Response

The response will have a status code of 200 and will include the details of the proposal in the following format:

``` json
{
"proposal": {
"id": "",
"index": 0,
"title": "",
"description": "",
"closedDate": "",
"votesFor": 0,
"votesAgainst": 0,
"status": ""
}
}
```
25 changes: 25 additions & 0 deletions docs/api/initiateUpload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sidebar_position: 9
---

# Initiate Upload

**Endpoint**: `/initiateUpload`

**HTTP Method**: `POST`

**Params**:
``` json
{
"format": "mp3"
}
```

## Description

This endpoint initiates an upload process by sending an HTTP POST request to the specified URL.
The request should include a payload in raw format with a "format" parameter.

## Response

Upon successful execution, the response will have a status code of 200 and will include a "url" parameter indicating the location for the upload.
29 changes: 29 additions & 0 deletions docs/api/insertPool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
sidebar_position: 10
---

# Insert Pool

**Endpoint**: `/insertPool`

**HTTP Method**: `POST`

**Params**:
``` json
{
"poolId": "",
"name": "",
"description": "",
"image": "",
"website": "",
"twitter": "",
"collateralTokens": [],
"chain": ""
}
```

## Description

The request should include a payload in the raw request body type with parameters such as poolId, name, description, image, website, twitter, collateralTokens, and chain.

## Response
27 changes: 27 additions & 0 deletions docs/api/insertUserVote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
sidebar_position: 10
---

# Insert User Vote

**Endpoint**: `/insertUserVote`

**HTTP Method**: `POST`

**Params**:
``` json
{
"votingId": "64ad3c1fc1d8dec244b69b9f",
"wallet": "0xd198...ce351",
"chain": "Ethereum",
"vote": true,
"signature": "signature",
"signedTimestamp": 100000000
}
```

## Description

This endpoint allows you to insert a user's vote.

## Response
22 changes: 22 additions & 0 deletions docs/api/listPools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
sidebar_position: 5
---

# List Pools

**Endpoint**: `/listPools`

**HTTP Method**: `GET`

**Params**:
- `poolIds=pool id`
- `chain=Ethereum`

## Description

This endpoint makes an HTTP GET request to fetch a list of pools based on the provided pool IDs and chain. The request should include the query parameters "poolIds" and "chain" to specify the pool IDs and the blockchain network, respectively.
The request body for this endpoint is undefined and should be left empty.

## Response

The response to this request will have a status code of 200, and it will return an empty array "[]" containing the list of pools that match the specified pool IDs and chain.
26 changes: 26 additions & 0 deletions docs/api/listProposals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
sidebar_position: 1
---

# List Proposals

**Endpoint**: `/listProposals`

**HTTP Method**: `GET`

## Description

This endpoint makes an HTTP GET request to retrieve a list of proposals. The request does not contain a request body.

## Response

The response returns a status code of 200 along with an array of objects, each representing a proposal. Each proposal object includes the following properties:

- id (string): The unique identifier of the proposal.
- index (number): The index of the proposal.
- title (string): The title of the proposal.
- description (string): The description of the proposal.
- closedDate (string): The date when the proposal was closed.
- votesFor (number): The number of votes in favor of the proposal.
- votesAgainst (number): The number of votes against the proposal.
- status (string): The status of the proposal.
19 changes: 19 additions & 0 deletions docs/api/listVotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
sidebar_position: 2
---

# List Votes

**Endpoint**: `/listVotes/{proposalID}`

**HTTP Method**: `GET`

## Description

This endpoint makes an HTTP GET request to retrieve a list of votes associated with the provided ID. The request does not include a request body.

## Response

The response to the last execution of this request had a status code of 200, and it returned a JSON object containing an array of "votes" along with a "count" of the total number of votes.

The "votes" array includes objects with properties such as "_id", "voting", "wallet", "chain", "vote", "signature", "signedTimestamp", "createdAt", "updatedAt", "__v", and "value".
22 changes: 22 additions & 0 deletions docs/api/startKyc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
sidebar_position: 7
---

# Start Kyc

**Endpoint**: `/startKyc`

**HTTP Method**: `POST`

**Params**:
``` json
{
"wallet": "0xd198...ce351"
}
```

## Description

This endpoint is used to initiate the KYC (Know Your Customer) process.

## Response
47 changes: 0 additions & 47 deletions docs/intro.md

This file was deleted.

6 changes: 3 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ const config = {
navbar: {
title: '',
logo: {
alt: 'Defactor',
alt: 'Defactor logo',
src: 'img/Defactor-Logo-Dark.svg',
srcDark: 'img/Defactor-Logo-Light.svg'
},
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
sidebarId: 'docSidebar',
position: 'left',
label: 'Tutorial',
label: 'Docs',
},
{to: '/blog', label: 'Blog', position: 'left'},
{
Expand Down
2 changes: 1 addition & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
docSidebar: [{type: 'autogenerated', dirName: '.'}],

// But you can create a sidebar manually
/*
Expand Down
Loading

0 comments on commit 0963b4c

Please sign in to comment.