generated from coulomb/repo-seed
Update README with installation options and AI agent prompts
- Add three installation methods (local path, npm link, copy dist) - Fix Quick Start example to use correct API property names - Add "Using AI Coding Agents" section with example prompts - Reference AGENTS.md for detailed integration instructions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
79
README.md
79
README.md
@@ -10,6 +10,42 @@ A JavaScript/TypeScript wrapper for the [Binect API](https://app.binect.de/index
|
||||
|
||||
## Installation
|
||||
|
||||
### Option 1: Local Path Reference (Recommended)
|
||||
|
||||
Since this library is not yet published to npm, reference it via local path in your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"@binect/js": "file:../binect-js"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then run `npm install`. Adjust the path to where you cloned/placed the binect-js folder.
|
||||
|
||||
### Option 2: npm link
|
||||
|
||||
```bash
|
||||
# In the binect-js directory
|
||||
cd /path/to/binect-js
|
||||
npm install
|
||||
npm run build
|
||||
npm link
|
||||
|
||||
# In your project directory
|
||||
cd /path/to/your-project
|
||||
npm link @binect/js
|
||||
```
|
||||
|
||||
### Option 3: Copy the dist folder
|
||||
|
||||
1. Build the library: `cd binect-js && npm install && npm run build`
|
||||
2. Copy the `dist/` folder to your project
|
||||
3. Import directly: `import { BinectClient } from './dist/index.js'`
|
||||
|
||||
### Future: npm (not yet available)
|
||||
|
||||
```bash
|
||||
npm install @binect/js
|
||||
```
|
||||
@@ -30,18 +66,20 @@ const client = new BinectClient({
|
||||
const pdfContent = readFileSync('letter.pdf').toString('base64');
|
||||
const document = await client.documents.upload({
|
||||
content: pdfContent,
|
||||
filename: 'letter.pdf',
|
||||
color: false,
|
||||
duplex: true,
|
||||
simplex: false, // false = duplex (double-sided)
|
||||
envelope: 'DINLANG',
|
||||
franking: 'STANDARD_FRANKING',
|
||||
});
|
||||
|
||||
console.log('Document ID:', document.documentId);
|
||||
console.log('Status:', document.status);
|
||||
console.log('Document ID:', document.id);
|
||||
console.log('Status:', document.status.code, document.status.text);
|
||||
|
||||
// Check if ready to send
|
||||
if (isShippable(document)) {
|
||||
// Send the document as physical mail
|
||||
const sending = await client.sendings.send(document.documentId);
|
||||
await client.sendings.send(String(document.id));
|
||||
console.log('Mail dispatched!');
|
||||
}
|
||||
```
|
||||
@@ -201,6 +239,39 @@ See [architecture/](./architecture/) for Architecture Decision Records (ADRs):
|
||||
|
||||
Official Binect API documentation: https://app.binect.de/index.jsp?id=api
|
||||
|
||||
## Using AI Coding Agents
|
||||
|
||||
This library includes an `AGENTS.md` file with comprehensive instructions for AI coding assistants (Claude, Cursor, Copilot, etc.).
|
||||
|
||||
### Setup for AI Integration
|
||||
|
||||
1. Ensure the binect-js folder is accessible to your project
|
||||
2. Copy `AGENTS.md` to your project root, or ensure the agent can read from binect-js
|
||||
|
||||
### Example Prompts
|
||||
|
||||
**To integrate the library into your project:**
|
||||
|
||||
> I want to add physical mail sending capability using the Binect API. The @binect/js library is located at `../binect-js`. Please:
|
||||
> 1. Add it as a dependency to my package.json
|
||||
> 2. Create a mail service that can upload PDFs and send them as letters
|
||||
> 3. Include proper error handling and status checking
|
||||
>
|
||||
> Read AGENTS.md in the binect-js folder for API documentation.
|
||||
|
||||
**To send a letter:**
|
||||
|
||||
> Using the @binect/js library, create a function that:
|
||||
> 1. Takes a PDF file path and sends it as physical mail via Binect
|
||||
> 2. Polls until the document is ready, then triggers sending
|
||||
> 3. Returns the document ID and final status
|
||||
>
|
||||
> Credentials are in environment variables BINECT_USERNAME and BINECT_PASSWORD.
|
||||
|
||||
**To add mail functionality to an existing service:**
|
||||
|
||||
> Add a `sendPhysicalMail(pdfBuffer: Buffer, options?: { color?: boolean })` method to my NotificationService class. Use the @binect/js library from `../binect-js`. Handle errors appropriately and log the document status.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
Reference in New Issue
Block a user