Skip to content

Commit 90e28d5

Browse files
committed
feat: split path params into separate request objects
1 parent 73c613f commit 90e28d5

17 files changed

Lines changed: 140 additions & 134 deletions

‎examples/vite/docs-playwright/screenshot-attachment-actions.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async function seedChannel(contextA: BrowserContext) {
7373
// Send a message with an image attachment that has custom actions
7474
await pageA.evaluate(`(async () => {
7575
var ch = window.channel;
76-
await ch.sendMessage({
76+
await ch.sendMessage({ message: {
7777
text: '',
7878
attachments: [{
7979
type: 'image',
@@ -85,7 +85,7 @@ async function seedChannel(contextA: BrowserContext) {
8585
{ name: 'vote', value: 'Loathe' },
8686
],
8787
}],
88-
});
88+
} });
8989
})()`);
9090

9191
console.log(' ✅ Channel seeded');

‎examples/vite/docs-playwright/screenshot-misc.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,21 @@ async function captureBaseImageFallbacks(browser: any) {
9191
// Send message with a broken image URL
9292
await page.evaluate(`(async () => {
9393
var ch = window.channel;
94-
await ch.sendMessage({
94+
await ch.sendMessage({ message: {
9595
text: 'Some text',
9696
attachments: [{
9797
type: 'image',
9898
image_url: 'https://invalid-url-that-will-fail.example/broken.jpg',
9999
thumb_url: 'https://invalid-url-that-will-fail.example/broken-thumb.jpg',
100100
title: 'broken-image.jpg',
101101
}],
102-
});
102+
} });
103103
})()`);
104104

105105
// Send message with two images (one broken) for gallery view
106106
await page.evaluate(`(async () => {
107107
var ch = window.channel;
108-
await ch.sendMessage({
108+
await ch.sendMessage({ message: {
109109
text: '',
110110
attachments: [
111111
{
@@ -119,7 +119,7 @@ async function captureBaseImageFallbacks(browser: any) {
119119
thumb_url: 'https://invalid-url-that-will-fail.example/broken2-thumb.jpg',
120120
},
121121
],
122-
});
122+
} });
123123
})()`);
124124

125125
await page.close();
@@ -174,7 +174,7 @@ async function captureConnectionStatus(browser: any) {
174174
// Send a message for context
175175
await page.evaluate(`(async () => {
176176
var ch = window.channel;
177-
await ch.sendMessage({ text: 'Hey, how are you?' });
177+
await ch.sendMessage({ message: { text: 'Hey, how are you?' } });
178178
})()`);
179179
await page.close();
180180

@@ -215,7 +215,7 @@ async function captureCustomNotification(browser: any) {
215215
const page = await createChannel(ctx, channelId, USER_A, USER_A);
216216
await page.evaluate(`(async () => {
217217
var ch = window.channel;
218-
await ch.sendMessage({ text: "Hi! How's it going?!" });
218+
await ch.sendMessage({ message: { text: "Hi! How's it going?!" } });
219219
})()`);
220220
await page.close();
221221

‎examples/vite/docs-playwright/screenshot-reactions.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,46 +75,46 @@ async function seedChannel(contextA: BrowserContext, contextB: BrowserContext) {
7575
// Send messages
7676
const r1: any = await pageA.evaluate(`(async () => {
7777
var ch = window.channel;
78-
var m = await ch.sendMessage({ text: 'What do you think about the new design?' });
78+
var m = await ch.sendMessage({ message: { text: 'What do you think about the new design?' } });
7979
return { id: m.message.id };
8080
})()`);
8181

8282
await pageB.evaluate(`(async () => {
8383
var ch = window.channel;
84-
await ch.sendMessage({ text: 'I love it! The color scheme is much better.' });
84+
await ch.sendMessage({ message: { text: 'I love it! The color scheme is much better.' } });
8585
})()`);
8686

8787
const r3: any = await pageA.evaluate(`(async () => {
8888
var ch = window.channel;
89-
var m = await ch.sendMessage({ text: 'Great to hear! Should we ship it this week?' });
89+
var m = await ch.sendMessage({ message: { text: 'Great to hear! Should we ship it this week?' } });
9090
return { id: m.message.id };
9191
})()`);
9292

9393
// Add reactions to messages
9494
// Marco reacts to his own first message with 'like'
9595
await pageA.evaluate(`(async () => {
9696
var ch = window.channel;
97-
await ch.sendReaction(${JSON.stringify(r1.id)}, { type: 'like' });
97+
await ch.sendReaction({ id: ${JSON.stringify(r1.id)} }, { reaction: { type: 'like' } });
9898
})()`);
9999
// John reacts to first message with 'love'
100100
await pageB.evaluate(`(async () => {
101101
var ch = window.channel;
102-
await ch.sendReaction(${JSON.stringify(r1.id)}, { type: 'love' });
102+
await ch.sendReaction({ id: ${JSON.stringify(r1.id)} }, { reaction: { type: 'love' } });
103103
})()`);
104104
// John reacts to third message with 'like'
105105
await pageB.evaluate(`(async () => {
106106
var ch = window.channel;
107-
await ch.sendReaction(${JSON.stringify(r3.id)}, { type: 'like' });
107+
await ch.sendReaction({ id: ${JSON.stringify(r3.id)} }, { reaction: { type: 'like' } });
108108
})()`);
109109

110110
// Add upvote/downvote reactions (for custom options variant)
111111
await pageA.evaluate(`(async () => {
112112
var ch = window.channel;
113-
await ch.sendReaction(${JSON.stringify(r3.id)}, { type: 'arrow_up' });
113+
await ch.sendReaction({ id: ${JSON.stringify(r3.id)} }, { reaction: { type: 'arrow_up' } });
114114
})()`);
115115
await pageB.evaluate(`(async () => {
116116
var ch = window.channel;
117-
await ch.sendReaction(${JSON.stringify(r1.id)}, { type: 'arrow_up' });
117+
await ch.sendReaction({ id: ${JSON.stringify(r1.id)} }, { reaction: { type: 'arrow_up' } });
118118
})()`);
119119

120120
console.log(' ✅ Channel seeded');

‎examples/vite/docs-playwright/screenshot-system-message.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ async function seedChannel(contextA: BrowserContext, contextB: BrowserContext) {
7070
// Send a few normal messages for context
7171
await pageA.evaluate(`(async () => {
7272
var ch = window.channel;
73-
await ch.sendMessage({ text: 'Hey John, quick question about the project' });
73+
await ch.sendMessage({ message: { text: 'Hey John, quick question about the project' } });
7474
})()`);
7575

7676
await pageB.evaluate(`(async () => {
7777
var ch = window.channel;
78-
await ch.sendMessage({ text: 'Sure, what is it?' });
78+
await ch.sendMessage({ message: { text: 'Sure, what is it?' } });
7979
})()`);
8080

8181
// Inject a system message into channel state via truncate with a system message

‎examples/vite/docs-playwright/screenshot-variants.ts‎

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async function seedChannel(contextA: BrowserContext, contextB: BrowserContext) {
7777
var client = window.client;
7878
7979
// 1. Marco: opening message
80-
var m1 = await ch.sendMessage({ text: 'Hey, John, how are you doing?' });
80+
var m1 = await ch.sendMessage({ message: { text: 'Hey, John, how are you doing?' } });
8181
8282
return { m1Id: m1.message.id };
8383
})()`);
@@ -88,7 +88,7 @@ async function seedChannel(contextA: BrowserContext, contextB: BrowserContext) {
8888
var client = window.client;
8989
9090
// 2. John: reply
91-
var m2 = await ch.sendMessage({ text: 'Hey, hey! Doing well \\u2013 how about you?' });
91+
var m2 = await ch.sendMessage({ message: { text: 'Hey, hey! Doing well \\u2013 how about you?' } });
9292
9393
return { m2Id: m2.message.id };
9494
})()`,
@@ -98,9 +98,9 @@ async function seedChannel(contextA: BrowserContext, contextB: BrowserContext) {
9898
var ch = window.channel;
9999
100100
// 3. Marco: long reply
101-
var m3 = await ch.sendMessage({
101+
var m3 = await ch.sendMessage({ message: {
102102
text: "Ah, thanks for asking! I'm doing quite well, all things considered. Every day brings its own set of challenges and opportunities, but overall, I'm feeling positive and motivated. I've been keeping busy learning new things."
103-
});
103+
} });
104104
105105
return { m3Id: m3.message.id };
106106
})()`);
@@ -111,16 +111,17 @@ async function seedChannel(contextA: BrowserContext, contextB: BrowserContext) {
111111
var ch = window.channel;
112112
var client = window.client;
113113
114-
var m4 = await ch.sendMessage({
114+
var m4 = await ch.sendMessage({ message: {
115115
text: '@Marco hey! How are you?',
116116
mentioned_users: [${JSON.stringify(USER_A)}]
117-
});
117+
} });
118118
119119
// Edit to trigger "Edited" indicator
120-
await client.updateMessage({
121-
id: m4.message.id,
122-
text: '@Marco hey! How are you?',
123-
mentioned_users: [${JSON.stringify(USER_A)}]
120+
await client.updateMessage({ id: m4.message.id }, {
121+
message: {
122+
text: '@Marco hey! How are you?',
123+
mentioned_users: [${JSON.stringify(USER_A)}]
124+
}
124125
});
125126
126127
return { m4Id: m4.message.id };
@@ -130,52 +131,52 @@ async function seedChannel(contextA: BrowserContext, contextB: BrowserContext) {
130131
// 5. John: link message
131132
const result5: any = await pageB.evaluate(`(async () => {
132133
var ch = window.channel;
133-
var m5 = await ch.sendMessage({ text: 'Check out this link:\\nhttps://getstream.io/' });
134+
var m5 = await ch.sendMessage({ message: { text: 'Check out this link:\\nhttps://getstream.io/' } });
134135
return { m5Id: m5.message.id };
135136
})()`);
136137

137138
// 6. Marco: markdown message
138139
const result6: any = await pageA.evaluate(`(async () => {
139140
var ch = window.channel;
140-
var m6 = await ch.sendMessage({
141+
var m6 = await ch.sendMessage({ message: {
141142
text: "Here's some ~~styled text~~ **Markdown**, *too*!"
142-
});
143+
} });
143144
return { m6Id: m6.message.id };
144145
})()`);
145146

146147
// 7. Marco: consecutive messages for grouping demo (V5)
147148
await pageA.evaluate(`(async () => {
148149
var ch = window.channel;
149-
await ch.sendMessage({ text: 'This message right here...' });
150-
await ch.sendMessage({ text: '...will be grouped with this one.' });
151-
await ch.sendMessage({ text: 'And this one as well!' });
150+
await ch.sendMessage({ message: { text: 'This message right here...' } });
151+
await ch.sendMessage({ message: { text: '...will be grouped with this one.' } });
152+
await ch.sendMessage({ message: { text: 'And this one as well!' } });
152153
})()`);
153154

154155
// 8. Add a thread reply on the markdown message (for reply_count in V7/V8)
155156
await pageB.evaluate(`(async () => {
156157
var ch = window.channel;
157-
await ch.sendMessage({
158+
await ch.sendMessage({ message: {
158159
text: 'Nice formatting!',
159160
parent_id: ${JSON.stringify(result6.m6Id)}
160-
});
161+
} });
161162
})()`);
162163

163164
// 9. Add reactions on the mention message (for V8)
164165
await pageA.evaluate(`(async () => {
165166
var ch = window.channel;
166-
await ch.sendReaction(${JSON.stringify(result4.m4Id)}, { type: '+1' });
167+
await ch.sendReaction({ id: ${JSON.stringify(result4.m4Id)} }, { reaction: { type: '+1' } });
167168
})()`);
168169
await pageB.evaluate(`(async () => {
169170
var ch = window.channel;
170-
await ch.sendReaction(${JSON.stringify(result4.m4Id)}, { type: '-1' });
171+
await ch.sendReaction({ id: ${JSON.stringify(result4.m4Id)} }, { reaction: { type: '-1' } });
171172
})()`);
172173

173174
// 10. Marco sends one more message, then soft-deletes it (for V7/V8)
174175
const result10: any = await pageA.evaluate(`(async () => {
175176
var ch = window.channel;
176177
var client = window.client;
177-
var m = await ch.sendMessage({ text: 'Actually, never mind about that last point.' });
178-
await client.deleteMessage(m.message.id);
178+
var m = await ch.sendMessage({ message: { text: 'Actually, never mind about that last point.' } });
179+
await client.deleteMessage({ id: m.message.id });
179180
return { deletedId: m.message.id };
180181
})()`);
181182

0 commit comments

Comments
 (0)