Skip to content

Commit

Permalink
Merge pull request #76 from nevermined-io/fix/ci_docs
Browse files Browse the repository at this point in the history
fix: docs
  • Loading branch information
aaitor authored Oct 18, 2024
2 parents b383e37 + 1a6090a commit d41f5d4
Show file tree
Hide file tree
Showing 46 changed files with 531 additions and 110 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
yarn
npm pack
- name: Update Docs
run: |
yarn run doc
- name: Update CHANGELOG.md
id: changelog
run: |
Expand All @@ -51,7 +55,16 @@ jobs:
commit_branch=${commit_branch//[[:blank:]]/}
fi
commit_branch="${commit_branch//remotes\/origin\//}"
echo "COMMIT_BRANCH=${commit_branch}" >> $GITHUB_ENV
echo "COMMIT_BRANCH=${commit_branch}" >> $GITHUB_ENV
- name: Commit Documentation
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated docs update
commit_options: '--no-verify --signoff'
file_pattern: docs/*
disable_globbing: true
branch: ${{ env.COMMIT_BRANCH }}

- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
53 changes: 34 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ yarn add @nevermined-io/payments
npm install @nevermined-io/payments
```

### Initialize the payments library (standalone)

```typescript
const payments = Payments.getInstance({
nvmApiKey: myBuilderNvmApiKey,
environment: "testing",
})
```

### Initialize the payments library (browser)
### Initialize the payments library

This is a browser only method. Here we have an example using react.
For a full example please refer to [payments-nextjs-example](https://github.com/nevermined-io/tutorials/tree/main/payments-nextjs-example)
Expand Down Expand Up @@ -60,16 +51,40 @@ export default function Home() {

The `init()` method should be called immediately after the app returns the user to `returnUrl`.

### Create a plan
### Create a Payments Plan

Once the app is initialized we can create a credits plan:
Once the app is initialized we can create a payment plan:

```typescript
await paymentsBuilder.createCreditsPlan({
name: 'E2E Payments Plan',
description: 'description',
price: 0n,
tokenAddress: ERC20_ADDRESS,
amountOfCredits: 100
})
const planDID = await payments.createCreditsPlan({
name: "My AI Payments Plan",
description: "AI stuff",
price: 10000000n,
tokenAddress: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
amountOfCredits: 30,
tags: ["test"]
})
```

### Create an AI Agent/Service

```typescript
const agentEndpoints: Endpoint[] = [
{ 'POST': `https://example.com/api/v1/agents/(.*)/tasks` },
{ 'GET': `https://example.com/api/v1/agents/(.*)/tasks/(.*)` }
]

const agentDID = await paymentsBuilder.createService({
planDID,
name: 'E2E Payments Agent',
description: 'description',
serviceType: 'agent',
serviceChargeType: 'fixed',
authType: 'bearer',
token: 'changeme',
amountOfCredits: 1,
endpoints: agentEndpoints,
openEndpoints: ['https://example.com/api/v1/rest/docs-json']
})
```

7 changes: 7 additions & 0 deletions docs/assets/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
--dark-hl-7: #4EC9B0;
--light-hl-8: #098658;
--dark-hl-8: #B5CEA8;
--light-hl-9: #000000FF;
--dark-hl-9: #D4D4D4;
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
Expand All @@ -31,6 +33,7 @@
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--code-background: var(--light-code-background);
} }

Expand All @@ -44,6 +47,7 @@
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--code-background: var(--dark-code-background);
} }

Expand All @@ -57,6 +61,7 @@
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--code-background: var(--light-code-background);
}

Expand All @@ -70,6 +75,7 @@
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--code-background: var(--dark-code-background);
}

Expand All @@ -82,4 +88,5 @@
.hl-6 { color: var(--hl-6); }
.hl-7 { color: var(--hl-7); }
.hl-8 { color: var(--hl-8); }
.hl-9 { color: var(--hl-9); }
pre, code { background: var(--code-background); }
2 changes: 1 addition & 1 deletion docs/assets/navigation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d41f5d4

Please sign in to comment.