Skip to content

schramm-famm/ether

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ether

Ether is responsible for CRUD operations on conversation metadata, conversation content, and conversation members. It uses MariaDB to store the conversation metadata and members, and stores the conversation content as an HTML file in the file system.

Environment Variables

  • ETHER_DB_USERNAME: username for accessing MariaDB
  • ETHER_DB_PASSWORD: password for accessing MariaDB
  • ETHER_DB_LOCATION: host and port where MariaDB is located (ex: "localhost:3306")
  • ETHER_DB_DATABASE: name of the database to use in MariaDB
  • ETHER_DB_CONTENT_DIR: directory where conversation content HTML files are stored

API Documentation

The following APIs are protected by heimdall, so requests must have the Authorization header set to the value Bearer <token>, where <token> is the token generated by heimdall. heimdall will then forward the request with an added User-ID header with the user ID value from the token. This user is treated as the "session user" for all requests.

APIS

POST /ether/v1/conversations

Creates a new conversation with just the session user as an owner member.

Request body format

{
    "name": "Friends",
    "description": "Casual banter",
    "avatar_url": "example.com/image.png"
}

Response format

201 Created

{
    "id": 1
    "name": "Friends",
    "description": "Casual banter",
    "avatar_url": "example.com/image.png"
}

GET /ether/v1/conversations/{conversation_id}

Retrieves a conversation's metadata.

Response format

200 OK

{
    "id": 1
    "name": "Friends",
    "description": "Casual banter",
    "avatar_url": "example.com/image.png"
}

Notable error codes: 404 Not Found

PATCH /ether/v1/conversations/{conversation_id}

Updates a conversation's metadata.

Request body format

{
    "name": "Acquintances...",
    "description": "Casual banter",
    "avatar_url": "example.com/image.png"
}

Response format

200 OK

{
    "id": 1
    "name": "Acquintances...",
    "description": "Casual banter",
    "avatar_url": "example.com/image.png"
}

Notable error codes: 403 Forbidden, 404 Not Found

DELETE /ether/v1/conversations/{conversation_id}

Deletes a conversation.

Response format

204 No Content

Notable error codes: 403 Forbidden, 404 Not Found

GET /ether/v1/conversations/{conversation_id}/content

Retrieve's a conversation's content.

Response format

200 OK

<div>hello world!</div>
<div>sup</div>

Notable error codes: 403 Forbidden, 404 Not Found

POST /ether/v1/conversations/{conversation_id}/users

Adds a member to a conversation.

Request body format

{
    "user_id": 2,
    "conversation_id": 1,
    "role": "user"
}

Response format

201 Created

{
    "user_id": 2,
    "conversation_id": 1,
    "role": "user",
    "nickname": "",
    "pending": true,
    "last_opened": "2020-02-19 18:32:00"
}

Notable error codes: 403 Forbidden, 404 Not Found, 409 Conflict

GET /ether/v1/conversations/{conversation_id}/users/{user_id}

Retrieves a conversation member.

Response format

200 OK

{
    "user_id": 2,
    "conversation_id": 1,
    "role": "user",
    "nickname": "",
    "pending": true,
    "last_opened": "2020-02-19 18:32:00"
}

Notable error codes: 404 Not Found

GET /ether/v1/conversations/{conversation_id}/users

Retrieves all of a conversation's member.

Response format

200 OK

{
    "users": [
        {
            "user_id": 1,
            "conversation_id": 1,
            "role": "owner",
            "nickname": "",
            "pending": false,
            "last_opened": "2020-02-19 18:39:00"
        },
        {
            "user_id": 1,
            "conversation_id": 2,
            "role": "user",
            "nickname": "",
            "pending": true,
            "last_opened": "2020-02-19 18:32:00"
        }
    ]
}

Notable error codes: 404 Not Found

PATCH /ether/v1/conversations/{conversation_id}/user_id

Updates a member in a conversation.

Request body format

{
    "user_id": 3,
    "conversation_id": 1,
    "role": "admin",
    "nickname": "An alright guy"
}

Response format

200 OK

{
    "user_id": 3,
    "conversation_id": 1,
    "role": "admin",
    "nickname": "An alright guy",
    "pending": false,
    "last_opened": "2020-02-19 18:44:00"
}

Notable error codes: 403 Forbidden, 404 Not Found

DELETE /ether/v1/conversations/{conversation_id}/user_id

Deletes a member from a conversation.

Response format

204 No Content

Notable error codes: 403 Forbidden, 404 Not Found

About

πŸ’¬ Service for managing conversations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •