|
35 | 35 | # Create a channel and send a message to create a thread |
36 | 36 | channel = @client.channel('messaging', channel_id: SecureRandom.uuid, data: { test: true }) |
37 | 37 | channel.create(@random_user[:id]) |
38 | | - |
| 38 | + |
39 | 39 | # Send a message to create a thread |
40 | 40 | message = channel.send_message({ text: 'Thread parent message' }, @random_user[:id]) |
41 | | - |
| 41 | + |
42 | 42 | # Send a reply to create a thread |
43 | 43 | channel.send_message({ text: 'Thread reply', parent_id: message['message']['id'] }, @random_user[:id]) |
44 | | - |
| 44 | + |
45 | 45 | # Query threads with filter |
46 | 46 | filter = { |
47 | 47 | 'created_by_user_id' => { '$eq' => @random_user[:id] } |
48 | 48 | } |
49 | | - |
| 49 | + |
50 | 50 | response = @client.thread.query_threads(filter, user_id: @random_user[:id]) |
51 | | - |
| 51 | + |
52 | 52 | # Verify the response |
53 | 53 | expect(response).to include 'threads' |
54 | 54 | expect(response['threads'].length).to be >= 1 |
55 | | - |
| 55 | + |
56 | 56 | # Clean up |
57 | 57 | channel.delete |
58 | 58 | end |
|
61 | 61 | # Create a channel and send a message to create a thread |
62 | 62 | channel = @client.channel('messaging', channel_id: SecureRandom.uuid, data: { test: true }) |
63 | 63 | channel.create(@random_user[:id]) |
64 | | - |
| 64 | + |
65 | 65 | # Send a message to create a thread |
66 | 66 | message = channel.send_message({ text: 'Thread parent message' }, @random_user[:id]) |
67 | | - |
| 67 | + |
68 | 68 | # Send a reply to create a thread |
69 | 69 | channel.send_message({ text: 'Thread reply', parent_id: message['message']['id'] }, @random_user[:id]) |
70 | | - |
| 70 | + |
71 | 71 | # Query threads with sort |
72 | 72 | sort = { |
73 | 73 | 'created_at' => -1 |
74 | 74 | } |
75 | | - |
| 75 | + |
76 | 76 | response = @client.thread.query_threads(sort: sort, user_id: @random_user[:id]) |
77 | | - |
| 77 | + |
78 | 78 | # Verify the response |
79 | 79 | expect(response).to include 'threads' |
80 | 80 | expect(response['threads'].length).to be >= 1 |
81 | | - |
| 81 | + |
82 | 82 | # Clean up |
83 | 83 | channel.delete |
84 | 84 | end |
|
87 | 87 | # Create a channel and send a message to create a thread |
88 | 88 | channel = @client.channel('messaging', channel_id: SecureRandom.uuid, data: { test: true }) |
89 | 89 | channel.create(@random_user[:id]) |
90 | | - |
| 90 | + |
91 | 91 | # Send a message to create a thread |
92 | 92 | message = channel.send_message({ text: 'Thread parent message' }, @random_user[:id]) |
93 | | - |
| 93 | + |
94 | 94 | # Send a reply to create a thread |
95 | 95 | channel.send_message({ text: 'Thread reply', parent_id: message['message']['id'] }, @random_user[:id]) |
96 | | - |
| 96 | + |
97 | 97 | # Query threads with both filter and sort |
98 | 98 | filter = { |
99 | 99 | 'created_by_user_id' => { '$eq' => @random_user[:id] } |
100 | 100 | } |
101 | | - |
| 101 | + |
102 | 102 | sort = { |
103 | 103 | 'created_at' => -1 |
104 | 104 | } |
105 | | - |
| 105 | + |
106 | 106 | response = @client.thread.query_threads(filter, sort: sort, user_id: @random_user[:id]) |
107 | | - |
| 107 | + |
108 | 108 | # Verify the response |
109 | 109 | expect(response).to include 'threads' |
110 | 110 | expect(response['threads'].length).to be >= 1 |
111 | | - |
| 111 | + |
112 | 112 | # Clean up |
113 | 113 | channel.delete |
114 | 114 | end |
115 | 115 | end |
116 | | -end |
| 116 | +end |
0 commit comments