@xtr-dev/rondevu-client 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/offers.d.ts +6 -1
- package/dist/offers.js +5 -2
- package/package.json +1 -1
package/dist/offers.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface CreateOfferRequest {
|
|
|
3
3
|
sdp: string;
|
|
4
4
|
topics: string[];
|
|
5
5
|
ttl?: number;
|
|
6
|
+
secret?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface Offer {
|
|
8
9
|
id: string;
|
|
@@ -12,6 +13,8 @@ export interface Offer {
|
|
|
12
13
|
createdAt?: number;
|
|
13
14
|
expiresAt: number;
|
|
14
15
|
lastSeen: number;
|
|
16
|
+
secret?: string;
|
|
17
|
+
hasSecret?: boolean;
|
|
15
18
|
answererPeerId?: string;
|
|
16
19
|
answerSdp?: string;
|
|
17
20
|
answeredAt?: number;
|
|
@@ -55,11 +58,13 @@ export declare class RondevuOffers {
|
|
|
55
58
|
getTopics(options?: {
|
|
56
59
|
limit?: number;
|
|
57
60
|
offset?: number;
|
|
61
|
+
startsWith?: string;
|
|
58
62
|
}): Promise<{
|
|
59
63
|
topics: TopicInfo[];
|
|
60
64
|
total: number;
|
|
61
65
|
limit: number;
|
|
62
66
|
offset: number;
|
|
67
|
+
startsWith?: string;
|
|
63
68
|
}>;
|
|
64
69
|
/**
|
|
65
70
|
* Get own offers
|
|
@@ -72,7 +77,7 @@ export declare class RondevuOffers {
|
|
|
72
77
|
/**
|
|
73
78
|
* Answer an offer
|
|
74
79
|
*/
|
|
75
|
-
answer(offerId: string, sdp: string): Promise<void>;
|
|
80
|
+
answer(offerId: string, sdp: string, secret?: string): Promise<void>;
|
|
76
81
|
/**
|
|
77
82
|
* Get answers to your offers
|
|
78
83
|
*/
|
package/dist/offers.js
CHANGED
|
@@ -81,6 +81,9 @@ export class RondevuOffers {
|
|
|
81
81
|
if (options?.offset) {
|
|
82
82
|
params.set('offset', options.offset.toString());
|
|
83
83
|
}
|
|
84
|
+
if (options?.startsWith) {
|
|
85
|
+
params.set('startsWith', options.startsWith);
|
|
86
|
+
}
|
|
84
87
|
const url = `${this.baseUrl}/topics${params.toString() ? '?' + params.toString() : ''}`;
|
|
85
88
|
const response = await this.fetchFn(url, {
|
|
86
89
|
method: 'GET',
|
|
@@ -126,14 +129,14 @@ export class RondevuOffers {
|
|
|
126
129
|
/**
|
|
127
130
|
* Answer an offer
|
|
128
131
|
*/
|
|
129
|
-
async answer(offerId, sdp) {
|
|
132
|
+
async answer(offerId, sdp, secret) {
|
|
130
133
|
const response = await this.fetchFn(`${this.baseUrl}/offers/${encodeURIComponent(offerId)}/answer`, {
|
|
131
134
|
method: 'POST',
|
|
132
135
|
headers: {
|
|
133
136
|
'Content-Type': 'application/json',
|
|
134
137
|
Authorization: RondevuAuth.createAuthHeader(this.credentials),
|
|
135
138
|
},
|
|
136
|
-
body: JSON.stringify({ sdp }),
|
|
139
|
+
body: JSON.stringify({ sdp, secret }),
|
|
137
140
|
});
|
|
138
141
|
if (!response.ok) {
|
|
139
142
|
const error = await response.json().catch(() => ({ error: 'Unknown error' }));
|