diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..704a6c02e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +node_modules/ +.nvmrc +.next/ + +k8s/ + +.git/ +.gitignore +.gitmodules + +.idea/ +.vscode/ + +Dockerfile +.dockerignore + +README.md +LICENSE + +.eslintrc.json +next-env.d.ts diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..97d817a4c --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +BACKEND_URL= +NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID= +NEXT_PUBLIC_ALGOLIA_APP_ID= +NEXT_PUBLIC_ALGOLIA_API_KEY= +NEXT_PUBLIC_ALGOLIA_INDEX= +NEWSLETTER_BASE_URL= diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..57abb6e98 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +tailwind.config.js +postcss.config.js +_app.js +next.config.js +index-data-to-algolia.js \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 000000000..be1570fff --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,31 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + settings: { + react: { + version: "detect", + }, + }, + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended", + "plugin:unicorn/recommended", + ], + parser: "@typescript-eslint/parser", + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: "latest", + sourceType: "module", + }, + plugins: ["react", "@typescript-eslint", "unicorn"], + rules: { + "unicorn/no-useless-undefined": ["error", { checkArguments: false }], + "unicorn/prevent-abbreviations": "off", + "unicorn/no-null": "off", + }, +}; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..deda46464 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: + - master + + pull_request: + branches: + - master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + - uses: pnpm/action-setup@v2 + with: + version: 8.6.10 + + - name: Dependencies + run: | + pnpm install + + - name: Build + run: | + pnpm run build + + - name: Lint + run: | + pnpm run lint + + - name: Formatting + run: | + pnpm run fmt:check diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml new file mode 100644 index 000000000..11afdab88 --- /dev/null +++ b/.github/workflows/deploy-production.yml @@ -0,0 +1,61 @@ +name: Deploy Production + +on: + push: + branches: + - release/production + +jobs: + build: + name: Build Images + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Gcloud Auth + uses: google-github-actions/auth@v1 + with: + credentials_json: "${{ secrets.ORG_PRODUCTION_IMAGES_PUSH }}" + + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + + - name: Set Image Tag + id: lookup + run: echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - run: | + gcloud auth list + gcloud auth configure-docker -q + echo "VERSION: ${{ steps.lookup.outputs.version }}" + + - name: Build and Push Images + run: | + ./k8s/build-img.py -p production + env: + BACKEND_URL: ${{ secrets.NEXT_PUBLIC_BACKEND_URL }} + NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID }} + NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }} + NEXT_PUBLIC_ALGOLIA_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_API_KEY }} + NEXT_PUBLIC_ALGOLIA_INDEX: ${{ secrets.NEXT_PUBLIC_ALGOLIA_INDEX }} + NEWSLETTER_BASE_URL: ${{ secrets.NEWSLETTER_BASE_URL }} + SENDER_TOKEN: ${{ secrets.SENDER_TOKEN }} + + - name: Trigger Image Update + run: | + curl -H "Accept: application/vnd.github.everest-preview+json" \ + -H "Authorization: token ${{ secrets.ORG_DISPATCH_RENDER_TOKEN }}" \ + --request POST \ + --data '{"event_type": "docs-build", "client_payload": {"image": "${{ env.IMAGE }}", "image_path": "${{ env.IMAGE_PATH }}", "key_path": "${{ env.KEY_PATH }}", "tag": "${{ env.TAG }}", "commit_message_service": "${{ env.SERVICE_NAME }}"}}' \ + ${{ env.TARGET_REPO }} + env: + IMAGE: gcr.io/fetch-ai-images/docs-website + KEY_PATH: ".website.image.tag" + TAG: ${{ steps.lookup.outputs.version }} + IMAGE_PATH: values + SERVICE_NAME: Documentation + TARGET_REPO: https://api.github.com/repos/fetchai/infra-production-deployment/dispatches diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml new file mode 100644 index 000000000..f401d162c --- /dev/null +++ b/.github/workflows/deploy-staging.yml @@ -0,0 +1,95 @@ +name: Deploy Staging + +on: + push: + branches: + - master + +jobs: + build: + name: Build Images + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Gcloud Auth + uses: google-github-actions/auth@v1 + with: + credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}" + + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + + - name: Set Image Tag + id: lookup + run: echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - run: | + gcloud auth list + gcloud auth configure-docker -q + echo "VERSION: ${{ steps.lookup.outputs.version }}" + + - name: Build and Push Images + run: | + ./k8s/build-img.py -p staging + env: + BACKEND_URL: ${{ secrets.STAGING_NEXT_PUBLIC_BACKEND_URL }} + NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID }} + NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }} + NEXT_PUBLIC_ALGOLIA_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_API_KEY }} + NEXT_PUBLIC_ALGOLIA_INDEX: ${{ secrets.NEXT_PUBLIC_ALGOLIA_INDEX }} + NEWSLETTER_BASE_URL: ${{ secrets.NEWSLETTER_BASE_URL }} + SENDER_TOKEN: ${{ secrets.SENDER_TOKEN }} + + deploy: + name: Deployment + runs-on: ubuntu-latest + + needs: + - build + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Gcloud Auth + uses: google-github-actions/auth@v1 + with: + credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}" + + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + + - name: Set Image Tag + id: lookup + run: echo "version=$(git describe --always --dirty=-wip)" >> $GITHUB_OUTPUT + + - name: Turnstyle + uses: softprops/turnstyle@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy to Staging + env: + IMAGE_TAG: ${{ steps.lookup.outputs.version }} + HELM_NAME: staging + NAMESPACE: docs-staging + GKE_PROJECT: fetch-ai-sandbox + GKE_CLUSTER: london-b + GKE_ZONE: europe-west2-b + + run: | + gcloud components install gke-gcloud-auth-plugin + gcloud container clusters get-credentials $GKE_CLUSTER \ + --zone $GKE_ZONE \ + --project $GKE_PROJECT + helm upgrade --install --wait --timeout 300s $HELM_NAME \ + ./k8s/docs/ \ + --set-string website.image.tag=$IMAGE_TAG \ + -n $NAMESPACE diff --git a/.github/workflows/ephemeral-delete.yaml b/.github/workflows/ephemeral-delete.yaml new file mode 100644 index 000000000..43ace2c1d --- /dev/null +++ b/.github/workflows/ephemeral-delete.yaml @@ -0,0 +1,50 @@ +name: Clean Ephemeral Deployment + +on: + pull_request: + types: + - closed + +jobs: + clean-deployment: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Gcloud Auth + uses: google-github-actions/auth@v1 + with: + credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}" + + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + + - name: Set Image Tag + id: lookup + run: echo "version=$(git describe --always --dirty=-wip)" >> $GITHUB_OUTPUT + + - name: Turnstyle + uses: softprops/turnstyle@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Uninstall Deployment + env: + HELM_NAME: ephemeral-${{ github.event.pull_request.number }} + NAMESPACE: docs-staging + GKE_PROJECT: fetch-ai-sandbox + GKE_CLUSTER: london-b + GKE_ZONE: europe-west2-b + PR_NUMBER: ${{ github.event.pull_request.number }} + HELM_NAME_INGRESS: ephemeral-ingress-${{ github.event.pull_request.number }} + + run: | + gcloud components install gke-gcloud-auth-plugin + gcloud container clusters get-credentials $GKE_CLUSTER \ + --zone $GKE_ZONE \ + --project $GKE_PROJECT + helm uninstall $HELM_NAME -n $NAMESPACE diff --git a/.github/workflows/ephemeral-deploy.yaml b/.github/workflows/ephemeral-deploy.yaml new file mode 100644 index 000000000..032be3537 --- /dev/null +++ b/.github/workflows/ephemeral-deploy.yaml @@ -0,0 +1,103 @@ +name: Ephemeral (Testing) Deployment + +on: + pull_request: + types: + - opened + - reopened + - synchronize + +jobs: + build: + name: Build Images + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Gcloud Auth + uses: google-github-actions/auth@v1 + with: + credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}" + + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + + - name: Set Image Tag + id: lookup + run: echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - run: | + gcloud auth list + gcloud auth configure-docker -q + echo "VERSION: ${{ steps.lookup.outputs.version }}" + + - name: Build and Push Images + run: ./k8s/build-img.py -p staging + env: + BACKEND_URL: ${{ secrets.STAGING_NEXT_PUBLIC_BACKEND_URL }} + NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID }} + NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }} + NEXT_PUBLIC_ALGOLIA_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_API_KEY }} + NEXT_PUBLIC_ALGOLIA_INDEX: ${{ secrets.NEXT_PUBLIC_ALGOLIA_INDEX }} + NEWSLETTER_BASE_URL: ${{ secrets.NEWSLETTER_BASE_URL }} + SENDER_TOKEN: ${{ secrets.SENDER_TOKEN }} + + deploy: + name: Ephermeral Deployment + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Gcloud Auth + uses: google-github-actions/auth@v1 + with: + credentials_json: "${{ secrets.ORG_SANDBOX_DEPLOYMENT_KEY }}" + + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + + - name: Set Image Tag + id: lookup + run: echo "version=$(git describe --always --dirty=-wip)" >> $GITHUB_OUTPUT + + - name: Turnstyle + uses: softprops/turnstyle@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy to Staging + env: + IMAGE_TAG: ${{ steps.lookup.outputs.version }} + HELM_NAME: ephemeral-${{ github.event.pull_request.number }} + NAMESPACE: docs-staging + GKE_PROJECT: fetch-ai-sandbox + GKE_CLUSTER: london-b + GKE_ZONE: europe-west2-b + PR_NUMBER: ${{ github.event.pull_request.number }} + DNS: docs-ephemeral-${{ github.event.pull_request.number }}.sandbox-london-b.fetch-ai.com + CERT: docs-ephemeral-${{ github.event.pull_request.number }} + CERT_NAME: docs-ephemeral-cert-${{ github.event.pull_request.number }} + EPHEMERAL: true + run: | + gcloud components install gke-gcloud-auth-plugin + gcloud container clusters get-credentials $GKE_CLUSTER \ + --zone $GKE_ZONE \ + --project $GKE_PROJECT + helm upgrade --install --wait --timeout 300s $HELM_NAME \ + ./k8s/docs/ \ + --set-string website.image.tag=$IMAGE_TAG \ + --set-string prVersion=${{ github.event.pull_request.number }} \ + -n $NAMESPACE \ + --set-string dns.name=$DNS \ + --set-string tls.cert=$CERT \ + --set-string tls.certName=$CERT_NAME \ + --set dns.additionalHosts=null \ diff --git a/.github/workflows/pr-title-linting.yml b/.github/workflows/pr-title-linting.yml new file mode 100644 index 000000000..a353a45ef --- /dev/null +++ b/.github/workflows/pr-title-linting.yml @@ -0,0 +1,43 @@ +name: Lint PR Title + +on: + pull_request_target: + types: + - opened + - editedgit + - synchronize + +jobs: + main: + name: PR Title Checks + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Optionally, you can provide options for further constraints. + with: + # Configure which types are allowed. + # Default: https://github.com/commitizen/conventional-commit-types + types: | + chore + content + fix + refactor + feat + test + # Configure which scopes are allowed. + scopes: | + docs + theme + deps + misc + # Configure that a scope must always be provided. + requireScope: true + # For work-in-progress PRs you can typically use draft pull requests + # from Github. However, private repositories on the free plan don't have + # this option and therefore this action allows you to opt-in to using the + # special "[WIP]" prefix to indicate this state. This will avoid the + # validation of the PR title and the pull request checks remain pending. + # Note that a second check will be reported if this is enabled. + wip: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d5f094322 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.next +node_modules +.DS_Store +.idea/ +.env +.history/ +.env.local diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..e69de29bb diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..aacb51810 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18.17 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..2cdd65931 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +pnpm-lock.yaml +**/*.mdx diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..7b053d4f2 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,77 @@ +# Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at _developer@fetch.ai_. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of actions. + +**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the , version 2.1, available at . + +Community Impact Guidelines were inspired by [Mozilla’s code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +For answers to common questions about this code of conduct, see the FAQ at: . Translations are available at . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..08fcfc01c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,167 @@ +# Contribution Guidelines + +Contributions to this repository are welcome. As a contributor, here are the guidelines we would like you to follow: + +- [Code of Conduct](#coc) +- [Question or Problem?](#question) +- [Issues and Bugs](#issue) +- [Feature Requests](#feature) +- [Submission Guidelines](#submit) +- [Coding Rules](#rules) +- [Commit Message Convention](#commit) +- [Merging Pull Requests](#merge) + +## Code of Conduct + + + +Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md). + + + +## Question or Problem? + + + +Please use [GitHub Discussions](https://github.com/fetchai/uAgents/discussions) for support related questions and general discussions. Do NOT open issues as they are for bug reports and feature requests. This is because: + + + +- Questions and answers stay available for public viewing so your question/answer might help someone else. +- GitHub Discussions voting system ensures the best answers are prominently visible. + +## Found a Bug? + +If you find a bug in the source code [submit a bug report issue](#submit-issue). +Even better, you can [submit a Pull Request](#submit-pr) with a fix. + +## Missing a Feature? + +You can _request_ a new feature by [submitting a feature request issue](#submit-issue). +If you would like to _implement_ a new feature: + +- For a **Major Feature**, first [open an issue](#submit-issue) and outline your proposal so that it can be discussed. +- **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr). + +## Submission Guidelines + +### Submitting an Issue + + + +Before you submit an issue, please search the [issue tracker](https://github.com/fetchai/uAgents/issues). An issue for your problem might already exist and the discussion might inform you of workarounds readily available. + +For bug reports, it is important that we can reproduce and confirm it. For this, we need you to provide a minimal reproduction instruction (this is part of the bug report issue template). + +You can file new issues by selecting from our [new issue templates](https://github.com/fetchai/uAgents/issues/new/choose) and filling out the issue template. + + + +### Submitting a Pull Request (PR) + +Before you submit your Pull Request (PR) consider the following guidelines: + +1. All Pull Requests should be based off of and opened against the `main` branch. + + + +2. Search [Existing PRs](https://github.com/fetchai/uAgents/pulls) for an open or closed PR that relates to your submission. + You don't want to duplicate existing efforts. + + +3. Be sure that an issue exists describing the problem you're fixing, or the design for the feature you'd like to add. + + + +4. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the [repository](https://github.com/fetchai/uAgents). + + +5. In your forked repository, make your changes in a new git branch created off of the `main` branch. + +6. Make your changes, **including test cases and documentation updates where appropriate**. + +7. Follow our [coding rules](#rules). + + + +8. Run all tests and checks locally, as described in the [development guide](DEVELOPING.md), and ensure they pass. This saves CI hours and ensures you only commit clean code. + + +9. Commit your changes using a descriptive commit message that follows our [commit message conventions](#commit). + +10. Push your branch to GitHub. + +11. In GitHub, send a pull request to `fetchai:main`. + +#### Reviewing a Pull Request + + + +The repository maintainers reserve the right not to accept pull requests from community members who haven't been good citizens of the community. Such behavior includes not following our [code of conduct](CODE_OF_CONDUCT.md) and applies within or outside the managed channels. + + + +When you contribute a new feature, the maintenance burden is transferred to the core team. This means that the benefit of the contribution must be compared against the cost of maintaining the feature. + +#### Addressing review feedback + +If we ask for changes via code reviews then: + +1. Make the required updates to the code. + +2. Re-run the tests and checks to ensure they are still passing. + +3. Create a new commit and push to your GitHub repository (this will update your Pull Request). + +#### After your pull request is merged + +After your pull request is merged, you can safely delete your branch and pull the changes from the (upstream) repository. + +## Coding Rules + +To ensure consistency throughout the source code, keep these rules in mind as you are working: + + + +- All code must pass our code quality checks (linters, formatters, etc). See the [development guide](DEVELOPING.md) section for more detail. + + +- All features **must be tested** via unit-tests and if applicable integration-tests. Bug fixes also require tests, because the presence of bugs usually indicates insufficient test coverage. Tests help to: + + 1. Prove that your code works correctly, and + 2. Guard against future breaking changes and lower the maintenance cost. + +- All public features **must be documented**. +- Keep API compatibility in mind when you change any code. Above version `1.0.0`, breaking changes can happen across versions with different left digit. Below version `1.0.0`, they can happen across versions with different middle digit. Reviewers of your pull request will comment on any API compatibility issues. + +## Commit Message Convention + +This project uses Conventional Commits to generate release notes and to determine versioning. Please follow the [Conventional Commits v1.0.0](https://www.conventionalcommits.org/en/v1.0.0/). The commit types must be one of the following: + +- **chore**: Commits that don't directly add features, fix bugs, or refactor code, but rather maintain the project or its surrounding processes. +- **ci**: Changes to our CI configuration files and scripts +- **docs**: Changes to the documentation +- **feat**: A new feature +- **fix**: A bug fix +- **refactor**: A code change that neither fixes a bug nor adds a feature +- **test**: Adding missing tests or correcting existing tests +- **revert**: Reverts a previous commit that introduced an issue or unintended change. This essentially undoes a previous commit. +- **style**: Changes that only affect code formatting or style, without affecting functionality. This ensures consistency and readability of the codebase. +- **perf**: Changes that improve the performance of the project. + +Commit messages should adhere to this standard and be of the form: + + ```bash + git commit -m "feat: add new feature x" + git commit -m "fix: fix bug in feature x" + git commit -m "docs: add documentation for feature x" + git commit -m "test: add test suite for feature x" + ``` + +Further details on `conventional commits` can be found [here](https://www.conventionalcommits.org/en/v1.0.0/). + +## Merging Pull Requests + +When merging a branch, PRs should be squashed into one conventional commit by selecting the `Squash and merge` option. This ensures Release notes are useful and readable when releases are created. + +See [Merge strategies](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits) from the official GitHub documentation. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..d03607e29 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM node:18-alpine + +ARG BACKEND_URL="" +ARG NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID="" +ARG NEXT_PUBLIC_ALGOLIA_APP_ID="" +ARG NEXT_PUBLIC_ALGOLIA_API_KEY="" +ARG NEXT_PUBLIC_ALGOLIA_INDEX="" +ARG NEWSLETTER_BASE_URL="" +ARG SENDER_TOKEN="" + +RUN apk add tree && corepack prepare pnpm@8.6.10 --activate && corepack enable + +WORKDIR /app +ADD package.json pnpm-lock.yaml /app/ + +RUN pnpm install --frozen-lockfile + +COPY . /app + +ENV NODE_ENV="production" + +RUN echo BACKEND_URL="${BACKEND_URL}" > .env.local && \ + echo SENDER_TOKEN="${SENDER_TOKEN}" > .env.local && \ + echo NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID="${NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID}" >> .env.local && \ + echo NEXT_PUBLIC_ALGOLIA_APP_ID="${NEXT_PUBLIC_ALGOLIA_APP_ID}" >> .env.local && \ + echo NEXT_PUBLIC_ALGOLIA_API_KEY="${NEXT_PUBLIC_ALGOLIA_API_KEY}" >> .env.local && \ + echo NEXT_PUBLIC_ALGOLIA_INDEX="${NEXT_PUBLIC_ALGOLIA_INDEX}" >> .env.local && \ + echo NEWSLETTER_BASE_URL="${NEWSLETTER_BASE_URL}" >> .env.local && \ + pnpm build + +ENTRYPOINT ["pnpm"] +CMD ["start"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..d5efd6a59 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 000000000..f261926ab --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Fetch.ai Documentation Repo + +Welcome to the code repository for websites and contents of fetch.ai/docs. + +## Updating docs + +We welcome PRs from all members of our community, and details and formats of this can be seen in our [Code of Conduct](CODE_OF_CONDUCT.md). + +## Developing + +### Install dependencies + +```bash +pnpm install +``` + +### Run Development Server + +```bash +pnpm dev +``` + +The site is then visible at: + +http://127.0.0.1:3000/docs + +## Contributing + +We welcome contributions from the community! Please see our Contributing Guide for information on how to get involved. Whether you're fixing bugs, adding new features, or improving documentation, your help is appreciated. + +## Support + +If you need help or have any questions, please post a discussion or join our community on [Discord](https://discord.com/invite/fetchai). + +## License + +The uAgents library is licensed under the APACHE License. For more details, see the [LICENSE](LICENSE) file. diff --git a/build-img.py b/build-img.py new file mode 100755 index 000000000..f245f3cb9 --- /dev/null +++ b/build-img.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +import os +import sys +import subprocess +import argparse + + +PROFILES = { + 'staging': { + 'repository': 'gcr.io/fetch-ai-sandbox/docs-website', + }, + 'production': { + 'repository': 'gcr.io/fetch-ai-images/docs-website', + }, +} + +PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +BUILD_ENV_VARS = ( + 'BACKEND_URL', + 'NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID', + 'NEXT_PUBLIC_ALGOLIA_APP_ID', + 'NEXT_PUBLIC_ALGOLIA_API_KEY', + 'NEXT_PUBLIC_ALGOLIA_INDEX', + 'NEWSLETTER_BASE_URL', + 'SENDER_TOKEN' +) + +def _profile(text: str) -> str: + if text not in PROFILES: + available_profiles = ', '.join(PROFILES.keys()) + print(f'Invalid profile {text}. Please select one of [{available_profiles}]') + sys.exit(1) + + return text + + +def parse_commandline() -> argparse.Namespace: + parser = argparse.ArgumentParser() + parser.add_argument('-p', '--profile', type=_profile, default='staging', help='The profile to use') + parser.add_argument('-n', '--no-push', dest='push', action='store_false', help='Disable pusing of the image') + parser.add_argument('-f', '--force-build', action='store_true', help=argparse.SUPPRESS) + return parser.parse_args() + + +def detect_local_modifications() -> bool: + exit_code = subprocess.call(['git', 'diff-index', '--quiet', 'HEAD']) + return exit_code != 0 + + +def get_version() -> str: + return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip() + + +def main(): + args = parse_commandline() + + # argument validation / augmentation + push = args.push + if detect_local_modifications(): + if args.force_build: + push = False + print('Disabling push of images due to local modifications') + else: + print('Detected local modifications. Please commit and try again') + sys.exit(1) + + # lookup the required information + version = get_version() + repository = PROFILES[args.profile]['repository'] + + image_url = f'{repository}:{version}' + + print() + print(f'Project root: {PROJECT_ROOT}') + print(f'Profile.....: {args.profile}') + print(f'Image Ref...: {image_url}') + print(f'Push........: {push}') + print() + + # Step 0. Collect up the build environment variables + build_args = [] + for env_name in BUILD_ENV_VARS: + if env_name not in os.environ: + print('Missing build variable', env_name) + sys.exit(1) + + build_args.append(f'--build-arg={env_name}={os.environ[env_name]}') + + # Step 1. Build the image + cmd = [ + 'docker', + 'build', + ] + build_args + [ + '--platform', 'linux/amd64', + '-t', image_url, + PROJECT_ROOT, + ] + subprocess.check_call(cmd) + + # Step 2. Push the image + if push: + subprocess.check_call([ + 'docker', + 'push', + image_url, + ]) + + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/components/api-endpoint.tsx b/components/api-endpoint.tsx new file mode 100644 index 000000000..a961260e2 --- /dev/null +++ b/components/api-endpoint.tsx @@ -0,0 +1,589 @@ +import { Code, Pre } from "nextra/components"; +import React, { useState } from "react"; +import { + ApiIntro, + Col, + Properties, + Property, + Row, + Tab, + DropDownTabs, +} from "./mdx"; +import Tooltip from "./tooltip"; +import Link from "next/link"; + +interface PropertyType { + name: string; + type: string; + description: string; + required?: boolean; +} + +// Helper function to replace path parameters in the URL +const replacePathParameters = ( + path: string, + pathParameters: Record = {}, +) => { + let updatedPath = path; + for (const param in pathParameters) { + updatedPath = updatedPath.replace(`{${param}}`, pathParameters[param]); + } + return updatedPath; +}; + +const PythonCodeTab: React.FC<{ + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; + url: string; + samplePayload?: unknown; + pathParameters?: Record; +}> = ({ method, url, samplePayload, pathParameters }) => { + let code = ``; + let actualUrl = url; + // Replace path parameters in the URL + for (const param in pathParameters) { + actualUrl = actualUrl.replace(`{${param}}`, `{pathParameters.${param}}`); + } + code = samplePayload + ? `\ +import requests + +data = ${JSON.stringify(samplePayload, undefined, 4)} + +${ + pathParameters + ? `pathParameters = ${JSON.stringify(pathParameters, undefined, 4)}` + : `` +} + +requests.${method.toLowerCase()}("${actualUrl}", json=data, headers={ + "Authorization": "bearer " +} + ` + : `\ +import requests + +${ + pathParameters + ? `pathParameters = ${JSON.stringify(pathParameters, undefined, 4)}` + : `` +} + +requests.${method.toLowerCase()}("${actualUrl}",, headers={ + "Authorization": "bearer " +} + `; + + return ( +
+      
+        {code}
+      
+    
+ ); +}; + +const JavascriptCodeTab: React.FC<{ + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; + url: string; + samplePayload?: unknown; + pathParameters?: Record; +}> = ({ method, url, samplePayload, pathParameters }) => { + let code = ``; + let actualUrl = url; + // Replace path parameters in the URL + for (const param in pathParameters) { + actualUrl = actualUrl.replace(`{${param}}`, `{pathParameters.${param}}`); + } + code = samplePayload + ? `\ +body = ${JSON.stringify(samplePayload, undefined, 4)} +${ + pathParameters + ? `pathParameters = ${JSON.stringify(pathParameters, undefined, 4)}` + : `` +} + +await fetch("${actualUrl}", { + method: ${method.toLowerCase()}, + headers: { + Authorization: Bearer + }, + body +})` + : `\ +${ + pathParameters + ? `pathParameters = ${JSON.stringify(pathParameters, undefined, 4)}` + : `` +} + +await fetch("${actualUrl}", { + method: ${method.toLowerCase()}, + headers: { + Authorization: Bearer + } +})`; + + return ( +
+      
+        {code}
+      
+    
+ ); +}; + +const CurlCodeTab: React.FC<{ + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; + url: string; + samplePayload?: unknown; + isBearerTokenRequired?: boolean; +}> = ({ method, url, samplePayload, isBearerTokenRequired }) => { + let code = `\ +curl \\ +-X ${method} \\ +${ + isBearerTokenRequired ? `-H Authorization: bearer \\\n` : "" +}${url}`; + + if (samplePayload) { + code += ` \\\n -d '${JSON.stringify(samplePayload)}'`; + } + + return ( +
+      {code.split("\n").map((line) => {
+        return (
+          <>
+            {line}
+            
+ + ); + })} +
+ ); +}; + +const JsonCodeTab: React.FC<{ + samplePayload: unknown; +}> = ({ samplePayload }) => { + const formattedJson = JSON.stringify(samplePayload, undefined, 2); + + return ( +
+      {formattedJson}
+    
+ ); +}; + +export const ApiResponses: React.FC<{ + description?: string; + samplePayload: unknown; + properties?: PropertyType[]; +}> = (properties) => { + return ( + <> + +

+ Responses +

+
+ + + {properties.description ? ( + {properties.description} + ) : undefined} + + {properties.properties && properties.properties.length > 0 ? ( + + {properties.properties.map((property) => { + return ( + + {property.description} + + ); + })} + + ) : undefined} + + + + + + + + + + + ); +}; + +export const ApiRequest: React.FC<{ + apiUrl: string; + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; + path: string; + description: string; + samplePayload?: unknown; + properties?: PropertyType[]; + pathParameters?: Record; + isBearerTokenRequired?: boolean; +}> = (properties) => { + return ( + <> + +

+ Request +

+
+ + + {properties.description ? ( + {properties.description} + ) : undefined} + {properties.properties && properties.properties.length > 0 ? ( + + {properties.properties.map((property) => { + return ( + + {property.description} + + ); + })} + + ) : undefined} + + + + + + + + + + + + + + + + + ); +}; + +export const ApiEndpointRequestResponse: React.FC<{ + apiUrl: string; + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; + path: string; + description: string; + samplePayload?: unknown; + responses?: unknown; + responseProperties?: PropertyType[]; + responseDescription?: string; + properties?: PropertyType[]; + pathParameters?: Record; + isBearerTokenRequired?: boolean; +}> = ({ isBearerTokenRequired = true, ...properties }) => { + const [isModalOpen, setIsModalOpen] = useState(false); + const [requestPayload, setRequestPayload] = useState( + properties.samplePayload + ? JSON.stringify(properties.samplePayload, null, 2) + : null, + ); + + const [loading, setLoading] = useState(false); + const [error, setError] = useState(""); + const [bearerToken, setBearerToken] = useState(""); + const [actualResponse, setActualResponse] = useState(""); + const [pathParameters, setPathParameters] = useState( + properties.pathParameters || {}, + ); + + const openModal = () => { + setIsModalOpen(true); + }; + + const closeModal = () => { + setIsModalOpen(false); + }; + + const hitRequestWithoutLogin = async () => { + try { + setLoading(true); + setError(""); + const requestPayloadJSON = JSON.parse(requestPayload || "{}"); + const apiUrlWithParams = (properties.apiUrl + + replacePathParameters(properties.path, pathParameters)) as string; + const response = await fetch(apiUrlWithParams, { + method: properties.method, + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${bearerToken}`, + }, + body: properties.method.includes("GET") + ? null + : JSON.stringify(requestPayloadJSON), + }); + const data = await response.json(); + const responseText = JSON.stringify(data, null, 2); + setActualResponse(responseText); + } catch (error) { + setError(`Error: ${error.message}`); + } finally { + setLoading(false); + } + }; + return ( + <> + +

+ Endpoint: + + {properties.method} + {" "} + + {properties.path} + + {isModalOpen ? ( + + ) : ( + + )} +

+
+ + {isModalOpen && ( +
+
+ Parameters +
+ +
+
+
+

Name

+
+
+

Description

+
+
+
+ {isBearerTokenRequired && ( +
+
+

+ Bearer Token required +

+ +

+ To access your Agentverse account, please follow these + steps: +

+
    +
  1. + Log in to your{" "} + + Agentverse + {" "} + account. +
  2. +
  3. + Once logged in, open the developer tools in your web + browser. +
  4. +
  5. + In the developer tools, navigate to the{" "} + Applications tab +
  6. +
  7. + Within the Applications tab, you will find a section for{" "} + cookies. +
  8. +
  9. + Look for a specific cookie named Fauna Name. This + cookie contains your Fauna token +
  10. +
  11. + Copy the value of the Fauna token from the + cookie. +
  12. +
  13. + Paste the copied Fauna token here. +
  14. +
+
+
+ +
+ setBearerToken(e.target.value)} + className="nx-p-2 nx-rounded nx-border nx-border-gray-300 nx-mt-2 nx-w-full" + /> +
+
+ )} + + {/* Render Path Parameters as input fields */} + {Object.keys(pathParameters).map((paramName) => ( +
+
+

+ {paramName} required +

+
+
+ { + // Update the path parameter value + const updatedPathParameters = { ...pathParameters }; + updatedPathParameters[paramName] = e.target.value; + setPathParameters(updatedPathParameters); + }} + className="nx-p-2 nx-rounded nx-border nx-border-gray-300 nx-mt-2 nx-w-full" + /> +
+
+ ))} + + {/* Additional Sample Payload */} + {requestPayload && ( +
+
+

+ Additional Sample Payload +

+
+
+