Skip to content

Commit aa522f0

Browse files
authored
Merge pull request #197 from dimitrov-d/main
Add RPC module SDK docs
2 parents 2b05a4f + 1cbba0e commit aa522f0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

build/5-apillon-sdk.md

+36
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,42 @@ const { jobs: cloudFunctionJobs } = await cloudFunctions.cloudFunction(newCloudF
482482
await cloudFunctionJobs[0].delete();
483483
```
484484

485+
## RPCs
486+
487+
The RPC module provides functionalities for managing RPC API keys and listing available endpoints. This module is essential for interacting with the Apillon platform's RPC services dynamically.
488+
489+
### Usage example
490+
491+
```typescript
492+
import { Rpc } from '@apillon/sdk';
493+
import { getConfig } from './helpers/helper';
494+
495+
// Initialize the RPC module
496+
const rpc = new Rpc({
497+
key: 'yourApiKey',
498+
secret: 'yourApiSecret',
499+
});
500+
501+
// Create a new API key
502+
const apiKey = await rpc.createApiKey({
503+
name: 'Test API Key',
504+
description: 'Test Description',
505+
});
506+
console.log('API Key created:', apiKey.name);
507+
508+
// List all API keys
509+
const { items } = await rpc.listApiKeys();
510+
console.log('Total API Keys:', items.length);
511+
512+
// Get a specific API key by ID
513+
const apiKey = await rpc.apiKey(apiKeyId).get();
514+
console.log('API Key UUID:', apiKey.uuid);
515+
516+
// List all available endpoints
517+
const endpoints = await rpc.listEndpoints();
518+
console.log('Total Endpoints:', endpoints.length);
519+
```
520+
485521
## Social
486522

487523
The Social module provides functionalities for managing social hubs and channels within the Apillon platform. This includes creating, listing, and interacting with hubs and channels. In the background it utilizes Grill.chat, a mobile-friendly, anonymous chat application powered by Subsocial.

0 commit comments

Comments
 (0)