@company_id = bcfe2f79-8e81-42a3-b551-3a32d49b2b4c @workspace_id = 3328552c-5ccd-4172-b84a-d876d56aa71b @baseURL = http://localhost:3000 @channelsURL = {{baseURL}}/internal/services/channels/v1/companies/{{company_id}}/workspaces/{{workspace_id}} @directChannelsURL = {{baseURL}}/internal/services/channels/v1/companies/{{company_id}}/workspaces/direct ### Login as user 1 # @name login GET {{baseURL}}/api/auth/login @authToken1 = {{login.response.body.token}} @userId1 = {{login.response.body.user.id}} ### Login as user 2 # @name login2 GET {{baseURL}}/api/auth/login @authToken2 = {{login2.response.body.token}} @userId2 = {{login2.response.body.user.id}} ### Login as user 3 # @name login3 GET {{baseURL}}/api/auth/login @authToken3 = {{login3.response.body.token}} @userId3 = {{login3.response.body.user.id}} ### Create a direct channel # @name createDirectChannel POST {{directChannelsURL}}/channels Content-Type: application/json Authorization: Bearer {{authToken1}} { "options": { "members": ["{{userId2}}"] }, "resource": { "icon": "hello", "description": "A direct channel", "channel_group": "twake", "is_default": false, "archived": false } } ### Direct channel details as user 1 should work @directId = {{createDirectChannel.response.body.resource.id}} GET {{directChannelsURL}}/channels/{{directId}} Content-Type: application/json Authorization: Bearer {{authToken1}} ### Direct channel details as user 2 (member) should work GET {{directChannelsURL}}/channels/{{directId}} Content-Type: application/json Authorization: Bearer {{authToken2}} ### Direct channel details as user 3 (not member) should not work GET {{directChannelsURL}}/channels/{{directId}} Content-Type: application/json Authorization: Bearer {{authToken3}} ### Direct channel members GET {{directChannelsURL}}/channels/{{directId}}/members?websockets=true Content-Type: application/json Authorization: Bearer {{authToken1}} ### List direct channels for user in company @authToken = {{login.response.body.token}} GET {{directChannelsURL}}/channels?websockets=true&limit=5 Content-Type: application/json Authorization: Bearer {{authToken1}} ### Update the direct channel description POST {{directChannelsURL}}/channels/{{directId}} Content-Type: application/json Authorization: Bearer {{authToken1}} { "resource": { "description": "A new direct channel description" } } ### Update the direct channel name will do nothing since the name is useless POST {{directChannelsURL}}/channels/{{directId}} Content-Type: application/json Authorization: Bearer {{authToken1}} { "resource": { "name": "A new direct channel name" } } ### Update the direct channel member settings for current user POST {{directChannelsURL}}/channels/{{directId}}/members/{{userId1}} Content-Type: application/json Authorization: Bearer {{authToken1}} { "resource": { "favorite": true, "notification_level": "all" } } ### Update another user member settings should fail POST {{directChannelsURL}}/channels/{{directId}}/members/{{userId2}} Content-Type: application/json Authorization: Bearer {{authToken1}} { "resource": { "favorite": true, "notification_level": "none" } } ### Get member settings as user1 GET {{directChannelsURL}}/channels/{{directId}}/members/{{userId1}} Content-Type: application/json Authorization: Bearer {{authToken1}} ### Get member settings as user2 GET {{directChannelsURL}}/channels/{{directId}}/members/{{userId2}} Content-Type: application/json Authorization: Bearer {{authToken2}} ### Get other member settings should fail GET {{directChannelsURL}}/channels/{{directId}}/members/{{userId2}} Content-Type: application/json Authorization: Bearer {{authToken1}} ### Leave a direct channel of another user should fail DELETE {{directChannelsURL}}/channels/{{directId}}/members/{{userId2}} Content-Type: application/json Authorization: Bearer {{authToken1}} ### Leave a direct channel should not fail DELETE {{directChannelsURL}}/channels/{{directId}}/members/{{userId1}} Content-Type: application/json Authorization: Bearer {{authToken1}}