@@ -1,19 +0,0 @@
|
||||
@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
|
||||
@badgesURL = {{baseURL}}/internal/services/notifications/v1/badges
|
||||
|
||||
# @name login
|
||||
GET {{baseURL}}/api/auth/login
|
||||
|
||||
@authToken = {{login.response.body.token}}
|
||||
@currentUserId = {{login.response.body.user.id}}
|
||||
|
||||
### List badges with all websockets
|
||||
|
||||
GET {{badgesURL}}/?company_id={{company_id}}&websockets=true&limit=5
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
@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}}
|
||||
|
||||
### Create a channel
|
||||
|
||||
# @name createChannel
|
||||
POST {{channelsURL}}/channels
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"name": "My channel",
|
||||
"icon": "tdrive logo",
|
||||
"description": "This channel allow tdrive's team to chat easily",
|
||||
"channel_group": "tdrive",
|
||||
"visibility": "public",
|
||||
"is_default": true,
|
||||
"archived": false
|
||||
}
|
||||
}
|
||||
|
||||
### Get a single channel
|
||||
|
||||
@getId = {{createChannel.response.body.resource.id}}
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}
|
||||
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}}"
|
||||
}
|
||||
}
|
||||
|
||||
### Mark the channel as read/unread
|
||||
|
||||
POST {{channelsURL}}/channels/{{getId}}/read
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
@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": "tdrive logo",
|
||||
"description": "This channel allow tdrive's team to chat easily",
|
||||
"channel_group": "tdrive",
|
||||
"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}}
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
@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": "tdrive",
|
||||
"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}}
|
||||
@@ -0,0 +1,251 @@
|
||||
# The task is:
|
||||
# to find all the files that I havee access to, it shoud be a doc files,
|
||||
# that was modified during the last week and share with my by Diana Potoking
|
||||
|
||||
|
||||
### Drop index
|
||||
DELETE https://localhost:9200/tdrive_files_extended
|
||||
|
||||
### Delete Index
|
||||
DELETE https://localhost:9200/drive_files
|
||||
|
||||
### Create index
|
||||
PUT https://localhost:9200/tdrive_files_extended
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"drive_files": {
|
||||
"aliases": {},
|
||||
"mappings": {
|
||||
"_source": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
### Check that it is created
|
||||
GET https://localhost:9200/_cat/indices
|
||||
|
||||
### GET index info
|
||||
GET https://localhost:9200/drive_files
|
||||
|
||||
### GET data to the index
|
||||
GET https://localhost:9200/drive_files/_doc/8c03c5a1-0146-11ee-82d9-f503f8a58e9d
|
||||
Content-Type: application/json
|
||||
|
||||
### Put data to the index
|
||||
PUT https://localhost:9200/tdrive_files_extended/_doc/0001
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"file_name": "file0001.txt",
|
||||
"access_info": [
|
||||
{
|
||||
"type": "user",
|
||||
"id": "user01",
|
||||
"level": "read",
|
||||
"grantor": "user02"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
###
|
||||
PUT https://localhost:9200/tdrive_files_extended/_doc/8c03c5a1-0146-11ee-82d9-f503f8a58e9d
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"file_name": "file0002.png",
|
||||
"access_info": [
|
||||
{
|
||||
"type": "user",
|
||||
"id": "user01",
|
||||
"level": "read",
|
||||
"grantor": "user03"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
### Search all in the index by last_modified
|
||||
GET https://localhost:9200/drive_files/_search
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": {
|
||||
|
||||
"bool": {
|
||||
"boost": 1,
|
||||
"must": [
|
||||
{
|
||||
"range":
|
||||
{
|
||||
"last_modified": {
|
||||
"gte": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"range":
|
||||
{
|
||||
"last_modified": {
|
||||
"lte": "1685958426348"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match": {
|
||||
"access_entities": {
|
||||
"query": "edfb30e0-0385-11ee-80e8-41892804174d",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"access_entities": {
|
||||
"query": "edd447f1-0385-11ee-80e8-41892804174d",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"minimum_should_match": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match": {
|
||||
"company_id": {
|
||||
"query": "edd447f1-0385-11ee-80e8-41892804174d",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"minimum_should_match": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### Search all in the index and order by name
|
||||
GET https://localhost:9200/drive_files/_search
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": {
|
||||
"bool": {
|
||||
"boost": 1,
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match": {
|
||||
"access_entities": {
|
||||
"query": "12fb6a40-03b3-11ee-af31-a569970b7f74",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"access_entities": {
|
||||
"query": "12f290a1-03b3-11ee-af31-a569970b7f74",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"minimum_should_match": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match": {
|
||||
"company_id": {
|
||||
"query": "12f290a1-03b3-11ee-af31-a569970b7f74",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"minimum_should_match": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sort": [
|
||||
{
|
||||
"name": "asc"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
### Search all in the index and order by name
|
||||
GET https://localhost:9200/drive_files/_search
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": {
|
||||
"bool": {
|
||||
"boost": 1,
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match": {
|
||||
"access_entities": {
|
||||
"query": "4090dce0-03ba-11ee-97d7-fb8fa15d86a1",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"access_entities": {
|
||||
"query": "40808931-03ba-11ee-97d7-fb8fa15d86a1",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"minimum_should_match": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match": {
|
||||
"company_id": {
|
||||
"query": "40808931-03ba-11ee-97d7-fb8fa15d86a1",
|
||||
"operator": "AND"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"minimum_should_match": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
@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
|
||||
|
||||
@authTokenUser1 = {{login.response.body.token}}
|
||||
@currentUserId1 = {{login.response.body.user.id}}
|
||||
|
||||
### Login as user 2
|
||||
|
||||
# @name login2
|
||||
GET {{baseURL}}/api/auth/login
|
||||
|
||||
@authTokenUser2 = {{login2.response.body.token}}
|
||||
@currentUserId2 = {{login2.response.body.user.id}}
|
||||
|
||||
### User 1 creates a private channel
|
||||
|
||||
# @name createChannel
|
||||
POST {{channelsURL}}/channels
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"name": "My private channel",
|
||||
"icon": "tdrive logo",
|
||||
"description": "This channel allow tdrive's team to chat easily",
|
||||
"channel_group": "tdrive",
|
||||
"visibility": "private",
|
||||
"is_default": true,
|
||||
"archived": false
|
||||
}
|
||||
}
|
||||
|
||||
### Get the private channel
|
||||
|
||||
@getId = {{createChannel.response.body.resource.id}}
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### Get all channel members
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
|
||||
### The user 2 tries to join the private channel, this should reject
|
||||
|
||||
POST {{channelsURL}}/channels/{{getId}}/members
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"user_id": "{{currentUserId2}}"
|
||||
}
|
||||
}
|
||||
|
||||
### The user 1 adds the user 2 as channel member, this should be OK
|
||||
|
||||
POST {{channelsURL}}/channels/{{getId}}/members
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"user_id": "{{currentUserId2}}"
|
||||
}
|
||||
}
|
||||
|
||||
### User 2 lists his channels
|
||||
|
||||
GET {{channelsURL}}/channels?websockets=true&mine=true&limit=5
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### Get all channel members as user 1
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### Get all channel members as user 2
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### User 1 leaves the channel he created
|
||||
|
||||
DELETE {{channelsURL}}/channels/{{getId}}/members/{{currentUserId1}}
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### User 2 leaves the channel: Error since he is the last member, he can not leave
|
||||
|
||||
DELETE {{channelsURL}}/channels/{{getId}}/members/{{currentUserId2}}
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
@@ -1,70 +0,0 @@
|
||||
@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 private channel
|
||||
|
||||
# @name createChannel
|
||||
POST {{channelsURL}}/channels
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"name": "My private channel",
|
||||
"icon": "tdrive logo",
|
||||
"description": "A private channel",
|
||||
"channel_group": "tdrive",
|
||||
"visibility": "private",
|
||||
"is_default": true,
|
||||
"archived": false
|
||||
}
|
||||
}
|
||||
|
||||
### Get the private channel
|
||||
|
||||
@getId = {{createChannel.response.body.resource.id}}
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
### Get members of the private channel
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
### Get current user as member
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members/{{currentUserId}}
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
### Current user quits the private channel will fail because he is the only one in it
|
||||
|
||||
DELETE {{channelsURL}}/channels/{{getId}}/members/{{currentUserId}}
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
@@ -1,108 +0,0 @@
|
||||
@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
|
||||
|
||||
@authTokenUser1 = {{login.response.body.token}}
|
||||
@currentUserId1 = {{login.response.body.user.id}}
|
||||
|
||||
### Login as user 2
|
||||
|
||||
# @name login2
|
||||
GET {{baseURL}}/api/auth/login
|
||||
|
||||
@authTokenUser2 = {{login2.response.body.token}}
|
||||
@currentUserId2 = {{login2.response.body.user.id}}
|
||||
|
||||
### User 1 creates a public channel
|
||||
|
||||
# @name createChannel
|
||||
POST {{channelsURL}}/channels
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"name": "A public channel",
|
||||
"icon": "tdrive logo",
|
||||
"description": "This channel allow tdrive's team to chat easily",
|
||||
"channel_group": "tdrive",
|
||||
"visibility": "public",
|
||||
"is_default": true,
|
||||
"archived": false
|
||||
}
|
||||
}
|
||||
|
||||
### Get the public channel
|
||||
|
||||
@getId = {{createChannel.response.body.resource.id}}
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### Get all channel members
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
|
||||
### The user 2 joins the public channel, this should be OK
|
||||
|
||||
POST {{channelsURL}}/channels/{{getId}}/members
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"user_id": "{{currentUserId2}}"
|
||||
}
|
||||
}
|
||||
|
||||
### Get all channel members, there are now 2 members
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### User 1 lists his channels
|
||||
|
||||
GET {{channelsURL}}/channels?mine=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### User 2 lists his channels
|
||||
|
||||
GET {{channelsURL}}/channels?mine=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### User 2 leaves the channel
|
||||
|
||||
DELETE {{channelsURL}}/channels/{{getId}}/members/{{currentUserId2}}
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### Get all channel members, there are now 1 member, the initial one
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### List channels as user 2, current channel appears since it is public
|
||||
|
||||
GET {{channelsURL}}/channels
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### User 2 list his public channels, current channel does not appear since he left it
|
||||
|
||||
GET {{channelsURL}}/channels?mine=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
@@ -1,85 +0,0 @@
|
||||
@company_id = bcfe2f79-8e81-42a3-b551-3a32d49b2b4c
|
||||
@workspace_id = 3328552c-5ccd-4172-b84a-d876d56aa71a
|
||||
|
||||
|
||||
@baseURL = http://localhost:3000
|
||||
@tabsURL = {{baseURL}}/internal/services/channels/v1/companies/{{company_id}}/workspaces/{{workspace_id}}/channels
|
||||
@channelsURL = {{baseURL}}/internal/services/channels/v1/companies/{{company_id}}/workspaces/{{workspace_id}}
|
||||
|
||||
|
||||
# @name login
|
||||
GET {{baseURL}}/api/auth/login
|
||||
|
||||
@authToken = {{login.response.body.token}}
|
||||
@currentUserId = {{login.response.body.user.id}}
|
||||
|
||||
|
||||
### List channel's tab with all websockets
|
||||
GET {{tabsURL}}/{{channelId}}/tabs?websockets=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": "tdrive logo",
|
||||
"description": "This channel allow tdrive's team to chat easily",
|
||||
"channel_group": "tdrive",
|
||||
"visibility": "public",
|
||||
"is_default": true,
|
||||
"archived": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### Create a tab
|
||||
# @name createTab
|
||||
@channelId = {{createChannel.response.body.resource.id}}
|
||||
|
||||
POST {{tabsURL}}/{{channelId}}/tabs
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
// WARNING : special caracter in tab's name does not work
|
||||
"name": "My tabs name",
|
||||
"configuration": "JSON"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### Get a single tab
|
||||
@getId = {{createTab.response.body.resource.id}}
|
||||
|
||||
GET {{tabsURL}}/{{channelId}}/tabs/{{getId}}
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
|
||||
### Update a tab
|
||||
@updateId = {{createTab.response.body.resource.id}}
|
||||
|
||||
POST {{tabsURL}}/{{channelId}}/tabs/{{updateId}}
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"name": "My tab updated",
|
||||
"configuration": "JSON"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### Delete a tab
|
||||
@deleteId = {{createTab.response.body.resource.id}}
|
||||
|
||||
DELETE {{tabsURL}}/{{channelId}}/tabs/{{deleteId}}
|
||||
Authorization: Bearer {{authToken}}
|
||||
Reference in New Issue
Block a user