@company_id = bcfe2f79-8e81-42a3-b551-3a32d49b2b4c @workspace_id = 3328552c-5ccd-4172-b84a-d876d56aa71b @user_id = 3328552c-5ccd-4172-b84a-d876d56aa71c @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 # @name login GET {{baseURL}}/api/auth/login @authToken = {{login.response.body.token}} @currentUserId = {{login.response.body.user.id}} ### List workspace channels with all websockets GET {{channelsURL}}/channels?websockets=true&limit=5 Content-Type: application/json Authorization: Bearer {{authToken}} ### List user channels with all websockets @authToken = {{login.response.body.token}} GET {{channelsURL}}/channels?websockets=true&mine=true&limit=5 Content-Type: application/json Authorization: Bearer {{authToken}} ### Create a channel # @name createChannel POST {{channelsURL}}/channels Content-Type: application/json Authorization: Bearer {{authToken}} { "resource": { "name": "My channel", "icon": "twake logo", "description": "This channel allow twake's team to chat easily", "channel_group": "twake", "visibility": "public", "is_default": true, "archived": false } } ### Get a single channel @getId = {{createChannel.response.body.resource.id}} GET {{channelsURL}}/channels/{{getId}} Authorization: Bearer {{authToken}} ### Update a channel @updateId = {{createChannel.response.body.resource.id}} POST {{channelsURL}}/channels/{{updateId}} Content-Type: application/json Authorization: Bearer {{authToken}} { "resource": { "name": "My channel", "description": "Hello world", "is_default": false } } ### Delete a channel @deleteId = {{createChannel.response.body.resource.id}} DELETE {{channelsURL}}/channels/{{deleteId}} Authorization: Bearer {{authToken}} ### Get all channel members GET {{channelsURL}}/channels/{{getId}}/members?websockets=true Content-Type: application/json Authorization: Bearer {{authToken}} ### Add current user as member to a channel (join channel) POST {{channelsURL}}/channels/{{getId}}/members Content-Type: application/json Authorization: Bearer {{authToken}} { "resource": { "user_id": "{{currentUserId}}" } } ### Get a channel member GET {{channelsURL}}/channels/{{getId}}/members/{{currentUserId}} Content-Type: application/json Authorization: Bearer {{authToken}} ### Update current channel member POST {{channelsURL}}/channels/{{getId}}/members/{{currentUserId}} Content-Type: application/json Authorization: Bearer {{authToken}} { "resource": { "favorite": true, "notification_level": "none", "hello": 1 } } ### Current user quits the channel DELETE {{channelsURL}}/channels/{{getId}}/members/{{currentUserId}} Content-Type: application/json Authorization: Bearer {{authToken}} ### Errors Tests ### Call without the JWT token should HTTP 401 GET {{channelsURL}}/channels Content-Type: application/json ### Get a channel which may not exists GET {{channelsURL}}/channels/0b0e1492-f596-46b9-a4fb-c12d71b2696e Authorization: Bearer {{authToken}}