chatapi

command module
v0.0.0-...-ab1ab75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 16 Imported by: 0

README

chatAPI

A chat server that provides an HTTP API to handle user chats and messages

HTTP Methods

"GET" / — Checking the server connection

    example: 
        "GET" :9000/
"GET" /ping — Checking the server connection

    example: 
        "GET" :9000/ping
"POST" /user — Add a new user
    options:
        name — User name 

    example: 
        "POST" :9000/user?name=Jack
"POST" /chat — Create a new chat. Need JSON body

    example: 
        "POST" :9000/chat
{
    "name" : "Alex's birthday",
    "users": ["3333x45if", "454x8548o", "112y5641654"]
}
"POST" /message — Send a message to the chat. Need JSON body

    example: 
        "POST" :9000/message
{
    "chat" : "xx45499e0",
    "author": "321x4445d",
    "text": "Hi there"
}
"GET" /user/chats — Get a list of the user's chats
    options:
        user — User id

    example: 
        "GET" :9000/user/chat?user=333x541i
"GET" /chat/messages — Get a list of chat messages
    options:
        chat — Chat id

    example: 
        "GET" :9000/chat/messages?chat=xx000fd1
"DELETE" /chat — Delete chat by id
    options:
        chat — Chat id

    example: 
        "DELETE" :9000/chat?chat=xx000fd1
"DELETE" /message — Delete message by id
    options:
        chat — Chat id
        message — Message id

    example: 
        "DELETE" :9000/message?chat=xx000fd1,message=00031
"DELETE" /chat/all — Delete all chats

    example: 
        "DELETE" :9000/chat/all

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL