Add startsWith parameter to getTopics method

Added optional startsWith parameter to topics query:
- Filters topics by prefix on the server side
- Updated TypeScript types
- Supports response with startsWith field

Version bumped to 0.7.5

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-16 20:42:00 +01:00
parent 53206d306b
commit e052464482
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@xtr-dev/rondevu-client", "name": "@xtr-dev/rondevu-client",
"version": "0.7.4", "version": "0.7.5",
"description": "TypeScript client for Rondevu topic-based peer discovery and signaling server", "description": "TypeScript client for Rondevu topic-based peer discovery and signaling server",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",

View File

@@ -143,11 +143,13 @@ export class RondevuOffers {
async getTopics(options?: { async getTopics(options?: {
limit?: number; limit?: number;
offset?: number; offset?: number;
startsWith?: string;
}): Promise<{ }): Promise<{
topics: TopicInfo[]; topics: TopicInfo[];
total: number; total: number;
limit: number; limit: number;
offset: number; offset: number;
startsWith?: string;
}> { }> {
const params = new URLSearchParams(); const params = new URLSearchParams();
@@ -159,6 +161,10 @@ export class RondevuOffers {
params.set('offset', options.offset.toString()); params.set('offset', options.offset.toString());
} }
if (options?.startsWith) {
params.set('startsWith', options.startsWith);
}
const url = `${this.baseUrl}/topics${ const url = `${this.baseUrl}/topics${
params.toString() ? '?' + params.toString() : '' params.toString() ? '?' + params.toString() : ''
}`; }`;